diff --git a/PWGJE/Tasks/statPromptPhoton.cxx b/PWGJE/Tasks/statPromptPhoton.cxx index adb6d7e0998..fcf4e3b8214 100644 --- a/PWGJE/Tasks/statPromptPhoton.cxx +++ b/PWGJE/Tasks/statPromptPhoton.cxx @@ -91,7 +91,6 @@ struct statPromptPhoton { Configurable cfgEmcTrigger{"cfgEmcTrigger", true, "Require EMC readout for event"}; Configurable cfgGeoCut{"cfgGeoCut", true, "Performs Geometric TPC cut"}; - // INIT void init(InitContext const&) { @@ -101,17 +100,17 @@ struct statPromptPhoton { histos.add("REC_nEvents", "REC_nEvents", kTH1F, {{4, 0.0, 4.0}}); histos.add("REC_Cluster_QA", "REC_Cluster_QA", kTH1F, {{10, -0.5, 9.5}}); histos.add("REC_PtHadSum_Photon", "REC_PtHadSum_Photon", kTH1F, {pthadAxis}); - histos.add("REC_TrackPhi_photontrigger", "REC_TrackPhi_photontrigger", kTH1F, {{64, 0, 2*TMath::Pi()}}); - histos.add("REC_TrackEta_photontrigger", "REC_TrackEta_photontrigger", kTH1F, {{100,-1,1}}); - histos.add("REC_ClusterPhi", "REC_ClusterPhi", kTH1F, {{640*2, 0, 2*TMath::Pi()}}); - histos.add("REC_ClusterEta", "REC_ClusterEta", kTH1F, {{100,-1,1}}); + histos.add("REC_TrackPhi_photontrigger", "REC_TrackPhi_photontrigger", kTH1F, {{64, 0, 2 * TMath::Pi()}}); + histos.add("REC_TrackEta_photontrigger", "REC_TrackEta_photontrigger", kTH1F, {{100, -1, 1}}); + histos.add("REC_ClusterPhi", "REC_ClusterPhi", kTH1F, {{640 * 2, 0, 2 * TMath::Pi()}}); + histos.add("REC_ClusterEta", "REC_ClusterEta", kTH1F, {{100, -1, 1}}); histos.add("REC_Track_Pt", "REC_Track_Pt", kTH1F, {{82, -1.0, 40.0}}); - histos.add("REC_Track_Phi", "REC_Track_Phi", kTH1F, {{640*2, 0, 2*TMath::Pi()}}); - histos.add("REC_Track_PhiPrime_Pt", "REC_Track_PhiPrime_Pt", kTH2F, {{640, 0, 2*TMath::Pi()},{82, -1.0, 40.0}}); - histos.add("REC_Cluster_PhiPrime_Pt", "REC_Cluster_PhiPrime_Pt", kTH2F, {{640, 0, 2*TMath::Pi()},{82, -1.0, 40.0}}); - histos.add("REC_Cluster_PhiPrime_Pt_AC", "REC_Cluster_PhiPrime_Pt_AC", kTH2F, {{640, 0, 2*TMath::Pi()},{82, -1.0, 40.0}}); - histos.add("REC_Cluster_PhiPrime_Pt_C", "REC_Cluster_PhiPrime_Pt_C", kTH2F, {{640, 0, 2*TMath::Pi()},{82, -1.0, 40.0}}); + histos.add("REC_Track_Phi", "REC_Track_Phi", kTH1F, {{640 * 2, 0, 2 * TMath::Pi()}}); + histos.add("REC_Track_PhiPrime_Pt", "REC_Track_PhiPrime_Pt", kTH2F, {{640, 0, 2 * TMath::Pi()}, {82, -1.0, 40.0}}); + histos.add("REC_Cluster_PhiPrime_Pt", "REC_Cluster_PhiPrime_Pt", kTH2F, {{640, 0, 2 * TMath::Pi()}, {82, -1.0, 40.0}}); + histos.add("REC_Cluster_PhiPrime_Pt_AC", "REC_Cluster_PhiPrime_Pt_AC", kTH2F, {{640, 0, 2 * TMath::Pi()}, {82, -1.0, 40.0}}); + histos.add("REC_Cluster_PhiPrime_Pt_C", "REC_Cluster_PhiPrime_Pt_C", kTH2F, {{640, 0, 2 * TMath::Pi()}, {82, -1.0, 40.0}}); histos.add("REC_Cluster_Particle_Pt", "REC_Cluster_Particle_Pt", kTH1F, {{82, -1.0, 40.0}}); histos.add("REC_Cluster_ParticleWITHtrack_Pt", "REC_Cluster_ParticleWITHtrack_Pt", kTH1F, {{82, -1.0, 40.0}}); @@ -123,7 +122,7 @@ struct statPromptPhoton { histos.add("REC_Impurity_ParticleWITHtrack_Pt_PhiPrime", "REC_Impurity_ParticleWITHtrack_Pt_PhiPrime", kTH2F, {{82, -1.0, 40.0}, {628, -2 * TMath::Pi(), 2 * TMath::Pi()}}); histos.add("REC_Cluster_ParticleWITHtrack_Pt_Eta", "REC_Cluster_ParticleWITHtrack_Pt_Eta", kTH2F, {{82, -1.0, 40.0}, {628, -2 * TMath::Pi(), 2 * TMath::Pi()}}); - + histos.add("REC_Cluster_ParticleWITHOUTtrack_Pt", "REC_Cluster_ParticleWITHOUTtrack_Pt", kTH1F, {{82, -1.0, 40.0}}); histos.add("REC_Cluster_ParticleWITHOUTtrack_Phi", "REC_Cluster_ParticleWITHOUTtrack_Phi", kTH1F, {{628, -2 * TMath::Pi(), 2 * TMath::Pi()}}); histos.add("REC_Cluster_ParticleWITHOUTtrack_Eta", "REC_Cluster_ParticleWITHOUTtrack_Eta", kTH1F, {{628, -2 * TMath::Pi(), 2 * TMath::Pi()}}); @@ -132,36 +131,35 @@ struct statPromptPhoton { histos.add("REC_Cluster_ParticleWITHOUTtrack_Pt_Eta", "REC_Cluster_ParticleWITHOUTtrack_Pt_Eta", kTH2F, {{82, -1.0, 40.0}, {628, -2 * TMath::Pi(), 2 * TMath::Pi()}}); histos.add("REC_Impurity_ParticleWITHOUTtrack_Pt_PhiPrime", "REC_Impurity_ParticleWITHOUTtrack_Pt_PhiPrime", kTH2F, {{82, -1.0, 40.0}, {628, -2 * TMath::Pi(), 2 * TMath::Pi()}}); - histos.add("REC_TrackPt_ClusterE", "REC_TrackPt_ClusterE", kTH2F, {{82, -1.0, 40.0},{82, -1.0, 40.0}}); - histos.add("REC_ParticlePt_ClusterE", "REC_ParticlePt_ClusterE", kTH2F, {{82, -1.0, 40.0},{82, -1.0, 40.0}}); + histos.add("REC_TrackPt_ClusterE", "REC_TrackPt_ClusterE", kTH2F, {{82, -1.0, 40.0}, {82, -1.0, 40.0}}); + histos.add("REC_ParticlePt_ClusterE", "REC_ParticlePt_ClusterE", kTH2F, {{82, -1.0, 40.0}, {82, -1.0, 40.0}}); histos.add("REC_TrackPt_Phi_Eta", "REC_TrackPt_Phi_Eta", kTH2F, {{628, -2 * TMath::Pi(), 2 * TMath::Pi()}, {628, -2 * TMath::Pi(), 2 * TMath::Pi()}}); histos.add("REC_ParticlePt_Phi_Eta", "REC_ParticlePt_Phi_Eta", kTH2F, {{628, -2 * TMath::Pi(), 2 * TMath::Pi()}, {628, -2 * TMath::Pi(), 2 * TMath::Pi()}}); - + histos.add("REC_True_v_Cluster_Phi", "REC_True_v_Cluster_Phi", kTH1F, {{628, -2 * TMath::Pi(), 2 * TMath::Pi()}}); histos.add("REC_True_v_Cluster_Eta", "REC_True_v_Cluster_Eta", kTH1F, {{628, -2 * TMath::Pi(), 2 * TMath::Pi()}}); histos.add("REC_TrueImpurity_v_Cluster_Phi", "REC_TrueImpurity_v_Cluster_Phi", kTH1F, {{628, -2 * TMath::Pi(), 2 * TMath::Pi()}}); histos.add("REC_TrueImpurity_v_Cluster_Eta", "REC_TrueImpurity_v_Cluster_Eta", kTH1F, {{628, -2 * TMath::Pi(), 2 * TMath::Pi()}}); histos.add("REC_TrueImpurity_v_Cluster_PhiAbs", "REC_TrueImpurity_v_Cluster_PhiAbs", kTH1F, {{628, -2 * TMath::Pi(), 2 * TMath::Pi()}}); histos.add("REC_TrueImpurity_v_Cluster_EtaAbs", "REC_TrueImpurity_v_Cluster_EtaAbs", kTH1F, {{628, -2 * TMath::Pi(), 2 * TMath::Pi()}}); - + histos.add("REC_TrueImpurity_v_Cluster_Phi_Eta", "REC_TrueImpurity_v_Cluster_Phi_Eta", kTH2F, {{628, -2 * TMath::Pi(), 2 * TMath::Pi()}, {628, -2 * TMath::Pi(), 2 * TMath::Pi()}}); histos.add("REC_Track_v_Cluster_Phi", "REC_Track_v_Cluster_Phi", kTH1F, {{628, -2 * TMath::Pi(), 2 * TMath::Pi()}}); histos.add("REC_Track_v_Cluster_Eta", "REC_Track_v_Cluster_Eta", kTH1F, {{628, -2 * TMath::Pi(), 2 * TMath::Pi()}}); - histos.add("REC_Track_v_Cluster_Phi_Pt", "REC_Track_v_Cluster_Phi_Pt", kTH2F, {{628, -2 * TMath::Pi(), 2 * TMath::Pi()}, {82,-1.0,40.0}}); - histos.add("REC_Track_v_Cluster_Eta_Pt", "REC_Track_v_Cluster_Eta_Pt", kTH2F, {{628, -2 * TMath::Pi(), 2 * TMath::Pi()}, {82,-1.0,40.0}}); + histos.add("REC_Track_v_Cluster_Phi_Pt", "REC_Track_v_Cluster_Phi_Pt", kTH2F, {{628, -2 * TMath::Pi(), 2 * TMath::Pi()}, {82, -1.0, 40.0}}); + histos.add("REC_Track_v_Cluster_Eta_Pt", "REC_Track_v_Cluster_Eta_Pt", kTH2F, {{628, -2 * TMath::Pi(), 2 * TMath::Pi()}, {82, -1.0, 40.0}}); histos.add("REC_Track_v_Cluster_Phi_Eta", "REC_Track_v_Cluster_Phi_Eta", kTH2F, {{628, -2 * TMath::Pi(), 2 * TMath::Pi()}, {628, -2 * TMath::Pi(), 2 * TMath::Pi()}}); - + histos.add("REC_Track_v_Cluster_Phi_AC", "REC_Track_v_Cluster_Phi_AC", kTH1F, {{628, -2 * TMath::Pi(), 2 * TMath::Pi()}}); histos.add("REC_Track_v_Cluster_Eta_AC", "REC_Track_v_Cluster_Eta_AC", kTH1F, {{628, -2 * TMath::Pi(), 2 * TMath::Pi()}}); histos.add("REC_Track_v_Cluster_Phi_Eta_AC", "REC_Track_v_Cluster_Phi_Eta_AC", kTH2F, {{628, -2 * TMath::Pi(), 2 * TMath::Pi()}, {628, -2 * TMath::Pi(), 2 * TMath::Pi()}}); - + histos.add("REC_Track_v_Cluster_Phi_C", "REC_Track_v_Cluster_Phi_C", kTH1F, {{628, -2 * TMath::Pi(), 2 * TMath::Pi()}}); histos.add("REC_Track_v_Cluster_Eta_C", "REC_Track_v_Cluster_Eta_C", kTH1F, {{628, -2 * TMath::Pi(), 2 * TMath::Pi()}}); histos.add("REC_Track_v_Cluster_Phi_Eta_C", "REC_Track_v_Cluster_Phi_Eta_C", kTH2F, {{628, -2 * TMath::Pi(), 2 * TMath::Pi()}, {628, -2 * TMath::Pi(), 2 * TMath::Pi()}}); - histos.add("REC_SumPt_BC", "REC_SumPt_BC", kTH1F, {{628, -2 * TMath::Pi(), 2 * TMath::Pi()}}); histos.add("REC_SumPt_AC", "REC_SumPt_AC", kTH1F, {{628, -2 * TMath::Pi(), 2 * TMath::Pi()}}); histos.add("REC_M02_BC", "REC_M02_BC", kTH1F, {{628, -2 * TMath::Pi(), 2 * TMath::Pi()}}); @@ -169,21 +167,21 @@ struct statPromptPhoton { histos.add("REC_Trigger_Purity", "REC_Trigger_Purity", kTH1F, {{4, 0.0, 4.0}}); histos.add("REC_Trigger_Energy", "REC_Trigger_Energy", kTH1F, {{82, -1.0, 40.0}}); - - histos.add("REC_Trigger_Purity_v_Energy", "REC_Trigger_Purity_v_Energy", kTH2F, {{4, 0.0, 4.0},{82, -1.0, 40.0}}); - + + histos.add("REC_Trigger_Purity_v_Energy", "REC_Trigger_Purity_v_Energy", kTH2F, {{4, 0.0, 4.0}, {82, -1.0, 40.0}}); + histos.add("REC_Trigger_Energy_GOOD", "REC_Trigger_Energy_GOOD", kTH1F, {{82, -1.0, 40.0}}); histos.add("REC_Trigger_Energy_MISS", "REC_Trigger_Energy_MISS", kTH1F, {{82, -1.0, 40.0}}); histos.add("REC_Trigger_Energy_FAKE", "REC_Trigger_Energy_FAKE", kTH1F, {{82, -1.0, 40.0}}); histos.add("REC_All_Energy", "REC_All_Energy", kTH1F, {{82, -1.0, 40.0}}); histos.add("REC_Impurity_Energy", "REC_Impurity_Energy", kTH1F, {{82, -1.0, 40.0}}); - histos.add("REC_Impurity_Energy_v_Cluster_Phi", "REC_Impurity_Energy_v_Cluster_Phi", kTH2F, {{82, -1.0, 40.0},{628, -2 * TMath::Pi(), 2 * TMath::Pi()}}); - histos.add("REC_Impurity_Energy_v_ClusterE_Phi", "REC_Impurity_Energy_v_ClusterE_Phi", kTH2F, {{82, -1.0, 40.0},{628, -2 * TMath::Pi(), 2 * TMath::Pi()}}); - histos.add("REC_Impurity_Energy_v_ClusterEoP_Phi", "REC_Impurity_Energy_v_ClusterEoP_Phi", kTH2F, {{82, -1.0, 40.0},{628, -2 * TMath::Pi(), 2 * TMath::Pi()}}); + histos.add("REC_Impurity_Energy_v_Cluster_Phi", "REC_Impurity_Energy_v_Cluster_Phi", kTH2F, {{82, -1.0, 40.0}, {628, -2 * TMath::Pi(), 2 * TMath::Pi()}}); + histos.add("REC_Impurity_Energy_v_ClusterE_Phi", "REC_Impurity_Energy_v_ClusterE_Phi", kTH2F, {{82, -1.0, 40.0}, {628, -2 * TMath::Pi(), 2 * TMath::Pi()}}); + histos.add("REC_Impurity_Energy_v_ClusterEoP_Phi", "REC_Impurity_Energy_v_ClusterEoP_Phi", kTH2F, {{82, -1.0, 40.0}, {628, -2 * TMath::Pi(), 2 * TMath::Pi()}}); + + histos.add("REC_Impurity_Energy_v_Cluster_Energy", "REC_Impurity_Energy_v_Cluster_Energy", kTH2F, {{82, -1.0, 40.0}, {82, -1.0, 40.0}}); - histos.add("REC_Impurity_Energy_v_Cluster_Energy", "REC_Impurity_Energy_v_Cluster_Energy", kTH2F, {{82, -1.0, 40.0},{82, -1.0, 40.0}}); - histos.add("REC_True_Trigger_Energy", "REC_True_Trigger_Energy", kTH1F, {{82, -1.0, 40.0}}); histos.add("REC_True_Prompt_Trigger_Energy", "REC_True_Prompt_Trigger_Energy", kTH1F, {{82, -1.0, 40.0}}); @@ -204,40 +202,38 @@ struct statPromptPhoton { histos.add("GEN_dR_Photon", "GEN_dR_Photon", kTH1F, {{628, 0.0, 2 * TMath::Pi()}}); histos.add("GEN_dR_Stern", "GEN_dR_Stern", kTH1F, {{628, 0.0, 2 * TMath::Pi()}}); - histos.add("DATA_nEvents", "DATA_nEvents", kTH1F, {{4, 0.0, 4.0}}); histos.add("DATA_M02_BC", "DATA_M02_BC", kTH1F, {{628, -2 * TMath::Pi(), 2 * TMath::Pi()}}); histos.add("DATA_M02_AC", "DATA_M02_AC", kTH1F, {{628, -2 * TMath::Pi(), 2 * TMath::Pi()}}); histos.add("DATA_Cluster_QA", "DATA_Cluster_QA", kTH1F, {{10, -0.5, 9.5}}); - histos.add("DATA_ClusterPhi", "DATA_ClusterPhi", kTH1F, {{640*2, 0, 2*TMath::Pi()}}); - histos.add("DATA_ClusterEta", "DATA_ClusterEta", kTH1F, {{100,-1,1}}); + histos.add("DATA_ClusterPhi", "DATA_ClusterPhi", kTH1F, {{640 * 2, 0, 2 * TMath::Pi()}}); + histos.add("DATA_ClusterEta", "DATA_ClusterEta", kTH1F, {{100, -1, 1}}); histos.add("DATA_All_Energy", "DATA_All_Energy", kTH1F, {{82, -1.0, 40.0}}); - histos.add("DATA_Cluster_PhiPrime_Pt", "DATA_Cluster_PhiPrime_Pt", kTH2F, {{640, 0, 2*TMath::Pi()},{82, -1.0, 40.0}}); - histos.add("DATA_Cluster_PhiPrime_Pt_AC", "DATA_Cluster_PhiPrime_Pt_AC", kTH2F, {{640, 0, 2*TMath::Pi()},{82, -1.0, 40.0}}); - histos.add("DATA_Cluster_PhiPrime_Pt_C", "DATA_Cluster_PhiPrime_Pt_C", kTH2F, {{640, 0, 2*TMath::Pi()},{82, -1.0, 40.0}}); + histos.add("DATA_Cluster_PhiPrime_Pt", "DATA_Cluster_PhiPrime_Pt", kTH2F, {{640, 0, 2 * TMath::Pi()}, {82, -1.0, 40.0}}); + histos.add("DATA_Cluster_PhiPrime_Pt_AC", "DATA_Cluster_PhiPrime_Pt_AC", kTH2F, {{640, 0, 2 * TMath::Pi()}, {82, -1.0, 40.0}}); + histos.add("DATA_Cluster_PhiPrime_Pt_C", "DATA_Cluster_PhiPrime_Pt_C", kTH2F, {{640, 0, 2 * TMath::Pi()}, {82, -1.0, 40.0}}); histos.add("DATA_Track_v_Cluster_Phi", "DATA_Track_v_Cluster_Phi", kTH1F, {{628, -2 * TMath::Pi(), 2 * TMath::Pi()}}); histos.add("DATA_Track_v_Cluster_Eta", "DATA_Track_v_Cluster_Eta", kTH1F, {{628, -2 * TMath::Pi(), 2 * TMath::Pi()}}); - histos.add("DATA_Track_v_Cluster_Phi_Pt", "DATA_Track_v_Cluster_Phi_Pt", kTH2F, {{628, -2 * TMath::Pi(), 2 * TMath::Pi()}, {82,-1.0,40.0}}); + histos.add("DATA_Track_v_Cluster_Phi_Pt", "DATA_Track_v_Cluster_Phi_Pt", kTH2F, {{628, -2 * TMath::Pi(), 2 * TMath::Pi()}, {82, -1.0, 40.0}}); histos.add("DATA_Track_v_Cluster_Phi_Eta", "DATA_Track_v_Cluster_Phi_Eta", kTH2F, {{628, -2 * TMath::Pi(), 2 * TMath::Pi()}, {628, -2 * TMath::Pi(), 2 * TMath::Pi()}}); histos.add("DATA_SumPt_BC", "DATA_SumPt_BC", kTH1F, {{628, -2 * TMath::Pi(), 2 * TMath::Pi()}}); histos.add("DATA_SumPt_AC", "DATA_SumPt_AC", kTH1F, {{628, -2 * TMath::Pi(), 2 * TMath::Pi()}}); histos.add("DATA_Trigger_V_PtHadSum_Photon", "DATA_Trigger_V_PtHadSum_Photon", kTH2F, {{100, 0, 100}, pthadAxis}); histos.add("DATA_PtHadSum_Photon", "DATA_PtHadSum_Photon", kTH1F, {pthadAxis}); histos.add("DATA_Trigger_Energy", "DATA_Trigger_Energy", kTH1F, {{82, -1.0, 40.0}}); - histos.add("DATA_Track_PhiPrime_Pt", "DATA_Track_PhiPrime_Pt", kTH2F, {{640, 0, 2*TMath::Pi()},{82, -1.0, 40.0}}); + histos.add("DATA_Track_PhiPrime_Pt", "DATA_Track_PhiPrime_Pt", kTH2F, {{640, 0, 2 * TMath::Pi()}, {82, -1.0, 40.0}}); histos.add("DATA_Track_Pt", "DATA_Track_Pt", kTH1F, {{82, -1.0, 40.0}}); - histos.add("DATA_Track_Phi", "DATA_Track_Phi", kTH1F, {{640*2, 0, 2*TMath::Pi()}}); - histos.add("DATA_TrackPhi_photontrigger", "DATA_TrackPhi_photontrigger", kTH1F, {{64, 0, 2*TMath::Pi()}}); - histos.add("DATA_TrackEta_photontrigger", "DATA_TrackEta_photontrigger", kTH1F, {{100,-1,1}}); + histos.add("DATA_Track_Phi", "DATA_Track_Phi", kTH1F, {{640 * 2, 0, 2 * TMath::Pi()}}); + histos.add("DATA_TrackPhi_photontrigger", "DATA_TrackPhi_photontrigger", kTH1F, {{64, 0, 2 * TMath::Pi()}}); + histos.add("DATA_TrackEta_photontrigger", "DATA_TrackEta_photontrigger", kTH1F, {{100, -1, 1}}); histos.add("DATA_Trigger_V_PtHadSum_Stern", "DATA_Trigger_V_PtHadSum_Stern", kTH2F, {{100, 0, 100}, pthadAxis}); - } // end of init Service ccdb; std::string runs = ""; double bfield = 0; - + Filter clusterDefinitionSelection = (o2::aod::emcalcluster::definition == cfgClusterDefinition) && (o2::aod::emcalcluster::time >= cfgMinTime) && (o2::aod::emcalcluster::time <= cfgMaxTime) && (o2::aod::emcalcluster::energy > cfgMinClusterEnergy) && (o2::aod::emcalcluster::nCells >= cfgMinNCells) && (o2::aod::emcalcluster::nlm <= cfgMaxNLM) && (o2::aod::emcalcluster::isExotic == cfgExoticContribution); Filter emccellfilter = aod::calo::caloType == 1; // mc emcal cell Filter PosZFilter = nabs(aod::jcollision::posZ) < cfgVtxCut; @@ -246,8 +242,8 @@ struct statPromptPhoton { using MCCells = o2::soa::Join; using MCClusters = o2::soa::Join; using Clusters = o2::aod::EMCALMCClusters; - - //using selectedCollisions = soa::Join; + + // using selectedCollisions = soa::Join; using selectedMCCollisions = aod::JMcCollisions; using TrackCandidates = soa::Join; @@ -257,14 +253,14 @@ struct statPromptPhoton { using filteredClusters = soa::Filtered; // using filteredCollisions = soa::Filtered; using filteredMCCollisions = soa::Filtered; - + Filter PosZFilter_JE = nabs(aod::jcollision::posZ) < cfgVtxCut; Filter clusterDefinitionSelection_JE = (o2::aod::jcluster::definition == cfgClusterDefinition) && (o2::aod::jcluster::time >= cfgMinTime) && (o2::aod::jcluster::time <= cfgMaxTime) && (o2::aod::jcluster::energy > cfgMinClusterEnergy) && (o2::aod::jcluster::nCells >= cfgMinNCells) && (o2::aod::jcluster::nlm <= cfgMaxNLM) && (o2::aod::jcluster::isExotic == cfgExoticContribution); - // using jTrackCandidates = soa::Join; + // using jTrackCandidates = soa::Join; using jTrackCandidates = soa::Join; using jDataTrackCandidates = soa::Join; - + using jMCClusters = o2::soa::Join; using jClusters = o2::soa::Join; using jselectedCollisions = soa::Join; @@ -272,7 +268,7 @@ struct statPromptPhoton { using jfilteredMCClusters = soa::Filtered; using jfilteredClusters = soa::Filtered; - //aod::JCollisions, aod::JCollisionPIs, aod::JCollisionBCs, aod::JEMCCollisionLbs + // aod::JCollisions, aod::JCollisionPIs, aod::JCollisionBCs, aod::JEMCCollisionLbs Preslice perClusterMatchedTracks = o2::aod::emcalclustercell::emcalclusterId; // Helper functions @@ -302,19 +298,19 @@ struct statPromptPhoton { double pt_track = track.pt(); if (!IsParticle) { - if constexpr (requires { track.trackId(); }) { - auto originaltrack = track.template track_as>(); - if (!trackSelection(originaltrack)) { - continue; - } //reject track - } else if constexpr (requires { track.sign(); }) { //checking for JTrack - //done checking for JTrack, now default to normal tracks - if (!trackSelection(track)) { - continue; - } //reject track - }// done checking for JTrack + if constexpr (requires { track.trackId(); }) { + auto originaltrack = track.template track_as>(); + if (!trackSelection(originaltrack)) { + continue; + } // reject track + } else if constexpr (requires { track.sign(); }) { // checking for JTrack + // done checking for JTrack, now default to normal tracks + if (!trackSelection(track)) { + continue; + } // reject track + } // done checking for JTrack } else { - if constexpr (requires { track.isPhysicalPrimary(); }) { + if constexpr (requires { track.isPhysicalPrimary(); }) { if (track.pt() < 0.15) { continue; } @@ -330,8 +326,8 @@ struct statPromptPhoton { int pdg = std::abs(track.pdgCode()); if (pdg != 211 && pdg != 321 && pdg != 2212) { continue; - } - } + } + } } if (IsStern || IsParticle) { if constexpr (requires { trigger.globalIndex(); }) { @@ -419,7 +415,7 @@ struct statPromptPhoton { ///////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////// - int nEventsGenMC = 0; + int nEventsGenMC = 0; // void processMCGen(filteredMCCollisions::iterator const& collision, soa::SmallGroups> const& recocolls, aod::McParticles const& mcParticles, filteredMCClusters const&) void processMCGen(filteredMCCollisions::iterator const& collision, soa::SmallGroups> const& recocolls, aod::JMcParticles const& mcParticles, jfilteredMCClusters const&) @@ -430,7 +426,7 @@ struct statPromptPhoton { } histos.fill(HIST("GEN_nEvents"), 0.5); if (fabs(collision.posZ()) > cfgVtxCut) - return; + return; if (recocolls.size() <= 0) // not reconstructed return; @@ -442,9 +438,9 @@ struct statPromptPhoton { return; histos.fill(HIST("GEN_nEvents"), 1.5); - if(cfgEmcTrigger){ - if (!recocoll.isEmcalReadout()) - return; + if (cfgEmcTrigger) { + if (!recocoll.isEmcalReadout()) + return; } histos.fill(HIST("GEN_nEvents"), 2.5); } @@ -456,10 +452,10 @@ struct statPromptPhoton { if (std::abs(mcPhoton.eta()) > cfgtrkMaxEta) continue; double pdgcode = fabs(mcPhoton.pdgCode()); - if(mcPhoton.isPhysicalPrimary()) { - if(pdgcode == 211 || pdgcode == 321 || pdgcode == 2212 || pdgcode == 11) { - histos.fill(HIST("GEN_Particle_Pt"), mcPhoton.pt()); - } + if (mcPhoton.isPhysicalPrimary()) { + if (pdgcode == 211 || pdgcode == 321 || pdgcode == 2212 || pdgcode == 11) { + histos.fill(HIST("GEN_Particle_Pt"), mcPhoton.pt()); + } } if (mcPhoton.getGenStatusCode() < 20) continue; @@ -509,70 +505,70 @@ struct statPromptPhoton { double truepthadsum = GetPtHadSum(mcParticles, lRealPhoton, cfgMinR, cfgMaxR, false, true, false); histos.fill(HIST("GEN_Trigger_V_PtHadSum_Photon"), mcPhoton.e(), truepthadsum); } - + // now we do all PROMPT photons - histos.fill(HIST("REC_True_Trigger_Energy"), mcPhoton.e()); - - int mompdg1 = 0; - int momindex1 = 0; - int momstatus1 = 0; - for (auto& photon_mom : mcPhoton.mothers_as()) { - if(mompdg1==0) { - mompdg1 = photon_mom.pdgCode(); - momindex1 = photon_mom.globalIndex(); - momstatus1 = photon_mom.getGenStatusCode(); - } - }//first photon loop - - if(std::fabs(mompdg1)<40 && std::fabs(mompdg1)>0){ - int mompdg2 = 0; - int momindex2 = 0; - int momstatus2 = 0; - int mompdg3 = 0; - int momindex3 = 0; - int momstatus3 = 0; - for (auto& mcPhoton_mom : mcParticles) { - if(mcPhoton_mom.globalIndex()==momindex1){ - for (auto& photon_momom : mcPhoton_mom.mothers_as()) { - if(mompdg2==0) { - mompdg2 = photon_momom.pdgCode(); - momindex2 = photon_momom.globalIndex(); - momstatus2 = photon_momom.getGenStatusCode(); - } - } - break; - } - }//2nd photon loop - if(std::fabs(mompdg2)<40 && std::fabs(mompdg2)>0){ - for (auto& mcPhoton_mom : mcParticles) { - if(mcPhoton_mom.globalIndex()==momindex2){ - for (auto& photon_momom : mcPhoton_mom.mothers_as()) { - if(mompdg3==0) { - mompdg3 = photon_momom.pdgCode(); - momindex3 = photon_momom.globalIndex(); - momstatus3 = photon_momom.getGenStatusCode(); - } - } - break; - } - }//3rd photon loop - }//2nd photon check - - std::cout<<"We have a GEN prompt photon"<()) { + if (mompdg1 == 0) { + mompdg1 = photon_mom.pdgCode(); + momindex1 = photon_mom.globalIndex(); + momstatus1 = photon_mom.getGenStatusCode(); + } + } // first photon loop + + if (std::fabs(mompdg1) < 40 && std::fabs(mompdg1) > 0) { + int mompdg2 = 0; + int momindex2 = 0; + int momstatus2 = 0; + int mompdg3 = 0; + int momindex3 = 0; + int momstatus3 = 0; + for (auto& mcPhoton_mom : mcParticles) { + if (mcPhoton_mom.globalIndex() == momindex1) { + for (auto& photon_momom : mcPhoton_mom.mothers_as()) { + if (mompdg2 == 0) { + mompdg2 = photon_momom.pdgCode(); + momindex2 = photon_momom.globalIndex(); + momstatus2 = photon_momom.getGenStatusCode(); + } + } + break; + } + } // 2nd photon loop + if (std::fabs(mompdg2) < 40 && std::fabs(mompdg2) > 0) { + for (auto& mcPhoton_mom : mcParticles) { + if (mcPhoton_mom.globalIndex() == momindex2) { + for (auto& photon_momom : mcPhoton_mom.mothers_as()) { + if (mompdg3 == 0) { + mompdg3 = photon_momom.pdgCode(); + momindex3 = photon_momom.globalIndex(); + momstatus3 = photon_momom.getGenStatusCode(); + } + } + break; + } + } // 3rd photon loop + } // 2nd photon check + + std::cout << "We have a GEN prompt photon" << std::endl; + std::cout << "Photon gen status code chain: " << std::endl; + std::cout << "Photon stat: " << mcPhoton.getGenStatusCode() << std::endl; + std::cout << "Photon index: " << mcPhoton.globalIndex() << std::endl; + std::cout << "Photon mompdg 1: " << mompdg1 << std::endl; + std::cout << "Photon momstatus 1: " << momstatus1 << std::endl; + std::cout << "Photon momindex 1: " << momindex1 << std::endl; + std::cout << "Photon mompdg 2: " << mompdg2 << std::endl; + std::cout << "Photon momstatus 2: " << momstatus2 << std::endl; + std::cout << "Photon momindex 2: " << momindex2 << std::endl; + std::cout << "Photon mompdg 3: " << mompdg3 << std::endl; + std::cout << "Photon momstatus 3: " << momstatus3 << std::endl; + std::cout << "Photon momindex 3: " << momindex3 << std::endl; + } // check for mother of OG + if (std::abs(mcPhoton.getGenStatusCode()) > 19 && std::abs(mcPhoton.getGenStatusCode()) < 90) { if (mcPhoton.isPhysicalPrimary()) { histos.fill(HIST("GEN_True_Prompt_Photon_Energy"), mcPhoton.e()); @@ -592,9 +588,10 @@ struct statPromptPhoton { } // end of process PROCESS_SWITCH(statPromptPhoton, processMCGen, "process MC Gen", true); - - int nEventsRecMC_JE = 0; - void processMCRec_JE(jfilteredCollisions::iterator const& collision, jfilteredMCClusters const& mcclusters, jTrackCandidates const& tracks, soa::Join const& caltracks, TrackCandidates const&, aod::JMcParticles const&, BcCandidates const&){ + + int nEventsRecMC_JE = 0; + void processMCRec_JE(jfilteredCollisions::iterator const& collision, jfilteredMCClusters const& mcclusters, jTrackCandidates const& tracks, soa::Join const& caltracks, TrackCandidates const&, aod::JMcParticles const&, BcCandidates const&) + { nEventsRecMC_JE++; if ((nEventsRecMC_JE + 1) % 10000 == 0) { @@ -603,61 +600,59 @@ struct statPromptPhoton { histos.fill(HIST("REC_nEvents"), 0.5); - //required cuts + // required cuts if (fabs(collision.posZ()) > cfgVtxCut) return; if (!collision.sel8()) return; - + histos.fill(HIST("REC_nEvents"), 1.5); - if(cfgEmcTrigger){ + if (cfgEmcTrigger) { if (!collision.isEmcalReadout()) - return; + return; } histos.fill(HIST("REC_nEvents"), 2.5); - - bool noTrk = true; - for ( auto& track : tracks) { + for (auto& track : tracks) { auto ogtrack = track.track_as(); if (!trackSelection(ogtrack)) { - continue; + continue; } - if(!ogtrack.isGlobalTrack()) { - continue; + if (!ogtrack.isGlobalTrack()) { + continue; } noTrk = false; break; } - if(noTrk) + if (noTrk) return; - + // now we do clusters - bool clustertrigger =false; + bool clustertrigger = false; for (auto& mccluster : mcclusters) { histos.fill(HIST("REC_M02_BC"), mccluster.m02()); - if(mccluster.m02()cfgHighM02) - continue; - if(mccluster.energy()cfgHighClusterE) - continue; - if(fabs(mccluster.eta())>cfgtrkMaxEta) - continue; - - histos.fill(HIST("REC_Cluster_QA"), 0.5); + if (mccluster.m02() < cfgLowM02) + continue; + if (mccluster.m02() > cfgHighM02) + continue; + if (mccluster.energy() < cfgLowClusterE) + continue; + if (mccluster.energy() > cfgHighClusterE) + continue; + if (fabs(mccluster.eta()) > cfgtrkMaxEta) + continue; + + histos.fill(HIST("REC_Cluster_QA"), 0.5); histos.fill(HIST("REC_M02_AC"), mccluster.m02()); histos.fill(HIST("REC_All_Energy"), mccluster.energy()); - histos.fill(HIST("REC_ClusterPhi"), mccluster.phi()); - histos.fill(HIST("REC_ClusterEta"), mccluster.eta()); - - bool photontrigger = false; //is a neutral cluster - bool chargetrigger = false; //is definitely not a neutral cluster + histos.fill(HIST("REC_ClusterPhi"), mccluster.phi()); + histos.fill(HIST("REC_ClusterEta"), mccluster.eta()); + + bool photontrigger = false; // is a neutral cluster + bool chargetrigger = false; // is definitely not a neutral cluster double photonPt = 0.0; double truephotonPt = 0.0; auto tracksofcluster = mccluster.matchedTracks_as>(); @@ -667,330 +662,322 @@ struct statPromptPhoton { /////////////// double phiPrimeC = mccluster.phi(); - phiPrimeC = phiPrimeC + TMath::Pi()/18.; - phiPrimeC = fmod(phiPrimeC, 2*TMath::Pi()/18.); + phiPrimeC = phiPrimeC + TMath::Pi() / 18.; + phiPrimeC = fmod(phiPrimeC, 2 * TMath::Pi() / 18.); double ptC = mccluster.energy(); - bool geocut = false; + bool geocut = false; histos.fill(HIST("REC_Cluster_PhiPrime_Pt"), phiPrimeC, mccluster.energy()); - if (phiPrimeC > (0.12/ptC + TMath::Pi()/18. + 0.035) || - phiPrimeC < (0.1/ptC/ptC + TMath::Pi()/18. - 0.025) ) { - geocut = false; - } else { - geocut = true; + if (phiPrimeC > (0.12 / ptC + TMath::Pi() / 18. + 0.035) || + phiPrimeC < (0.1 / ptC / ptC + TMath::Pi() / 18. - 0.025)) { + geocut = false; + } else { + geocut = true; } - - if(cfgGeoCut) { - if(geocut) { - histos.fill(HIST("REC_Cluster_PhiPrime_Pt_C"), phiPrimeC, mccluster.energy()); - continue; - } + + if (cfgGeoCut) { + if (geocut) { + histos.fill(HIST("REC_Cluster_PhiPrime_Pt_C"), phiPrimeC, mccluster.energy()); + continue; + } } - + histos.fill(HIST("REC_Cluster_PhiPrime_Pt_AC"), phiPrimeC, mccluster.energy()); - - //first, we check if veto is required + + // first, we check if veto is required double sumptT = 0; bool clusterqa = false; for (auto& ctrack : tracksofcluster) { - auto ogtrack = ctrack.track_as(); - if (!trackSelection(ogtrack)) { - continue; - } - if(!ogtrack.isGlobalTrack()) { - continue; - } - - bool nodoublecount = false; - double etaT = ogtrack.trackEtaEmcal(); - double etaC = mccluster.eta(); - double phiT = ogtrack.trackPhiEmcal(); - double phiC = mccluster.phi(); - double ptT = ctrack.pt(); - bool etatrigger = false; - bool phitrigger = false; - double phidiff = TVector2::Phi_mpi_pi(mccluster.phi()-ogtrack.phi()); - double etadiff = mccluster.eta()-ogtrack.eta(); - - // if(fabs(etaT - etaC) < (0.010 + pow(ptT+4.07,-2.5)) ) { - // etatrigger = true; - // } - - // if(fabs(TVector2::Phi_mpi_pi(phiT - phiC)) < (0.015 + pow(ptT+3.65,-2.0)) ) { - // phitrigger = true; - // } - - if(fabs(etadiff) < 0.05) { - etatrigger = true; - } - - if(fabs(phidiff) < 0.05) { - phitrigger = true; - } - - - if(etatrigger && phitrigger) { - chargetrigger = true; - sumptT+=ptT; - } - if(chargetrigger){ - if(!clusterqa) { - histos.fill(HIST("REC_Cluster_QA"), 1.5); - clusterqa=true; - } - } - histos.fill(HIST("REC_Track_v_Cluster_Phi"), phidiff); - histos.fill(HIST("REC_Track_v_Cluster_Eta"), etadiff); - - histos.fill(HIST("REC_Track_v_Cluster_Phi_Eta"), phidiff,etadiff); - - }//track of cluster loop - - if(chargetrigger && sumptT>0) { - double mccluster_over_sumptT = mccluster.energy()/sumptT; - histos.fill(HIST("REC_SumPt_BC"), mccluster_over_sumptT); - if(mccluster_over_sumptT < 1.7) { - histos.fill(HIST("REC_Cluster_QA"), 2.5); //veto fails, cluster is charged - } - else { - histos.fill(HIST("REC_Cluster_QA"), 3.5); //veto is good, cluster is converted to neutral cluster - // chargetrigger = false; - histos.fill(HIST("REC_SumPt_AC"), mccluster_over_sumptT); - } - }// sumptT check - - if(!chargetrigger) { - photontrigger = true; + auto ogtrack = ctrack.track_as(); + if (!trackSelection(ogtrack)) { + continue; + } + if (!ogtrack.isGlobalTrack()) { + continue; + } + + bool nodoublecount = false; + double etaT = ogtrack.trackEtaEmcal(); + double etaC = mccluster.eta(); + double phiT = ogtrack.trackPhiEmcal(); + double phiC = mccluster.phi(); + double ptT = ctrack.pt(); + bool etatrigger = false; + bool phitrigger = false; + double phidiff = TVector2::Phi_mpi_pi(mccluster.phi() - ogtrack.phi()); + double etadiff = mccluster.eta() - ogtrack.eta(); + + // if(fabs(etaT - etaC) < (0.010 + pow(ptT+4.07,-2.5)) ) { + // etatrigger = true; + // } + + // if(fabs(TVector2::Phi_mpi_pi(phiT - phiC)) < (0.015 + pow(ptT+3.65,-2.0)) ) { + // phitrigger = true; + // } + + if (fabs(etadiff) < 0.05) { + etatrigger = true; + } + + if (fabs(phidiff) < 0.05) { + phitrigger = true; + } + + if (etatrigger && phitrigger) { + chargetrigger = true; + sumptT += ptT; + } + if (chargetrigger) { + if (!clusterqa) { + histos.fill(HIST("REC_Cluster_QA"), 1.5); + clusterqa = true; + } + } + histos.fill(HIST("REC_Track_v_Cluster_Phi"), phidiff); + histos.fill(HIST("REC_Track_v_Cluster_Eta"), etadiff); + + histos.fill(HIST("REC_Track_v_Cluster_Phi_Eta"), phidiff, etadiff); + + } // track of cluster loop + + if (chargetrigger && sumptT > 0) { + double mccluster_over_sumptT = mccluster.energy() / sumptT; + histos.fill(HIST("REC_SumPt_BC"), mccluster_over_sumptT); + if (mccluster_over_sumptT < 1.7) { + histos.fill(HIST("REC_Cluster_QA"), 2.5); // veto fails, cluster is charged + } else { + histos.fill(HIST("REC_Cluster_QA"), 3.5); // veto is good, cluster is converted to neutral cluster + // chargetrigger = false; + histos.fill(HIST("REC_SumPt_AC"), mccluster_over_sumptT); + } + } // sumptT check + + if (!chargetrigger) { + photontrigger = true; } /////////////// /////////////// /////////////// - - //check if cluster is good + + // check if cluster is good for (auto& ctrack : tracksofcluster) { - - auto ogtrack = ctrack.track_as(); - if (!trackSelection(ogtrack)) { - continue; - } - if(!ogtrack.isGlobalTrack()) { - continue; - } - - bool etatrigger = false; - bool phitrigger = false; - double ptT = ctrack.pt(); - double phidiff = TVector2::Phi_mpi_pi(mccluster.phi()-ogtrack.phi()); - double etadiff = mccluster.eta()-ogtrack.eta(); - if(fabs(etadiff) < 0.05) { - etatrigger = true; - } - - if(fabs(phidiff) < 0.05) { - phitrigger = true; - } - - if(chargetrigger){ - histos.fill(HIST("REC_Track_v_Cluster_Phi_C"), phidiff); - histos.fill(HIST("REC_Track_v_Cluster_Eta_C"), etadiff); - histos.fill(HIST("REC_Track_v_Cluster_Phi_Eta_C"), phidiff,etadiff); - } else { - if(etatrigger && chargetrigger) { - std::cout<<"????????????????????"<(); + if (!trackSelection(ogtrack)) { + continue; + } + if (!ogtrack.isGlobalTrack()) { + continue; + } + + bool etatrigger = false; + bool phitrigger = false; + double ptT = ctrack.pt(); + double phidiff = TVector2::Phi_mpi_pi(mccluster.phi() - ogtrack.phi()); + double etadiff = mccluster.eta() - ogtrack.eta(); + if (fabs(etadiff) < 0.05) { + etatrigger = true; + } + + if (fabs(phidiff) < 0.05) { + phitrigger = true; + } + + if (chargetrigger) { + histos.fill(HIST("REC_Track_v_Cluster_Phi_C"), phidiff); + histos.fill(HIST("REC_Track_v_Cluster_Eta_C"), etadiff); + histos.fill(HIST("REC_Track_v_Cluster_Phi_Eta_C"), phidiff, etadiff); + } else { + if (etatrigger && chargetrigger) { + std::cout << "????????????????????" << std::endl; + } + histos.fill(HIST("REC_Track_v_Cluster_Phi_AC"), phidiff); + histos.fill(HIST("REC_Track_v_Cluster_Eta_AC"), etadiff); + histos.fill(HIST("REC_Track_v_Cluster_Phi_Eta_AC"), phidiff, etadiff); + } + } // tracks + /////////////// /////////////// /////////////// - - - if(photontrigger) { //if no charge trigger, cluster is good! - histos.fill(HIST("REC_Cluster_QA"), 4.5); - clustertrigger=true; - double pthadsum = GetPtHadSum(tracks, mccluster, cfgMinR, cfgMaxR, false, false, true); - histos.fill(HIST("REC_Trigger_V_PtHadSum_Photon"), mccluster.energy(), pthadsum); - histos.fill(HIST("REC_PtHadSum_Photon"), pthadsum); - histos.fill(HIST("REC_Trigger_Energy"), mccluster.energy()); - } + if (photontrigger) { // if no charge trigger, cluster is good! + histos.fill(HIST("REC_Cluster_QA"), 4.5); + clustertrigger = true; + double pthadsum = GetPtHadSum(tracks, mccluster, cfgMinR, cfgMaxR, false, false, true); + histos.fill(HIST("REC_Trigger_V_PtHadSum_Photon"), mccluster.energy(), pthadsum); + histos.fill(HIST("REC_PtHadSum_Photon"), pthadsum); + histos.fill(HIST("REC_Trigger_Energy"), mccluster.energy()); + } + auto ClusterParticles = mccluster.mcParticle_as(); - - auto ClusterParticles = mccluster.mcParticle_as(); - - //now we check the realness of our prompt photons - bool goodgentrigger =true; + // now we check the realness of our prompt photons + bool goodgentrigger = true; double chPe = 0; - for (auto& clusterparticle : ClusterParticles) { - double etaP = clusterparticle.eta(); - double etaC = mccluster.eta(); - double phiP = clusterparticle.phi(); - double phiC = mccluster.phi(); - double ptP = clusterparticle.pt(); - int cindex =clusterparticle.globalIndex(); - double pdgcode = fabs(clusterparticle.pdgCode()); - if(!clusterparticle.isPhysicalPrimary()) { - continue; - } - - if(pdgcode == 211 || pdgcode == 321 || pdgcode == 2212 || pdgcode == 11) { - bool notrack = true; - histos.fill(HIST("REC_Cluster_Particle_Pt"), clusterparticle.pt()); - - double phiPrimeP = clusterparticle.phi(); - if(clusterparticle.pdgCode()<0) { - phiPrimeP = 2*TMath::Pi()-phiPrimeP; - } - phiPrimeP = phiPrimeP + TMath::Pi()/18.; - phiPrimeP = fmod(phiPrimeP, 2*TMath::Pi()/18.); - double ptP = clusterparticle.pt(); - for (auto& track : tracks) { - if(!track.has_mcParticle()) - continue; - auto ogtrack = track.track_as(); - if (!trackSelection(ogtrack)) { - continue; - } - if(!ogtrack.isGlobalTrack()) { - continue; - } - - int tindex = track.mcParticleId(); - if(tindex==cindex){ - histos.fill(HIST("REC_Cluster_ParticleWITHtrack_Pt"), clusterparticle.pt()); - histos.fill(HIST("REC_Cluster_ParticleWITHtrack_Phi"), clusterparticle.phi()); - histos.fill(HIST("REC_Cluster_ParticleWITHtrack_Eta"), clusterparticle.eta()); - histos.fill(HIST("REC_Cluster_ParticleWITHtrack_Pt_Phi"), clusterparticle.pt(),clusterparticle.phi()); - // if (phiPrimeP > (0.12/ptP + TMath::Pi()/18. + 0.035) || - // phiPrimeP < (0.1/ptP/ptP + TMath::Pi()/18. - 0.025) ) { - histos.fill(HIST("REC_Cluster_ParticleWITHtrack_Pt_PhiPrime"), ptP,phiPrimeP); - if(photontrigger) { - histos.fill(HIST("REC_Impurity_ParticleWITHtrack_Pt_PhiPrime"),ptP,phiPrimeP); - } - // }//geo cut - histos.fill(HIST("REC_Cluster_ParticleWITHtrack_Pt_Eta"), clusterparticle.pt(),clusterparticle.eta()); - - histos.fill(HIST("REC_Cluster_ParticleWITHtrack_TrackPt"), track.pt()); - notrack = false; - break; - } - } //track loop - - if(notrack) { - histos.fill(HIST("REC_Cluster_ParticleWITHOUTtrack_Pt"), clusterparticle.pt()); - histos.fill(HIST("REC_Cluster_ParticleWITHOUTtrack_Phi"), clusterparticle.phi()); - histos.fill(HIST("REC_Cluster_ParticleWITHOUTtrack_Eta"), clusterparticle.eta()); - histos.fill(HIST("REC_Cluster_ParticleWITHOUTtrack_Pt_Phi"), clusterparticle.pt(),clusterparticle.phi()); - // if (phiPrimeP > (0.12/ptP + TMath::Pi()/18. + 0.035) || - // phiPrimeP < (0.1/ptP/ptP + TMath::Pi()/18. - 0.025) ) { - histos.fill(HIST("REC_Cluster_ParticleWITHOUTtrack_Pt_PhiPrime"),ptP,phiPrimeP); - if(photontrigger) { - histos.fill(HIST("REC_Impurity_ParticleWITHOUTtrack_Pt_PhiPrime"),ptP,phiPrimeP); - } - // }//geo cut - histos.fill(HIST("REC_Cluster_ParticleWITHOUTtrack_Pt_Eta"), clusterparticle.pt(),clusterparticle.eta()); - } - }//pdg code check - - double phidiff = TVector2::Phi_mpi_pi(mccluster.phi()-clusterparticle.phi()); - double etadiff = mccluster.eta()-clusterparticle.eta(); - - if(pdgcode == 211 || pdgcode == 321 || pdgcode == 2212 || pdgcode == 11) { - if(clusterparticle.e()>0.01) { - chPe += clusterparticle.e(); - goodgentrigger=false; - if(photontrigger) { - histos.fill(HIST("REC_Impurity_Energy_v_Cluster_Phi"), clusterparticle.e(),phidiff); - histos.fill(HIST("REC_Impurity_Energy_v_ClusterE_Phi"), mccluster.energy(),phidiff); - histos.fill(HIST("REC_Impurity_Energy_v_ClusterEoP_Phi"), mccluster.energy()/clusterparticle.e(),phidiff); - histos.fill(HIST("REC_Impurity_Energy_v_Cluster_Energy"), mccluster.energy(),clusterparticle.e()); - - histos.fill(HIST("REC_TrueImpurity_v_Cluster_Phi"), phidiff); - histos.fill(HIST("REC_TrueImpurity_v_Cluster_PhiAbs"), clusterparticle.phi()); - histos.fill(HIST("REC_TrueImpurity_v_Cluster_Eta"), etadiff); - histos.fill(HIST("REC_TrueImpurity_v_Cluster_EtaAbs"), clusterparticle.eta()); - histos.fill(HIST("REC_TrueImpurity_v_Cluster_Phi_Eta"), phidiff,etadiff); - } - } - } - histos.fill(HIST("REC_True_v_Cluster_Phi"), phidiff); - histos.fill(HIST("REC_True_v_Cluster_Eta"), etadiff); - - if(!photontrigger) { - continue; - } - if (clusterparticle.pdgCode() == 22) { - histos.fill(HIST("REC_True_Trigger_Energy"), clusterparticle.e()); - int mom1 = 0; - int mom2 = 0; - for (auto& photon_mom : clusterparticle.mothers_as()) { - if(mom1==0) { - mom1 = photon_mom.pdgCode(); - } - if(mom1!=0) { - mom2 = photon_mom.pdgCode(); - } - } - if(std::fabs(mom1)>40 && std::fabs(mom1)>0) - continue; - - // std::cout<<"We have a REC prompt photon"< 19 && std::abs(clusterparticle.getGenStatusCode())<90) { - histos.fill(HIST("REC_True_Prompt_Trigger_Energy"), clusterparticle.e()); - TLorentzVector lRealPhoton; - lRealPhoton.SetPxPyPzE(clusterparticle.px(), clusterparticle.py(), clusterparticle.pz(), clusterparticle.e()); - double truepthadsum = GetPtHadSum(tracks, lRealPhoton, cfgMinR, cfgMaxR, false, false, false); - truephotonPt = clusterparticle.e(); - histos.fill(HIST("REC_TrueTrigger_V_PtHadSum_Photon"), truephotonPt, truepthadsum); - } - } //photon check - }// clusterparticle loop + for (auto& clusterparticle : ClusterParticles) { + double etaP = clusterparticle.eta(); + double etaC = mccluster.eta(); + double phiP = clusterparticle.phi(); + double phiC = mccluster.phi(); + double ptP = clusterparticle.pt(); + int cindex = clusterparticle.globalIndex(); + double pdgcode = fabs(clusterparticle.pdgCode()); + if (!clusterparticle.isPhysicalPrimary()) { + continue; + } + + if (pdgcode == 211 || pdgcode == 321 || pdgcode == 2212 || pdgcode == 11) { + bool notrack = true; + histos.fill(HIST("REC_Cluster_Particle_Pt"), clusterparticle.pt()); + + double phiPrimeP = clusterparticle.phi(); + if (clusterparticle.pdgCode() < 0) { + phiPrimeP = 2 * TMath::Pi() - phiPrimeP; + } + phiPrimeP = phiPrimeP + TMath::Pi() / 18.; + phiPrimeP = fmod(phiPrimeP, 2 * TMath::Pi() / 18.); + double ptP = clusterparticle.pt(); + for (auto& track : tracks) { + if (!track.has_mcParticle()) + continue; + auto ogtrack = track.track_as(); + if (!trackSelection(ogtrack)) { + continue; + } + if (!ogtrack.isGlobalTrack()) { + continue; + } + + int tindex = track.mcParticleId(); + if (tindex == cindex) { + histos.fill(HIST("REC_Cluster_ParticleWITHtrack_Pt"), clusterparticle.pt()); + histos.fill(HIST("REC_Cluster_ParticleWITHtrack_Phi"), clusterparticle.phi()); + histos.fill(HIST("REC_Cluster_ParticleWITHtrack_Eta"), clusterparticle.eta()); + histos.fill(HIST("REC_Cluster_ParticleWITHtrack_Pt_Phi"), clusterparticle.pt(), clusterparticle.phi()); + // if (phiPrimeP > (0.12/ptP + TMath::Pi()/18. + 0.035) || + // phiPrimeP < (0.1/ptP/ptP + TMath::Pi()/18. - 0.025) ) { + histos.fill(HIST("REC_Cluster_ParticleWITHtrack_Pt_PhiPrime"), ptP, phiPrimeP); + if (photontrigger) { + histos.fill(HIST("REC_Impurity_ParticleWITHtrack_Pt_PhiPrime"), ptP, phiPrimeP); + } + // }//geo cut + histos.fill(HIST("REC_Cluster_ParticleWITHtrack_Pt_Eta"), clusterparticle.pt(), clusterparticle.eta()); + + histos.fill(HIST("REC_Cluster_ParticleWITHtrack_TrackPt"), track.pt()); + notrack = false; + break; + } + } // track loop + + if (notrack) { + histos.fill(HIST("REC_Cluster_ParticleWITHOUTtrack_Pt"), clusterparticle.pt()); + histos.fill(HIST("REC_Cluster_ParticleWITHOUTtrack_Phi"), clusterparticle.phi()); + histos.fill(HIST("REC_Cluster_ParticleWITHOUTtrack_Eta"), clusterparticle.eta()); + histos.fill(HIST("REC_Cluster_ParticleWITHOUTtrack_Pt_Phi"), clusterparticle.pt(), clusterparticle.phi()); + // if (phiPrimeP > (0.12/ptP + TMath::Pi()/18. + 0.035) || + // phiPrimeP < (0.1/ptP/ptP + TMath::Pi()/18. - 0.025) ) { + histos.fill(HIST("REC_Cluster_ParticleWITHOUTtrack_Pt_PhiPrime"), ptP, phiPrimeP); + if (photontrigger) { + histos.fill(HIST("REC_Impurity_ParticleWITHOUTtrack_Pt_PhiPrime"), ptP, phiPrimeP); + } + // }//geo cut + histos.fill(HIST("REC_Cluster_ParticleWITHOUTtrack_Pt_Eta"), clusterparticle.pt(), clusterparticle.eta()); + } + } // pdg code check + + double phidiff = TVector2::Phi_mpi_pi(mccluster.phi() - clusterparticle.phi()); + double etadiff = mccluster.eta() - clusterparticle.eta(); + + if (pdgcode == 211 || pdgcode == 321 || pdgcode == 2212 || pdgcode == 11) { + if (clusterparticle.e() > 0.01) { + chPe += clusterparticle.e(); + goodgentrigger = false; + if (photontrigger) { + histos.fill(HIST("REC_Impurity_Energy_v_Cluster_Phi"), clusterparticle.e(), phidiff); + histos.fill(HIST("REC_Impurity_Energy_v_ClusterE_Phi"), mccluster.energy(), phidiff); + histos.fill(HIST("REC_Impurity_Energy_v_ClusterEoP_Phi"), mccluster.energy() / clusterparticle.e(), phidiff); + histos.fill(HIST("REC_Impurity_Energy_v_Cluster_Energy"), mccluster.energy(), clusterparticle.e()); + + histos.fill(HIST("REC_TrueImpurity_v_Cluster_Phi"), phidiff); + histos.fill(HIST("REC_TrueImpurity_v_Cluster_PhiAbs"), clusterparticle.phi()); + histos.fill(HIST("REC_TrueImpurity_v_Cluster_Eta"), etadiff); + histos.fill(HIST("REC_TrueImpurity_v_Cluster_EtaAbs"), clusterparticle.eta()); + histos.fill(HIST("REC_TrueImpurity_v_Cluster_Phi_Eta"), phidiff, etadiff); + } + } + } + histos.fill(HIST("REC_True_v_Cluster_Phi"), phidiff); + histos.fill(HIST("REC_True_v_Cluster_Eta"), etadiff); + + if (!photontrigger) { + continue; + } + if (clusterparticle.pdgCode() == 22) { + histos.fill(HIST("REC_True_Trigger_Energy"), clusterparticle.e()); + int mom1 = 0; + int mom2 = 0; + for (auto& photon_mom : clusterparticle.mothers_as()) { + if (mom1 == 0) { + mom1 = photon_mom.pdgCode(); + } + if (mom1 != 0) { + mom2 = photon_mom.pdgCode(); + } + } + if (std::fabs(mom1) > 40 && std::fabs(mom1) > 0) + continue; + + // std::cout<<"We have a REC prompt photon"< 19 && std::abs(clusterparticle.getGenStatusCode()) < 90) { + histos.fill(HIST("REC_True_Prompt_Trigger_Energy"), clusterparticle.e()); + TLorentzVector lRealPhoton; + lRealPhoton.SetPxPyPzE(clusterparticle.px(), clusterparticle.py(), clusterparticle.pz(), clusterparticle.e()); + double truepthadsum = GetPtHadSum(tracks, lRealPhoton, cfgMinR, cfgMaxR, false, false, false); + truephotonPt = clusterparticle.e(); + histos.fill(HIST("REC_TrueTrigger_V_PtHadSum_Photon"), truephotonPt, truepthadsum); + } + } // photon check + } // clusterparticle loop /* if(chPe>0){ - if(photontrigger){ - if(chPe/mccluster.energy() < 0.50){ - goodgentrigger=true; - } - } + if(photontrigger){ + if(chPe/mccluster.energy() < 0.50){ + goodgentrigger=true; + } + } } */ - if(goodgentrigger && photontrigger) { - histos.fill(HIST("REC_Trigger_Purity"), 0.5); - histos.fill(HIST("REC_Trigger_Energy_GOOD"), mccluster.energy()); - histos.fill(HIST("REC_Trigger_Purity_v_Energy"), 0.5, mccluster.energy()); - + if (goodgentrigger && photontrigger) { + histos.fill(HIST("REC_Trigger_Purity"), 0.5); + histos.fill(HIST("REC_Trigger_Energy_GOOD"), mccluster.energy()); + histos.fill(HIST("REC_Trigger_Purity_v_Energy"), 0.5, mccluster.energy()); } - if(goodgentrigger && !photontrigger) { - histos.fill(HIST("REC_Trigger_Purity"), 1.5); - histos.fill(HIST("REC_Trigger_Energy_MISS"), mccluster.energy()); - histos.fill(HIST("REC_Trigger_Purity_v_Energy"), 1.5, mccluster.energy()); + if (goodgentrigger && !photontrigger) { + histos.fill(HIST("REC_Trigger_Purity"), 1.5); + histos.fill(HIST("REC_Trigger_Energy_MISS"), mccluster.energy()); + histos.fill(HIST("REC_Trigger_Purity_v_Energy"), 1.5, mccluster.energy()); } - if(!goodgentrigger && photontrigger) { - histos.fill(HIST("REC_Trigger_Purity"), 2.5); - histos.fill(HIST("REC_Trigger_Energy_FAKE"), mccluster.energy()); - histos.fill(HIST("REC_Trigger_Purity_v_Energy"), 2.5, mccluster.energy()); - + if (!goodgentrigger && photontrigger) { + histos.fill(HIST("REC_Trigger_Purity"), 2.5); + histos.fill(HIST("REC_Trigger_Energy_FAKE"), mccluster.energy()); + histos.fill(HIST("REC_Trigger_Purity_v_Energy"), 2.5, mccluster.energy()); } - }// cluster loop + } // cluster loop auto bc = collision.bc_as(); int rnr = bc.runNumber(); - + std::string rnrstring = std::to_string(rnr); - if(runs.find(rnrstring) == std::string::npos) { + if (runs.find(rnrstring) == std::string::npos) { // std::cout<<"++++++++++++++++++++++++++++++++"<getForTimeStamp(ccdbpath, bc.timestamp()); // if(grpmag) { @@ -1000,86 +987,87 @@ struct statPromptPhoton { // std::cout<<"++++++++++++++++++++++++++++++++"<getForTimeStamp(ccdbpath, bc.timestamp()); // if(!grpo) { // std::cout<<"WE CAN NEITHER FETCH GRPMAG OR GRPO!!! SHIT IS SCREWED"<getNominalL3Field(); + // bfield = grpo->getNominalL3Field(); // } bfield = 5; runs += rnrstring; - std::cout<<"++++++++++++++++++++++++++++++++"<(); if (!trackSelection(ogtrack)) { - continue; + continue; } - if(!ogtrack.isGlobalTrack()) { - continue; + if (!ogtrack.isGlobalTrack()) { + continue; } - - //Do stuff with geometric cuts + + // Do stuff with geometric cuts double phiPrime = track.phi(); - if(track.sign()<0) { - phiPrime = 2*TMath::Pi()-phiPrime; + if (track.sign() < 0) { + phiPrime = 2 * TMath::Pi() - phiPrime; } - if(bfield<0) { - phiPrime = 2*TMath::Pi()-phiPrime; + if (bfield < 0) { + phiPrime = 2 * TMath::Pi() - phiPrime; } - - phiPrime = phiPrime + TMath::Pi()/18.; - phiPrime = fmod(phiPrime, 2*TMath::Pi()/18.); + + phiPrime = phiPrime + TMath::Pi() / 18.; + phiPrime = fmod(phiPrime, 2 * TMath::Pi() / 18.); double pt = track.pt(); // if (phiPrime > (0.12/pt + TMath::Pi()/18. + 0.035) || // phiPrime < (0.1/pt/pt + TMath::Pi()/18. - 0.025) ) { - histos.fill(HIST("REC_Track_PhiPrime_Pt"), phiPrime, track.pt()); - // }//geo cut + histos.fill(HIST("REC_Track_PhiPrime_Pt"), phiPrime, track.pt()); + // }//geo cut // Done with geometric cuts - + histos.fill(HIST("REC_Track_Pt"), track.pt()); histos.fill(HIST("REC_Track_Phi"), track.phi()); if (clustertrigger) { - histos.fill(HIST("REC_TrackPhi_photontrigger"),track.phi()); - histos.fill(HIST("REC_TrackEta_photontrigger"),track.eta()); + histos.fill(HIST("REC_TrackPhi_photontrigger"), track.phi()); + histos.fill(HIST("REC_TrackEta_photontrigger"), track.eta()); } - if(track.pt() > cfgMinTrig && track.pt() < cfgMaxTrig) { - if(fabs(track.eta()) <= cfgtrkMaxEta) { - sterntrigger=true; - sternPt=track.pt(); - } + if (track.pt() > cfgMinTrig && track.pt() < cfgMaxTrig) { + if (fabs(track.eta()) <= cfgtrkMaxEta) { + sterntrigger = true; + sternPt = track.pt(); + } } - if(sterntrigger) { - bool doStern = true; - double sterncount = 1.0; - while(doStern) { - double pthadsum = GetPtHadSum(tracks, track, cfgMinR, cfgMaxR, true, false, true); - histos.fill(HIST("REC_Trigger_V_PtHadSum_Stern"), sterncount, pthadsum, 2.0/sternPt); - if(sterncount const& caltracks, TrackCandidates const&, BcCandidates const&){ + int nEventsData = 0; + void processData(jfilteredCollisions::iterator const& collision, jfilteredClusters const& clusters, jDataTrackCandidates const& tracks, soa::Join const& caltracks, TrackCandidates const&, BcCandidates const&) + { nEventsData++; if ((nEventsData + 1) % 10000 == 0) { @@ -1088,239 +1076,235 @@ struct statPromptPhoton { histos.fill(HIST("DATA_nEvents"), 0.5); - //required cuts + // required cuts if (fabs(collision.posZ()) > cfgVtxCut) return; if (!collision.sel8()) return; - + histos.fill(HIST("DATA_nEvents"), 1.5); - if(cfgEmcTrigger){ + if (cfgEmcTrigger) { if (!collision.isEmcalReadout()) - return; + return; } histos.fill(HIST("DATA_nEvents"), 2.5); - bool noTrk = true; - for ( auto& track : tracks) { + for (auto& track : tracks) { auto ogtrack = track.track_as(); if (!trackSelection(ogtrack)) { - continue; + continue; } - if(!ogtrack.isGlobalTrack()) { - continue; + if (!ogtrack.isGlobalTrack()) { + continue; } noTrk = false; break; } - if(noTrk) + if (noTrk) return; - + // now we do clusters - bool clustertrigger =false; + bool clustertrigger = false; for (auto& cluster : clusters) { histos.fill(HIST("DATA_M02_BC"), cluster.m02()); - if(cluster.m02()cfgHighM02) - continue; - if(cluster.energy()cfgHighClusterE) - continue; - if(fabs(cluster.eta())>cfgtrkMaxEta) - continue; - - histos.fill(HIST("DATA_Cluster_QA"), 0.5); + if (cluster.m02() < cfgLowM02) + continue; + if (cluster.m02() > cfgHighM02) + continue; + if (cluster.energy() < cfgLowClusterE) + continue; + if (cluster.energy() > cfgHighClusterE) + continue; + if (fabs(cluster.eta()) > cfgtrkMaxEta) + continue; + + histos.fill(HIST("DATA_Cluster_QA"), 0.5); histos.fill(HIST("DATA_M02_AC"), cluster.m02()); histos.fill(HIST("DATA_All_Energy"), cluster.energy()); - histos.fill(HIST("DATA_ClusterPhi"), cluster.phi()); + histos.fill(HIST("DATA_ClusterPhi"), cluster.phi()); histos.fill(HIST("DATA_ClusterEta"), cluster.eta()); - bool photontrigger = false; //is a neutral cluster - bool chargetrigger = false; //is definitely not a neutral cluster + bool photontrigger = false; // is a neutral cluster + bool chargetrigger = false; // is definitely not a neutral cluster auto tracksofcluster = cluster.matchedTracks_as>(); ///*GEOMETRICAL CUT*/// double phiPrimeC = cluster.phi(); - phiPrimeC = phiPrimeC + TMath::Pi()/18.; - phiPrimeC = fmod(phiPrimeC, 2*TMath::Pi()/18.); + phiPrimeC = phiPrimeC + TMath::Pi() / 18.; + phiPrimeC = fmod(phiPrimeC, 2 * TMath::Pi() / 18.); double ptC = cluster.energy(); - bool geocut = false; + bool geocut = false; histos.fill(HIST("DATA_Cluster_PhiPrime_Pt"), phiPrimeC, cluster.energy()); - if (phiPrimeC > (0.12/ptC + TMath::Pi()/18. + 0.035) || - phiPrimeC < (0.1/ptC/ptC + TMath::Pi()/18. - 0.025) ) { - geocut = false; - } else { - geocut = true; + if (phiPrimeC > (0.12 / ptC + TMath::Pi() / 18. + 0.035) || + phiPrimeC < (0.1 / ptC / ptC + TMath::Pi() / 18. - 0.025)) { + geocut = false; + } else { + geocut = true; } - - if(cfgGeoCut) { - if(geocut) { - histos.fill(HIST("DATA_Cluster_PhiPrime_Pt_C"), phiPrimeC, cluster.energy()); - continue; - } + + if (cfgGeoCut) { + if (geocut) { + histos.fill(HIST("DATA_Cluster_PhiPrime_Pt_C"), phiPrimeC, cluster.energy()); + continue; + } } - + histos.fill(HIST("DATA_Cluster_PhiPrime_Pt_AC"), phiPrimeC, cluster.energy()); ///*GEOMETRICAL CUT*/// - + ///*CHECK FOR PHOTON CANDIDATE*/// - //first, we check if veto is required + // first, we check if veto is required double sumptT = 0; bool clusterqa = false; for (auto& ctrack : tracksofcluster) { - auto ogtrack = ctrack.track_as(); - if (!trackSelection(ogtrack)) { - continue; - } - if(!ogtrack.isGlobalTrack()) { - continue; - } - - bool nodoublecount = false; - double etaT = ogtrack.trackEtaEmcal(); - double etaC = cluster.eta(); - double phiT = ogtrack.trackPhiEmcal(); - double phiC = cluster.phi(); - double ptT = ctrack.pt(); - bool etatrigger = false; - bool phitrigger = false; - double phidiff = TVector2::Phi_mpi_pi(cluster.phi()-ogtrack.phi()); - double etadiff = cluster.eta()-ogtrack.eta(); - - if(fabs(etaT - etaC) < (0.010 + pow(ptT+4.07,-2.5)) ) { - etatrigger = true; - } - - if(fabs(TVector2::Phi_mpi_pi(phiT - phiC)) < (0.015 + pow(ptT+3.65,-2.0)) ) { - phitrigger = true; - } - - if(etatrigger && phitrigger) { - chargetrigger = true; - sumptT+=ptT; - } - if(chargetrigger){ - if(!clusterqa) { - histos.fill(HIST("DATA_Cluster_QA"), 1.5); - clusterqa=true; - } - } - histos.fill(HIST("DATA_Track_v_Cluster_Phi"), phidiff); - histos.fill(HIST("DATA_Track_v_Cluster_Eta"), etadiff); - histos.fill(HIST("DATA_Track_v_Cluster_Phi_Eta"), phidiff,etadiff); - - }//track of cluster loop - - if(chargetrigger && sumptT>0) { - double cluster_over_sumptT = cluster.energy()/sumptT; - histos.fill(HIST("DATA_SumPt_BC"), cluster_over_sumptT); - if(cluster_over_sumptT < 1.7) { - histos.fill(HIST("DATA_Cluster_QA"), 2.5); //veto fails, cluster is charged - } - else { - histos.fill(HIST("DATA_Cluster_QA"), 3.5); //veto is good, cluster is converted to neutral cluster - chargetrigger = false; - histos.fill(HIST("DATA_SumPt_AC"), cluster_over_sumptT); - } - }// sumptT check - - if(!chargetrigger) { - photontrigger = true; + auto ogtrack = ctrack.track_as(); + if (!trackSelection(ogtrack)) { + continue; + } + if (!ogtrack.isGlobalTrack()) { + continue; + } + + bool nodoublecount = false; + double etaT = ogtrack.trackEtaEmcal(); + double etaC = cluster.eta(); + double phiT = ogtrack.trackPhiEmcal(); + double phiC = cluster.phi(); + double ptT = ctrack.pt(); + bool etatrigger = false; + bool phitrigger = false; + double phidiff = TVector2::Phi_mpi_pi(cluster.phi() - ogtrack.phi()); + double etadiff = cluster.eta() - ogtrack.eta(); + + if (fabs(etaT - etaC) < (0.010 + pow(ptT + 4.07, -2.5))) { + etatrigger = true; + } + + if (fabs(TVector2::Phi_mpi_pi(phiT - phiC)) < (0.015 + pow(ptT + 3.65, -2.0))) { + phitrigger = true; + } + + if (etatrigger && phitrigger) { + chargetrigger = true; + sumptT += ptT; + } + if (chargetrigger) { + if (!clusterqa) { + histos.fill(HIST("DATA_Cluster_QA"), 1.5); + clusterqa = true; + } + } + histos.fill(HIST("DATA_Track_v_Cluster_Phi"), phidiff); + histos.fill(HIST("DATA_Track_v_Cluster_Eta"), etadiff); + histos.fill(HIST("DATA_Track_v_Cluster_Phi_Eta"), phidiff, etadiff); + + } // track of cluster loop + + if (chargetrigger && sumptT > 0) { + double cluster_over_sumptT = cluster.energy() / sumptT; + histos.fill(HIST("DATA_SumPt_BC"), cluster_over_sumptT); + if (cluster_over_sumptT < 1.7) { + histos.fill(HIST("DATA_Cluster_QA"), 2.5); // veto fails, cluster is charged + } else { + histos.fill(HIST("DATA_Cluster_QA"), 3.5); // veto is good, cluster is converted to neutral cluster + chargetrigger = false; + histos.fill(HIST("DATA_SumPt_AC"), cluster_over_sumptT); + } + } // sumptT check + + if (!chargetrigger) { + photontrigger = true; } ///*CHECK FOR PHOTON CANDIDATE*/// ///*CALCULATE PTHAD SUM*/// - if(photontrigger) { //if no charge trigger, cluster is good! - histos.fill(HIST("DATA_Cluster_QA"), 4.5); - clustertrigger=true; - double pthadsum = GetPtHadSum(tracks, cluster, cfgMinR, cfgMaxR, false, false, true); - histos.fill(HIST("DATA_Trigger_V_PtHadSum_Photon"), cluster.energy(), pthadsum); - histos.fill(HIST("DATA_PtHadSum_Photon"), pthadsum); - histos.fill(HIST("DATA_Trigger_Energy"), cluster.energy()); + if (photontrigger) { // if no charge trigger, cluster is good! + histos.fill(HIST("DATA_Cluster_QA"), 4.5); + clustertrigger = true; + double pthadsum = GetPtHadSum(tracks, cluster, cfgMinR, cfgMaxR, false, false, true); + histos.fill(HIST("DATA_Trigger_V_PtHadSum_Photon"), cluster.energy(), pthadsum); + histos.fill(HIST("DATA_PtHadSum_Photon"), pthadsum); + histos.fill(HIST("DATA_Trigger_Energy"), cluster.energy()); } ///*CALCULATE PTHAD SUM*/// - - } //cluster loop - ///*CALCULATE STERNHEIMER*/// - - for ( auto& track : tracks) { + } // cluster loop + + ///*CALCULATE STERNHEIMER*/// + + for (auto& track : tracks) { bool sterntrigger = false; double sternPt = 0.0; auto ogtrack = track.track_as(); if (!trackSelection(ogtrack)) { - continue; + continue; } - if(!ogtrack.isGlobalTrack()) { - continue; + if (!ogtrack.isGlobalTrack()) { + continue; } - - //Do stuff with geometric cuts + + // Do stuff with geometric cuts double phiPrime = track.phi(); - if(track.sign()<0) { - phiPrime = 2*TMath::Pi()-phiPrime; + if (track.sign() < 0) { + phiPrime = 2 * TMath::Pi() - phiPrime; } - if(bfield<0) { - phiPrime = 2*TMath::Pi()-phiPrime; + if (bfield < 0) { + phiPrime = 2 * TMath::Pi() - phiPrime; } - - phiPrime = phiPrime + TMath::Pi()/18.; - phiPrime = fmod(phiPrime, 2*TMath::Pi()/18.); + + phiPrime = phiPrime + TMath::Pi() / 18.; + phiPrime = fmod(phiPrime, 2 * TMath::Pi() / 18.); double pt = track.pt(); - if (phiPrime > (0.12/pt + TMath::Pi()/18. + 0.035) || - phiPrime < (0.1/pt/pt + TMath::Pi()/18. - 0.025) ) { - histos.fill(HIST("DATA_Track_PhiPrime_Pt"), phiPrime, track.pt()); - }//geo cut + if (phiPrime > (0.12 / pt + TMath::Pi() / 18. + 0.035) || + phiPrime < (0.1 / pt / pt + TMath::Pi() / 18. - 0.025)) { + histos.fill(HIST("DATA_Track_PhiPrime_Pt"), phiPrime, track.pt()); + } // geo cut // Done with geometric cuts - + histos.fill(HIST("DATA_Track_Pt"), track.pt()); histos.fill(HIST("DATA_Track_Phi"), track.phi()); if (clustertrigger) { - histos.fill(HIST("DATA_TrackPhi_photontrigger"),track.phi()); - histos.fill(HIST("DATA_TrackEta_photontrigger"),track.eta()); + histos.fill(HIST("DATA_TrackPhi_photontrigger"), track.phi()); + histos.fill(HIST("DATA_TrackEta_photontrigger"), track.eta()); } - if(track.pt() > cfgMinTrig && track.pt() < cfgMaxTrig) { - if(fabs(track.eta()) <= cfgtrkMaxEta) { - sterntrigger=true; - sternPt=track.pt(); - } + if (track.pt() > cfgMinTrig && track.pt() < cfgMaxTrig) { + if (fabs(track.eta()) <= cfgtrkMaxEta) { + sterntrigger = true; + sternPt = track.pt(); + } } - - if(sterntrigger) { - bool doStern = true; - double sterncount = 1.0; - while(doStern) { - double pthadsum = GetPtHadSum(tracks, track, cfgMinR, cfgMaxR, true, false, true); - histos.fill(HIST("DATA_Trigger_V_PtHadSum_Stern"), sterncount, pthadsum, 2.0/sternPt); - if(sterncount