CMS 3D CMS Logo

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 //
17 //
18 
19 #ifndef CalibTracker_SiStripQuality_SiStripBadAPVandHotStripAlgorithmFromClusterOccupancy_H
20 #define CalibTracker_SiStripQuality_SiStripBadAPVandHotStripAlgorithmFromClusterOccupancy_H
21 
22 // system include files
23 #include <memory>
24 #include <vector>
25 #include <map>
26 #include <sstream>
27 #include <iostream>
28 
29 #include "TMath.h"
30 #include "TTree.h"
31 #include "TFile.h"
32 
37 
39 
40 class SiStripQuality;
41 class TrackerTopology;
42 
44 public:
48 
50 
52 
53  void setProbabilityThreshold(long double prob) { prob_ = prob; }
54  void setMinNumEntries(unsigned short m) { MinNumEntries_ = m; }
55  void setMinNumEntriesPerStrip(unsigned short m) { MinNumEntriesPerStrip_ = 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();
64  bool WriteOutputFile,
65  std::string DQMOutfileName,
66  bool WriteDQMHistograms) {
69  DQMOutfileName_ = DQMOutfileName;
70  WriteDQMHistograms_ = WriteDQMHistograms;
71  }
72  void setTrackerGeometry(const TrackerGeometry* tkgeom) { TkGeom = tkgeom; }
74 
75 private:
76  struct Apv {
77  uint32_t detrawId;
80  double apvMedian[6];
82  TH1F* th1f[6];
83  int NEntries[6];
84  int NEmptyBins[6];
85  };
86 
87  void CalculateMeanAndRMS(const std::vector<Apv>&, std::pair<double, double>*, int);
88 
90  std::vector<Apv>&,
91  std::pair<double, double>*,
92  std::vector<unsigned int>&,
94 
95  void iterativeSearch(Apv&, std::vector<unsigned int>&, int);
96 
97  void evaluatePoissonian(std::vector<long double>&, long double& meanVal);
98 
99  void setBasicTreeParameters(int detid);
100 
102 
103  void fillStripDQMHistograms();
104 
105  long double prob_;
106  long double ratio_;
107  unsigned short MinNumEntries_;
108  unsigned short MinNumEntriesPerStrip_;
109  long double lowoccupancy_;
110  long double highoccupancy_;
111  long double absolutelow_;
113  double Nevents_;
114  long double absolute_occupancy_;
115  double minNevents_;
123 
125 
126  double stripOccupancy[6][128];
127  double stripWeight[6][128];
128 
129  std::vector<Apv> medianValues_TIB_Layer1;
130  std::pair<double, double> MeanAndRms_TIB_Layer1[7];
131  std::vector<Apv> medianValues_TIB_Layer2;
132  std::pair<double, double> MeanAndRms_TIB_Layer2[7];
133  std::vector<Apv> medianValues_TIB_Layer3;
134  std::pair<double, double> MeanAndRms_TIB_Layer3[7];
135  std::vector<Apv> medianValues_TIB_Layer4;
136  std::pair<double, double> MeanAndRms_TIB_Layer4[7];
137 
138  std::vector<Apv> medianValues_TOB_Layer1;
139  std::pair<double, double> MeanAndRms_TOB_Layer1[7];
140  std::vector<Apv> medianValues_TOB_Layer2;
141  std::pair<double, double> MeanAndRms_TOB_Layer2[7];
142  std::vector<Apv> medianValues_TOB_Layer3;
143  std::pair<double, double> MeanAndRms_TOB_Layer3[7];
144  std::vector<Apv> medianValues_TOB_Layer4;
145  std::pair<double, double> MeanAndRms_TOB_Layer4[7];
146  std::vector<Apv> medianValues_TOB_Layer5;
147  std::pair<double, double> MeanAndRms_TOB_Layer5[7];
148  std::vector<Apv> medianValues_TOB_Layer6;
149  std::pair<double, double> MeanAndRms_TOB_Layer6[7];
150 
151  std::vector<Apv> medianValues_TIDPlus_Disc1;
152  std::pair<double, double> MeanAndRms_TIDPlus_Disc1[7];
153  std::vector<Apv> medianValues_TIDPlus_Disc2;
154  std::pair<double, double> MeanAndRms_TIDPlus_Disc2[7];
155  std::vector<Apv> medianValues_TIDPlus_Disc3;
156  std::pair<double, double> MeanAndRms_TIDPlus_Disc3[7];
157 
158  std::vector<Apv> medianValues_TIDMinus_Disc1;
159  std::pair<double, double> MeanAndRms_TIDMinus_Disc1[7];
160  std::vector<Apv> medianValues_TIDMinus_Disc2;
161  std::pair<double, double> MeanAndRms_TIDMinus_Disc2[7];
162  std::vector<Apv> medianValues_TIDMinus_Disc3;
163  std::pair<double, double> MeanAndRms_TIDMinus_Disc3[7];
164 
165  std::vector<Apv> medianValues_TECPlus_Disc1;
166  std::pair<double, double> MeanAndRms_TECPlus_Disc1[7];
167  std::vector<Apv> medianValues_TECPlus_Disc2;
168  std::pair<double, double> MeanAndRms_TECPlus_Disc2[7];
169  std::vector<Apv> medianValues_TECPlus_Disc3;
170  std::pair<double, double> MeanAndRms_TECPlus_Disc3[7];
171  std::vector<Apv> medianValues_TECPlus_Disc4;
172  std::pair<double, double> MeanAndRms_TECPlus_Disc4[7];
173  std::vector<Apv> medianValues_TECPlus_Disc5;
174  std::pair<double, double> MeanAndRms_TECPlus_Disc5[7];
175  std::vector<Apv> medianValues_TECPlus_Disc6;
176  std::pair<double, double> MeanAndRms_TECPlus_Disc6[7];
177  std::vector<Apv> medianValues_TECPlus_Disc7;
178  std::pair<double, double> MeanAndRms_TECPlus_Disc7[7];
179  std::vector<Apv> medianValues_TECPlus_Disc8;
180  std::pair<double, double> MeanAndRms_TECPlus_Disc8[7];
181  std::vector<Apv> medianValues_TECPlus_Disc9;
182  std::pair<double, double> MeanAndRms_TECPlus_Disc9[7];
183 
184  std::vector<Apv> medianValues_TECMinus_Disc1;
185  std::pair<double, double> MeanAndRms_TECMinus_Disc1[7];
186  std::vector<Apv> medianValues_TECMinus_Disc2;
187  std::pair<double, double> MeanAndRms_TECMinus_Disc2[7];
188  std::vector<Apv> medianValues_TECMinus_Disc3;
189  std::pair<double, double> MeanAndRms_TECMinus_Disc3[7];
190  std::vector<Apv> medianValues_TECMinus_Disc4;
191  std::pair<double, double> MeanAndRms_TECMinus_Disc4[7];
192  std::vector<Apv> medianValues_TECMinus_Disc5;
193  std::pair<double, double> MeanAndRms_TECMinus_Disc5[7];
194  std::vector<Apv> medianValues_TECMinus_Disc6;
195  std::pair<double, double> MeanAndRms_TECMinus_Disc6[7];
196  std::vector<Apv> medianValues_TECMinus_Disc7;
197  std::pair<double, double> MeanAndRms_TECMinus_Disc7[7];
198  std::vector<Apv> medianValues_TECMinus_Disc8;
199  std::pair<double, double> MeanAndRms_TECMinus_Disc8[7];
200  std::vector<Apv> medianValues_TECMinus_Disc9;
201  std::pair<double, double> MeanAndRms_TECMinus_Disc9[7];
202 
203  TFile* f;
204  TTree* apvtree;
205 
206  uint32_t detrawid;
207  int subdetid;
209  int disc;
210  int isback;
214  int isstereo;
219 
226 
229  int isBad;
230 
231  TTree* striptree;
234 
235  int isHot;
241  double avgAPVHits;
242  double poissonProb;
243 
244  int ishot[128];
247  double stripoccupancy[128];
248  int striphits[128];
249  double poissonprob[128];
250  double medianapvhits[6];
251  double avgapvhits[6];
252 
253  std::stringstream ss;
254 
255  std::ostringstream oss;
256 
257  DQMStore* dqmStore;
258 
259  MonitorElement* tmp;
260  TProfile* tmp_prof;
261 
262  // Histograms
263  // indexes in these arrays are [SubDetId-2][LayerN]
264  // histograms for [SubDetId-2][0] are global for the subdetector
265  // histogram for [0][0] is global for the tracker
266 
268  TH1F* medianOccupancy[5][10];
269  TH1F* absoluteOccupancy[5][10];
270 
271  std::vector<TH2F*> distanceVsStripNumber;
272  std::vector<TProfile*> pfxDistanceVsStripNumber;
273  std::vector<TH1F*> projXDistanceVsStripNumber;
274  std::vector<TH1F*> projYDistanceVsStripNumber;
275 
276  std::vector<TH2F*> occupancyVsStripNumber;
277  std::vector<TProfile*> pfxOccupancyVsStripNumber;
278  std::vector<TH1F*> projYOccupancyVsStripNumber;
280  std::vector<TProfile*> pfxOccupancyHotStripsVsStripNumber;
283  std::vector<TProfile*> pfxOccupancyGoodStripsVsStripNumber;
285 
286  std::vector<TH2F*> poissonProbVsStripNumber;
287  std::vector<TProfile*> pfxPoissonProbVsStripNumber;
288  std::vector<TH1F*> projYPoissonProbVsStripNumber;
290  std::vector<TProfile*> pfxPoissonProbHotStripsVsStripNumber;
295 
296  std::vector<TH2F*> nHitsVsStripNumber;
297  std::vector<TProfile*> pfxNHitsVsStripNumber;
298  std::vector<TH1F*> projXNHitsVsStripNumber;
299  std::vector<TH1F*> projYNHitsVsStripNumber;
300  std::vector<TH2F*> nHitsHotStripsVsStripNumber;
301  std::vector<TProfile*> pfxNHitsHotStripsVsStripNumber;
304  std::vector<TH2F*> nHitsGoodStripsVsStripNumber;
305  std::vector<TProfile*> pfxNHitsGoodStripsVsStripNumber;
308 
309  std::vector<std::string> subDetName;
310  std::vector<unsigned int> nLayers;
311  std::vector<std::string> layerName;
312 
313  std::vector<unsigned int> vHotStripsInModule;
314  unsigned int distance;
315  unsigned int distanceR, distanceL;
316 
318 };
319 #endif
string OutputFileName
WriteOutputFile
Name of root file for histograms.
void setOutputFileName(std::string OutputFileName, bool WriteOutputFile, std::string DQMOutfileName, bool WriteDQMHistograms)
void CalculateMeanAndRMS(const std::vector< Apv > &, std::pair< double, double > *, int)
__gnu_cxx::hash_map< unsigned int, std::shared_ptr< TH1F > > QualityHistosMap
SiStripBadAPVandHotStripAlgorithmFromClusterOccupancy(const edm::ParameterSet &, const TrackerTopology *)
void AnalyzeOccupancy(SiStripQuality *, std::vector< Apv > &, std::pair< double, double > *, std::vector< unsigned int > &, edm::ESHandle< SiStripQuality > &)
void extractBadAPVSandStrips(SiStripQuality *, HistoMap &, edm::ESHandle< SiStripQuality > &)