CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
SiStripBadAPVandHotStripAlgorithmFromClusterOccupancy.h
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: SiStripQuality
4 // Class: SiStripBadAPVandHotStripAlgorithmFromClusterOccupancy
5 //
13 //
14 // Original Author: Gordon KAUSSEN
15 // Created: Wed Jan 28 09:11:10 CEST 2009
16 // $Id: SiStripBadAPVandHotStripAlgorithmFromClusterOccupancy.h,v 1.2 2011/02/14 18:19:38 kaussen Exp $
17 //
18 //
19 
20 #ifndef CalibTracker_SiStripQuality_SiStripBadAPVandHotStripAlgorithmFromClusterOccupancy_H
21 #define CalibTracker_SiStripQuality_SiStripBadAPVandHotStripAlgorithmFromClusterOccupancy_H
22 
23 // system include files
24 #include <memory>
25 #include <vector>
26 #include <map>
27 #include <sstream>
28 #include <iostream>
29 
30 #include "TMath.h"
31 #include "TTree.h"
32 #include "TFile.h"
33 
38 
41 
42 class SiStripQuality;
43 
45 
46 public:
48 
50 
52 
53  void setProbabilityThreshold(long double prob){prob_=prob;}
54  void setMinNumEntries(unsigned short m){MinNumEntries_=m;}
56  void setLowOccupancyThreshold(long double low_occupancy){lowoccupancy_=low_occupancy;}
57  void setHighOccupancyThreshold(long double high_occupancy){highoccupancy_=high_occupancy;}
58  void setAbsoluteLowThreshold(long double absolute_low){absolutelow_=absolute_low;}
59  void setNumberIterations(int number_iterations){numberiterations_=number_iterations;}
60  void setAbsoluteOccupancyThreshold(long double absolute_occupancy){absolute_occupancy_=absolute_occupancy;}
61  void setNumberOfEvents(double Nevents){Nevents_=Nevents;}
62  void setMinNumOfEvents();
63  void setOutputFileName(std::string OutputFileName, bool WriteOutputFile, std::string DQMOutfileName, bool WriteDQMHistograms){OutFileName_=OutputFileName; WriteOutputFile_=WriteOutputFile; DQMOutfileName_=DQMOutfileName; WriteDQMHistograms_=WriteDQMHistograms;}
64  void setTrackerGeometry(const TrackerGeometry* tkgeom){TkGeom = tkgeom;}
66 
67  private:
68 
69  struct Apv{
70 
71  uint32_t detrawId;
74  double apvMedian[6];
76  TH1F* th1f[6];
77  int NEntries[6];
78  int NEmptyBins[6];
79  };
80 
81  void CalculateMeanAndRMS(std::vector<Apv>, std::pair<double,double>*, int);
82 
83  void AnalyzeOccupancy(SiStripQuality*, std::vector<Apv>&, std::pair<double,double>*, std::vector<unsigned int>&, edm::ESHandle<SiStripQuality>&);
84 
85  void iterativeSearch(Apv&,std::vector<unsigned int>&,int);
86 
87  void evaluatePoissonian(std::vector<long double>& , long double& meanVal);
88 
89  void setBasicTreeParameters(int detid);
90 
92 
94 
95  long double prob_;
96  unsigned short MinNumEntries_;
97  unsigned short MinNumEntriesPerStrip_;
98  long double lowoccupancy_;
99  long double highoccupancy_;
100  long double absolutelow_;
102  double Nevents_;
103  long double absolute_occupancy_;
104  double minNevents_;
105  std::string OutFileName_;
107  std::string DQMOutfileName_;
111 
113 
114  double stripOccupancy[6][128];
115  double stripWeight[6][128];
116 
117  std::vector<Apv> medianValues_TIB_Layer1; std::pair<double,double> MeanAndRms_TIB_Layer1[7];
118  std::vector<Apv> medianValues_TIB_Layer2; std::pair<double,double> MeanAndRms_TIB_Layer2[7];
119  std::vector<Apv> medianValues_TIB_Layer3; std::pair<double,double> MeanAndRms_TIB_Layer3[7];
120  std::vector<Apv> medianValues_TIB_Layer4; std::pair<double,double> MeanAndRms_TIB_Layer4[7];
121 
122  std::vector<Apv> medianValues_TOB_Layer1; std::pair<double,double> MeanAndRms_TOB_Layer1[7];
123  std::vector<Apv> medianValues_TOB_Layer2; std::pair<double,double> MeanAndRms_TOB_Layer2[7];
124  std::vector<Apv> medianValues_TOB_Layer3; std::pair<double,double> MeanAndRms_TOB_Layer3[7];
125  std::vector<Apv> medianValues_TOB_Layer4; std::pair<double,double> MeanAndRms_TOB_Layer4[7];
126  std::vector<Apv> medianValues_TOB_Layer5; std::pair<double,double> MeanAndRms_TOB_Layer5[7];
127  std::vector<Apv> medianValues_TOB_Layer6; std::pair<double,double> MeanAndRms_TOB_Layer6[7];
128 
129  std::vector<Apv> medianValues_TIDPlus_Disc1; std::pair<double,double> MeanAndRms_TIDPlus_Disc1[7];
130  std::vector<Apv> medianValues_TIDPlus_Disc2; std::pair<double,double> MeanAndRms_TIDPlus_Disc2[7];
131  std::vector<Apv> medianValues_TIDPlus_Disc3; std::pair<double,double> MeanAndRms_TIDPlus_Disc3[7];
132 
133  std::vector<Apv> medianValues_TIDMinus_Disc1; std::pair<double,double> MeanAndRms_TIDMinus_Disc1[7];
134  std::vector<Apv> medianValues_TIDMinus_Disc2; std::pair<double,double> MeanAndRms_TIDMinus_Disc2[7];
135  std::vector<Apv> medianValues_TIDMinus_Disc3; std::pair<double,double> MeanAndRms_TIDMinus_Disc3[7];
136 
137  std::vector<Apv> medianValues_TECPlus_Disc1; std::pair<double,double> MeanAndRms_TECPlus_Disc1[7];
138  std::vector<Apv> medianValues_TECPlus_Disc2; std::pair<double,double> MeanAndRms_TECPlus_Disc2[7];
139  std::vector<Apv> medianValues_TECPlus_Disc3; std::pair<double,double> MeanAndRms_TECPlus_Disc3[7];
140  std::vector<Apv> medianValues_TECPlus_Disc4; std::pair<double,double> MeanAndRms_TECPlus_Disc4[7];
141  std::vector<Apv> medianValues_TECPlus_Disc5; std::pair<double,double> MeanAndRms_TECPlus_Disc5[7];
142  std::vector<Apv> medianValues_TECPlus_Disc6; std::pair<double,double> MeanAndRms_TECPlus_Disc6[7];
143  std::vector<Apv> medianValues_TECPlus_Disc7; std::pair<double,double> MeanAndRms_TECPlus_Disc7[7];
144  std::vector<Apv> medianValues_TECPlus_Disc8; std::pair<double,double> MeanAndRms_TECPlus_Disc8[7];
145  std::vector<Apv> medianValues_TECPlus_Disc9; std::pair<double,double> MeanAndRms_TECPlus_Disc9[7];
146 
147  std::vector<Apv> medianValues_TECMinus_Disc1; std::pair<double,double> MeanAndRms_TECMinus_Disc1[7];
148  std::vector<Apv> medianValues_TECMinus_Disc2; std::pair<double,double> MeanAndRms_TECMinus_Disc2[7];
149  std::vector<Apv> medianValues_TECMinus_Disc3; std::pair<double,double> MeanAndRms_TECMinus_Disc3[7];
150  std::vector<Apv> medianValues_TECMinus_Disc4; std::pair<double,double> MeanAndRms_TECMinus_Disc4[7];
151  std::vector<Apv> medianValues_TECMinus_Disc5; std::pair<double,double> MeanAndRms_TECMinus_Disc5[7];
152  std::vector<Apv> medianValues_TECMinus_Disc6; std::pair<double,double> MeanAndRms_TECMinus_Disc6[7];
153  std::vector<Apv> medianValues_TECMinus_Disc7; std::pair<double,double> MeanAndRms_TECMinus_Disc7[7];
154  std::vector<Apv> medianValues_TECMinus_Disc8; std::pair<double,double> MeanAndRms_TECMinus_Disc8[7];
155  std::vector<Apv> medianValues_TECMinus_Disc9; std::pair<double,double> MeanAndRms_TECMinus_Disc9[7];
156 
157 
158  TFile* f;
159  TTree* apvtree;
160 
161  uint32_t detrawid;
162  int subdetid;
164  int disc;
165  int isback;
169  int isstereo;
174 
181 
184  int isBad;
185 
186  TTree* striptree;
189 
190  int isHot;
195  double poissonProb;
196 
197  int ishot[128];
200  double stripoccupancy[128];
201  int striphits[128];
202  double poissonprob[128];
203 
204  std::stringstream ss;
205 
206  std::ostringstream oss;
207 
209 
211  TProfile* tmp_prof;
212 
213  // Histograms
214  // indexes in these arrays are [SubDetId-2][LayerN]
215  // histograms for [SubDetId-2][0] are global for the subdetector
216  // histogram for [0][0] is global for the tracker
217 
219  TH1F* medianOccupancy[5][10];
220  TH1F* absoluteOccupancy[5][10];
221 
222  std::vector<TH2F*> distanceVsStripNumber;
223  std::vector<TProfile*> pfxDistanceVsStripNumber;
224  std::vector<TH1F*> projXDistanceVsStripNumber;
225  std::vector<TH1F*> projYDistanceVsStripNumber;
226 
227  std::vector<TH2F*> occupancyVsStripNumber;
228  std::vector<TProfile*> pfxOccupancyVsStripNumber;
229  std::vector<TH1F*> projYOccupancyVsStripNumber;
231  std::vector<TProfile*> pfxOccupancyHotStripsVsStripNumber;
234  std::vector<TProfile*> pfxOccupancyGoodStripsVsStripNumber;
236 
237  std::vector<TH2F*> poissonProbVsStripNumber;
238  std::vector<TProfile*> pfxPoissonProbVsStripNumber;
239  std::vector<TH1F*> projYPoissonProbVsStripNumber;
241  std::vector<TProfile*> pfxPoissonProbHotStripsVsStripNumber;
246 
247  std::vector<TH2F*> nHitsVsStripNumber;
248  std::vector<TProfile*> pfxNHitsVsStripNumber;
249  std::vector<TH1F*> projXNHitsVsStripNumber;
250  std::vector<TH1F*> projYNHitsVsStripNumber;
251  std::vector<TH2F*> nHitsHotStripsVsStripNumber;
252  std::vector<TProfile*> pfxNHitsHotStripsVsStripNumber;
255  std::vector<TH2F*> nHitsGoodStripsVsStripNumber;
256  std::vector<TProfile*> pfxNHitsGoodStripsVsStripNumber;
259 
260  std::vector<std::string> subDetName;
261  std::vector<unsigned int> nLayers;
262  std::vector<std::string> layerName;
263 
264  std::vector<unsigned int> vHotStripsInModule;
265  unsigned int distance;
266  unsigned int distanceR, distanceL;
267 
268  std::string outfilename;
269 };
270 #endif
271 
string OutputFileName
void setOutputFileName(std::string OutputFileName, bool WriteOutputFile, std::string DQMOutfileName, bool WriteDQMHistograms)
__gnu_cxx::hash_map< unsigned int, boost::shared_ptr< TH1F > > QualityHistosMap
void CalculateMeanAndRMS(std::vector< Apv >, std::pair< double, double > *, int)
void AnalyzeOccupancy(SiStripQuality *, std::vector< Apv > &, std::pair< double, double > *, std::vector< unsigned int > &, edm::ESHandle< SiStripQuality > &)
void extractBadAPVSandStrips(SiStripQuality *, HistoMap &, edm::ESHandle< SiStripQuality > &)