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