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