/// /// For questions or suggestions about this module please contact the /// current responsible and CC in the oaAnalysis package manager. /// /// 21-Jul-2010: Current responsible for this module is, /// Blair Jamieson (jamieson [*a*t*] physics.ubc.ca) /// #ifndef TTrackerReconModule_hxx_seen #define TTrackerReconModule_hxx_seen #include #include #include #include #include #include #include #include #include #include #include "IAnalysisReconModuleBase.hxx" #include "ITrueVertex.hxx" namespace COMET { class IReconTrackerModule; }; /// This module summarizes the reconstruction information from the ReconTracker. class COMET::IReconTrackerModule : public IAnalysisReconModuleBase { public: /// An object to describe a reconstructed track. /// An object to store unused hits /// That is, hits that were not associated with any track class IUnusedHit : public TObject { public: virtual ~IUnusedHit(); double TotalCharge; ///< Deposited charge (the hit EDeposit) TVector3 Position; ///< The position of the hit component 0=x 1=y 2=z in mm TVector3 Variance; ///< The position variance in mm double Time; ///< Time of the hit in ns double TimeUnc; ///< Time Uncertainty of hit in ns ClassDef(IReconTrackerModule::IUnusedHit, 1); }; /// An object to describe a reconstructed vertex class ITrackerVertex : public TObject { public: virtual ~ITrackerVertex(); std::string AlgorithmName; ///< The name of the algorithm that created this object. int Status; ///< The status for the fit. double Quality; ///< The quality of the fit. Ie. the Prob(chi2,ndof) int NDOF; ///< The number of degrees of freedom. /// The position of the vertex /// components [0]=x [1]=y [2]=z [3]=t /// x,y,z are in mm, t is in ns TLorentzVector Position; //! The position of the vertex /// The position variance; /// components [0]=var(x) [1]=var(y) [2]=var(z) [3]=var(t) /// x,y,z are in mm^2, t is in ns^2 TLorentzVector Variance; //! The position variance; ClassDef(IReconTrackerModule::ITrackerVertex, 1); }; /// TPC pid and track variables class ITPCTrack : public TObject { public: virtual ~ITPCTrack(); UInt_t UniqueID; ///< Unique ID number to allow matching to Global Recon object. int Detector; ///< TPC number 1, 2 or 3 int Ndof; ///< Number of degrees of freedom in TPC fit double Chi2; ///< TPC chi2 calculated after likelihood fit int NHits; ///< number of clusters used in TPC fit double Momentum; ///< Momentum of the TPC pid in MeV/c double MomentumError; ///< Uncertainty in the Momentum in MeV/c from the TPC pid double Charge; ///< Charge from the TPC pid (+1, or -1) TLorentzVector Position; ///< Position at which kinematics are reported in mm, ns TLorentzVector PositionVariance; ///< Variance in Position in mm^2, ns^2 TVector3 Direction; ///< TPC pid direction vector in mm TVector3 DirectionVariance; ///< TPC pid variance in vector direction in mm^2 double NTrun; ///< 70% of the number of clusters double Ccorr; ///< Corrected truncated mean charge deposit in PID double PullEle; ///< Pull for TPC pid electron hypothesis double PullMuon; ///< Pull for TPC pid muon hypothesis double PullPion; ///< Pull for TPC pid pion hypothesis double PullKaon; ///< Pull for TPC pid kaon hypothesis double PullProton; ///< Pull for TPC pid proton hypothesis double dEdxexpEle; ///< Estimated dE/dx for electron hypothesis double dEdxexpMuon; ///< Estimated dE/dx for muon hypothesis double dEdxexpPion; ///< Estimated dE/dx for pion hypothesis double dEdxexpKaon; ///< Estimated dE/dx for kaon hypothesis double dEdxexpProton; ///< Estimated dE/dx for proton hypothesis double SigmaEle; ///< Sigma estimated width of TPC pid electron hypothesis double SigmaMuon; ///< Sigma estimated width of TPC pid muon hypothesis double SigmaPion; ///< Sigma estimated width of TPC pid pion hypothesis double SigmaKaon; ///< Sigma estimated width of TPC pid kaon hypothesis double SigmaProton; ///< Sigma estimated width of TPC pid proton hypothesis // Other fit parameters (diffusion related) /// TPC track diffusion parameters depend on diffusion model used /// Original TPC diffusion model was: /// sigma^2 = sigma0 + sigma1*drift + sigma*drift^2 /// Updated TPC diffusion model is: /// sigma^2 = sigma0*(drift-mean_drift) + sigma1*mean_drift + sigma2*drift^2 /// units are mm, to convert to microns/sqrt(cm) take for example: /// D = sqrt( sigma/10 )*10000 double Sigma0; ///< TPC track diffusion sigma0 parameter double Sigma1; ///< TPC track diffusion sigma1 parameter double Sigma2; ///< TPC track diffusion sigma2 parameter double MeanDrift; ///< TPC track mean drift value used in diffusion model /// Number of constituents (probably 1, for track!) int NConstituents; // dig for original track and store curvature information // -- somewhat redundant with pid information, but here for checking -- TVector3 TrDirection; ///< track direction vector TVector3 TrDirectionVar; ///< variance in track direction vector double TrCurvature; ///< track curvature, units are 1/mm double TrCurvatureVar; ///< variance in track direction vector, units are (1/mm)^2 // Associated FGD information using Claudio's 2010a method of hit association bool HasExtrapolation; ///< extrapolation method of vertex is calculated or not double ExtrapolatedVertexXX; ///< for xbar vertex, this is x coordinate in mm double ExtrapolatedVertexZX; ///< for xbar vertex, this is z coordinate in mm double ExtrapolatedVertexYY; ///< for ybar vertex, this is y coordinate in mm double ExtrapolatedVertexZY; ///< for ybar vertex, this is z coordinate in mm bool EnteringFGD; ///< not sure // std::vector ExtrapolatedHits; ClassDef(IReconTrackerModule::ITPCTrack, 1); }; /// An object to hold specific FGD track variables class IFGDTrack : public TObject { public: virtual ~IFGDTrack(); UInt_t UniqueID; ///< Unique ID number to allow matching to Global Recon object. int Detector; ///< FGD number 1 or 2 int Ndof; ///< Number of degrees of freedom in FGD track fit double Chi2; ///< Chi2 of the FGD track fit /// the FGD track starting position vector /// coordinates in order x,y,z,t where x,y,z are in mm, t is in ns TLorentzVector Position; /// the FGD track direction vector (dx,dy,dz) TVector3 Direction; /// the FGD track energy deposit (total number of pe's) double EDeposit; ClassDef(IReconTrackerModule::IFGDTrack, 1); }; /// An object to describe the true G4 particle associated to the ITrackerResult class ITrueParticle : public TObject { public: virtual ~ITrueParticle(); int ID; ///< Trajectoy Id double Pur; ///< The purity for matching double Eff; ///< The efficiency for matching COMET::ITrueVertex Vertex; ///< True vertex associated to this TrueParticle ClassDef(IReconTrackerModule::ITrueParticle, 1); }; /// An object to describe a track that has /// no fit result class ITrackOther : public TObject { public: ITrackOther(); virtual ~ITrackOther(); std::string AlgorithmName; ///< The name of the algorithm that created this object. int Detector; ///< Detector used (1,2,3 for TPC, or 4,5 for FGD?) int NHits; ///< The number of hits. TClonesArray* Hits; ///< The hits double EDeposit; ///< The deposited charge for the object. TLorentzVector FrontPosition;///< The position of the track at its upstream-most end (x,y,z,t) in mm, ns TLorentzVector BackPosition;///< The position of the track at its downstream-most end /// (x,y,z,t) in mm, ns // JIMHACK - Just for now include an instance of IUnusedHit object here as // TFile::MakeProject does not seem able to find them when they are hidden inside a // TClonesArray. Nothing is done with these - it is just an ugly workaround. IUnusedHit hackHits;/// Likelihoods; std::vector Pids; ///< the PID that goes with Likelihoods TLorentzVector Position; ///< track position 4-vector (x,y,z,t) in mm, ns TLorentzVector Variance; ///< track position variance 4-vector var(x),var(y),var(z),var(t) in mm^2, ns^2 TVector3 Direction; ///< track direction vector TVector3 DirectionVariance; ///< track direction variance double Momentum; ///< track momentum MeV/c double MomentumError; ///< track momentum MeV/c ITrueParticle TrueParticle; ///< information about the true particle associated with this track Int_t NTPCs; ///< Number of TPC tracks used to build this track TClonesArray *TPC; ///< Information about the TPC pids/tracks used to build this track Int_t NFGDs; ///< Number of FGD Specific objects TClonesArray *FGD; ///< FGD objects associated with track int NNodes; ///< The number of nodes (fgd hits + tpc tracks) TClonesArray *Nodes; ///< Kinematics of the track at each node in the track fit // JIMHACK - Just for now include an instance of TPC, FGD, Constituents object here as // TFile::MakeProject does not seem able to find them when they are hidden inside a // TClonesArray. Nothing is done with these - it is just an ugly workaround. ITrackerConstituent hackConstituentsObject;/// object); /// Initialize the branches in the ReconTracker oaAnalysis tree virtual void InitializeBranches(); /// Main call to fill all of the branches of the ReconTracker /// oaAnalysis tree for a given event virtual bool FillTree(COMET::ICOMETEvent&); /// Method to fill ReconTracker tree with vertex information /// Input is a IReconVertex. The method makes a new ITrackerVertex /// tree entry and fills its values. The method is passed a pointer /// to the TClonesArray of IReconVertex to add values to at index idx. void FillVertex( COMET::IHandle< COMET::IReconVertex > in, TClonesArray * out, int idx ); /// Method to fill ReconTracker tree with TPC information /// Input is a IReconPID of TPC fit information. The method makes a new ITPCTrack /// tree entry and fills its values. The method is passed a pointer /// to the TClonesArray of ITPCTrack to add values to at index idx. /// It is done this way so the same method can be called, but passing different /// pointer to TClonesArray of ITPCTrack for both the ITrackerResult::TPC and /// the fTPCIso isolated tpc tracks. void FillTPC( COMET::IHandle< COMET::IReconPID > in, TClonesArray * out, int idx ); /// Method to make a TPC object with extrapolated hit association information. bool ExtrapolateTPC( COMET::IHandle< COMET::IReconPID > in, TClonesArray * out, int idx, COMET::IHandle fgd ); /// Method to fill ReconTracker tree with FGD information /// Input is a IReconPID of FGD fit information. The method makes a new IFGDTrack /// tree entry and fills its values. The method is passed a pointer /// to the TClonesArray of IFGDTrack to add values to at index idx. /// It is done this way so the same method can be called, but passing different /// pointer to TClonesArray of IFGDTrack for both the ITrackerResult::FGD and /// the fFGDIso isolated fgd tracks. void FillFGD( COMET::IHandle< COMET::IReconTrack > in, TClonesArray * out, int idx ); /// Method to fill ReconTracker tree with unfit track information /// Input is a IReconTrack that was not fit. The method makes a new ITrackOther /// tree entry and fills its values. The method is passed a pointer /// to the TClonesArray of ITrackOther to add values to at index idx. /// It is done this way so the same method can be called, but passing different /// pointer to TClonesArray of ITrackOther for both the fFGDOther and /// the fTPCOther tracks without fits. void FillOther( COMET::IHandle< COMET::IReconTrack > in, TClonesArray * out, int idx ); /// Method to get the tpc combo hits from the tpc hit selection (used for tpc other) COMET::IHandle GetHitsFromComboHits(COMET::IHandle tpc); /// Method to fill information about constituent pids. That is the pid /// pieces used to build the final pid. Note that only the multiple detector /// constituents are filled here, while the FGD and TPC only tracks are filled /// by calling FillTPC and FillFGD. This method is recursively called to fill /// all constituents, constituents of constituents, and so on. /// If new constituent is created it returns true, otherwise returns false, and /// returns the index into TTrackResult::Constituents if a new constituent was /// added to the tree. bool FillConstituentPid( ITrackerResult * result, COMET::IHandle< COMET::IReconPID > in, int &idx ); /// Method to fill information about constituent tracks. That is the track /// pieces used to build the final track. Note that only the multiple detector /// constituents are filled here, while the FGD and TPC only tracks are filled /// by calling FillTPC and FillFGD. This method is recursively called to fill /// all constituents, constituents of constituents, and so on. /// If new constituent is created it returns true, otherwise returns false, and /// returns the index into TTrackResult::Constituents if a new constituent was /// added to the tree. bool FillConstituentTrack( ITrackerResult * result, COMET::IHandle< COMET::IReconTrack > in, int &idx ); /// Helper method to convert ITrackState curvature information into momentum /// and momentum uncertainty void GetMomentum( COMET::IHandle state,double &p,double &ep); /// Helper method to convert ITrackState curvature information into track charge double GetCharge( COMET::IHandle state); /// Method to fill a ReconTracker result entry void FillFinalPid( ITrackerResult * result, COMET::IHandle< COMET::IReconPID > reco ); /// Method to fill a ReconTracker result entry void FillFinalTrack( ITrackerResult * result, COMET::IHandle< COMET::IReconTrack > reco ); /// Method to build an integer key that describes the detectors used /// to build the TRecon object. Each base 10 digit of the integer /// represents one detector that was used. the numbering of the /// detectors is: 1=TPC1, 2=TPC2, 3=TPC3, 4=FGD1, 5=FGD2, 6=DSECAL, /// 7=BarrelECAL, 8=P0D, 9=SMRD int GetDetectorNumber(COMET::IHandle object); /// Method to get the G4 trajectory that best matches the TRecon object COMET::IG4Trajectory GetTrajectory(COMET::ICOMETEvent& event,COMET::IHandle reco); /// Method to measure the purity of a reconstructed track against the truth std::map TrkRecModGetG4TrajectoryFractions(const COMET::IHandle track); /// Method to fill the true particle information given a G4track void FillTrueParticle( COMET::IG4Trajectory* G4track, double pur, double eff, COMET::IReconTrackerModule::ITrueParticle& trueParticle ); /// Method to get the parent G4 track for a given G4 track COMET::IHandle GetParent(COMET::IG4Trajectory* G4track); COMET::IHandle GetParent(COMET::IHandle< COMET::IG4Trajectory > G4track); /// Method to fill the true vertex information from a given G4 vertex void FillTrueVertex( bool found, const COMET::IG4PrimaryVertex& G4vertex, double pur, double eff, COMET::ITrueVertex& vertex); /// Method to find the best matching G4 vertex for a given G4 track bool GetG4Vertex(COMET::IG4Trajectory* G4track, COMET::IG4PrimaryVertex& G4vertex); /// Method to find the incident particle (neutrino) that gave rise to a given G4 track bool GetIncomingParticle(const COMET::IG4PrimaryVertex& G4vertex, COMET::IG4PrimaryParticle& incoming); /// called recursively to look for bottom level track that built a PID. In case /// the PID is made of several PIDs, the one with the track with smallest relative curvature /// error is returned. COMET::IHandle< COMET::IReconTrack> GetConstituentTrack( COMET::IHandle< COMET::IReconPID > in, int &nconstit ); public: ///Tree Entries Int_t fNVertices; ///< The number of added vertices TClonesArray *fVertices; ///< The vector of ReconTracker vertices (none ever?). Int_t fNTracks; ///< The number of ReconTracker results TClonesArray *fTracks; ///< The vector of overall ReconTracker results Int_t fNFGDOther; ///< The number of FGD tracks with no fit (none ever?). TClonesArray *fFGDOther; ///< The vector of FGD tracks with no fit Int_t fNTPCOther; ///< The number of TPC tracks with no fit TClonesArray *fTPCOther; ///< The vector of TPC tracks with no fit // The code producing the TPC iso objects is commented out in ReconTracker v0r9 Int_t fNTPCIso; ///< The number of isolated TPC tracks with fits (none ever?) TClonesArray *fTPCIso; ///< The vector of isolated TPC tracks with fits Int_t fNTPCUnused; ///< The number of unused TPC hits TClonesArray*fTPCUnused; ///< The vector of unused TPC hits Int_t fNFGDUnused; ///< The number of unused FGD hits TClonesArray*fFGDUnused; ///< The vector of unused TPC hits Int_t fNTPCExtrapolation; ///< The number of TPC tracks extrapolated into the FGD following Claudio's (2010a) method TClonesArray*fTPCExtrapolation; ///< The vector of TPC tracks extrapolated into the FGD following Claudio's (2010a) method private: double fMaxDrift; ///< TPC maximum drift used for tpc other hits double fCathodeOffset; ///< TPC cathode offset used for tpc other hits double fDriftVelocity; ///< TPC drift velocity used for tpc other hits ClassDef(IReconTrackerModule,3); }; #endif