CMS 3D CMS Logo

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