test
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 //
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 
40 
41 class SiStripQuality;
42 class TrackerTopology;
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(const 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  long double ratio_;
97  unsigned short MinNumEntries_;
98  unsigned short MinNumEntriesPerStrip_;
99  long double lowoccupancy_;
100  long double highoccupancy_;
101  long double absolutelow_;
103  double Nevents_;
104  long double absolute_occupancy_;
105  double minNevents_;
113 
115 
116  double stripOccupancy[6][128];
117  double stripWeight[6][128];
118 
119  std::vector<Apv> medianValues_TIB_Layer1; std::pair<double,double> MeanAndRms_TIB_Layer1[7];
120  std::vector<Apv> medianValues_TIB_Layer2; std::pair<double,double> MeanAndRms_TIB_Layer2[7];
121  std::vector<Apv> medianValues_TIB_Layer3; std::pair<double,double> MeanAndRms_TIB_Layer3[7];
122  std::vector<Apv> medianValues_TIB_Layer4; std::pair<double,double> MeanAndRms_TIB_Layer4[7];
123 
124  std::vector<Apv> medianValues_TOB_Layer1; std::pair<double,double> MeanAndRms_TOB_Layer1[7];
125  std::vector<Apv> medianValues_TOB_Layer2; std::pair<double,double> MeanAndRms_TOB_Layer2[7];
126  std::vector<Apv> medianValues_TOB_Layer3; std::pair<double,double> MeanAndRms_TOB_Layer3[7];
127  std::vector<Apv> medianValues_TOB_Layer4; std::pair<double,double> MeanAndRms_TOB_Layer4[7];
128  std::vector<Apv> medianValues_TOB_Layer5; std::pair<double,double> MeanAndRms_TOB_Layer5[7];
129  std::vector<Apv> medianValues_TOB_Layer6; std::pair<double,double> MeanAndRms_TOB_Layer6[7];
130 
131  std::vector<Apv> medianValues_TIDPlus_Disc1; std::pair<double,double> MeanAndRms_TIDPlus_Disc1[7];
132  std::vector<Apv> medianValues_TIDPlus_Disc2; std::pair<double,double> MeanAndRms_TIDPlus_Disc2[7];
133  std::vector<Apv> medianValues_TIDPlus_Disc3; std::pair<double,double> MeanAndRms_TIDPlus_Disc3[7];
134 
135  std::vector<Apv> medianValues_TIDMinus_Disc1; std::pair<double,double> MeanAndRms_TIDMinus_Disc1[7];
136  std::vector<Apv> medianValues_TIDMinus_Disc2; std::pair<double,double> MeanAndRms_TIDMinus_Disc2[7];
137  std::vector<Apv> medianValues_TIDMinus_Disc3; std::pair<double,double> MeanAndRms_TIDMinus_Disc3[7];
138 
139  std::vector<Apv> medianValues_TECPlus_Disc1; std::pair<double,double> MeanAndRms_TECPlus_Disc1[7];
140  std::vector<Apv> medianValues_TECPlus_Disc2; std::pair<double,double> MeanAndRms_TECPlus_Disc2[7];
141  std::vector<Apv> medianValues_TECPlus_Disc3; std::pair<double,double> MeanAndRms_TECPlus_Disc3[7];
142  std::vector<Apv> medianValues_TECPlus_Disc4; std::pair<double,double> MeanAndRms_TECPlus_Disc4[7];
143  std::vector<Apv> medianValues_TECPlus_Disc5; std::pair<double,double> MeanAndRms_TECPlus_Disc5[7];
144  std::vector<Apv> medianValues_TECPlus_Disc6; std::pair<double,double> MeanAndRms_TECPlus_Disc6[7];
145  std::vector<Apv> medianValues_TECPlus_Disc7; std::pair<double,double> MeanAndRms_TECPlus_Disc7[7];
146  std::vector<Apv> medianValues_TECPlus_Disc8; std::pair<double,double> MeanAndRms_TECPlus_Disc8[7];
147  std::vector<Apv> medianValues_TECPlus_Disc9; std::pair<double,double> MeanAndRms_TECPlus_Disc9[7];
148 
149  std::vector<Apv> medianValues_TECMinus_Disc1; std::pair<double,double> MeanAndRms_TECMinus_Disc1[7];
150  std::vector<Apv> medianValues_TECMinus_Disc2; std::pair<double,double> MeanAndRms_TECMinus_Disc2[7];
151  std::vector<Apv> medianValues_TECMinus_Disc3; std::pair<double,double> MeanAndRms_TECMinus_Disc3[7];
152  std::vector<Apv> medianValues_TECMinus_Disc4; std::pair<double,double> MeanAndRms_TECMinus_Disc4[7];
153  std::vector<Apv> medianValues_TECMinus_Disc5; std::pair<double,double> MeanAndRms_TECMinus_Disc5[7];
154  std::vector<Apv> medianValues_TECMinus_Disc6; std::pair<double,double> MeanAndRms_TECMinus_Disc6[7];
155  std::vector<Apv> medianValues_TECMinus_Disc7; std::pair<double,double> MeanAndRms_TECMinus_Disc7[7];
156  std::vector<Apv> medianValues_TECMinus_Disc8; std::pair<double,double> MeanAndRms_TECMinus_Disc8[7];
157  std::vector<Apv> medianValues_TECMinus_Disc9; std::pair<double,double> MeanAndRms_TECMinus_Disc9[7];
158 
159 
160  TFile* f;
161  TTree* apvtree;
162 
163  uint32_t detrawid;
164  int subdetid;
166  int disc;
167  int isback;
171  int isstereo;
176 
183 
186  int isBad;
187 
188  TTree* striptree;
191 
192  int isHot;
198  double avgAPVHits;
199  double poissonProb;
200 
201  int ishot[128];
204  double stripoccupancy[128];
205  int striphits[128];
206  double poissonprob[128];
207  double medianapvhits[6];
208  double avgapvhits[6];
209 
210  std::stringstream ss;
211 
212  std::ostringstream oss;
213 
215 
217  TProfile* tmp_prof;
218 
219  // Histograms
220  // indexes in these arrays are [SubDetId-2][LayerN]
221  // histograms for [SubDetId-2][0] are global for the subdetector
222  // histogram for [0][0] is global for the tracker
223 
225  TH1F* medianOccupancy[5][10];
226  TH1F* absoluteOccupancy[5][10];
227 
228  std::vector<TH2F*> distanceVsStripNumber;
229  std::vector<TProfile*> pfxDistanceVsStripNumber;
230  std::vector<TH1F*> projXDistanceVsStripNumber;
231  std::vector<TH1F*> projYDistanceVsStripNumber;
232 
233  std::vector<TH2F*> occupancyVsStripNumber;
234  std::vector<TProfile*> pfxOccupancyVsStripNumber;
235  std::vector<TH1F*> projYOccupancyVsStripNumber;
237  std::vector<TProfile*> pfxOccupancyHotStripsVsStripNumber;
240  std::vector<TProfile*> pfxOccupancyGoodStripsVsStripNumber;
242 
243  std::vector<TH2F*> poissonProbVsStripNumber;
244  std::vector<TProfile*> pfxPoissonProbVsStripNumber;
245  std::vector<TH1F*> projYPoissonProbVsStripNumber;
247  std::vector<TProfile*> pfxPoissonProbHotStripsVsStripNumber;
252 
253  std::vector<TH2F*> nHitsVsStripNumber;
254  std::vector<TProfile*> pfxNHitsVsStripNumber;
255  std::vector<TH1F*> projXNHitsVsStripNumber;
256  std::vector<TH1F*> projYNHitsVsStripNumber;
257  std::vector<TH2F*> nHitsHotStripsVsStripNumber;
258  std::vector<TProfile*> pfxNHitsHotStripsVsStripNumber;
261  std::vector<TH2F*> nHitsGoodStripsVsStripNumber;
262  std::vector<TProfile*> pfxNHitsGoodStripsVsStripNumber;
265 
266  std::vector<std::string> subDetName;
267  std::vector<unsigned int> nLayers;
268  std::vector<std::string> layerName;
269 
270  std::vector<unsigned int> vHotStripsInModule;
271  unsigned int distance;
272  unsigned int distanceR, distanceL;
273 
275 };
276 #endif
277 
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(const std::vector< Apv > &, std::pair< double, double > *, int)
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 > &)