| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

In This Package:

HistorianStepAction Class Reference

#include <HistorianStepAction.h>

Inheritance diagram for HistorianStepAction:

[legend]
Collaboration diagram for HistorianStepAction:
[legend]
List of all members.

Public Types

 SUCCESS
 NO_INTERFACE
 VERSMISMATCH
 LAST_ERROR
enum  Status
enum  Status
enum  Status

Public Member Functions

 HistorianStepAction (const std::string &type, const std::string &name, const IInterface *parent)
virtual ~HistorianStepAction ()
virtual StatusCode initialize ()
virtual StatusCode finalize ()
virtual void UserSteppingAction (const G4Step *)
virtual void queryParam (int id, double &output) const
virtual void queryParam (int id, std::string &output) const
DayaBay::SimTrackReference getAncestorTrack () const
DayaBay::SimVertexReference getAncestorVertex () const
virtual bool IsInterestingTrack (const G4Track *)
virtual bool IsInterestingVertex (const G4Step *)
virtual StatusCode GetTrackParameterList (RuleParser::ParameterList &)
 To get the initial list of Queriables.
virtual StatusCode GetVertexParameterList (RuleParser::ParameterList &)
void Reset (const G4Step *, const G4Track *, const G4StepPoint *)
 To prepare a Step for querying:.
const IDetectorElementgetDetectorElement () const
int getDetectorElementMatch () const
const ILVolumegetLogicalVolume () const
const IPVolumegetPhysicalVolume () const
const DayaBay::SimProcessgetProcess () const
double getQuenchedEnergy () const
const G4HistoryUserTrackInfogetUserTrackInfo () const
unsigned int getDetectorId () const
unsigned int getDetectorId (const IDetectorElement *) const
virtual StatusCode queryInterface (const InterfaceID &riid, void **ppvInterface)=0
virtual StatusCode queryInterface (const InterfaceID &riid, void **ppvInterface)=0
virtual StatusCode queryInterface (const InterfaceID &riid, void **ppvInterface)=0
virtual StatusCode queryInterface (const InterfaceID &riid, void **ppvUnknown)
virtual unsigned long addRef ()=0
virtual unsigned long addRef ()=0
virtual unsigned long addRef ()=0
virtual unsigned long addRef ()
virtual unsigned long release ()=0
virtual unsigned long release ()=0
virtual unsigned long release ()=0
StatusCode release (const IInterface *interface) const
virtual unsigned long release ()
virtual const std::string & type () const =0
virtual const std::string & type () const
virtual const IInterfaceparent () const =0
virtual const IInterfaceparent () const
virtual StatusCode configure ()=0
virtual StatusCode configure ()
virtual StatusCode start ()=0
virtual StatusCode start ()
virtual StatusCode stop ()=0
virtual StatusCode stop ()
virtual StatusCode terminate ()=0
virtual StatusCode terminate ()
virtual StatusCode reinitialize ()=0
virtual StatusCode reinitialize ()
virtual StatusCode restart ()=0
virtual StatusCode restart ()
virtual Gaudi::StateMachine::State FSMState () const =0
virtual Gaudi::StateMachine::State FSMState () const
virtual StatusCode sysInitialize ()=0
virtual StatusCode sysInitialize ()
virtual StatusCode sysStart ()=0
virtual StatusCode sysStart ()
virtual StatusCode sysStop ()=0
virtual StatusCode sysStop ()
virtual StatusCode sysFinalize ()=0
virtual StatusCode sysFinalize ()
virtual StatusCode sysReinitialize ()=0
virtual StatusCode sysReinitialize ()
virtual StatusCode sysRestart ()=0
virtual StatusCode sysRestart ()
virtual unsigned long refCount () const =0
virtual const std::string & name () const =0
virtual const std::string & name () const
virtual void handle (const Incident &i)
IGiGaSvcgigaSvc () const
IGiGaSetUpSvcsetupSvc () const
INTupleSvcntupleSvc () const
INTupleSvcevtColSvc () const
IDataProviderSvcdetSvc () const
IDataProviderSvcevtSvc () const
IIncidentSvcincSvc () const
IChronoStatSvcchronoSvc () const
IHistogramSvchistoSvc () const
IAlgContextSvccontextSvc () const
DataObjectput (IDataProviderSvc *svc, DataObject *object, const std::string &address, const bool useRootInTES=true) const
DataObjectput (DataObject *object, const std::string &address, const bool useRootInTES=true) const
Gaudi::Utils::GetData< TYPE
>::return_type 
get (IDataProviderSvc *svc, const std::string &location, const bool useRootInTES=true) const
Gaudi::Utils::GetData< TYPE
>::return_type 
get (const std::string &location, const bool useRootInTES=true) const
TYPE * getDet (IDataProviderSvc *svc, const std::string &location) const
TYPE * getDet (const std::string &location) const
bool exist (IDataProviderSvc *svc, const std::string &location, const bool useRootInTES=true) const
bool exist (const std::string &location, const bool useRootInTES=true) const
bool existDet (IDataProviderSvc *svc, const std::string &location) const
bool existDet (const std::string &location) const
TYPE * getOrCreate (IDataProviderSvc *svc, const std::string &location, const bool useRootInTES=true) const
TYPE * getOrCreate (const std::string &location, const bool useRootInTES=true) const
TOOL * tool (const std::string &type, const std::string &name, const IInterface *parent=0, bool create=true) const
TOOL * tool (const std::string &type, const IInterface *parent=0, bool create=true) const
SERVICE * svc (const std::string &name, const bool create=true) const
IUpdateManagerSvcupdMgrSvc () const
IDataProviderSvcfastContainersSvc () const
StatusCode Error (const std::string &msg, const StatusCode st=StatusCode::FAILURE, const size_t mx=10) const
StatusCode Warning (const std::string &msg, const StatusCode st=StatusCode::FAILURE, const size_t mx=10) const
StatusCode Print (const std::string &msg, const StatusCode st=StatusCode::SUCCESS, const MSG::Level lev=MSG::INFO) const
StatusCode Assert (const bool ok, const std::string &message="", const StatusCode sc=StatusCode(StatusCode::FAILURE, true)) const
StatusCode Assert (const bool ok, const char *message, const StatusCode sc=StatusCode(StatusCode::FAILURE, true)) const
StatusCode Exception (const std::string &msg, const GaudiException &exc, const StatusCode sc=StatusCode(StatusCode::FAILURE, true)) const
StatusCode Exception (const std::string &msg, const std::exception &exc, const StatusCode sc=StatusCode(StatusCode::FAILURE, true)) const
StatusCode Exception (const std::string &msg="no message", const StatusCode sc=StatusCode(StatusCode::FAILURE, true)) const
MsgStreammsgStream (const MSG::Level level) const
MsgStreamalways () const
MsgStreamfatal () const
MsgStreamerr () const
MsgStreamerror () const
MsgStreamwarning () const
MsgStreaminfo () const
MsgStreamdebug () const
MsgStreamverbose () const
MsgStreammsg () const
const Statisticscounters () const
StatEntitycounter (const std::string &tag) const
MSG::Level msgLevel () const
bool msgLevel (const MSG::Level level) const
void resetMsgStream () const
bool typePrint () const
bool propsPrint () const
bool statPrint () const
bool errorsPrint () const
long printStat (const MSG::Level level=MSG::ALWAYS) const
long printErrors (const MSG::Level level=MSG::ALWAYS) const
long printProps (const MSG::Level level=MSG::ALWAYS) const
void registerCondition (const std::string &condition, StatusCode(CallerClass::*mf)()=NULL)
void registerCondition (const std::string &condition, CondType *&condPtrDest, StatusCode(CallerClass::*mf)()=NULL)
void registerCondition (char *condition, StatusCode(CallerClass::*mf)()=NULL)
void registerCondition (TargetClass *condition, StatusCode(CallerClass::*mf)()=NULL)
StatusCode runUpdate ()
TransientFastContainer< T > * getFastContainer (const std::string &location, typename TransientFastContainer< T >::size_type initial=0)
const std::string & context () const
const std::string & rootInTES () const
double globalTimeOffset () const
virtual Gaudi::StateMachine::State targetFSMState () const
virtual StatusCode setProperty (const Property &p)
virtual StatusCode setProperty (const std::string &s)
virtual StatusCode setProperty (const std::string &n, const std::string &v)
StatusCode setProperty (const std::string &name, const TYPE &value)
virtual StatusCode getProperty (Property *p) const
virtual const PropertygetProperty (const std::string &name) const
virtual StatusCode getProperty (const std::string &n, std::string &v) const
virtual const std::vector<
Property * > & 
getProperties () const
PropertyMgrgetPropertyMgr ()
ISvcLocatorserviceLocator () const
ISvcLocatorsvcLoc () const
IMessageSvcmsgSvc () const
IToolSvctoolSvc () const
StatusCode setProperties ()
StatusCode service (const std::string &name, T *&svc, bool createIf=true) const
StatusCode service (const std::string &type, const std::string &name, T *&svc) const
void declInterface (const InterfaceID &, void *)
PropertydeclareProperty (const std::string &name, T &property, const std::string &doc="none") const
PropertydeclareRemoteProperty (const std::string &name, IProperty *rsvc, const std::string &rname="") const
IAuditorSvcauditorSvc () const
IMonitorSvcmonitorSvc () const
void declareInfo (const std::string &name, const T &var, const std::string &desc) const
void declareInfo (const std::string &name, const std::string &format, const void *var, int size, const std::string &desc) const

Static Public Member Functions

static const InterfaceIDinterfaceID ()
static const InterfaceIDinterfaceID ()
static const InterfaceIDinterfaceID ()

Public Attributes

 SUCCESS
 NO_INTERFACE
 VERSMISMATCH
 LAST_ERROR

Protected Types

typedef std::map< const IDetectorElement *,
unsigned int > 
DetectorIdCache_t
 kPar_Unknown = 0
 kPar_START_VERTEX
 kPar_Step_dE
 kPar_Step_dE_Ion
 kPar_Step_qdE
 kPar_Step_dx
 kPar_Step_dt
 kPar_Step_dAngle
 kPar_capTargetZ
 kPar_capTargetA
 kPar_Step_E_weighted_x
 kPar_Step_E_weighted_y
 kPar_Step_E_weighted_z
 kPar_Step_E_weighted_t
 kPar_Step_qE_weighted_x
 kPar_Step_qE_weighted_y
 kPar_Step_qE_weighted_z
 kPar_Step_qE_weighted_t
 kPar_IsStopping
 kPar_IsStarting
 kPar_StepNumber
 kPar_VolumeChanged
 kPar_MaterialChanged
 kPar_START_TRACK
 kPar_t
 kPar_x
 kPar_y
 kPar_z
 kPar_r
 kPar_local_x
 kPar_local_y
 kPar_local_z
 kPar_local_r
 kPar_LogicalVolumeName
 kPar_MaterialName
 kPar_DetectorElement
 kPar_DetectorElementName
 kPar_DetectorElementMatch
 kPar_NicheId
 kPar_DetectorId
 kPar_SiteId
 kPar_Site
 kPar_AD
 kPar_momentum
 kPar_TotEnergy
 kPar_KineticEnergy
 kPar_vx
 kPar_vy
 kPar_vz
 kPar_local_vx
 kPar_local_vy
 kPar_local_vz
 kPar_ProcessType
 kPar_ProcessName
 kPar_Pdg
 kPar_Charge
 kPar_TrackId
 kPar_CreatorPdg
 kPar_AncestorPdg
 kPar_mass
 kPar_ParticleName
 kPar_Prescale
 kPar_CreatorProcessName
 kPar_END_VERTEX
 kPar_END_QUERIABLE
enum  EParamIds {
  kPar_Unknown = 0, kPar_START_VERTEX, kPar_Step_dE, kPar_Step_dE_Ion,
  kPar_Step_qdE, kPar_Step_dx, kPar_Step_dt, kPar_Step_dAngle,
  kPar_capTargetZ, kPar_capTargetA, kPar_Step_E_weighted_x, kPar_Step_E_weighted_y,
  kPar_Step_E_weighted_z, kPar_Step_E_weighted_t, kPar_Step_qE_weighted_x, kPar_Step_qE_weighted_y,
  kPar_Step_qE_weighted_z, kPar_Step_qE_weighted_t, kPar_IsStopping, kPar_IsStarting,
  kPar_StepNumber, kPar_VolumeChanged, kPar_MaterialChanged, kPar_START_TRACK,
  kPar_t, kPar_x, kPar_y, kPar_z,
  kPar_r, kPar_local_x, kPar_local_y, kPar_local_z,
  kPar_local_r, kPar_LogicalVolumeName, kPar_MaterialName, kPar_DetectorElement,
  kPar_DetectorElementName, kPar_DetectorElementMatch, kPar_NicheId, kPar_DetectorId,
  kPar_SiteId, kPar_Site, kPar_AD, kPar_momentum,
  kPar_TotEnergy, kPar_KineticEnergy, kPar_vx, kPar_vy,
  kPar_vz, kPar_local_vx, kPar_local_vy, kPar_local_vz,
  kPar_ProcessType, kPar_ProcessName, kPar_Pdg, kPar_Charge,
  kPar_TrackId, kPar_CreatorPdg, kPar_AncestorPdg, kPar_mass,
  kPar_ParticleName, kPar_Prescale, kPar_CreatorProcessName, kPar_END_VERTEX,
  kPar_END_QUERIABLE
}
typedef std::map< std::string,
StatEntity
Statistics
typedef std::map< std::string,
unsigned int > 
Counter
typedef std::vector< IAlgTool * > AlgTools
typedef std::pair< IInterface *,
std::string > 
ServiceEntry
typedef std::vector< ServiceEntryServices

Protected Member Functions

virtual unsigned long refCount () const
StatusCode releaseTool (const IAlgTool *tool) const
StatusCode releaseSvc (const IInterface *svc) const
int outputLevel () const
IntegerPropertyoutputLevelProperty ()
void initOutputLevel (Property &prop)

Protected Attributes

std::vector< std::string > m_DetectorElementSearchPath
std::string m_TouchableToDetelem_name
std::vector< std::string > m_IdParameterNames
const G4Step * mCurrentStep
const G4Track * mCurrentTrack
const G4StepPoint * mCurrentStepPoint
ITouchableToDetectorElementmTouchToDetElem
const IDetectorElementmDetElement
int mDetElementMatch
const ILVolumemLogicVolume
const IPVolumemPhysVolume
DayaBay::SimProcess mProcess
double mQuenchedEnergy
G4HistoryUserTrackInfomUserTrackInfo
unsigned int mDetectorId
DetectorIdCache_t mDetectorIdCache

Static Protected Attributes

static const bool IgnoreRootInTES
static const bool UseRootInTES

Private Types

 kPar_HISTORIAN_START = kPar_END_QUERIABLE
 kPar_ParentPdg
 kPar_ParentIndirection
 kPar_GrandParentPdg
 kPar_GrandParentIndirection
 kPar_distanceFromLastVertex
 kPar_timeSinceLastVertex
 kPar_energyLossSinceLastVertex
 kPar_angleFromLastVertex
enum  EHistorianStepParams {
  kPar_HISTORIAN_START = kPar_END_QUERIABLE, kPar_ParentPdg, kPar_ParentIndirection, kPar_GrandParentPdg,
  kPar_GrandParentIndirection, kPar_distanceFromLastVertex, kPar_timeSinceLastVertex, kPar_energyLossSinceLastVertex,
  kPar_angleFromLastVertex
}

Private Member Functions

StatusCode CreateTrack (const G4Track *, DayaBay::SimTrack *&track)
StatusCode CreateVertex (DayaBay::SimVertex *&v, const DayaBay::SimTrackReference &parent)
 HistorianStepAction ()
 no default constructor
 HistorianStepAction (const HistorianStepAction &)
 no copy
HistorianStepActionoperator= (const HistorianStepAction &)
 no =

Private Attributes

G4bool idflag
std::string m_TrackSelection
std::string m_VertexSelection
G4bool m_UseFastMuEnergyCut
IHistoryKeepermHistoryKeeper
RuleParser::RulemTrackRule
RuleParser::RulemVertexRule
DayaBay::SimParticleHistorymCurrentHistory
DayaBay::SimTrackReference mCurrentTrackRef

Detailed Description

Definition at line 30 of file HistorianStepAction.h.


Member Typedef Documentation

typedef std::map<const IDetectorElement*,unsigned int> QueriableStepAction::DetectorIdCache_t [protected, inherited]

Definition at line 88 of file QueriableStepAction.h.


Member Enumeration Documentation

enum HistorianStepAction::EHistorianStepParams [private]

Enumerator:
kPar_HISTORIAN_START 
kPar_ParentPdg 
kPar_ParentIndirection 
kPar_GrandParentPdg 
kPar_GrandParentIndirection 
kPar_distanceFromLastVertex 
kPar_timeSinceLastVertex 
kPar_energyLossSinceLastVertex 
kPar_angleFromLastVertex 

Definition at line 81 of file HistorianStepAction.h.

00081                             {
00082     kPar_HISTORIAN_START = kPar_END_QUERIABLE
00083     // Tracky things specific to Histories:
00084     , kPar_ParentPdg                  // int
00085     , kPar_ParentIndirection          // int
00086     , kPar_GrandParentPdg             // int
00087     , kPar_GrandParentIndirection     // int
00088   
00089      // Vertex-y things only applicable if we have current history information.
00090     , kPar_distanceFromLastVertex     // double
00091     , kPar_timeSinceLastVertex        // double
00092     , kPar_energyLossSinceLastVertex  // double
00093     , kPar_angleFromLastVertex        // double
00094     
00095   };

enum QueriableStepAction::EParamIds [protected, inherited]

Enumerator:
kPar_Unknown 
kPar_START_VERTEX 
kPar_Step_dE 
kPar_Step_dE_Ion 
kPar_Step_qdE 
kPar_Step_dx 
kPar_Step_dt 
kPar_Step_dAngle 
kPar_capTargetZ 
kPar_capTargetA 
kPar_Step_E_weighted_x 
kPar_Step_E_weighted_y 
kPar_Step_E_weighted_z 
kPar_Step_E_weighted_t 
kPar_Step_qE_weighted_x 
kPar_Step_qE_weighted_y 
kPar_Step_qE_weighted_z 
kPar_Step_qE_weighted_t 
kPar_IsStopping 
kPar_IsStarting 
kPar_StepNumber 
kPar_VolumeChanged 
kPar_MaterialChanged 
kPar_START_TRACK 
kPar_t 
kPar_x 
kPar_y 
kPar_z 
kPar_r 
kPar_local_x 
kPar_local_y 
kPar_local_z 
kPar_local_r 
kPar_LogicalVolumeName 
kPar_MaterialName 
kPar_DetectorElement 
kPar_DetectorElementName 
kPar_DetectorElementMatch 
kPar_NicheId 
kPar_DetectorId 
kPar_SiteId 
kPar_Site 
kPar_AD 
kPar_momentum 
kPar_TotEnergy 
kPar_KineticEnergy 
kPar_vx 
kPar_vy 
kPar_vz 
kPar_local_vx 
kPar_local_vy 
kPar_local_vz 
kPar_ProcessType 
kPar_ProcessName 
kPar_Pdg 
kPar_Charge 
kPar_TrackId 
kPar_CreatorPdg 
kPar_AncestorPdg 
kPar_mass 
kPar_ParticleName 
kPar_Prescale 
kPar_CreatorProcessName 
kPar_END_VERTEX 
kPar_END_QUERIABLE 

Definition at line 93 of file QueriableStepAction.h.

00093                   {
00094      kPar_Unknown = 0
00095      , kPar_START_VERTEX
00097      // Applies to end-of-step (Vertex) only
00098      , kPar_Step_dE                    // double
00099      , kPar_Step_dE_Ion                // double
00100      , kPar_Step_qdE                   // double
00101      , kPar_Step_dx                    // double
00102      , kPar_Step_dt                    // double
00103      , kPar_Step_dAngle                // double
00104      , kPar_capTargetZ                 // int
00105      , kPar_capTargetA                 // int | No correct A info. 8/2008 Wei
00106      
00107      , kPar_Step_E_weighted_x          // double
00108      , kPar_Step_E_weighted_y          // double
00109      , kPar_Step_E_weighted_z          // double
00110      , kPar_Step_E_weighted_t          // double
00111      , kPar_Step_qE_weighted_x         // double
00112      , kPar_Step_qE_weighted_y         // double
00113      , kPar_Step_qE_weighted_z         // double
00114      , kPar_Step_qE_weighted_t         // double
00115 
00116      , kPar_IsStopping                 // int
00117      , kPar_IsStarting                 // int
00118      , kPar_StepNumber                 // int
00119 
00120      , kPar_VolumeChanged              // int as bool
00121      , kPar_MaterialChanged            // int as bool
00122 
00124      // Both Vertex and Track:
00125      , kPar_START_TRACK
00126      , kPar_t                          // double   |
00127      , kPar_x                          // double   |
00128      , kPar_y                          // double   |
00129      , kPar_z                          // double   |
00130      , kPar_r                          // double   |
00131      , kPar_local_x                    // double   |
00132      , kPar_local_y                    // double   |
00133      , kPar_local_z                    // double   | all of these guys refer to prepoint for tracks
00134      , kPar_local_r                    // double   | or postpoint for vertices.
00135      , kPar_LogicalVolumeName          // string
00136      , kPar_MaterialName               // string
00137      , kPar_DetectorElement            // custom
00138      , kPar_DetectorElementName        // string           
00139      , kPar_DetectorElementMatch       // int
00140      , kPar_NicheId                    // int
00141      , kPar_DetectorId                 // int
00142      , kPar_SiteId                     // int
00143      , kPar_Site                       // int
00144      , kPar_AD                         // int
00145      , kPar_momentum                   // double   |
00146      , kPar_TotEnergy                  // double   |
00147      , kPar_KineticEnergy              // double   |
00148      , kPar_vx                         // double   |
00149      , kPar_vy                         // double   |
00150      , kPar_vz                         // double   |
00151      , kPar_local_vx                   // double   |
00152      , kPar_local_vy                   // double   |
00153      , kPar_local_vz                   // double   |
00154      , kPar_ProcessType                // int      |
00155      , kPar_ProcessName                // string   |
00156 
00157      , kPar_Pdg                        // int 
00158      , kPar_Charge                    // int
00159      , kPar_TrackId                    // int
00160      , kPar_CreatorPdg                 // int
00161      , kPar_AncestorPdg                // int
00162      , kPar_mass                       // double
00163      , kPar_ParticleName               // string
00164      , kPar_Prescale                   // custom
00165      , kPar_CreatorProcessName         // string
00166      , kPar_END_VERTEX
00167      , kPar_END_QUERIABLE
00168    }; 


Constructor & Destructor Documentation

HistorianStepAction::HistorianStepAction ( const std::string &  type,
const std::string &  name,
const IInterface parent 
)

Definition at line 36 of file HistorianStepAction.cc.

00040   : QueriableStepAction( type, name, parent )
00041   , mHistoryKeeper(0)
00042   , mTrackRule(0)
00043   , mVertexRule(0)
00044 { 
00045   declareProperty("TrackSelection",m_TrackSelection = "none");
00046   declareProperty("VertexSelection",m_VertexSelection = "none");
00047   declareProperty("UseFastMuEnergyCut",m_UseFastMuEnergyCut = false);
00048 }

virtual HistorianStepAction::~HistorianStepAction (  )  [inline, virtual]

Definition at line 37 of file HistorianStepAction.h.

00037 {};

HistorianStepAction::HistorianStepAction (  )  [private]

no default constructor

HistorianStepAction::HistorianStepAction ( const HistorianStepAction  )  [private]

no copy


Member Function Documentation

StatusCode HistorianStepAction::initialize (  )  [virtual]

Reimplemented from QueriableStepAction.

Definition at line 50 of file HistorianStepAction.cc.

00051 {
00052   info() << "HistorianStepAction::initialize()" << endreq;
00053 
00054   StatusCode sc = QueriableStepAction::initialize();
00055   if (sc.isFailure()) return sc;
00056   
00057   // Set up default search path for detector elements. Note that this throws away PMT-specific information.
00058   // Also, change the default search path:
00059   m_DetectorElementSearchPath.clear();
00060   m_DetectorElementSearchPath.push_back("/dd/Structure/DayaBay");
00061   m_DetectorElementSearchPath.push_back("/dd/Structure/Sites");
00062   m_DetectorElementSearchPath.push_back("/dd/Structure/Pool");
00063   m_DetectorElementSearchPath.push_back("/dd/Structure/AD");
00064   m_DetectorElementSearchPath.push_back("/dd/Structure/RPC");
00065   
00066   sc = service("HistoryKeeper",mHistoryKeeper,true);
00067   if (sc.isFailure()) return sc;
00068   
00069 
00071   // Build the selection rules.
00072   
00073   using namespace RuleParser;
00074   using std::string;
00075     
00077   ParameterList tplist;
00078   QueriableStepAction::GetTrackParameterList(tplist);
00079   tplist.add<double>(kPar_ParentPdg,"ParentPdg","AncestorPdg","Ancestor");
00080   tplist.add<double>(kPar_ParentIndirection,"ParentIndirection","AncestorIndirection");
00081   tplist.add<double>(kPar_GrandParentPdg,"GrandParentPdg","GrandParent");
00082   tplist.add<double>(kPar_GrandParentIndirection,"GrandParentIndirection");
00083 
00084 
00086   ParameterList vplist;
00087   QueriableStepAction::GetVertexParameterList(vplist);
00088   vplist.add<double>(kPar_ParentPdg,"ParentPdg","AncestorPdg","Ancestor");
00089   vplist.add<double>(kPar_ParentIndirection,"ParentIndirection","AncestorIndirection");
00090   vplist.add<double>(kPar_GrandParentPdg,"GrandParentPdg","GrandParent");
00091   vplist.add<double>(kPar_GrandParentIndirection,"GrandParentIndirection");
00092   
00093   vplist.add<double>(kPar_distanceFromLastVertex,"distanceFromLastVertex");
00094   vplist.add<double>(kPar_timeSinceLastVertex,"TimeSinceLastVertex");
00095   vplist.add<double>(kPar_energyLossSinceLastVertex,"EnergyLostSinceLastVertex");
00096   vplist.add<double>(kPar_angleFromLastVertex,"AngleFromLastVertex");
00097                                                      
00098                                                      
00099   bool result;
00100   result = RuleParser::CreateRules(m_TrackSelection,tplist,mTrackRule);
00101   
00102   if(mTrackRule==0 || result==false) {
00103     err() << "Failed to interpret selection string: " << m_TrackSelection << endreq;
00104     return StatusCode::FAILURE;
00105   } else {
00106     info() << "Configured with track selection:  " << mTrackRule->name() << endreq;
00107   }
00108   
00109 
00110   result = RuleParser::CreateRules(m_VertexSelection,vplist,mVertexRule);
00111   
00112   if(mVertexRule==0 || result==false) {
00113     err() << "Failed to interpret selection string: " << m_VertexSelection << endreq;
00114     return StatusCode::FAILURE;
00115   } else {
00116     info() << "Configured with vertex selection: " << mVertexRule->name() << endreq;
00117   }
00118   
00119 
00120   return StatusCode::SUCCESS; 
00121 }

StatusCode HistorianStepAction::finalize (  )  [virtual]

Reimplemented from QueriableStepAction.

Definition at line 123 of file HistorianStepAction.cc.

00124 {
00125   return  QueriableStepAction::finalize();
00126 }

void HistorianStepAction::UserSteppingAction ( const G4Step *   )  [virtual]

Implements QueriableStepAction.

Definition at line 376 of file HistorianStepAction.cc.

00377 {
00383   
00384   // Reset temporary things:
00385   mHistoryKeeper->GetCurrentHistory(mCurrentHistory);
00386   assert(mCurrentHistory);
00387  
00389   //Add the fast muon simulation energy cut for different particle, intend to increase the simulation speed. By Haoqi Jan,27, 2011.
00390   
00391   G4Track* g4track = g4step->GetTrack();
00395   if( g4track->GetGlobalTime()> 3e16 )  {  //3e16 /* a year */
00396     G4HistoryUserTrackInfo* userinfo = dynamic_cast<G4HistoryUserTrackInfo*>
00397       ( g4track->GetUserInformation() );
00398     int parentPdg = 0;
00399     if(userinfo) {
00400       parentPdg = userinfo->parentPdg();
00401     }
00402     warning()<<"A 1 year old track orignated by particle "<<parentPdg<<endreq;
00403   }
00405 
00406   G4int trackId = g4track ->GetTrackID();
00407   G4StepPoint* thePrePoint;
00408   G4VPhysicalVolume* physV;
00409   G4Material* material;
00410   G4ParticleDefinition* particle = g4track->GetDefinition();
00411   G4String pname = particle->GetParticleName();
00412   G4ProcessVector* processVector; 
00413   thePrePoint = g4step->GetPreStepPoint();
00414   physV = thePrePoint->GetPhysicalVolume();
00415   material = physV->GetLogicalVolume()->GetMaterial(); 
00416   G4double EnergyCut;
00417  
00418 if(g4track->GetCurrentStepNumber()==1&&m_UseFastMuEnergyCut==true)
00419   { idflag=true;}
00420  //G4cout<<"FastMuCut ="<<m_UseFastMuEnergyCut <<G4endl;
00421   if(idflag==true)
00422     {
00423        
00424       if(material->GetName()=="/dd/Materials/Rock"||material->GetName()=="/dd/Materials/Air")
00425       {  
00426        //  G4cout<<"Rock or air aterial Name ="<<material->GetName()<<G4endl;
00427          if(particle->GetPDGCharge()!=0)
00428          {
00429             EnergyCut=500.0;
00430          }
00431          else
00432          {
00433             EnergyCut=30.0; 
00434          }
00435       }//rock
00436       else if(material->GetName()=="/dd/Materials/OwsWater"||material->GetName()=="/dd/Materials/IwsWater")
00437       {
00438          // G4cout<<"Ows or IWs aterial Name ="<<material->GetName()<<G4endl;
00439          if(particle->GetPDGCharge()!=0)
00440          {
00441             EnergyCut=50.0;
00442          }
00443          else
00444          {
00445             EnergyCut=3.0;   
00446           }
00447        }
00448        else 
00449        {
00450         EnergyCut=0.;
00451      //    if(material->GetName()=="/dd/Materials/LiquidScintillator"||material->GetName()=="/dd/Materials/GdDopedLS") G4cout<<"Material ="<<material->GetName()<<G4endl;
00452 
00453         }//material
00454       if(g4track->GetKineticEnergy()/MeV<EnergyCut)
00455       {
00456           
00457           //aTrack->SetKineticEnergy(0.00001/MeV);
00458           g4track->SetTrackStatus(fStopAndKill);
00459           idflag=false;
00460       }
00461    }//idflag
00463   
00465   // First, do things related to SimTracks.
00467 
00468   if(g4track->GetCurrentStepNumber() == 1) {
00469     // This is the first time we've seen this track. 
00470     // The interesting point is the first one, the track initial vertex.
00471     QueriableStepAction::Reset(g4step,g4track,g4step->GetPreStepPoint());
00472 
00473     // Does a SimTrack already exist for this G4track?
00474     int id = g4track->GetTrackID();
00475     SimTrackReference ref = mCurrentHistory->track(id);
00476     SimTrack* track = ref.track();
00477 
00478     if(track==0) { // There is no track or reference.
00479       // Maybe we need to make one. Is it a primary track?
00480       if(g4track->GetParentID()==0) {
00481         // This is a primary track, so this action is responsible for starting it.
00482         // Create the SimTrack
00483         CreateTrack(g4track,track);
00484         ref = SimTrackReference(track,0);
00485       } else {
00486         if(IsInterestingTrack(g4track)) {
00487           CreateTrack(g4track,track);        
00488           ref = SimTrackReference(track,0);
00489         }
00490       }
00491     }
00492 
00493     if(ref.track()==0) {
00494       // OK, there is still no valid reference. Let's build an indirect one.
00495       SimTrackReference  parentTrack = getAncestorTrack();
00496       SimVertexReference parentVertex = getAncestorVertex();
00497 
00498        // Increment indirection.
00499        ref = SimTrackReference(parentTrack.track(),parentTrack.indirection()+1);
00500        mCurrentHistory->addTrackRef(g4track->GetTrackID(),ref);
00501      }
00502 
00503 
00504     // currentTrack should now be set correctly, one way or another
00505     if(! ref.isDirect()) {
00506       // The reference is indirect, meaning we aren't recording the current one.
00507       // So, instead, we want to store some 'missing' information.
00508       ref.track()->incrementUnrecordedDescendants(pdgFromG4Track(g4track));
00509     }
00510 
00511     // The current track reference, for convenience.
00512     //mCurrentHistory->setCurrentTrack(ref);
00513   }
00514   
00516   // Second, do things related to SimVertex.
00518   
00519   // The point of interest is the post-step if we're looking at the step/vertex
00520   QueriableStepAction::Reset(g4step,g4track,g4step->GetPostStepPoint());
00521   
00522   mCurrentTrackRef = mCurrentHistory->track(g4track->GetTrackID());
00523   if(!mCurrentTrackRef.track()) {
00524     // This is an error and shouldn't happen.
00525     err() << "Somehow we got a bad track reference on track id " 
00526           << g4track->GetTrackID() << endreq;
00527     err() << " This shouldn't happen - everything should have a parent." << endreq;
00528     assert(0);
00529   }
00530   
00531 
00532   // Is the current track getting recorded?
00533   if(mCurrentTrackRef.isDirect()){
00534     // Yes. Is this interaction interesting on it's own?
00535     if(IsInterestingVertex(g4step)) {
00536       verbose() << " InterestingVertex. Track in " << g4step->GetTrack()->GetVolume()->GetName() 
00537               << " particle " << g4step->GetTrack()->GetDefinition()->GetParticleName()
00538               << " G4TrackID "<< g4step->GetTrack()->GetTrackID()
00539               << " current step# " << g4step->GetTrack()->GetCurrentStepNumber()
00540               << " step length(mm) " << g4step->GetTrack()->GetStepLength()/mm
00541               << endreq;
00542       SimVertex* vertex = 0;
00543       CreateVertex(vertex,mCurrentTrackRef);
00544       // Give ownership to History.
00545       mCurrentHistory->addVertex(vertex); 
00546       // We have a recorded track and recorded vertex. So, add the vertex.
00547       mCurrentTrackRef.track()->addVertex(vertex);
00548     }
00549   }
00550 
00551   // Get current PDG code.
00552   int pdg = pdgFromG4Track(g4track);
00553   
00554   // Get the current best reference to a vertex
00555   SimVertexReference curVertexRef(mCurrentTrackRef.track()->vertices().back(),mCurrentTrackRef.indirection());
00556 
00557   assert(fpSteppingManager);
00558   assert(fpSteppingManager->GetStep() == g4step);
00559   
00560   // Loop over secondaries, push information forward.
00561   int nSecAtRest = fpSteppingManager->GetfN2ndariesAtRestDoIt();
00562   int nSecAlong  = fpSteppingManager->GetfN2ndariesAlongStepDoIt();
00563   int nSecPost   = fpSteppingManager->GetfN2ndariesPostStepDoIt();
00564   int nSecTotal  = nSecAtRest+nSecAlong+nSecPost;
00565   G4TrackVector* secVec = fpSteppingManager->GetfSecondary();
00566 
00567   size_t end = (*secVec).size();
00568   size_t start = end-nSecTotal;
00569   for(size_t itrack=start; itrack < end; itrack++)
00570   {
00571     G4Track* g4track = (*secVec)[itrack];
00572     G4HistoryUserTrackInfo* user
00573       = new G4HistoryUserTrackInfo(curVertexRef,mCurrentTrackRef,pdg);
00574     if(g4track->GetUserInformation()) {
00575       warning() << "Already found user info!  itrack=" << itrack
00576         << " out of " << (*secVec).size() << endreq;
00577     } else {
00578       g4track->SetUserInformation(user);
00579     }
00580   }
00581 
00582 }

void HistorianStepAction::queryParam ( int  id,
double &  output 
) const [virtual]

Reimplemented from QueriableStepAction.

Definition at line 132 of file HistorianStepAction.cc.

00133 {
00134   SimTrackReference ref;
00135   G4StepPoint* postPoint = mCurrentStep->GetPostStepPoint();
00136   const SimVertex* v = 0;
00137   Gaudi::XYZPoint pos;
00138   Gaudi::XYZVector dPos;
00139   
00140   switch(id) {
00141     case kPar_ParentPdg:
00142       ref = getAncestorTrack();
00143       if(ref.track()) output = ref.track()->particle();
00144       else output = 0;
00145       break;
00146       
00147     case kPar_ParentIndirection:
00148       output = getAncestorTrack().indirection();
00149       break;
00150 
00151     case kPar_GrandParentPdg:
00152       output = 0;
00153       ref = getAncestorTrack();
00154       if(ref.track()) ref = ref.track()->ancestorTrack();
00155       if(ref.track()) output = ref.track()->particle();
00156       break;
00157     
00158     case kPar_GrandParentIndirection:
00159       output = -999;
00160       ref = getAncestorTrack();
00161       if(ref.track()) output = ref.track()->ancestorTrack().indirection();
00162       break;
00163 
00164     // Special history stuff.
00165     case kPar_distanceFromLastVertex:      
00166     case kPar_timeSinceLastVertex:
00167     case kPar_energyLossSinceLastVertex:
00168     case kPar_angleFromLastVertex:
00169       assert(mCurrentTrackRef.track());
00170       assert(mCurrentTrackRef.track()->vertices().size());
00171       v = mCurrentTrackRef.track()->vertices().back();
00172 
00173       switch(id) {
00174         case kPar_distanceFromLastVertex:
00175           pos = Gaudi::XYZPoint(postPoint->GetPosition().x()
00176                                 ,postPoint->GetPosition().y()
00177                                 ,postPoint->GetPosition().z());
00178           dPos = pos - v->position();
00179           output = dPos.R();
00180           return;
00181         case kPar_timeSinceLastVertex:
00182           output = postPoint->GetGlobalTime() - v->time();
00183           return;
00184         case kPar_energyLossSinceLastVertex:
00185           output = postPoint->GetTotalEnergy() - v->totalEnergy();
00186           return;
00187         case kPar_angleFromLastVertex:
00188           output = ( postPoint->GetMomentumDirection().x() * v->momentum().x()
00189                    + postPoint->GetMomentumDirection().y() * v->momentum().y()
00190                    + postPoint->GetMomentumDirection().z() * v->momentum().z() )
00191                    / (v->momentum().R());
00192           output = acos(output)*CLHEP::radian;
00193           return;
00194       }
00195       break;
00196 
00197     default:
00198       QueriableStepAction::queryParam(id,output);
00199   }
00200   verbose() << " id " << id << " output " << output << endreq;
00201 
00202 }

void HistorianStepAction::queryParam ( int  id,
std::string &  output 
) const [virtual]

Reimplemented from QueriableStepAction.

Definition at line 204 of file HistorianStepAction.cc.

00205 {
00206   QueriableStepAction::queryParam(id,output);
00207   verbose() << " id " << id << " output " << output << endreq;
00208 
00209 }

SimTrackReference HistorianStepAction::getAncestorTrack (  )  const

Definition at line 212 of file HistorianStepAction.cc.

00213 {
00214   const G4HistoryUserTrackInfo* info = getUserTrackInfo();
00215   if(!info) {
00216     err() << "Found track id " << mCurrentTrack->GetTrackID() << " with no user info. Shouldn't happen." << endreq;
00217     err() << "(Are you running with both the HistorianTrackAction AND the HistorianStepAction?)" << endreq;
00218     assert(info);    
00219   }
00220   return info->track();
00221 }

SimVertexReference HistorianStepAction::getAncestorVertex (  )  const

Definition at line 223 of file HistorianStepAction.cc.

00224 {
00225   const G4HistoryUserTrackInfo* info = getUserTrackInfo();
00226   if(!info) {
00227     err() << "Found track id " << mCurrentTrack->GetTrackID() << " with no user info. Shouldn't happen." << endreq;
00228     err() << "(Are you running with both the HistorianTrackAction AND the HistorianStepAction?)" << endreq;
00229     assert(info);    
00230   }
00231   
00232   return info->vertex();
00233 }

bool HistorianStepAction::IsInterestingTrack ( const G4Track *   )  [virtual]

Definition at line 369 of file HistorianStepAction.cc.

00370 {
00371   // All the magic is done by the RuleParser system, and the Rules it has procuded:
00372   return mTrackRule->select(this);
00373 }

bool HistorianStepAction::IsInterestingVertex ( const G4Step *   )  [virtual]

Definition at line 363 of file HistorianStepAction.cc.

00364 {
00365   // All the magic is done by the RuleParser system, and the Rules it has procuded:
00366   return mVertexRule->select(this);
00367 }

StatusCode HistorianStepAction::CreateTrack ( const G4Track *  ,
DayaBay::SimTrack *&  track 
) [private]

Definition at line 268 of file HistorianStepAction.cc.

00269 {
00270   SimTrackReference parentTrack;
00271   SimVertexReference parentVertex;
00272   int parentPdg = 0;
00273  
00274   const HepMC::GenParticle*  genPart = 0;
00275 
00276   if(g4track->GetParentID()==0){
00277     //info() << "Building primary particle" << endreq;
00278     // Primary track is a special case.
00279     parentTrack = SimTrackReference(0,0);
00280     parentVertex= SimVertexReference(0,0);
00281 
00282     const G4DhPrimaryParticleInformation* primaryinfo = 
00283         dynamic_cast<const G4DhPrimaryParticleInformation*>(
00284              g4track->GetDynamicParticle()->GetPrimaryParticle()->GetUserInformation() );
00285      if(primaryinfo) {
00286        genPart  = primaryinfo->GetHepParticle();      
00287      }
00288 
00289   } else {
00290     const G4HistoryUserTrackInfo* userinfo = getUserTrackInfo();
00291     if(userinfo) {
00292       parentTrack = userinfo->track();
00293       parentVertex = userinfo->vertex();
00294       parentPdg = userinfo->parentPdg();
00295     } else {
00296       err() << "Found track id " << mCurrentTrack->GetTrackID() << " with no user info. Shouldn't happen." << endreq;
00297       err() << "(Are you running with both the HistorianTrackAction AND the HistorianStepAction?)" << endreq;
00298       assert(userinfo);    
00299     }
00300     genPart = parentTrack.track()->primaryParticle();
00301   }
00302 
00303   int pdg = pdgFromG4Track(g4track);
00304   if(pdg == 0 ) {
00305     warning() << "Found particle with zero pdg code. Geant claims this particle is: " 
00306               << g4track->GetDefinition()->GetParticleName() << endreq;
00307   }
00308  
00309   track = new SimTrack();
00310   track->setTrackId(g4track->GetTrackID());
00311   track->setParentParticle(parentPdg);
00312   track->setAncestorTrack(parentTrack);
00313   track->setAncestorVertex(parentVertex);
00314   track->setPrimaryParticle(genPart);
00315   track->setParticle(pdg);
00316     
00318   // Create the start vertex.
00319   const G4ThreeVector& pos = mCurrentStepPoint->GetPosition();
00320   const G4ThreeVector mom = mCurrentStepPoint->GetMomentum();
00321 
00322   // Figure out the process.
00323   SimProcess proc;
00324   if(g4track->GetParentID()==0){
00325     // This is a primary.
00326     proc = SimProcess(SimProcess::kPrimaryVertex,"");
00327   } else {
00328     if(mCurrentTrack->GetCreatorProcess())
00329       proc = SimProcess(SimProcess::kParticleStart,mCurrentTrack->GetCreatorProcess()->GetProcessName());
00330     else
00331       proc = SimProcess(SimProcess::kParticleStart,"");
00332   }
00333 
00334   SimVertex* vertex = new SimVertex(
00335                        SimTrackReference(track,0),
00336                        proc,
00337                        mCurrentStepPoint->GetGlobalTime(),
00338                        Gaudi::XYZPoint(pos.x(),pos.y(),pos.z()),
00339                        mCurrentStepPoint->GetTotalEnergy(),
00340                        Gaudi::XYZVector(mom.x(),mom.y(),mom.z())
00341                       );
00342     
00343   track->addVertex(vertex);
00344   mCurrentHistory->addTrack(track);
00345   mCurrentHistory->addTrackRef(g4track->GetTrackID(),SimTrackReference(track,0));
00346   mCurrentHistory->addVertex(vertex);
00347   if(g4track->GetParentID()==0){ 
00348     // This is a primary.
00349     mCurrentHistory->addPrimaryTrack(track);
00350   } else {
00351     // This track is not a primary, so try to link from our parent vertex to us.
00352     // Invert the parent-vertex indirection to find out the parentVertex->this track reference.
00353     SimTrackReference downref(track,parentVertex.indirection());
00354     if(!parentVertex.vertex())
00355       err() << "SimTrack being created, but no Parent vertex is stored. This shouldn't happen." << endreq;
00356     else
00357       parentVertex.vertex()->addSecondary(downref);
00358   }  
00359   return StatusCode::SUCCESS;
00360 }

StatusCode HistorianStepAction::CreateVertex ( DayaBay::SimVertex *&  v,
const DayaBay::SimTrackReference parent 
) [private]

Definition at line 239 of file HistorianStepAction.cc.

00241 { 
00248      
00249   const G4ThreeVector& pos = mCurrentStepPoint->GetPosition();
00250   const G4ThreeVector mom = mCurrentStepPoint->GetMomentum();
00251 
00252   vertex = new SimVertex(
00253                       parent,
00254                       getProcess(),
00255                       mCurrentStepPoint->GetGlobalTime(),
00256                       Gaudi::XYZPoint(pos.x(),pos.y(),pos.z()),
00257                       mCurrentStepPoint->GetTotalEnergy(),
00258                       Gaudi::XYZVector(mom.x(),mom.y(),mom.z())
00259                      );
00260 
00261   return StatusCode::SUCCESS;
00262 }

HistorianStepAction& HistorianStepAction::operator= ( const HistorianStepAction  )  [private]

no =

StatusCode QueriableStepAction::GetTrackParameterList ( RuleParser::ParameterList  )  [virtual, inherited]

To get the initial list of Queriables.

Usually called at initialize()

Definition at line 107 of file QueriableStepAction.cc.

00108 {
00109   using namespace RuleParser;
00110   using std::string;
00111   
00112   tplist.add<double>(kPar_t,"time","t");
00113   tplist.add<double>(kPar_x,"x","global_x");
00114   tplist.add<double>(kPar_y,"y","global_y");
00115   tplist.add<double>(kPar_z,"z","global_z");
00116   tplist.add<double>(kPar_r,"r","radius","pos_r");
00117   tplist.add<double>(kPar_local_x,"lx","local_x","det_x");             
00118   tplist.add<double>(kPar_local_y,"ly","local_y","det_y");
00119   tplist.add<double>(kPar_local_z,"lz","local_z","det_z");
00120   tplist.add<double>(kPar_local_r,"lr","local_r","det_r");
00121   tplist.add<string>(kPar_LogicalVolumeName,"Volume","LogicalVolumeName","LogicalVolume","VolumeName");
00122   tplist.add<string>(kPar_MaterialName,"Material","MaterialName");
00123   tplist.add<string>(kPar_DetectorElementName,"DetectorElementName");
00124   tplist.add<double>(kPar_DetectorElementMatch,"Match","DetectorElementMatch");
00125   tplist.add<double>(kPar_NicheId,"NicheId","Niche");
00126   tplist.add<double>(kPar_DetectorId,"DetectorId");
00127   tplist.add<double>(kPar_SiteId,"SiteId");
00128   tplist.add<double>(kPar_Site,"Site");
00129   tplist.add<double>(kPar_AD,"AD","AdNumber");
00130 
00131   tplist.add<double>(kPar_momentum,"momentum","p");
00132   tplist.add<double>(kPar_TotEnergy,"E","totEnergy","TotalEnergy");
00133   tplist.add<double>(kPar_KineticEnergy,"KE","kineticEnergy");
00134   tplist.add<double>(kPar_vx,"vx","global_dir_x","global_u");
00135   tplist.add<double>(kPar_vy,"vy","global_dir_y","global_v");
00136   tplist.add<double>(kPar_vz,"vz","global_dir_z","global_w");
00137   tplist.add<double>(kPar_local_vx,"lvx","local_dir_x","local_u");
00138   tplist.add<double>(kPar_local_vy,"lvy","local_dir_y","local_v");
00139   tplist.add<double>(kPar_local_vz,"lvz","local_dir_z","local_w");
00140   tplist.add<double>(kPar_ProcessType,"ProcessType");
00141   tplist.add<string>(kPar_ProcessName,"Process","ProcessName");
00142   tplist.add<double>(kPar_Pdg,"pdg","pdgcode","particle");
00143   tplist.add<double>(kPar_Charge,"charge","ParticleCharge","q");
00144   tplist.add<double>(kPar_TrackId,"id","trackid");
00145   tplist.add<double>(kPar_CreatorPdg,"creatorPdg","creator");
00146   tplist.add<double>(kPar_AncestorPdg,"ParentPdg","AncestorPdg","Ancestor");
00147   tplist.add<double>(kPar_mass,"mass","m");
00148   tplist.add<string>(kPar_ParticleName,"ParticleName");
00149   tplist.add<string>(kPar_CreatorProcessName,"CreatorProcessName","CreatorProcess");
00150 
00151 
00152 
00153   boost::shared_ptr<RuleFactory> prescaleFactory(new PrescaleRuleFactory);
00154   boost::shared_ptr<RuleFactory> customFactory(new DetElemContainsRuleFactory<QueriableStepAction>(this));
00155   tplist.add<int>(kPar_Prescale,"Prescale","by",prescaleFactory);
00156   tplist.add<const IDetectorElement*>(kPar_DetectorElement,"DetElem","in",customFactory);
00157   tplist.add<const IDetectorElement*>(kPar_DetectorElement,"DetectorElement","in",customFactory);
00158 
00159 
00160   return StatusCode::SUCCESS;
00161 }

StatusCode QueriableStepAction::GetVertexParameterList ( RuleParser::ParameterList  )  [virtual, inherited]

Definition at line 164 of file QueriableStepAction.cc.

00165 {
00167   GetTrackParameterList(vplist); // Everything valid for a track is valid for a vertex.
00168 
00169   using namespace RuleParser;
00170   using std::string;
00171 
00172 
00173   // And add vertex-specific stuff:
00174   vplist.add<double>(kPar_Step_dE,"Step_dE","dE");
00175   vplist.add<double>(kPar_Step_dE_Ion,"Step_dE_Ion","de_ion","ionization");
00176   vplist.add<double>(kPar_Step_qdE,"Step_qDE","quenched_dE","qdE");
00177   vplist.add<double>(kPar_Step_dx,"Step_dx","StepLength","dx");
00178   vplist.add<double>(kPar_Step_dt,"Step_dt","StepDuration","dt");
00179   vplist.add<double>(kPar_Step_dAngle,"Step_dAngle","dAngle");
00180   vplist.add<double>(kPar_capTargetZ,"capTargetZ");
00181   vplist.add<double>(kPar_capTargetA,"capTargetA");
00182   vplist.add<double>(kPar_Step_E_weighted_x,"Ex","E_weighted_x");
00183   vplist.add<double>(kPar_Step_E_weighted_y,"Ey","E_weighted_y"); 
00184   vplist.add<double>(kPar_Step_E_weighted_z,"Ez","E_weighted_z");    
00185   vplist.add<double>(kPar_Step_E_weighted_t,"Et","E_weighted_t");    
00186   vplist.add<double>(kPar_Step_qE_weighted_x,"qEx","qE_weighted_x","quenched_weighted_x");
00187   vplist.add<double>(kPar_Step_qE_weighted_y,"qEy","qE_weighted_y","quenched_weighted_y");    
00188   vplist.add<double>(kPar_Step_qE_weighted_z,"qEz","qE_weighted_z","quenched_weighted_z");    
00189   vplist.add<double>(kPar_Step_qE_weighted_t,"qEt","qE_weighted_t","quenched_weighted_t");                                     
00190 
00191 
00192   vplist.add<double>(kPar_IsStopping,"IsStopping","stop","End");
00193   vplist.add<double>(kPar_IsStarting,"IsStarting","start","begin");
00194   vplist.add<double>(kPar_StepNumber,"StepNumber");                    
00195   vplist.add<double>(kPar_VolumeChanged,"VolumeChanged","NewVolume");
00196   vplist.add<double>(kPar_MaterialChanged,"MaterialChanged","NewMaterial");
00197 
00198 
00199   verbose() << " kPar_MaterialName " << kPar_MaterialName << " kPar_MaterialChanged " << kPar_MaterialChanged
00200           << " kPar_VolumeChanged " << kPar_VolumeChanged << " kPar_Pdg " << kPar_Pdg 
00201           << " kPar_LogicalVolumeName " << kPar_LogicalVolumeName 
00202           << endreq;
00203   
00204   return StatusCode::SUCCESS;
00205 }                                                   

void QueriableStepAction::Reset ( const G4Step *  ,
const G4Track *  ,
const G4StepPoint *   
) [inherited]

To prepare a Step for querying:.

Definition at line 85 of file QueriableStepAction.cc.

00089 {
00090   mCurrentStep = step;
00091   mCurrentTrack = track;
00092   mCurrentStepPoint = point;
00093   
00094   mDetElement=0;
00095   mDetElementMatch=-1;
00096   mLogicVolume=0;
00097   mPhysVolume=0;
00098   mProcess=SimProcess();
00099   mQuenchedEnergy = -1e9;
00100   mUserTrackInfo = 0;
00101   mDetectorId = 0xFFFFFFF;
00102 
00103   verbose() << " The current track has been reset " << endreq;
00104 }

const IDetectorElement * QueriableStepAction::getDetectorElement (  )  const [inherited]

Definition at line 518 of file QueriableStepAction.cc.

00519 {
00520   if(!mDetElement) {
00521     // wangzhe:
00522     // (GetPhysicalVolume() == 0) at the boundary of the world.
00523     // (MotherLogical pointer == 0) means that current step point is
00524     // in the outmost volume, "Universe". 
00525     // Currently no touchable history info is available here, so neglect
00526     // any query in this volume.
00527     if(mCurrentStep->GetPreStepPoint()->GetPhysicalVolume() == 0) {
00528       return 0;
00529     }
00530     if(mCurrentStep->GetPreStepPoint()->GetPhysicalVolume()->GetMotherLogical() == 0) {
00531       return 0;
00532     }
00533     // wz
00534     G4VTouchable* touch = mCurrentStep->GetPreStepPoint()->GetTouchableHandle()();
00535     G4TouchableHistory* hist = dynamic_cast<G4TouchableHistory*>(touch);
00536     assert(hist);
00537 
00538     if (!hist->GetHistoryDepth()) {
00539         err() << "getDetectorElement(): given empty touchable history" << endreq;
00540         return 0;
00541     }
00542 
00543     StatusCode sc = mTouchToDetElem->GetBestDetectorElement(hist,
00544                                                             m_DetectorElementSearchPath,
00545                                                             mDetElement,
00546                                                             mDetElementMatch);
00547     if (sc.isFailure()) {
00548         err() << "Failed to get best detector element" << endreq;
00549         return 0;
00550     }
00551   }
00552   return mDetElement;  
00553 }

int QueriableStepAction::getDetectorElementMatch (  )  const [inherited]

Definition at line 555 of file QueriableStepAction.cc.

00556 {
00557   getDetectorElement();
00558   return mDetElementMatch;
00559 }

const ILVolume * QueriableStepAction::getLogicalVolume (  )  const [inherited]

Definition at line 561 of file QueriableStepAction.cc.

00562 {
00563   if(!mLogicVolume) {
00564     const IPVolume* pvol = getPhysicalVolume();
00565     if(pvol) mLogicVolume = pvol->lvolume();
00566   }
00567   return mLogicVolume; 
00568 }

const IPVolume * QueriableStepAction::getPhysicalVolume (  )  const [inherited]

Definition at line 570 of file QueriableStepAction.cc.

00571 {
00572   if(!mPhysVolume) {
00573      mTouchToDetElem->G4VolumeToDetDesc(mCurrentStep->GetPreStepPoint()->GetPhysicalVolume(),
00574                                         mPhysVolume
00575                                         );
00576    }
00577    return mPhysVolume;  
00578 }

const SimProcess & QueriableStepAction::getProcess (  )  const [inherited]

Definition at line 580 of file QueriableStepAction.cc.

00581 {
00582   if(!mProcess.isValid()){
00583     if(mCurrentStepPoint == mCurrentStep->GetPreStepPoint()) {
00584       if(mCurrentTrack->GetParentID()==0) // This is a primary.
00585          mProcess = SimProcess(SimProcess::kPrimaryVertex,"");
00586       else if(mCurrentTrack->GetCreatorProcess())
00587         mProcess = SimProcess(SimProcess::kParticleStart,mCurrentTrack->GetCreatorProcess()->GetProcessName());
00588       else
00589         mProcess = SimProcess(SimProcess::kParticleStart,"");
00590     } else {
00591       switch(mCurrentStep->GetPostStepPoint()->GetStepStatus()) {
00592         case fWorldBoundary:   mProcess = SimProcess(SimProcess::kWorldBoundary,""); break;
00593         case fGeomBoundary:    mProcess = SimProcess(SimProcess::kGeomBoundary,""); break;
00594         default:
00595         SimProcessFromG4Process(mCurrentStepPoint->GetProcessDefinedStep(),mProcess);
00596       }
00597     }
00598   }
00599   return mProcess;
00600 }

double QueriableStepAction::getQuenchedEnergy (  )  const [inherited]

Definition at line 602 of file QueriableStepAction.cc.

00603 {
00604   if(mQuenchedEnergy>=0) return mQuenchedEnergy;
00605   G4Track *aTrack = mCurrentStep->GetTrack();
00606   G4ParticleDefinition* aParticle = aTrack->GetDefinition();
00607   G4String particleName = aParticle->GetParticleName();
00608   //info()<<"particle name "<<particleName<<endreq;
00609 
00610   double dE = mCurrentStep->GetTotalEnergyDeposit();
00611   double dx = mCurrentStep->GetStepLength();
00612 
00613   // Find quenched energy deposit.
00614   mQuenchedEnergy = 0;
00615   if(dE > 0) {
00616     if(aParticle == G4Gamma::Gamma()) // It is a gamma
00617     {
00618       G4LossTableManager* manager = G4LossTableManager::Instance();
00619       dx = manager->GetRange(G4Electron::Electron(), dE, aTrack->GetMaterialCutsCouple());
00620       //info()<<"dE_dx = "<<dE/dx/(MeV/mm)<<"MeV/mm"<<endreq;
00621     } 
00622     G4Material* aMaterial = mCurrentStep->GetPreStepPoint()->GetMaterial();
00623     G4MaterialPropertiesTable* aMaterialPropertiesTable =
00624         aMaterial->GetMaterialPropertiesTable();
00625     if (aMaterialPropertiesTable) {
00626 
00627       // There are some properties. Is there a scintillator property?
00628       const G4MaterialPropertyVector* Fast_Intensity = 
00629           aMaterialPropertiesTable->GetProperty("FASTCOMPONENT"); 
00630       const G4MaterialPropertyVector* Slow_Intensity =
00631           aMaterialPropertiesTable->GetProperty("SLOWCOMPONENT");
00632   
00633       if (Fast_Intensity || Slow_Intensity ) {
00634         // It's a scintillator.
00635         double delta = dE/dx/aMaterial->GetDensity(); 
00636         //double birk1 = 0.0125*g/cm2/MeV;
00637         double birk1 = m_BirksConstant1; 
00638         if(mCurrentTrack->GetDefinition()->GetPDGCharge()>1.1)//for particle charge greater than 1.
00639            birk1 = 0.57*birk1;
00640         //double birk2 = (0.0031*g/MeV/cm2)*(0.0031*g/MeV/cm2);
00641         double birk2 = m_BirksConstant2;
00642         mQuenchedEnergy= dE /(1+birk1*delta+birk2*delta*delta);
00643       }
00644     }
00645   }
00646   return mQuenchedEnergy;  
00647 }

const G4HistoryUserTrackInfo * QueriableStepAction::getUserTrackInfo (  )  const [inherited]

Definition at line 649 of file QueriableStepAction.cc.

00650 {
00651   if(!mUserTrackInfo) {
00652     mUserTrackInfo = dynamic_cast<G4HistoryUserTrackInfo*>(mCurrentTrack->GetUserInformation());
00653   }
00654   return mUserTrackInfo;  
00655 }

unsigned int QueriableStepAction::getDetectorId (  )  const [inherited]

Definition at line 657 of file QueriableStepAction.cc.

00658 {
00659   if(mDetectorId==0xFFFFFFF) {
00660     const IDetectorElement* de = getDetectorElement();
00661     mDetectorId = getDetectorId(de);
00662   }
00663   return mDetectorId;
00664 }

unsigned int QueriableStepAction::getDetectorId ( const IDetectorElement  )  const [inherited]

Definition at line 666 of file QueriableStepAction.cc.

00667 {
00668   DetectorIdCache_t::iterator it = mDetectorIdCache.find(de);
00669   if(it!=mDetectorIdCache.end()) {
00670     return it->second;
00671   }
00672 
00673   const ParamValidDataObject* params = de->params();
00674   
00675   // Check each type of user param that the user could have provided:
00676   for(unsigned int ip = 0; ip<m_IdParameterNames.size(); ip++) {
00677     if (params->exists(m_IdParameterNames[ip])) {
00678       if (unsigned int id = (unsigned int)(params->param<int>(m_IdParameterNames[ip]))) {
00679         // Got it!
00680         mDetectorIdCache[de] = id;  // cache it for next time
00681         //info() << "Found id for " << getDetectorElement()->name() << " --> id " << std::hex << mDetectorId << std::dec << endreq;
00682         return id;
00683       }
00684     }
00685   }
00686   
00687   // Ok, we didnt' find it.
00688   // So, move up the support tree recursively.
00689 
00690   // --this does't work because geo->detElem() is private
00691   // const IGeometryInfo* igeo = de->geometry();
00692   //   ILVolume::ReplicaPath dummy;
00693   //   IGeometryInfo* nextGeo = 0;
00694   //   igeo->location(nextGeo, dummy); 
00695   //   if(nextGeo==0) return 0x0; // We failed to find any kind of ID.
00696   // const GeometryInfoPlus* geoplus = dynamic_cast<GeometryInfoPlus*>(nextGeo);
00697   //   assert(geoplus); // What's up with this?
00698   //   return getDetectorId(geoplus->detElem());
00699 
00700   // -- this works if the child elements are all set correctly in the XML.
00701   const IDetectorElement* nextElem = de->parentIDetectorElement();
00702   if(nextElem==0) {
00703     const IDetectorElement* ide = getDetectorElement();
00704     std::string DeName;
00705     if(ide) DeName = ide->name();
00706     else DeName = "";
00707     warning() << "Found no next-element for " << DeName << " --> id " << std::hex << mDetectorId << std::dec << endreq;
00708     mDetectorIdCache[de] = 0;
00709     return 0;
00710   }
00711   unsigned int id = getDetectorId(nextElem);
00712   mDetectorIdCache[de] = id;
00713   return id;
00714 }


Member Data Documentation

G4bool HistorianStepAction::idflag [private]

Definition at line 57 of file HistorianStepAction.h.

std::string HistorianStepAction::m_TrackSelection [private]

Definition at line 60 of file HistorianStepAction.h.

std::string HistorianStepAction::m_VertexSelection [private]

Definition at line 61 of file HistorianStepAction.h.

G4bool HistorianStepAction::m_UseFastMuEnergyCut [private]

Definition at line 62 of file HistorianStepAction.h.

IHistoryKeeper* HistorianStepAction::mHistoryKeeper [private]

Definition at line 63 of file HistorianStepAction.h.

RuleParser::Rule* HistorianStepAction::mTrackRule [private]

Definition at line 64 of file HistorianStepAction.h.

RuleParser::Rule* HistorianStepAction::mVertexRule [private]

Definition at line 65 of file HistorianStepAction.h.

DayaBay::SimParticleHistory* HistorianStepAction::mCurrentHistory [private]

Definition at line 68 of file HistorianStepAction.h.

DayaBay::SimTrackReference HistorianStepAction::mCurrentTrackRef [private]

Definition at line 69 of file HistorianStepAction.h.

std::vector<std::string> QueriableStepAction::m_DetectorElementSearchPath [protected, inherited]

Definition at line 68 of file QueriableStepAction.h.

std::string QueriableStepAction::m_TouchableToDetelem_name [protected, inherited]

Definition at line 69 of file QueriableStepAction.h.

std::vector<std::string> QueriableStepAction::m_IdParameterNames [protected, inherited]

Definition at line 70 of file QueriableStepAction.h.

const G4Step* QueriableStepAction::mCurrentStep [protected, inherited]

Definition at line 73 of file QueriableStepAction.h.

const G4Track* QueriableStepAction::mCurrentTrack [protected, inherited]

Definition at line 74 of file QueriableStepAction.h.

const G4StepPoint* QueriableStepAction::mCurrentStepPoint [protected, inherited]

Definition at line 75 of file QueriableStepAction.h.

ITouchableToDetectorElement* QueriableStepAction::mTouchToDetElem [protected, inherited]

Definition at line 76 of file QueriableStepAction.h.

const IDetectorElement* QueriableStepAction::mDetElement [mutable, protected, inherited]

Definition at line 80 of file QueriableStepAction.h.

int QueriableStepAction::mDetElementMatch [mutable, protected, inherited]

Definition at line 81 of file QueriableStepAction.h.

const ILVolume* QueriableStepAction::mLogicVolume [mutable, protected, inherited]

Definition at line 82 of file QueriableStepAction.h.

const IPVolume* QueriableStepAction::mPhysVolume [mutable, protected, inherited]

Definition at line 83 of file QueriableStepAction.h.

DayaBay::SimProcess QueriableStepAction::mProcess [mutable, protected, inherited]

Definition at line 84 of file QueriableStepAction.h.

double QueriableStepAction::mQuenchedEnergy [mutable, protected, inherited]

Definition at line 85 of file QueriableStepAction.h.

G4HistoryUserTrackInfo* QueriableStepAction::mUserTrackInfo [mutable, protected, inherited]

Definition at line 86 of file QueriableStepAction.h.

unsigned int QueriableStepAction::mDetectorId [mutable, protected, inherited]

Definition at line 87 of file QueriableStepAction.h.

DetectorIdCache_t QueriableStepAction::mDetectorIdCache [mutable, protected, inherited]

Definition at line 89 of file QueriableStepAction.h.


The documentation for this class was generated from the following files:
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

Generated on Mon Apr 11 20:54:55 2011 for Historian by doxygen 1.4.7