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  :     PHcalTB06Info
0005 //
0006 // Implementation:
0007 //     <Notes on implementation>
0008 //
0009 // Original Author:  Sunanda Banerjee
0010 //         Created:  Tue Oct 10 10:25:44 CEST 2006
0011 //
0012 
0013 // system include files
0014 
0015 // user include files
0016 #include "SimDataFormats/HcalTestBeam/interface/PHcalTB06Info.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 PHcalTB06Info::PHcalTB06Info() { clear(); }
0031 
0032 // PHcalTB06Info::PHcalTB06Info(const PHcalTB06Info& rhs) {
0033 //    // do actual copying here;
0034 // }
0035 
0036 PHcalTB06Info::~PHcalTB06Info() {}
0037 
0038 //
0039 // assignment operators
0040 //
0041 // const PHcalTB06Info& PHcalTB06Info::operator=(const PHcalTB06Info& rhs) {
0042 //   //An exception safe implementation is
0043 //   PHcalTB06Info temp(rhs);
0044 //   swap(rhs);
0045 //
0046 //   return *this;
0047 // }
0048 
0049 //
0050 // member functions
0051 //
0052 
0053 void PHcalTB06Info::clear() {
0054   nPrimary = idBeam = 0;
0055   eBeam = etaBeam = phiBeam = 0;
0056 
0057   simEtot = simEEc = simEHc = 0;
0058 
0059   hit = 0;
0060   hits.clear();
0061 
0062   v1EvNum = v1Type = v1Nsec = 0;
0063   v1X = v1Y = v1Z = v1U = v1V = v1W = 0;
0064   v1Px = v1Py = v1Pz = 0;
0065   v1Sec.clear();
0066 }
0067 
0068 void PHcalTB06Info::setPrimary(int primary, int id, double energy, double etav, double phiv) {
0069   nPrimary = primary;
0070   idBeam = id;
0071   eBeam = (float)(energy);
0072   etaBeam = (float)(etav);
0073   phiBeam = (float)(phiv);
0074   LogDebug("SimHCalData") << "PHcalTB06Info::setPrimary: nPrimary " << nPrimary << " partID " << idBeam << " initE "
0075                           << eBeam << " eta " << etaBeam << " phi " << phiBeam;
0076 }
0077 
0078 void PHcalTB06Info::setEdep(double simtot, double sime, double simh) {
0079   simEtot = (float)simtot;
0080   simEEc = (float)sime;
0081   simEHc = (float)simh;
0082 
0083   LogDebug("SimHCalData") << "PHcalTB06Info::setEdep: simEtot " << simEtot << " simEEc " << simEEc << " simEHc "
0084                           << simEHc;
0085 }
0086 
0087 void PHcalTB06Info::saveHit(unsigned int id, double eta, double phi, double e, double t) {
0088   int nh = hit;
0089   hit++;
0090   PHcalTB06Info::Hit newHit;
0091   newHit.id = id;
0092   newHit.eta = (float)(eta);
0093   newHit.phi = (float)(phi);
0094   newHit.e = (float)(e);
0095   newHit.t = (float)(t);
0096   hits.push_back(newHit);
0097   LogDebug("SimHCalData") << "PHcalTB06Info::saveHit " << hit << " ID 0x" << std::hex << hits[nh].id << std::dec
0098                           << " Eta " << hits[nh].eta << " Phi " << hits[nh].phi << " E " << hits[nh].e << " t "
0099                           << hits[nh].t;
0100 }
0101 
0102 void PHcalTB06Info::setVtxPrim(
0103     int evNum, int type, double x, double y, double z, double u, double v, double w, double px, double py, double pz) {
0104   v1EvNum = evNum;
0105   v1Type = type;
0106   double r = sqrt(x * x + y * y + z * z);
0107   v1X = (float)(x);
0108   v1Y = (float)(y);
0109   v1Z = (float)(z);
0110   v1R = (float)(r);
0111   v1Px = (float)(px);
0112   v1Py = (float)(py);
0113   v1Pz = (float)(pz);
0114   v1U = (float)(u);
0115   v1V = (float)(v);
0116   v1W = (float)(w);
0117   LogDebug("SimHCalData") << "PHcalTB06Info::setVtxPrim: EvNum " << v1EvNum << " Type " << v1Type << " X/Y/Z/R " << v1X
0118                           << "/" << v1Y << "/" << v1Z << "/" << v1R << " Px/Py/Pz " << v1Px << "/" << v1Py << "/"
0119                           << v1Pz << " U/V/W " << v1U << "/" << v1V << "/" << v1W;
0120 }
0121 
0122 void PHcalTB06Info::setVtxSec(int id, int pdg, double px, double py, double pz, double ek) {
0123   int ns = v1Nsec;
0124   v1Nsec++;
0125   PHcalTB06Info::Vtx newVtx;
0126   newVtx.trackID = id;
0127   newVtx.partID = pdg;
0128   newVtx.px = (float)(px);
0129   newVtx.py = (float)(py);
0130   newVtx.pz = (float)(pz);
0131   newVtx.eKin = (float)(ek);
0132   v1Sec.push_back(newVtx);
0133   LogDebug("SimHCalData") << "PHcalTB06Info::setVtxSec " << v1Nsec << " ID " << v1Sec[ns].trackID << " PDG Code "
0134                           << v1Sec[ns].partID << " Px/Py/Pz/Ek " << v1Sec[ns].px << "/" << v1Sec[ns].py << "/"
0135                           << v1Sec[ns].pz << "/" << v1Sec[ns].eKin;
0136 }