Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-03 08:15:04

0001 #ifndef RecoConversionEval_H__
0002 #define RecoConversionEval_H__
0003 
0004 //===============================================
0005 /// \file RecoConversionEval.h
0006 /// \brief Use reco info to tag photon conversions
0007 /// \author Francesco Vassalli
0008 //===============================================
0009 #include <fun4all/SubsysReco.h>
0010 #include <GenFit/GFRaveVertex.h>
0011 #include <string>
0012 #include <cmath>
0013 namespace PHGenFit {
0014     class Track;
0015 } /* namespace PHGenFit */
0016 class PHCompositeNode;
0017 class PHG4TruthInfoContainer;
0018 class SvtxEvalStack;
0019 class SvtxVertex;
0020 class SvtxTrack;
0021 class SvtxTrackMap;
0022 class SvtxHitMap;
0023 class TrkrClusterContainer;
0024 class RawClusterContainer;
0025 class TTree;
0026 class TFile;
0027 class TLorentzVector;
0028 class SVReco;
0029 class VtxRegressor;
0030 
0031 class RecoConversionEval : public SubsysReco {
0032 
0033     public:
0034 
0035         RecoConversionEval(const std::string &name,std::string tmvamethod, std::string tmvapath);
0036         ~RecoConversionEval();
0037         int Init(PHCompositeNode *topNode);
0038         int InitRun(PHCompositeNode *topNode);
0039         void doNodePointers(PHCompositeNode *topNode);
0040         int process_event(PHCompositeNode *topNode);
0041         int End(PHCompositeNode *topNode);
0042 
0043     private:
0044         SvtxTrackMap* _allTracks=NULL;
0045         RawClusterContainer* _mainClusterContainer=NULL;
0046         TrkrClusterContainer* _clusterMap=NULL;
0047         SvtxHitMap *_hitMap=NULL;
0048         SVReco *_vertexer=NULL;
0049         std::string _fname;
0050         TFile *_file=NULL;
0051         TTree *_treeSignal=NULL;
0052         TTree *_treeBackground=NULL;
0053         VtxRegressor *_regressor=NULL;
0054 
0055         PHG4TruthInfoContainer *_truthinfo=NULL;
0056 
0057 
0058         bool hasNodePointers()const;
0059         ///Uses the TMVA method to correct the vtx radius
0060         genfit::GFRaveVertex* correctSecondaryVertex(genfit::GFRaveVertex* vtx,SvtxTrack* reco1,SvtxTrack* reco2);
0061         ///Uses {@link _vertexer} to refit \param reco1 and \param reco2
0062         std::pair<PHGenFit::Track*,PHGenFit::Track*> refitTracks(genfit::GFRaveVertex* vtx,SvtxTrack* reco1,SvtxTrack* reco2);
0063         ///Adds \param reco1 and \param reco2 as TLorentzVectors
0064         TLorentzVector* reconstructPhoton(SvtxTrack* reco1,SvtxTrack* reco2);
0065         ///Adds the {@link PHGenFit::Track}s into a TLorentVector
0066         TLorentzVector* reconstructPhoton(std::pair<PHGenFit::Track*,PHGenFit::Track*> recos);
0067         inline bool detaCut(float eta1, float eta2) const{
0068             return (eta1>eta2?eta1-eta2:eta2-eta1)<_kDetaCut;
0069         }
0070 
0071         bool pairCuts(SvtxTrack* t1, SvtxTrack* t2)const;
0072         /** Check that the radial distance between the first hit of both tracks is less the cut 
0073          * cut should be stricter for pairs with no silicone hits
0074          * also need to check the approach distance
0075          */
0076         bool hitCuts(SvtxTrack* t1, SvtxTrack* t2)const ;
0077         bool vtxCuts(genfit::GFRaveVertex* vtxCan);
0078         //!track must be closer in RZ space to the vtx than the cut
0079         bool vtxTrackRZCut(TVector3 recoVertPos, SvtxTrack* track);
0080         //!track must be closer in RPhi space to the vtx than the cut
0081         bool vtxTrackRPhiCut(TVector3 recoVertPos, SvtxTrack* track);
0082         //! vtx radius must be greater than the cut
0083         bool vtxRadiusCut(TVector3 recoVertPos);
0084     //! cut on the reconstructed photon mass and pT
0085     bool photonCuts(TLorentzVector* photon)const;
0086         /* cut on the distance between the closest point between the two tracks*/
0087         bool approachDistance(SvtxTrack *t1,SvtxTrack* t2)const;
0088         
0089         /** \defgroup variables for the TTree
0090         @{*/
0091         float _b_photon_m;
0092         float _b_photon_pT;
0093         float _b_photon_eta;
0094         float _b_photon_phi;
0095         float _b_track1_pT;
0096         float _b_track2_pT;
0097         bool _b_refit;
0098         /**@}*/
0099         /** \defgroup counts for background rejection rate
0100         @{*/
0101         unsigned totalTracks=0;
0102         unsigned passedpTEtaQ=0;
0103         unsigned passedCluster=0;
0104         unsigned passedPair=0;
0105         unsigned passedVtx=0;
0106         unsigned passedPhoton=0;
0107         /**@}*/
0108 
0109         // I want these to be static constexpr
0110         // TODO confirm these numbers
0111         unsigned int _kNSiliconLayer=7;
0112         /** \defgroup  consts for the cuts
0113         @{*/
0114         float _kTrackPtCut=2.5; 
0115         float _kEMProbCut=.0;
0116         float _kVtxRCut=1.84;
0117         float _kDetaCut=.008;
0118         float _kPhotonMmin=.27;
0119         float _kPhotonMmax=8.;
0120         float _kPhotonPTmin=0.039;
0121         int _kDLayerCut=9;
0122         /**@}*/
0123         //these are not useful
0124         float _kFirstHit=1;
0125         float _kFirstHitStrict=1;
0126         double _kApprochCut=30;
0127         float _kVtxRPhiCut=.4;
0128         float _kVtxRZCut=.4;
0129         float _kVtxChi2Cut=.4;
0130 
0131         float _kElectronRestM=.005109989461;
0132 };
0133 
0134 #endif // __RecoConversionEval_H__