Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:29:42

0001 // -*- C++ -*-
0002 //
0003 // Package:     HcalTestBeam
0004 // Class  :     PHcalTB04Info
0005 //
0006 // Implementation:
0007 //     <Notes on implementation>
0008 //
0009 // Original Author:  Sunanda Banerjee
0010 //         Created:  Sun May 14 10:25:44 CEST 2006
0011 //
0012 
0013 // system include files
0014 
0015 // user include files
0016 #include "SimDataFormats/HcalTestBeam/interface/PHcalTB04Info.h"
0017 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0018 
0019 //
0020 // constants, enums and typedefs
0021 //
0022 
0023 //
0024 // static data member definitions
0025 //
0026 
0027 //
0028 // constructors and destructor
0029 //
0030 PHcalTB04Info::PHcalTB04Info() { clear(); }
0031 
0032 // PHcalTB04Info::PHcalTB04Info(const PHcalTB04Info& rhs) {
0033 //    // do actual copying here;
0034 // }
0035 
0036 PHcalTB04Info::~PHcalTB04Info() {}
0037 
0038 //
0039 // assignment operators
0040 //
0041 // const PHcalTB04Info& PHcalTB04Info::operator=(const PHcalTB04Info& rhs) {
0042 //   //An exception safe implementation is
0043 //   PHcalTB04Info temp(rhs);
0044 //   swap(rhs);
0045 //
0046 //   return *this;
0047 // }
0048 
0049 //
0050 // member functions
0051 //
0052 
0053 void PHcalTB04Info::clear() {
0054   nPrimary = idBeam = 0;
0055   eBeam = etaBeam = phiBeam = 0;
0056 
0057   simEtot = simEEc = simEHc = 0;
0058   digEtot = digEEc = digEHc = 0;
0059 
0060   nCrystal = nTower = 0;
0061 
0062   hit = 0;
0063 
0064   v1EvNum = v1Type = v1Nsec = 0;
0065   v1X = v1Y = v1Z = v1U = v1V = v1W = 0;
0066   v1Px = v1Py = v1Pz = 0;
0067 }
0068 
0069 void PHcalTB04Info::setIDs(const std::vector<int>& ide, const std::vector<int>& idh) {
0070   nCrystal = ide.size();
0071   if (nCrystal > 0) {
0072     idEcal.reserve(nCrystal);
0073     esime.reserve(nCrystal);
0074     edige.reserve(nCrystal);
0075   }
0076   LogDebug("SimHCalData") << "PHcalTB04Info:: Called with " << nCrystal << " crystals";
0077   for (int i = 0; i < nCrystal; i++) {
0078     idEcal.push_back(ide[i]);
0079     LogDebug("SimHCalData") << "\tIndex for " << i << " =  0x" << std::hex << idEcal[i] << std::dec;
0080   }
0081 
0082   nTower = idh.size();
0083   if (nTower > 0) {
0084     idHcal.reserve(nTower);
0085     esimh.reserve(nTower);
0086     edigh.reserve(nTower);
0087   }
0088   LogDebug("SimHCalData") << "PHcalTB04Info:: Called with " << nTower << " HCal towers";
0089   for (int i = 0; i < nTower; i++) {
0090     idHcal.push_back(idh[i]);
0091     LogDebug("SimHCalData") << "\tIndex for " << i << " =  0x" << std::hex << idHcal[i] << std::dec;
0092   }
0093 }
0094 
0095 void PHcalTB04Info::setPrimary(int primary, int id, double energy, double etav, double phiv) {
0096   nPrimary = primary;
0097   idBeam = id;
0098   eBeam = (float)(energy);
0099   etaBeam = (float)(etav);
0100   phiBeam = (float)(phiv);
0101   LogDebug("SimHCalData") << "PHcalTB04Info::setPrimary: nPrimary " << nPrimary << " partID " << idBeam << " initE "
0102                           << eBeam << " eta " << etaBeam << " phi " << phiBeam;
0103 }
0104 
0105 void PHcalTB04Info::setEdep(double simtot, double sime, double simh, double digtot, double dige, double digh) {
0106   simEtot = (float)simtot;
0107   simEEc = (float)sime;
0108   simEHc = (float)simh;
0109   digEtot = (float)digtot;
0110   digEEc = (float)dige;
0111   digEHc = (float)digh;
0112 
0113   LogDebug("SimHCalData") << "PHcalTB04Info::setEdep: simEtot " << simEtot << " simEEc " << simEEc << " simEHc "
0114                           << simEHc << " digEtot " << digEtot << " digEEc " << digEEc << " digEHc " << digEHc;
0115 }
0116 
0117 void PHcalTB04Info::setEdepEcal(const std::vector<double>& esim, const std::vector<double>& eqie) {
0118   for (int i = 0; i < nCrystal; i++) {
0119     float edep = 0;
0120     if (i < int(esim.size()))
0121       esime.push_back(esim[i]);
0122     else
0123       esime.push_back(edep);
0124     if (i < int(eqie.size()))
0125       edige.push_back(eqie[i]);
0126     else
0127       edige.push_back(edep);
0128 
0129     LogDebug("SimHCalData") << "PHcalTB04Info::setEdepEcal [" << i << "] Esim = " << esime[i] << " Edig = " << edige[i];
0130   }
0131 }
0132 
0133 void PHcalTB04Info::setEdepHcal(const std::vector<double>& esim, const std::vector<double>& eqie) {
0134   for (int i = 0; i < nTower; i++) {
0135     float edep = 0;
0136     if (i < int(esim.size()))
0137       esimh.push_back(esim[i]);
0138     else
0139       esimh.push_back(edep);
0140     if (i < int(eqie.size()))
0141       edigh.push_back(eqie[i]);
0142     else
0143       edigh.push_back(edep);
0144 
0145     LogDebug("SimHCalData") << "PHcalTB04Info::setEdepHcal [" << i << "] Esim = " << esimh[i] << " Edig = " << edigh[i];
0146   }
0147 }
0148 
0149 void PHcalTB04Info::setTrnsProf(const std::vector<double>& es1,
0150                                 const std::vector<double>& eq1,
0151                                 const std::vector<double>& es2,
0152                                 const std::vector<double>& eq2) {
0153   int siz = (int)(es1.size());
0154   if (siz > 0) {
0155     latsimEta.reserve(siz);
0156     latdigEta.reserve(siz);
0157     latsimPhi.reserve(siz);
0158     latdigPhi.reserve(siz);
0159     for (int i = 0; i < siz; i++) {
0160       latsimEta.push_back((float)(es1[i]));
0161       latdigEta.push_back((float)(eq1[i]));
0162       latsimPhi.push_back((float)(es2[i]));
0163       latdigPhi.push_back((float)(eq2[i]));
0164       LogDebug("SimHCalData") << "PHcalTB04Info::setTrnsProf [" << i << "] latsimEta = " << latsimEta[i]
0165                               << " latdigEta = " << latdigEta[i] << " latsimPhi = " << latsimPhi[i]
0166                               << " latdigPhi = " << latdigPhi[i];
0167     }
0168   }
0169 }
0170 
0171 void PHcalTB04Info::setLongProf(const std::vector<double>& es, const std::vector<double>& eq) {
0172   int siz = (int)(es.size());
0173   if (siz > 0) {
0174     longsim.reserve(siz);
0175     longdig.reserve(siz);
0176     for (int i = 0; i < siz; i++) {
0177       longsim.push_back((float)(es[i]));
0178       longdig.push_back((float)(eq[i]));
0179       LogDebug("SimHCalData") << "PHcalTB04Info::setLongProf [" << i << "] longsim = " << longsim[i]
0180                               << " longdig = " << longdig[i];
0181     }
0182   }
0183 }
0184 
0185 void PHcalTB04Info::saveHit(int det, int lay, int eta, int phi, double e, double t) {
0186   int nh = hit;
0187   hit++;
0188   detHit.push_back(det);
0189   layHit.push_back(lay);
0190   etaHit.push_back(eta);
0191   phiHit.push_back(phi);
0192   eHit.push_back((float)(e));
0193   tHit.push_back((float)(t));
0194   LogDebug("SimHCalData") << "PHcalTB04Info::saveHit " << hit << " Det " << detHit[nh] << " layer " << layHit[nh]
0195                           << " Eta " << etaHit[nh] << " Phi " << phiHit[nh] << " E " << eHit[nh] << " t " << tHit[nh];
0196 }
0197 
0198 void PHcalTB04Info::setVtxPrim(
0199     int evNum, int type, double x, double y, double z, double u, double v, double w, double px, double py, double pz) {
0200   v1EvNum = evNum;
0201   v1Type = type;
0202   double r = sqrt(x * x + y * y + z * z);
0203   v1X = (float)(x);
0204   v1Y = (float)(y);
0205   v1Z = (float)(z);
0206   v1R = (float)(r);
0207   v1Px = (float)(px);
0208   v1Py = (float)(py);
0209   v1Pz = (float)(pz);
0210   v1U = (float)(u);
0211   v1V = (float)(v);
0212   v1W = (float)(w);
0213   LogDebug("SimHCalData") << "PHcalTB04Info::setVtxPrim: EvNum " << v1EvNum << " Type " << v1Type << " X/Y/Z/R " << v1X
0214                           << "/" << v1Y << "/" << v1Z << "/" << v1R << " Px/Py/Pz " << v1Px << "/" << v1Py << "/"
0215                           << v1Pz << " U/V/W " << v1U << "/" << v1V << "/" << v1W;
0216 }
0217 
0218 void PHcalTB04Info::setVtxSec(int id, int pdg, double px, double py, double pz, double ek) {
0219   int ns = v1Nsec;
0220   v1Nsec++;
0221   v1secTrackID.push_back(id);
0222   v1secPartID.push_back(pdg);
0223   v1secPx.push_back((float)(px));
0224   v1secPy.push_back((float)(py));
0225   v1secPz.push_back((float)(pz));
0226   v1secEk.push_back((float)(ek));
0227   LogDebug("SimHCalData") << "PHcalTB04Info::setVtxSec " << v1Nsec << " ID " << v1secTrackID[ns] << " PDG Code "
0228                           << v1secPartID[ns] << " Px/Py/Pz/Ek " << v1secPx[ns] << "/" << v1secPy[ns] << "/"
0229                           << v1secPz[ns] << "/" << v1secEk[ns];
0230 }