Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-08-10 22:49:56

0001 ///////////////////////////////////////////////////////////////////////////////
0002 // File: BscG4Hit.cc
0003 // Date: 02.2006
0004 // Description: Transient Hit class for the Bsc
0005 ///////////////////////////////////////////////////////////////////////////////
0006 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0007 #include "SimG4CMS/Forward/interface/BscG4Hit.h"
0008 #include <iostream>
0009 
0010 BscG4Hit::BscG4Hit() : entry(0., 0., 0.), entrylp(0., 0., 0.), exitlp(0., 0., 0.) {
0011   elem = 0.f;
0012   hadr = 0.f;
0013   theIncidentEnergy = 0.f;
0014   theTimeSlice = 0.;
0015   theTrackID = -1;
0016   theUnitID = 0;
0017   thePabs = 0.f;
0018   theTof = 0.f;
0019   theEnergyLoss = 0.f;
0020   theParticleType = 0;
0021   theUnitID = 0;
0022   theTrackID = -1;
0023   theThetaAtEntry = -10000.f;
0024   thePhiAtEntry = -10000.f;
0025   theParentId = 0;
0026   theProcessId = 0;
0027 
0028   theX = 0.f;
0029   theY = 0.f;
0030   theZ = 0.f;
0031   theVx = 0.f;
0032   theVy = 0.f;
0033   theVz = 0.f;
0034 }
0035 
0036 BscG4Hit::~BscG4Hit() {}
0037 
0038 BscG4Hit::BscG4Hit(const BscG4Hit& right) {
0039   theUnitID = right.theUnitID;
0040 
0041   theTrackID = right.theTrackID;
0042   theTof = right.theTof;
0043   theEnergyLoss = right.theEnergyLoss;
0044   theParticleType = right.theParticleType;
0045   thePabs = right.thePabs;
0046   elem = right.elem;
0047   hadr = right.hadr;
0048   theIncidentEnergy = right.theIncidentEnergy;
0049   theTimeSlice = right.theTimeSlice;
0050   entry = right.entry;
0051   entrylp = right.entrylp;
0052   exitlp = right.exitlp;
0053   theThetaAtEntry = right.theThetaAtEntry;
0054   thePhiAtEntry = right.thePhiAtEntry;
0055   theParentId = right.theParentId;
0056   theProcessId = right.theProcessId;
0057 
0058   theX = right.theX;
0059   theY = right.theY;
0060   theZ = right.theZ;
0061 
0062   theVx = right.theVx;
0063   theVy = right.theVy;
0064   theVz = right.theVz;
0065 }
0066 
0067 const BscG4Hit& BscG4Hit::operator=(const BscG4Hit& right) {
0068   theUnitID = right.theUnitID;
0069 
0070   theTrackID = right.theTrackID;
0071   theTof = right.theTof;
0072   theEnergyLoss = right.theEnergyLoss;
0073   theParticleType = right.theParticleType;
0074   thePabs = right.thePabs;
0075   elem = right.elem;
0076   hadr = right.hadr;
0077   theIncidentEnergy = right.theIncidentEnergy;
0078   theTimeSlice = right.theTimeSlice;
0079   entry = right.entry;
0080   entrylp = right.entrylp;
0081   exitlp = right.exitlp;
0082   theThetaAtEntry = right.theThetaAtEntry;
0083   thePhiAtEntry = right.thePhiAtEntry;
0084   theParentId = right.theParentId;
0085   theProcessId = right.theProcessId;
0086 
0087   theX = right.theX;
0088   theY = right.theY;
0089   theZ = right.theZ;
0090 
0091   theVx = right.theVx;
0092   theVy = right.theVy;
0093   theVz = right.theVz;
0094 
0095   return *this;
0096 }
0097 
0098 void BscG4Hit::setEntry(const G4ThreeVector& v) {
0099   entry = v;
0100   theX = v.x();
0101   theY = v.y();
0102   theZ = v.z();
0103 }
0104 
0105 void BscG4Hit::addEnergyDeposit(const BscG4Hit& aHit) {
0106   elem += aHit.getEM();
0107   hadr += aHit.getHadr();
0108   theEnergyLoss = elem + hadr;
0109 }
0110 
0111 void BscG4Hit::Print() { edm::LogVerbatim("ForwardSim") << (*this); }
0112 
0113 void BscG4Hit::addEnergyDeposit(float em, float hd) {
0114   elem += em;
0115   hadr += hd;
0116   theEnergyLoss = elem + hadr;
0117 }
0118 
0119 void BscG4Hit::setHitPosition(const G4ThreeVector& v) {
0120   theX = v.x();
0121   theY = v.y();
0122   theZ = v.z();
0123 }
0124 
0125 void BscG4Hit::setVertexPosition(const G4ThreeVector& v) {
0126   theVx = v.x();
0127   theVy = v.y();
0128   theVz = v.z();
0129 }
0130 
0131 std::ostream& operator<<(std::ostream& os, const BscG4Hit& hit) {
0132   os << " Data of this BscG4Hit are:" << std::endl
0133      << " hitEntryLocalP: " << hit.getEntryLocalP() << std::endl
0134      << " hitExitLocalP: " << hit.getExitLocalP() << std::endl
0135      << " Time slice ID: " << hit.getTimeSliceID() << std::endl
0136      << " Time slice : " << hit.getTimeSlice() << std::endl
0137      << " Tof : " << hit.getTof() << std::endl
0138      << " EnergyDeposit = " << hit.getEnergyDeposit() << std::endl
0139      << " elmenergy = " << hit.getEM() << std::endl
0140      << " hadrenergy = " << hit.getHadr() << std::endl
0141      << " EnergyLoss = " << hit.getEnergyLoss() << std::endl
0142      << " ParticleType = " << hit.getParticleType() << std::endl
0143      << " Pabs = " << hit.getPabs() << std::endl
0144      << " Energy of primary particle (ID = " << hit.getTrackID() << ") = " << hit.getIncidentEnergy() << " (MeV)"
0145      << std::endl
0146      << " Entry point in Bsc unit number " << hit.getUnitID() << " is: " << hit.getEntry() << " (mm)" << std::endl;
0147   os << "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" << std::endl;
0148   return os;
0149 }