File indexing completed on 2025-08-03 08:15:03
0001
0002
0003
0004
0005
0006
0007
0008
0009 #ifndef CONVERSION_H__
0010 #define CONVERSION_H__
0011
0012 #include <g4main/PHG4Particle.h>
0013 #include <g4main/PHG4VtxPoint.h>
0014 #include <trackbase_historic/SvtxTrack.h>
0015 #include <trackbase_historic/SvtxClusterMap.h>
0016 #include <trackbase_historic/SvtxVertex.h>
0017 #include <g4eval/SvtxTrackEval.h>
0018 #include <GenFit/GFRaveVertex.h>
0019 #include <TLorentzVector.h>
0020 #include <TVector3.h>
0021 #include <utility>
0022
0023 namespace PHGenFit {
0024 class Track;
0025 }
0026
0027
0028 class SvtxTrackEval;
0029 class PHCompositeNode;
0030 class PHG4TruthInfoContainer;
0031 class TLorentzVector;
0032 class SvtxHitMap;
0033 class SVReco;
0034 class VtxRegressor;
0035
0036
0037 class Conversion
0038 {
0039 public:
0040 Conversion(){verbosity=0;}
0041 Conversion(SvtxTrackEval* trackeval,int verbosity=0);
0042 Conversion(PHG4VtxPoint* vtx,int verbosity=0);
0043 Conversion(PHG4VtxPoint* vtx,SvtxTrackEval *trackeval,int verbosity=0);
0044 ~Conversion();
0045
0046
0047
0048 void setElectron(PHG4Particle* e);
0049 inline void setTrackEval(SvtxTrackEval *trackeval){this->trackeval=trackeval;}
0050 inline void setVtx(PHG4VtxPoint* vtx){this->vtx=vtx;}
0051 inline PHG4VtxPoint* getVtx()const{return vtx;}
0052
0053 inline bool isComplete()const{
0054 if (e1&&e2&&photon)
0055 {
0056 return true;
0057 }
0058 else{
0059 return false;
0060 }
0061 }
0062
0063 inline bool hasPair()const{
0064 if (e1&&e2)
0065 {
0066 return true;
0067 }
0068 else{
0069 return false;
0070 }
0071 }
0072
0073 bool setParent(PHG4Particle* parent);
0074
0075
0076 void setPrimaryPhoton(PHG4Particle* parent,PHG4TruthInfoContainer* truthinfo);
0077
0078
0079 inline int recoCount()const{
0080 int r=0;
0081 if (reco1)
0082 {
0083 r++;
0084 }
0085 if (reco2)
0086 {
0087 r++;
0088 }
0089 return r;
0090 }
0091
0092 PHG4Particle* getElectron();
0093
0094 inline PHG4Particle* getElectron()const{return e1;}
0095
0096 PHG4Particle* getPositron();
0097
0098 inline PHG4Particle* getPositron()const{return e2;}
0099 inline PHG4Particle* getPhoton()const{return photon;}
0100 inline PHG4Particle* getPrimaryPhoton()const{return primaryPhoton;}
0101 inline int getEmbed() const {return embedID;}
0102
0103 inline void setEmbed(int embedID) {this->embedID=embedID;}
0104 inline void setSourceId(int source){sourceId=source;}
0105 inline int getSourceId()const{return sourceId;}
0106 inline genfit::GFRaveVertex* getRecoVtx()const{return recoVertex;}
0107
0108
0109 float trackDEta()const;
0110 static float trackDEta(SvtxTrack* reco1, SvtxTrack* reco2);
0111
0112
0113 inline float trackDPhi()const{
0114 if (recoCount()==2)
0115 {
0116 return DeltaPhi(reco1->get_phi(),reco2->get_phi());
0117 }
0118 else return -1.;
0119 }
0120 inline static float trackDPhi(SvtxTrack* reco1, SvtxTrack* reco2){
0121 return DeltaPhi(reco1->get_phi(),reco2->get_phi());
0122 }
0123
0124 float minTrackpT();
0125 std::pair<float,float> getTrackpTs();
0126 std::pair<float,float> getTrackEtas();
0127 std::pair<float,float> getTrackPhis();
0128 inline std::pair<SvtxTrack*,SvtxTrack*> getRecoTracks()const{
0129 return std::pair<SvtxTrack*,SvtxTrack*>(reco1,reco2);
0130 }
0131
0132 SvtxTrack* getRecoTrack(unsigned truthID) const;
0133
0134
0135 inline void setClusterMap(SvtxClusterMap* cmap){
0136 _svtxClusterMap=cmap;
0137 }
0138 inline int setVerbosity(int v){
0139 verbosity=v;
0140 return verbosity;
0141 }
0142
0143
0144
0145
0146 int get_cluster_id();
0147
0148
0149 int get_cluster_id()const;
0150
0151
0152
0153 int get_cluster_id(SvtxTrackEval *trackeval);
0154
0155
0156
0157 std::pair<int,int> get_cluster_ids();
0158
0159
0160
0161 int setRecoTracks(SvtxTrackEval* trackeval);
0162 int setRecoTracks();
0163
0164
0165
0166 void setRecoTrack(int truthID, SvtxTrack* recoTrack);
0167
0168
0169
0170
0171 bool setElectron();
0172
0173
0174 int trackDLayer(SvtxClusterMap* cmap,SvtxHitMap *hitmap);
0175 int trackDLayer(TrkrClusterContainer* );
0176 static int trackDLayer(TrkrClusterContainer*,SvtxTrack*,SvtxTrack* );
0177
0178 int firstLayer(SvtxClusterMap* cmap,SvtxHitMap *hitmap);
0179 int firstLayer(TrkrClusterContainer* );
0180
0181 bool hasSilicon(SvtxClusterMap* );
0182
0183
0184 double approachDistance()const;
0185 static double approachDistance(SvtxTrack*,SvtxTrack*);
0186
0187 double dist(PHG4VtxPoint* vtx, SvtxClusterMap* cmap);
0188 double dist(TVector3* vtx, SvtxClusterMap* cmap);
0189 double dist(TVector3* vtx, TrkrClusterContainer* cmap);
0190
0191 float minDca();
0192
0193 float vtxTrackRPhi(TVector3 vertpos);
0194 static float vtxTrackRPhi(TVector3 vertpos,SvtxTrack*,SvtxTrack*);
0195
0196 float vtxTrackRZ(TVector3 vertpos);
0197 static float vtxTrackRZ(TVector3 vertpos,SvtxTrack*,SvtxTrack*);
0198
0199
0200
0201 TLorentzVector* setRecoPhoton();
0202 TLorentzVector* getRecoPhoton();
0203 static TLorentzVector* getRecoPhoton(SvtxTrack* reco1, SvtxTrack* reco2);
0204
0205 TLorentzVector* getRefitRecoPhoton();
0206 PHG4Particle* getTruthPhoton(PHG4TruthInfoContainer*);
0207
0208 std::pair<PHGenFit::Track*,PHGenFit::Track*> refitTracks(SVReco* vertexer, SvtxVertex* recoVtx);
0209
0210 std::pair<PHGenFit::Track*,PHGenFit::Track*> refitTracks(SVReco* vertexer);
0211
0212
0213 std::pair<PHGenFit::Track*,PHGenFit::Track*> refitTracksTruthVtx(SVReco* vertexer);
0214
0215 std::pair<PHGenFit::Track*,PHGenFit::Track*> refitTracksTruthVtx(SVReco* vertexer,SvtxVertex* seedVtx);
0216
0217
0218 genfit::GFRaveVertex* getSecondaryVertex(SVReco* vertexer);
0219
0220 std::pair<PHGenFit::Track*,PHGenFit::Track*> getPHGFTracks(SVReco* vertexer);
0221
0222
0223
0224 std::pair<TLorentzVector*,TLorentzVector*> getRecoTlvs();
0225
0226
0227
0228 std::pair<TLorentzVector*,TLorentzVector*> getRefitRecoTlvs();
0229
0230
0231
0232 std::pair<PHG4Particle*,PHG4Particle*> getParticlesMissingTrack();
0233
0234 genfit::GFRaveVertex* correctSecondaryVertex(VtxRegressor* regressor);
0235 static genfit::GFRaveVertex* correctSecondaryVertex(VtxRegressor* regressor,genfit::GFRaveVertex*, SvtxTrack* reco1, SvtxTrack* reco2);
0236
0237
0238
0239 inline static double InTwoPi (double phi) {
0240 while (phi < 0 || 2*TMath::Pi() <= phi) {
0241 if (phi < 0) phi += 2*TMath::Pi();
0242 else phi -= 2*TMath::Pi();
0243 }
0244 return phi;
0245 }
0246
0247
0248
0249
0250 inline static double DeltaPhi (double phi1, double phi2) {
0251 phi1 = InTwoPi(phi1);
0252 phi2 = InTwoPi(phi2);
0253 double dphi = abs(phi1 - phi2);
0254 while (dphi > TMath::Pi()) dphi = abs (dphi - 2*TMath::Pi());
0255 return dphi;
0256 }
0257
0258
0259 void printTruth();
0260
0261 void printReco();
0262
0263 void PrintPhotonRecoInfo();
0264 void PrintPhotonRecoInfo(TLorentzVector *tlv_photon,TLorentzVector *tlv_electron, TLorentzVector *tlv_positron,float mass);
0265 private:
0266 PHG4Particle* e1=NULL;
0267 PHG4Particle* e2=NULL;
0268 PHG4Particle* photon=NULL;
0269 PHG4Particle* primaryPhoton=NULL;
0270 PHG4VtxPoint* vtx=NULL;
0271 SvtxVertex* truthSvtxVtx=NULL;
0272 SvtxTrack* reco1=NULL;
0273 SvtxTrack* reco2=NULL;
0274 SvtxTrackEval* trackeval=NULL;
0275 SvtxClusterMap* _svtxClusterMap=NULL;
0276 genfit::GFRaveVertex *recoVertex=NULL;
0277 TLorentzVector *recoPhoton=NULL;
0278 std::pair<PHGenFit::Track*,PHGenFit::Track*> _refit_phgf_tracks;
0279 std::pair<unsigned,unsigned> pairTruthReco1;
0280 std::pair<unsigned,unsigned> pairTruthReco2;
0281
0282 static const int _kNSiliconLayer =7;
0283 int embedID=0;
0284 int verbosity;
0285 int sourceId;
0286 static const float _kElectronRestM;
0287
0288 static float vtxTrackRZ(TVector3 recoVertPos,SvtxTrack *track);
0289
0290 static float vtxTrackRPhi(TVector3 recoVertPos,SvtxTrack *track);
0291
0292
0293
0294
0295 void PHG4VtxPointToSvtxVertex();
0296
0297
0298
0299
0300 void PHG4VtxPointToSvtxVertex(SvtxVertex* seedVtx);
0301
0302 };
0303 #endif