10 #include <trackbase_historic/SvtxVertexMap.h>
29 #include <calobase/RawCluster.h>
30 #include <calobase/RawClusterContainer.h>
31 #include <calobase/RawClusterUtility.h>
32 #include <calobase/RawTowerGeomContainer_Cylinderv1.h>
35 #include <calobase/RawTower.h>
36 #include <calobase/RawTowerContainer.h>
37 #include <calobase/RawTowerGeom.h>
38 #include <calobase/RawTowerGeomContainer.h>
39 #include <calobase/RawTowerDefs.h>
50 #pragma GCC diagnostic push
51 #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
52 #include <HepMC/GenEvent.h>
53 #pragma GCC diagnostic pop
54 #include <HepMC/GenVertex.h>
80 m_outputFileName(fileName),
81 m_minEMClusterEnergy(0.1),
82 m_minIHClusterEnergy(0.012),
83 m_minOHClusterEnergy(0.025),
84 m_minCemcTowerEnergy(0.04),
85 m_minHcalTowerEnergy(0.006),
86 m_minSimTowerEnergy(0.0),
87 m_analyzeTracks(
true),
88 m_analyzeClusters(
true),
89 m_analyzeTowers(
true),
90 m_analyzeSimTowers(
true),
91 m_analyzeHepMCTruth(
true),
92 m_analyzeG4Truth(
true),
93 m_analyzeCentrality(
true),
94 m_analyzeAddTruth(
true)
130 if(!cemcGeomContainer){
131 std::cout <<
"ERROR: TOWERGEOM_CEMC not found" << std::endl;
133 if(!ihcalGeomContainer){
134 std::cout <<
"ERROR: TOWERGEOM_HCALIN not found" << std::endl;
136 if(!ohcalGeomContainer){
137 std::cout <<
"ERROR: TOWERGEOM_HCALOUT not found" << std::endl;
163 std::cout <<
counter <<
" events processed" << std::endl;
199 central = findNode::getClass<CentralityInfo>(topNode,
"CentralityInfo");
210 SvtxTrackMap *trackmap = findNode::getClass<SvtxTrackMap>(topNode,
"SvtxTrackMap");
216 <<
"SvtxTrackMap node is missing, can't collect tracks"
221 SvtxVertexMap *vertexmap = findNode::getClass<SvtxVertexMap>(topNode,
"SvtxVertexMap");
227 <<
"SvtxVertexMap node is missing, can't collect tracks"
245 for(
auto entry : *trackmap)
259 float dca_xy, dca_z, dca_xy_error, dca_z_error;
260 calculateDCA(track, vertexmap, dca_xy, dca_z, dca_xy_error, dca_z_error);
315 float px = truthtrack->
get_px();
316 float py = truthtrack->
get_py();
317 float pz = truthtrack->
get_pz();
339 for(
auto entry : *vertexmap)
358 RawClusterContainer *cemcContainer = findNode::getClass<RawClusterContainer>(topNode,
"CLUSTER_CEMC");
364 <<
"CLUSTER_CEMC node is missing, can't collect EMCal clusters"
372 for(
auto entry : cemcMap){
378 CLHEP::Hep3Vector
origin(0, 0, 0);
391 RawClusterContainer *ihcalContainer = findNode::getClass<RawClusterContainer>(topNode,
"CLUSTER_HCALIN");
397 <<
"CLUSTER_HCALIN node is missing, can't collect EMCal clusters"
405 for(
auto entry : ihcalMap){
411 CLHEP::Hep3Vector
origin(0, 0, 0);
424 RawClusterContainer *ohcalContainer = findNode::getClass<RawClusterContainer>(topNode,
"CLUSTER_HCALOUT");
430 <<
"CLUSTER_HCALOUT node is missing, can't collect EMCal clusters"
438 for(
auto entry : ohcalMap){
444 CLHEP::Hep3Vector
origin(0, 0, 0);
469 RawTowerContainer *cemcTowerContainer = findNode::getClass<RawTowerContainer>(topNode,
"TOWER_CALIB_CEMC");
470 RawTowerGeomContainer *cemcGeom = findNode::getClass<RawTowerGeomContainer>(topNode,
"TOWERGEOM_CEMC");
472 if(cemcTowerContainer && cemcGeom)
494 RawTowerContainer *ihcalTowerContainer = findNode::getClass<RawTowerContainer>(topNode,
"TOWER_CALIB_HCALIN");
495 RawTowerGeomContainer *ihcalGeom = findNode::getClass<RawTowerGeomContainer>(topNode,
"TOWERGEOM_HCALIN");
497 if(ihcalTowerContainer && ihcalGeom)
519 RawTowerContainer *ohcalTowerContainer = findNode::getClass<RawTowerContainer>(topNode,
"TOWER_CALIB_HCALOUT");
520 RawTowerGeomContainer *ohcalGeom = findNode::getClass<RawTowerGeomContainer>(topNode,
"TOWERGEOM_HCALOUT");
522 if(ohcalTowerContainer && ohcalGeom)
553 RawTowerContainer *cemcTowerContainer = findNode::getClass<RawTowerContainer>(topNode,
"TOWER_SIM_CEMC");
554 RawTowerGeomContainer *cemcGeom = findNode::getClass<RawTowerGeomContainer>(topNode,
"TOWERGEOM_CEMC");
556 if(cemcTowerContainer && cemcGeom)
578 RawTowerContainer *ihcalTowerContainer = findNode::getClass<RawTowerContainer>(topNode,
"TOWER_SIM_HCALIN");
579 RawTowerGeomContainer *ihcalGeom = findNode::getClass<RawTowerGeomContainer>(topNode,
"TOWERGEOM_HCALIN");
581 if(ihcalTowerContainer && ihcalGeom)
602 RawTowerContainer *ohcalTowerContainer = findNode::getClass<RawTowerContainer>(topNode,
"TOWER_SIM_HCALOUT");
603 RawTowerGeomContainer *ohcalGeom = findNode::getClass<RawTowerGeomContainer>(topNode,
"TOWERGEOM_HCALOUT");
605 if(ohcalTowerContainer && ohcalGeom)
635 PHHepMCGenEventMap *hepmceventmap = findNode::getClass<PHHepMCGenEventMap>(topNode,
"PHHepMCGenEventMap");
636 if (!hepmceventmap) std::cout <<
PHWHERE <<
"HEPMC event map node is missing, can't collected HEPMC truth particles"<< std::endl;
639 eventIter != hepmceventmap->
end(); ++eventIter) {
648 HepMC::GenEvent *truthevent = hepmcevent->
getEvent();
651 <<
"no evt pointer under phhepmvgeneventmap found "
657 for (HepMC::GenEvent::particle_const_iterator iter = truthevent->particles_begin();
658 iter != truthevent->particles_end(); ++iter) {
665 + (*iter)->momentum().py() * (*iter)->momentum().py());
668 if (m_hepmc >= 20000)
break;
681 if (!truthinfo) std::cout <<
PHWHERE <<
"PHG4TruthInfoContainer node is missing, can't collect G4 truth particles"<< std::endl;
686 iter != range.second; ++iter) {
698 if (m_g4_eta[
m_g4] != m_g4_eta[
m_g4]) m_g4_eta[
m_g4] = -999;
703 if (m_g4 >= 20000)
break;
709 siter != second_range.second; ++siter) {
710 if (
m_g4 >= 19999)
break;
721 if (m_g4_eta[
m_g4] != m_g4_eta[
m_g4]) m_g4_eta[
m_g4] = -999;
741 if (!truthinfo) std::cout <<
PHWHERE <<
"PHG4TruthInfoContainer node is missing, can't collect additional truth particles"<< std::endl;
746 if (!vertex.empty()) vertex.clear();
767 if (vertex.find(vtx->
get_id()) != vertex.end()) {
777 PHG4HitContainer* blackhole = findNode::getClass<PHG4HitContainer>(topNode,
"G4HIT_BH_1");
778 if (!blackhole) std::cout <<
"No blackhole" << std::endl;
783 hit_iter != bh_hit_range.second; hit_iter++) {
784 PHG4Hit *this_hit = hit_iter->second;
803 float x = projectedState->
get_x();
804 float y = projectedState->
get_y();
805 float z = projectedState->
get_z();
807 float theta = acos(z / sqrt(x*x + y*y + z*z) );
809 return -log( tan(theta/2.0) );
813 float x = projectedState->
get_x();
814 float y = projectedState->
get_y();
821 float& dca3dxy,
float& dca3dz,
822 float& dca3dxysigma,
float& dca3dzsigma)
832 auto svtxVertex = vertexmap->
get(vtxid);
837 svtxVertex->get_z());
841 Acts::ActsSymMatrix<3> posCov;
842 for(
int i = 0;
i < 3; ++
i)
844 for(
int j = 0;
j < 3; ++
j)
851 float phi = atan2(
r(1),
r(0));
856 rot(0,1) = -sin(phi);
865 rot_T = rot.transpose();
868 Acts::ActsSymMatrix<3> rotCov = rot * posCov * rot_T;
872 dca3dxysigma = sqrt(rotCov(0,0));
873 dca3dzsigma = sqrt(rotCov(2,2));
887 m_centraltree =
new TTree(
"centraltree",
"Tree of centralities");
893 m_tracktree =
new TTree(
"tracktree",
"Tree of svtx tracks");
951 m_clustertree =
new TTree(
"clustertree",
"Tree of raw clusters");
980 m_towertree =
new TTree(
"towertree",
"Tree of raw towers");
1009 m_simtowertree =
new TTree(
"simtowertree",
"Tree of raw simtowers");
1039 m_hepmctree =
new TTree(
"hepmctree",
"Tree of truth hepmc info and particles");
1051 m_g4tree =
new TTree(
"g4tree",
"Tree of truth G4 particles");
1065 m_addtruthtree =
new TTree(
"addtruthtree",
"Tree of additional truth information");