// -*- C++ -*- // // Package: Tracing // Module: Trace // // Description: Trace class containing trace info and more // // Implimentation: // // // Author: Martin Lohner // Created: Jan 23, 1997 // RCS(Id) // // Revision history // // RCS(Log) // system include files #include #include #include // user include files #include "report.hh" #include "Trace.hh" #include "mkl_trace_struct.hh" #include "MCParticle.hh" #include "Medium.hh" #include "Material.hh" //#include "HitStruct.hh" // // constants, enums and typedefs // static const char* const kFacilityString = "Tracing.Trace"; // // static data member definitions // // // constructors and destructor // Trace::Trace( TraceType iType ) : m_type(iType), // m_geom(0), m_hitIndexF(0) // m_hit(0) { // how to initialize: // m_wtrack // m_traceInfo } #if 0 Trace::Trace( const Trace& iTrace ) { copyDataMembers( iTrace ); } #endif Trace::~Trace() { // beware: hit pointer doesn't need to be cleaned up, because memory is // owned by Fortran! } // // assignment operators // #if 0 const Trace& Trace::operator=( const Trace& iTrace ) { if( this != &iTrace ) { copyDataMembers( iTrace ); } return *this; } #endif // // member functions // void Trace::copyDataMembers( const Trace& iTrace ) { m_type = iTrace.m_type; m_wtrack = iTrace.m_wtrack; m_traceInfo = iTrace.m_traceInfo; //m_geom = iTrace.m_geom; m_bfield = iTrace.m_bfield; m_hitIndexF = iTrace.m_hitIndexF; //m_hit = iTrace.m_hit; } void Trace::setTraceInfo( const MCParticle& particle ) { // index into hep particle list m_traceInfo.hep = particle.hepIndexF(); // reference point m_traceInfo.ref_x = particle.wtrack().x; m_traceInfo.ref_y = particle.wtrack().y; m_traceInfo.ref_z = particle.wtrack().z; m_traceInfo.path = particle.path().arc; // Total track length up to this hit m_traceInfo.tau = particle.path().tau; // Proper flight time to intersection m_traceInfo.time = particle.path().time; // Time at which track made hit // material fillMaterialInfo( particle ); // ---------------------------------------------------------------------- // the following are only filled because some tracking routines need them m_traceInfo.type = int(type()); m_traceInfo.plane = 0; for( int i=0; i<3; i++ ) m_traceInfo.eta[i] = 0; // only if we have a medium const Medium* medium = particle.pCurrentMedium(); if( medium != 0 ) { m_traceInfo.plane = medium->commonIndexF(); for( int i=0; i<3; i++ ) m_traceInfo.eta[i] = particle.eta()[i]; } } void Trace::fillMaterialInfo( const MCParticle& particle ) { // only bother if we have a material type trace // MCFBool relevant = ( type() == TraceType::kRPlane // || type() == TraceType::kZPlane // || type() == TraceType::kCone // || type() == TraceType::kPair // || type() == TraceType::kAbsorb // || type() == TraceType::kCalor // || type() == TraceType::kShower // || type() == TraceType::kMaterial MCFBool relevant = ( type() == TraceType::kPair || type() == TraceType::kAbsorb // || type() == TraceType::kCalor // || type() == TraceType::kShower || type() == TraceType::kMSEloss || type() == TraceType::kMSElossNOT ); // if relevant, have Medium, and Medium has Material if( relevant && 0 != particle.pCurrentMedium() && 0 != particle.currentMedium().pMaterial() ) { const Material& material = particle.currentMedium().material(); // Position in the material list m_traceInfo.material = 0; //material.index() // # of radiation lengths of material m_traceInfo.radl = material.radLength(); m_traceInfo.dedx = material.dedx(); // not used anymore // for( int i=0; i