CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_1_8_patch9/src/SimDataFormats/HcalTestBeam/src/PHcalTB06Info.cc

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 //
00003 // Package:     HcalTestBeam
00004 // Class  :     PHcalTB06Info
00005 // 
00006 // Implementation:
00007 //     <Notes on implementation>
00008 //
00009 // Original Author:  Sunanda Banerjee
00010 //         Created:  Tue Oct 10 10:25:44 CEST 2006
00011 //
00012 
00013 // system include files
00014 
00015 // user include files
00016 #include "SimDataFormats/HcalTestBeam/interface/PHcalTB06Info.h"
00017 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00018 
00019 
00020 
00021 //
00022 // constants, enums and typedefs
00023 //
00024 
00025 //
00026 // static data member definitions
00027 //
00028 
00029 //
00030 // constructors and destructor
00031 //
00032 PHcalTB06Info::PHcalTB06Info() {
00033   clear();
00034 }
00035 
00036 // PHcalTB06Info::PHcalTB06Info(const PHcalTB06Info& rhs) {
00037 //    // do actual copying here;
00038 // }
00039 
00040 PHcalTB06Info::~PHcalTB06Info() {
00041 }
00042 
00043 //
00044 // assignment operators
00045 //
00046 // const PHcalTB06Info& PHcalTB06Info::operator=(const PHcalTB06Info& rhs) {
00047 //   //An exception safe implementation is
00048 //   PHcalTB06Info temp(rhs);
00049 //   swap(rhs);
00050 //
00051 //   return *this;
00052 // }
00053 
00054 //
00055 // member functions
00056 //
00057 
00058 void PHcalTB06Info::clear() {
00059   nPrimary =  idBeam =0;
00060   eBeam = etaBeam = phiBeam = 0;
00061 
00062   simEtot = simEEc = simEHc = 0;
00063 
00064   hit = 0;
00065   hits.clear();
00066 
00067   v1EvNum = v1Type = v1Nsec = 0;
00068   v1X = v1Y = v1Z = v1U = v1V = v1W = 0;
00069   v1Px = v1Py = v1Pz = 0;
00070   v1Sec.clear();
00071 }
00072 
00073 void PHcalTB06Info::setPrimary(int primary, int id, double energy, double etav,
00074                                double phiv) {
00075 
00076   nPrimary = primary;
00077   idBeam   = id;
00078   eBeam    = (float)(energy);
00079   etaBeam  = (float)(etav);
00080   phiBeam  = (float)(phiv);
00081   LogDebug("SimHCalData") << "PHcalTB06Info::setPrimary: nPrimary " << nPrimary
00082                           << " partID " << idBeam << " initE " << eBeam 
00083                           << " eta " << etaBeam << " phi " << phiBeam;
00084 }
00085 
00086 void PHcalTB06Info::setEdep(double simtot, double sime, double simh) {
00087 
00088   simEtot = (float)simtot;
00089   simEEc  = (float)sime;
00090   simEHc  = (float)simh;
00091 
00092   LogDebug("SimHCalData") << "PHcalTB06Info::setEdep: simEtot " << simEtot 
00093                           << " simEEc " << simEEc << " simEHc " << simEHc;
00094 }
00095 
00096 void PHcalTB06Info::saveHit(unsigned int id, double eta, double phi, double e, 
00097                             double t) {
00098 
00099   int nh = hit;
00100   hit++;
00101   PHcalTB06Info::Hit newHit;
00102   newHit.id  = id;
00103   newHit.eta = (float)(eta);
00104   newHit.phi = (float)(phi);
00105   newHit.e   = (float)(e);
00106   newHit.t   = (float)(t);
00107   hits.push_back(newHit);
00108   LogDebug("SimHCalData") << "PHcalTB06Info::saveHit " << hit << " ID 0x" 
00109                           << std::hex << hits[nh].id << std::dec << " Eta " 
00110                           << hits[nh].eta << " Phi " << hits[nh].phi 
00111                           << " E " << hits[nh].e << " t " << hits[nh].t;
00112 }
00113 
00114 void PHcalTB06Info::setVtxPrim(int evNum, int type, double x, double y, 
00115                                double z, double u, double v, double w, 
00116                                double px, double py, double pz) {
00117 
00118   v1EvNum = evNum;
00119   v1Type  = type;
00120   double r= sqrt(x*x+y*y+z*z);
00121   v1X     = (float)(x);
00122   v1Y     = (float)(y);
00123   v1Z     = (float)(z);
00124   v1R     = (float)(r);
00125   v1Px    = (float)(px);
00126   v1Py    = (float)(py);
00127   v1Pz    = (float)(pz);
00128   v1U     = (float)(u);
00129   v1V     = (float)(v);
00130   v1W     = (float)(w);
00131   LogDebug("SimHCalData") << "PHcalTB06Info::setVtxPrim: EvNum " << v1EvNum 
00132                           << " Type " << v1Type << " X/Y/Z/R " << v1X << "/" 
00133                           << v1Y << "/" << v1Z << "/" << v1R << " Px/Py/Pz " 
00134                           << v1Px << "/" << v1Py << "/" << v1Pz << " U/V/W "
00135                           << v1U << "/" << v1V << "/" << v1W;
00136 }
00137 
00138 void PHcalTB06Info::setVtxSec(int id, int pdg, double px, double py, double pz,
00139                               double ek) {
00140 
00141   int ns = v1Nsec;
00142   v1Nsec++;
00143   PHcalTB06Info::Vtx newVtx;
00144   newVtx.trackID = id;
00145   newVtx.partID  = pdg;
00146   newVtx.px      = (float)(px);
00147   newVtx.py      = (float)(py);
00148   newVtx.pz      = (float)(pz);
00149   newVtx.eKin    = (float)(ek);
00150   v1Sec.push_back(newVtx);
00151   LogDebug("SimHCalData") << "PHcalTB06Info::setVtxSec " << v1Nsec << " ID " 
00152                           << v1Sec[ns].trackID << " PDG Code " 
00153                           << v1Sec[ns].partID << " Px/Py/Pz/Ek " 
00154                           << v1Sec[ns].px << "/" << v1Sec[ns].py << "/" 
00155                           << v1Sec[ns].pz << "/" << v1Sec[ns].eKin;
00156 }