CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
PHcalTB04Info.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: HcalTestBeam
4 // Class : PHcalTB04Info
5 //
6 // Implementation:
7 // <Notes on implementation>
8 //
9 // Original Author: Sunanda Banerjee
10 // Created: Sun May 14 10:25:44 CEST 2006
11 //
12 
13 // system include files
14 
15 // user include files
18 
19 
20 
21 //
22 // constants, enums and typedefs
23 //
24 
25 //
26 // static data member definitions
27 //
28 
29 //
30 // constructors and destructor
31 //
33  clear();
34 }
35 
36 // PHcalTB04Info::PHcalTB04Info(const PHcalTB04Info& rhs) {
37 // // do actual copying here;
38 // }
39 
41 }
42 
43 //
44 // assignment operators
45 //
46 // const PHcalTB04Info& PHcalTB04Info::operator=(const PHcalTB04Info& rhs) {
47 // //An exception safe implementation is
48 // PHcalTB04Info temp(rhs);
49 // swap(rhs);
50 //
51 // return *this;
52 // }
53 
54 //
55 // member functions
56 //
57 
59  nPrimary = idBeam =0;
60  eBeam = etaBeam = phiBeam = 0;
61 
62  simEtot = simEEc = simEHc = 0;
63  digEtot = digEEc = digEHc = 0;
64 
65  nCrystal = nTower = 0;
66 
67  hit = 0;
68 
69  v1EvNum = v1Type = v1Nsec = 0;
70  v1X = v1Y = v1Z = v1U = v1V = v1W = 0;
71  v1Px = v1Py = v1Pz = 0;
72 }
73 
74 void PHcalTB04Info::setIDs(const std::vector<int>& ide, const std::vector<int>& idh) {
75 
76  nCrystal = ide.size();
77  if (nCrystal > 0) {
78  idEcal.reserve(nCrystal);
79  esime.reserve(nCrystal);
80  edige.reserve(nCrystal);
81  }
82  LogDebug("SimHCalData") << "PHcalTB04Info:: Called with " << nCrystal << " crystals";
83  for (int i=0; i<nCrystal; i++) {
84  idEcal.push_back(ide[i]);
85  LogDebug("SimHCalData") << "\tIndex for " << i << " = 0x" << std::hex << idEcal[i] << std::dec;
86  }
87 
88  nTower = idh.size();
89  if (nTower > 0) {
90  idHcal.reserve(nTower);
91  esimh.reserve(nTower);
92  edigh.reserve(nTower);
93  }
94  LogDebug("SimHCalData") << "PHcalTB04Info:: Called with " << nTower << " HCal towers";
95  for (int i=0; i<nTower; i++) {
96  idHcal.push_back(idh[i]);
97  LogDebug("SimHCalData") << "\tIndex for " << i << " = 0x" << std::hex << idHcal[i] << std::dec;
98  }
99 
100 }
101 
102 void PHcalTB04Info::setPrimary(int primary, int id, double energy, double etav,
103  double phiv) {
104 
105  nPrimary = primary;
106  idBeam = id;
107  eBeam = (float)(energy);
108  etaBeam = (float)(etav);
109  phiBeam = (float)(phiv);
110  LogDebug("SimHCalData") << "PHcalTB04Info::setPrimary: nPrimary " << nPrimary << " partID " << idBeam << " initE " << eBeam << " eta " << etaBeam << " phi " << phiBeam;
111 }
112 
113 void PHcalTB04Info::setEdep(double simtot, double sime, double simh,
114  double digtot, double dige, double digh) {
115 
116  simEtot = (float)simtot;
117  simEEc = (float)sime;
118  simEHc = (float)simh;
119  digEtot = (float)digtot;
120  digEEc = (float)dige;
121  digEHc = (float)digh;
122 
123  LogDebug("SimHCalData") << "PHcalTB04Info::setEdep: simEtot " << simEtot << " simEEc " << simEEc << " simEHc " << simEHc << " digEtot " << digEtot << " digEEc " << digEEc << " digEHc " << digEHc;
124 }
125 
126 void PHcalTB04Info::setEdepEcal(const std::vector<double>& esim,
127  const std::vector<double>& eqie) {
128 
129  for (int i=0; i<nCrystal; i++) {
130  float edep = 0;
131  if (i<int(esim.size())) esime.push_back(esim[i]);
132  else esime.push_back(edep);
133  if (i<int(eqie.size())) edige.push_back(eqie[i]);
134  else edige.push_back(edep);
135 
136  LogDebug("SimHCalData") << "PHcalTB04Info::setEdepEcal [" << i << "] Esim = " << esime[i] << " Edig = " << edige[i];
137  }
138 }
139 
140 void PHcalTB04Info::setEdepHcal(const std::vector<double>& esim,
141  const std::vector<double>& eqie) {
142 
143  for (int i=0; i<nTower; i++) {
144  float edep = 0;
145  if (i<int(esim.size())) esimh.push_back(esim[i]);
146  else esimh.push_back(edep);
147  if (i<int(eqie.size())) edigh.push_back(eqie[i]);
148  else edigh.push_back(edep);
149 
150  LogDebug("SimHCalData") << "PHcalTB04Info::setEdepHcal [" << i << "] Esim = " << esimh[i] << " Edig = " << edigh[i];
151  }
152 }
153 
154 void PHcalTB04Info::setTrnsProf(const std::vector<double>& es1,
155  const std::vector<double>& eq1,
156  const std::vector<double>& es2,
157  const std::vector<double>& eq2) {
158 
159  int siz = (int)(es1.size());
160  if (siz > 0) {
161  latsimEta.reserve(siz);
162  latdigEta.reserve(siz);
163  latsimPhi.reserve(siz);
164  latdigPhi.reserve(siz);
165  for (int i=0; i<siz; i++) {
166  latsimEta.push_back((float)(es1[i]));
167  latdigEta.push_back((float)(eq1[i]));
168  latsimPhi.push_back((float)(es2[i]));
169  latdigPhi.push_back((float)(eq2[i]));
170  LogDebug("SimHCalData") << "PHcalTB04Info::setTrnsProf [" << i << "] latsimEta = " << latsimEta[i] << " latdigEta = " << latdigEta[i] << " latsimPhi = " << latsimPhi[i] << " latdigPhi = " << latdigPhi[i];
171  }
172  }
173 }
174 
175 void PHcalTB04Info::setLongProf(const std::vector<double>& es,
176  const std::vector<double>& eq) {
177 
178  int siz = (int)(es.size());
179  if (siz > 0) {
180  longsim.reserve(siz);
181  longdig.reserve(siz);
182  for (int i=0; i<siz; i++) {
183  longsim.push_back((float)(es[i]));
184  longdig.push_back((float)(eq[i]));
185  LogDebug("SimHCalData") << "PHcalTB04Info::setLongProf [" << i << "] longsim = " << longsim[i] << " longdig = " << longdig[i];
186  }
187  }
188 }
189 
190 void PHcalTB04Info::saveHit(int det, int lay, int eta, int phi, double e,
191  double t) {
192 
193  int nh = hit;
194  hit++;
195  detHit.push_back(det);
196  layHit.push_back(lay);
197  etaHit.push_back(eta);
198  phiHit.push_back(phi);
199  eHit.push_back((float)(e));
200  tHit.push_back((float)(t));
201  LogDebug("SimHCalData") << "PHcalTB04Info::saveHit " << hit << " Det " << detHit[nh] << " layer " << layHit[nh] << " Eta " << etaHit[nh] << " Phi " << phiHit[nh] << " E " << eHit[nh] << " t " << tHit[nh];
202 }
203 
204 void PHcalTB04Info::setVtxPrim(int evNum, int type, double x, double y,
205  double z, double u, double v, double w,
206  double px, double py, double pz) {
207 
208  v1EvNum = evNum;
209  v1Type = type;
210  double r= sqrt(x*x+y*y+z*z);
211  v1X = (float)(x);
212  v1Y = (float)(y);
213  v1Z = (float)(z);
214  v1R = (float)(r);
215  v1Px = (float)(px);
216  v1Py = (float)(py);
217  v1Pz = (float)(pz);
218  v1U = (float)(u);
219  v1V = (float)(v);
220  v1W = (float)(w);
221  LogDebug("SimHCalData") << "PHcalTB04Info::setVtxPrim: EvNum " << v1EvNum << " Type " << v1Type << " X/Y/Z/R " << v1X << "/" << v1Y << "/" << v1Z << "/" << v1R << " Px/Py/Pz " << v1Px << "/" << v1Py << "/" << v1Pz << " U/V/W " << v1U << "/" << v1V << "/" << v1W;
222 }
223 
224 void PHcalTB04Info::setVtxSec(int id, int pdg, double px, double py, double pz,
225  double ek) {
226 
227  int ns = v1Nsec;
228  v1Nsec++;
229  v1secTrackID.push_back(id);
230  v1secPartID.push_back(pdg);
231  v1secPx.push_back((float)(px));
232  v1secPy.push_back((float)(py));
233  v1secPz.push_back((float)(pz));
234  v1secEk.push_back((float)(ek));
235  LogDebug("SimHCalData") << "PHcalTB04Info::setVtxSec " << v1Nsec << " ID " << v1secTrackID[ns] << " PDG Code " << v1secPartID[ns] << " Px/Py/Pz/Ek " << v1secPx[ns] << "/" << v1secPy[ns] << "/" << v1secPz[ns] << "/" << v1secEk[ns];
236 }
#define LogDebug(id)
FloatVector eHit
virtual ~PHcalTB04Info()
type
Definition: HCALResponse.h:21
tuple t
Definition: tree.py:139
int i
Definition: DBlmapReader.cc:9
FloatVector v1secPy
void setLongProf(const std::vector< double > &es, const std::vector< double > &eq)
IntVector layHit
const double w
Definition: UKUtility.cc:23
void setEdepEcal(const std::vector< double > &esim, const std::vector< double > &edig)
IntVector phiHit
void setPrimary(int primary, int id, double energy, double eta, double phi)
FloatVector v1secPx
IntVector v1secPartID
float float float z
void setEdep(double simtot, double sime, double simh, double digtot, double dige, double digh)
void setTrnsProf(const std::vector< double > &es1, const std::vector< double > &eq1, const std::vector< double > &es2, const std::vector< double > &eq2)
FloatVector edigh
void saveHit(int det, int lay, int eta, int phi, double e, double t)
T x() const
Cartesian x coordinate.
FloatVector edige
FloatVector longdig
FloatVector esime
void setIDs(const std::vector< int > &, const std::vector< int > &)
FloatVector v1secPz
void setVtxSec(int id, int pdg, double px, double py, double pz, double ek)
void setEdepHcal(const std::vector< double > &esim, const std::vector< double > &edig)
T sqrt(T t)
Definition: SSEVec.h:48
IntVector v1secTrackID
IntVector idEcal
FloatVector latsimEta
IntVector idHcal
int evNum() const
Definition: PHcalTB04Info.h:72
FloatVector longsim
IntVector etaHit
Geom::Phi< T > phi() const
FloatVector v1secEk
void setVtxPrim(int evNum, int type, double x, double y, double z, double u, double v, double w, double px, double py, double pz)
FloatVector latdigPhi
FloatVector esimh
int primary() const
Definition: PHcalTB04Info.h:44
IntVector detHit
FloatVector latsimPhi
FloatVector latdigEta
FloatVector tHit