6 #include <phgenfit/Track.h>
8 #include <trackbase_historic/SvtxCluster.h>
9 #include <trackbase_historic/SvtxHitMap.h>
11 #include <trackbase_historic/SvtxVertex_v1.h>
72 std::cout<<
"WARNING in Conversion oversetting conversion electrons"<<std::endl;
99 std::cout<<
"Warning in Conversion bad charges in conversion"<<std::endl;
109 std::cout<<
"Warning in Conversion no truth tracks set"<<std::endl;
136 if(!(*
photon==*parent)) cerr<<
"Bad photon matching!"<<endl;
143 if(!
setParent(parent)) cerr<<
"Bad photon matching during primary photon set"<<endl;
153 if(!recoTrack)
return;
267 if(!(reco1&&reco2))
return NULL;
272 return new TLorentzVector(tlv1+tlv2);
277 if (refit_tlvs.first&&refit_tlvs.second)
280 recoPhoton=
new TLorentzVector(*refit_tlvs.first + *refit_tlvs.second);
286 std::pair<TLorentzVector*,TLorentzVector*>
r;
289 r.first =
new TLorentzVector();
292 r.second =
new TLorentzVector();
298 r.first =
new TLorentzVector();
305 r.second =
new TLorentzVector ();
319 std::pair<TLorentzVector*,TLorentzVector*>
r;
322 r.first =
new TLorentzVector();
324 r.second =
new TLorentzVector();
363 cout<<
"bad reco"<<endl;
383 return std::pair<int,int>(-1,-1);
441 float dR = sqrt(recoVertPos.x()*recoVertPos.x()+recoVertPos.y()*recoVertPos.y())-sqrt(track->
get_x()*track->
get_x()+track->
get_y()*track->
get_y());
442 float dZ = recoVertPos.z()-track->
get_z();
443 return sqrt(dR*dR+dZ*dZ);
447 float vtxR=sqrt(recoVertPos.x()*recoVertPos.x()+recoVertPos.y()*recoVertPos.y());
449 return sqrt(vtxR*vtxR+trackR*trackR-2*vtxR*trackR*cos(recoVertPos.Phi()-track->
get_phi()));
456 SvtxHit *
h1 = hitmap->get(*(c1->begin_hits()));
457 SvtxHit *
h2 = hitmap->get(*(c2->begin_hits()));
458 int l1 = h1->get_layer();
459 int l2 = h2->get_layer();
494 SvtxHit *
h1 = hitmap->get(*(c1->begin_hits()));
495 SvtxHit *
h2 = hitmap->get(*(c2->begin_hits()));
496 if(h1->get_layer()>h2->get_layer()){
497 return h2->get_layer();
499 else return h1->get_layer();
538 double r1 = sqrt(abs(c1->get_x()-recovtx->
get_x())+abs(c1->get_y()-recovtx->
get_y())+abs(c1->get_z()-recovtx->
get_z()));
539 double r2 = sqrt(abs(c2->get_x()-recovtx->
get_x())+abs(c2->get_y()-recovtx->
get_y())+abs(c2->get_z()-recovtx->
get_z()));
550 double r1 = sqrt(abs(c1->get_x()-recovtx->x())+abs(c1->get_y()-recovtx->y())+abs(c1->get_z()-recovtx->z()));
551 double r2 = sqrt(abs(c2->get_x()-recovtx->x())+abs(c2->get_y()-recovtx->y())+abs(c2->get_z()-recovtx->z()));
562 double r1 = sqrt(abs(c1->
getX()-recovtx->x())+abs(c1->
getY()-recovtx->y())+abs(c1->
getZ()-recovtx->z()));
563 double r2 = sqrt(abs(c2->
getX()-recovtx->x())+abs(c2->
getY()-recovtx->y())+abs(c2->
getZ()-recovtx->z()));
572 cout<<
"Conversion with truth info:\n";
579 cout<<
"Conversion with reco info:\n";
587 if(!
recoPhoton) cerr<<
"No photon reconstructed"<<endl;
598 if(!
recoPhoton) cerr<<
"No photon reconstructed"<<endl;
600 cout<<
"Truth Track: ";tlv_electron->Print();
602 cout<<
"Truth Track: ";tlv_positron->Print();
604 cout<<
"Truth Photon: ";tlv_photon->Print();
605 cout<<
"Reco Photon with mass: "<<mass<<
": ";
recoPhoton->Print();
626 static const double eps = 0.000001;
637 double D = a*c - b*
b;
642 tc = (b>c ? d/b : e/
c);
645 sc = (b*e - c*d) / D;
646 tc = (a*e - b*d) / D;
667 static const double eps = 0.000001;
678 double D = a*c - b*
b;
683 tc = (b>c ? d/b : e/
c);
686 sc = (b*e - c*d) / D;
687 tc = (a*e - b*d) / D;
729 else return std::pair<float,float>(-1,
reco2->
get_pt());
732 return std::pair<float,float>(-1,-1);
743 else return std::pair<float,float>(-1,
reco2->
get_eta());
746 return std::pair<float,float>(-1,-1);
757 else return std::pair<float,float>(-1,
reco2->
get_phi());
760 return std::pair<float,float>(-1,-1);
783 cerr<<
"WARNING: no vertex to correct"<<endl;
788 cerr<<
"WARNING: no reco tracks to do vertex correction"<<endl;
795 using namespace genfit;
797 std::vector<GFRaveTrackParameters*>
tracks;
808 cerr<<
"WARNING: no vertex to correct"<<endl;
813 cerr<<
"WARNING: no reco tracks to do vertex correction"<<endl;
817 TVector3 nextPos = recoVertex->
getPos();
818 nextPos.SetMagThetaPhi(regressor->
regress(reco1,reco2,recoVertex),nextPos.Theta(),nextPos.Phi());
820 using namespace genfit;
822 std::vector<GFRaveTrackParameters*>
tracks;
832 std::pair<PHGenFit::Track*,PHGenFit::Track*>
r;
859 cerr<<
"WARNING: No vertex to refit tracks"<<endl;
873 cerr<<
"WARNING: No vertex to refit tracks"<<endl;
896 double d = rand.Gaus(0, ae);
897 double g = rand.Gaus(0, ae);
898 double h = rand.Gaus(0, i);
930 for (
int i = 0;
i < 3; ++
i)
932 for (
int j = 0;
j < 3; ++
j)