CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
EcalCosmicsHists.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: EcalCosmicsHists
4 // Class: EcalCosmicsHists
5 //
21 
27 
30 
38 
39 
40 #include <vector>
41 #include "TLine.h"
42 
43 
44 using namespace cms;
45 using namespace edm;
46 using namespace std;
47 
48 //
49 // constants, enums and typedefs
50 //
51 
52 //
53 // static data member definitions
54 //
55 
56 //
57 // constructors and destructor
58 //
60  ecalRawDataColl_(iConfig.getParameter<edm::InputTag>("ecalRawDataColl")),
61  ecalRecHitCollectionEB_ (iConfig.getParameter<edm::InputTag>("ecalRecHitCollectionEB")),
62  ecalRecHitCollectionEE_ (iConfig.getParameter<edm::InputTag>("ecalRecHitCollectionEE")),
63  barrelClusterCollection_ (iConfig.getParameter<edm::InputTag>("barrelClusterCollection")),
64  endcapClusterCollection_ (iConfig.getParameter<edm::InputTag>("endcapClusterCollection")),
65  l1GTReadoutRecTag_ (iConfig.getUntrackedParameter<std::string>("L1GlobalReadoutRecord","gtDigis")),
66  l1GMTReadoutRecTag_ (iConfig.getUntrackedParameter<std::string>("L1GlobalMuonReadoutRecord","gtDigis")),
67  runNum_(-1),
68  histRangeMax_ (iConfig.getUntrackedParameter<double>("histogramMaxRange",1.8)),
69  histRangeMin_ (iConfig.getUntrackedParameter<double>("histogramMinRange",0.0)),
70  minTimingAmpEB_ (iConfig.getUntrackedParameter<double>("MinTimingAmpEB",0.100)),
71  minTimingAmpEE_ (iConfig.getUntrackedParameter<double>("MinTimingAmpEE",0.100)),
72  minRecHitAmpEB_(iConfig.getUntrackedParameter<double>("MinRecHitAmpEB",0.027)),
73  minRecHitAmpEE_(iConfig.getUntrackedParameter<double>("MinRecHitAmpEE",0.18)),
74  minHighEnergy_(iConfig.getUntrackedParameter<double>("MinHighEnergy",2.0)),
75  fileName_ (iConfig.getUntrackedParameter<std::string>("fileName", std::string("ecalCosmicHists"))),
76  runInFileName_(iConfig.getUntrackedParameter<bool>("runInFileName",true)),
77  startTime_ (iConfig.getUntrackedParameter<double>("TimeStampStart",1215107133.)),
78  runTimeLength_ (iConfig.getUntrackedParameter<double>("TimeStampLength",3.)),
79  numTimingBins_(iConfig.getUntrackedParameter<int>("TimeStampBins",1800))
80 {
81  naiveEvtNum_ = 0;
82  cosmicCounter_ = 0;
83  cosmicCounterEB_ = 0;
87 
88  // TrackAssociator parameters
89  edm::ParameterSet trkParameters = iConfig.getParameter<edm::ParameterSet>("TrackAssociatorParameters");
90  trackParameters_.loadParameters( trkParameters );
92 
93  string title1 = "Seed Energy for All Feds; Seed Energy (GeV)";
94  string name1 = "SeedEnergyAllFEDs";
95  int numBins = 200;//(int)round(histRangeMax_-histRangeMin_)+1;
96  allFedsHist_ = new TH1F(name1.c_str(),title1.c_str(),numBins,histRangeMin_,histRangeMax_);
97 
98  fedMap_ = new EcalFedMap();
99 }
100 
101 
103 {
104 }
105 
106 
107 //
108 // member functions
109 //
110 
111 // ------------ method called to for each event ------------
112 void
114 {
115  bool hasEndcapClusters = true;
116  int ievt = iEvent.id().event();
117 
120 
121  naiveEvtNum_++;
122 
123  //LogDebug("EcalCosmicsHists")<< " My Event: " << naiveEvtNum_ << " " << iEvent.id().run() << " " << iEvent.id().event() << " " << iEvent.time().value();
124  //LogDebug("EcalCosmicsHists")<< "Timestamp: " << iEvent.id().run() << " " << iEvent.id().event() << " " << iEvent.time().value();
125 
126 
127  // check DB payload
129  iSetup.get<EcalADCToGeVConstantRcd>().get(pAgc);
130  const EcalADCToGeVConstant* agc = pAgc.product();
131  if (naiveEvtNum_<=1) {
132  LogWarning("EcalCosmicsHists") << "Global EB ADC->GeV scale: " << agc->getEBValue() << " GeV/ADC count" ;
133  LogWarning("EcalCosmicsHists") << "Global EE ADC->GeV scale: " << agc->getEEValue() << " GeV/ADC count" ;
134  }
135  //float adcEBconst = agc->getEBValue();
136  //float adcEEconst = agc->getEEValue();
137 
138 
139  //
140 
141  //===================TIMESTAMP INFORMTION=================================
142  // Code added to get the time in seconds
143  unsigned int timeStampLow = ( 0xFFFFFFFF & iEvent.time().value() );
144  unsigned int timeStampHigh = ( iEvent.time().value() >> 32 );
145  double rawEventTime = ( double)(timeStampHigh)+((double )(timeStampLow)/1000000.);
146  double eventTime = rawEventTime - startTime_; //Notice the subtraction of the "starttime"
147  //std::cout << "Event Time " << eventTime << " High " <<timeStampHigh<< " low"<<timeStampLow <<" value " <<iEvent.time().value() << std::endl;
148  //========================================================================
149 
150  iEvent.getByLabel(barrelClusterCollection_, bscHandle);
151  if (!(bscHandle.isValid()))
152  {
153  LogWarning("EcalCosmicsHists") << barrelClusterCollection_ << " not available";
154  return;
155  }
156  LogDebug("EcalCosmicsHists") << "event " << ievt;
157 
158  iEvent.getByLabel(endcapClusterCollection_, escHandle);
159  if (!(escHandle.isValid()))
160  {
161  LogWarning("EcalCosmicsHists") << endcapClusterCollection_ << " not available";
162  hasEndcapClusters = false;
163  //return;
164  }
165 
167  iEvent.getByLabel(ecalRecHitCollectionEB_, hits);
168  if (!(hits.isValid()))
169  {
170  LogWarning("EcalCosmicsHists") << ecalRecHitCollectionEB_ << " not available";
171  return;
172  }
174  iEvent.getByLabel(ecalRecHitCollectionEE_, hitsEE);
175  if (!(hitsEE.isValid()))
176  {
177  LogWarning("EcalCosmicsHists") << ecalRecHitCollectionEE_ << " not available";
178  return;
179  }
180 
182  iEvent.getByLabel(ecalRawDataColl_, DCCHeaders);
183  if(!DCCHeaders.isValid())
184  LogWarning("EcalCosmicsHists") << "DCC headers not available";
185 
186  //make the bx histos right here
187  //TODO: Right now we are filling histos for errors...
188  int orbit = -100;
189  int bx = -100;
190  int runType = -100;
191 
192  for(EcalRawDataCollection::const_iterator headerItr= DCCHeaders->begin();headerItr != DCCHeaders->end();
193  ++headerItr) {
194  headerItr->getEventSettings();
195  int myorbit = headerItr->getOrbit();
196  int mybx = headerItr->getBX();
197  int myRunType = headerItr->getRunType();
198  int FEDid = headerItr->fedId();
199  TH2F* dccRuntypeHist = FEDsAndDCCRuntypeVsBxHists_[FEDid];
200  if(dccRuntypeHist==0)
201  {
202  initHists(FEDid);
203  dccRuntypeHist = FEDsAndDCCRuntypeVsBxHists_[FEDid];
204  }
205  dccRuntypeHist->Fill(mybx,myRunType);
206 
207  if (bx == -100)
208  {
209  bx = mybx;
210  }
211  else if (bx != mybx)
212  {
213  LogWarning("EcalCosmicsHists") << "This header has a conflicting bx OTHERS were " << bx << " here " << mybx;
214  dccBXErrorByFEDHist_->Fill(headerItr->fedId());
215  if(bx != -100)
216  {
217  dccErrorVsBxHist_->Fill(bx,0);
218  }
219  }
220 
221  if (runType == -100)
222  {
223  runType = myRunType;
224  }
225  else if (runType != myRunType)
226  {
227  LogWarning("EcalCosmicsHists") << "This header has a conflicting runType OTHERS were " << bx << " here " << mybx;
228  dccRuntypeErrorByFEDHist_->Fill(headerItr->fedId());
229  if(bx != -100)
230  dccErrorVsBxHist_->Fill(bx,2);
231  }
232 
233 
234  if (orbit == -100)
235  {
236  orbit = myorbit;
237  }
238  else if (orbit != myorbit)
239  {
240  LogWarning("EcalCosmicsHists") << "This header has a conflicting orbit; OTHERS were " << orbit << " here " << myorbit;
241  dccOrbitErrorByFEDHist_->Fill(headerItr->fedId());
242  if(bx != -100)
243  dccErrorVsBxHist_->Fill(bx,1);
244  }
245  }
246  dccEventVsBxHist_->Fill(bx,runType);
247  dccRuntypeHist_->Fill(runType);
248 
249 
250 
251  std::vector<bool> l1Triggers = determineTriggers(iEvent, iSetup);
252  bool isEcalL1 = l1Triggers[4];
253  bool isHCALL1 = l1Triggers[3];
254  bool isRPCL1 = l1Triggers[2];
255  bool isCSCL1 = l1Triggers[1];
256  bool isDTL1 = l1Triggers[0];
257 
258  if(runNum_==-1)
259  {
260  runNum_ = iEvent.id().run();
261  }
262 
263  int numberOfCosmics = 0;
264  int numberOfCosmicsEB = 0;
265  int numberOfCosmicsEEP = 0;
266  int numberOfCosmicsEEM = 0;
267  int numberOfCosmicsTop = 0;
268  int numberOfCosmicsBottom = 0;
269  int numberOfHighEClusters = 0;
270  //int eventnum = iEvent.id().event();
271  std::vector<EBDetId> seeds;
272 
273  //++++++++++++++++++BEGIN LOOP OVER EB SUPERCLUSTERS+++++++++++++++++++++++++//
274 
275  const reco::SuperClusterCollection *clusterCollection_p = bscHandle.product();
276  for (reco::SuperClusterCollection::const_iterator clus = clusterCollection_p->begin(); clus != clusterCollection_p->end(); ++clus)
277  {
278  double energy = clus->energy();
279  double phi = clus->phi();
280  double eta = clus->eta();
281  double time = -1000.0;
282  double ampli = 0.;
283  double secondMin = 0.;
284  double secondTime = -1000.;
285  int numXtalsinCluster = 0;
286 
287  EBDetId maxDet;
288  EBDetId secDet;
289 
290  numberofBCinSC_->Fill(clus->clustersSize());
291  numberofBCinSCphi_->Fill(phi,clus->clustersSize());
292 
293  for (reco::CaloCluster_iterator bclus = (clus->clustersBegin()); bclus != (clus->clustersEnd()); ++bclus)
294  {
295  double cphi = (*bclus)->phi();
296  double ceta = (*bclus)->eta();
297  TrueBCOccupancy_->Fill(cphi,ceta);
298  TrueBCOccupancyCoarse_->Fill(cphi,ceta);
299  }
300 
301  std::vector< std::pair<DetId, float> > clusterDetIds = clus->hitsAndFractions();//get these from the cluster
302  for(std::vector<std::pair<DetId, float> >::const_iterator detitr = clusterDetIds.begin(); detitr != clusterDetIds.end(); ++detitr)
303  {
304  //Here I use the "find" on a digi collection... I have been warned...
305  if ((*detitr).first.det() != DetId::Ecal) { std::cout << " det is " <<(*detitr).first.det() << std::endl;continue;}
306  if ((*detitr).first.subdetId() != EcalBarrel) {std::cout << " subdet is " <<(*detitr).first.subdetId() << std::endl; continue; }
307  EcalRecHitCollection::const_iterator thishit = hits->find((*detitr).first);
308  if (thishit == hits->end()) continue;
309  //The checking above should no longer be needed...... as only those in the cluster would already have rechits..
310 
311  EcalRecHit myhit = (*thishit);
312 
313  double thisamp = myhit.energy();
314  if (thisamp > minRecHitAmpEB_) {numXtalsinCluster++; }
315  if (thisamp > secondMin) {secondMin = thisamp; secondTime = myhit.time(); secDet = (EBDetId)(*detitr).first;}
316  if (secondMin > ampli) {std::swap(ampli,secondMin); std::swap(time,secondTime); std::swap(maxDet,secDet);}
317  }
318 
319  double fullnumXtalsinCluster = clusterDetIds.size();
320 
321  float E2 = ampli + secondMin;
323  int FEDid = 600+elecId.dccId();
324 
325  numberOfCosmics++;
326  numberOfCosmicsEB++;
327 
328  //Set some more values
329  seeds.push_back(maxDet);
330  int ieta = maxDet.ieta();
331  int iphi = maxDet.iphi();
332  int ietaSM = maxDet.ietaSM();
333  int iphiSM = maxDet.iphiSM();
334 
335  int LM = ecalElectronicsMap_->getLMNumber(maxDet) ;//FIX ME
336 
337  // top and bottom clusters
338  if (iphi>0&&iphi<180) {
339  numberOfCosmicsTop++;
340  } else {
341  numberOfCosmicsBottom++;
342  }
343 
344  // fill the proper hist
345  TH1F* uRecHist = FEDsAndHists_[FEDid];
346  TH1F* E2uRecHist = FEDsAndE2Hists_[FEDid];
347  TH1F* energyuRecHist = FEDsAndenergyHists_[FEDid];
348  TH1F* timingHist = FEDsAndTimingHists_[FEDid];
349  TH1F* freqHist = FEDsAndFrequencyHists_[FEDid];
350  TH1F* iphiProfileHist = FEDsAndiPhiProfileHists_[FEDid];
351  TH1F* ietaProfileHist = FEDsAndiEtaProfileHists_[FEDid];
352  TH2F* timingHistVsFreq = FEDsAndTimingVsFreqHists_[FEDid];
353  TH2F* timingHistVsAmp = FEDsAndTimingVsAmpHists_[FEDid];
354  TH2F* E2vsE1uRecHist = FEDsAndE2vsE1Hists_[FEDid];
355  TH2F* energyvsE1uRecHist = FEDsAndenergyvsE1Hists_[FEDid];
356  TH2F* occupHist = FEDsAndOccupancyHists_[FEDid];
357  TH2F* timingHistVsPhi = FEDsAndTimingVsPhiHists_[FEDid];
358  TH2F* timingHistVsModule = FEDsAndTimingVsModuleHists_[FEDid];
359 
360  if(uRecHist==0)
361  {
362  initHists(FEDid);
363  uRecHist = FEDsAndHists_[FEDid];
364  E2uRecHist = FEDsAndE2Hists_[FEDid];
365  energyuRecHist = FEDsAndenergyHists_[FEDid];
366  timingHist = FEDsAndTimingHists_[FEDid];
367  freqHist = FEDsAndFrequencyHists_[FEDid];
368  timingHistVsFreq = FEDsAndTimingVsFreqHists_[FEDid];
369  timingHistVsAmp = FEDsAndTimingVsAmpHists_[FEDid];
370  iphiProfileHist = FEDsAndiPhiProfileHists_[FEDid];
371  ietaProfileHist = FEDsAndiEtaProfileHists_[FEDid];
372  E2vsE1uRecHist = FEDsAndE2vsE1Hists_[FEDid];
373  energyvsE1uRecHist = FEDsAndenergyvsE1Hists_[FEDid];
374  occupHist = FEDsAndOccupancyHists_[FEDid];
375  timingHistVsPhi = FEDsAndTimingVsPhiHists_[FEDid];
376  timingHistVsModule = FEDsAndTimingVsModuleHists_[FEDid];
377  }
378 
379  uRecHist->Fill(ampli);
380  E2uRecHist->Fill(E2);
381  E2vsE1uRecHist->Fill(ampli,E2);
382  energyuRecHist->Fill(energy);
383  energyvsE1uRecHist->Fill(ampli,energy);
384  allFedsHist_->Fill(ampli);
385  allFedsE2Hist_->Fill(E2);
386  allFedsenergyHist_->Fill(energy);
387  allFedsenergyHighHist_->Fill(energy);
388  allFedsE2vsE1Hist_->Fill(ampli,E2);
389  allFedsenergyvsE1Hist_->Fill(ampli,energy);
390  freqHist->Fill(naiveEvtNum_);
391  iphiProfileHist->Fill(iphi);
392  ietaProfileHist->Fill(ieta);
393 
395  allFedsiPhiProfileHist_->Fill(iphi);
396  allFedsiEtaProfileHist_->Fill(ieta);
397  allOccupancy_->Fill(iphi, ieta);
398  TrueOccupancy_->Fill(phi, eta);
399  allOccupancyCoarse_->Fill(iphi, ieta);
400  TrueOccupancyCoarse_->Fill(phi, eta);
401  allFedsNumXtalsInClusterHist_->Fill(numXtalsinCluster);
402  NumXtalsInClusterHist_->Fill(fullnumXtalsinCluster);
403  numxtalsVsEnergy_->Fill(energy,numXtalsinCluster);
404  numxtalsVsHighEnergy_->Fill(energy,numXtalsinCluster);
405 
406  //Fill the hists for the time stamp information
407  allFedsFreqTimeVsPhiHist_->Fill(iphi,eventTime);
408  allFedsFreqTimeVsPhiTTHist_->Fill(iphi,eventTime);
409  allFedsFreqTimeVsEtaHist_->Fill(eventTime,ieta);
410  allFedsFreqTimeVsEtaTTHist_->Fill(eventTime,ieta);
411  //end time stamp hists
412 
413  occupHist->Fill(ietaSM,iphiSM);
414  if (fullnumXtalsinCluster==1) {
415  allOccupancySingleXtal_->Fill(iphi, ieta);
416  energySingleXtalHist_->Fill(energy);
417  }
418 
419  // Exclusive trigger plots
420 
421  if(isEcalL1&&!isDTL1&&!isRPCL1&&!isCSCL1&&!isHCALL1) {
422  allOccupancyExclusiveECAL_->Fill(iphi, ieta);
423  allOccupancyCoarseExclusiveECAL_->Fill(iphi, ieta);
424  if (ampli > minTimingAmpEB_) {
425  allFedsTimingHistECAL_->Fill(time);
426  allFedsTimingPhiEtaHistECAL_->Fill(iphi,ieta,time);
427  allFedsTimingTTHistECAL_->Fill(iphi,ieta,time);
428  allFedsTimingLMHistECAL_->Fill(LM,time);
429  }
430  triggerExclusiveHist_->Fill(0);
431  }
432 
433  if(!isEcalL1&&!isDTL1&&!isRPCL1&&!isCSCL1&&isHCALL1) {
434  allOccupancyExclusiveHCAL_->Fill(iphi, ieta);
435  allOccupancyCoarseExclusiveHCAL_->Fill(iphi, ieta);
436  if (ampli > minTimingAmpEB_) {
437  allFedsTimingHistHCAL_->Fill(time);
438  allFedsTimingPhiEtaHistHCAL_->Fill(iphi,ieta,time);
439  allFedsTimingTTHistHCAL_->Fill(iphi,ieta,time);
440  allFedsTimingLMHistHCAL_->Fill(LM,time);
441  }
442  triggerExclusiveHist_->Fill(1);
443  }
444 
445  if(!isEcalL1&&isDTL1&&!isRPCL1&&!isCSCL1&&!isHCALL1) {
446  allOccupancyExclusiveDT_->Fill(iphi, ieta);
447  allOccupancyCoarseExclusiveDT_->Fill(iphi, ieta);
448  if (ampli > minTimingAmpEB_) {
449  allFedsTimingHistDT_->Fill(time);
450  allFedsTimingPhiEtaHistDT_->Fill(iphi,ieta,time);
451  allFedsTimingTTHistDT_->Fill(iphi,ieta,time);
452  allFedsTimingLMHistDT_->Fill(LM,time);
453  }
454  triggerExclusiveHist_->Fill(2);
455  }
456 
457  if(!isEcalL1&&!isDTL1&&isRPCL1&&!isCSCL1&&!isHCALL1) {
458  allOccupancyExclusiveRPC_->Fill(iphi, ieta);
459  allOccupancyCoarseExclusiveRPC_->Fill(iphi, ieta);
460  if (ampli > minTimingAmpEB_) {
461  allFedsTimingHistRPC_->Fill(time);
462  allFedsTimingPhiEtaHistRPC_->Fill(iphi,ieta,time);
463  allFedsTimingTTHistRPC_->Fill(iphi,ieta,time);
464  allFedsTimingLMHistRPC_->Fill(LM,time);
465  }
466  triggerExclusiveHist_->Fill(3);
467  }
468 
469  if(!isEcalL1&&!isDTL1&&!isRPCL1&&isCSCL1&&!isHCALL1) {
470  allOccupancyExclusiveCSC_->Fill(iphi, ieta);
471  allOccupancyCoarseExclusiveCSC_->Fill(iphi, ieta);
472  if (ampli > minTimingAmpEB_) {
473  allFedsTimingHistCSC_->Fill(time);
474  allFedsTimingPhiEtaHistCSC_->Fill(iphi,ieta,time);
475  allFedsTimingTTHistCSC_->Fill(iphi,ieta,time);
476  allFedsTimingLMHistCSC_->Fill(LM,time);
477  }
478  triggerExclusiveHist_->Fill(4);
479  }
480 
481  // Inclusive trigger plots
482 
483  if (isEcalL1) {
484  triggerHist_->Fill(0);
485  allOccupancyECAL_->Fill(iphi, ieta);
486  allOccupancyCoarseECAL_->Fill(iphi, ieta);
487  }
488  if (isHCALL1) {
489  triggerHist_->Fill(1);
490  allOccupancyHCAL_->Fill(iphi, ieta);
491  allOccupancyCoarseHCAL_->Fill(iphi, ieta);
492  }
493  if (isDTL1) {
494  triggerHist_->Fill(2);
495  allOccupancyDT_->Fill(iphi, ieta);
496  allOccupancyCoarseDT_->Fill(iphi, ieta);
497  }
498  if (isRPCL1) {
499  triggerHist_->Fill(3);
500  allOccupancyRPC_->Fill(iphi, ieta);
501  allOccupancyCoarseRPC_->Fill(iphi, ieta);
502  }
503  if (isCSCL1) {
504  triggerHist_->Fill(4);
505  allOccupancyCSC_->Fill(iphi, ieta);
506  allOccupancyCoarseCSC_->Fill(iphi, ieta);
507  }
508 
509  // Fill histo for Ecal+muon coincidence
510  if(isEcalL1&&(isCSCL1||isRPCL1||isDTL1)&&!isHCALL1)
511  allFedsTimingHistEcalMuon_->Fill(time);
512 
513  if (ampli > minTimingAmpEB_) {
514  timingHist->Fill(time);
515  timingHistVsFreq->Fill(time, naiveEvtNum_);
516  timingHistVsAmp->Fill(time, ampli);
517  allFedsTimingHist_->Fill(time);
518  allFedsTimingVsAmpHist_->Fill(time, ampli);
520  timingHistVsPhi->Fill(time, iphiSM);
521  timingHistVsModule->Fill(time, ietaSM);
522  allFedsTimingPhiHist_->Fill(iphi,time);
523  allFedsTimingPhiEtaHist_->Fill(iphi,ieta,time);
524  allFedsTimingTTHist_->Fill(iphi,ieta,time);
525  allFedsTimingLMHist_->Fill(LM,time);
526  if (FEDid>=610&&FEDid<=627) allFedsTimingPhiEbmHist_->Fill(iphi,time);
527  if (FEDid>=628&&FEDid<=645) allFedsTimingPhiEbpHist_->Fill(iphi,time);
528 
529  if (FEDid>=610&&FEDid<=627) allFedsTimingEbmHist_->Fill(time);
530  if (FEDid>=628&&FEDid<=645) allFedsTimingEbpHist_->Fill(time);
531  if (FEDid>=613&&FEDid<=616) allFedsTimingEbmTopHist_->Fill(time);
532  if (FEDid>=631&&FEDid<=634) allFedsTimingEbpTopHist_->Fill(time);
533  if (FEDid>=622&&FEDid<=625) allFedsTimingEbmBottomHist_->Fill(time);
534  if (FEDid>=640&&FEDid<=643) allFedsTimingEbpBottomHist_->Fill(time);
535  }
536 
537  // *** High Energy Clusters Analysis ** //
538 
539  if (energy>minHighEnergy_) {
540 
541  LogInfo("EcalCosmicsHists") << "High energy event " << iEvent.id().run() << " : "
542  << iEvent.id().event() << " " << naiveEvtNum_
543  << " : " << energy << " " << numXtalsinCluster
544  << " : " << iphi << " " << ieta
545  << " : " << isEcalL1 << isHCALL1 << isDTL1 << isRPCL1 << isCSCL1 ;
546 
547  numberOfHighEClusters++;
548  allOccupancyHighEnergy_->Fill(iphi, ieta);
549  allOccupancyHighEnergyCoarse_->Fill(iphi, ieta);
550  allFedsOccupancyHighEnergyHist_->Fill(iphi,ieta,energy);
551  allFedsenergyOnlyHighHist_->Fill(energy);
552 
553  HighEnergy_2GeV_occuCoarse->Fill(iphi,ieta);
554  HighEnergy_2GeV_occu3D->Fill(iphi,ieta,energy);
555 
556  HighEnergy_NumXtal->Fill(fullnumXtalsinCluster);
557  HighEnergy_NumXtalFedId->Fill(FEDid,fullnumXtalsinCluster);
558  HighEnergy_NumXtaliphi->Fill(iphi,fullnumXtalsinCluster);
559  HighEnergy_energy3D->Fill(iphi,ieta,energy);
560  HighEnergy_energyNumXtal->Fill(fullnumXtalsinCluster,energy);
561 
562  if (energy>100.0) {
563  LogInfo("EcalCosmicsHists") << "Very high energy event " << iEvent.id().run() << " : "
564  << iEvent.id().event() << " " << naiveEvtNum_
565  << " : " << energy << " " << numXtalsinCluster
566  << " : " << iphi << " " << ieta
567  << " : " << isEcalL1 << isHCALL1 << isDTL1 << isRPCL1 << isCSCL1 ;
568 
569  HighEnergy_100GeV_occuCoarse->Fill(iphi,ieta);
570  HighEnergy_100GeV_occu3D->Fill(iphi,ieta,energy);
571 
572  }
573 
574  }
575 
576  // *** end of High Energy Clusters analysis *** //
577 
578  }//++++++++++++++++++END LOOP OVER EB SUPERCLUSTERS+++++++++++++++++++++++//
579 
580  //+++++++++++++++++++LOOP OVER ENDCAP EE CLUSTERS++++++++++++++++++++//
581 
582  if(hasEndcapClusters) {
583  clusterCollection_p = escHandle.product();
584  for (reco::SuperClusterCollection::const_iterator clus = clusterCollection_p->begin(); clus != clusterCollection_p->end(); ++clus) {
585  double energy = clus->energy();
586  //double phi = clus->phi();
587  //double eta = clus->eta();
588  double time = -1000.0;
589  double ampli = 0.;
590  double secondMin = 0.;
591  double secondTime = -1000.;
592  int clusSize = clus->clustersSize();
593  int numXtalsinCluster = 0;
594 
595  EEDetId maxDet;
596  EEDetId secDet;
597  //LogInfo("EcalCosmicsHists") << "Here is what we initialized the maxDet to: " << maxDet;
598 
599  // for (reco::basicCluster_iterator bclus = (clus->clustersBegin()); bclus != (clus->clustersEnd()); ++bclus) {
600 // //double cphi = (*bclus)->phi();
601 // //double ceta = (*bclus)->eta();
602 // //TODO: extend histos to EE
603 // //TrueBCOccupancy_->Fill(cphi,ceta);
604 // //TrueBCOccupancyCoarse_->Fill(cphi,ceta);
605 // }
606 
607  std::vector<std::pair<DetId, float> > clusterDetIds = clus->hitsAndFractions();//get these from the cluster
608  for(std::vector<std::pair<DetId, float> >::const_iterator detitr = clusterDetIds.begin(); detitr != clusterDetIds.end(); ++detitr) {
609 
610  //LogInfo("EcalCosmicsHists") << " Here is the DetId inside the cluster: " << (EEDetId)(*detitr);
611  //Here I use the "find" on a digi collection... I have been warned...
612 
613  if ((*detitr).first.det() != DetId::Ecal) {
614  LogError("EcalCosmicsHists") << " det is " <<(*detitr).first.det(); continue;
615  }
616  if ((*detitr).first.subdetId() != EcalEndcap) {
617  LogError("EcalCosmicsHists") << " subdet is " <<(*detitr).first.subdetId(); continue;
618  }
619 
620  EcalRecHitCollection::const_iterator thishit = hitsEE->find((*detitr).first);
621 
622  if (thishit == hitsEE->end()) {
623  LogInfo("EcalCosmicsHists") << " WARNING: EEDetId not found in the RecHit collection!";
624  continue;
625  }
626  // The checking above should no longer be needed......
627  // as only those in the cluster would already have rechits..
628 
629  EcalRecHit myhit = (*thishit);
630 
631  //LogInfo("EcalCosmicsHists") << " Found hit for DetId: " << (EEDetId)(*detitr);
632  double thisamp = myhit.energy();
633  if (thisamp > minRecHitAmpEE_) {numXtalsinCluster++; }
634  if (thisamp > secondMin) {secondMin = thisamp; secondTime = myhit.time(); secDet = (EEDetId)(*detitr).first;}
635  if (secondMin > ampli) {std::swap(ampli,secondMin); std::swap(time,secondTime); std::swap(maxDet,secDet);}
636 
637  //LogInfo("EcalCosmicsHists") << "maxDetId is now: " << (EEDetId)(maxDet);
638  }
639 
640  double fullnumXtalsinCluster = clusterDetIds.size();
641 
642  float E2 = ampli + secondMin;
643 
645  //int FEDid = 600+elecId.dccId();
646 
647  //Set some more values
648  //TODO: need to fix the seeds vector to be DetId or have another one for EE
649  //seeds.push_back(maxDet);
650 
651  int ix = maxDet.ix();
652  int iy = maxDet.iy();
653  int iz = maxDet.zside();
654 
655  // LogWarning("EcalCosmicsHists") << "EE cluster (x,y,z) : ( "
656  // << ix << " , " << iy << " , " << iz
657  // << " ) " << std::endl;
658 
659  if (!EEDetId::validDetId(ix,iy,iz)) {
660  LogWarning("EcalCosmicsHists") << "INVALID EE DetId !!!" << endl;
661  return;
662  }
663 
664 
665  numberOfCosmics++;
666  if (iz<0) { numberOfCosmicsEEM++; }
667  else { numberOfCosmicsEEP++; }
668 
669  //int LM = ecalElectronicsMap_->getLMNumber(maxDet) ;//FIX ME
670 
671  //TODO: extend histos to EE
672  //TH1F* uRecHist = FEDsAndHists_[FEDid];
673  //TH1F* E2uRecHist = FEDsAndE2Hists_[FEDid];
674  //TH1F* energyuRecHist = FEDsAndenergyHists_[FEDid];
675  //TH1F* timingHist = FEDsAndTimingHists_[FEDid];
676  //TH1F* freqHist = FEDsAndFrequencyHists_[FEDid];
677  //TH1F* iphiProfileHist = FEDsAndiPhiProfileHists_[FEDid];
678  //TH1F* ietaProfileHist = FEDsAndiEtaProfileHists_[FEDid];
679  //TH2F* timingHistVsFreq = FEDsAndTimingVsFreqHists_[FEDid];
680  //TH2F* timingHistVsAmp = FEDsAndTimingVsAmpHists_[FEDid];
681  //TH2F* E2vsE1uRecHist = FEDsAndE2vsE1Hists_[FEDid];
682  //TH2F* energyvsE1uRecHist = FEDsAndenergyvsE1Hists_[FEDid];
683  //TH1F* numXtalInClusterHist = FEDsAndNumXtalsInClusterHists_[FEDid];
684  //TH2F* occupHist = FEDsAndOccupancyHists_[FEDid];
685  //TH2F* timingHistVsPhi = FEDsAndTimingVsPhiHists_[FEDid];
686  //TH2F* timingHistVsModule = FEDsAndTimingVsModuleHists_[FEDid];
687  //if(uRecHist==0)
688  //{
689  // initHists(FEDid);
690  // uRecHist = FEDsAndHists_[FEDid];
691  // E2uRecHist = FEDsAndE2Hists_[FEDid];
692  // energyuRecHist = FEDsAndenergyHists_[FEDid];
693  // timingHist = FEDsAndTimingHists_[FEDid];
694  // freqHist = FEDsAndFrequencyHists_[FEDid];
695  // timingHistVsFreq = FEDsAndTimingVsFreqHists_[FEDid];
696  // timingHistVsAmp = FEDsAndTimingVsAmpHists_[FEDid];
697  // iphiProfileHist = FEDsAndiPhiProfileHists_[FEDid];
698  // ietaProfileHist = FEDsAndiEtaProfileHists_[FEDid];
699  // E2vsE1uRecHist = FEDsAndE2vsE1Hists_[FEDid];
700  // energyvsE1uRecHist = FEDsAndenergyvsE1Hists_[FEDid];
701  // numXtalInClusterHist = FEDsAndNumXtalsInClusterHists_[FEDid];
702  // occupHist = FEDsAndOccupancyHists_[FEDid];
703  // timingHistVsPhi = FEDsAndTimingVsPhiHists_[FEDid];
704  // timingHistVsModule = FEDsAndTimingVsModuleHists_[FEDid];
705  //}
706  //uRecHist->Fill(ampli);
707  //E2uRecHist->Fill(E2);
708  //E2vsE1uRecHist->Fill(ampli,E2);
709  //energyuRecHist->Fill(energy);
710  //energyvsE1uRecHist->Fill(ampli,energy);
711  //allFedsHist_->Fill(ampli);
712 
713  if (iz<0) {
714  EEM_FedsSeedEnergyHist_->Fill(ampli);
715  EEM_FedsenergyHist_->Fill(energy);
716  EEM_FedsenergyHighHist_->Fill(energy);
717  EEM_FedsE2Hist_->Fill(E2);
718  EEM_FedsE2vsE1Hist_->Fill(ampli,E2);
719  EEM_FedsenergyvsE1Hist_->Fill(ampli,energy);
720  EEM_AllOccupancyCoarse_->Fill(ix-0.5,iy-0.5);
721  EEM_AllOccupancy_->Fill(ix-0.5,iy-0.5);
722 
723  EEM_FedsNumXtalsInClusterHist_->Fill(numXtalsinCluster);
724  EEM_NumXtalsInClusterHist_->Fill(fullnumXtalsinCluster);
725  EEM_numxtalsVsEnergy_->Fill(energy,numXtalsinCluster);
726  EEM_numxtalsVsHighEnergy_->Fill(energy,numXtalsinCluster);
727  EEM_numberofBCinSC_->Fill(clusSize);
728 
729  if (fullnumXtalsinCluster==1) {
730  EEM_OccupancySingleXtal_->Fill(ix-0.5,iy-0.5);
731  EEM_energySingleXtalHist_->Fill(energy);
732  }
733 
734  if (ampli > minTimingAmpEE_) {
735  EEM_FedsTimingHist_->Fill(time);
736  EEM_FedsTimingVsAmpHist_->Fill(time, ampli);
737  EEM_FedsTimingTTHist_->Fill(ix-0.5,iy-0.5,time);
738  }
739 
740  // Exclusive trigger plots
741 
742  if(isEcalL1&&!isDTL1&&!isRPCL1&&!isCSCL1&&!isHCALL1) {
743  EEM_OccupancyExclusiveECAL_->Fill(ix-0.5,iy-0.5);
744  EEM_OccupancyCoarseExclusiveECAL_->Fill(ix-0.5,iy-0.5);
745  if (ampli > minTimingAmpEE_) {
746  EEM_FedsTimingHistECAL_->Fill(time);
747  EEM_FedsTimingTTHistECAL_->Fill(ix-0.5,iy-0.5,time);
748  }
749  EEM_triggerExclusiveHist_->Fill(0);
750  }
751 
752  if(!isEcalL1&&!isDTL1&&!isRPCL1&&!isCSCL1&&isHCALL1) {
753  EEM_OccupancyExclusiveHCAL_->Fill(ix-0.5,iy-0.5);
754  EEM_OccupancyCoarseExclusiveHCAL_->Fill(ix-0.5,iy-0.5);
755  if (ampli > minTimingAmpEE_) {
756  EEM_FedsTimingHistHCAL_->Fill(time);
757  EEM_FedsTimingTTHistHCAL_->Fill(ix-0.5,iy-0.5,time);
758  }
759  EEM_triggerExclusiveHist_->Fill(1);
760  }
761 
762  if(!isEcalL1&&isDTL1&&!isRPCL1&&!isCSCL1&&!isHCALL1) {
763  EEM_OccupancyExclusiveDT_->Fill(ix-0.5,iy-0.5);
764  EEM_OccupancyCoarseExclusiveDT_->Fill(ix-0.5,iy-0.5);
765  if (ampli > minTimingAmpEE_) {
766  EEM_FedsTimingHistDT_->Fill(time);
767  EEM_FedsTimingTTHistDT_->Fill(ix-0.5,iy-0.5,time);
768  }
769  EEM_triggerExclusiveHist_->Fill(2);
770  }
771 
772  if(!isEcalL1&&!isDTL1&&isRPCL1&&!isCSCL1&&!isHCALL1) {
773  EEM_OccupancyExclusiveRPC_->Fill(ix-0.5,iy-0.5);
774  EEM_OccupancyCoarseExclusiveRPC_->Fill(ix-0.5,iy-0.5);
775  if (ampli > minTimingAmpEE_) {
776  EEM_FedsTimingHistRPC_->Fill(time);
777  EEM_FedsTimingTTHistRPC_->Fill(ix-0.5,iy-0.5,time);
778  }
779  EEM_triggerExclusiveHist_->Fill(3);
780  }
781 
782  if(!isEcalL1&&!isDTL1&&!isRPCL1&&isCSCL1&&!isHCALL1) {
783  EEM_OccupancyExclusiveCSC_->Fill(ix-0.5,iy-0.5);
784  EEM_OccupancyCoarseExclusiveCSC_->Fill(ix-0.5,iy-0.5);
785  if (ampli > minTimingAmpEE_) {
786  EEM_FedsTimingHistCSC_->Fill(time);
787  EEM_FedsTimingTTHistCSC_->Fill(ix-0.5,iy-0.5,time);
788  }
789  EEM_triggerExclusiveHist_->Fill(4);
790  }
791 
792  // Inclusive trigger plots
793 
794  if (isEcalL1) {
795  EEM_triggerHist_->Fill(0);
796  EEM_OccupancyECAL_->Fill(ix-0.5,iy-0.5);
797  EEM_OccupancyCoarseECAL_->Fill(ix-0.5,iy-0.5);
798  }
799  if (isHCALL1) {
800  EEM_triggerHist_->Fill(1);
801  EEM_OccupancyHCAL_->Fill(ix-0.5,iy-0.5);
802  EEM_OccupancyCoarseHCAL_->Fill(ix-0.5,iy-0.5);
803  }
804  if (isDTL1) {
805  EEM_triggerHist_->Fill(2);
806  EEM_OccupancyDT_->Fill(ix-0.5,iy-0.5);
807  EEM_OccupancyCoarseDT_->Fill(ix-0.5,iy-0.5);
808  }
809  if (isRPCL1) {
810  EEM_triggerHist_->Fill(3);
811  EEM_OccupancyRPC_->Fill(ix-0.5,iy-0.5);
812  EEM_OccupancyCoarseRPC_->Fill(ix-0.5,iy-0.5);
813  }
814  if (isCSCL1) {
815  EEM_triggerHist_->Fill(4);
816  EEM_OccupancyCSC_->Fill(ix-0.5,iy-0.5);
817  EEM_OccupancyCoarseCSC_->Fill(ix-0.5,iy-0.5);
818  }
819 
820  } else {
821 
822  EEP_FedsSeedEnergyHist_->Fill(ampli);
823  EEP_FedsenergyHist_->Fill(energy);
824  EEP_FedsenergyHighHist_->Fill(energy);
825  EEP_FedsE2Hist_->Fill(E2);
826  EEP_FedsE2vsE1Hist_->Fill(ampli,E2);
827  EEP_FedsenergyvsE1Hist_->Fill(ampli,energy);
828  EEP_AllOccupancyCoarse_->Fill(ix-0.5,iy-0.5);
829  EEP_AllOccupancy_->Fill(ix-0.5,iy-0.5);
830 
831  EEP_FedsNumXtalsInClusterHist_->Fill(numXtalsinCluster);
832  EEP_NumXtalsInClusterHist_->Fill(fullnumXtalsinCluster);
833  EEP_numxtalsVsEnergy_->Fill(energy,numXtalsinCluster);
834  EEP_numxtalsVsHighEnergy_->Fill(energy,numXtalsinCluster);
835  EEP_numberofBCinSC_->Fill(clusSize);
836 
837  if (fullnumXtalsinCluster==1) {
838  EEP_OccupancySingleXtal_->Fill(ix-0.5,iy-0.5);
839  EEP_energySingleXtalHist_->Fill(energy);
840  }
841 
842  if (ampli > minTimingAmpEE_) {
843  EEP_FedsTimingHist_->Fill(time);
844  EEP_FedsTimingVsAmpHist_->Fill(time, ampli);
845  EEP_FedsTimingTTHist_->Fill(ix-0.5,iy-0.5,time);
846  }
847 
848  // Exclusive trigger plots
849 
850  if(isEcalL1&&!isDTL1&&!isRPCL1&&!isCSCL1&&!isHCALL1) {
851  EEP_OccupancyExclusiveECAL_->Fill(ix-0.5,iy-0.5);
852  EEP_OccupancyCoarseExclusiveECAL_->Fill(ix-0.5,iy-0.5);
853  if (ampli > minTimingAmpEE_) {
854  EEP_FedsTimingHistECAL_->Fill(time);
855  EEP_FedsTimingTTHistECAL_->Fill(ix-0.5,iy-0.5,time);
856  }
857  EEP_triggerExclusiveHist_->Fill(0);
858  }
859 
860  if(!isEcalL1&&!isDTL1&&!isRPCL1&&!isCSCL1&&isHCALL1) {
861  EEP_OccupancyExclusiveHCAL_->Fill(ix-0.5,iy-0.5);
862  EEP_OccupancyCoarseExclusiveHCAL_->Fill(ix-0.5,iy-0.5);
863  if (ampli > minTimingAmpEE_) {
864  EEP_FedsTimingHistHCAL_->Fill(time);
865  EEP_FedsTimingTTHistHCAL_->Fill(ix-0.5,iy-0.5,time);
866  }
867  EEP_triggerExclusiveHist_->Fill(1);
868  }
869 
870  if(!isEcalL1&&isDTL1&&!isRPCL1&&!isCSCL1&&!isHCALL1) {
871  EEP_OccupancyExclusiveDT_->Fill(ix-0.5,iy-0.5);
872  EEP_OccupancyCoarseExclusiveDT_->Fill(ix-0.5,iy-0.5);
873  if (ampli > minTimingAmpEE_) {
874  EEP_FedsTimingHistDT_->Fill(time);
875  EEP_FedsTimingTTHistDT_->Fill(ix-0.5,iy-0.5,time);
876  }
877  EEP_triggerExclusiveHist_->Fill(2);
878  }
879 
880  if(!isEcalL1&&!isDTL1&&isRPCL1&&!isCSCL1&&!isHCALL1) {
881  EEP_OccupancyExclusiveRPC_->Fill(ix-0.5,iy-0.5);
882  EEP_OccupancyCoarseExclusiveRPC_->Fill(ix-0.5,iy-0.5);
883  if (ampli > minTimingAmpEE_) {
884  EEP_FedsTimingHistRPC_->Fill(time);
885  EEP_FedsTimingTTHistRPC_->Fill(ix-0.5,iy-0.5,time);
886  }
887  EEP_triggerExclusiveHist_->Fill(3);
888  }
889 
890  if(!isEcalL1&&!isDTL1&&!isRPCL1&&isCSCL1&&!isHCALL1) {
891  EEP_OccupancyExclusiveCSC_->Fill(ix-0.5,iy-0.5);
892  EEP_OccupancyCoarseExclusiveCSC_->Fill(ix-0.5,iy-0.5);
893  if (ampli > minTimingAmpEE_) {
894  EEP_FedsTimingHistCSC_->Fill(time);
895  EEP_FedsTimingTTHistCSC_->Fill(ix-0.5,iy-0.5,time);
896  }
897  EEP_triggerExclusiveHist_->Fill(4);
898  }
899 
900  // Inclusive trigger plots
901 
902  if (isEcalL1) {
903  EEP_triggerHist_->Fill(0);
904  EEP_OccupancyECAL_->Fill(ix-0.5,iy-0.5);
905  EEP_OccupancyCoarseECAL_->Fill(ix-0.5,iy-0.5);
906  }
907  if (isHCALL1) {
908  EEP_triggerHist_->Fill(1);
909  EEP_OccupancyHCAL_->Fill(ix-0.5,iy-0.5);
910  EEP_OccupancyCoarseHCAL_->Fill(ix-0.5,iy-0.5);
911  }
912  if (isDTL1) {
913  EEP_triggerHist_->Fill(2);
914  EEP_OccupancyDT_->Fill(ix-0.5,iy-0.5);
915  EEP_OccupancyCoarseDT_->Fill(ix-0.5,iy-0.5);
916  }
917  if (isRPCL1) {
918  EEP_triggerHist_->Fill(3);
919  EEP_OccupancyRPC_->Fill(ix-0.5,iy-0.5);
920  EEP_OccupancyCoarseRPC_->Fill(ix-0.5,iy-0.5);
921  }
922  if (isCSCL1) {
923  EEP_triggerHist_->Fill(4);
924  EEP_OccupancyCSC_->Fill(ix-0.5,iy-0.5);
925  EEP_OccupancyCoarseCSC_->Fill(ix-0.5,iy-0.5);
926  }
927 
928  }
929 
930 
931  // *** High Energy Clusters Analysis ** //
932 
933  if (energy>minHighEnergy_) {
934 
935  LogInfo("EcalCosmicsHists") << "High energy event in EE " << iEvent.id().run() << " : "
936  << iEvent.id().event() << " " << naiveEvtNum_
937  << " : " << energy << " " << numXtalsinCluster
938  << " : " << ix << " " << iy
939  << " : " << isEcalL1 << isHCALL1 << isDTL1 << isRPCL1 << isCSCL1 ;
940 
941  // numberOfHighEClusters++;
942  // allOccupancyHighEnergy_->Fill(iphi, ieta);
943  // allOccupancyHighEnergyCoarse_->Fill(iphi, ieta);
944  // allFedsOccupancyHighEnergyHist_->Fill(iphi,ieta,energy);
945  if (iz<0) {
946  EEM_FedsenergyOnlyHighHist_->Fill(energy);
947  EEM_OccupancyHighEnergy_->Fill(ix-0.5,iy-0.5);
948  EEM_OccupancyHighEnergyCoarse_->Fill(ix-0.5,iy-0.5);
949  } else {
950  EEP_FedsenergyOnlyHighHist_->Fill(energy);
951  }
952  // HighEnergy_2GeV_occuCoarse->Fill(iphi,ieta);
953  // HighEnergy_2GeV_occu3D->Fill(iphi,ieta,energy);
954 
955  // HighEnergy_NumXtal->Fill(fullnumXtalsinCluster);
956  // HighEnergy_NumXtalFedId->Fill(FEDid,fullnumXtalsinCluster);
957  // HighEnergy_NumXtaliphi->Fill(iphi,fullnumXtalsinCluster);
958  // HighEnergy_energy3D->Fill(iphi,ieta,energy);
959  // HighEnergy_energyNumXtal->Fill(fullnumXtalsinCluster,energy);
960 
961  if (energy>100.0) {
962  LogInfo("EcalCosmicsHists") << "Very high energy event in EE " << iEvent.id().run() << " : "
963  << iEvent.id().event() << " " << naiveEvtNum_
964  << " : " << energy << " " << numXtalsinCluster
965  << " : " << ix << " " << iy
966  << " : " << isEcalL1 << isHCALL1 << isDTL1 << isRPCL1 << isCSCL1 ;
967  // HighEnergy_100GeV_occuCoarse->Fill(iphi,ieta);
968  // HighEnergy_100GeV_occu3D->Fill(iphi,ieta,energy);
969  }
970 
971  }
972 
973  // *** end of High Energy Clusters analysis *** //
974 
975  }//++++++++++++++++++END LOOP OVER EE SUPERCLUSTERS+++++++++++++++++++++++++++++++++++
976  }
977 
978  HighEnergy_numClusHighEn->Fill(numberOfHighEClusters);
979  HighEnergy_ratioClusters->Fill((double(numberOfHighEClusters))/(double(numberOfCosmics)));
980 
981  numberofCosmicsHist_->Fill(numberOfCosmics);
982  EEP_numberofCosmicsHist_->Fill(numberOfCosmicsEEP);
983  EEM_numberofCosmicsHist_->Fill(numberOfCosmicsEEM);
984  numberofCosmicsHistEB_->Fill(numberOfCosmicsEB);
985 
986  if ( numberOfCosmics > 0 ) {
987  cosmicCounter_++;
989  allFedsFreqTimeHist_->Fill(eventTime);
990  //This line will work in 21X!!
991  //std::cout << " Orbit " << iEvent.orbitNumber() << " BX " << iEvent.bunchCrossing()<< std::endl;
992  //std::cout << " BX " << iEvent.experimentType() << std::endl;
993  }
994 
995  if ( numberOfCosmicsEB > 0 ) cosmicCounterEB_++;
996  if ( numberOfCosmicsEEP > 0 ) cosmicCounterEEP_++;
997  if ( numberOfCosmicsEEM > 0 ) cosmicCounterEEM_++;
998 
999  if (numberOfCosmicsTop&&numberOfCosmicsBottom) {
1001  numberofCosmicsTopBottomHist_->Fill(numberOfCosmicsTop+numberOfCosmicsBottom);
1002  }
1003 
1004  // *** TrackAssociator *** //
1005 
1006  // get reco tracks
1008  iEvent.getByLabel("cosmicMuons", recoTracks);
1009 
1010  if ( recoTracks.isValid() ) {
1011  // LogWarning("EcalCosmicsHists") << "... Valid TrackAssociator recoTracks !!! " << recoTracks.product()->size();
1012  std::map<int,std::vector<DetId> > trackDetIdMap;
1013  int tracks = 0;
1014  for(reco::TrackCollection::const_iterator recoTrack = recoTracks->begin(); recoTrack != recoTracks->end(); ++recoTrack){
1015 
1016  if(fabs(recoTrack->d0())>70 || fabs(recoTrack->dz())>70)
1017  continue;
1018  if(recoTrack->numberOfValidHits()<20)
1019  continue;
1020 
1021  //if (recoTrack->pt() < 2) continue; // skip low Pt tracks
1022 
1023  TrackDetMatchInfo info = trackAssociator_.associate(iEvent, iSetup, *recoTrack, trackParameters_);
1024 
1025  // edm::LogVerbatim("TrackAssociator") << "\n-------------------------------------------------------\n Track (pt,eta,phi): " <<
1026  // recoTrack->pt() << " , " << recoTrack->eta() << " , " << recoTrack->phi() ;
1027  // edm::LogVerbatim("TrackAssociator") << "Ecal energy in crossed crystals based on RecHits: " <<
1028  // info.crossedEnergy(TrackDetMatchInfo::EcalRecHits);
1029  // edm::LogVerbatim("TrackAssociator") << "Ecal energy in 3x3 crystals based on RecHits: " <<
1030  // info.nXnEnergy(TrackDetMatchInfo::EcalRecHits, 1);
1031  // edm::LogVerbatim("TrackAssociator") << "Hcal energy in crossed towers based on RecHits: " <<
1032  // info.crossedEnergy(TrackDetMatchInfo::HcalRecHits);
1033  // edm::LogVerbatim("TrackAssociator") << "Hcal energy in 3x3 towers based on RecHits: " <<
1034  // info.nXnEnergy(TrackDetMatchInfo::HcalRecHits, 1);
1035  // edm::LogVerbatim("TrackAssociator") << "Number of muon segment matches: " << info.numberOfSegments();
1036 
1037  // std::cout << "\n-------------------------------------------------------\n Track (pt,eta,phi): " <<
1038  // recoTrack->pt() << " , " << recoTrack->eta() << " , " << recoTrack->phi() << std::endl;
1039  // std::cout << "Ecal energy in crossed crystals based on RecHits: " <<
1040  // info.crossedEnergy(TrackDetMatchInfo::EcalRecHits) << std::endl;
1041  // std::cout << "Ecal energy in 3x3 crystals based on RecHits: " <<
1042  // info.nXnEnergy(TrackDetMatchInfo::EcalRecHits, 1) << std::endl;
1043  // std::cout << "Hcal energy in crossed towers based on RecHits: " <<
1044  // info.crossedEnergy(TrackDetMatchInfo::HcalRecHits) << std::endl;
1045  // std::cout << "Hcal energy in 3x3 towers based on RecHits: " <<
1046  // info.nXnEnergy(TrackDetMatchInfo::HcalRecHits, 1) << std::endl;
1047 
1048  for (unsigned int i=0; i<info.crossedEcalIds.size(); i++) {
1049  // only checks for barrel
1050  if (info.crossedEcalIds[i].det() == DetId::Ecal && info.crossedEcalIds[i].subdetId() == 1) {
1051  EBDetId ebDetId (info.crossedEcalIds[i]);
1052  trackAssoc_muonsEcal_->Fill(ebDetId.iphi(), ebDetId.ieta());
1053  //std::cout << "Crossed iphi: " << ebDetId.iphi()
1054  // << " ieta: " << ebDetId.ieta() << " : nCross " << info.crossedEcalIds.size() << std::endl;
1055 
1056  EcalRecHitCollection::const_iterator thishit = hits->find(ebDetId);
1057  if (thishit == hits->end()) 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.size()>0)
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.size() > 0 && trackDetIdMap.size() > 0)
1081  {
1082  double bestDr = 1000;
1083  double bestDPhi = 1000;
1084  double bestDEta = 1000;
1085  double bestEtaTrack = 1000;
1086  double bestEtaSeed = 1000;
1087  double bestPhiTrack = 1000;
1088  double bestPhiSeed = 1000;
1089  EBDetId bestTrackDet;
1090  EBDetId bestSeed;
1091  int bestTrack = -1;
1092  std::map<EBDetId,EBDetId> trackDetIdToSeedMap;
1093 
1094  //edm::LogVerbatim("TrackAssociator") << "NumTracks:" << trackDetIdMap.size() << " numClusters:" << seeds.size();
1095 
1096  for(std::vector<EBDetId>::const_iterator seedItr = seeds.begin(); seedItr != seeds.end(); ++seedItr) {
1097  for(std::map<int,std::vector<DetId> >::const_iterator mapItr = trackDetIdMap.begin();
1098  mapItr != trackDetIdMap.end(); ++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  {
1114  bestDr = dR;
1115  bestDPhi = dphi;
1116  bestDEta = deta;
1117  bestTrackDet = mapItr->second[i];
1118  bestTrack = mapItr->first;
1119  bestSeed = (*seedItr);
1120  bestEtaTrack = ebDet.ieta();
1121  bestEtaSeed = seedEta;
1122  bestPhiTrack = ebDet.iphi();
1123  bestPhiSeed = seedItr->iphi();
1124  }
1125  }
1126  }
1127  }
1128  }
1129  if(bestDr < 1000) {
1130  //edm::LogVerbatim("TrackAssociator") << "Best deltaR from matched DetId's to cluster:" << bestDr;
1131  deltaRHist_->Fill(bestDr);
1132  deltaPhiHist_->Fill(bestDPhi);
1133  deltaEtaHist_->Fill(bestDEta);
1134  deltaEtaDeltaPhiHist_->Fill(bestDEta,bestDPhi);
1135  seedTrackEtaHist_->Fill(bestEtaSeed,bestEtaTrack);
1136  seedTrackPhiHist_->Fill(bestPhiSeed,bestPhiTrack);
1137  seeds.erase(find(seeds.begin(),seeds.end(), bestSeed));
1138  trackDetIdMap.erase(trackDetIdMap.find(bestTrack));
1139  trackDetIdToSeedMap[bestTrackDet] = bestSeed;
1140  numAssocTracks++;
1141  numAssocClusters++;
1142 
1143  // for high energy analysis
1144  if(bestDPhi < 1.5 && bestDEta < 1.8 ) {
1145  //edm::LogVerbatim("TrackAssociator") << "Best seed ieta and iphi: ("
1146  // << bestSeed.ieta() << ", " << bestSeed.iphi() << ") ";
1147  //check if the bestSeed is a High Energy one
1148  EcalRecHitCollection::const_iterator Ecalhit = hits->find(bestSeed);
1149  if (Ecalhit == hits->end()) {
1150  continue;
1151  }
1152  double EcalhitEnergy = Ecalhit->energy();
1153  //edm::LogVerbatim("TrackAssociator") << "Best seed energy: " << EcalhitEnergy ;
1154  HighEnergy_bestSeed->Fill(EcalhitEnergy);
1155  HighEnergy_bestSeedOccupancy->Fill(bestSeed.iphi(), bestSeed.ieta());
1156  }
1157  }
1158  else {
1159  edm::LogVerbatim("TrackAssociator") << "could not match cluster seed to track." << bestDr;
1160  break; // no match found
1161  }
1162  }
1163  if(numSeeds>0 && numTracks>0) {
1164  ratioAssocClustersHist_->AddBinContent(1,numAssocClusters);
1165  ratioAssocClustersHist_->AddBinContent(2,numSeeds);
1166  }
1167  if(numTracks>0) {
1168  ratioAssocTracksHist_->AddBinContent(1,numAssocTracks);
1169  ratioAssocTracksHist_->AddBinContent(2,numTracks);
1170  numberofCosmicsWTrackHist_->Fill(numSeeds);
1171  }
1172  } else {
1173  // LogWarning("EcalCosmicsHists") << "!!! No TrackAssociator recoTracks !!!";
1174  }
1175 
1176 
1177  // Study on Tracks for High Energy events
1178  edm::Handle<reco::TrackCollection> recoTracksBarrel;
1179  iEvent.getByLabel("cosmicMuonsBarrelOnly", recoTracksBarrel);
1180  if ( !recoTracksBarrel.isValid() ) {
1181  //edm::LogWarning("EcalCosmicsHists") << "RecoTracksBarrel not valid!! " ;
1182  }
1183  else {
1184  //edm::LogWarning("EcalCosmicsHists") << "Number of barrel reco tracks found in the event: " << recoTracksBarrel->size() ;
1185  HighEnergy_numRecoTrackBarrel->Fill(recoTracksBarrel->size());
1186  for(reco::TrackCollection::const_iterator recoTrack = recoTracksBarrel->begin(); recoTrack != recoTracksBarrel->end(); ++recoTrack) {
1187  //edm::LogWarning("EcalCosmicsHists") << "Track (pt,eta,phi): " << recoTrack->pt() << " , " << recoTrack->eta() << " , " << recoTrack->phi() ;
1188  //edm::LogWarning("EcalCosmicsHists") << "Track innermost hit: " << recoTrack->innerPosition().phi() ;
1189  }
1190 
1191  for (reco::SuperClusterCollection::const_iterator clus = clusterCollection_p->begin(); clus != clusterCollection_p->end(); ++clus) {
1192  double energy = clus->energy();
1193  double phi = clus->phi();
1194  double eta = clus->eta();
1195 
1196  if (recoTracksBarrel->size()==0) HighEnergy_0tracks_occu3D->Fill(phi,eta,energy);
1197  if (recoTracksBarrel->size()==1) HighEnergy_1tracks_occu3D->Fill(phi,eta,energy);
1198  if (recoTracksBarrel->size()==2) HighEnergy_2tracks_occu3D->Fill(phi,eta,energy);
1199 
1200  std::vector<std::pair<DetId, float> > clusterDetIds = clus->hitsAndFractions();//get these from the cluster
1201  for(std::vector< std::pair<DetId, float> >::const_iterator detitr = clusterDetIds.begin(); detitr != clusterDetIds.end(); ++detitr)
1202  {
1203  if ((*detitr).first.det() != DetId::Ecal) {continue;}
1204  if ((*detitr).first.subdetId() != EcalBarrel) {continue; }
1205  EcalRecHitCollection::const_iterator thishit = hits->find((*detitr).first);
1206  if (thishit == hits->end()) {continue;}
1207 
1208  double rechitenergy = thishit->energy();
1209  int ieta = ((EBDetId)(*detitr).first).ieta();
1210  int iphi = ((EBDetId)(*detitr).first).iphi();
1211  if (rechitenergy > minRecHitAmpEB_) {
1212  if (recoTracksBarrel->size()==0) HighEnergy_0tracks_occu3DXtal->Fill(iphi,ieta,rechitenergy);
1213  if (recoTracksBarrel->size()==1) HighEnergy_1tracks_occu3DXtal->Fill(iphi,ieta,rechitenergy);
1214  if (recoTracksBarrel->size()==2) HighEnergy_2tracks_occu3DXtal->Fill(iphi,ieta,rechitenergy);
1215 
1216  if (rechitenergy > 10 ) edm::LogWarning("EcalCosmicsHists") << "!!!!! Crystal with energy " << rechitenergy << " at (ieta,iphi) (" << ieta << " ," << iphi << "); Id: " << (*detitr).first.det();
1217  }
1218  }
1219  }
1220 
1221  // look at angle between 2 recoTracks
1222  if ( recoTracksBarrel->size() == 2 ) {
1223  reco::TrackCollection::const_iterator Track1 = recoTracksBarrel->begin();
1224  reco::TrackCollection::const_iterator Track2 = (recoTracksBarrel->begin())+1;
1225  float angle = (acos(sin(Track1->theta()) * cos(Track1->phi()) * sin(Track2->theta()) * cos(Track2->phi()) + sin(Track1->theta()) * sin(Track1->phi()) * sin(Track2->theta()) * sin(Track2->phi()) + cos(Track1->theta()) * cos(Track2->theta())))/0.017453292519943;
1226  //edm::LogWarning("EcalCosmicsHists") << "Tracks angle: " << angle;
1227  HighEnergy_TracksAngle->Fill(angle);
1228  if ( (Track1->innerPosition().phi()) > 0 && (Track2->innerPosition().phi()) < 0 ) {
1229  //edm::LogWarning("EcalCosmicsHists") << "Top-bottom tracks";
1230  HighEnergy_TracksAngleTopBottom->Fill(angle);
1231  }
1232 
1233 
1234  }
1235  }
1236 
1237  // *** end of TrackAssociator code *** //
1238 
1239 
1240  // *** HCAL RecHits code *** //
1241 
1242  //hcal rechits
1244  iEvent.getByLabel("hbhereco", hbhe);
1245 
1247  iEvent.getByLabel("hfreco",hfrh);
1248 
1250  iEvent.getByLabel("horeco", horh);
1251 
1252  if ( hbhe.isValid() ) {
1253  // LogInfo("EcalCosmicHists") << "event " << ievt << " HBHE RecHits collection size " << hbhe->size();
1254  const HBHERecHitCollection hbheHit = *(hbhe.product());
1255  for (HBHERecHitCollection::const_iterator hhit=hbheHit.begin(); hhit!=hbheHit.end(); hhit++) {
1256  // if (hhit->energy() > 0.6){
1257  hcalEnergy_HBHE_->Fill(hhit->energy());
1258  // }
1259  }
1260  } else {
1261  // LogWarning("EcalCosmicHists") << " HBHE RecHits **NOT** VALID!! " << endl;
1262  }
1263 
1264  if ( hfrh.isValid() ) {
1265  // LogInfo("EcalCosmicHists") << "event " << ievt << " HF RecHits collection size " << hfrh->size();
1266  const HFRecHitCollection hfHit = *(hfrh.product());
1267  for (HFRecHitCollection::const_iterator hhit=hfHit.begin(); hhit!=hfHit.end(); hhit++) {
1268  hcalEnergy_HF_->Fill(hhit->energy());
1269  }
1270  } else {
1271  // LogWarning("EcalCosmicHists") << " HF RecHits **NOT** VALID!! " << endl;
1272  }
1273 
1274  if ( horh.isValid() ) {
1275  // LogInfo("EcalCosmicHists") << "event " << ievt << " HO RecHits collection size " << horh->size();
1276  const HORecHitCollection hoHit = *(horh.product());
1277  for (HORecHitCollection::const_iterator hhit=hoHit.begin(); hhit!=hoHit.end(); hhit++) {
1278  // if (hhit->energy() > 0.6){
1279  hcalEnergy_HO_->Fill(hhit->energy());
1280  // }
1281  }
1282  } else {
1283  // LogWarning("EcalCosmicHists") << " HO RecHits **NOT** VALID!! " << endl;
1284  }
1285 
1286  // *** end of HCAL code *** //
1287 }
1288 
1289 
1290 
1291 std::vector<bool> EcalCosmicsHists::determineTriggers(const edm::Event& iEvent, const edm::EventSetup& eventSetup)
1292 {
1293  std::vector<bool> l1Triggers; //DT,CSC,RPC,HCAL,ECAL
1294  //0 , 1 , 2 , 3 , 4
1295  for(int i=0;i<5;i++)
1296  l1Triggers.push_back(false);
1297 
1298  // get the GMTReadoutCollection
1299  Handle<L1MuGMTReadoutCollection> gmtrc_handle;
1300  iEvent.getByLabel(l1GMTReadoutRecTag_,gmtrc_handle);
1301  L1MuGMTReadoutCollection const* gmtrc = gmtrc_handle.product();
1302  if (!(gmtrc_handle.isValid()))
1303  {
1304  LogWarning("EcalCosmicsHists") << "l1MuGMTReadoutCollection" << " not available";
1305  return l1Triggers;
1306  }
1307  // get hold of L1GlobalReadoutRecord
1309  iEvent.getByLabel(l1GTReadoutRecTag_,L1GTRR);
1310 
1311  //Ecal
1313  eventSetup.get<L1GtTriggerMenuRcd>().get(menuRcd) ;
1314  const L1GtTriggerMenu* menu = menuRcd.product();
1316  iEvent.getByLabel( edm::InputTag("gtDigis"), gtRecord);
1317  // Get dWord after masking disabled bits
1318  const DecisionWord dWord = gtRecord->decisionWord();
1319 
1320  bool l1SingleEG1 = menu->gtAlgorithmResult("L1_SingleEG1", dWord);
1321  bool l1SingleEG5 = menu->gtAlgorithmResult("L1_SingleEG5", dWord);
1322  bool l1SingleEG8 = menu->gtAlgorithmResult("L1_SingleEG8", dWord);
1323  bool l1SingleEG10 = menu->gtAlgorithmResult("L1_SingleEG10", dWord);
1324  bool l1SingleEG12 = menu->gtAlgorithmResult("L1_SingleEG12", dWord);
1325  bool l1SingleEG15 = menu->gtAlgorithmResult("L1_SingleEG15", dWord);
1326  bool l1SingleEG20 = menu->gtAlgorithmResult("L1_SingleEG20", dWord);
1327  bool l1SingleEG25 = menu->gtAlgorithmResult("L1_SingleEG25", dWord);
1328  bool l1DoubleNoIsoEGBTBtight = menu->gtAlgorithmResult("L1_DoubleNoIsoEG_BTB_tight", dWord);
1329  bool l1DoubleNoIsoEGBTBloose = menu->gtAlgorithmResult("L1_DoubleNoIsoEG_BTB_loose ", dWord);
1330  bool l1DoubleNoIsoEGTopBottom = menu->gtAlgorithmResult("L1_DoubleNoIsoEGTopBottom", dWord);
1331  bool l1DoubleNoIsoEGTopBottomCen = menu->gtAlgorithmResult("L1_DoubleNoIsoEGTopBottomCen", dWord);
1332  bool l1DoubleNoIsoEGTopBottomCen2 = menu->gtAlgorithmResult("L1_DoubleNoIsoEGTopBottomCen2", dWord);
1333  bool l1DoubleNoIsoEGTopBottomCenVert = menu->gtAlgorithmResult("L1_DoubleNoIsoEGTopBottomCenVert", dWord);
1334 
1335  l1Triggers[4] = l1SingleEG1 || l1SingleEG5 || l1SingleEG8 || l1SingleEG10 || l1SingleEG12 || l1SingleEG15
1336  || l1SingleEG20 || l1SingleEG25 || l1DoubleNoIsoEGBTBtight || l1DoubleNoIsoEGBTBloose
1337  || l1DoubleNoIsoEGTopBottom || l1DoubleNoIsoEGTopBottomCen || l1DoubleNoIsoEGTopBottomCen2
1338  || l1DoubleNoIsoEGTopBottomCenVert;
1339 
1340  std::vector<L1MuGMTReadoutRecord> gmt_records = gmtrc->getRecords();
1341  std::vector<L1MuGMTReadoutRecord>::const_iterator igmtrr;
1342  for(igmtrr=gmt_records.begin(); igmtrr!=gmt_records.end(); igmtrr++) {
1343  std::vector<L1MuRegionalCand>::const_iterator iter1;
1344  std::vector<L1MuRegionalCand> rmc;
1345 
1346  //DT triggers
1347  int idt = 0;
1348  rmc = igmtrr->getDTBXCands();
1349  for(iter1=rmc.begin(); iter1!=rmc.end(); iter1++) {
1350  if ( !(*iter1).empty() ) {
1351  idt++;
1352  }
1353  }
1354  //if(idt>0) std::cout << "Found " << idt << " valid DT candidates in bx wrt. L1A = "
1355  // << igmtrr->getBxInEvent() << std::endl;
1356  if(igmtrr->getBxInEvent()==0 && idt>0) l1Triggers[0] = true;
1357 
1358  //RPC triggers
1359  int irpcb = 0;
1360  rmc = igmtrr->getBrlRPCCands();
1361  for(iter1=rmc.begin(); iter1!=rmc.end(); iter1++) {
1362  if ( !(*iter1).empty() ) {
1363  irpcb++;
1364  }
1365  }
1366  //if(irpcb>0) std::cout << "Found " << irpcb << " valid RPC candidates in bx wrt. L1A = "
1367  // << igmtrr->getBxInEvent() << std::endl;
1368  if(igmtrr->getBxInEvent()==0 && irpcb>0) l1Triggers[2] = true;
1369 
1370  //CSC Triggers
1371  int icsc = 0;
1372  rmc = igmtrr->getCSCCands();
1373  for(iter1=rmc.begin(); iter1!=rmc.end(); iter1++) {
1374  if ( !(*iter1).empty() ) {
1375  icsc++;
1376  }
1377  }
1378  //if(icsc>0) std::cout << "Found " << icsc << " valid CSC candidates in bx wrt. L1A = "
1379  // << igmtrr->getBxInEvent() << std::endl;
1380  if(igmtrr->getBxInEvent()==0 && icsc>0) l1Triggers[1] = true;
1381  }
1382 
1383  L1GlobalTriggerReadoutRecord const* gtrr = L1GTRR.product();
1384 
1385  for(int ibx=-1; ibx<=1; ibx++) {
1386  bool hcal_top = false;
1387  bool hcal_bot = false;
1388  const L1GtPsbWord psb = gtrr->gtPsbWord(0xbb0d,ibx);
1389  std::vector<int> valid_phi;
1390  if((psb.aData(4)&0x3f) >= 1) {valid_phi.push_back( (psb.aData(4)>>10)&0x1f ); }
1391  if((psb.bData(4)&0x3f) >= 1) {valid_phi.push_back( (psb.bData(4)>>10)&0x1f ); }
1392  if((psb.aData(5)&0x3f) >= 1) {valid_phi.push_back( (psb.aData(5)>>10)&0x1f ); }
1393  if((psb.bData(5)&0x3f) >= 1) {valid_phi.push_back( (psb.bData(5)>>10)&0x1f ); }
1394  std::vector<int>::const_iterator iphi;
1395  for(iphi=valid_phi.begin(); iphi!=valid_phi.end(); iphi++) {
1396  //std::cout << "Found HCAL mip with phi=" << *iphi << " in bx wrt. L1A = " << ibx << std::endl;
1397  if(*iphi<9) hcal_top=true;
1398  if(*iphi>8) hcal_bot=true;
1399  }
1400  if(ibx==0 && hcal_top && hcal_bot) l1Triggers[3]=true;
1401  }
1402 
1403  edm::LogInfo("EcalCosmicsHists") << "**** Trigger SourceSource ****";
1404  if(l1Triggers[0]) edm::LogInfo("EcalCosmicsHists") << "DT";
1405  if(l1Triggers[2]) edm::LogInfo("EcalCosmicsHists") << "RPC";
1406  if(l1Triggers[1]) edm::LogInfo("EcalCosmicsHists") << "CSC";
1407  if(l1Triggers[3]) edm::LogInfo("EcalCosmicsHists") << "HCAL";
1408  if(l1Triggers[4]) edm::LogInfo("EcalCosmicsHists") << "ECAL";
1409  edm::LogInfo("EcalCosmicsHists") << "************************";
1410 
1411  return l1Triggers;
1412 }
1413 
1414 // insert the hist map into the map keyed by FED number
1416 {
1417  using namespace std;
1418 
1419  string FEDid = intToString(FED);
1420  string title1 = "Energy of Seed Crystal ";
1421  title1.append(fedMap_->getSliceFromFed(FED));
1422  title1.append(";Seed Energy (GeV);Number of Cosmics");
1423  string name1 = "SeedEnergyFED";
1424  name1.append(intToString(FED));
1425  int numBins = 200;//(int)round(histRangeMax_-histRangeMin_)+1;
1426  TH1F* hist = new TH1F(name1.c_str(),title1.c_str(), numBins, histRangeMin_, histRangeMax_);
1427  FEDsAndHists_[FED] = hist;
1428  FEDsAndHists_[FED]->SetDirectory(0);
1429 
1430  TH1F* E2hist = new TH1F(Form("E2_FED_%d",FED),Form("E2_FED_%d",FED), numBins, histRangeMin_, histRangeMax_);
1431  FEDsAndE2Hists_[FED] = E2hist;
1432  FEDsAndE2Hists_[FED]->SetDirectory(0);
1433 
1434  TH1F* energyhist = new TH1F(Form("Energy_FED_%d",FED),Form("Energy_FED_%d",FED), numBins, histRangeMin_, histRangeMax_);
1435  FEDsAndenergyHists_[FED] = energyhist;
1436  FEDsAndenergyHists_[FED]->SetDirectory(0);
1437 
1438  TH2F* E2vsE1hist = new TH2F(Form("E2vsE1_FED_%d",FED),Form("E2vsE1_FED_%d",FED), numBins, histRangeMin_, histRangeMax_, numBins, histRangeMin_, histRangeMax_);
1439  FEDsAndE2vsE1Hists_[FED] = E2vsE1hist;
1440  FEDsAndE2vsE1Hists_[FED]->SetDirectory(0);
1441 
1442  TH2F* energyvsE1hist = new TH2F(Form("EnergyvsE1_FED_%d",FED),Form("EnergyvsE1_FED_%d",FED), numBins, histRangeMin_, histRangeMax_, numBins, histRangeMin_, histRangeMax_);
1443  FEDsAndenergyvsE1Hists_[FED] = energyvsE1hist;
1444  FEDsAndenergyvsE1Hists_[FED]->SetDirectory(0);
1445 
1446  title1 = "Time for ";
1447  title1.append(fedMap_->getSliceFromFed(FED));
1448  title1.append(";Relative Time (1 clock = 25ns);Events");
1449  name1 = "TimeFED";
1450  name1.append(intToString(FED));
1451  TH1F* timingHist = new TH1F(name1.c_str(),title1.c_str(),78,-7,7);
1452  FEDsAndTimingHists_[FED] = timingHist;
1453  FEDsAndTimingHists_[FED]->SetDirectory(0);
1454 
1455  TH1F* freqHist = new TH1F(Form("Frequency_FED_%d",FED),Form("Frequency for FED %d;Event Number",FED),100,0.,100000);
1456  FEDsAndFrequencyHists_[FED] = freqHist;
1457  FEDsAndFrequencyHists_[FED]->SetDirectory(0);
1458 
1459  TH1F* iphiProfileHist = new TH1F(Form("iPhi_Profile_FED_%d",FED),Form("iPhi Profile for FED %d",FED),360,1.,361);
1460  FEDsAndiPhiProfileHists_[FED] = iphiProfileHist;
1461  FEDsAndiPhiProfileHists_[FED]->SetDirectory(0);
1462 
1463  TH1F* ietaProfileHist = new TH1F(Form("iEta_Profile_FED_%d",FED),Form("iEta Profile for FED %d",FED),172,-86,86);
1464  FEDsAndiEtaProfileHists_[FED] = ietaProfileHist;
1465  FEDsAndiEtaProfileHists_[FED]->SetDirectory(0);
1466 
1467  TH2F* timingHistVsFreq = new TH2F(Form("timeVsFreqFED_%d",FED),Form("time Vs Freq FED %d",FED),78,-7,7,100,0.,100000);
1468  FEDsAndTimingVsFreqHists_[FED] = timingHistVsFreq;
1469  FEDsAndTimingVsFreqHists_[FED]->SetDirectory(0);
1470 
1471  TH2F* timingHistVsAmp = new TH2F(Form("timeVsAmpFED_%d",FED),Form("time Vs Amp FED %d",FED),78,-7,7,numBins,histRangeMin_,histRangeMax_);
1472  FEDsAndTimingVsAmpHists_[FED] = timingHistVsAmp;
1473  FEDsAndTimingVsAmpHists_[FED]->SetDirectory(0);
1474 
1475  TH1F* numXtalInClusterHist = new TH1F(Form("NumXtalsInCluster_FED_%d",FED),Form("Num active Xtals In Cluster for FED %d;Num Active Xtals",FED),25,0,25);
1476  FEDsAndNumXtalsInClusterHists_[FED] = numXtalInClusterHist;
1477  FEDsAndNumXtalsInClusterHists_[FED]->SetDirectory(0);
1478 
1479  TH2F* OccupHist = new TH2F(Form("occupFED_%d",FED),Form("Occupancy FED %d;i#eta;i#phi",FED),85,1,86,20,1,21);
1480  FEDsAndOccupancyHists_[FED] = OccupHist;
1481  FEDsAndOccupancyHists_[FED]->SetDirectory(0);
1482 
1483  TH2F* timingHistVsPhi = new TH2F(Form("timeVsPhiFED_%d",FED),Form("time Vs Phi FED %d;Relative Time (1 clock = 25ns);i#phi",FED),78,-7,7,20,1,21);
1484  FEDsAndTimingVsPhiHists_[FED] = timingHistVsPhi;
1485  FEDsAndTimingVsPhiHists_[FED]->SetDirectory(0);
1486 
1487  TH2F* timingHistVsModule = new TH2F(Form("timeVsModuleFED_%d",FED),Form("time Vs Module FED %d;Relative Time (1 clock = 25ns);i#eta",FED),78,-7,7,4,1,86);
1488  FEDsAndTimingVsModuleHists_[FED] = timingHistVsModule;
1489  FEDsAndTimingVsModuleHists_[FED]->SetDirectory(0);
1490 
1491  TH2F* dccRuntypeVsBxFED = new TH2F(Form("DCCRuntypeVsBxFED_%d",FED),Form("DCC Runtype vs. BX FED %d",FED),3600,0,3600,24,0,24);
1492  FEDsAndDCCRuntypeVsBxHists_[FED] = dccRuntypeVsBxFED;
1493  FEDsAndDCCRuntypeVsBxHists_[FED]->SetDirectory(0);
1494 
1495 }
1496 
1497 // ------------ method called once each job just before starting event loop ------------
1498 void
1500 {
1502  eventSetup.get< EcalMappingRcd >().get(handle);
1503  ecalElectronicsMap_ = handle.product();
1504 
1505  //Here I will init some of the specific histograms
1506  int numBins = 200;//(int)round(histRangeMax_-histRangeMin_)+1;
1507 
1508  //=============Special Bins for TT and Modules borders=============================
1509  double ttEtaBins[36] = {-85, -80, -75, -70, -65, -60, -55, -50, -45, -40, -35, -30, -25, -20, -15, -10, -5, 0, 1, 6, 11, 16, 21, 26, 31, 36, 41, 46, 51, 56, 61, 66, 71, 76, 81, 86 };
1510  double modEtaBins[10]={-85, -65, -45, -25, 0, 1, 26, 46, 66, 86};
1511  double ttPhiBins[73];
1512  double modPhiBins[19];
1513  double timingBins[79];
1514  double highEBins[11];
1515  for (int i = 0; i < 79; ++i)
1516  {
1517  timingBins[i]=-7.+double(i)*14./78.;
1518  if (i<73)
1519  {
1520  ttPhiBins[i]=1+5*i;
1521  if ( i < 19)
1522  {
1523  modPhiBins[i]=1+20*i;
1524  if (i < 11)
1525  {
1526  highEBins[i]=10.+double(i)*20.;
1527  }
1528  }
1529  }
1530 
1531  }
1532  //=============END Special Bins for TT and Modules borders===========================
1533 
1534  //====================Frequency for Event timing information=========================
1535  double timingEndInSeconds = runTimeLength_*3600.;
1536  double timingBinWidth = timingEndInSeconds/double(numTimingBins_);
1537  //====================END Frequency for Event timing information=====================
1538 
1539 
1540  allFedsenergyHist_ = new TH1F("energy_AllClusters","energy_AllClusters;Cluster Energy (GeV)",numBins,histRangeMin_,histRangeMax_);
1541  allFedsenergyHighHist_ = new TH1F("energyHigh_AllClusters","energyHigh_AllClusters;Cluster Energy (GeV)",numBins,histRangeMin_,200.0);
1542  allFedsenergyOnlyHighHist_ = new TH1F("energyHigh_HighEnergyClusters","energy of High Energy Clusters;Cluster Energy (GeV)",numBins,histRangeMin_,200.0);
1543  allFedsE2Hist_ = new TH1F("E2_AllClusters","E2_AllClusters;Seed+highest neighbor energy (GeV)",numBins,histRangeMin_,histRangeMax_);
1544  allFedsE2vsE1Hist_ = new TH2F("E2vsE1_AllClusters","E2vsE1_AllClusters;Seed Energy (GeV);Seed+highest neighbor energy (GeV)",numBins,histRangeMin_,histRangeMax_,numBins,histRangeMin_,histRangeMax_);
1545  allFedsenergyvsE1Hist_ = new TH2F("energyvsE1_AllClusters","energyvsE1_AllClusters;Seed Energy (GeV);Energy(GeV)",numBins,histRangeMin_,histRangeMax_,numBins,histRangeMin_,histRangeMax_);
1546  allFedsTimingHist_ = new TH1F("timeForAllFeds","timeForAllFeds;Relative Time (1 clock = 25ns)",78,-7,7);
1547  allFedsTimingVsFreqHist_ = new TH2F("timeVsFreqAllEvent","time Vs Freq All events;Relative Time (1 clock = 25ns);Event Number",78,-7,7,2000,0.,200000);
1548  allFedsTimingVsAmpHist_ = new TH2F("timeVsAmpAllEvents","time Vs Amp All Events;Relative Time (1 clock = 25ns);Amplitude (GeV)",78,-7,7,numBins,histRangeMin_,histRangeMax_);
1549  allFedsFrequencyHist_ = new TH1F("FrequencyAllEvent","Frequency for All events;Event Number",2000,0.,200000);
1550 
1551  //--------Special Hists for times stamp info----------------------------------------------
1552  allFedsFreqTimeHist_ = new TH1F("FrequencyAllEventsInTime",Form("Time of Cosmic Events; Time (s);Passing Event rate/%5g s",timingBinWidth),numTimingBins_,0.,timingEndInSeconds);
1553  allFedsFreqTimeVsPhiHist_= new TH2F("FrequencyAllEventsInTimeVsPhi",Form("Time of Cosmic Events vs iPhi; iPhi;Time (s)/%5g s",timingBinWidth*360.),360,1.,361.,numTimingBins_/360,0.,timingEndInSeconds);
1554  allFedsFreqTimeVsPhiTTHist_= new TH2F("FrequencyAllEventsInTimeVsTTPhi",Form("Time of Cosmic Events vs iPhi (TT bins); iPhi;Time (s)/%5g s",timingBinWidth*72.),72,1.,361.,numTimingBins_/72,0.,timingEndInSeconds);
1555  allFedsFreqTimeVsEtaHist_= new TH2F("FrequencyAllEventsInTimeVsEta",Form("Time of Cosmic Events vs iEta; Time (s)/%5g s; iEta" ,timingBinWidth*172.),numTimingBins_/172,0.,timingEndInSeconds,172,-86.,86.);
1556  allFedsFreqTimeVsEtaTTHist_= new TH2F("FrequencyAllEventsInTimeVsTTEta",Form("Time of Cosmic Events vs Eta (TT bins);Time (s)/%5g s; iEta" ,timingBinWidth*35.),numTimingBins_/35,0.,timingEndInSeconds,35,ttEtaBins);
1557  //--------END Special Hists for times stamp info------------------------------------------
1558 
1559  allFedsiPhiProfileHist_ = new TH1F("iPhiProfileAllEvents","iPhi Profile all events;i#phi",360,1.,361.);
1560  allFedsiEtaProfileHist_ = new TH1F("iEtaProfileAllEvents","iEta Profile all events;i#eta",172,-86,86);
1561 
1562  allOccupancy_ = new TH2F("OccupancyAllEvents","Occupancy all events;i#phi;i#eta",360,1.,361.,172,-86,86);
1563  TrueOccupancy_ = new TH2F("TrueOccupancyAllEvents","True Occupancy all events;#phi;#eta",360,-3.14159,3.14159,172,-1.5,1.5);
1564  allOccupancyCoarse_ = new TH2F("OccupancyAllEventsCoarse","Occupancy all events Coarse;i#phi;i#eta",360/5,1,361.,35,ttEtaBins);
1565  TrueOccupancyCoarse_ = new TH2F("TrueOccupancyAllEventsCoarse","True Occupancy all events Coarse;#phi;#eta",360/5,-3.14159,3.14159,34,-1.5,1.5);
1566 
1567 
1568  // single xtal cluster occupancy
1569  allOccupancySingleXtal_ = new TH2F("OccupancySingleXtal","Occupancy single xtal clusters;i#phi;i#eta",360,1.,361.,172,-86,86);
1570  energySingleXtalHist_ = new TH1F("energy_SingleXtalClusters","Energy single xtal clusters;Cluster Energy (GeV)",numBins,histRangeMin_,200.0);
1571 
1572  allFedsTimingPhiHist_ = new TH2F("timePhiAllFEDs","time vs Phi for all FEDs (TT binning);i#phi;Relative Time (1 clock = 25ns)",72,1,361,78,-7,7);
1573  allFedsTimingPhiEbpHist_ = new TH2F("timePhiEBP","time vs Phi for FEDs in EB+ (TT binning) ;i#phi;Relative Time (1 clock = 25ns)",72,1,361,78,-7,7);
1574  allFedsTimingPhiEbmHist_ = new TH2F("timePhiEBM","time vs Phi for FEDs in EB- (TT binning);i#phi;Relative Time (1 clock = 25ns)",72,1,361,78,-7,7);
1575  allFedsTimingPhiEtaHist_ = new TH3F("timePhiEtaAllFEDs","(Phi,Eta,time) for all FEDs (SM,M binning);i#phi;i#eta;Relative Time (1 clock = 25ns)",18,modPhiBins,9,modEtaBins,78,timingBins);
1576  allFedsTimingTTHist_ = new TH3F("timeTTAllFEDs","(Phi,Eta,time) for all FEDs (SM,TT binning);i#phi;i#eta;Relative Time (1 clock = 25ns)",72,ttPhiBins,35,ttEtaBins,78,timingBins);
1577  allFedsTimingLMHist_ = new TH2F("timeLMAllFEDs","(LM,time) for all FEDs (SM,LM binning);LM;Relative Time (1 clock = 25ns)",92, 1, 92,78,-7,7);
1578 
1579  allFedsTimingEbpHist_ = new TH1F("timeEBP","time for FEDs in EB+;Relative Time (1 clock = 25ns)",78,-7,7);
1580  allFedsTimingEbmHist_ = new TH1F("timeEBM","time for FEDs in EB-;Relative Time (1 clock = 25ns)",78,-7,7);
1581  allFedsTimingEbpTopHist_ = new TH1F("timeEBPTop","time for FEDs in EB+ Top;Relative Time (1 clock = 25ns)",78,-7,7);
1582  allFedsTimingEbmTopHist_ = new TH1F("timeEBMTop","time for FEDs in EB- Top;Relative Time (1 clock = 25ns)",78,-7,7);
1583  allFedsTimingEbpBottomHist_ = new TH1F("timeEBPBottom","time for FEDs in EB+ Bottom;Relative Time (1 clock = 25ns)",78,-7,7);
1584  allFedsTimingEbmBottomHist_ = new TH1F("timeEBMBottom","time for FEDs in EB- Bottom;Relative Time (1 clock = 25ns)",78,-7,7);
1585 
1586  numberofCosmicsHist_ = new TH1F("numberofCosmicsPerEvent","Number of cosmics per event;Number of Cosmics",30,0,30);
1587  numberofCosmicsHistEB_ = new TH1F("numberofCosmicsPerEvent_EB","Number of cosmics per event EB;Number of Cosmics",30,0,30);
1588 
1589  numberofCosmicsWTrackHist_ = new TH1F("numberofCosmicsWTrackPerEvent","Number of cosmics with track per event",30,0,30);
1590  numberofCosmicsTopBottomHist_ = new TH1F("numberofCosmicsTopBottomPerEvent","Number of top bottom cosmics per event;Number of Cosmics",30,0,30);
1591  numberofGoodEvtFreq_ = new TH1F("frequencyOfGoodEvents","Number of events with cosmic vs Event;Event Number;Number of Good Events/100 Events",2000,0,200000);
1592 
1593  numberofCrossedEcalIdsHist_ = new TH1F("numberofCrossedEcalCosmicsPerEvent","Number of crossed ECAL cosmics per event;Number of Crossed Cosmics",10,0,10);
1594 
1595  allOccupancyExclusiveECAL_ = new TH2F("OccupancyAllEvents_ExclusiveECAL","Occupancy all events Exclusive ECAL ;i#phi;i#eta",360,1.,361.,172,-86,86);
1596  allOccupancyCoarseExclusiveECAL_ = new TH2F("OccupancyAllEventsCoarse_ExclusiveECAL","Occupancy all events Coarse Exclusive ECAL;i#phi;i#eta",360/5,ttPhiBins,35, ttEtaBins);
1597  allOccupancyECAL_ = new TH2F("OccupancyAllEvents_ECAL","Occupancy all events ECAL;i#phi;i#eta",360,1.,361.,172,-86,86);
1598  allOccupancyCoarseECAL_ = new TH2F("OccupancyAllEventsCoarse_ECAL","Occupancy all events Coarse ECAL;i#phi;i#eta",360/5,ttPhiBins,35, ttEtaBins);
1599  allFedsTimingHistECAL_ = new TH1F("timeForAllFeds_ECAL","timeForAllFeds ECAL;Relative Time (1 clock = 25ns)",78,-7,7);
1600  allFedsTimingPhiEtaHistECAL_ = new TH3F("timePhiEtaAllFEDs_ECAL","ECAL (Phi,Eta,time) for all FEDs (SM,M binning);i#phi;i#eta;Relative Time (1 clock = 25ns)",18,modPhiBins,9, modEtaBins,78,timingBins);
1601  allFedsTimingTTHistECAL_ = new TH3F("timeTTAllFEDs_ECAL","ECAL (Phi,Eta,time) for all FEDs (SM,TT binning);i#phi;i#eta;Relative Time (1 clock = 25ns)",72,ttPhiBins,35,ttEtaBins,78,timingBins);
1602  allFedsTimingLMHistECAL_ = new TH2F("timeLMAllFEDs_ECAL","ECAL (LM,time) for all FEDs (SM,LM binning);LM;Relative Time (1 clock = 25ns)",92, 1, 92,78,-7,7);
1603 
1604  allOccupancyExclusiveDT_ = new TH2F("OccupancyAllEvents_ExclusiveDT","Occupancy all events Exclusive DT;i#phi;i#eta",360,1.,361.,172,-86,86);
1605  allOccupancyCoarseExclusiveDT_ = new TH2F("OccupancyAllEventsCoarse_ExclusiveDT","Occupancy all events Coarse Exclusive DT;i#phi;i#eta",360/5,1,361.,35,ttEtaBins);
1606  allOccupancyDT_ = new TH2F("OccupancyAllEvents_DT","Occupancy all events DT;i#phi;i#eta",360,1.,361.,172,-86,86);
1607  allOccupancyCoarseDT_ = new TH2F("OccupancyAllEventsCoarse_DT","Occupancy all events Coarse DT;i#phi;i#eta",360/5,1,361.,35,ttEtaBins);
1608  allFedsTimingHistDT_ = new TH1F("timeForAllFeds_DT","timeForAllFeds DT;Relative Time (1 clock = 25ns)",78,-7,7);
1609  allFedsTimingPhiEtaHistDT_ = new TH3F("timePhiEtaAllFEDs_DT","DT (Phi,Eta,time) for all FEDs (SM,M binning);i#phi;i#eta;Relative Time (1 clock = 25ns)",18,modPhiBins,9, modEtaBins,78,timingBins);
1610  allFedsTimingTTHistDT_ = new TH3F("timeTTAllFEDs_DT","DT (Phi,Eta,time) for all FEDs (SM,TT binning);i#phi;i#eta;Relative Time (1 clock = 25ns)",72,ttPhiBins,35,ttEtaBins,78,timingBins);
1611  allFedsTimingLMHistDT_ = new TH2F("timeLMAllFEDs_DT","DT (LM,time) for all FEDs (SM,LM binning);LM;Relative Time (1 clock = 25ns)",92, 1, 92,78,-7,7);
1612 
1613  allOccupancyExclusiveRPC_ = new TH2F("OccupancyAllEvents_ExclusiveRPC","Occupancy all events Exclusive RPC;i#phi;i#eta",360,1.,361.,172,-86,86);
1614  allOccupancyCoarseExclusiveRPC_ = new TH2F("OccupancyAllEventsCoarse_ExclusiveRPC","Occupancy all events Coarse Exclusive RPC;i#phi;i#eta",360/5,1,361.,35, ttEtaBins);
1615  allOccupancyRPC_ = new TH2F("OccupancyAllEvents_RPC","Occupancy all events RPC;i#phi;i#eta",360,1.,361.,172,-86,86);
1616  allOccupancyCoarseRPC_ = new TH2F("OccupancyAllEventsCoarse_RPC","Occupancy all events Coarse RPC;i#phi;i#eta",360/5,1,361.,35, ttEtaBins);
1617  allFedsTimingHistRPC_ = new TH1F("timeForAllFeds_RPC","timeForAllFeds RPC;Relative Time (1 clock = 25ns)",78,-7,7);
1618  allFedsTimingPhiEtaHistRPC_ = new TH3F("timePhiEtaAllFEDs_RPC","RPC (Phi,Eta,time) for all FEDs (SM,M binning);i#phi;i#eta;Relative Time (1 clock = 25ns)",18,modPhiBins,9, modEtaBins,78,timingBins);
1619  allFedsTimingTTHistRPC_ = new TH3F("timeTTAllFEDs_RPC","RPC (Phi,Eta,time) for all FEDs (SM,TT binning);i#phi;i#eta;Relative Time (1 clock = 25ns)",72,ttPhiBins,35,ttEtaBins,78,timingBins);
1620  allFedsTimingLMHistRPC_ = new TH2F("timeLMAllFEDs_RPC","RPC (LM,time) for all FEDs (SM,LM binning);LM;Relative Time (1 clock = 25ns)",92, 1, 92,78,-7,7);
1621 
1622  allOccupancyExclusiveCSC_ = new TH2F("OccupancyAllEvents_ExclusiveCSC","Occupancy all events Exclusive CSC;i#phi;i#eta",360,1.,361.,172,-86,86);
1623  allOccupancyCoarseExclusiveCSC_ = new TH2F("OccupancyAllEventsCoarse_ExclusiveCSC","Occupancy all events Coarse Exclusive CSC;i#phi;i#eta",360/5,1,361.,35, ttEtaBins);
1624  allOccupancyCSC_ = new TH2F("OccupancyAllEvents_CSC","Occupancy all events CSC;i#phi;i#eta",360,1.,361.,172,-86,86);
1625  allOccupancyCoarseCSC_ = new TH2F("OccupancyAllEventsCoarse_CSC","Occupancy all events Coarse CSC;i#phi;i#eta",360/5,1,361.,35, ttEtaBins);
1626  allFedsTimingHistCSC_ = new TH1F("timeForAllFeds_CSC","timeForAllFeds CSC;Relative Time (1 clock = 25ns)",78,-7,7);
1627  allFedsTimingPhiEtaHistCSC_ = new TH3F("timePhiEtaAllFEDs_CSC","CSC (Phi,Eta,time) for all FEDs (SM,M binning);i#phi;i#eta;Relative Time (1 clock = 25ns)",18,modPhiBins,9, modEtaBins,78,timingBins);
1628  allFedsTimingTTHistCSC_ = new TH3F("timeTTAllFEDs_CSC","CSC (Phi,Eta,time) for all FEDs (SM,TT binning);i#phi;i#eta;Relative Time (1 clock = 25ns)",72,ttPhiBins,35,ttEtaBins,78,timingBins);
1629  allFedsTimingLMHistCSC_ = new TH2F("timeLMAllFEDs_CSC","CSC (LM,time) for all FEDs (SM,LM binning);LM;Relative Time (1 clock = 25ns)",92, 1, 62,78,-7,7);
1630 
1631  allOccupancyExclusiveHCAL_ = new TH2F("OccupancyAllEvents_ExclusiveHCAL","Occupancy all events Exclusive HCAL;i#phi;i#eta",360,1.,361.,172,-86,86);
1632  allOccupancyCoarseExclusiveHCAL_ = new TH2F("OccupancyAllEventsCoarse_ExclusiveHCAL","Occupancy all events Coarse Exclusive HCAL;i#phi;i#eta",360/5,1,361.,35, ttEtaBins);
1633  allOccupancyHCAL_ = new TH2F("OccupancyAllEvents_HCAL","Occupancy all events HCAL;i#phi;i#eta",360,1.,361.,172,-86,86);
1634  allOccupancyCoarseHCAL_ = new TH2F("OccupancyAllEventsCoarse_HCAL","Occupancy all events Coarse HCAL;i#phi;i#eta",360/5,1,361.,35, ttEtaBins);
1635  allFedsTimingHistHCAL_ = new TH1F("timeForAllFeds_HCAL","timeForAllFeds HCAL;Relative Time (1 clock = 25ns)",78,-7,7);
1636  allFedsTimingPhiEtaHistHCAL_ = new TH3F("timePhiEtaAllFEDs_HCAL","HCAL (Phi,Eta,time) for all FEDs (SM,M binning);i#phi;i#eta;Relative Time (1 clock = 25ns)",18,modPhiBins,9, modEtaBins,78,timingBins);
1637  allFedsTimingTTHistHCAL_ = new TH3F("timeTTAllFEDs_HCAL","HCAL (Phi,Eta,time) for all FEDs (SM,TT binning);i#phi;i#eta;Relative Time (1 clock = 25ns)",72,ttPhiBins,35,ttEtaBins,78,timingBins);
1638  allFedsTimingLMHistHCAL_ = new TH2F("timeLMAllFEDs_HCAL","HCAL (LM,time) for all FEDs (SM,LM binning);LM;Relative Time (1 clock = 25ns)",92, 1, 92,78,-7,7);
1639 
1640  TrueBCOccupancy_ = new TH2F("BCTrueOccupancyAllEvents","True SB Occupancy all events;#phi;#eta",360,-3.14159,3.14159,172,-1.5,1.5);
1641  TrueBCOccupancyCoarse_ = new TH2F("BCTrueOccupancyAllEventsCoarse","True BC Occupancy all events Coarse;#phi;#eta",360/5,-3.14159,3.14159,34,-1.5 ,1.5);
1642 
1643  numberofBCinSC_ = new TH1F("numberofBCinSC","Number of Basic Clusters in Super Cluster;Num Basic Clusters",20,0,20);//SC
1644  numberofBCinSCphi_ = new TH2F("numberofBCinSCphi","Number of Basic Clusters in Super Cluster;phi;Num Basic Clusters",360/5,-3.14159,3.14159,20,0,20);//SC
1645 
1646  allFedsTimingHistEcalMuon_ = new TH1F("timeForAllFeds_EcalMuon","timeForAllFeds Ecal+Muon;Relative Time (1 clock = 25ns)",78,-7,7);
1647 
1648  triggerHist_ = new TH1F("triggerHist","Trigger Number",5,0,5);
1649  triggerHist_->GetXaxis()->SetBinLabel(1,"ECAL");
1650  triggerHist_->GetXaxis()->SetBinLabel(2,"HCAL");
1651  triggerHist_->GetXaxis()->SetBinLabel(3,"DT");
1652  triggerHist_->GetXaxis()->SetBinLabel(4,"RPC");
1653  triggerHist_->GetXaxis()->SetBinLabel(5,"CSC");
1654 
1655  triggerExclusiveHist_ = new TH1F("triggerExclusiveHist","Trigger Number (Mutually Exclusive)",5,0,5); triggerExclusiveHist_->GetXaxis()->SetBinLabel(1,"ECAL");
1656  triggerExclusiveHist_->GetXaxis()->SetBinLabel(2,"HCAL");
1657  triggerExclusiveHist_->GetXaxis()->SetBinLabel(3,"DT");
1658  triggerExclusiveHist_->GetXaxis()->SetBinLabel(4,"RPC");
1659  triggerExclusiveHist_->GetXaxis()->SetBinLabel(5,"CSC");
1660 
1661  runNumberHist_ = new TH1F("runNumberHist","Run Number",1,0,1);
1662 
1663  deltaRHist_ = new TH1F("deltaRHist","deltaR",500,-0.5,499.5);
1664  deltaEtaHist_ = new TH1F("deltaIEtaHist","deltaIEta",170,-85.5,84.5);
1665  deltaPhiHist_ = new TH1F("deltaIPhiHist","deltaIPhi",720,-360.5,359.5);
1666  ratioAssocTracksHist_ = new TH1F("ratioAssocTracks","num assoc. tracks/tracks through Ecal",11,0,1.1);
1667  ratioAssocClustersHist_ = new TH1F("ratioAssocClusters","num assoc. clusters/total clusters",11,0,1.1);
1668  trackAssoc_muonsEcal_= new TH2F("trackAssoc_muonsEcal","Map of muon hits in Ecal", 360,1.,361.,172,-86,86);//360, 0 , 360, 170,-85 ,85);
1669  deltaEtaDeltaPhiHist_ = new TH2F("deltaEtaDeltaPhi","Delta ieta vs. delta iphi",170,-85.5,84.5,720,-360.5,359.5);
1670  seedTrackEtaHist_ = new TH2F("seedTrackEta","track ieta vs. seed ieta",170,-85.5,84.5,170,-85.5,84.5);
1671  seedTrackPhiHist_ = new TH2F("seedTrackPhi","track iphi vs. seed iphi",720,-360.5,359.5,720,-360.5,359.5);
1672 
1673  dccEventVsBxHist_ = new TH2F("dccEventVsBx","DCC Runtype vs. bunch crossing",3600,0,3600,24,0,24);
1674  dccBXErrorByFEDHist_ = new TH1F("dccBXErrorByFED","Incorrect BX number by FED",54,601,655);
1675  dccOrbitErrorByFEDHist_ = new TH1F("dccOrbitErrorByFED","Incorrect orbit number by FED",54,601,655);
1676  dccRuntypeErrorByFEDHist_ = new TH1F("dccRuntypeErrorByFED","Incorrect DCC Runtype by FED",54,601,655);
1677  dccRuntypeHist_ = new TH1F("dccRuntype","DCC Runtype frequency",24,0,24);
1678  dccErrorVsBxHist_ = new TH2F("dccErrorVsBX","DCC Errors vs. BX",3600,0,3600,3,0,3);
1679 
1680  hcalEnergy_HBHE_ = new TH1F("hcalEnergy_HBHE","RecHit Energy HBHE",440,-10,100);
1681  hcalEnergy_HF_ = new TH1F("hcalEnergy_HF","RecHit Energy HF",440,-10,100);
1682  hcalEnergy_HO_ = new TH1F("hcalEnergy_HO","RecHit Energy HO",440,-10,100);
1683  hcalHEHBecalEB_ = new TH2F("hcalHEHBecalEB","HCAL HBHE RecHit energy vs ECAL EB energy",numBins,histRangeMin_,300.0,40,-5,5);
1684 
1685  NumXtalsInClusterHist_ = new TH1F("NumXtalsInClusterAllHist","Number of Xtals in Cluster;NumXtals",150,0,150);
1686  numxtalsVsEnergy_ = new TH2F("NumXtalsVsEnergy","Number of Xtals in Cluster vs Energy;Energy (GeV);Number of Xtals in Cluster",numBins,histRangeMin_,histRangeMax_, 150,0,150);
1687  numxtalsVsHighEnergy_ = new TH2F("NumXtalsVsHighEnergy","Number of Xtals in Cluster vs Energy;Energy (GeV);Number of Xtals in Cluster",numBins,histRangeMin_,200., 150,0,150);
1688 
1689  // high energy analysis
1690  allOccupancyHighEnergy_ = new TH2F("OccupancyHighEnergyEvents","Occupancy high energy events;i#phi;i#eta",360,1.,361.,172,-86,86);
1691  allOccupancyHighEnergyCoarse_ = new TH2F("OccupancyHighEnergyEventsCoarse","Occupancy high energy events Coarse;i#phi;i#eta",72,ttPhiBins,35,ttEtaBins);
1692  allFedsOccupancyHighEnergyHist_ = new TH3F("OccupancyHighEnergyEvents3D","(Phi,Eta,energy) for all high energy events;i#phi;i#eta;energy (GeV)",18,modPhiBins,9,modEtaBins,10,highEBins);
1693  allFedsNumXtalsInClusterHist_ = new TH1F("NumActiveXtalsInClusterAllHist","Number of active Xtals in Cluster;NumXtals",100,0,100);
1694 
1695  HighEnergy_NumXtal = new TH1F("HighEnergy_NumXtal","Num crystals in high E clusters;num crystals",150,0,150);
1696  HighEnergy_NumXtalFedId = new TH2F("HighEnergy_NumXtalFedId","Num crystals in cluster vs FedId;FedId;num crystals",36,610.,645.,150,0,150);
1697  HighEnergy_NumXtaliphi = new TH2F("HighEnergy_NumXtaliphi","Num crystals in cluster vs iphi;i#phi;num crystals",360,1.,361.,150,0,150);
1698  HighEnergy_energy3D = new TH3F("HighEnergy_energy3D","(Phi,Eta,energy) for all high energy events;i#phi;i#eta;energy (GeV)",72,ttPhiBins,35,ttEtaBins,10,highEBins);
1699 
1700  HighEnergy_energyNumXtal = new TH2F("HighEnergy_energyNumXtal","Energy in cluster vs Num crystals in cluster;num crystals;energy",150,0,150,200,0.,200.);
1701 
1702  HighEnergy_bestSeed = new TH1F("HighEnergy_bestSeedEnergy","BestSeed Energy from TrackAss",200,0.,200.);
1703  HighEnergy_bestSeedOccupancy = new TH2F("HighEnergy_bestSeedOccupancy","Occupancy HighEn events from TrackAss;i#phi;i#eta",360,1.,361.,172,-86,86);
1704 
1705  HighEnergy_numClusHighEn = new TH1F("HighEnergy_numClusHighEn","Num High Energy Clusters",7,0,7);
1706  HighEnergy_ratioClusters = new TH1F("HighEnergy_ratioClusters","Num High Energy Clusters/Num tot Clusters",100,0.,1.1);
1707 
1708  HighEnergy_numRecoTrackBarrel = new TH1F("HighEnergy_numRecoTracksBarrel","Num BarrelRecoTracks",10,0,10);
1709  HighEnergy_TracksAngle = new TH1F("HighEnergy_TracksAngle","Angle between tracks",720,0.,180.);
1710  HighEnergy_TracksAngleTopBottom = new TH1F("HighEnergy_TopBottomTracksAngle","Angle between top-bottom tracks",720,0.,180.);
1711 
1712  HighEnergy_2GeV_occuCoarse = new TH2F("HighEnergy_occu2GeV_Coarse","Occupancy high energy events with more than 2 GeV;i#phi;i#eta",72,ttPhiBins,35,ttEtaBins);
1713  HighEnergy_2GeV_occu3D = new TH3F("HighEnergy_2GeV_energy3D","(iphi,ieta,energy) for all high energy events w > 10 GeV;i#phi;i#eta;energy (GeV)",72,ttPhiBins,35,ttEtaBins,10,highEBins);
1714  HighEnergy_100GeV_occuCoarse = new TH2F("HighEnergy_occu100GeV_Coarse","Occupancy high energy events with more than 100 GeV;i#phi;i#eta",72,ttPhiBins,35,ttEtaBins);
1715  HighEnergy_100GeV_occu3D = new TH3F("HighEnergy_100GeV_energy3D","(iphi,ieta,energy) for all high energy events more than 100 GeV;i#phi;i#eta;energy (GeV)",72,ttPhiBins,35,ttEtaBins,10,highEBins);
1716  HighEnergy_0tracks_occu3D = new TH3F("HighEnergy_0Tracks_energy3D","(iphi,ieta,energy) for all events with 0 tracks;i#phi;i#eta;energy (GeV)",72,ttPhiBins,35,ttEtaBins,10,highEBins);
1717  HighEnergy_1tracks_occu3D = new TH3F("HighEnergy_1Tracks_energy3D","(iphi,ieta,energy) for all events with 1 tracks;i#phi;i#eta;energy (GeV)",72,ttPhiBins,35,ttEtaBins,10,highEBins);
1718  HighEnergy_2tracks_occu3D = new TH3F("HighEnergy_2Tracks_energy3D","(iphi,ieta,energy) for all events with 2 tracks;i#phi;i#eta;energy (GeV)",72,ttPhiBins,35,ttEtaBins,10,highEBins);
1719  HighEnergy_0tracks_occu3DXtal = new TH3F("HighEnergy_0Tracks_energy3DXtal","(iphi,ieta,energy) for all events with 0 tracks;i#phi;i#eta;energy (GeV)",360,1.,361.,172,-86,86,200,0.,200.);
1720  HighEnergy_1tracks_occu3DXtal = new TH3F("HighEnergy_1Tracks_energy3DXtal","(iphi,ieta,energy) for all events with 1 tracks;i#phi;i#eta;energy (GeV)",360,1.,361.,172,-86,86,200,0.,200.);
1721  HighEnergy_2tracks_occu3DXtal = new TH3F("HighEnergy_2Tracks_energy3DXtal","(iphi,ieta,energy) for all events with 2 tracks;i#phi;i#eta;energy (GeV)",360,1.,361.,172,-86,86,200,0.,200.);
1722 
1723  //EE histograms
1724 
1725  // EE-
1726  EEM_FedsSeedEnergyHist_ = new TH1F("SeedEnergyAllFEDs","Seed Energy for EEM Feds; Seed Energy (GeV)",200,histRangeMin_,10.0);
1727 
1728  EEM_AllOccupancyCoarse_ = new TH2F("OccupancyAllEventsCoarse","Occupancy all events Coarse EEM;ix;iy",20,0,100,20,0,100);
1729  EEM_AllOccupancy_ = new TH2F("OccupancyAllEvents","Occupancy all events EEM;ix;iy",100,0,100,100,0,100);
1730  EEM_FedsenergyHist_ = new TH1F("energy_AllClusters","energy_AllClusters_EEM;Cluster Energy (GeV)",numBins,histRangeMin_,10.0);
1731  EEM_FedsenergyHighHist_ = new TH1F("energyHigh_AllClusters","energyHigh_AllClusters in EEM;Cluster Energy (GeV)",numBins,histRangeMin_,200.0);
1732  EEM_FedsenergyOnlyHighHist_ = new TH1F("energyHigh_HighEnergyClusters","energy of High Energy Clusters in EEM;Cluster Energy (GeV)",numBins,histRangeMin_,200.0);
1733  EEM_FedsE2Hist_ = new TH1F("E2_AllClusters","E2_AllClusters_EEM;Seed+highest neighbor energy (GeV)",numBins,histRangeMin_,10.0);
1734  EEM_FedsE2vsE1Hist_ = new TH2F("E2vsE1_AllClusters","E2vsE1_AllClusters_EEM;Seed Energy (GeV);Seed+highest neighbor energy (GeV)",numBins,histRangeMin_,10.0,numBins,histRangeMin_,10.0);
1735  EEM_FedsenergyvsE1Hist_ = new TH2F("energyvsE1_AllClusters","energyvsE1_AllClusters_EEM;Seed Energy (GeV);Energy(GeV)",numBins,histRangeMin_,10.0,numBins,histRangeMin_,10.0);
1736  EEM_FedsTimingHist_ = new TH1F("timeForAllFeds","timeForAllFeds_EEM;Relative Time (1 clock = 25ns)",78,-7,7);
1737  EEM_numberofCosmicsHist_ = new TH1F("numberofCosmicsPerEvent","Number of cosmics per event EEM;Number of Cosmics",30,0,30);
1738 
1739  EEM_FedsTimingVsAmpHist_ = new TH2F("timeVsAmpAllEvents","time Vs Amp All Events EEM;Relative Time (1 clock = 25ns);Amplitude (GeV)",78,-7,7,numBins,histRangeMin_,10.0);
1740  EEM_FedsTimingTTHist_ = new TH3F("timeTTAllFEDs","(ix,iy,time) for all FEDs (SM,TT binning) EEM;ix;iy;Relative Time (1 clock = 25ns)",20,0,100,20,0,100,78,-7,7);
1741 
1742  EEM_OccupancySingleXtal_ = new TH2F("OccupancySingleXtal","Occupancy single xtal clusters EEM;ix;iy",100,0,100,100,0,100);
1743  EEM_energySingleXtalHist_ = new TH1F("energy_SingleXtalClusters","Energy single xtal clusters EEM;Cluster Energy (GeV)",numBins,histRangeMin_,200.0);
1744 
1745  EEM_OccupancyExclusiveECAL_ = new TH2F("OccupancyAllEvents_ExclusiveECAL","Occupancy all events Exclusive ECAL EEM;ix;iy",100,0,100,100,0,100);
1746  EEM_OccupancyCoarseExclusiveECAL_ = new TH2F("OccupancyAllEventsCoarse_ExclusiveECAL","Occupancy all events Coarse Exclusive ECAL EEM;ix;iy",20,0,100,20,0,100);
1747  EEM_OccupancyECAL_ = new TH2F("OccupancyAllEvents_ECAL","Occupancy all events ECAL EEM;ix;iy",100,0,100,100,0,100);
1748  EEM_OccupancyCoarseECAL_ = new TH2F("OccupancyAllEventsCoarse_ECAL","Occupancy all events Coarse ECAL EEM;ix;iy",20,0,100,20,0,100);
1749  EEM_FedsTimingHistECAL_ = new TH1F("timeForAllFeds_ECAL","timeForAllFeds ECAL EEM;Relative Time (1 clock = 25ns)",78,-7,7);
1750  EEM_FedsTimingTTHistECAL_ = new TH3F("timeTTAllFEDs_ECAL","(ix,iy,time) for all FEDs (SM,TT binning) ECAL EEM;ix;iy;Relative Time (1 clock = 25ns)",20,0,100,20,0,100,78,-7,7);
1751 
1752  EEM_OccupancyExclusiveDT_ = new TH2F("OccupancyAllEvents_ExclusiveDT","Occupancy all events Exclusive DT EEM;ix;iy",100,0,100,100,0,100);
1753  EEM_OccupancyCoarseExclusiveDT_ = new TH2F("OccupancyAllEventsCoarse_ExclusiveDT","Occupancy all events Coarse Exclusive DT EEM;ix;iy",20,0,100,20,0,100);
1754  EEM_OccupancyDT_ = new TH2F("OccupancyAllEvents_DT","Occupancy all events DT EEM;ix;iy",100,0,100,100,0,100);
1755  EEM_OccupancyCoarseDT_ = new TH2F("OccupancyAllEventsCoarse_DT","Occupancy all events Coarse DT EEM;ix;iy",20,0,100,20,0,100);
1756  EEM_FedsTimingHistDT_ = new TH1F("timeForAllFeds_DT","timeForAllFeds DT EEM;Relative Time (1 clock = 25ns)",78,-7,7);
1757  EEM_FedsTimingTTHistDT_ = new TH3F("timeTTAllFEDs_DT","(ix,iy,time) for all FEDs (SM,TT binning) DT EEM;ix;iy;Relative Time (1 clock = 25ns)",20,0,100,20,0,100,78,-7,7);
1758 
1759  EEM_OccupancyExclusiveRPC_ = new TH2F("OccupancyAllEvents_ExclusiveRPC","Occupancy all events Exclusive RPC EEM;ix;iy",100,0,100,100,0,100);
1760  EEM_OccupancyCoarseExclusiveRPC_ = new TH2F("OccupancyAllEventsCoarse_ExclusiveRPC","Occupancy all events Coarse Exclusive RPC EEM;ix;iy",20,0,100,20,0,100);
1761  EEM_OccupancyRPC_ = new TH2F("OccupancyAllEvents_RPC","Occupancy all events RPC EEM;ix;iy",100,0,100,100,0,100);
1762  EEM_OccupancyCoarseRPC_ = new TH2F("OccupancyAllEventsCoarse_RPC","Occupancy all events Coarse RPC EEM;ix;iy",20,0,100,20,0,100);
1763  EEM_FedsTimingHistRPC_ = new TH1F("timeForAllFeds_RPC","timeForAllFeds RPC EEM;Relative Time (1 clock = 25ns)",78,-7,7);
1764  EEM_FedsTimingTTHistRPC_ = new TH3F("timeTTAllFEDs_RPC","(ix,iy,time) for all FEDs (SM,TT binning) RPC EEM;ix;iy;Relative Time (1 clock = 25ns)",20,0,100,20,0,100,78,-7,7);
1765 
1766  EEM_OccupancyExclusiveCSC_ = new TH2F("OccupancyAllEvents_ExclusiveCSC","Occupancy all events Exclusive CSC EEM;ix;iy",100,0,100,100,0,100);
1767  EEM_OccupancyCoarseExclusiveCSC_ = new TH2F("OccupancyAllEventsCoarse_ExclusiveCSC","Occupancy all events Coarse Exclusive CSC EEM;ix;iy",20,0,100,20,0,100);
1768  EEM_OccupancyCSC_ = new TH2F("OccupancyAllEvents_CSC","Occupancy all events CSC EEM;ix;iy",100,0,100,100,0,100);
1769  EEM_OccupancyCoarseCSC_ = new TH2F("OccupancyAllEventsCoarse_CSC","Occupancy all events Coarse CSC EEM;ix;iy",20,0,100,20,0,100);
1770  EEM_FedsTimingHistCSC_ = new TH1F("timeForAllFeds_CSC","timeForAllFeds CSC EEM;Relative Time (1 clock = 25ns)",78,-7,7);
1771  EEM_FedsTimingTTHistCSC_ = new TH3F("timeTTAllFEDs_CSC","(ix,iy,time) for all FEDs (SM,TT binning) CSC EEM;ix;iy;Relative Time (1 clock = 25ns)",20,0,100,20,0,100,78,-7,7);
1772 
1773  EEM_OccupancyExclusiveHCAL_ = new TH2F("OccupancyAllEvents_ExclusiveHCAL","Occupancy all events Exclusive HCAL EEM;ix;iy",100,0,100,100,0,100);
1774  EEM_OccupancyCoarseExclusiveHCAL_ = new TH2F("OccupancyAllEventsCoarse_ExclusiveHCAL","Occupancy all events Coarse Exclusive HCAL EEM;ix;iy",20,0,100,20,0,100);
1775  EEM_OccupancyHCAL_ = new TH2F("OccupancyAllEvents_HCAL","Occupancy all events HCAL EEM;ix;iy",100,0,100,100,0,100);
1776  EEM_OccupancyCoarseHCAL_ = new TH2F("OccupancyAllEventsCoarse_HCAL","Occupancy all events Coarse HCAL EEM;ix;iy",20,0,100,20,0,100);
1777  EEM_FedsTimingHistHCAL_ = new TH1F("timeForAllFeds_HCAL","timeForAllFeds HCAL EEM;Relative Time (1 clock = 25ns)",78,-7,7);
1778  EEM_FedsTimingTTHistHCAL_ = new TH3F("timeTTAllFEDs_HCAL","(ix,iy,time) for all FEDs (SM,TT binning) HCAL EEM;ix;iy;Relative Time (1 clock = 25ns)",20,0,100,20,0,100,78,-7,7);
1779 
1780  EEM_numberofBCinSC_ = new TH1F("numberofBCinSC","Number of Basic Clusters in Super Cluster EEM;Num Basic Clusters",20,0,20);
1781 
1782  EEM_triggerHist_ = new TH1F("triggerHist","Trigger Number EEM",5,0,5);
1783  EEM_triggerHist_->GetXaxis()->SetBinLabel(1,"ECAL");
1784  EEM_triggerHist_->GetXaxis()->SetBinLabel(2,"HCAL");
1785  EEM_triggerHist_->GetXaxis()->SetBinLabel(3,"DT");
1786  EEM_triggerHist_->GetXaxis()->SetBinLabel(4,"RPC");
1787  EEM_triggerHist_->GetXaxis()->SetBinLabel(5,"CSC");
1788 
1789  EEM_triggerExclusiveHist_ = new TH1F("triggerExclusiveHist","Trigger Number (Mutually Exclusive) EEM",5,0,5); triggerExclusiveHist_->GetXaxis()->SetBinLabel(1,"ECAL");
1790  EEM_triggerExclusiveHist_->GetXaxis()->SetBinLabel(2,"HCAL");
1791  EEM_triggerExclusiveHist_->GetXaxis()->SetBinLabel(3,"DT");
1792  EEM_triggerExclusiveHist_->GetXaxis()->SetBinLabel(4,"RPC");
1793  EEM_triggerExclusiveHist_->GetXaxis()->SetBinLabel(5,"CSC");
1794 
1795  EEM_NumXtalsInClusterHist_ = new TH1F("NumXtalsInClusterAllHist","Number of Xtals in Cluster EEM;NumXtals",150,0,150);
1796  EEM_numxtalsVsEnergy_ = new TH2F("NumXtalsVsEnergy","Number of Xtals in Cluster vs Energy EEM;Energy (GeV);Number of Xtals in Cluster",numBins,histRangeMin_,10.0, 150,0,150);
1797  EEM_numxtalsVsHighEnergy_ = new TH2F("NumXtalsVsHighEnergy","Number of Xtals in Cluster vs Energy EEM;Energy (GeV);Number of Xtals in Cluster",numBins,histRangeMin_,200., 150,0,150);
1798 
1799  EEM_OccupancyHighEnergy_ = new TH2F("OccupancyHighEnergyEvents","Occupancy high energy events EEM;ix;iy",100,0,100,100,0,100);
1800  EEM_OccupancyHighEnergyCoarse_ = new TH2F("OccupancyHighEnergyEventsCoarse","Occupancy high energy events Coarse EEM;ix;iy",20,0,100,20,0,100);
1801 
1802  EEM_FedsNumXtalsInClusterHist_ = new TH1F("NumActiveXtalsInClusterAllHist","Number of active Xtals in Cluster EEM;NumXtals",100,0,100);
1803 
1804 
1805  // EE+
1806  EEP_FedsSeedEnergyHist_ = new TH1F("SeedEnergyAllFEDs","Seed Energy for EEP Feds; Seed Energy (GeV)",200,histRangeMin_,10.0);
1807 
1808  EEP_AllOccupancyCoarse_ = new TH2F("OccupancyAllEventsCoarse","Occupancy all events Coarse EEP;ix;iy",20,0,100,20,0,100);
1809  EEP_AllOccupancy_ = new TH2F("OccupancyAllEvents","Occupancy all events EEP;ix;iy",100,0,100,100,0,100);
1810  EEP_FedsenergyHist_ = new TH1F("energy_AllClusters","energy_AllClusters_EEP;Cluster Energy (GeV)",numBins,histRangeMin_,10.0);
1811  EEP_FedsenergyHighHist_ = new TH1F("energyHigh_AllClusters","energyHigh_AllClusters in EEP;Cluster Energy (GeV)",numBins,histRangeMin_,200.0);
1812  EEP_FedsenergyOnlyHighHist_ = new TH1F("energyHigh_HighEnergyClusters","energy of High Energy Clusters in EEP;Cluster Energy (GeV)",numBins,histRangeMin_,200.0);
1813  EEP_FedsE2Hist_ = new TH1F("E2_AllClusters","E2_AllClusters_EEP;Seed+highest neighbor energy (GeV)",numBins,histRangeMin_,10.0);
1814  EEP_FedsE2vsE1Hist_ = new TH2F("E2vsE1_AllClusters","E2vsE1_AllClusters_EEP;Seed Energy (GeV);Seed+highest neighbor energy (GeV)",numBins,histRangeMin_,10.0,numBins,histRangeMin_,10.0);
1815  EEP_FedsenergyvsE1Hist_ = new TH2F("energyvsE1_AllClusters","energyvsE1_AllClusters_EEP;Seed Energy (GeV);Energy(GeV)",numBins,histRangeMin_,10.0,numBins,histRangeMin_,10.0);
1816  EEP_FedsTimingHist_ = new TH1F("timeForAllFeds","timeForAllFeds_EEP;Relative Time (1 clock = 25ns)",78,-7,7);
1817  EEP_numberofCosmicsHist_ = new TH1F("numberofCosmicsPerEvent","Number of cosmics per event EEP;Number of Cosmics",30,0,30);
1818 
1819  EEP_FedsTimingVsAmpHist_ = new TH2F("timeVsAmpAllEvents","time Vs Amp All Events EEP;Relative Time (1 clock = 25ns);Amplitude (GeV)",78,-7,7,numBins,histRangeMin_,10.0);
1820  EEP_FedsTimingTTHist_ = new TH3F("timeTTAllFEDs","(ix,iy,time) for all FEDs (SM,TT binning) EEP;ix;iy;Relative Time (1 clock = 25ns)",20,0,100,20,0,100,78,-7,7);
1821 
1822  EEP_OccupancySingleXtal_ = new TH2F("OccupancySingleXtal","Occupancy single xtal clusters EEP;ix;iy",100,0,100,100,0,100);
1823  EEP_energySingleXtalHist_ = new TH1F("energy_SingleXtalClusters","Energy single xtal clusters EEP;Cluster Energy (GeV)",numBins,histRangeMin_,200.0);
1824 
1825  EEP_OccupancyExclusiveECAL_ = new TH2F("OccupancyAllEvents_ExclusiveECAL","Occupancy all events Exclusive ECAL EEP;ix;iy",100,0,100,100,0,100);
1826  EEP_OccupancyCoarseExclusiveECAL_ = new TH2F("OccupancyAllEventsCoarse_ExclusiveECAL","Occupancy all events Coarse Exclusive ECAL EEP;ix;iy",20,0,100,20,0,100);
1827  EEP_OccupancyECAL_ = new TH2F("OccupancyAllEvents_ECAL","Occupancy all events ECAL EEP;ix;iy",100,0,100,100,0,100);
1828  EEP_OccupancyCoarseECAL_ = new TH2F("OccupancyAllEventsCoarse_ECAL","Occupancy all events Coarse ECAL EEP;ix;iy",20,0,100,20,0,100);
1829  EEP_FedsTimingHistECAL_ = new TH1F("timeForAllFeds_ECAL","timeForAllFeds ECAL EEP;Relative Time (1 clock = 25ns)",78,-7,7);
1830  EEP_FedsTimingTTHistECAL_ = new TH3F("timeTTAllFEDs_ECAL","(ix,iy,time) for all FEDs (SM,TT binning) ECAL EEP;ix;iy;Relative Time (1 clock = 25ns)",20,0,100,20,0,100,78,-7,7);
1831 
1832  EEP_OccupancyExclusiveDT_ = new TH2F("OccupancyAllEvents_ExclusiveDT","Occupancy all events Exclusive DT EEP;ix;iy",100,0,100,100,0,100);
1833  EEP_OccupancyCoarseExclusiveDT_ = new TH2F("OccupancyAllEventsCoarse_ExclusiveDT","Occupancy all events Coarse Exclusive DT EEP;ix;iy",20,0,100,20,0,100);
1834  EEP_OccupancyDT_ = new TH2F("OccupancyAllEvents_DT","Occupancy all events DT EEP;ix;iy",100,0,100,100,0,100);
1835  EEP_OccupancyCoarseDT_ = new TH2F("OccupancyAllEventsCoarse_DT","Occupancy all events Coarse DT EEP;ix;iy",20,0,100,20,0,100);
1836  EEP_FedsTimingHistDT_ = new TH1F("timeForAllFeds_DT","timeForAllFeds DT EEP;Relative Time (1 clock = 25ns)",78,-7,7);
1837  EEP_FedsTimingTTHistDT_ = new TH3F("timeTTAllFEDs_DT","(ix,iy,time) for all FEDs (SM,TT binning) DT EEP;ix;iy;Relative Time (1 clock = 25ns)",20,0,100,20,0,100,78,-7,7);
1838 
1839  EEP_OccupancyExclusiveRPC_ = new TH2F("OccupancyAllEvents_ExclusiveRPC","Occupancy all events Exclusive RPC EEP;ix;iy",100,0,100,100,0,100);
1840  EEP_OccupancyCoarseExclusiveRPC_ = new TH2F("OccupancyAllEventsCoarse_ExclusiveRPC","Occupancy all events Coarse Exclusive RPC EEP;ix;iy",20,0,100,20,0,100);
1841  EEP_OccupancyRPC_ = new TH2F("OccupancyAllEvents_RPC","Occupancy all events RPC EEP;ix;iy",100,0,100,100,0,100);
1842  EEP_OccupancyCoarseRPC_ = new TH2F("OccupancyAllEventsCoarse_RPC","Occupancy all events Coarse RPC EEP;ix;iy",20,0,100,20,0,100);
1843  EEP_FedsTimingHistRPC_ = new TH1F("timeForAllFeds_RPC","timeForAllFeds RPC EEP;Relative Time (1 clock = 25ns)",78,-7,7);
1844  EEP_FedsTimingTTHistRPC_ = new TH3F("timeTTAllFEDs_RPC","(ix,iy,time) for all FEDs (SM,TT binning) RPC EEP;ix;iy;Relative Time (1 clock = 25ns)",20,0,100,20,0,100,78,-7,7);
1845 
1846  EEP_OccupancyExclusiveCSC_ = new TH2F("OccupancyAllEvents_ExclusiveCSC","Occupancy all events Exclusive CSC EEP;ix;iy",100,0,100,100,0,100);
1847  EEP_OccupancyCoarseExclusiveCSC_ = new TH2F("OccupancyAllEventsCoarse_ExclusiveCSC","Occupancy all events Coarse Exclusive CSC EEP;ix;iy",20,0,100,20,0,100);
1848  EEP_OccupancyCSC_ = new TH2F("OccupancyAllEvents_CSC","Occupancy all events CSC EEP;ix;iy",100,0,100,100,0,100);
1849  EEP_OccupancyCoarseCSC_ = new TH2F("OccupancyAllEventsCoarse_CSC","Occupancy all events Coarse CSC EEP;ix;iy",20,0,100,20,0,100);
1850  EEP_FedsTimingHistCSC_ = new TH1F("timeForAllFeds_CSC","timeForAllFeds CSC EEP;Relative Time (1 clock = 25ns)",78,-7,7);
1851  EEP_FedsTimingTTHistCSC_ = new TH3F("timeTTAllFEDs_CSC","(ix,iy,time) for all FEDs (SM,TT binning) CSC EEP;ix;iy;Relative Time (1 clock = 25ns)",20,0,100,20,0,100,78,-7,7);
1852 
1853  EEP_OccupancyExclusiveHCAL_ = new TH2F("OccupancyAllEvents_ExclusiveHCAL","Occupancy all events Exclusive HCAL EEP;ix;iy",100,0,100,100,0,100);
1854  EEP_OccupancyCoarseExclusiveHCAL_ = new TH2F("OccupancyAllEventsCoarse_ExclusiveHCAL","Occupancy all events Coarse Exclusive HCAL EEP;ix;iy",20,0,100,20,0,100);
1855  EEP_OccupancyHCAL_ = new TH2F("OccupancyAllEvents_HCAL","Occupancy all events HCAL EEP;ix;iy",100,0,100,100,0,100);
1856  EEP_OccupancyCoarseHCAL_ = new TH2F("OccupancyAllEventsCoarse_HCAL","Occupancy all events Coarse HCAL EEP;ix;iy",20,0,100,20,0,100);
1857  EEP_FedsTimingHistHCAL_ = new TH1F("timeForAllFeds_HCAL","timeForAllFeds HCAL EEP;Relative Time (1 clock = 25ns)",78,-7,7);
1858  EEP_FedsTimingTTHistHCAL_ = new TH3F("timeTTAllFEDs_HCAL","(ix,iy,time) for all FEDs (SM,TT binning) HCAL EEP;ix;iy;Relative Time (1 clock = 25ns)",20,0,100,20,0,100,78,-7,7);
1859 
1860  EEP_numberofBCinSC_ = new TH1F("numberofBCinSC","Number of Basic Clusters in Super Cluster EEP;Num Basic Clusters",20,0,20);
1861 
1862  EEP_triggerHist_ = new TH1F("triggerHist","Trigger Number EEP",5,0,5);
1863  EEP_triggerHist_->GetXaxis()->SetBinLabel(1,"ECAL");
1864  EEP_triggerHist_->GetXaxis()->SetBinLabel(2,"HCAL");
1865  EEP_triggerHist_->GetXaxis()->SetBinLabel(3,"DT");
1866  EEP_triggerHist_->GetXaxis()->SetBinLabel(4,"RPC");
1867  EEP_triggerHist_->GetXaxis()->SetBinLabel(5,"CSC");
1868 
1869  EEP_triggerExclusiveHist_ = new TH1F("triggerExclusiveHist","Trigger Number (Mutually Exclusive) EEP",5,0,5);
1870  EEP_triggerExclusiveHist_->GetXaxis()->SetBinLabel(1,"ECAL");
1871  EEP_triggerExclusiveHist_->GetXaxis()->SetBinLabel(2,"HCAL");
1872  EEP_triggerExclusiveHist_->GetXaxis()->SetBinLabel(3,"DT");
1873  EEP_triggerExclusiveHist_->GetXaxis()->SetBinLabel(4,"RPC");
1874  EEP_triggerExclusiveHist_->GetXaxis()->SetBinLabel(5,"CSC");
1875 
1876  EEP_NumXtalsInClusterHist_ = new TH1F("NumXtalsInClusterAllHist","Number of Xtals in Cluster EEP;NumXtals",150,0,150);
1877  EEP_numxtalsVsEnergy_ = new TH2F("NumXtalsVsEnergy","Number of Xtals in Cluster vs Energy EEP;Energy (GeV);Number of Xtals in Cluster",numBins,histRangeMin_,10.0, 150,0,150);
1878  EEP_numxtalsVsHighEnergy_ = new TH2F("NumXtalsVsHighEnergy","Number of Xtals in Cluster vs Energy EEP;Energy (GeV);Number of Xtals in Cluster",numBins,histRangeMin_,200., 150,0,150);
1879 
1880  EEP_OccupancyHighEnergy_ = new TH2F("OccupancyHighEnergyEvents","Occupancy high energy events EEP;ix;iy",100,0,100,100,0,100);
1881  EEP_OccupancyHighEnergyCoarse_ = new TH2F("OccupancyHighEnergyEventsCoarse","Occupancy high energy events Coarse EEP;ix;iy",20,0,100,20,0,100);
1882 
1883  EEP_FedsNumXtalsInClusterHist_ = new TH1F("NumActiveXtalsInClusterAllHist","Number of active Xtals in Cluster EEP;NumXtals",100,0,100);
1884 
1885 
1886 }
1887 
1888 // ------------ method called once each job just after ending the event loop ------------
1889 void
1891 {
1892  using namespace std;
1893  if (runInFileName_) {
1894  fileName_ += "-"+intToString(runNum_)+".graph.root";
1895  } else {
1896  fileName_ += ".root";
1897  }
1898 
1899  TFile root_file_(fileName_.c_str() , "RECREATE");
1900 
1901  for(map<int,TH1F*>::const_iterator itr = FEDsAndHists_.begin();
1902  itr != FEDsAndHists_.end(); ++itr) {
1903  string dir = fedMap_->getSliceFromFed(itr->first);
1904  TDirectory* FEDdir = gDirectory->mkdir(dir.c_str());
1905  FEDdir->cd();
1906 
1907  TH1F* hist = itr->second;
1908  if(hist!=0)
1909  hist->Write();
1910  else {
1911  cerr << "EcalCosmicsHists: Error: This shouldn't happen!" << endl;
1912  }
1913  // Write out timing hist
1914  hist = FEDsAndTimingHists_[itr->first];
1915  if(hist!=0)
1916  hist->Write();
1917  else {
1918  cerr << "EcalCosmicsHists: Error: This shouldn't happen!" << endl;
1919  }
1920 
1921  hist = FEDsAndFrequencyHists_[itr->first];
1922  hist->Write();
1923 
1924  hist = FEDsAndiPhiProfileHists_[itr->first];
1925  hist->Write();
1926 
1927  hist = FEDsAndiEtaProfileHists_[itr->first];
1928  hist->Write();
1929 
1930  hist = FEDsAndE2Hists_[itr->first];
1931  hist->Write();
1932 
1933  hist = FEDsAndenergyHists_[itr->first];
1934  hist->Write();
1935 
1936  hist = FEDsAndNumXtalsInClusterHists_[itr->first];
1937  hist->Write();
1938 
1939  TH2F* hist2 = FEDsAndTimingVsAmpHists_[itr->first];
1940  hist2->Write();
1941 
1942  hist2 = FEDsAndTimingVsFreqHists_[itr->first];
1943  hist2->Write();
1944 
1945  hist2 = FEDsAndE2vsE1Hists_[itr->first];
1946  hist2->Write();
1947 
1948  hist2 = FEDsAndenergyvsE1Hists_[itr->first];
1949  hist2->Write();
1950 
1951  hist2 = FEDsAndOccupancyHists_[itr->first];
1952  hist2->Write();
1953 
1954  hist2 = FEDsAndTimingVsPhiHists_[itr->first];
1955  hist2->Write();
1956 
1957  hist2 = FEDsAndTimingVsModuleHists_[itr->first];
1958  hist2->Write();
1959 
1960  //2d hist
1961  map<int,TH2F*>::const_iterator itr2d;
1962  itr2d = FEDsAndDCCRuntypeVsBxHists_.find(itr->first);
1963  if(itr2d != FEDsAndDCCRuntypeVsBxHists_.end())
1964  {
1965  TH2F* hist2 = itr2d->second;
1966  hist2->GetYaxis()->SetBinLabel(1,"COSMIC");
1967  hist2->GetYaxis()->SetBinLabel(2,"BEAMH4");
1968  hist2->GetYaxis()->SetBinLabel(3,"BEAMH2");
1969  hist2->GetYaxis()->SetBinLabel(4,"MTCC");
1970  hist2->GetYaxis()->SetBinLabel(5,"LASER_STD");
1971  hist2->GetYaxis()->SetBinLabel(6,"LASER_POWER_SCAN");
1972  hist2->GetYaxis()->SetBinLabel(7,"LASER_DELAY_SCAN");
1973  hist2->GetYaxis()->SetBinLabel(8,"TESTPULSE_SCAN_MEM");
1974  hist2->GetYaxis()->SetBinLabel(9,"TESTPULSE_MGPA");
1975  hist2->GetYaxis()->SetBinLabel(10,"PEDESTAL_STD");
1976  hist2->GetYaxis()->SetBinLabel(11,"PEDESTAL_OFFSET_SCAN");
1977  hist2->GetYaxis()->SetBinLabel(12,"PEDESTAL_25NS_SCAN");
1978  hist2->GetYaxis()->SetBinLabel(13,"LED_STD");
1979  hist2->GetYaxis()->SetBinLabel(14,"PHYSICS_GLOBAL");
1980  hist2->GetYaxis()->SetBinLabel(15,"COSMICS_GLOBAL");
1981  hist2->GetYaxis()->SetBinLabel(16,"HALO_GLOBAL");
1982  hist2->GetYaxis()->SetBinLabel(17,"LASER_GAP");
1983  hist2->GetYaxis()->SetBinLabel(18,"TESTPULSE_GAP");
1984  hist2->GetYaxis()->SetBinLabel(19,"PEDESTAL_GAP");
1985  hist2->GetYaxis()->SetBinLabel(20,"LED_GAP");
1986  hist2->GetYaxis()->SetBinLabel(21,"PHYSICS_LOCAL");
1987  hist2->GetYaxis()->SetBinLabel(22,"COSMICS_LOCAL");
1988  hist2->GetYaxis()->SetBinLabel(23,"HALO_LOCAL");
1989  hist2->GetYaxis()->SetBinLabel(24,"CALIB_LOCAL");
1990  hist2->Write();
1991  }
1992 
1993  root_file_.cd();
1994  }
1995  allFedsHist_->Write();
1996  allFedsE2Hist_->Write();
1997  allFedsenergyHist_->Write();
1998  allFedsenergyHighHist_->Write();
1999  allFedsenergyOnlyHighHist_->Write();
2000  allFedsE2vsE1Hist_->Write();
2001  allFedsenergyvsE1Hist_->Write();
2002  allFedsTimingHist_->Write();
2003  allFedsTimingVsAmpHist_->Write();
2004  allFedsFrequencyHist_->Write();
2005  allFedsTimingVsFreqHist_->Write();
2006  allFedsiEtaProfileHist_->Write();
2007  allFedsiPhiProfileHist_->Write();
2008  allOccupancy_->Write();
2009  TrueOccupancy_->Write();
2010  allOccupancyCoarse_->Write();
2011  TrueOccupancyCoarse_->Write();
2012  allOccupancyHighEnergy_->Write();
2014  allOccupancySingleXtal_->Write();
2015  energySingleXtalHist_->Write();
2017  allFedsTimingPhiHist_->Write();
2018  allFedsTimingPhiEbpHist_->Write();
2019  allFedsTimingPhiEbmHist_->Write();
2020  allFedsTimingEbpHist_->Write();
2021  allFedsTimingEbmHist_->Write();
2022  allFedsTimingEbpTopHist_->Write();
2023  allFedsTimingEbmTopHist_->Write();
2024  allFedsTimingEbpBottomHist_->Write();
2025  allFedsTimingEbmBottomHist_->Write();
2026  allFedsTimingPhiEtaHist_->Write();
2027  allFedsTimingTTHist_->Write();
2028  allFedsTimingLMHist_->Write();
2030 
2031  numberofBCinSC_->Write();//SC
2032  numberofBCinSCphi_->Write();//SC
2033  TrueBCOccupancyCoarse_->Write();//BC
2034  TrueBCOccupancy_->Write(); //BC
2035 
2036  numxtalsVsEnergy_->Write();
2037  numxtalsVsHighEnergy_->Write();
2038 
2039  allOccupancyExclusiveECAL_->Write();
2041  allOccupancyECAL_->Write();
2042  allOccupancyCoarseECAL_->Write();
2044  allFedsTimingHistECAL_->Write();
2045  allFedsTimingTTHistECAL_->Write();
2046  allFedsTimingLMHistECAL_->Write();
2047 
2048  allOccupancyExclusiveHCAL_->Write();
2050  allOccupancyHCAL_->Write();
2051  allOccupancyCoarseHCAL_->Write();
2053  allFedsTimingHistHCAL_->Write();
2054  allFedsTimingTTHistHCAL_->Write();
2055  allFedsTimingLMHistHCAL_->Write();
2056 
2057  allOccupancyExclusiveDT_->Write();
2059  allOccupancyDT_->Write();
2060  allOccupancyCoarseDT_->Write();
2061  allFedsTimingPhiEtaHistDT_->Write();
2062  allFedsTimingHistDT_->Write();
2063  allFedsTimingTTHistDT_->Write();
2064  allFedsTimingLMHistDT_->Write();
2065 
2066  allOccupancyExclusiveRPC_->Write();
2068  allOccupancyRPC_->Write();
2069  allOccupancyCoarseRPC_->Write();
2070  allFedsTimingPhiEtaHistRPC_->Write();
2071  allFedsTimingHistRPC_->Write();
2072  allFedsTimingTTHistRPC_->Write();
2073  allFedsTimingLMHistRPC_->Write();
2074 
2075  allOccupancyExclusiveCSC_->Write();
2077  allOccupancyCSC_->Write();
2078  allOccupancyCoarseCSC_->Write();
2079  allFedsTimingPhiEtaHistCSC_->Write();
2080  allFedsTimingHistCSC_->Write();
2081  allFedsTimingTTHistCSC_->Write();
2082  allFedsTimingLMHistCSC_->Write();
2083 
2084  allFedsTimingHistEcalMuon_->Write();
2085 
2086  //EE
2087  TDirectory* EEMinusDir = gDirectory->mkdir("EEMinus");
2088  EEMinusDir->cd();
2089  EEM_FedsSeedEnergyHist_->Write();
2090  EEM_AllOccupancyCoarse_->Write();
2091  EEM_AllOccupancy_->Write();
2092  EEM_FedsenergyHist_->Write();
2093  EEM_FedsenergyHighHist_->Write();
2094  EEM_FedsenergyOnlyHighHist_->Write();
2095  EEM_FedsE2Hist_->Write();
2096  EEM_FedsE2vsE1Hist_->Write();
2097  EEM_FedsenergyvsE1Hist_->Write();
2098  EEM_FedsTimingHist_->Write();
2099  EEM_numberofCosmicsHist_->Write();
2100  EEM_FedsTimingVsAmpHist_->Write();
2101  EEM_FedsTimingTTHist_->Write();
2102  EEM_OccupancySingleXtal_->Write();
2103  EEM_energySingleXtalHist_->Write();
2104  EEM_OccupancyExclusiveECAL_->Write();
2106  EEM_OccupancyECAL_->Write();
2107  EEM_OccupancyCoarseECAL_->Write();
2108  EEM_FedsTimingHistECAL_->Write();
2109  EEM_FedsTimingTTHistECAL_->Write();
2110  EEM_OccupancyExclusiveDT_->Write();
2112  EEM_OccupancyDT_->Write();
2113  EEM_OccupancyCoarseDT_->Write();
2114  EEM_FedsTimingHistDT_->Write();
2115  EEM_FedsTimingTTHistDT_->Write();
2116  EEM_OccupancyExclusiveRPC_->Write();
2118  EEM_OccupancyRPC_->Write();
2119  EEM_OccupancyCoarseRPC_->Write();
2120  EEM_FedsTimingHistRPC_->Write();
2121  EEM_FedsTimingTTHistRPC_->Write();
2122  EEM_OccupancyExclusiveCSC_->Write();
2124  EEM_OccupancyCSC_->Write();
2125  EEM_OccupancyCoarseCSC_->Write();
2126  EEM_FedsTimingHistCSC_->Write();
2127  EEM_FedsTimingTTHistCSC_->Write();
2128  EEM_OccupancyExclusiveHCAL_->Write();
2130  EEM_OccupancyHCAL_->Write();
2131  EEM_OccupancyCoarseHCAL_->Write();
2132  EEM_FedsTimingHistHCAL_->Write();
2133  EEM_FedsTimingTTHistHCAL_->Write();
2134  EEM_numberofBCinSC_->Write();
2135  EEM_triggerHist_->Write();
2136  EEM_triggerExclusiveHist_->Write();
2137  EEM_NumXtalsInClusterHist_->Write();
2138  EEM_numxtalsVsEnergy_->Write();
2139  EEM_numxtalsVsHighEnergy_->Write();
2140  EEM_OccupancyHighEnergy_->Write();
2143  root_file_.cd();
2144 
2145  TDirectory* EEPlusDir = gDirectory->mkdir("EEPlus");
2146  EEPlusDir->cd();
2147  EEP_FedsSeedEnergyHist_->Write();
2148  EEP_AllOccupancyCoarse_->Write();
2149  EEP_AllOccupancy_->Write();
2150  EEP_FedsenergyHist_->Write();
2151  EEP_FedsenergyHighHist_->Write();
2152  EEP_FedsenergyOnlyHighHist_->Write();
2153  EEP_FedsE2Hist_->Write();
2154  EEP_FedsE2vsE1Hist_->Write();
2155  EEP_FedsenergyvsE1Hist_->Write();
2156  EEP_FedsTimingHist_->Write();
2157  EEP_numberofCosmicsHist_->Write();
2158  EEP_FedsTimingVsAmpHist_->Write();
2159  EEP_FedsTimingTTHist_->Write();
2160  EEP_OccupancySingleXtal_->Write();
2161  EEP_energySingleXtalHist_->Write();
2162  EEP_OccupancyExclusiveECAL_->Write();
2164  EEP_OccupancyECAL_->Write();
2165  EEP_OccupancyCoarseECAL_->Write();
2166  EEP_FedsTimingHistECAL_->Write();
2167  EEP_FedsTimingTTHistECAL_->Write();
2168  EEP_OccupancyExclusiveDT_->Write();
2170  EEP_OccupancyDT_->Write();
2171  EEP_OccupancyCoarseDT_->Write();
2172  EEP_FedsTimingHistDT_->Write();
2173  EEP_FedsTimingTTHistDT_->Write();
2174  EEP_OccupancyExclusiveRPC_->Write();
2176  EEP_OccupancyRPC_->Write();
2177  EEP_OccupancyCoarseRPC_->Write();
2178  EEP_FedsTimingHistRPC_->Write();
2179  EEP_FedsTimingTTHistRPC_->Write();
2180  EEP_OccupancyExclusiveCSC_->Write();
2182  EEP_OccupancyCSC_->Write();
2183  EEP_OccupancyCoarseCSC_->Write();
2184  EEP_FedsTimingHistCSC_->Write();
2185  EEP_FedsTimingTTHistCSC_->Write();
2186  EEP_OccupancyExclusiveHCAL_->Write();
2188  EEP_OccupancyHCAL_->Write();
2189  EEP_OccupancyCoarseHCAL_->Write();
2190  EEP_FedsTimingHistHCAL_->Write();
2191  EEP_FedsTimingTTHistHCAL_->Write();
2192  EEP_numberofBCinSC_->Write();
2193  EEP_triggerHist_->Write();
2194  EEP_triggerExclusiveHist_->Write();
2195  EEP_NumXtalsInClusterHist_->Write();
2196  EEP_numxtalsVsEnergy_->Write();
2197  EEP_numxtalsVsHighEnergy_->Write();
2198  EEP_OccupancyHighEnergy_->Write();
2201  root_file_.cd();
2202 
2203  triggerHist_->Write();
2204  triggerExclusiveHist_->Write();
2205 
2206  NumXtalsInClusterHist_->Write();
2207 
2208  numberofCosmicsHist_->Write();
2209  numberofCosmicsHistEB_->Write();
2210 
2211  numberofCosmicsWTrackHist_->Write();
2213  numberofGoodEvtFreq_->Write();
2214  numberofCrossedEcalIdsHist_->Write();
2215 
2216  runNumberHist_->SetBinContent(1,runNum_);
2217  runNumberHist_->Write();
2218 
2219  deltaRHist_->Write();
2220  deltaEtaHist_->Write();
2221  deltaPhiHist_->Write();
2222  ratioAssocClustersHist_->Write();
2223  ratioAssocTracksHist_->Write();
2224  deltaEtaDeltaPhiHist_->Write();
2225  seedTrackPhiHist_->Write();
2226  seedTrackEtaHist_->Write();
2227  dccEventVsBxHist_->Write();
2228  dccOrbitErrorByFEDHist_->Write();
2229  dccBXErrorByFEDHist_->Write();
2230  dccRuntypeErrorByFEDHist_->Write();
2231  dccErrorVsBxHist_->Write();
2232  dccRuntypeHist_->Write();
2233 
2234  trackAssoc_muonsEcal_->Write();
2235 
2236  hcalEnergy_HBHE_->Write();
2237  hcalEnergy_HF_->Write();
2238  hcalEnergy_HO_->Write();
2239  hcalHEHBecalEB_->Write();
2240 
2241  TDirectory* highEnergyDir = gDirectory->mkdir("HighEnergy");
2242  highEnergyDir->cd();
2243  HighEnergy_NumXtal->Write();
2244  HighEnergy_NumXtalFedId->Write();
2245  HighEnergy_NumXtaliphi->Write();
2246  HighEnergy_energy3D->Write();
2247  HighEnergy_energyNumXtal->Write();
2248  HighEnergy_bestSeed->Write();
2250  HighEnergy_numClusHighEn->Write();
2251  HighEnergy_ratioClusters->Write();
2253  HighEnergy_TracksAngle->Write();
2255  HighEnergy_2GeV_occuCoarse->Write();
2256  HighEnergy_2GeV_occu3D->Write();
2258  HighEnergy_100GeV_occu3D->Write();
2259  HighEnergy_0tracks_occu3D->Write();
2260  HighEnergy_1tracks_occu3D->Write();
2261  HighEnergy_2tracks_occu3D->Write();
2265 
2266  root_file_.cd();
2267 
2268  TDirectory* TimeStampdir = gDirectory->mkdir("EventTiming");
2269  TimeStampdir->cd();
2270  allFedsFreqTimeHist_->Write();
2271  allFedsFreqTimeVsPhiHist_->Write();
2272  allFedsFreqTimeVsPhiTTHist_->Write();
2273  allFedsFreqTimeVsEtaHist_->Write();
2274  allFedsFreqTimeVsEtaTTHist_->Write();
2275 
2276  root_file_.cd();
2277 
2278  root_file_.Close();
2279 
2280  LogWarning("EcalCosmicsHists") << "---> Number of cosmic events: " << cosmicCounter_ << " in " << naiveEvtNum_ << " events.";
2281  LogWarning("EcalCosmicsHists") << "---> Number of EB cosmic events: " << cosmicCounterEB_ << " in " << naiveEvtNum_ << " events.";
2282  LogWarning("EcalCosmicsHists") << "---> Number of EE- cosmic events: " << cosmicCounterEEM_ << " in " << naiveEvtNum_ << " events.";
2283  LogWarning("EcalCosmicsHists") << "---> Number of EE+ cosmic events: " << cosmicCounterEEP_ << " in " << naiveEvtNum_ << " events.";
2284 
2285  // LogWarning("EcalCosmicsHists") << "---> Number of top+bottom cosmic events: " << cosmicCounterTopBottom_ << " in " << cosmicCounter_ << " cosmics in " << naiveEvtNum_ << " events.";
2286 
2287 }
2288 
2289 
2291 {
2292  using namespace std;
2293  ostringstream myStream;
2294  myStream << num << flush;
2295  return(myStream.str()); //returns the string form of the stringstream object
2296 }
2297 
TH3F * EEM_FedsTimingTTHistECAL_
#define LogDebug(id)
RunNumber_t run() const
Definition: EventID.h:42
TH2F * allFedsTimingLMHistECAL_
TH2F * allOccupancyExclusiveECAL_
virtual void analyze(edm::Event const &, edm::EventSetup const &)
TH3F * allFedsTimingTTHistRPC_
TH3F * HighEnergy_0tracks_occu3D
T getParameter(std::string const &) const
const cms_uint16_t bData(int iB) const
get/set B_DATA_CH_IB
Definition: L1GtPsbWord.cc:325
EventNumber_t event() const
Definition: EventID.h:44
TH2F * allOccupancyCoarseExclusiveCSC_
TH2F * EEM_OccupancySingleXtal_
int i
Definition: DBlmapReader.cc:9
std::string intToString(int num)
TH3F * allFedsTimingTTHistCSC_
TH2F * EEP_FedsenergyvsE1Hist_
TH2F * allOccupancyExclusiveHCAL_
TH2F * HighEnergy_bestSeedOccupancy
TH2F * allOccupancyCoarseExclusiveECAL_
TH3F * allFedsTimingPhiEtaHistCSC_
std::map< int, TH2F * > FEDsAndDCCRuntypeVsBxHists_
int ix() const
Definition: EEDetId.h:77
TH1F * EEM_FedsenergyHighHist_
TH2F * EEM_numxtalsVsHighEnergy_
TH1F * allFedsiPhiProfileHist_
TH1F * EEM_numberofCosmicsHist_
TH3F * EEM_FedsTimingTTHistCSC_
TH1F * EEP_FedsenergyHighHist_
TH2F * allOccupancyExclusiveRPC_
TH1F * allFedsiEtaProfileHist_
EcalFedMap * fedMap_
std::map< int, TH2F * > FEDsAndTimingVsAmpHists_
TH3F * allFedsTimingPhiEtaHistECAL_
edm::InputTag ecalRawDataColl_
std::map< int, TH1F * > FEDsAndFrequencyHists_
TH2F * allOccupancyCoarseExclusiveHCAL_
EcalCosmicsHists(const edm::ParameterSet &)
TH2F * EEP_OccupancyExclusiveHCAL_
TH1F * EEP_energySingleXtalHist_
TH1F * allFedsTimingEbpTopHist_
TH2F * EEM_OccupancyExclusiveDT_
std::map< int, TH2F * > FEDsAndE2vsE1Hists_
TH2F * allFedsTimingLMHistHCAL_
Ecal readout channel identification [32:20] Unused (so far) [19:13] DCC id [12:6] tower [5:3] strip [...
TH2F * allFedsTimingVsFreqHist_
TH1F * EEM_energySingleXtalHist_
std::vector< DetId > crossedEcalIds
TH2F * EEP_numxtalsVsHighEnergy_
TH2F * EEM_FedsTimingVsAmpHist_
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
TH1F * EEP_FedsSeedEnergyHist_
void useDefaultPropagator()
use the default propagator
TH1F * allFedsTimingEbpBottomHist_
std::vector< T >::const_iterator const_iterator
TH3F * allFedsTimingPhiEtaHistDT_
TH2F * EEP_OccupancyCoarseECAL_
#define abs(x)
Definition: mlp_lapack.h:159
TH1F * numberofCosmicsWTrackHist_
virtual void endJob()
TH3F * EEP_FedsTimingTTHistRPC_
TH2F * allFedsFreqTimeVsPhiHist_
TH2F * HighEnergy_2GeV_occuCoarse
TH1F * dccRuntypeErrorByFEDHist_
TH3F * allFedsTimingPhiEtaHistRPC_
TH3F * HighEnergy_1tracks_occu3DXtal
T eta() const
TH3F * allFedsTimingPhiEtaHistHCAL_
float time() const
Definition: CaloRecHit.h:21
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:7
TH3F * EEM_FedsTimingTTHistDT_
TH2F * EEM_OccupancyExclusiveECAL_
std::map< int, TH1F * > FEDsAndHists_
TH2F * EEM_OccupancyCoarseHCAL_
std::map< int, TH1F * > FEDsAndNumXtalsInClusterHists_
int iphiSM() const
get the crystal iphi (1-20)
Definition: EBDetId.h:76
TH3F * EEM_FedsTimingTTHistRPC_
TH3F * HighEnergy_2tracks_occu3D
TH2F * HighEnergy_100GeV_occuCoarse
std::map< int, TH2F * > FEDsAndTimingVsPhiHists_
TH2F * allOccupancyCoarseExclusiveDT_
dictionary map
Definition: Association.py:205
TH2F * EEP_OccupancyExclusiveCSC_
TH2F * allOccupancyHighEnergy_
edm::InputTag endcapClusterCollection_
TH2F * EEP_OccupancyExclusiveDT_
std::string getSliceFromFed(int)
Definition: EcalFedMap.cc:93
int iphi() const
get the crystal iphi
Definition: EBDetId.h:54
virtual void beginRun(edm::Run const &, edm::EventSetup const &)
TH2F * EEM_OccupancyCoarseExclusiveCSC_
TH2F * HighEnergy_NumXtalFedId
TH3F * allFedsTimingTTHistECAL_
TH1F * allFedsTimingEbmTopHist_
EcalElectronicsId getElectronicsId(const DetId &id) const
Get the electronics id for this det id.
std::vector< bool > determineTriggers(const edm::Event &, const edm::EventSetup &eventSetup)
TH2F * allFedsFreqTimeVsEtaTTHist_
int iEvent
Definition: GenABIO.cc:243
TH2F * EEM_OccupancyExclusiveRPC_
TH2F * EEM_OccupancyHighEnergy_
TH1F * EEP_FedsTimingHistHCAL_
TH2F * allFedsTimingPhiEbmHist_
std::map< int, TH2F * > FEDsAndenergyvsE1Hists_
const cms_uint16_t aData(int iA) const
get/set A_DATA_CH_IA
Definition: L1GtPsbWord.cc:230
TH2F * EEM_OccupancyCoarseECAL_
TH2F * EEM_OccupancyCoarseExclusiveRPC_
std::vector< SuperCluster > SuperClusterCollection
collection of SuperCluser objectr
TH1F * EEP_numberofCosmicsHist_
TH2F * EEP_OccupancyHighEnergyCoarse_
std::vector< bool > DecisionWord
typedefs
float energy() const
Definition: CaloRecHit.h:19
void swap(edm::DataFrameContainer &lhs, edm::DataFrameContainer &rhs)
TH1F * EEP_FedsNumXtalsInClusterHist_
TH3F * EEP_FedsTimingTTHistHCAL_
T sqrt(T t)
Definition: SSEVec.h:48
TH3F * HighEnergy_1tracks_occu3D
TH1F * allFedsenergyOnlyHighHist_
TH1F * EEP_triggerExclusiveHist_
TH2F * EEP_OccupancyCoarseExclusiveECAL_
const bool gtAlgorithmResult(const std::string &algName, const std::vector< bool > &decWord) const
TH1F * EEM_FedsSeedEnergyHist_
std::map< int, TH2F * > FEDsAndOccupancyHists_
TH3F * HighEnergy_100GeV_occu3D
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_
int zside() const
Definition: EEDetId.h:71
TH2F * EEP_OccupancyCoarseExclusiveHCAL_
std::string fileName_
tuple handle
Definition: patZpeak.py:22
TH2F * EEM_OccupancyCoarseRPC_
TH2F * EEP_AllOccupancyCoarse_
TH2F * EEP_OccupancyCoarseCSC_
std::map< int, TH1F * > FEDsAndiEtaProfileHists_
const EcalElectronicsMapping * ecalElectronicsMap_
TrackDetectorAssociator trackAssociator_
TH1F * numberofCosmicsTopBottomHist_
TH2F * EEP_OccupancySingleXtal_
TH2F * EEM_OccupancyCoarseExclusiveECAL_
int iy() const
Definition: EEDetId.h:83
TH1F * allFedsTimingHistEcalMuon_
int ieta() const
get the crystal ieta
Definition: EBDetId.h:52
TH2F * EEP_OccupancyExclusiveECAL_
std::map< int, TH2F * > FEDsAndTimingVsFreqHists_
const L1GtPsbWord gtPsbWord(cms_uint16_t boardIdValue, int bxInEventValue) const
get / set PSB word (record) in the GT readout record
TrackAssociatorParameters trackParameters_
TH1F * EEM_triggerExclusiveHist_
TH1F * EEM_FedsTimingHistHCAL_
bool isValid() const
Definition: HandleBase.h:76
TH1F * HighEnergy_TracksAngleTopBottom
int dccId() const
get the DCC (Ecal Local DCC value not global one) id
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:361
TH1F * EEP_FedsTimingHistECAL_
TH2F * allFedsTimingPhiEbpHist_
TH2F * allOccupancyExclusiveDT_
TH2F * EEM_OccupancyCoarseExclusiveHCAL_
TH2F * allOccupancySingleXtal_
TH2F * EEP_OccupancyCoarseExclusiveCSC_
std::map< int, TH1F * > FEDsAndiPhiProfileHists_
TH2F * allFedsTimingVsAmpHist_
TH3F * allFedsTimingPhiEtaHist_
const_iterator end() const
TH1F * ratioAssocClustersHist_
edm::InputTag l1GMTReadoutRecTag_
TH2F * EEM_FedsenergyvsE1Hist_
TimeValue_t value() const
Definition: Timestamp.cc:72
TH2F * EEM_OccupancyCoarseCSC_
TH2F * allOccupancyExclusiveCSC_
TH1F * HighEnergy_numClusHighEn
TH2F * allFedsFreqTimeVsEtaHist_
TH2F * EEP_OccupancyExclusiveRPC_
tuple tracks
Definition: testEve_cfg.py:39
static bool validDetId(int crystal_ix, int crystal_iy, int iz)
Definition: EEDetId.h:249
const T & get() const
Definition: EventSetup.h:55
T const * product() const
Definition: ESHandle.h:62
long long int num
Definition: procUtils.cc:71
TH1F * EEM_FedsTimingHistECAL_
T const * product() const
Definition: Handle.h:74
TH2F * allFedsTimingLMHistRPC_
int ietaSM() const
get the crystal ieta in the SM convention (1-85)
Definition: EBDetId.h:74
std::map< int, TH2F * > FEDsAndTimingVsModuleHists_
edm::EventID id() const
Definition: EventBase.h:56
TH1F * dccOrbitErrorByFEDHist_
TH1F * numberofCrossedEcalIdsHist_
TH2F * allFedsTimingLMHistCSC_
TH3F * EEM_FedsTimingTTHistHCAL_
TH2F * allOccupancyCoarseECAL_
TH2F * EEP_OccupancyCoarseHCAL_
std::vector< L1MuGMTReadoutRecord > const & getRecords() const
TH1F * EEM_FedsenergyOnlyHighHist_
TH1F * EEP_NumXtalsInClusterHist_
TH1F * allFedsNumXtalsInClusterHist_
TH2F * EEM_OccupancyExclusiveHCAL_
TH2F * allOccupancyCoarseExclusiveRPC_
TH2F * EEP_OccupancyCoarseExclusiveRPC_
TH2F * EEM_OccupancyCoarseExclusiveDT_
TrackDetMatchInfo associate(const edm::Event &, const edm::EventSetup &, const FreeTrajectoryState &, const AssociatorParameters &)
TH2F * EEP_OccupancyCoarseRPC_
TH3F * HighEnergy_2tracks_occu3DXtal
TH1F * EEM_NumXtalsInClusterHist_
TH2F * allOccupancyHighEnergyCoarse_
TH2F * EEP_OccupancyHighEnergy_
TH3F * allFedsOccupancyHighEnergyHist_
tuple cout
Definition: gather_cfg.py:121
TH2F * EEM_AllOccupancyCoarse_
dbl *** dir
Definition: mlp_gen.cc:35
TH3F * EEP_FedsTimingTTHistCSC_
TH3F * EEP_FedsTimingTTHistDT_
TH2F * EEP_FedsTimingVsAmpHist_
TH1F * EEM_FedsNumXtalsInClusterHist_
TH2F * allFedsFreqTimeVsPhiTTHist_
std::map< int, TH1F * > FEDsAndenergyHists_
edm::InputTag l1GTReadoutRecTag_
edm::InputTag barrelClusterCollection_
int getLMNumber(const DetId &id) const
std::map< int, TH1F * > FEDsAndTimingHists_
TH2F * EEM_OccupancyHighEnergyCoarse_
edm::Timestamp time() const
Definition: EventBase.h:57
std::map< int, TH1F * > FEDsAndE2Hists_
TH1F * allFedsTimingEbmBottomHist_
TH1F * EEP_FedsenergyOnlyHighHist_
void loadParameters(const edm::ParameterSet &)
const_iterator begin() const
Definition: Run.h:36
edm::InputTag ecalRecHitCollectionEB_
TH1F * HighEnergy_numRecoTrackBarrel
TH2F * EEP_OccupancyCoarseExclusiveDT_
TH3F * HighEnergy_0tracks_occu3DXtal
TH2F * allOccupancyCoarseHCAL_
T angle(T x1, T y1, T z1, T x2, T y2, T z2)
Definition: angle.h:11
edm::InputTag ecalRecHitCollectionEE_
Definition: DDAxes.h:10