CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions
MatrixFillMap Class Reference

#include <MatrixFillMap.h>

Inheritance diagram for MatrixFillMap:
VFillMap

Public Member Functions

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. More...
 
 MatrixFillMap (int, int, const std::map< int, int > &, double, double, const std::map< int, int > &, EcalIntercalibConstantMap *, EcalIntercalibConstantMap *)
 ctor More...
 
 ~MatrixFillMap () override
 dtor More...
 
- Public Member Functions inherited from VFillMap
 VFillMap (int, int, const std::map< int, int > &, double, double, const std::map< int, int > &, EcalIntercalibConstantMap *, EcalIntercalibConstantMap *)
 ctor More...
 
virtual ~VFillMap ()
 dtor More...
 

Private Member Functions

void fillEBMap (EBDetId, const EcalRecHitCollection *, std::map< int, double > &, int, double &)
 takes care of the Barrel More...
 
void fillEEMap (EEDetId, const EcalRecHitCollection *, std::map< int, double > &, int, double &)
 takes care of the Endcap More...
 

Additional Inherited Members

- Public Attributes inherited from VFillMap
EcalIntercalibConstantMapm_barrelMap
 
EcalIntercalibConstantMapm_endcapMap
 
std::map< int, int > m_IndexInRegion
 
double m_maxEnergyPerCrystal
 
double m_minEnergyPerCrystal
 
int m_recoWindowSidex
 
int m_recoWindowSidey
 
std::map< int, int > m_xtalRegionId
 

Detailed Description

Definition at line 7 of file MatrixFillMap.h.

Constructor & Destructor Documentation

◆ MatrixFillMap()

MatrixFillMap::MatrixFillMap ( int  WindowX,
int  WindowY,
const std::map< int, int > &  xtalReg,
double  minE,
double  maxE,
const std::map< int, int > &  IndexReg,
EcalIntercalibConstantMap barrelMap,
EcalIntercalibConstantMap endcapMap 
)

ctor

Definition at line 6 of file MatrixFillMap.cc.

14  :
15 
16  VFillMap(WindowX, WindowY, xtalReg, minE, maxE, IndexReg, barrelMap, endcapMap) {}
VFillMap(int, int, const std::map< int, int > &, double, double, const std::map< int, int > &, EcalIntercalibConstantMap *, EcalIntercalibConstantMap *)
ctor
Definition: VFillMap.cc:3

◆ ~MatrixFillMap()

MatrixFillMap::~MatrixFillMap ( )
override

dtor

Definition at line 18 of file MatrixFillMap.cc.

18 {}

Member Function Documentation

◆ fillEBMap()

void MatrixFillMap::fillEBMap ( EBDetId  EBmax,
const EcalRecHitCollection barrelHitsCollection,
std::map< int, double > &  EBRegionMap,
int  EBNumberOfRegion,
double &  pSubtract 
)
private

takes care of the Barrel

Definition at line 35 of file MatrixFillMap.cc.

References funct::abs(), EBDetId::ETAPHIMODE, edm::SortedCollection< T, SORT >::find(), EBDetId::ieta(), cuy::ii, EBDetId::iphi(), edm::isNotFinite(), VFillMap::m_IndexInRegion, VFillMap::m_maxEnergyPerCrystal, VFillMap::m_minEnergyPerCrystal, VFillMap::m_recoWindowSidex, VFillMap::m_recoWindowSidey, VFillMap::m_xtalRegionId, DetId::rawId(), and EBDetId::validDetId().

Referenced by fillMap().

39  {
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 }
double m_maxEnergyPerCrystal
Definition: VFillMap.h:38
int m_recoWindowSidex
Definition: VFillMap.h:34
constexpr bool isNotFinite(T x)
Definition: isFinite.h:9
int iphi() const
get the crystal iphi
Definition: EBDetId.h:51
uint32_t ID
Definition: Definitions.h:24
std::vector< EcalRecHit >::const_iterator const_iterator
std::map< int, int > m_IndexInRegion
Definition: VFillMap.h:39
static bool validDetId(int i, int j)
check if a valid index combination
Definition: EBDetId.h:118
int ieta() const
get the crystal ieta
Definition: EBDetId.h:49
double m_minEnergyPerCrystal
Definition: VFillMap.h:37
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
static const int ETAPHIMODE
Definition: EBDetId.h:158
ii
Definition: cuy.py:589
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
iterator find(key_type k)
std::map< int, int > m_xtalRegionId
Definition: VFillMap.h:36
int m_recoWindowSidey
Definition: VFillMap.h:35

◆ fillEEMap()

void MatrixFillMap::fillEEMap ( EEDetId  EEmax,
const EcalRecHitCollection endcapHitsCollection,
std::map< int, double > &  EExtlMap,
int  EENumberOfRegion,
double &  pSubtract 
)
private

takes care of the Endcap

Definition at line 90 of file MatrixFillMap.cc.

References edm::SortedCollection< T, SORT >::find(), cuy::ii, edm::isNotFinite(), EEDetId::ix(), EEDetId::iy(), VFillMap::m_IndexInRegion, VFillMap::m_maxEnergyPerCrystal, VFillMap::m_minEnergyPerCrystal, VFillMap::m_recoWindowSidex, VFillMap::m_recoWindowSidey, VFillMap::m_xtalRegionId, DetId::rawId(), EEDetId::validDetId(), EEDetId::XYMODE, and EEDetId::zside().

Referenced by fillMap().

94  {
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 }
double m_maxEnergyPerCrystal
Definition: VFillMap.h:38
int m_recoWindowSidex
Definition: VFillMap.h:34
constexpr bool isNotFinite(T x)
Definition: isFinite.h:9
uint32_t ID
Definition: Definitions.h:24
static const int XYMODE
Definition: EEDetId.h:333
int ix() const
Definition: EEDetId.h:77
std::vector< EcalRecHit >::const_iterator const_iterator
std::map< int, int > m_IndexInRegion
Definition: VFillMap.h:39
double m_minEnergyPerCrystal
Definition: VFillMap.h:37
ii
Definition: cuy.py:589
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
iterator find(key_type k)
std::map< int, int > m_xtalRegionId
Definition: VFillMap.h:36
int m_recoWindowSidey
Definition: VFillMap.h:35
int iy() const
Definition: EEDetId.h:83

◆ fillMap()

void MatrixFillMap::fillMap ( const std::vector< std::pair< DetId, float > > &  ,
const DetId  ,
const EcalRecHitCollection ,
const EcalRecHitCollection ,
std::map< int, double > &  xtlMap,
double &   
)
overridevirtual

The Map filler.

Implements VFillMap.

Definition at line 20 of file MatrixFillMap.cc.

References EcalBarrel, EcalEndcap, fillEBMap(), fillEEMap(), VFillMap::m_xtalRegionId, and METSkim_cff::Max.

25  {
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 }
void fillEBMap(EBDetId, const EcalRecHitCollection *, std::map< int, double > &, int, double &)
takes care of the Barrel
void fillEEMap(EEDetId, const EcalRecHitCollection *, std::map< int, double > &, int, double &)
takes care of the Endcap
std::map< int, int > m_xtalRegionId
Definition: VFillMap.h:36