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.3 2013/01/11 04:57:47 wmtan 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 class TrackerTopology;
44 
46 
47 public:
49 
51 
53 
54  void setProbabilityThreshold(long double prob){prob_=prob;}
55  void setMinNumEntries(unsigned short m){MinNumEntries_=m;}
57  void setLowOccupancyThreshold(long double low_occupancy){lowoccupancy_=low_occupancy;}
58  void setHighOccupancyThreshold(long double high_occupancy){highoccupancy_=high_occupancy;}
59  void setAbsoluteLowThreshold(long double absolute_low){absolutelow_=absolute_low;}
60  void setNumberIterations(int number_iterations){numberiterations_=number_iterations;}
61  void setAbsoluteOccupancyThreshold(long double absolute_occupancy){absolute_occupancy_=absolute_occupancy;}
62  void setNumberOfEvents(double Nevents){Nevents_=Nevents;}
63  void setMinNumOfEvents();
64  void setOutputFileName(std::string OutputFileName, bool WriteOutputFile, std::string DQMOutfileName, bool WriteDQMHistograms){OutFileName_=OutputFileName; WriteOutputFile_=WriteOutputFile; DQMOutfileName_=DQMOutfileName; WriteDQMHistograms_=WriteDQMHistograms;}
65  void setTrackerGeometry(const TrackerGeometry* tkgeom){TkGeom = tkgeom;}
67 
68  private:
69 
70  struct Apv{
71 
72  uint32_t detrawId;
75  double apvMedian[6];
77  TH1F* th1f[6];
78  int NEntries[6];
79  int NEmptyBins[6];
80  };
81 
82  void CalculateMeanAndRMS(std::vector<Apv>, std::pair<double,double>*, int);
83 
84  void AnalyzeOccupancy(SiStripQuality*, std::vector<Apv>&, std::pair<double,double>*, std::vector<unsigned int>&, edm::ESHandle<SiStripQuality>&);
85 
86  void iterativeSearch(Apv&,std::vector<unsigned int>&,int);
87 
88  void evaluatePoissonian(std::vector<long double>& , long double& meanVal);
89 
90  void setBasicTreeParameters(int detid);
91 
93 
95 
96  long double prob_;
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;
197  double poissonProb;
198 
199  int ishot[128];
202  double stripoccupancy[128];
203  int striphits[128];
204  double poissonprob[128];
205 
206  std::stringstream ss;
207 
208  std::ostringstream oss;
209 
211 
213  TProfile* tmp_prof;
214 
215  // Histograms
216  // indexes in these arrays are [SubDetId-2][LayerN]
217  // histograms for [SubDetId-2][0] are global for the subdetector
218  // histogram for [0][0] is global for the tracker
219 
221  TH1F* medianOccupancy[5][10];
222  TH1F* absoluteOccupancy[5][10];
223 
224  std::vector<TH2F*> distanceVsStripNumber;
225  std::vector<TProfile*> pfxDistanceVsStripNumber;
226  std::vector<TH1F*> projXDistanceVsStripNumber;
227  std::vector<TH1F*> projYDistanceVsStripNumber;
228 
229  std::vector<TH2F*> occupancyVsStripNumber;
230  std::vector<TProfile*> pfxOccupancyVsStripNumber;
231  std::vector<TH1F*> projYOccupancyVsStripNumber;
233  std::vector<TProfile*> pfxOccupancyHotStripsVsStripNumber;
236  std::vector<TProfile*> pfxOccupancyGoodStripsVsStripNumber;
238 
239  std::vector<TH2F*> poissonProbVsStripNumber;
240  std::vector<TProfile*> pfxPoissonProbVsStripNumber;
241  std::vector<TH1F*> projYPoissonProbVsStripNumber;
243  std::vector<TProfile*> pfxPoissonProbHotStripsVsStripNumber;
248 
249  std::vector<TH2F*> nHitsVsStripNumber;
250  std::vector<TProfile*> pfxNHitsVsStripNumber;
251  std::vector<TH1F*> projXNHitsVsStripNumber;
252  std::vector<TH1F*> projYNHitsVsStripNumber;
253  std::vector<TH2F*> nHitsHotStripsVsStripNumber;
254  std::vector<TProfile*> pfxNHitsHotStripsVsStripNumber;
257  std::vector<TH2F*> nHitsGoodStripsVsStripNumber;
258  std::vector<TProfile*> pfxNHitsGoodStripsVsStripNumber;
261 
262  std::vector<std::string> subDetName;
263  std::vector<unsigned int> nLayers;
264  std::vector<std::string> layerName;
265 
266  std::vector<unsigned int> vHotStripsInModule;
267  unsigned int distance;
268  unsigned int distanceR, distanceL;
269 
271 };
272 #endif
273 
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)
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 > &)