CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
CalibrationCluster.cc
Go to the documentation of this file.
2 #include <iostream>
3 #include <string>
4 
5 using namespace std;
6 
8 
9 }
10 
12 }
13 
15 
16 std::vector<EBDetId> CalibrationCluster::get5x5Id(EBDetId const & maxHitId){
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 }
50 
52 
53 std::vector<EBDetId> CalibrationCluster::get3x3Id(EBDetId const & maxHitId){
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 }
75 
77 
78 
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 }
106 
108 
109 
111 hits, CalibMap & ReducedMap, std::vector<EBDetId> & XstalsNxN, float & outBoundEnergy, int & nXtalsOut){
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 }
144 
CalibMap::value_type pippo
CalibMap getMap(int, int, int, int)
double maxEta
int iphi() const
get the crystal iphi
Definition: EBDetId.h:53
std::vector< float > getEnergyVector(const EBRecHitCollection *, CalibMap &, std::vector< EBDetId > &, float &, int &)
int ieta() const
get the crystal ieta
Definition: EBDetId.h:51
static const int ETAPHIMODE
Definition: EBDetId.h:166
#define column(...)
Definition: DbCore.h:74
Geom::Phi< T > phi() const
std::vector< EBDetId > get3x3Id(EBDetId const &)
std::map< EBDetId, unsigned int > CalibMap
iterator find(key_type k)
tuple cout
Definition: gather_cfg.py:121
std::vector< EBDetId > get5x5Id(EBDetId const &)