diff --git a/PWGUD/Core/SGCutParHolder.h b/PWGUD/Core/SGCutParHolder.h index 369c3851062..628e36300bc 100644 --- a/PWGUD/Core/SGCutParHolder.h +++ b/PWGUD/Core/SGCutParHolder.h @@ -127,4 +127,3 @@ class SGCutParHolder }; #endif // PWGUD_CORE_SGCUTPARHOLDER_H_ - diff --git a/PWGUD/Core/SGCutParHolderLinkDef.h b/PWGUD/Core/SGCutParHolderLinkDef.h index 0183fe69829..f9216fa0c37 100644 --- a/PWGUD/Core/SGCutParHolderLinkDef.h +++ b/PWGUD/Core/SGCutParHolderLinkDef.h @@ -17,4 +17,3 @@ #pragma link C++ class SGCutParHolder + ; #endif // PWGUD_CORE_SGCUTPARHOLDERLINKDEF_H_ - diff --git a/PWGUD/Core/SGSelector.h b/PWGUD/Core/SGSelector.h index 605e3847627..89cb671564b 100644 --- a/PWGUD/Core/SGSelector.h +++ b/PWGUD/Core/SGSelector.h @@ -11,13 +11,13 @@ // Selector for Single Gap events class SGSelector { -public: + public: // constructor/destructor SGSelector() { fPDG = TDatabasePDG::Instance(); } ~SGSelector() { delete fPDG; } template - int Print(SGCutParHolder diffCuts, CC &collision, BCs &bcRange, TCs &tracks, FWs &fwdtracks) + int Print(SGCutParHolder diffCuts, CC& collision, BCs& bcRange, TCs& tracks, FWs& fwdtracks) { LOGF(info, "Size of array %i", collision.size()); return 1; @@ -25,7 +25,7 @@ class SGSelector // Function to check if collisions pass SG filter template - int IsSelected(SGCutParHolder diffCuts, CC &collision, BCs &bcRange, TCs &tracks, FWs &fwdtracks, bool useSideA) + int IsSelected(SGCutParHolder diffCuts, CC& collision, BCs& bcRange, TCs& tracks, FWs& fwdtracks, bool useSideA) { LOGF(debug, "Collision %f", collision.collisionTime()); LOGF(debug, "Number of close BCs: %i", bcRange.size()); @@ -33,30 +33,28 @@ class SGSelector // Single Gap (SG) condition int sg = 1; int dg = 1; - for (auto const &bc : bcRange) - { -// LOGF(info, "%i \t %i \t %i", udhelpers::cleanFITA(bc, diffCuts.maxFITtime(), diffCuts.FITAmpLimits()), udhelpers::cleanFITC(bc, diffCuts.maxFITtime(), diffCuts.FITAmpLimits()), udhelpers::cleanFIT(bc, diffCuts.maxFITtime(), diffCuts.FITAmpLimits())); - if (!udhelpers::cleanFITA(bc, diffCuts.maxFITtime(), diffCuts.FITAmpLimits()) && !udhelpers::cleanFITC(bc, diffCuts.maxFITtime(), diffCuts.FITAmpLimits())) { - // return 1; //activity on both sides - sg = 0; - } - if (!udhelpers::cleanFIT(bc, diffCuts.maxFITtime(), diffCuts.FITAmpLimits())) { - // return 1; //activity on both sides - dg = 0; - } + for (auto const& bc : bcRange) { + // LOGF(info, "%i \t %i \t %i", udhelpers::cleanFITA(bc, diffCuts.maxFITtime(), diffCuts.FITAmpLimits()), udhelpers::cleanFITC(bc, diffCuts.maxFITtime(), diffCuts.FITAmpLimits()), udhelpers::cleanFIT(bc, diffCuts.maxFITtime(), diffCuts.FITAmpLimits())); + if (!udhelpers::cleanFITA(bc, diffCuts.maxFITtime(), diffCuts.FITAmpLimits()) && !udhelpers::cleanFITC(bc, diffCuts.maxFITtime(), diffCuts.FITAmpLimits())) { + // return 1; //activity on both sides + sg = 0; + } + if (!udhelpers::cleanFIT(bc, diffCuts.maxFITtime(), diffCuts.FITAmpLimits())) { + // return 1; //activity on both sides + dg = 0; + } } - if (sg||dg) LOGF(info, "%i\t%i",sg,dg); - if (!sg) return 1; + if (sg || dg) + LOGF(info, "%i\t%i", sg, dg); + if (!sg) + return 1; // forward tracks LOGF(debug, "FwdTracks %i", fwdtracks.size()); - if (!diffCuts.withFwdTracks()) - { - for (auto &fwdtrack : fwdtracks) - { + if (!diffCuts.withFwdTracks()) { + for (auto& fwdtrack : fwdtracks) { LOGF(info, " %i / %f / %f / %f / %f", fwdtrack.trackType(), fwdtrack.eta(), fwdtrack.pt(), fwdtrack.p(), fwdtrack.trackTimeRes()); // only consider tracks with MID (good timing) - if (fwdtrack.trackType() == 0 || fwdtrack.trackType() == 3) - { + if (fwdtrack.trackType() == 0 || fwdtrack.trackType() == 3) { return 2; } } @@ -66,39 +64,31 @@ class SGSelector // no vtx tracks which are not global tracks // no PV tracks with ITS only auto rgtrwTOF = 0.; // fraction of PV tracks with TOF hit - for (auto &track : tracks) - { - if (track.isGlobalTrack() && !track.isPVContributor()) - { + for (auto& track : tracks) { + if (track.isGlobalTrack() && !track.isPVContributor()) { return 3; } - if (diffCuts.globalTracksOnly() && track.isPVContributor() && !track.isGlobalTrack()) - { + if (diffCuts.globalTracksOnly() && track.isPVContributor() && !track.isGlobalTrack()) { return 4; } - if (!diffCuts.ITSOnlyTracks() && track.isPVContributor() && !track.hasTPC()) - { + if (!diffCuts.ITSOnlyTracks() && track.isPVContributor() && !track.hasTPC()) { return 5; } // update fraction of PV tracks with TOF hit - if (track.isPVContributor() && track.hasTOF()) - { + if (track.isPVContributor() && track.hasTOF()) { rgtrwTOF += 1.; } } - if (collision.numContrib() > 0) - { + if (collision.numContrib() > 0) { rgtrwTOF /= collision.numContrib(); } - if (rgtrwTOF < diffCuts.minRgtrwTOF()) - { + if (rgtrwTOF < diffCuts.minRgtrwTOF()) { return 6; } // number of vertex tracks - if (collision.numContrib() < diffCuts.minNTracks() || collision.numContrib() > diffCuts.maxNTracks()) - { + if (collision.numContrib() < diffCuts.minNTracks() || collision.numContrib() > diffCuts.maxNTracks()) { return 7; } @@ -107,19 +97,16 @@ class SGSelector // which particle hypothesis? auto mass2Use = 0.; - TParticlePDG *pdgparticle = fPDG->GetParticle(diffCuts.pidHypothesis()); - if (pdgparticle != nullptr) - { + TParticlePDG* pdgparticle = fPDG->GetParticle(diffCuts.pidHypothesis()); + if (pdgparticle != nullptr) { mass2Use = pdgparticle->Mass(); } auto netCharge = 0; auto lvtmp = TLorentzVector(); auto ivm = TLorentzVector(); - for (auto &track : tracks) - { - if (track.isPVContributor()) - { + for (auto& track : tracks) { + if (track.isPVContributor()) { // PID // if (!udhelpers::hasGoodPID(diffCuts, track)) { @@ -128,14 +115,12 @@ class SGSelector // pt lvtmp.SetXYZM(track.px(), track.py(), track.pz(), mass2Use); - if (lvtmp.Perp() < diffCuts.minPt() || lvtmp.Perp() > diffCuts.maxPt()) - { + if (lvtmp.Perp() < diffCuts.minPt() || lvtmp.Perp() > diffCuts.maxPt()) { return 9; } // eta - if (lvtmp.Eta() < diffCuts.minEta() || lvtmp.Eta() > diffCuts.maxEta()) - { + if (lvtmp.Eta() < diffCuts.minEta() || lvtmp.Eta() > diffCuts.maxEta()) { return 10; } netCharge += track.sign(); @@ -145,31 +130,30 @@ class SGSelector // net charge auto netChargeValues = diffCuts.netCharges(); - if (std::find(netChargeValues.begin(), netChargeValues.end(), netCharge) == netChargeValues.end()) - { + if (std::find(netChargeValues.begin(), netChargeValues.end(), netCharge) == netChargeValues.end()) { return 11; } // invariant mass - if (ivm.M() < diffCuts.minIVM() || ivm.M() > diffCuts.maxIVM()) - { + if (ivm.M() < diffCuts.minIVM() || ivm.M() > diffCuts.maxIVM()) { return 12; } // check that there are no FIT signals in any of the compatible BCs // Single Gap (SG) condition - for (auto const &bc : bcRange) - { + for (auto const& bc : bcRange) { if (useSideA) { if (!udhelpers::cleanFITA(bc, diffCuts.maxFITtime(), diffCuts.FITAmpLimits())) { return 1; } - // if we arrive here then the event is good! - else return 0; + // if we arrive here then the event is good! + else + return 0; } else { if (!udhelpers::cleanFITC(bc, diffCuts.maxFITtime(), diffCuts.FITAmpLimits())) { return 1; } - // if we arrive here then the event is good! - else return 0; + // if we arrive here then the event is good! + else + return 0; } } @@ -179,35 +163,30 @@ class SGSelector // Function to check if BC passes SG filter (without associated collision) template - int IsSelected(SGCutParHolder diffCuts, BCs &bcRange, TCs &tracks, FWs &fwdtracks, bool useSideA) + int IsSelected(SGCutParHolder diffCuts, BCs& bcRange, TCs& tracks, FWs& fwdtracks, bool useSideA) { // check that there are no FIT signals in bcRange // Single Gap (SG) condition - for (auto const &bc : bcRange) - { - LOGF(info, "%i \t %i", udhelpers::cleanFITA(bc, diffCuts.maxFITtime(), diffCuts.FITAmpLimits()), udhelpers::cleanFITC(bc, diffCuts.maxFITtime(), diffCuts.FITAmpLimits())); - if (!udhelpers::cleanFITA(bc, diffCuts.maxFITtime(), diffCuts.FITAmpLimits()) && !udhelpers::cleanFITC(bc, diffCuts.maxFITtime(), diffCuts.FITAmpLimits())) { - return 1; //activity on both sides - } + for (auto const& bc : bcRange) { + LOGF(info, "%i \t %i", udhelpers::cleanFITA(bc, diffCuts.maxFITtime(), diffCuts.FITAmpLimits()), udhelpers::cleanFITC(bc, diffCuts.maxFITtime(), diffCuts.FITAmpLimits())); + if (!udhelpers::cleanFITA(bc, diffCuts.maxFITtime(), diffCuts.FITAmpLimits()) && !udhelpers::cleanFITC(bc, diffCuts.maxFITtime(), diffCuts.FITAmpLimits())) { + return 1; // activity on both sides + } } // no activity in muon arm - if (!diffCuts.withFwdTracks()) - { - for (auto &fwdtrack : fwdtracks) - { + if (!diffCuts.withFwdTracks()) { + for (auto& fwdtrack : fwdtracks) { LOGF(info, " %i / %f / %f / %f / %f", fwdtrack.trackType(), fwdtrack.eta(), fwdtrack.pt(), fwdtrack.p(), fwdtrack.trackTimeRes()); // only consider tracks with MID (good timing) - if (fwdtrack.trackType() == 0 || fwdtrack.trackType() == 3) - { + if (fwdtrack.trackType() == 0 || fwdtrack.trackType() == 3) { return 2; } } } // number of tracks - if (static_cast(tracks.size()) < diffCuts.minNTracks() || static_cast(tracks.size()) > diffCuts.maxNTracks()) - { + if (static_cast(tracks.size()) < diffCuts.minNTracks() || static_cast(tracks.size()) > diffCuts.maxNTracks()) { return 3; } @@ -216,17 +195,15 @@ class SGSelector // which particle hypothesis? auto mass2Use = 0.; - TParticlePDG *pdgparticle = fPDG->GetParticle(diffCuts.pidHypothesis()); - if (pdgparticle != nullptr) - { + TParticlePDG* pdgparticle = fPDG->GetParticle(diffCuts.pidHypothesis()); + if (pdgparticle != nullptr) { mass2Use = pdgparticle->Mass(); } auto netCharge = 0; auto lvtmp = TLorentzVector(); auto ivm = TLorentzVector(); - for (auto &track : tracks) - { + for (auto& track : tracks) { // PID // if (!udhelpers::hasGoodPID(diffCuts, track)) { @@ -235,14 +212,12 @@ class SGSelector // pt lvtmp.SetXYZM(track.px(), track.py(), track.pz(), mass2Use); - if (lvtmp.Perp() < diffCuts.minPt() || lvtmp.Perp() > diffCuts.maxPt()) - { + if (lvtmp.Perp() < diffCuts.minPt() || lvtmp.Perp() > diffCuts.maxPt()) { return 5; } // eta - if (lvtmp.Eta() < diffCuts.minEta() || lvtmp.Eta() > diffCuts.maxEta()) - { + if (lvtmp.Eta() < diffCuts.minEta() || lvtmp.Eta() > diffCuts.maxEta()) { return 6; } netCharge += track.sign(); @@ -251,40 +226,37 @@ class SGSelector // net charge auto netChargeValues = diffCuts.netCharges(); - if (std::find(netChargeValues.begin(), netChargeValues.end(), netCharge) == netChargeValues.end()) - { + if (std::find(netChargeValues.begin(), netChargeValues.end(), netCharge) == netChargeValues.end()) { return 7; } // invariant mass - if (ivm.M() < diffCuts.minIVM() || ivm.M() > diffCuts.maxIVM()) - { + if (ivm.M() < diffCuts.minIVM() || ivm.M() > diffCuts.maxIVM()) { return 8; } // check that there are no FIT signals in any of the compatible BCs // Single Gap (SG) condition - for (auto const &bc : bcRange) - { + for (auto const& bc : bcRange) { if (useSideA) { if (!udhelpers::cleanFITA(bc, diffCuts.maxFITtime(), diffCuts.FITAmpLimits())) { return 1; } - // if we arrive here then the event is good! - else return 0; + // if we arrive here then the event is good! + else + return 0; } else { if (!udhelpers::cleanFITC(bc, diffCuts.maxFITtime(), diffCuts.FITAmpLimits())) { return 1; } - // if we arrive here then the event is good! - else return 0; + // if we arrive here then the event is good! + else + return 0; } } - }; -private: - TDatabasePDG *fPDG; + private: + TDatabasePDG* fPDG; }; #endif // PWGUD_CORE_SGSELECTOR_H_ - diff --git a/PWGUD/DataModel/UDTables.h b/PWGUD/DataModel/UDTables.h index a02fb41f6b5..c57e19b7b1f 100644 --- a/PWGUD/DataModel/UDTables.h +++ b/PWGUD/DataModel/UDTables.h @@ -96,7 +96,7 @@ DECLARE_SOA_COLUMN(TriggerMaskFDD, triggerMaskFDD, uint8_t); //! FDD trigg DECLARE_SOA_COLUMN(TotalFV0AmplitudeA, totalFV0AmplitudeA, float); //! sum of amplitudes on A side of FDD DECLARE_SOA_COLUMN(TimeFV0A, timeFV0A, float); //! FV0A average time DECLARE_SOA_COLUMN(TriggerMaskFV0A, triggerMaskFV0A, uint8_t); //! FV0 trigger mask -//Gap Side Information +// Gap Side Information DECLARE_SOA_COLUMN(GapSide, gapSide, uint8_t); // 0 for side A, 1 for side C, 2 for both sides (or use an enum for better readability) // FIT selection flags // bits in range [0, 15] -> past BCs @@ -150,7 +150,6 @@ DECLARE_SOA_TABLE(UDCollisions, "AOD", "UDCOLLISION", collision::NumContrib, udcollision::NetCharge, udcollision::RgtrwTOF); - DECLARE_SOA_TABLE(SGCollisions, "AOD", "SGCOLLISION", o2::soa::Index<>, @@ -162,7 +161,7 @@ DECLARE_SOA_TABLE(SGCollisions, "AOD", "SGCOLLISION", collision::NumContrib, udcollision::NetCharge, udcollision::RgtrwTOF, - udcollision::GapSide); + udcollision::GapSide); DECLARE_SOA_TABLE(UDCollisionsSels, "AOD", "UDCOLLISIONSEL", udcollision::TotalFT0AmplitudeA, diff --git a/PWGUD/TableProducer/SGCandProducer.cxx b/PWGUD/TableProducer/SGCandProducer.cxx index fc97f9ef1ed..c01e352c1c2 100644 --- a/PWGUD/TableProducer/SGCandProducer.cxx +++ b/PWGUD/TableProducer/SGCandProducer.cxx @@ -10,7 +10,7 @@ using namespace o2::framework::expressions; struct SGCandProducer { // get an SGCutparHolder - SGCutParHolder sameCuts = SGCutParHolder();//SGCutparHolder + SGCutParHolder sameCuts = SGCutParHolder(); // SGCutparHolder Configurable SGCuts{"SGCuts", {}, "SG event cuts"}; // SG selector @@ -33,8 +33,8 @@ struct SGCandProducer { // initialize histogram registry HistogramRegistry registry{ - "registry", - {}}; + "registry", + {}}; // data inputs using CCs = soa::Join; @@ -143,17 +143,20 @@ struct SGCandProducer { LOGF(debug, " Size of bcRange %d", bcRange.size()); // apply SG selection -// auto isSGEvent = sgSelector.IsSelected(sameCuts, collision, bcRange, tracks, fwdtracks); + // auto isSGEvent = sgSelector.IsSelected(sameCuts, collision, bcRange, tracks, fwdtracks); auto isSGEventA = sgSelector.IsSelected(sameCuts, collision, bcRange, tracks, fwdtracks, true /* useSideA */); - // Check if it's a SingleGap event for sideC + // Check if it's a SingleGap event for sideC auto isSGEventC = sgSelector.IsSelected(sameCuts, collision, bcRange, tracks, fwdtracks, false /* useSideC */); // save SG candidates auto isSGEvent = (isSGEventA && isSGEventC); uint8_t gapSide = -1; - if (!isSGEventA && !isSGEventC) gapSide =2; - else if (!isSGEventA) gapSide =0; - else if (!isSGEventC) gapSide =1; + if (!isSGEventA && !isSGEventC) + gapSide = 2; + else if (!isSGEventA) + gapSide = 0; + else if (!isSGEventC) + gapSide = 1; registry.get(HIST("reco/Stat"))->Fill(0., 1.); registry.get(HIST("reco/Stat"))->Fill(isSGEvent + 1, 1.); if (isSGEvent == 0) { diff --git a/Tutorials/PWGMM/myExampleTask.cxx b/Tutorials/PWGMM/myExampleTask.cxx index 849608a5542..6caac2655b1 100644 --- a/Tutorials/PWGMM/myExampleTask.cxx +++ b/Tutorials/PWGMM/myExampleTask.cxx @@ -25,80 +25,86 @@ using namespace o2::framework::expressions; struct myExampleTask { // Histogram registry: an object to hold your histograms HistogramRegistry histos{"histos", {}, OutputObjHandlingPolicy::AnalysisObject}; - + Configurable nBinsPt{"nBinsPt", 100, "N bins in pT histo"}; - + Filter trackDCA = nabs(aod::track::dcaXY) < 0.2f; Preslice perCollision = aod::track::collisionId; - //This is an example of a convenient declaration of "using" - //using myCompleteTracks = soa::Join; //for data - using myCompleteTracks = soa::Join; //for MC + // This is an example of a convenient declaration of "using" + // using myCompleteTracks = soa::Join; //for data + using myCompleteTracks = soa::Join; // for MC using myFilteredTracks = soa::Filtered; void init(InitContext const&) { - // define axes you want to use - const AxisSpec axisCounter{1, 0, +1, ""}; - const AxisSpec axisReco{4, -.5, +3.5, "N coll"}; - const AxisSpec axisTrack{50, -.5, +49.5, "Number of Tracks"}; - const AxisSpec axisEta{30, -1.5, +1.5, "#eta"}; - const AxisSpec axisPt{nBinsPt, 0, 10, "p_{T}"}; - const AxisSpec axisDeltaPt{100, -1.0, +1.0, "#Delta(p_{T})"}; - // create histograms - histos.add("numberOfRecoCollisions", "numberOfRecoCollisions", kTH1F, {axisReco}); - histos.add("eventCounter", "eventCounter", kTH1F, {axisCounter}); - histos.add("etaHistogram", "etaHistogram", kTH1F, {axisEta}); - histos.add("ptHistogram", "ptHistogram", kTH1F, {axisPt}); - histos.add("ptResolution", "ptResolution", kTH2F, {axisPt, axisDeltaPt}); - histos.add("multiplicityCorrelation", "multiplicityCorrelation", kTH2F, {axisTrack, axisTrack}); - histos.add("ptHistogramPion", "ptHistogramPion", kTH1F, {axisPt}); - histos.add("ptHistogramKaon", "ptHistogramKaon", kTH1F, {axisPt}); - histos.add("ptHistogramProton", "ptHistogramProton", kTH1F, {axisPt}); - histos.add("ptGeneratedPion", "ptGeneratedPion", kTH1F, {axisPt}); - histos.add("ptGeneratedKaon", "ptGeneratedKaon", kTH1F, {axisPt}); - histos.add("ptGeneratedProton", "ptGeneratedProton", kTH1F, {axisPt}); - } - + // define axes you want to use + const AxisSpec axisCounter{1, 0, +1, ""}; + const AxisSpec axisReco{4, -.5, +3.5, "N coll"}; + const AxisSpec axisTrack{50, -.5, +49.5, "Number of Tracks"}; + const AxisSpec axisEta{30, -1.5, +1.5, "#eta"}; + const AxisSpec axisPt{nBinsPt, 0, 10, "p_{T}"}; + const AxisSpec axisDeltaPt{100, -1.0, +1.0, "#Delta(p_{T})"}; + // create histograms + histos.add("numberOfRecoCollisions", "numberOfRecoCollisions", kTH1F, {axisReco}); + histos.add("eventCounter", "eventCounter", kTH1F, {axisCounter}); + histos.add("etaHistogram", "etaHistogram", kTH1F, {axisEta}); + histos.add("ptHistogram", "ptHistogram", kTH1F, {axisPt}); + histos.add("ptResolution", "ptResolution", kTH2F, {axisPt, axisDeltaPt}); + histos.add("multiplicityCorrelation", "multiplicityCorrelation", kTH2F, {axisTrack, axisTrack}); + histos.add("ptHistogramPion", "ptHistogramPion", kTH1F, {axisPt}); + histos.add("ptHistogramKaon", "ptHistogramKaon", kTH1F, {axisPt}); + histos.add("ptHistogramProton", "ptHistogramProton", kTH1F, {axisPt}); + histos.add("ptGeneratedPion", "ptGeneratedPion", kTH1F, {axisPt}); + histos.add("ptGeneratedKaon", "ptGeneratedKaon", kTH1F, {axisPt}); + histos.add("ptGeneratedProton", "ptGeneratedProton", kTH1F, {axisPt}); + } + void processReco(o2::aod::Collision const& collision, myFilteredTracks const& tracks, aod::McParticles const&) { - histos.fill(HIST("eventCounter"), 0.5); - for (const auto& track : tracks) { - if( track.tpcNClsCrossedRows() < 70 ) continue; //badly tracked - histos.fill(HIST("etaHistogram"), track.eta()); - histos.fill(HIST("ptHistogram"), track.pt()); - if(track.has_mcParticle()){ - auto mcParticle = track.mcParticle(); - histos.fill(HIST("ptResolution"), track.pt(), track.pt() - mcParticle.pt()); - if(mcParticle.isPhysicalPrimary() && fabs(mcParticle.y())<0.5){ // do this in the context of the track ! (context matters!!!) - if(abs(mcParticle.pdgCode())==211) histos.fill(HIST("ptHistogramPion"), mcParticle.pt()); - if(abs(mcParticle.pdgCode())==321) histos.fill(HIST("ptHistogramKaon"), mcParticle.pt()); - if(abs(mcParticle.pdgCode())==2212) histos.fill(HIST("ptHistogramProton"), mcParticle.pt()); - } - } - } - } -PROCESS_SWITCH(myExampleTask, processReco, "process reconstructed information", true); - void processSim(aod::McCollision const& mcCollision, soa::SmallGroups> const& collisions, aod::McParticles const& mcParticles, myFilteredTracks const& tracks) - { - histos.fill(HIST("numberOfRecoCollisions"), collisions.size()); - for (const auto& mcParticle : mcParticles) { - if(mcParticle.isPhysicalPrimary() && fabs(mcParticle.y())<0.5){ // watch out for context!!! - if(abs(mcParticle.pdgCode())==211) histos.fill(HIST("ptGeneratedPion"), mcParticle.pt()); - if(abs(mcParticle.pdgCode())==321) histos.fill(HIST("ptGeneratedKaon"), mcParticle.pt()); - if(abs(mcParticle.pdgCode())==2212) histos.fill(HIST("ptGeneratedProton"), mcParticle.pt()); - } - } - std::vector numberOfTracks; - for (auto& collision : collisions) { - auto groupedTracks = tracks.sliceBy(perCollision, collision.globalIndex()); - // size of grouped tracks may help in understanding why event was split! - numberOfTracks.emplace_back(groupedTracks.size()); - } - if( collisions.size() == 2 ) histos.fill(HIST("multiplicityCorrelation"), numberOfTracks[0], numberOfTracks[1]); - } -PROCESS_SWITCH(myExampleTask, processSim, "process pure simulation information", true); - + histos.fill(HIST("eventCounter"), 0.5); + for (const auto& track : tracks) { + if (track.tpcNClsCrossedRows() < 70) + continue; // badly tracked + histos.fill(HIST("etaHistogram"), track.eta()); + histos.fill(HIST("ptHistogram"), track.pt()); + if (track.has_mcParticle()) { + auto mcParticle = track.mcParticle(); + histos.fill(HIST("ptResolution"), track.pt(), track.pt() - mcParticle.pt()); + if (mcParticle.isPhysicalPrimary() && fabs(mcParticle.y()) < 0.5) { // do this in the context of the track ! (context matters!!!) + if (abs(mcParticle.pdgCode()) == 211) + histos.fill(HIST("ptHistogramPion"), mcParticle.pt()); + if (abs(mcParticle.pdgCode()) == 321) + histos.fill(HIST("ptHistogramKaon"), mcParticle.pt()); + if (abs(mcParticle.pdgCode()) == 2212) + histos.fill(HIST("ptHistogramProton"), mcParticle.pt()); + } + } + } + } + PROCESS_SWITCH(myExampleTask, processReco, "process reconstructed information", true); + void processSim(aod::McCollision const& mcCollision, soa::SmallGroups> const& collisions, aod::McParticles const& mcParticles, myFilteredTracks const& tracks) + { + histos.fill(HIST("numberOfRecoCollisions"), collisions.size()); + for (const auto& mcParticle : mcParticles) { + if (mcParticle.isPhysicalPrimary() && fabs(mcParticle.y()) < 0.5) { // watch out for context!!! + if (abs(mcParticle.pdgCode()) == 211) + histos.fill(HIST("ptGeneratedPion"), mcParticle.pt()); + if (abs(mcParticle.pdgCode()) == 321) + histos.fill(HIST("ptGeneratedKaon"), mcParticle.pt()); + if (abs(mcParticle.pdgCode()) == 2212) + histos.fill(HIST("ptGeneratedProton"), mcParticle.pt()); + } + } + std::vector numberOfTracks; + for (auto& collision : collisions) { + auto groupedTracks = tracks.sliceBy(perCollision, collision.globalIndex()); + // size of grouped tracks may help in understanding why event was split! + numberOfTracks.emplace_back(groupedTracks.size()); + } + if (collisions.size() == 2) + histos.fill(HIST("multiplicityCorrelation"), numberOfTracks[0], numberOfTracks[1]); + } + PROCESS_SWITCH(myExampleTask, processSim, "process pure simulation information", true); }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) diff --git a/Tutorials/PWGUD/UDTutorial_01sg.cxx b/Tutorials/PWGUD/UDTutorial_01sg.cxx index 229a72ecd1f..3909efa2291 100644 --- a/Tutorials/PWGUD/UDTutorial_01sg.cxx +++ b/Tutorials/PWGUD/UDTutorial_01sg.cxx @@ -25,7 +25,7 @@ using namespace o2; using namespace o2::framework; using namespace o2::framework::expressions; -struct UDTutorial01sg { //UDTutorial01 +struct UDTutorial01sg { // UDTutorial01 // configurables Configurable verbose{"Verbose", {}, "Additional print outs"}; @@ -74,7 +74,7 @@ struct UDTutorial01sg { //UDTutorial01 } // define data types - using UDCollisionsFull = soa::Join; //UDCollisions + using UDCollisionsFull = soa::Join; // UDCollisions using UDCollisionFull = UDCollisionsFull::iterator; using UDTracksFull = soa::Join; diff --git a/Tutorials/PWGUD/UDTutorial_03b.cxx b/Tutorials/PWGUD/UDTutorial_03b.cxx index b0ec8ebc4de..3937a0185fa 100644 --- a/Tutorials/PWGUD/UDTutorial_03b.cxx +++ b/Tutorials/PWGUD/UDTutorial_03b.cxx @@ -516,7 +516,7 @@ struct UDTutorial03b { registry.get(HIST("Reco/mcRap"))->Fill(lv_gen->Rapidity(), 1.); registry.get(HIST("Reco/mcMPt"))->Fill(lv_gen->M(), lv_gen->Pt(), 1.); registry.get(HIST("Reco/MGenMRec"))->Fill(lv_gen->M(), lv_rec->M(), 1.); - registry.get(HIST("Reco/MRes"))->Fill((lv_gen->M()-lv_rec->M()), 1.); + registry.get(HIST("Reco/MRes"))->Fill((lv_gen->M() - lv_rec->M()), 1.); } } PROCESS_SWITCH(UDTutorial03b, processReco, "Process reconstructed data", true);