CMS 3D CMS Logo

MatrixFillMap.cc
Go to the documentation of this file.
5 
7  int WindowY,
8  const std::map<int, int>& xtalReg,
9  double minE,
10  double maxE,
11  const std::map<int, int>& IndexReg,
12  EcalIntercalibConstantMap* barrelMap,
13  EcalIntercalibConstantMap* endcapMap)
14  :
15 
16  VFillMap(WindowX, WindowY, xtalReg, minE, maxE, IndexReg, barrelMap, endcapMap) {}
17 
19 
20 void MatrixFillMap::fillMap(const std::vector<std::pair<DetId, float> >& v1,
21  const DetId Max,
22  const EcalRecHitCollection* barrelHitsCollection,
23  const EcalRecHitCollection* endcapHitsCollection,
24  std::map<int, double>& xtlMap,
25  double& pSubtract) {
26  if (Max.subdetId() == EcalBarrel) {
27  EBDetId EBMax = Max;
28  fillEBMap(EBMax, barrelHitsCollection, xtlMap, m_xtalRegionId[Max.rawId()], pSubtract);
29  } else if (Max.subdetId() == EcalEndcap) {
30  EEDetId EEMax = Max;
31  fillEEMap(EEMax, endcapHitsCollection, xtlMap, m_xtalRegionId[Max.rawId()], pSubtract);
32  }
33 }
34 
36  const EcalRecHitCollection* barrelHitsCollection,
37  std::map<int, double>& EBRegionMap,
38  int EBNumberOfRegion,
39  double& pSubtract) {
40  int curr_eta;
41  int curr_phi;
42  //reads the hits in a recoWindowSide^2 wide region around the MOX
43  for (int ii = 0; ii < m_recoWindowSidex; ++ii)
44  for (int ij = 0; ij < m_recoWindowSidey; ++ij) {
45  curr_eta = EBmax.ieta() + ii - (m_recoWindowSidex / 2);
46  curr_phi = EBmax.iphi() + ij - (m_recoWindowSidey / 2);
47  //skips if the xtals matrix falls over the border
48  if (abs(curr_eta) > 85)
49  continue;
50  //Couples with the zero gap in the barrel eta index
51  if (curr_eta * EBmax.ieta() <= 0) {
52  if (EBmax.ieta() > 0)
53  curr_eta--;
54  else
55  curr_eta++;
56  } // JUMP over 0
57  //The following 2 couples with the ciclicity of the phiIndex
58  if (curr_phi < 1)
59  curr_phi += 360;
60  if (curr_phi >= 360)
61  curr_phi -= 360;
62  //checks if the detId is valid
63  if (EBDetId::validDetId(curr_eta, curr_phi)) {
64  EBDetId det = EBDetId(curr_eta, curr_phi, EBDetId::ETAPHIMODE);
65  int ID = det.rawId();
66  //finds the hit corresponding to the cell
67  EcalRecHitCollection::const_iterator curr_recHit = barrelHitsCollection->find(det);
68  double dummy = 0;
69  dummy = curr_recHit->energy();
70  //checks if the reading of the xtal is in a sensible range
71  if (edm::isNotFinite(dummy)) {
72  dummy = 0;
73  }
75  continue;
77  continue;
78  //corrects the energy with the calibration coeff of the ring
79  dummy *= (*m_barrelMap)[det];
80  //sums the energy of the xtal to the appropiate ring
81  if (m_xtalRegionId[ID] == EBNumberOfRegion)
82  EBRegionMap[m_IndexInRegion[ID]] += dummy;
83  //adds the reading to pSubtract when part of the matrix is outside the region
84  else
85  pSubtract += dummy;
86  }
87  }
88 }
89 
91  const EcalRecHitCollection* endcapHitsCollection,
92  std::map<int, double>& EExtlMap,
93  int EENumberOfRegion,
94  double& pSubtract) {
95  int curr_x;
96  int curr_y;
97  for (int ii = 0; ii < m_recoWindowSidex; ++ii)
98  for (int ij = 0; ij < m_recoWindowSidey; ++ij) {
99  //Works as fillEBMap
100  curr_x = EEmax.ix() - m_recoWindowSidex / 2 + ii;
101  curr_y = EEmax.iy() - m_recoWindowSidey / 2 + ij;
102  if (EEDetId::validDetId(curr_x, curr_y, EEmax.zside())) {
103  EEDetId det = EEDetId(curr_x, curr_y, EEmax.zside(), EEDetId::XYMODE);
104  EcalRecHitCollection::const_iterator curr_recHit = endcapHitsCollection->find(det);
105  double dummy = curr_recHit->energy();
106  if (edm::isNotFinite(dummy)) {
107  dummy = 0;
108  }
110  continue;
112  continue;
113  }
114  dummy *= (*m_endcapMap)[det];
115  int ID = det.rawId();
116  if (m_xtalRegionId[ID] == EENumberOfRegion)
117  EExtlMap[m_IndexInRegion[ID]] += dummy;
118  else
119  pSubtract += dummy;
120  }
121  }
122 }
HLT_FULL_cff.maxE
maxE
Definition: HLT_FULL_cff.py:13661
EBDetId::ieta
int ieta() const
get the crystal ieta
Definition: EBDetId.h:49
edm::SortedCollection< EcalRecHit >::const_iterator
std::vector< EcalRecHit >::const_iterator const_iterator
Definition: SortedCollection.h:80
edm::isNotFinite
constexpr bool isNotFinite(T x)
Definition: isFinite.h:9
MatrixFillMap::MatrixFillMap
MatrixFillMap(int, int, const std::map< int, int > &, double, double, const std::map< int, int > &, EcalIntercalibConstantMap *, EcalIntercalibConstantMap *)
ctor
Definition: MatrixFillMap.cc:6
EBDetId
Definition: EBDetId.h:17
EBDetId.h
EEDetId.h
edm::SortedCollection< EcalRecHit >
VFillMap::m_minEnergyPerCrystal
double m_minEnergyPerCrystal
Definition: VFillMap.h:37
VFillMap::m_xtalRegionId
std::map< int, int > m_xtalRegionId
Definition: VFillMap.h:36
EcalCondObjectContainer
Definition: EcalCondObjectContainer.h:13
EEDetId::ix
int ix() const
Definition: EEDetId.h:77
EcalBarrel
Definition: EcalSubdetector.h:10
VFillMap::m_recoWindowSidex
int m_recoWindowSidex
Definition: VFillMap.h:34
DetId
Definition: DetId.h:17
VFillMap::m_IndexInRegion
std::map< int, int > m_IndexInRegion
Definition: VFillMap.h:39
EEDetId::zside
int zside() const
Definition: EEDetId.h:71
EEDetId
Definition: EEDetId.h:14
MatrixFillMap::~MatrixFillMap
~MatrixFillMap() override
dtor
Definition: MatrixFillMap.cc:18
EcalEndcap
Definition: EcalSubdetector.h:10
EBDetId::ETAPHIMODE
static const int ETAPHIMODE
Definition: EBDetId.h:158
align::ID
uint32_t ID
Definition: Definitions.h:24
MatrixFillMap::fillMap
void fillMap(const std::vector< std::pair< DetId, float > > &, const DetId, const EcalRecHitCollection *, const EcalRecHitCollection *, std::map< int, double > &xtlMap, double &) override
The Map filler.
Definition: MatrixFillMap.cc:20
VFillMap
Definition: VFillMap.h:12
trackerHitRTTI::vector
Definition: trackerHitRTTI.h:21
Max
T Max(T a, T b)
Definition: MathUtil.h:44
EEDetId::iy
int iy() const
Definition: EEDetId.h:83
EBDetId::validDetId
static bool validDetId(int i, int j)
check if a valid index combination
Definition: EBDetId.h:118
MatrixFillMap::fillEEMap
void fillEEMap(EEDetId, const EcalRecHitCollection *, std::map< int, double > &, int, double &)
takes care of the Endcap
Definition: MatrixFillMap.cc:90
edm::SortedCollection::find
iterator find(key_type k)
Definition: SortedCollection.h:240
DetId::rawId
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
isFinite.h
MatrixFillMap::fillEBMap
void fillEBMap(EBDetId, const EcalRecHitCollection *, std::map< int, double > &, int, double &)
takes care of the Barrel
Definition: MatrixFillMap.cc:35
EEDetId::XYMODE
static const int XYMODE
Definition: EEDetId.h:335
VFillMap::m_maxEnergyPerCrystal
double m_maxEnergyPerCrystal
Definition: VFillMap.h:38
EEDetId::validDetId
static bool validDetId(int crystal_ix, int crystal_iy, int iz)
Definition: EEDetId.h:248
MatrixFillMap.h
EBDetId::iphi
int iphi() const
get the crystal iphi
Definition: EBDetId.h:51
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
VFillMap::m_recoWindowSidey
int m_recoWindowSidey
Definition: VFillMap.h:35
dummy
Definition: DummySelector.h:38
cuy.ii
ii
Definition: cuy.py:589