CMS 3D CMS Logo

SiStripHitEffFromCalibTree.cc
Go to the documentation of this file.
1 //Original Author: Christopher Edelmaier
2 // Created: Feb. 11, 2010
3 #include <memory>
4 #include <string>
5 #include <iostream>
6 #include <fstream>
7 #include <sstream>
8 
17 
43 
54 
57 
62 
63 #include "TFile.h"
64 #include "TCanvas.h"
65 #include "TObjString.h"
66 #include "TString.h"
67 #include "TH1F.h"
68 #include "TH2F.h"
69 #include "TProfile.h"
70 #include "TF1.h"
71 #include "TROOT.h"
72 #include "TTree.h"
73 #include "TStyle.h"
74 #include "TLeaf.h"
75 #include "TGaxis.h"
76 #include "TGraphAsymmErrors.h"
77 #include "TLatex.h"
78 #include "TLegend.h"
79 #include "TEfficiency.h"
80 
81 using namespace edm;
82 using namespace reco;
83 using namespace std;
84 
85 struct hit{
86  double x;
87  double y;
88  double z;
89  unsigned int id;
90 };
91 
92 class SiStripHitEffFromCalibTree : public ConditionDBWriter<SiStripBadStrip> {
93  public:
95  ~SiStripHitEffFromCalibTree() override;
96 
97  private:
98  void algoBeginJob(const edm::EventSetup&) override;
99  void algoEndJob() override;
100  void algoAnalyze(const edm::Event& e, const edm::EventSetup& c) override;
101  void SetBadComponents(int i, int component,SiStripQuality::BadComponent& BC, std::stringstream ssV[4][19], int NBadComponent[4][19][4]);
102  void makeTKMap(bool autoTagging);
103  void makeHotColdMaps();
104  void makeSQLite();
105  void totalStatistics();
106  void makeSummary();
107  void makeSummaryVsBx();
108  void ComputeEff(vector< TH1F* > &vhfound, vector< TH1F* > &vhtotal, string name);
109  void makeSummaryVsLumi();
110  void makeSummaryVsCM();
111  TString GetLayerName(Long_t k);
112  TString GetLayerSideName(Long_t k);
113  float calcPhi(float x, float y);
114 
119  SiStripBadStrip* getNewObject() override;
120 
121  TTree* CalibTree;
122  vector<string> CalibTreeFilenames;
123  float threshold;
124  unsigned int nModsMin;
125  unsigned int doSummary;
129  float _ResXSig;
133  unsigned int _bunchx;
134  unsigned int _spaceBetweenTrains;
135  bool _useCM;
140  float _tkMapMin;
141  float _effPlotMin;
142  TString _title;
143 
144  unsigned int nTEClayers;
145 
146  TH1F* bxHisto;
148  TH1F* PUHisto;
149 
150  // for association of informations of the hitEff tree and the event infos tree
151  map< pair< unsigned int, unsigned int>, array<double, 3> > eventInfos;
152 
153  vector<hit> hits[23];
154  vector<TH2F*> HotColdMaps;
155  map< unsigned int, pair< unsigned int, unsigned int> > modCounter[23];
161  long layerfound[23];
162  long layertotal[23];
163  map< unsigned int, vector<int> > layerfound_perBx;
164  map< unsigned int, vector<int> > layertotal_perBx;
165  vector< TH1F* > layerfound_vsLumi;
166  vector< TH1F* > layertotal_vsLumi;
167  vector< TH1F* > layerfound_vsPU;
168  vector< TH1F* > layertotal_vsPU;
169  vector< TH1F* > layerfound_vsCM;
170  vector< TH1F* > layertotal_vsCM;
171  int goodlayertotal[35];
172  int goodlayerfound[35];
173  int alllayertotal[35];
174  int alllayerfound[35];
175  map< unsigned int, double > BadModules;
176 };
177 
180  FileInPath_("CalibTracker/SiStripCommon/data/SiStripDetInfo.dat")
181 {
182  CalibTreeFilenames = conf.getUntrackedParameter<vector<std::string> >("CalibTreeFilenames");
183  threshold = conf.getParameter<double>("Threshold");
184  nModsMin = conf.getParameter<int>("nModsMin");
185  doSummary = conf.getParameter<int>("doSummary");
186  _badModulesFile = conf.getUntrackedParameter<std::string>("BadModulesFile", "");
187  _autoIneffModTagging = conf.getUntrackedParameter<bool>("AutoIneffModTagging", false);
188  _clusterMatchingMethod = conf.getUntrackedParameter<int>("ClusterMatchingMethod",0);
189  _ResXSig = conf.getUntrackedParameter<double>("ResXSig",-1);
190  _clusterTrajDist = conf.getUntrackedParameter<double>("ClusterTrajDist",64.0);
191  _stripsApvEdge = conf.getUntrackedParameter<double>("StripsApvEdge",10.0);
192  _useOnlyHighPurityTracks = conf.getUntrackedParameter<bool>("UseOnlyHighPurityTracks", true);
193  _bunchx = conf.getUntrackedParameter<int>("BunchCrossing",0);
194  _spaceBetweenTrains = conf.getUntrackedParameter<int>("SpaceBetweenTrains",25);
195  _useCM = conf.getUntrackedParameter<bool>("UseCommonMode",false);
196  _showEndcapSides = conf.getUntrackedParameter<bool>("ShowEndcapSides",true);
197  _showRings = conf.getUntrackedParameter<bool>("ShowRings",false);
198  _showTOB6TEC9 = conf.getUntrackedParameter<bool>("ShowTOB6TEC9",false);
199  _showOnlyGoodModules = conf.getUntrackedParameter<bool>("ShowOnlyGoodModules",false);
200  _tkMapMin = conf.getUntrackedParameter<double>("TkMapMin",0.9);
201  _effPlotMin = conf.getUntrackedParameter<double>("EffPlotMin",0.9);
202  _title = conf.getParameter<std::string>("Title");
204 
205  nTEClayers = 9; // number of wheels
206  if(_showRings) nTEClayers = 7; // number of rings
207 
208  quality_ = new SiStripQuality;
209 }
210 
212 
214  //I have no idea what goes here
215  //fs->make<TTree>("HitEffHistos","Tree of the inefficient hit histograms");
216 }
217 
219  //Still have no idea what goes here
220 
221 }
222 
224 
226  c.get<TrackerDigiGeometryRecord>().get( tracker );
227  const TrackerGeometry * tkgeom=&(* tracker);
228 
229  //Retrieve tracker topology from geometry
230  edm::ESHandle<TrackerTopology> tTopoHandle;
231  c.get<TrackerTopologyRcd>().get(tTopoHandle);
232  const TrackerTopology* const tTopo = tTopoHandle.product();
233 
234  // read bad modules to mask
235  ifstream badModules_file;
236  set<uint32_t> badModules_list;
237  if(!_badModulesFile.empty()) {
238  badModules_file.open(_badModulesFile.c_str());
239  uint32_t badmodule_detid;
240  int mods, fiber1, fiber2, fiber3;
241  if(badModules_file.is_open()) {
242  string line;
243  while ( getline (badModules_file,line) ) {
244  if(badModules_file.eof()) continue;
245  stringstream ss(line);
246  ss >> badmodule_detid >> mods >> fiber1 >> fiber2 >> fiber3;
247  if(badmodule_detid!=0 && mods==1 && (fiber1==1 || fiber2==1 || fiber3==1) )
248  badModules_list.insert(badmodule_detid);
249  }
250  badModules_file.close();
251  }
252  }
253  if(!badModules_list.empty()) cout<<"Remove additionnal bad modules from the analysis: "<<endl;
254  set<uint32_t>::iterator itBadMod;
255  for (itBadMod=badModules_list.begin(); itBadMod!=badModules_list.end(); ++itBadMod)
256  cout<<" "<<*itBadMod<<endl;
257 
258 
259  // initialze counters and histos
260 
261  bxHisto = fs->make<TH1F>("bx","bx",3600,0,3600);
262  instLumiHisto = fs->make<TH1F>("instLumi","inst. lumi.",250,0,25000);
263  PUHisto = fs->make<TH1F>("PU","PU",200,0,200);
264 
265 
266  for(int l=0; l < 35; l++) {
267  goodlayertotal[l] = 0;
268  goodlayerfound[l] = 0;
269  alllayertotal[l] = 0;
270  alllayerfound[l] = 0;
271  }
272 
273  TH1F* resolutionPlots[23];
274  for(Long_t ilayer = 0; ilayer <23; ilayer++) {
275  resolutionPlots[ilayer] = fs->make<TH1F>(Form("resol_layer_%i",(int)(ilayer)),GetLayerName(ilayer),125,-125,125);
276  resolutionPlots[ilayer]->GetXaxis()->SetTitle("trajX-clusX [strip unit]");
277 
278  layerfound_vsLumi.push_back( fs->make<TH1F>(Form("layerfound_vsLumi_layer_%i",(int)(ilayer)),GetLayerName(ilayer),100,0,25000));
279  layertotal_vsLumi.push_back( fs->make<TH1F>(Form("layertotal_vsLumi_layer_%i",(int)(ilayer)),GetLayerName(ilayer),100,0,25000));
280  layerfound_vsPU.push_back( fs->make<TH1F>(Form("layerfound_vsPU_layer_%i",(int)(ilayer)),GetLayerName(ilayer),45,0,90));
281  layertotal_vsPU.push_back( fs->make<TH1F>(Form("layertotal_vsPU_layer_%i",(int)(ilayer)),GetLayerName(ilayer),45,0,90));
282 
283  if(_useCM) {
284  layerfound_vsCM.push_back( fs->make<TH1F>(Form("layerfound_vsCM_layer_%i",(int)(ilayer)),GetLayerName(ilayer),20,0,400));
285  layertotal_vsCM.push_back( fs->make<TH1F>(Form("layertotal_vsCM_layer_%i",(int)(ilayer)),GetLayerName(ilayer),20,0,400));
286  }
287  layertotal[ilayer] = 0;
288  layerfound[ilayer] = 0;
289  }
290 
291  if(!_autoIneffModTagging) cout << "A module is bad if efficiency < " << threshold << " and has at least " << nModsMin << " nModsMin." << endl;
292  else cout << "A module is bad if efficiency < the avg in layer - " << threshold << " and has at least " << nModsMin << " nModsMin." << endl;
293 
294 
295  unsigned int run, evt, bx;
296  double instLumi, PU;
297 
298  //Open the ROOT Calib Tree
299  for( unsigned int ifile=0; ifile < CalibTreeFilenames.size(); ifile++) {
300 
301  cout<<"Loading file: "<<CalibTreeFilenames[ifile]<<endl;
302  TFile* CalibTreeFile = TFile::Open(CalibTreeFilenames[ifile].c_str(),"READ");
303 
304  // Get event infos
305  bool foundEventInfos=false;
306  try {
307  CalibTreeFile->cd("eventInfo");
308  }
309  catch(exception& e) {
310  cout << "No event infos tree" << endl;
311  }
312  TTree* EventTree = (TTree*)(gDirectory->Get("tree"));
313 
314  TLeaf* runLf;
315  TLeaf* evtLf;
316  TLeaf* BunchLf;
317  TLeaf* InstLumiLf;
318  TLeaf* PULf;
319  if(EventTree){
320 
321  cout << "Found event infos tree" << endl;
322 
323  runLf = EventTree->GetLeaf("run");
324  evtLf = EventTree->GetLeaf("event");
325 
326  BunchLf = EventTree->GetLeaf("bx");
327  InstLumiLf = EventTree->GetLeaf("instLumi");
328  PULf = EventTree->GetLeaf("PU");
329 
330  int nevt = EventTree->GetEntries();
331  if(nevt) foundEventInfos=true;
332 
333  for(int j =0; j < nevt; j++) {
334  EventTree->GetEntry(j);
335  run = runLf->GetValue();
336  evt = evtLf->GetValue();
337  bx = BunchLf->GetValue();
338  instLumi = InstLumiLf->GetValue();
339  PU = PULf->GetValue();
340 
341  bxHisto->Fill(bx);
342  instLumiHisto->Fill(instLumi);
343  PUHisto->Fill(PU);
344 
345  eventInfos[ make_pair(run, evt) ] = array<double, 3> {{ (double) bx, instLumi, PU}};
346  }
347 
348  }
349 
350 
351  // Get hit infos
352  CalibTreeFile->cd("anEff");
353  CalibTree = (TTree*)(gDirectory->Get("traj"));
354 
355  runLf = CalibTree->GetLeaf("run");
356  evtLf = CalibTree->GetLeaf("event");
357  TLeaf* BadLf = CalibTree->GetLeaf("ModIsBad");
358  TLeaf* sistripLf = CalibTree->GetLeaf("SiStripQualBad");
359  TLeaf* idLf = CalibTree->GetLeaf("Id");
360  TLeaf* acceptLf = CalibTree->GetLeaf("withinAcceptance");
361  TLeaf* layerLf = CalibTree->GetLeaf("layer");
362  //TLeaf* nHitsLf = CalibTree->GetLeaf("nHits");
363  TLeaf* highPurityLf = CalibTree->GetLeaf("highPurity");
364  TLeaf* xLf = CalibTree->GetLeaf("TrajGlbX");
365  TLeaf* yLf = CalibTree->GetLeaf("TrajGlbY");
366  TLeaf* zLf = CalibTree->GetLeaf("TrajGlbZ");
367  TLeaf* ResXSigLf = CalibTree->GetLeaf("ResXSig");
368  TLeaf* TrajLocXLf = CalibTree->GetLeaf("TrajLocX");
369  TLeaf* TrajLocYLf = CalibTree->GetLeaf("TrajLocY");
370  TLeaf* ClusterLocXLf = CalibTree->GetLeaf("ClusterLocX");
371  BunchLf = CalibTree->GetLeaf("bunchx");
372  InstLumiLf = CalibTree->GetLeaf("instLumi");
373  PULf = CalibTree->GetLeaf("PU");
374  TLeaf* CMLf = nullptr;
375  if(_useCM) CMLf = CalibTree->GetLeaf("commonMode");
376 
377  int nevents = CalibTree->GetEntries();
378  cout << "Successfully loaded analyze function with " << nevents << " events!\n";
379 
380 
381  map< pair< unsigned int, unsigned int>, array<double, 3> >::iterator itEventInfos;
382 
383 
384  //Loop through all of the events
385  for(int j =0; j < nevents; j++) {
386  CalibTree->GetEntry(j);
387  run = (unsigned int)runLf->GetValue();
388  evt = (unsigned int)evtLf->GetValue();
389  unsigned int isBad = (unsigned int)BadLf->GetValue();
390  unsigned int quality = (unsigned int)sistripLf->GetValue();
391  unsigned int id = (unsigned int)idLf->GetValue();
392  unsigned int accept = (unsigned int)acceptLf->GetValue();
393  unsigned int layer_wheel = (unsigned int)layerLf->GetValue();
394  unsigned int layer = layer_wheel;
395  if(_showRings && layer >10) { // use rings instead of wheels
396  if(layer<14) layer = 10 + ((id>>9)&0x3); //TID 3 disks and also 3 rings -> use the same container
397  else layer = 13 + ((id>>5)&0x7); //TEC
398  }
399  //unsigned int nHits = (unsigned int)nHitsLf->GetValue();
400  bool highPurity = (bool) highPurityLf->GetValue();
401  double x = xLf->GetValue();
402  double y = yLf->GetValue();
403  double z = zLf->GetValue();
404  double resxsig = ResXSigLf->GetValue();
405  double TrajLocX = TrajLocXLf->GetValue();
406  double TrajLocY = TrajLocYLf->GetValue();
407  double ClusterLocX = ClusterLocXLf->GetValue();
408  double TrajLocXMid;
409  double stripTrajMid;
410  double stripCluster;
411  bool badquality = false;
412 
413  instLumi = 0;
414  PU = 0;
415 
416  // if no special tree with event infos, they may be stored in the hit eff tree
417  if(!foundEventInfos){
418  bx = (unsigned int)BunchLf->GetValue();
419  if(InstLumiLf!=nullptr) instLumi = InstLumiLf->GetValue(); // branch not filled by default
420  if(PULf!=nullptr) PU = PULf->GetValue(); // branch not filled by default
421  }
422  int CM = -100;
423  if(_useCM) CM = CMLf->GetValue();
424 
425 
426  // Get infos from eventInfos if they exist
427  if(foundEventInfos){
428 
429  itEventInfos = eventInfos.find( make_pair(run, evt) );
430  if(itEventInfos!=eventInfos.end()){
431  bx = itEventInfos->second[0];
432  instLumi = itEventInfos->second[1];
433  PU = itEventInfos->second[2];
434  }
435  }
436 
437 
438 
439  //We have two things we want to do, both an XY color plot, and the efficiency measurement
440  //First, ignore anything that isn't in acceptance and isn't good quality
441 
442  if(_bunchx > 0 && _bunchx != bx) continue;
443 
444  //if(quality == 1 || accept != 1 || nHits < 8) continue;
445  if(accept != 1) continue;
446  if(_useOnlyHighPurityTracks && !highPurity) continue;
447  if(quality == 1) badquality = true;
448 
449  // don't compute efficiencies in modules from TOB6 and TEC9
450  if(!_showTOB6TEC9 && (layer_wheel==10 || layer_wheel==22)) continue;
451 
452  // don't use bad modules given in the bad module list
453  itBadMod = badModules_list.find(id);
454  if(itBadMod!=badModules_list.end()) continue;
455 
456 
457  //Now that we have a good event, we need to look at if we expected it or not, and the location
458  //if we didn't
459  //Fill the missing hit information first
460  bool badflag = false;
461 
462  // By default uses the old matching method
463  if(_ResXSig < 0) {
464  if(isBad == 1) badflag = true; // isBad set to false in the tree when resxsig<999.0
465  }
466  else {
467  if(isBad == 1 || resxsig > _ResXSig) badflag = true;
468  }
469 
470  // Conversion of positions in strip unit
471  int nstrips = -9;
472  float Pitch = -9.0;
473 
474  if (resxsig==1000.0) { // special treatment, no GeomDetUnit associated in some cases when no cluster found
475  Pitch = 0.0205; // maximum
476  nstrips = 768; // maximum
477  stripTrajMid = TrajLocX/Pitch + nstrips/2.0 ;
478  stripCluster = ClusterLocX/Pitch + nstrips/2.0 ;
479  }
480  else {
481  DetId ClusterDetId(id);
482  const StripGeomDetUnit * stripdet=(const StripGeomDetUnit*)tkgeom->idToDetUnit(ClusterDetId);
483  const StripTopology& Topo = stripdet->specificTopology();
484  nstrips = Topo.nstrips();
485  Pitch = stripdet->surface().bounds().width() / Topo.nstrips();
486  stripTrajMid = TrajLocX/Pitch + nstrips/2.0 ; //layer01->10
487  stripCluster = ClusterLocX/Pitch + nstrips/2.0 ;
488 
489  // For trapezoidal modules: extrapolation of x trajectory position to the y middle of the module
490  // for correct comparison with cluster position
491  float hbedge = 0;
492  float htedge = 0;
493  float hapoth = 0;
494  if(layer>=11) {
495  const BoundPlane& plane = stripdet->surface();
496  const TrapezoidalPlaneBounds* trapezoidalBounds( dynamic_cast<const TrapezoidalPlaneBounds*>(&(plane.bounds())));
497  std::array<const float, 4> const & parameters = (*trapezoidalBounds).parameters();
498  hbedge = parameters[0];
499  htedge = parameters[1];
500  hapoth = parameters[3];
501  TrajLocXMid = TrajLocX / (1 + (htedge-hbedge)*TrajLocY/(htedge+hbedge)/hapoth) ; // radialy extrapolated x loc position at middle
502  stripTrajMid = TrajLocXMid/Pitch + nstrips/2.0 ;
503  }
504  }
505 
506 
507  if(!badquality && layer<23) {
508  if(resxsig!=1000.0) resolutionPlots[layer]->Fill(stripTrajMid-stripCluster);
509  else resolutionPlots[layer]->Fill(1000);
510  }
511 
512 
513  // New matching methods
514  int tapv = -9;
515  int capv = -9;
516  float stripInAPV = 64.;
517 
518  if ( _clusterMatchingMethod >=1 ) {
519  badflag = false; // reset
520  if(resxsig == 1000.0) { // default value when no cluster found in the module
521  badflag = true; // consider the module inefficient in this case
522  }
523  else{
524  if (_clusterMatchingMethod==2 || _clusterMatchingMethod==4) { // check the distance between cluster and trajectory position
525  if ( abs(stripCluster - stripTrajMid) > _clusterTrajDist ) badflag = true;
526  }
527  if (_clusterMatchingMethod==3 || _clusterMatchingMethod==4) { // cluster and traj have to be in the same APV (don't take edges into accounts)
528  tapv = (int) stripTrajMid/128;
529  capv = (int) stripCluster/128;
530  stripInAPV = stripTrajMid-tapv*128;
531 
532  if(stripInAPV<_stripsApvEdge || stripInAPV>128-_stripsApvEdge) continue;
533  if(tapv != capv) badflag = true;
534  }
535  }
536  }
537 
538 
539 
540  if(badflag && !badquality) {
541  hit temphit;
542  temphit.x = x;
543  temphit.y = y;
544  temphit.z = z;
545  temphit.id = id;
546  hits[layer].push_back(temphit);
547  }
548  pair<unsigned int, unsigned int> newgoodpair (1,1);
549  pair<unsigned int, unsigned int> newbadpair (1,0);
550  //First, figure out if the module already exists in the map of maps
551  map< unsigned int, pair< unsigned int, unsigned int> >::iterator it = modCounter[layer].find(id);
552  if(!badquality) {
553  if(it == modCounter[layer].end()) {
554  if(badflag) modCounter[layer][id] = newbadpair;
555  else modCounter[layer][id] = newgoodpair;
556  }
557  else {
558  ((*it).second.first)++;
559  if(!badflag) ((*it).second.second)++;
560  }
561 
562  if(layerfound_perBx.find(bx)==layerfound_perBx.end()) {
563  layerfound_perBx[bx] = vector<int>(23, 0);
564  layertotal_perBx[bx] = vector<int>(23, 0);
565  }
566  if(!badflag) layerfound_perBx[bx][layer]++;
567  layertotal_perBx[bx][layer]++;
568 
569  if(!badflag) layerfound_vsLumi[layer]->Fill(instLumi);
570  layertotal_vsLumi[layer]->Fill(instLumi);
571  if(!badflag) layerfound_vsPU[layer]->Fill(PU);
572  layertotal_vsPU[layer]->Fill(PU);
573 
574  if(_useCM){
575  if(!badflag) layerfound_vsCM[layer]->Fill(CM);
576  layertotal_vsCM[layer]->Fill(CM);
577  }
578 
579  //Have to do the decoding for which side to go on (ugh)
580  if(layer <= 10) {
581  if(!badflag) goodlayerfound[layer]++;
582  goodlayertotal[layer]++;
583  }
584  else if(layer > 10 && layer < 14) {
585  if( ((id>>13)&0x3) == 1) {
586  if(!badflag) goodlayerfound[layer]++;
587  goodlayertotal[layer]++;
588  }
589  else if( ((id>>13)&0x3) == 2) {
590  if(!badflag) goodlayerfound[layer+3]++;
591  goodlayertotal[layer+3]++;
592  }
593  }
594  else if(layer > 13 && layer <= 22) {
595  if( ((id>>18)&0x3) == 1) {
596  if(!badflag) goodlayerfound[layer+3]++;
597  goodlayertotal[layer+3]++;
598  }
599  else if( ((id>>18)&0x3) == 2) {
600  if(!badflag) goodlayerfound[layer+3+nTEClayers]++;
601  goodlayertotal[layer+3+nTEClayers]++;
602  }
603  }
604  }
605  //Do the one where we don't exclude bad modules!
606  if(layer <= 10) {
607  if(!badflag) alllayerfound[layer]++;
608  alllayertotal[layer]++;
609  }
610  else if(layer > 10 && layer < 14) {
611  if( ((id>>13)&0x3) == 1) {
612  if(!badflag) alllayerfound[layer]++;
613  alllayertotal[layer]++;
614  }
615  else if( ((id>>13)&0x3) == 2) {
616  if(!badflag) alllayerfound[layer+3]++;
617  alllayertotal[layer+3]++;
618  }
619  }
620  else if(layer > 13 && layer <= 22) {
621  if( ((id>>18)&0x3) == 1) {
622  if(!badflag) alllayerfound[layer+3]++;
623  alllayertotal[layer+3]++;
624  }
625  else if( ((id>>18)&0x3) == 2) {
626  if(!badflag) alllayerfound[layer+3+nTEClayers]++;
627  alllayertotal[layer+3+nTEClayers]++;
628  }
629  }
630  //At this point, both of our maps are loaded with the correct information
631  }
632  }// go to next CalibTreeFile
633 
634  makeHotColdMaps();
636  makeSQLite();
637  totalStatistics();
638  makeSummary();
639  makeSummaryVsBx();
641  if(_useCM) makeSummaryVsCM();
642 
644  //try to write out what's in the quality record
646  int NTkBadComponent[4]; //k: 0=BadModule, 1=BadFiber, 2=BadApv, 3=BadStrips
647  int NBadComponent[4][19][4];
648  //legend: NBadComponent[i][j][k]= SubSystem i, layer/disk/wheel j, BadModule/Fiber/Apv k
649  // i: 0=TIB, 1=TID, 2=TOB, 3=TEC
650  // k: 0=BadModule, 1=BadFiber, 2=BadApv, 3=BadStrips
651  std::stringstream ssV[4][19];
652 
653  for(int i=0;i<4;++i){
654  NTkBadComponent[i]=0;
655  for(int j=0;j<19;++j){
656  ssV[i][j].str("");
657  for(int k=0;k<4;++k)
658  NBadComponent[i][j][k]=0;
659  }
660  }
661 
662 
663  std::vector<SiStripQuality::BadComponent> BC = quality_->getBadComponentList();
664 
665  for (size_t i=0;i<BC.size();++i){
666 
667  //&&&&&&&&&&&&&
668  //Full Tk
669  //&&&&&&&&&&&&&
670 
671  if (BC[i].BadModule)
672  NTkBadComponent[0]++;
673  if (BC[i].BadFibers)
674  NTkBadComponent[1]+= ( (BC[i].BadFibers>>2)&0x1 )+ ( (BC[i].BadFibers>>1)&0x1 ) + ( (BC[i].BadFibers)&0x1 );
675  if (BC[i].BadApvs)
676  NTkBadComponent[2]+= ( (BC[i].BadApvs>>5)&0x1 )+ ( (BC[i].BadApvs>>4)&0x1 ) + ( (BC[i].BadApvs>>3)&0x1 ) +
677  ( (BC[i].BadApvs>>2)&0x1 )+ ( (BC[i].BadApvs>>1)&0x1 ) + ( (BC[i].BadApvs)&0x1 );
678 
679  //&&&&&&&&&&&&&&&&&
680  //Single SubSystem
681  //&&&&&&&&&&&&&&&&&
682 
683  int component;
684  SiStripDetId a(BC[i].detid);
685  if ( a.subdetId() == SiStripDetId::TIB ){
686  //&&&&&&&&&&&&&&&&&
687  //TIB
688  //&&&&&&&&&&&&&&&&&
689 
690  component=tTopo->tibLayer(BC[i].detid);
691  SetBadComponents(0, component, BC[i], ssV, NBadComponent);
692 
693  } else if ( a.subdetId() == SiStripDetId::TID ) {
694  //&&&&&&&&&&&&&&&&&
695  //TID
696  //&&&&&&&&&&&&&&&&&
697 
698  component=tTopo->tidSide(BC[i].detid)==2?tTopo->tidWheel(BC[i].detid):tTopo->tidWheel(BC[i].detid)+3;
699  SetBadComponents(1, component, BC[i], ssV, NBadComponent);
700 
701  } else if ( a.subdetId() == SiStripDetId::TOB ) {
702  //&&&&&&&&&&&&&&&&&
703  //TOB
704  //&&&&&&&&&&&&&&&&&
705 
706  component=tTopo->tobLayer(BC[i].detid);
707  SetBadComponents(2, component, BC[i], ssV, NBadComponent);
708 
709  } else if ( a.subdetId() == SiStripDetId::TEC ) {
710  //&&&&&&&&&&&&&&&&&
711  //TEC
712  //&&&&&&&&&&&&&&&&&
713 
714  component=tTopo->tecSide(BC[i].detid)==2?tTopo->tecWheel(BC[i].detid):tTopo->tecWheel(BC[i].detid)+9;
715  SetBadComponents(3, component, BC[i], ssV, NBadComponent);
716 
717  }
718  }
719 
720  //&&&&&&&&&&&&&&&&&&
721  // Single Strip Info
722  //&&&&&&&&&&&&&&&&&&
723  float percentage=0;
724 
727 
728  for (SiStripBadStrip::RegistryIterator rp=rbegin; rp != rend; ++rp) {
729  unsigned int detid=rp->detid;
730 
731  int subdet=-999; int component=-999;
732  SiStripDetId a(detid);
733  if ( a.subdetId() == 3 ){
734  subdet=0;
735  component=tTopo->tibLayer(detid);
736  } else if ( a.subdetId() == 4 ) {
737  subdet=1;
738  component=tTopo->tidSide(detid)==2?tTopo->tidWheel(detid):tTopo->tidWheel(detid)+3;
739  } else if ( a.subdetId() == 5 ) {
740  subdet=2;
741  component=tTopo->tobLayer(detid);
742  } else if ( a.subdetId() == 6 ) {
743  subdet=3;
744  component=tTopo->tecSide(detid)==2?tTopo->tecWheel(detid):tTopo->tecWheel(detid)+9;
745  }
746 
748 
749  percentage=0;
750  for(int it=0;it<sqrange.second-sqrange.first;it++){
751  unsigned int range=quality_->decode( *(sqrange.first+it) ).range;
752  NTkBadComponent[3]+=range;
753  NBadComponent[subdet][0][3]+=range;
754  NBadComponent[subdet][component][3]+=range;
755  percentage+=range;
756  }
757  if(percentage!=0)
758  percentage/=128.*reader->getNumberOfApvsAndStripLength(detid).first;
759  if(percentage>1)
760  edm::LogError("SiStripQualityStatistics") << "PROBLEM detid " << detid << " value " << percentage<< std::endl;
761  }
762  //&&&&&&&&&&&&&&&&&&
763  // printout
764  //&&&&&&&&&&&&&&&&&&
765 
766  cout << "\n-----------------\nNew IOV starting from run " << e.id().run() << " event " << e.id().event() << " lumiBlock " << e.luminosityBlock() << " time " << e.time().value() << "\n-----------------\n";
767  cout << "\n-----------------\nGlobal Info\n-----------------";
768  cout << "\nBadComponent \t Modules \tFibers \tApvs\tStrips\n----------------------------------------------------------------";
769  cout << "\nTracker:\t\t"<<NTkBadComponent[0]<<"\t"<<NTkBadComponent[1]<<"\t"<<NTkBadComponent[2]<<"\t"<<NTkBadComponent[3];
770  cout << endl;
771  cout << "\nTIB:\t\t\t"<<NBadComponent[0][0][0]<<"\t"<<NBadComponent[0][0][1]<<"\t"<<NBadComponent[0][0][2]<<"\t"<<NBadComponent[0][0][3];
772  cout << "\nTID:\t\t\t"<<NBadComponent[1][0][0]<<"\t"<<NBadComponent[1][0][1]<<"\t"<<NBadComponent[1][0][2]<<"\t"<<NBadComponent[1][0][3];
773  cout << "\nTOB:\t\t\t"<<NBadComponent[2][0][0]<<"\t"<<NBadComponent[2][0][1]<<"\t"<<NBadComponent[2][0][2]<<"\t"<<NBadComponent[2][0][3];
774  cout << "\nTEC:\t\t\t"<<NBadComponent[3][0][0]<<"\t"<<NBadComponent[3][0][1]<<"\t"<<NBadComponent[3][0][2]<<"\t"<<NBadComponent[3][0][3];
775  cout << "\n";
776 
777  for (int i=1;i<5;++i)
778  cout << "\nTIB Layer " << i << " :\t\t"<<NBadComponent[0][i][0]<<"\t"<<NBadComponent[0][i][1]<<"\t"<<NBadComponent[0][i][2]<<"\t"<<NBadComponent[0][i][3];
779  cout << "\n";
780  for (int i=1;i<4;++i)
781  cout << "\nTID+ Disk " << i << " :\t\t"<<NBadComponent[1][i][0]<<"\t"<<NBadComponent[1][i][1]<<"\t"<<NBadComponent[1][i][2]<<"\t"<<NBadComponent[1][i][3];
782  for (int i=4;i<7;++i)
783  cout << "\nTID- Disk " << i-3 << " :\t\t"<<NBadComponent[1][i][0]<<"\t"<<NBadComponent[1][i][1]<<"\t"<<NBadComponent[1][i][2]<<"\t"<<NBadComponent[1][i][3];
784  cout << "\n";
785  for (int i=1;i<7;++i)
786  cout << "\nTOB Layer " << i << " :\t\t"<<NBadComponent[2][i][0]<<"\t"<<NBadComponent[2][i][1]<<"\t"<<NBadComponent[2][i][2]<<"\t"<<NBadComponent[2][i][3];
787  cout << "\n";
788  for (int i=1;i<10;++i)
789  cout << "\nTEC+ Disk " << i << " :\t\t"<<NBadComponent[3][i][0]<<"\t"<<NBadComponent[3][i][1]<<"\t"<<NBadComponent[3][i][2]<<"\t"<<NBadComponent[3][i][3];
790  for (int i=10;i<19;++i)
791  cout << "\nTEC- Disk " << i-9 << " :\t\t"<<NBadComponent[3][i][0]<<"\t"<<NBadComponent[3][i][1]<<"\t"<<NBadComponent[3][i][2]<<"\t"<<NBadComponent[3][i][3];
792  cout << "\n";
793 
794  cout << "\n----------------------------------------------------------------\n\t\t Detid \tModules Fibers Apvs\n----------------------------------------------------------------";
795  for (int i=1;i<5;++i)
796  cout << "\nTIB Layer " << i << " :" << ssV[0][i].str();
797  cout << "\n";
798  for (int i=1;i<4;++i)
799  cout << "\nTID+ Disk " << i << " :" << ssV[1][i].str();
800  for (int i=4;i<7;++i)
801  cout << "\nTID- Disk " << i-3 << " :" << ssV[1][i].str();
802  cout << "\n";
803  for (int i=1;i<7;++i)
804  cout << "\nTOB Layer " << i << " :" << ssV[2][i].str();
805  cout << "\n";
806  for (int i=1;i<10;++i)
807  cout << "\nTEC+ Disk " << i << " :" << ssV[3][i].str();
808  for (int i=10;i<19;++i)
809  cout << "\nTEC- Disk " << i-9 << " :" << ssV[3][i].str();
810 
811  // store also bad modules in log file
812  ofstream badModules;
813  badModules.open("BadModules.log");
814  badModules << "\n----------------------------------------------------------------\n\t\t Detid \tModules Fibers Apvs\n----------------------------------------------------------------";
815  for (int i=1;i<5;++i)
816  badModules << "\nTIB Layer " << i << " :" << ssV[0][i].str();
817  badModules << "\n";
818  for (int i=1;i<4;++i)
819  badModules << "\nTID+ Disk " << i << " :" << ssV[1][i].str();
820  for (int i=4;i<7;++i)
821  badModules << "\nTID- Disk " << i-3 << " :" << ssV[1][i].str();
822  badModules << "\n";
823  for (int i=1;i<7;++i)
824  badModules << "\nTOB Layer " << i << " :" << ssV[2][i].str();
825  badModules << "\n";
826  for (int i=1;i<10;++i)
827  badModules << "\nTEC+ Disk " << i << " :" << ssV[3][i].str();
828  for (int i=10;i<19;++i)
829  badModules << "\nTEC- Disk " << i-9 << " :" << ssV[3][i].str();
830  badModules.close();
831 
832 }
833 
835  cout << "Entering hot cold map generation!\n";
836  TStyle* gStyle = new TStyle("gStyle","myStyle");
837  gStyle->cd();
838  gStyle->SetPalette(1);
839  gStyle->SetCanvasColor(kWhite);
840  gStyle->SetOptStat(0);
841  //Here we make the hot/cold color maps that we love so very much
842  //Already have access to the data as a private variable
843  //Create all of the histograms in the TFileService
844  TH2F *temph2;
845  for(Long_t maplayer = 1; maplayer <=22; maplayer++) {
846  //Initialize all of the histograms
847  if(maplayer > 0 && maplayer <= 4) {
848  //We are in the TIB
849  temph2 = fs->make<TH2F>(Form("%s%i","TIB",(int)(maplayer)),"TIB",100,-1,361,100,-100,100);
850  temph2->GetXaxis()->SetTitle("Phi");
851  temph2->GetXaxis()->SetBinLabel(1,TString("360"));
852  temph2->GetXaxis()->SetBinLabel(50,TString("180"));
853  temph2->GetXaxis()->SetBinLabel(100,TString("0"));
854  temph2->GetYaxis()->SetTitle("Global Z");
855  temph2->SetOption("colz");
856  HotColdMaps.push_back(temph2);
857  }
858  else if(maplayer > 4 && maplayer <= 10) {
859  //We are in the TOB
860  temph2 = fs->make<TH2F>(Form("%s%i","TOB",(int)(maplayer-4)),"TOB",100,-1,361,100,-120,120);
861  temph2->GetXaxis()->SetTitle("Phi");
862  temph2->GetXaxis()->SetBinLabel(1,TString("360"));
863  temph2->GetXaxis()->SetBinLabel(50,TString("180"));
864  temph2->GetXaxis()->SetBinLabel(100,TString("0"));
865  temph2->GetYaxis()->SetTitle("Global Z");
866  temph2->SetOption("colz");
867  HotColdMaps.push_back(temph2);
868  }
869  else if(maplayer > 10 && maplayer <= 13) {
870  //We are in the TID
871  //Split by +/-
872  temph2 = fs->make<TH2F>(Form("%s%i","TID-",(int)(maplayer-10)),"TID-",100,-100,100,100,-100,100);
873  temph2->GetXaxis()->SetTitle("Global Y");
874  temph2->GetXaxis()->SetBinLabel(1,TString("+Y"));
875  temph2->GetXaxis()->SetBinLabel(50,TString("0"));
876  temph2->GetXaxis()->SetBinLabel(100,TString("-Y"));
877  temph2->GetYaxis()->SetTitle("Global X");
878  temph2->GetYaxis()->SetBinLabel(1,TString("-X"));
879  temph2->GetYaxis()->SetBinLabel(50,TString("0"));
880  temph2->GetYaxis()->SetBinLabel(100,TString("+X"));
881  temph2->SetOption("colz");
882  HotColdMaps.push_back(temph2);
883  temph2 = fs->make<TH2F>(Form("%s%i","TID+",(int)(maplayer-10)),"TID+",100,-100,100,100,-100,100);
884  temph2->GetXaxis()->SetTitle("Global Y");
885  temph2->GetXaxis()->SetBinLabel(1,TString("+Y"));
886  temph2->GetXaxis()->SetBinLabel(50,TString("0"));
887  temph2->GetXaxis()->SetBinLabel(100,TString("-Y"));
888  temph2->GetYaxis()->SetTitle("Global X");
889  temph2->GetYaxis()->SetBinLabel(1,TString("-X"));
890  temph2->GetYaxis()->SetBinLabel(50,TString("0"));
891  temph2->GetYaxis()->SetBinLabel(100,TString("+X"));
892  temph2->SetOption("colz");
893  HotColdMaps.push_back(temph2);
894  }
895  else if(maplayer > 13) {
896  //We are in the TEC
897  //Split by +/-
898  temph2 = fs->make<TH2F>(Form("%s%i","TEC-",(int)(maplayer-13)),"TEC-",100,-120,120,100,-120,120);
899  temph2->GetXaxis()->SetTitle("Global Y");
900  temph2->GetXaxis()->SetBinLabel(1,TString("+Y"));
901  temph2->GetXaxis()->SetBinLabel(50,TString("0"));
902  temph2->GetXaxis()->SetBinLabel(100,TString("-Y"));
903  temph2->GetYaxis()->SetTitle("Global X");
904  temph2->GetYaxis()->SetBinLabel(1,TString("-X"));
905  temph2->GetYaxis()->SetBinLabel(50,TString("0"));
906  temph2->GetYaxis()->SetBinLabel(100,TString("+X"));
907  temph2->SetOption("colz");
908  HotColdMaps.push_back(temph2);
909  temph2 = fs->make<TH2F>(Form("%s%i","TEC+",(int)(maplayer-13)),"TEC+",100,-120,120,100,-120,120);
910  temph2->GetXaxis()->SetTitle("Global Y");
911  temph2->GetXaxis()->SetBinLabel(1,TString("+Y"));
912  temph2->GetXaxis()->SetBinLabel(50,TString("0"));
913  temph2->GetXaxis()->SetBinLabel(100,TString("-Y"));
914  temph2->GetYaxis()->SetTitle("Global X");
915  temph2->GetYaxis()->SetBinLabel(1,TString("-X"));
916  temph2->GetYaxis()->SetBinLabel(50,TString("0"));
917  temph2->GetYaxis()->SetBinLabel(100,TString("+X"));
918  temph2->SetOption("colz");
919  HotColdMaps.push_back(temph2);
920  }
921  }
922  for(Long_t mylayer = 1; mylayer <= 22; mylayer++) {
923  //Determine what kind of plot we want to write out
924  //Loop through the entirety of each layer
925  //Create an array of the histograms
926  vector<hit>::const_iterator iter;
927  for(iter = hits[mylayer].begin(); iter != hits[mylayer].end(); iter++) {
928  //Looping over the particular layer
929  //Fill by 360-x to get the proper location to compare with TKMaps of phi
930  //Also global xy is messed up
931  if(mylayer > 0 && mylayer <= 4) {
932  //We are in the TIB
933  float phi = calcPhi(iter->x, iter->y);
934  HotColdMaps[mylayer - 1]->Fill(360.-phi,iter->z,1.);
935  }
936  else if(mylayer > 4 && mylayer <= 10) {
937  //We are in the TOB
938  float phi = calcPhi(iter->x,iter->y);
939  HotColdMaps[mylayer - 1]->Fill(360.-phi,iter->z,1.);
940  }
941  else if(mylayer > 10 && mylayer <= 13) {
942  //We are in the TID
943  //There are 2 different maps here
944  int side = (((iter->id)>>13) & 0x3);
945  if(side == 1) HotColdMaps[(mylayer - 1) + (mylayer - 11)]->Fill(-iter->y,iter->x,1.);
946  else if(side == 2) HotColdMaps[(mylayer - 1) + (mylayer - 10)]->Fill(-iter->y,iter->x,1.);
947  //if(side == 1) HotColdMaps[(mylayer - 1) + (mylayer - 11)]->Fill(iter->x,iter->y,1.);
948  //else if(side == 2) HotColdMaps[(mylayer - 1) + (mylayer - 10)]->Fill(iter->x,iter->y,1.);
949  }
950  else if(mylayer > 13) {
951  //We are in the TEC
952  //There are 2 different maps here
953  int side = (((iter->id)>>18) & 0x3);
954  if(side == 1) HotColdMaps[(mylayer + 2) + (mylayer - 14)]->Fill(-iter->y,iter->x,1.);
955  else if(side == 2) HotColdMaps[(mylayer + 2) + (mylayer - 13)]->Fill(-iter->y,iter->x,1.);
956  //if(side == 1) HotColdMaps[(mylayer + 2) + (mylayer - 14)]->Fill(iter->x,iter->y,1.);
957  //else if(side == 2) HotColdMaps[(mylayer + 2) + (mylayer - 13)]->Fill(iter->x,iter->y,1.);
958  }
959  }
960  }
961  cout << "Finished HotCold Map Generation\n";
962 }
963 
964 void SiStripHitEffFromCalibTree::makeTKMap(bool autoTagging=false) {
965  cout << "Entering TKMap generation!\n";
966  tkmap = new TrackerMap(" Detector Inefficiency ");
967  tkmapbad = new TrackerMap(" Inefficient Modules ");
968  tkmapeff = new TrackerMap(_title.Data());
969  tkmapnum = new TrackerMap(" Detector numerator ");
970  tkmapden = new TrackerMap(" Detector denominator ");
971 
972  double myeff, mynum, myden;
973  double eff_limit=0;
974 
975  for(Long_t i = 1; i <= 22; i++) {
976  //Loop over every layer, extracting the information from
977  //the map of the efficiencies
978  layertotal[i] = 0;
979  layerfound[i] = 0;
980  TH1F* hEffInLayer = fs->make<TH1F>(Form("eff_layer%i", int(i)),Form("Module efficiency in layer %i", int(i)), 201,0,1.005);
981 
982  map<unsigned int, pair<unsigned int, unsigned int> >::const_iterator ih;
983  for( ih = modCounter[i].begin(); ih != modCounter[i].end(); ih++) {
984  //We should be in the layer in question, and looping over all of the modules in said layer
985  //Generate the list for the TKmap, and the bad module list
986  mynum = (double)(((*ih).second).second);
987  myden = (double)(((*ih).second).first);
988  if(myden>0) myeff = mynum/myden;
989  else myeff=0;
990  hEffInLayer->Fill(myeff);
991 
992  if(!autoTagging) {
993  if ( (myden >= nModsMin) && (myeff < threshold) ) {
994  //We have a bad module, put it in the list!
995  BadModules[(*ih).first] = myeff;
996  tkmapbad->fillc((*ih).first,255,0,0);
997  cout << "Layer " << i <<" ("<< GetLayerName(i) << ") module " << (*ih).first << " efficiency: " << myeff << " , " << mynum << "/" << myden << endl;
998  }
999  else {
1000  //Fill the bad list with empty results for every module
1001  tkmapbad->fillc((*ih).first,255,255,255);
1002  }
1003  if(myden < nModsMin ) {
1004  cout << "Layer " << i <<" ("<< GetLayerName(i) << ") module " << (*ih).first << " is under occupancy at " << myden << endl;
1005  }
1006  }
1007 
1008  //Put any module into the TKMap
1009  tkmap->fill((*ih).first,1.-myeff);
1010  tkmapeff->fill((*ih).first,myeff);
1011  tkmapnum->fill((*ih).first,mynum);
1012  tkmapden->fill((*ih).first,myden);
1013 
1014  //Add the number of hits in the layer
1015  layertotal[i] += long(myden);
1016  layerfound[i] += long(mynum);
1017  }
1018 
1019  if(autoTagging) {
1020 
1021  //Compute threshold to use for each layer
1022  hEffInLayer->GetXaxis()->SetRange(3, hEffInLayer->GetNbinsX()+1); // Remove from the avg modules below 1%
1023  eff_limit = hEffInLayer->GetMean()-threshold;
1024  cout << "Layer " << i << " threshold for bad modules: " << eff_limit << endl;
1025  hEffInLayer->GetXaxis()->SetRange(1, hEffInLayer->GetNbinsX()+1);
1026 
1027 
1028  for( ih = modCounter[i].begin(); ih != modCounter[i].end(); ih++) {
1029  // Second loop over modules to tag inefficient ones
1030  mynum = (double)(((*ih).second).second);
1031  myden = (double)(((*ih).second).first);
1032  if(myden>0) myeff = mynum/myden;
1033  else myeff=0;
1034  if ( (myden >= nModsMin) && (myeff < eff_limit) ) {
1035  //We have a bad module, put it in the list!
1036  BadModules[(*ih).first] = myeff;
1037  tkmapbad->fillc((*ih).first,255,0,0);
1038  cout << "Layer " << i <<" ("<< GetLayerName(i) << ") module " << (*ih).first << " efficiency: " << myeff << " , " << mynum << "/" << myden << endl;
1039  }
1040  else {
1041  //Fill the bad list with empty results for every module
1042  tkmapbad->fillc((*ih).first,255,255,255);
1043  }
1044  if(myden < nModsMin ) {
1045  cout << "Layer " << i <<" ("<< GetLayerName(i) << ") module " << (*ih).first << " layer " << i << " is under occupancy at " << myden << endl;
1046  }
1047  }
1048 
1049  }
1050 
1051 
1052  }
1053  tkmap->save(true, 0, 0, "SiStripHitEffTKMap.png");
1054  tkmapbad->save(true, 0, 0, "SiStripHitEffTKMapBad.png");
1055  tkmapeff->save(true, _tkMapMin, 1., "SiStripHitEffTKMapEff.png");
1056  tkmapnum->save(true, 0, 0, "SiStripHitEffTKMapNum.png");
1057  tkmapden->save(true, 0, 0, "SiStripHitEffTKMapDen.png");
1058  cout << "Finished TKMap Generation\n";
1059 }
1060 
1061 
1063  //Generate the SQLite file for use in the Database of the bad modules!
1064  cout << "Entering SQLite file generation!\n";
1065  std::vector<unsigned int> BadStripList;
1066  unsigned short NStrips;
1067  unsigned int id1;
1068  SiStripQuality* pQuality = new SiStripQuality;
1069  //This is the list of the bad strips, use to mask out entire APVs
1070  //Now simply go through the bad hit list and mask out things that
1071  //are bad!
1072  map< unsigned int, double >::const_iterator it;
1073  for(it = BadModules.begin(); it != BadModules.end(); it++) {
1074  //We need to figure out how many strips are in this particular module
1075  //To Mask correctly!
1076  NStrips=reader->getNumberOfApvsAndStripLength((*it).first).first*128;
1077  cout << "Number of strips module " << (*it).first << " is " << NStrips << endl;
1078  BadStripList.push_back(pQuality->encode(0,NStrips,0));
1079  //Now compact into a single bad module
1080  id1=(unsigned int)(*it).first;
1081  cout << "ID1 shoudl match list of modules above " << id1 << endl;
1082  quality_->compact(id1,BadStripList);
1083  SiStripQuality::Range range(BadStripList.begin(),BadStripList.end());
1084  quality_->put(id1,range);
1085  BadStripList.clear();
1086  }
1087  //Fill all the bad components now
1089 }
1090 
1092  //Calculate the statistics by layer
1093  int totalfound = 0;
1094  int totaltotal = 0;
1095  double layereff;
1096  int subdetfound[5];
1097  int subdettotal[5];
1098 
1099  for(Long_t i=1; i<5; i++) {subdetfound[i]=0; subdettotal[i]=0;}
1100 
1101  for(Long_t i=1; i<=22; i++) {
1102  layereff = double(layerfound[i])/double(layertotal[i]);
1103  cout << "Layer " << i << " (" << GetLayerName(i) << ") has total efficiency " << layereff << " " << layerfound[i] << "/" << layertotal[i] << endl;
1104  totalfound += layerfound[i];
1105  totaltotal += layertotal[i];
1106  if(i<5) {subdetfound[1]+=layerfound[i]; subdettotal[1]+=layertotal[i];}
1107  if(i>=5 && i<11) {subdetfound[2]+=layerfound[i]; subdettotal[2]+=layertotal[i];}
1108  if(i>=11 && i<14) {subdetfound[3]+=layerfound[i]; subdettotal[3]+=layertotal[i];}
1109  if(i>=14) {subdetfound[4]+=layerfound[i]; subdettotal[4]+=layertotal[i];}
1110 
1111  }
1112 
1113  cout << "The total efficiency is " << double(totalfound)/double(totaltotal) << endl;
1114  cout << " TIB: " << double(subdetfound[1])/subdettotal[1] <<" "<< subdetfound[1]<<"/"<<subdettotal[1]<< endl;
1115  cout << " TOB: " << double(subdetfound[2])/subdettotal[2] <<" "<< subdetfound[2]<<"/"<<subdettotal[2]<< endl;
1116  cout << " TID: " << double(subdetfound[3])/subdettotal[3] <<" "<< subdetfound[3]<<"/"<<subdettotal[3]<< endl;
1117  cout << " TEC: " << double(subdetfound[4])/subdettotal[4] <<" "<< subdetfound[4]<<"/"<<subdettotal[4]<< endl;
1118 }
1119 
1121  //setTDRStyle();
1122 
1123  int nLayers = 34;
1124  if(_showRings) nLayers = 30;
1125  if(!_showEndcapSides) {
1126  if(!_showRings) nLayers=22;
1127  else nLayers=20;
1128  }
1129 
1130  TH1F *found = fs->make<TH1F>("found","found",nLayers+1,0,nLayers+1);
1131  TH1F *all = fs->make<TH1F>("all","all",nLayers+1,0,nLayers+1);
1132  TH1F *found2 = fs->make<TH1F>("found2","found2",nLayers+1,0,nLayers+1);
1133  TH1F *all2 = fs->make<TH1F>("all2","all2",nLayers+1,0,nLayers+1);
1134  // first bin only to keep real data off the y axis so set to -1
1135  found->SetBinContent(0,-1);
1136  all->SetBinContent(0,1);
1137 
1138  // new ROOT version: TGraph::Divide don't handle null or negative values
1139  for (Long_t i=1; i< nLayers+2; ++i) {
1140  found->SetBinContent(i,1e-6);
1141  all->SetBinContent(i,1);
1142  found2->SetBinContent(i,1e-6);
1143  all2->SetBinContent(i,1);
1144  }
1145 
1146  TCanvas *c7 =new TCanvas("c7"," test ",10,10,800,600);
1147  c7->SetFillColor(0);
1148  c7->SetGrid();
1149 
1150  int nLayers_max=nLayers+1; // barrel+endcap
1151  if(!_showEndcapSides) nLayers_max=11; // barrel
1152  for (Long_t i=1; i< nLayers_max; ++i) {
1153  cout << "Fill only good modules layer " << i << ": S = " << goodlayerfound[i] << " B = " << goodlayertotal[i] << endl;
1154  if (goodlayertotal[i] > 5) {
1155  found->SetBinContent(i,goodlayerfound[i]);
1156  all->SetBinContent(i,goodlayertotal[i]);
1157  }
1158 
1159  cout << "Filling all modules layer " << i << ": S = " << alllayerfound[i] << " B = " << alllayertotal[i] << endl;
1160  if (alllayertotal[i] > 5) {
1161  found2->SetBinContent(i,alllayerfound[i]);
1162  all2->SetBinContent(i,alllayertotal[i]);
1163  }
1164 
1165  }
1166 
1167  // endcap - merging sides
1168  if(!_showEndcapSides) {
1169  for (Long_t i=11; i< 14; ++i) { // TID disks
1170  cout << "Fill only good modules layer " << i << ": S = " << goodlayerfound[i]+goodlayerfound[i+3] << " B = " << goodlayertotal[i]+goodlayertotal[i+3] << endl;
1171  if (goodlayertotal[i]+goodlayertotal[i+3] > 5) {
1172  found->SetBinContent(i,goodlayerfound[i]+goodlayerfound[i+3]);
1173  all->SetBinContent(i,goodlayertotal[i]+goodlayertotal[i+3]);
1174  }
1175  cout << "Filling all modules layer " << i << ": S = " << alllayerfound[i]+alllayerfound[i+3] << " B = " << alllayertotal[i]+alllayertotal[i+3] << endl;
1176  if (alllayertotal[i]+alllayertotal[i+3] > 5) {
1177  found2->SetBinContent(i,alllayerfound[i]+alllayerfound[i+3]);
1178  all2->SetBinContent(i,alllayertotal[i]+alllayertotal[i+3]);
1179  }
1180  }
1181  for (Long_t i=17; i< 17+nTEClayers; ++i) { // TEC disks
1182  cout << "Fill only good modules layer " << i-3 << ": S = " << goodlayerfound[i]+goodlayerfound[i+nTEClayers] << " B = " << goodlayertotal[i]+goodlayertotal[i+nTEClayers] << endl;
1183  if (goodlayertotal[i]+goodlayertotal[i+nTEClayers] > 5) {
1184  found->SetBinContent(i-3,goodlayerfound[i]+goodlayerfound[i+nTEClayers]);
1185  all->SetBinContent(i-3,goodlayertotal[i]+goodlayertotal[i+nTEClayers]);
1186  }
1187  cout << "Filling all modules layer " << i-3 << ": S = " << alllayerfound[i]+alllayerfound[i+nTEClayers] << " B = " << alllayertotal[i]+alllayertotal[i+nTEClayers] << endl;
1188  if (alllayertotal[i]+alllayertotal[i+nTEClayers] > 5) {
1189  found2->SetBinContent(i-3,alllayerfound[i]+alllayerfound[i+nTEClayers]);
1190  all2->SetBinContent(i-3,alllayertotal[i]+alllayertotal[i+nTEClayers]);
1191  }
1192  }
1193  }
1194 
1195  found->Sumw2();
1196  all->Sumw2();
1197 
1198  found2->Sumw2();
1199  all2->Sumw2();
1200 
1201  TGraphAsymmErrors *gr = fs->make<TGraphAsymmErrors>(nLayers+1);
1202  gr->SetName("eff_good");
1203  gr->BayesDivide(found,all);
1204 
1205  TGraphAsymmErrors *gr2 = fs->make<TGraphAsymmErrors>(nLayers+1);
1206  gr2->SetName("eff_all");
1207  gr2->BayesDivide(found2,all2);
1208 
1209  for(int j = 0; j<nLayers+1; j++){
1210  gr->SetPointError(j, 0., 0., gr->GetErrorYlow(j),gr->GetErrorYhigh(j) );
1211  gr2->SetPointError(j, 0., 0., gr2->GetErrorYlow(j),gr2->GetErrorYhigh(j) );
1212  }
1213 
1214  gr->GetXaxis()->SetLimits(0,nLayers);
1215  gr->SetMarkerColor(2);
1216  gr->SetMarkerSize(1.2);
1217  gr->SetLineColor(2);
1218  gr->SetLineWidth(4);
1219  gr->SetMarkerStyle(20);
1220  gr->SetMinimum(_effPlotMin);
1221  gr->SetMaximum(1.001);
1222  gr->GetYaxis()->SetTitle("Efficiency");
1223  gStyle->SetTitleFillColor(0);
1224  gStyle->SetTitleBorderSize(0);
1225  gr->SetTitle(_title);
1226 
1227  gr2->GetXaxis()->SetLimits(0,nLayers);
1228  gr2->SetMarkerColor(1);
1229  gr2->SetMarkerSize(1.2);
1230  gr2->SetLineColor(1);
1231  gr2->SetLineWidth(4);
1232  gr2->SetMarkerStyle(21);
1233  gr2->SetMinimum(_effPlotMin);
1234  gr2->SetMaximum(1.001);
1235  gr2->GetYaxis()->SetTitle("Efficiency");
1236  gr2->SetTitle(_title);
1237 
1238  for ( Long_t k=1; k<nLayers+1; k++) {
1239  TString label;
1240  if(_showEndcapSides) label = GetLayerSideName(k);
1241  else label = GetLayerName(k);
1242  if(!_showTOB6TEC9) {
1243  if(k==10) label="";
1244  if(!_showRings && k==nLayers) label="";
1245  if(!_showRings && _showEndcapSides && k==25) label="";
1246  }
1247  if(!_showRings) {
1248  if(_showEndcapSides) {
1249  gr->GetXaxis()->SetBinLabel(((k+1)*100+2)/(nLayers)-4,label);
1250  gr2->GetXaxis()->SetBinLabel(((k+1)*100+2)/(nLayers)-4,label);
1251  }
1252  else {
1253  gr->GetXaxis()->SetBinLabel((k+1)*100/(nLayers)-6,label);
1254  gr2->GetXaxis()->SetBinLabel((k+1)*100/(nLayers)-6,label);
1255  }
1256  }
1257  else {
1258  if(_showEndcapSides) {
1259  gr->GetXaxis()->SetBinLabel((k+1)*100/(nLayers)-4,label);
1260  gr2->GetXaxis()->SetBinLabel((k+1)*100/(nLayers)-4,label);
1261  }
1262  else {
1263  gr->GetXaxis()->SetBinLabel((k+1)*100/(nLayers)-7,label);
1264  gr2->GetXaxis()->SetBinLabel((k+1)*100/(nLayers)-7,label);
1265  }
1266  }
1267  }
1268 
1269  gr->Draw("AP");
1270  gr->GetXaxis()->SetNdivisions(36);
1271 
1272  c7->cd();
1273  TPad *overlay = new TPad("overlay","",0,0,1,1);
1274  overlay->SetFillStyle(4000);
1275  overlay->SetFillColor(0);
1276  overlay->SetFrameFillStyle(4000);
1277  overlay->Draw("same");
1278  overlay->cd();
1279  if(!_showOnlyGoodModules) gr2->Draw("AP");
1280 
1281  TLegend *leg = new TLegend(0.70,0.27,0.88,0.40);
1282  leg->AddEntry(gr,"Good Modules","p");
1283  if(!_showOnlyGoodModules) leg->AddEntry(gr2,"All Modules","p");
1284  leg->SetTextSize(0.020);
1285  leg->SetFillColor(0);
1286  leg->Draw("same");
1287 
1288  c7->SaveAs("Summary.png");
1289 }
1290 
1291 
1293  cout<<"Computing efficiency vs bx"<<endl;
1294 
1295  unsigned int nLayers = 22;
1296  if(_showRings) nLayers = 20;
1297 
1298  for(unsigned int ilayer=1; ilayer<nLayers; ilayer++) {
1299  TH1F *hfound = fs->make<TH1F>(Form("foundVsBx_layer%i", ilayer),Form("layer %i", ilayer),3565,0,3565);
1300  TH1F *htotal = fs->make<TH1F>(Form("totalVsBx_layer%i", ilayer),Form("layer %i", ilayer),3565,0,3565);
1301 
1302  for(unsigned int ibx=0; ibx<3566; ibx++){
1303  hfound->SetBinContent(ibx, 1e-6);
1304  htotal->SetBinContent(ibx, 1);
1305  }
1306  map<unsigned int, vector<int> >::iterator iterMapvsBx;
1307  for(iterMapvsBx=layerfound_perBx.begin(); iterMapvsBx!=layerfound_perBx.end(); ++iterMapvsBx)
1308  hfound->SetBinContent( iterMapvsBx->first, iterMapvsBx->second[ilayer]);
1309  for(iterMapvsBx=layertotal_perBx.begin(); iterMapvsBx!=layertotal_perBx.end(); ++iterMapvsBx)
1310  if(iterMapvsBx->second[ilayer]>0) htotal->SetBinContent( iterMapvsBx->first, iterMapvsBx->second[ilayer]);
1311 
1312  hfound->Sumw2();
1313  htotal->Sumw2();
1314 
1315  TGraphAsymmErrors *geff = fs->make<TGraphAsymmErrors>(3564);
1316  geff->SetName(Form("effVsBx_layer%i", ilayer));
1317  geff->SetTitle("Hit Efficiency vs bx - "+GetLayerName(ilayer));
1318  geff->BayesDivide(hfound,htotal);
1319 
1320  //Average over trains
1321  TGraphAsymmErrors *geff_avg = fs->make<TGraphAsymmErrors>();
1322  geff_avg->SetName(Form("effVsBxAvg_layer%i", ilayer));
1323  geff_avg->SetTitle("Hit Efficiency vs bx - "+GetLayerName(ilayer));
1324  geff_avg->SetMarkerStyle(20);
1325  int ibx=0;
1326  int previous_bx=-80;
1327  int delta_bx=0;
1328  int nbx=0;
1329  int found=0;
1330  int total=0;
1331  double sum_bx=0;
1332  int ipt=0;
1333  float low, up, eff;
1334  int firstbx=0;
1335  for(iterMapvsBx=layertotal_perBx.begin(); iterMapvsBx!=layertotal_perBx.end(); ++iterMapvsBx){
1336  ibx=iterMapvsBx->first;
1337  delta_bx=ibx-previous_bx;
1338  // consider a new train
1339  if(delta_bx>(int)_spaceBetweenTrains && nbx>0 && total>0){
1340  eff=found/(float)total;
1341  //cout<<"new train "<<ipt<<" "<<sum_bx/nbx<<" "<<eff<<endl;
1342  geff_avg->SetPoint(ipt, sum_bx/nbx, eff);
1343  low = TEfficiency::Bayesian(total, found, .683, 1, 1, false);
1344  up = TEfficiency::Bayesian(total, found, .683, 1, 1, true);
1345  geff_avg->SetPointError(ipt, sum_bx/nbx-firstbx, previous_bx-sum_bx/nbx, eff-low, up-eff);
1346  ipt++;
1347  sum_bx=0;
1348  found=0;
1349  total=0;
1350  nbx=0;
1351  firstbx=ibx;
1352  }
1353  sum_bx+=ibx;
1354  found+=hfound->GetBinContent(ibx);
1355  total+=htotal->GetBinContent(ibx);
1356  nbx++;
1357 
1358  previous_bx=ibx;
1359  }
1360  //last train
1361  eff=found/(float)total;
1362  //cout<<"new train "<<ipt<<" "<<sum_bx/nbx<<" "<<eff<<endl;
1363  geff_avg->SetPoint(ipt, sum_bx/nbx, eff);
1364  low = TEfficiency::Bayesian(total, found, .683, 1, 1, false);
1365  up = TEfficiency::Bayesian(total, found, .683, 1, 1, true);
1366  geff_avg->SetPointError(ipt, sum_bx/nbx-firstbx, previous_bx-sum_bx/nbx, eff-low, up-eff);
1367  }
1368 }
1369 
1370 
1372 
1373  TString layername="";
1374  TString ringlabel="D";
1375  if(_showRings) ringlabel="R";
1376  if (k>0 && k<5) {
1377  layername = TString("TIB L") + k;
1378  } else if (k>4 && k<11) {
1379  layername = TString("TOB L")+(k-4);
1380  } else if (k>10 && k<14) {
1381  layername = TString("TID ")+ringlabel+(k-10);
1382  } else if (k>13 && k<14+nTEClayers) {
1383  layername = TString("TEC ")+ringlabel+(k-13);
1384  }
1385 
1386  return layername;
1387 }
1388 
1389 void SiStripHitEffFromCalibTree::ComputeEff(vector< TH1F* > &vhfound, vector< TH1F* > &vhtotal, string name) {
1390 
1391  unsigned int nLayers = 22;
1392  if(_showRings) nLayers = 20;
1393 
1394  TH1F* hfound;
1395  TH1F* htotal;
1396 
1397  for(unsigned int ilayer=1; ilayer<nLayers; ilayer++) {
1398 
1399  hfound = vhfound[ilayer];
1400  htotal = vhtotal[ilayer];
1401 
1402  hfound->Sumw2();
1403  htotal->Sumw2();
1404 
1405  // new ROOT version: TGraph::Divide don't handle null or negative values
1406  for (Long_t i=0; i< hfound->GetNbinsX()+1; ++i) {
1407  if( hfound->GetBinContent(i)==0) hfound->SetBinContent(i,1e-6);
1408  if( htotal->GetBinContent(i)==0) htotal->SetBinContent(i,1);
1409  }
1410 
1411  TGraphAsymmErrors *geff = fs->make<TGraphAsymmErrors>(hfound->GetNbinsX());
1412  geff->SetName(Form("%s_layer%i", name.c_str(), ilayer));
1413  geff->BayesDivide(hfound, htotal);
1414  if(name=="effVsLumi") geff->SetTitle("Hit Efficiency vs inst. lumi. - "+GetLayerName(ilayer));
1415  if(name=="effVsPU") geff->SetTitle("Hit Efficiency vs pileup - "+GetLayerName(ilayer));
1416  if(name=="effVsCM") geff->SetTitle("Hit Efficiency vs common Mode - "+GetLayerName(ilayer));
1417  geff->SetMarkerStyle(20);
1418 
1419  }
1420 
1421 }
1422 
1424  cout<<"Computing efficiency vs lumi"<<endl;
1425 
1426  if(instLumiHisto->GetEntries()) // from infos per event
1427  cout<<"Avg conditions (avg+/-rms): lumi :"<<instLumiHisto->GetMean()<<"+/-"<<instLumiHisto->GetRMS()
1428  <<" pu: "<<PUHisto->GetMean()<<"+/-"<<PUHisto->GetRMS()<<endl;
1429 
1430  else { // from infos per hit
1431 
1432  unsigned int nLayers = 22;
1433  if(_showRings) nLayers = 20;
1434  unsigned int nLayersForAvg = 0;
1435  float layerLumi = 0;
1436  float layerPU = 0;
1437  float avgLumi = 0;
1438  float avgPU = 0;
1439 
1440  cout<<"Lumi summary: (avg over trajectory measurements)"<<endl;
1441  for(unsigned int ilayer=1; ilayer<nLayers; ilayer++) {
1442  layerLumi=layertotal_vsLumi[ilayer]->GetMean();
1443  layerPU=layertotal_vsPU[ilayer]->GetMean();
1444  //cout<<" layer "<<ilayer<<" lumi: "<<layerLumi<<" pu: "<<layerPU<<endl;
1445  if(layerLumi!=0 && layerPU!=0) {
1446  avgLumi+=layerLumi;
1447  avgPU+=layerPU;
1448  nLayersForAvg++;
1449  }
1450  }
1451  avgLumi/=nLayersForAvg;
1452  avgPU/=nLayersForAvg;
1453  cout<<"Avg conditions: lumi :"<<avgLumi<<" pu: "<<avgPU<<endl;
1454  }
1455 
1458 
1459 }
1460 
1462  cout<<"Computing efficiency vs CM"<<endl;
1464 }
1465 
1467 
1468  TString layername="";
1469  TString ringlabel="D";
1470  if(_showRings) ringlabel="R";
1471  if (k>0 && k<5) {
1472  layername = TString("TIB L") + k;
1473  } else if (k>4&&k<11) {
1474  layername = TString("TOB L")+(k-4);
1475  } else if (k>10&&k<14) {
1476  layername = TString("TID- ")+ringlabel+(k-10);
1477  } else if (k>13&&k<17) {
1478  layername = TString("TID+ ")+ringlabel+(k-13);
1479  } else if (k>16&&k<17+nTEClayers) {
1480  layername = TString("TEC- ")+ringlabel+(k-16);
1481  } else if (k>16+nTEClayers) {
1482  layername = TString("TEC+ ")+ringlabel+(k-16-nTEClayers);
1483  }
1484 
1485  return layername;
1486 }
1487 
1489  //Need this for a Condition DB Writer
1490  //Initialize a return variable
1492 
1495 
1496  for(;rIter!=rIterEnd;++rIter){
1497  SiStripBadStrip::Range range(quality_->getDataVectorBegin()+rIter->ibegin,quality_->getDataVectorBegin()+rIter->iend);
1498  if ( ! obj->put(rIter->detid,range) )
1499  edm::LogError("SiStripHitEffFromCalibTree")<<"[SiStripHitEffFromCalibTree::getNewObject] detid already exists"<<std::endl;
1500  }
1501 
1502  return obj;
1503 }
1504 
1506  float phi = 0;
1507  float Pi = 3.14159;
1508  if((x>=0)&&(y>=0)) phi = atan(y/x);
1509  else if((x>=0)&&(y<=0)) phi = atan(y/x) + 2*Pi;
1510  else if((x<=0)&&(y>=0)) phi = atan(y/x) + Pi;
1511  else phi = atan(y/x) + Pi;
1512  phi = phi*180.0/Pi;
1513 
1514  return phi;
1515 }
1516 
1517 void SiStripHitEffFromCalibTree::SetBadComponents(int i, int component,SiStripQuality::BadComponent& BC, std::stringstream ssV[4][19], int NBadComponent[4][19][4]){
1518 
1519  int napv=reader->getNumberOfApvsAndStripLength(BC.detid).first;
1520 
1521  ssV[i][component] << "\n\t\t "
1522  << BC.detid
1523  << " \t " << BC.BadModule << " \t "
1524  << ( (BC.BadFibers)&0x1 ) << " ";
1525  if (napv==4)
1526  ssV[i][component] << "x " <<( (BC.BadFibers>>1)&0x1 );
1527 
1528  if (napv==6)
1529  ssV[i][component] << ( (BC.BadFibers>>1)&0x1 ) << " "
1530  << ( (BC.BadFibers>>2)&0x1 );
1531  ssV[i][component] << " \t "
1532  << ( (BC.BadApvs)&0x1 ) << " "
1533  << ( (BC.BadApvs>>1)&0x1 ) << " ";
1534  if (napv==4)
1535  ssV[i][component] << "x x " << ( (BC.BadApvs>>2)&0x1 ) << " "
1536  << ( (BC.BadApvs>>3)&0x1 );
1537  if (napv==6)
1538  ssV[i][component] << ( (BC.BadApvs>>2)&0x1 ) << " "
1539  << ( (BC.BadApvs>>3)&0x1 ) << " "
1540  << ( (BC.BadApvs>>4)&0x1 ) << " "
1541  << ( (BC.BadApvs>>5)&0x1 ) << " ";
1542 
1543  if (BC.BadApvs){
1544  NBadComponent[i][0][2]+= ( (BC.BadApvs>>5)&0x1 )+ ( (BC.BadApvs>>4)&0x1 ) + ( (BC.BadApvs>>3)&0x1 ) +
1545  ( (BC.BadApvs>>2)&0x1 )+ ( (BC.BadApvs>>1)&0x1 ) + ( (BC.BadApvs)&0x1 );
1546  NBadComponent[i][component][2]+= ( (BC.BadApvs>>5)&0x1 )+ ( (BC.BadApvs>>4)&0x1 ) + ( (BC.BadApvs>>3)&0x1 ) +
1547  ( (BC.BadApvs>>2)&0x1 )+ ( (BC.BadApvs>>1)&0x1 ) + ( (BC.BadApvs)&0x1 );
1548  }
1549  if (BC.BadFibers){
1550  NBadComponent[i][0][1]+= ( (BC.BadFibers>>2)&0x1 )+ ( (BC.BadFibers>>1)&0x1 ) + ( (BC.BadFibers)&0x1 );
1551  NBadComponent[i][component][1]+= ( (BC.BadFibers>>2)&0x1 )+ ( (BC.BadFibers>>1)&0x1 ) + ( (BC.BadFibers)&0x1 );
1552  }
1553  if (BC.BadModule){
1554  NBadComponent[i][0][0]++;
1555  NBadComponent[i][component][0]++;
1556  }
1557 }
1558 
unsigned short range
RunNumber_t run() const
Definition: EventID.h:39
Definition: BitonicSort.h:8
const double Pi
T getParameter(std::string const &) const
EventNumber_t event() const
Definition: EventID.h:41
T getUntrackedParameter(std::string const &, T const &) const
const std::vector< BadComponent > & getBadComponentList() const
unsigned int tibLayer(const DetId &id) const
virtual const std::array< const float, 4 > parameters() const
const std::pair< unsigned short, double > getNumberOfApvsAndStripLength(uint32_t detId) const
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
edm::LuminosityBlockNumber_t luminosityBlock() const
Definition: EventBase.h:63
const Bounds & bounds() const
Definition: Surface.h:120
unsigned int tidWheel(const DetId &id) const
T * make(const Args &...args) const
make new ROOT object
Definition: TFileService.h:64
void SetBadComponents(int i, int component, SiStripQuality::BadComponent &BC, std::stringstream ssV[4][19], int NBadComponent[4][19][4])
Registry::const_iterator RegistryIterator
SiStripDetInfoFileReader * reader
bool accept(const edm::Event &event, const edm::TriggerResults &triggerTable, const std::string &triggerPath)
Definition: TopDQMHelpers.h:30
virtual const StripTopology & specificTopology() const
Returns a reference to the strip proxy topology.
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:42
virtual float width() const =0
const TrackerGeomDet * idToDetUnit(DetId) const override
Return the pointer to the GeomDetUnit corresponding to a given DetId.
def overlay(hists, ytitle, header, addon)
Definition: compare.py:120
RegistryIterator getRegistryVectorEnd() const
edm::Service< TFileService > fs
map< unsigned int, vector< int > > layerfound_perBx
unsigned int tidSide(const DetId &id) const
void ComputeEff(vector< TH1F * > &vhfound, vector< TH1F * > &vhtotal, string name)
void algoBeginJob(const edm::EventSetup &) override
void save(bool print_total=true, float minval=0., float maxval=0., std::string s="svgmap.svg", int width=1500, int height=800)
Definition: TrackerMap.cc:699
void compact(unsigned int &, std::vector< unsigned int > &)
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:41
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
#define end
Definition: vmac.h:39
map< pair< unsigned int, unsigned int >, array< double, 3 > > eventInfos
SiStripBadStrip * getNewObject() override
void fillBadComponents()
map< unsigned int, pair< unsigned int, unsigned int > > modCounter[23]
void fillc(int idmod, int RGBcode)
Definition: TrackerMap.h:109
int k[5][pyjets_maxn]
unsigned int id
ContainerIterator getDataVectorBegin() const
Detector identifier class for the strip tracker.
Definition: SiStripDetId.h:17
Definition: DetId.h:18
virtual int nstrips() const =0
RegistryIterator getRegistryVectorBegin() const
edm::EventID id() const
Definition: EventBase.h:60
fixed size matrix
#define begin
Definition: vmac.h:32
HLT enums.
map< unsigned int, vector< int > > layertotal_perBx
void algoAnalyze(const edm::Event &e, const edm::EventSetup &c) override
double a
Definition: hdecay.h:121
std::pair< ContainerIterator, ContainerIterator > Range
T get() const
Definition: EventSetup.h:63
std::string fullPath() const
Definition: FileInPath.cc:197
map< unsigned int, double > BadModules
bool put(const uint32_t &detID, const InputVector &vect)
#define str(s)
unsigned int tecWheel(const DetId &id) const
T const * product() const
Definition: ESHandle.h:86
unsigned int encode(const unsigned short &first, const unsigned short &NconsecutiveBadStrips, const unsigned short &flag=0)
TimeValue_t value() const
Definition: Timestamp.h:56
SiStripHitEffFromCalibTree(const edm::ParameterSet &)
edm::Timestamp time() const
Definition: EventBase.h:61
void fill(int layer, int ring, int nmod, float x)
Definition: TrackerMap.cc:2786
data decode(const unsigned int &value) const
unsigned int tobLayer(const DetId &id) const
unsigned int tecSide(const DetId &id) const