Skip to content
Snippets Groups Projects
Commit 813fc930 authored by Shohei Shirabe's avatar Shohei Shirabe Committed by Graeme Stewart
Browse files

fix ave. num. of links with error (SCT_Monitoring-00-06-48)

parent 737a9ef0
No related merge requests found
......@@ -23,7 +23,6 @@
#include "InDetConditionsSummaryService/IInDetConditionsSvc.h"
#include "SCT_ConditionsServices/ISCT_FlaggedConditionSvc.h"
#include "SCT_ConditionsServices/ISCT_ConfigurationConditionsSvc.h"
#include "SCT_Monitoring/SCT_MonitoringNumbers.h"
/** Forward declarations*/
......@@ -58,7 +57,9 @@ class SCTErrMonTool : public ManagedMonitorToolBase
//@}
private:
static const int NREGIONS_INC_GENERAL=SCT_Monitoring::N_REGIONS+1;
static const int NREGIONS_INC_GENERAL=SCT_Monitoring::N_REGIONS+1;
typedef TProfile2D * Prof2_t;
typedef std::vector<Prof2_t> VecProf2_t;
StatusCode checkRateHists();
StatusCode fillByteStreamErrors();
StatusCode bookErrHistos();
......@@ -126,6 +127,37 @@ class SCTErrMonTool : public ManagedMonitorToolBase
StatusCode bookPositiveEndCapConfMaps();
StatusCode bookNegativeEndCapConfMaps();
int nLink0[4088];
int nLink1[4088];
bool goodModules[4088];
VecProf2_t m_pnoiseoccupancymapHistoVectorECC;
VecProf2_t m_pnoiseoccupancymapHistoVectorECCSide0;
VecProf2_t m_pnoiseoccupancymapHistoVectorECCSide1;
VecProf2_t m_pnoiseoccupancymapHistoVectorBar;
VecProf2_t m_pnoiseoccupancymapHistoVectorBarSide0;
VecProf2_t m_pnoiseoccupancymapHistoVectorBarSide1;
VecProf2_t m_pnoiseoccupancymapHistoVectorECA;
VecProf2_t m_pnoiseoccupancymapHistoVectorECASide0;
VecProf2_t m_pnoiseoccupancymapHistoVectorECASide1;
bool noSidesHit;
bool oneSideHit;
int nZero[4088];
int nOne[4088];
int nOneSide0[4088];
int nOneSide1[4088];
int nLayer[4088];
int nEta[4088];
int nPhi[4088];
int nNonGoodModule[4088];
int tbin;
int modNum;
float ratio;
float ratioside0;
float ratioside1;
int fillByteStreamErrorsHelper(const std::set<IdentifierHash>* errors, TH2F *histo[NREGIONS_INC_GENERAL][SCT_Monitoring::N_ENDCAPSx2], bool lumiHist, int err_type, bool b_maskedlinks);
void numByteStreamErrors(const std::set<IdentifierHash>* errors, int& ntot, int& nbar, int& neca, int& necc);
StatusCode bookErrHistosHelper(MonGroup & mg, TString name, TString title, TString titlehitmap, TProfile2D* &tprof, TH2F* &th, const int layer, const bool barrel=true);
......@@ -176,6 +208,7 @@ class SCTErrMonTool : public ManagedMonitorToolBase
///SCT Helper class
const SCT_ID* m_pSCTHelper;
//@}
/// ---------------------------------------
......@@ -190,8 +223,9 @@ class SCTErrMonTool : public ManagedMonitorToolBase
StatusCode resetCondDBMaps();
StatusCode resetConfigurationDetails();
/// Pointer to 1D histogram of Number of SCT Clusters per Event
/// Pointer to 1D histogram of Number of SCT Clusters per Even
TProfile * m_Conf[4];
TProfile * m_ConfRN[4];
// TProfile * m_ConfOnline[4];
TH1F * m_ConfOnline[4];
TProfile * m_MaskedLinksVsLB[4];
......@@ -234,14 +268,25 @@ class SCTErrMonTool : public ManagedMonitorToolBase
/** a handle on the Hist/TTree registration service */
ServiceHandle<ITHistSvc> m_thistSvc;
ServiceHandle<ISCT_ByteStreamErrorsSvc> m_byteStreamErrSvc;
// ServiceHandle<IInDetConditionsSvc> m_pSummarySvc;
bool m_checkBadModules;
bool m_ignore_RDO_cut_online;
float m_errThreshold;
float m_effThreshold;
int m_noiseThreshold;
bool getHisto(const int lyr, const int reg, const int type, TH2* histo[2]);
bool getHistoRecent(const int lyr, const int reg, const int type, TH2* histo[2]);
float calculateNoiseOccupancyUsingRatioMethod(const float numberOneSide, const float numberZeroSide);
float calculateOneSideNoiseOccupancyUsingRatioMethod(const float numberOneSide, const float numberZeroSide);
bool isBarrel(const int moduleNumber);
bool isEndcap(const int moduleNumber);
bool isEndcapA(const int moduleNumber);
bool isEndcapC(const int moduleNumber);
//@}
Prof2_t
prof2Factory(const std::string & name, const std::string & title, const unsigned int&, VecProf2_t & storageVector);
};
#endif
......@@ -97,7 +97,7 @@ private:
Double_t &theta, Double_t &phi);
/** Method to find the chip just before a given hit */
Int_t previousChip (Double_t xl, Int_t side, Int_t isub);
Int_t previousChip (Double_t xl, Int_t side, bool swap);
/** Computes residual of a hit to a track */
Double_t getResidual (const Identifier& surfaceID,
......@@ -119,6 +119,8 @@ private:
Int_t nbinx, Double_t * xbins,
Int_t nbiny, Double_t * ybins);
const SCT_ID* m_pSCTHelper;
const InDetDD::SCT_DetectorManager* m_pManager;
std::string m_TrackName;
IChronoStatSvc * m_chrono;
const TrackCollection * m_tracks;
......@@ -127,6 +129,7 @@ private:
std::map < Identifier, unsigned int > * m_badChips;
ServiceHandle<MagField::IMagFieldSvc> m_fieldServiceHandle;
Int_t m_DetectorMode;
Int_t m_RunningMode;
Int_t m_minPixelHits;
......
......@@ -109,8 +109,14 @@ private:
bool goodModules[N_MOD_BARREL + 2 * N_MOD_ENDCAPS];
VecProf2_t m_pnoiseoccupancymapHistoVectorECC;
VecProf2_t m_pnoiseoccupancymapHistoVectorECCSide0;
VecProf2_t m_pnoiseoccupancymapHistoVectorECCSide1;
VecProf2_t m_pnoiseoccupancymapHistoVectorBar;
VecProf2_t m_pnoiseoccupancymapHistoVectorBarSide0;
VecProf2_t m_pnoiseoccupancymapHistoVectorBarSide1;
VecProf2_t m_pnoiseoccupancymapHistoVectorECA;
VecProf2_t m_pnoiseoccupancymapHistoVectorECASide0;
VecProf2_t m_pnoiseoccupancymapHistoVectorECASide1;
int nOneSideModule;
int nTwoSideModule;
......@@ -133,6 +139,8 @@ private:
int nZero[N_MOD_BARREL + 2 * N_MOD_ENDCAPS];
int nOne[N_MOD_BARREL + 2 * N_MOD_ENDCAPS];
int nOneSide0[N_MOD_BARREL + 2 * N_MOD_ENDCAPS];
int nOneSide1[N_MOD_BARREL + 2 * N_MOD_ENDCAPS];
int nLayer[N_MOD_BARREL + 2 * N_MOD_ENDCAPS];
int nEta[N_MOD_BARREL + 2 * N_MOD_ENDCAPS];
int nPhi[N_MOD_BARREL + 2 * N_MOD_ENDCAPS];
......@@ -146,6 +154,8 @@ private:
int tbin;
int modNum;
float ratio;
float ratioside0;
float ratioside1;
static const long NBINS_LBs = 2000;
......@@ -184,7 +194,9 @@ private:
H1_t m_N11ECA_vsLB[N_DISKS];
H1_t m_NOb;
H1_t m_NObSide;
H1_t m_NO;
H1_t m_NOSide;
H1_t m_NOb_layer[N_BARRELS];
H1_t m_NOb_layer_vsLB[N_BARRELS];
H1_t m_NOECC_disk[N_DISKS];
......@@ -192,6 +204,9 @@ private:
H1_t m_NOECA_disk[N_DISKS];
H1_t m_NOECA_disk_vsLB[N_DISKS];
H1_t m_NOEC;
H1_t m_NOECSide;
H1_t m_NOECASide;
H1_t m_NOECCSide;
H1_t m_NOEC_Outer;
H1_t m_NOEC_ShortMiddle;
H1_t m_NOEC_Inner;
......@@ -238,6 +253,7 @@ private:
// Calculate the local angle of incidence
int findAnglesToWaferSurface ( const double (&vec)[3], const double &sinAlpha, const Identifier &id, double &theta, double &phi );
float calculateNoiseOccupancyUsingRatioMethod(const float numberOneSide, const float numberZeroSide);
float calculateOneSideNoiseOccupancyUsingRatioMethod(const float numberOneSide, const float numberZeroSide);
bool isBarrel(const int moduleNumber);
bool isEndcap(const int moduleNumber);
bool isEndcapA(const int moduleNumber);
......
......@@ -40,6 +40,7 @@
#include "InDetReadoutGeometry/TRT_DetectorManager.h"
#include "InDetReadoutGeometry/PixelDetectorManager.h"
#include "InDetReadoutGeometry/SCT_DetectorManager.h"
#include "InDetReadoutGeometry/SiDetectorElement.h"
//Conditions
#include "InDetConditionsSummaryService/InDetHierarchy.h"
#include "InDetRawData/SCT3_RawData.h"
......@@ -75,6 +76,7 @@ namespace Trk {
namespace InDetDD{
class SiDetectorElement;
class SiCellId;
class SCT_DetectorManagaer;
}
namespace{//anonymous namespace for functions at file scope
......@@ -135,6 +137,8 @@ using std::string;
SCTHitEffMonTool::SCTHitEffMonTool(const string& type,const string& name, const IInterface* parent) :
ManagedMonitorToolBase(type,name,parent),
mgr(nullptr),
m_pSCTHelper(0),
m_pManager(0),
m_TrackName("ResolvedSCTTracks"),//original track collection
m_chrono(nullptr),
m_tracks(nullptr),//original tracks
......@@ -342,6 +346,8 @@ StatusCode SCTHitEffMonTool::initialize(){
INFO ("Retrieved tool " << m_rotcreator);
CHECK(m_fieldServiceHandle.retrieve());
detStore()->retrieve( m_pSCTHelper, "SCT_ID");
detStore()->retrieve( m_pManager, "SCT");
m_path = (m_useIDGlobal) ? ("/InDetGlobal/") : ("");
if (m_superDetailed) m_detailed = true;
......@@ -1247,7 +1253,10 @@ StatusCode SCTHitEffMonTool::fillHistograms(){
// Check bad chips
Bool_t nearBadChip(false);
Int_t chipPos(previousChip(xl, side, isub));
IdentifierHash waferHash = m_pSCTHelper->wafer_hash(surfaceID);
const InDetDD::SiDetectorElement* pElement = m_pManager->getDetectorElement(waferHash);
bool swap=(pElement->swapPhiReadoutDirection()) ? true : false;
Int_t chipPos(previousChip(xl, side, swap));
unsigned int status(0);
std::map<Identifier, unsigned int>::const_iterator badChip(m_badChips->find(module_id));
if (badChip != m_badChips->end()){
......@@ -1495,17 +1504,14 @@ StatusCode SCTHitEffMonTool::failCut(Bool_t value, std::string name){
return StatusCode::SUCCESS;
}
Int_t SCTHitEffMonTool::previousChip(Double_t xl, Int_t side, Int_t isub){
Int_t SCTHitEffMonTool::previousChip(Double_t xl, Int_t side, bool swap){
Float_t nStrips(768.);
Float_t stripWidth(79.95e-3);
Float_t nChips(6.);
Float_t xLeftEdge(xl + nStrips / 2. * stripWidth); // xl defined wrt center of module, convert to edge of module
Int_t chipPos(int(xLeftEdge / (stripWidth * nStrips) * nChips));
if (chipPos < 0 or chipPos > 5) VERBOSE("Wrong chip position " << chipPos << " " << xl << " " << side);
chipPos = std::max(chipPos, 0);
chipPos = std::min(chipPos, 5);
if (isub == 0) chipPos = 5 - chipPos; // Correction for inverted numbering in EC
if (side == 1) chipPos = 11 - chipPos;
if(side==0) chipPos = swap ? 5-chipPos : chipPos;
else chipPos = swap ? 11-chipPos : 6+chipPos;
return chipPos;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment