15 using namespace findNode;
19 namespace SColdQcdCorrelatorAnalysis {
23 bool SCorrelatorJetTree::IsGoodVertex(
const CLHEP::Hep3Vector vtx) {
27 cout <<
"SCorrelatorJetTree::IsGoodVertex(CLHEP::Hep3Vector) Checking if event is good..." << endl;
31 const double vr = sqrt((vtx.x() * vtx.x()) + (vtx.y() * vtx.y()));
34 const bool isInEvtVzRange = ((vtx.z() > m_evtVzRange[0]) && (vtx.z() < m_evtVzRange[1]));
35 const bool isInEvtVrRange = ((abs(vr) > m_evtVrRange[0]) && (abs(vr) < m_evtVrRange[1]));
36 const bool isGoodVertex = (isInEvtVzRange && isInEvtVrRange);
47 cout <<
"SCorrelatorJetTree::GetEventVariables(PHCompositeNode*) Grabbing event info..." << endl;
52 m_recoSumECal = GetSumECalEne(topNode);
53 m_recoSumHCal = GetSumHCalEne(topNode);
55 m_trueNumChrgPars = GetNumChrgPars(topNode);
56 m_trueSumPar = GetSumParEne(topNode);
68 cout <<
"SCorrelatorJetTree::GetPartonInfo(PHCompositeNode*) Grabbing parton info..." << endl;
78 unsigned int iOutPart = 0;
79 HepMC::GenEvent* mcEvt =
GetMcEvent(topNode, iPartonEvt);
80 for (HepMC::GenEvent::particle_const_iterator itPar = mcEvt -> particles_begin(); itPar != mcEvt -> particles_end(); ++itPar) {
84 const bool foundBothPartons = (iOutPart == 2);
85 if (!isOutParton || foundBothPartons)
continue;
88 const double parPx = (*itPar) ->
momentum().px();
89 const double parPy = (*itPar) ->
momentum().py();
90 const double parPz = (*itPar) ->
momentum().pz();
91 const double parVx = (*itPar) -> production_vertex() ->
position().x();
92 const double parVy = (*itPar) -> production_vertex() ->
position().y();
93 const double parVz = (*itPar) -> production_vertex() ->
position().z();
96 m_partonID[iOutPart] = (*itPar) -> pdg_id();
97 m_partonMom[iOutPart] = CLHEP::Hep3Vector(parPx, parPy, parPz);
98 m_trueVtx = CLHEP::Hep3Vector(parVx, parVy, parVz);
111 cout <<
"SCorrelatorJetTree::GetNumTrks(PHCompositeNode*) Calculating no. of tracks..." << endl;
121 track = itTrk -> second;
122 if (!track)
continue;
125 const bool isGoodTrack = IsGoodTrack(track, topNode);
126 if (isGoodTrack) ++nTrk;
139 cout <<
"SCorrelatorJetTree::GetNumChrgPars(PHCompositeNode*) Calculating no. of charged particles..." << endl;
144 for (
const int evtToGrab : m_vecEvtsToGrab) {
147 HepMC::GenEvent* mcEvt =
GetMcEvent(topNode, evtToGrab);
148 for (HepMC::GenEvent::particle_const_iterator itPar = mcEvt -> particles_begin(); itPar != mcEvt -> particles_end(); ++itPar) {
151 const bool isFinalState = ((*itPar) ->
status() == 1);
152 if (!isFinalState)
continue;
155 const bool isGoodPar = IsGoodParticle(*itPar);
156 if (isGoodPar) ++nPar;
170 cout <<
"SCorrelatorJetTree::GetSumECalEne(PHCompositeNode*) Getting sum of ECal energy..." << endl;
178 double eneECalSum = 0.;
181 for (itEMClust = emClustRange.first; itEMClust != emClustRange.second; itEMClust++) {
184 const RawCluster* emClust = itEMClust -> second;
185 if (!emClust)
continue;
188 const double vX = vtx -> get_x();
189 const double vY = vtx -> get_y();
190 const double vZ = vtx -> get_z();
192 CLHEP::Hep3Vector hepVecVtx = CLHEP::Hep3Vector(vX, vY, vZ);
196 const bool isGoodECal = IsGoodECal(hepVecEMClust);
197 if (isGoodECal) eneECalSum += hepVecEMClust.mag();
210 cout <<
"SCorrelatorJetTree::GetSumHCalEne(PHCompositeNode*) Getting sum of HCal energy..." << endl;
219 double eneIHCalSum = 0.;
222 for (itIHClust = ihClustRange.first; itIHClust != ihClustRange.second; itIHClust++) {
225 const RawCluster* ihClust = itIHClust -> second;
226 if (!ihClust)
continue;
229 const double vX = vtx -> get_x();
230 const double vY = vtx -> get_y();
231 const double vZ = vtx -> get_z();
233 CLHEP::Hep3Vector hepVecVtx = CLHEP::Hep3Vector(vX, vY, vZ);
237 const bool isGoodHCal = IsGoodECal(hepVecIHClust);
238 if (isGoodHCal) eneIHCalSum += hepVecIHClust.mag();
242 double eneOHCalSum = 0.;
245 for (itOHClust = ohClustRange.first; itOHClust != ohClustRange.second; itOHClust++) {
248 const RawCluster* ohClust = itOHClust -> second;
249 if (!ohClust)
continue;
252 const double vX = vtx -> get_x();
253 const double vY = vtx -> get_y();
254 const double vZ = vtx -> get_z();
256 CLHEP::Hep3Vector hepVecVtx = CLHEP::Hep3Vector(vX, vY, vZ);
260 const bool isGoodHCal = IsGoodECal(hepVecOHClust);
261 if (isGoodHCal) eneOHCalSum += hepVecOHClust.mag();
264 const double eneHCalSum = eneIHCalSum + eneOHCalSum;
275 cout <<
"SCorrelatorJetTree::GetSumParEne(PHComposite*) Calculating sum of particle energy..." << endl;
280 for (
const int evtToGrab : m_vecEvtsToGrab) {
282 HepMC::GenEvent* mcEvt =
GetMcEvent(topNode, evtToGrab);
283 for (HepMC::GenEvent::particle_const_iterator itPar = mcEvt -> particles_begin(); itPar != mcEvt -> particles_end(); ++itPar) {
286 const bool isFinalState = ((*itPar) ->
status() == 1);
287 if (!isFinalState)
continue;
290 const bool isGoodPar = IsGoodParticle(*itPar,
true);
291 if (isGoodPar) eSumPar += (*itPar) ->
momentum().e();
305 cout <<
"SCorrelatorJetTree::GetRecoVtx(PHComposite*) Getting reconstructed vertex..." << endl;
309 const double vtxX = vtx -> get_x();
310 const double vtxY = vtx -> get_y();
311 const double vtxZ = vtx -> get_z();
312 const CLHEP::Hep3Vector recoVtx = CLHEP::Hep3Vector(vtxX, vtxY, vtxZ);