64 unsigned int nlayers_maps,
65 unsigned int nlayers_intt,
66 unsigned int nlayers_tpc,
67 unsigned int nlayers_mms)
72 , _svtxevalstack(nullptr)
76 , _do_vertex_eval(
true)
77 , _do_gpoint_eval(
true)
78 , _do_g4hit_eval(
true)
80 , _do_cluster_eval(
true)
81 , _do_g4cluster_eval(
true)
82 , _do_gtrack_eval(
true)
83 , _do_track_eval(
true)
84 , _do_gseed_eval(
false)
85 , _do_track_match(
true)
86 , _do_eval_light(
true)
87 , _do_vtx_eval_light(
true)
88 , _scan_for_embedded(
false)
89 , _scan_for_primaries(
false)
90 , _nlayers_maps(nlayers_maps)
91 , _nlayers_intt(nlayers_intt)
92 , _nlayers_tpc(nlayers_tpc)
93 , _nlayers_mms(nlayers_mms)
95 , _ntp_vertex(nullptr)
96 , _ntp_gpoint(nullptr)
99 , _ntp_cluster(nullptr)
100 , _ntp_g4cluster(nullptr)
101 , _ntp_gtrack(nullptr)
102 , _ntp_track(nullptr)
103 , _ntp_gseed(nullptr)
104 , _filename(filename)
105 , _trackmapname(trackmapname)
121 _tfile->SetCompressionLevel(0);
124 "occ11:occ116:occ21:occ216:occ31:occ316:"
125 "gntrkall:gntrkprim:ntrk:"
126 "nhittpcall:nhittpcin:nhittpcmid:nhittpcout:nclusall:nclustpc:nclusintt:nclusmaps:nclusmms");
129 "event:seed:vx:vy:vz:ntracks:chi2:ndof:"
130 "gvx:gvy:gvz:gvt:gembed:gntracks:gntracksmaps:"
131 "gnembed:nfromtruth:"
132 "nhittpcall:nhittpcin:nhittpcmid:nhittpcout:nclusall:nclustpc:nclusintt:nclusmaps:nclusmms");
137 "event:seed:gvx:gvy:gvz:gvt:gntracks:gembed:"
140 "nhittpcall:nhittpcin:nhittpcmid:nhittpcout:nclusall:nclustpc:nclusintt:nclusmaps:nclusmms");
143 "event:seed:g4hitID:gx:gy:gz:gt:gpl:gedep:geta:gphi:"
145 "glayer:gtrackID:gflavor:"
148 "gfpx:gfpy:gfpz:gfx:gfy:gfz:"
149 "gembed:gprimary:nclusters:"
150 "clusID:x:y:z:eta:phi:e:adc:layer:size:"
151 "efromtruth:dphitru:detatru:dztru:drtru:"
152 "nhittpcall:nhittpcin:nhittpcmid:nhittpcout:nclusall:nclustpc:nclusintt:nclusmaps:nclusmms");
155 "event:seed:hitID:e:adc:layer:phielem:zelem:"
156 "cellID:ecell:phibin:zbin:phi:z:"
157 "g4hitID:gedep:gx:gy:gz:gt:"
159 "gpx:gpy:gpz:gvx:gvy:gvz:gvt:"
160 "gfpx:gfpy:gfpz:gfx:gfy:gfz:"
161 "gembed:gprimary:efromtruth:"
162 "nhittpcall:nhittpcin:nhittpcmid:nhittpcout:nclusall:nclustpc:nclusintt:nclusmaps:nclusmms");
165 "event:seed:hitID:x:y:z:r:phi:eta:theta:ex:ey:ez:ephi:"
166 "e:adc:maxadc:layer:phielem:zelem:size:"
167 "trackID:niter:g4hitID:gx:"
168 "gy:gz:gr:gphi:geta:gt:gtrackID:gflavor:"
169 "gpx:gpy:gpz:gvx:gvy:gvz:gvt:"
170 "gfpx:gfpy:gfpz:gfx:gfy:gfz:"
171 "gembed:gprimary:efromtruth:nparticles:"
172 "nhittpcall:nhittpcin:nhittpcmid:nhittpcout:nclusall:nclustpc:nclusintt:nclusmaps:nclusmms");
175 "event:layer:gx:gy:gz:gt:gedep:gr:gphi:geta:gtrackID:gflavor:gembed:gprimary:gphisize:gzsize:gadc:nreco:x:y:z:r:phi:eta:ex:ey:ez:ephi:adc");
178 "event:seed:gntracks:gtrackID:gflavor:gnhits:gnmaps:gnintt:gnmms:"
179 "gnintt1:gnintt2:gnintt3:gnintt4:"
180 "gnintt5:gnintt6:gnintt7:gnintt8:"
181 "gntpc:gnlmaps:gnlintt:gnltpc:gnlmms:"
182 "gpx:gpy:gpz:gpt:geta:gphi:"
184 "gfpx:gfpy:gfpz:gfx:gfy:gfz:"
186 "trackID:px:py:pz:pt:eta:phi:deltapt:deltaeta:deltaphi:"
187 "charge:quality:chisq:ndf:nhits:layers:nmaps:nintt:ntpc:nmms:ntpc1:ntpc11:ntpc2:ntpc3:nlmaps:nlintt:nltpc:nlmms:"
188 "dca2d:dca2dsigma:dca3dxy:dca3dxysigma:dca3dz:dca3dzsigma:pcax:pcay:pcaz:nfromtruth:nwrong:ntrumaps:ntruintt:ntrutpc:ntrumms:ntrutpc1:ntrutpc11:ntrutpc2:ntrutpc3:layersfromtruth:"
189 "nhittpcall:nhittpcin:nhittpcmid:nhittpcout:nclusall:nclustpc:nclusintt:nclusmaps:nclusmms");
192 "event:seed:trackID:px:py:pz:pt:eta:phi:deltapt:deltaeta:deltaphi:charge:"
193 "quality:chisq:ndf:nhits:nmaps:nintt:ntpc:nmms:ntpc1:ntpc11:ntpc2:ntpc3:nlmaps:nlintt:nltpc:nlmms:layers:"
194 "dca2d:dca2dsigma:dca3dxy:dca3dxysigma:dca3dz:dca3dzsigma:pcax:pcay:pcaz:"
195 "presdphi:presdeta:prese3x3:prese:"
196 "cemcdphi:cemcdeta:cemce3x3:cemce:"
197 "hcalindphi:hcalindeta:hcaline3x3:hcaline:"
198 "hcaloutdphi:hcaloutdeta:hcaloute3x3:hcaloute:"
199 "gtrackID:gflavor:gnhits:gnmaps:gnintt:gntpc:gnmms:gnlmaps:gnlintt:gnltpc:gnlmms:"
200 "gpx:gpy:gpz:gpt:geta:gphi:"
202 "gfpx:gfpy:gfpz:gfx:gfy:gfz:"
203 "gembed:gprimary:nfromtruth:nwrong:ntrumaps:ntruintt:"
204 "ntrutpc:ntrumms:ntrutpc1:ntrutpc11:ntrutpc2:ntrutpc3:layersfromtruth:"
205 "nhittpcall:nhittpcin:nhittpcmid:nhittpcout:nclusall:nclustpc:nclusintt:nclusmaps:nclusmms");
208 "event:seed:ntrk:gx:gy:gz:gr:geta:gphi:"
210 "gpx:gpy:gpz:gtpt:gtphi:gteta:"
212 "gembed:gprimary:gflav:"
214 "nhittpcall:nhittpcin:nhittpcmid:nhittpcout:nclusall:nclustpc:nclusintt:nclusmaps:nclusmms");
231 cout <<
"SvtxEvaluator::process_event - Event = " <<
_ievent << endl;
248 cout <<
"SvtxEvaluator::process_event - Seed = " <<
_iseed << endl;
308 cout <<
"========================= SvtxEvaluator::End() ============================" << endl;
309 cout <<
" " <<
_ievent <<
" events of output written to: " <<
_filename << endl;
310 cout <<
"===========================================================================" << endl;
321 cout <<
"SvtxEvaluator::End() - Error Count: " <<
_errors << endl;
333 if (
Verbosity() > 1) cout <<
"SvtxEvaluator::printInputInfo() entered" << endl;
342 cout <<
"---PHG4HITS-------------" << endl;
345 unsigned int ig4hit = 0;
346 for (std::set<PHG4Hit*>::iterator iter = g4hits.begin();
347 iter != g4hits.end();
351 cout << ig4hit <<
" of " << g4hits.size();
352 cout <<
": PHG4Hit: " << endl;
357 cout <<
"---SVTXCLUSTERS-------------" << endl;
358 TrkrClusterContainer* clustermap = findNode::getClass<TrkrClusterContainer>(topNode,
"CORRECTED_TRKR_CLUSTER");
360 clustermap = findNode::getClass<TrkrClusterContainer>(topNode,
"TRKR_CLUSTER");
362 TrkrHitSetContainer* hitsets = findNode::getClass<TrkrHitSetContainer>(topNode,
"TRKR_HITSET");
364 if (clustermap!=
nullptr&&hitsets!=
nullptr){
365 unsigned int icluster = 0;
367 for (
auto hitsetitr = hitsetrange.first;
368 hitsetitr != hitsetrange.second;
370 auto range = clustermap->
getClusters(hitsetitr->first);
371 for(
auto iter = range.first; iter != range.second; ++iter ){
373 cout << icluster <<
" with key " << cluster_key <<
" of " << clustermap->
size();
374 cout <<
": SvtxCluster: " << endl;
375 iter->second->identify();
381 cout <<
"---SVXTRACKS-------------" << endl;
385 unsigned int itrack = 0;
387 iter != trackmap->
end();
390 cout << itrack <<
" of " << trackmap->
size();
392 cout <<
" : SvtxTrack:" << endl;
399 cout <<
"---SVXVERTEXES-------------" << endl;
402 vertexmap = findNode::getClass<SvtxVertexMap>(topNode,
"SvtxVertexMap");
404 vertexmap = findNode::getClass<SvtxVertexMap>(topNode,
"SvtxVertexMapRefit");
406 vertexmap = findNode::getClass<SvtxVertexMap>(topNode,
"SvtxVertexMapActs");
410 unsigned int ivertex = 0;
412 iter != vertexmap->end();
415 cout << ivertex <<
" of " << vertexmap->
size();
417 cout <<
" : SvtxVertex:" << endl;
429 if (
Verbosity() > 1) cout <<
"SvtxEvaluator::printOutputInfo() entered" << endl;
449 float gvx = gvertex->
get_x();
450 float gvy = gvertex->get_y();
451 float gvz = gvertex->get_z();
459 vertexmap = findNode::getClass<SvtxVertexMap>(topNode,
"SvtxVertexMap");
461 vertexmap = findNode::getClass<SvtxVertexMap>(topNode,
"SvtxVertexMapRefit");
463 vertexmap = findNode::getClass<SvtxVertexMap>(topNode,
"SvtxVertexMapActs");
467 if (!vertexmap->empty())
469 SvtxVertex* vertex = (vertexmap->begin()->second);
471 vx = vertex->
get_x();
472 vy = vertex->
get_y();
473 vz = vertex->
get_z();
477 cout <<
"===Vertex Reconstruction=======================" << endl;
478 cout <<
"vtrue = (" << gvx <<
"," << gvy <<
"," << gvz <<
") => vreco = (" << vx <<
"," << vy <<
"," << vz <<
")" << endl;
481 cout <<
"===Tracking Summary============================" << endl;
482 unsigned int ng4hits[100] = {0};
484 for (std::set<PHG4Hit*>::iterator iter = g4hits.begin();
485 iter != g4hits.end();
492 TrkrHitSetContainer *hitsetmap = findNode::getClass<TrkrHitSetContainer>(topNode,
"TRKR_HITSET");
494 TrkrClusterContainer* clustermap = findNode::getClass<TrkrClusterContainer>(topNode,
"CORRECTED_TRKR_CLUSTER");
496 clustermap = findNode::getClass<TrkrClusterContainer>(topNode,
"TRKR_CLUSTER");
498 unsigned int nclusters[100] = {0};
499 unsigned int nhits[100] = {0};
501 ActsTrackingGeometry *tgeometry = findNode::getClass<ActsTrackingGeometry>(topNode,
"ActsTrackingGeometry");
502 ActsSurfaceMaps *surfmaps = findNode::getClass<ActsSurfaceMaps>(topNode,
"ActsSurfaceMaps");
503 if(!tgeometry or !surfmaps)
505 std::cout <<
PHWHERE <<
"No Acts geometry on node tree. Can't continue."
513 hitsetiter != all_hitsets.second;
521 hitr != hitrangei.second;
526 auto range = clustermap->getClusters(hitsetiter->first);
527 for(
auto clusIter = range.first; clusIter != range.second; ++clusIter ){
528 const auto cluskey = clusIter->first;
537 findNode::getClass<PHG4CylinderCellGeomContainer>(topNode,
"CYLINDERCELLGEOM_SVTX");
540 std::cout <<
PHWHERE <<
"ERROR: Can't find node CYLINDERCELLGEOM_SVTX" << std::endl;
549 cout <<
"layer " << ilayer <<
": nG4hits = " << ng4hits[ilayer]
550 <<
" => nHits = " << nhits[ilayer]
551 <<
" => nClusters = " << nclusters[ilayer] << endl;
553 cout <<
"layer " << ilayer
564 cout <<
" => nTracks = ";
566 cout << trackmap->
size() << endl;
573 for (std::set<PHG4Hit*>::iterator iter = g4hits.begin();
574 iter != g4hits.end();
580 cout <<
"===PHG4Hit===================================" << endl;
581 cout <<
" PHG4Hit: ";
586 for (std::set<TrkrDefs::cluskey>::iterator jter = clusters.begin();
587 jter != clusters.end();
591 cout <<
"===Created-SvtxCluster================" << endl;
592 cout <<
"SvtxCluster: ";
593 TrkrCluster *cluster = clustermap->findCluster(cluster_key);
600 iter != range.second;
608 cout <<
"=== Gtrack ===================================================" << endl;
609 cout <<
" PHG4Particle id = " << particle->
get_track_id() << endl;
611 cout <<
" ptrue = (";
613 cout << particle->
get_px();
616 cout << particle->
get_py();
619 cout << particle->
get_pz();
622 cout <<
" vtrue = (";
633 cout <<
" pt = " << sqrt(pow(particle->
get_px(), 2) + pow(particle->
get_py(), 2)) << endl;
634 cout <<
" phi = " << atan2(particle->
get_py(), particle->
get_px()) << endl;
635 cout <<
" eta = " << asinh(particle->
get_pz() / sqrt(pow(particle->
get_px(), 2) + pow(particle->
get_py(), 2))) << endl;
639 cout <<
" ---Associated-PHG4Hits-----------------------------------------" << endl;
641 for (std::set<PHG4Hit*>::iterator jter = g4hits.begin();
642 jter != g4hits.end();
647 float x = 0.5 * (g4hit->
get_x(0) + g4hit->
get_x(1));
648 float y = 0.5 * (g4hit->
get_y(0) + g4hit->
get_y(1));
649 float z = 0.5 * (g4hit->
get_z(0) + g4hit->
get_z(1));
651 cout <<
" #" << g4hit->
get_hit_id() <<
" xtrue = (";
663 for (std::set<TrkrDefs::cluskey>::iterator kter = clusters.begin();
664 kter != clusters.end();
669 TrkrCluster *cluster = clustermap->findCluster(cluster_key);
676 cout <<
" => #" << cluster_key;
677 cout <<
" xreco = (";
692 if (trackmap && clustermap)
695 for (std::set<SvtxTrack*>::iterator jter = tracks.begin();
696 jter != tracks.end();
701 float px = track->
get_px();
702 float py = track->
get_py();
703 float pz = track->
get_pz();
705 cout <<
"===Created-SvtxTrack==========================================" << endl;
706 cout <<
" SvtxTrack id = " << track->
get_id() << endl;
707 cout <<
" preco = (";
717 cout <<
" quality = " << track->
get_quality() << endl;
720 cout <<
" ---Associated-SvtxClusters-to-PHG4Hits-------------------------" << endl;
727 TrkrCluster *cluster = clustermap->findCluster(cluster_key);
734 cout <<
" #" << cluster_key <<
" xreco = (";
748 x = 0.5 * (g4hit->
get_x(0) + g4hit->
get_x(1));
749 y = 0.5 * (g4hit->
get_y(0) + g4hit->
get_y(1));
750 z = 0.5 * (g4hit->
get_z(0) + g4hit->
get_z(1));
762 cout <<
") => Gtrack id = " << g4hit->
get_trkid();
766 cout <<
" noise hit";
785 if (
Verbosity() > 1) cout <<
"SvtxEvaluator::fillOutputNtuples() entered" << endl;
787 ActsTrackingGeometry *tgeometry = findNode::getClass<ActsTrackingGeometry>(topNode,
"ActsTrackingGeometry");
788 ActsSurfaceMaps *surfmaps = findNode::getClass<ActsSurfaceMaps>(topNode,
"ActsSurfaceMaps");
789 if(!tgeometry or !surfmaps)
791 std::cout <<
"No Acts geometry on node tree. Can't continue."
804 float nhit_tpc_all = 0;
805 float nhit_tpc_in = 0;
806 float nhit_tpc_mid = 0;
807 float nhit_tpc_out = 0;
810 float nclus_intt = 0;
811 float nclus_maps = 0;
814 for(
int i = 0; i<100;i++)nhit[i] = 0;
822 TrkrHitSetContainer* hitmap_in = findNode::getClass<TrkrHitSetContainer>(topNode,
"TRKR_HITSET");
827 hitsetiter != all_hitsets.second;
837 hitr != hitrangei.second;
851 findNode::getClass<PHG4CylinderCellGeomContainer>(topNode,
"CYLINDERCELLGEOM_SVTX");
854 std::cout <<
PHWHERE <<
"ERROR: Can't find node CYLINDERCELLGEOM_SVTX" << std::endl;
861 float nhits = nhit[
layer];
865 cout <<
" occ11 = " << occ11
866 <<
" nbins = " << nbins
867 <<
" nhits = " << nhits
868 <<
" layer = " << layer
875 occ116 = nhits/nbins;
886 occ216 = nhits/nbins;
896 occ316 = nhits/nbins;
900 cout <<
" occ11 = " << occ11
901 <<
" occ116 = " << occ116
902 <<
" occ21 = " << occ21
903 <<
" occ216 = " << occ216
904 <<
" occ31 = " << occ31
905 <<
" occ316 = " << occ316
908 TrkrHitSetContainer* hitsets = findNode::getClass<TrkrHitSetContainer>(topNode,
"TRKR_HITSET");
910 TrkrClusterContainer* clustermap_in = findNode::getClass<TrkrClusterContainer>(topNode,
"CORRECTED_TRKR_CLUSTER");
912 clustermap_in = findNode::getClass<TrkrClusterContainer>(topNode,
"TRKR_CLUSTER");
914 nclus_all = clustermap_in->
size();
917 for (
auto hitsetitr = hitsetrange.first;
918 hitsetitr != hitsetrange.second;
920 auto range = clustermap_in->getClusters(hitsetitr->first);
921 for(
auto iter_cin = range.first; iter_cin != range.second; ++iter_cin ){
926 if (_nlayers_intt > 0)
941 cout <<
"Filling ntp_info " << endl;
946 ntrk = (float) trackmap->
size();
950 cout <<
"EVENTINFO SEED: " <<
m_fSeed << endl;
951 cout <<
"EVENTINFO NHIT: " << setprecision(9) << nhit_tpc_all << endl;
952 cout <<
"EVENTINFO NTRKGEN: " << nprim << endl;
953 cout <<
"EVENTINFO NTRKREC: " << ntrk << endl;
957 occ11,occ116,occ21,occ216,occ31,occ316,
964 nhit_tpc_out, nclus_all, nclus_tpc, nclus_intt, nclus_maps, nclus_mms};
978 cout <<
"Filling ntp_vertex " << endl;
985 vertexmap = findNode::getClass<SvtxVertexMap>(topNode,
"SvtxVertexMap");
987 vertexmap = findNode::getClass<SvtxVertexMap>(topNode,
"SvtxVertexMapRefit");
989 vertexmap = findNode::getClass<SvtxVertexMap>(topNode,
"SvtxVertexMapActs");
993 if (vertexmap && truthinfo)
996 map<int, unsigned int> embedvtxid_particle_count;
997 map<int, unsigned int> embedvtxid_maps_particle_count;
998 map<int, unsigned int> vertex_particle_count;
1002 for (
auto iter = prange.first; iter != prange.second; ++iter)
1004 const int point_id = iter->second->get_vtx_id();
1005 int gembed = truthinfo->isEmbededVtx(iter->second->get_vtx_id());
1006 ++vertex_particle_count[point_id];
1007 ++embedvtxid_particle_count[gembed];
1012 std::set<TrkrDefs::cluskey> g4clusters = clustereval->
all_clusters_from(g4particle);
1013 unsigned int nglmaps = 0;
1036 nglmaps += lmaps[i];
1039 float gpx = g4particle->
get_px();
1040 float gpy = g4particle->
get_py();
1041 float gpz = g4particle->
get_pz();
1045 if (gpx != 0 && gpy != 0)
1047 TVector3 gv(gpx, gpy, gpz);
1053 if (nglmaps == 3 && fabs(geta) < 1.0 && gpt > 0.5)
1054 ++embedvtxid_maps_particle_count[gembed];
1058 auto vrange = truthinfo->GetPrimaryVtxRange();
1059 map<int, bool> embedvtxid_found;
1060 map<int, int> embedvtxid_vertex_id;
1061 map<int, PHG4VtxPoint*> embedvtxid_vertex;
1062 for (
auto iter = vrange.first; iter != vrange.second; ++iter)
1064 const int point_id = iter->first;
1065 int gembed = truthinfo->isEmbededVtx(point_id);
1069 auto search = embedvtxid_found.find(gembed);
1070 if (search != embedvtxid_found.end())
1072 embedvtxid_vertex_id[gembed] = point_id;
1073 embedvtxid_vertex[gembed] = iter->second;
1077 if (vertex_particle_count[embedvtxid_vertex_id[gembed]] < vertex_particle_count[point_id])
1079 embedvtxid_vertex_id[gembed] = point_id;
1080 embedvtxid_vertex[gembed] = iter->second;
1083 embedvtxid_found[gembed] =
false;
1086 unsigned int ngembed = 0;
1087 for (std::map<int, bool>::iterator iter = embedvtxid_found.begin();
1088 iter != embedvtxid_found.end();
1091 if (iter->first >= 0 || iter->first != iter->first)
continue;
1096 iter != vertexmap->end();
1101 float vx = vertex->
get_x();
1102 float vy = vertex->
get_y();
1103 float vz = vertex->
get_z();
1112 float gntracks = truthinfo->GetNumPrimaryVertexParticles();
1113 float gntracksmaps = NAN;
1114 float gnembed = NAN;
1115 float nfromtruth = NAN;
1118 const int point_id = point->
get_id();
1119 gvx = point->
get_x();
1120 gvy = point->
get_y();
1121 gvz = point->
get_z();
1122 gvt = point->
get_t();
1123 gembed = truthinfo->isEmbededVtx(point_id);
1124 gntracks = embedvtxid_particle_count[(
int) gembed];
1125 if (embedvtxid_maps_particle_count[(
int) gembed] > 0 && fabs(gvt) < 2000. && fabs(gvz) < 13.0)
1126 gntracksmaps = embedvtxid_maps_particle_count[(
int) gembed];
1127 gnembed = (float) ngembed;
1129 embedvtxid_found[(
int) gembed] =
true;
1151 nhit_tpc_out, nclus_all, nclus_tpc, nclus_intt, nclus_maps,nclus_mms};
1158 for (std::map<int, bool>::iterator iter = embedvtxid_found.begin();
1159 iter != embedvtxid_found.end();
1162 if (embedvtxid_found[iter->first])
continue;
1167 float ntracks = NAN;
1173 float gembed = iter->first;
1174 float gntracks = NAN;
1175 float gntracksmaps = NAN;
1176 float gnembed = NAN;
1177 float nfromtruth = NAN;
1183 const int point_id = point->
get_id();
1184 gvx = point->
get_x();
1185 gvy = point->
get_y();
1186 gvz = point->
get_z();
1187 gvt = point->
get_t();
1188 gembed = truthinfo->isEmbededVtx(point_id);
1189 gntracks = embedvtxid_particle_count[(
int) gembed];
1190 if (embedvtxid_maps_particle_count[(
int) gembed] > 0 && fabs(gvt) < 2000 && fabs(gvz) < 13.0)
1191 gntracksmaps = embedvtxid_maps_particle_count[(
int) gembed];
1192 gnembed = (float) ngembed;
1197 std::cout <<
" adding vertex data " << std::endl;
1216 nhit_tpc_out, nclus_all, nclus_tpc, nclus_intt, nclus_maps, nclus_mms};
1238 cout <<
"Filling ntp_gpoint " << endl;
1248 map<int, unsigned int> vertex_particle_count;
1249 for (
auto iter = prange.first; iter != prange.second; ++iter)
1251 ++vertex_particle_count[iter->second->get_vtx_id()];
1254 for (
auto iter = vrange.first; iter != vrange.second; ++iter)
1256 const int point_id = iter->first;
1265 float gvx = point->
get_x();
1266 float gvy = point->
get_y();
1267 float gvz = point->
get_z();
1268 float gvt = point->
get_t();
1269 float gntracks = vertex_particle_count[point_id];
1275 float ntracks = NAN;
1276 float nfromtruth = NAN;
1280 vx = vertex->
get_x();
1281 vy = vertex->
get_y();
1282 vz = vertex->
get_z();
1302 nhit_tpc_out, nclus_all, nclus_tpc, nclus_intt, nclus_maps, nclus_mms};
1323 cout <<
"Filling ntp_g4hit " << endl;
1327 for (std::set<PHG4Hit*>::iterator iter = g4hits.begin();
1328 iter != g4hits.end();
1338 TVector3 vg4(gx, gy, gz);
1343 float gdphi = vin.DeltaPhi(vout);
1344 float gdz = fabs(g4hit->
get_z(1) - g4hit->
get_z(0));
1350 float gflavor = NAN;
1355 float geta = vec.Eta();
1356 float gphi = vec.Phi();
1362 float gprimary = NAN;
1375 if (trutheval->
get_embed(g4particle) <= 0)
continue;
1378 gflavor = g4particle->
get_pid();
1379 gpx = g4particle->
get_px();
1380 gpy = g4particle->
get_py();
1381 gpz = g4particle->
get_pz();
1397 gfpx = outerhit->
get_px(1);
1398 gfpy = outerhit->
get_py(1);
1399 gfpz = outerhit->
get_pz(1);
1400 gfx = outerhit->
get_x(1);
1401 gfy = outerhit->
get_y(1);
1402 gfz = outerhit->
get_z(1);
1405 gembed = trutheval->
get_embed(g4particle);
1406 gprimary = trutheval->
is_primary(g4particle);
1410 float nclusters = clusters.size();
1425 float efromtruth = NAN;
1426 float dphitru = NAN;
1427 float detatru = NAN;
1431 TrkrClusterContainer* clustermap = findNode::getClass<TrkrClusterContainer>(topNode,
"CORRECTED_TRKR_CLUSTER");
1433 clustermap = findNode::getClass<TrkrClusterContainer>(topNode,
"TRKR_CLUSTER");
1439 clusID = cluster_key;
1444 TVector3
vec2(x, y, z);
1447 e = cluster->getAdc();
1448 adc = cluster->getAdc();
1453 TrkrClusterHitAssoc *cluster_hit_map = findNode::getClass<TrkrClusterHitAssoc>(topNode,
"TRKR_CLUSTERHITASSOC");
1454 std::pair<std::multimap<TrkrDefs::cluskey, TrkrDefs::hitkey>::const_iterator, std::multimap<TrkrDefs::cluskey, TrkrDefs::hitkey>::const_iterator>
1455 hitrange = cluster_hit_map->
getHits(cluster_key);
1456 for(std::multimap<TrkrDefs::cluskey, TrkrDefs::hitkey>::const_iterator
1457 clushititer = hitrange.first; clushititer != hitrange.second; ++clushititer)
1462 dphitru = vec2.DeltaPhi(vg4);
1463 detatru = eta - geta;
1465 drtru = vec2.DeltaR(vg4);
1520 nhit_tpc_out, nclus_all, nclus_tpc, nclus_intt, nclus_maps, nclus_mms};
1539 cout <<
"Filling ntp_hit " << endl;
1543 TrkrHitSetContainer *hitmap = findNode::getClass<TrkrHitSetContainer>(topNode,
"TRKR_HITSET");
1545 findNode::getClass<PHG4CylinderCellGeomContainer>(topNode,
"CYLINDERCELLGEOM_SVTX");
1546 if (!geom_container)
1548 std::cout <<
PHWHERE <<
"ERROR: Can't find node CYLINDERCELLGEOM_SVTX" << std::endl;
1556 iter != all_hitsets.second;
1565 hitr != hitrangei.second;
1573 float hitID = hit_key;
1575 float adc = hit->
getAdc();
1580 float ecell = hit->
getAdc();
1596 float g4hitID = NAN;
1602 float gtrackID = NAN;
1603 float gflavor = NAN;
1618 float gprimary = NAN;
1620 float efromtruth = NAN;
1635 if (trutheval->
get_embed(g4particle) <= 0)
continue;
1639 gflavor = g4particle->
get_pid();
1640 gpx = g4particle->
get_px();
1641 gpy = g4particle->
get_py();
1642 gpz = g4particle->
get_pz();
1659 gfpx = outerhit->
get_px(1);
1660 gfpy = outerhit->
get_py(1);
1661 gfpz = outerhit->
get_pz(1);
1662 gfx = outerhit->
get_x(1);
1663 gfy = outerhit->
get_y(1);
1664 gfz = outerhit->
get_z(1);
1666 gembed = trutheval->
get_embed(g4particle);
1667 gprimary = trutheval->
is_primary(g4particle);
1676 float hit_data[] = {
1718 nhit_tpc_out, nclus_all, nclus_tpc, nclus_intt, nclus_maps, nclus_mms};
1737 cout <<
"check for ntp_cluster" << endl;
1743 if (
Verbosity() > 1) cout <<
"Filling ntp_cluster (all of them) " << endl;
1745 TrkrClusterContainer* clustermap = findNode::getClass<TrkrClusterContainer>(topNode,
"CORRECTED_TRKR_CLUSTER");
1747 clustermap = findNode::getClass<TrkrClusterContainer>(topNode,
"TRKR_CLUSTER");
1749 TrkrClusterHitAssoc* clusterhitmap = findNode::getClass<TrkrClusterHitAssoc>(topNode,
"TRKR_CLUSTERHITASSOC");
1750 TrkrHitSetContainer* hitsets = findNode::getClass<TrkrHitSetContainer>(topNode,
"TRKR_HITSET");
1751 TrkrClusterIterationMapv1* _iteration_map = findNode::getClass<TrkrClusterIterationMapv1>(topNode,
"CLUSTER_ITERATION_MAP");
1754 if (clustermap !=
nullptr)
1755 cout <<
"got clustermap" << endl;
1757 cout <<
"no clustermap" << endl;
1758 if (clusterhitmap !=
nullptr)
1759 cout <<
"got clusterhitmap" << endl;
1761 cout <<
"no clusterhitmap" << endl;
1763 if (hitsets !=
nullptr)
1764 cout <<
"got hitsets" << endl;
1766 cout <<
"no hitsets" << endl;
1769 if (clustermap !=
nullptr && clusterhitmap !=
nullptr && hitsets !=
nullptr){
1770 auto hitsetrange = hitsets->getHitSets();
1771 for (
auto hitsetitr = hitsetrange.first;
1772 hitsetitr != hitsetrange.second;
1775 auto range = clustermap->
getClusters(hitsetitr->first);
1776 for(
auto iter = range.first; iter != range.second; ++iter ){
1782 if(_iteration_map!=NULL)
1783 niter = _iteration_map->getIteration(cluster_key);
1784 float hitID = (float) cluster_key;
1789 TVector3
pos(x, y, z);
1790 float r = pos.Perp();
1791 float phi = pos.Phi();
1792 float eta = pos.Eta();
1793 float theta = pos.Theta();
1795 float ex = sqrt(globerr[0][0]);
1796 float ey = sqrt(globerr[1][1]);
1801 float adc = cluster->
getAdc();
1806 float maxadc = -999;
1810 if(hitsetlayer!=layer){
1811 cout <<
"WARNING hitset layer " << hitsetlayer <<
"| " << hitsetlayer2 <<
" layer " << layer << endl;
1819 std::pair<std::multimap<TrkrDefs::cluskey, TrkrDefs::hitkey>::const_iterator, std::multimap<TrkrDefs::cluskey, TrkrDefs::hitkey>::const_iterator>
1820 hitrange = clusterhitmap->getHits(cluster_key);
1821 for(std::multimap<TrkrDefs::cluskey, TrkrDefs::hitkey>::const_iterator
1822 clushititer = hitrange.first; clushititer != hitrange.second; ++clushititer)
1824 TrkrHit* hit = hitset->second->getHit(clushititer->second);
1826 sumadc += (hit->
getAdc() - 70);
1827 if((hit->
getAdc()-70)>maxadc)
1828 maxadc = (hit->
getAdc()-70);
1832 float trackID = NAN;
1833 if (track!=NULL) trackID = track->
get_id();
1835 float g4hitID = NAN;
1844 float gtrackID = NAN;
1845 float gflavor = NAN;
1860 float gprimary = NAN;
1862 float efromtruth = NAN;
1867 std::cout <<
PHWHERE <<
" **** reco: layer " << layer << std::endl;
1868 cout <<
" reco cluster key " << reco_cluskey <<
" r " << r <<
" x " << x <<
" y " << y <<
" z " << z <<
" phi " << phi <<
" adc " << adc << endl;
1870 float nparticles = NAN;
1879 cout <<
"Found matching truth cluster with key " << truth_cluskey <<
" for reco cluster key " << cluster_key <<
" in layer " << layer << endl;
1883 gx=truth_cluster->getX();
1884 gy=truth_cluster->getY();
1885 gz=truth_cluster->getZ();
1886 efromtruth = truth_cluster->getError(0,0);
1888 TVector3 gpos(gx, gy, gz);
1896 gflavor = g4particle->
get_pid();
1897 gpx = g4particle->
get_px();
1898 gpy = g4particle->
get_py();
1899 gpz = g4particle->
get_pz();
1915 gfpx = outerhit->
get_px(1);
1916 gfpy = outerhit->
get_py(1);
1917 gfpz = outerhit->
get_pz(1);
1918 gfx = outerhit->
get_x(1);
1919 gfy = outerhit->
get_y(1);
1920 gfz = outerhit->
get_z(1);
1923 gembed = trutheval->
get_embed(g4particle);
1924 gprimary = trutheval->
is_primary(g4particle);
1930 cout <<
" truth cluster key " << ckey <<
" gr " << gr <<
" gx " << gx <<
" gy " << gy <<
" gz " << gz <<
" gphi " << gphi <<
" efromtruth " << efromtruth << endl;
1940 float cluster_data[] = {(float)
_ievent,
1993 nhit_tpc_out, nclus_all, nclus_tpc, nclus_intt, nclus_maps, nclus_mms};
2003 cout <<
"Filling ntp_cluster (embedded only) " << endl;
2012 TrkrClusterContainer* clustermap = findNode::getClass<TrkrClusterContainer>(topNode,
"CORRECTED_TRKR_CLUSTER");
2014 clustermap = findNode::getClass<TrkrClusterContainer>(topNode,
"TRKR_CLUSTER");
2016 TrkrClusterHitAssoc* clusterhitmap = findNode::getClass<TrkrClusterHitAssoc>(topNode,
"TRKR_CLUSTERHITASSOC");
2017 TrkrHitSetContainer* hitsets = findNode::getClass<TrkrHitSetContainer>(topNode,
"TRKR_HITSET");
2018 TrkrClusterIterationMapv1* _iteration_map = findNode::getClass<TrkrClusterIterationMapv1>(topNode,
"CLUSTER_ITERATION_MAP");
2020 if (trackmap !=
nullptr && clustermap !=
nullptr && clusterhitmap !=
nullptr && hitsets !=
nullptr){
2022 iter != trackmap->
end();
2030 if (trutheval->
get_embed(truth) <= 0)
continue;
2038 TrkrCluster* cluster = clustermap->findCluster(cluster_key);
2039 if(!cluster)
continue;
2046 if(_iteration_map!=NULL)
2047 niter = _iteration_map->getIteration(cluster_key);
2053 TVector3
pos(x, y, z);
2054 float r = pos.Perp();
2055 float phi = pos.Phi();
2056 float eta = pos.Eta();
2057 float theta = pos.Theta();
2059 float ex = sqrt(globerr[0][0]);
2060 float ey = sqrt(globerr[1][1]);
2066 float adc = cluster->
getAdc();
2073 float maxadc = -999;
2077 std::pair<std::multimap<TrkrDefs::cluskey, TrkrDefs::hitkey>::const_iterator, std::multimap<TrkrDefs::cluskey, TrkrDefs::hitkey>::const_iterator>
2078 hitrange = clusterhitmap->getHits(cluster_key);
2079 for(std::multimap<TrkrDefs::cluskey, TrkrDefs::hitkey>::const_iterator
2080 clushititer = hitrange.first; clushititer != hitrange.second; ++clushititer)
2082 TrkrHit* hit = hitset->second->getHit(clushititer->second);
2088 float trackID = NAN;
2089 trackID = track->
get_id();
2091 float g4hitID = NAN;
2100 float gtrackID = NAN;
2101 float gflavor = NAN;
2116 float gprimary = NAN;
2118 float efromtruth = NAN;
2129 cout <<
" Found matching truth cluster with key " << truth_cluskey <<
" for reco cluster key " << cluster_key <<
" in layer " << layer << endl;
2133 gx=truth_cluster->getX();
2134 gy=truth_cluster->getY();
2135 gz=truth_cluster->getZ();
2136 efromtruth = truth_cluster->getError(0,0);
2138 TVector3 gpos(gx, gy, gz);
2146 gflavor = g4particle->
get_pid();
2147 gpx = g4particle->
get_px();
2148 gpy = g4particle->
get_py();
2149 gpz = g4particle->
get_pz();
2164 gfpx = outerhit->
get_px(1);
2165 gfpy = outerhit->
get_py(1);
2166 gfpz = outerhit->
get_pz(1);
2167 gfx = outerhit->
get_x(1);
2168 gfy = outerhit->
get_y(1);
2169 gfz = outerhit->
get_z(1);
2172 gembed = trutheval->
get_embed(g4particle);
2173 gprimary = trutheval->
is_primary(g4particle);
2179 float cluster_data[] = {(float)
_ievent,
2232 nhit_tpc_out, nclus_all, nclus_tpc, nclus_intt, nclus_maps, nclus_mms};
2249 cout <<
"check for ntp_g4cluster" << endl;
2256 cout <<
"Filling ntp_g4cluster " << endl;
2261 iter != range.second;
2269 if (trutheval->
get_embed(g4particle) <= 0)
continue;
2273 float gflavor = g4particle->
get_pid();
2274 float gembed = trutheval->
get_embed(g4particle);
2275 float gprimary = trutheval->
is_primary(g4particle);
2278 cout <<
PHWHERE <<
" PHG4Particle ID " << gtrackID <<
" gflavor " << gflavor <<
" gprimary " << gprimary << endl;
2281 std::map<unsigned int, std::shared_ptr<TrkrCluster> > truth_clusters = trutheval->
all_truth_clusters(g4particle);
2284 for (
auto it = truth_clusters.begin();
it != truth_clusters.end(); ++
it )
2286 unsigned int layer =
it->first;
2287 std::shared_ptr<TrkrCluster> gclus =
it->second;
2289 float gx = gclus->getX();
2290 float gy = gclus->getY();
2291 float gz = gclus->getZ();
2293 float gedep = gclus->getError(0,0);
2294 float gadc = (float) gclus->getAdc();
2296 TVector3 gpos(gx, gy, gz);
2297 float gr = sqrt(gx*gx+gy*gy);
2298 float gphi = gpos.Phi();
2299 float geta = gpos.Eta();
2304 std::cout <<
PHWHERE <<
" **** truth: layer " << layer << std::endl;
2305 cout <<
" truth cluster key " << ckey <<
" gr " << gr <<
" gx " << gx <<
" gy " << gy <<
" gz " << gz
2306 <<
" gphi " << gphi <<
" gedep " << gedep <<
" gadc " << gadc << endl;
2309 float gphisize = gclus->getSize(1,1);
2310 float gzsize = gclus->getSize(2,2);
2337 TVector3
pos(x, y, z);
2342 ex = sqrt(globerr[0][0]);
2343 ey = sqrt(globerr[1][1]);
2347 adc = reco_cluster->
getAdc();
2352 cout <<
" reco cluster key " << reco_cluskey <<
" r " << r <<
" x " << x <<
" y " << y <<
" z " << z <<
" phi " << phi <<
" adc " << adc << endl;
2358 cout <<
" ----------- Failed to find matching reco cluster " << endl;
2363 float g4cluster_data[] = {(float)
_ievent,
2409 cout <<
"Filling ntp_gtrack " << endl;
2424 iter != range.second;
2432 if (trutheval->
get_embed(g4particle) <= 0)
continue;
2436 float gflavor = g4particle->
get_pid();
2438 std::set<TrkrDefs::cluskey> g4clusters = clustereval->
all_clusters_from(g4particle);
2440 float ng4hits = g4clusters.size();
2441 unsigned int ngmaps = 0;
2442 unsigned int ngmms = 0;
2443 unsigned int ngintt = 0;
2444 unsigned int ngintt1 = 0;
2445 unsigned int ngintt2 = 0;
2446 unsigned int ngintt3 = 0;
2447 unsigned int ngintt4 = 0;
2448 unsigned int ngintt5 = 0;
2449 unsigned int ngintt6 = 0;
2450 unsigned int ngintt7 = 0;
2451 unsigned int ngintt8 = 0;
2452 unsigned int ngtpc = 0;
2453 unsigned int nglmaps = 0;
2454 unsigned int nglintt = 0;
2455 unsigned int ngltpc = 0;
2456 unsigned int nglmms = 0;
2460 for (
unsigned int i = 0; i <
_nlayers_maps; i++) lmaps[i] = 0;
2462 int lintt[_nlayers_intt + 1];
2463 if (_nlayers_intt > 0)
2464 for (
unsigned int i = 0; i <
_nlayers_intt; i++) lintt[i] = 0;
2468 for (
unsigned int i = 0; i <
_nlayers_tpc; i++) ltpc[i] = 0;
2472 for (
unsigned int i = 0; i <
_nlayers_mms; i++) lmms[i] = 0;
2478 if (_nlayers_maps > 0 && layer < _nlayers_maps)
2483 if (_nlayers_mms > 0 && layer >= _nlayers_maps + _nlayers_intt + _nlayers_tpc)
2485 lmms[layer - _nlayers_tpc - _nlayers_intt -
_nlayers_maps] = 1;
2488 if (_nlayers_intt > 0 && layer >= _nlayers_maps && layer < _nlayers_maps + _nlayers_intt)
2494 if (_nlayers_intt > 0 && layer == _nlayers_maps && layer < _nlayers_maps + _nlayers_intt)
2499 if (_nlayers_intt > 1 && layer == _nlayers_maps + 1 && layer < _nlayers_maps + _nlayers_intt)
2504 if (_nlayers_intt > 2 && layer == _nlayers_maps + 2 && layer < _nlayers_maps + _nlayers_intt)
2509 if (_nlayers_intt > 3 && layer == _nlayers_maps + 3 && layer < _nlayers_maps + _nlayers_intt)
2514 if (_nlayers_intt > 4 && layer == _nlayers_maps + 4 && layer < _nlayers_maps + _nlayers_intt)
2519 if (_nlayers_intt > 5 && layer == _nlayers_maps + 5 && layer < _nlayers_maps + _nlayers_intt)
2524 if (_nlayers_intt > 6 && layer == _nlayers_maps + 6 && layer < _nlayers_maps + _nlayers_intt)
2529 if (_nlayers_intt > 7 && layer == _nlayers_maps + 7 && layer < _nlayers_maps + _nlayers_intt)
2533 if (_nlayers_tpc > 0 && layer >= _nlayers_maps + _nlayers_intt && layer < _nlayers_maps + _nlayers_intt + _nlayers_tpc)
2539 if (_nlayers_maps > 0)
2540 for (
unsigned int i = 0; i <
_nlayers_maps; i++) nglmaps += lmaps[i];
2541 if (_nlayers_intt > 0)
2542 for (
unsigned int i = 0; i <
_nlayers_intt; i++) nglintt += lintt[i];
2543 if (_nlayers_tpc > 0)
2544 for (
unsigned int i = 0; i <
_nlayers_tpc; i++) ngltpc += ltpc[i];
2545 if (_nlayers_mms > 0)
2546 for (
unsigned int i = 0; i <
_nlayers_mms; i++) nglmms += lmms[i];
2548 float gpx = g4particle->
get_px();
2549 float gpy = g4particle->
get_py();
2550 float gpz = g4particle->
get_pz();
2554 if (gpx != 0 && gpy != 0)
2556 TVector3 gv(gpx, gpy, gpz);
2562 float gvx = vtx->
get_x();
2563 float gvy = vtx->
get_y();
2564 float gvz = vtx->
get_z();
2565 float gvt = vtx->
get_t();
2580 gfpx = outerhit->
get_px(1);
2581 gfpy = outerhit->
get_py(1);
2582 gfpz = outerhit->
get_pz(1);
2583 gfx = outerhit->
get_x(1);
2584 gfy = outerhit->
get_y(1);
2585 gfz = outerhit->
get_z(1);
2588 float gembed = trutheval->
get_embed(g4particle);
2589 float gprimary = trutheval->
is_primary(g4particle);
2591 float trackID = NAN;
2593 float quality = NAN;
2609 unsigned int layers = 0x0;
2611 float dca2dsigma = NAN;
2612 float dca3dxy = NAN;
2613 float dca3dxysigma = NAN;
2615 float dca3dzsigma = NAN;
2622 float deltapt = NAN;
2623 float deltaeta = NAN;
2624 float deltaphi = NAN;
2629 float nfromtruth = NAN;
2631 float ntrumaps = NAN;
2632 float ntruintt = NAN;
2633 float ntrumms = NAN;
2634 float ntrutpc = NAN;
2635 float ntrutpc1 = NAN;
2636 float ntrutpc11 = NAN;
2637 float ntrutpc2 = NAN;
2638 float ntrutpc3 = NAN;
2639 float layersfromtruth = NAN;
2647 trackID = track->
get_id();
2654 vector <int> maps(_nlayers_maps, 0);
2655 vector <int> intt(_nlayers_intt, 0);
2656 vector <int> tpc(_nlayers_tpc, 0);
2657 vector <int> mms(_nlayers_mms, 0);
2659 if (_nlayers_maps > 0)
2661 for (
unsigned int i = 0; i <
_nlayers_maps; i++) maps[i] = 0;
2663 if (_nlayers_intt > 0)
2665 for (
unsigned int i = 0; i <
_nlayers_intt; i++) intt[i] = 0;
2667 if (_nlayers_tpc > 0)
2669 for (
unsigned int i = 0; i <
_nlayers_tpc; i++) tpc[i] = 0;
2671 if (_nlayers_mms > 0)
2673 for (
unsigned int i = 0; i <
_nlayers_mms; i++) mms[i] = 0;
2683 if (_nlayers_maps > 0 && layer < _nlayers_maps)
2688 if (_nlayers_intt > 0 && layer >= _nlayers_maps && layer < _nlayers_maps + _nlayers_intt)
2693 if (_nlayers_tpc > 0 &&
2694 layer >= (_nlayers_maps + _nlayers_intt) &&
2695 layer < (_nlayers_maps + _nlayers_intt + _nlayers_tpc))
2700 if((layer - (_nlayers_maps + _nlayers_intt))<8){
2704 if((layer - (_nlayers_maps + _nlayers_intt))<16){
2708 else if((layer - (_nlayers_maps + _nlayers_intt))<32){
2712 else if((layer - (_nlayers_maps + _nlayers_intt))<48){
2717 if (_nlayers_mms > 0 && layer >= _nlayers_maps + _nlayers_intt + _nlayers_tpc)
2719 mms[layer - (_nlayers_maps + _nlayers_intt +
_nlayers_tpc)] = 1;
2723 if (_nlayers_maps > 0)
2724 for (
unsigned int i = 0; i <
_nlayers_maps; i++) nlmaps += maps[i];
2725 if (_nlayers_intt > 0)
2726 for (
unsigned int i = 0; i <
_nlayers_intt; i++) nlintt += intt[i];
2727 if (_nlayers_tpc > 0)
2728 for (
unsigned int i = 0; i <
_nlayers_tpc; i++) nltpc += tpc[i];
2729 if (_nlayers_mms > 0)
2730 for (
unsigned int i = 0; i <
_nlayers_mms; i++) nlmms += mms[i];
2732 layers = nlmaps + nlintt + nltpc + nlmms;
2751 TVector3
v(px, py, pz);
2761 deltapt = sqrt((CVxx*px*px+2*CVxy*px*py+CVyy*py*py)/(px*px+py*py));
2762 deltaeta = sqrt((CVzz*(px*px+py*py)*(px*px+py*py)+pz*(-2*(CVxz*px+CVyz*py)*(px*px+py*py)+CVxx*px*px*pz+CVyy*py*py*pz+2*CVxy*px*py*pz))/((px*px+py*py)*(px*px+py*py)*(px*px+py*py+pz*pz)));
2763 deltaphi = sqrt((CVyy*px*px-2*CVxy*px*py+CVxx*py*py)/((px*px+py*py)*(px*px+py*py)));
2764 pcax = track->
get_x();
2765 pcay = track->
get_y();
2766 pcaz = track->
get_z();
2771 if (_nlayers_maps == 0)
2779 if (_nlayers_intt == 0)
2787 if (_nlayers_mms == 0)
2793 ntrumms = trackeval->
get_layer_range_contribution(track, g4particle, _nlayers_maps + _nlayers_intt + _nlayers_tpc, _nlayers_maps + _nlayers_intt + _nlayers_tpc + _nlayers_mms);
2795 ntrutpc = trackeval->
get_layer_range_contribution(track, g4particle, _nlayers_maps + _nlayers_intt, _nlayers_maps + _nlayers_intt + _nlayers_tpc);
2796 ntrutpc1 = trackeval->
get_layer_range_contribution(track, g4particle, _nlayers_maps + _nlayers_intt, _nlayers_maps + _nlayers_intt + 16);
2797 ntrutpc11 = trackeval->
get_layer_range_contribution(track, g4particle, _nlayers_maps + _nlayers_intt, _nlayers_maps + _nlayers_intt + 8);
2798 ntrutpc2 = trackeval->
get_layer_range_contribution(track, g4particle, _nlayers_maps + _nlayers_intt+16, _nlayers_maps + _nlayers_intt + 32);
2799 ntrutpc3 = trackeval->
get_layer_range_contribution(track, g4particle, _nlayers_maps + _nlayers_intt+32, _nlayers_maps + _nlayers_intt + _nlayers_tpc);
2895 nhit_tpc_out, nclus_all, nclus_tpc, nclus_intt, nclus_maps, nclus_mms};
2925 cout <<
"Filling ntp_track " << endl;
2934 iter != trackmap->
end();
2938 float trackID = track->
get_id();
2944 unsigned int layers = 0x0;
2951 for (
unsigned int i = 0; i <
_nlayers_maps; i++) maps[i] = 0;
2953 if (_nlayers_intt > 0)
2955 for (
unsigned int i = 0; i <
_nlayers_intt; i++) intt[i] = 0;
2959 for (
unsigned int i = 0; i <
_nlayers_tpc; i++) tpc[i] = 0;
2963 for (
unsigned int i = 0; i <
_nlayers_mms; i++) mms[i] = 0;
3022 for (
unsigned int i = 0; i <
_nlayers_maps; i++) nlmaps += maps[i];
3023 if (_nlayers_intt > 0)
3024 for (
unsigned int i = 0; i <
_nlayers_intt; i++) nlintt += intt[i];
3026 for (
unsigned int i = 0; i <
_nlayers_tpc; i++) nltpc += tpc[i];
3028 for (
unsigned int i = 0; i <
_nlayers_mms; i++) nlmms += mms[i];
3029 layers = nlmaps + nlintt + nltpc + nlmms;
3036 float px = track->
get_px();
3037 float py = track->
get_py();
3038 float pz = track->
get_pz();
3039 TVector3
v(px, py, pz);
3041 float eta = v.Eta();
3042 float phi = v.Phi();
3049 float deltapt = sqrt((CVxx*px*px+2*CVxy*px*py+CVyy*py*py)/(px*px+py*py));
3050 float deltaeta = sqrt((CVzz*(px*px+py*py)*(px*px+py*py)+pz*(-2*(CVxz*px+CVyz*py)*(px*px+py*py)+CVxx*px*px*pz+CVyy*py*py*pz+2*CVxy*px*py*pz))/((px*px+py*py)*(px*px+py*py)*(px*px+py*py+pz*pz)));
3051 float deltaphi = sqrt((CVyy*px*px-2*CVxy*px*py+CVxx*py*py)/((px*px+py*py)*(px*px+py*py)));
3052 float pcax = track->
get_x();
3053 float pcay = track->
get_y();
3054 float pcaz = track->
get_z();
3076 float gtrackID = NAN;
3077 float gflavor = NAN;
3078 float ng4hits = NAN;
3079 unsigned int ngmaps = 0;
3080 unsigned int ngintt = 0;
3081 unsigned int ngmms = 0;
3082 unsigned int ngtpc = 0;
3083 unsigned int nglmaps = 0;
3084 unsigned int nglintt = 0;
3085 unsigned int nglmms = 0;
3086 unsigned int ngltpc = 0;
3104 float gprimary = NAN;
3106 float nfromtruth = NAN;
3108 float ntrumaps = NAN;
3109 float ntruintt = NAN;
3110 float ntrumms = NAN;
3111 float ntrutpc = NAN;
3112 float ntrutpc1 = NAN;
3113 float ntrutpc11 = NAN;
3114 float ntrutpc2 = NAN;
3115 float ntrutpc3 = NAN;
3116 float layersfromtruth = NAN;
3125 if (trutheval->
get_embed(g4particle) <= 0)
continue;
3129 gflavor = g4particle->
get_pid();
3131 std::set<TrkrDefs::cluskey> g4clusters = clustereval->
all_clusters_from(g4particle);
3132 ng4hits = g4clusters.size();
3133 gpx = g4particle->
get_px();
3134 gpy = g4particle->
get_py();
3135 gpz = g4particle->
get_pz();
3137 int lmaps[_nlayers_maps + 1];
3138 if (_nlayers_maps > 0)
3139 for (
unsigned int i = 0; i <
_nlayers_maps; i++) lmaps[i] = 0;
3141 int lintt[_nlayers_intt + 1];
3142 if (_nlayers_intt > 0)
3143 for (
unsigned int i = 0; i <
_nlayers_intt; i++) lintt[i] = 0;
3145 int ltpc[_nlayers_tpc + 1];
3146 if (_nlayers_tpc > 0)
3147 for (
unsigned int i = 0; i <
_nlayers_tpc; i++) ltpc[i] = 0;
3149 int lmms[_nlayers_mms + 1];
3150 if (_nlayers_mms > 0)
3151 for (
unsigned int i = 0; i <
_nlayers_mms; i++) lmms[i] = 0;
3156 if (_nlayers_maps > 0 && layer < _nlayers_maps)
3162 if (_nlayers_intt > 0 && layer >= _nlayers_maps && layer < _nlayers_maps + _nlayers_intt)
3168 if (_nlayers_tpc > 0 && layer >= _nlayers_maps + _nlayers_intt && layer < _nlayers_maps + _nlayers_intt + _nlayers_tpc)
3174 if (_nlayers_mms > 0 && layer >= _nlayers_maps + _nlayers_intt + _nlayers_tpc && layer < _nlayers_maps + _nlayers_intt + _nlayers_tpc + _nlayers_mms)
3176 lmms[layer - (_nlayers_maps + _nlayers_intt +
_nlayers_tpc)] = 1;
3181 if (_nlayers_maps > 0)
3182 for (
unsigned int i = 0; i <
_nlayers_maps; i++) nglmaps += lmaps[i];
3183 if (_nlayers_intt > 0)
3184 for (
unsigned int i = 0; i <
_nlayers_intt; i++) nglintt += lintt[i];
3185 if (_nlayers_tpc > 0)
3186 for (
unsigned int i = 0; i <
_nlayers_tpc; i++) ngltpc += ltpc[i];
3187 if (_nlayers_mms > 0)
3188 for (
unsigned int i = 0; i <
_nlayers_mms; i++) nglmms += lmms[i];
3190 TVector3 gv(gpx, gpy, gpz);
3205 gfpx = outerhit->
get_px(1);
3206 gfpy = outerhit->
get_py(1);
3207 gfpz = outerhit->
get_pz(1);
3208 gfx = outerhit->
get_x(1);
3209 gfy = outerhit->
get_y(1);
3210 gfz = outerhit->
get_z(1);
3212 gembed = trutheval->
get_embed(g4particle);
3213 gprimary = trutheval->
is_primary(g4particle);
3217 if (_nlayers_maps == 0)
3225 if (_nlayers_intt == 0)
3233 if (_nlayers_mms == 0)
3239 ntrumms = trackeval->
get_layer_range_contribution(track, g4particle, _nlayers_maps + _nlayers_intt + _nlayers_tpc, _nlayers_maps + _nlayers_intt + _nlayers_tpc + _nlayers_mms);
3241 ntrutpc = trackeval->
get_layer_range_contribution(track, g4particle, _nlayers_maps + _nlayers_intt, _nlayers_maps + _nlayers_intt + _nlayers_tpc);
3242 ntrutpc1 = trackeval->
get_layer_range_contribution(track, g4particle, _nlayers_maps + _nlayers_intt, _nlayers_maps + _nlayers_intt + 16);
3243 ntrutpc11 = trackeval->
get_layer_range_contribution(track, g4particle, _nlayers_maps + _nlayers_intt, _nlayers_maps + _nlayers_intt + 8);
3244 ntrutpc2 = trackeval->
get_layer_range_contribution(track, g4particle, _nlayers_maps + _nlayers_intt+16, _nlayers_maps + _nlayers_intt + 32);
3245 ntrutpc3 = trackeval->
get_layer_range_contribution(track, g4particle, _nlayers_maps + _nlayers_intt+32, _nlayers_maps + _nlayers_intt + _nlayers_tpc);
3265 nhits, nmaps, nintt, ntpc,nmms,
3266 ntpc1,ntpc11,ntpc2,ntpc3,
3267 nlmaps, nlintt, nltpc,nlmms,
3337 nhit_tpc_out, nclus_all, nclus_tpc, nclus_intt, nclus_maps, nclus_mms};
3341 <<
" trackID " << trackID
3342 <<
" nhits " << nhits
3346 <<
" gembed " << gembed
3347 <<
" gprimary " << gprimary
3368 cout <<
"Filling ntp_gseed " << endl;
3391 float gprimary = NAN;
3393 float dphiprev = NAN;
3394 float detaprev = NAN;
3404 iter != range.second;
3415 std::set<PHG4Hit*> truth_hits = trutheval->
all_truth_hits(g4particle);
3416 for (std::set<PHG4Hit*>::iterator iter = truth_hits.begin();
3417 iter != truth_hits.end();
3421 unsigned int layer = g4hit->
get_layer();
3438 if (gx == 0 && gy == 0)
continue;
3440 TVector3 vg4(gx, gy, gz);
3445 gpx = g4particle->
get_px();
3446 gpy = g4particle->
get_py();
3447 gpz = g4particle->
get_pz();
3448 TVector3 vg4p(gpx, gpy, gpz);
3463 gembed = trutheval->
get_embed(g4particle);
3464 gprimary = trutheval->
is_primary(g4particle);
3465 gflav = g4particle->
get_pid();
3468 if (xval[i - 1] != 0 && yval[i - 1] != 0)
3470 TVector3 vg4prev(xval[i - 1], yval[i - 1], zval[i - 1]);
3471 dphiprev = vg4.DeltaPhi(vg4prev);
3472 detaprev = geta - vg4prev.Eta();
3476 float ntrk_f = ntrk;
3478 float gseed_data[] = {_ievent_f,
3504 nhit_tpc_out, nclus_all, nclus_tpc, nclus_intt, nclus_maps, nclus_mms};
3523 TMatrixF localErr(3,3);
3524 localErr[0][0] = 0.;
3525 localErr[0][1] = 0.;
3526 localErr[0][2] = 0.;
3527 localErr[1][0] = 0.;
3530 localErr[2][0] = 0.;
3535 ROT[0][0] = cos(clusphi);
3536 ROT[0][1] = -sin(clusphi);
3538 ROT[1][0] = sin(clusphi);
3539 ROT[1][1] = cos(clusphi);
3544 TMatrixF ROT_T(3,3);
3545 ROT_T.Transpose(ROT);
3548 err = ROT * localErr * ROT_T;