CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 &)
 The Map filler. More...
 
 MatrixFillMap (int, int, const std::map< int, int > &, double, double, const std::map< int, int > &, EcalIntercalibConstantMap *, EcalIntercalibConstantMap *)
 ctor More...
 
 ~MatrixFillMap ()
 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 ( 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.

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

dtor

Definition at line 21 of file MatrixFillMap.cc.

22  {
23  }

Member Function Documentation

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 49 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().

53 {
54  int curr_eta;
55  int curr_phi;
56  //reads the hits in a recoWindowSide^2 wide region around the MOX
57  for (int ii = 0 ; ii< m_recoWindowSidex ; ++ii)
58  for (int ij =0 ; ij< m_recoWindowSidey ; ++ij)
59  {
60  curr_eta=EBmax.ieta() + ii - (m_recoWindowSidex/2);
61  curr_phi=EBmax.iphi() + ij - (m_recoWindowSidey/2);
62  //skips if the xtals matrix falls over the border
63  if (abs(curr_eta)>85) continue;
64  //Couples with the zero gap in the barrel eta index
65  if (curr_eta * EBmax.ieta() <= 0) {
66  if (EBmax.ieta() > 0) curr_eta--;
67  else curr_eta++;
68  } // JUMP over 0
69  //The following 2 couples with the ciclicity of the phiIndex
70  if (curr_phi < 1) curr_phi += 360;
71  if (curr_phi >= 360) curr_phi -= 360;
72  //checks if the detId is valid
73  if(EBDetId::validDetId(curr_eta,curr_phi))
74  {
75  EBDetId det = EBDetId(curr_eta,curr_phi,EBDetId::ETAPHIMODE);
76  int ID= det.rawId();
77  //finds the hit corresponding to the cell
78  EcalRecHitCollection::const_iterator curr_recHit = barrelHitsCollection->find(det) ;
79  double dummy = 0;
80  dummy = curr_recHit->energy () ;
81  //checks if the reading of the xtal is in a sensible range
82  if (edm::isNotFinite(dummy)){
83  dummy=0;
84  }
85  if ( dummy < m_minEnergyPerCrystal) continue;
86  if (dummy > m_maxEnergyPerCrystal) continue;
87  //corrects the energy with the calibration coeff of the ring
88  dummy *= (*m_barrelMap)[det];
89  //sums the energy of the xtal to the appropiate ring
90  if (m_xtalRegionId[ID]==EBNumberOfRegion)
91  EBRegionMap[m_IndexInRegion[ID]]+= dummy;
92  //adds the reading to pSubtract when part of the matrix is outside the region
93  else pSubtract +=dummy;
94  }
95  }
96 }
double m_maxEnergyPerCrystal
Definition: VFillMap.h:39
int m_recoWindowSidex
Definition: VFillMap.h:35
uint32_t ID
Definition: Definitions.h:26
std::vector< EcalRecHit >::const_iterator const_iterator
int ii
Definition: cuy.py:588
std::map< int, int > m_IndexInRegion
Definition: VFillMap.h:40
static bool validDetId(int i, int j)
check if a valid index combination
Definition: EBDetId.h:124
int iphi() const
get the crystal iphi
Definition: EBDetId.h:53
uint32_t rawId() const
get the raw id
Definition: DetId.h:43
bool isNotFinite(T x)
Definition: isFinite.h:10
double m_minEnergyPerCrystal
Definition: VFillMap.h:38
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
int ieta() const
get the crystal ieta
Definition: EBDetId.h:51
static const int ETAPHIMODE
Definition: EBDetId.h:166
std::map< int, int > m_xtalRegionId
Definition: VFillMap.h:37
iterator find(key_type k)
int m_recoWindowSidey
Definition: VFillMap.h:36
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 98 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().

102 {
103  int curr_x;
104  int curr_y;
105  for (int ii = 0 ; ii< m_recoWindowSidex ; ++ii)
106  for (int ij =0 ; ij< m_recoWindowSidey ; ++ij)
107  {
108  //Works as fillEBMap
109  curr_x = EEmax.ix() - m_recoWindowSidex/2 +ii;
110  curr_y = EEmax.iy() - m_recoWindowSidey /2 +ij;
111  if(EEDetId::validDetId(curr_x,curr_y,EEmax.zside()))
112  {
113  EEDetId det = EEDetId(curr_x,curr_y,EEmax.zside(),EEDetId::XYMODE);
114  int ID=det.rawId();
115  EcalRecHitCollection::const_iterator curr_recHit = endcapHitsCollection->find(det) ;
116  double dummy = curr_recHit->energy () ;
117  if (edm::isNotFinite(dummy)) {
118  dummy=0;
119  }
120  if ( dummy < m_minEnergyPerCrystal ) continue;
121  if ( dummy > m_maxEnergyPerCrystal ) {
122  dummy=0;
123  continue;
124  }
125  dummy *= (*m_endcapMap)[det];
126  if (m_xtalRegionId[ID]==EENumberOfRegion)
127  EExtlMap[m_IndexInRegion[ID]] += dummy;
128  else pSubtract +=dummy;
129  }
130  }
131 }
double m_maxEnergyPerCrystal
Definition: VFillMap.h:39
int m_recoWindowSidex
Definition: VFillMap.h:35
int ix() const
Definition: EEDetId.h:76
uint32_t ID
Definition: Definitions.h:26
static const int XYMODE
Definition: EEDetId.h:339
std::vector< EcalRecHit >::const_iterator const_iterator
int ii
Definition: cuy.py:588
std::map< int, int > m_IndexInRegion
Definition: VFillMap.h:40
uint32_t rawId() const
get the raw id
Definition: DetId.h:43
bool isNotFinite(T x)
Definition: isFinite.h:10
double m_minEnergyPerCrystal
Definition: VFillMap.h:38
int zside() const
Definition: EEDetId.h:70
int iy() const
Definition: EEDetId.h:82
std::map< int, int > m_xtalRegionId
Definition: VFillMap.h:37
static bool validDetId(int crystal_ix, int crystal_iy, int iz)
Definition: EEDetId.h:248
iterator find(key_type k)
int m_recoWindowSidey
Definition: VFillMap.h:36
void MatrixFillMap::fillMap ( const std::vector< std::pair< DetId, float > > &  ,
const DetId  ,
const EcalRecHitCollection ,
const EcalRecHitCollection ,
std::map< int, double > &  xtlMap,
double &   
)
virtual

The Map filler.

Implements VFillMap.

Definition at line 27 of file MatrixFillMap.cc.

References EcalBarrel, EcalEndcap, fillEBMap(), fillEEMap(), VFillMap::m_xtalRegionId, siStripFEDMonitor_P5_cff::Max, DetId::rawId(), and DetId::subdetId().

33 {
34  if (Max.subdetId() == EcalBarrel ){
35  EBDetId EBMax = Max;
36  fillEBMap (EBMax, barrelHitsCollection, xtlMap,
37  m_xtalRegionId[Max.rawId()], pSubtract ) ;
38  }
39  else if (Max.subdetId()== EcalEndcap){
40  EEDetId EEMax = Max;
41  fillEEMap (EEMax, endcapHitsCollection, xtlMap,
42  m_xtalRegionId[Max.rawId()],pSubtract ) ;
43  }
44 }
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:37