CMS 3D CMS Logo

ZeeCalibration.cc
Go to the documentation of this file.
1 #include <fstream>
2 #include <iostream>
3 #include <map>
4 #include <stdexcept>
5 #include <string>
6 #include <utility>
7 #include <vector>
8 
9 #include <TBranch.h>
10 #include <TCanvas.h>
11 #include <TF1.h>
12 #include <TFile.h>
13 #include <TGraph.h>
14 #include <TGraphErrors.h>
15 #include <TH1.h>
16 #include <TH2.h>
17 #include <TProfile.h>
18 #include <TRandom.h>
19 #include <TTree.h>
20 
21 #include <CLHEP/Vector/LorentzVector.h>
22 
62 
63 #define MZ 91.1876
64 
65 #define DEBUG 1
66 
68 #ifdef DEBUG
69  std::cout << "[ZeeCalibration] Starting the ctor" << std::endl;
70 #endif
71 
72  theMaxLoops = iConfig.getUntrackedParameter<unsigned int>("maxLoops", 0);
73 
74  wantEtaCorrection_ = iConfig.getUntrackedParameter<bool>("wantEtaCorrection", true);
75 
76  outputFileName_ = iConfig.getParameter<std::string>("outputFile");
77 
78  minInvMassCut_ = iConfig.getUntrackedParameter<double>("minInvMassCut", 70.);
79  maxInvMassCut_ = iConfig.getUntrackedParameter<double>("maxInvMassCut", 110.);
80 
81  rechitProducer_ = iConfig.getParameter<std::string>("rechitProducer");
82  rechitCollection_ = iConfig.getParameter<std::string>("rechitCollection");
83 
84  erechitProducer_ = iConfig.getParameter<std::string>("erechitProducer");
85  erechitCollection_ = iConfig.getParameter<std::string>("erechitCollection");
86 
87  scProducer_ = iConfig.getParameter<std::string>("scProducer");
88  scCollection_ = iConfig.getParameter<std::string>("scCollection");
89 
90  scIslandProducer_ = iConfig.getParameter<std::string>("scIslandProducer");
91  scIslandCollection_ = iConfig.getParameter<std::string>("scIslandCollection");
92 
93  calibMode_ = iConfig.getUntrackedParameter<std::string>("ZCalib_CalibType");
94 
95  mcProducer_ = iConfig.getUntrackedParameter<std::string>("mcProducer", "");
96 
97  electronProducer_ = iConfig.getParameter<std::string>("electronProducer");
98  electronCollection_ = iConfig.getParameter<std::string>("electronCollection");
99 
100  outputFile_ = TFile::Open(outputFileName_.c_str(), "RECREATE"); // open output file to store histograms
101 
102  myTree = new TTree("myTree", "myTree");
103  // myTree->Branch("zMass","zMass", &mass);
104  myTree->Branch("zMass", &mass4tree, "mass/F");
105  myTree->Branch("zMassDiff", &massDiff4tree, "massDiff/F");
106 
107  barrelfile_ = iConfig.getUntrackedParameter<std::string>("initialMiscalibrationBarrel", "");
108  endcapfile_ = iConfig.getUntrackedParameter<std::string>("initialMiscalibrationEndcap", "");
109 
111  iConfig.getUntrackedParameter<unsigned int>("electronSelection", 0); //option for electron selection
112 
113  etaBins_ = iConfig.getUntrackedParameter<unsigned int>("etaBins", 10);
114  etBins_ = iConfig.getUntrackedParameter<unsigned int>("etBins", 10);
115 
116  etaMin_ = iConfig.getUntrackedParameter<double>("etaMin", 0.);
117  etMin_ = iConfig.getUntrackedParameter<double>("etMin", 0.);
118  etaMax_ = iConfig.getUntrackedParameter<double>("etaMax", 3.);
119  etMax_ = iConfig.getUntrackedParameter<double>("etMax", 100.);
120 
121  // new ZeePlots("zeePlots.root");
122  // ZeePlots->bookHistos();
123 
124  //ZeeCalibrationPLots("zeeCalibPlots");
125  //ZeecaPlots->bookHistos(maxsIter);
126 
127  hlTriggerResults_ = iConfig.getParameter<edm::InputTag>("HLTriggerResults");
128 
129  theParameterSet = iConfig;
130  EcalIndexingTools* myIndexTool = nullptr;
131 
132  myIndexTool = EcalIndexingTools::getInstance();
133 
135 
136  //creating the algorithm
138 
139  // Tell the framework what data is being produced
140  //setWhatProduced(this);
142  findingRecord<EcalIntercalibConstantsRcd>();
143 
144  for (int i = 0; i < 50; i++) {
146  loopArray[i] = -1.;
147  sigmaArray[i] = -1.;
148  sigmaErrorArray[i] = -1.;
149  }
150 
151 #ifdef DEBUG
152  std::cout << "[ZeeCalibration] Done with the ctor" << std::endl;
153 #endif
154 }
155 
157  // if (theAlgorithm_)
158  // delete theAlgorithm_;
159 }
160 
161 //_____________________________________________________________________________
162 // Produce EcalIntercalibConstants
163 std::shared_ptr<EcalIntercalibConstants> ZeeCalibration::produceEcalIntercalibConstants(
164  const EcalIntercalibConstantsRcd& iRecord) {
165  std::cout << "@SUB=ZeeCalibration::produceEcalIntercalibConstants" << std::endl;
166  return ical;
167 }
168 
170 
171 //========================================================================
173  printStatistics();
174 
175  if (calibMode_ != "ETA_ET_MODE") {
177 
178  //Writing out calibration coefficients
179  calibXMLwriter* barrelWriter = new calibXMLwriter(EcalBarrel);
180  for (int ieta = -EBDetId::MAX_IETA; ieta <= EBDetId::MAX_IETA; ++ieta) {
181  if (ieta == 0)
182  continue;
183  for (int iphi = EBDetId::MIN_IPHI; iphi <= EBDetId::MAX_IPHI; ++iphi) {
184  // make an EBDetId since we need EBDetId::rawId() to be used as the key for the pedestals
185  if (EBDetId::validDetId(ieta, iphi)) {
186  EBDetId ebid(ieta, iphi);
187  barrelWriter->writeLine(ebid, *(ical->getMap().find(ebid.rawId())));
188  }
189  }
190  }
191 
192  calibXMLwriter* endcapWriter = new calibXMLwriter(EcalEndcap);
193  for (int iX = EEDetId::IX_MIN; iX <= EEDetId::IX_MAX; ++iX) {
194  for (int iY = EEDetId::IY_MIN; iY <= EEDetId::IY_MAX; ++iY) {
195  // make an EEDetId since we need EEDetId::rawId() to be used as the key for the pedestals
196  if (EEDetId::validDetId(iX, iY, 1)) {
197  EEDetId eeid(iX, iY, 1);
198  endcapWriter->writeLine(eeid, *(ical->getMap().find(eeid.rawId())));
199  }
200  if (EEDetId::validDetId(iX, iY, -1)) {
201  EEDetId eeid(iX, iY, -1);
202  endcapWriter->writeLine(eeid, *(ical->getMap().find(eeid.rawId())));
203  }
204  }
205  }
206 
207  }
208 
209  std::cout << "Writing histos..." << std::endl;
210  outputFile_->cd();
211 
212  // zeeplts->Write();
213 
216 
219 
221 
225 
226  h1_electronCosTheta_SC_->Write();
227  h1_electronCosTheta_TK_->Write();
229 
230  h1_zMassResol_->Write();
231  h1_zEtaResol_->Write();
232  h1_zPhiResol_->Write();
233  h1_eleEtaResol_->Write();
234  h1_elePhiResol_->Write();
235  h1_seedOverSC_->Write();
236  h1_preshowerOverSC_->Write();
237 
238  for (unsigned int i = 0; i < 25; i++) {
239  if (i < theMaxLoops) {
240  h_ESCEtrueVsEta_[i]->Write();
241  h_ESCEtrue_[i]->Write();
242 
243  h_ESCcorrEtrueVsEta_[i]->Write();
244  h_ESCcorrEtrue_[i]->Write();
245 
246  h2_chi2_[i]->Write();
247  h2_iterations_[i]->Write();
248 
249  // h_DiffZMassDistr_[i]->Write();
250 
251  //h_ZMassDistr_[i]->Write();
252  }
253  }
254 
255  h2_fEtaBarrelGood_->Write();
256  h2_fEtaBarrelBad_->Write();
257  h2_fEtaEndcapGood_->Write();
258  h2_fEtaEndcapBad_->Write();
259  h1_eleClasses_->Write();
260 
261  h_eleEffEta_[0]->Write();
262  h_eleEffPhi_[0]->Write();
263  h_eleEffPt_[0]->Write();
264 
265  h_eleEffEta_[1]->Write();
266  h_eleEffPhi_[1]->Write();
267  h_eleEffPt_[1]->Write();
268 
269  int j = 0;
270 
271  int flag = 0;
272 
273  Double_t mean[25] = {0.};
274  Double_t num[25] = {0.};
275  Double_t meanErr[25] = {0.};
276  Float_t rms[25] = {0.};
277  Float_t tempRms[10][25];
278 
279  for (int ia = 0; ia < 10; ia++) {
280  for (int ib = 0; ib < 25; ib++) {
281  tempRms[ia][ib] = 0.;
282  }
283  }
284 
285  int aa = 0;
286 
287  for (int k = 0; k < theAlgorithm_->getNumberOfChannels(); k++) {
289  bool isNearCrack = false;
290 
291  if (calibMode_ == "RING") {
292  isNearCrack = (abs(ringNumberCorrector(k)) == 1 || abs(ringNumberCorrector(k)) == 25 ||
293  abs(ringNumberCorrector(k)) == 26 || abs(ringNumberCorrector(k)) == 45 ||
294  abs(ringNumberCorrector(k)) == 46 || abs(ringNumberCorrector(k)) == 65 ||
295  abs(ringNumberCorrector(k)) == 66 || abs(ringNumberCorrector(k)) == 85 ||
296  abs(ringNumberCorrector(k)) == 86 || abs(ringNumberCorrector(k)) == 124);
297  }
298 
299  if (k < 85) {
300  if ((k + 1) % 5 != 0) {
301  if (!isNearCrack) {
302  mean[j] += calibCoeff[k];
303  mean[j] += calibCoeff[169 - k];
304 
305  num[j] += 2.;
306 
307  //meanErr[j]+= calibCoeffError[k];
308  //meanErr[j]+= calibCoeffError[169 - k];
309 
310  meanErr[j] += 1. / pow(calibCoeffError[k], 2);
311  meanErr[j] += 1. / pow(calibCoeffError[169 - k], 2);
312 
313  tempRms[aa][j] += calibCoeff[k];
314  aa++;
315  tempRms[aa][j] += calibCoeff[169 - k];
316  aa++;
317  }
318  }
319 
320  else {
321  if (!isNearCrack) {
322  mean[j] += calibCoeff[k];
323  mean[j] += calibCoeff[169 - k];
324 
325  num[j] += 2.;
326 
327  //meanErr[j]+= calibCoeffError[k];
328  //meanErr[j]+= calibCoeffError[169 - k];
329 
330  meanErr[j] += 1. / pow(calibCoeffError[k], 2);
331  meanErr[j] += 1. / pow(calibCoeffError[169 - k], 2);
332 
333  tempRms[aa][j] += calibCoeff[k];
334  aa++;
335  tempRms[aa][j] += calibCoeff[169 - k];
336  aa++;
337  }
338  j++;
339  aa = 0;
340  }
341  }
342  //EE begin
343 
344  if (k >= 170 && k <= 204) {
345  if (flag < 4) {
346  //make groups of 5 Xtals in #eta
347  mean[j] += calibCoeff[k] / 10.;
348  mean[j] += calibCoeff[k + 39] / 10.;
349 
350  meanErr[j] += calibCoeffError[k] / 30.;
351  meanErr[j] += calibCoeffError[k + 39] / 30.;
352 
353  tempRms[aa][j] += calibCoeff[k];
354  aa++;
355  tempRms[aa][j] += calibCoeff[k + 39];
356  aa++;
357 
358  flag++;
359  }
360 
361  else if (flag == 4) {
362  //make groups of 5 Xtals in #eta
363  mean[j] += calibCoeff[k] / 10.;
364  mean[j] += calibCoeff[k + 39] / 10.;
365 
366  meanErr[j] += calibCoeffError[k] / 30.;
367  meanErr[j] += calibCoeffError[k + 39] / 30.;
368 
369  tempRms[aa][j] += calibCoeff[k];
370  aa++;
371  tempRms[aa][j] += calibCoeff[k + 39];
372  aa++;
373 
374  flag = 0;
375  // std::cout<<" index(>85) "<<k<<" j is "<<j<<" mean[j] is "<<mean[j]<<std::endl;
376  j++;
377  aa = 0;
378  }
379  }
380  if (k >= 205 && k <= 208) {
381  mean[j] += calibCoeff[k] / 8.;
382  mean[j] += calibCoeff[k + 39] / 8.;
383 
384  meanErr[j] += calibCoeffError[k] / 30.;
385  meanErr[j] += calibCoeffError[k + 39] / 30.;
386 
387  tempRms[aa][j] += calibCoeff[k];
388  aa++;
389  tempRms[aa][j] += calibCoeff[k + 39];
390  aa++;
391  }
392  //EE end
393 
394  /*
395  for(int jj =0; jj< 25; jj++){
396  if(meanErr[jj] > 0.)
397  std::cout<<" meanErr[jj] before sqrt: "<<meanErr[jj]<<std::endl;
398 
399  meanErr[jj] = 1./sqrt( meanErr[jj] );
400 
401  std::cout<<" meanErr[jj] after sqrt: "<<meanErr[jj]<<std::endl;
402  }
403  */
404 
405  if (!isNearCrack) {
408  h1_mc_->Fill(initCalibCoeff[k] * calibCoeff[k] - 1.);
409 
410  if (k < 170) {
412  h1_mcEB_->Fill(initCalibCoeff[k] * calibCoeff[k] - 1.);
413  }
414 
415  if (k >= 170) {
417  h1_mcEE_->Fill(initCalibCoeff[k] * calibCoeff[k] - 1.);
418  }
419  }
420  }
421 
422  for (int ic = 0; ic < 17; ic++) {
423  mean[ic] = mean[ic] / num[ic]; //find mean of recalib coeff on group of rings
424  //meanErr[ic] = meanErr[ic] / ( sqrt( num[ic] ) * num[ic] ); //find mean of recalib coeff on group of rings
425  meanErr[ic] = 1. / sqrt(meanErr[ic]); //find mean of recalib coeff on group of rings
426  }
427 
428  //build array of RMS
429  for (int ic = 0; ic < 25; ic++) {
430  for (int id = 0; id < 10; id++) {
431  if (tempRms[id][ic] > 0.) {
432  rms[ic] += (tempRms[id][ic] - mean[j]) * (tempRms[id][ic] - mean[j]);
433  }
434  }
435  rms[ic] /= 10.; //this is approximate
436  rms[ic] = sqrt(rms[ic]);
437  }
438 
439  //build array of RMS
440 
441  Double_t xtalEta[25] = {1.4425, 1.3567, 1.2711, 1.1855, 1.10, 1.01, 0.92, 0.83, 0.7468,
442  0.6612, 0.5756, 0.4897, 0.3985, 0.3117, 0.2250, 0.1384, 0.0487, 1.546,
443  1.651, 1.771, 1.908, 2.071, 2.267, 2.516, 2.8};
444 
445  Double_t zero[25] = {0.026}; //interval/sqrt(12)
446 
447  for (int j = 0; j < 25; j++)
448  h2_coeffVsEtaGrouped_->Fill(xtalEta[j], mean[j]);
449 
450  // for(int sho = 0; sho <25; sho++)
451  //cout<<"xtalEta[j] "<< xtalEta[sho]<<" mean[j] "<<mean[sho]<<" err[j] "<<meanErr[sho]<<std::endl;
452 
453  TProfile* px = h2_coeffVsEta_->ProfileX("coeffVsEtaProfile");
454  px->SetXTitle("Eta channel");
455  px->SetYTitle("recalibCoeff");
456  px->Write();
457 
458  h2_coeffVsEta_->Write();
459  h2_coeffVsEtaGrouped_->Write();
460  h2_zMassVsLoop_->Write();
461  h2_zMassDiffVsLoop_->Write();
462  h2_zWidthVsLoop_->Write();
463  h2_coeffVsLoop_->Write();
464  h2_miscalRecal_->Write();
465  h1_mc_->Write();
466  h2_miscalRecalEB_->Write();
467  h1_mcEB_->Write();
468  h2_miscalRecalEE_->Write();
469  h1_mcEE_->Write();
470 
471  h2_residualSigma_->Write();
472 
474 
475  double weightSumMeanBarrel = 0.;
476  double weightSumMeanEndcap = 0.;
477 
478  for (int iIteration = 0; iIteration < theAlgorithm_->getNumberOfIterations(); iIteration++)
479  for (int iChannel = 0; iChannel < theAlgorithm_->getNumberOfChannels(); iChannel++) {
480  if (iIteration == (theAlgorithm_->getNumberOfIterations() - 1)) {
481  if (iChannel < 170)
482  weightSumMeanBarrel += algoHistos->weightedRescaleFactor[iIteration][iChannel]->Integral() / 170.;
483 
484  if (iChannel >= 170)
485  weightSumMeanEndcap += algoHistos->weightedRescaleFactor[iIteration][iChannel]->Integral() / 78.;
486 
487  h1_occupancyVsEta_->Fill((Double_t)ringNumberCorrector(iChannel),
488  algoHistos->weightedRescaleFactor[iIteration][iChannel]->Integral());
489 
490  h1_occupancy_->Fill(algoHistos->weightedRescaleFactor[iIteration][iChannel]->Integral());
491 
492  if (iChannel < 170)
493  h1_occupancyBarrel_->Fill(algoHistos->weightedRescaleFactor[iIteration][iChannel]->Integral());
494 
495  if (iChannel >= 170)
496  h1_occupancyEndcap_->Fill(algoHistos->weightedRescaleFactor[iIteration][iChannel]->Integral());
497 
498 #ifdef DEBUG
499  std::cout << "Writing weighted integral for channel " << ringNumberCorrector(iChannel) << " ,value "
500  << algoHistos->weightedRescaleFactor[iIteration][iChannel]->Integral() << std::endl;
501 #endif
502  }
503  }
504 
505  // std::cout<<"Done! Closing output file... "<<std::endl;
506 
507  h1_weightSumMeanBarrel_->Fill(weightSumMeanBarrel);
508  h1_weightSumMeanEndcap_->Fill(weightSumMeanEndcap);
509 
510  std::cout << "Weight sum mean on channels in Barrel is :" << weightSumMeanBarrel << std::endl;
511  std::cout << "Weight sum mean on channels in Endcap is :" << weightSumMeanEndcap << std::endl;
512 
513  h1_weightSumMeanBarrel_->Write();
514  h1_weightSumMeanEndcap_->Write();
515 
516  h1_occupancyVsEta_->Write();
517  h1_occupancy_->Write();
518  h1_occupancyBarrel_->Write();
519  h1_occupancyEndcap_->Write();
520 
521  myTree->Write();
522 
523  TGraphErrors* graph = new TGraphErrors(25, xtalEta, mean, zero, meanErr);
524  graph->Draw("APL");
525  graph->Write();
526 
527  double zero50[50] = {0.};
528 
529  TGraphErrors* residualSigmaGraph = new TGraphErrors(50, loopArray, sigmaArray, zero50, sigmaErrorArray);
530  residualSigmaGraph->SetName("residualSigmaGraph");
531  residualSigmaGraph->Draw("APL");
532  residualSigmaGraph->Write();
533 
534  TGraphErrors* coefficientDistanceAtIterationGraph =
535  new TGraphErrors(50, loopArray, coefficientDistanceAtIteration, zero50, zero50);
536  coefficientDistanceAtIterationGraph->SetName("coefficientDistanceAtIterationGraph");
537  coefficientDistanceAtIterationGraph->Draw("APL");
538  coefficientDistanceAtIterationGraph->Write();
539 
540  Float_t noError[250] = {0.};
541 
542  Float_t ringInd[250];
543  for (int i = 0; i < 250; i++)
544  ringInd[i] = ringNumberCorrector(i);
545 
546  TGraphErrors* graphCoeff =
547  new TGraphErrors(theAlgorithm_->getNumberOfChannels(), ringInd, calibCoeff, noError, calibCoeffError);
548  graphCoeff->SetName("graphCoeff");
549  graphCoeff->Draw("APL");
550  graphCoeff->Write();
551 
552  // outputFile_->Write();//this automatically writes all histos on file
553 
554  h1_ZCandMult_->Write();
555  h1_reco_ZMass_->Write();
556 
557  h1_reco_ZMassCorr_->Write();
558  h1_reco_ZMassCorrBB_->Write();
559  h1_reco_ZMassCorrEE_->Write();
560 
561  outputFile_->Close();
562 
567 
568  // myZeeRescaleFactorPlots_ = new ZeeRescaleFactorPlots("zeeRescaleFactorPlots.root");
569  //myZeeRescaleFactorPlots_->writeHistograms( theAlgorithm_ );
570 
571  // delete myZeeRescaleFactorPlots_;
572 }
573 
574 //_____________________________________________________________________________
575 // Called at each event
576 //________________________________________
577 
579  using namespace edm;
580 
581 #ifdef DEBUG
582  std::cout << "[ZeeCalibration] Entering duringLoop" << std::endl;
583 #endif
584 
585  // code that used to be in beginJob
586  if (isfirstcall_) {
587  //inizializzare la geometria di ecal
589  iSetup.get<CaloGeometryRecord>().get(pG);
591 
592  myZeePlots_ = new ZeePlots("zeePlots.root");
593  // myZeeRescaleFactorPlots_ = new ZeeRescaleFactorPlots("zeeRescaleFactorPlots.root");
594 
595  // go to *OUR* rootfile and book histograms
596  outputFile_->cd();
597  bookHistograms();
598 
599  std::cout << "[ZeeCalibration::beginOfJob] Histograms booked " << std::endl;
600 
601  loopFlag_ = 0;
602 
603  //Read miscalibration map if requested
604  CaloMiscalibMapEcal* miscalibMap = nullptr;
605  if (!barrelfile_.empty() || !barrelfile_.empty()) {
606  miscalibMap = new CaloMiscalibMapEcal();
607  miscalibMap->prefillMap();
608  }
609 
610  if (!barrelfile_.empty()) {
611  MiscalibReaderFromXMLEcalBarrel barrelreader_(*miscalibMap);
612  barrelreader_.parseXMLMiscalibFile(barrelfile_);
613 #ifdef DEBUG
614  std::cout << "[ZeeCalibration::beginOfJob] Parsed EB miscal file" << std::endl;
615 #endif
616  }
617 
618  if (!endcapfile_.empty()) {
619  MiscalibReaderFromXMLEcalEndcap endcapreader_(*miscalibMap);
620  endcapreader_.parseXMLMiscalibFile(endcapfile_);
621 #ifdef DEBUG
622  std::cout << "[ZeeCalibration::beginOfJob] Parsed EE miscal file" << std::endl;
623 #endif
624  }
625 
626  std::cout << " theAlgorithm_->getNumberOfChannels() " << theAlgorithm_->getNumberOfChannels() << std::endl;
627 
629  for (int k = 0; k < theAlgorithm_->getNumberOfChannels(); k++) {
630  calibCoeff[k] = 1.;
631  calibCoeffError[k] = 0.;
632 
633  std::vector<DetId> ringIds;
634 
635  if (calibMode_ == "RING")
637 
638  if (calibMode_ == "MODULE")
640 
641  if (calibMode_ == "ABS_SCALE" || calibMode_ == "ETA_ET_MODE")
643 
644  if (miscalibMap) {
645  initCalibCoeff[k] = 0.;
646  for (unsigned int iid = 0; iid < ringIds.size(); ++iid) {
647  float miscalib = *(miscalibMap->get().getMap().find(ringIds[iid]));
648  // float miscalib=miscalibMap->get().getMap().find(ringIds[iid])->second; ////////AP
649  initCalibCoeff[k] += miscalib;
650  }
651  initCalibCoeff[k] /= (float)ringIds.size();
652  std::cout << k << " " << initCalibCoeff[k] << " " << ringIds.size() << std::endl;
653  } else {
654  initCalibCoeff[k] = 1.;
655  }
656  }
657 
658  ical = std::make_shared<EcalIntercalibConstants>();
659 
660  for (int k = 0; k < theAlgorithm_->getNumberOfChannels(); k++) {
661  // std::vector<DetId> ringIds = EcalRingCalibrationTools::getDetIdsInRing(k);
662 
663  std::vector<DetId> ringIds;
664 
665  if (calibMode_ == "RING")
667 
668  if (calibMode_ == "MODULE")
670 
671  if (calibMode_ == "ABS_SCALE" || calibMode_ == "ETA_ET_MODE")
673 
674  for (unsigned int iid = 0; iid < ringIds.size(); ++iid) {
675  // ical->setValue( ringIds[iid], 1. * initCalibCoeff[k] );
676 
677  if (ringIds[iid].subdetId() == EcalBarrel) {
678  EBDetId myEBDetId(ringIds[iid]);
679  h2_xtalMiscalibCoeffBarrel_->SetBinContent(
680  myEBDetId.ieta() + 86,
681  myEBDetId.iphi(),
682  *(miscalibMap->get().getMap().find(ringIds[iid]))); //fill TH2 with miscalibCoeff
683  }
684 
685  if (ringIds[iid].subdetId() == EcalEndcap) {
686  EEDetId myEEDetId(ringIds[iid]);
687  if (myEEDetId.zside() < 0)
688  h2_xtalMiscalibCoeffEndcapMinus_->SetBinContent(
689  myEEDetId.ix(),
690  myEEDetId.iy(),
691  *(miscalibMap->get().getMap().find(ringIds[iid]))); //fill TH2 with miscalibCoeff
692 
693  if (myEEDetId.zside() > 0)
694  h2_xtalMiscalibCoeffEndcapPlus_->SetBinContent(
695  myEEDetId.ix(),
696  myEEDetId.iy(),
697  *(miscalibMap->get().getMap().find(ringIds[iid]))); //fill TH2 with miscalibCoeff
698  }
699 
700  ical->setValue(ringIds[iid], *(miscalibMap->get().getMap().find(ringIds[iid])));
701  }
702 
703  read_events = 0;
704  init_ = false;
705  }
706  isfirstcall_ = false;
707  } // if isfirstcall
708 
710 
711  for (unsigned int iHLT = 0; iHLT < 200; ++iHLT) {
712  aHLTResults[iHLT] = false;
713  }
714 
715 #ifdef DEBUG
716  std::cout << "[ZeeCalibration::duringLoop] Done with initializing aHLTresults[] " << std::endl;
717 #endif
718 
719  edm::Handle<edm::TriggerResults> hltTriggerResultHandle;
720  iEvent.getByLabel(hlTriggerResults_, hltTriggerResultHandle);
721 
722  if (!hltTriggerResultHandle.isValid()) {
723  //std::cout << "invalid handle for HLT TriggerResults" << std::endl;
724  } else {
725  hltCount = hltTriggerResultHandle->size();
726 
727  if (loopFlag_ == 0)
728  myZeePlots_->fillHLTInfo(hltTriggerResultHandle);
729 
730 #ifdef DEBUG
731  std::cout << "[ZeeCalibration::duringLoop] Done with myZeePlots_->fillHLTInfo(hltTriggerResultHandle); "
732  << std::endl;
733 #endif
734 
735  for (int i = 0; i < hltCount; i++) {
736  aHLTResults[i] = hltTriggerResultHandle->accept(i);
737 
738  //HLT bit 32 = HLT1Electron
739  //HLT bit 34 = HLT2Electron
740  //HLT bit 35 = HLT2ElectronRelaxed
741  }
742 
743  if (!aHLTResults[32] && !aHLTResults[34] && !aHLTResults[35])
744  return kContinue;
745  }
746 
747 #ifdef DEBUG
748  std::cout << "[ZeeCalibration::duringLoop] End HLT section" << std::endl;
749 #endif
750 
752 
753  std::vector<HepMC::GenParticle*> mcEle;
754 
755  float myGenZMass(-1);
756 
757  if (!mcProducer_.empty()) {
758  //DUMP GENERATED Z MASS - BEGIN
759  Handle<HepMCProduct> hepProd;
760  // iEvent.getByLabel( "source", hepProd ) ;
761  iEvent.getByLabel(mcProducer_, hepProd);
762 
763  const HepMC::GenEvent* myGenEvent = hepProd->GetEvent();
764 
765  if (loopFlag_ == 0)
766  myZeePlots_->fillZMCInfo(&(*myGenEvent));
767 
768 #ifdef DEBUG
769  std::cout << "[ZeeCalibration::duringLoop] Done with myZeePlots_->fillZMCInfo( & (*myGenEvent) ); " << std::endl;
770 #endif
771 
772  for (HepMC::GenEvent::particle_const_iterator p = myGenEvent->particles_begin(); p != myGenEvent->particles_end();
773  ++p) {
774  //return a pointer to MC Z in the event
775  if ((*p)->pdg_id() == 23 && (*p)->status() == 2) {
776  myGenZMass = (*p)->momentum().m();
777  }
778  }
779  //DUMP GENERATED Z MASS - END
780 
781  if (loopFlag_ == 0)
782  myZeePlots_->fillEleMCInfo(&(*myGenEvent));
783 
784  //loop over MC positrons and find the closest MC positron in (eta,phi) phace space - begin
785  HepMC::GenParticle MCele;
786 
787  for (HepMC::GenEvent::particle_const_iterator p = myGenEvent->particles_begin(); p != myGenEvent->particles_end();
788  ++p) {
789  if (abs((*p)->pdg_id()) == 11) {
790  mcEle.push_back((*p));
791  MCele = *(*p);
792  }
793  }
794 
795  if (mcEle.size() == 2 && fabs(mcEle[0]->momentum().eta()) < 2.4 && fabs(mcEle[1]->momentum().eta()) < 2.4) {
796  NEVT++;
797 
798  if (fabs(mcEle[0]->momentum().eta()) < 1.479 && fabs(mcEle[1]->momentum().eta()) < 1.479)
799  MCZBB++;
800 
801  if ((fabs(mcEle[0]->momentum().eta()) > 1.479 && fabs(mcEle[1]->momentum().eta()) < 1.479) ||
802  (fabs(mcEle[0]->momentum().eta()) < 1.479 && fabs(mcEle[1]->momentum().eta()) > 1.479))
803  MCZEB++;
804 
805  if (fabs(mcEle[0]->momentum().eta()) > 1.479 && fabs(mcEle[1]->momentum().eta()) > 1.479)
806  MCZEE++;
807  }
808  }
809 
810  // Get EBRecHits
812  try {
813  iEvent.getByLabel(rechitProducer_, rechitCollection_, phits);
814  } catch (std::exception& ex) {
815  std::cerr << "Error! can't get the product EBRecHitCollection " << std::endl;
816  }
817  const EBRecHitCollection* hits = phits.product(); // get a ptr to the product
818 
819  // Get EERecHits
821  try {
822  iEvent.getByLabel(erechitProducer_, erechitCollection_, ephits);
823  } catch (std::exception& ex) {
824  std::cerr << "Error! can't get the product EERecHitCollection " << std::endl;
825  }
826  const EERecHitCollection* ehits = ephits.product(); // get a ptr to the product
827 
828  //Get Hybrid SuperClusters
830  try {
831  iEvent.getByLabel(scProducer_, scCollection_, pSuperClusters);
832  } catch (std::exception& ex) {
833  std::cerr << "Error! can't get the product SuperClusterCollection " << std::endl;
834  }
835  const reco::SuperClusterCollection* scCollection = pSuperClusters.product();
836 
837 #ifdef DEBUG
838  std::cout << "scCollection->size()" << scCollection->size() << std::endl;
839  for (reco::SuperClusterCollection::const_iterator scIt = scCollection->begin(); scIt != scCollection->end(); scIt++) {
840  std::cout << scIt->energy() << std::endl;
841  }
842 #endif
843 
844  //Get Island SuperClusters
845  Handle<reco::SuperClusterCollection> pIslandSuperClusters;
846  try {
847  iEvent.getByLabel(scIslandProducer_, scIslandCollection_, pIslandSuperClusters);
848  } catch (std::exception& ex) {
849  std::cerr << "Error! can't get the product IslandSuperClusterCollection " << std::endl;
850  }
851  const reco::SuperClusterCollection* scIslandCollection = pIslandSuperClusters.product();
852 
853 #ifdef DEBUG
854  std::cout << "scCollection->size()" << scIslandCollection->size() << std::endl;
855 #endif
856 
857  if ((scCollection->size() + scIslandCollection->size()) < 2)
858  return kContinue;
859 
860  // Get Electrons
862  try {
863  iEvent.getByLabel(electronProducer_, electronCollection_, pElectrons);
864  } catch (std::exception& ex) {
865  std::cerr << "Error! can't get the product ElectronCollection " << std::endl;
866  }
868 
869  /*
870  //reco-mc association map
871  std::map<HepMC::GenParticle*,const reco::PixelMatchGsfElectron*> myMCmap;
872 
873  fillMCmap(&(*electronCollection),mcEle,myMCmap);
874 
875  fillEleInfo(mcEle,myMCmap);
876  */
877 
878  if (electronCollection->size() < 2)
879  return kContinue;
880 
881  if (!hits && !ehits) {
882  std::cout << "!hits" << std::endl;
883  return kContinue;
884  }
885 
886  if (hits->empty() && ehits->empty()) {
887  std::cout << "hits->size() == 0" << std::endl;
888  return kContinue;
889  }
890 
891  if (!electronCollection) {
892  std::cout << "!electronCollection" << std::endl;
893  return kContinue;
894  }
895 
896  if (electronCollection->empty()) {
897  std::cout << "electronCollection->size() == 0" << std::endl;
898  return kContinue;
899  }
900 
904 
905  read_events++;
906 
907  // std::cout << "read_events = " << read_events << std::endl;
908 
910 
911 #ifdef DEBUG
912  std::cout << " Starting with myZeePlots_->fillEleInfo(electronCollection); " << std::endl;
913 #endif
914 
915  if (loopFlag_ == 0)
917 
918 #ifdef DEBUG
919  std::cout << " Done with myZeePlots_->fillEleInfo(electronCollection); " << std::endl;
920 #endif
921 
922  //FILL an electron vector - end
923  //###################################Electron-SC association: begin#####################################################
924  //Filling new ElectronCollection with new SC ref and calibElectron container
925  std::vector<calib::CalibElectron> calibElectrons;
926  //std::map< const calib::CalibElectron* , const reco::SuperCluster* > eleScMap;
927 
928  //#####################################Electron-SC association map: end#####################################################
929  for (unsigned int e_it = 0; e_it != electronCollection->size(); e_it++) {
930  calibElectrons.push_back(calib::CalibElectron(&((*electronCollection)[e_it]), hits, ehits));
931 #ifdef DEBUG
932  std::cout << calibElectrons.back().getRecoElectron()->superCluster()->energy() << " "
933  << calibElectrons.back().getRecoElectron()->energy() << std::endl;
934 #endif
935  // h1_recoEleEnergy_->Fill(calibElectrons.back().getRecoElectron()->superCluster()->energy());
936  }
937  // if (iLoop == 0)
938  //fillCalibElectrons(calibElectrons);
939 
940 #ifdef DEBUG
941  std::cout << "Filled histos" << std::endl;
942 #endif
943 
944  //COMBINATORY FOR Z MASS - begin
945  std::vector<std::pair<calib::CalibElectron*, calib::CalibElectron*> > zeeCandidates;
946  int myBestZ = -1;
947 
948  mass = -1.;
949  double DeltaMinvMin(5000.);
950 
951  if (calibElectrons.size() < 2)
952  return kContinue;
953 
954  for (unsigned int e_it = 0; e_it != calibElectrons.size() - 1; e_it++) {
955  for (unsigned int p_it = e_it + 1; p_it != calibElectrons.size(); p_it++) {
956 #ifdef DEBUG
957  std::cout << e_it << " " << calibElectrons[e_it].getRecoElectron()->charge() << " " << p_it << " "
958  << calibElectrons[p_it].getRecoElectron()->charge() << std::endl;
959 #endif
960  if (calibElectrons[e_it].getRecoElectron()->charge() * calibElectrons[p_it].getRecoElectron()->charge() != -1)
961  continue;
962 
964  std::pair<calib::CalibElectron*, calib::CalibElectron*>(&(calibElectrons[e_it]), &(calibElectrons[p_it])));
965 
966  if (mass < 0)
967  continue;
968 
969 #ifdef DEBUG
970  std::cout << "#######################mass " << mass << std::endl;
971 #endif
972 
973  zeeCandidates.push_back(
974  std::pair<calib::CalibElectron*, calib::CalibElectron*>(&(calibElectrons[e_it]), &(calibElectrons[p_it])));
975  double DeltaMinv = fabs(mass - MZ);
976 
977  if (DeltaMinv < DeltaMinvMin) {
978  DeltaMinvMin = DeltaMinv;
979  myBestZ = zeeCandidates.size() - 1;
980  }
981  }
982  }
983 
984  // h_DeltaZMassDistr_[loopFlag_]->Fill( (mass-MZ) / MZ );
985 
986  // zeeCa->Fill(zeeCandidates);
987  //
988  h1_ZCandMult_->Fill(zeeCandidates.size());
989 
990  if (zeeCandidates.empty() || myBestZ == -1)
991  return kContinue;
992 
993  if (loopFlag_ == 0)
994  myZeePlots_->fillZInfo(zeeCandidates[myBestZ]);
995 
996 #ifdef DEBUG
997  std::cout << "Found ZCandidates " << myBestZ << std::endl;
998 #endif
999 
1000  // h1_zMassResol_ ->Fill(mass-myGenZMass);
1001 
1003 
1004  int class1 = zeeCandidates[myBestZ].first->getRecoElectron()->classification();
1005  int class2 = zeeCandidates[myBestZ].second->getRecoElectron()->classification();
1006 
1007  h1_eleClasses_->Fill(class1);
1008  h1_eleClasses_->Fill(class2);
1009 
1010  std::cout << "BEFORE " << std::endl;
1011 
1012  // myZeePlots_->fillEleClassesPlots( zeeCandidates[myBestZ].first );
1013  //myZeePlots_->fillEleClassesPlots( zeeCandidates[myBestZ].second );
1014 
1015  std::cout << "AFTER " << std::endl;
1016 
1018 
1019  if (class1 < 100)
1020  // h1_Elec_->Fill(1);
1022  if (class1 >= 100)
1024 
1025  if (class2 < 100)
1027  if (class2 >= 100)
1029 
1030  if (class1 == 0)
1032  if (class1 == 100)
1034  if (class1 == 10 || class1 == 20)
1036  if (class1 == 110 || class1 == 120)
1038  if (class1 >= 30 && class1 <= 34)
1040  if (class1 >= 130 && class1 <= 134)
1042  if (class1 == 40)
1044  if (class1 == 140)
1046 
1047  if (class2 == 0)
1049  if (class2 == 100)
1051  if (class2 == 10 || class2 == 20)
1053  if (class2 == 110 || class2 == 120)
1055  if (class2 >= 30 && class2 <= 34)
1057  if (class2 >= 130 && class2 <= 134)
1059  if (class2 == 40)
1061  if (class2 == 140)
1063 
1065 
1067 
1068  DetId firstElehottestDetId =
1070  zeeCandidates[myBestZ].first->getRecoElectron()->superCluster()->seed()->hitsAndFractions(), hits, ehits)
1071  .first;
1072  DetId secondElehottestDetId =
1074  zeeCandidates[myBestZ].second->getRecoElectron()->superCluster()->seed()->hitsAndFractions(), hits, ehits)
1075  .first;
1076 
1077  bool firstElectronIsOnModuleBorder(false);
1078  bool secondElectronIsOnModuleBorder(false);
1079 
1081 
1082  if (class1 < 100) {
1083  if (firstElehottestDetId.subdetId() == EcalBarrel)
1084  firstElectronIsOnModuleBorder = xtalIsOnModuleBorder(firstElehottestDetId);
1085 
1087 
1088  if (firstElehottestDetId.subdetId() == EcalBarrel && !firstElectronIsOnModuleBorder)
1090  }
1091 
1092  if (class2 < 100) {
1093  if (secondElehottestDetId.subdetId() == EcalBarrel)
1094  secondElectronIsOnModuleBorder = xtalIsOnModuleBorder(secondElehottestDetId);
1095 
1097 
1098  if (secondElehottestDetId.subdetId() == EcalBarrel && !secondElectronIsOnModuleBorder)
1100  }
1101 
1102  if (class1 < 100) {
1103  if (firstElehottestDetId.subdetId() == EcalBarrel && firstElectronIsOnModuleBorder) {
1104  h1_borderElectronClassification_->Fill(class1);
1105  return kContinue;
1106  }
1107  }
1108 
1109  if (class2 < 100) {
1110  if (secondElehottestDetId.subdetId() == EcalBarrel && secondElectronIsOnModuleBorder) {
1111  h1_borderElectronClassification_->Fill(class2);
1112  return kContinue;
1113  }
1114  }
1115 
1118 
1119  if (class1 < 100 && class2 < 100) {
1120  BBZN++;
1121  if (class1 == 0 && class2 == 0)
1122  BBZN_gg++;
1123  if (class1 < 21 && class2 < 21)
1124  BBZN_tt++;
1125  if (class1 < 21 || class2 < 21)
1126  BBZN_t0++;
1127  }
1128 
1129  if (class1 >= 100 && class2 >= 100) {
1130  EEZN++;
1131  if (class1 == 100 && class2 == 100)
1132  EEZN_gg++;
1133  if (class1 < 121 && class2 < 121)
1134  EEZN_tt++;
1135  if (class1 < 121 || class2 < 121)
1136  EEZN_t0++;
1137  }
1138 
1139  if ((class1 < 100 && class2 >= 100) || (class2 < 100 && class1 >= 100)) {
1140  EBZN++;
1141  if ((class1 == 0 && class2 == 100) || (class2 == 0 && class1 == 100))
1142  EBZN_gg++;
1143  if ((class1 < 21 && class2 < 121) || (class2 < 21 && class1 < 121))
1144  EBZN_tt++;
1145  if (class2 < 21 || class1 < 21 || class2 < 121 || class1 < 121)
1146  EBZN_t0++;
1147  }
1148 
1150 
1151  if (myBestZ == -1)
1152  return kContinue;
1153 
1154  bool invMassBool = ((mass > minInvMassCut_) && (mass < maxInvMassCut_));
1155 
1156  bool selectionBool = false;
1157  //0 = all electrons (but no crack)
1158 
1160 
1161  float theta1 = 2. * atan(exp(-zeeCandidates[myBestZ].first->getRecoElectron()->superCluster()->eta()));
1162  bool ET_1 = ((zeeCandidates[myBestZ].first->getRecoElectron()->superCluster()->energy() * sin(theta1)) > 20.);
1163 
1164  float theta2 = 2. * atan(exp(-zeeCandidates[myBestZ].second->getRecoElectron()->superCluster()->eta()));
1165  bool ET_2 = ((zeeCandidates[myBestZ].second->getRecoElectron()->superCluster()->energy() * sin(theta2)) > 20.);
1166 
1167  bool HoE_1 = (zeeCandidates[myBestZ].first->getRecoElectron()->hadronicOverEm() < 0.115);
1168  bool HoE_2 = (zeeCandidates[myBestZ].second->getRecoElectron()->hadronicOverEm() < 0.115);
1169 
1170  bool DeltaPhiIn_1 = (zeeCandidates[myBestZ].first->getRecoElectron()->deltaPhiSuperClusterTrackAtVtx() < 0.090);
1171  bool DeltaPhiIn_2 = (zeeCandidates[myBestZ].second->getRecoElectron()->deltaPhiSuperClusterTrackAtVtx() < 0.090);
1172 
1173  bool DeltaEtaIn_1 = (zeeCandidates[myBestZ].first->getRecoElectron()->deltaEtaSuperClusterTrackAtVtx() < 0.0090);
1174  bool DeltaEtaIn_2 = (zeeCandidates[myBestZ].second->getRecoElectron()->deltaEtaSuperClusterTrackAtVtx() < 0.0090);
1175 
1177 
1178  if (!(invMassBool && ET_1 && ET_2 && HoE_1 && HoE_2 && DeltaPhiIn_1 && DeltaPhiIn_2 && DeltaEtaIn_1 && DeltaEtaIn_2))
1179  return kContinue;
1181 
1182  h1_eventsAfterEWKSelection_->Fill(1);
1183 
1185 
1186  int c1st = zeeCandidates[myBestZ].first->getRecoElectron()->classification();
1187  int c2nd = zeeCandidates[myBestZ].second->getRecoElectron()->classification();
1188  if (electronSelection_ == 0)
1189  selectionBool = (myBestZ != -1 && c1st != 40 && c1st != 40 && c2nd != 40 && c2nd != 140);
1190 
1191  //1 = all electrons are Golden, BB or Narrow
1192 
1193  if (electronSelection_ == 1)
1194  selectionBool =
1195  (myBestZ != -1 && (c1st == 0 || c1st == 10 || c1st == 20 || c1st == 100 || c1st == 110 || c1st == 120) &&
1196  (c2nd == 0 || c2nd == 10 || c2nd == 20 || c2nd == 100 || c2nd == 110 || c2nd == 120));
1197 
1198  //2 = all electrons are Golden
1199  if (electronSelection_ == 2)
1200  selectionBool = (myBestZ != -1 && (c1st == 0 || c1st == 100) && (c2nd == 0 || c2nd == 100));
1201  //3 = all electrons are showering
1202  if (electronSelection_ == 3)
1203  selectionBool = (myBestZ != -1 && ((c1st >= 30 && c1st <= 34) || ((c1st >= 130 && c1st <= 134))) &&
1204  ((c2nd >= 30 && c2nd <= 34) || ((c2nd >= 130 && c2nd <= 134)))
1205 
1206  );
1207 
1208  //4 = all Barrel electrons are Golden, BB or Narrow; take all Endcap electrons
1209 
1210  if (electronSelection_ == 4)
1211  selectionBool = (myBestZ != -1 && (
1212 
1213  ((c1st == 0 || c1st == 10 || c1st == 20) && c2nd >= 100 && c2nd != 140)
1214 
1215  ||
1216 
1217  ((c2nd == 0 || c2nd == 10 || c2nd == 20) && c1st >= 100 && c1st != 140)
1218 
1219  ));
1220 
1221  //5 = all Endcap electrons (but no crack)
1222 
1223  if (electronSelection_ == 5)
1224  selectionBool = (myBestZ != -1 && c1st >= 100 && c2nd >= 100 && c1st != 140 && c2nd != 140);
1225 
1226  //6 = all Barrel electrons (but no crack)
1227 
1228  if (electronSelection_ == 6)
1229  selectionBool = (myBestZ != -1 && c1st < 100 && c2nd < 100 && c1st != 40 && c2nd != 40);
1230 
1231  //7 = this eliminates the events which have 1 ele in the Barrel and 1 in the Endcap
1232 
1233  if (electronSelection_ == 7)
1234  selectionBool = (myBestZ != -1 && !(c1st < 100 && c2nd >= 100) && !(c1st >= 100 && c2nd < 100));
1235 
1236  float ele1EnergyCorrection(1.);
1237  float ele2EnergyCorrection(1.);
1238 
1239  if (invMassBool && selectionBool && wantEtaCorrection_) {
1240  ele1EnergyCorrection = getEtaCorrection(zeeCandidates[myBestZ].first->getRecoElectron());
1241  ele2EnergyCorrection = getEtaCorrection(zeeCandidates[myBestZ].second->getRecoElectron());
1242  }
1243 
1244  if (invMassBool && selectionBool) {
1246  ZeeKinematicTools::cosThetaElectrons_SC(zeeCandidates[myBestZ], ele1EnergyCorrection, ele2EnergyCorrection));
1248  ZeeKinematicTools::cosThetaElectrons_TK(zeeCandidates[myBestZ], ele1EnergyCorrection, ele2EnergyCorrection));
1250  ZeeKinematicTools::cosThetaElectrons_SC(zeeCandidates[myBestZ], ele1EnergyCorrection, ele2EnergyCorrection) /
1252  zeeCandidates[myBestZ], ele1EnergyCorrection, ele2EnergyCorrection) -
1253  1.);
1254 
1255  if (!mcProducer_.empty()) {
1256  h1_zMassResol_->Fill(mass - myGenZMass);
1257 
1258  //reco-mc association map - begin
1259 
1260  std::map<HepMC::GenParticle*, const reco::GsfElectron*> myMCmap;
1261 
1262  std::vector<const reco::GsfElectron*> dauElectronCollection;
1263 
1264  dauElectronCollection.push_back(zeeCandidates[myBestZ].first->getRecoElectron());
1265  dauElectronCollection.push_back(zeeCandidates[myBestZ].second->getRecoElectron());
1266 
1267  fillMCmap(&dauElectronCollection, mcEle, myMCmap);
1268  fillEleInfo(mcEle, myMCmap);
1269  //h_DiffZMassDistr_[loopFlag_]->Fill( (mass-myGenZMass) );
1270  }
1271 
1272  //PUT f(eta) IN OUR Zee ALGORITHM
1273  theAlgorithm_->addEvent(zeeCandidates[myBestZ].first,
1274  zeeCandidates[myBestZ].second,
1275  MZ * sqrt(ele1EnergyCorrection * ele2EnergyCorrection));
1276 
1277  h1_reco_ZMass_->Fill(ZeeKinematicTools::calculateZMass_withTK(zeeCandidates[myBestZ]));
1278 
1280  zeeCandidates[myBestZ], ele1EnergyCorrection, ele2EnergyCorrection));
1281 
1282  int c1st = zeeCandidates[myBestZ].first->getRecoElectron()->classification();
1283  int c2nd = zeeCandidates[myBestZ].second->getRecoElectron()->classification();
1284  if (c1st < 100 && c2nd < 100)
1286  zeeCandidates[myBestZ], ele1EnergyCorrection, ele2EnergyCorrection));
1287 
1288  if (c1st >= 100 && c2nd >= 100)
1290  zeeCandidates[myBestZ], ele1EnergyCorrection, ele2EnergyCorrection));
1291 
1293  zeeCandidates[myBestZ], ele1EnergyCorrection, ele2EnergyCorrection);
1294 
1296  zeeCandidates[myBestZ], ele1EnergyCorrection, ele2EnergyCorrection) -
1297  myGenZMass;
1298 
1299  // h_ZMassDistr_[loopFlag_]->Fill(ZeeKinematicTools::calculateZMassWithCorrectedElectrons_withTK(zeeCandidates[myBestZ],ele1EnergyCorrection,ele2EnergyCorrection));
1300 
1301  myTree->Fill();
1302  }
1303 
1304 #ifdef DEBUG
1305  std::cout << "Added event to algorithm" << std::endl;
1306 #endif
1307 
1308  return kContinue;
1309 }
1310 //end of ZeeCalibration::duringLoop
1311 
1312 // Called at beginning of loop
1313 void ZeeCalibration::startingNewLoop(unsigned int iLoop) {
1314  std::cout << "[ZeeCalibration] Starting loop number " << iLoop << std::endl;
1315 
1317 
1318  resetVariables();
1319 
1320  resetHistograms();
1321 
1322 #ifdef DEBUG
1323  std::cout << "[ZeeCalibration] exiting from startingNewLoop" << std::endl;
1324 #endif
1325 }
1326 
1327 // Called at end of loop
1329  double par[3];
1330  double errpar[3];
1331  double zChi2;
1332  int zIters;
1333 
1334  ZIterativeAlgorithmWithFit::gausfit(h1_reco_ZMass_, par, errpar, 2., 2., &zChi2, &zIters);
1335 
1336  h2_zMassVsLoop_->Fill(loopFlag_, par[1]);
1337 
1338  h2_zMassDiffVsLoop_->Fill(loopFlag_, (par[1] - MZ) / MZ);
1339 
1340  h2_zWidthVsLoop_->Fill(loopFlag_, par[2]);
1341 
1343 
1344  std::cout << "[ZeeCalibration] Ending loop " << iLoop << std::endl;
1345  //RUN the algorithm
1347 
1348  const std::vector<float>& optimizedCoefficients = theAlgorithm_->getOptimizedCoefficients();
1349  const std::vector<float>& optimizedCoefficientsError = theAlgorithm_->getOptimizedCoefficientsError();
1350  //const std::vector<float>& weightSum = theAlgorithm_->getWeightSum();
1351  const std::vector<float>& optimizedChi2 = theAlgorithm_->getOptimizedChiSquare();
1352  const std::vector<int>& optimizedIterations = theAlgorithm_->getOptimizedIterations();
1353 
1354  //#ifdef DEBUG
1355  std::cout << "Optimized coefficients " << optimizedCoefficients.size() << std::endl;
1356  //#endif
1357 
1358  // h2_coeffVsLoop_->Fill(loopFlag_, optimizedCoefficients[75]); //show the evolution of just 1 ring coefficient (well chosen...)
1359 
1361  for (unsigned int ieta = 0; ieta < optimizedCoefficients.size(); ieta++) {
1362  NewCalibCoeff[ieta] = calibCoeff[ieta] * optimizedCoefficients[ieta];
1363 
1364  h2_chi2_[loopFlag_]->Fill(ringNumberCorrector(ieta), optimizedChi2[ieta]);
1365  h2_iterations_[loopFlag_]->Fill(ringNumberCorrector(ieta), optimizedIterations[ieta]);
1366  }
1368 
1370  computeCoefficientDistanceAtIteration(calibCoeff, NewCalibCoeff, optimizedCoefficients.size());
1371 
1372  std::cout << "Iteration # : " << loopFlag_ << " CoefficientDistanceAtIteration "
1373  << coefficientDistanceAtIteration[loopFlag_] << std::endl;
1374  std::cout << "size " << optimizedCoefficients.size() << std::endl;
1375 
1376  for (unsigned int ieta = 0; ieta < optimizedCoefficients.size(); ieta++) {
1377  calibCoeff[ieta] *= optimizedCoefficients[ieta];
1379  calibCoeff[ieta] * sqrt(pow(optimizedCoefficientsError[ieta] / optimizedCoefficients[ieta], 2) +
1381  //calibCoeffError[ieta] = optimizedCoefficientsError[ieta];
1382 
1383 #ifdef DEBUG
1384  std::cout << ieta << " " << optimizedCoefficients[ieta] << std::endl;
1385 #endif
1386 
1387  std::vector<DetId> ringIds;
1388 
1389  if (calibMode_ == "RING")
1391 
1392  if (calibMode_ == "MODULE")
1394 
1395  if (calibMode_ == "ABS_SCALE" || calibMode_ == "ETA_ET_MODE")
1397 
1398  for (unsigned int iid = 0; iid < ringIds.size(); ++iid) {
1399  if (ringIds[iid].subdetId() == EcalBarrel) {
1400  EBDetId myEBDetId(ringIds[iid]);
1401  h2_xtalRecalibCoeffBarrel_[loopFlag_]->SetBinContent(
1402  myEBDetId.ieta() + 86,
1403  myEBDetId.iphi(),
1404  100 * (calibCoeff[ieta] * initCalibCoeff[ieta] - 1.)); //fill TH2 with recalibCoeff
1405  }
1406 
1407  if (ringIds[iid].subdetId() == EcalEndcap) {
1408  EEDetId myEEDetId(ringIds[iid]);
1409  if (myEEDetId.zside() < 0)
1411  myEEDetId.ix(),
1412  myEEDetId.iy(),
1413  100 * (calibCoeff[ieta] * initCalibCoeff[ieta] - 1.)); //fill TH2 with recalibCoeff
1414 
1415  if (myEEDetId.zside() > 0)
1416  h2_xtalRecalibCoeffEndcapPlus_[loopFlag_]->SetBinContent(
1417  myEEDetId.ix(),
1418  myEEDetId.iy(),
1419  100 * (calibCoeff[ieta] * initCalibCoeff[ieta] - 1.)); //fill TH2 with recalibCoeff
1420  }
1421 
1422  ical->setValue(ringIds[iid], *(ical->getMap().find(ringIds[iid])) * optimizedCoefficients[ieta]);
1423  }
1424  }
1425 
1427 
1428  for (int k = 0; k < theAlgorithm_->getNumberOfChannels(); k++) {
1429  bool isNearCrack =
1430  (abs(ringNumberCorrector(k)) == 1 || abs(ringNumberCorrector(k)) == 25 || abs(ringNumberCorrector(k)) == 26 ||
1431  abs(ringNumberCorrector(k)) == 45 || abs(ringNumberCorrector(k)) == 46 || abs(ringNumberCorrector(k)) == 65 ||
1432  abs(ringNumberCorrector(k)) == 66 || abs(ringNumberCorrector(k)) == 85 || abs(ringNumberCorrector(k)) == 86 ||
1433  abs(ringNumberCorrector(k)) == 124);
1434 
1435  if (!isNearCrack) {
1436  // h2_miscalRecalParz_[iLoop]->Fill( initCalibCoeff[k], 1./calibCoeff[k] );
1437  h1_mcParz_[iLoop]->Fill(initCalibCoeff[k] * calibCoeff[k] - 1.);
1438 
1439  if (k < 170) {
1440  //h2_miscalRecalEBParz_[iLoop]->Fill( initCalibCoeff[k], 1./calibCoeff[k] );
1441  h1_mcEBParz_[iLoop]->Fill(initCalibCoeff[k] * calibCoeff[k] - 1.);
1442  }
1443 
1444  if (k >= 170) {
1445  //h2_miscalRecalEEParz_[iLoop]->Fill( initCalibCoeff[k], 1./calibCoeff[k] );
1446  h1_mcEEParz_[iLoop]->Fill(initCalibCoeff[k] * calibCoeff[k] - 1.);
1447  }
1448  }
1449  }
1450 
1452  double parResidual[3];
1453  double errparResidual[3];
1454  double zResChi2;
1455  int zResIters;
1456 
1457  ZIterativeAlgorithmWithFit::gausfit(h1_mcParz_[iLoop], parResidual, errparResidual, 3., 3., &zResChi2, &zResIters);
1458  //h1_mcParz_[iLoop]->Fit("gaus");
1459 
1460  h2_residualSigma_->Fill(loopFlag_ + 1, parResidual[2]);
1461  loopArray[loopFlag_] = loopFlag_ + 1;
1462  sigmaArray[loopFlag_] = parResidual[2];
1463  sigmaErrorArray[loopFlag_] = errparResidual[2];
1464 
1465  std::cout << "Fit on residuals, sigma is " << parResidual[2] << " +/- " << errparResidual[2] << std::endl;
1466 
1468  outputFile_->cd();
1469 
1470  // h2_miscalRecalParz_[iLoop]->Write();
1471  h1_mcParz_[iLoop]->Write();
1472 
1473  //h2_miscalRecalEBParz_[iLoop]->Write();
1474  h1_mcEBParz_[iLoop]->Write();
1475 
1476  //h2_miscalRecalEEParz_[iLoop]->Write();
1477  h1_mcEEParz_[iLoop]->Write();
1481 
1483 
1484  loopFlag_++;
1485 
1486 #ifdef DEBUG
1487  std::cout << " loopFlag_ is " << loopFlag_ << std::endl;
1488 #endif
1489 
1490  if (iLoop == theMaxLoops - 1 || iLoop >= theMaxLoops)
1491  return kStop;
1492  else
1493  return kContinue;
1494 }
1495 
1497  h1_eventsBeforeEWKSelection_ = new TH1F("h1_eventsBeforeEWKSelection", "h1_eventsBeforeEWKSelection", 5, 0, 5);
1498  h1_eventsAfterEWKSelection_ = new TH1F("h1_eventsAfterEWKSelection", "h1_eventsAfterEWKSelection", 5, 0, 5);
1499 
1501  new TH1F("h1_eventsBeforeBorderSelection", "h1_eventsBeforeBorderSelection", 5, 0, 5);
1502  h1_eventsAfterBorderSelection_ = new TH1F("h1_eventsAfterBorderSelection", "h1_eventsAfterBorderSelection", 5, 0, 5);
1503 
1504  h1_seedOverSC_ = new TH1F("h1_seedOverSC", "h1_seedOverSC", 400, 0., 2.);
1505 
1507 
1509  new TH1F("h1_borderElectronClassification", "h1_borderElectronClassification", 55, -5, 50);
1510  h1_preshowerOverSC_ = new TH1F("h1_preshowerOverSC", "h1_preshowerOverSC", 400, 0., 1.);
1511 
1512  h2_fEtaBarrelGood_ = new TH2F("fEtaBarrelGood", "fEtaBarrelGood", 800, -4., 4., 800, 0.8, 1.2);
1513  h2_fEtaBarrelGood_->SetXTitle("Eta");
1514  h2_fEtaBarrelGood_->SetYTitle("1/fEtaBarrelGood");
1515 
1516  h2_fEtaBarrelBad_ = new TH2F("fEtaBarrelBad", "fEtaBarrelBad", 800, -4., 4., 800, 0.8, 1.2);
1517  h2_fEtaBarrelBad_->SetXTitle("Eta");
1518  h2_fEtaBarrelBad_->SetYTitle("1/fEtaBarrelBad");
1519 
1520  h2_fEtaEndcapGood_ = new TH2F("fEtaEndcapGood", "fEtaEndcapGood", 800, -4., 4., 800, 0.8, 1.2);
1521  h2_fEtaEndcapGood_->SetXTitle("Eta");
1522  h2_fEtaEndcapGood_->SetYTitle("1/fEtaEndcapGood");
1523 
1524  h2_fEtaEndcapBad_ = new TH2F("fEtaEndcapBad", "fEtaEndcapBad", 800, -4., 4., 800, 0.8, 1.2);
1525  h2_fEtaEndcapBad_->SetXTitle("Eta");
1526  h2_fEtaEndcapBad_->SetYTitle("1/fEtaEndcapBad");
1527 
1528  for (int i = 0; i < 2; i++) {
1529  char histoName[50];
1530 
1531  sprintf(histoName, "h_eleEffEta_%d", i);
1532  h_eleEffEta_[i] = new TH1F(histoName, histoName, 150, 0., 2.7);
1533  h_eleEffEta_[i]->SetXTitle("|#eta|");
1534 
1535  sprintf(histoName, "h_eleEffPhi_%d", i);
1536  h_eleEffPhi_[i] = new TH1F(histoName, histoName, 400, -4., 4.);
1537  h_eleEffPhi_[i]->SetXTitle("Phi");
1538 
1539  sprintf(histoName, "h_eleEffPt_%d", i);
1540  h_eleEffPt_[i] = new TH1F(histoName, histoName, 200, 0., 200.);
1541  h_eleEffPt_[i]->SetXTitle("p_{T}(GeV/c)");
1542  }
1543 
1545  new TH2F("h2_xtalMiscalibCoeffBarrel", "h2_xtalMiscalibCoeffBarrel", 171, -85, 85, 360, 0, 360);
1547  new TH2F("h2_xtalMiscalibCoeffEndcapMinus", "h2_xtalMiscalibCoeffEndcapMinus", 100, 0, 100, 100, 0, 100);
1549  new TH2F("h2_xtalMiscalibCoeffEndcapPlus", "h2_xtalMiscalibCoeffEndcapPlus", 100, 0, 100, 100, 0, 100);
1550 
1551  h2_xtalMiscalibCoeffBarrel_->SetXTitle("ieta");
1552  h2_xtalMiscalibCoeffBarrel_->SetYTitle("iphi");
1553 
1554  h2_xtalMiscalibCoeffEndcapMinus_->SetXTitle("ix");
1555  h2_xtalMiscalibCoeffEndcapMinus_->SetYTitle("iy");
1556 
1557  for (int i = 0; i < 25; i++) {
1558  char histoName[50];
1559  sprintf(histoName, "h_ESCEtrueVsEta_%d", i);
1560 
1561  h_ESCEtrueVsEta_[i] = new TH2F(histoName, histoName, 150, 0., 2.7, 300, 0., 1.5);
1562  h_ESCEtrueVsEta_[i]->SetXTitle("|#eta|");
1563  h_ESCEtrueVsEta_[i]->SetYTitle("E_{SC,raw}/E_{MC}");
1564 
1565  sprintf(histoName, "h_ESCEtrue_%d", i);
1566 
1567  h_ESCEtrue_[i] = new TH1F(histoName, histoName, 300, 0., 1.5);
1568 
1569  sprintf(histoName, "h2_chi2_%d", i);
1570  h2_chi2_[i] = new TH2F(histoName, histoName, 1000, -150, 150, 1000, -1, 5);
1571 
1572  sprintf(histoName, "h2_iterations_%d", i);
1573  h2_iterations_[i] = new TH2F(histoName, histoName, 1000, -150, 150, 1000, -1, 15);
1574 
1575  sprintf(histoName, "h_ESCcorrEtrueVsEta_%d", i);
1576 
1577  h_ESCcorrEtrueVsEta_[i] = new TH2F(histoName, histoName, 150, 0., 2.7, 300, 0., 1.5);
1578  h_ESCcorrEtrueVsEta_[i]->SetXTitle("|#eta|");
1579  h_ESCcorrEtrueVsEta_[i]->SetYTitle("E_{SC,#eta-corr}/E_{MC}");
1580 
1581  sprintf(histoName, "h_ESCcorrEtrue_%d", i);
1582 
1583  h_ESCcorrEtrue_[i] = new TH1F(histoName, histoName, 300, 0., 1.5);
1584 
1585  sprintf(histoName, "h2_xtalRecalibCoeffBarrel_%d", i);
1586  h2_xtalRecalibCoeffBarrel_[i] = new TH2F(histoName, histoName, 171, -85, 85, 360, 0, 360);
1587 
1588  h2_xtalRecalibCoeffBarrel_[i]->SetXTitle("ieta");
1589  h2_xtalRecalibCoeffBarrel_[i]->SetYTitle("iphi");
1590 
1591  sprintf(histoName, "h2_xtalRecalibCoeffEndcapMinus_%d", i);
1592  h2_xtalRecalibCoeffEndcapMinus_[i] = new TH2F(histoName, histoName, 100, 0, 100, 100, 0, 100);
1593  h2_xtalRecalibCoeffEndcapMinus_[i]->SetXTitle("ix");
1594  h2_xtalRecalibCoeffEndcapMinus_[i]->SetYTitle("iy");
1595 
1596  sprintf(histoName, "h2_xtalRecalibCoeffEndcapPlus_%d", i);
1597  h2_xtalRecalibCoeffEndcapPlus_[i] = new TH2F(histoName, histoName, 100, 0, 100, 100, 0, 100);
1598  h2_xtalRecalibCoeffEndcapPlus_[i]->SetXTitle("ix");
1599  h2_xtalRecalibCoeffEndcapPlus_[i]->SetYTitle("iy");
1600  }
1601 
1602  /*
1603  for (int i=0;i<15;i++)
1604  {
1605 
1606  char histoName[50];
1607 
1608  sprintf(histoName,"h_DiffZMassDistr_%d",i);
1609  h_DiffZMassDistr_[i] = new TH1F(histoName,histoName, 400, -20., 20.);
1610  h_DiffZMassDistr_[i]->SetXTitle("M_{Z, reco} - M_{Z, MC}");
1611  h_DiffZMassDistr_[i]->SetYTitle("events");
1612 
1613  sprintf(histoName,"h_ZMassDistr_%d",i);
1614  h_ZMassDistr_[i] = new TH1F(histoName,histoName, 200, 0., 150.);
1615  h_ZMassDistr_[i]->SetXTitle("RecoZmass (GeV)");
1616  h_ZMassDistr_[i]->SetYTitle("events");
1617 
1618  }
1619  */
1620 
1621  h1_zMassResol_ = new TH1F("zMassResol", "zMassResol", 200, -50., 50.);
1622  h1_zMassResol_->SetXTitle("M_{Z, reco} - M_{Z, MC}");
1623  h1_zMassResol_->SetYTitle("events");
1624 
1625  h1_eleEtaResol_ = new TH1F("eleEtaResol", "eleEtaResol", 100, -0.01, 0.01);
1626  h1_eleEtaResol_->SetXTitle("#eta_{reco} - #eta_{MC}");
1627  h1_eleEtaResol_->SetYTitle("events");
1628 
1629  h1_electronCosTheta_TK_ = new TH1F("electronCosTheta_TK", "electronCosTheta_TK", 100, -1, 1);
1630  h1_electronCosTheta_TK_->SetXTitle("cos #theta_{12}");
1631  h1_electronCosTheta_TK_->SetYTitle("events");
1632 
1633  h1_electronCosTheta_SC_ = new TH1F("electronCosTheta_SC", "electronCosTheta_SC", 100, -1, 1);
1634  h1_electronCosTheta_SC_->SetXTitle("cos #theta_{12}");
1635  h1_electronCosTheta_SC_->SetYTitle("events");
1636 
1637  h1_electronCosTheta_SC_TK_ = new TH1F("electronCosTheta_SC_TK", "electronCosTheta_SC_TK", 200, -0.1, 0.1);
1638  h1_electronCosTheta_SC_TK_->SetXTitle("cos #theta_{12}^{SC}/ cos #theta_{12}^{TK} - 1");
1639  h1_electronCosTheta_SC_TK_->SetYTitle("events");
1640 
1641  h1_elePhiResol_ = new TH1F("elePhiResol", "elePhiResol", 100, -0.01, 0.01);
1642  h1_elePhiResol_->SetXTitle("#phi_{reco} - #phi_{MC}");
1643  h1_elePhiResol_->SetYTitle("events");
1644 
1645  h1_zEtaResol_ = new TH1F("zEtaResol", "zEtaResol", 200, -1., 1.);
1646  h1_zEtaResol_->SetXTitle("#eta_{Z, reco} - #eta_{Z, MC}");
1647  h1_zEtaResol_->SetYTitle("events");
1648 
1649  h1_zPhiResol_ = new TH1F("zPhiResol", "zPhiResol", 200, -1., 1.);
1650  h1_zPhiResol_->SetXTitle("#phi_{Z, reco} - #phi_{Z, MC}");
1651  h1_zPhiResol_->SetYTitle("events");
1652 
1653  h1_nEleReco_ = new TH1F("nEleReco", "Number of reco electrons", 10, -0.5, 10.5);
1654  h1_nEleReco_->SetXTitle("nEleReco");
1655  h1_nEleReco_->SetYTitle("events");
1656 
1657  // h1_occupancyVsEta_ = new TH1F("occupancyVsEta","occupancyVsEta",EcalRingCalibrationTools::N_RING_TOTAL,0,(float)EcalRingCalibrationTools::N_RING_TOTAL);
1658 
1659  h1_occupancyVsEta_ = new TH1F("occupancyVsEta", "occupancyVsEta", 249, -124, 124);
1660  h1_occupancyVsEta_->SetYTitle("Weighted electron statistics");
1661  h1_occupancyVsEta_->SetXTitle("Eta channel");
1662 
1663  h1_weightSumMeanBarrel_ = new TH1F("weightSumMeanBarrel", "weightSumMeanBarrel", 10000, 0, 10000);
1664  h1_weightSumMeanEndcap_ = new TH1F("weightSumMeanEndcap", "weightSumMeanEndcap", 10000, 0, 10000);
1665 
1666  h1_occupancy_ = new TH1F("occupancy", "occupancy", 1000, 0, 10000);
1667  h1_occupancy_->SetXTitle("Weighted electron statistics");
1668 
1669  h1_occupancyBarrel_ = new TH1F("occupancyBarrel", "occupancyBarrel", 1000, 0, 10000);
1670  h1_occupancyBarrel_->SetXTitle("Weighted electron statistics");
1671 
1672  h1_occupancyEndcap_ = new TH1F("occupancyEndcap", "occupancyEndcap", 1000, 0, 10000);
1673  h1_occupancyEndcap_->SetXTitle("Weighted electron statistics");
1674 
1675  h1_eleClasses_ = new TH1F("eleClasses", "eleClasses", 301, -1, 300);
1676  h1_eleClasses_->SetXTitle("classCode");
1677  h1_eleClasses_->SetYTitle("#");
1678 
1680 
1682 
1684 
1686 
1687  h1_ZCandMult_ = new TH1F("ZCandMult", "Multiplicity of Z candidates in one event", 10, -0.5, 10.5);
1688  h1_ZCandMult_->SetXTitle("ZCandMult");
1689 
1690  h1_reco_ZMass_ = new TH1F("reco_ZMass", "Inv. mass of 2 reco Electrons", 200, 0., 150.);
1691  h1_reco_ZMass_->SetXTitle("reco_ZMass (GeV)");
1692  h1_reco_ZMass_->SetYTitle("events");
1693 
1694  h1_reco_ZMassCorr_ = new TH1F("reco_ZMassCorr", "Inv. mass of 2 corrected reco Electrons", 200, 0., 150.);
1695  h1_reco_ZMassCorr_->SetXTitle("reco_ZMass (GeV)");
1696  h1_reco_ZMassCorr_->SetYTitle("events");
1697 
1698  h1_reco_ZMassCorrBB_ = new TH1F("reco_ZMassCorrBB", "Inv. mass of 2 corrected reco Electrons", 200, 0., 150.);
1699  h1_reco_ZMassCorrBB_->SetXTitle("reco_ZMass (GeV)");
1700  h1_reco_ZMassCorrBB_->SetYTitle("events");
1701 
1702  h1_reco_ZMassCorrEE_ = new TH1F("reco_ZMassCorrEE", "Inv. mass of 2 corrected reco Electrons", 200, 0., 150.);
1703  h1_reco_ZMassCorrEE_->SetXTitle("reco_ZMass (GeV)");
1704  h1_reco_ZMassCorrEE_->SetYTitle("events");
1705 
1706  // h2_coeffVsEta_= new TH2F("h2_calibCoeffVsEta","h2_calibCoeffVsEta",EcalRingCalibrationTools::N_RING_TOTAL,0, (double)EcalRingCalibrationTools::N_RING_TOTAL, 200, 0., 2.);
1707 
1708  h2_coeffVsEta_ = new TH2F("h2_calibCoeffVsEta", "h2_calibCoeffVsEta", 249, -124, 125, 200, 0., 2.);
1709  h2_coeffVsEta_->SetXTitle("Eta channel");
1710  h2_coeffVsEta_->SetYTitle("recalibCoeff");
1711 
1713  new TH2F("h2_calibCoeffVsEtaGrouped", "h2_calibCoeffVsEtaGrouped", 200, 0., 3., 200, 0.6, 1.4);
1714  h2_coeffVsEtaGrouped_->SetXTitle("|#eta|");
1715  h2_coeffVsEtaGrouped_->SetYTitle("recalibCoeff");
1716 
1717  h2_zMassVsLoop_ = new TH2F("h2_zMassVsLoop", "h2_zMassVsLoop", 1000, 0, 40, 90, 80., 95.);
1718 
1719  h2_zMassDiffVsLoop_ = new TH2F("h2_zMassDiffVsLoop", "h2_zMassDiffVsLoop", 1000, 0, 40, 100, -1., 1.);
1720  h2_zMassDiffVsLoop_->SetXTitle("Iteration");
1721  h2_zMassDiffVsLoop_->SetYTitle("M_{Z, reco peak} - M_{Z, true}");
1722 
1723  h2_zWidthVsLoop_ = new TH2F("h2_zWidthVsLoop", "h2_zWidthVsLoop", 1000, 0, 40, 100, 0., 10.);
1724 
1725  h2_coeffVsLoop_ = new TH2F("h2_coeffVsLoop", "h2_coeffVsLoop", 1000, 0, 40, 100, 0., 2.);
1726 
1727  h2_residualSigma_ = new TH2F("h2_residualSigma", "h2_residualSigma", 1000, 0, 40, 100, 0., .5);
1728 
1729  h2_miscalRecal_ = new TH2F("h2_miscalRecal", "h2_miscalRecal", 500, 0., 2., 500, 0., 2.);
1730  h2_miscalRecal_->SetXTitle("initCalibCoeff");
1731  h2_miscalRecal_->SetYTitle("1/RecalibCoeff");
1732 
1733  h2_miscalRecalEB_ = new TH2F("h2_miscalRecalEB", "h2_miscalRecalEB", 500, 0., 2., 500, 0., 2.);
1734  h2_miscalRecalEB_->SetXTitle("initCalibCoeff");
1735  h2_miscalRecalEB_->SetYTitle("1/RecalibCoeff");
1736 
1737  h2_miscalRecalEE_ = new TH2F("h2_miscalRecalEE", "h2_miscalRecalEE", 500, 0., 2., 500, 0., 2.);
1738  h2_miscalRecalEE_->SetXTitle("initCalibCoeff");
1739  h2_miscalRecalEE_->SetYTitle("1/RecalibCoeff");
1740 
1741  h1_mc_ = new TH1F("h1_residualMiscalib", "h1_residualMiscalib", 200, -0.2, 0.2);
1742  h1_mcEB_ = new TH1F("h1_residualMiscalibEB", "h1_residualMiscalibEB", 200, -0.2, 0.2);
1743  h1_mcEE_ = new TH1F("h1_residualMiscalibEE", "h1_residualMiscalibEE", 200, -0.2, 0.2);
1744 
1745  for (int i = 0; i < 25; i++) {
1746  char histoName[50];
1747  /*
1748  sprintf(histoName,"h2_miscalRecalParz_%d",i);
1749  h2_miscalRecalParz_[i] = new TH2F(histoName,histoName,500, 0., 2., 500, 0., 2.);
1750  h2_miscalRecalParz_[i]->SetXTitle("initCalibCoeff");
1751  h2_miscalRecalParz_[i]->SetYTitle("1/recalibCoeff");
1752 
1753  sprintf(histoName,"h2_miscalRecalEBParz_%d",i);
1754  h2_miscalRecalEBParz_[i] = new TH2F(histoName,histoName,500, 0., 2., 500, 0., 2.);
1755  h2_miscalRecalEBParz_[i]->SetXTitle("initCalibCoeff");
1756  h2_miscalRecalEBParz_[i]->SetYTitle("1/recalibCoeff");
1757 
1758  sprintf(histoName,"h2_miscalRecalEEParz_%d",i);
1759  h2_miscalRecalEEParz_[i] = new TH2F(histoName,histoName,500, 0., 2., 500, 0., 2.);
1760  h2_miscalRecalEEParz_[i]->SetXTitle("initCalibCoeff");
1761  h2_miscalRecalEEParz_[i]->SetYTitle("1/recalibCoeff");
1762  */
1763 
1764  sprintf(histoName, "h1_residualMiscalibParz_%d", i);
1765  h1_mcParz_[i] = new TH1F(histoName, histoName, 200, -0.2, 0.2);
1766  sprintf(histoName, "h1_residualMiscalibEBParz_%d", i);
1767  h1_mcEBParz_[i] = new TH1F(histoName, histoName, 200, -0.2, 0.2);
1768  sprintf(histoName, "h1_residualMiscalibEEParz_%d", i);
1769  h1_mcEEParz_[i] = new TH1F(histoName, histoName, 200, -0.2, 0.2);
1770  }
1771 }
1772 
1773 double ZeeCalibration::fEtaBarrelBad(double scEta) const {
1774  float p0 = 1.00153e+00;
1775  float p1 = 3.29331e-02;
1776  float p2 = 1.21187e-03;
1777 
1778  double x = (double)fabs(scEta);
1779 
1780  return 1. / (p0 + p1 * x * x + p2 * x * x * x * x);
1781 }
1782 
1783 double ZeeCalibration::fEtaEndcapGood(double scEta) const {
1784  // f(eta) for the first 3 classes (100, 110 and 120)
1785  // Ivica's new corrections 01/06
1786  float p0 = 1.06819e+00;
1787  float p1 = -1.53189e-02;
1788  float p2 = 4.01707e-04;
1789 
1790  double x = (double)fabs(scEta);
1791 
1792  return 1. / (p0 + p1 * x * x + p2 * x * x * x * x);
1793 }
1794 
1795 double ZeeCalibration::fEtaEndcapBad(double scEta) const {
1796  float p0 = 1.17382e+00;
1797  float p1 = -6.52319e-02;
1798  float p2 = 6.26108e-03;
1799 
1800  double x = (double)fabs(scEta);
1801 
1802  return 1. / (p0 + p1 * x * x + p2 * x * x * x * x);
1803 }
1804 
1805 double ZeeCalibration::fEtaBarrelGood(double scEta) const {
1806  float p0 = 9.99782e-01;
1807  float p1 = 1.26983e-02;
1808  float p2 = 2.16344e-03;
1809 
1810  double x = (double)fabs(scEta);
1811 
1812  return 1. / (p0 + p1 * x * x + p2 * x * x * x * x);
1813 }
1814 
1816 
1817 void ZeeCalibration::fillMCmap(const std::vector<const reco::GsfElectron*>* electronCollection,
1818  const std::vector<HepMC::GenParticle*>& mcEle,
1819  std::map<HepMC::GenParticle*, const reco::GsfElectron*>& myMCmap) {
1820  for (unsigned int i = 0; i < mcEle.size(); i++) {
1821  float minDR = 0.1;
1822  const reco::GsfElectron* myMatchEle = nullptr;
1823  for (unsigned int j = 0; j < electronCollection->size(); j++) {
1824  float dr = EvalDR(mcEle[i]->momentum().pseudoRapidity(),
1825  (*(*electronCollection)[j]).eta(),
1826  mcEle[i]->momentum().phi(),
1827  (*(*electronCollection)[j]).phi());
1828  if (dr < minDR) {
1829  myMatchEle = (*electronCollection)[j];
1830  minDR = dr;
1831  }
1832  }
1833  myMCmap.insert(std::pair<HepMC::GenParticle*, const reco::GsfElectron*>(mcEle[i], myMatchEle));
1834  }
1835 }
1836 
1837 float ZeeCalibration::EvalDR(float Eta, float Eta_ref, float Phi, float Phi_ref) {
1838  if (Phi < 0)
1839  Phi = 2 * TMath::Pi() + Phi;
1840  if (Phi_ref < 0)
1841  Phi_ref = 2 * TMath::Pi() + Phi_ref;
1842  float DPhi = Phi - Phi_ref;
1843  if (fabs(DPhi) > TMath::Pi())
1844  DPhi = 2 * TMath::Pi() - fabs(DPhi);
1845 
1846  float DEta = Eta - Eta_ref;
1847 
1848  float DR = sqrt(DEta * DEta + DPhi * DPhi);
1849  return DR;
1850 }
1851 
1852 float ZeeCalibration::EvalDPhi(float Phi, float Phi_ref) {
1853  if (Phi < 0)
1854  Phi = 2 * TMath::Pi() + Phi;
1855  if (Phi_ref < 0)
1856  Phi_ref = 2 * TMath::Pi() + Phi_ref;
1857  return (Phi - Phi_ref);
1858 }
1859 
1860 void ZeeCalibration::fillEleInfo(std::vector<HepMC::GenParticle*>& mcEle,
1861  std::map<HepMC::GenParticle*, const reco::GsfElectron*>& associationMap) {
1862  for (unsigned int i = 0; i < mcEle.size(); i++) {
1863  h_eleEffEta_[0]->Fill(fabs(mcEle[i]->momentum().pseudoRapidity()));
1864  h_eleEffPhi_[0]->Fill(mcEle[i]->momentum().phi());
1865  h_eleEffPt_[0]->Fill(mcEle[i]->momentum().perp());
1866 
1867  std::map<HepMC::GenParticle*, const reco::GsfElectron*>::const_iterator mIter = associationMap.find(mcEle[i]);
1868  if (mIter == associationMap.end())
1869  continue;
1870 
1871  if ((*mIter).second) {
1872  const reco::GsfElectron* myEle = (*mIter).second;
1873 
1874  h_eleEffEta_[1]->Fill(fabs(mcEle[i]->momentum().pseudoRapidity()));
1875  h_eleEffPhi_[1]->Fill(mcEle[i]->momentum().phi());
1876  h_eleEffPt_[1]->Fill(mcEle[i]->momentum().perp());
1877  h1_eleEtaResol_->Fill(myEle->eta() - mcEle[i]->momentum().eta());
1878  h1_elePhiResol_->Fill(myEle->phi() - mcEle[i]->momentum().phi());
1879 
1880  const reco::SuperCluster* mySC = &(*(myEle->superCluster()));
1881  if (/*fabs(mySC->position().eta()) < 2.4*/ true) {
1882  // if(myEle->classification()>=100)std::cout<<"mySC->preshowerEnergy()"<<mySC->preshowerEnergy()<<std::endl;
1883 
1884  h_ESCEtrue_[loopFlag_]->Fill(mySC->energy() / mcEle[i]->momentum().e());
1885  h_ESCEtrueVsEta_[loopFlag_]->Fill(fabs(mySC->position().eta()), mySC->energy() / mcEle[i]->momentum().e());
1886 
1887  double corrSCenergy = (mySC->energy()) / getEtaCorrection(myEle);
1888  h_ESCcorrEtrue_[loopFlag_]->Fill(corrSCenergy / mcEle[i]->momentum().e());
1889  h_ESCcorrEtrueVsEta_[loopFlag_]->Fill(fabs(mySC->position().eta()), corrSCenergy / mcEle[i]->momentum().e());
1890 
1891  // std::vector<DetId> mySCRecHits = mySC->seed()->getHitsByDetId();
1892 
1893  h1_seedOverSC_->Fill(mySC->seed()->energy() / mySC->energy());
1894  h1_preshowerOverSC_->Fill(mySC->preshowerEnergy() / mySC->energy());
1895  }
1896  }
1897  }
1898 }
1899 
1901  int index = -999;
1902 
1903  if (calibMode_ == "RING") {
1904  if (k >= 0 && k <= 84)
1905  index = k - 85;
1906 
1907  if (k >= 85 && k <= 169)
1908  index = k - 84;
1909 
1910  if (k >= 170 && k <= 208)
1911  index = -k + 84;
1912 
1913  if (k >= 209 && k <= 247)
1914  index = k - 123;
1915 
1916  }
1917 
1918  else if (calibMode_ == "MODULE") {
1919  if (k >= 0 && k <= 71)
1920  index = k - 72;
1921 
1922  if (k >= 72 && k <= 143)
1923  index = k - 71;
1924  }
1925  return index;
1926 }
1927 
1929  double correction(1.);
1930 
1931  int c = ele->classification();
1932  if (c == 0 || c == 10 || c == 20)
1933  correction = fEtaBarrelGood(ele->superCluster()->eta());
1934 
1935  if (c == 100 || c == 110 || c == 120)
1936  correction = fEtaEndcapGood(ele->superCluster()->eta());
1937 
1938  if (c == 30 || c == 31 || c == 32 || c == 33 || c == 34)
1939  correction = fEtaBarrelBad(ele->superCluster()->eta());
1940 
1941  if (c == 130 || c == 131 || c == 132 || c == 133 || c == 134)
1942  correction = fEtaEndcapBad(ele->superCluster()->eta());
1943 
1944  return correction;
1945 }
1946 
1947 std::pair<DetId, double> ZeeCalibration::getHottestDetId(const std::vector<std::pair<DetId, float> >& mySCRecHits,
1948  const EBRecHitCollection* ebhits,
1949  const EERecHitCollection* eehits) {
1950  double maxEnergy = -9999.;
1951  const EcalRecHit* hottestRecHit = nullptr;
1952 
1953  std::pair<DetId, double> myPair(DetId(0), -9999.);
1954 
1955  for (std::vector<std::pair<DetId, float> >::const_iterator idIt = mySCRecHits.begin(); idIt != mySCRecHits.end();
1956  idIt++) {
1957  if (idIt->first.subdetId() == EcalBarrel) {
1958  hottestRecHit = &(*(ebhits->find((*idIt).first)));
1959 
1960  if (hottestRecHit == &(*(ebhits->end()))) {
1961  std::cout << "@@@@@@@@@@@@@@@@@@@@@@@@@@@ NO RECHIT FOUND SHOULD NEVER HAPPEN" << std::endl;
1962  continue;
1963  }
1964  } else if (idIt->first.subdetId() == EcalEndcap) {
1965  hottestRecHit = &(*(eehits->find((*idIt).first)));
1966  if (hottestRecHit == &(*(eehits->end()))) {
1967  std::cout << "@@@@@@@@@@@@@@@@@@@@@@@@@@@ NO RECHIT FOUND SHOULD NEVER HAPPEN" << std::endl;
1968  continue;
1969  }
1970  }
1971 
1972  //std::cout<<"[getHottestDetId] hottestRecHit->energy() "<<hottestRecHit->energy()<<std::endl;
1973 
1974  if (hottestRecHit && hottestRecHit->energy() > maxEnergy) {
1975  maxEnergy = hottestRecHit->energy();
1976 
1977  myPair.first = hottestRecHit->id();
1978  myPair.second = maxEnergy;
1979  }
1980 
1981  } //end loop to find hottest RecHit
1982 
1983  //std::cout<<"[ZeeCalibration::getHottestDetId] going to return..."<<std::endl;
1984 
1985  return myPair;
1986 }
1987 
1989  bool myBool(false);
1990 
1991  short ieta = myEBDetId.ieta();
1992  short iphi = myEBDetId.iphi();
1993 
1994  // std::cout<<"[xtalIsOnModuleBorder] ieta: "<<ieta<<" iphi "<<iphi<<std::endl;
1995 
1996  myBool = (abs(ieta) == 1 || abs(ieta) == 25 || abs(ieta) == 26 || abs(ieta) == 45 || abs(ieta) == 46 ||
1997  abs(ieta) == 65 || abs(ieta) == 66 || abs(ieta) == 85);
1998 
1999  for (int i = 0; i < 19; i++) {
2000  if (iphi == (20 * i + 1) || iphi == 20 * i)
2001  myBool = true;
2002  }
2003 
2004  return myBool;
2005 }
2006 
2007 float ZeeCalibration::computeCoefficientDistanceAtIteration(float v1[250], float v2[250], int size) {
2008  float dist(0.);
2009 
2010  for (int i = 0; i < size; i++) {
2011  // std::cout<< "[ZeeCalibration::computeCoefficientDistanceAtIteration] Adding term "<<pow( v1[i]-v2[i], 2 )<<" from v1 "<<v1[i]<<" and v2 "<<v2[i]<<std::endl;
2012 
2013  bool isNearCrack = false;
2014 
2015  if (calibMode_ == "RING") { //exclude non-calibrated rings from computation
2016 
2017  isNearCrack = (abs(ringNumberCorrector(i)) == 1 || abs(ringNumberCorrector(i)) == 25 ||
2018  abs(ringNumberCorrector(i)) == 26 || abs(ringNumberCorrector(i)) == 45 ||
2019  abs(ringNumberCorrector(i)) == 46 || abs(ringNumberCorrector(i)) == 65 ||
2020  abs(ringNumberCorrector(i)) == 66 || abs(ringNumberCorrector(i)) == 85 ||
2021  abs(ringNumberCorrector(i)) == 86 || abs(ringNumberCorrector(i)) == 124);
2022  }
2023 
2024  if (!isNearCrack)
2025  dist += pow(v1[i] - v2[i], 2);
2026  }
2027 
2028  dist = sqrt(dist) / size;
2029 
2030  return dist;
2031 }
2032 
2034  BBZN = 0;
2035  EBZN = 0;
2036  EEZN = 0;
2037  BBZN_gg = 0;
2038  EBZN_gg = 0;
2039  EEZN_gg = 0;
2040 
2041  BBZN_tt = 0;
2042  EBZN_tt = 0;
2043  EEZN_tt = 0;
2044 
2045  BBZN_t0 = 0;
2046  EBZN_t0 = 0;
2047  EEZN_t0 = 0;
2048 
2051 
2060 
2063 
2064  return;
2065 }
2066 
2069  h1_eventsAfterEWKSelection_->Reset();
2070 
2073 
2074  for (int i = 0; i < 2; i++) {
2075  h_eleEffEta_[i]->Reset();
2076  h_eleEffPhi_[i]->Reset();
2077  h_eleEffPt_[i]->Reset();
2078  }
2079 
2080  h1_seedOverSC_->Reset();
2081  h1_preshowerOverSC_->Reset();
2082 
2083  h1_eleEtaResol_->Reset();
2084  h1_elePhiResol_->Reset();
2085 
2086  h1_zMassResol_->Reset();
2087 
2088  h1_electronCosTheta_TK_->Reset();
2089  h1_electronCosTheta_SC_->Reset();
2090  h1_electronCosTheta_SC_TK_->Reset();
2091 
2092  h2_fEtaBarrelGood_->Reset();
2093  h2_fEtaBarrelBad_->Reset();
2094  h2_fEtaEndcapGood_->Reset();
2095  h2_fEtaEndcapBad_->Reset();
2096  h1_eleClasses_->Reset();
2097 
2098  h1_ZCandMult_->Reset();
2099  h1_reco_ZMass_->Reset();
2100  h1_reco_ZMassCorr_->Reset();
2101  h1_reco_ZMassCorrBB_->Reset();
2102  h1_reco_ZMassCorrEE_->Reset();
2103  h1_occupancyVsEta_->Reset();
2104  h1_occupancy_->Reset();
2105  h1_occupancyBarrel_->Reset();
2106  h1_occupancyEndcap_->Reset();
2107 
2108  return;
2109 }
2110 
2112  std::cout << "[ CHECK ON BARREL ELECTRON NUMBER ]"
2113  << " first " << BARREL_ELECTRONS_BEFORE_BORDER_CUT << " second " << TOTAL_ELECTRONS_IN_BARREL << std::endl;
2114 
2115  std::cout << "[ EFFICIENCY OF THE BORDER SELECTION ]"
2117 
2118  std::cout << "[ EFFICIENCY OF THE GOLDEN SELECTION ] BARREL: "
2120  << " ENDCAP: " << (float)GOLDEN_ELECTRONS_IN_ENDCAP / (float)TOTAL_ELECTRONS_IN_ENDCAP << std::endl;
2121 
2122  std::cout << "[ EFFICIENCY OF THE SILVER SELECTION ] BARREL: "
2124  << " ENDCAP: " << (float)SILVER_ELECTRONS_IN_ENDCAP / (float)TOTAL_ELECTRONS_IN_ENDCAP << std::endl;
2125 
2126  std::cout << "[ EFFICIENCY OF THE SHOWER SELECTION ] BARREL: "
2128  << " ENDCAP: " << (float)SHOWER_ELECTRONS_IN_ENDCAP / (float)TOTAL_ELECTRONS_IN_ENDCAP << std::endl;
2129 
2130  std::cout << "[ EFFICIENCY OF THE CRACK SELECTION ] BARREL: "
2132  << " ENDCAP: " << (float)CRACK_ELECTRONS_IN_ENDCAP / (float)TOTAL_ELECTRONS_IN_ENDCAP << std::endl;
2133 
2134  std::ofstream fout("ZeeStatistics.txt");
2135 
2136  if (!fout) {
2137  std::cout << "Cannot open output file.\n";
2138  }
2139 
2140  fout << "ZeeStatistics" << std::endl;
2141 
2142  fout << "##########################RECO#########################" << std::endl;
2143  fout << "##################Zee with Barrel-Barrel electrons: " << BBZN << std::endl;
2144 
2145  fout << "Golden-Golden fraction: " << (float)BBZN_gg / BBZN << " 3-3 fraction is " << (float)BBZN_tt / BBZN
2146  << " 3-whatever fraction is " << (float)BBZN_t0 / BBZN << std::endl;
2147  fout << "##################Zee with Barrel-Endcap electrons: " << EBZN << std::endl;
2148  fout << "Golden-Golden fraction: " << (float)EBZN_gg / EBZN << " 3-3 fraction is " << (float)EBZN_tt / EBZN
2149  << " 3-whatever fraction is " << (float)EBZN_t0 / EBZN << std::endl;
2150  fout << "##################Zee with Endcap-Endcap electrons: " << EEZN << std::endl;
2151  fout << "Golden-Golden fraction: " << (float)EEZN_gg / EEZN << " 3-3 fraction is " << (float)EEZN_tt / EEZN
2152  << " 3-whatever fraction is " << (float)EEZN_t0 / EEZN << std::endl;
2153 
2154  fout << "\n" << std::endl;
2155 
2156  fout << "##########################GEN#########################" << std::endl;
2157  fout << "##################Zee with Barrel-Barrel electrons: " << (float)MCZBB / NEVT << std::endl;
2158  fout << "##################Zee with Barrel-Endcap electrons: " << (float)MCZEB / NEVT << std::endl;
2159  fout << "##################Zee with Endcap-Endcap electrons: " << (float)MCZEE / NEVT << std::endl;
2160 
2161  fout.close();
2162 }
EcalCondObjectContainer::getMap
const self & getMap() const
Definition: EcalCondObjectContainer.h:80
ZeeCalibration::h1_eleEtaResol_
TH1F * h1_eleEtaResol_
Definition: ZeeCalibration.h:241
ZeeCalibration::h1_reco_ZMassCorr_
TH1F * h1_reco_ZMassCorr_
Definition: ZeeCalibration.h:231
ZeeCalibration::computeCoefficientDistanceAtIteration
float computeCoefficientDistanceAtIteration(float v1[250], float v2[250], int size)
Definition: ZeeCalibration.cc:2007
ZeeCalibration::h2_miscalRecalEB_
TH2F * h2_miscalRecalEB_
Definition: ZeeCalibration.h:269
ZeeCalibration::SILVER_ELECTRONS_IN_BARREL
int SILVER_ELECTRONS_IN_BARREL
Definition: ZeeCalibration.h:332
ZeeCalibration::h1_occupancyBarrel_
TH1F * h1_occupancyBarrel_
Definition: ZeeCalibration.h:298
ZeeCalibration::aHLTResults
bool aHLTResults[200]
Definition: ZeeCalibration.h:364
edm::EDLooperBase::Status
Status
Definition: EDLooperBase.h:79
ZeeCalibration::h2_chi2_
TH2F * h2_chi2_[25]
Definition: ZeeCalibration.h:278
CalibrationCluster.h
ZeeCalibration::TOTAL_ELECTRONS_IN_BARREL
int TOTAL_ELECTRONS_IN_BARREL
Definition: ZeeCalibration.h:326
ZeeCalibration::rechitProducer_
std::string rechitProducer_
Definition: ZeeCalibration.h:148
EcalRecHit
Definition: EcalRecHit.h:15
Handle.h
ZIterativeAlgorithmWithFit::addEvent
bool addEvent(calib::CalibElectron *, calib::CalibElectron *, float)
Definition: ZIterativeAlgorithmWithFit.cc:250
ZeeCalibration::MCZBB
Int_t MCZBB
Definition: ZeeCalibration.h:308
EBDetId::ieta
int ieta() const
get the crystal ieta
Definition: EBDetId.h:49
mps_fire.i
i
Definition: mps_fire.py:355
ZeeCalibration::h_ESCEtrue_
TH1F * h_ESCEtrue_[25]
Definition: ZeeCalibration.h:247
ZeeCalibration::myTree
TTree * myTree
Definition: ZeeCalibration.h:144
calibXMLwriter
Definition: calibXMLwriter.h:15
MessageLogger.h
dqmMemoryStats.float
float
Definition: dqmMemoryStats.py:127
SiStripPI::mean
Definition: SiStripPayloadInspectorHelper.h:169
calib::CalibElectron
Definition: CalibElectron.h:13
TrackExtraFwd.h
ZeeCalibration::fEtaEndcapGood
double fEtaEndcapGood(double scEta) const
Definition: ZeeCalibration.cc:1783
ZeeCalibration::h2_fEtaEndcapBad_
TH2F * h2_fEtaEndcapBad_
Definition: ZeeCalibration.h:215
ZeeCalibration::h1_eventsAfterBorderSelection_
TH1F * h1_eventsAfterBorderSelection_
Definition: ZeeCalibration.h:210
edm::Handle::product
T const * product() const
Definition: Handle.h:70
ZeeCalibration::sigmaErrorArray
double sigmaErrorArray[50]
Definition: ZeeCalibration.h:320
hfClusterShapes_cfi.hits
hits
Definition: hfClusterShapes_cfi.py:5
ZeeCalibration::NewCalibCoeff
float NewCalibCoeff[250]
Definition: ZeeCalibration.h:189
CaloMiscalibMapEcal::get
const EcalIntercalibConstants & get()
Definition: CaloMiscalibMapEcal.h:90
ZeeCalibration::BBZN_t0
Int_t BBZN_t0
Definition: ZeeCalibration.h:307
EcalRecHit::id
DetId id() const
get the id
Definition: EcalRecHit.h:77
ESHandle.h
TriggerResults.h
ZeeCalibration::EBZN_t0
Int_t EBZN_t0
Definition: ZeeCalibration.h:307
EcalIntercalibConstants.h
ZeeCalibration::massDiff4tree
float massDiff4tree
Definition: ZeeCalibration.h:182
reco::SuperCluster
Definition: SuperCluster.h:18
ZeeCalibration::erechitProducer_
std::string erechitProducer_
Definition: ZeeCalibration.h:150
TriggerNamesService.h
ZeeCalibration::h1_mcEBParz_
TH1F * h1_mcEBParz_[25]
Definition: ZeeCalibration.h:272
BasicCluster.h
ZeeCalibration::h2_fEtaBarrelBad_
TH2F * h2_fEtaBarrelBad_
Definition: ZeeCalibration.h:213
ZeePlots::fillEleInfo
void fillEleInfo(const reco::GsfElectronCollection *)
Definition: ZeePlots.cc:220
CaloGeometryRecord
Definition: CaloGeometryRecord.h:30
EcalIndexingTools
Definition: EcalIndexingTools.h:9
EBDetId
Definition: EBDetId.h:17
edm
HLT enums.
Definition: AlignableModifier.h:19
ZeeCalibration::outputFileName_
std::string outputFileName_
Definition: ZeeCalibration.h:146
ZeeCalibration::h2_xtalRecalibCoeffBarrel_
TH2F * h2_xtalRecalibCoeffBarrel_[25]
Definition: ZeeCalibration.h:281
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
MZ
#define MZ
Definition: ZeeCalibration.cc:63
MiscalibReaderFromXMLEcalBarrel.h
ZeeCalibration::etMin_
double etMin_
Definition: ZeeCalibration.h:170
ZeeCalibration::h2_zMassVsLoop_
TH2F * h2_zMassVsLoop_
Definition: ZeeCalibration.h:255
gather_cfg.cout
cout
Definition: gather_cfg.py:144
EBDetId.h
EEDetId.h
edm::ESProducer::setWhatProduced
auto setWhatProduced(T *iThis, const es::Label &iLabel={})
Definition: ESProducer.h:138
ZeeCalibration::hlTriggerResults_
edm::InputTag hlTriggerResults_
Definition: ZeeCalibration.h:341
ZeePlots::fillZMCInfo
void fillZMCInfo(const HepMC::GenEvent *)
Definition: ZeePlots.cc:132
ZIterativeAlgorithmWithFit::getOptimizedChiSquare
const std::vector< float > & getOptimizedChiSquare() const
Definition: ZIterativeAlgorithmWithFit.h:65
ZIterativeAlgorithmWithFit::ZIterativeAlgorithmWithFitPlots
Definition: ZIterativeAlgorithmWithFit.h:30
mitigatedMETSequence_cff.DPhi
DPhi
Definition: mitigatedMETSequence_cff.py:37
edm::SortedCollection< EcalRecHit >
edm::second
U second(std::pair< T, U > const &p)
Definition: ParameterSet.cc:215
ZeeCalibration::scIslandCollection_
std::string scIslandCollection_
Definition: ZeeCalibration.h:156
EEDetId::IX_MIN
static const int IX_MIN
Definition: EEDetId.h:290
ZIterativeAlgorithmWithFit::getNumberOfIterations
int getNumberOfIterations() const
Definition: ZIterativeAlgorithmWithFit.h:57
pdwgLeptonRecoSkim_cfi.electronCollection
electronCollection
Definition: pdwgLeptonRecoSkim_cfi.py:5
ZeeKinematicTools.h
ZeeCalibration::h2_fEtaEndcapGood_
TH2F * h2_fEtaEndcapGood_
Definition: ZeeCalibration.h:214
ZeeCalibration::resetVariables
void resetVariables()
Definition: ZeeCalibration.cc:2033
ZeeCalibration::h1_reco_ZMass_
TH1F * h1_reco_ZMass_
Definition: ZeeCalibration.h:229
ZeeCalibration::mass4tree
float mass4tree
Definition: ZeeCalibration.h:181
EcalIndexingTools::setBinRange
void setBinRange(int, double, double, int, double, double)
Definition: EcalIndexingTools.cc:8
reco::GsfElectronCollection
std::vector< GsfElectron > GsfElectronCollection
collection of GsfElectron objects
Definition: GsfElectronFwd.h:14
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
ZeeCalibration::h2_zMassDiffVsLoop_
TH2F * h2_zMassDiffVsLoop_
Definition: ZeeCalibration.h:256
ZeeCalibration::beginOfJob
void beginOfJob() override
Called at beginning of job.
Definition: ZeeCalibration.cc:169
DDAxes::x
EcalRecHit::energy
float energy() const
Definition: EcalRecHit.h:68
ZeeCalibration::h1_occupancyVsEta_
TH1F * h1_occupancyVsEta_
Definition: ZeeCalibration.h:292
ZeeCalibration::h1_ZCandMult_
TH1F * h1_ZCandMult_
Definition: ZeeCalibration.h:236
EEDetId::IY_MIN
static const int IY_MIN
Definition: EEDetId.h:294
CaloMiscalibMapEcal::prefillMap
void prefillMap()
Definition: CaloMiscalibMapEcal.h:20
HouseholderDecomposition.h
perp
T perp() const
Magnitude of transverse component.
Definition: Basic3DVectorLD.h:133
ZeeCalibration::ZeeCalibration
ZeeCalibration(const edm::ParameterSet &iConfig)
Constructor.
Definition: ZeeCalibration.cc:67
EEDetId::ix
int ix() const
Definition: EEDetId.h:77
SiStripPI::rms
Definition: SiStripPayloadInspectorHelper.h:169
ZeeCalibration::h1_zMassResol_
TH1F * h1_zMassResol_
Definition: ZeeCalibration.h:226
edm::Handle< edm::TriggerResults >
ZeeCalibration::h1_zEtaResol_
TH1F * h1_zEtaResol_
Definition: ZeeCalibration.h:227
ZeeCalibration::coefficientDistanceAtIteration
double coefficientDistanceAtIteration[50]
Definition: ZeeCalibration.h:321
ZeePlots::writeMCEleHistograms
void writeMCEleHistograms()
Definition: ZeePlots.cc:255
ZeeCalibration::erechitCollection_
std::string erechitCollection_
Definition: ZeeCalibration.h:151
dqmdumpme.first
first
Definition: dqmdumpme.py:55
ZeeCalibration::CRACK_ELECTRONS_IN_ENDCAP
int CRACK_ELECTRONS_IN_ENDCAP
Definition: ZeeCalibration.h:339
ZeeKinematicTools::cosThetaElectrons_TK
static float cosThetaElectrons_TK(const std::pair< calib::CalibElectron *, calib::CalibElectron * > &aZCandidate, float ele1EnergyCorrection, float ele2EnergyCorrection)
Definition: ZeeKinematicTools.cc:63
EcalBarrel
Definition: EcalSubdetector.h:10
ZeeKinematicTools::calculateZMass_withTK
static float calculateZMass_withTK(const std::pair< calib::CalibElectron *, calib::CalibElectron * > &aZCandidate)
Definition: ZeeKinematicTools.cc:129
ZeeCalibration::TOTAL_ELECTRONS_IN_ENDCAP
int TOTAL_ELECTRONS_IN_ENDCAP
Definition: ZeeCalibration.h:327
EcalRecHitCollections.h
MinL3Algorithm.h
HepMC::GenEvent
Definition: hepmc_rootio.cc:9
CaloRecHit.h
MiscalibReaderFromXMLEcalEndcap.h
ZeeCalibration::duringLoop
Status duringLoop(const edm::Event &, const edm::EventSetup &) override
Called at each event.
Definition: ZeeCalibration.cc:578
ZeeCalibration::h2_residualSigma_
TH2F * h2_residualSigma_
Definition: ZeeCalibration.h:268
ZeeCalibration::h1_electronCosTheta_TK_
TH1F * h1_electronCosTheta_TK_
Definition: ZeeCalibration.h:301
ZeeCalibration::EBZN_gg
Int_t EBZN_gg
Definition: ZeeCalibration.h:307
ZeeKinematicTools::calculateZMassWithCorrectedElectrons_withTK
static float calculateZMassWithCorrectedElectrons_withTK(const std::pair< calib::CalibElectron *, calib::CalibElectron * > &aZCandidate, float ele1EnergyCorrection, float ele2EnergyCorrection)
Definition: ZeeKinematicTools.cc:102
funct::sin
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
LEDCalibrationChannels.iphi
iphi
Definition: LEDCalibrationChannels.py:64
ZeeCalibration::electronCollection_
std::string electronCollection_
Definition: ZeeCalibration.h:162
ZeeCalibration::mass
double mass
Definition: ZeeCalibration.h:179
ZeeCalibration::isfirstcall_
bool isfirstcall_
Definition: ZeeCalibration.h:366
reco::SuperClusterCollection
std::vector< SuperCluster > SuperClusterCollection
collection of SuperCluser objectr
Definition: SuperClusterFwd.h:9
ZeeCalibration::theMaxLoops
unsigned int theMaxLoops
Definition: ZeeCalibration.h:312
DetId
Definition: DetId.h:17
ZeeCalibration::ringNumberCorrector
int ringNumberCorrector(int k)
Definition: ZeeCalibration.cc:1900
ZeeCalibration::h1_elePhiResol_
TH1F * h1_elePhiResol_
Definition: ZeeCalibration.h:242
ZeeCalibration::EEZN_gg
Int_t EEZN_gg
Definition: ZeeCalibration.h:307
ZeeCalibration::sigmaArray
double sigmaArray[50]
Definition: ZeeCalibration.h:319
Track.h
ZeePlots::fillEleMCInfo
void fillEleMCInfo(const HepMC::GenEvent *)
Definition: ZeePlots.cc:178
edm::EventSetup::get
T get() const
Definition: EventSetup.h:73
TrackFwd.h
ZeeCalibration::BARREL_ELECTRONS_BEFORE_BORDER_CUT
int BARREL_ELECTRONS_BEFORE_BORDER_CUT
Definition: ZeeCalibration.h:323
ZeeCalibration::startingNewLoop
void startingNewLoop(unsigned int iLoop) override
Called at beginning of loop.
Definition: ZeeCalibration.cc:1313
ZeeCalibration::h1_seedOverSC_
TH1F * h1_seedOverSC_
Definition: ZeeCalibration.h:223
ZeeCalibration::h_eleEffPhi_
TH1F * h_eleEffPhi_[2]
Definition: ZeeCalibration.h:245
ZeeCalibration::h2_miscalRecalEE_
TH2F * h2_miscalRecalEE_
Definition: ZeeCalibration.h:273
edm::EDLooperBase::kStop
Definition: EDLooperBase.h:79
edm::HLTGlobalStatus::size
unsigned int size() const
Get number of paths stored.
Definition: HLTGlobalStatus.h:35
calibXMLwriter::writeLine
void writeLine(EBDetId const &, float)
Definition: calibXMLwriter.cc:32
ZeeCalibration::theParameterSet
edm::ParameterSet theParameterSet
Definition: ZeeCalibration.h:202
Service.h
PVValHelper::eta
Definition: PVValidationHelpers.h:69
ZeeCalibration::BBZN_tt
Int_t BBZN_tt
Definition: ZeeCalibration.h:307
ZeeCalibration::rechitCollection_
std::string rechitCollection_
Definition: ZeeCalibration.h:149
ZeePlots::fillHLTInfo
void fillHLTInfo(edm::Handle< edm::TriggerResults >)
Definition: ZeePlots.cc:299
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
ZeeCalibration::h2_miscalRecal_
TH2F * h2_miscalRecal_
Definition: ZeeCalibration.h:260
edm::ESHandle< CaloGeometry >
ZeeCalibration::bookHistograms
void bookHistograms()
Definition: ZeeCalibration.cc:1496
p2
double p2[4]
Definition: TauolaWrapper.h:90
ZeeCalibration::ical
std::shared_ptr< EcalIntercalibConstants > ical
Definition: ZeeCalibration.h:193
ZeeCalibration::fillMCmap
void fillMCmap(const std::vector< const reco::GsfElectron * > *electronCollection, const std::vector< HepMC::GenParticle * > &mcEle, std::map< HepMC::GenParticle *, const reco::GsfElectron * > &myMCmap)
Definition: ZeeCalibration.cc:1817
ZeeKinematicTools::cosThetaElectrons_SC
static float cosThetaElectrons_SC(const std::pair< calib::CalibElectron *, calib::CalibElectron * > &aZCandidate, float ele1EnergyCorrection, float ele2EnergyCorrection)
Definition: ZeeKinematicTools.cc:39
EcalCondObjectContainer::find
const_iterator find(uint32_t rawId) const
Definition: EcalCondObjectContainer.h:53
ZeeCalibration::~ZeeCalibration
~ZeeCalibration() override
Destructor.
Definition: ZeeCalibration.cc:156
ZeeCalibration::scProducer_
std::string scProducer_
Definition: ZeeCalibration.h:152
calibXMLwriter.h
EBDetId::MAX_IPHI
static const int MAX_IPHI
Definition: EBDetId.h:137
EEDetId::IY_MAX
static const int IY_MAX
Definition: EEDetId.h:302
reco::GsfElectron
Definition: GsfElectron.h:35
VtxSmearedParameters_cfi.Phi
Phi
Definition: VtxSmearedParameters_cfi.py:112
dqmdumpme.k
k
Definition: dqmdumpme.py:60
EEDetId::zside
int zside() const
Definition: EEDetId.h:71
ZeeCalibration::CRACK_ELECTRONS_IN_BARREL
int CRACK_ELECTRONS_IN_BARREL
Definition: ZeeCalibration.h:338
ZeeCalibration::maxInvMassCut_
double maxInvMassCut_
Definition: ZeeCalibration.h:178
EcalRingCalibrationTools::getDetIdsInRing
static std::vector< DetId > getDetIdsInRing(short aRingIndex)
Retrieve the DetIds in a phi-ring.
Definition: EcalRingCalibrationTools.cc:66
ZeeCalibration::EBZN
Int_t EBZN
Definition: ZeeCalibration.h:307
ZeeCalibration::h2_iterations_
TH2F * h2_iterations_[25]
Definition: ZeeCalibration.h:279
GsfElectron.h
ZeeCalibration::h2_coeffVsEtaGrouped_
TH2F * h2_coeffVsEtaGrouped_
Definition: ZeeCalibration.h:254
ZeeCalibration.h
PDWG_EXOHSCP_cff.minDR
minDR
Definition: PDWG_EXOHSCP_cff.py:109
ZeeCalibration::h_ESCcorrEtrue_
TH1F * h_ESCcorrEtrue_[25]
Definition: ZeeCalibration.h:250
DetId::subdetId
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum)
Definition: DetId.h:48
EEDetId
Definition: EEDetId.h:14
CaloGeometryRecord.h
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
ZeeCalibration::h1_reco_ZMassCorrEE_
TH1F * h1_reco_ZMassCorrEE_
Definition: ZeeCalibration.h:233
EcalEndcap
Definition: EcalSubdetector.h:10
ZeeCalibration::etaMax_
double etaMax_
Definition: ZeeCalibration.h:171
MiscalibReaderFromXMLEcalBarrel
Definition: MiscalibReaderFromXMLEcalBarrel.h:8
ZeeCalibration::resetHistograms
void resetHistograms()
Definition: ZeeCalibration.cc:2067
ALCARECOTkAlJpsiMuMu_cff.charge
charge
Definition: ALCARECOTkAlJpsiMuMu_cff.py:47
ZeePlots::writeZHistograms
void writeZHistograms()
Definition: ZeePlots.cc:110
ZeePlots::bookEleHistograms
void bookEleHistograms()
Definition: ZeePlots.cc:195
ZeeCalibration::MCZEB
Int_t MCZEB
Definition: ZeeCalibration.h:308
cppFunctionSkipper.exception
exception
Definition: cppFunctionSkipper.py:10
CaloMiscalibMapEcal.h
EcalIndexingTools::getInstance
static EcalIndexingTools * getInstance()
Definition: EcalIndexingTools.h:23
LEDCalibrationChannels.ieta
ieta
Definition: LEDCalibrationChannels.py:63
ZeeCalibration::h1_mcEB_
TH1F * h1_mcEB_
Definition: ZeeCalibration.h:271
ZeeCalibration::loopArray
double loopArray[50]
Definition: ZeeCalibration.h:318
CaloSubdetectorGeometry.h
ZeePlots::writeMCZHistograms
void writeMCZHistograms()
Definition: ZeePlots.cc:122
GsfElectronFwd.h
CaloMiscalibMapEcal
Definition: CaloMiscalibMapEcal.h:16
edm::ParameterSet
Definition: ParameterSet.h:36
ZeeCalibration::scIslandProducer_
std::string scIslandProducer_
Definition: ZeeCalibration.h:155
reco::SuperCluster::seed
const CaloClusterPtr & seed() const
seed BasicCluster
Definition: SuperCluster.h:77
ZeeCalibration::SHOWER_ELECTRONS_IN_BARREL
int SHOWER_ELECTRONS_IN_BARREL
Definition: ZeeCalibration.h:335
reco::LeafCandidate::eta
double eta() const final
momentum pseudorapidity
Definition: LeafCandidate.h:152
ZeeCalibration::init_
bool init_
Definition: ZeeCalibration.h:354
ZeeCalibration::h1_weightSumMeanEndcap_
TH1F * h1_weightSumMeanEndcap_
Definition: ZeeCalibration.h:290
ZeeCalibration::outputFile_
TFile * outputFile_
Definition: ZeeCalibration.h:310
ZeePlots::fillZInfo
void fillZInfo(std::pair< calib::CalibElectron *, calib::CalibElectron * > myZeeCandidate)
Definition: ZeePlots.cc:100
ZeeCalibration::produceEcalIntercalibConstants
virtual std::shared_ptr< EcalIntercalibConstants > produceEcalIntercalibConstants(const EcalIntercalibConstantsRcd &iRecord)
Produce Ecal interCalibrations.
Definition: ZeeCalibration.cc:163
pfMETCorrectionType0_cfi.correction
correction
Definition: pfMETCorrectionType0_cfi.py:39
edm::SortedCollection::end
const_iterator end() const
Definition: SortedCollection.h:267
beam_dqm_sourceclient-live_cfg.cerr
cerr
Definition: beam_dqm_sourceclient-live_cfg.py:17
ZeeCalibration::EvalDPhi
float EvalDPhi(float Phi, float Phi_ref)
Definition: ZeeCalibration.cc:1852
ZeeCalibration::h1_mcEE_
TH1F * h1_mcEE_
Definition: ZeeCalibration.h:275
ZeePlots::bookZHistograms
void bookZHistograms()
Definition: ZeePlots.cc:74
ZeeCalibration::h1_preshowerOverSC_
TH1F * h1_preshowerOverSC_
Definition: ZeeCalibration.h:224
ZeeCalibration::hltCount
Int_t hltCount
Definition: ZeeCalibration.h:360
ZeeCalibration::h1_reco_ZMassCorrBB_
TH1F * h1_reco_ZMassCorrBB_
Definition: ZeeCalibration.h:232
ZIterativeAlgorithmWithFit
Definition: ZIterativeAlgorithmWithFit.h:28
EEDetId::IX_MAX
static const int IX_MAX
Definition: EEDetId.h:298
groupFilesInBlocks.fout
fout
Definition: groupFilesInBlocks.py:162
ZeeCalibration::h1_mc_
TH1F * h1_mc_
Definition: ZeeCalibration.h:262
ZeeCalibration::minInvMassCut_
double minInvMassCut_
Definition: ZeeCalibration.h:177
ZeeCalibration::calibMode_
std::string calibMode_
Definition: ZeeCalibration.h:159
ZeeCalibration::etBins_
unsigned int etBins_
Definition: ZeeCalibration.h:167
iEvent
int iEvent
Definition: GenABIO.cc:224
ZeePlots::writeEleHistograms
void writeEleHistograms()
Definition: ZeePlots.cc:240
ZeeCalibration::h1_occupancy_
TH1F * h1_occupancy_
Definition: ZeeCalibration.h:297
ZeeCalibration::BBZN_gg
Int_t BBZN_gg
Definition: ZeeCalibration.h:307
ZeeCalibration::wantEtaCorrection_
bool wantEtaCorrection_
Definition: ZeeCalibration.h:314
p1
double p1[4]
Definition: TauolaWrapper.h:89
MiscalibReaderFromXMLEcalEndcap
Definition: MiscalibReaderFromXMLEcalEndcap.h:8
cuy.ib
ib
Definition: cuy.py:662
ZeeCalibration::endOfLoop
Status endOfLoop(const edm::EventSetup &, unsigned int iLoop) override
Called at end of loop.
Definition: ZeeCalibration.cc:1328
ZeeCalibration::getHottestDetId
std::pair< DetId, double > getHottestDetId(const std::vector< std::pair< DetId, float > > &mySCRecHits, const EBRecHitCollection *ebhits, const EERecHitCollection *eehits)
Definition: ZeeCalibration.cc:1947
ZeeCalibration::h2_zWidthVsLoop_
TH2F * h2_zWidthVsLoop_
Definition: ZeeCalibration.h:257
edm::EventSetup
Definition: EventSetup.h:57
edm::EDLooperBase::kContinue
Definition: EDLooperBase.h:79
particleFlowClusterECALTimeSelected_cfi.maxEnergy
maxEnergy
Definition: particleFlowClusterECALTimeSelected_cfi.py:10
edm::HepMCProduct::GetEvent
const HepMC::GenEvent * GetEvent() const
Definition: HepMCProduct.h:34
HltBtagPostValidation_cff.c
c
Definition: HltBtagPostValidation_cff.py:31
ZeeCalibration::h2_xtalRecalibCoeffEndcapPlus_
TH2F * h2_xtalRecalibCoeffEndcapPlus_[25]
Definition: ZeeCalibration.h:283
ZeeCalibration::h1_electronCosTheta_SC_
TH1F * h1_electronCosTheta_SC_
Definition: ZeeCalibration.h:302
ZeePlots
Definition: ZeePlots.h:50
get
#define get
EEDetId::iy
int iy() const
Definition: EEDetId.h:83
ZIterativeAlgorithmWithFit::ZIterativeAlgorithmWithFitPlots::weightedRescaleFactor
TH1 * weightedRescaleFactor[50][250]
Definition: ZIterativeAlgorithmWithFit.h:31
ZeeCalibration::h2_xtalMiscalibCoeffEndcapMinus_
TH2F * h2_xtalMiscalibCoeffEndcapMinus_
Definition: ZeeCalibration.h:286
ZeeCalibration::fEtaBarrelGood
double fEtaBarrelGood(double scEta) const
Definition: ZeeCalibration.cc:1805
ZeeCalibration::h2_xtalMiscalibCoeffBarrel_
TH2F * h2_xtalMiscalibCoeffBarrel_
Definition: ZeeCalibration.h:285
EgammaValidation_cff.num
num
Definition: EgammaValidation_cff.py:34
EcalRecHit.h
reco::CaloCluster::position
const math::XYZPoint & position() const
cluster centroid position
Definition: CaloCluster.h:154
ZIterativeAlgorithmWithFit::gausfit
static void gausfit(TH1F *histoou, double *par, double *errpar, float nsigmalow, float nsigmaup, double *mychi2, int *iterations)
Definition: ZIterativeAlgorithmWithFit.cc:355
ZIterativeAlgorithmWithFit::getOptimizedCoefficients
const std::vector< float > & getOptimizedCoefficients() const
Definition: ZIterativeAlgorithmWithFit.h:61
ZeeCalibration::BBZN
Int_t BBZN
Definition: ZeeCalibration.h:307
ZeeCalibration::EEZN
Int_t EEZN
Definition: ZeeCalibration.h:307
EBDetId::validDetId
static bool validDetId(int i, int j)
check if a valid index combination
Definition: EBDetId.h:118
DDAxes::phi
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
ZeeCalibration::initCalibCoeff
float initCalibCoeff[250]
Definition: ZeeCalibration.h:191
ZeeCalibration::h2_coeffVsEta_
TH2F * h2_coeffVsEta_
Definition: ZeeCalibration.h:253
multPhiCorr_741_25nsDY_cfi.px
px
Definition: multPhiCorr_741_25nsDY_cfi.py:10
ZeeCalibration::read_events
int read_events
Definition: ZeeCalibration.h:184
ZeeCalibration::h2_xtalRecalibCoeffEndcapMinus_
TH2F * h2_xtalRecalibCoeffEndcapMinus_[25]
Definition: ZeeCalibration.h:282
edm::SortedCollection::find
iterator find(key_type k)
Definition: SortedCollection.h:240
ZIterativeAlgorithmWithFit::iterate
bool iterate()
Definition: ZIterativeAlgorithmWithFit.cc:182
EcalRingCalibrationTools::getDetIdsInModule
static std::vector< DetId > getDetIdsInModule(short int)
Definition: EcalRingCalibrationTools.cc:125
Electron.h
GenParticle.GenParticle
GenParticle
Definition: GenParticle.py:18
ZeeCalibration::calibCoeff
float calibCoeff[250]
Definition: ZeeCalibration.h:188
DetId::rawId
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
ZeeCalibration::theAlgorithm_
ZIterativeAlgorithmWithFit * theAlgorithm_
Definition: ZeeCalibration.h:195
ZeePlots::bookEleMCHistograms
void bookEleMCHistograms()
Definition: ZeePlots.cc:156
ZeeCalibration::h2_fEtaBarrelGood_
TH2F * h2_fEtaBarrelGood_
Definition: ZeeCalibration.h:212
ZeeCalibration::h1_eleClasses_
TH1F * h1_eleClasses_
Definition: ZeeCalibration.h:217
ZeeCalibration::calibCoeffError
float calibCoeffError[250]
Definition: ZeeCalibration.h:190
reco::LeafCandidate::phi
double phi() const final
momentum azimuthal angle
Definition: LeafCandidate.h:148
reco::SuperCluster::preshowerEnergy
double preshowerEnergy() const
energy deposited in preshower
Definition: SuperCluster.h:61
ZeeCalibration::SILVER_ELECTRONS_IN_ENDCAP
int SILVER_ELECTRONS_IN_ENDCAP
Definition: ZeeCalibration.h:333
ZIterativeAlgorithmWithFit::getHistos
const ZIterativeAlgorithmWithFitPlots * getHistos() const
Definition: ZIterativeAlgorithmWithFit.h:55
ZeeCalibration::mcProducer_
std::string mcProducer_
Definition: ZeeCalibration.h:158
DetId.h
ZeeCalibration::electronSelection_
unsigned int electronSelection_
Definition: ZeeCalibration.h:316
triggerObjects_cff.id
id
Definition: triggerObjects_cff.py:31
ZeeCalibration::etMax_
double etMax_
Definition: ZeeCalibration.h:172
ZeeCalibration::h1_eventsBeforeEWKSelection_
TH1F * h1_eventsBeforeEWKSelection_
Definition: ZeeCalibration.h:206
ZeeCalibration::etaMin_
double etaMin_
Definition: ZeeCalibration.h:169
ZeeCalibration::h_eleEffPt_
TH1F * h_eleEffPt_[2]
Definition: ZeeCalibration.h:246
SuperCluster.h
flavorHistoryFilter_cfi.dr
dr
Definition: flavorHistoryFilter_cfi.py:37
CaloGeometry.h
ZeeCalibration::getEtaCorrection
double getEtaCorrection(const reco::GsfElectron *)
Definition: ZeeCalibration.cc:1928
ZeeCalibration::NEVT
Int_t NEVT
Definition: ZeeCalibration.h:308
ZeePlots::bookHLTHistograms
void bookHLTHistograms()
Definition: ZeePlots.cc:270
ZeePlots::bookZMCHistograms
void bookZMCHistograms()
Definition: ZeePlots.cc:50
ZeeCalibration::h1_zPhiResol_
TH1F * h1_zPhiResol_
Definition: ZeeCalibration.h:228
ZeeCalibration::h2_xtalMiscalibCoeffEndcapPlus_
TH2F * h2_xtalMiscalibCoeffEndcapPlus_
Definition: ZeeCalibration.h:287
reco::GsfElectron::classification
Classification classification() const
Definition: GsfElectron.h:730
ZeeCalibration::h1_electronCosTheta_SC_TK_
TH1F * h1_electronCosTheta_SC_TK_
Definition: ZeeCalibration.h:303
ZIterativeAlgorithmWithFit::resetIteration
bool resetIteration()
Definition: ZIterativeAlgorithmWithFit.cc:168
ZeeCalibration::h1_mcEEParz_
TH1F * h1_mcEEParz_[25]
Definition: ZeeCalibration.h:276
HltBtagPostValidation_cff.histoName
histoName
Definition: HltBtagPostValidation_cff.py:17
ZeeCalibration::fEtaBarrelBad
double fEtaBarrelBad(double scEta) const
Definition: ZeeCalibration.cc:1773
EventSetup.h
reco::GsfElectron::superCluster
SuperClusterRef superCluster() const override
reference to a SuperCluster
Definition: GsfElectron.h:163
ZeeCalibration::printStatistics
void printStatistics()
Definition: ZeeCalibration.cc:2111
ZeeCalibration::h1_eventsBeforeBorderSelection_
TH1F * h1_eventsBeforeBorderSelection_
Definition: ZeeCalibration.h:209
edm::HLTGlobalStatus::accept
bool accept() const
Has at least one path accepted the event?
Definition: HLTGlobalStatus.h:49
ZeeCalibration::endOfJob
void endOfJob() override
Called at end of job.
Definition: ZeeCalibration.cc:172
AlignmentPI::index
index
Definition: AlignmentPayloadInspectorHelper.h:46
EEDetId::validDetId
static bool validDetId(int crystal_ix, int crystal_iy, int iz)
Definition: EEDetId.h:248
MiscalibReaderFromXML::parseXMLMiscalibFile
bool parseXMLMiscalibFile(std::string configFile)
Definition: MiscalibReaderXML.cc:69
ZeeCalibration::h2_coeffVsLoop_
TH2F * h2_coeffVsLoop_
Definition: ZeeCalibration.h:258
ZeeCalibration::electronProducer_
std::string electronProducer_
Definition: ZeeCalibration.h:161
Pi
const double Pi
Definition: CosmicMuonParameters.h:18
ZeeCalibration::h1_nEleReco_
TH1F * h1_nEleReco_
Definition: ZeeCalibration.h:216
ZeeCalibration::h1_mcParz_
TH1F * h1_mcParz_[25]
Definition: ZeeCalibration.h:263
ZeeCalibration::etaBins_
unsigned int etaBins_
Definition: ZeeCalibration.h:166
ZeeCalibration::EEZN_tt
Int_t EEZN_tt
Definition: ZeeCalibration.h:307
funct::pow
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:30
EBDetId::iphi
int iphi() const
get the crystal iphi
Definition: EBDetId.h:51
ZeeCalibration::MCZEE
Int_t MCZEE
Definition: ZeeCalibration.h:308
ZeeCalibration::xtalIsOnModuleBorder
bool xtalIsOnModuleBorder(EBDetId myEBDetId)
Definition: ZeeCalibration.cc:1988
EcalIndexingTools.h
ZIterativeAlgorithmWithFit::getOptimizedIterations
const std::vector< int > & getOptimizedIterations() const
Definition: ZIterativeAlgorithmWithFit.h:67
ZeeCalibration::h_ESCEtrueVsEta_
TH2F * h_ESCEtrueVsEta_[25]
Definition: ZeeCalibration.h:248
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
ZeeCalibration::GOLDEN_ELECTRONS_IN_ENDCAP
int GOLDEN_ELECTRONS_IN_ENDCAP
Definition: ZeeCalibration.h:330
ParameterSet.h
ZeeCalibration::h_eleEffEta_
TH1F * h_eleEffEta_[2]
Definition: ZeeCalibration.h:244
ZeeCalibration::barrelfile_
std::string barrelfile_
Definition: ZeeCalibration.h:174
ZeeCalibration::fEtaEndcapBad
double fEtaEndcapBad(double scEta) const
Definition: ZeeCalibration.cc:1795
ZeeCalibration::GOLDEN_ELECTRONS_IN_BARREL
int GOLDEN_ELECTRONS_IN_BARREL
Definition: ZeeCalibration.h:329
HepMCProduct.h
ZeeCalibration::scCollection_
std::string scCollection_
Definition: ZeeCalibration.h:153
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
JetChargeProducer_cfi.exp
exp
Definition: JetChargeProducer_cfi.py:6
edm::HandleBase::isValid
bool isValid() const
Definition: HandleBase.h:70
ZeeCalibration::endcapfile_
std::string endcapfile_
Definition: ZeeCalibration.h:175
edm::Event
Definition: Event.h:73
ZeeCalibration::h1_eventsAfterEWKSelection_
TH1F * h1_eventsAfterEWKSelection_
Definition: ZeeCalibration.h:207
EcalRingCalibrationTools.h
EcalRingCalibrationTools::setCaloGeometry
static void setCaloGeometry(const CaloGeometry *geometry)
Definition: EcalRingCalibrationTools.cc:181
EcalIntercalibConstantsRcd
Definition: EcalIntercalibConstantsRcd.h:5
EcalIntercalibConstantsRcd.h
ZeeCalibration::fillEleInfo
void fillEleInfo(std::vector< HepMC::GenParticle * > &a, std::map< HepMC::GenParticle *, const reco::GsfElectron * > &b)
Definition: ZeeCalibration.cc:1860
reco::CaloCluster::energy
double energy() const
cluster energy
Definition: CaloCluster.h:149
edm::InputTag
Definition: InputTag.h:15
EcalRingCalibrationTools::getDetIdsInECAL
static std::vector< DetId > getDetIdsInECAL()
Definition: EcalRingCalibrationTools.cc:102
ZeeCalibration::h1_weightSumMeanBarrel_
TH1F * h1_weightSumMeanBarrel_
Definition: ZeeCalibration.h:289
ZeeCalibration::h1_borderElectronClassification_
TH1F * h1_borderElectronClassification_
Definition: ZeeCalibration.h:305
ZeeCalibration::h_ESCcorrEtrueVsEta_
TH2F * h_ESCcorrEtrueVsEta_[25]
Definition: ZeeCalibration.h:251
ZeeCalibration::EvalDR
float EvalDR(float Eta, float Eta_ref, float Phi, float Phi_ref)
Definition: ZeeCalibration.cc:1837
ZeeCalibration::EBZN_tt
Int_t EBZN_tt
Definition: ZeeCalibration.h:307
EBDetId::MAX_IETA
static const int MAX_IETA
Definition: EBDetId.h:136
ZeeCalibration::myZeePlots_
ZeePlots * myZeePlots_
Definition: ZeeCalibration.h:197
ZeeCalibration::h1_occupancyEndcap_
TH1F * h1_occupancyEndcap_
Definition: ZeeCalibration.h:299
RemoveAddSevLevel.flag
flag
Definition: RemoveAddSevLevel.py:116
ZIterativeAlgorithmWithFit::getNumberOfChannels
int getNumberOfChannels() const
Definition: ZIterativeAlgorithmWithFit.h:59
ZeeCalibration::SHOWER_ELECTRONS_IN_ENDCAP
int SHOWER_ELECTRONS_IN_ENDCAP
Definition: ZeeCalibration.h:336
edm::SortedCollection::empty
bool empty() const
Definition: SortedCollection.h:210
findQualityFiles.size
size
Write out results.
Definition: findQualityFiles.py:443
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37
ZeeCalibration::BARREL_ELECTRONS_AFTER_BORDER_CUT
int BARREL_ELECTRONS_AFTER_BORDER_CUT
Definition: ZeeCalibration.h:324
cleanAndMergeSuperClusters_cfi.scCollection
scCollection
Definition: cleanAndMergeSuperClusters_cfi.py:12
EBDetId::MIN_IPHI
static const int MIN_IPHI
Definition: EBDetId.h:135
ZeeCalibration::loopFlag_
int loopFlag_
Definition: ZeeCalibration.h:186
ZIterativeAlgorithmWithFit::getOptimizedCoefficientsError
const std::vector< float > & getOptimizedCoefficientsError() const
Definition: ZIterativeAlgorithmWithFit.h:63
ZeeCalibration::EEZN_t0
Int_t EEZN_t0
Definition: ZeeCalibration.h:307