1313// / \brief Reconstruction of Phi yield through track-track Minv correlations for resonance hadrochemistry analysis.
1414// /
1515// /
16- // / \author Adrian Fereydon Nassirpour <adrian.fereydon.nassirpour@cern.ch>
16+ // / \author Adrian Fereydon Nassirpour <adrian.fereydon.nassirpour@cern.ch>
17+
1718#include < CCDB/BasicCCDBManager.h>
1819
1920#include < iostream>
@@ -63,6 +64,7 @@ using namespace o2::framework;
6364using namespace o2 ::framework::expressions;
6465
6566struct statPromptPhoton {
67+
6668 SliceCache cache;
6769 HistogramRegistry histos{" histos" , {}, OutputObjHandlingPolicy::AnalysisObject};
6870 Configurable<double > cfgMaxDCArToPVcut{" cfgMaxDCArToPVcut" , 0.5 , " Track DCAr cut to PV Maximum" };
@@ -101,15 +103,20 @@ struct statPromptPhoton {
101103 Configurable<bool > cfgGenHistograms{" cfgGenHistograms" , false , " Enables Generated histograms" };
102104 Configurable<bool > cfgRecHistograms{" cfgRecHistograms" , false , " Enables Reconstructed histograms" };
103105 Configurable<bool > cfgDataHistograms{" cfgDataHistograms" , false , " Enables Data histograms" };
106+ Configurable<bool > cfgSkimmedTrigger{" cfgSkimmedTrigger" , false , " Enables trigger for skimmied datasets (2023 onwards)" };
107+ Configurable<std::string> cfgTriggerMasks{" cfgTriggerMasks" , " " , " possible JE Trigger masks: fJetChLowPt,fJetChHighPt,fTrackLowPt,fTrackHighPt,fJetD0ChLowPt,fJetD0ChHighPt,fJetLcChLowPt,fJetLcChHighPt,fEMCALReadout,fJetFullHighPt,fJetFullLowPt,fJetNeutralHighPt,fJetNeutralLowPt,fGammaVeryHighPtEMCAL,fGammaVeryHighPtDCAL,fGammaHighPtEMCAL,fGammaHighPtDCAL,fGammaLowPtEMCAL,fGammaLowPtDCAL,fGammaVeryLowPtEMCAL,fGammaVeryLowPtDCAL" };
104108 Configurable<bool > cfgDebug{" cfgDebug" , false , " Enables debug information for local running" };
109+
105110 int trackFilter = -1 ;
111+ std::vector<int > triggerMaskBits;
106112
107113 // INIT
108114 void init (InitContext const &)
109115 {
110116 std::vector<double > ptBinning = {0.0 , 0.1 , 0.2 , 0.3 , 0.4 , 0.5 , 0.6 , 0.7 , 0.8 , 0.9 , 1.0 , 1.2 , 1.4 , 1.6 , 1.8 , 2.0 , 2.5 , 3.0 , 4.0 , 5.0 , 6.0 , 8.0 , 12.0 , 16.0 , 20.0 , 25.0 , 30.0 , 40.0 , 50.0 , 75.0 , 100.0 , 150.0 , 200.0 , 300.0 , 500.0 };
111117 AxisSpec pthadAxis = {ptBinning, " #it{p}_{T}^{had sum} [GeV/c]" };
112118
119+ triggerMaskBits = jetderiveddatautilities::initialiseTriggerMaskBits (cfgTriggerMasks);
113120 if (cfgJETracks) {
114121 trackFilter = jetderiveddatautilities::initialiseTrackSelection (static_cast <std::string>(cfgTrackFilter));
115122 }
@@ -251,8 +258,11 @@ struct statPromptPhoton {
251258
252259 using jMCClusters = o2::soa::Join<o2::aod::JMcClusterLbs, o2::aod::JClusters, o2::aod::JClusterTracks>;
253260 using jClusters = o2::soa::Join<o2::aod::JClusters, o2::aod::JClusterTracks>;
254- using jselectedCollisions = soa::Join<aod::JCollisions, aod::JCollisionBCs, aod::JCollisionPIs, aod::EvSels, aod::JEMCCollisionLbs>;
261+ using jselectedCollisions = soa::Join<aod::JCollisions, aod::JCollisionBCs, aod::JCollisionPIs, aod::EvSels, aod::JEMCCollisionLbs, aod::JMcCollisionLbs>;
262+ using jselectedDataCollisions = soa::Join<aod::JCollisions, aod::JCollisionBCs, aod::JCollisionPIs, aod::EvSels, aod::JEMCCollisionLbs>;
263+ // using jselectedDataCollisions = soa::Join<aod::JCollisions, aod::JCollisionBCs, aod::JCollisionPIs, aod::JCollisionMcInfos, aod::EvSels, aod::JEMCCollisionLbs>;
255264 using jfilteredCollisions = soa::Filtered<jselectedCollisions>;
265+ using jfilteredDataCollisions = soa::Filtered<jselectedDataCollisions>;
256266 using jfilteredMCClusters = soa::Filtered<jMCClusters>;
257267 using jfilteredClusters = soa::Filtered<jClusters>;
258268
@@ -604,7 +614,7 @@ struct statPromptPhoton {
604614
605615 PresliceUnsorted<jEMCtracks> EMCTrackPerTrack = aod::jemctrack::trackId;
606616 int nEventsRecMC_JE = 0 ;
607- void processMCRec_JE (jfilteredCollisions::iterator const & collision, jfilteredMCClusters const & mcclusters, jTrackCandidates const & tracks, soa::Join<aod::JTracks, aod::JTrackExtras, aod::JTrackPIs> const &, TrackCandidates const &, aod::JMcParticles const &, BcCandidates const &, jEMCtracks const & emctracks)
617+ void processMCRec_JE (jfilteredCollisions::iterator const & collision, jfilteredMCClusters const & mcclusters, jTrackCandidates const & tracks, soa::Join<aod::JTracks, aod::JTrackExtras, aod::JTrackPIs> const &, TrackCandidates const &, aod::JMcParticles const &, BcCandidates const &, jEMCtracks const & emctracks, aod::JetMcCollisions const & )
608618 {
609619
610620 nEventsRecMC_JE++;
@@ -629,6 +639,20 @@ struct statPromptPhoton {
629639 }
630640 histos.fill (HIST (" REC_nEvents" ), 2.5 );
631641
642+
643+ if (cfgSkimmedTrigger){
644+ if (!jetderiveddatautilities::selectTrigger (collision, triggerMaskBits)) {
645+ return ;
646+ }
647+ }// JE Software Triggers
648+
649+ histos.fill (HIST (" REC_nEvents" ), 3.5 );
650+
651+ double weight = 1 ;
652+ if (collision.has_mcCollision ()) {
653+ weight = collision.mcCollision ().weight ();
654+ }
655+
632656 bool noTrk = true ;
633657 for (auto & track : tracks) {
634658 if (cfgJETracks) {
@@ -844,9 +868,9 @@ struct statPromptPhoton {
844868 histos.fill (HIST (" REC_Cluster_QA" ), 4.5 );
845869 clustertrigger = true ;
846870 double pthadsum = GetPtHadSum (tracks, mccluster, cfgMinR, cfgMaxR, false , false , true );
847- histos.fill (HIST (" REC_Trigger_V_PtHadSum_Photon" ), mccluster.energy (), pthadsum);
848- histos.fill (HIST (" REC_PtHadSum_Photon" ), pthadsum);
849- histos.fill (HIST (" REC_Trigger_Energy" ), mccluster.energy ());
871+ histos.fill (HIST (" REC_Trigger_V_PtHadSum_Photon" ), mccluster.energy (), pthadsum, weight );
872+ histos.fill (HIST (" REC_PtHadSum_Photon" ), pthadsum, weight );
873+ histos.fill (HIST (" REC_Trigger_Energy" ), mccluster.energy (), weight );
850874 }
851875
852876 auto ClusterParticles = mccluster.mcParticles_as <aod::JMcParticles>();
@@ -855,11 +879,6 @@ struct statPromptPhoton {
855879 bool goodgentrigger = true ;
856880 double chPe = 0 ;
857881 for (auto & clusterparticle : ClusterParticles) {
858- // double etaP = clusterparticle.eta();
859- // double etaC = mccluster.eta();
860- // double phiP = clusterparticle.phi();
861- // double phiC = mccluster.phi();
862- // double ptP = clusterparticle.pt();
863882 int cindex = clusterparticle.globalIndex ();
864883 double pdgcode = fabs (clusterparticle.pdgCode ());
865884 if (!clusterparticle.isPhysicalPrimary ()) {
@@ -900,8 +919,6 @@ struct statPromptPhoton {
900919 histos.fill (HIST (" REC_Cluster_ParticleWITHtrack_Phi" ), clusterparticle.phi ());
901920 histos.fill (HIST (" REC_Cluster_ParticleWITHtrack_Eta" ), clusterparticle.eta ());
902921 histos.fill (HIST (" REC_Cluster_ParticleWITHtrack_Pt_Phi" ), clusterparticle.pt (), clusterparticle.phi ());
903- // if (phiPrimeP > (0.12/ptP + TMath::Pi()/18. + 0.035) ||
904- // phiPrimeP < (0.1/ptP/ptP + TMath::Pi()/18. - 0.025) ) {
905922 histos.fill (HIST (" REC_Cluster_ParticleWITHtrack_Pt_PhiPrime" ), ptP, phiPrimeP);
906923 if (photontrigger) {
907924 histos.fill (HIST (" REC_Impurity_ParticleWITHtrack_Pt_PhiPrime" ), ptP, phiPrimeP);
@@ -920,8 +937,6 @@ struct statPromptPhoton {
920937 histos.fill (HIST (" REC_Cluster_ParticleWITHOUTtrack_Phi" ), clusterparticle.phi ());
921938 histos.fill (HIST (" REC_Cluster_ParticleWITHOUTtrack_Eta" ), clusterparticle.eta ());
922939 histos.fill (HIST (" REC_Cluster_ParticleWITHOUTtrack_Pt_Phi" ), clusterparticle.pt (), clusterparticle.phi ());
923- // if (phiPrimeP > (0.12/ptP + TMath::Pi()/18. + 0.035) ||
924- // phiPrimeP < (0.1/ptP/ptP + TMath::Pi()/18. - 0.025) ) {
925940 histos.fill (HIST (" REC_Cluster_ParticleWITHOUTtrack_Pt_PhiPrime" ), ptP, phiPrimeP);
926941 if (photontrigger) {
927942 histos.fill (HIST (" REC_Impurity_ParticleWITHOUTtrack_Pt_PhiPrime" ), ptP, phiPrimeP);
@@ -980,12 +995,12 @@ struct statPromptPhoton {
980995 std::cout << " Photon mom 2: " << mom2 << std::endl;
981996 }
982997 if (std::abs (clusterparticle.getGenStatusCode ()) > 19 && std::abs (clusterparticle.getGenStatusCode ()) < 90 ) {
983- histos.fill (HIST (" REC_True_Prompt_Trigger_Energy" ), clusterparticle.e ());
998+ histos.fill (HIST (" REC_True_Prompt_Trigger_Energy" ), clusterparticle.e (), weight );
984999 TLorentzVector lRealPhoton;
9851000 lRealPhoton.SetPxPyPzE (clusterparticle.px (), clusterparticle.py (), clusterparticle.pz (), clusterparticle.e ());
9861001 double truepthadsum = GetPtHadSum (tracks, lRealPhoton, cfgMinR, cfgMaxR, false , false , false );
9871002 truephotonPt = clusterparticle.e ();
988- histos.fill (HIST (" REC_TrueTrigger_V_PtHadSum_Photon" ), truephotonPt, truepthadsum);
1003+ histos.fill (HIST (" REC_TrueTrigger_V_PtHadSum_Photon" ), truephotonPt, truepthadsum, weight );
9891004 }
9901005 } // photon check
9911006 } // clusterparticle loop
@@ -1016,39 +1031,6 @@ struct statPromptPhoton {
10161031 }
10171032 } // cluster loop
10181033
1019- // auto bc = collision.bc_as<BcCandidates>();
1020- // int rnr = bc.runNumber();
1021-
1022- // std::string rnrstring = std::to_string(rnr);
1023- // if (runs.find(rnrstring) == std::string::npos) {
1024- // std::cout<<"++++++++++++++++++++++++++++++++"<<std::endl;
1025- // std::cout<<"FETCHING NEW RUN NUMBER FOR RUN: "<<rnr<<std::endl;
1026- // std::cout<<"++++++++++++++++++++++++++++++++"<<std::endl;
1027-
1028- // std::string ccdbpath="GLO/Config/GRPMagField";
1029- // static o2::parameters::GRPMagField* grpmag = ccdb->getForTimeStamp<o2::parameters::GRPMagField>(ccdbpath, bc.timestamp());
1030- // if(grpmag) {
1031- // bfield = std::lround(5.f * grpmag->getL3Current() / 30000.f);
1032- // std::cout<<"++++++++++++++++++++++++++++++++"<<std::endl;
1033- // std::cout<<"MAG FIELD IS: "<<bfield<<std::endl;
1034- // std::cout<<"++++++++++++++++++++++++++++++++"<<std::endl;
1035- // }
1036- // else {
1037- // ccdbpath="GLO/GRP/GRP";
1038- // static o2::parameters::GRPObject* grpo = ccdb->getForTimeStamp<o2::parameters::GRPObject>(ccdbpath, bc.timestamp());
1039- // if(!grpo) {
1040- // std::cout<<"WE CAN NEITHER FETCH GRPMAG OR GRPO!!! SHIT IS SCREWED"<<std::endl;
1041- // }
1042- // bfield = grpo->getNominalL3Field();
1043- // }
1044- // bfield = 5;
1045- // runs += rnrstring;
1046- // std::cout << "++++++++++++++++++++++++++++++++" << std::endl;
1047- // std::cout << "Run is now appended to string: " << runs << std::endl;
1048- // std::cout << "++++++++++++++++++++++++++++++++" << std::endl;
1049-
1050- // } // check mag field for current run number: done!
1051-
10521034 // clusters done, now we do the sternheimer tracks
10531035 for (auto & track : tracks) {
10541036 bool sterntrigger = false ;
@@ -1073,19 +1055,9 @@ struct statPromptPhoton {
10731055 phiPrime = 2 * TMath::Pi () - phiPrime;
10741056 }
10751057
1076- // if (bfield < 0) {
1077- // phiPrime = 2 * TMath::Pi() - phiPrime;
1078- // }
1079-
10801058 phiPrime = phiPrime + TMath::Pi () / 18 .;
10811059 phiPrime = fmod (phiPrime, 2 * TMath::Pi () / 18 .);
1082- // double pt = track.pt();
1083- // if (phiPrime > (0.12/pt + TMath::Pi()/18. + 0.035) ||
1084- // phiPrime < (0.1/pt/pt + TMath::Pi()/18. - 0.025) ) {
10851060 histos.fill (HIST (" REC_Track_PhiPrime_Pt" ), phiPrime, track.pt ());
1086- // }//geo cut
1087- // Done with geometric cuts
1088-
10891061 histos.fill (HIST (" REC_Track_Pt" ), track.pt ());
10901062 histos.fill (HIST (" REC_Track_Phi" ), track.phi ());
10911063 if (clustertrigger) {
@@ -1099,12 +1071,12 @@ struct statPromptPhoton {
10991071 }
11001072 }
11011073 double pthadsum = GetPtHadSum (tracks, track, cfgMinR, cfgMaxR, true , false , true );
1102- histos.fill (HIST (" REC_Trigger_V_PtHadSum_Nch" ), sternPt, pthadsum);
1074+ histos.fill (HIST (" REC_Trigger_V_PtHadSum_Nch" ), sternPt, pthadsum,weight );
11031075 if (sterntrigger) {
11041076 bool doStern = true ;
11051077 double sterncount = 1.0 ;
11061078 while (doStern) {
1107- histos.fill (HIST (" REC_Trigger_V_PtHadSum_Stern" ), sterncount, pthadsum, 2.0 / sternPt);
1079+ histos.fill (HIST (" REC_Trigger_V_PtHadSum_Stern" ), sterncount, pthadsum, ( 2.0 / sternPt)*weight );
11081080 if (sterncount < sternPt) {
11091081 sterncount++;
11101082 } else {
@@ -1119,18 +1091,21 @@ struct statPromptPhoton {
11191091 PROCESS_SWITCH (statPromptPhoton, processMCRec_JE, " processJE MC data" , false );
11201092
11211093 int nEventsData = 0 ;
1122- void processData (jfilteredCollisions ::iterator const & collision, jfilteredClusters const & clusters, jDataTrackCandidates const & tracks, soa::Join<aod::JTracks, aod::JTrackExtras, aod::JTrackPIs> const &, TrackCandidates const &, BcCandidates const &, jEMCtracks const & emctracks)
1094+ void processData (jfilteredDataCollisions ::iterator const & collision, jfilteredClusters const & clusters, jDataTrackCandidates const & tracks, soa::Join<aod::JTracks, aod::JTrackExtras, aod::JTrackPIs> const &, TrackCandidates const &, BcCandidates const &, jEMCtracks const & emctracks)
11231095 {
1124-
11251096 nEventsData++;
11261097 if (cfgDebug) {
11271098 if (nEventsData == 1 ) {
11281099 std::cout << " Starting Data Processing: " << nEventsData << std::endl;
11291100 }
11301101 if ((nEventsData + 1 ) % 10000 == 0 ) {
11311102 std::cout << " Processed Data Events: " << nEventsData << std::endl;
1103+ std::cout << " Events Trigger Bit: " << collision.triggerSel () << std::endl;
1104+ std::cout << " Trigger Mask Bit: " << triggerMaskBits[0 ] << std::endl;
1105+ std::cout << " Trigger Mask Cfg Line: " << cfgTriggerMasks << std::endl;
11321106 }
11331107 }
1108+
11341109 histos.fill (HIST (" DATA_nEvents" ), 0.5 );
11351110
11361111 // required cuts
@@ -1140,13 +1115,21 @@ struct statPromptPhoton {
11401115 return ;
11411116
11421117 histos.fill (HIST (" DATA_nEvents" ), 1.5 );
1143-
11441118 if (cfgEmcTrigger) {
11451119 if (!collision.isEmcalReadout ())
11461120 return ;
11471121 }
1122+
11481123 histos.fill (HIST (" DATA_nEvents" ), 2.5 );
11491124
1125+ if (cfgSkimmedTrigger){
1126+ if (!jetderiveddatautilities::selectTrigger (collision, triggerMaskBits)) {
1127+ return ;
1128+ }
1129+ }// JE Software Triggers
1130+
1131+ histos.fill (HIST (" DATA_nEvents" ), 3.5 );
1132+
11501133 bool noTrk = true ;
11511134 for (auto & track : tracks) {
11521135
@@ -1347,10 +1330,6 @@ struct statPromptPhoton {
13471330 phiPrime = 2 * TMath::Pi () - phiPrime;
13481331 }
13491332
1350- // if (bfield < 0) {
1351- // phiPrime = 2 * TMath::Pi() - phiPrime;
1352- // }
1353-
13541333 phiPrime = phiPrime + TMath::Pi () / 18 .;
13551334 phiPrime = fmod (phiPrime, 2 * TMath::Pi () / 18 .);
13561335 double pt = track.pt ();
0 commit comments