CMS 3D CMS Logo

EcalCosmicsHists.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: EcalCosmicsHists
4 // Class: EcalCosmicsHists
5 //
18 
22 
25 
28 
29 using namespace cms;
30 using namespace edm;
31 using namespace std;
32 
33 //
34 // constants, enums and typedefs
35 //
36 
37 //
38 // static data member definitions
39 //
40 
41 //
42 // constructors and destructor
43 //
45  : ecalRawDataColl_(iConfig.getParameter<edm::InputTag>("ecalRawDataColl")),
46  ecalRecHitCollectionEB_(iConfig.getParameter<edm::InputTag>("ecalRecHitCollectionEB")),
47  ecalRecHitCollectionEE_(iConfig.getParameter<edm::InputTag>("ecalRecHitCollectionEE")),
48  barrelClusterCollection_(iConfig.getParameter<edm::InputTag>("barrelClusterCollection")),
49  endcapClusterCollection_(iConfig.getParameter<edm::InputTag>("endcapClusterCollection")),
50  l1GTReadoutRecTag_(iConfig.getUntrackedParameter<std::string>("L1GlobalReadoutRecord", "gtDigis")),
51  l1GMTReadoutRecTag_(iConfig.getUntrackedParameter<std::string>("L1GlobalMuonReadoutRecord", "gtDigis")),
52  barrelClusterToken_(consumes<reco::SuperClusterCollection>(barrelClusterCollection_)),
53  endcapClusterToken_(consumes<reco::SuperClusterCollection>(endcapClusterCollection_)),
54  ebRecHitToken_(consumes<EcalRecHitCollection>(ecalRecHitCollectionEB_)),
55  eeRecHitToken_(consumes<EcalRecHitCollection>(ecalRecHitCollectionEE_)),
56  ecalRawDataToken_(consumes<EcalRawDataCollection>(ecalRawDataColl_)),
57  tracksToken_(consumes<reco::TrackCollection>(edm::InputTag("cosmicMuons"))),
58  tracksBarrelToken_(consumes<reco::TrackCollection>(edm::InputTag("cosmicMuonsBarrelOnly"))),
59  hbheRecHitToken_(consumes<HBHERecHitCollection>(edm::InputTag("hbhereco"))),
60  hfRecHitToken_(consumes<HFRecHitCollection>(edm::InputTag("hfreco"))),
61  hoRecHitToken_(consumes<HORecHitCollection>(edm::InputTag("horeco"))),
62  l1MuGMTToken_(consumes<L1MuGMTReadoutCollection>(l1GMTReadoutRecTag_)),
63  l1GTReadoutToken_(consumes<L1GlobalTriggerReadoutRecord>(l1GTReadoutRecTag_)),
64  gtRecordToken_(consumes<L1GlobalTriggerReadoutRecord>(edm::InputTag("gtDigis"))),
65  ecalADCToGeVConstantToken_(esConsumes()),
66  l1MenuToken_(esConsumes()),
67  ecalMappingToken_(esConsumes<edm::Transition::BeginRun>()),
68  runNum_(-1),
69  histRangeMax_(iConfig.getUntrackedParameter<double>("histogramMaxRange", 1.8)),
70  histRangeMin_(iConfig.getUntrackedParameter<double>("histogramMinRange", 0.0)),
71  minTimingAmpEB_(iConfig.getUntrackedParameter<double>("MinTimingAmpEB", 0.100)),
72  minTimingAmpEE_(iConfig.getUntrackedParameter<double>("MinTimingAmpEE", 0.100)),
73  minRecHitAmpEB_(iConfig.getUntrackedParameter<double>("MinRecHitAmpEB", 0.027)),
74  minRecHitAmpEE_(iConfig.getUntrackedParameter<double>("MinRecHitAmpEE", 0.18)),
75  minHighEnergy_(iConfig.getUntrackedParameter<double>("MinHighEnergy", 2.0)),
76  fileName_(iConfig.getUntrackedParameter<std::string>("fileName", std::string("ecalCosmicHists"))),
77  runInFileName_(iConfig.getUntrackedParameter<bool>("runInFileName", true)),
78  startTime_(iConfig.getUntrackedParameter<double>("TimeStampStart", 1215107133.)),
79  runTimeLength_(iConfig.getUntrackedParameter<double>("TimeStampLength", 3.)),
80  numTimingBins_(iConfig.getUntrackedParameter<int>("TimeStampBins", 1800)) {
81  naiveEvtNum_ = 0;
82  cosmicCounter_ = 0;
83  cosmicCounterEB_ = 0;
87 
88  // TrackAssociator parameters
89  edm::ParameterSet trkParameters = iConfig.getParameter<edm::ParameterSet>("TrackAssociatorParameters");
91  trackParameters_.loadParameters(trkParameters, iC);
93 
94  string title1 = "Seed Energy for All Feds; Seed Energy (GeV)";
95  string name1 = "SeedEnergyAllFEDs";
96  int numBins = 200; //(int)round(histRangeMax_-histRangeMin_)+1;
97  allFedsHist_ = new TH1F(name1.c_str(), title1.c_str(), numBins, histRangeMin_, histRangeMax_);
98 
99  fedMap_ = new EcalFedMap();
100 }
101 
103 
104 //
105 // member functions
106 //
107 
108 // ------------ method called to for each event ------------
110  bool hasEndcapClusters = true;
111  int ievt = iEvent.id().event();
112 
115 
116  naiveEvtNum_++;
117 
118  //LogDebug("EcalCosmicsHists")<< " My Event: " << naiveEvtNum_ << " " << iEvent.id().run() << " " << iEvent.id().event() << " " << iEvent.time().value();
119  //LogDebug("EcalCosmicsHists")<< "Timestamp: " << iEvent.id().run() << " " << iEvent.id().event() << " " << iEvent.time().value();
120 
121  // check DB payload
122  const auto& agc = iSetup.getData(ecalADCToGeVConstantToken_);
123  if (naiveEvtNum_ <= 1) {
124  LogWarning("EcalCosmicsHists") << "Global EB ADC->GeV scale: " << agc.getEBValue() << " GeV/ADC count";
125  LogWarning("EcalCosmicsHists") << "Global EE ADC->GeV scale: " << agc.getEEValue() << " GeV/ADC count";
126  }
127 
128  //===================TIMESTAMP INFORMTION=================================
129  // Code added to get the time in seconds
130  unsigned int timeStampLow = (0xFFFFFFFF & iEvent.time().value());
131  unsigned int timeStampHigh = (iEvent.time().value() >> 32);
132  double rawEventTime = (double)(timeStampHigh) + ((double)(timeStampLow) / 1000000.);
133  double eventTime = rawEventTime - startTime_; //Notice the subtraction of the "starttime"
134  //std::cout << "Event Time " << eventTime << " High " <<timeStampHigh<< " low"<<timeStampLow <<" value " <<iEvent.time().value() << std::endl;
135  //========================================================================
136 
137  iEvent.getByToken(barrelClusterToken_, bscHandle);
138  if (!(bscHandle.isValid())) {
139  LogWarning("EcalCosmicsHists") << barrelClusterCollection_ << " not available";
140  return;
141  }
142  LogDebug("EcalCosmicsHists") << "event " << ievt;
143 
144  iEvent.getByToken(endcapClusterToken_, escHandle);
145  if (!(escHandle.isValid())) {
146  LogWarning("EcalCosmicsHists") << endcapClusterCollection_ << " not available";
147  hasEndcapClusters = false;
148  //return;
149  }
150 
152  iEvent.getByToken(ebRecHitToken_, hits);
153  if (!(hits.isValid())) {
154  LogWarning("EcalCosmicsHists") << ecalRecHitCollectionEB_ << " not available";
155  return;
156  }
158  iEvent.getByToken(eeRecHitToken_, hitsEE);
159  if (!(hitsEE.isValid())) {
160  LogWarning("EcalCosmicsHists") << ecalRecHitCollectionEE_ << " not available";
161  return;
162  }
163 
165  iEvent.getByToken(ecalRawDataToken_, DCCHeaders);
166  if (!DCCHeaders.isValid())
167  LogWarning("EcalCosmicsHists") << "DCC headers not available";
168 
169  //make the bx histos right here
170  //TODO: Right now we are filling histos for errors...
171  int orbit = -100;
172  int bx = -100;
173  int runType = -100;
174 
175  for (EcalRawDataCollection::const_iterator headerItr = DCCHeaders->begin(); headerItr != DCCHeaders->end();
176  ++headerItr) {
177  headerItr->getEventSettings();
178  int myorbit = headerItr->getOrbit();
179  int mybx = headerItr->getBX();
180  int myRunType = headerItr->getRunType();
181  int FEDid = headerItr->fedId();
182  TH2F* dccRuntypeHist = FEDsAndDCCRuntypeVsBxHists_[FEDid];
183  if (dccRuntypeHist == nullptr) {
184  initHists(FEDid);
185  dccRuntypeHist = FEDsAndDCCRuntypeVsBxHists_[FEDid];
186  }
187  dccRuntypeHist->Fill(mybx, myRunType);
188 
189  if (bx == -100) {
190  bx = mybx;
191  } else if (bx != mybx) {
192  LogWarning("EcalCosmicsHists") << "This header has a conflicting bx OTHERS were " << bx << " here " << mybx;
193  dccBXErrorByFEDHist_->Fill(headerItr->fedId());
194  if (bx != -100) {
195  dccErrorVsBxHist_->Fill(bx, 0);
196  }
197  }
198 
199  if (runType == -100) {
200  runType = myRunType;
201  } else if (runType != myRunType) {
202  LogWarning("EcalCosmicsHists") << "This header has a conflicting runType OTHERS were " << bx << " here " << mybx;
203  dccRuntypeErrorByFEDHist_->Fill(headerItr->fedId());
204  if (bx != -100)
205  dccErrorVsBxHist_->Fill(bx, 2);
206  }
207 
208  if (orbit == -100) {
209  orbit = myorbit;
210  } else if (orbit != myorbit) {
211  LogWarning("EcalCosmicsHists") << "This header has a conflicting orbit; OTHERS were " << orbit << " here "
212  << myorbit;
213  dccOrbitErrorByFEDHist_->Fill(headerItr->fedId());
214  if (bx != -100)
215  dccErrorVsBxHist_->Fill(bx, 1);
216  }
217  }
218  dccEventVsBxHist_->Fill(bx, runType);
219  dccRuntypeHist_->Fill(runType);
220 
221  std::vector<bool> l1Triggers = determineTriggers(iEvent, iSetup);
222  bool isEcalL1 = l1Triggers[4];
223  bool isHCALL1 = l1Triggers[3];
224  bool isRPCL1 = l1Triggers[2];
225  bool isCSCL1 = l1Triggers[1];
226  bool isDTL1 = l1Triggers[0];
227 
228  if (runNum_ == -1) {
229  runNum_ = iEvent.id().run();
230  }
231 
232  int numberOfCosmics = 0;
233  int numberOfCosmicsEB = 0;
234  int numberOfCosmicsEEP = 0;
235  int numberOfCosmicsEEM = 0;
236  int numberOfCosmicsTop = 0;
237  int numberOfCosmicsBottom = 0;
238  int numberOfHighEClusters = 0;
239  //int eventnum = iEvent.id().event();
240  std::vector<EBDetId> seeds;
241 
242  //++++++++++++++++++BEGIN LOOP OVER EB SUPERCLUSTERS+++++++++++++++++++++++++//
243 
244  const reco::SuperClusterCollection* clusterCollection_p = bscHandle.product();
245  for (reco::SuperClusterCollection::const_iterator clus = clusterCollection_p->begin();
246  clus != clusterCollection_p->end();
247  ++clus) {
248  double energy = clus->energy();
249  double phi = clus->phi();
250  double eta = clus->eta();
251  double time = -1000.0;
252  double ampli = 0.;
253  double secondMin = 0.;
254  double secondTime = -1000.;
255  int numXtalsinCluster = 0;
256 
257  EBDetId maxDet;
258  EBDetId secDet;
259 
260  numberofBCinSC_->Fill(clus->clustersSize());
261  numberofBCinSCphi_->Fill(phi, clus->clustersSize());
262 
263  for (reco::CaloCluster_iterator bclus = (clus->clustersBegin()); bclus != (clus->clustersEnd()); ++bclus) {
264  double cphi = (*bclus)->phi();
265  double ceta = (*bclus)->eta();
266  TrueBCOccupancy_->Fill(cphi, ceta);
267  TrueBCOccupancyCoarse_->Fill(cphi, ceta);
268  }
269 
270  std::vector<std::pair<DetId, float> > clusterDetIds = clus->hitsAndFractions(); //get these from the cluster
271  for (std::vector<std::pair<DetId, float> >::const_iterator detitr = clusterDetIds.begin();
272  detitr != clusterDetIds.end();
273  ++detitr) {
274  //Here I use the "find" on a digi collection... I have been warned...
275  if ((*detitr).first.det() != DetId::Ecal) {
276  std::cout << " det is " << (*detitr).first.det() << std::endl;
277  continue;
278  }
279  if ((*detitr).first.subdetId() != EcalBarrel) {
280  std::cout << " subdet is " << (*detitr).first.subdetId() << std::endl;
281  continue;
282  }
283  EcalRecHitCollection::const_iterator thishit = hits->find((*detitr).first);
284  if (thishit == hits->end())
285  continue;
286  //The checking above should no longer be needed...... as only those in the cluster would already have rechits..
287 
288  EcalRecHit myhit = (*thishit);
289 
290  double thisamp = myhit.energy();
291  if (thisamp > minRecHitAmpEB_) {
292  numXtalsinCluster++;
293  }
294  if (thisamp > secondMin) {
295  secondMin = thisamp;
296  secondTime = myhit.time();
297  secDet = (EBDetId)(*detitr).first;
298  }
299  if (secondMin > ampli) {
300  std::swap(ampli, secondMin);
301  std::swap(time, secondTime);
302  std::swap(maxDet, secDet);
303  }
304  }
305 
306  double fullnumXtalsinCluster = clusterDetIds.size();
307 
308  float E2 = ampli + secondMin;
310  int FEDid = 600 + elecId.dccId();
311 
312  numberOfCosmics++;
313  numberOfCosmicsEB++;
314 
315  //Set some more values
316  seeds.push_back(maxDet);
317  int ieta = maxDet.ieta();
318  int iphi = maxDet.iphi();
319  int ietaSM = maxDet.ietaSM();
320  int iphiSM = maxDet.iphiSM();
321 
322  int LM = ecalElectronicsMap_->getLMNumber(maxDet); //FIX ME
323 
324  // top and bottom clusters
325  if (iphi > 0 && iphi < 180) {
326  numberOfCosmicsTop++;
327  } else {
328  numberOfCosmicsBottom++;
329  }
330 
331  // fill the proper hist
332  TH1F* uRecHist = FEDsAndHists_[FEDid];
333  TH1F* E2uRecHist = FEDsAndE2Hists_[FEDid];
334  TH1F* energyuRecHist = FEDsAndenergyHists_[FEDid];
335  TH1F* timingHist = FEDsAndTimingHists_[FEDid];
336  TH1F* freqHist = FEDsAndFrequencyHists_[FEDid];
337  TH1F* iphiProfileHist = FEDsAndiPhiProfileHists_[FEDid];
338  TH1F* ietaProfileHist = FEDsAndiEtaProfileHists_[FEDid];
339  TH2F* timingHistVsFreq = FEDsAndTimingVsFreqHists_[FEDid];
340  TH2F* timingHistVsAmp = FEDsAndTimingVsAmpHists_[FEDid];
341  TH2F* E2vsE1uRecHist = FEDsAndE2vsE1Hists_[FEDid];
342  TH2F* energyvsE1uRecHist = FEDsAndenergyvsE1Hists_[FEDid];
343  TH2F* occupHist = FEDsAndOccupancyHists_[FEDid];
344  TH2F* timingHistVsPhi = FEDsAndTimingVsPhiHists_[FEDid];
345  TH2F* timingHistVsModule = FEDsAndTimingVsModuleHists_[FEDid];
346 
347  if (uRecHist == nullptr) {
348  initHists(FEDid);
349  uRecHist = FEDsAndHists_[FEDid];
350  E2uRecHist = FEDsAndE2Hists_[FEDid];
351  energyuRecHist = FEDsAndenergyHists_[FEDid];
352  timingHist = FEDsAndTimingHists_[FEDid];
353  freqHist = FEDsAndFrequencyHists_[FEDid];
354  timingHistVsFreq = FEDsAndTimingVsFreqHists_[FEDid];
355  timingHistVsAmp = FEDsAndTimingVsAmpHists_[FEDid];
356  iphiProfileHist = FEDsAndiPhiProfileHists_[FEDid];
357  ietaProfileHist = FEDsAndiEtaProfileHists_[FEDid];
358  E2vsE1uRecHist = FEDsAndE2vsE1Hists_[FEDid];
359  energyvsE1uRecHist = FEDsAndenergyvsE1Hists_[FEDid];
360  occupHist = FEDsAndOccupancyHists_[FEDid];
361  timingHistVsPhi = FEDsAndTimingVsPhiHists_[FEDid];
362  timingHistVsModule = FEDsAndTimingVsModuleHists_[FEDid];
363  }
364 
365  uRecHist->Fill(ampli);
366  E2uRecHist->Fill(E2);
367  E2vsE1uRecHist->Fill(ampli, E2);
368  energyuRecHist->Fill(energy);
369  energyvsE1uRecHist->Fill(ampli, energy);
370  allFedsHist_->Fill(ampli);
371  allFedsE2Hist_->Fill(E2);
372  allFedsenergyHist_->Fill(energy);
374  allFedsE2vsE1Hist_->Fill(ampli, E2);
375  allFedsenergyvsE1Hist_->Fill(ampli, energy);
376  freqHist->Fill(naiveEvtNum_);
377  iphiProfileHist->Fill(iphi);
378  ietaProfileHist->Fill(ieta);
379 
383  allOccupancy_->Fill(iphi, ieta);
384  TrueOccupancy_->Fill(phi, eta);
385  allOccupancyCoarse_->Fill(iphi, ieta);
386  TrueOccupancyCoarse_->Fill(phi, eta);
387  allFedsNumXtalsInClusterHist_->Fill(numXtalsinCluster);
388  NumXtalsInClusterHist_->Fill(fullnumXtalsinCluster);
389  numxtalsVsEnergy_->Fill(energy, numXtalsinCluster);
390  numxtalsVsHighEnergy_->Fill(energy, numXtalsinCluster);
391 
392  //Fill the hists for the time stamp information
393  allFedsFreqTimeVsPhiHist_->Fill(iphi, eventTime);
394  allFedsFreqTimeVsPhiTTHist_->Fill(iphi, eventTime);
395  allFedsFreqTimeVsEtaHist_->Fill(eventTime, ieta);
396  allFedsFreqTimeVsEtaTTHist_->Fill(eventTime, ieta);
397  //end time stamp hists
398 
399  occupHist->Fill(ietaSM, iphiSM);
400  if (fullnumXtalsinCluster == 1) {
403  }
404 
405  // Exclusive trigger plots
406 
407  if (isEcalL1 && !isDTL1 && !isRPCL1 && !isCSCL1 && !isHCALL1) {
410  if (ampli > minTimingAmpEB_) {
414  allFedsTimingLMHistECAL_->Fill(LM, time);
415  }
416  triggerExclusiveHist_->Fill(0);
417  }
418 
419  if (!isEcalL1 && !isDTL1 && !isRPCL1 && !isCSCL1 && isHCALL1) {
422  if (ampli > minTimingAmpEB_) {
426  allFedsTimingLMHistHCAL_->Fill(LM, time);
427  }
428  triggerExclusiveHist_->Fill(1);
429  }
430 
431  if (!isEcalL1 && isDTL1 && !isRPCL1 && !isCSCL1 && !isHCALL1) {
434  if (ampli > minTimingAmpEB_) {
435  allFedsTimingHistDT_->Fill(time);
438  allFedsTimingLMHistDT_->Fill(LM, time);
439  }
440  triggerExclusiveHist_->Fill(2);
441  }
442 
443  if (!isEcalL1 && !isDTL1 && isRPCL1 && !isCSCL1 && !isHCALL1) {
446  if (ampli > minTimingAmpEB_) {
450  allFedsTimingLMHistRPC_->Fill(LM, time);
451  }
452  triggerExclusiveHist_->Fill(3);
453  }
454 
455  if (!isEcalL1 && !isDTL1 && !isRPCL1 && isCSCL1 && !isHCALL1) {
458  if (ampli > minTimingAmpEB_) {
462  allFedsTimingLMHistCSC_->Fill(LM, time);
463  }
464  triggerExclusiveHist_->Fill(4);
465  }
466 
467  // Inclusive trigger plots
468 
469  if (isEcalL1) {
470  triggerHist_->Fill(0);
471  allOccupancyECAL_->Fill(iphi, ieta);
473  }
474  if (isHCALL1) {
475  triggerHist_->Fill(1);
476  allOccupancyHCAL_->Fill(iphi, ieta);
478  }
479  if (isDTL1) {
480  triggerHist_->Fill(2);
481  allOccupancyDT_->Fill(iphi, ieta);
483  }
484  if (isRPCL1) {
485  triggerHist_->Fill(3);
486  allOccupancyRPC_->Fill(iphi, ieta);
488  }
489  if (isCSCL1) {
490  triggerHist_->Fill(4);
491  allOccupancyCSC_->Fill(iphi, ieta);
493  }
494 
495  // Fill histo for Ecal+muon coincidence
496  if (isEcalL1 && (isCSCL1 || isRPCL1 || isDTL1) && !isHCALL1)
498 
499  if (ampli > minTimingAmpEB_) {
500  timingHist->Fill(time);
501  timingHistVsFreq->Fill(time, naiveEvtNum_);
502  timingHistVsAmp->Fill(time, ampli);
503  allFedsTimingHist_->Fill(time);
504  allFedsTimingVsAmpHist_->Fill(time, ampli);
506  timingHistVsPhi->Fill(time, iphiSM);
507  timingHistVsModule->Fill(time, ietaSM);
511  allFedsTimingLMHist_->Fill(LM, time);
512  if (FEDid >= 610 && FEDid <= 627)
514  if (FEDid >= 628 && FEDid <= 645)
516 
517  if (FEDid >= 610 && FEDid <= 627)
519  if (FEDid >= 628 && FEDid <= 645)
521  if (FEDid >= 613 && FEDid <= 616)
523  if (FEDid >= 631 && FEDid <= 634)
525  if (FEDid >= 622 && FEDid <= 625)
527  if (FEDid >= 640 && FEDid <= 643)
529  }
530 
531  // *** High Energy Clusters Analysis ** //
532 
533  if (energy > minHighEnergy_) {
534  LogInfo("EcalCosmicsHists") << "High energy event " << iEvent.id().run() << " : " << iEvent.id().event() << " "
535  << naiveEvtNum_ << " : " << energy << " " << numXtalsinCluster << " : " << iphi << " "
536  << ieta << " : " << isEcalL1 << isHCALL1 << isDTL1 << isRPCL1 << isCSCL1;
537 
538  numberOfHighEClusters++;
543 
546 
547  HighEnergy_NumXtal->Fill(fullnumXtalsinCluster);
548  HighEnergy_NumXtalFedId->Fill(FEDid, fullnumXtalsinCluster);
549  HighEnergy_NumXtaliphi->Fill(iphi, fullnumXtalsinCluster);
551  HighEnergy_energyNumXtal->Fill(fullnumXtalsinCluster, energy);
552 
553  if (energy > 100.0) {
554  LogInfo("EcalCosmicsHists") << "Very high energy event " << iEvent.id().run() << " : " << iEvent.id().event()
555  << " " << naiveEvtNum_ << " : " << energy << " " << numXtalsinCluster << " : "
556  << iphi << " " << ieta << " : " << isEcalL1 << isHCALL1 << isDTL1 << isRPCL1
557  << isCSCL1;
558 
561  }
562  }
563 
564  // *** end of High Energy Clusters analysis *** //
565 
566  } //++++++++++++++++++END LOOP OVER EB SUPERCLUSTERS+++++++++++++++++++++++//
567 
568  //+++++++++++++++++++LOOP OVER ENDCAP EE CLUSTERS++++++++++++++++++++//
569 
570  if (hasEndcapClusters) {
571  clusterCollection_p = escHandle.product();
572  for (reco::SuperClusterCollection::const_iterator clus = clusterCollection_p->begin();
573  clus != clusterCollection_p->end();
574  ++clus) {
575  double energy = clus->energy();
576  //double phi = clus->phi();
577  //double eta = clus->eta();
578  double time = -1000.0;
579  double ampli = 0.;
580  double secondMin = 0.;
581  double secondTime = -1000.;
582  int clusSize = clus->clustersSize();
583  int numXtalsinCluster = 0;
584 
585  EEDetId maxDet;
586  EEDetId secDet;
587  //LogInfo("EcalCosmicsHists") << "Here is what we initialized the maxDet to: " << maxDet;
588 
589  // for (reco::basicCluster_iterator bclus = (clus->clustersBegin()); bclus != (clus->clustersEnd()); ++bclus) {
590  // //double cphi = (*bclus)->phi();
591  // //double ceta = (*bclus)->eta();
592  // //TODO: extend histos to EE
593  // //TrueBCOccupancy_->Fill(cphi,ceta);
594  // //TrueBCOccupancyCoarse_->Fill(cphi,ceta);
595  // }
596 
597  std::vector<std::pair<DetId, float> > clusterDetIds = clus->hitsAndFractions(); //get these from the cluster
598  for (std::vector<std::pair<DetId, float> >::const_iterator detitr = clusterDetIds.begin();
599  detitr != clusterDetIds.end();
600  ++detitr) {
601  //LogInfo("EcalCosmicsHists") << " Here is the DetId inside the cluster: " << (EEDetId)(*detitr);
602  //Here I use the "find" on a digi collection... I have been warned...
603 
604  if ((*detitr).first.det() != DetId::Ecal) {
605  LogError("EcalCosmicsHists") << " det is " << (*detitr).first.det();
606  continue;
607  }
608  if ((*detitr).first.subdetId() != EcalEndcap) {
609  LogError("EcalCosmicsHists") << " subdet is " << (*detitr).first.subdetId();
610  continue;
611  }
612 
613  EcalRecHitCollection::const_iterator thishit = hitsEE->find((*detitr).first);
614 
615  if (thishit == hitsEE->end()) {
616  LogInfo("EcalCosmicsHists") << " WARNING: EEDetId not found in the RecHit collection!";
617  continue;
618  }
619  // The checking above should no longer be needed......
620  // as only those in the cluster would already have rechits..
621 
622  EcalRecHit myhit = (*thishit);
623 
624  //LogInfo("EcalCosmicsHists") << " Found hit for DetId: " << (EEDetId)(*detitr);
625  double thisamp = myhit.energy();
626  if (thisamp > minRecHitAmpEE_) {
627  numXtalsinCluster++;
628  }
629  if (thisamp > secondMin) {
630  secondMin = thisamp;
631  secondTime = myhit.time();
632  secDet = (EEDetId)(*detitr).first;
633  }
634  if (secondMin > ampli) {
635  std::swap(ampli, secondMin);
636  std::swap(time, secondTime);
637  std::swap(maxDet, secDet);
638  }
639 
640  //LogInfo("EcalCosmicsHists") << "maxDetId is now: " << (EEDetId)(maxDet);
641  }
642 
643  double fullnumXtalsinCluster = clusterDetIds.size();
644 
645  float E2 = ampli + secondMin;
646 
648  //int FEDid = 600+elecId.dccId();
649 
650  //Set some more values
651  //TODO: need to fix the seeds vector to be DetId or have another one for EE
652  //seeds.push_back(maxDet);
653 
654  int ix = maxDet.ix();
655  int iy = maxDet.iy();
656  int iz = maxDet.zside();
657 
658  // LogWarning("EcalCosmicsHists") << "EE cluster (x,y,z) : ( "
659  // << ix << " , " << iy << " , " << iz
660  // << " ) " << std::endl;
661 
662  if (!EEDetId::validDetId(ix, iy, iz)) {
663  LogWarning("EcalCosmicsHists") << "INVALID EE DetId !!!";
664  return;
665  }
666 
667  numberOfCosmics++;
668  if (iz < 0) {
669  numberOfCosmicsEEM++;
670  } else {
671  numberOfCosmicsEEP++;
672  }
673 
674  //int LM = ecalElectronicsMap_->getLMNumber(maxDet) ;//FIX ME
675 
676  //TODO: extend histos to EE
677  //TH1F* uRecHist = FEDsAndHists_[FEDid];
678  //TH1F* E2uRecHist = FEDsAndE2Hists_[FEDid];
679  //TH1F* energyuRecHist = FEDsAndenergyHists_[FEDid];
680  //TH1F* timingHist = FEDsAndTimingHists_[FEDid];
681  //TH1F* freqHist = FEDsAndFrequencyHists_[FEDid];
682  //TH1F* iphiProfileHist = FEDsAndiPhiProfileHists_[FEDid];
683  //TH1F* ietaProfileHist = FEDsAndiEtaProfileHists_[FEDid];
684  //TH2F* timingHistVsFreq = FEDsAndTimingVsFreqHists_[FEDid];
685  //TH2F* timingHistVsAmp = FEDsAndTimingVsAmpHists_[FEDid];
686  //TH2F* E2vsE1uRecHist = FEDsAndE2vsE1Hists_[FEDid];
687  //TH2F* energyvsE1uRecHist = FEDsAndenergyvsE1Hists_[FEDid];
688  //TH1F* numXtalInClusterHist = FEDsAndNumXtalsInClusterHists_[FEDid];
689  //TH2F* occupHist = FEDsAndOccupancyHists_[FEDid];
690  //TH2F* timingHistVsPhi = FEDsAndTimingVsPhiHists_[FEDid];
691  //TH2F* timingHistVsModule = FEDsAndTimingVsModuleHists_[FEDid];
692  //if(uRecHist==0)
693  //{
694  // initHists(FEDid);
695  // uRecHist = FEDsAndHists_[FEDid];
696  // E2uRecHist = FEDsAndE2Hists_[FEDid];
697  // energyuRecHist = FEDsAndenergyHists_[FEDid];
698  // timingHist = FEDsAndTimingHists_[FEDid];
699  // freqHist = FEDsAndFrequencyHists_[FEDid];
700  // timingHistVsFreq = FEDsAndTimingVsFreqHists_[FEDid];
701  // timingHistVsAmp = FEDsAndTimingVsAmpHists_[FEDid];
702  // iphiProfileHist = FEDsAndiPhiProfileHists_[FEDid];
703  // ietaProfileHist = FEDsAndiEtaProfileHists_[FEDid];
704  // E2vsE1uRecHist = FEDsAndE2vsE1Hists_[FEDid];
705  // energyvsE1uRecHist = FEDsAndenergyvsE1Hists_[FEDid];
706  // numXtalInClusterHist = FEDsAndNumXtalsInClusterHists_[FEDid];
707  // occupHist = FEDsAndOccupancyHists_[FEDid];
708  // timingHistVsPhi = FEDsAndTimingVsPhiHists_[FEDid];
709  // timingHistVsModule = FEDsAndTimingVsModuleHists_[FEDid];
710  //}
711  //uRecHist->Fill(ampli);
712  //E2uRecHist->Fill(E2);
713  //E2vsE1uRecHist->Fill(ampli,E2);
714  //energyuRecHist->Fill(energy);
715  //energyvsE1uRecHist->Fill(ampli,energy);
716  //allFedsHist_->Fill(ampli);
717 
718  if (iz < 0) {
719  EEM_FedsSeedEnergyHist_->Fill(ampli);
722  EEM_FedsE2Hist_->Fill(E2);
723  EEM_FedsE2vsE1Hist_->Fill(ampli, E2);
724  EEM_FedsenergyvsE1Hist_->Fill(ampli, energy);
725  EEM_AllOccupancyCoarse_->Fill(ix - 0.5, iy - 0.5);
726  EEM_AllOccupancy_->Fill(ix - 0.5, iy - 0.5);
727 
728  EEM_FedsNumXtalsInClusterHist_->Fill(numXtalsinCluster);
729  EEM_NumXtalsInClusterHist_->Fill(fullnumXtalsinCluster);
730  EEM_numxtalsVsEnergy_->Fill(energy, numXtalsinCluster);
731  EEM_numxtalsVsHighEnergy_->Fill(energy, numXtalsinCluster);
732  EEM_numberofBCinSC_->Fill(clusSize);
733 
734  if (fullnumXtalsinCluster == 1) {
735  EEM_OccupancySingleXtal_->Fill(ix - 0.5, iy - 0.5);
737  }
738 
739  if (ampli > minTimingAmpEE_) {
740  EEM_FedsTimingHist_->Fill(time);
741  EEM_FedsTimingVsAmpHist_->Fill(time, ampli);
742  EEM_FedsTimingTTHist_->Fill(ix - 0.5, iy - 0.5, time);
743  }
744 
745  // Exclusive trigger plots
746 
747  if (isEcalL1 && !isDTL1 && !isRPCL1 && !isCSCL1 && !isHCALL1) {
748  EEM_OccupancyExclusiveECAL_->Fill(ix - 0.5, iy - 0.5);
749  EEM_OccupancyCoarseExclusiveECAL_->Fill(ix - 0.5, iy - 0.5);
750  if (ampli > minTimingAmpEE_) {
752  EEM_FedsTimingTTHistECAL_->Fill(ix - 0.5, iy - 0.5, time);
753  }
754  EEM_triggerExclusiveHist_->Fill(0);
755  }
756 
757  if (!isEcalL1 && !isDTL1 && !isRPCL1 && !isCSCL1 && isHCALL1) {
758  EEM_OccupancyExclusiveHCAL_->Fill(ix - 0.5, iy - 0.5);
759  EEM_OccupancyCoarseExclusiveHCAL_->Fill(ix - 0.5, iy - 0.5);
760  if (ampli > minTimingAmpEE_) {
762  EEM_FedsTimingTTHistHCAL_->Fill(ix - 0.5, iy - 0.5, time);
763  }
764  EEM_triggerExclusiveHist_->Fill(1);
765  }
766 
767  if (!isEcalL1 && isDTL1 && !isRPCL1 && !isCSCL1 && !isHCALL1) {
768  EEM_OccupancyExclusiveDT_->Fill(ix - 0.5, iy - 0.5);
769  EEM_OccupancyCoarseExclusiveDT_->Fill(ix - 0.5, iy - 0.5);
770  if (ampli > minTimingAmpEE_) {
772  EEM_FedsTimingTTHistDT_->Fill(ix - 0.5, iy - 0.5, time);
773  }
774  EEM_triggerExclusiveHist_->Fill(2);
775  }
776 
777  if (!isEcalL1 && !isDTL1 && isRPCL1 && !isCSCL1 && !isHCALL1) {
778  EEM_OccupancyExclusiveRPC_->Fill(ix - 0.5, iy - 0.5);
779  EEM_OccupancyCoarseExclusiveRPC_->Fill(ix - 0.5, iy - 0.5);
780  if (ampli > minTimingAmpEE_) {
782  EEM_FedsTimingTTHistRPC_->Fill(ix - 0.5, iy - 0.5, time);
783  }
784  EEM_triggerExclusiveHist_->Fill(3);
785  }
786 
787  if (!isEcalL1 && !isDTL1 && !isRPCL1 && isCSCL1 && !isHCALL1) {
788  EEM_OccupancyExclusiveCSC_->Fill(ix - 0.5, iy - 0.5);
789  EEM_OccupancyCoarseExclusiveCSC_->Fill(ix - 0.5, iy - 0.5);
790  if (ampli > minTimingAmpEE_) {
792  EEM_FedsTimingTTHistCSC_->Fill(ix - 0.5, iy - 0.5, time);
793  }
794  EEM_triggerExclusiveHist_->Fill(4);
795  }
796 
797  // Inclusive trigger plots
798 
799  if (isEcalL1) {
800  EEM_triggerHist_->Fill(0);
801  EEM_OccupancyECAL_->Fill(ix - 0.5, iy - 0.5);
802  EEM_OccupancyCoarseECAL_->Fill(ix - 0.5, iy - 0.5);
803  }
804  if (isHCALL1) {
805  EEM_triggerHist_->Fill(1);
806  EEM_OccupancyHCAL_->Fill(ix - 0.5, iy - 0.5);
807  EEM_OccupancyCoarseHCAL_->Fill(ix - 0.5, iy - 0.5);
808  }
809  if (isDTL1) {
810  EEM_triggerHist_->Fill(2);
811  EEM_OccupancyDT_->Fill(ix - 0.5, iy - 0.5);
812  EEM_OccupancyCoarseDT_->Fill(ix - 0.5, iy - 0.5);
813  }
814  if (isRPCL1) {
815  EEM_triggerHist_->Fill(3);
816  EEM_OccupancyRPC_->Fill(ix - 0.5, iy - 0.5);
817  EEM_OccupancyCoarseRPC_->Fill(ix - 0.5, iy - 0.5);
818  }
819  if (isCSCL1) {
820  EEM_triggerHist_->Fill(4);
821  EEM_OccupancyCSC_->Fill(ix - 0.5, iy - 0.5);
822  EEM_OccupancyCoarseCSC_->Fill(ix - 0.5, iy - 0.5);
823  }
824 
825  } else {
826  EEP_FedsSeedEnergyHist_->Fill(ampli);
829  EEP_FedsE2Hist_->Fill(E2);
830  EEP_FedsE2vsE1Hist_->Fill(ampli, E2);
831  EEP_FedsenergyvsE1Hist_->Fill(ampli, energy);
832  EEP_AllOccupancyCoarse_->Fill(ix - 0.5, iy - 0.5);
833  EEP_AllOccupancy_->Fill(ix - 0.5, iy - 0.5);
834 
835  EEP_FedsNumXtalsInClusterHist_->Fill(numXtalsinCluster);
836  EEP_NumXtalsInClusterHist_->Fill(fullnumXtalsinCluster);
837  EEP_numxtalsVsEnergy_->Fill(energy, numXtalsinCluster);
838  EEP_numxtalsVsHighEnergy_->Fill(energy, numXtalsinCluster);
839  EEP_numberofBCinSC_->Fill(clusSize);
840 
841  if (fullnumXtalsinCluster == 1) {
842  EEP_OccupancySingleXtal_->Fill(ix - 0.5, iy - 0.5);
844  }
845 
846  if (ampli > minTimingAmpEE_) {
847  EEP_FedsTimingHist_->Fill(time);
848  EEP_FedsTimingVsAmpHist_->Fill(time, ampli);
849  EEP_FedsTimingTTHist_->Fill(ix - 0.5, iy - 0.5, time);
850  }
851 
852  // Exclusive trigger plots
853 
854  if (isEcalL1 && !isDTL1 && !isRPCL1 && !isCSCL1 && !isHCALL1) {
855  EEP_OccupancyExclusiveECAL_->Fill(ix - 0.5, iy - 0.5);
856  EEP_OccupancyCoarseExclusiveECAL_->Fill(ix - 0.5, iy - 0.5);
857  if (ampli > minTimingAmpEE_) {
859  EEP_FedsTimingTTHistECAL_->Fill(ix - 0.5, iy - 0.5, time);
860  }
861  EEP_triggerExclusiveHist_->Fill(0);
862  }
863 
864  if (!isEcalL1 && !isDTL1 && !isRPCL1 && !isCSCL1 && isHCALL1) {
865  EEP_OccupancyExclusiveHCAL_->Fill(ix - 0.5, iy - 0.5);
866  EEP_OccupancyCoarseExclusiveHCAL_->Fill(ix - 0.5, iy - 0.5);
867  if (ampli > minTimingAmpEE_) {
869  EEP_FedsTimingTTHistHCAL_->Fill(ix - 0.5, iy - 0.5, time);
870  }
871  EEP_triggerExclusiveHist_->Fill(1);
872  }
873 
874  if (!isEcalL1 && isDTL1 && !isRPCL1 && !isCSCL1 && !isHCALL1) {
875  EEP_OccupancyExclusiveDT_->Fill(ix - 0.5, iy - 0.5);
876  EEP_OccupancyCoarseExclusiveDT_->Fill(ix - 0.5, iy - 0.5);
877  if (ampli > minTimingAmpEE_) {
879  EEP_FedsTimingTTHistDT_->Fill(ix - 0.5, iy - 0.5, time);
880  }
881  EEP_triggerExclusiveHist_->Fill(2);
882  }
883 
884  if (!isEcalL1 && !isDTL1 && isRPCL1 && !isCSCL1 && !isHCALL1) {
885  EEP_OccupancyExclusiveRPC_->Fill(ix - 0.5, iy - 0.5);
886  EEP_OccupancyCoarseExclusiveRPC_->Fill(ix - 0.5, iy - 0.5);
887  if (ampli > minTimingAmpEE_) {
889  EEP_FedsTimingTTHistRPC_->Fill(ix - 0.5, iy - 0.5, time);
890  }
891  EEP_triggerExclusiveHist_->Fill(3);
892  }
893 
894  if (!isEcalL1 && !isDTL1 && !isRPCL1 && isCSCL1 && !isHCALL1) {
895  EEP_OccupancyExclusiveCSC_->Fill(ix - 0.5, iy - 0.5);
896  EEP_OccupancyCoarseExclusiveCSC_->Fill(ix - 0.5, iy - 0.5);
897  if (ampli > minTimingAmpEE_) {
899  EEP_FedsTimingTTHistCSC_->Fill(ix - 0.5, iy - 0.5, time);
900  }
901  EEP_triggerExclusiveHist_->Fill(4);
902  }
903 
904  // Inclusive trigger plots
905 
906  if (isEcalL1) {
907  EEP_triggerHist_->Fill(0);
908  EEP_OccupancyECAL_->Fill(ix - 0.5, iy - 0.5);
909  EEP_OccupancyCoarseECAL_->Fill(ix - 0.5, iy - 0.5);
910  }
911  if (isHCALL1) {
912  EEP_triggerHist_->Fill(1);
913  EEP_OccupancyHCAL_->Fill(ix - 0.5, iy - 0.5);
914  EEP_OccupancyCoarseHCAL_->Fill(ix - 0.5, iy - 0.5);
915  }
916  if (isDTL1) {
917  EEP_triggerHist_->Fill(2);
918  EEP_OccupancyDT_->Fill(ix - 0.5, iy - 0.5);
919  EEP_OccupancyCoarseDT_->Fill(ix - 0.5, iy - 0.5);
920  }
921  if (isRPCL1) {
922  EEP_triggerHist_->Fill(3);
923  EEP_OccupancyRPC_->Fill(ix - 0.5, iy - 0.5);
924  EEP_OccupancyCoarseRPC_->Fill(ix - 0.5, iy - 0.5);
925  }
926  if (isCSCL1) {
927  EEP_triggerHist_->Fill(4);
928  EEP_OccupancyCSC_->Fill(ix - 0.5, iy - 0.5);
929  EEP_OccupancyCoarseCSC_->Fill(ix - 0.5, iy - 0.5);
930  }
931  }
932 
933  // *** High Energy Clusters Analysis ** //
934 
935  if (energy > minHighEnergy_) {
936  LogInfo("EcalCosmicsHists") << "High energy event in EE " << iEvent.id().run() << " : " << iEvent.id().event()
937  << " " << naiveEvtNum_ << " : " << energy << " " << numXtalsinCluster << " : " << ix
938  << " " << iy << " : " << isEcalL1 << isHCALL1 << isDTL1 << isRPCL1 << isCSCL1;
939 
940  // numberOfHighEClusters++;
941  // allOccupancyHighEnergy_->Fill(iphi, ieta);
942  // allOccupancyHighEnergyCoarse_->Fill(iphi, ieta);
943  // allFedsOccupancyHighEnergyHist_->Fill(iphi,ieta,energy);
944  if (iz < 0) {
946  EEM_OccupancyHighEnergy_->Fill(ix - 0.5, iy - 0.5);
947  EEM_OccupancyHighEnergyCoarse_->Fill(ix - 0.5, iy - 0.5);
948  } else {
950  }
951  // HighEnergy_2GeV_occuCoarse->Fill(iphi,ieta);
952  // HighEnergy_2GeV_occu3D->Fill(iphi,ieta,energy);
953 
954  // HighEnergy_NumXtal->Fill(fullnumXtalsinCluster);
955  // HighEnergy_NumXtalFedId->Fill(FEDid,fullnumXtalsinCluster);
956  // HighEnergy_NumXtaliphi->Fill(iphi,fullnumXtalsinCluster);
957  // HighEnergy_energy3D->Fill(iphi,ieta,energy);
958  // HighEnergy_energyNumXtal->Fill(fullnumXtalsinCluster,energy);
959 
960  if (energy > 100.0) {
961  LogInfo("EcalCosmicsHists") << "Very high energy event in EE " << iEvent.id().run() << " : "
962  << iEvent.id().event() << " " << naiveEvtNum_ << " : " << energy << " "
963  << numXtalsinCluster << " : " << ix << " " << iy << " : " << isEcalL1 << isHCALL1
964  << isDTL1 << isRPCL1 << isCSCL1;
965  // HighEnergy_100GeV_occuCoarse->Fill(iphi,ieta);
966  // HighEnergy_100GeV_occu3D->Fill(iphi,ieta,energy);
967  }
968  }
969 
970  // *** end of High Energy Clusters analysis *** //
971 
972  } //++++++++++++++++++END LOOP OVER EE SUPERCLUSTERS+++++++++++++++++++++++++++++++++++
973  }
974 
975  HighEnergy_numClusHighEn->Fill(numberOfHighEClusters);
976  HighEnergy_ratioClusters->Fill((double(numberOfHighEClusters)) / (double(numberOfCosmics)));
977 
978  numberofCosmicsHist_->Fill(numberOfCosmics);
979  EEP_numberofCosmicsHist_->Fill(numberOfCosmicsEEP);
980  EEM_numberofCosmicsHist_->Fill(numberOfCosmicsEEM);
981  numberofCosmicsHistEB_->Fill(numberOfCosmicsEB);
982 
983  if (numberOfCosmics > 0) {
984  cosmicCounter_++;
986  allFedsFreqTimeHist_->Fill(eventTime);
987  //This line will work in 21X!!
988  //std::cout << " Orbit " << iEvent.orbitNumber() << " BX " << iEvent.bunchCrossing()<< std::endl;
989  //std::cout << " BX " << iEvent.experimentType() << std::endl;
990  }
991 
992  if (numberOfCosmicsEB > 0)
994  if (numberOfCosmicsEEP > 0)
996  if (numberOfCosmicsEEM > 0)
998 
999  if (numberOfCosmicsTop && numberOfCosmicsBottom) {
1001  numberofCosmicsTopBottomHist_->Fill(numberOfCosmicsTop + numberOfCosmicsBottom);
1002  }
1003 
1004  // *** TrackAssociator *** //
1005 
1006  // get reco tracks
1008  iEvent.getByToken(tracksToken_, recoTracks);
1009 
1010  if (recoTracks.isValid()) {
1011  std::map<int, std::vector<DetId> > trackDetIdMap;
1012  int tracks = 0;
1013  for (reco::TrackCollection::const_iterator recoTrack = recoTracks->begin(); recoTrack != recoTracks->end();
1014  ++recoTrack) {
1015  if (fabs(recoTrack->d0()) > 70 || fabs(recoTrack->dz()) > 70)
1016  continue;
1017  if (recoTrack->numberOfValidHits() < 20)
1018  continue;
1019 
1020  //if (recoTrack->pt() < 2) continue; // skip low Pt tracks
1021 
1023 
1024  // edm::LogVerbatim("TrackAssociator") << "\n-------------------------------------------------------\n Track (pt,eta,phi): " <<
1025  // recoTrack->pt() << " , " << recoTrack->eta() << " , " << recoTrack->phi() ;
1026  // edm::LogVerbatim("TrackAssociator") << "Ecal energy in crossed crystals based on RecHits: " <<
1027  // info.crossedEnergy(TrackDetMatchInfo::EcalRecHits);
1028  // edm::LogVerbatim("TrackAssociator") << "Ecal energy in 3x3 crystals based on RecHits: " <<
1029  // info.nXnEnergy(TrackDetMatchInfo::EcalRecHits, 1);
1030  // edm::LogVerbatim("TrackAssociator") << "Hcal energy in crossed towers based on RecHits: " <<
1031  // info.crossedEnergy(TrackDetMatchInfo::HcalRecHits);
1032  // edm::LogVerbatim("TrackAssociator") << "Hcal energy in 3x3 towers based on RecHits: " <<
1033  // info.nXnEnergy(TrackDetMatchInfo::HcalRecHits, 1);
1034  // edm::LogVerbatim("TrackAssociator") << "Number of muon segment matches: " << info.numberOfSegments();
1035 
1036  // std::cout << "\n-------------------------------------------------------\n Track (pt,eta,phi): " <<
1037  // recoTrack->pt() << " , " << recoTrack->eta() << " , " << recoTrack->phi() << std::endl;
1038  // std::cout << "Ecal energy in crossed crystals based on RecHits: " <<
1039  // info.crossedEnergy(TrackDetMatchInfo::EcalRecHits) << std::endl;
1040  // std::cout << "Ecal energy in 3x3 crystals based on RecHits: " <<
1041  // info.nXnEnergy(TrackDetMatchInfo::EcalRecHits, 1) << std::endl;
1042  // std::cout << "Hcal energy in crossed towers based on RecHits: " <<
1043  // info.crossedEnergy(TrackDetMatchInfo::HcalRecHits) << std::endl;
1044  // std::cout << "Hcal energy in 3x3 towers based on RecHits: " <<
1045  // info.nXnEnergy(TrackDetMatchInfo::HcalRecHits, 1) << std::endl;
1046 
1047  for (unsigned int i = 0; i < info.crossedEcalIds.size(); i++) {
1048  // only checks for barrel
1049  if (info.crossedEcalIds[i].det() == DetId::Ecal && info.crossedEcalIds[i].subdetId() == 1) {
1050  EBDetId ebDetId(info.crossedEcalIds[i]);
1051  trackAssoc_muonsEcal_->Fill(ebDetId.iphi(), ebDetId.ieta());
1052  //std::cout << "Crossed iphi: " << ebDetId.iphi()
1053  // << " ieta: " << ebDetId.ieta() << " : nCross " << info.crossedEcalIds.size() << std::endl;
1054 
1055  EcalRecHitCollection::const_iterator thishit = hits->find(ebDetId);
1056  if (thishit == hits->end())
1057  continue;
1058 
1059  //EcalRecHit myhit = (*thishit);
1060  //double thisamp = myhit.energy();
1061  //std::cout << " Crossed energy: " << thisamp << " : nCross " << info.crossedEcalIds.size() << std::endl;
1062  }
1063  }
1064 
1065  //edm::LogVerbatim("TrackAssociator") << " crossedEcalIds size: " << info.crossedEcalIds.size()
1066  // << " crossedEcalRecHits size: " << info.crossedEcalRecHits.size();
1067  numberofCrossedEcalIdsHist_->Fill(info.crossedEcalIds.size());
1068  tracks++;
1069  if (!info.crossedEcalIds.empty())
1070  trackDetIdMap.insert(std::pair<int, std::vector<DetId> >(tracks, info.crossedEcalIds));
1071  }
1072 
1073  // Now to match recoTracks with cosmic clusters
1074 
1075  int numAssocTracks = 0;
1076  int numAssocClusters = 0;
1077  edm::LogVerbatim("TrackAssociator") << "Matching cosmic clusters to tracks...";
1078  int numSeeds = seeds.size();
1079  int numTracks = trackDetIdMap.size();
1080  while (!seeds.empty() && !trackDetIdMap.empty()) {
1081  double bestDr = 1000;
1082  double bestDPhi = 1000;
1083  double bestDEta = 1000;
1084  double bestEtaTrack = 1000;
1085  double bestEtaSeed = 1000;
1086  double bestPhiTrack = 1000;
1087  double bestPhiSeed = 1000;
1088  EBDetId bestTrackDet;
1089  EBDetId bestSeed;
1090  int bestTrack = -1;
1091  std::map<EBDetId, EBDetId> trackDetIdToSeedMap;
1092 
1093  //edm::LogVerbatim("TrackAssociator") << "NumTracks:" << trackDetIdMap.size() << " numClusters:" << seeds.size();
1094 
1095  for (std::vector<EBDetId>::const_iterator seedItr = seeds.begin(); seedItr != seeds.end(); ++seedItr) {
1096  for (std::map<int, std::vector<DetId> >::const_iterator mapItr = trackDetIdMap.begin();
1097  mapItr != trackDetIdMap.end();
1098  ++mapItr) {
1099  for (unsigned int i = 0; i < mapItr->second.size(); i++) {
1100  // only checks for barrel
1101  if (mapItr->second[i].det() == DetId::Ecal && mapItr->second[i].subdetId() == 1) {
1102  EBDetId ebDet = (mapItr->second[i]);
1103  double seedEta = seedItr->ieta();
1104  double deta = ebDet.ieta() - seedEta;
1105  if (seedEta * ebDet.ieta() < 0)
1106  deta > 0 ? (deta = deta - 1.) : (deta = deta + 1.);
1107  double dR;
1108  double dphi = ebDet.iphi() - seedItr->iphi();
1109  if (abs(dphi) > 180)
1110  dphi > 0 ? (dphi = 360 - dphi) : (dphi = -360 - dphi);
1111  dR = sqrt(deta * deta + dphi * dphi);
1112  if (dR < bestDr) {
1113  bestDr = dR;
1114  bestDPhi = dphi;
1115  bestDEta = deta;
1116  bestTrackDet = mapItr->second[i];
1117  bestTrack = mapItr->first;
1118  bestSeed = (*seedItr);
1119  bestEtaTrack = ebDet.ieta();
1120  bestEtaSeed = seedEta;
1121  bestPhiTrack = ebDet.iphi();
1122  bestPhiSeed = seedItr->iphi();
1123  }
1124  }
1125  }
1126  }
1127  }
1128  if (bestDr < 1000) {
1129  //edm::LogVerbatim("TrackAssociator") << "Best deltaR from matched DetId's to cluster:" << bestDr;
1130  deltaRHist_->Fill(bestDr);
1131  deltaPhiHist_->Fill(bestDPhi);
1132  deltaEtaHist_->Fill(bestDEta);
1133  deltaEtaDeltaPhiHist_->Fill(bestDEta, bestDPhi);
1134  seedTrackEtaHist_->Fill(bestEtaSeed, bestEtaTrack);
1135  seedTrackPhiHist_->Fill(bestPhiSeed, bestPhiTrack);
1136  seeds.erase(find(seeds.begin(), seeds.end(), bestSeed));
1137  trackDetIdMap.erase(trackDetIdMap.find(bestTrack));
1138  trackDetIdToSeedMap[bestTrackDet] = bestSeed;
1139  numAssocTracks++;
1140  numAssocClusters++;
1141 
1142  // for high energy analysis
1143  if (bestDPhi < 1.5 && bestDEta < 1.8) {
1144  //edm::LogVerbatim("TrackAssociator") << "Best seed ieta and iphi: ("
1145  // << bestSeed.ieta() << ", " << bestSeed.iphi() << ") ";
1146  //check if the bestSeed is a High Energy one
1147  EcalRecHitCollection::const_iterator Ecalhit = hits->find(bestSeed);
1148  if (Ecalhit == hits->end()) {
1149  continue;
1150  }
1151  double EcalhitEnergy = Ecalhit->energy();
1152  //edm::LogVerbatim("TrackAssociator") << "Best seed energy: " << EcalhitEnergy ;
1153  HighEnergy_bestSeed->Fill(EcalhitEnergy);
1154  HighEnergy_bestSeedOccupancy->Fill(bestSeed.iphi(), bestSeed.ieta());
1155  }
1156  } else {
1157  edm::LogVerbatim("TrackAssociator") << "could not match cluster seed to track." << bestDr;
1158  break; // no match found
1159  }
1160  }
1161  if (numSeeds > 0 && numTracks > 0) {
1162  ratioAssocClustersHist_->AddBinContent(1, numAssocClusters);
1163  ratioAssocClustersHist_->AddBinContent(2, numSeeds);
1164  }
1165  if (numTracks > 0) {
1166  ratioAssocTracksHist_->AddBinContent(1, numAssocTracks);
1167  ratioAssocTracksHist_->AddBinContent(2, numTracks);
1168  numberofCosmicsWTrackHist_->Fill(numSeeds);
1169  }
1170  } else {
1171  LogWarning("EcalCosmicsHists") << "!!! No TrackAssociator recoTracks !!!";
1172  }
1173 
1174  // Study on Tracks for High Energy events
1175  edm::Handle<reco::TrackCollection> recoTracksBarrel;
1176  iEvent.getByToken(tracksBarrelToken_, recoTracksBarrel);
1177  if (!recoTracksBarrel.isValid()) {
1178  edm::LogWarning("EcalCosmicsHists") << "RecoTracksBarrel not valid!! ";
1179  } else {
1180  HighEnergy_numRecoTrackBarrel->Fill(recoTracksBarrel->size());
1181  for (reco::TrackCollection::const_iterator recoTrack = recoTracksBarrel->begin();
1182  recoTrack != recoTracksBarrel->end();
1183  ++recoTrack) {
1184  //edm::LogWarning("EcalCosmicsHists") << "Track (pt,eta,phi): " << recoTrack->pt() << " , " << recoTrack->eta() << " , " << recoTrack->phi() ;
1185  //edm::LogWarning("EcalCosmicsHists") << "Track innermost hit: " << recoTrack->innerPosition().phi() ;
1186  }
1187 
1188  for (reco::SuperClusterCollection::const_iterator clus = clusterCollection_p->begin();
1189  clus != clusterCollection_p->end();
1190  ++clus) {
1191  double energy = clus->energy();
1192  double phi = clus->phi();
1193  double eta = clus->eta();
1194 
1195  if (recoTracksBarrel->empty())
1197  if (recoTracksBarrel->size() == 1)
1199  if (recoTracksBarrel->size() == 2)
1201 
1202  std::vector<std::pair<DetId, float> > clusterDetIds = clus->hitsAndFractions(); //get these from the cluster
1203  for (std::vector<std::pair<DetId, float> >::const_iterator detitr = clusterDetIds.begin();
1204  detitr != clusterDetIds.end();
1205  ++detitr) {
1206  if ((*detitr).first.det() != DetId::Ecal) {
1207  continue;
1208  }
1209  if ((*detitr).first.subdetId() != EcalBarrel) {
1210  continue;
1211  }
1212  EcalRecHitCollection::const_iterator thishit = hits->find((*detitr).first);
1213  if (thishit == hits->end()) {
1214  continue;
1215  }
1216 
1217  double rechitenergy = thishit->energy();
1218  int ieta = ((EBDetId)(*detitr).first).ieta();
1219  int iphi = ((EBDetId)(*detitr).first).iphi();
1220  if (rechitenergy > minRecHitAmpEB_) {
1221  if (recoTracksBarrel->empty())
1222  HighEnergy_0tracks_occu3DXtal->Fill(iphi, ieta, rechitenergy);
1223  if (recoTracksBarrel->size() == 1)
1224  HighEnergy_1tracks_occu3DXtal->Fill(iphi, ieta, rechitenergy);
1225  if (recoTracksBarrel->size() == 2)
1226  HighEnergy_2tracks_occu3DXtal->Fill(iphi, ieta, rechitenergy);
1227 
1228  if (rechitenergy > 10)
1229  edm::LogWarning("EcalCosmicsHists") << "!!!!! Crystal with energy " << rechitenergy << " at (ieta,iphi) ("
1230  << ieta << " ," << iphi << "); Id: " << (*detitr).first.det();
1231  }
1232  }
1233  }
1234 
1235  // look at angle between 2 recoTracks
1236  if (recoTracksBarrel->size() == 2) {
1237  reco::TrackCollection::const_iterator Track1 = recoTracksBarrel->begin();
1238  reco::TrackCollection::const_iterator Track2 = (recoTracksBarrel->begin()) + 1;
1239  float angle = (acos(sin(Track1->theta()) * cos(Track1->phi()) * sin(Track2->theta()) * cos(Track2->phi()) +
1240  sin(Track1->theta()) * sin(Track1->phi()) * sin(Track2->theta()) * sin(Track2->phi()) +
1241  cos(Track1->theta()) * cos(Track2->theta()))) /
1242  0.017453292519943;
1243  //edm::LogWarning("EcalCosmicsHists") << "Tracks angle: " << angle;
1245  if ((Track1->innerPosition().phi()) > 0 && (Track2->innerPosition().phi()) < 0) {
1246  //edm::LogWarning("EcalCosmicsHists") << "Top-bottom tracks";
1248  }
1249  }
1250  }
1251 
1252  // *** end of TrackAssociator code *** //
1253 
1254  // *** HCAL RecHits code *** //
1255 
1256  //hcal rechits
1258  iEvent.getByToken(hbheRecHitToken_, hbhe);
1259 
1261  iEvent.getByToken(hfRecHitToken_, hfrh);
1262 
1264  iEvent.getByToken(hoRecHitToken_, horh);
1265 
1266  if (hbhe.isValid()) {
1267  const HBHERecHitCollection hbheHit = *(hbhe.product());
1268  for (HBHERecHitCollection::const_iterator hhit = hbheHit.begin(); hhit != hbheHit.end(); hhit++) {
1269  // if (hhit->energy() > 0.6){
1270  hcalEnergy_HBHE_->Fill(hhit->energy());
1271  // }
1272  }
1273  } else {
1274  LogWarning("EcalCosmicHists") << " HBHE RecHits **NOT** VALID!! ";
1275  }
1276 
1277  if (hfrh.isValid()) {
1278  const HFRecHitCollection hfHit = *(hfrh.product());
1279  for (HFRecHitCollection::const_iterator hhit = hfHit.begin(); hhit != hfHit.end(); hhit++) {
1280  hcalEnergy_HF_->Fill(hhit->energy());
1281  }
1282  } else {
1283  LogWarning("EcalCosmicHists") << " HF RecHits **NOT** VALID!! ";
1284  }
1285 
1286  if (horh.isValid()) {
1287  const HORecHitCollection hoHit = *(horh.product());
1288  for (HORecHitCollection::const_iterator hhit = hoHit.begin(); hhit != hoHit.end(); hhit++) {
1289  // if (hhit->energy() > 0.6){
1290  hcalEnergy_HO_->Fill(hhit->energy());
1291  // }
1292  }
1293  } else {
1294  LogWarning("EcalCosmicHists") << " HO RecHits **NOT** VALID!! ";
1295  }
1296 
1297  // *** end of HCAL code *** //
1298 }
1299 
1301  std::vector<bool> l1Triggers; //DT,CSC,RPC,HCAL,ECAL
1302  //0 , 1 , 2 , 3 , 4
1303  l1Triggers.reserve(5);
1304  for (int i = 0; i < 5; i++)
1305  l1Triggers.push_back(false);
1306 
1307  // get the GMTReadoutCollection
1308  Handle<L1MuGMTReadoutCollection> gmtrc_handle;
1309  iEvent.getByToken(l1MuGMTToken_, gmtrc_handle);
1310  L1MuGMTReadoutCollection const* gmtrc = gmtrc_handle.product();
1311  if (!(gmtrc_handle.isValid())) {
1312  LogWarning("EcalCosmicsHists") << "l1MuGMTReadoutCollection"
1313  << " not available";
1314  return l1Triggers;
1315  }
1316  // get hold of L1GlobalReadoutRecord
1318  iEvent.getByToken(l1GTReadoutToken_, L1GTRR);
1319 
1320  //Ecal
1321  const auto& menu = eventSetup.getData(l1MenuToken_);
1323  iEvent.getByToken(gtRecordToken_, gtRecord);
1324  // Get dWord after masking disabled bits
1325  const DecisionWord dWord = gtRecord->decisionWord();
1326 
1327  bool l1SingleEG1 = menu.gtAlgorithmResult("L1_SingleEG1", dWord);
1328  bool l1SingleEG5 = menu.gtAlgorithmResult("L1_SingleEG5", dWord);
1329  bool l1SingleEG8 = menu.gtAlgorithmResult("L1_SingleEG8", dWord);
1330  bool l1SingleEG10 = menu.gtAlgorithmResult("L1_SingleEG10", dWord);
1331  bool l1SingleEG12 = menu.gtAlgorithmResult("L1_SingleEG12", dWord);
1332  bool l1SingleEG15 = menu.gtAlgorithmResult("L1_SingleEG15", dWord);
1333  bool l1SingleEG20 = menu.gtAlgorithmResult("L1_SingleEG20", dWord);
1334  bool l1SingleEG25 = menu.gtAlgorithmResult("L1_SingleEG25", dWord);
1335  bool l1DoubleNoIsoEGBTBtight = menu.gtAlgorithmResult("L1_DoubleNoIsoEG_BTB_tight", dWord);
1336  bool l1DoubleNoIsoEGBTBloose = menu.gtAlgorithmResult("L1_DoubleNoIsoEG_BTB_loose ", dWord);
1337  bool l1DoubleNoIsoEGTopBottom = menu.gtAlgorithmResult("L1_DoubleNoIsoEGTopBottom", dWord);
1338  bool l1DoubleNoIsoEGTopBottomCen = menu.gtAlgorithmResult("L1_DoubleNoIsoEGTopBottomCen", dWord);
1339  bool l1DoubleNoIsoEGTopBottomCen2 = menu.gtAlgorithmResult("L1_DoubleNoIsoEGTopBottomCen2", dWord);
1340  bool l1DoubleNoIsoEGTopBottomCenVert = menu.gtAlgorithmResult("L1_DoubleNoIsoEGTopBottomCenVert", dWord);
1341 
1342  l1Triggers[4] = l1SingleEG1 || l1SingleEG5 || l1SingleEG8 || l1SingleEG10 || l1SingleEG12 || l1SingleEG15 ||
1343  l1SingleEG20 || l1SingleEG25 || l1DoubleNoIsoEGBTBtight || l1DoubleNoIsoEGBTBloose ||
1344  l1DoubleNoIsoEGTopBottom || l1DoubleNoIsoEGTopBottomCen || l1DoubleNoIsoEGTopBottomCen2 ||
1345  l1DoubleNoIsoEGTopBottomCenVert;
1346 
1347  std::vector<L1MuGMTReadoutRecord> gmt_records = gmtrc->getRecords();
1348  std::vector<L1MuGMTReadoutRecord>::const_iterator igmtrr;
1349  for (igmtrr = gmt_records.begin(); igmtrr != gmt_records.end(); igmtrr++) {
1350  std::vector<L1MuRegionalCand>::const_iterator iter1;
1351  std::vector<L1MuRegionalCand> rmc;
1352 
1353  //DT triggers
1354  int idt = 0;
1355  rmc = igmtrr->getDTBXCands();
1356  for (iter1 = rmc.begin(); iter1 != rmc.end(); iter1++) {
1357  if (!(*iter1).empty()) {
1358  idt++;
1359  }
1360  }
1361  //if(idt>0) std::cout << "Found " << idt << " valid DT candidates in bx wrt. L1A = "
1362  // << igmtrr->getBxInEvent() << std::endl;
1363  if (igmtrr->getBxInEvent() == 0 && idt > 0)
1364  l1Triggers[0] = true;
1365 
1366  //RPC triggers
1367  int irpcb = 0;
1368  rmc = igmtrr->getBrlRPCCands();
1369  for (iter1 = rmc.begin(); iter1 != rmc.end(); iter1++) {
1370  if (!(*iter1).empty()) {
1371  irpcb++;
1372  }
1373  }
1374  //if(irpcb>0) std::cout << "Found " << irpcb << " valid RPC candidates in bx wrt. L1A = "
1375  // << igmtrr->getBxInEvent() << std::endl;
1376  if (igmtrr->getBxInEvent() == 0 && irpcb > 0)
1377  l1Triggers[2] = true;
1378 
1379  //CSC Triggers
1380  int icsc = 0;
1381  rmc = igmtrr->getCSCCands();
1382  for (iter1 = rmc.begin(); iter1 != rmc.end(); iter1++) {
1383  if (!(*iter1).empty()) {
1384  icsc++;
1385  }
1386  }
1387  //if(icsc>0) std::cout << "Found " << icsc << " valid CSC candidates in bx wrt. L1A = "
1388  // << igmtrr->getBxInEvent() << std::endl;
1389  if (igmtrr->getBxInEvent() == 0 && icsc > 0)
1390  l1Triggers[1] = true;
1391  }
1392 
1393  L1GlobalTriggerReadoutRecord const* gtrr = L1GTRR.product();
1394 
1395  for (int ibx = -1; ibx <= 1; ibx++) {
1396  bool hcal_top = false;
1397  bool hcal_bot = false;
1398  const L1GtPsbWord psb = gtrr->gtPsbWord(0xbb0d, ibx);
1399  std::vector<int> valid_phi;
1400  if ((psb.aData(4) & 0x3f) >= 1) {
1401  valid_phi.push_back((psb.aData(4) >> 10) & 0x1f);
1402  }
1403  if ((psb.bData(4) & 0x3f) >= 1) {
1404  valid_phi.push_back((psb.bData(4) >> 10) & 0x1f);
1405  }
1406  if ((psb.aData(5) & 0x3f) >= 1) {
1407  valid_phi.push_back((psb.aData(5) >> 10) & 0x1f);
1408  }
1409  if ((psb.bData(5) & 0x3f) >= 1) {
1410  valid_phi.push_back((psb.bData(5) >> 10) & 0x1f);
1411  }
1412  std::vector<int>::const_iterator iphi;
1413  for (iphi = valid_phi.begin(); iphi != valid_phi.end(); iphi++) {
1414  //std::cout << "Found HCAL mip with phi=" << *iphi << " in bx wrt. L1A = " << ibx << std::endl;
1415  if (*iphi < 9)
1416  hcal_top = true;
1417  if (*iphi > 8)
1418  hcal_bot = true;
1419  }
1420  if (ibx == 0 && hcal_top && hcal_bot)
1421  l1Triggers[3] = true;
1422  }
1423 
1424  edm::LogInfo("EcalCosmicsHists") << "**** Trigger SourceSource ****";
1425  if (l1Triggers[0])
1426  edm::LogInfo("EcalCosmicsHists") << "DT";
1427  if (l1Triggers[2])
1428  edm::LogInfo("EcalCosmicsHists") << "RPC";
1429  if (l1Triggers[1])
1430  edm::LogInfo("EcalCosmicsHists") << "CSC";
1431  if (l1Triggers[3])
1432  edm::LogInfo("EcalCosmicsHists") << "HCAL";
1433  if (l1Triggers[4])
1434  edm::LogInfo("EcalCosmicsHists") << "ECAL";
1435  edm::LogInfo("EcalCosmicsHists") << "************************";
1436 
1437  return l1Triggers;
1438 }
1439 
1440 // insert the hist map into the map keyed by FED number
1442  using namespace std;
1443 
1444  string FEDid = intToString(FED);
1445  string title1 = "Energy of Seed Crystal ";
1446  title1.append(fedMap_->getSliceFromFed(FED));
1447  title1.append(";Seed Energy (GeV);Number of Cosmics");
1448  string name1 = "SeedEnergyFED";
1449  name1.append(intToString(FED));
1450  int numBins = 200; //(int)round(histRangeMax_-histRangeMin_)+1;
1451  TH1F* hist = new TH1F(name1.c_str(), title1.c_str(), numBins, histRangeMin_, histRangeMax_);
1452  FEDsAndHists_[FED] = hist;
1453  FEDsAndHists_[FED]->SetDirectory(nullptr);
1454 
1455  TH1F* E2hist = new TH1F(Form("E2_FED_%d", FED), Form("E2_FED_%d", FED), numBins, histRangeMin_, histRangeMax_);
1456  FEDsAndE2Hists_[FED] = E2hist;
1457  FEDsAndE2Hists_[FED]->SetDirectory(nullptr);
1458 
1459  TH1F* energyhist =
1460  new TH1F(Form("Energy_FED_%d", FED), Form("Energy_FED_%d", FED), numBins, histRangeMin_, histRangeMax_);
1461  FEDsAndenergyHists_[FED] = energyhist;
1462  FEDsAndenergyHists_[FED]->SetDirectory(nullptr);
1463 
1464  TH2F* E2vsE1hist = new TH2F(Form("E2vsE1_FED_%d", FED),
1465  Form("E2vsE1_FED_%d", FED),
1466  numBins,
1467  histRangeMin_,
1468  histRangeMax_,
1469  numBins,
1470  histRangeMin_,
1471  histRangeMax_);
1472  FEDsAndE2vsE1Hists_[FED] = E2vsE1hist;
1473  FEDsAndE2vsE1Hists_[FED]->SetDirectory(nullptr);
1474 
1475  TH2F* energyvsE1hist = new TH2F(Form("EnergyvsE1_FED_%d", FED),
1476  Form("EnergyvsE1_FED_%d", FED),
1477  numBins,
1478  histRangeMin_,
1479  histRangeMax_,
1480  numBins,
1481  histRangeMin_,
1482  histRangeMax_);
1483  FEDsAndenergyvsE1Hists_[FED] = energyvsE1hist;
1484  FEDsAndenergyvsE1Hists_[FED]->SetDirectory(nullptr);
1485 
1486  title1 = "Time for ";
1487  title1.append(fedMap_->getSliceFromFed(FED));
1488  title1.append(";Relative Time (1 clock = 25ns);Events");
1489  name1 = "TimeFED";
1490  name1.append(intToString(FED));
1491  TH1F* timingHist = new TH1F(name1.c_str(), title1.c_str(), 78, -7, 7);
1492  FEDsAndTimingHists_[FED] = timingHist;
1493  FEDsAndTimingHists_[FED]->SetDirectory(nullptr);
1494 
1495  TH1F* freqHist =
1496  new TH1F(Form("Frequency_FED_%d", FED), Form("Frequency for FED %d;Event Number", FED), 100, 0., 100000);
1497  FEDsAndFrequencyHists_[FED] = freqHist;
1498  FEDsAndFrequencyHists_[FED]->SetDirectory(nullptr);
1499 
1500  TH1F* iphiProfileHist =
1501  new TH1F(Form("iPhi_Profile_FED_%d", FED), Form("iPhi Profile for FED %d", FED), 360, 1., 361);
1502  FEDsAndiPhiProfileHists_[FED] = iphiProfileHist;
1503  FEDsAndiPhiProfileHists_[FED]->SetDirectory(nullptr);
1504 
1505  TH1F* ietaProfileHist =
1506  new TH1F(Form("iEta_Profile_FED_%d", FED), Form("iEta Profile for FED %d", FED), 172, -86, 86);
1507  FEDsAndiEtaProfileHists_[FED] = ietaProfileHist;
1508  FEDsAndiEtaProfileHists_[FED]->SetDirectory(nullptr);
1509 
1510  TH2F* timingHistVsFreq =
1511  new TH2F(Form("timeVsFreqFED_%d", FED), Form("time Vs Freq FED %d", FED), 78, -7, 7, 100, 0., 100000);
1512  FEDsAndTimingVsFreqHists_[FED] = timingHistVsFreq;
1513  FEDsAndTimingVsFreqHists_[FED]->SetDirectory(nullptr);
1514 
1515  TH2F* timingHistVsAmp = new TH2F(
1516  Form("timeVsAmpFED_%d", FED), Form("time Vs Amp FED %d", FED), 78, -7, 7, numBins, histRangeMin_, histRangeMax_);
1517  FEDsAndTimingVsAmpHists_[FED] = timingHistVsAmp;
1518  FEDsAndTimingVsAmpHists_[FED]->SetDirectory(nullptr);
1519 
1520  TH1F* numXtalInClusterHist = new TH1F(Form("NumXtalsInCluster_FED_%d", FED),
1521  Form("Num active Xtals In Cluster for FED %d;Num Active Xtals", FED),
1522  25,
1523  0,
1524  25);
1525  FEDsAndNumXtalsInClusterHists_[FED] = numXtalInClusterHist;
1526  FEDsAndNumXtalsInClusterHists_[FED]->SetDirectory(nullptr);
1527 
1528  TH2F* OccupHist = new TH2F(Form("occupFED_%d", FED), Form("Occupancy FED %d;i#eta;i#phi", FED), 85, 1, 86, 20, 1, 21);
1529  FEDsAndOccupancyHists_[FED] = OccupHist;
1530  FEDsAndOccupancyHists_[FED]->SetDirectory(nullptr);
1531 
1532  TH2F* timingHistVsPhi = new TH2F(Form("timeVsPhiFED_%d", FED),
1533  Form("time Vs Phi FED %d;Relative Time (1 clock = 25ns);i#phi", FED),
1534  78,
1535  -7,
1536  7,
1537  20,
1538  1,
1539  21);
1540  FEDsAndTimingVsPhiHists_[FED] = timingHistVsPhi;
1541  FEDsAndTimingVsPhiHists_[FED]->SetDirectory(nullptr);
1542 
1543  TH2F* timingHistVsModule = new TH2F(Form("timeVsModuleFED_%d", FED),
1544  Form("time Vs Module FED %d;Relative Time (1 clock = 25ns);i#eta", FED),
1545  78,
1546  -7,
1547  7,
1548  4,
1549  1,
1550  86);
1551  FEDsAndTimingVsModuleHists_[FED] = timingHistVsModule;
1552  FEDsAndTimingVsModuleHists_[FED]->SetDirectory(nullptr);
1553 
1554  TH2F* dccRuntypeVsBxFED =
1555  new TH2F(Form("DCCRuntypeVsBxFED_%d", FED), Form("DCC Runtype vs. BX FED %d", FED), 3600, 0, 3600, 24, 0, 24);
1556  FEDsAndDCCRuntypeVsBxHists_[FED] = dccRuntypeVsBxFED;
1557  FEDsAndDCCRuntypeVsBxHists_[FED]->SetDirectory(nullptr);
1558 }
1559 
1560 // ------------ method called once each job just before starting event loop ------------
1563 
1564  //Here I will init some of the specific histograms
1565  int numBins = 200; //(int)round(histRangeMax_-histRangeMin_)+1;
1566 
1567  //=============Special Bins for TT and Modules borders=============================
1568  double ttEtaBins[36] = {-85, -80, -75, -70, -65, -60, -55, -50, -45, -40, -35, -30, -25, -20, -15, -10, -5, 0,
1569  1, 6, 11, 16, 21, 26, 31, 36, 41, 46, 51, 56, 61, 66, 71, 76, 81, 86};
1570  double modEtaBins[10] = {-85, -65, -45, -25, 0, 1, 26, 46, 66, 86};
1571  double ttPhiBins[73];
1572  double modPhiBins[19];
1573  double timingBins[79];
1574  double highEBins[11];
1575  for (int i = 0; i < 79; ++i) {
1576  timingBins[i] = -7. + double(i) * 14. / 78.;
1577  if (i < 73) {
1578  ttPhiBins[i] = 1 + 5 * i;
1579  if (i < 19) {
1580  modPhiBins[i] = 1 + 20 * i;
1581  if (i < 11) {
1582  highEBins[i] = 10. + double(i) * 20.;
1583  }
1584  }
1585  }
1586  }
1587  //=============END Special Bins for TT and Modules borders===========================
1588 
1589  //====================Frequency for Event timing information=========================
1590  double timingEndInSeconds = runTimeLength_ * 3600.;
1591  double timingBinWidth = timingEndInSeconds / double(numTimingBins_);
1592  //====================END Frequency for Event timing information=====================
1593 
1595  new TH1F("energy_AllClusters", "energy_AllClusters;Cluster Energy (GeV)", numBins, histRangeMin_, histRangeMax_);
1597  new TH1F("energyHigh_AllClusters", "energyHigh_AllClusters;Cluster Energy (GeV)", numBins, histRangeMin_, 200.0);
1598  allFedsenergyOnlyHighHist_ = new TH1F("energyHigh_HighEnergyClusters",
1599  "energy of High Energy Clusters;Cluster Energy (GeV)",
1600  numBins,
1601  histRangeMin_,
1602  200.0);
1603  allFedsE2Hist_ = new TH1F(
1604  "E2_AllClusters", "E2_AllClusters;Seed+highest neighbor energy (GeV)", numBins, histRangeMin_, histRangeMax_);
1605  allFedsE2vsE1Hist_ = new TH2F("E2vsE1_AllClusters",
1606  "E2vsE1_AllClusters;Seed Energy (GeV);Seed+highest neighbor energy (GeV)",
1607  numBins,
1608  histRangeMin_,
1609  histRangeMax_,
1610  numBins,
1611  histRangeMin_,
1612  histRangeMax_);
1613  allFedsenergyvsE1Hist_ = new TH2F("energyvsE1_AllClusters",
1614  "energyvsE1_AllClusters;Seed Energy (GeV);Energy(GeV)",
1615  numBins,
1616  histRangeMin_,
1617  histRangeMax_,
1618  numBins,
1619  histRangeMin_,
1620  histRangeMax_);
1621  allFedsTimingHist_ = new TH1F("timeForAllFeds", "timeForAllFeds;Relative Time (1 clock = 25ns)", 78, -7, 7);
1622  allFedsTimingVsFreqHist_ = new TH2F("timeVsFreqAllEvent",
1623  "time Vs Freq All events;Relative Time (1 clock = 25ns);Event Number",
1624  78,
1625  -7,
1626  7,
1627  2000,
1628  0.,
1629  200000);
1630  allFedsTimingVsAmpHist_ = new TH2F("timeVsAmpAllEvents",
1631  "time Vs Amp All Events;Relative Time (1 clock = 25ns);Amplitude (GeV)",
1632  78,
1633  -7,
1634  7,
1635  numBins,
1636  histRangeMin_,
1637  histRangeMax_);
1638  allFedsFrequencyHist_ = new TH1F("FrequencyAllEvent", "Frequency for All events;Event Number", 2000, 0., 200000);
1639 
1640  //--------Special Hists for times stamp info----------------------------------------------
1641  allFedsFreqTimeHist_ = new TH1F("FrequencyAllEventsInTime",
1642  Form("Time of Cosmic Events; Time (s);Passing Event rate/%5g s", timingBinWidth),
1644  0.,
1645  timingEndInSeconds);
1647  new TH2F("FrequencyAllEventsInTimeVsPhi",
1648  Form("Time of Cosmic Events vs iPhi; iPhi;Time (s)/%5g s", timingBinWidth * 360.),
1649  360,
1650  1.,
1651  361.,
1652  numTimingBins_ / 360,
1653  0.,
1654  timingEndInSeconds);
1656  new TH2F("FrequencyAllEventsInTimeVsTTPhi",
1657  Form("Time of Cosmic Events vs iPhi (TT bins); iPhi;Time (s)/%5g s", timingBinWidth * 72.),
1658  72,
1659  1.,
1660  361.,
1661  numTimingBins_ / 72,
1662  0.,
1663  timingEndInSeconds);
1665  new TH2F("FrequencyAllEventsInTimeVsEta",
1666  Form("Time of Cosmic Events vs iEta; Time (s)/%5g s; iEta", timingBinWidth * 172.),
1667  numTimingBins_ / 172,
1668  0.,
1669  timingEndInSeconds,
1670  172,
1671  -86.,
1672  86.);
1674  new TH2F("FrequencyAllEventsInTimeVsTTEta",
1675  Form("Time of Cosmic Events vs Eta (TT bins);Time (s)/%5g s; iEta", timingBinWidth * 35.),
1676  numTimingBins_ / 35,
1677  0.,
1678  timingEndInSeconds,
1679  35,
1680  ttEtaBins);
1681  //--------END Special Hists for times stamp info------------------------------------------
1682 
1683  allFedsiPhiProfileHist_ = new TH1F("iPhiProfileAllEvents", "iPhi Profile all events;i#phi", 360, 1., 361.);
1684  allFedsiEtaProfileHist_ = new TH1F("iEtaProfileAllEvents", "iEta Profile all events;i#eta", 172, -86, 86);
1685 
1686  allOccupancy_ = new TH2F("OccupancyAllEvents", "Occupancy all events;i#phi;i#eta", 360, 1., 361., 172, -86, 86);
1687  TrueOccupancy_ =
1688  new TH2F("TrueOccupancyAllEvents", "True Occupancy all events;#phi;#eta", 360, -3.14159, 3.14159, 172, -1.5, 1.5);
1690  new TH2F("OccupancyAllEventsCoarse", "Occupancy all events Coarse;i#phi;i#eta", 360 / 5, 1, 361., 35, ttEtaBins);
1691  TrueOccupancyCoarse_ = new TH2F("TrueOccupancyAllEventsCoarse",
1692  "True Occupancy all events Coarse;#phi;#eta",
1693  360 / 5,
1694  -3.14159,
1695  3.14159,
1696  34,
1697  -1.5,
1698  1.5);
1699 
1700  // single xtal cluster occupancy
1702  new TH2F("OccupancySingleXtal", "Occupancy single xtal clusters;i#phi;i#eta", 360, 1., 361., 172, -86, 86);
1703  energySingleXtalHist_ = new TH1F(
1704  "energy_SingleXtalClusters", "Energy single xtal clusters;Cluster Energy (GeV)", numBins, histRangeMin_, 200.0);
1705 
1706  allFedsTimingPhiHist_ = new TH2F("timePhiAllFEDs",
1707  "time vs Phi for all FEDs (TT binning);i#phi;Relative Time (1 clock = 25ns)",
1708  72,
1709  1,
1710  361,
1711  78,
1712  -7,
1713  7);
1714  allFedsTimingPhiEbpHist_ = new TH2F("timePhiEBP",
1715  "time vs Phi for FEDs in EB+ (TT binning) ;i#phi;Relative Time (1 clock = 25ns)",
1716  72,
1717  1,
1718  361,
1719  78,
1720  -7,
1721  7);
1722  allFedsTimingPhiEbmHist_ = new TH2F("timePhiEBM",
1723  "time vs Phi for FEDs in EB- (TT binning);i#phi;Relative Time (1 clock = 25ns)",
1724  72,
1725  1,
1726  361,
1727  78,
1728  -7,
1729  7);
1731  new TH3F("timePhiEtaAllFEDs",
1732  "(Phi,Eta,time) for all FEDs (SM,M binning);i#phi;i#eta;Relative Time (1 clock = 25ns)",
1733  18,
1734  modPhiBins,
1735  9,
1736  modEtaBins,
1737  78,
1738  timingBins);
1740  new TH3F("timeTTAllFEDs",
1741  "(Phi,Eta,time) for all FEDs (SM,TT binning);i#phi;i#eta;Relative Time (1 clock = 25ns)",
1742  72,
1743  ttPhiBins,
1744  35,
1745  ttEtaBins,
1746  78,
1747  timingBins);
1748  allFedsTimingLMHist_ = new TH2F(
1749  "timeLMAllFEDs", "(LM,time) for all FEDs (SM,LM binning);LM;Relative Time (1 clock = 25ns)", 92, 1, 92, 78, -7, 7);
1750 
1751  allFedsTimingEbpHist_ = new TH1F("timeEBP", "time for FEDs in EB+;Relative Time (1 clock = 25ns)", 78, -7, 7);
1752  allFedsTimingEbmHist_ = new TH1F("timeEBM", "time for FEDs in EB-;Relative Time (1 clock = 25ns)", 78, -7, 7);
1754  new TH1F("timeEBPTop", "time for FEDs in EB+ Top;Relative Time (1 clock = 25ns)", 78, -7, 7);
1756  new TH1F("timeEBMTop", "time for FEDs in EB- Top;Relative Time (1 clock = 25ns)", 78, -7, 7);
1758  new TH1F("timeEBPBottom", "time for FEDs in EB+ Bottom;Relative Time (1 clock = 25ns)", 78, -7, 7);
1760  new TH1F("timeEBMBottom", "time for FEDs in EB- Bottom;Relative Time (1 clock = 25ns)", 78, -7, 7);
1761 
1763  new TH1F("numberofCosmicsPerEvent", "Number of cosmics per event;Number of Cosmics", 30, 0, 30);
1765  new TH1F("numberofCosmicsPerEvent_EB", "Number of cosmics per event EB;Number of Cosmics", 30, 0, 30);
1766 
1768  new TH1F("numberofCosmicsWTrackPerEvent", "Number of cosmics with track per event", 30, 0, 30);
1769  numberofCosmicsTopBottomHist_ = new TH1F(
1770  "numberofCosmicsTopBottomPerEvent", "Number of top bottom cosmics per event;Number of Cosmics", 30, 0, 30);
1771  numberofGoodEvtFreq_ = new TH1F("frequencyOfGoodEvents",
1772  "Number of events with cosmic vs Event;Event Number;Number of Good Events/100 Events",
1773  2000,
1774  0,
1775  200000);
1776 
1777  numberofCrossedEcalIdsHist_ = new TH1F("numberofCrossedEcalCosmicsPerEvent",
1778  "Number of crossed ECAL cosmics per event;Number of Crossed Cosmics",
1779  10,
1780  0,
1781  10);
1782 
1783  allOccupancyExclusiveECAL_ = new TH2F("OccupancyAllEvents_ExclusiveECAL",
1784  "Occupancy all events Exclusive ECAL ;i#phi;i#eta",
1785  360,
1786  1.,
1787  361.,
1788  172,
1789  -86,
1790  86);
1791  allOccupancyCoarseExclusiveECAL_ = new TH2F("OccupancyAllEventsCoarse_ExclusiveECAL",
1792  "Occupancy all events Coarse Exclusive ECAL;i#phi;i#eta",
1793  360 / 5,
1794  ttPhiBins,
1795  35,
1796  ttEtaBins);
1798  new TH2F("OccupancyAllEvents_ECAL", "Occupancy all events ECAL;i#phi;i#eta", 360, 1., 361., 172, -86, 86);
1799  allOccupancyCoarseECAL_ = new TH2F("OccupancyAllEventsCoarse_ECAL",
1800  "Occupancy all events Coarse ECAL;i#phi;i#eta",
1801  360 / 5,
1802  ttPhiBins,
1803  35,
1804  ttEtaBins);
1806  new TH1F("timeForAllFeds_ECAL", "timeForAllFeds ECAL;Relative Time (1 clock = 25ns)", 78, -7, 7);
1808  new TH3F("timePhiEtaAllFEDs_ECAL",
1809  "ECAL (Phi,Eta,time) for all FEDs (SM,M binning);i#phi;i#eta;Relative Time (1 clock = 25ns)",
1810  18,
1811  modPhiBins,
1812  9,
1813  modEtaBins,
1814  78,
1815  timingBins);
1817  new TH3F("timeTTAllFEDs_ECAL",
1818  "ECAL (Phi,Eta,time) for all FEDs (SM,TT binning);i#phi;i#eta;Relative Time (1 clock = 25ns)",
1819  72,
1820  ttPhiBins,
1821  35,
1822  ttEtaBins,
1823  78,
1824  timingBins);
1825  allFedsTimingLMHistECAL_ = new TH2F("timeLMAllFEDs_ECAL",
1826  "ECAL (LM,time) for all FEDs (SM,LM binning);LM;Relative Time (1 clock = 25ns)",
1827  92,
1828  1,
1829  92,
1830  78,
1831  -7,
1832  7);
1833 
1834  allOccupancyExclusiveDT_ = new TH2F(
1835  "OccupancyAllEvents_ExclusiveDT", "Occupancy all events Exclusive DT;i#phi;i#eta", 360, 1., 361., 172, -86, 86);
1836  allOccupancyCoarseExclusiveDT_ = new TH2F("OccupancyAllEventsCoarse_ExclusiveDT",
1837  "Occupancy all events Coarse Exclusive DT;i#phi;i#eta",
1838  360 / 5,
1839  1,
1840  361.,
1841  35,
1842  ttEtaBins);
1843  allOccupancyDT_ =
1844  new TH2F("OccupancyAllEvents_DT", "Occupancy all events DT;i#phi;i#eta", 360, 1., 361., 172, -86, 86);
1845  allOccupancyCoarseDT_ = new TH2F(
1846  "OccupancyAllEventsCoarse_DT", "Occupancy all events Coarse DT;i#phi;i#eta", 360 / 5, 1, 361., 35, ttEtaBins);
1847  allFedsTimingHistDT_ = new TH1F("timeForAllFeds_DT", "timeForAllFeds DT;Relative Time (1 clock = 25ns)", 78, -7, 7);
1849  new TH3F("timePhiEtaAllFEDs_DT",
1850  "DT (Phi,Eta,time) for all FEDs (SM,M binning);i#phi;i#eta;Relative Time (1 clock = 25ns)",
1851  18,
1852  modPhiBins,
1853  9,
1854  modEtaBins,
1855  78,
1856  timingBins);
1858  new TH3F("timeTTAllFEDs_DT",
1859  "DT (Phi,Eta,time) for all FEDs (SM,TT binning);i#phi;i#eta;Relative Time (1 clock = 25ns)",
1860  72,
1861  ttPhiBins,
1862  35,
1863  ttEtaBins,
1864  78,
1865  timingBins);
1866  allFedsTimingLMHistDT_ = new TH2F("timeLMAllFEDs_DT",
1867  "DT (LM,time) for all FEDs (SM,LM binning);LM;Relative Time (1 clock = 25ns)",
1868  92,
1869  1,
1870  92,
1871  78,
1872  -7,
1873  7);
1874 
1875  allOccupancyExclusiveRPC_ = new TH2F(
1876  "OccupancyAllEvents_ExclusiveRPC", "Occupancy all events Exclusive RPC;i#phi;i#eta", 360, 1., 361., 172, -86, 86);
1877  allOccupancyCoarseExclusiveRPC_ = new TH2F("OccupancyAllEventsCoarse_ExclusiveRPC",
1878  "Occupancy all events Coarse Exclusive RPC;i#phi;i#eta",
1879  360 / 5,
1880  1,
1881  361.,
1882  35,
1883  ttEtaBins);
1885  new TH2F("OccupancyAllEvents_RPC", "Occupancy all events RPC;i#phi;i#eta", 360, 1., 361., 172, -86, 86);
1886  allOccupancyCoarseRPC_ = new TH2F(
1887  "OccupancyAllEventsCoarse_RPC", "Occupancy all events Coarse RPC;i#phi;i#eta", 360 / 5, 1, 361., 35, ttEtaBins);
1889  new TH1F("timeForAllFeds_RPC", "timeForAllFeds RPC;Relative Time (1 clock = 25ns)", 78, -7, 7);
1891  new TH3F("timePhiEtaAllFEDs_RPC",
1892  "RPC (Phi,Eta,time) for all FEDs (SM,M binning);i#phi;i#eta;Relative Time (1 clock = 25ns)",
1893  18,
1894  modPhiBins,
1895  9,
1896  modEtaBins,
1897  78,
1898  timingBins);
1900  new TH3F("timeTTAllFEDs_RPC",
1901  "RPC (Phi,Eta,time) for all FEDs (SM,TT binning);i#phi;i#eta;Relative Time (1 clock = 25ns)",
1902  72,
1903  ttPhiBins,
1904  35,
1905  ttEtaBins,
1906  78,
1907  timingBins);
1908  allFedsTimingLMHistRPC_ = new TH2F("timeLMAllFEDs_RPC",
1909  "RPC (LM,time) for all FEDs (SM,LM binning);LM;Relative Time (1 clock = 25ns)",
1910  92,
1911  1,
1912  92,
1913  78,
1914  -7,
1915  7);
1916 
1917  allOccupancyExclusiveCSC_ = new TH2F(
1918  "OccupancyAllEvents_ExclusiveCSC", "Occupancy all events Exclusive CSC;i#phi;i#eta", 360, 1., 361., 172, -86, 86);
1919  allOccupancyCoarseExclusiveCSC_ = new TH2F("OccupancyAllEventsCoarse_ExclusiveCSC",
1920  "Occupancy all events Coarse Exclusive CSC;i#phi;i#eta",
1921  360 / 5,
1922  1,
1923  361.,
1924  35,
1925  ttEtaBins);
1927  new TH2F("OccupancyAllEvents_CSC", "Occupancy all events CSC;i#phi;i#eta", 360, 1., 361., 172, -86, 86);
1928  allOccupancyCoarseCSC_ = new TH2F(
1929  "OccupancyAllEventsCoarse_CSC", "Occupancy all events Coarse CSC;i#phi;i#eta", 360 / 5, 1, 361., 35, ttEtaBins);
1931  new TH1F("timeForAllFeds_CSC", "timeForAllFeds CSC;Relative Time (1 clock = 25ns)", 78, -7, 7);
1933  new TH3F("timePhiEtaAllFEDs_CSC",
1934  "CSC (Phi,Eta,time) for all FEDs (SM,M binning);i#phi;i#eta;Relative Time (1 clock = 25ns)",
1935  18,
1936  modPhiBins,
1937  9,
1938  modEtaBins,
1939  78,
1940  timingBins);
1942  new TH3F("timeTTAllFEDs_CSC",
1943  "CSC (Phi,Eta,time) for all FEDs (SM,TT binning);i#phi;i#eta;Relative Time (1 clock = 25ns)",
1944  72,
1945  ttPhiBins,
1946  35,
1947  ttEtaBins,
1948  78,
1949  timingBins);
1950  allFedsTimingLMHistCSC_ = new TH2F("timeLMAllFEDs_CSC",
1951  "CSC (LM,time) for all FEDs (SM,LM binning);LM;Relative Time (1 clock = 25ns)",
1952  92,
1953  1,
1954  62,
1955  78,
1956  -7,
1957  7);
1958 
1959  allOccupancyExclusiveHCAL_ = new TH2F("OccupancyAllEvents_ExclusiveHCAL",
1960  "Occupancy all events Exclusive HCAL;i#phi;i#eta",
1961  360,
1962  1.,
1963  361.,
1964  172,
1965  -86,
1966  86);
1967  allOccupancyCoarseExclusiveHCAL_ = new TH2F("OccupancyAllEventsCoarse_ExclusiveHCAL",
1968  "Occupancy all events Coarse Exclusive HCAL;i#phi;i#eta",
1969  360 / 5,
1970  1,
1971  361.,
1972  35,
1973  ttEtaBins);
1975  new TH2F("OccupancyAllEvents_HCAL", "Occupancy all events HCAL;i#phi;i#eta", 360, 1., 361., 172, -86, 86);
1976  allOccupancyCoarseHCAL_ = new TH2F(
1977  "OccupancyAllEventsCoarse_HCAL", "Occupancy all events Coarse HCAL;i#phi;i#eta", 360 / 5, 1, 361., 35, ttEtaBins);
1979  new TH1F("timeForAllFeds_HCAL", "timeForAllFeds HCAL;Relative Time (1 clock = 25ns)", 78, -7, 7);
1981  new TH3F("timePhiEtaAllFEDs_HCAL",
1982  "HCAL (Phi,Eta,time) for all FEDs (SM,M binning);i#phi;i#eta;Relative Time (1 clock = 25ns)",
1983  18,
1984  modPhiBins,
1985  9,
1986  modEtaBins,
1987  78,
1988  timingBins);
1990  new TH3F("timeTTAllFEDs_HCAL",
1991  "HCAL (Phi,Eta,time) for all FEDs (SM,TT binning);i#phi;i#eta;Relative Time (1 clock = 25ns)",
1992  72,
1993  ttPhiBins,
1994  35,
1995  ttEtaBins,
1996  78,
1997  timingBins);
1998  allFedsTimingLMHistHCAL_ = new TH2F("timeLMAllFEDs_HCAL",
1999  "HCAL (LM,time) for all FEDs (SM,LM binning);LM;Relative Time (1 clock = 25ns)",
2000  92,
2001  1,
2002  92,
2003  78,
2004  -7,
2005  7);
2006 
2007  TrueBCOccupancy_ = new TH2F(
2008  "BCTrueOccupancyAllEvents", "True SB Occupancy all events;#phi;#eta", 360, -3.14159, 3.14159, 172, -1.5, 1.5);
2009  TrueBCOccupancyCoarse_ = new TH2F("BCTrueOccupancyAllEventsCoarse",
2010  "True BC Occupancy all events Coarse;#phi;#eta",
2011  360 / 5,
2012  -3.14159,
2013  3.14159,
2014  34,
2015  -1.5,
2016  1.5);
2017 
2018  numberofBCinSC_ =
2019  new TH1F("numberofBCinSC", "Number of Basic Clusters in Super Cluster;Num Basic Clusters", 20, 0, 20); //SC
2020  numberofBCinSCphi_ = new TH2F("numberofBCinSCphi",
2021  "Number of Basic Clusters in Super Cluster;phi;Num Basic Clusters",
2022  360 / 5,
2023  -3.14159,
2024  3.14159,
2025  20,
2026  0,
2027  20); //SC
2028 
2030  new TH1F("timeForAllFeds_EcalMuon", "timeForAllFeds Ecal+Muon;Relative Time (1 clock = 25ns)", 78, -7, 7);
2031 
2032  triggerHist_ = new TH1F("triggerHist", "Trigger Number", 5, 0, 5);
2033  triggerHist_->GetXaxis()->SetBinLabel(1, "ECAL");
2034  triggerHist_->GetXaxis()->SetBinLabel(2, "HCAL");
2035  triggerHist_->GetXaxis()->SetBinLabel(3, "DT");
2036  triggerHist_->GetXaxis()->SetBinLabel(4, "RPC");
2037  triggerHist_->GetXaxis()->SetBinLabel(5, "CSC");
2038 
2039  triggerExclusiveHist_ = new TH1F("triggerExclusiveHist", "Trigger Number (Mutually Exclusive)", 5, 0, 5);
2040  triggerExclusiveHist_->GetXaxis()->SetBinLabel(1, "ECAL");
2041  triggerExclusiveHist_->GetXaxis()->SetBinLabel(2, "HCAL");
2042  triggerExclusiveHist_->GetXaxis()->SetBinLabel(3, "DT");
2043  triggerExclusiveHist_->GetXaxis()->SetBinLabel(4, "RPC");
2044  triggerExclusiveHist_->GetXaxis()->SetBinLabel(5, "CSC");
2045 
2046  runNumberHist_ = new TH1F("runNumberHist", "Run Number", 1, 0, 1);
2047 
2048  deltaRHist_ = new TH1F("deltaRHist", "deltaR", 500, -0.5, 499.5);
2049  deltaEtaHist_ = new TH1F("deltaIEtaHist", "deltaIEta", 170, -85.5, 84.5);
2050  deltaPhiHist_ = new TH1F("deltaIPhiHist", "deltaIPhi", 720, -360.5, 359.5);
2051  ratioAssocTracksHist_ = new TH1F("ratioAssocTracks", "num assoc. tracks/tracks through Ecal", 11, 0, 1.1);
2052  ratioAssocClustersHist_ = new TH1F("ratioAssocClusters", "num assoc. clusters/total clusters", 11, 0, 1.1);
2053  trackAssoc_muonsEcal_ = new TH2F(
2054  "trackAssoc_muonsEcal", "Map of muon hits in Ecal", 360, 1., 361., 172, -86, 86); //360, 0 , 360, 170,-85 ,85);
2056  new TH2F("deltaEtaDeltaPhi", "Delta ieta vs. delta iphi", 170, -85.5, 84.5, 720, -360.5, 359.5);
2057  seedTrackEtaHist_ = new TH2F("seedTrackEta", "track ieta vs. seed ieta", 170, -85.5, 84.5, 170, -85.5, 84.5);
2058  seedTrackPhiHist_ = new TH2F("seedTrackPhi", "track iphi vs. seed iphi", 720, -360.5, 359.5, 720, -360.5, 359.5);
2059 
2060  dccEventVsBxHist_ = new TH2F("dccEventVsBx", "DCC Runtype vs. bunch crossing", 3600, 0, 3600, 24, 0, 24);
2061  dccBXErrorByFEDHist_ = new TH1F("dccBXErrorByFED", "Incorrect BX number by FED", 54, 601, 655);
2062  dccOrbitErrorByFEDHist_ = new TH1F("dccOrbitErrorByFED", "Incorrect orbit number by FED", 54, 601, 655);
2063  dccRuntypeErrorByFEDHist_ = new TH1F("dccRuntypeErrorByFED", "Incorrect DCC Runtype by FED", 54, 601, 655);
2064  dccRuntypeHist_ = new TH1F("dccRuntype", "DCC Runtype frequency", 24, 0, 24);
2065  dccErrorVsBxHist_ = new TH2F("dccErrorVsBX", "DCC Errors vs. BX", 3600, 0, 3600, 3, 0, 3);
2066 
2067  hcalEnergy_HBHE_ = new TH1F("hcalEnergy_HBHE", "RecHit Energy HBHE", 440, -10, 100);
2068  hcalEnergy_HF_ = new TH1F("hcalEnergy_HF", "RecHit Energy HF", 440, -10, 100);
2069  hcalEnergy_HO_ = new TH1F("hcalEnergy_HO", "RecHit Energy HO", 440, -10, 100);
2070  hcalHEHBecalEB_ =
2071  new TH2F("hcalHEHBecalEB", "HCAL HBHE RecHit energy vs ECAL EB energy", numBins, histRangeMin_, 300.0, 40, -5, 5);
2072 
2073  NumXtalsInClusterHist_ = new TH1F("NumXtalsInClusterAllHist", "Number of Xtals in Cluster;NumXtals", 150, 0, 150);
2074  numxtalsVsEnergy_ = new TH2F("NumXtalsVsEnergy",
2075  "Number of Xtals in Cluster vs Energy;Energy (GeV);Number of Xtals in Cluster",
2076  numBins,
2077  histRangeMin_,
2078  histRangeMax_,
2079  150,
2080  0,
2081  150);
2082  numxtalsVsHighEnergy_ = new TH2F("NumXtalsVsHighEnergy",
2083  "Number of Xtals in Cluster vs Energy;Energy (GeV);Number of Xtals in Cluster",
2084  numBins,
2085  histRangeMin_,
2086  200.,
2087  150,
2088  0,
2089  150);
2090 
2091  // high energy analysis
2093  new TH2F("OccupancyHighEnergyEvents", "Occupancy high energy events;i#phi;i#eta", 360, 1., 361., 172, -86, 86);
2094  allOccupancyHighEnergyCoarse_ = new TH2F("OccupancyHighEnergyEventsCoarse",
2095  "Occupancy high energy events Coarse;i#phi;i#eta",
2096  72,
2097  ttPhiBins,
2098  35,
2099  ttEtaBins);
2100  allFedsOccupancyHighEnergyHist_ = new TH3F("OccupancyHighEnergyEvents3D",
2101  "(Phi,Eta,energy) for all high energy events;i#phi;i#eta;energy (GeV)",
2102  18,
2103  modPhiBins,
2104  9,
2105  modEtaBins,
2106  10,
2107  highEBins);
2109  new TH1F("NumActiveXtalsInClusterAllHist", "Number of active Xtals in Cluster;NumXtals", 100, 0, 100);
2110 
2111  HighEnergy_NumXtal = new TH1F("HighEnergy_NumXtal", "Num crystals in high E clusters;num crystals", 150, 0, 150);
2112  HighEnergy_NumXtalFedId = new TH2F(
2113  "HighEnergy_NumXtalFedId", "Num crystals in cluster vs FedId;FedId;num crystals", 36, 610., 645., 150, 0, 150);
2114  HighEnergy_NumXtaliphi = new TH2F(
2115  "HighEnergy_NumXtaliphi", "Num crystals in cluster vs iphi;i#phi;num crystals", 360, 1., 361., 150, 0, 150);
2116  HighEnergy_energy3D = new TH3F("HighEnergy_energy3D",
2117  "(Phi,Eta,energy) for all high energy events;i#phi;i#eta;energy (GeV)",
2118  72,
2119  ttPhiBins,
2120  35,
2121  ttEtaBins,
2122  10,
2123  highEBins);
2124 
2125  HighEnergy_energyNumXtal = new TH2F("HighEnergy_energyNumXtal",
2126  "Energy in cluster vs Num crystals in cluster;num crystals;energy",
2127  150,
2128  0,
2129  150,
2130  200,
2131  0.,
2132  200.);
2133 
2134  HighEnergy_bestSeed = new TH1F("HighEnergy_bestSeedEnergy", "BestSeed Energy from TrackAss", 200, 0., 200.);
2135  HighEnergy_bestSeedOccupancy = new TH2F(
2136  "HighEnergy_bestSeedOccupancy", "Occupancy HighEn events from TrackAss;i#phi;i#eta", 360, 1., 361., 172, -86, 86);
2137 
2138  HighEnergy_numClusHighEn = new TH1F("HighEnergy_numClusHighEn", "Num High Energy Clusters", 7, 0, 7);
2140  new TH1F("HighEnergy_ratioClusters", "Num High Energy Clusters/Num tot Clusters", 100, 0., 1.1);
2141 
2142  HighEnergy_numRecoTrackBarrel = new TH1F("HighEnergy_numRecoTracksBarrel", "Num BarrelRecoTracks", 10, 0, 10);
2143  HighEnergy_TracksAngle = new TH1F("HighEnergy_TracksAngle", "Angle between tracks", 720, 0., 180.);
2145  new TH1F("HighEnergy_TopBottomTracksAngle", "Angle between top-bottom tracks", 720, 0., 180.);
2146 
2147  HighEnergy_2GeV_occuCoarse = new TH2F("HighEnergy_occu2GeV_Coarse",
2148  "Occupancy high energy events with more than 2 GeV;i#phi;i#eta",
2149  72,
2150  ttPhiBins,
2151  35,
2152  ttEtaBins);
2153  HighEnergy_2GeV_occu3D = new TH3F("HighEnergy_2GeV_energy3D",
2154  "(iphi,ieta,energy) for all high energy events w > 10 GeV;i#phi;i#eta;energy (GeV)",
2155  72,
2156  ttPhiBins,
2157  35,
2158  ttEtaBins,
2159  10,
2160  highEBins);
2161  HighEnergy_100GeV_occuCoarse = new TH2F("HighEnergy_occu100GeV_Coarse",
2162  "Occupancy high energy events with more than 100 GeV;i#phi;i#eta",
2163  72,
2164  ttPhiBins,
2165  35,
2166  ttEtaBins);
2168  new TH3F("HighEnergy_100GeV_energy3D",
2169  "(iphi,ieta,energy) for all high energy events more than 100 GeV;i#phi;i#eta;energy (GeV)",
2170  72,
2171  ttPhiBins,
2172  35,
2173  ttEtaBins,
2174  10,
2175  highEBins);
2176  HighEnergy_0tracks_occu3D = new TH3F("HighEnergy_0Tracks_energy3D",
2177  "(iphi,ieta,energy) for all events with 0 tracks;i#phi;i#eta;energy (GeV)",
2178  72,
2179  ttPhiBins,
2180  35,
2181  ttEtaBins,
2182  10,
2183  highEBins);
2184  HighEnergy_1tracks_occu3D = new TH3F("HighEnergy_1Tracks_energy3D",
2185  "(iphi,ieta,energy) for all events with 1 tracks;i#phi;i#eta;energy (GeV)",
2186  72,
2187  ttPhiBins,
2188  35,
2189  ttEtaBins,
2190  10,
2191  highEBins);
2192  HighEnergy_2tracks_occu3D = new TH3F("HighEnergy_2Tracks_energy3D",
2193  "(iphi,ieta,energy) for all events with 2 tracks;i#phi;i#eta;energy (GeV)",
2194  72,
2195  ttPhiBins,
2196  35,
2197  ttEtaBins,
2198  10,
2199  highEBins);
2200  HighEnergy_0tracks_occu3DXtal = new TH3F("HighEnergy_0Tracks_energy3DXtal",
2201  "(iphi,ieta,energy) for all events with 0 tracks;i#phi;i#eta;energy (GeV)",
2202  360,
2203  1.,
2204  361.,
2205  172,
2206  -86,
2207  86,
2208  200,
2209  0.,
2210  200.);
2211  HighEnergy_1tracks_occu3DXtal = new TH3F("HighEnergy_1Tracks_energy3DXtal",
2212  "(iphi,ieta,energy) for all events with 1 tracks;i#phi;i#eta;energy (GeV)",
2213  360,
2214  1.,
2215  361.,
2216  172,
2217  -86,
2218  86,
2219  200,
2220  0.,
2221  200.);
2222  HighEnergy_2tracks_occu3DXtal = new TH3F("HighEnergy_2Tracks_energy3DXtal",
2223  "(iphi,ieta,energy) for all events with 2 tracks;i#phi;i#eta;energy (GeV)",
2224  360,
2225  1.,
2226  361.,
2227  172,
2228  -86,
2229  86,
2230  200,
2231  0.,
2232  200.);
2233 
2234  //EE histograms
2235 
2236  // EE-
2238  new TH1F("SeedEnergyAllFEDs", "Seed Energy for EEM Feds; Seed Energy (GeV)", 200, histRangeMin_, 10.0);
2239 
2241  new TH2F("OccupancyAllEventsCoarse", "Occupancy all events Coarse EEM;ix;iy", 20, 0, 100, 20, 0, 100);
2242  EEM_AllOccupancy_ = new TH2F("OccupancyAllEvents", "Occupancy all events EEM;ix;iy", 100, 0, 100, 100, 0, 100);
2244  new TH1F("energy_AllClusters", "energy_AllClusters_EEM;Cluster Energy (GeV)", numBins, histRangeMin_, 10.0);
2245  EEM_FedsenergyHighHist_ = new TH1F(
2246  "energyHigh_AllClusters", "energyHigh_AllClusters in EEM;Cluster Energy (GeV)", numBins, histRangeMin_, 200.0);
2247  EEM_FedsenergyOnlyHighHist_ = new TH1F("energyHigh_HighEnergyClusters",
2248  "energy of High Energy Clusters in EEM;Cluster Energy (GeV)",
2249  numBins,
2250  histRangeMin_,
2251  200.0);
2252  EEM_FedsE2Hist_ =
2253  new TH1F("E2_AllClusters", "E2_AllClusters_EEM;Seed+highest neighbor energy (GeV)", numBins, histRangeMin_, 10.0);
2254  EEM_FedsE2vsE1Hist_ = new TH2F("E2vsE1_AllClusters",
2255  "E2vsE1_AllClusters_EEM;Seed Energy (GeV);Seed+highest neighbor energy (GeV)",
2256  numBins,
2257  histRangeMin_,
2258  10.0,
2259  numBins,
2260  histRangeMin_,
2261  10.0);
2262  EEM_FedsenergyvsE1Hist_ = new TH2F("energyvsE1_AllClusters",
2263  "energyvsE1_AllClusters_EEM;Seed Energy (GeV);Energy(GeV)",
2264  numBins,
2265  histRangeMin_,
2266  10.0,
2267  numBins,
2268  histRangeMin_,
2269  10.0);
2270  EEM_FedsTimingHist_ = new TH1F("timeForAllFeds", "timeForAllFeds_EEM;Relative Time (1 clock = 25ns)", 78, -7, 7);
2272  new TH1F("numberofCosmicsPerEvent", "Number of cosmics per event EEM;Number of Cosmics", 30, 0, 30);
2273 
2274  EEM_FedsTimingVsAmpHist_ = new TH2F("timeVsAmpAllEvents",
2275  "time Vs Amp All Events EEM;Relative Time (1 clock = 25ns);Amplitude (GeV)",
2276  78,
2277  -7,
2278  7,
2279  numBins,
2280  histRangeMin_,
2281  10.0);
2282  EEM_FedsTimingTTHist_ = new TH3F("timeTTAllFEDs",
2283  "(ix,iy,time) for all FEDs (SM,TT binning) EEM;ix;iy;Relative Time (1 clock = 25ns)",
2284  20,
2285  0,
2286  100,
2287  20,
2288  0,
2289  100,
2290  78,
2291  -7,
2292  7);
2293 
2295  new TH2F("OccupancySingleXtal", "Occupancy single xtal clusters EEM;ix;iy", 100, 0, 100, 100, 0, 100);
2296  EEM_energySingleXtalHist_ = new TH1F("energy_SingleXtalClusters",
2297  "Energy single xtal clusters EEM;Cluster Energy (GeV)",
2298  numBins,
2299  histRangeMin_,
2300  200.0);
2301 
2302  EEM_OccupancyExclusiveECAL_ = new TH2F(
2303  "OccupancyAllEvents_ExclusiveECAL", "Occupancy all events Exclusive ECAL EEM;ix;iy", 100, 0, 100, 100, 0, 100);
2304  EEM_OccupancyCoarseExclusiveECAL_ = new TH2F("OccupancyAllEventsCoarse_ExclusiveECAL",
2305  "Occupancy all events Coarse Exclusive ECAL EEM;ix;iy",
2306  20,
2307  0,
2308  100,
2309  20,
2310  0,
2311  100);
2313  new TH2F("OccupancyAllEvents_ECAL", "Occupancy all events ECAL EEM;ix;iy", 100, 0, 100, 100, 0, 100);
2315  new TH2F("OccupancyAllEventsCoarse_ECAL", "Occupancy all events Coarse ECAL EEM;ix;iy", 20, 0, 100, 20, 0, 100);
2317  new TH1F("timeForAllFeds_ECAL", "timeForAllFeds ECAL EEM;Relative Time (1 clock = 25ns)", 78, -7, 7);
2319  new TH3F("timeTTAllFEDs_ECAL",
2320  "(ix,iy,time) for all FEDs (SM,TT binning) ECAL EEM;ix;iy;Relative Time (1 clock = 25ns)",
2321  20,
2322  0,
2323  100,
2324  20,
2325  0,
2326  100,
2327  78,
2328  -7,
2329  7);
2330 
2331  EEM_OccupancyExclusiveDT_ = new TH2F(
2332  "OccupancyAllEvents_ExclusiveDT", "Occupancy all events Exclusive DT EEM;ix;iy", 100, 0, 100, 100, 0, 100);
2333  EEM_OccupancyCoarseExclusiveDT_ = new TH2F("OccupancyAllEventsCoarse_ExclusiveDT",
2334  "Occupancy all events Coarse Exclusive DT EEM;ix;iy",
2335  20,
2336  0,
2337  100,
2338  20,
2339  0,
2340  100);
2341  EEM_OccupancyDT_ = new TH2F("OccupancyAllEvents_DT", "Occupancy all events DT EEM;ix;iy", 100, 0, 100, 100, 0, 100);
2343  new TH2F("OccupancyAllEventsCoarse_DT", "Occupancy all events Coarse DT EEM;ix;iy", 20, 0, 100, 20, 0, 100);
2345  new TH1F("timeForAllFeds_DT", "timeForAllFeds DT EEM;Relative Time (1 clock = 25ns)", 78, -7, 7);
2347  new TH3F("timeTTAllFEDs_DT",
2348  "(ix,iy,time) for all FEDs (SM,TT binning) DT EEM;ix;iy;Relative Time (1 clock = 25ns)",
2349  20,
2350  0,
2351  100,
2352  20,
2353  0,
2354  100,
2355  78,
2356  -7,
2357  7);
2358 
2359  EEM_OccupancyExclusiveRPC_ = new TH2F(
2360  "OccupancyAllEvents_ExclusiveRPC", "Occupancy all events Exclusive RPC EEM;ix;iy", 100, 0, 100, 100, 0, 100);
2361  EEM_OccupancyCoarseExclusiveRPC_ = new TH2F("OccupancyAllEventsCoarse_ExclusiveRPC",
2362  "Occupancy all events Coarse Exclusive RPC EEM;ix;iy",
2363  20,
2364  0,
2365  100,
2366  20,
2367  0,
2368  100);
2370  new TH2F("OccupancyAllEvents_RPC", "Occupancy all events RPC EEM;ix;iy", 100, 0, 100, 100, 0, 100);
2372  new TH2F("OccupancyAllEventsCoarse_RPC", "Occupancy all events Coarse RPC EEM;ix;iy", 20, 0, 100, 20, 0, 100);
2374  new TH1F("timeForAllFeds_RPC", "timeForAllFeds RPC EEM;Relative Time (1 clock = 25ns)", 78, -7, 7);
2376  new TH3F("timeTTAllFEDs_RPC",
2377  "(ix,iy,time) for all FEDs (SM,TT binning) RPC EEM;ix;iy;Relative Time (1 clock = 25ns)",
2378  20,
2379  0,
2380  100,
2381  20,
2382  0,
2383  100,
2384  78,
2385  -7,
2386  7);
2387 
2388  EEM_OccupancyExclusiveCSC_ = new TH2F(
2389  "OccupancyAllEvents_ExclusiveCSC", "Occupancy all events Exclusive CSC EEM;ix;iy", 100, 0, 100, 100, 0, 100);
2390  EEM_OccupancyCoarseExclusiveCSC_ = new TH2F("OccupancyAllEventsCoarse_ExclusiveCSC",
2391  "Occupancy all events Coarse Exclusive CSC EEM;ix;iy",
2392  20,
2393  0,
2394  100,
2395  20,
2396  0,
2397  100);
2399  new TH2F("OccupancyAllEvents_CSC", "Occupancy all events CSC EEM;ix;iy", 100, 0, 100, 100, 0, 100);
2401  new TH2F("OccupancyAllEventsCoarse_CSC", "Occupancy all events Coarse CSC EEM;ix;iy", 20, 0, 100, 20, 0, 100);
2403  new TH1F("timeForAllFeds_CSC", "timeForAllFeds CSC EEM;Relative Time (1 clock = 25ns)", 78, -7, 7);
2405  new TH3F("timeTTAllFEDs_CSC",
2406  "(ix,iy,time) for all FEDs (SM,TT binning) CSC EEM;ix;iy;Relative Time (1 clock = 25ns)",
2407  20,
2408  0,
2409  100,
2410  20,
2411  0,
2412  100,
2413  78,
2414  -7,
2415  7);
2416 
2417  EEM_OccupancyExclusiveHCAL_ = new TH2F(
2418  "OccupancyAllEvents_ExclusiveHCAL", "Occupancy all events Exclusive HCAL EEM;ix;iy", 100, 0, 100, 100, 0, 100);
2419  EEM_OccupancyCoarseExclusiveHCAL_ = new TH2F("OccupancyAllEventsCoarse_ExclusiveHCAL",
2420  "Occupancy all events Coarse Exclusive HCAL EEM;ix;iy",
2421  20,
2422  0,
2423  100,
2424  20,
2425  0,
2426  100);
2428  new TH2F("OccupancyAllEvents_HCAL", "Occupancy all events HCAL EEM;ix;iy", 100, 0, 100, 100, 0, 100);
2430  new TH2F("OccupancyAllEventsCoarse_HCAL", "Occupancy all events Coarse HCAL EEM;ix;iy", 20, 0, 100, 20, 0, 100);
2432  new TH1F("timeForAllFeds_HCAL", "timeForAllFeds HCAL EEM;Relative Time (1 clock = 25ns)", 78, -7, 7);
2434  new TH3F("timeTTAllFEDs_HCAL",
2435  "(ix,iy,time) for all FEDs (SM,TT binning) HCAL EEM;ix;iy;Relative Time (1 clock = 25ns)",
2436  20,
2437  0,
2438  100,
2439  20,
2440  0,
2441  100,
2442  78,
2443  -7,
2444  7);
2445 
2447  new TH1F("numberofBCinSC", "Number of Basic Clusters in Super Cluster EEM;Num Basic Clusters", 20, 0, 20);
2448 
2449  EEM_triggerHist_ = new TH1F("triggerHist", "Trigger Number EEM", 5, 0, 5);
2450  EEM_triggerHist_->GetXaxis()->SetBinLabel(1, "ECAL");
2451  EEM_triggerHist_->GetXaxis()->SetBinLabel(2, "HCAL");
2452  EEM_triggerHist_->GetXaxis()->SetBinLabel(3, "DT");
2453  EEM_triggerHist_->GetXaxis()->SetBinLabel(4, "RPC");
2454  EEM_triggerHist_->GetXaxis()->SetBinLabel(5, "CSC");
2455 
2456  EEM_triggerExclusiveHist_ = new TH1F("triggerExclusiveHist", "Trigger Number (Mutually Exclusive) EEM", 5, 0, 5);
2457  triggerExclusiveHist_->GetXaxis()->SetBinLabel(1, "ECAL");
2458  EEM_triggerExclusiveHist_->GetXaxis()->SetBinLabel(2, "HCAL");
2459  EEM_triggerExclusiveHist_->GetXaxis()->SetBinLabel(3, "DT");
2460  EEM_triggerExclusiveHist_->GetXaxis()->SetBinLabel(4, "RPC");
2461  EEM_triggerExclusiveHist_->GetXaxis()->SetBinLabel(5, "CSC");
2462 
2464  new TH1F("NumXtalsInClusterAllHist", "Number of Xtals in Cluster EEM;NumXtals", 150, 0, 150);
2465  EEM_numxtalsVsEnergy_ = new TH2F("NumXtalsVsEnergy",
2466  "Number of Xtals in Cluster vs Energy EEM;Energy (GeV);Number of Xtals in Cluster",
2467  numBins,
2468  histRangeMin_,
2469  10.0,
2470  150,
2471  0,
2472  150);
2474  new TH2F("NumXtalsVsHighEnergy",
2475  "Number of Xtals in Cluster vs Energy EEM;Energy (GeV);Number of Xtals in Cluster",
2476  numBins,
2477  histRangeMin_,
2478  200.,
2479  150,
2480  0,
2481  150);
2482 
2484  new TH2F("OccupancyHighEnergyEvents", "Occupancy high energy events EEM;ix;iy", 100, 0, 100, 100, 0, 100);
2485  EEM_OccupancyHighEnergyCoarse_ = new TH2F(
2486  "OccupancyHighEnergyEventsCoarse", "Occupancy high energy events Coarse EEM;ix;iy", 20, 0, 100, 20, 0, 100);
2487 
2489  new TH1F("NumActiveXtalsInClusterAllHist", "Number of active Xtals in Cluster EEM;NumXtals", 100, 0, 100);
2490 
2491  // EE+
2493  new TH1F("SeedEnergyAllFEDs", "Seed Energy for EEP Feds; Seed Energy (GeV)", 200, histRangeMin_, 10.0);
2494 
2496  new TH2F("OccupancyAllEventsCoarse", "Occupancy all events Coarse EEP;ix;iy", 20, 0, 100, 20, 0, 100);
2497  EEP_AllOccupancy_ = new TH2F("OccupancyAllEvents", "Occupancy all events EEP;ix;iy", 100, 0, 100, 100, 0, 100);
2499  new TH1F("energy_AllClusters", "energy_AllClusters_EEP;Cluster Energy (GeV)", numBins, histRangeMin_, 10.0);
2500  EEP_FedsenergyHighHist_ = new TH1F(
2501  "energyHigh_AllClusters", "energyHigh_AllClusters in EEP;Cluster Energy (GeV)", numBins, histRangeMin_, 200.0);
2502  EEP_FedsenergyOnlyHighHist_ = new TH1F("energyHigh_HighEnergyClusters",
2503  "energy of High Energy Clusters in EEP;Cluster Energy (GeV)",
2504  numBins,
2505  histRangeMin_,
2506  200.0);
2507  EEP_FedsE2Hist_ =
2508  new TH1F("E2_AllClusters", "E2_AllClusters_EEP;Seed+highest neighbor energy (GeV)", numBins, histRangeMin_, 10.0);
2509  EEP_FedsE2vsE1Hist_ = new TH2F("E2vsE1_AllClusters",
2510  "E2vsE1_AllClusters_EEP;Seed Energy (GeV);Seed+highest neighbor energy (GeV)",
2511  numBins,
2512  histRangeMin_,
2513  10.0,
2514  numBins,
2515  histRangeMin_,
2516  10.0);
2517  EEP_FedsenergyvsE1Hist_ = new TH2F("energyvsE1_AllClusters",
2518  "energyvsE1_AllClusters_EEP;Seed Energy (GeV);Energy(GeV)",
2519  numBins,
2520  histRangeMin_,
2521  10.0,
2522  numBins,
2523  histRangeMin_,
2524  10.0);
2525  EEP_FedsTimingHist_ = new TH1F("timeForAllFeds", "timeForAllFeds_EEP;Relative Time (1 clock = 25ns)", 78, -7, 7);
2527  new TH1F("numberofCosmicsPerEvent", "Number of cosmics per event EEP;Number of Cosmics", 30, 0, 30);
2528 
2529  EEP_FedsTimingVsAmpHist_ = new TH2F("timeVsAmpAllEvents",
2530  "time Vs Amp All Events EEP;Relative Time (1 clock = 25ns);Amplitude (GeV)",
2531  78,
2532  -7,
2533  7,
2534  numBins,
2535  histRangeMin_,
2536  10.0);
2537  EEP_FedsTimingTTHist_ = new TH3F("timeTTAllFEDs",
2538  "(ix,iy,time) for all FEDs (SM,TT binning) EEP;ix;iy;Relative Time (1 clock = 25ns)",
2539  20,
2540  0,
2541  100,
2542  20,
2543  0,
2544  100,
2545  78,
2546  -7,
2547  7);
2548 
2550  new TH2F("OccupancySingleXtal", "Occupancy single xtal clusters EEP;ix;iy", 100, 0, 100, 100, 0, 100);
2551  EEP_energySingleXtalHist_ = new TH1F("energy_SingleXtalClusters",
2552  "Energy single xtal clusters EEP;Cluster Energy (GeV)",
2553  numBins,
2554  histRangeMin_,
2555  200.0);
2556 
2557  EEP_OccupancyExclusiveECAL_ = new TH2F(
2558  "OccupancyAllEvents_ExclusiveECAL", "Occupancy all events Exclusive ECAL EEP;ix;iy", 100, 0, 100, 100, 0, 100);
2559  EEP_OccupancyCoarseExclusiveECAL_ = new TH2F("OccupancyAllEventsCoarse_ExclusiveECAL",
2560  "Occupancy all events Coarse Exclusive ECAL EEP;ix;iy",
2561  20,
2562  0,
2563  100,
2564  20,
2565  0,
2566  100);
2568  new TH2F("OccupancyAllEvents_ECAL", "Occupancy all events ECAL EEP;ix;iy", 100, 0, 100, 100, 0, 100);
2570  new TH2F("OccupancyAllEventsCoarse_ECAL", "Occupancy all events Coarse ECAL EEP;ix;iy", 20, 0, 100, 20, 0, 100);
2572  new TH1F("timeForAllFeds_ECAL", "timeForAllFeds ECAL EEP;Relative Time (1 clock = 25ns)", 78, -7, 7);
2574  new TH3F("timeTTAllFEDs_ECAL",
2575  "(ix,iy,time) for all FEDs (SM,TT binning) ECAL EEP;ix;iy;Relative Time (1 clock = 25ns)",
2576  20,
2577  0,
2578  100,
2579  20,
2580  0,
2581  100,
2582  78,
2583  -7,
2584  7);
2585 
2586  EEP_OccupancyExclusiveDT_ = new TH2F(
2587  "OccupancyAllEvents_ExclusiveDT", "Occupancy all events Exclusive DT EEP;ix;iy", 100, 0, 100, 100, 0, 100);
2588  EEP_OccupancyCoarseExclusiveDT_ = new TH2F("OccupancyAllEventsCoarse_ExclusiveDT",
2589  "Occupancy all events Coarse Exclusive DT EEP;ix;iy",
2590  20,
2591  0,
2592  100,
2593  20,
2594  0,
2595  100);
2596  EEP_OccupancyDT_ = new TH2F("OccupancyAllEvents_DT", "Occupancy all events DT EEP;ix;iy", 100, 0, 100, 100, 0, 100);
2598  new TH2F("OccupancyAllEventsCoarse_DT", "Occupancy all events Coarse DT EEP;ix;iy", 20, 0, 100, 20, 0, 100);
2600  new TH1F("timeForAllFeds_DT", "timeForAllFeds DT EEP;Relative Time (1 clock = 25ns)", 78, -7, 7);
2602  new TH3F("timeTTAllFEDs_DT",
2603  "(ix,iy,time) for all FEDs (SM,TT binning) DT EEP;ix;iy;Relative Time (1 clock = 25ns)",
2604  20,
2605  0,
2606  100,
2607  20,
2608  0,
2609  100,
2610  78,
2611  -7,
2612  7);
2613 
2614  EEP_OccupancyExclusiveRPC_ = new TH2F(
2615  "OccupancyAllEvents_ExclusiveRPC", "Occupancy all events Exclusive RPC EEP;ix;iy", 100, 0, 100, 100, 0, 100);
2616  EEP_OccupancyCoarseExclusiveRPC_ = new TH2F("OccupancyAllEventsCoarse_ExclusiveRPC",
2617  "Occupancy all events Coarse Exclusive RPC EEP;ix;iy",
2618  20,
2619  0,
2620  100,
2621  20,
2622  0,
2623  100);
2625  new TH2F("OccupancyAllEvents_RPC", "Occupancy all events RPC EEP;ix;iy", 100, 0, 100, 100, 0, 100);
2627  new TH2F("OccupancyAllEventsCoarse_RPC", "Occupancy all events Coarse RPC EEP;ix;iy", 20, 0, 100, 20, 0, 100);
2629  new TH1F("timeForAllFeds_RPC", "timeForAllFeds RPC EEP;Relative Time (1 clock = 25ns)", 78, -7, 7);
2631  new TH3F("timeTTAllFEDs_RPC",
2632  "(ix,iy,time) for all FEDs (SM,TT binning) RPC EEP;ix;iy;Relative Time (1 clock = 25ns)",
2633  20,
2634  0,
2635  100,
2636  20,
2637  0,
2638  100,
2639  78,
2640  -7,
2641  7);
2642 
2643  EEP_OccupancyExclusiveCSC_ = new TH2F(
2644  "OccupancyAllEvents_ExclusiveCSC", "Occupancy all events Exclusive CSC EEP;ix;iy", 100, 0, 100, 100, 0, 100);
2645  EEP_OccupancyCoarseExclusiveCSC_ = new TH2F("OccupancyAllEventsCoarse_ExclusiveCSC",
2646  "Occupancy all events Coarse Exclusive CSC EEP;ix;iy",
2647  20,
2648  0,
2649  100,
2650  20,
2651  0,
2652  100);
2654  new TH2F("OccupancyAllEvents_CSC", "Occupancy all events CSC EEP;ix;iy", 100, 0, 100, 100, 0, 100);
2656  new TH2F("OccupancyAllEventsCoarse_CSC", "Occupancy all events Coarse CSC EEP;ix;iy", 20, 0, 100, 20, 0, 100);
2658  new TH1F("timeForAllFeds_CSC", "timeForAllFeds CSC EEP;Relative Time (1 clock = 25ns)", 78, -7, 7);
2660  new TH3F("timeTTAllFEDs_CSC",
2661  "(ix,iy,time) for all FEDs (SM,TT binning) CSC EEP;ix;iy;Relative Time (1 clock = 25ns)",
2662  20,
2663  0,
2664  100,
2665  20,
2666  0,
2667  100,
2668  78,
2669  -7,
2670  7);
2671 
2672  EEP_OccupancyExclusiveHCAL_ = new TH2F(
2673  "OccupancyAllEvents_ExclusiveHCAL", "Occupancy all events Exclusive HCAL EEP;ix;iy", 100, 0, 100, 100, 0, 100);
2674  EEP_OccupancyCoarseExclusiveHCAL_ = new TH2F("OccupancyAllEventsCoarse_ExclusiveHCAL",
2675  "Occupancy all events Coarse Exclusive HCAL EEP;ix;iy",
2676  20,
2677  0,
2678  100,
2679  20,
2680  0,
2681  100);
2683  new TH2F("OccupancyAllEvents_HCAL", "Occupancy all events HCAL EEP;ix;iy", 100, 0, 100, 100, 0, 100);
2685  new TH2F("OccupancyAllEventsCoarse_HCAL", "Occupancy all events Coarse HCAL EEP;ix;iy", 20, 0, 100, 20, 0, 100);
2687  new TH1F("timeForAllFeds_HCAL", "timeForAllFeds HCAL EEP;Relative Time (1 clock = 25ns)", 78, -7, 7);
2689  new TH3F("timeTTAllFEDs_HCAL",
2690  "(ix,iy,time) for all FEDs (SM,TT binning) HCAL EEP;ix;iy;Relative Time (1 clock = 25ns)",
2691  20,
2692  0,
2693  100,
2694  20,
2695  0,
2696  100,
2697  78,
2698  -7,
2699  7);
2700 
2702  new TH1F("numberofBCinSC", "Number of Basic Clusters in Super Cluster EEP;Num Basic Clusters", 20, 0, 20);
2703 
2704  EEP_triggerHist_ = new TH1F("triggerHist", "Trigger Number EEP", 5, 0, 5);
2705  EEP_triggerHist_->GetXaxis()->SetBinLabel(1, "ECAL");
2706  EEP_triggerHist_->GetXaxis()->SetBinLabel(2, "HCAL");
2707  EEP_triggerHist_->GetXaxis()->SetBinLabel(3, "DT");
2708  EEP_triggerHist_->GetXaxis()->SetBinLabel(4, "RPC");
2709  EEP_triggerHist_->GetXaxis()->SetBinLabel(5, "CSC");
2710 
2711  EEP_triggerExclusiveHist_ = new TH1F("triggerExclusiveHist", "Trigger Number (Mutually Exclusive) EEP", 5, 0, 5);
2712  EEP_triggerExclusiveHist_->GetXaxis()->SetBinLabel(1, "ECAL");
2713  EEP_triggerExclusiveHist_->GetXaxis()->SetBinLabel(2, "HCAL");
2714  EEP_triggerExclusiveHist_->GetXaxis()->SetBinLabel(3, "DT");
2715  EEP_triggerExclusiveHist_->GetXaxis()->SetBinLabel(4, "RPC");
2716  EEP_triggerExclusiveHist_->GetXaxis()->SetBinLabel(5, "CSC");
2717 
2719  new TH1F("NumXtalsInClusterAllHist", "Number of Xtals in Cluster EEP;NumXtals", 150, 0, 150);
2720  EEP_numxtalsVsEnergy_ = new TH2F("NumXtalsVsEnergy",
2721  "Number of Xtals in Cluster vs Energy EEP;Energy (GeV);Number of Xtals in Cluster",
2722  numBins,
2723  histRangeMin_,
2724  10.0,
2725  150,
2726  0,
2727  150);
2729  new TH2F("NumXtalsVsHighEnergy",
2730  "Number of Xtals in Cluster vs Energy EEP;Energy (GeV);Number of Xtals in Cluster",
2731  numBins,
2732  histRangeMin_,
2733  200.,
2734  150,
2735  0,
2736  150);
2737 
2739  new TH2F("OccupancyHighEnergyEvents", "Occupancy high energy events EEP;ix;iy", 100, 0, 100, 100, 0, 100);
2740  EEP_OccupancyHighEnergyCoarse_ = new TH2F(
2741  "OccupancyHighEnergyEventsCoarse", "Occupancy high energy events Coarse EEP;ix;iy", 20, 0, 100, 20, 0, 100);
2742 
2744  new TH1F("NumActiveXtalsInClusterAllHist", "Number of active Xtals in Cluster EEP;NumXtals", 100, 0, 100);
2745 }
2746 
2748 
2749 // ------------ method called once each job just after ending the event loop ------------
2751  using namespace std;
2752  if (runInFileName_) {
2753  fileName_ += "-" + intToString(runNum_) + ".graph.root";
2754  } else {
2755  fileName_ += ".root";
2756  }
2757 
2758  TFile root_file_(fileName_.c_str(), "RECREATE");
2759 
2760  for (map<int, TH1F*>::const_iterator itr = FEDsAndHists_.begin(); itr != FEDsAndHists_.end(); ++itr) {
2761  string dir = fedMap_->getSliceFromFed(itr->first);
2762  TDirectory* FEDdir = gDirectory->mkdir(dir.c_str());
2763  FEDdir->cd();
2764 
2765  TH1F* hist = itr->second;
2766  if (hist != nullptr)
2767  hist->Write();
2768  else {
2769  cerr << "EcalCosmicsHists: Error: This shouldn't happen!" << endl;
2770  }
2771  // Write out timing hist
2772  hist = FEDsAndTimingHists_[itr->first];
2773  if (hist != nullptr)
2774  hist->Write();
2775  else {
2776  cerr << "EcalCosmicsHists: Error: This shouldn't happen!" << endl;
2777  }
2778 
2779  hist = FEDsAndFrequencyHists_[itr->first];
2780  hist->Write();
2781 
2782  hist = FEDsAndiPhiProfileHists_[itr->first];
2783  hist->Write();
2784 
2785  hist = FEDsAndiEtaProfileHists_[itr->first];
2786  hist->Write();
2787 
2788  hist = FEDsAndE2Hists_[itr->first];
2789  hist->Write();
2790 
2791  hist = FEDsAndenergyHists_[itr->first];
2792  hist->Write();
2793 
2794  hist = FEDsAndNumXtalsInClusterHists_[itr->first];
2795  hist->Write();
2796 
2797  TH2F* hist2 = FEDsAndTimingVsAmpHists_[itr->first];
2798  hist2->Write();
2799 
2800  hist2 = FEDsAndTimingVsFreqHists_[itr->first];
2801  hist2->Write();
2802 
2803  hist2 = FEDsAndE2vsE1Hists_[itr->first];
2804  hist2->Write();
2805 
2806  hist2 = FEDsAndenergyvsE1Hists_[itr->first];
2807  hist2->Write();
2808 
2809  hist2 = FEDsAndOccupancyHists_[itr->first];
2810  hist2->Write();
2811 
2812  hist2 = FEDsAndTimingVsPhiHists_[itr->first];
2813  hist2->Write();
2814 
2815  hist2 = FEDsAndTimingVsModuleHists_[itr->first];
2816  hist2->Write();
2817 
2818  //2d hist
2819  map<int, TH2F*>::const_iterator itr2d;
2820  itr2d = FEDsAndDCCRuntypeVsBxHists_.find(itr->first);
2821  if (itr2d != FEDsAndDCCRuntypeVsBxHists_.end()) {
2822  TH2F* hist2 = itr2d->second;
2823  hist2->GetYaxis()->SetBinLabel(1, "COSMIC");
2824  hist2->GetYaxis()->SetBinLabel(2, "BEAMH4");
2825  hist2->GetYaxis()->SetBinLabel(3, "BEAMH2");
2826  hist2->GetYaxis()->SetBinLabel(4, "MTCC");
2827  hist2->GetYaxis()->SetBinLabel(5, "LASER_STD");
2828  hist2->GetYaxis()->SetBinLabel(6, "LASER_POWER_SCAN");
2829  hist2->GetYaxis()->SetBinLabel(7, "LASER_DELAY_SCAN");
2830  hist2->GetYaxis()->SetBinLabel(8, "TESTPULSE_SCAN_MEM");
2831  hist2->GetYaxis()->SetBinLabel(9, "TESTPULSE_MGPA");
2832  hist2->GetYaxis()->SetBinLabel(10, "PEDESTAL_STD");
2833  hist2->GetYaxis()->SetBinLabel(11, "PEDESTAL_OFFSET_SCAN");
2834  hist2->GetYaxis()->SetBinLabel(12, "PEDESTAL_25NS_SCAN");
2835  hist2->GetYaxis()->SetBinLabel(13, "LED_STD");
2836  hist2->GetYaxis()->SetBinLabel(14, "PHYSICS_GLOBAL");
2837  hist2->GetYaxis()->SetBinLabel(15, "COSMICS_GLOBAL");
2838  hist2->GetYaxis()->SetBinLabel(16, "HALO_GLOBAL");
2839  hist2->GetYaxis()->SetBinLabel(17, "LASER_GAP");
2840  hist2->GetYaxis()->SetBinLabel(18, "TESTPULSE_GAP");
2841  hist2->GetYaxis()->SetBinLabel(19, "PEDESTAL_GAP");
2842  hist2->GetYaxis()->SetBinLabel(20, "LED_GAP");
2843  hist2->GetYaxis()->SetBinLabel(21, "PHYSICS_LOCAL");
2844  hist2->GetYaxis()->SetBinLabel(22, "COSMICS_LOCAL");
2845  hist2->GetYaxis()->SetBinLabel(23, "HALO_LOCAL");
2846  hist2->GetYaxis()->SetBinLabel(24, "CALIB_LOCAL");
2847  hist2->Write();
2848  }
2849 
2850  root_file_.cd();
2851  }
2852  allFedsHist_->Write();
2853  allFedsE2Hist_->Write();
2854  allFedsenergyHist_->Write();
2855  allFedsenergyHighHist_->Write();
2856  allFedsenergyOnlyHighHist_->Write();
2857  allFedsE2vsE1Hist_->Write();
2858  allFedsenergyvsE1Hist_->Write();
2859  allFedsTimingHist_->Write();
2860  allFedsTimingVsAmpHist_->Write();
2861  allFedsFrequencyHist_->Write();
2862  allFedsTimingVsFreqHist_->Write();
2863  allFedsiEtaProfileHist_->Write();
2864  allFedsiPhiProfileHist_->Write();
2865  allOccupancy_->Write();
2866  TrueOccupancy_->Write();
2867  allOccupancyCoarse_->Write();
2868  TrueOccupancyCoarse_->Write();
2869  allOccupancyHighEnergy_->Write();
2871  allOccupancySingleXtal_->Write();
2872  energySingleXtalHist_->Write();
2874  allFedsTimingPhiHist_->Write();
2875  allFedsTimingPhiEbpHist_->Write();
2876  allFedsTimingPhiEbmHist_->Write();
2877  allFedsTimingEbpHist_->Write();
2878  allFedsTimingEbmHist_->Write();
2879  allFedsTimingEbpTopHist_->Write();
2880  allFedsTimingEbmTopHist_->Write();
2881  allFedsTimingEbpBottomHist_->Write();
2882  allFedsTimingEbmBottomHist_->Write();
2883  allFedsTimingPhiEtaHist_->Write();
2884  allFedsTimingTTHist_->Write();
2885  allFedsTimingLMHist_->Write();
2887 
2888  numberofBCinSC_->Write(); //SC
2889  numberofBCinSCphi_->Write(); //SC
2890  TrueBCOccupancyCoarse_->Write(); //BC
2891  TrueBCOccupancy_->Write(); //BC
2892 
2893  numxtalsVsEnergy_->Write();
2894  numxtalsVsHighEnergy_->Write();
2895 
2896  allOccupancyExclusiveECAL_->Write();
2898  allOccupancyECAL_->Write();
2899  allOccupancyCoarseECAL_->Write();
2901  allFedsTimingHistECAL_->Write();
2902  allFedsTimingTTHistECAL_->Write();
2903  allFedsTimingLMHistECAL_->Write();
2904 
2905  allOccupancyExclusiveHCAL_->Write();
2907  allOccupancyHCAL_->Write();
2908  allOccupancyCoarseHCAL_->Write();
2910  allFedsTimingHistHCAL_->Write();
2911  allFedsTimingTTHistHCAL_->Write();
2912  allFedsTimingLMHistHCAL_->Write();
2913 
2914  allOccupancyExclusiveDT_->Write();
2916  allOccupancyDT_->Write();
2917  allOccupancyCoarseDT_->Write();
2918  allFedsTimingPhiEtaHistDT_->Write();
2919  allFedsTimingHistDT_->Write();
2920  allFedsTimingTTHistDT_->Write();
2921  allFedsTimingLMHistDT_->Write();
2922 
2923  allOccupancyExclusiveRPC_->Write();
2925  allOccupancyRPC_->Write();
2926  allOccupancyCoarseRPC_->Write();
2927  allFedsTimingPhiEtaHistRPC_->Write();
2928  allFedsTimingHistRPC_->Write();
2929  allFedsTimingTTHistRPC_->Write();
2930  allFedsTimingLMHistRPC_->Write();
2931 
2932  allOccupancyExclusiveCSC_->Write();
2934  allOccupancyCSC_->Write();
2935  allOccupancyCoarseCSC_->Write();
2936  allFedsTimingPhiEtaHistCSC_->Write();
2937  allFedsTimingHistCSC_->Write();
2938  allFedsTimingTTHistCSC_->Write();
2939  allFedsTimingLMHistCSC_->Write();
2940 
2941  allFedsTimingHistEcalMuon_->Write();
2942 
2943  //EE
2944  TDirectory* EEMinusDir = gDirectory->mkdir("EEMinus");
2945  EEMinusDir->cd();
2946  EEM_FedsSeedEnergyHist_->Write();
2947  EEM_AllOccupancyCoarse_->Write();
2948  EEM_AllOccupancy_->Write();
2949  EEM_FedsenergyHist_->Write();
2950  EEM_FedsenergyHighHist_->Write();
2951  EEM_FedsenergyOnlyHighHist_->Write();
2952  EEM_FedsE2Hist_->Write();
2953  EEM_FedsE2vsE1Hist_->Write();
2954  EEM_FedsenergyvsE1Hist_->Write();
2955  EEM_FedsTimingHist_->Write();
2956  EEM_numberofCosmicsHist_->Write();
2957  EEM_FedsTimingVsAmpHist_->Write();
2958  EEM_FedsTimingTTHist_->Write();
2959  EEM_OccupancySingleXtal_->Write();
2960  EEM_energySingleXtalHist_->Write();
2961  EEM_OccupancyExclusiveECAL_->Write();
2963  EEM_OccupancyECAL_->Write();
2964  EEM_OccupancyCoarseECAL_->Write();
2965  EEM_FedsTimingHistECAL_->Write();
2966  EEM_FedsTimingTTHistECAL_->Write();
2967  EEM_OccupancyExclusiveDT_->Write();
2969  EEM_OccupancyDT_->Write();
2970  EEM_OccupancyCoarseDT_->Write();
2971  EEM_FedsTimingHistDT_->Write();
2972  EEM_FedsTimingTTHistDT_->Write();
2973  EEM_OccupancyExclusiveRPC_->Write();
2975  EEM_OccupancyRPC_->Write();
2976  EEM_OccupancyCoarseRPC_->Write();
2977  EEM_FedsTimingHistRPC_->Write();
2978  EEM_FedsTimingTTHistRPC_->Write();
2979  EEM_OccupancyExclusiveCSC_->Write();
2981  EEM_OccupancyCSC_->Write();
2982  EEM_OccupancyCoarseCSC_->Write();
2983  EEM_FedsTimingHistCSC_->Write();
2984  EEM_FedsTimingTTHistCSC_->Write();
2985  EEM_OccupancyExclusiveHCAL_->Write();
2987  EEM_OccupancyHCAL_->Write();
2988  EEM_OccupancyCoarseHCAL_->Write();
2989  EEM_FedsTimingHistHCAL_->Write();
2990  EEM_FedsTimingTTHistHCAL_->Write();
2991  EEM_numberofBCinSC_->Write();
2992  EEM_triggerHist_->Write();
2993  EEM_triggerExclusiveHist_->Write();
2994  EEM_NumXtalsInClusterHist_->Write();
2995  EEM_numxtalsVsEnergy_->Write();
2996  EEM_numxtalsVsHighEnergy_->Write();
2997  EEM_OccupancyHighEnergy_->Write();
3000  root_file_.cd();
3001 
3002  TDirectory* EEPlusDir = gDirectory->mkdir("EEPlus");
3003  EEPlusDir->cd();
3004  EEP_FedsSeedEnergyHist_->Write();
3005  EEP_AllOccupancyCoarse_->Write();
3006  EEP_AllOccupancy_->Write();
3007  EEP_FedsenergyHist_->Write();
3008  EEP_FedsenergyHighHist_->Write();
3009  EEP_FedsenergyOnlyHighHist_->Write();
3010  EEP_FedsE2Hist_->Write();
3011  EEP_FedsE2vsE1Hist_->Write();
3012  EEP_FedsenergyvsE1Hist_->Write();
3013  EEP_FedsTimingHist_->Write();
3014  EEP_numberofCosmicsHist_->Write();
3015  EEP_FedsTimingVsAmpHist_->Write();
3016  EEP_FedsTimingTTHist_->Write();
3017  EEP_OccupancySingleXtal_->Write();
3018  EEP_energySingleXtalHist_->Write();
3019  EEP_OccupancyExclusiveECAL_->Write();
3021  EEP_OccupancyECAL_->Write();
3022  EEP_OccupancyCoarseECAL_->Write();
3023  EEP_FedsTimingHistECAL_->Write();
3024  EEP_FedsTimingTTHistECAL_->Write();
3025  EEP_OccupancyExclusiveDT_->Write();
3027  EEP_OccupancyDT_->Write();
3028  EEP_OccupancyCoarseDT_->Write();
3029  EEP_FedsTimingHistDT_->Write();
3030  EEP_FedsTimingTTHistDT_->Write();
3031  EEP_OccupancyExclusiveRPC_->Write();
3033  EEP_OccupancyRPC_->Write();
3034  EEP_OccupancyCoarseRPC_->Write();
3035  EEP_FedsTimingHistRPC_->Write();
3036  EEP_FedsTimingTTHistRPC_->Write();
3037  EEP_OccupancyExclusiveCSC_->Write();
3039  EEP_OccupancyCSC_->Write();
3040  EEP_OccupancyCoarseCSC_->Write();
3041  EEP_FedsTimingHistCSC_->Write();
3042  EEP_FedsTimingTTHistCSC_->Write();
3043  EEP_OccupancyExclusiveHCAL_->Write();
3045  EEP_OccupancyHCAL_->Write();
3046  EEP_OccupancyCoarseHCAL_->Write();
3047  EEP_FedsTimingHistHCAL_->Write();
3048  EEP_FedsTimingTTHistHCAL_->Write();
3049  EEP_numberofBCinSC_->Write();
3050  EEP_triggerHist_->Write();
3051  EEP_triggerExclusiveHist_->Write();
3052  EEP_NumXtalsInClusterHist_->Write();
3053  EEP_numxtalsVsEnergy_->Write();
3054  EEP_numxtalsVsHighEnergy_->Write();
3055  EEP_OccupancyHighEnergy_->Write();
3058  root_file_.cd();
3059 
3060  triggerHist_->Write();
3061  triggerExclusiveHist_->Write();
3062 
3063  NumXtalsInClusterHist_->Write();
3064 
3065  numberofCosmicsHist_->Write();
3066  numberofCosmicsHistEB_->Write();
3067 
3068  numberofCosmicsWTrackHist_->Write();
3070  numberofGoodEvtFreq_->Write();
3071  numberofCrossedEcalIdsHist_->Write();
3072 
3073  runNumberHist_->SetBinContent(1, runNum_);
3074  runNumberHist_->Write();
3075 
3076  deltaRHist_->Write();
3077  deltaEtaHist_->Write();
3078  deltaPhiHist_->Write();
3079  ratioAssocClustersHist_->Write();
3080  ratioAssocTracksHist_->Write();
3081  deltaEtaDeltaPhiHist_->Write();
3082  seedTrackPhiHist_->Write();
3083  seedTrackEtaHist_->Write();
3084  dccEventVsBxHist_->Write();
3085  dccOrbitErrorByFEDHist_->Write();
3086  dccBXErrorByFEDHist_->Write();
3087  dccRuntypeErrorByFEDHist_->Write();
3088  dccErrorVsBxHist_->Write();
3089  dccRuntypeHist_->Write();
3090 
3091  trackAssoc_muonsEcal_->Write();
3092 
3093  hcalEnergy_HBHE_->Write();
3094  hcalEnergy_HF_->Write();
3095  hcalEnergy_HO_->Write();
3096  hcalHEHBecalEB_->Write();
3097 
3098  TDirectory* highEnergyDir = gDirectory->mkdir("HighEnergy");
3099  highEnergyDir->cd();
3100  HighEnergy_NumXtal->Write();
3101  HighEnergy_NumXtalFedId->Write();
3102  HighEnergy_NumXtaliphi->Write();
3103  HighEnergy_energy3D->Write();
3104  HighEnergy_energyNumXtal->Write();
3105  HighEnergy_bestSeed->Write();
3107  HighEnergy_numClusHighEn->Write();
3108  HighEnergy_ratioClusters->Write();
3110  HighEnergy_TracksAngle->Write();
3112  HighEnergy_2GeV_occuCoarse->Write();
3113  HighEnergy_2GeV_occu3D->Write();
3115  HighEnergy_100GeV_occu3D->Write();
3116  HighEnergy_0tracks_occu3D->Write();
3117  HighEnergy_1tracks_occu3D->Write();
3118  HighEnergy_2tracks_occu3D->Write();
3122 
3123  root_file_.cd();
3124 
3125  TDirectory* TimeStampdir = gDirectory->mkdir("EventTiming");
3126  TimeStampdir->cd();
3127  allFedsFreqTimeHist_->Write();
3128  allFedsFreqTimeVsPhiHist_->Write();
3129  allFedsFreqTimeVsPhiTTHist_->Write();
3130  allFedsFreqTimeVsEtaHist_->Write();
3131  allFedsFreqTimeVsEtaTTHist_->Write();
3132 
3133  root_file_.cd();
3134 
3135  root_file_.Close();
3136 
3137  LogWarning("EcalCosmicsHists") << "---> Number of cosmic events: " << cosmicCounter_ << " in " << naiveEvtNum_
3138  << " events.";
3139  LogWarning("EcalCosmicsHists") << "---> Number of EB cosmic events: " << cosmicCounterEB_ << " in " << naiveEvtNum_
3140  << " events.";
3141  LogWarning("EcalCosmicsHists") << "---> Number of EE- cosmic events: " << cosmicCounterEEM_ << " in " << naiveEvtNum_
3142  << " events.";
3143  LogWarning("EcalCosmicsHists") << "---> Number of EE+ cosmic events: " << cosmicCounterEEP_ << " in " << naiveEvtNum_
3144  << " events.";
3145 
3146  // LogWarning("EcalCosmicsHists") << "---> Number of top+bottom cosmic events: " << cosmicCounterTopBottom_ << " in " << cosmicCounter_ << " cosmics in " << naiveEvtNum_ << " events.";
3147 }
3148 
3150  using namespace std;
3151  ostringstream myStream;
3152  myStream << num << flush;
3153  return (myStream.str()); //returns the string form of the stringstream object
3154 }
TH3F * EEM_FedsTimingTTHistECAL_
TH2F * allFedsTimingLMHistECAL_
TH2F * allOccupancyExclusiveECAL_
TH3F * allFedsTimingTTHistRPC_
Log< level::Info, true > LogVerbatim
TH3F * HighEnergy_0tracks_occu3D
TH2F * allOccupancyCoarseExclusiveCSC_
TH2F * EEM_OccupancySingleXtal_
const edm::ESGetToken< L1GtTriggerMenu, L1GtTriggerMenuRcd > l1MenuToken_
std::string intToString(int num)
std::map< int, TH1F * > FEDsAndNumXtalsInClusterHists_
TH3F * allFedsTimingTTHistCSC_
std::map< int, TH2F * > FEDsAndTimingVsAmpHists_
float time() const
Definition: EcalRecHit.h:70
ESGetTokenH3DDVariant esConsumes(std::string const &Record, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
const double minHighEnergy_
TH2F * EEP_FedsenergyvsE1Hist_
TH2F * allOccupancyExclusiveHCAL_
TH2F * HighEnergy_bestSeedOccupancy
const edm::EDGetTokenT< EcalRecHitCollection > ebRecHitToken_
static const TGPicture * info(bool iBackgroundIsBlack)
TH2F * allOccupancyCoarseExclusiveECAL_
TH3F * allFedsTimingPhiEtaHistCSC_
const double minRecHitAmpEB_
std::map< int, TH2F * > FEDsAndE2vsE1Hists_
TH1F * EEM_FedsenergyHighHist_
TH2F * EEM_numxtalsVsHighEnergy_
TH1F * allFedsiPhiProfileHist_
TH1F * EEM_numberofCosmicsHist_
TH3F * EEM_FedsTimingTTHistCSC_
TH1F * EEP_FedsenergyHighHist_
TH2F * allOccupancyExclusiveRPC_
TH1F * allFedsiEtaProfileHist_
EcalFedMap * fedMap_
TH3F * allFedsTimingPhiEtaHistECAL_
const cms_uint16_t aData(int iA) const
get/set A_DATA_CH_IA
Definition: L1GtPsbWord.cc:181
TH2F * allOccupancyCoarseExclusiveHCAL_
EcalCosmicsHists(const edm::ParameterSet &)
TH2F * EEP_OccupancyExclusiveHCAL_
TH1F * EEP_energySingleXtalHist_
TH1F * allFedsTimingEbpTopHist_
TH2F * EEM_OccupancyExclusiveDT_
void endJob() override
const double minTimingAmpEB_
std::map< int, TH2F * > FEDsAndTimingVsPhiHists_
TH2F * allFedsTimingLMHistHCAL_
Ecal readout channel identification [32:20] Unused (so far) [19:13] DCC id [12:6] tower [5:3] strip [...
int iphi() const
get the crystal iphi
Definition: EBDetId.h:51
const edm::ESGetToken< EcalElectronicsMapping, EcalMappingRcd > ecalMappingToken_
TH2F * allFedsTimingVsFreqHist_
TH1F * EEM_energySingleXtalHist_
TH2F * EEP_numxtalsVsHighEnergy_
TH2F * EEM_FedsTimingVsAmpHist_
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
TH1F * EEP_FedsSeedEnergyHist_
T const * product() const
Definition: Handle.h:70
void useDefaultPropagator()
use the default propagator
int dccId() const
get the DCC (Ecal Local DCC value not global one) id
int ix() const
Definition: EEDetId.h:77
TH1F * allFedsTimingEbpBottomHist_
std::vector< Track > TrackCollection
collection of Tracks
Definition: TrackFwd.h:14
std::map< int, TH1F * > FEDsAndE2Hists_
std::vector< T >::const_iterator const_iterator
TH3F * allFedsTimingPhiEtaHistDT_
TH2F * EEP_OccupancyCoarseECAL_
void loadParameters(const edm::ParameterSet &, edm::ConsumesCollector &)
const int numTimingBins_
TH1F * numberofCosmicsWTrackHist_
const DecisionWord & decisionWord(int bxInEventValue) const
const double minTimingAmpEE_
TH3F * EEP_FedsTimingTTHistRPC_
const edm::EDGetTokenT< HBHERecHitCollection > hbheRecHitToken_
TH2F * allFedsFreqTimeVsPhiHist_
TH2F * HighEnergy_2GeV_occuCoarse
TH1F * dccRuntypeErrorByFEDHist_
std::map< int, TH2F * > FEDsAndTimingVsModuleHists_
TH3F * allFedsTimingPhiEtaHistRPC_
TH3F * HighEnergy_1tracks_occu3DXtal
Log< level::Error, false > LogError
void analyze(edm::Event const &, edm::EventSetup const &) override
TH3F * allFedsTimingPhiEtaHistHCAL_
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
TH3F * EEM_FedsTimingTTHistDT_
const edm::EDGetTokenT< HFRecHitCollection > hfRecHitToken_
~EcalCosmicsHists() override
TH2F * EEM_OccupancyExclusiveECAL_
const bool runInFileName_
TH2F * EEM_OccupancyCoarseHCAL_
TH3F * EEM_FedsTimingTTHistRPC_
TH3F * HighEnergy_2tracks_occu3D
TH2F * HighEnergy_100GeV_occuCoarse
TH2F * allOccupancyCoarseExclusiveDT_
const edm::EDGetTokenT< reco::TrackCollection > tracksBarrelToken_
TH2F * EEP_OccupancyExclusiveCSC_
const cms_uint16_t bData(int iB) const
get/set B_DATA_CH_IB
Definition: L1GtPsbWord.cc:253
TH2F * allOccupancyHighEnergy_
edm::InputTag endcapClusterCollection_
TH2F * EEP_OccupancyExclusiveDT_
std::map< int, TH2F * > FEDsAndDCCRuntypeVsBxHists_
std::string getSliceFromFed(int)
Definition: EcalFedMap.cc:86
const edm::EDGetTokenT< HORecHitCollection > hoRecHitToken_
int ieta() const
get the crystal ieta
Definition: EBDetId.h:49
TH2F * EEM_OccupancyCoarseExclusiveCSC_
const edm::EDGetTokenT< L1MuGMTReadoutCollection > l1MuGMTToken_
TH2F * HighEnergy_NumXtalFedId
TH3F * allFedsTimingTTHistECAL_
TH1F * allFedsTimingEbmTopHist_
void endRun(edm::Run const &, edm::EventSetup const &) override
std::vector< bool > determineTriggers(const edm::Event &, const edm::EventSetup &eventSetup)
TH2F * allFedsFreqTimeVsEtaTTHist_
int iEvent
Definition: GenABIO.cc:224
TH2F * EEM_OccupancyExclusiveRPC_
TH2F * EEM_OccupancyHighEnergy_
TH1F * EEP_FedsTimingHistHCAL_
TH2F * allFedsTimingPhiEbmHist_
TH2F * EEM_OccupancyCoarseECAL_
std::map< int, TH1F * > FEDsAndiPhiProfileHists_
TH2F * EEM_OccupancyCoarseExclusiveRPC_
std::map< int, TH1F * > FEDsAndFrequencyHists_
const edm::ESGetToken< EcalADCToGeVConstant, EcalADCToGeVConstantRcd > ecalADCToGeVConstantToken_
const edm::EDGetTokenT< EcalRawDataCollection > ecalRawDataToken_
std::vector< SuperCluster > SuperClusterCollection
collection of SuperCluser objectr
TH1F * EEP_numberofCosmicsHist_
TH2F * EEP_OccupancyHighEnergyCoarse_
std::vector< bool > DecisionWord
typedefs
void swap(edm::DataFrameContainer &lhs, edm::DataFrameContainer &rhs)
TH1F * EEP_FedsNumXtalsInClusterHist_
TH3F * EEP_FedsTimingTTHistHCAL_
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
T sqrt(T t)
Definition: SSEVec.h:19
TH3F * HighEnergy_1tracks_occu3D
TH1F * allFedsenergyOnlyHighHist_
std::map< int, TH1F * > FEDsAndenergyHists_
TH1F * EEP_triggerExclusiveHist_
TH2F * EEP_OccupancyCoarseExclusiveECAL_
TH1F * EEM_FedsSeedEnergyHist_
TH3F * HighEnergy_100GeV_occu3D
std::map< int, TH2F * > FEDsAndenergyvsE1Hists_
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
TH3F * EEP_FedsTimingTTHistECAL_
TH2F * HighEnergy_energyNumXtal
TH3F * allFedsTimingTTHistHCAL_
TH1F * HighEnergy_ratioClusters
TH2F * EEM_OccupancyExclusiveCSC_
TH2F * EEP_OccupancyCoarseExclusiveHCAL_
std::string fileName_
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
TH2F * EEM_OccupancyCoarseRPC_
TH2F * EEP_AllOccupancyCoarse_
Transition
Definition: Transition.h:12
TH2F * EEP_OccupancyCoarseCSC_
const EcalElectronicsMapping * ecalElectronicsMap_
TrackDetectorAssociator trackAssociator_
TH1F * numberofCosmicsTopBottomHist_
TH2F * EEP_OccupancySingleXtal_
TH2F * EEM_OccupancyCoarseExclusiveECAL_
bool getData(T &iHolder) const
Definition: EventSetup.h:122
const_iterator begin() const
TH1F * allFedsTimingHistEcalMuon_
TH2F * EEP_OccupancyExclusiveECAL_
TrackAssociatorParameters trackParameters_
TH1F * EEM_triggerExclusiveHist_
TH1F * EEM_FedsTimingHistHCAL_
TH1F * HighEnergy_TracksAngleTopBottom
std::map< int, TH2F * > FEDsAndOccupancyHists_
TH1F * EEP_FedsTimingHistECAL_
TH2F * allFedsTimingPhiEbpHist_
TH2F * allOccupancyExclusiveDT_
TH2F * EEM_OccupancyCoarseExclusiveHCAL_
TH2F * allOccupancySingleXtal_
TH2F * EEP_OccupancyCoarseExclusiveCSC_
TH2F * allFedsTimingVsAmpHist_
Namespace of DDCMS conversion namespace.
TH3F * allFedsTimingPhiEtaHist_
const_iterator end() const
__shared__ Hist hist
TH1F * ratioAssocClustersHist_
TH2F * EEM_FedsenergyvsE1Hist_
Log< level::Info, false > LogInfo
TH2F * EEM_OccupancyCoarseCSC_
TH2F * allOccupancyExclusiveCSC_
TH1F * HighEnergy_numClusHighEn
std::vector< L1MuGMTReadoutRecord > const & getRecords() const
auto const & tracks
cannot be loose
TH2F * allFedsFreqTimeVsEtaHist_
int zside() const
Definition: EEDetId.h:71
TH2F * EEP_OccupancyExclusiveRPC_
const L1GtPsbWord gtPsbWord(cms_uint16_t boardIdValue, int bxInEventValue) const
get / set PSB word (record) in the GT readout record
static bool validDetId(int crystal_ix, int crystal_iy, int iz)
Definition: EEDetId.h:248
int getLMNumber(const DetId &id) const
const edm::EDGetTokenT< EcalRecHitCollection > eeRecHitToken_
void beginRun(edm::Run const &, edm::EventSetup const &) override
const double startTime_
TH1F * EEM_FedsTimingHistECAL_
const double minRecHitAmpEE_
TH2F * allFedsTimingLMHistRPC_
bool isValid() const
Definition: HandleBase.h:70
const double histRangeMin_
const edm::EDGetTokenT< reco::TrackCollection > tracksToken_
const double runTimeLength_
iterator find(key_type k)
TH1F * dccOrbitErrorByFEDHist_
TH1F * numberofCrossedEcalIdsHist_
fixed size matrix
HLT enums.
EcalElectronicsId getElectronicsId(const DetId &id) const
Get the electronics id for this det id.
TH2F * allFedsTimingLMHistCSC_
TH3F * EEM_FedsTimingTTHistHCAL_
TH2F * allOccupancyCoarseECAL_
TH2F * EEP_OccupancyCoarseHCAL_
TH1F * EEM_FedsenergyOnlyHighHist_
TH1F * EEP_NumXtalsInClusterHist_
TH1F * allFedsNumXtalsInClusterHist_
const edm::EDGetTokenT< reco::SuperClusterCollection > barrelClusterToken_
const edm::EDGetTokenT< L1GlobalTriggerReadoutRecord > l1GTReadoutToken_
TH2F * EEM_OccupancyExclusiveHCAL_
TH2F * allOccupancyCoarseExclusiveRPC_
TH2F * EEP_OccupancyCoarseExclusiveRPC_
std::map< int, TH1F * > FEDsAndiEtaProfileHists_
TH2F * EEM_OccupancyCoarseExclusiveDT_
TrackDetMatchInfo associate(const edm::Event &, const edm::EventSetup &, const FreeTrajectoryState &, const AssociatorParameters &)
std::map< int, TH1F * > FEDsAndTimingHists_
TH2F * EEP_OccupancyCoarseRPC_
TH3F * HighEnergy_2tracks_occu3DXtal
TH1F * EEM_NumXtalsInClusterHist_
TH2F * allOccupancyHighEnergyCoarse_
TH2F * EEP_OccupancyHighEnergy_
TH3F * allFedsOccupancyHighEnergyHist_
int iphiSM() const
get the crystal iphi (1-20)
Definition: EBDetId.h:73
TH2F * EEM_AllOccupancyCoarse_
TH3F * EEP_FedsTimingTTHistCSC_
TH3F * EEP_FedsTimingTTHistDT_
TH2F * EEP_FedsTimingVsAmpHist_
Log< level::Warning, false > LogWarning
float energy() const
Definition: EcalRecHit.h:68
const edm::EDGetTokenT< L1GlobalTriggerReadoutRecord > gtRecordToken_
TH1F * EEM_FedsNumXtalsInClusterHist_
TH2F * allFedsFreqTimeVsPhiTTHist_
edm::InputTag barrelClusterCollection_
int ietaSM() const
get the crystal ieta in the SM convention (1-85)
Definition: EBDetId.h:71
TH2F * EEM_OccupancyHighEnergyCoarse_
TH1F * allFedsTimingEbmBottomHist_
TH1F * EEP_FedsenergyOnlyHighHist_
std::map< int, TH1F * > FEDsAndHists_
const edm::EDGetTokenT< reco::SuperClusterCollection > endcapClusterToken_
const double histRangeMax_
std::map< int, TH2F * > FEDsAndTimingVsFreqHists_
Definition: Run.h:45
edm::InputTag ecalRecHitCollectionEB_
int iy() const
Definition: EEDetId.h:83
TH1F * HighEnergy_numRecoTrackBarrel
TH2F * EEP_OccupancyCoarseExclusiveDT_
TH3F * HighEnergy_0tracks_occu3DXtal
#define LogDebug(id)
TH2F * allOccupancyCoarseHCAL_
T angle(T x1, T y1, T z1, T x2, T y2, T z2)
Definition: angle.h:11
edm::InputTag ecalRecHitCollectionEE_