CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_0/src/SimDataFormats/HcalTestBeam/src/PHcalTB04Info.cc

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 //
00003 // Package:     HcalTestBeam
00004 // Class  :     PHcalTB04Info
00005 // 
00006 // Implementation:
00007 //     <Notes on implementation>
00008 //
00009 // Original Author:  Sunanda Banerjee
00010 //         Created:  Sun May 14 10:25:44 CEST 2006
00011 // $Id: PHcalTB04Info.cc,v 1.3 2006/11/16 16:45:03 sunanda Exp $
00012 //
00013 
00014 // system include files
00015 
00016 // user include files
00017 #include "SimDataFormats/HcalTestBeam/interface/PHcalTB04Info.h"
00018 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00019 
00020 
00021 
00022 //
00023 // constants, enums and typedefs
00024 //
00025 
00026 //
00027 // static data member definitions
00028 //
00029 
00030 //
00031 // constructors and destructor
00032 //
00033 PHcalTB04Info::PHcalTB04Info() {
00034   clear();
00035 }
00036 
00037 // PHcalTB04Info::PHcalTB04Info(const PHcalTB04Info& rhs) {
00038 //    // do actual copying here;
00039 // }
00040 
00041 PHcalTB04Info::~PHcalTB04Info() {
00042 }
00043 
00044 //
00045 // assignment operators
00046 //
00047 // const PHcalTB04Info& PHcalTB04Info::operator=(const PHcalTB04Info& rhs) {
00048 //   //An exception safe implementation is
00049 //   PHcalTB04Info temp(rhs);
00050 //   swap(rhs);
00051 //
00052 //   return *this;
00053 // }
00054 
00055 //
00056 // member functions
00057 //
00058 
00059 void PHcalTB04Info::clear() {
00060   nPrimary =  idBeam =0;
00061   eBeam = etaBeam = phiBeam = 0;
00062 
00063   simEtot = simEEc = simEHc = 0;
00064   digEtot = digEEc = digEHc = 0;
00065 
00066   nCrystal = nTower = 0;
00067 
00068   hit = 0;
00069 
00070   v1EvNum = v1Type = v1Nsec = 0;
00071   v1X = v1Y = v1Z = v1U = v1V = v1W = 0;
00072   v1Px = v1Py = v1Pz = 0;
00073 }
00074   
00075 void PHcalTB04Info::setIDs(std::vector<int> ide, std::vector<int> idh) {
00076 
00077   nCrystal = ide.size();
00078   if (nCrystal > 0) {
00079     idEcal.reserve(nCrystal);
00080     esime.reserve(nCrystal);
00081     edige.reserve(nCrystal);
00082   }
00083   LogDebug("SimHCalData") << "PHcalTB04Info:: Called with " << nCrystal << " crystals";
00084   for (int i=0; i<nCrystal; i++) {
00085     idEcal.push_back(ide[i]);
00086     LogDebug("SimHCalData") << "\tIndex for " << i << " =  0x" << std::hex << idEcal[i] << std::dec;
00087   }
00088 
00089   nTower   = idh.size();
00090   if (nTower > 0) {
00091     idHcal.reserve(nTower);
00092     esimh.reserve(nTower);
00093     edigh.reserve(nTower);
00094   }
00095   LogDebug("SimHCalData") << "PHcalTB04Info:: Called with " << nTower << " HCal towers";
00096   for (int i=0; i<nTower; i++) {
00097     idHcal.push_back(idh[i]);
00098     LogDebug("SimHCalData") << "\tIndex for " << i << " =  0x" << std::hex << idHcal[i] << std::dec;
00099   }
00100 
00101 }
00102 
00103 void PHcalTB04Info::setPrimary(int primary, int id, double energy, double etav,
00104                                double phiv) {
00105 
00106   nPrimary = primary;
00107   idBeam   = id;
00108   eBeam    = (float)(energy);
00109   etaBeam  = (float)(etav);
00110   phiBeam  = (float)(phiv);
00111   LogDebug("SimHCalData") << "PHcalTB04Info::setPrimary: nPrimary " << nPrimary << " partID " << idBeam << " initE " << eBeam << " eta " << etaBeam << " phi " << phiBeam;
00112 }
00113 
00114 void PHcalTB04Info::setEdep(double simtot, double sime, double simh, 
00115                             double digtot, double dige, double digh) {
00116 
00117   simEtot = (float)simtot;
00118   simEEc  = (float)sime;
00119   simEHc  = (float)simh;
00120   digEtot = (float)digtot;
00121   digEEc  = (float)dige;
00122   digEHc  = (float)digh;
00123 
00124   LogDebug("SimHCalData") << "PHcalTB04Info::setEdep: simEtot " << simEtot << " simEEc " << simEEc << " simEHc " << simEHc << " digEtot " << digEtot  << " digEEc " << digEEc << " digEHc " << digEHc;
00125 }
00126 
00127 void PHcalTB04Info::setEdepEcal(std::vector<double> esim, 
00128                                 std::vector<double> eqie) {
00129 
00130   for (int i=0; i<nCrystal; i++) {
00131     float edep = 0;
00132     if (i<int(esim.size())) esime.push_back(esim[i]);
00133     else                    esime.push_back(edep);
00134     if (i<int(eqie.size())) edige.push_back(eqie[i]);
00135     else                    edige.push_back(edep);
00136 
00137     LogDebug("SimHCalData") << "PHcalTB04Info::setEdepEcal [" << i << "] Esim = " << esime[i] << " Edig = " << edige[i];
00138   }
00139 }
00140 
00141 void PHcalTB04Info::setEdepHcal(std::vector<double> esim, 
00142                                 std::vector<double> eqie) {
00143 
00144   for (int i=0; i<nTower; i++) {
00145     float edep = 0;
00146     if (i<int(esim.size())) esimh.push_back(esim[i]);
00147     else                    esimh.push_back(edep);
00148     if (i<int(eqie.size())) edigh.push_back(eqie[i]);
00149     else                    edigh.push_back(edep);
00150 
00151     LogDebug("SimHCalData") << "PHcalTB04Info::setEdepHcal [" << i << "] Esim = " << esimh[i] << " Edig = " << edigh[i];
00152   }
00153 }
00154 
00155 void PHcalTB04Info::setTrnsProf(std::vector<double> es1, 
00156                                 std::vector<double> eq1, 
00157                                 std::vector<double> es2,
00158                                 std::vector<double> eq2) {
00159 
00160   int siz = (int)(es1.size());
00161   if (siz > 0) {
00162     latsimEta.reserve(siz);
00163     latdigEta.reserve(siz);
00164     latsimPhi.reserve(siz);
00165     latdigPhi.reserve(siz);
00166     for (int i=0; i<siz; i++) {
00167       latsimEta.push_back((float)(es1[i]));
00168       latdigEta.push_back((float)(eq1[i]));
00169       latsimPhi.push_back((float)(es2[i]));
00170       latdigPhi.push_back((float)(eq2[i]));
00171       LogDebug("SimHCalData") << "PHcalTB04Info::setTrnsProf [" << i << "] latsimEta = " << latsimEta[i] << " latdigEta = " << latdigEta[i] << " latsimPhi = " << latsimPhi[i] << " latdigPhi = " << latdigPhi[i];
00172     }
00173   }
00174 }
00175 
00176 void PHcalTB04Info::setLongProf(std::vector<double> es, 
00177                                 std::vector<double> eq) {
00178 
00179   int siz = (int)(es.size());
00180   if (siz > 0) {
00181     longsim.reserve(siz);
00182     longdig.reserve(siz);
00183     for (int i=0; i<siz; i++) {
00184       longsim.push_back((float)(es[i]));
00185       longdig.push_back((float)(eq[i]));
00186       LogDebug("SimHCalData") << "PHcalTB04Info::setLongProf [" << i << "] longsim = " << longsim[i] << " longdig = " << longdig[i];
00187     }
00188   }
00189 }
00190 
00191 void PHcalTB04Info::saveHit(int det, int lay, int eta, int phi, double e, 
00192                             double t) {
00193 
00194   int nh = hit;
00195   hit++;
00196   detHit.push_back(det);
00197   layHit.push_back(lay);
00198   etaHit.push_back(eta);
00199   phiHit.push_back(phi);
00200   eHit.push_back((float)(e));
00201   tHit.push_back((float)(t));
00202   LogDebug("SimHCalData") << "PHcalTB04Info::saveHit " << hit << " Det " << detHit[nh] << " layer " << layHit[nh] << " Eta " << etaHit[nh] << " Phi " << phiHit[nh] << " E " << eHit[nh] << " t " << tHit[nh];
00203 }
00204 
00205 void PHcalTB04Info::setVtxPrim(int evNum, int type, double x, double y, 
00206                                double z, double u, double v, double w, 
00207                                double px, double py, double pz) {
00208 
00209   v1EvNum = evNum;
00210   v1Type  = type;
00211   double r= sqrt(x*x+y*y+z*z);
00212   v1X     = (float)(x);
00213   v1Y     = (float)(y);
00214   v1Z     = (float)(z);
00215   v1R     = (float)(r);
00216   v1Px    = (float)(px);
00217   v1Py    = (float)(py);
00218   v1Pz    = (float)(pz);
00219   v1U     = (float)(u);
00220   v1V     = (float)(v);
00221   v1W     = (float)(w);
00222   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;
00223 }
00224 
00225 void PHcalTB04Info::setVtxSec(int id, int pdg, double px, double py, double pz,
00226                               double ek) {
00227 
00228   int ns = v1Nsec;
00229   v1Nsec++;
00230   v1secTrackID.push_back(id);
00231   v1secPartID.push_back(pdg);
00232   v1secPx.push_back((float)(px));
00233   v1secPy.push_back((float)(py));
00234   v1secPz.push_back((float)(pz));
00235   v1secEk.push_back((float)(ek));  
00236   LogDebug("SimHCalData") << "PHcalTB04Info::setVtxSec " << v1Nsec << " ID " << v1secTrackID[ns] << " PDG Code " << v1secPartID[ns] << " Px/Py/Pz/Ek " << v1secPx[ns] << "/" << v1secPy[ns] << "/" << v1secPz[ns] << "/" << v1secEk[ns];
00237 }