CMS 3D CMS Logo

InvRingCalib.cc
Go to the documentation of this file.
1 #include <memory>
2 #include <cmath>
16 
19 
20 //Not to remain in the final version
21 #include "TH2.h"
22 #include "TFile.h"
23 //----------------------------------------------------------------
24 //ctor
25 
27  : m_barrelAlCa(iConfig.getParameter<edm::InputTag>("barrelAlca")),
28  m_endcapAlCa(iConfig.getParameter<edm::InputTag>("endcapAlca")),
29  m_ElectronLabel(iConfig.getParameter<edm::InputTag>("ElectronLabel")),
30  m_recoWindowSidex(iConfig.getParameter<int>("recoWindowSidex")),
31  m_recoWindowSidey(iConfig.getParameter<int>("recoWindowSidey")),
32  m_minEnergyPerCrystal(iConfig.getParameter<double>("minEnergyPerCrystal")),
33  m_maxEnergyPerCrystal(iConfig.getParameter<double>("maxEnergyPerCrystal")),
34  m_etaStart(iConfig.getParameter<int>("etaStart")),
35  m_etaEnd(iConfig.getParameter<int>("etaEnd")),
36  m_etaWidth(iConfig.getParameter<int>("etaWidth")),
37  m_maxSelectedNumPerRing(iConfig.getParameter<int>("maxNumPerRing")),
38  m_minCoeff(iConfig.getParameter<double>("minCoeff")),
39  m_maxCoeff(iConfig.getParameter<double>("maxCoeff")),
40  m_usingBlockSolver(iConfig.getParameter<int>("usingBlockSolver")),
41  m_startRing(iConfig.getParameter<int>("startRing")),
42  m_endRing(iConfig.getParameter<int>("endRing")),
43  m_EBcoeffFile(iConfig.getParameter<std::string>("EBcoeffs")),
44  m_EEcoeffFile(iConfig.getParameter<std::string>("EEcoeffs")),
45  m_EEZone(iConfig.getParameter<int>("EEZone")),
46  m_ebRecHitToken(consumes<EBRecHitCollection>(m_barrelAlCa)),
47  m_eeRecHitToken(consumes<EERecHitCollection>(m_endcapAlCa)),
48  m_gsfElectronToken(consumes<reco::GsfElectronCollection>(m_ElectronLabel)),
49  m_geometryToken(esConsumes()) {
50  //controls if the parameters inputed are correct
51  if ((m_etaEnd * m_etaStart) > 0)
53  if ((m_etaEnd * m_etaStart) < 0)
54  assert(!((m_etaEnd - m_etaStart - 1) % m_etaWidth));
55 
56  assert(m_etaStart >= -85 && m_etaStart <= 86);
57  assert(m_etaEnd >= m_etaStart && m_etaEnd <= 86);
58  assert(m_startRing > -1 && m_startRing <= 40);
60 
62  assert((abs(m_EEZone) <= 1));
63 
64  m_loops = (unsigned int)iConfig.getParameter<int>("loops") - 1;
65  //LP CalibBlock vector instantiation
66  edm::LogInfo("IML") << "[InvRingCalib][ctor] Calib Block";
67  std::string algorithm = iConfig.getParameter<std::string>("algorithm");
68  m_mapFillerType = iConfig.getParameter<std::string>("FillType");
69  int eventWeight = iConfig.getUntrackedParameter<int>("L3EventWeight", 1);
70 
71  for (int i = 0; i < EBRegionNum(); ++i) {
72  if (algorithm == "IMA")
74  else if (algorithm == "L3")
75  m_IMACalibBlocks.push_back(new L3CalibBlock(m_etaWidth, eventWeight));
76  else {
77  edm::LogError("building") << algorithm << " is not a valid calibration algorithm";
78  exit(1);
79  }
80  }
81  int EEBlocks = 0;
82  if (m_EEZone == 0)
83  EEBlocks = 2 * EERegionNum();
84  if (m_EEZone == 1 || m_EEZone == -1)
85  EEBlocks = EERegionNum();
86 
87  for (int i = 0; i < EEBlocks; ++i) {
88  if (algorithm == "IMA")
90  else if (algorithm == "L3")
91  m_IMACalibBlocks.push_back(new L3CalibBlock(m_etaWidth, eventWeight));
92  else {
93  edm::LogError("building") << algorithm << " is not a valid calibration algorithm";
94  exit(1);
95  }
96  }
97  edm::LogInfo("IML") << " [InvRingCalib][ctor] end of creator";
98 }
99 
100 //-------------------------------------------------------------- end ctor
102 
104 
105 //---------------------------------------------------
106 
109 
110 //--------------------------------------------------------
111 
113 void InvRingCalib::startingNewLoop(unsigned int ciclo) {
114  edm::LogInfo("IML") << "[InvMatrixCalibLooper][Start] entering loop " << ciclo;
115  for (std::vector<VEcalCalibBlock*>::iterator calibBlock = m_IMACalibBlocks.begin();
116  calibBlock != m_IMACalibBlocks.end();
117  ++calibBlock) {
118  //LP empties the energies vector, to fill DuringLoop.
119  (*calibBlock)->reset();
120  }
121  for (std::map<int, int>::const_iterator ring = m_xtalRing.begin(); ring != m_xtalRing.end(); ++ring)
122  m_RingNumOfHits[ring->second] = 0;
123  return;
124 }
125 
126 //--------------------------------------------------------
127 
130  if (isfirstcall_) {
131  edm::LogInfo("IML") << "[InvRingCalib][beginOfJob]";
132  //gets the geometry from the event setup
133  const auto& geometry = iSetup.getData(m_geometryToken);
134  edm::LogInfo("IML") << "[InvRingCalib] Event Setup read";
135  //fills a vector with all the cells
136  m_barrelCells = geometry.getValidDetIds(DetId::Ecal, EcalBarrel);
137  m_endcapCells = geometry.getValidDetIds(DetId::Ecal, EcalEndcap);
138  //Defines the EB regions
139  edm::LogInfo("IML") << "[InvRingCalib] Defining Barrel Regions";
140  EBRegionDef();
141  //Defines what is a ring in the EE
142  edm::LogInfo("IML") << "[InvRingCalib] Defining endcap Rings";
143  EERingDef(iSetup);
144  //Defines the regions in the EE
145  edm::LogInfo("IML") << "[InvRingCalib] Defining endcap Regions";
146  EERegionDef();
147  if (m_mapFillerType == "Cluster")
154  &m_barrelMap,
155  &m_endcapMap);
156  if (m_mapFillerType == "Matrix")
163  &m_barrelMap,
164  &m_endcapMap);
165  edm::LogInfo("IML") << "[InvRingCalib] Initializing the coeffs";
166  //Sets the initial coefficients to 1.
167  //Graphs to check ring, regions and so on, not needed in the final version
168  TH2F EBRegion("EBRegion", "EBRegion", 171, -85, 86, 360, 1, 361);
169  TH2F EBRing("EBRing", "EBRing", 171, -85, 86, 360, 1, 361);
170  for (std::vector<DetId>::const_iterator it = m_barrelCells.begin(); it != m_barrelCells.end(); ++it) {
171  EBDetId eb(*it);
172  EBRing.Fill(eb.ieta(), eb.iphi(), m_RinginRegion[it->rawId()]);
173  EBRegion.Fill(eb.ieta(), eb.iphi(), m_xtalRegionId[it->rawId()]);
174  }
175 
176  TH2F EEPRegion("EEPRegion", "EEPRegion", 100, 1, 101, 100, 1, 101);
177  TH2F EEPRing("EEPRing", "EEPRing", 100, 1, 101, 100, 1, 101);
178  TH2F EEPRingReg("EEPRingReg", "EEPRingReg", 100, 1, 101, 100, 1, 101);
179  TH2F EEMRegion("EEMRegion", "EEMRegion", 100, 1, 101, 100, 1, 101);
180  TH2F EEMRing("EEMRing", "EEMRing", 100, 1, 101, 100, 1, 101);
181  TH2F EEMRingReg("EEMRingReg", "EEMRingReg", 100, 1, 101, 100, 1, 101);
182  // TH1F eta ("eta","eta",250,-85,165);
183  for (std::vector<DetId>::const_iterator it = m_endcapCells.begin(); it != m_endcapCells.end(); ++it) {
184  EEDetId ee(*it);
185  if (ee.zside() > 0) {
186  EEPRegion.Fill(ee.ix(), ee.iy(), m_xtalRegionId[ee.rawId()]);
187  EEPRing.Fill(ee.ix(), ee.iy(), m_xtalRing[ee.rawId()]);
188  EEPRingReg.Fill(ee.ix(), ee.iy(), m_RinginRegion[ee.rawId()]);
189  }
190  if (ee.zside() < 0) {
191  EEMRegion.Fill(ee.ix(), ee.iy(), m_xtalRegionId[ee.rawId()]);
192  EEMRing.Fill(ee.ix(), ee.iy(), m_xtalRing[ee.rawId()]);
193  EEMRingReg.Fill(ee.ix(), ee.iy(), m_RinginRegion[ee.rawId()]);
194  }
195  }
196 
197  // for (std::map<int,float>::iterator it=m_eta.begin();
198  // it!=m_eta.end();++it)
199  // eta.Fill(it->first,it->second);
200  TFile out("EBZone.root", "recreate");
201  EBRegion.Write();
202  EBRing.Write();
203  EEPRegion.Write();
204  EEPRing.Write();
205  EEPRingReg.Write();
206  EEMRegion.Write();
207  EEMRing.Write();
208  // eta.Write();
209  EEMRingReg.Write();
210  out.Close();
211  edm::LogInfo("IML") << "[InvRingCalib] Start to acquire the coeffs";
212  CaloMiscalibMapEcal EBmap;
213  EBmap.prefillMap();
214  MiscalibReaderFromXMLEcalBarrel barrelreader(EBmap);
215  if (!m_EBcoeffFile.empty())
216  barrelreader.parseXMLMiscalibFile(m_EBcoeffFile);
217  EcalIntercalibConstants costants(EBmap.get());
218  m_barrelMap = costants.getMap();
219  CaloMiscalibMapEcal EEmap;
220  EEmap.prefillMap();
221  MiscalibReaderFromXMLEcalEndcap endcapreader(EEmap);
222  if (!m_EEcoeffFile.empty())
223  endcapreader.parseXMLMiscalibFile(m_EEcoeffFile);
224  EcalIntercalibConstants EEcostants(EEmap.get());
225  m_endcapMap = EEcostants.getMap();
226 
227  isfirstcall_ = false;
228  } // if isfirstcall
229 
230  //gets the barrel recHits
231  double pSubtract = 0.;
232  double pTk = 0.;
233  const EcalRecHitCollection* barrelHitsCollection = nullptr;
234  edm::Handle<EBRecHitCollection> barrelRecHitsHandle;
235  iEvent.getByToken(m_ebRecHitToken, barrelRecHitsHandle);
236  barrelHitsCollection = barrelRecHitsHandle.product();
237 
238  if (!barrelRecHitsHandle.isValid()) {
239  edm::LogError("IML") << "[EcalEleCalibLooper] barrel rec hits not found";
240  return kContinue;
241  }
242 
243  //gets the endcap recHits
244  const EcalRecHitCollection* endcapHitsCollection = nullptr;
245  edm::Handle<EERecHitCollection> endcapRecHitsHandle;
246  iEvent.getByToken(m_eeRecHitToken, endcapRecHitsHandle);
247  endcapHitsCollection = endcapRecHitsHandle.product();
248 
249  if (!endcapRecHitsHandle.isValid()) {
250  edm::LogError("IML") << "[EcalEleCalibLooper] endcap rec hits not found";
251  return kContinue;
252  }
253 
254  //gets the electrons
256  iEvent.getByToken(m_gsfElectronToken, pElectrons);
257 
258  if (!pElectrons.isValid()) {
259  edm::LogError("IML") << "[EcalEleCalibLooper] electrons not found";
260  return kContinue;
261  }
262 
263  //loops over the electrons in the event
264  for (reco::GsfElectronCollection::const_iterator eleIt = pElectrons->begin(); eleIt != pElectrons->end(); ++eleIt) {
265  pSubtract = 0;
266  pTk = eleIt->trackMomentumAtVtx().R();
267  std::map<int, double> xtlMap;
268  DetId Max = 0;
269  if (std::abs(eleIt->eta()) < 1.49)
270  Max = EcalClusterTools::getMaximum(eleIt->superCluster()->hitsAndFractions(), barrelHitsCollection).first;
271  else
272  Max = EcalClusterTools::getMaximum(eleIt->superCluster()->hitsAndFractions(), endcapHitsCollection).first;
273  if (Max.det() == 0)
274  continue;
276  eleIt->superCluster()->hitsAndFractions(), Max, barrelHitsCollection, endcapHitsCollection, xtlMap, pSubtract);
277  if (m_xtalRegionId[Max.rawId()] == -1)
278  continue;
279  pSubtract += eleIt->superCluster()->preshowerEnergy();
280  ++m_RingNumOfHits[m_xtalRing[Max.rawId()]];
281  //fills the calibBlock
282  m_IMACalibBlocks.at(m_xtalRegionId[Max.rawId()])->Fill(xtlMap.begin(), xtlMap.end(), pTk, pSubtract);
283  }
284  return kContinue;
285 } //end of duringLoop
286 
287 //-------------------------------------
288 
289 //EndOfLoop
290 edm::EDLooper::Status InvRingCalib::endOfLoop(const edm::EventSetup& dumb, unsigned int iCounter) {
291  std::map<int, double> InterRings;
292  edm::LogInfo("IML") << "[InvMatrixCalibLooper][endOfLoop] Start to invert the matrixes";
293  //call the autoexplaining "solve" method for every calibBlock
294  for (std::vector<VEcalCalibBlock*>::iterator calibBlock = m_IMACalibBlocks.begin();
295  calibBlock != m_IMACalibBlocks.end();
296  ++calibBlock)
297  (*calibBlock)->solve(m_usingBlockSolver, m_minCoeff, m_maxCoeff);
298 
299  edm::LogInfo("IML") << "[InvRingLooper][endOfLoop] Starting to write the coeffs";
300  TH1F* coeffDistr = new TH1F("coeffdistr", "coeffdistr", 100, 0.7, 1.4);
301  TH1F* coeffMap = new TH1F("coeffRingMap", "coeffRingMap", 250, -85, 165);
302  TH1F* ringDistr = new TH1F("ringDistr", "ringDistr", 250, -85, 165);
303  TH1F* RingFill = new TH1F("RingFill", "RingFill", 250, -85, 165);
304  for (std::map<int, int>::const_iterator it = m_xtalRing.begin(); it != m_xtalRing.end(); ++it)
305  ringDistr->Fill(it->second + 0.1);
306 
307  int ID;
308  std::map<int, int> flag;
309  for (std::map<int, int>::const_iterator it = m_xtalRing.begin(); it != m_xtalRing.end(); ++it)
310  flag[it->second] = 0;
311 
312  for (std::vector<DetId>::const_iterator it = m_barrelCells.begin(); it != m_barrelCells.end(); ++it) {
313  ID = it->rawId();
314  if (m_xtalRegionId[ID] == -1)
315  continue;
316  if (flag[m_xtalRing[ID]])
317  continue;
318  flag[m_xtalRing[ID]] = 1;
319  RingFill->Fill(m_xtalRing[ID], m_RingNumOfHits[m_xtalRing[ID]]);
320  InterRings[m_xtalRing[ID]] = m_IMACalibBlocks.at(m_xtalRegionId[ID])->at(m_RinginRegion[ID]);
321  coeffMap->Fill(m_xtalRing[ID] + 0.1, InterRings[m_xtalRing[ID]]);
322  coeffDistr->Fill(InterRings[m_xtalRing[ID]]);
323  }
324 
325  for (std::vector<DetId>::const_iterator it = m_endcapCells.begin(); it != m_endcapCells.end(); ++it) {
326  ID = it->rawId();
327  if (m_xtalRegionId[ID] == -1)
328  continue;
329  if (flag[m_xtalRing[ID]])
330  continue;
331  flag[m_xtalRing[ID]] = 1;
332  InterRings[m_xtalRing[ID]] = m_IMACalibBlocks.at(m_xtalRegionId[ID])->at(m_RinginRegion[ID]);
333  RingFill->Fill(m_xtalRing[ID], m_RingNumOfHits[m_xtalRing[ID]]);
334  coeffMap->Fill(m_xtalRing[ID], InterRings[m_xtalRing[ID]]);
335  coeffDistr->Fill(InterRings[m_xtalRing[ID]]);
336  }
337 
338  char filename[80];
339  sprintf(filename, "coeff%d.root", iCounter);
340  TFile out(filename, "recreate");
341  coeffDistr->Write();
342  coeffMap->Write();
343  ringDistr->Write();
344  RingFill->Write();
345  out.Close();
346  for (std::vector<DetId>::const_iterator it = m_barrelCells.begin(); it != m_barrelCells.end(); ++it) {
347  m_barrelMap[*it] *= InterRings[m_xtalRing[it->rawId()]];
348  }
349  for (std::vector<DetId>::const_iterator it = m_endcapCells.begin(); it != m_endcapCells.end(); ++it)
350  m_endcapMap[*it] *= InterRings[m_xtalRing[it->rawId()]];
351  if (iCounter < m_loops - 1)
352  return kContinue;
353  else
354  return kStop;
355 }
356 
357 //---------------------------------------
358 
359 //LP endOfJob
361  edm::LogInfo("IML") << "[InvMatrixCalibLooper][endOfJob] saving calib coeffs";
362  calibXMLwriter barrelWriter(EcalBarrel);
363  calibXMLwriter endcapWriter(EcalEndcap);
364  for (std::vector<DetId>::const_iterator barrelIt = m_barrelCells.begin(); barrelIt != m_barrelCells.end();
365  ++barrelIt) {
366  EBDetId eb(*barrelIt);
367  barrelWriter.writeLine(eb, m_barrelMap[eb]);
368  }
369  for (std::vector<DetId>::const_iterator endcapIt = m_endcapCells.begin(); endcapIt != m_endcapCells.end();
370  ++endcapIt) {
371  EEDetId ee(*endcapIt);
372  endcapWriter.writeLine(ee, m_endcapMap[ee]);
373  }
374 }
375 
376 //------------------------------------//
377 // definition of functions //
378 //------------------------------------//
379 
380 //------------------------------------------------------------
381 
384  //Gets the geometry of the endcap
385  const auto& geometry = iSetup.getData(m_geometryToken);
386  const CaloSubdetectorGeometry* endcapGeometry = geometry.getSubdetectorGeometry(DetId::Ecal, EcalEndcap);
387  //for every xtal gets the position Vector and the phi position
388 
389  // for (std::vector<DetId>::const_iterator barrelIt = m_barrelCells.begin();
390  // barrelIt!=m_barrelCells.end();
391  // ++barrelIt) {
392  // const CaloCellGeometry *cellGeometry = barrelGeometry->getGeometry(*barrelIt);
393  // GlobalPoint point;
394  // EBDetId eb (*barrelIt);
395  // point=cellGeometry->getPosition();
396  // m_eta[eb.ieta()]=point.eta() ; //cellGeometry->getPosition().eta();
397  // }
398  for (std::vector<DetId>::const_iterator endcapIt = m_endcapCells.begin(); endcapIt != m_endcapCells.end();
399  ++endcapIt) {
400  auto cellGeometry = endcapGeometry->getGeometry(*endcapIt);
401  m_cellPos[endcapIt->rawId()] = cellGeometry->getPosition();
402  m_cellPhi[endcapIt->rawId()] = cellGeometry->getPosition().phi();
403  }
404  //takes the first 39 xtals at a fixed y varying the x coordinate and saves their eta coordinate
405  float eta_ring[39];
406  for (int ring = 0; ring < 39; ring++)
407  if (EEDetId::validDetId(ring, 50, 1)) {
408  EEDetId det = EEDetId(ring, 50, 1, EEDetId::XYMODE);
409  eta_ring[ring] = m_cellPos[det.rawId()].eta();
410  }
411  //defines the bonduary of the rings as the average eta of a xtal
412  double etaBonduary[40];
413  etaBonduary[0] = 1.49;
414  etaBonduary[39] = 4.0;
415  for (int ring = 1; ring < 39; ++ring)
416  etaBonduary[ring] = (eta_ring[ring] + eta_ring[ring - 1]) / 2.;
417  //assign to each xtal a ring number
418  int CRing;
419  for (int ring = 0; ring < 39; ring++)
420  for (std::vector<DetId>::const_iterator endcapIt = m_endcapCells.begin(); endcapIt != m_endcapCells.end();
421  ++endcapIt) {
422  if (fabs(m_cellPos[endcapIt->rawId()].eta()) > etaBonduary[ring] &&
423  fabs(m_cellPos[endcapIt->rawId()].eta()) < etaBonduary[ring + 1]) {
424  EEDetId ee(*endcapIt);
425  if (ee.zside() > 0)
426  CRing = ring + 86;
427  else
428  CRing = ring + 125;
429  m_xtalRing[endcapIt->rawId()] = CRing;
430  // m_eta[CRing]=m_cellPos[endcapIt->rawId()].eta();
431  }
432  }
433  return;
434 }
435 
436 //------------------------------------------------------------
437 
440  int reg;
441  int ring;
442  EEDetId ee(id);
443  //sets the reg to -1 if the ring doesn't exist or is outside the region of interest
444  if (m_xtalRing[id] == -1)
445  return -1;
446  //avoid the calibration in the wrong zside
447  if (m_EEZone == 1) {
448  if (ee.zside() < 0)
449  return -1;
450  ring = m_xtalRing[id] - 86;
451  if (ring >= m_endRing)
452  return -1;
453  if (ring < m_startRing)
454  return -1;
455  reg = (ring - m_startRing) / m_etaWidth;
457  return reg;
458  }
459  if (m_EEZone == -1) {
460  if (ee.zside() > 0)
461  return -1;
462  ring = m_xtalRing[id] - 125;
463  if (ring >= m_endRing)
464  return -1;
465  if (ring < m_startRing)
466  return -1;
467  reg = (ring - m_startRing) / m_etaWidth;
469  return reg;
470  }
471  if (ee.zside() > 0)
472  ring = m_xtalRing[id] - 86;
473  else
474  ring = m_xtalRing[id] - 125;
475  if (ring >= m_endRing)
476  return -1;
477  if (ring < m_startRing)
478  return -1;
479  reg = (ring - m_startRing) / m_etaWidth;
481  return reg;
482 }
483 //----------------------------------------
487  int reg;
488  for (std::vector<DetId>::const_iterator endcapIt = m_endcapCells.begin(); endcapIt != m_endcapCells.end();
489  ++endcapIt) {
490  EEDetId ee(*endcapIt);
491  reg = EERegId(endcapIt->rawId());
492  //If the ring is not of interest saves only the region Id(-1)
493  if (reg == -1)
494  m_xtalRegionId[endcapIt->rawId()] = reg;
495  //sums the number of region in EB or EB+EE to have different regionsId in different regions
496  else {
497  if (ee.zside() > 0)
498  reg += EBRegionNum();
499  else
500  reg += EBRegionNum() + EERegionNum();
501  m_xtalRegionId[endcapIt->rawId()] = reg;
502  }
503  }
504 }
505 
506 //------------------------------------------------------------
507 
509 inline int InvRingCalib::EERegionNum() const { return ((m_endRing - m_startRing) / m_etaWidth); }
510 
513  if ((m_etaEnd * m_etaStart) > 0)
514  return ((m_etaEnd - m_etaStart) / m_etaWidth);
515 
516  if ((m_etaEnd * m_etaStart) < 0)
517  return ((m_etaEnd - m_etaStart - 1) / m_etaWidth);
518 
519  return 0;
520 }
524  int k = 0;
525  for (int i = m_etaStart; i < m_etaEnd; ++i) {
526  if (i == 0)
527  continue;
528  m_Reg[i] = k / m_etaWidth;
529  ++k;
530  }
531 }
533 int InvRingCalib::EBRegId(const int ieta) {
534  if (ieta < m_etaStart || ieta >= m_etaEnd)
535  return -1;
536  else
537  return (m_Reg[ieta]);
538 }
539 
540 //------------------------------------------------------------
541 
542 //EB Region Definition
544  RegPrepare();
545  for (std::vector<DetId>::const_iterator it = m_barrelCells.begin(); it != m_barrelCells.end(); ++it) {
546  EBDetId eb(it->rawId());
547  m_xtalRing[eb.rawId()] = eb.ieta();
548  m_xtalRegionId[eb.rawId()] = EBRegId(eb.ieta());
549  if (m_xtalRegionId[eb.rawId()] == -1)
550  continue;
551  m_RinginRegion[eb.rawId()] = (eb.ieta() - m_etaStart) % m_etaWidth;
552  }
553 }
554 //------------------------------------------------------------
virtual void fillMap(const std::vector< std::pair< DetId, float > > &, const DetId, const EcalRecHitCollection *, const EcalRecHitCollection *, std::map< int, double > &xtlMap, double &)=0
The Map filler.
ESGetTokenH3DDVariant esConsumes(std::string const &Record, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
const double m_maxEnergyPerCrystal
maximum energy per crystal cut
Definition: InvRingCalib.h:78
const int m_etaWidth
eta size of the regions
Definition: InvRingCalib.h:84
void startingNewLoop(unsigned int) override
startingNewLoop
const edm::EDGetTokenT< EBRecHitCollection > m_ebRecHitToken
ED token.
Definition: InvRingCalib.h:131
void EERingDef(const edm::EventSetup &)
Defines the rins in the endcap.
std::map< int, int > m_xtalRegionId
association map between raw detIds and Region
Definition: InvRingCalib.h:113
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
Definition: EventSetup.h:119
void EBRegionDef()
Defines the regions in the barrel.
const int m_endRing
Definition: InvRingCalib.h:109
const int m_usingBlockSolver
to exclude the blocksolver
Definition: InvRingCalib.h:97
for(int i=first, nt=offsets[nh];i< nt;i+=gridDim.x *blockDim.x)
int iphi() const
get the crystal iphi
Definition: EBDetId.h:51
const int m_startRing
LP define the EE region to calibrate.
Definition: InvRingCalib.h:108
InvRingCalib(const edm::ParameterSet &)
ctor
Definition: InvRingCalib.cc:26
uint32_t ID
Definition: Definitions.h:24
T const * product() const
Definition: Handle.h:70
static const int XYMODE
Definition: EEDetId.h:335
int ix() const
Definition: EEDetId.h:77
const int m_EEZone
endcap zone to be calibrated
Definition: InvRingCalib.h:124
bool parseXMLMiscalibFile(std::string configFile)
EcalIntercalibConstantMap m_endcapMap
Definition: InvRingCalib.h:104
void EERegionDef()
Defines the regions in the endcap.
int EERegionNum() const
The number of regions in EE.
void beginOfJob() override
BeginOfJob.
std::vector< VEcalCalibBlock * > m_IMACalibBlocks
single blocks calibrators
Definition: InvRingCalib.h:91
Status duringLoop(const edm::Event &, const edm::EventSetup &) override
duringLoop
int EERegId(int)
gives back in which region of the endcap you are.
Log< level::Error, false > LogError
Status endOfLoop(const edm::EventSetup &, unsigned int iCounter) override
assert(be >=bs)
std::vector< GsfElectron > GsfElectronCollection
collection of GsfElectron objects
const double m_maxCoeff
maximum coefficient accepted (RAW)
Definition: InvRingCalib.h:95
const edm::EDGetTokenT< reco::GsfElectronCollection > m_gsfElectronToken
Definition: InvRingCalib.h:133
double getMaximum(TObjArray *array)
int ieta() const
get the crystal ieta
Definition: EBDetId.h:49
const double m_minCoeff
minimum coefficient accepted (RAW)
Definition: InvRingCalib.h:93
T getUntrackedParameter(std::string const &, T const &) const
EcalIntercalibConstantMap m_barrelMap
Definition: InvRingCalib.h:103
int EBRegionNum() const
Number of regions in EB.
void endOfJob() override
int iEvent
Definition: GenABIO.cc:224
std::map< int, GlobalPoint > m_cellPos
position of the cell, borders, coords etc...
Definition: InvRingCalib.h:99
const int m_recoWindowSidey
Definition: InvRingCalib.h:74
const edm::ESGetToken< CaloGeometry, CaloGeometryRecord > m_geometryToken
ES token.
Definition: InvRingCalib.h:135
VFillMap * m_MapFiller
The class that fills the map!
Definition: InvRingCalib.h:63
const EcalIntercalibConstants & get()
const int m_etaEnd
eta end of the zone of interest
Definition: InvRingCalib.h:82
std::map< int, int > m_Reg
EB regions vs. eta index.
Definition: InvRingCalib.h:126
std::vector< DetId > m_barrelCells
geometry things used all over the file
Definition: InvRingCalib.h:118
void Fill(HcalDetId &id, double val, std::vector< TH2F > &depth)
const int m_etaStart
eta start of the zone of interest
Definition: InvRingCalib.h:80
std::map< int, int > m_RinginRegion
association map between raw detIds and the number of the ring inside the region
Definition: InvRingCalib.h:115
interface to the L3Univ class for testing
Definition: L3CalibBlock.h:24
~InvRingCalib() override
dtor
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
void RegPrepare()
Prepares the EB regions;.
unsigned int m_loops
LP sets the number of loops to do.
Definition: InvRingCalib.h:106
virtual std::shared_ptr< const CaloCellGeometry > getGeometry(const DetId &id) const
Get the cell geometry of a given detector id. Should return false if not found.
std::map< int, int > m_xtalRing
association map between Raw detIds and Rings
Definition: InvRingCalib.h:111
Log< level::Info, false > LogInfo
Definition: DetId.h:17
int zside() const
Definition: EEDetId.h:71
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
static bool validDetId(int crystal_ix, int crystal_iy, int iz)
Definition: EEDetId.h:248
const edm::EDGetTokenT< EERecHitCollection > m_eeRecHitToken
Definition: InvRingCalib.h:132
const double m_minEnergyPerCrystal
minimum energy per crystal cut
Definition: InvRingCalib.h:76
bool isValid() const
Definition: HandleBase.h:70
const int m_recoWindowSidex
reconstruction window size
Definition: InvRingCalib.h:73
std::map< int, CalibCoeff > coeffMap
void writeLine(EBDetId const &, float)
fixed size matrix
HLT enums.
std::map< int, int > m_cellPhi
Definition: InvRingCalib.h:100
const std::string m_EEcoeffFile
Definition: InvRingCalib.h:122
const std::string m_EBcoeffFile
coeffs filenames
Definition: InvRingCalib.h:121
std::vector< DetId > m_endcapCells
Definition: InvRingCalib.h:119
std::map< int, int > m_RingNumOfHits
number of events already read per Ring
Definition: InvRingCalib.h:89
std::string m_mapFillerType
Definition: InvRingCalib.h:127
int EBRegId(const int)
Gives back in which region you are:
int iy() const
Definition: EEDetId.h:83
def exit(msg="")