CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 15 of file CalibrationCluster.h.

typedef CalibMap::value_type CalibrationCluster::pippo

Definition at line 16 of file CalibrationCluster.h.

Constructor & Destructor Documentation

CalibrationCluster::CalibrationCluster ( )

Definition at line 7 of file CalibrationCluster.cc.

7 {}
CalibrationCluster::~CalibrationCluster ( )

Definition at line 9 of file CalibrationCluster.cc.

9 {}

Member Function Documentation

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

Definition at line 50 of file CalibrationCluster.cc.

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

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

Definition at line 13 of file CalibrationCluster.cc.

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

Referenced by ElectronCalibration::analyze().

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

Definition at line 91 of file CalibrationCluster.cc.

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

95  {
96  energyVector.clear();
97  std::vector<EBDetId>::iterator it;
98 
99  // std::cout << "Reduced Map Size =" << ReducedMap.size() << std::endl;
100  // std::cout << "XstalsNxN Size =" << XstalsNxN.size() << std::endl;
101  energyVector.resize(ReducedMap.size(), 0.);
102 
103  outBoundEnergy = 0.;
104  nXtalsOut = 0;
105  for (it = XstalsNxN.begin(); it != XstalsNxN.end(); ++it) {
106  if (ReducedMap.find(*it) != ReducedMap.end()) {
107  CalibMap::iterator it2 = ReducedMap.find(*it);
108 
109  int icry = it2->second;
110 
111  energyVector[icry] = (hits->find(*it))->energy();
112 
113  } else {
114  // std::cout << " Cell out of Reduced map: did you subtracted the cell energy from P ???" << std::endl;
115  outBoundEnergy += (hits->find(*it))->energy();
116  nXtalsOut++;
117  }
118  }
119 
120  return energyVector;
121 }
std::vector< float > energyVector
iterator find(key_type k)
CalibrationCluster::CalibMap CalibrationCluster::getMap ( int  minEta,
int  maxEta,
int  minPhi,
int  maxPhi 
)

Definition at line 69 of file CalibrationCluster.cc.

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

Referenced by ElectronCalibration::beginJob().

69  {
70  calibRegion.clear();
71  int rowSize = maxEta - minEta + 1;
72  int columnSize = maxPhi - minPhi + 1;
73  int reducedSize = rowSize * columnSize;
74 
75  for (int icry = 0; icry < reducedSize; icry++) {
76  unsigned int eta = minEta + icry / columnSize;
77  unsigned int phi = minPhi + icry % columnSize;
78 
79  try {
80  calibRegion.insert(pippo(EBDetId(eta, phi, EBDetId::ETAPHIMODE), icry));
81  } catch (...) {
82  std::cout << "Cannot construct full matrix !!! " << std::endl;
83  }
84  }
85 
86  return calibRegion;
87 }
CalibMap::value_type pippo
double maxEta
static const int ETAPHIMODE
Definition: EBDetId.h:158
tuple cout
Definition: gather_cfg.py:144

Member Data Documentation

CalibMap CalibrationCluster::calibRegion
private

Definition at line 30 of file CalibrationCluster.h.

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

Definition at line 29 of file CalibrationCluster.h.

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

Definition at line 28 of file CalibrationCluster.h.

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

Definition at line 27 of file CalibrationCluster.h.