9 #include <calotrigger/CaloTriggerInfo.h>
10 #include <calobase/RawCluster.h>
11 #include <calobase/RawClusterv1.h>
31 #include <GenFit/FieldManager.h>
32 #include <GenFit/GFRaveVertex.h>
33 #include <GenFit/GFRaveVertexFactory.h>
34 #include <GenFit/MeasuredStateOnPlane.h>
35 #include <GenFit/RKTrackRep.h>
36 #include <GenFit/StateOnPlane.h>
41 #include <TLorentzVector.h>
48 int particleEmbed,
int pythiaEmbed,
bool makeTTree=
true) :
SubsysReco(
"VtxTest"),
49 _kRunNumber(runnumber),_kParticleEmbed(particleEmbed), _kPythiaEmbed(pythiaEmbed), _kMakeTTree(makeTTree)
67 _tree =
new TTree(
"ttree",
"conversion data");
68 _tree->SetAutoSave(300);
71 _tree->Branch(
"nVtx", &
_b_nVtx);
74 _tree->Branch(
"rVtx",
_b_rVtx,
"rVtx[nVtx]/D");
75 _tree->Branch(
"pythia",
_b_pythia,
"pythia[nVtx]/B");
76 _tree->Branch(
"electron_pt",
_b_electron_pt,
"electron_pt[nVtx]/F");
79 _tree->Branch(
"positron_pt",
_b_positron_pt,
"positron_pt[nVtx]/F");
80 _tree->Branch(
"photon_pt",
_b_parent_pt ,
"photon_pt[nVtx]/F");
81 _tree->Branch(
"photon_eta",
_b_parent_eta ,
"photon_eta[nVtx]/F");
82 _tree->Branch(
"photon_phi",
_b_parent_phi ,
"photon_phi[nVtx]/F");
83 _tree->Branch(
"e_deta",
_b_e_deta ,
"e_deta[nTpair]/F");
84 _tree->Branch(
"e_dphi",
_b_e_dphi ,
"e_dphi[nTpair]/F");
85 _tree->Branch(
"fLayer",
_b_fLayer,
"fLayer[nTpair]/I");
87 _tree->Branch(
"nCluster",
_b_nCluster,
"nCluster[nRpair]/I");
93 _signalCutTree =
new TTree(
"cutTreeSignal",
"signal data for making track pair cuts");
156 _truthinfo = findNode::getClass<PHG4TruthInfoContainer>(topNode,
"G4TruthInfo");
157 _clusterMap = findNode::getClass<TrkrClusterContainer>(topNode,
"TRKR_CLUSTER");
161 cerr<<
Name()<<
": critical error-bad nodes \n";
163 cerr<<
"\t RawClusterContainer is bad";
166 cerr<<
"\t TruthInfoContainer is bad";
169 cerr<<
"\t TrkrClusterMap is bad";
191 cout<<
"found pion\n";
192 TLorentzVector truth;
200 if(!(*truth_vtx==*vtemp)) cout<<
"vtx does not agree"<<endl;
205 cout<<
"did not find truth_vtx"<<endl;
208 if(!svtxtrack1||!svtxtrack2){
209 cout<<
"did not find tracks"<<endl;
216 TVector3 recoVertPos = recoVert->
getPos();
217 _b_vtx_radius = sqrt(recoVertPos.x()*recoVertPos.x()+recoVertPos.y()*recoVertPos.y());
224 TVector3 tVertPos(truth_vtx->
get_x(),truth_vtx->
get_y(),truth_vtx->
get_z());
240 TVector3 tVertPos(truth_vtx->
get_x(),truth_vtx->
get_y(),truth_vtx->
get_z());
256 std::queue<std::pair<int,int>> missingChildren;
257 for (std::map<int,Conversion>::iterator
i = mymap->begin();
i != mymap->end(); ++
i) {
260 TLorentzVector tlv_photon,tlv_electron,tlv_positron;
262 temp=
i->second.getElectron();
265 cout<<
"numUnique filling tree"<<endl;
276 temp=
i->second.getPositron();
282 unsigned int nRecoTracks =
i->second.setRecoTracks(trackeval);
300 if(tlv_electron.Pt()>tlv_positron.Pt())
_b_ttrack_pT = tlv_positron.Pt();
303 pair<SvtxTrack*, SvtxTrack*> reco_tracks=
i->second.getRecoTracks();
307 TVector3 recoVertPos = recoVert->
getPos();
308 _b_vtx_radius = sqrt(recoVertPos.x()*recoVertPos.x()+recoVertPos.y()*recoVertPos.y());
325 TLorentzVector* recoPhoton =
i->second.setRecoPhoton();
344 pair<int,int> clusterIds =
i->second.get_cluster_ids();
346 if(mainClusterContainer->getCluster(clusterIds.first)){
347 clustemp =
dynamic_cast<RawCluster*
>(mainClusterContainer->getCluster(clusterIds.first)->Clone());
352 RawCluster *clus2 = mainClusterContainer->getCluster(clusterIds.second);
356 TVector3 etaCalc(clustemp->
get_x(),clustemp->
get_y(),clustemp->
get_z());
362 float eta1 = etaCalc.PseudoRapidity();
366 if (clusterIds.first!=clusterIds.second)
384 int clustidtemp=
i->second.get_cluster_id();
385 if(mainClusterContainer->getCluster(clustidtemp)){
386 RawCluster *clustemp =
dynamic_cast<RawCluster*
>(mainClusterContainer->getCluster(clustidtemp)->Clone());
397 cerr<<
Name()<<
" error setting reco tracks"<<endl;
409 return missingChildren;
414 for (std::map<int,Conversion>::iterator
i = mymap->begin();
i != mymap->end(); ++
i) {
415 int nReco=
i->second.setRecoTracks(trackeval);
426 _bb_pid =
i->second.getElectron()->get_pid();
427 pair<SvtxTrack*, SvtxTrack*> reco_tracks=
i->second.getRecoTracks();
431 TVector3 recoVertPos = recoVert->
getPos();
432 _bb_vtx_radius = sqrt(recoVertPos.x()*recoVertPos.x()+recoVertPos.y()*recoVertPos.y());
436 TLorentzVector* recoPhoton =
i->second.setRecoPhoton();
455 while(!missingChildren.empty()){
458 if(
Verbosity()>1&& iter->second->get_parent_id()==missingChildren.front().first&&iter->second->get_track_id()!=missingChildren.front().second){
459 cout<<
"Found Child:\n";
460 iter->second->identify();
461 cout<<
"With mother:\n";
465 missingChildren.pop();