#ifndef TTrackerECALPi0ReconModule_hxx_seen #define TTrackerECALPi0ReconModule_hxx_seen #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "TClonesArray.h" #include "IAnalysisReconModuleBase.hxx" namespace COMET { class ITrackerECALPi0ReconModule; }; class IMyChangeClass : public COMET::IOADatabase::IGeometryChange { public: IMyChangeClass(COMET::ITrackerECALPi0ReconModule *parent); virtual ~IMyChangeClass(); void Callback(const COMET::ICOMETEvent* const); private: COMET::ITrackerECALPi0ReconModule *fParent; }; /// ITrackerECALPi0ReconModule /// /// Summary information about ReconECal output. /// > Including Track and Shower specific reconstucted quantities, /// > The ReconECal pid and energy variables, /// > As well as some information gathered from the hits reconstructed to be in /// each object. /// > Plus more... /// /// The Track and Shower 'Like' quantities show what ReconECal thinks each /// object is with default cuts on the TrShval and EMHadVal reconstructed for /// each object. /// /// Please feel free to add to the module. /// /// Tom Maryon (Lancaster) + many others over other versions. /// class COMET::ITrackerECALPi0ReconModule : public IAnalysisReconModuleBase { public: class IPi0Photon : public TObject { public: IPi0Photon() {} virtual ~IPi0Photon(); Int_t NHits; Double_t Energy; TVector3 Momentum; Double_t PID; TLorentzVector Position; Double_t Thrust; TVector3 ThrustOrigin; TVector3 ThrustAxis; TVector3 Pointing; Int_t Module; Int_t UpstreamLayer; Int_t DownstreamLayer; Int_t ExtremePlusXHit; Int_t ExtremeMinusXHit; Int_t ExtremePlusYHit; Int_t ExtremeMinusYHit; Double_t VertexResolution; std::vector TrueParticles; void Fill(COMET::IHandle, COMET::ITrackerECALPi0ReconModule*); ClassDef(ITrackerECALPi0ReconModule::IPi0Photon, 1); }; public: /// IReconECalTrack /// The main object that contains ECAL track information /// Feel free to add to. class IPi0 : public TObject { public: virtual ~IPi0(); IPi0() { }; /// The name of the algorithm that created this reconstruction object. // std::string AlgorithmName; double Mass; double Energy; TVector3 Momentum; TLorentzVector Position; IPi0Photon PhotonHigh; IPi0Photon PhotonLow; double OpeningAngle; double ResAlongHigh; double ResAlongLow; double ResThird; double DeltaT; ClassDef(ITrackerECALPi0ReconModule::IPi0, 1); }; public: class ITruthClusteredParticle : public TObject { public: ITruthClusteredParticle() {} virtual ~ITruthClusteredParticle(); Int_t Module; Int_t Id; Double_t EDep; ClassDef(ITrackerECALPi0ReconModule::ITruthClusteredParticle, 1); }; public: class IFailedGlobalObject : public TObject { public: IFailedGlobalObject() {} virtual ~IFailedGlobalObject(); Int_t PidId; Int_t Detector; Int_t Subdetector; Double_t Time; ClassDef(ITrackerECALPi0ReconModule::IFailedGlobalObject, 1); }; public: ITrackerECALPi0ReconModule(const char *name = "TrackerECalPi0", const char *title = "Tracker ECal Recon Module"); virtual ~ITrackerECALPi0ReconModule(); virtual Bool_t ProcessFirstEvent(COMET::ICOMETEvent& event); protected: virtual void InitializeModule(); virtual void InitializeBranches(); virtual bool FillTree(COMET::ICOMETEvent&); public: ///Tree Entries Int_t fNPi0; //! /// TClonesArray of TECALRecon Objects TClonesArray *fPi0; //! TClonesArray *fTruth; //! Int_t fNTruth; //! TClonesArray *fFailedGlobalObject; //! Int_t fNFailedGlobalObject; //! std::map > > fTrajIDs; //! std::map > fTrajPoses; //! std::map fModuleShapes; //! void InitialiseModuleShapes(); bool DoesLineCrossModules(COMET::IGeometryId m, const TVector3& p1, const TVector3& p2); COMET::IGeometryId FindModule(const TVector3& p); private: void GetTrajectories(COMET::ICOMETEvent& event); COMET::IHandle ProcessBunches(const COMET::IAlgorithmResult&); int GetDetectorNumber(COMET::IHandle object); int GetBunch(COMET::IHandle object); COMET::IHandle ProcessCandidates(const COMET::IAlgorithmResult&); enum kView { kViewUndefined = 0, kViewXZ = 0x1, kViewYZ = 0x2, kViewXY = 0x4, kViewZX = 0x8, kViewZY = 0x10, kViewYX = 0x20 }; enum kOrient { kOrientUndefined = 0, kOrientZ = 0x1, kOrientX = 0x2, kOrientY = 0x4 }; struct ClusterParams { double Time, TrShVal, EMHadVal, EMEnergy, Thrust, ThetaIncidence; TVector3 Origin, Direction; kOrient View; }; ClusterParams GetClusterParams(COMET::IHandle cluster); double CompareClusters(ClusterParams cl1, ClusterParams cl2); std::vector > > GetMatches(std::vector Set1); COMET::IHandle MakeReconVertex(const ClusterParams& cl1, const ClusterParams& cl2); const TVector3 MatchThrusts(const ClusterParams& cl1, const ClusterParams& cl2, kView view); const TVector3 MatchThrustVariance(COMET::IHandle vertex, const ClusterParams& cl1, const ClusterParams& cl2, const TVector3& pos, kView view); const std::pair MatchThirdViewInterval(const TVector3& vtx2d, const ClusterParams& cl, kView unmatchedView); double AddKinematicsToVertex(COMET::IHandle vertex, const TVector3& vtx, const ClusterParams& cl1, const ClusterParams& cl2); double GetAngularResolution(double incangle, double energy); virtual Bool_t IsEnabledByDefault() const {return fIsEnabled;} ClassDef(ITrackerECALPi0ReconModule,1); }; #endif