#ifndef analysis_IAnalysisUtilities_hxx #define analysis_IAnalysisUtilities_hxx #include #include #include #include #include #include #include #include class TGeoNode; class TDirectory; namespace COMET{ namespace IAnalysisUtilities{ TDirectory* GetOrMakeDirectory(const std::string& name, TDirectory* parentDir=NULL); TGeoNode* GetNode(const TVector3& position); std::string FullNodePath(const TVector3& position); void ConvertToPolarAngles(const TVector3& globalPos, const TVector3& direction, double& theta, double& phi); int GetPID(const COMET::IG4VHit& hit); COMET::IGeometryId GetGeometryID(const double pos_x, const double pos_y, const double pos_z); inline COMET::IGeometryId GetGeometryID(const TVector3& position){ return GetGeometryID(position.x(),position.y(),position.z()); } inline COMET::IGeometryId GetGeometryID(const COMET::IG4VHit& hit){ return GetGeometryID(hit.GetPosX(), hit.GetPosY(), hit.GetPosZ()); } COMET::IChannelId GetChannelID(const double pos_x, const double pos_y, const double pos_z); inline COMET::IChannelId GetChannelID(const TVector3& position){ return GetChannelID(position.x(),position.y(),position.z()); } inline COMET::IChannelId GetChannelID(const COMET::IG4VHit& hit){ return GetChannelID(hit.GetPosX(), hit.GetPosY(), hit.GetPosZ()); } ///@group Particle Flux Checkers ///@{ typedef std::vector VolumeNames; typedef std::set NameSet; /// Checks if the volume path matches *all* match names and *none* of /// the anti-match names bool CheckVolumePath(const char* volumePath, const VolumeNames* matchNames = NULL, const VolumeNames* antiMatch = NULL); /// Checks if volume exists at pos and the full path matches *all* match /// names and *none* of the anti-match names bool CheckVolumePath(const TVector3& pos, const VolumeNames* matchNames = NULL, const VolumeNames* antiMatch = NULL); /// Check if the trajectory passed through the volume with a given name bool CheckParticleFlux(const COMET::IG4Trajectory& traj, const bool checkStopped = false, const VolumeNames* matchNames = NULL, const VolumeNames* antiMatch = NULL); /// Get the names of all the volumes the particle passes through void GetParticleFluxVolumes(const COMET::IG4Trajectory& traj, NameSet& allNames, const bool checkStopped = false, const VolumeNames* matchNames = NULL, const VolumeNames* antiMatch = NULL); ///@} ///@group Muon Stopping Target Functions ///@{ bool ParticleStoppedInStopTgt(const COMET::IG4Trajectory& traj); bool IsInStoppingTarget(const char* volumePath); bool IsInStoppingTarget(const TVector3& pos); ///@} const COMET::IHandle GetTrajectory(int trackID); } } #endif // analysis_IAnalysisUtilities_hxx