/// /// For questions or suggestions about this module please contact the /// current responsible and CC in the oaAnalysis package manager. /// /// 11-Sep-2011: Current responsible for this module is, /// Alex Thorley (thorleya [*a*t*] hep.ph.liv.ac.uk) /// #ifndef TTrackerECALReconModule_hxx_seen #define TTrackerECALReconModule_hxx_seen #include #include #include #include #include #include #include #include #include #include #include #include #include "TClonesArray.h" #include "IAnalysisReconModuleBase.hxx" #include namespace COMET { class ITrackerReconECalModule; }; /** ITrackerReconECalModule - Object that contains information related to reconstructed objects in the tracker ECAL. This oaAnalysis module provides information gleaned from the output of the ReconECal reconstruction package. Amongst other quantities, the output of this module provides: - Variables which quantify the extent to which the reconstructed object resembles a track or a shower. - Track and shower specific reconstructed quantities. - Information concerning the constituent hits of reconstructed objects. Users are encouraged to add information to this module. Originally documented by Tom Maryon and others. */ class COMET::ITrackerReconECalModule : public IAnalysisReconModuleBase { public: /// IReconECalTrack /// The main object that contains ECAL track information class IReconECalTrack : public TObject { public: virtual ~IReconECalTrack(); IReconECalTrack(){}; // The name of the algorithm that created this reconstruction object. // std::string AlgorithmName; double Curvature; ///< The track curvature around the X axis. TVector3 Direction; ///< The track direction. //TVector3 DirectionVar; double EDeposit; ///< The charge deposited by the track in units of MIPs // The full name of this datum. The full name places the datum in the // data tree and has the syntax //xxxx/yyyy/zzzz. // TString FullName; int NDOF; ///< The number of degrees of freedom in the reconstruction. TLorentzVector Position; ///< The track starting position. TLorentzVector PositionVar; ///< The track starting position variance. TLorentzVector BackPosition; ///< The position of the end of the track double Quality; ///< The goodness of fit for the reconstruction. TVector3 Width; ///< The width of the track. int Status; ///< The fit status. ClassDef(ITrackerReconECalModule::IReconECalTrack, 1); }; public: /// IReconECalShower /// The main object that contains ECAL shower information /// Feel free to add to. class IReconECalShower : public TObject { public: virtual ~IReconECalShower(); // The name of the algorithm that created this reconstruction object. // std::string AlgorithmName; TVector3 ConeAngle; ///< The shower opening angle. TVector3 Direction; ///< The shower direction. // The shower direction variance //TVector3 DirectionVar; double EDeposit; ///< The energy deposited in the shower // the full name of this datum. The full name places the datum in the // data tree and has the syntax //xxxx/yyyy/zzzz. // TString FullName; int NDOF; ///< The number of degrees of freedom in the reconstruction. TLorentzVector Position; ///< The shower position. TLorentzVector PositionVar; ///< The shower position variance. TLorentzVector BackPosition; ///< The charge weighted position of the end of the shower double Quality; ///< The goodness of fit for the reconstruction. int Status; ///< The fit status. ClassDef(ITrackerReconECalModule::IReconECalShower, 1); }; public: /// IReconECalCluster /// The main object that contains ECAL cluster information /// Feel free to add to. class IReconECalCluster : public TObject { public: virtual ~IReconECalCluster(); IReconECalCluster(){}; // The name of the algorithm. // std::string AlgorithmName; TLorentzVector Position; ///< The cluster position. TLorentzVector PositionVar; ///< The cluster position variance. int NDOF; ///< The number of degrees of freedom in the reconstruction. double Quality; ///< The goodness of fit for the reconstruction. int Status; ///< The fit status. double EDeposit; ///< The charge deposited by the cluster. ClassDef(ITrackerReconECalModule::IReconECalCluster, 1); }; public: /// IReconECalObject /// The main object that contains ECAL recon information /// Feel free to add to. class IReconECalObject : public TObject { public: IReconECalObject(); virtual ~IReconECalObject(); int Radon_XY_First_Prong_NHits; ///< The number of hits in the first radon line in the XY view int Radon_XY_First_Prong_Angle; ///< The angle from the radon Y axis to the line perpendicular to the first radon line in the XY view int Radon_XY_First_Prong_Distance; ///< The perpendicular distance from the cluster centre to the first radon line in the XY view int Radon_XY_Second_Prong_NHits; ///< The number of hits in the second radon line in the XY view int Radon_XY_Second_Prong_Angle; ///< The angle from the radon Y axis to the line perpendicular to the first radon line in the XY view int Radon_XY_Second_Prong_Distance; ///< The perpendicular distance from the cluster centre to the first radon line in the XY view int Radon_XY_Third_Prong_NHits; ///< The number of hits in the first radon line in the XY view int Radon_XY_Third_Prong_Angle; ///< The angle from the radon Y axis to the line perpendicular to the first radon line in the XY view int Radon_XY_Third_Prong_Distance; ///< The perpendicular distance from the cluster centre to the first radon line in the XY view int Radon_XZ_First_Prong_NHits; ///< The number of hits in the first radon line in the XZ view int Radon_XZ_First_Prong_Angle; ///< The angle from the radon Y axis to the line perpendicular to the first radon line in the XZ view int Radon_XZ_First_Prong_Distance; ///< The perpendicular distance from the cluster centre to the first radon line in the XZ view int Radon_XZ_Second_Prong_NHits; ///< The number of hits in the second radon line in the XZ view int Radon_XZ_Second_Prong_Angle; ///< The angle from the radon Y axis to the line perpendicular to the second radon line in the XZ view int Radon_XZ_Second_Prong_Distance; ///< The perpendicular distance from the cluster centre to the second radon line in the XZ view int Radon_XZ_Third_Prong_NHits; ///< The number of hits in the third radon line in the XZ view int Radon_XZ_Third_Prong_Angle; ///< The angle from the radon Y axis to the line perpendicular to the third radon line in the XZ view int Radon_XZ_Third_Prong_Distance; ///< The perpendicular distance from the cluster centre to the third radon line in the XZ view int Radon_YZ_First_Prong_NHits; ///< The number of hits in the first radon line in the YZ view int Radon_YZ_First_Prong_Angle; ///< The angle from the radon Y axis to the line perpendicular to the first radon line in the YZ view int Radon_YZ_First_Prong_Distance; ///< The perpendicular distance from the cluster centre to the first radon line in the YZ view int Radon_YZ_Second_Prong_NHits; ///< The number of hits in the second radon line in the YZ view int Radon_YZ_Second_Prong_Angle; ///< The angle from the radon Y axis to the line perpendicular to the second radon line in the YZ view int Radon_YZ_Second_Prong_Distance; ///< The perpendicular distance from the cluster centre to the second radon line in the YZ view int Radon_YZ_Third_Prong_NHits; ///< The number of hits in the third radon line in the YZ view int Radon_YZ_Third_Prong_Angle; ///< The angle from the radon Y axis to the line perpendicular to the third radon line in the YZ view int Radon_YZ_Third_Prong_Distance; ///< The perpendicular distance from the cluster centre to the third radon line in the YZ view TVector3 Radon_3D_First_Prong_Direction; ///< The 3D direction of the first radon line, in global coordinates. This will be (0,0,0) if no line is reconstructed int Radon_3D_First_Prong_NHits; ///< The number of hits in the first 3D radon line. This will be 0 if no line is reconstructed TVector3 Radon_3D_Second_Prong_Direction; ///< The 3D direction of the second radon line, in global coordinates. This will be (0,0,0) if no line is reconstructed int Radon_3D_Second_Prong_NHits; ///< The number of hits in the second 3D radon line. This will be 0 if no line is reconstructed TVector3 Radon_3D_Third_Prong_Direction; ///< The 3D direction of the third radon line, in global coordinates. This will be (0,0,0) if no line is reconstructed int Radon_3D_Third_Prong_NHits; ///< The number of hits in the third 3D radon line. This will be 0 if no line is reconstructed IReconECalTrack Track; ///< Objects to store information for a track. IReconECalShower Shower; ///< Objects to store information for a shower. IReconECalCluster Cluster; ///< Objects to store information for a cluster. UInt_t UniqueID; ///< Unique ID number to allow matching to Global Recon object Int_t G4ID; ///< G4ID for truth matched objects, using TrackTruthInfo (the original truth-matching algorithm). /// G4ID of the primary particle associated with this object. /// See IShowerTruthInfo in oaUtility for details. Int_t G4ID_Primary; //G4ID of the primary particle associated with this object. Double_t Completeness_Primary; ///< Truth-matching completeness for G4ID_Primary Double_t Cleanliness_Primary; ///< Truth-matching cleanliness for G4ID_Primary /// G4ID of the highest-level parent particle that enters the ECal module, /// and which had a daughter that contributed to this object. /// See IShowerTruthInfo in oaUtility for details. Int_t G4ID_Recursive;// G4ID of the highest-level parent particle that enters the ECal module. Int_t G4ID_Recursive2;// G4ID of the highest-level parent particle that enters the ECal module. Int_t G4ID_Recursive3;// G4ID of the highest-level parent particle that enters the ECal module. Int_t G4ID_Recursive4;// G4ID of the highest-level parent particle that enters the ECal module. Double_t Completeness_Recursive; ///< Truth-matching completeness for G4ID_Recursive /// Truth-matching cleanliness for G4ID_Recursive Double_t Cleanliness_Recursive; /// The single true particle that contributed most hits to this object. Should be the same /// as G4ID in most cases (unless two particles contributed the same amount). /// See IShowerTruthInfo in oaUtility for details. Int_t G4ID_Single; //The single true particle that contributed most hits to this object. Double_t Completeness_Single; ///< Truth-matching completeness for G4ID_Single Double_t Cleanliness_Single; ///< Truth-matching cleanliness for G4ID_Single Bool_t IsTrackLike; ///< Boolean value reflecting whether this object is "track-like", based on default cuts in ReconECal Bool_t IsShowerLike; ///< Boolean value reflecting whether this object is "shower-like", based on default cuts in ReconECal //Bool_t IsEMLike; //Bool_t IsHADLike; /// Hit level information, in the future most of this, and more complex hit level /// info, will be able to be obtained from a hit level module. Int_t TimeBunch; ///< Timebunch that the object occurred in - currently not filled Int_t NHits; ///< Number of hits in this object Int_t NIsXHits; ///< Number of hits with precise X information in the object Int_t NIsYHits; ///< Number of hits with precise Y information in the object Int_t NIsZHits; ///< Number of hits with precise Z information in the object Int_t NLayersHit; ///< Number of layers hit by this object /// The maximum bar number hit in a cluster, for layers perpendicular to the beam axis /// The maximum value is 95 for Barrel ECals, 49 for DsECal Int_t maxPerpBarHit; // The maximum bar number hit in a cluster /// The maximum bar number hit in a cluster, for layers parallel to the beam axis /// The maximum value is 56 or 37 for Side and Top/Bottom Barrel ECals and 49 for DsECal Int_t maxParaBarHit; //The maximum bar number hit in a cluster /// The minimum bar number hit in a cluster /// The minimum value of this is 0 for all ECals Int_t minBarHit;//The minimum bar number hit in a cluster Int_t mostUpStreamLayerHit; ///< The layer closest to the centre of the tracker that was hit by the object. ECal layers are zero ordered, so this starts at 0 /// The layer furthest from the centre of the tracker that was hit by the object. /// This is layer number 30 (the 31st layer) for Barrel ECals and layer number 33 (the 34th layer) for the downstream ECal Int_t mostDownStreamLayerHit;//The layer furthest from the centre of the tracker that was hit Double_t TotalHitCharge; ///< Sum of charges of the consitituent hits in reconstructed object. Double_t AverageHitTime; ///< Average time of hits in reconstructed object. std::string Module; ///< Name of ECAL module in which object was reconstructed. Double_t ObjectLength; ///< Recon object length in mm /* //Added by Gavin Davies Int_t IsXHit; Int_t IsYHit; Int_t IsZHit; Int_t LayerHit; Int_t BarHit; */ /// Pid Variables, For more info on the Pid variable see the documentation /// in ReconECal or the technical note at; /// http://www.t2k.org/docs/technotes/002 double PID_AMR; ///< Ratio of the length to the width of the reconstructed object. /// The combined "circularity" of the object. (showers) 0.0 <= circularity <= 1.0 (tracks) /// This variable is a replacement for AMR. /// PID_Circularity = PID_CircularityView0 * PID_CircularityView1 double PID_Circularity;// The combined "circularity" of the object. (showers) 0.0 <= circularity <= 1.0 (tracks) double PID_CircularityView0; ///< The "circularity" in view 0 (odd layers) of the object. (showers) 0.0 <= circularity <= 1.0 (tracks) double PID_CircularityView1; ///< The "circularity" in view 1 (even layers - including 0) of the object. (showers) 0.0 <= circularity <= 1.0 (tracks) double PID_Angle; ///< The zenith angle with respect to each detector. double PID_Max_Ratio; ///< The maximum ratio between the charge in the largest charge layer over the smallest // Ratio of charge in the front and back half of the detector. // double PID_ChargeRatio; double PID_ShowerAngle; ///< The angle from the start of an object to its width at its charge centre double PID_Asymmetry; ///< Ratio of the big width of an object by its small width. double PID_MeanPosition; ///< The charge weight position with respect to the object start position. double PID_Qskew; ///< Skew of the Q distribution double PID_ShowerWidth; ///< Width at the charge centre double PID_EMLikelihood; ///< Electro-magnetic likelihood double PID_TrShval; ///< Value to seperate tracks from showers. 0 = shower-like, 1 = track-like, though there can be values outside this range double PID_EMHadVal; ///< Value to seperate EM from Hadronic showers - not currently used. double PID_TruncatedMaxRatio; ///< A truncated Max Ratio. See the ReconECal documentation for the full definition. /// A variable sensitive to the charge distribution in the plane transverse to a shower/track direction. /// See the ReconECal documentation for the full definition. double PID_TransverseChargeRatio;// A variable sensitive to the charge distribution in the plane transverse to a shower/track direction. double PID_NormalizedMipChi2; ///< A variable sensitive to the shape of the dE/dx distribution along the track. See the ReconECal documentation for the full definition. double PID_NormalizedMipChi2AllLayers; ///< A variable sensitive to the shape of the dE/dx distribution along the track. See the ReconECal documentation for the full definition. double PID_FrontBackRatio; ///< The ratio of the charge in equal length blocks at each end of the track. double PID_FrontBackRatioNumerator; ///< The numerator of the front - back ratio double PID_FrontBackRatioDenominator; ///< The denominator of the front - back ratio /// Containment: contained = 1.0, not-contained = 0.0. /// An object is classed as contained if it has no hits in the outer bars of the ECal (bar number 0 or the maximum bar in a layer) /// and no hits in the outermost layer of the ECal. double Containment; //Containment: contained = 1.0, not-contained = 0.0. /// For more details on the Likelihood PID see the ReconECal documentation or /// http://www.t2k.org/docs/technotes/111 /// A combined discriminator for separating MIPs from EM showers. /// Positive values = EM shower-like; /// Negative values = MIP-like. /// This variable should eventually replace the old TrShval /// See the ReconECal documentation for more details. double PID_LLR_MIP_EM; /// A combined discriminator for tagging showering pions in a sample of MIP-like tracks. /// Positive values = showering pion-like; /// Negative values = MIP-like. /// See the ReconECal documentation for more details. double PID_LLR_MIP_Pion; /// A combined discriminator for separating showering pions from MIP-like tracks. /// See the ReconECal documentation for more details. /// A combined discriminator for separating protons from electrons. /// Positive values = stopping track-like; /// Negative values = EM shower-like. /// See the ReconECal documentation for more details. double PID_LLR_EM_HIP; /// A combined discriminator for separating MIPs from EM showers. /// This is similar to LLR_MIP_EM but trained specifically on /// low-momentum electrons and muon. NB: this variable is still being /// developed and should be considered to be unstable. /// Positive values = electron-like; /// Negative values = muon-like. /// See the ReconECal documentation for more details. double PID_LLR_MIP_EM_LowMomentum; double AverageZPosition; ///< Average Z position of the object without charge weighting. double EMEnergyFit_Result; ///< The result from the EM energy fit to the cluster double EMEnergyFit_Uncertainty; ///< The uncertainty of the EM energy fit to the cluster double EMEnergyFit_Likelihood_energyGrad; ///< Energy fit experts please fill this in double EMEnergyFit_Likelihood_energy_qsumGrad; ///< Energy fit experts please fill this in double EMEnergyFit_Likelihood_qsum_like; ///< Energy fit experts please fill this in double EMEnergyFit_Para_QSum; ///< The summed charge present in the cluster in units of MIPs double EMEnergyFit_Para_QMean; ///< The mean charge of hits in the cluster in units of MIPs double EMEnergyFit_Para_QRMS; ///< The RMS of the hit charges for the cluster in units of MIPs double EMEnergyFit_Para_QSkew; ///< The skew of hit charges for the cluster in units of MIPs double EMEnergyFit_Para_QMax; ///< The maximum hit charge within the cluster in units of MIPs // Michel Electron Delayed Cluster Variables double MElectronTag_NDelayedCluster; ///< The number of delayed Michel electron candidate clusters std::vector MElectronTag_NDelayedHits; ///< The number of hits in a Michel electron candidate std::vector MElectronTag_DeltaX; ///< The X displacement of the Michel electron candidate from the original ECal cluster std::vector MElectronTag_DeltaY; ///< The Y displacement of the Michel electron candidate from the original ECal cluster std::vector MElectronTag_DeltaZ; ///< The Z displacement of the Michel electron candidate from the original ECal cluster std::vector MElectronTag_DeltaT; ///< The time displacement of the Michel electron candidate from the original ECal cluster std::vector MElectronTag_EDep; ///< The energy deposited by the Michel electron candidate /// MElectronTag_TrackEnd refers to which end of the Cluster the MichelCandidate was observed. /// +1 means it was observed at the outermost end (the end with the highest layer number), -1 means the innermost end (lowest layer number) std::vector MElectronTag_TrackEnd; //which end of the Cluster the MichelCandidate was observed. /// Thrust variables double Thrust; TVector3 ThrustOrigin; TVector3 ThrustAxis; /// ECAL Pid variables from the Kalman Fitter int KFNNodes; int KFMultiTracksTPC; int KFMultiTracksECAL; int KFNDOF; double KFQuality; double KFParameter; double KFParameterNodes; double KFHitQuality; bool KFIsMatched; /// ECAL Pid variables from the Kalman Fitter (running in ECAL StandAlone mode int KFNNodesEcalStandAlone; int KFMultiTracksTPCEcalStandAlone; int KFMultiTracksECALEcalStandAlone; int KFNDOFEcalStandAlone; double KFQualityEcalStandAlone; double KFParameterEcalStandAlone; double KFParameterNodesEcalStandAlone; double KFHitQualityEcalStandAlone; bool KFIsMatchedEcalStandAlone; /// The matching likelihood double MatchingLikelihood; /// Variables based on the number of hits per layer int FirstLayer; int LastLayer; int NHitsAtLayersWithManyHits; int NLayersOneHits; int NLayersTwoHits; int NLayersThreeHits; int NLayersFourHits; int NLayersFiveHits; int NLayersSixHits; int NLayersSevenHits; int FirstLayerManyHits; int SecondLayerManyHits; int ThirdLayerManyHits; int LastLayerManyHits; int MaxHitsInALayer; int MaxHitChargeLayer; /// Method to fill the Radon transform information for each cluster void FillRadonInfo(COMET::IHandle pid); /// Method to fill hit info is seperate to help keep things tidy. void FillHitInfo(COMET::IHandle hitsel); /// Method to add information in RealDatums stored in the tracks or showers. /// Examples of what this information includes, /// - Pid, Parameters for the TMVA Tool used. /// - Energy likelihood fit parametres, uncertainties etc... /// - Michel Electron Tag information on any tagged delayed clusters. void FillDatumInfo(COMET::IHandle base); /// Method to calculate the position in the last layer reached by the particle. TLorentzVector FindBackPosition(COMET::IHandle hits); /// Calculates the pointing vector. TVector3 CalculatePointing(COMET::IHandle hitsel); /// Pointing vector. TVector3 Pointing; /// Method to calculate the FrontBackRatio variable virtual void CalculateFrontBackRatio(COMET::IHandle hits, double& FrontBackRatio, double& FrontBackRatioNumerator, double& FrontBackRatioDenominator); ClassDef(ITrackerReconECalModule::IReconECalObject, 1); }; /// Object containing information about 2D unmatched clusters from the ECALs. class IReconECalUnmatchedObject : public TObject { public: IReconECalUnmatchedObject(); virtual ~IReconECalUnmatchedObject(); int NHits; ///< Number of hits in the cluster int View; ///< View of the cluster. View 0 - Y measuring (odd) Layers and View 1 - X measuring (even) layers double TotalHitCharge; ///< Summed hit charge in the cluster in units of MIPs double AverageHitTime; ///< Average time of the cluster in ns TVector3 FrontPosition; ///< Position of the end of the cluster closest to the centre of the tracker TVector3 BackPosition; ///< Position in end of the cluster furthest from the centre of the track int mostUpStreamLayerHit; ///< The layer closest to the centre of the tracker that was hit by the cluster int mostDownStreamLayerHit; ///< The layer furthest from the centre of the tracker that was hit by the cluster Int_t G4ID; ///< Truth-matched particle ID. /// G4ID of the primary particle associated with this object. /// See IShowerTruthInfo in oaUtility for details. Int_t G4ID_Primary; //G4ID of the primary particle associated with this object. /// G4ID of the highest-level parent particle that enters the ECal module, /// and which had a daughter that contributed to this object. /// See IShowerTruthInfo in oaUtility for details. Int_t G4ID_Recursive;//G4ID of the highest-level parent particle that enters the ECal module /// The single true particle that contributed most hits to this object. Should be the same /// as G4ID in most cases (unless two particles contributed the same amount). /// See IShowerTruthInfo in oaUtility for details. Int_t G4ID_Single;//The single true particle that contributed most hits to this object. /// Method that fills the data members from the unmatched cluster hits void FillHitInfo(COMET::IHandle hits); ClassDef(ITrackerReconECalModule::IReconECalUnmatchedObject, 1); }; public: ITrackerReconECalModule(const char *name = "TrackerECal", const char *title = "Tracker ECal Recon Module"); virtual ~ITrackerReconECalModule(); virtual Bool_t ProcessFirstEvent(COMET::ICOMETEvent& event); /// Returns true if there is at least one Recon object in the Tracker /// ECALs. If so, and -preselection=ITrackerReconECalModule is specified, /// the full oaEvent event will be output for this event virtual bool IsFullEventWorthSaving(COMET::ICOMETEvent& event); protected: virtual void InitializeModule(); virtual void InitializeBranches(); virtual bool FillTree(COMET::ICOMETEvent&); public: ///Tree Entries Int_t fNReconObjects; //! Int_t fNUnmatchedObjects; Int_t fNReconTrackLike; //! Int_t fNReconShowerLike; //! Int_t fNReconCluster; //! double total; bool fIsMC; /// TClonesArray of TECALRecon Objects TClonesArray *fReconObjects; //! TClonesArray *fUnmatchedObjects; private: ClassDef(ITrackerReconECalModule,1); }; #endif