Back to home page

sPhenix code displayed by LXR

 
 

    


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

0001 /**
0002  * @VtxTest.h
0003  * @author Francesco Vassalli <Francesco.Vassalli@colorado.edu>
0004  * @version 1.0
0005  *
0006  * @section Uses truth particle information to find photon conversions. 
0007  * Infomation about the conversions is recored in a TTree.
0008  * Finally they are associated with clusters for latter analysis
0009  */
0010 #ifndef TRUTHCONVERSIONEVAL_H__
0011 #define TRUTHCONVERSIONEVAL_H__
0012 
0013 #include <fun4all/SubsysReco.h>
0014 #include <calobase/RawClusterContainer.h>
0015 #include <queue>
0016 
0017 class PHCompositeNode;
0018 class PHG4TruthInfoContainer;
0019 class PHG4Particle;
0020 class PHG4VtxPoint;
0021 class Conversion;
0022 class SvtxTrackEval;
0023 class SvtxHitMap;
0024 class SvtxHit;
0025 class SvtxClusterMap;
0026 class SvtxCluster;
0027 class RawClusterContainer;
0028 class TTree;
0029 class TFile;
0030 class SVReco;
0031 class TrkrClusterContainer;
0032 
0033 class VtxTest: public SubsysReco
0034 {
0035 
0036   public:
0037     /**
0038      *
0039      * @param name name of the output file
0040      * @param runnumber printed in TTree for condor jobs
0041      * @param particleEmbed the embedID of particles embeded by Fun4All
0042      * @param pythiaEmbed the embedID for an embeded pythia event
0043      * @param makeTTree true-writes the TTree false-won't make TTree will still find clusters
0044      */
0045     VtxTest(const std::string &name,unsigned int runnumber, 
0046         int particleEmbed, int pythiaEmbed,bool makeTTree);
0047     ~VtxTest();
0048     int InitRun(PHCompositeNode*);
0049     /**
0050      * Find the conversions pass them to numUnique.
0051      * Fill the TTree
0052      * @return event status */
0053     int process_event(PHCompositeNode*);
0054     int End(PHCompositeNode*);
0055     /** get the clusters associated with converions*/
0056     const RawClusterContainer* getClusters()const;
0057 
0058   private:
0059     void doNodePointers(PHCompositeNode* topNode);
0060     /** helper function for process_event
0061      * fills the member fields with information from the conversions 
0062      * finds the clusters associated with the conversions
0063      * @return currently will return nothing 
0064      * but can easily be changed to return a structure for the converions with only 1 truth associated track*/
0065     std::queue<std::pair<int,int>> numUnique(std::map<int,Conversion>* map,SvtxTrackEval* trackEval,RawClusterContainer* mainClusterContainer);
0066     /** attempts to find other truth associated tracks for conversions with only 1 truth associated track*/
0067     void findChildren(std::queue<std::pair<int,int>> missing,PHG4TruthInfoContainer* truthinfo);
0068     /** @param map should contain Conversion objects which hold background events i.e. not conversions
0069      * fills the fields for {@link _backgroundCutTree*/
0070     void processBackground(std::map<int,Conversion>* map,SvtxTrackEval* trackEval,TTree* tree);
0071 
0072     int get_embed(PHG4Particle* particle, PHG4TruthInfoContainer* truthinfo) const;
0073     float vtoR(PHG4VtxPoint* vtx)const;
0074 
0075     const static int s_kMAXParticles=200; ///< increase this number if arrays go out of bounds
0076     const static int s_kMAXRecoMatch=20; ///< increase this number if arrays go out of bounds
0077     const unsigned int _kRunNumber;
0078     const int _kParticleEmbed; ///< primary embedID
0079     const int _kPythiaEmbed; ///< background event embedID i.e. pythia or AA
0080     const bool _kMakeTTree;//< if false no TTrees are output
0081     int _runNumber; ///<for the TTree do not change
0082     TFile *_f=NULL; ///< output file
0083     TTree *_tree=NULL; ///< stores most of the data about the conversions
0084     TTree *_signalCutTree=NULL; ///<signal data for making track pair cuts
0085     TTree *_h_backgroundCutTree=NULL; ///<hadronic background data for making track pair cuts
0086     TTree *_e_backgroundCutTree=NULL; ///<EM background data for making track pair cuts
0087     RawClusterContainer *_mainClusterContainer; ///< contain 1 cluster associated with each conversion
0088     PHG4TruthInfoContainer *_truthinfo;
0089     TrkrClusterContainer* _clusterMap;
0090     SvtxHitMap *_hitMap;
0091     std::string _foutname; ///< name of the output file
0092     SVReco *_vertexer=NULL; ///< for reco vertex finding
0093     /** \defgroup mainTreeVars Variables for {@link _tree}
0094       @{*/
0095     int _b_event;
0096     int _b_nVtx;  ///<total conversions
0097     int _b_Tpair; ///<count acceptance e pairs in truth
0098     int _b_Rpair; ///<count acceptance e pairs in reco
0099     double _b_rVtx[s_kMAXParticles];  ///<truth conversion radius used for the signal tree
0100     bool _b_pythia[s_kMAXParticles];  ///<record if the conversion is from pythia or G4 particle
0101     float _b_electron_pt[s_kMAXParticles];
0102     float _b_positron_pt[s_kMAXParticles];
0103     float _b_electron_reco_pt[s_kMAXParticles];
0104     float _b_positron_reco_pt[s_kMAXParticles];
0105     float _b_e_deta[s_kMAXParticles];
0106     float _b_e_dphi[s_kMAXParticles];
0107     float _b_parent_pt  [s_kMAXParticles];
0108     float _b_parent_eta [s_kMAXParticles];
0109     float _b_parent_phi [s_kMAXParticles];
0110     int   _b_grandparent_id [s_kMAXParticles]; ///<pid of the source of the photon 0 for prompt
0111     /** # of clusters associated with each conversion that has 2 reco tracks
0112     * 1 indicates the reco tracks go to the same cluster ~15% of conversions*/
0113     int   _b_nCluster [s_kMAXRecoMatch]; 
0114     int   _b_fLayer [s_kMAXRecoMatch]; 
0115     float _b_cluster_dphi [s_kMAXRecoMatch];
0116     float _b_cluster_deta [s_kMAXRecoMatch];
0117     float _b_Mcluster_prob[s_kMAXRecoMatch]; ///<cluster prob for merged clusters
0118     float _b_Scluster_prob[s_kMAXRecoMatch]; ///<cluster prob for split clusters
0119     /**@}*/
0120     /** \defgroup signalTreeVars Variables for {@link _signalCutTree}
0121       @{*/
0122     float _b_track_deta ;
0123     int _b_track_layer ;
0124     int _b_track_dlayer ;
0125     float _b_track_pT;
0126     float _b_ttrack_pT;
0127     double _b_approach  ;
0128     double _b_vtx_radius ;
0129     double _b_vtx_phi ;
0130     double _b_vtx_eta ;
0131     double _b_vtx_x ;
0132     double _b_vtx_y ;
0133     double _b_vtx_z ;
0134     double _b_tvtx_eta ;
0135     double _b_tvtx_x ;
0136     double _b_tvtx_y ;
0137     double _b_tvtx_z ;
0138     double _b_tvtx_radius ;
0139     double _b_tvtx_phi ;
0140     double _b_vtxTrack_dist;
0141     float _b_vtx_chi2;
0142     float _b_photon_m;
0143     float _b_photon_pT;
0144     float _b_cluster_prob;
0145     float _b_track_dphi;
0146     /**@}*/
0147     /** \defgroup backTreeVars Variables for {@link _signalCutTree}
0148       @{*/
0149     //bb stands for background branch
0150     float _bb_track_deta ;
0151     int _bb_track_layer ;
0152     int _bb_track_dlayer ;
0153     float _bb_track_pT;
0154     double _bb_approach ;
0155     double _bb_vtx_radius;
0156     double _bb_vtxTrack_dist;
0157     float _bb_vtx_chi2;
0158     float _bb_photon_m;
0159     float _bb_photon_pT;
0160     float _bb_cluster_prob;
0161     float _bb_track_dphi;
0162     int _bb_pid;
0163     /**@}*/
0164     /** RawClusters associated with truth conversions
0165      * processed by other modules*/
0166     RawClusterContainer _conversionClusters;
0167 
0168     const static int s_kTPCRADIUS=21; //in cm there is a way to get this from the simulation I should implement?
0169     ///<TPC radius currently hardcoded
0170     float _kRAPIDITYACCEPT=1; //<acceptance rapidity currently hard coded to |1|
0171 };
0172 
0173 
0174 
0175 #endif // __TRUTHCONVERSIONEVAL_H__
0176 
0177 
0178