File indexing completed on 2025-02-21 10:04:19
0001
0002 #include <vector>
0003
0004 #include <TRef.h>
0005
0006 #ifndef _CHARGED_PARTICLE_
0007 #define _CHARGED_PARTICLE_
0008
0009 #include "CherenkovRadiator.h"
0010 #include "RadiatorHistory.h"
0011 #include "TransientParticle.h"
0012 #include "CherenkovPID.h"
0013
0014 class ChargedParticle: public TransientParticle {
0015 public:
0016 ChargedParticle(int pdg = 0): TransientParticle(pdg), m_StopTracing(false) {};
0017 ~ChargedParticle() {
0018 for(auto radiator: m_RadiatorHistory)
0019 delete radiator.second;
0020
0021
0022 if (m_OrphanPhotons.size()) {
0023 for(auto photon: m_OrphanPhotons)
0024 delete photon;
0025 m_OrphanPhotons.clear();
0026 }
0027
0028 m_RadiatorHistory.clear();
0029 };
0030
0031 bool IsCharged( void ) const { return true; };
0032
0033
0034
0035
0036 inline RadiatorHistory *FindRadiatorHistory(CherenkovRadiator *radiator) const {
0037 for(auto rpair: m_RadiatorHistory)
0038 if (rpair.first == radiator)
0039 return rpair.second;
0040
0041 return 0;
0042 };
0043
0044 inline void AddOrphanPhoton(OpticalPhoton *photon) { m_OrphanPhotons.push_back(photon); };
0045 inline void StopTracing( void ) { m_StopTracing = true; };
0046 inline bool TracingIsStopped( void ) const { return m_StopTracing; };
0047 inline void StartRadiatorHistory(const std::pair<CherenkovRadiator*, RadiatorHistory*> &history) {
0048 m_RadiatorHistory.push_back(history);
0049 };
0050 inline std::vector<std::pair<TRef, RadiatorHistory*> > &GetRadiatorHistory( void ) {
0051 return m_RadiatorHistory;
0052 };
0053
0054
0055 CherenkovRadiator *GetRadiator(const std::pair<TRef, RadiatorHistory*> &entry) {
0056 return dynamic_cast<CherenkovRadiator*>(entry.first.GetObject());
0057 };
0058
0059 void SetRadiator(std::pair<TRef, RadiatorHistory*> &entry, CherenkovRadiator *radiator) {
0060 entry.first = radiator;
0061 };
0062 RadiatorHistory *GetHistory( std::pair<TRef, RadiatorHistory*> &entry) {
0063 return entry.second;
0064 };
0065
0066
0067 void PIDReconstruction(CherenkovPID &pid);
0068
0069 private:
0070
0071 std::vector<OpticalPhoton*> m_OrphanPhotons;
0072
0073
0074 std::vector<std::pair<TRef, RadiatorHistory*> > m_RadiatorHistory;
0075
0076 bool m_StopTracing;
0077
0078 #ifndef DISABLE_ROOT_IO
0079 ClassDef(ChargedParticle, 1);
0080 #endif
0081 };
0082
0083 #endif