CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Private Attributes
CalibrationCluster Class Reference

#include <CalibrationCluster.h>

Public Types

typedef std::map< EBDetId, unsigned int > CalibMap
 
typedef CalibMap::value_type pippo
 

Public Member Functions

 CalibrationCluster ()
 
std::vector< EBDetIdget3x3Id (EBDetId const &)
 
std::vector< EBDetIdget5x5Id (EBDetId const &)
 
std::vector< float > getEnergyVector (const EBRecHitCollection *, CalibMap &, std::vector< EBDetId > &, float &, int &)
 
CalibMap getMap (int, int, int, int)
 
 ~CalibrationCluster ()
 

Private Attributes

CalibMap calibRegion
 
std::vector< float > energyVector
 
std::vector< EBDetIdXtals3x3
 
std::vector< EBDetIdXtals5x5
 

Detailed Description

Definition at line 13 of file CalibrationCluster.h.

Member Typedef Documentation

typedef std::map<EBDetId,unsigned int> CalibrationCluster::CalibMap

Definition at line 16 of file CalibrationCluster.h.

typedef CalibMap::value_type CalibrationCluster::pippo

Definition at line 17 of file CalibrationCluster.h.

Constructor & Destructor Documentation

CalibrationCluster::CalibrationCluster ( )

Definition at line 7 of file CalibrationCluster.cc.

7  {
8 
9 }
CalibrationCluster::~CalibrationCluster ( )

Definition at line 11 of file CalibrationCluster.cc.

11  {
12 }

Member Function Documentation

std::vector< EBDetId > CalibrationCluster::get3x3Id ( EBDetId const &  maxHitId)

Definition at line 53 of file CalibrationCluster.cc.

References gather_cfg::cout, EBDetId::ETAPHIMODE, EBDetId::ieta(), and EBDetId::iphi().

53  {
54 
55  Xtals3x3.clear();
56 
57  for (unsigned int icry=0;icry<9;icry++)
58  {
59  unsigned int row = icry / 3;
60  unsigned int column= icry %3;
61 
62 
63  try
64  {
65  Xtals3x3.push_back(EBDetId(maxHitId.ieta()+column-1,maxHitId.iphi()+row-1,EBDetId::ETAPHIMODE));
66  }
67  catch ( ... )
68  {
69  std::cout << "Cannot construct 3x3 matrix around EBDetId " << maxHitId << std::endl;
70  }
71  }
72 
73  return Xtals3x3;
74 }
std::vector< EBDetId > Xtals3x3
static const int ETAPHIMODE
Definition: EBDetId.h:158
std::vector< EBDetId > CalibrationCluster::get5x5Id ( EBDetId const &  maxHitId)

Definition at line 16 of file CalibrationCluster.cc.

References gather_cfg::cout, EBDetId::ETAPHIMODE, EBDetId::ieta(), and EBDetId::iphi().

Referenced by ElectronCalibration::analyze().

16  {
17 
18 
19  Xtals5x5.clear();
20 
21 
22 // std::cout << "get5x5Id: max Containment crystal " << maxHitId.ic() << " eta " << maxHitId.ieta() << " phi " << maxHitId.iphi() << std::endl;
23 
24  for (unsigned int icry=0;icry<25;icry++)
25  {
26  unsigned int row = icry / 5;
27  unsigned int column= icry %5;
28 // std::cout << "CalibrationCluster::icry = " << icry << std::endl;
29 
30  int curr_eta=maxHitId.ieta() + column - (5/2);
31  int curr_phi=maxHitId.iphi() + row - (5/2);
32 
33  if (curr_eta * maxHitId.ieta() <= 0) {if (maxHitId.ieta() > 0) curr_eta--; else curr_eta++; } // JUMP over 0
34  if (curr_phi < 1) curr_phi += 360;
35  if (curr_phi > 360) curr_phi -= 360;
36 
37  try
38  {
39 // Xtals5x5.push_back(EBDetId(maxHitId.ieta()+column-2,maxHitId.iphi()+row-2,EBDetId::ETAPHIMODE));
40  Xtals5x5.push_back(EBDetId(curr_eta,curr_phi,EBDetId::ETAPHIMODE));
41  }
42  catch ( ... )
43  {
44  std::cout << "Cannot construct 5x5 matrix around EBDetId " << maxHitId << std::endl;
45  }
46  }
47 
48  return Xtals5x5;
49 }
std::vector< EBDetId > Xtals5x5
static const int ETAPHIMODE
Definition: EBDetId.h:158
std::vector< float > CalibrationCluster::getEnergyVector ( const EBRecHitCollection hits,
CalibMap ReducedMap,
std::vector< EBDetId > &  XstalsNxN,
float &  outBoundEnergy,
int &  nXtalsOut 
)

Definition at line 110 of file CalibrationCluster.cc.

References edm::SortedCollection< T, SORT >::find().

111  {
112 
113  energyVector.clear();
114  std::vector<EBDetId>::iterator it;
115 
116 // std::cout << "Reduced Map Size =" << ReducedMap.size() << std::endl;
117 // std::cout << "XstalsNxN Size =" << XstalsNxN.size() << std::endl;
118  energyVector.resize(ReducedMap.size(),0.);
119 
120  outBoundEnergy=0.;
121  nXtalsOut=0;
122  for(it=XstalsNxN.begin();it!=XstalsNxN.end();++it)
123  {
124  if(ReducedMap.find(*it) != ReducedMap.end()){
125  CalibMap::iterator it2 = ReducedMap.find(*it);
126 
127  int icry = it2->second;
128 
129  energyVector[icry]=(hits->find(*it))->energy();
130 
131  } else {
132 
133 // std::cout << " Cell out of Reduced map: did you subtracted the cell energy from P ???" << std::endl;
134  outBoundEnergy+=(hits->find(*it))->energy();
135  nXtalsOut++;
136  }
137  }
138 
139 
140 
141 return energyVector;
142 
143 }
std::vector< float > energyVector
iterator find(key_type k)
CalibrationCluster::CalibMap CalibrationCluster::getMap ( int  minEta,
int  maxEta,
int  minPhi,
int  maxPhi 
)

Definition at line 79 of file CalibrationCluster.cc.

References gather_cfg::cout, PVValHelper::eta, and EBDetId::ETAPHIMODE.

Referenced by ElectronCalibration::beginJob().

79  {
80 
81  calibRegion.clear();
82  int rowSize=maxEta-minEta+1;
83  int columnSize=maxPhi-minPhi+1;
84  int reducedSize=rowSize*columnSize;
85 
86 
87  for (int icry=0;icry<reducedSize;icry++)
88  {
89  unsigned int eta = minEta + icry/columnSize;
90  unsigned int phi = minPhi + icry%columnSize;
91 
92 
93  try
94  {
95  calibRegion.insert(pippo(EBDetId(eta,phi,EBDetId::ETAPHIMODE),icry));
96  }
97  catch ( ... )
98  {
99  std::cout << "Cannot construct full matrix !!! " << std::endl;
100  }
101  }
102 
103  return calibRegion;
104 
105 }
CalibMap::value_type pippo
double maxEta
static const int ETAPHIMODE
Definition: EBDetId.h:158

Member Data Documentation

CalibMap CalibrationCluster::calibRegion
private

Definition at line 34 of file CalibrationCluster.h.

std::vector<float> CalibrationCluster::energyVector
private

Definition at line 33 of file CalibrationCluster.h.

std::vector<EBDetId> CalibrationCluster::Xtals3x3
private

Definition at line 32 of file CalibrationCluster.h.

std::vector<EBDetId> CalibrationCluster::Xtals5x5
private

Definition at line 31 of file CalibrationCluster.h.