CMS 3D CMS Logo

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