diff --git a/PWGCF/TwoParticleCorrelations/DataModel/IdentifiedBfFiltered.h b/PWGCF/TwoParticleCorrelations/DataModel/IdentifiedBfFiltered.h deleted file mode 100644 index 96a5721d35c..00000000000 --- a/PWGCF/TwoParticleCorrelations/DataModel/IdentifiedBfFiltered.h +++ /dev/null @@ -1,115 +0,0 @@ -// Copyright 2019-2020 CERN and copyright holders of ALICE O2. -// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. -// All rights not expressly granted are reserved. -// -// This software is distributed under the terms of the GNU General Public -// License v3 (GPL Version 3), copied verbatim in the file "COPYING". -// -// In applying this license CERN does not waive the privileges and immunities -// granted to it by virtue of its status as an Intergovernmental Organization -// or submit itself to any jurisdiction. -#ifndef PWGCF_TWOPARTICLECORRELATIONS_DATAMODEL_IDENTIFIEDBFFILTERED_H_ -#define PWGCF_TWOPARTICLECORRELATIONS_DATAMODEL_IDENTIFIEDBFFILTERED_H_ - -#include "Framework/ASoA.h" -#include "Framework/AnalysisDataModel.h" - -namespace o2 -{ -namespace aod -{ -/* we have to change from int to bool when bool columns work properly */ -namespace identifiedbffilter -{ -DECLARE_SOA_COLUMN(IdentifiedBfCFCollisionAccepted, collisionaccepted, uint8_t); //! If the collision/event has been accepted or not -DECLARE_SOA_COLUMN(IdentifiedBfCFCollisionCentMult, centmult, float); //! The centrality/multiplicity pecentile -DECLARE_SOA_DYNAMIC_COLUMN(IsCollisionAccepted, //! Is the collision/event accepted - iscollisionaccepted, - [](uint8_t _collisionaccepted) -> uint8_t { return _collisionaccepted; }); -DECLARE_SOA_DYNAMIC_COLUMN(IsGenCollisionAccepted, //! Is the generated collision/event accepted - isgencollisionaccepted, - [](uint8_t _collisionaccepted) -> uint8_t { return _collisionaccepted; }); -} // namespace identifiedbffilter -DECLARE_SOA_TABLE(IdentifiedBfCFAcceptedCollisions, - "AOD", - "IBFCFACCCOLL", //! Accepted reconstructed collisions/events filtered table - o2::soa::Index<>, - collision::BCId, - collision::PosZ, - identifiedbffilter::IdentifiedBfCFCollisionAccepted, - identifiedbffilter::IdentifiedBfCFCollisionCentMult, - identifiedbffilter::IsCollisionAccepted); -using IdentifiedBfCFAcceptedCollision = IdentifiedBfCFAcceptedCollisions::iterator; -DECLARE_SOA_TABLE(IdentifiedBfCFAcceptedTrueCollisions, - "AOD", - "IBFCFACCGENCOLL", //! Accepted generated collisions/events filtered table - o2::soa::Index<>, - collision::BCId, - mccollision::PosZ, - identifiedbffilter::IdentifiedBfCFCollisionAccepted, - identifiedbffilter::IdentifiedBfCFCollisionCentMult, - identifiedbffilter::IsGenCollisionAccepted); -using IdentifiedBfCFAcceptedTrueCollision = IdentifiedBfCFAcceptedTrueCollisions::iterator; -DECLARE_SOA_TABLE( - IdentifiedBfCFCollisionsInfo, - "AOD", - "IBFCFCOLLINF", //! Accepted reconstructed collisions/events Collisions joinable table - identifiedbffilter::IdentifiedBfCFCollisionAccepted, - identifiedbffilter::IdentifiedBfCFCollisionCentMult, - identifiedbffilter::IsCollisionAccepted); -DECLARE_SOA_TABLE( - IdentifiedBfCFGenCollisionsInfo, - "AOD", - "IBFGENCFCOLLINF", //! Accepted generated collisions/events mcCollisions joinable table - identifiedbffilter::IdentifiedBfCFCollisionAccepted, - identifiedbffilter::IdentifiedBfCFCollisionCentMult, - identifiedbffilter::IsGenCollisionAccepted); -namespace identifiedbffilter -{ -DECLARE_SOA_INDEX_COLUMN(IdentifiedBfCFAcceptedCollision, event); //! Reconstructed collision/event -DECLARE_SOA_INDEX_COLUMN(IdentifiedBfCFAcceptedTrueCollision, mcevent); //! Generated collision/event -DECLARE_SOA_COLUMN(TrackacceptedId, - trackacceptedid, - int8_t); //! Id of accepted track, criteria: even (+) odd (-) -DECLARE_SOA_COLUMN(Pt, pt, float); //! The track transverse momentum -DECLARE_SOA_COLUMN(Eta, eta, float); //! The track pseudorapidity -DECLARE_SOA_COLUMN(Phi, phi, float); //! The track azimuthal angle -DECLARE_SOA_DYNAMIC_COLUMN(Sign, - sign, //! Charge: positive: 1, negative: -1 - [](int8_t trackacceptedid) -> int8_t { - return (trackacceptedid % 2 == 0 - ? 1 - : (trackacceptedid % 2 == 1 ? -1 : 0)); - }); -DECLARE_SOA_DYNAMIC_COLUMN(TrkID, - trkid, //! The track id - [](int8_t trackacceptedid) -> int8_t { return trackacceptedid; }); -DECLARE_SOA_DYNAMIC_COLUMN(PartID, - partid, //! The generated particle id - [](int8_t trackacceptedid) -> int8_t { return trackacceptedid; }); -} // namespace identifiedbffilter -DECLARE_SOA_TABLE(ScannedTracks, "AOD", "SCANNEDTRACKS", //! The reconstructed tracks filtered table - identifiedbffilter::IdentifiedBfCFAcceptedCollisionId, - identifiedbffilter::TrackacceptedId, - identifiedbffilter::Pt, - identifiedbffilter::Eta, - identifiedbffilter::Phi, - identifiedbffilter::Sign); -DECLARE_SOA_TABLE(ScannedTrueTracks, "AOD", "SCANTRUETRACKS", //! The generated particles filtered table - identifiedbffilter::IdentifiedBfCFAcceptedTrueCollisionId, - identifiedbffilter::TrackacceptedId, - identifiedbffilter::Pt, - identifiedbffilter::Eta, - identifiedbffilter::Phi, - identifiedbffilter::Sign); -DECLARE_SOA_TABLE(IdentifiedBfCFTracksInfo, "AOD", "SCANDTRCKINF", //! The additional information Tracks joinable table - identifiedbffilter::TrackacceptedId, - identifiedbffilter::TrkID); -DECLARE_SOA_TABLE(IdentifiedBfCFGenTracksInfo, "AOD", "SCANDGENTRCKINF", //! The additional information mcParticle joinable table - identifiedbffilter::TrackacceptedId, - identifiedbffilter::Sign, - identifiedbffilter::PartID); -} // namespace aod -} // namespace o2 - -#endif // PWGCF_TWOPARTICLECORRELATIONS_DATAMODEL_IDENTIFIEDBFFILTERED_H_ diff --git a/PWGCF/TwoParticleCorrelations/TableProducer/CMakeLists.txt b/PWGCF/TwoParticleCorrelations/TableProducer/CMakeLists.txt index 4bc1d428324..c7820c37871 100644 --- a/PWGCF/TwoParticleCorrelations/TableProducer/CMakeLists.txt +++ b/PWGCF/TwoParticleCorrelations/TableProducer/CMakeLists.txt @@ -9,27 +9,22 @@ # granted to it by virtue of its status as an Intergovernmental Organization # or submit itself to any jurisdiction. -o2physics_add_dpl_workflow(twopartcorr-register-skim +o2physics_add_dpl_workflow(two-particle-correlations-register-skimming SOURCES twoParticleCorrelationsRegisterSkimming.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2Physics::TwoPartCorrCore COMPONENT_NAME Analysis) -o2physics_add_dpl_workflow(twopartcorr-skim +o2physics_add_dpl_workflow(two-particle-correlations-full-skimming SOURCES twoParticleCorrelationsFullSkimming.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2Physics::TwoPartCorrCore COMPONENT_NAME Analysis) -o2physics_add_dpl_workflow(twopartcorr-notstored-skim +o2physics_add_dpl_workflow(two-particle-correlations-not-stored-skimming SOURCES twoParticleCorrelationsNotStoredSkimming.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2Physics::TwoPartCorrCore COMPONENT_NAME Analysis) -o2physics_add_dpl_workflow(twopartcorr-filter +o2physics_add_dpl_workflow(two-particle-correlations-filtering SOURCES twoParticleCorrelationsFiltering.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2Physics::TwoPartCorrCore COMPONENT_NAME Analysis) - -o2physics_add_dpl_workflow(identifiedbf-filter - SOURCES identifiedBfFilter.cxx - PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2Physics::PWGCFCore - COMPONENT_NAME Analysis) diff --git a/PWGCF/TwoParticleCorrelations/TableProducer/identifiedBfFilter.cxx b/PWGCF/TwoParticleCorrelations/TableProducer/identifiedBfFilter.cxx deleted file mode 100644 index 535dd77cce2..00000000000 --- a/PWGCF/TwoParticleCorrelations/TableProducer/identifiedBfFilter.cxx +++ /dev/null @@ -1,2296 +0,0 @@ -// Copyright 2019-2020 CERN and copyright holders of ALICE O2. -// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. -// All rights not expressly granted are reserved. -// -// This software is distributed under the terms of the GNU General Public -// License v3 (GPL Version 3), copied verbatim in the file "COPYING". -// -// In applying this license CERN does not waive the privileges and immunities -// granted to it by virtue of its status as an Intergovernmental Organization -// or submit itself to any jurisdiction. - -/// \file identifiedBfFilter.cxx -/// \brief Filters collisions and tracks according to selection criteria -/// \author bghanley1995@gmail.com - -#include "PWGCF/TwoParticleCorrelations/TableProducer/identifiedBfFilter.h" - -#include -#include -#include -#include - -#include "Framework/AnalysisTask.h" -#include "Framework/AnalysisDataModel.h" -#include "Framework/ASoAHelpers.h" -#include "Common/DataModel/EventSelection.h" -#include "Common/DataModel/Centrality.h" -#include "Common/Core/TrackSelection.h" -#include "Common/Core/TrackSelectionDefaults.h" -#include "Common/DataModel/PIDResponse.h" -#include "PWGCF/Core/AnalysisConfigurableCuts.h" -#include "PWGCF/TwoParticleCorrelations/DataModel/IdentifiedBfFiltered.h" -#include "Common/DataModel/TrackSelectionTables.h" -#include "Common/DataModel/CollisionAssociationTables.h" -#include "Framework/runDataProcessing.h" -#include "Framework/O2DatabasePDGPlugin.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -using namespace o2; -using namespace o2::framework; -using namespace o2::soa; -using namespace o2::framework::expressions; -using namespace o2::analysis; - -#define IDENTIFIEDBFFILTERLOGCOLLISIONS debug -#define IDENTIFIEDBFFILTERLOGTRACKS debug - -namespace o2::analysis::identifiedbffilter -{ -using IdBfFullTracks = soa::Join; -using IdBfFullTracksAmbiguous = soa::Join; -using IdBfTracksPID = soa::Join; -using IdBfTracksTOF = soa::Join; -using IdBfTracksFullPID = soa::Join; -using IdBfFullTracksPID = soa::Join; -using IdBfFullTracksFullPID = soa::Join; -using IdBfFullTracksPIDAmbiguous = soa::Join; -using IdBfFullTracksFullPIDAmbiguous = soa::Join; -using IdBfFullTracksDetLevel = soa::Join; -using IdBfFullTracksDetLevelAmbiguous = soa::Join; -using IdBfFullTracksPIDDetLevel = soa::Join; -using IdBfFullTracksFullPIDDetLevel = soa::Join; -using IdBfFullTracksPIDDetLevelAmbiguous = soa::Join; -using IdBfFullTracksFullPIDDetLevelAmbiguous = soa::Join; - -bool fullDerivedData = false; /* produce full derived data for its external storage */ - -TList* ccdblst = nullptr; -bool loadfromccdb = false; - -std::vector recoIdMethods = {0, 1, 2}; // Reconstructed PID Methods, 0 is no PID, 1 is calculated PID, 2 is MC PID -std::vector trackTypes = {0, 1, 2, 3}; -const int twoDenom = 2; // Used to test if a value is even or odd - -//============================================================================================ -// The IdentifiedBfFilter histogram objects -// TODO: consider registering in the histogram registry -//============================================================================================ -TH1F* fhCentMultB = nullptr; -TH1F* fhCentMultA = nullptr; -TH1F* fhVertexZB = nullptr; -TH1F* fhVertexZA = nullptr; -TH1F* fhMultB = nullptr; -TH1F* fhMultA = nullptr; -TH2F* fhYZB = nullptr; -TH2F* fhXYB = nullptr; -TH2F* fhYZA = nullptr; -TH2F* fhXYA = nullptr; -TH1F* fhPB = nullptr; -TH1F* fhPA[kIdBfNoOfSpecies + 1] = {nullptr}; -TH1F* fhPtB = nullptr; -TH1F* fhPtA[kIdBfNoOfSpecies + 1] = {nullptr}; -TH1F* fhPtPosB = nullptr; -TH1F* fhPtPosA[kIdBfNoOfSpecies + 1] = {nullptr}; -TH1F* fhPtNegB = nullptr; -TH1F* fhPtNegA[kIdBfNoOfSpecies + 1] = {nullptr}; -TH2F* fhNPosNegA[kIdBfNoOfSpecies + 1] = {nullptr}; -TH1F* fhDeltaNA[kIdBfNoOfSpecies + 1] = {nullptr}; - -TH2F* fhPtEtaPosA[kIdBfNoOfSpecies + 1] = {nullptr}; -TH2F* fhPtEtaNegA[kIdBfNoOfSpecies + 1] = {nullptr}; - -TH1I* fhNClustersB = nullptr; -TH2F* fhPhiYB = nullptr; -TH2F* fhPtYB = nullptr; -TH1F* fhChi2B = nullptr; -TH1I* fhITSNclB = nullptr; - -TH1I* fhNClustersA = nullptr; -TH2F* fhPhiYA = nullptr; -TH2F* fhPtYA = nullptr; -TH1F* fhChi2A = nullptr; -TH1I* fhITSNclA = nullptr; - -TH2F* fhNSigmaTPC[kIdBfNoOfSpecies] = {nullptr}; -TH2F* fhNSigmaTOF[kIdBfNoOfSpecies] = {nullptr}; -TH2F* fhNSigmaCombo[kIdBfNoOfSpecies] = {nullptr}; -TH2F* fhNSigmaTPCIdTrks[kIdBfNoOfSpecies] = {nullptr}; - -TH1F* fhNSigmaCorrection[kIdBfNoOfSpecies] = {nullptr}; - -TH1F* fhEtaB = nullptr; -TH1F* fhEtaA = nullptr; - -TH1F* fhPhiB = nullptr; -TH1F* fhPhiA = nullptr; - -TH1F* fhTrackLengthB = nullptr; -TH1F* fhTrackLengthTOFB = nullptr; -TH2F* fhTrackTimeB = nullptr; -TH2F* fhTrackBetaInvB = nullptr; -TH2F* fhTrackTimeIPB = nullptr; -TH2F* fhTrackBetaInvIPB = nullptr; -TH2F* fhdEdxB = nullptr; -TH2F* fhdEdxIPTPCB = nullptr; -TH1F* fhTrackLengthA[kIdBfNoOfSpecies + 2] = {nullptr}; -TH1F* fhTrackLengthTOFA[kIdBfNoOfSpecies + 2] = {nullptr}; -TH2F* fhdEdxA[kIdBfNoOfSpecies + 2] = {nullptr}; -TH2F* fhdEdxIPTPCA[kIdBfNoOfSpecies + 2] = {nullptr}; -TH2F* fhTrackTimeA[kIdBfNoOfSpecies + 2] = {nullptr}; -TH2F* fhTrackBetaInvA[kIdBfNoOfSpecies + 2] = {nullptr}; -TH2F* fhTrackTimeIPA[kIdBfNoOfSpecies + 2] = {nullptr}; -TH2F* fhTrackBetaInvIPA[kIdBfNoOfSpecies + 2] = {nullptr}; - -TH1F* fhMassB = nullptr; -TH1F* fhMassA[kIdBfNoOfSpecies + 1] = {nullptr}; - -TH2S* fhDoublePID = nullptr; - -TH1F* fhDCAxyB = nullptr; -TH1F* fhDCAxyA = nullptr; -TH1F* fhFineDCAxyA = nullptr; -TH1F* fhDCAzB = nullptr; -TH2F* fhDCAxyzB = nullptr; -TH1F* fhDCAzA = nullptr; -TH1F* fhFineDCAzA = nullptr; -TH2F* fhDCAxyzA = nullptr; - -TH1F* fhWrongTrackID = nullptr; - -TH2D* fhAmbiguousTrackType = nullptr; -TH2F* fhAmbiguousTrackPt = nullptr; -TH2F* fhAmbiguityDegree = nullptr; -TH2F* fhCompatibleCollisionsZVtxRms = nullptr; - -TH2S* fhTruePIDMismatch = nullptr; -TH1S* fhTruePIDCorrect = nullptr; - -std::vector> fhTrueNSigmaTPC = {o2::analysis::identifiedbffilter::kIdBfNoOfSpecies, {o2::analysis::identifiedbffilter::kIdBfNoOfSpecies, nullptr}}; -std::vector> fhTrueNSigmaTOF = {o2::analysis::identifiedbffilter::kIdBfNoOfSpecies, {o2::analysis::identifiedbffilter::kIdBfNoOfSpecies, nullptr}}; - -std::vector> fhPrimaryNSigmaTPC = {o2::analysis::identifiedbffilter::kIdBfNoOfSpecies, {o2::analysis::identifiedbffilter::kIdBfNoOfSpecies, nullptr}}; -std::vector> fhPrimaryNSigmaTOF = {o2::analysis::identifiedbffilter::kIdBfNoOfSpecies, {o2::analysis::identifiedbffilter::kIdBfNoOfSpecies, nullptr}}; - -TH1F* fhTrueCentMultB = nullptr; -TH1F* fhTrueCentMultA = nullptr; -TH1F* fhTrueVertexZB = nullptr; -TH1F* fhTrueVertexZA = nullptr; -TH1F* fhTrueVertexZAA = nullptr; -TH1F* fhTruePB = nullptr; -TH1F* fhTrueCharge = nullptr; -TH1F* fhTruePA[kIdBfNoOfSpecies + 1] = {nullptr}; -TH1F* fhTruePtB = nullptr; -TH1F* fhTruePtA[kIdBfNoOfSpecies + 1] = {nullptr}; -TH1F* fhTruePtPosB = nullptr; -TH1F* fhTruePtPosA[kIdBfNoOfSpecies + 1] = {nullptr}; -TH1F* fhTruePtNegB = nullptr; -TH1F* fhTruePtNegA[kIdBfNoOfSpecies + 1] = {nullptr}; -TH2F* fhTrueNPosNegA[kIdBfNoOfSpecies + 1] = {nullptr}; -TH1F* fhTrueDeltaNA[kIdBfNoOfSpecies + 1] = {nullptr}; - -TH2F* fhTruedEdxA[kIdBfNoOfSpecies + 1] = {nullptr}; -TH2F* fhTruedEdxIPTPCA[kIdBfNoOfSpecies + 1] = {nullptr}; -TH1F* fhTrueTrackLengthA[kIdBfNoOfSpecies + 1] = {nullptr}; -TH1F* fhTrueTrackLengthTOFA[kIdBfNoOfSpecies + 1] = {nullptr}; -TH2F* fhTrueTrackTimeA[kIdBfNoOfSpecies + 1] = {nullptr}; -TH2F* fhTrueTrackBetaInvA[kIdBfNoOfSpecies + 1] = {nullptr}; -TH2F* fhTrueTrackTimeIPA[kIdBfNoOfSpecies + 1] = {nullptr}; -TH2F* fhTrueTrackBetaInvIPA[kIdBfNoOfSpecies + 1] = {nullptr}; - -TH1F* fhPrimaryPA[kIdBfNoOfSpecies + 1] = {nullptr}; -TH1F* fhPrimaryPtA[kIdBfNoOfSpecies + 1] = {nullptr}; -TH2F* fhPrimarydEdxA[kIdBfNoOfSpecies + 1] = {nullptr}; -TH2F* fhPrimarydEdxIPTPCA[kIdBfNoOfSpecies + 1] = {nullptr}; -TH1F* fhPrimaryTrackLengthA[kIdBfNoOfSpecies + 1] = {nullptr}; -TH1F* fhPrimaryTrackLengthTOFA[kIdBfNoOfSpecies + 1] = {nullptr}; -TH2F* fhPrimaryTrackTimeA[kIdBfNoOfSpecies + 1] = {nullptr}; -TH2F* fhPrimaryTrackBetaInvA[kIdBfNoOfSpecies + 1] = {nullptr}; -TH2F* fhPrimaryTrackTimeIPA[kIdBfNoOfSpecies + 1] = {nullptr}; -TH2F* fhPrimaryTrackBetaInvIPA[kIdBfNoOfSpecies + 1] = {nullptr}; - -TH1F* fhPurePA[kIdBfNoOfSpecies + 1] = {nullptr}; -TH1F* fhPurePtA[kIdBfNoOfSpecies + 1] = {nullptr}; -TH2F* fhPuredEdxA[kIdBfNoOfSpecies + 1] = {nullptr}; -TH2F* fhPuredEdxIPTPCA[kIdBfNoOfSpecies + 1] = {nullptr}; -TH1F* fhPureTrackLengthA[kIdBfNoOfSpecies + 1] = {nullptr}; -TH1F* fhPureTrackLengthTOFA[kIdBfNoOfSpecies + 1] = {nullptr}; -TH2F* fhPureTrackTimeA[kIdBfNoOfSpecies + 1] = {nullptr}; -TH2F* fhPureTrackBetaInvA[kIdBfNoOfSpecies + 1] = {nullptr}; -TH2F* fhPureTrackTimeIPA[kIdBfNoOfSpecies + 1] = {nullptr}; -TH2F* fhPureTrackBetaInvIPA[kIdBfNoOfSpecies + 1] = {nullptr}; - -TH2F* fhTruePtEtaPosA[kIdBfNoOfSpecies + 1] = {nullptr}; -TH2F* fhTruePtEtaNegA[kIdBfNoOfSpecies + 1] = {nullptr}; - -TH2F* fhTruePhiYB = nullptr; -TH2F* fhTruePtYB = nullptr; - -TH2F* fhTruePhiYA = nullptr; -TH2F* fhTruePtYA = nullptr; - -TH1F* fhTrueEtaB = nullptr; -TH1F* fhTrueEtaA = nullptr; - -TH1F* fhTruePhiB = nullptr; -TH1F* fhTruePhiA = nullptr; - -TH1F* fhTrueDCAxyB = nullptr; -TH1F* fhTrueDCAxyA = nullptr; -TH1F* fhTrueDCAzB = nullptr; -TH1F* fhTrueDCAxyBid = nullptr; -TH1F* fhTrueDCAzA = nullptr; -TH2F* fhTrueDCAxyzB = nullptr; -TH2F* fhTrueDCAxyzA = nullptr; - -TH1F* fhPrimaryPB = nullptr; -TH1F* fhPrimaryPtB = nullptr; -TH2F* fhPrimarydEdxB = nullptr; -TH2F* fhPrimarydEdxIPTPCB = nullptr; -TH1F* fhPrimaryTrackLengthB = nullptr; -TH1F* fhPrimaryTrackLengthTOFB = nullptr; -TH2F* fhPrimaryTrackTimeB = nullptr; -TH2F* fhPrimaryTrackBetaInvB = nullptr; -TH2F* fhPrimaryTrackTimeIPB = nullptr; -TH2F* fhPrimaryTrackBetaInvIPB = nullptr; - -//============================================================================================ -// The IdentifiedBfFilter multiplicity counters -//============================================================================================ -int trkMultPos[kIdBfNoOfSpecies + 1]; // multiplicity of positive tracks -int trkMultNeg[kIdBfNoOfSpecies + 1]; // multiplicity of negative tracks -int partMultPos[kIdBfNoOfSpecies + 1]; // multiplicity of positive particles -int partMultNeg[kIdBfNoOfSpecies + 1]; // multiplicity of negative particles -} // namespace o2::analysis::identifiedbffilter - -using namespace identifiedbffilter; - -struct IdentifiedBfFilter { - Configurable cfgFullDerivedData{"cfgFullDerivedData", false, "Produce the full derived data for external storage. Default false"}; - Configurable cfgCentMultEstimator{"cfgCentMultEstimator", "V0M", "Centrality/multiplicity estimator detector: V0M,CL0,CL1,FV0A,FT0M,FT0A,FT0C,NTPV,NOCM: none. Default V0M"}; - Configurable cfgSystem{"cfgSystem", "PbPb", "System: pp, PbPb, Pbp, pPb, XeXe, ppRun3, PbPbRun3. Default PbPb"}; - Configurable cfgDataType{"cfgDataType", "data", "Data type: data, datanoevsel, MC, FastMC, OnTheFlyMC. Default data"}; - Configurable cfgTriggSel{"cfgTriggSel", "MB", "Trigger selection: MB, None. Default MB"}; - Configurable cfgBinning{"cfgBinning", - {28, -7.0, 7.0, 18, 0.2, 2.0, 16, -0.8, 0.8, 72, 0.5}, - "triplets - nbins, min, max - for z_vtx, pT, eta and phi, binning plus bin fraction of phi origin shift"}; - Configurable cfgTraceCollId0{"cfgTraceCollId0", false, "Trace particles in collisions id 0. Default false"}; - - OutputObj fOutput{"IdentifiedBfFilterCollisionsInfo", OutputObjHandlingPolicy::AnalysisObject}; - - Produces acceptedcollisions; - Produces collisionsinfo; - Produces acceptedtrueevents; - Produces gencollisionsinfo; - - void init(InitContext const&) - { - using namespace identifiedbffilter; - - LOGF(info, "IdentifiedBfFilterTask::init()"); - - fullDerivedData = cfgFullDerivedData; - - /* update with the configurable values */ - /* the binning */ - ptbins = cfgBinning->mPTbins; - ptlow = cfgBinning->mPTmin; - ptup = cfgBinning->mPTmax; - etabins = cfgBinning->mEtabins; - etalow = cfgBinning->mEtamin; - etaup = cfgBinning->mEtamax; - zvtxbins = cfgBinning->mZVtxbins; - zvtxlow = cfgBinning->mZVtxmin; - zvtxup = cfgBinning->mZVtxmax; - /* the track types and combinations */ - /* the centrality/multiplicity estimation */ - fCentMultEstimator = getCentMultEstimator(cfgCentMultEstimator); - /* the trigger selection */ - fTriggerSelection = getTriggerSelection(cfgTriggSel); - traceCollId0 = cfgTraceCollId0; - - /* if the system type is not known at this time, we have to put the initialization somewhere else */ - fSystem = getSystemType(cfgSystem); - fDataType = getDataType(cfgDataType); - - /* create the output list which will own the task histograms */ - TList* fOutputList = new TList(); - fOutputList->SetOwner(true); - fOutput.setObject(fOutputList); - - if ((fDataType == kData) || (fDataType == kDataNoEvtSel) || (fDataType == kMC)) { - /* create the reconstructed data histograms */ - /* TODO: proper axes and axes titles according to the system; still incomplete */ - std::string multestimator = getCentMultEstimatorName(fCentMultEstimator); - if (fSystem > kPbp) { - fhCentMultB = new TH1F("CentralityB", "Centrality before cut; centrality (%)", 100, 0, 100); - fhCentMultA = new TH1F("CentralityA", "Centrality; centrality (%)", 100, 0, 100); - fhMultB = new TH1F("MultB", TString::Format("%s Multiplicity before cut;%s Multiplicity;Collisions", multestimator.c_str(), multestimator.c_str()), 4001, -0.5, 4000.5); - fhMultA = new TH1F("MultA", TString::Format("%s Multiplicity;%s Multiplicity;Collisions", multestimator.c_str(), multestimator.c_str()), 4001, -0.5, 4000.5); - } else { - /* for pp, pPb and Pbp systems use multiplicity instead */ - fhCentMultB = new TH1F("MultiplicityB", "Multiplicity before cut; multiplicity (%)", 100, 0, 100); - fhCentMultA = new TH1F("MultiplicityA", "Multiplicity; multiplicity (%)", 100, 0, 100); - fhMultB = new TH1F("MultB", TString::Format("%s Multiplicity before cut;%s Multiplicity;Collisions", multestimator.c_str(), multestimator.c_str()), 601, -0.5, 600.5); - fhMultA = new TH1F("MultA", TString::Format("%s Multiplicity;%s Multiplicity;Collisions", multestimator.c_str(), multestimator.c_str()), 601, -0.5, 600.5); - } - - fhVertexZB = new TH1F("VertexZB", "Vertex Z; z_{vtx}", 60, -15, 15); - fhVertexZA = new TH1F("VertexZA", "Vertex Z; z_{vtx}", zvtxbins, zvtxlow, zvtxup); - - /* add the hstograms to the output list */ - fOutputList->Add(fhCentMultB); - fOutputList->Add(fhCentMultA); - fOutputList->Add(fhMultB); - fOutputList->Add(fhMultA); - fOutputList->Add(fhVertexZB); - fOutputList->Add(fhVertexZA); - } - - if ((fDataType != kData) && (fDataType != kDataNoEvtSel)) { - /* create the true data histograms */ - /* TODO: proper axes and axes titles according to the system; still incomplete */ - if (fSystem > kPbp) { - fhTrueCentMultB = new TH1F("TrueCentralityB", "Centrality before (truth); centrality (%)", 100, 0, 100); - fhTrueCentMultA = new TH1F("TrueCentralityA", "Centrality (truth); centrality (%)", 100, 0, 100); - } else { - /* for pp, pPb and Pbp systems use multiplicity instead */ - fhTrueCentMultB = new TH1F("TrueMultiplicityB", "Multiplicity before (truth); multiplicity (%)", 100, 0, 100); - fhTrueCentMultA = new TH1F("TrueMultiplicityA", "Multiplicity (truth); multiplicity (%)", 100, 0, 100); - } - - fhTrueVertexZB = new TH1F("TrueVertexZB", "Vertex Z before (truth); z_{vtx}", 60, -15, 15); - fhTrueVertexZA = new TH1F("TrueVertexZA", "Vertex Z (truth); z_{vtx}", zvtxbins, zvtxlow, zvtxup); - fhTrueVertexZAA = new TH1F("TrueVertexZAA", "Vertex Z (truth rec associated); z_{vtx}", zvtxbins, zvtxlow, zvtxup); - - /* add the hstograms to the output list */ - fOutputList->Add(fhTrueCentMultB); - fOutputList->Add(fhTrueCentMultA); - fOutputList->Add(fhTrueVertexZB); - fOutputList->Add(fhTrueVertexZA); - fOutputList->Add(fhTrueVertexZAA); - } - } - - template - void processReconstructed(CollisionObject const& collision, TracksObject const& ftracks, float centormult); - - void processWithCent(aod::CollisionEvSelCent const& collision, IdBfFullTracks const& ftracks); - PROCESS_SWITCH(IdentifiedBfFilter, processWithCent, "Process reco with centrality", false); - - void processWithRun2Cent(aod::CollisionEvSelRun2Cent const& collision, IdBfFullTracks const& ftracks); - PROCESS_SWITCH(IdentifiedBfFilter, processWithRun2Cent, "Process reco with Run !/2 centrality", false); - - void processWithoutCent(aod::CollisionEvSel const& collision, IdBfFullTracks const& ftracks); - PROCESS_SWITCH(IdentifiedBfFilter, processWithoutCent, "Process reco without centrality", false); - - void processWithCentPID(aod::CollisionEvSelCent const& collision, IdBfFullTracksPID const& ftracks); - PROCESS_SWITCH(IdentifiedBfFilter, processWithCentPID, "Process PID reco with centrality", false); - - void processWithRun2CentPID(aod::CollisionEvSelRun2Cent const& collision, IdBfFullTracksPID const& ftracks); - PROCESS_SWITCH(IdentifiedBfFilter, processWithRun2CentPID, "Process PID reco with centrality", false); - - void processWithoutCentPID(aod::CollisionEvSel const& collision, IdBfFullTracksPID const& ftracks); - PROCESS_SWITCH(IdentifiedBfFilter, processWithoutCentPID, "Process PID reco without centrality", false); - - void processWithCentFullPID(aod::CollisionEvSelCent const& collision, IdBfFullTracksFullPID const& ftracks); - PROCESS_SWITCH(IdentifiedBfFilter, processWithCentFullPID, "Process Full PID reco with centrality", false); - - void processWithRun2CentFullPID(aod::CollisionEvSelRun2Cent const& collision, IdBfFullTracksFullPID const& ftracks); - PROCESS_SWITCH(IdentifiedBfFilter, processWithRun2CentFullPID, "Process Full PID reco with centrality", false); - - void processWithoutCentFullPID(aod::CollisionEvSel const& collision, IdBfFullTracksFullPID const& ftracks); - PROCESS_SWITCH(IdentifiedBfFilter, processWithoutCentFullPID, "Process Full PID reco without centrality", false); - - void processWithCentDetectorLevel(aod::CollisionEvSelCent const& collision, IdBfFullTracksDetLevel const& ftracks, aod::McParticles const&); - PROCESS_SWITCH(IdentifiedBfFilter, processWithCentDetectorLevel, "Process MC detector level with centrality", false); - - void processWithRun2CentDetectorLevel(aod::CollisionEvSelRun2Cent const& collision, IdBfFullTracksDetLevel const& ftracks, aod::McParticles const&); - PROCESS_SWITCH(IdentifiedBfFilter, processWithRun2CentDetectorLevel, "Process MC detector level with centrality", false); - - void processWithoutCentDetectorLevel(aod::CollisionEvSel const& collision, IdBfFullTracksDetLevel const& ftracks, aod::McParticles const&); - PROCESS_SWITCH(IdentifiedBfFilter, processWithoutCentDetectorLevel, "Process MC detector level without centrality", false); - - void processWithCentPIDDetectorLevel(aod::CollisionEvSelCent const& collision, IdBfFullTracksPIDDetLevel const& ftracks, aod::McParticles const&); - PROCESS_SWITCH(IdentifiedBfFilter, processWithCentPIDDetectorLevel, "Process PID MC detector level with centrality", false); - - void processWithRun2CentPIDDetectorLevel(aod::CollisionEvSelRun2Cent const& collision, IdBfFullTracksPIDDetLevel const& ftracks, aod::McParticles const&); - PROCESS_SWITCH(IdentifiedBfFilter, processWithRun2CentPIDDetectorLevel, "Process PID MC detector level with centrality", false); - - void processWithoutCentPIDDetectorLevel(aod::CollisionEvSel const& collision, IdBfFullTracksPIDDetLevel const& ftracks, aod::McParticles const&); - PROCESS_SWITCH(IdentifiedBfFilter, processWithoutCentPIDDetectorLevel, "Process PID MC detector level without centrality", false); - - void processWithCentFullPIDDetectorLevel(aod::CollisionEvSelCent const& collision, IdBfFullTracksFullPIDDetLevel const& ftracks, aod::McParticles const&); - PROCESS_SWITCH(IdentifiedBfFilter, processWithCentFullPIDDetectorLevel, "Process Full PID MC detector level with centrality", false); - - void processWithRun2CentFullPIDDetectorLevel(aod::CollisionEvSelRun2Cent const& collision, IdBfFullTracksFullPIDDetLevel const& ftracks, aod::McParticles const&); - PROCESS_SWITCH(IdentifiedBfFilter, processWithRun2CentFullPIDDetectorLevel, "Process Full PID MC detector level with centrality", false); - - void processWithoutCentFullPIDDetectorLevel(aod::CollisionEvSel const& collision, IdBfFullTracksFullPIDDetLevel const& ftracks, aod::McParticles const&); - PROCESS_SWITCH(IdentifiedBfFilter, processWithoutCentFullPIDDetectorLevel, "Process Full PID MC detector level without centrality", false); - - template - void processGenerated(CollisionObject const& mccollision, ParticlesList const& mcparticles, float centormult); - - template - void processGeneratorLevel(aod::McCollision const& mccollision, - CollisionsGroup const& collisions, - aod::McParticles const& mcparticles, - AllCollisions const& allcollisions, - float defaultcent); - - void processWithCentGeneratorLevel(aod::McCollision const& mccollision, - soa::SmallGroups> const& collisions, - aod::McParticles const& mcparticles, - aod::CollisionsEvSelCent const& allcollisions); - PROCESS_SWITCH(IdentifiedBfFilter, processWithCentGeneratorLevel, "Process generated with centrality", false); - - void processWithRun2CentGeneratorLevel(aod::McCollision const& mccollision, - soa::SmallGroups> const& collisions, - aod::McParticles const& mcparticles, - aod::CollisionsEvSelRun2Cent const& allcollisions); - PROCESS_SWITCH(IdentifiedBfFilter, processWithRun2CentGeneratorLevel, "Process generated with centrality", false); - - void processWithoutCentGeneratorLevel(aod::McCollision const& mccollision, - soa::SmallGroups> const& collisions, - aod::McParticles const& mcparticles, - aod::CollisionsEvSel const& allcollisions); - PROCESS_SWITCH(IdentifiedBfFilter, processWithoutCentGeneratorLevel, "Process generated without centrality", false); - - void processVertexGenerated(aod::McCollisions const&); - PROCESS_SWITCH(IdentifiedBfFilter, processVertexGenerated, "Process vertex generator level", false); -}; - -template -void IdentifiedBfFilter::processReconstructed(CollisionObject const& collision, TracksObject const& ftracks, float tentativecentmult) -{ - using namespace identifiedbffilter; - - LOGF(IDENTIFIEDBFFILTERLOGCOLLISIONS, "IdentifiedBfFilterTask::processReconstructed(). New collision with %d tracks", ftracks.size()); - - float mult = extractMultiplicity(collision, fCentMultEstimator); - - fhCentMultB->Fill(tentativecentmult); - fhMultB->Fill(mult); - fhVertexZB->Fill(collision.posZ()); - uint8_t acceptedevent = uint8_t(false); - float centormult = tentativecentmult; - if (isEvtSelected(collision, centormult)) { - acceptedevent = true; - fhCentMultA->Fill(centormult); - fhMultA->Fill(mult); - fhVertexZA->Fill(collision.posZ()); - if (fullDerivedData) { - acceptedcollisions(collision.bcId(), collision.posZ(), acceptedevent, centormult); - } else { - collisionsinfo(acceptedevent, centormult); - } - } else { - if (!fullDerivedData) { - /* the tracks are done at a different level */ - collisionsinfo(uint8_t(false), 105.0); - } - } -} - -void IdentifiedBfFilter::processWithCent(aod::CollisionEvSelCent const& collision, IdBfFullTracks const& ftracks) -{ - processReconstructed(collision, ftracks, getCentMultPercentile(collision)); -} - -void IdentifiedBfFilter::processWithRun2Cent(aod::CollisionEvSelRun2Cent const& collision, IdBfFullTracks const& ftracks) -{ - processReconstructed(collision, ftracks, getCentMultPercentile(collision)); -} - -void IdentifiedBfFilter::processWithoutCent(aod::CollisionEvSel const& collision, IdBfFullTracks const& ftracks) -{ - processReconstructed(collision, ftracks, 50.0); -} - -void IdentifiedBfFilter::processWithCentPID(aod::CollisionEvSelCent const& collision, IdBfFullTracksPID const& ftracks) -{ - processReconstructed(collision, ftracks, getCentMultPercentile(collision)); -} - -void IdentifiedBfFilter::processWithRun2CentPID(aod::CollisionEvSelRun2Cent const& collision, IdBfFullTracksPID const& ftracks) -{ - processReconstructed(collision, ftracks, getCentMultPercentile(collision)); -} - -void IdentifiedBfFilter::processWithoutCentPID(aod::CollisionEvSel const& collision, IdBfFullTracksPID const& ftracks) -{ - processReconstructed(collision, ftracks, 50.0); -} - -void IdentifiedBfFilter::processWithCentFullPID(aod::CollisionEvSelCent const& collision, IdBfFullTracksFullPID const& ftracks) -{ - processReconstructed(collision, ftracks, getCentMultPercentile(collision)); -} - -void IdentifiedBfFilter::processWithRun2CentFullPID(aod::CollisionEvSelRun2Cent const& collision, IdBfFullTracksFullPID const& ftracks) -{ - processReconstructed(collision, ftracks, getCentMultPercentile(collision)); -} - -void IdentifiedBfFilter::processWithoutCentFullPID(aod::CollisionEvSel const& collision, IdBfFullTracksFullPID const& ftracks) -{ - processReconstructed(collision, ftracks, 50.0); -} - -void IdentifiedBfFilter::processWithCentDetectorLevel(aod::CollisionEvSelCent const& collision, IdBfFullTracksDetLevel const& ftracks, aod::McParticles const&) -{ - processReconstructed(collision, ftracks, getCentMultPercentile(collision)); -} - -void IdentifiedBfFilter::processWithRun2CentDetectorLevel(aod::CollisionEvSelRun2Cent const& collision, IdBfFullTracksDetLevel const& ftracks, aod::McParticles const&) -{ - processReconstructed(collision, ftracks, getCentMultPercentile(collision)); -} - -void IdentifiedBfFilter::processWithoutCentDetectorLevel(aod::CollisionEvSel const& collision, IdBfFullTracksDetLevel const& ftracks, aod::McParticles const&) -{ - processReconstructed(collision, ftracks, 50.0); -} - -void IdentifiedBfFilter::processWithCentPIDDetectorLevel(aod::CollisionEvSelCent const& collision, IdBfFullTracksPIDDetLevel const& ftracks, aod::McParticles const&) -{ - processReconstructed(collision, ftracks, getCentMultPercentile(collision)); -} - -void IdentifiedBfFilter::processWithRun2CentPIDDetectorLevel(aod::CollisionEvSelRun2Cent const& collision, IdBfFullTracksPIDDetLevel const& ftracks, aod::McParticles const&) -{ - processReconstructed(collision, ftracks, getCentMultPercentile(collision)); -} - -void IdentifiedBfFilter::processWithoutCentPIDDetectorLevel(aod::CollisionEvSel const& collision, IdBfFullTracksPIDDetLevel const& ftracks, aod::McParticles const&) -{ - processReconstructed(collision, ftracks, 50.0); -} - -void IdentifiedBfFilter::processWithCentFullPIDDetectorLevel(aod::CollisionEvSelCent const& collision, IdBfFullTracksFullPIDDetLevel const& ftracks, aod::McParticles const&) -{ - processReconstructed(collision, ftracks, getCentMultPercentile(collision)); -} - -void IdentifiedBfFilter::processWithRun2CentFullPIDDetectorLevel(aod::CollisionEvSelRun2Cent const& collision, IdBfFullTracksFullPIDDetLevel const& ftracks, aod::McParticles const&) -{ - processReconstructed(collision, ftracks, getCentMultPercentile(collision)); -} - -void IdentifiedBfFilter::processWithoutCentFullPIDDetectorLevel(aod::CollisionEvSel const& collision, IdBfFullTracksFullPIDDetLevel const& ftracks, aod::McParticles const&) -{ - processReconstructed(collision, ftracks, 50.0); -} - -template -void IdentifiedBfFilter::processGenerated(CollisionObject const& mccollision, ParticlesList const&, float centormult) -{ - using namespace identifiedbffilter; - - uint8_t acceptedevent = uint8_t(false); - if (isEvtSelected(mccollision, centormult)) { - acceptedevent = uint8_t(true); - } - if (fullDerivedData) { - acceptedtrueevents(mccollision.bcId(), mccollision.posZ(), acceptedevent, centormult); - } else { - gencollisionsinfo(acceptedevent, centormult); - } -} - -template -void IdentifiedBfFilter::processGeneratorLevel(aod::McCollision const& mccollision, - CollisionsGroup const& collisions, - aod::McParticles const& mcparticles, - AllCollisions const& allcollisions, - float defaultcent) -{ - using namespace identifiedbffilter; - - LOGF(IDENTIFIEDBFFILTERLOGCOLLISIONS, "IdentifiedBfFilterTask::processGeneratorLevel(). New generated collision with %d reconstructed collisions and %d particles", collisions.size(), mcparticles.size()); - - if (collisions.size() > 1) { - LOGF(IDENTIFIEDBFFILTERLOGCOLLISIONS, "IdentifiedBfFilterTask::processGeneratorLevel(). Generated collision with more than one reconstructed collisions. Processing only the first accepted for centrality/multiplicity classes extraction"); - } - - bool processed = false; - for (const auto& tmpcollision : collisions) { - if (tmpcollision.has_mcCollision()) { - if (tmpcollision.mcCollisionId() == mccollision.globalIndex()) { - typename AllCollisions::iterator const& collision = allcollisions.iteratorAt(tmpcollision.globalIndex()); - if (isEvtSelected(collision, defaultcent)) { - fhTrueVertexZAA->Fill(mccollision.posZ()); - processGenerated(mccollision, mcparticles, defaultcent); - processed = true; - break; /* TODO: only processing the first reconstructed accepted collision */ - } - } - } - } - if (!processed && !fullDerivedData) { - gencollisionsinfo(uint8_t(false), 105.0); - } -} - -void IdentifiedBfFilter::processWithCentGeneratorLevel(aod::McCollision const& mccollision, - soa::SmallGroups> const& collisions, - aod::McParticles const& mcparticles, - aod::CollisionsEvSelCent const& allcollisions) -{ - processGeneratorLevel(mccollision, collisions, mcparticles, allcollisions, 50.0); -} - -void IdentifiedBfFilter::processWithRun2CentGeneratorLevel(aod::McCollision const& mccollision, - soa::SmallGroups> const& collisions, - aod::McParticles const& mcparticles, - aod::CollisionsEvSelRun2Cent const& allcollisions) -{ - processGeneratorLevel(mccollision, collisions, mcparticles, allcollisions, 50.0); -} - -void IdentifiedBfFilter::processWithoutCentGeneratorLevel(aod::McCollision const& mccollision, - soa::SmallGroups> const& collisions, - aod::McParticles const& mcparticles, - aod::CollisionsEvSel const& allcollisions) -{ - processGeneratorLevel(mccollision, collisions, mcparticles, allcollisions, 50.0); -} - -void IdentifiedBfFilter::processVertexGenerated(aod::McCollisions const& mccollisions) -{ - for (aod::McCollision const& mccollision : mccollisions) { - fhTrueVertexZB->Fill(mccollision.posZ()); - /* we assign a default value */ - float centmult = 50.0f; - if (isEvtSelected(mccollision, centmult)) { - fhTrueVertexZA->Fill((mccollision.posZ())); - } - } -} - -/// RMS calculation. Taken from PWGHF/Tasks/taskMcValidation.cxx -/// \param vec vector of values to compute RMS -template -T computeRMS(std::vector& vec) -{ - T sum = std::accumulate(vec.begin(), vec.end(), 0.0); - T mean = sum / vec.size(); - - std::vector diff(vec.size()); - std::transform(vec.begin(), vec.end(), diff.begin(), [mean](T x) { return x - mean; }); - T sqSum = std::inner_product(diff.begin(), diff.end(), diff.begin(), 0.0); - T stdev = std::sqrt(sqSum / vec.size()); - - return stdev; -} - -struct IdentifiedBfFilterTracks { - - struct : ConfigurableGroup { - Configurable inputCCDBUrl{"inputCCDBUrl", "http://ccdb-test.cern.ch:8080", "The CCDB url for the input file"}; - Configurable inputCCDBPathName{"inputCCDBPathName", "", "The CCDB path for the input file. Default \"\", i.e. don't load from CCDB"}; - Configurable inputCCDBDate{"inputCCDBDate", "20220307", "The CCDB date for the input file"}; - } cfgcentersinputfile; - Service ccdb; - - TList* getCCDBInput(const char* ccdbpath, const char* ccdbdate) - { - - std::tm cfgtm = {}; - std::stringstream ss(ccdbdate); - ss >> std::get_time(&cfgtm, "%Y%m%d"); - cfgtm.tm_hour = 12; - int64_t timestamp = std::mktime(&cfgtm) * 1000; - - TList* lst = ccdb->getForTimeStamp(ccdbpath, timestamp); - if (lst != nullptr) { - LOGF(info, "Correctly loaded CCDB input object"); - } else { - LOGF(error, "CCDB input object could not be loaded"); - } - return lst; - } - - Service fPDG; - Produces scannedtracks; - Produces tracksinfo; - Produces scannedgentracks; - Produces gentracksinfo; - - Configurable cfgFullDerivedData{"cfgFullDerivedData", false, "Produce the full derived data for external storage. Default false"}; - Configurable cfgTrackType{"cfgTrackType", 1, "Type of selected tracks: 0 = no selection, 1 = Run2 global tracks FB96, 3 = Run3 tracks, 5 = Run2 TPC only tracks, 7 = Run 3 TPC only tracks. Default 1"}; - Configurable cfgSystem{"cfgSystem", "PbPb", "System: pp, PbPb, Pbp, pPb, XeXe, ppRun3, PbPbRun3. Default PbPb"}; - Configurable cfgDataType{"cfgDataType", "data", "Data type: data, datanoevsel, MC, FastMC, OnTheFlyMC. Default data"}; - Configurable cfgBinning{"cfgBinning", - {28, -7.0, 7.0, 18, 0.2, 2.0, 16, -0.8, 0.8, 72, 0.5}, - "triplets - nbins, min, max - for z_vtx, pT, eta and phi, binning plus bin fraction of phi origin shift"}; - Configurable cfgTraceDCAOutliers{"cfgTraceDCAOutliers", {false, 0.0, 0.0}, "Track the generator level DCAxy outliers: false/true, low dcaxy, up dcaxy. Default {false,0.0,0.0}"}; - Configurable cfgTraceOutOfSpeciesParticles{"cfgTraceOutOfSpeciesParticles", false, "Track the particles which are not e,mu,pi,K,p: false/true. Default false"}; - Configurable cfgRecoIdMethod{"cfgRecoIdMethod", 0, "Method for identifying reconstructed tracks: 0 No PID, 1 PID, 2 mcparticle. Default 0"}; - Configurable cfgTrackSelection{"cfgTrackSelection", {false, false, 0, 70, 0.8, 2.4, 3.2}, "Track selection: {useit: true/false, ongen: true/false, tpccls, tpcxrws, tpcxrfc, dcaxy, dcaz}. Default {false,0.70.0.8,2.4,3.2}"}; - Configurable reqTOF{"reqTOF", false, "Require TOF data for PID. Default false"}; - Configurable onlyTOF{"onlyTOF", false, "Only use TOF data for PID. Default false"}; - - // Configurable pidEl{"pidEl", -1, "Identify Electron Tracks"}; - // Configurable pidPi{"pidPi", -1, "Identify Pion Tracks"}; - // Configurable pidKa{"pidKa", -1, "Identify Kaon Tracks"}; - // Configurable pidPr{"pidPr", -1, "Identify Proton Tracks"}; - - // Configurable minPIDSigma{"minPIDSigma", -3.0, "Minimum required sigma for PID Acceptance"}; - // Configurable maxPIDSigma{"maxPIDSigma", 3.0, "Maximum required sigma for PID Acceptance"}; - - // Configurable> minPIDSigmas{"minPIDSigmas", {-3.,-3.,-3.,-3.},"Minimum required sigma for PID Acceptance, {e, pi, K, p}"}; - // Configurable>> acceptPIDSigmas{"acceptPIDSigmas", {{-3.,3.},{-3.,3.},{-3.,3.},{-3.,3.}},"Sigma range for PID Acceptance, {e, pi, K, p}"}; - // Configurable> minRejectSigmas{"minRejectSigmas", {-1.,-1.,-1.,-1.},"Minimum required sigma for PID double match rejection, {e, pi, K, p}"}; - - // Configurable minRejectSigma{"minRejectSigma", -1.0, "Minimum required sigma for PID double match rejection"}; - // Configurable maxRejectSigma{"maxRejectSigma", 1.0, "Maximum required sigma for PID double match rejection"}; - - Configurable> cfgDoPID{"cfgDoPID", {-1, -1, -1, -1}, "Do PID for particle, {e, pi, K, p}"}; - Configurable> cfgTOFCut{"cfgTOFCut", {0.8, 0.8, 0.8, 0.8}, "Momentum under which we don't use TOF PID data, {e, pi, K, p}"}; - Configurable> cfgTPCCut{"cfgTPCCut", {1.2, 1.2, 1.2, 1.2}, "Momentum over which we don't use TPC PID data, {e, pi, K, p}"}; - - Configurable makeNSigmaPlots{"makeNSigmaPlots", false, "Produce the N Sigma Plots for external storage. Default false"}; - - struct : ConfigurableGroup { - Configurable> rejectPIDSigmasEl{"rejectPIDSigmasEl", {0., 1., 1., 1.}, "Required sigma for PID double match rejection of electrons for {e, pi, K, p}"}; - Configurable> rejectPIDSigmasPi{"rejectPIDSigmasPi", {1., 0., 1., 1.}, "Required sigma for PID double match rejection of pions for {e, pi, K, p}"}; - Configurable> rejectPIDSigmasKa{"rejectPIDSigmasKa", {1., 1., 0., 1.}, "Required sigma for PID double match rejection of kaons for {e, pi, K, p}"}; - Configurable> rejectPIDSigmasPr{"rejectPIDSigmasPr", {1., 1., 1., 0.}, "Required sigma for PID double match rejection of protons for {e, pi, K, p}"}; - } rejectPIDSigmas; - - struct : ConfigurableGroup { - Configurable> acceptPIDSigmasEl{"acceptPIDSigmasEl", {-3., 3.}, "Sigma range for PID Acceptance for electrons"}; - Configurable> acceptPIDSigmasPi{"acceptPIDSigmasPi", {-3., 3.}, "Sigma range for PID Acceptance for pions"}; - Configurable> acceptPIDSigmasKa{"acceptPIDSigmasKa", {-3., 3.}, "Sigma range for PID Acceptance for kaons"}; - Configurable> acceptPIDSigmasPr{"acceptPIDSigmasPr", {-3., 3.}, "Sigma range for PID Acceptance for protons"}; - } acceptPIDSigmas; - - OutputObj fOutput{"IdentifiedBfFilterTracksInfo", OutputObjHandlingPolicy::AnalysisObject}; - bool checkAmbiguousTracks = false; - - void init(InitContext&) - { - LOGF(info, "IdentifiedBfFilterTracks::init()"); - - // ccdb info - ccdb->setURL(cfgcentersinputfile.inputCCDBUrl); - ccdb->setCaching(true); - ccdb->setLocalObjectValidityChecking(); - LOGF(info, "Initizalized CCDB"); - - loadfromccdb = cfgcentersinputfile.inputCCDBPathName->length() > 0; - - if (ccdblst == nullptr) { - if (loadfromccdb) { - LOGF(info, "Loading CCDB Objects"); - - ccdblst = getCCDBInput(cfgcentersinputfile.inputCCDBPathName->c_str(), cfgcentersinputfile.inputCCDBDate->c_str()); - for (int i = 0; i < kIdBfNoOfSpecies; i++) { - fhNSigmaCorrection[i] = reinterpret_cast(ccdblst->FindObject(Form("centerBin_%s", speciesName[i]))); - } - } - } - LOGF(info, "Loaded CCDB Objects"); - - fullDerivedData = cfgFullDerivedData; - - /* update with the configurable values */ - /* the binning */ - ptbins = cfgBinning->mPTbins; - ptlow = cfgBinning->mPTmin; - ptup = cfgBinning->mPTmax; - etabins = cfgBinning->mEtabins; - etalow = cfgBinning->mEtamin; - etaup = cfgBinning->mEtamax; - zvtxbins = cfgBinning->mZVtxbins; - zvtxlow = cfgBinning->mZVtxmin; - zvtxup = cfgBinning->mZVtxmax; - - LOGF(info, "Initializing ranges"); - acceptRange.push_back(acceptPIDSigmas.acceptPIDSigmasEl); - acceptRange.push_back(acceptPIDSigmas.acceptPIDSigmasPi); - acceptRange.push_back(acceptPIDSigmas.acceptPIDSigmasKa); - acceptRange.push_back(acceptPIDSigmas.acceptPIDSigmasPr); - - rejectRange.push_back(rejectPIDSigmas.rejectPIDSigmasEl); - rejectRange.push_back(rejectPIDSigmas.rejectPIDSigmasPi); - rejectRange.push_back(rejectPIDSigmas.rejectPIDSigmasKa); - rejectRange.push_back(rejectPIDSigmas.rejectPIDSigmasPr); - - doPID = cfgDoPID; - tofCut = cfgTOFCut; - tpcCut = cfgTPCCut; - /* the track types and combinations */ - tracktype = cfgTrackType.value; - initializeTrackSelection(); - traceDCAOutliers = cfgTraceDCAOutliers; - traceOutOfSpeciesParticles = cfgTraceOutOfSpeciesParticles; - recoIdMethod = cfgRecoIdMethod; - if (cfgTrackSelection->mUseIt) { - useOwnTrackSelection = true; - if (cfgTrackSelection->mOnGen) { - useOwnParticleSelection = true; - particleMaxDCAxy = cfgTrackSelection->mDCAxy; - particleMaxDCAZ = cfgTrackSelection->mDCAz; - } - ownTrackSelection.ResetITSRequirements(); - ownTrackSelection.SetMinNClustersTPC(cfgTrackSelection->mTPCclusters); - ownTrackSelection.SetMinNCrossedRowsTPC(cfgTrackSelection->mTPCxRows); - ownTrackSelection.SetMaxDcaXYPtDep([&](float) { return cfgTrackSelection->mDCAxy; }); - ownTrackSelection.SetMaxDcaXY(cfgTrackSelection->mDCAxy); - ownTrackSelection.SetMaxDcaZ(cfgTrackSelection->mDCAz); - o2::aod::track::TrackTypeEnum ttype; - switch (tracktype) { - case 1: - ttype = o2::aod::track::Run2Track; - break; - case 3: - ttype = o2::aod::track::Track; - break; - default: - ttype = o2::aod::track::Track; - break; - } - ownTrackSelection.SetTrackType(ttype); - } else { - useOwnTrackSelection = false; - } - - /* if the system type is not known at this time, we have to put the initialization somewhere else */ - fSystem = getSystemType(cfgSystem); - fDataType = getDataType(cfgDataType); - - /* required ambiguous tracks checks? */ - if (dofilterDetectorLevelWithoutPIDAmbiguous || dofilterDetectorLevelWithPIDAmbiguous || dofilterRecoWithoutPIDAmbiguous || dofilterRecoWithPIDAmbiguous) { - checkAmbiguousTracks = true; - } - - /* create the output list which will own the task histograms */ - TList* fOutputList = new TList(); - fOutputList->SetOwner(true); - fOutput.setObject(fOutputList); - - /* incorporate configuration parameters to the output */ - fOutputList->Add(new TParameter("TrackType", cfgTrackType, 'f')); - fOutputList->Add(new TParameter("TrackOneCharge", 1, 'f')); - fOutputList->Add(new TParameter("TrackTwoCharge", -1, 'f')); - - if ((fDataType == kData) || (fDataType == kDataNoEvtSel) || (fDataType == kMC)) { - /* create the reconstructed data histograms */ - fhXYB = new TH2F("fHistXYB", "x and y distribution for reconstructed before", 1000, -10.0, 10.0, 1000, -10.0, 10.0); - fhYZB = new TH2F("fHistYZB", "y and z distribution for reconstructed before", 1000, -10.0, 10.0, 1000, -10.0, 10.0); - fhXYA = new TH2F("fHistXYA", "x and y distribution for reconstructed after", 1000, -10.0, 10.0, 1000, -10.0, 10.0); - fhYZA = new TH2F("fHistYZA", "y and z distribution for reconstructed after", 1000, -10.0, 10.0, 1000, -10.0, 10.0); - fhPB = new TH1F("fHistPB", "p distribution for reconstructed before;p (GeV/c);dN/dp (c/GeV)", 100, 0.0, 15.0); - fhPtB = new TH1F("fHistPtB", "p_{T} distribution for reconstructed before;p_{T} (GeV/c);dN/dP_{T} (c/GeV)", 100, 0.0, 15.0); - fhPtPosB = new TH1F("fHistPtPosB", "P_{T} distribution for reconstructed (#plus) before;P_{T} (GeV/c);dN/dP_{T} (c/GeV)", 100, 0.0, 15.0); - fhPtNegB = new TH1F("fHistPtNegB", "P_{T} distribution for reconstructed (#minus) before;P_{T} (GeV/c);dN/dP_{T} (c/GeV)", 100, 0.0, 15.0); - fhEtaB = new TH1F("fHistEtaB", "#eta distribution for reconstructed before;#eta;counts", 40, -2.0, 2.0); - fhEtaA = new TH1F("fHistEtaA", "#eta distribution for reconstructed;#eta;counts", etabins, etalow, etaup); - fhPhiB = new TH1F("fHistPhiB", "#phi distribution for reconstructed before;#phi;counts", 360, 0.0, constants::math::TwoPI); - fhdEdxB = new TH2F("fHistdEdxB", "dE/dx vs P before; P (GeV/c); dE/dx (a.u.)", ptbins, ptlow, ptup, 1000, 0.0, 1000.0); - fhdEdxIPTPCB = new TH2F("fHistdEdxIPTPCB", "dE/dx vs P_{IP} before; P (GeV/c); dE/dx (a.u.)", ptbins, ptlow, ptup, 1000, 0.0, 1000.0); - fhTrackLengthB = new TH1F(TString::Format("fhTrackLengthB").Data(), - TString::Format("Track Length; L (cm)").Data(), - 1000, 0., 1000.0); - fhTrackLengthTOFB = new TH1F(TString::Format("fhTrackLengthTOFB").Data(), - TString::Format("Track Length with TOF; L (cm)").Data(), - 1000, 0.0, 1000.0); - fhTrackTimeB = new TH2F(TString::Format("fhTrackTimeB").Data(), - TString::Format("Track Time vs P; P (GeV/c); Track Time(ns)").Data(), - ptbins, ptlow, ptup, 1000, 0.0, 10.0); - fhTrackBetaInvB = new TH2F(TString::Format("fhTrackBetaInvB").Data(), - TString::Format("1/#Beta vs P; P (GeV/c); 1/#Beta(ns/m)").Data(), - ptbins, ptlow, ptup, 1000, 0.0, 10.0); - fhTrackTimeIPB = new TH2F(TString::Format("fhTrackTimeIPB").Data(), - TString::Format("Track Time vs P_{IP}; P (GeV/c); Track Time(ns)").Data(), - ptbins, ptlow, ptup, 1000, 0.0, 10.0); - fhTrackBetaInvIPB = new TH2F(TString::Format("fhTrackBetaInvIPB").Data(), - TString::Format("1/#Beta vs P_{IP}; P (GeV/c); 1/#Beta(ns/m)").Data(), - ptbins, ptlow, ptup, 1000, 0.0, 10.0); - fhPhiA = new TH1F("fHistPhiA", "#phi distribution for reconstructed;#phi;counts", 360, 0.0, constants::math::TwoPI); - fhDCAxyB = new TH1F("DCAxyB", "DCA_{xy} distribution for reconstructed before;DCA_{xy} (cm);counts", 1000, -4.0, 4.0); - fhDCAxyA = new TH1F("DCAxyA", "DCA_{xy} distribution for reconstructed;DCA_{xy} (cm);counts", 1000, -4., 4.0); - fhDCAxyzB = new TH2F("DCAxyzB", "DCA_{xy} vs DCA_{z} distribution for reconstructed before;DCA_{xy} (cm); DCA_{z} (cm);counts", 1000, -4.0, 4.0, 1000, -4.0, 4.0); - fhFineDCAxyA = new TH1F("FineDCAxyA", "DCA_{xy} distribution for reconstructed;DCA_{xy} (cm);counts", 4000, -1.0, 1.0); - fhDCAzB = new TH1F("DCAzB", "DCA_{z} distribution for reconstructed before;DCA_{z} (cm);counts", 1000, -4.0, 4.0); - fhDCAzA = new TH1F("DCAzA", "DCA_{z} distribution for reconstructed;DCA_{z} (cm);counts", 1000, -4.0, 4.0); - fhFineDCAzA = new TH1F("FineDCAzA", "DCA_{z} distribution for reconstructed;DCA_{z} (cm);counts", 4000, -1.0, 1.0); - fhDCAxyzA = new TH2F("DCAxyzA", "DCA_{xy} vs DCA_{z} distribution for reconstructed;DCA_{xy} (cm); DCA_{z} (cm);counts", 1000, -4.0, 4.0, 1000, -4.0, 4.0); - - fhNClustersB = new TH1I("fHistNClB", "TPC NClusters distribution for reconstructed before;counts", 201, 0, 200); - fhPhiYB = new TH2F("fHistPhiYB", "#phi vs #eta distribution for reconstructed before;#phi;#eta;counts", 360, 0.0, constants::math::TwoPI, 40, -2.0, 2.0); - fhPtYB = new TH2F("fHistPtYB", "p_{T} vs #eta distribution for reconstructed before;p_{T} (GeV/c);#eta;counts", 100, 0.0, 15.0, 40, -2.0, 2.0); - fhChi2B = new TH1F("fHistChi2B", "#chi^{2}/Ncl TPC distribution for reconstructed before;", 100, 0.0, 20.0); - fhITSNclB = new TH1I("fHistITSNClB", "ITS NClusters distribution for reconstructed before;counts", 21, 0, 20); - - fhNClustersA = new TH1I("fHistNClA", "TPC NClusters distribution for reconstructed after;counts", 201, 0, 200); - fhPhiYA = new TH2F("fHistPhiYA", "#phi vs #eta distribution for reconstructed after;#phi;#eta;counts", 360, 0.0, constants::math::TwoPI, 40, -2.0, 2.0); - fhPtYA = new TH2F("fHistPtYA", "p_{T} vs #eta distribution for reconstructed after;p_{T} (GeV/c);#eta;counts", 100, 0.0, 15.0, 40, -2.0, 2.0); - fhChi2A = new TH1F("fHistChi2A", "#chi^{2}/Ncl TPC distribution for reconstructed after;", 100, 0.0, 20.0); - fhITSNclA = new TH1I("fHistITSNClA", "ITS NClusters distribution for reconstructed after;counts", 21, 0, 20); - - fhDoublePID = new TH2S("DoublePID", "PIDs for double match;Original Species;Secondary Species", kIdBfNoOfSpecies, 0, kIdBfNoOfSpecies, kIdBfNoOfSpecies, 0, kIdBfNoOfSpecies); - - fhWrongTrackID = new TH1F("WrongTrackId", "Wrong Tracks From Double Track Id distribution in p", ptbins, ptlow, ptup); - if (checkAmbiguousTracks) { - /* let's allocate the ambigous tracks tracking histograms*/ - fhAmbiguousTrackType = new TH2D("fHistAmbiguousTracksType", "Ambiguous tracks type vs. multiplicity class;Ambiguous track type;Multiplicity (%);counts", 4, -0.5, 3.5, 101, -0.5, 100.5); - fhAmbiguousTrackPt = new TH2F("fHistAmbiguousTracksPt", "Ambiguous tracks #it{p}_{T} vs. multiplicity class;#it{p}_{T} (GeV/#it{c});Multiplicity (%);counts", 100, 0.0, 15.0, 101, -0.5, 100.5); - fhAmbiguityDegree = new TH2F("fHistAmbiguityDegree", "Ambiguity degree vs. multiplicity class;Ambiguity degree;Multiplicity (%);counts", 31, -0.5, 30.5, 101, -0.5, 100.5); - fhCompatibleCollisionsZVtxRms = new TH2F("fHistCompatibleCollisionsZVtxRms", "Compatible collisions #it{z}_{vtx} RMS;#sigma_{#it{z}_{vtx}};Multiplicity (%);counts", 100, -10.0, 10.0, 101, -0.5, 100.5); - } - - for (int sp = 0; sp < kIdBfNoOfSpecies; ++sp) { - fhNSigmaTPC[sp] = new TH2F(TString::Format("fhNSigmaTPC_%s", speciesName[sp]).Data(), - TString::Format("N Sigma from TPC vs P for %s;N #sigma;p (GeV/c)", speciesTitle[sp]).Data(), - 48, -6, 6, - ptbins, ptlow, ptup); - fhNSigmaTOF[sp] = new TH2F(TString::Format("fhNSigmaTOF_%s", speciesName[sp]).Data(), - TString::Format("N Sigma from TOF vs P for %s;N #sigma;p (GeV/c)", speciesTitle[sp]).Data(), - 48, -6, 6, - ptbins, ptlow, ptup); - fhNSigmaCombo[sp] = new TH2F(TString::Format("fhNSigmaCombo_%s", speciesName[sp]).Data(), - TString::Format("N Sigma from Combo vs P for %s;N #sigma;p (GeV/c)", speciesTitle[sp]).Data(), - 48, -6, 6, - ptbins, ptlow, ptup); - fhNSigmaTPCIdTrks[sp] = new TH2F(TString::Format("fhNSigmaTPC_IdTrks_%s", speciesName[sp]).Data(), - TString::Format("N Sigma from TPC vs P for Identified %s;N #sigma;p (GeV/c)", speciesTitle[sp]).Data(), - 48, -6, 6, - ptbins, ptlow, ptup); - } - - for (int sp = 0; sp < kIdBfNoOfSpecies + 1; ++sp) { - fhPA[sp] = new TH1F(TString::Format("fHistPA_%s", speciesName[sp]).Data(), - TString::Format("p distribution for reconstructed %s;p (GeV/c);dN/dp (c/GeV)", speciesTitle[sp]).Data(), - ptbins, ptlow, ptup); - fhPtA[sp] = new TH1F(TString::Format("fHistPtA_%s", speciesName[sp]), - TString::Format("p_{T} distribution for reconstructed %s;p_{T} (GeV/c);dN/dP_{T} (c/GeV)", speciesTitle[sp]).Data(), - ptbins, ptlow, ptup); - fhPtPosA[sp] = new TH1F(TString::Format("fHistPtPosA_%s", speciesName[sp]), - TString::Format("P_{T} distribution for reconstructed %s^{#plus};P_{T} (GeV/c);dN/dP_{T} (c/GeV)", speciesTitle[sp]).Data(), - ptbins, ptlow, ptup); - fhPtNegA[sp] = new TH1F(TString::Format("fHistPtNegA_%s", speciesName[sp]), - TString::Format("P_{T} distribution for reconstructed %s^{#minus};P_{T} (GeV/c);dN/dP_{T} (c/GeV)", speciesTitle[sp]).Data(), - ptbins, ptlow, ptup); - fhPtEtaPosA[sp] = new TH2F(TString::Format("fHistPtEtaPosA_%s", speciesName[sp]), - TString::Format("P_{T} vs #eta distribution for reconstructed %s^{#plus};P_{T} (GeV/c);#eta;dN/dP_{T} (c/GeV)", speciesTitle[sp]).Data(), - ptbins, ptlow, ptup, - etabins, etalow, etaup); - fhPtEtaNegA[sp] = new TH2F(TString::Format("fHistPtEtaNegA_%s", speciesName[sp]), - TString::Format("P_{T} vs #eta distribution for reconstructed %s^{#minus};P_{T} (GeV/c);#eta;dN/dP_{T} (c/GeV)", speciesTitle[sp]).Data(), - ptbins, ptlow, ptup, - etabins, etalow, etaup); - fhNPosNegA[sp] = new TH2F(TString::Format("fhNPosNegA_%s", speciesName[sp]).Data(), - TString::Format("N(%s^{#plus}) N(%s^{#minus}) distribution for reconstructed;N(%s^{#plus});N(%s^{#minus})", speciesTitle[sp], speciesTitle[sp], speciesTitle[sp], speciesTitle[sp]).Data(), - 40, -0.5, 39.5, 40, -0.5, 39.5); - fhDeltaNA[sp] = new TH1F(TString::Format("fhDeltaNA_%s", speciesName[sp]).Data(), - TString::Format("N(%s^{#plus}) #minus N(%s^{#minus}) distribution for reconstructed;N(%s^{#plus}) #minus N(%s^{#minus})", speciesTitle[sp], speciesTitle[sp], speciesTitle[sp], speciesTitle[sp]).Data(), - 79, -39.5, 39.5); - fhdEdxA[sp] = new TH2F(TString::Format("fhdEdxA_%s", speciesName[sp]).Data(), - TString::Format("dE/dx vs P reconstructed %s; P (GeV/c); dE/dx (a.u.)", speciesTitle[sp]).Data(), - ptbins, ptlow, ptup, 1000, 0.0, 1000.0); - fhdEdxIPTPCA[sp] = new TH2F(TString::Format("fhdEdxIPTPCA_%s", speciesName[sp]).Data(), - TString::Format("dE/dx vs P_{IP} reconstructed %s; P (GeV/c); dE/dx (a.u.)", speciesTitle[sp]).Data(), - ptbins, ptlow, ptup, 1000, 0.0, 1000.0); - fhTrackLengthA[sp] = new TH1F(TString::Format("fhTrackLengthA_%s", speciesName[sp]).Data(), - TString::Format("Track Length of reconstructed %s; L (cm)", speciesTitle[sp]).Data(), - 1000, 0.0, 1000.0); - fhTrackLengthTOFA[sp] = new TH1F(TString::Format("fhTrackLengthTOFA_%s", speciesName[sp]).Data(), - TString::Format("Track Length of reconstructed %s with TOF; L (cm)", speciesTitle[sp]).Data(), - 1000, 0.0, 1000.0); - fhTrackTimeA[sp] = new TH2F(TString::Format("fhTrackTimeA_%s", speciesName[sp]).Data(), - TString::Format("Track Time vs P reconstructed %s; P (GeV/c); Track Time(ns)", speciesTitle[sp]).Data(), ptbins, ptlow, ptup, 1000, 0.0, 10.0); - fhTrackBetaInvA[sp] = new TH2F(TString::Format("fhTrackBetaInvA_%s", speciesName[sp]).Data(), - TString::Format("1/#Beta vs P reconstructed %s; P (GeV/c); 1/#Beta(ns/m)", speciesTitle[sp]).Data(), - ptbins, ptlow, ptup, 1000, 0.0, 10.0); - fhTrackTimeIPA[sp] = new TH2F(TString::Format("fhTrackTimeIPA_%s", speciesName[sp]).Data(), - TString::Format("Track Time vs P_{IP} reconstructed %s; P (GeV/c); Track Time(ns)", speciesTitle[sp]).Data(), - ptbins, ptlow, ptup, 1000, 0.0, 10.0); - fhTrackBetaInvIPA[sp] = new TH2F(TString::Format("fhTrackBetaInvIPA_%s", speciesName[sp]).Data(), - TString::Format("1/#Beta vs P_{IP} reconstructed %s; P (GeV/c); 1/#Beta(ns/m)", speciesTitle[sp]).Data(), - ptbins, ptlow, ptup, 1000, 0.0, 10.0); - LOGF(info, "Made Histos"); - } - fhdEdxA[kIdBfNoOfSpecies + 1] = new TH2F(TString::Format("fhdEdxA_WrongSpecies").Data(), - TString::Format("dE/dx vs P reconstructed Wrong Species; P (GeV/c); dE/dx (a.u.)").Data(), - ptbins, ptlow, ptup, 1000, 0.0, 1000.0); - fhdEdxIPTPCA[kIdBfNoOfSpecies + 1] = new TH2F(TString::Format("fhdEdxIPTPCA_WrongSpecies").Data(), - TString::Format("dE/dx vs P_{IP} reconstructed Wrong Species; P (GeV/c); dE/dx (a.u.)").Data(), - ptbins, ptlow, ptup, 1000, 0.0, 1000.0); - fhTrackLengthA[kIdBfNoOfSpecies + 1] = new TH1F(TString::Format("fhTrackLengthA_WrongSpecies").Data(), - TString::Format("Track Length of reconstructed Wrong Species; L (cm)").Data(), - 1000, 0.0, 1000.0); - fhTrackLengthTOFA[kIdBfNoOfSpecies + 1] = new TH1F(TString::Format("fhTrackLengthTOFA_WrongSpecies").Data(), - TString::Format("Track Length of reconstructed Wrong Species with TOF; L (cm)").Data(), - 1000, 0.0, 1000.0); - fhTrackTimeA[kIdBfNoOfSpecies + 1] = new TH2F(TString::Format("fhTrackTimeA_WrongSpecies").Data(), - TString::Format("Track Time vs P reconstructed Wrong Species; P (GeV/c); Track Time(ns)").Data(), - ptbins, ptlow, ptup, 1000, 0.0, 10.0); - fhTrackBetaInvA[kIdBfNoOfSpecies + 1] = new TH2F(TString::Format("fhTrackBetaInvA_WrongSpecies").Data(), - TString::Format("1/#Beta vs P reconstructed Wrong Species; P (GeV/c); 1/#Beta(ns/m)").Data(), - ptbins, ptlow, ptup, 1000, 0.0, 10.0); - fhTrackTimeIPA[kIdBfNoOfSpecies + 1] = new TH2F(TString::Format("fhTrackTimeIPA_WrongSpecies").Data(), - TString::Format("Track Time vs P_{IP} reconstructed Wrong Species; P (GeV/c); Track Time(ns)").Data(), - ptbins, ptlow, ptup, 1000, 0.0, 10.0); - fhTrackBetaInvIPA[kIdBfNoOfSpecies + 1] = new TH2F(TString::Format("fhTrackBetaInvIPA_WrongSpecies").Data(), - TString::Format("1/#Beta vs P_{IP} reconstructed Wrong Species; P (GeV/c); 1/#Beta(ns/m)").Data(), - ptbins, ptlow, ptup, 1000, 0.0, 10.0); - - /* add the hstograms to the output list */ - fOutputList->Add(fhXYB); - fOutputList->Add(fhYZB); - fOutputList->Add(fhXYA); - fOutputList->Add(fhYZA); - fOutputList->Add(fhNClustersB); - fOutputList->Add(fhNClustersA); - fOutputList->Add(fhPhiYB); - fOutputList->Add(fhPhiYA); - fOutputList->Add(fhPtYB); - fOutputList->Add(fhPtYA); - fOutputList->Add(fhChi2B); - fOutputList->Add(fhChi2A); - fOutputList->Add(fhITSNclB); - fOutputList->Add(fhITSNclA); - fOutputList->Add(fhPB); - fOutputList->Add(fhPtB); - fOutputList->Add(fhPtPosB); - fOutputList->Add(fhPtNegB); - fOutputList->Add(fhEtaB); - fOutputList->Add(fhEtaA); - fOutputList->Add(fhPhiB); - fOutputList->Add(fhPhiA); - fOutputList->Add(fhdEdxB); - fOutputList->Add(fhdEdxIPTPCB); - fOutputList->Add(fhTrackLengthB); - fOutputList->Add(fhTrackLengthTOFB); - fOutputList->Add(fhTrackTimeB); - fOutputList->Add(fhTrackBetaInvB); - fOutputList->Add(fhTrackTimeIPB); - fOutputList->Add(fhTrackBetaInvIPB); - fOutputList->Add(fhDCAxyB); - fOutputList->Add(fhDCAxyA); - fOutputList->Add(fhDCAxyzB); - fOutputList->Add(fhDCAxyzA); - fOutputList->Add(fhWrongTrackID); - fOutputList->Add(fhDoublePID); - fOutputList->Add(fhFineDCAxyA); - fOutputList->Add(fhDCAzB); - fOutputList->Add(fhDCAzA); - fOutputList->Add(fhFineDCAzA); - - if (checkAmbiguousTracks) { - fOutputList->Add(fhAmbiguousTrackType); - fOutputList->Add(fhAmbiguousTrackPt); - fOutputList->Add(fhAmbiguityDegree); - fOutputList->Add(fhCompatibleCollisionsZVtxRms); - } - - for (int sp = 0; sp < kIdBfNoOfSpecies; ++sp) { - fOutputList->Add(fhNSigmaTPC[sp]); - fOutputList->Add(fhNSigmaTOF[sp]); - fOutputList->Add(fhNSigmaCombo[sp]); - fOutputList->Add(fhNSigmaTPCIdTrks[sp]); - } - - for (int sp = 0; sp < kIdBfNoOfSpecies + 1; ++sp) { - fOutputList->Add(fhPA[sp]); - fOutputList->Add(fhPtA[sp]); - fOutputList->Add(fhPtPosA[sp]); - fOutputList->Add(fhPtNegA[sp]); - fOutputList->Add(fhPtEtaPosA[sp]); - fOutputList->Add(fhPtEtaNegA[sp]); - fOutputList->Add(fhNPosNegA[sp]); - fOutputList->Add(fhDeltaNA[sp]); - fOutputList->Add(fhdEdxA[sp]); - fOutputList->Add(fhdEdxIPTPCA[sp]); - fOutputList->Add(fhTrackLengthA[sp]); - fOutputList->Add(fhTrackLengthTOFA[sp]); - fOutputList->Add(fhTrackTimeA[sp]); - fOutputList->Add(fhTrackBetaInvA[sp]); - fOutputList->Add(fhTrackTimeIPA[sp]); - fOutputList->Add(fhTrackBetaInvIPA[sp]); - LOGF(info, "Added histos"); - } - fOutputList->Add(fhdEdxA[kIdBfNoOfSpecies + 1]); - fOutputList->Add(fhdEdxIPTPCA[kIdBfNoOfSpecies + 1]); - fOutputList->Add(fhTrackLengthA[kIdBfNoOfSpecies + 1]); - fOutputList->Add(fhTrackLengthTOFA[kIdBfNoOfSpecies + 1]); - fOutputList->Add(fhTrackTimeA[kIdBfNoOfSpecies + 1]); - fOutputList->Add(fhTrackBetaInvA[kIdBfNoOfSpecies + 1]); - fOutputList->Add(fhTrackTimeIPA[kIdBfNoOfSpecies + 1]); - fOutputList->Add(fhTrackBetaInvIPA[kIdBfNoOfSpecies + 1]); - } - - if ((fDataType != kData) && (fDataType != kDataNoEvtSel)) { - /* create the true data histograms */ - - fhTruePIDMismatch = new TH2S("fHistTruePIDMismatch", "Mismatched Generated and Reconstructed PID;Generated Species;Reconstructed Species", kIdBfNoOfSpecies, 0, kIdBfNoOfSpecies, kIdBfNoOfSpecies, 0, kIdBfNoOfSpecies); - fhTruePIDCorrect = new TH1S("fHistTruePIDCorrect", "Correct PID between Generated and Reconstructed PID;Species", kIdBfNoOfSpecies, 0, kIdBfNoOfSpecies); - - fhTruePB = new TH1F("fTrueHistPB", "p distribution before (truth);p (GeV/c);dN/dp (c/GeV)", 100, 0.0, 15.0); - fhTrueCharge = new TH1F("fTrueHistCharge", "Charge distribution before (truth);charge;count", 3, -1.0, 1.0); - - fhTruePhiYB = new TH2F("fTrueHistPhiYB", "#phi vs #eta distribution before (truth);#phi;#eta;counts", 360, 0.0, constants::math::TwoPI, 40, -2.0, 2.0); - fhTruePtYB = new TH2F("fTrueHistPtYB", "p_{T} vs #eta distribution before (truth);p_{T} (GeV/c);#eta;counts", 100, 0.0, 15.0, 40, -2.0, 2.0); - - fhTruePhiYA = new TH2F("fTrueHistPhiYA", "#phi vs #eta distribution after (truth);#phi;#eta;counts", 360, 0.0, constants::math::TwoPI, 40, -2.0, 2.0); - fhTruePtYA = new TH2F("fTrueHistPtYA", "p_{T} vs #eta distribution after (truth);p_{T} (GeV/c);#eta;counts", 100, 0.0, 15.0, 40, -2.0, 2.0); - - fhTruePtB = new TH1F("fTrueHistPtB", "p_{T} distribution before (truth);p_{T} (GeV/c);dN/dP_{T} (c/GeV)", 100, 0.0, 15.0); - fhTruePtPosB = new TH1F("fTrueHistPtPosB", "P_{T} distribution (#plus) before (truth);P_{T} (GeV/c);dN/dP_{T} (c/GeV)", 100, 0.0, 15.0); - fhTruePtNegB = new TH1F("fTrueHistPtNegB", "P_{T} distribution (#minus) before (truth);P_{T} (GeV/c);dN/dP_{T} (c/GeV)", 100, 0.0, 15.0); - fhTrueEtaB = new TH1F("fTrueHistEtaB", "#eta distribution before (truth);#eta;counts", 40, -2.0, 2.0); - fhTrueEtaA = new TH1F("fTrueHistEtaA", "#eta distribution (truth);#eta;counts", etabins, etalow, etaup); - fhTruePhiB = new TH1F("fTrueHistPhiB", "#phi distribution before (truth);#phi;counts", 360, 0.0, constants::math::TwoPI); - fhTruePhiA = new TH1F("fTrueHistPhiA", "#phi distribution (truth);#phi;counts", 360, 0.0, constants::math::TwoPI); - fhTrueDCAxyB = new TH1F("TrueDCAxyB", "DCA_{xy} distribution for generated before;DCA_{xy} (cm);counts", 1000, -4.0, 4.0); - fhPrimaryPB = new TH1F(TString::Format("fhPrimaryPB").Data(), - TString::Format("p distribution Primary Before Selection;p (GeV/c);dN/dp (c/GeV)").Data(), - ptbins, ptlow, ptup); - fhPrimaryPtB = new TH1F(TString::Format("fhPrimaryPtB"), - TString::Format("p_{T} distribution Primary Before Selection ;p_{T} (GeV/c);dN/dP_{T} (c/GeV)").Data(), - ptbins, ptlow, ptup); - fhPrimarydEdxB = new TH2F(TString::Format("fhPrimarydEdxB").Data(), - TString::Format("dE/dx vs P Primary Before Selection; P (GeV/c); dE/dx (a.u.)").Data(), - ptbins, ptlow, ptup, 1000, 0.0, 1000.0); - fhPrimarydEdxIPTPCB = new TH2F(TString::Format("fhPrimarydEdxIPTPCB").Data(), - TString::Format("dE/dx vs P_{IP} Primary Before Selection; P (GeV/c); dE/dx (a.u.)").Data(), - ptbins, ptlow, ptup, 1000, 0.0, 1000.0); - fhPrimaryTrackLengthB = new TH1F(TString::Format("fhPrimaryTrackLengthB").Data(), - TString::Format("Track Length of Primary Before Selection; L (cm)").Data(), - 1000, 0.0, 1000.0); - fhPrimaryTrackLengthTOFB = new TH1F(TString::Format("fhPrimaryTrackLengthTOFB").Data(), - TString::Format("Track Length of Primary Before Selection with TOF; L (cm)").Data(), - 1000, 0.0, 1000.0); - fhPrimaryTrackTimeB = new TH2F(TString::Format("fhPrimaryTrackTimeB").Data(), - TString::Format("Track Time vs P Primary Before Selection; P (GeV/c); Track Time(ns)").Data(), - ptbins, ptlow, ptup, 1000, 0.0, 10.0); - fhPrimaryTrackBetaInvB = new TH2F(TString::Format("fhPrimaryTrackBetaInvB").Data(), - TString::Format("1/#Beta vs P Primary Before Selection; P (GeV/c); 1/#Beta(ns/m)").Data(), - ptbins, ptlow, ptup, 1000, 0.0, 10.0); - fhPrimaryTrackTimeIPB = new TH2F(TString::Format("fhPrimaryTrackTimeIPB").Data(), - TString::Format("Track Time vs P_{IP} Primary Before Selection; P (GeV/c); Track Time(ns)").Data(), - ptbins, ptlow, ptup, 1000, 0.0, 10.0); - fhPrimaryTrackBetaInvIPB = new TH2F(TString::Format("fhPrimaryTrackBetaInvIPB").Data(), - TString::Format("1/#Beta vs P_{IP} Primary Before Selection; P (GeV/c); 1/#Beta(ns/m)").Data(), - ptbins, ptlow, ptup, 1000, 0.0, 10.0); - if (traceDCAOutliers.mDoIt) { - fhTrueDCAxyBid = new TH1F("PDGCodeDCAxyB", - TString::Format("PDG code within %.2f<|DCA_{#it{xy}}|<%.2f; PDG code", traceDCAOutliers.mLowValue, traceDCAOutliers.mUpValue).Data(), - 100, 0.5, 100.5); - } - fhTrueDCAxyA = new TH1F("TrueDCAxyA", "DCA_{xy} distribution for generated;DCA_{xy};counts (cm)", 1000, -4., 4.0); - fhTrueDCAzB = new TH1F("TrueDCAzB", "DCA_{z} distribution for generated before;DCA_{z} (cm);counts", 1000, -4.0, 4.0); - fhTrueDCAzA = new TH1F("TrueDCAzA", "DCA_{z} distribution for generated;DCA_{z} (cm);counts", 1000, -4.0, 4.0); - fhTrueDCAxyzB = new TH2F("TrueDCAxyzB", "DCA_{xy} vs DCA_{z} distribution for generated before;DCA_{xy} (cm);DCA_{z} (cm);counts", 1000, -4.0, 4.0, 1000, -4.0, 4.0); - fhTrueDCAxyzA = new TH2F("TrueDCAxyzA", "DCA_{xy} vs DCA_{z} distribution for generated after;DCA_{xy} (cm);DCA_{z} (cm);counts", 1000, -4.0, 4.0, 1000, -4.0, 4.0); - - for (int sp = 0; sp < kIdBfNoOfSpecies + 1; ++sp) { - fhTruePA[sp] = new TH1F(TString::Format("fTrueHistPA_%s", speciesName[sp]).Data(), - TString::Format("p distribution %s (truth);p (GeV/c);dN/dp (c/GeV)", speciesTitle[sp]).Data(), - ptbins, ptlow, ptup); - fhTruePtA[sp] = new TH1F(TString::Format("fTrueHistPtA_%s", speciesName[sp]), - TString::Format("p_{T} distribution %s (truth);p_{T} (GeV/c);dN/dP_{T} (c/GeV)", speciesTitle[sp]).Data(), - ptbins, ptlow, ptup); - fhTruePtPosA[sp] = new TH1F(TString::Format("fTrueHistPtPosA_%s", speciesName[sp]), - TString::Format("P_{T} distribution %s^{#plus} (truth);P_{T} (GeV/c);dN/dP_{T} (c/GeV)", speciesTitle[sp]).Data(), - ptbins, ptlow, ptup); - fhTruePtNegA[sp] = new TH1F(TString::Format("fTrueHistPtNegA_%s", speciesName[sp]), - TString::Format("P_{T} distribution %s^{#minus} (truth);P_{T} (GeV/c);dN/dP_{T} (c/GeV)", speciesTitle[sp]).Data(), - ptbins, ptlow, ptup); - fhTruePtEtaPosA[sp] = new TH2F(TString::Format("fTrueHistPtEtaPosA_%s", speciesName[sp]), - TString::Format("P_{T} vs #eta distribution %s^{#plus} (truth);P_{T} (GeV/c);#eta;dN/dP_{T} (c/GeV)", speciesTitle[sp]).Data(), - ptbins, ptlow, ptup, - etabins, etalow, etaup); - fhTruePtEtaNegA[sp] = new TH2F(TString::Format("fTrueHistPtEtaNegA_%s", speciesName[sp]), - TString::Format("P_{T} vs #eta distribution %s^{#minus} (truth);P_{T} (GeV/c);#eta;dN/dP_{T} (c/GeV)", speciesTitle[sp]).Data(), - ptbins, ptlow, ptup, - etabins, etalow, etaup); - fhTrueNPosNegA[sp] = new TH2F(TString::Format("fhTrueNPosNegA_%s", speciesName[sp]).Data(), - TString::Format("N(%s^{#plus}) N(%s^{#minus}) distribution (truth);N(%s^{#plus});N(%s^{#minus})", speciesTitle[sp], speciesTitle[sp], speciesTitle[sp], speciesTitle[sp]).Data(), - 40, -0.5, 39.5, 40, -0.5, 39.5); - fhTrueDeltaNA[sp] = new TH1F(TString::Format("fhTrueDeltaNA_%s", speciesName[sp]).Data(), - TString::Format("N(%s^{#plus}) #minus N(%s^{#minus}) distribution (truth);N(%s^{#plus}) #minus N(%s^{#minus})", speciesTitle[sp], speciesTitle[sp], speciesTitle[sp], speciesTitle[sp]).Data(), - 79, -39.5, 39.5); - fhTruedEdxA[sp] = new TH2F(TString::Format("fhTruedEdxA_%s", speciesName[sp]).Data(), - TString::Format("dE/dx vs P generated %s; P (GeV/c); dE/dx (a.u.)", speciesTitle[sp]).Data(), - ptbins, ptlow, ptup, 1000, 0.0, 1000.0); - fhTruedEdxIPTPCA[sp] = new TH2F(TString::Format("fhTruedEdxIPTPCA_%s", speciesName[sp]).Data(), - TString::Format("dE/dx vs P_{IP} generated %s; P (GeV/c); dE/dx (a.u.)", speciesTitle[sp]).Data(), - ptbins, ptlow, ptup, 1000, 0.0, 1000.0); - fhTrueTrackLengthA[sp] = new TH1F(TString::Format("fhTrueTrackLengthA_%s", speciesName[sp]).Data(), - TString::Format("Track Length of generated %s; L (cm)", speciesTitle[sp]).Data(), - 1000, 0.0, 1000.0); - fhTrueTrackLengthTOFA[sp] = new TH1F(TString::Format("fhTrueTrackLengthTOFA_%s", speciesName[sp]).Data(), - TString::Format("Track Length of generated %s with TOF; L (cm)", speciesTitle[sp]).Data(), - 1000, 0.0, 1000.0); - fhTrueTrackTimeA[sp] = new TH2F(TString::Format("fhTrueTrackTimeA_%s", speciesName[sp]).Data(), - TString::Format("Track Time vs P generated %s; P (GeV/c); Track Time(ns)", speciesTitle[sp]).Data(), - ptbins, ptlow, ptup, 1000, 0.0, 10.0); - fhTrueTrackBetaInvA[sp] = new TH2F(TString::Format("fhTrueTrackBetaInvA_%s", speciesName[sp]).Data(), - TString::Format("1/#Beta vs P generated %s; P (GeV/c); 1/#Beta(ns/m)", speciesTitle[sp]).Data(), - ptbins, ptlow, ptup, 1000, 0.0, 10.0); - fhTrueTrackTimeIPA[sp] = new TH2F(TString::Format("fhTrueTrackTimeIPA_%s", speciesName[sp]).Data(), - TString::Format("Track Time vs P_{IP} generated %s; P (GeV/c); Track Time(ns)", speciesTitle[sp]).Data(), - ptbins, ptlow, ptup, 1000, 0.0, 10.0); - fhTrueTrackBetaInvIPA[sp] = new TH2F(TString::Format("fhTrueTrackBetaInvIPA_%s", speciesName[sp]).Data(), - TString::Format("1/#Beta vs P_{IP} generated %s; P (GeV/c); 1/#Beta(ns/m)", speciesTitle[sp]).Data(), - ptbins, ptlow, ptup, 1000, 0.0, 10.0); - - fhPrimaryPA[sp] = new TH1F(TString::Format("fhPrimaryPA_%s", speciesName[sp]).Data(), - TString::Format("p distribution Primary %s;p (GeV/c);dN/dp (c/GeV)", speciesTitle[sp]).Data(), - ptbins, ptlow, ptup); - fhPrimaryPtA[sp] = new TH1F(TString::Format("fhPrimaryPtA_%s", speciesName[sp]), - TString::Format("p_{T} distribution Primary %s ;p_{T} (GeV/c);dN/dP_{T} (c/GeV)", speciesTitle[sp]).Data(), - ptbins, ptlow, ptup); - fhPrimarydEdxA[sp] = new TH2F(TString::Format("fhPrimarydEdxA_%s", speciesName[sp]).Data(), - TString::Format("dE/dx vs P Primary %s; P (GeV/c); dE/dx (a.u.)", speciesTitle[sp]).Data(), - ptbins, ptlow, ptup, 1000, 0.0, 1000.0); - fhPrimarydEdxIPTPCA[sp] = new TH2F(TString::Format("fhPrimarydEdxIPTPCA_%s", speciesName[sp]).Data(), - TString::Format("dE/dx vs P_{IP} Primary %s; P (GeV/c); dE/dx (a.u.)", speciesTitle[sp]).Data(), - ptbins, ptlow, ptup, 1000, 0.0, 1000.0); - fhPrimaryTrackLengthA[sp] = new TH1F(TString::Format("fhPrimaryTrackLengthA_%s", speciesName[sp]).Data(), - TString::Format("Track Length of Primary %s; L (cm)", speciesTitle[sp]).Data(), - 1000, 0.0, 1000.0); - fhPrimaryTrackLengthTOFA[sp] = new TH1F(TString::Format("fhPrimaryTrackLengthTOFA_%s", speciesName[sp]).Data(), - TString::Format("Track Length of Primary %s with TOF; L (cm)", speciesTitle[sp]).Data(), - 1000, 0.0, 1000.0); - fhPrimaryTrackTimeA[sp] = new TH2F(TString::Format("fhPrimaryTrackTimeA_%s", speciesName[sp]).Data(), - TString::Format("Track Time vs P Primary %s; P (GeV/c); Track Time(ns)", speciesTitle[sp]).Data(), - ptbins, ptlow, ptup, 1000, 0.0, 10.0); - fhPrimaryTrackBetaInvA[sp] = new TH2F(TString::Format("fhPrimaryTrackBetaInvA_%s", speciesName[sp]).Data(), - TString::Format("1/#Beta vs P Primary %s; P (GeV/c); 1/#Beta(ns/m)", speciesTitle[sp]).Data(), - ptbins, ptlow, ptup, 1000, 0.0, 10.0); - fhPrimaryTrackTimeIPA[sp] = new TH2F(TString::Format("fhPrimaryTrackTimeIPA_%s", speciesName[sp]).Data(), - TString::Format("Track Time vs P_{IP} Primary %s; P (GeV/c); Track Time(ns)", speciesTitle[sp]).Data(), - ptbins, ptlow, ptup, 1000, 0.0, 10.0); - fhPrimaryTrackBetaInvIPA[sp] = new TH2F(TString::Format("fhPrimaryTrackBetaInvIPA_%s", speciesName[sp]).Data(), - TString::Format("1/#Beta vs P_{IP} Primary %s; P (GeV/c); 1/#Beta(ns/m)", speciesTitle[sp]).Data(), - ptbins, ptlow, ptup, 1000, 0.0, 10.0); - - fhPurePA[sp] = new TH1F(TString::Format("fhPurePA_%s", speciesName[sp]).Data(), - TString::Format("p distribution Pure %s;p (GeV/c);dN/dp (c/GeV)", speciesTitle[sp]).Data(), - ptbins, ptlow, ptup); - fhPurePtA[sp] = new TH1F(TString::Format("fhPurePtA_%s", speciesName[sp]), - TString::Format("p_{T} distribution Pure %s ;p_{T} (GeV/c);dN/dP_{T} (c/GeV)", speciesTitle[sp]).Data(), - ptbins, ptlow, ptup); - fhPuredEdxA[sp] = new TH2F(TString::Format("fhPuredEdxA_%s", speciesName[sp]).Data(), - TString::Format("dE/dx vs P Pure %s; P (GeV/c); dE/dx (a.u.)", speciesTitle[sp]).Data(), - ptbins, ptlow, ptup, 1000, 0.0, 1000.0); - fhPuredEdxIPTPCA[sp] = new TH2F(TString::Format("fhPuredEdxIPTPCA_%s", speciesName[sp]).Data(), - TString::Format("dE/dx vs P_{IP} Pure %s; P (GeV/c); dE/dx (a.u.)", speciesTitle[sp]).Data(), - ptbins, ptlow, ptup, 1000, 0.0, 1000.0); - fhPureTrackLengthA[sp] = new TH1F(TString::Format("fhPureTrackLengthA_%s", speciesName[sp]).Data(), - TString::Format("Track Length of Pure %s; L (cm)", speciesTitle[sp]).Data(), - 1000, 0.0, 1000.0); - fhPureTrackLengthTOFA[sp] = new TH1F(TString::Format("fhPureTrackLengthTOFA_%s", speciesName[sp]).Data(), - TString::Format("Track Length of Pure %s with TOF; L (cm)", speciesTitle[sp]).Data(), - 1000, 0.0, 1000.0); - fhPureTrackTimeA[sp] = new TH2F(TString::Format("fhPureTrackTimeA_%s", speciesName[sp]).Data(), - TString::Format("Track Time vs P Pure %s; P (GeV/c); Track Time(ns)", speciesTitle[sp]).Data(), - ptbins, ptlow, ptup, 1000, 0.0, 10.0); - fhPureTrackBetaInvA[sp] = new TH2F(TString::Format("fhPureTrackBetaInvA_%s", speciesName[sp]).Data(), - TString::Format("1/#Beta vs P Pure %s; P (GeV/c); 1/#Beta(ns/m)", speciesTitle[sp]).Data(), - ptbins, ptlow, ptup, 1000, 0.0, 10.0); - fhPureTrackTimeIPA[sp] = new TH2F(TString::Format("fhPureTrackTimeIPA_%s", speciesName[sp]).Data(), - TString::Format("Track Time vs P_{IP} Pure %s; P (GeV/c); Track Time(ns)", speciesTitle[sp]).Data(), - ptbins, ptlow, ptup, 1000, 0.0, 10.0); - fhPureTrackBetaInvIPA[sp] = new TH2F(TString::Format("fhPureTrackBetaInvIPA_%s", speciesName[sp]).Data(), - TString::Format("1/#Beta vs P_{IP} Pure %s; P (GeV/c); 1/#Beta(ns/m)", speciesTitle[sp]).Data(), - ptbins, ptlow, ptup, 1000, 0.0, 10.0); - } - if (makeNSigmaPlots) { - for (int sp1 = 0; sp1 < kIdBfNoOfSpecies; ++sp1) { - for (int sp2 = 0; sp2 < kIdBfNoOfSpecies; ++sp2) { - fhTrueNSigmaTPC[sp1][sp2] = new TH2F(TString::Format("fhTrueNSigmaTPC%s_%s", speciesName[sp1], speciesName[sp2]).Data(), - TString::Format("N #sigma %s from TPC vs P for generated %s;N #sigma;p (GeV/c)", speciesTitle[sp1], speciesTitle[sp2]).Data(), - 48, -6, 6, - ptbins, ptlow, ptup); - - fhTrueNSigmaTOF[sp1][sp2] = new TH2F(TString::Format("fhTrueNSigmaTOF%s_%s", speciesName[sp1], speciesName[sp2]).Data(), - TString::Format("N #sigma %s from TOF vs P for generated %s;N #sigma;p (GeV/c)", speciesTitle[sp1], speciesTitle[sp2]).Data(), - 48, -6, 6, - ptbins, ptlow, ptup); - fhPrimaryNSigmaTPC[sp1][sp2] = new TH2F(TString::Format("fhPrimaryNSigmaTPC%s_%s", speciesName[sp1], speciesName[sp2]).Data(), - TString::Format("N #sigma %s from TPC vs P for primary %s;N #sigma;p (GeV/c)", speciesTitle[sp1], speciesTitle[sp2]).Data(), - 48, -6, 6, - ptbins, ptlow, ptup); - - fhPrimaryNSigmaTOF[sp1][sp2] = new TH2F(TString::Format("fhPrimaryNSigmaTOF%s_%s", speciesName[sp1], speciesName[sp2]).Data(), - TString::Format("N #sigma %s from TOF vs P for primary %s;N #sigma;p (GeV/c)", speciesTitle[sp1], speciesTitle[sp2]).Data(), - 48, -6, 6, - ptbins, ptlow, ptup); - } - } - } - - /* add the hstograms to the output list */ - fOutputList->Add(fhTruePIDMismatch); - fOutputList->Add(fhTruePIDCorrect); - fOutputList->Add(fhTruePhiYB); - fOutputList->Add(fhTruePtYB); - fOutputList->Add(fhTruePhiYA); - fOutputList->Add(fhTruePtYA); - fOutputList->Add(fhTruePB); - fOutputList->Add(fhTruePtB); - fOutputList->Add(fhTruePtPosB); - fOutputList->Add(fhTruePtNegB); - fOutputList->Add(fhTrueCharge); - fOutputList->Add(fhTrueEtaB); - fOutputList->Add(fhTrueEtaA); - fOutputList->Add(fhTruePhiB); - fOutputList->Add(fhTruePhiA); - fOutputList->Add(fhTrueDCAxyB); - fOutputList->Add(fhPrimaryPB); - fOutputList->Add(fhPrimaryPtB); - fOutputList->Add(fhPrimarydEdxB); - fOutputList->Add(fhPrimarydEdxIPTPCB); - fOutputList->Add(fhPrimaryTrackLengthB); - fOutputList->Add(fhPrimaryTrackLengthTOFB); - fOutputList->Add(fhPrimaryTrackTimeB); - fOutputList->Add(fhPrimaryTrackBetaInvB); - fOutputList->Add(fhPrimaryTrackTimeIPB); - fOutputList->Add(fhPrimaryTrackBetaInvIPB); - if (traceDCAOutliers.mDoIt) { - fOutputList->Add(fhTrueDCAxyBid); - } - fOutputList->Add(fhTrueDCAxyA); - fOutputList->Add(fhTrueDCAzB); - fOutputList->Add(fhTrueDCAzA); - fOutputList->Add(fhTrueDCAxyzB); - fOutputList->Add(fhTrueDCAxyzA); - - for (int sp = 0; sp < kIdBfNoOfSpecies + 1; ++sp) { - fOutputList->Add(fhTruePA[sp]); - fOutputList->Add(fhTruePtA[sp]); - fOutputList->Add(fhTruePtPosA[sp]); - fOutputList->Add(fhTruePtNegA[sp]); - fOutputList->Add(fhTruePtEtaPosA[sp]); - fOutputList->Add(fhTruePtEtaNegA[sp]); - fOutputList->Add(fhTrueNPosNegA[sp]); - fOutputList->Add(fhTrueDeltaNA[sp]); - - fOutputList->Add(fhTruedEdxA[sp]); - fOutputList->Add(fhTruedEdxIPTPCA[sp]); - fOutputList->Add(fhTrueTrackLengthA[sp]); - fOutputList->Add(fhTrueTrackLengthTOFA[sp]); - fOutputList->Add(fhTrueTrackTimeA[sp]); - fOutputList->Add(fhTrueTrackBetaInvA[sp]); - fOutputList->Add(fhTrueTrackTimeIPA[sp]); - fOutputList->Add(fhTrueTrackBetaInvIPA[sp]); - - fOutputList->Add(fhPrimaryPA[sp]); - fOutputList->Add(fhPrimaryPtA[sp]); - fOutputList->Add(fhPrimarydEdxA[sp]); - fOutputList->Add(fhPrimarydEdxIPTPCA[sp]); - fOutputList->Add(fhPrimaryTrackLengthA[sp]); - fOutputList->Add(fhPrimaryTrackLengthTOFA[sp]); - fOutputList->Add(fhPrimaryTrackTimeA[sp]); - fOutputList->Add(fhPrimaryTrackBetaInvA[sp]); - fOutputList->Add(fhPrimaryTrackTimeIPA[sp]); - fOutputList->Add(fhPrimaryTrackBetaInvIPA[sp]); - - fOutputList->Add(fhPurePA[sp]); - fOutputList->Add(fhPurePtA[sp]); - fOutputList->Add(fhPuredEdxA[sp]); - fOutputList->Add(fhPuredEdxIPTPCA[sp]); - fOutputList->Add(fhPureTrackLengthA[sp]); - fOutputList->Add(fhPureTrackLengthTOFA[sp]); - fOutputList->Add(fhPureTrackTimeA[sp]); - fOutputList->Add(fhPureTrackBetaInvA[sp]); - fOutputList->Add(fhPureTrackTimeIPA[sp]); - fOutputList->Add(fhPureTrackBetaInvIPA[sp]); - } - if (makeNSigmaPlots) { - for (int sp1 = 0; sp1 < kIdBfNoOfSpecies; ++sp1) { - for (int sp2 = 0; sp2 < kIdBfNoOfSpecies; ++sp2) { - fOutputList->Add(fhTrueNSigmaTPC[sp1][sp2]); - fOutputList->Add(fhTrueNSigmaTOF[sp1][sp2]); - fOutputList->Add(fhPrimaryNSigmaTPC[sp1][sp2]); - fOutputList->Add(fhPrimaryNSigmaTOF[sp1][sp2]); - } - } - } - } - /* initialize access to the CCDB */ - } - - template - inline MatchRecoGenSpecies identifyTrack(TrackObject const& track); - template - int8_t acceptTrack(TrackObject const& track); - template - int8_t acceptParticle(ParticleObject& particle, MCCollisionObject const& mccollision); - template - int8_t selectTrackAmbiguousCheck(CollisionObjects const& collisions, TrackObject const& track); - template - inline void identifyPIDMismatch(ParticleObject const& particle, MatchRecoGenSpecies const& trkId); - template - inline void identifyRealNSigma(ParticleObject const& particle, std::vector tpcNSigma, std::vector tofNSigma, float tpcInnerParam); - template - inline MatchRecoGenSpecies identifyParticle(ParticleObject const& particle); - template - void fillTrackHistosBeforeSelection(TrackObject const& track); - template - void fillTrackHistosAfterSelection(TrackObject const& track, MatchRecoGenSpecies sp); - template - bool isPrimary(ParticleObject const& particle); - template - void fillRealPIDTrackHistosAfter(TrackObject const& track, MatchRecoGenSpecies sp); - template - void fillParticleHistosBeforeSelection(ParticleObject const& particle, - MCCollisionObject const& collision, - float charge); - template - void fillParticleHistosAfterSelection(ParticleObject const& particle, - MCCollisionObject const& collision, - float charge, - MatchRecoGenSpecies sp); - - /* TODO: as it is now when the derived data is stored (fullDerivedData = true) */ - /* the collision index stored with the track is wrong. This has to be fixed */ - template - void filterTracks(soa::Join const& collisions, - passedtracks const& tracks) - { - // LOGF(info, "Top of filterTracks"); - int naccepted = 0; - int ncollaccepted = 0; - if (!fullDerivedData) { - tracksinfo.reserve(tracks.size()); - } - for (const auto& collision : collisions) { - if (collision.collisionaccepted()) { - ncollaccepted++; - } - } - for (const auto& track : tracks) { - int8_t pid = -1; - if (track.has_collision() && (track.template collision_as>()).collisionaccepted()) { - pid = selectTrackAmbiguousCheck(collisions, track); - if (!(pid < 0)) { - naccepted++; - /* update charged multiplicities */ - if (pid % twoDenom == trackTypes[0]) { - trkMultPos[kIdBfCharged]++; - } - if (pid % twoDenom == trackTypes[1]) { - trkMultNeg[kIdBfCharged]++; - } - if (fullDerivedData) { - LOGF(fatal, "Stored derived data not prepared for saving the proper new collision id"); - scannedtracks((track.template collision_as>()).globalIndex(), pid, track.pt(), track.eta(), track.phi()); - } else { - tracksinfo(pid); - } - } else { - if (!fullDerivedData) { - /* track not accepted */ - tracksinfo(pid); - } - } - } else { - if (!fullDerivedData) { - /* track collision not accepted */ - tracksinfo(pid); - } - } - } - LOGF(IDENTIFIEDBFFILTERLOGCOLLISIONS, - "Processed %d accepted collisions out of a total of %d with %d accepted tracks out of a " - "total of %d", - ncollaccepted, - collisions.size(), - naccepted, - tracks.size()); - } - - /* TODO: for the time being the full derived data is still not supported */ - /* for doing that we need to get the index of the associated mc collision */ - void filterParticles(soa::Join const& gencollisions, aod::McParticles const& particles) - { - using namespace identifiedbffilter; - int acceptedparticles = 0; - int acceptedcollisions = 0; - if (!fullDerivedData) { - gentracksinfo.reserve(particles.size()); - } - - for (const auto& gencoll : gencollisions) { - if (gencoll.collisionaccepted()) { - acceptedcollisions++; - } - } - - for (const auto& particle : particles) { - int8_t pid = -1; - if (particle.isPhysicalPrimary()) { - TParticlePDG* pdgpart = fPDG->GetParticle(particle.pdgCode()); - float charge = 0; - if (pdgpart != nullptr) { - charge = getCharge(pdgpart->Charge()); - // print charge - } - fhTrueCharge->Fill(charge); - if (charge != 0) { - if (particle.has_mcCollision() && (particle.template mcCollision_as>()).collisionaccepted()) { - auto mccollision = particle.template mcCollision_as>(); - /* before particle selection */ - fillParticleHistosBeforeSelection(particle, mccollision, charge); - - /* track selection */ - pid = acceptParticle(particle, mccollision); - if (!(pid < 0)) { // if PID isn't negative - acceptedparticles++; - } - } - } else { - if ((particle.mcCollisionId() == 0) && traceCollId0) { - LOGF(IDENTIFIEDBFFILTERLOGTRACKS, "Particle %d with fractional charge or equal to zero", particle.globalIndex()); - } - } - - } else { - if ((particle.mcCollisionId() == 0) && traceCollId0) { - LOGF(IDENTIFIEDBFFILTERLOGTRACKS, "Particle %d not Physical Primary", particle.globalIndex()); - } - } - if (!fullDerivedData) { - gentracksinfo(pid); - } - } - LOGF(info, - "Processed %d accepted generated collisions out of a total of %d with %d accepted particles out of a " - "total of %d", - acceptedcollisions, - gencollisions.size(), - acceptedparticles, - particles.size()); - } - - void filterRecoWithPID(soa::Join& collisions, IdBfFullTracksPID const& tracks) - { - filterTracks(collisions, tracks); - } - PROCESS_SWITCH(IdentifiedBfFilterTracks, filterRecoWithPID, "Not stored derived data track filtering", false) - - void filterRecoWithPIDAmbiguous(soa::Join& collisions, IdBfFullTracksPIDAmbiguous const& tracks) - { - filterTracks(collisions, tracks); - } - PROCESS_SWITCH(IdentifiedBfFilterTracks, filterRecoWithPIDAmbiguous, "Not stored derived data track filtering with ambiguous tracks check", false) - - void filterDetectorLevelWithPID(soa::Join& collisions, IdBfFullTracksPIDDetLevel const& tracks, aod::McParticles const&) - { - filterTracks(collisions, tracks); - } - PROCESS_SWITCH(IdentifiedBfFilterTracks, filterDetectorLevelWithPID, "Not stored derived data detector level track filtering", false) - - void filterDetectorLevelWithPIDAmbiguous(soa::Join& collisions, IdBfFullTracksPIDDetLevelAmbiguous const& tracks, aod::McParticles const&) - { - filterTracks(collisions, tracks); - } - PROCESS_SWITCH(IdentifiedBfFilterTracks, filterDetectorLevelWithPIDAmbiguous, "Not stored derived data detector level track filtering with ambiguous tracks check", false) - - void filterRecoWithFullPID(soa::Join& collisions, IdBfFullTracksFullPID const& tracks, aod::McParticles const&) - { - filterTracks(collisions, tracks); - } - PROCESS_SWITCH(IdentifiedBfFilterTracks, filterRecoWithFullPID, "Not stored derived data track filtering", false) - - void filterRecoWithFullPIDAmbiguous(soa::Join& collisions, IdBfFullTracksFullPIDAmbiguous const& tracks) - { - filterTracks(collisions, tracks); - } - PROCESS_SWITCH(IdentifiedBfFilterTracks, filterRecoWithFullPIDAmbiguous, "Not stored derived data track filtering with ambiguous tracks check", false) - - void filterDetectorLevelWithFullPID(soa::Join& collisions, IdBfFullTracksFullPIDDetLevel const& tracks, aod::McParticles const&) - { - filterTracks(collisions, tracks); - } - PROCESS_SWITCH(IdentifiedBfFilterTracks, filterDetectorLevelWithFullPID, "Not stored derived data detector level track filtering", false) - - void filterDetectorLevelWithFullPIDAmbiguous(soa::Join& collisions, IdBfFullTracksFullPIDDetLevelAmbiguous const& tracks, aod::McParticles const&) - { - filterTracks(collisions, tracks); - } - PROCESS_SWITCH(IdentifiedBfFilterTracks, filterDetectorLevelWithFullPIDAmbiguous, "Not stored derived data detector level track filtering with ambiguous tracks check", false) - - void filterRecoWithoutPID(soa::Join const& collisions, IdBfFullTracks const& tracks) - { - filterTracks(collisions, tracks); - } - PROCESS_SWITCH(IdentifiedBfFilterTracks, filterRecoWithoutPID, "Track filtering without PID information", true) - - void filterRecoWithoutPIDAmbiguous(soa::Join const& collisions, IdBfFullTracksAmbiguous const& tracks) - { - filterTracks(collisions, tracks); - } - PROCESS_SWITCH(IdentifiedBfFilterTracks, filterRecoWithoutPIDAmbiguous, "Track filtering without PID information with ambiguous tracks check", false) - - void filterDetectorLevelWithoutPID(soa::Join const& collisions, IdBfFullTracksDetLevel const& tracks, aod::McParticles const&) - { - filterTracks(collisions, tracks); - } - PROCESS_SWITCH(IdentifiedBfFilterTracks, filterDetectorLevelWithoutPID, "Detector level track filtering without PID information", false) - - void filterDetectorLevelWithoutPIDAmbiguous(soa::Join const& collisions, IdBfFullTracksDetLevelAmbiguous const& tracks, aod::McParticles const&) - { - filterTracks(collisions, tracks); - } - PROCESS_SWITCH(IdentifiedBfFilterTracks, filterDetectorLevelWithoutPIDAmbiguous, "Detector level track filtering without PID information with ambiguous tracks check", false) - - void filterGenerated(soa::Join const& gencollisions, aod::McParticles const& particles) - { - filterParticles(gencollisions, particles); - } - PROCESS_SWITCH(IdentifiedBfFilterTracks, filterGenerated, "Generated particles filtering", true) -}; - -template -inline MatchRecoGenSpecies IdentifiedBfFilterTracks::identifyParticle(ParticleObject const& particle) -{ - using namespace identifiedbffilter; - // LOGF(info, "Top of identifyParticle"); - - int pdgcode = std::fabs(particle.pdgCode()); - - switch (pdgcode) { - case kPositron: - return kIdBfElectron; - break; - - case kPiPlus: - return kIdBfPion; - break; - case kKPlus: - return kIdBfKaon; - break; - case kProton: - return kIdBfProton; - break; - - default: - if (traceOutOfSpeciesParticles) { - LOGF(info, "Wrong particle passed selection cuts. PDG code: %d", pdgcode); - } - return kWrongSpecies; - break; - } -} - -template -inline void IdentifiedBfFilterTracks::identifyPIDMismatch(ParticleObject const& particle, MatchRecoGenSpecies const& trkId) -{ - MatchRecoGenSpecies realPID = identifyParticle(particle); - if (!(realPID < 0)) { - if (realPID == trkId) { - fhTruePIDCorrect->Fill(realPID); - } else { - fhTruePIDMismatch->Fill(realPID, trkId); - } - } -} - -template -inline void IdentifiedBfFilterTracks::identifyRealNSigma(ParticleObject const& particle, std::vector tpcNSigma, std::vector tofNSigma, float tpcInnerParam) -{ - - MatchRecoGenSpecies realPID = identifyParticle(particle); - if (!(realPID < 0)) { - fhTrueNSigmaTPC[kIdBfElectron][realPID]->Fill(tpcNSigma[kIdBfElectron], tpcInnerParam); - fhTrueNSigmaTOF[kIdBfElectron][realPID]->Fill(tofNSigma[kIdBfElectron], tpcInnerParam); - fhTrueNSigmaTPC[kIdBfPion][realPID]->Fill(tpcNSigma[kIdBfPion], tpcInnerParam); - fhTrueNSigmaTOF[kIdBfPion][realPID]->Fill(tofNSigma[kIdBfPion], tpcInnerParam); - fhTrueNSigmaTPC[kIdBfKaon][realPID]->Fill(tpcNSigma[kIdBfKaon], tpcInnerParam); - fhTrueNSigmaTOF[kIdBfKaon][realPID]->Fill(tofNSigma[kIdBfKaon], tpcInnerParam); - fhTrueNSigmaTPC[kIdBfProton][realPID]->Fill(tpcNSigma[kIdBfProton], tpcInnerParam); - fhTrueNSigmaTOF[kIdBfProton][realPID]->Fill(tofNSigma[kIdBfProton], tpcInnerParam); - - if (particle.isPhysicalPrimary()) { - fhPrimaryNSigmaTPC[kIdBfElectron][realPID]->Fill(tpcNSigma[kIdBfElectron], tpcInnerParam); - fhPrimaryNSigmaTOF[kIdBfElectron][realPID]->Fill(tofNSigma[kIdBfElectron], tpcInnerParam); - fhPrimaryNSigmaTPC[kIdBfPion][realPID]->Fill(tpcNSigma[kIdBfPion], tpcInnerParam); - fhPrimaryNSigmaTOF[kIdBfPion][realPID]->Fill(tofNSigma[kIdBfPion], tpcInnerParam); - fhPrimaryNSigmaTPC[kIdBfKaon][realPID]->Fill(tpcNSigma[kIdBfKaon], tpcInnerParam); - fhPrimaryNSigmaTOF[kIdBfKaon][realPID]->Fill(tofNSigma[kIdBfKaon], tpcInnerParam); - fhPrimaryNSigmaTPC[kIdBfProton][realPID]->Fill(tpcNSigma[kIdBfProton], tpcInnerParam); - fhPrimaryNSigmaTOF[kIdBfProton][realPID]->Fill(tofNSigma[kIdBfProton], tpcInnerParam); - } - } -} - -template -void fillNSigmaHistos(TrackObject const& track) -{ - - float actualTPCNSigma[kIdBfNoOfSpecies]; - - actualTPCNSigma[kIdBfElectron] = track.tpcNSigmaEl(); - actualTPCNSigma[kIdBfPion] = track.tpcNSigmaPi(); - actualTPCNSigma[kIdBfKaon] = track.tpcNSigmaKa(); - actualTPCNSigma[kIdBfProton] = track.tpcNSigmaPr(); - - float actualTOFNSigma[kIdBfNoOfSpecies]; - - actualTOFNSigma[kIdBfElectron] = track.tofNSigmaEl(); - actualTOFNSigma[kIdBfPion] = track.tofNSigmaPi(); - actualTOFNSigma[kIdBfKaon] = track.tofNSigmaKa(); - actualTOFNSigma[kIdBfProton] = track.tofNSigmaPr(); - - if (loadfromccdb) { - actualTPCNSigma[kIdBfElectron] = actualTPCNSigma[kIdBfElectron] - fhNSigmaCorrection[kIdBfElectron]->GetBinContent(fhNSigmaCorrection[kIdBfElectron]->FindBin(track.tpcInnerParam())); - actualTPCNSigma[kIdBfPion] = actualTPCNSigma[kIdBfPion] - fhNSigmaCorrection[kIdBfPion]->GetBinContent(fhNSigmaCorrection[kIdBfPion]->FindBin(track.tpcInnerParam())); - actualTPCNSigma[kIdBfKaon] = actualTPCNSigma[kIdBfKaon] - fhNSigmaCorrection[kIdBfKaon]->GetBinContent(fhNSigmaCorrection[kIdBfKaon]->FindBin(track.tpcInnerParam())); - actualTPCNSigma[kIdBfProton] = actualTPCNSigma[kIdBfProton] - fhNSigmaCorrection[kIdBfProton]->GetBinContent(fhNSigmaCorrection[kIdBfProton]->FindBin(track.tpcInnerParam())); - } - - fhNSigmaTPC[kIdBfElectron]->Fill(actualTPCNSigma[kIdBfElectron], track.tpcInnerParam()); - fhNSigmaTPC[kIdBfPion]->Fill(actualTPCNSigma[kIdBfPion], track.tpcInnerParam()); - fhNSigmaTPC[kIdBfKaon]->Fill(actualTPCNSigma[kIdBfKaon], track.tpcInnerParam()); - fhNSigmaTPC[kIdBfProton]->Fill(actualTPCNSigma[kIdBfProton], track.tpcInnerParam()); - - fhNSigmaTOF[kIdBfElectron]->Fill(actualTOFNSigma[kIdBfElectron], track.tpcInnerParam()); - fhNSigmaTOF[kIdBfPion]->Fill(actualTOFNSigma[kIdBfPion], track.tpcInnerParam()); - fhNSigmaTOF[kIdBfKaon]->Fill(actualTOFNSigma[kIdBfKaon], track.tpcInnerParam()); - fhNSigmaTOF[kIdBfProton]->Fill(actualTOFNSigma[kIdBfProton], track.tpcInnerParam()); - - fhNSigmaCombo[kIdBfElectron]->Fill(sqrtf(actualTOFNSigma[kIdBfElectron] * actualTOFNSigma[kIdBfElectron] + actualTPCNSigma[kIdBfElectron] * actualTPCNSigma[kIdBfElectron]), track.tpcInnerParam()); - fhNSigmaCombo[kIdBfPion]->Fill(sqrtf(actualTOFNSigma[kIdBfPion] * actualTOFNSigma[kIdBfPion] + actualTPCNSigma[kIdBfPion] * actualTPCNSigma[kIdBfPion]), track.tpcInnerParam()); - fhNSigmaCombo[kIdBfKaon]->Fill(sqrtf(actualTOFNSigma[kIdBfKaon] * actualTOFNSigma[kIdBfKaon] + actualTPCNSigma[kIdBfKaon] * actualTPCNSigma[kIdBfKaon]), track.tpcInnerParam()); - fhNSigmaCombo[kIdBfProton]->Fill(sqrtf(actualTOFNSigma[kIdBfProton] * actualTOFNSigma[kIdBfProton] + actualTPCNSigma[kIdBfProton] * actualTPCNSigma[kIdBfProton]), track.tpcInnerParam()); -} - -/// \brief Identifies the passed track with TPC and TOF data -/// \param track the track of interest -/// \return the internal track id, -1 if not accepted - -template -inline MatchRecoGenSpecies IdentifiedBfFilterTracks::identifyTrack(TrackObject const& track) -{ - using namespace o2::analysis::identifiedbffilter; - - fillNSigmaHistos(track); - - std::vector actualTPCNSigma(kIdBfNoOfSpecies, 0.); - - actualTPCNSigma[kIdBfElectron] = track.tpcNSigmaEl(); - actualTPCNSigma[kIdBfPion] = track.tpcNSigmaPi(); - actualTPCNSigma[kIdBfKaon] = track.tpcNSigmaKa(); - actualTPCNSigma[kIdBfProton] = track.tpcNSigmaPr(); - - std::vector actualTOFNSigma(kIdBfNoOfSpecies, 0.); - - actualTOFNSigma[kIdBfElectron] = track.tofNSigmaEl(); - actualTOFNSigma[kIdBfPion] = track.tofNSigmaPi(); - actualTOFNSigma[kIdBfKaon] = track.tofNSigmaKa(); - actualTOFNSigma[kIdBfProton] = track.tofNSigmaPr(); - - float nsigmas[kIdBfNoOfSpecies]; - - if constexpr (framework::has_type_v) { - if (makeNSigmaPlots) { - identifyRealNSigma(track.template mcParticle_as(), actualTPCNSigma, actualTOFNSigma, track.tpcInnerParam()); - } - } - - if (loadfromccdb) { - for (int iSp = 0; iSp < kIdBfNoOfSpecies; iSp++) { - actualTPCNSigma[iSp] = actualTPCNSigma[iSp] - fhNSigmaCorrection[iSp]->GetBinContent(fhNSigmaCorrection[iSp]->FindBin(track.tpcInnerParam())); - } - } - - for (int iSp = 0; iSp < kIdBfNoOfSpecies; iSp++) { - - if (track.tpcInnerParam() < tofCut[iSp] && track.tpcInnerParam() < tpcCut[iSp] && !onlyTOF) { - nsigmas[iSp] = actualTPCNSigma[iSp]; - } else if (track.tpcInnerParam() > tofCut[iSp] && track.tpcInnerParam() < tpcCut[iSp] && !onlyTOF && track.hasTOF()) { - nsigmas[iSp] = sqrtf(actualTPCNSigma[iSp] * actualTPCNSigma[iSp] + actualTOFNSigma[iSp] * actualTOFNSigma[iSp]); - } else if (track.hasTOF() && ((track.tpcInnerParam() > tofCut[iSp] && track.tpcInnerParam() > tpcCut[iSp]) || onlyTOF)) { - nsigmas[iSp] = actualTOFNSigma[iSp]; - } else { - return kWrongSpecies; - } - } - - float minNSigma = 999.0f; - MatchRecoGenSpecies spMinNSigma = kWrongSpecies; - for (int sp = 0; sp < kIdBfNoOfSpecies; ++sp) { - if (doPID[sp]) { // Check if we're IDing PID for this species - if (std::fabs(nsigmas[sp]) < std::fabs(minNSigma)) { // Check if species nsigma is less than current nsigma - minNSigma = nsigmas[sp]; // If yes, set species nsigma to current nsigma - spMinNSigma = MatchRecoGenSpecies(sp); // set current species sp number to current sp - } - } - } - bool doublematch = false; - MatchRecoGenSpecies spDouble = kWrongSpecies; - // LOGF(info,"Looking at accept range"); - if (minNSigma < acceptRange[spMinNSigma][1] && minNSigma > acceptRange[spMinNSigma][0]) { // Check that current nsigma is in accpetance range - // LOGF(info,"In accept Range"); - for (int sp = 0; (sp < kIdBfNoOfSpecies) && !doublematch; ++sp) { // iterate over all species while there's no double match and we're in the list - if (sp != spMinNSigma) { // for species not current minimum nsigma species - // LOGF(info, "looking at Reject Range"); - if (std::fabs(nsigmas[sp]) < rejectRange[spMinNSigma][sp]) { // If secondary species is in rejection range - doublematch = true; // Set double match true - spDouble = MatchRecoGenSpecies(sp); - } - } - } - if (doublematch) { // if double match true - fhWrongTrackID->Fill(track.p()); - fhdEdxA[kIdBfNoOfSpecies]->Fill(track.p(), track.tpcSignal()); - fhdEdxIPTPCA[kIdBfNoOfSpecies]->Fill(track.tpcInnerParam(), track.tpcSignal()); - fhTrackLengthA[kIdBfNoOfSpecies]->Fill(track.length()); - fhTrackTimeA[kIdBfNoOfSpecies]->Fill(track.p(), (track.trackTime())); - fhTrackTimeIPA[kIdBfNoOfSpecies]->Fill(track.tpcInnerParam(), (track.trackTime())); - - if constexpr (framework::has_type_v) { - fhTrackBetaInvA[kIdBfNoOfSpecies]->Fill(track.p(), 1 / track.beta()); - fhTrackBetaInvIPA[kIdBfNoOfSpecies]->Fill(track.tpcInnerParam(), 1 / track.beta()); - } - fhDoublePID->Fill(spMinNSigma, spDouble); - return kWrongSpecies; // Return wrong species value - } else { - fhNSigmaTPCIdTrks[spMinNSigma]->Fill(actualTPCNSigma[spMinNSigma], track.tpcInnerParam()); - - if constexpr (framework::has_type_v) { - identifyPIDMismatch(track.template mcParticle_as(), spMinNSigma); - } - return spMinNSigma; - } - } else { - return kWrongSpecies; - } -} - -/// \brief Accepts or not the passed track -/// \param track the track of interest -/// \return the internal track id, -1 if not accepted - -template -inline int8_t IdentifiedBfFilterTracks::acceptTrack(TrackObject const& track) -{ - // LOGF(info,"Top of acceptTrack"); - fillTrackHistosBeforeSelection(track); // ) { - if (track.mcParticleId() < 0) { - // LOGF(info,"No matching MC particle"); - return -1; - } - } - - if (matchTrackType(track)) { - // LOGF(info, "Track type match"); - if (ptlow < track.pt() && track.pt() < ptup && etalow < track.eta() && track.eta() < etaup) { - // LOGF(info, "Track Accepted"); - fillTrackHistosAfterSelection(track, kIdBfCharged); - MatchRecoGenSpecies sp = kWrongSpecies; - if (recoIdMethod == recoIdMethods[0]) { - sp = kIdBfCharged; - } else if (recoIdMethod == recoIdMethods[1]) { - if constexpr (framework::has_type_v || framework::has_type_v) { - sp = identifyTrack(track); - } else { - LOGF(fatal, "Track identification required but PID information not present"); - } - } else if (recoIdMethod == recoIdMethods[2]) { - if constexpr (framework::has_type_v) { - sp = identifyParticle(track.template mcParticle_as()); - } else { - LOGF(fatal, "Track identification required from MC particle but MC information not present"); - } - } - if (sp == kWrongSpecies) { - return -1; - } - if (!(sp < 0)) { - fillTrackHistosAfterSelection(track, sp); // 0) { // if positive - trkMultPos[sp]++; //<< Update Particle Multiplicity - return speciesChargeValue1[sp]; - } - if (track.sign() < 0) { // if negative - trkMultNeg[sp]++; //<< Update Particle Multiplicity - return speciesChargeValue1[sp] + 1; - } - } - } - } - return -1; -} - -/// \brief Accepts or not the passed generated particle -/// \param track the particle of interest -/// \return `true` if the particle is accepted, `false` otherwise -template -inline int8_t IdentifiedBfFilterTracks::acceptParticle(ParticleObject& particle, MCCollisionObject const& mccollision) -{ - /* overall momentum cut */ - if (!(overallminp < particle.p())) { - return kWrongSpecies; - } - TParticlePDG* pdgpart = fPDG->GetParticle(particle.pdgCode()); - float charge = 0; - if (pdgpart != nullptr) { - charge = getCharge(pdgpart->Charge()); - } - if ((particle.flags() & 0x8) != 0x8) { - if (particle.isPhysicalPrimary() && std::fabs(charge) > 0.0) { - if ((particle.mcCollisionId() == 0) && traceCollId0) { - LOGF(info, "Particle %d passed isPhysicalPrimary", particle.globalIndex()); - } - - if (ptlow < particle.pt() && particle.pt() < ptup && etalow < particle.eta() && particle.eta() < etaup) { - MatchRecoGenSpecies sp = kWrongSpecies; - if (recoIdMethod == recoIdMethods[0]) { - sp = kIdBfCharged; - } - if (recoIdMethod == recoIdMethods[1] || recoIdMethod == recoIdMethods[2]) { - sp = identifyParticle(particle); - } - - if (sp != kWrongSpecies) { - if (sp != kIdBfCharged) { - /* fill the charged particle histograms */ - fillParticleHistosAfterSelection(particle, mccollision, charge, kIdBfCharged); - /* update charged multiplicities */ - if (charge == 1) { - partMultPos[kIdBfCharged]++; - } else if (charge == -1) { - partMultNeg[kIdBfCharged]++; - } - } - /* fill the species histograms */ - fillParticleHistosAfterSelection(particle, mccollision, charge, sp); - /* update species multiplicities */ - if (charge == 1) { - partMultPos[sp]++; - } else if (charge == -1) { - partMultNeg[sp]++; - } - } - if (charge == 1) { - return speciesChargeValue1[sp]; - - } else if (charge == -1) { - return speciesChargeValue1[sp] + 1; - } - } - } else { - if ((particle.mcCollisionId() == 0) && traceCollId0) { - LOGF(info, "Particle %d NOT passed isPhysicalPrimary", particle.globalIndex()); - } - } - } else { - if ((particle.mcCollisionId() == 0) && traceCollId0) { - LOGF(info, "Particle %d Out of Bunch Pileup", particle.globalIndex()); - } - } - return kWrongSpecies; -} - -template -int8_t IdentifiedBfFilterTracks::selectTrackAmbiguousCheck(CollisionObjects const& collisions, TrackObject const& track) -{ - // LOGF(info,"Top of AmbiguousCheck"); - bool ambiguoustrack = false; - int tracktype = 0; /* no ambiguous */ - std::vector zvertexes{}; - /* ambiguous tracks checks if required */ - if constexpr (has_type_v) { - if (track.compatibleCollIds().size() > 0) { - if (track.compatibleCollIds().size() == 1) { - if (track.collisionId() != track.compatibleCollIds()[0]) { - /* ambiguous track! */ - ambiguoustrack = true; - /* in principle we should not be here because the track is associated to two collisions at least */ - tracktype = 2; - zvertexes.push_back(collisions.iteratorAt(track.collisionId()).posZ()); - zvertexes.push_back(collisions.iteratorAt(track.compatibleCollIds()[0]).posZ()); - } else { - /* we consider the track as no ambiguous */ - tracktype = 1; - } - } else { - /* ambiguous track! */ - ambiguoustrack = true; - tracktype = 3; - /* the track is associated to more than one collision */ - for (const auto& collIdx : track.compatibleCollIds()) { - zvertexes.push_back(collisions.iteratorAt(collIdx).posZ()); - } - } - } - } - - float multiplicityclass = (track.template collision_as>()).centmult(); - if (ambiguoustrack) { - /* keep track of ambiguous tracks */ - fhAmbiguousTrackType->Fill(tracktype, multiplicityclass); - fhAmbiguousTrackPt->Fill(track.pt(), multiplicityclass); - fhAmbiguityDegree->Fill(zvertexes.size(), multiplicityclass); - if (tracktype == trackTypes[2]) { - fhCompatibleCollisionsZVtxRms->Fill(-computeRMS(zvertexes), multiplicityclass); - } else { - fhCompatibleCollisionsZVtxRms->Fill(computeRMS(zvertexes), multiplicityclass); - } - return -1; - } else { - if (checkAmbiguousTracks) { - /* feedback of no ambiguous tracks only if checks required */ - fhAmbiguousTrackType->Fill(tracktype, multiplicityclass); - } - return acceptTrack(track); - } -} - -template -void IdentifiedBfFilterTracks::fillTrackHistosBeforeSelection(TrackObject const& track) -{ - fhXYB->Fill(track.x(), track.y()); - fhYZB->Fill(track.y(), track.z()); - fhNClustersB->Fill(track.tpcNClsFound()); - fhPhiYB->Fill(track.phi(), track.eta()); - fhPtYB->Fill(track.pt(), track.eta()); - fhChi2B->Fill(track.tpcChi2NCl()); - fhITSNclB->Fill(track.itsNCls()); - - fhPB->Fill(track.p()); - fhPtB->Fill(track.pt()); - fhEtaB->Fill(track.eta()); - fhPhiB->Fill(track.phi()); - fhdEdxB->Fill(track.p(), track.tpcSignal()); - fhdEdxIPTPCB->Fill(track.tpcInnerParam(), track.tpcSignal()); - if (track.sign() > 0) { - fhPtPosB->Fill(track.pt()); - } else { - fhPtNegB->Fill(track.pt()); - } - fhDCAxyB->Fill(track.dcaXY()); - fhDCAzB->Fill(track.dcaZ()); - fhDCAxyzB->Fill(track.dcaXY(), track.dcaZ()); - - if constexpr (framework::has_type_v) { - - if (isPrimary(track.template mcParticle_as())) { - fhPrimaryPB->Fill(track.p()); - fhPrimaryPtB->Fill(track.pt()); - fhPrimarydEdxB->Fill(track.p(), track.tpcSignal()); - fhPrimarydEdxIPTPCB->Fill(track.tpcInnerParam(), track.tpcSignal()); - fhPrimaryTrackLengthB->Fill(track.length()); - if (track.hasTOF() && track.p() > tofCut[0]) { - fhPrimaryTrackLengthTOFB->Fill(track.length()); - fhPrimaryTrackTimeB->Fill(track.p(), (track.trackTime())); - fhPrimaryTrackTimeIPB->Fill(track.tpcInnerParam(), (track.trackTime())); - - if constexpr (framework::has_type_v) { - fhPrimaryTrackBetaInvB->Fill(track.p(), 1 / track.beta()); - fhPrimaryTrackBetaInvIPB->Fill(track.tpcInnerParam(), 1 / track.beta()); - } - } - } - } -} -template -bool IdentifiedBfFilterTracks::isPrimary(ParticleObject const& particle) -{ - return particle.isPhysicalPrimary(); -} -template -void IdentifiedBfFilterTracks::fillRealPIDTrackHistosAfter(TrackObject const& track, MatchRecoGenSpecies sp) -{ - - if constexpr (framework::has_type_v) { - MatchRecoGenSpecies realPID = identifyParticle(track.template mcParticle_as()); - if (!(realPID < 0)) { - fhTruedEdxA[realPID]->Fill(track.p(), track.tpcSignal()); - fhTruedEdxIPTPCA[realPID]->Fill(track.tpcInnerParam(), track.tpcSignal()); - fhTrueTrackLengthA[realPID]->Fill(track.length()); - if (track.hasTOF() && track.p() > tofCut[realPID]) { - fhTrueTrackLengthTOFA[realPID]->Fill(track.length()); - fhTrueTrackTimeA[realPID]->Fill(track.p(), (track.trackTime())); - fhTrueTrackTimeIPA[realPID]->Fill(track.tpcInnerParam(), (track.trackTime())); - if constexpr (framework::has_type_v) { - fhTrueTrackBetaInvA[realPID]->Fill(track.p(), 1 / track.beta()); - fhTrueTrackBetaInvIPA[realPID]->Fill(track.tpcInnerParam(), 1 / track.beta()); - } - } - } - - if (isPrimary(track.template mcParticle_as())) { - fhPrimaryPA[sp]->Fill(track.p()); - fhPrimaryPtA[sp]->Fill(track.pt()); - fhPrimarydEdxA[sp]->Fill(track.p(), track.tpcSignal()); - fhPrimarydEdxIPTPCA[sp]->Fill(track.tpcInnerParam(), track.tpcSignal()); - fhPrimaryTrackLengthA[sp]->Fill(track.length()); - if (track.hasTOF() && track.p() > tofCut[sp]) { - fhPrimaryTrackLengthTOFA[sp]->Fill(track.length()); - fhPrimaryTrackTimeA[sp]->Fill(track.p(), (track.trackTime())); - fhPrimaryTrackTimeIPA[sp]->Fill(track.tpcInnerParam(), (track.trackTime())); - - if constexpr (framework::has_type_v) { - fhPrimaryTrackBetaInvA[sp]->Fill(track.p(), 1 / track.beta()); - fhPrimaryTrackBetaInvIPA[sp]->Fill(track.tpcInnerParam(), 1 / track.beta()); - } - } - - if (sp == realPID) { - fhPurePA[realPID]->Fill(track.p()); - fhPurePtA[realPID]->Fill(track.pt()); - fhPuredEdxA[realPID]->Fill(track.p(), track.tpcSignal()); - fhPuredEdxIPTPCA[realPID]->Fill(track.tpcInnerParam(), track.tpcSignal()); - fhPureTrackLengthA[realPID]->Fill(track.length()); - if (track.hasTOF() && track.p() > tofCut[realPID]) { - fhPureTrackLengthTOFA[realPID]->Fill(track.length()); - fhPureTrackTimeA[realPID]->Fill(track.p(), (track.trackTime())); - fhPureTrackTimeIPA[realPID]->Fill(track.tpcInnerParam(), (track.trackTime())); - - if constexpr (framework::has_type_v) { - fhPureTrackBetaInvA[realPID]->Fill(track.p(), 1 / track.beta()); - fhPureTrackBetaInvIPA[realPID]->Fill(track.tpcInnerParam(), 1 / track.beta()); - } - } - } - } - } -} -template -void IdentifiedBfFilterTracks::fillTrackHistosAfterSelection(TrackObject const& track, MatchRecoGenSpecies sp) -{ - /* the charged species should have been called first so avoid double counting */ - // LOGF(info,"Top of AfterSelection"); - if (sp == kIdBfCharged) { - fhEtaA->Fill(track.eta()); - fhPhiA->Fill(track.phi()); - fhXYA->Fill(track.x(), track.y()); - fhYZA->Fill(track.y(), track.z()); - fhNClustersA->Fill(track.tpcNClsFound()); - fhPhiYA->Fill(track.phi(), track.eta()); - fhPtYA->Fill(track.pt(), track.eta()); - fhChi2A->Fill(track.tpcChi2NCl()); - fhITSNclA->Fill(track.itsNCls()); - fhDCAxyA->Fill(track.dcaXY()); - fhDCAzA->Fill(track.dcaZ()); - fhDCAxyzA->Fill(track.dcaXY(), track.dcaZ()); - - if (track.dcaXY() < 1.0) { - fhFineDCAxyA->Fill(track.dcaXY()); - } - if (track.dcaZ() < 1.0) { - fhFineDCAzA->Fill(track.dcaZ()); - } - } - fhPA[sp]->Fill(track.p()); - fhPtA[sp]->Fill(track.pt()); - fhdEdxA[sp]->Fill(track.p(), track.tpcSignal()); - fhdEdxIPTPCA[sp]->Fill(track.tpcInnerParam(), track.tpcSignal()); - fhTrackLengthA[sp]->Fill(track.length()); - if (track.hasTOF() && track.p() > tofCut[sp]) { - fhTrackLengthTOFA[sp]->Fill(track.length()); - fhTrackTimeA[sp]->Fill(track.p(), (track.trackTime())); - fhTrackTimeIPA[sp]->Fill(track.tpcInnerParam(), (track.trackTime())); - - if constexpr (framework::has_type_v) { - fhTrackBetaInvA[sp]->Fill(track.p(), 1 / track.beta()); - fhTrackBetaInvIPA[sp]->Fill(track.tpcInnerParam(), 1 / track.beta()); - } - } - if (track.sign() > 0) { - fhPtPosA[sp]->Fill(track.pt()); - fhPtEtaPosA[sp]->Fill(track.pt(), track.eta()); - } else { - fhPtNegA[sp]->Fill(track.pt()); - fhPtEtaNegA[sp]->Fill(track.pt(), track.eta()); - } - if ((fDataType != kData) && (fDataType != kDataNoEvtSel)) { - fillRealPIDTrackHistosAfter(track, sp); - } -} - -template -void IdentifiedBfFilterTracks::fillParticleHistosBeforeSelection(ParticleObject const& particle, MCCollisionObject const& collision, float charge) -{ - fhTruePhiYB->Fill(particle.phi(), particle.eta()); - fhTruePtYB->Fill(particle.pt(), particle.eta()); - fhTruePB->Fill(particle.p()); - fhTruePtB->Fill(particle.pt()); - fhTrueEtaB->Fill(particle.eta()); - fhTruePhiB->Fill(particle.phi()); - if (charge > 0) { - fhTruePtPosB->Fill(particle.pt()); - } else if (charge < 0) { - fhTruePtNegB->Fill(particle.pt()); - } - - float dcaxy = std::sqrt((particle.vx() - collision.posX()) * (particle.vx() - collision.posX()) + - (particle.vy() - collision.posY()) * (particle.vy() - collision.posY())); - if (traceDCAOutliers.mDoIt && (traceDCAOutliers.mLowValue < dcaxy) && (dcaxy < traceDCAOutliers.mUpValue)) { - fhTrueDCAxyBid->Fill(TString::Format("%d", particle.pdgCode()).Data(), 1.0); - } - - fhTrueDCAxyB->Fill(std::sqrt((particle.vx() - collision.posX()) * (particle.vx() - collision.posX()) + - (particle.vy() - collision.posY()) * (particle.vy() - collision.posY()))); - fhTrueDCAxyzB->Fill(std::sqrt((particle.vx() - collision.posX()) * (particle.vx() - collision.posX()) + - (particle.vy() - collision.posY()) * (particle.vy() - collision.posY())), - (particle.vz() - collision.posZ())); - fhTrueDCAzB->Fill((particle.vz() - collision.posZ())); -} - -template -void IdentifiedBfFilterTracks::fillParticleHistosAfterSelection(ParticleObject const& particle, MCCollisionObject const& collision, float charge, MatchRecoGenSpecies sp) -{ - /* the charged species should have been called first so avoid double counting */ - if (sp == kIdBfCharged) { - fhTruePhiYA->Fill(particle.phi(), particle.eta()); - fhTruePtYA->Fill(particle.pt(), particle.eta()); - fhTrueEtaA->Fill(particle.eta()); - fhTruePhiA->Fill(particle.phi()); - float dcaxy = std::sqrt((particle.vx() - collision.posX()) * (particle.vx() - collision.posX()) + - (particle.vy() - collision.posY()) * (particle.vy() - collision.posY())); - if (traceDCAOutliers.mDoIt && (traceDCAOutliers.mLowValue < dcaxy) && (dcaxy < traceDCAOutliers.mUpValue)) { - LOGF(info, "DCAxy outlier: Particle with index %d and pdg code %d assigned to MC collision %d, pT: %f, phi: %f, eta: %f", - particle.globalIndex(), particle.pdgCode(), particle.mcCollisionId(), particle.pt(), particle.phi(), particle.eta()); - LOGF(info, " With status %d and flags %0X", particle.statusCode(), particle.flags()); - } - - fhTrueDCAxyA->Fill(std::sqrt((particle.vx() - collision.posX()) * (particle.vx() - collision.posX()) + - (particle.vy() - collision.posY()) * (particle.vy() - collision.posY()))); - fhTrueDCAzA->Fill((particle.vz() - collision.posZ())); - fhTrueDCAxyzA->Fill(std::sqrt((particle.vx() - collision.posX()) * (particle.vx() - collision.posX()) + - (particle.vy() - collision.posY()) * (particle.vy() - collision.posY())), - (particle.vz() - collision.posZ())); - } - fhTruePA[sp]->Fill(particle.p()); - fhTruePtA[sp]->Fill(particle.pt()); - if (charge > 0) { - fhTruePtPosA[sp]->Fill(particle.pt()); - fhTruePtEtaPosA[sp]->Fill(particle.pt(), particle.eta()); - } else { - fhTruePtNegA[sp]->Fill(particle.pt()); - fhTruePtEtaNegA[sp]->Fill(particle.pt(), particle.eta()); - } -} -WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) -{ - WorkflowSpec workflow{adaptAnalysisTask(cfgc, - SetDefaultProcesses{ - {{"processWithoutCent", true}, - {"processWithoutCentGeneratorLevel", true}}}), - adaptAnalysisTask(cfgc)}; - return workflow; -} diff --git a/PWGCF/TwoParticleCorrelations/TableProducer/identifiedBfFilter.h b/PWGCF/TwoParticleCorrelations/TableProducer/identifiedBfFilter.h deleted file mode 100644 index 7335b36c421..00000000000 --- a/PWGCF/TwoParticleCorrelations/TableProducer/identifiedBfFilter.h +++ /dev/null @@ -1,775 +0,0 @@ -// Copyright 2019-2020 CERN and copyright holders of ALICE O2. -// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. -// All rights not expressly granted are reserved. -// -// This software is distributed under the terms of the GNU General Public -// License v3 (GPL Version 3), copied verbatim in the file "COPYING". -// -// In applying this license CERN does not waive the privileges and immunities -// granted to it by virtue of its status as an Intergovernmental Organization -// or submit itself to any jurisdiction. - -/// \file identifiedBfFilter.h -/// \brief Filters collisions and tracks according to selection criteria -/// \author bghanley1995@gmail.com - -#ifndef PWGCF_TWOPARTICLECORRELATIONS_TABLEPRODUCER_IDENTIFIEDBFFILTER_H_ -#define PWGCF_TWOPARTICLECORRELATIONS_TABLEPRODUCER_IDENTIFIEDBFFILTER_H_ - -#include - -#include -#include - -#include "Framework/AnalysisTask.h" -#include "Framework/AnalysisDataModel.h" -#include "Framework/runDataProcessing.h" -#include "Framework/O2DatabasePDGPlugin.h" -#include "Common/DataModel/EventSelection.h" -#include "Common/DataModel/Multiplicity.h" -#include "Common/DataModel/Centrality.h" -#include "Common/DataModel/TrackSelectionTables.h" -#include "Common/Core/TrackSelection.h" -#include "Common/Core/TrackSelectionDefaults.h" -#include "PWGCF/Core/AnalysisConfigurableCuts.h" -#include "MathUtils/Utils.h" - -namespace o2 - -{ -namespace aod -{ -using CollisionsEvSelCent = soa::Join; -using CollisionEvSelCent = soa::Join::iterator; -using CollisionsEvSelRun2Cent = soa::Join; -using CollisionEvSelRun2Cent = soa::Join::iterator; -using CollisionsEvSel = soa::Join; -using CollisionEvSel = soa::Join::iterator; -using TrackData = soa::Join::iterator; -} // namespace aod -namespace analysis -{ -namespace identifiedbffilter -{ - -const std::vector pdgcodes = {11, 211, 321, 2212}; - -/// \enum MatchRecoGenSpecies -/// \brief The species considered by the matching test -enum MatchRecoGenSpecies { - kIdBfElectron = 0, ///< electron - kIdBfPion, ///< pion - kIdBfKaon, ///< kaon - kIdBfProton, ///< proton - kIdBfNoOfSpecies, ///< the number of considered species - kIdBfCharged = 4, - kWrongSpecies = -1 -}; - -/// \enum SpeciesPairMatch -/// \brief The species pair considered by the matching test -enum SpeciesPairMatch { - kIdBfElectronElectron, ///< Electron-Electron,Electron-Positron - kIdBfElectronMuon, ///< Electron-Muon - kIdBfElectronPion, ///< Electron-Pion - kIdBfElectronKaon, ///< Electron-Kaon - kIdBfElectronProton, ///< Electron-Proton - kIdBfMuonMuon, ///< Muon-Muon - kIdBfMuonPion, ///< Muon-Pion - kIdBfMuonKaon, ///< Muon-Kaon - kIdBfMuonProton, ///< Muon-Proton - kIdBfPionPion, ///< Pion-Pion - kIdBfPionKaon, ///< Pion-Kaon - kIdBfPionProton, ///< Pion-Proton - kIdBfKaonKaon, ///< Kaon-Kaon - kIdBfKaonProton, ///< Kaon-Proton - kIdBfProtonProton ///< Proton-Proton -}; - -const char* speciesName[kIdBfNoOfSpecies + 1] = {"e", "pi", "ka", "p", "ha"}; - -const char* speciesTitle[kIdBfNoOfSpecies + 1] = {"e", "#pi", "K", "p", "ha"}; - -const int speciesChargeValue1[kIdBfNoOfSpecies] = { - 0, //< electron - 2, //< pion - 4, //< Kaon - 6 //< proton -}; - -/// \enum SystemType -/// \brief The type of the system under analysis -enum SystemType { - kNoSystem = 0, ///< no system defined - kpp, ///< **p-p** system - kpPb, ///< **p-Pb** system - kPbp, ///< **Pb-p** system - kPbPb, ///< **Pb-Pb** system - kXeXe, ///< **Xe-Xe** system - kppRun3, ///< **p-p Run 3** system - kPbPbRun3, ///< **Pb-Pb Run 3** system - knSystems ///< number of handled systems -}; - -/// \enum DataType -/// \brief Which kind of data is the task addressing -enum DataType { - kData = 0, ///< actual data, not generated - kMC, ///< Generator level and detector level - kFastMC, ///< Gererator level but stored dataset - kOnTheFly, ///< On the fly generator level data - kDataNoEvtSel, ///< actual data but not event selection available yet - knGenData ///< number of different generator data types -}; - -/// \enum CentMultEstimatorType -/// \brief The detector used to estimate centrality/multiplicity -enum CentMultEstimatorType { - kNOCM = 0, ///< do not use centrality/multiplicity estimator - kV0M, ///< V0M centrality/multiplicity estimator Run 1/2 - kCL0, ///< CL0 centrality/multiplicity estimator Run 1/2 - kCL1, ///< CL1 centrality/multiplicity estimator Run 1/2 - kFV0A, ///< FV0A centrality/multiplicity estimator Run 3 - kFT0M, ///< FT0M centrality/multiplicity estimator Run 3 - kFT0A, ///< FT0A centrality/multiplicity estimator Run 3 - kFT0C, ///< FT0C centrality/multiplicity estimator Run 3 - kNTPV, ///< NTPV centrality/multiplicity estimator Run 3 - knCentMultEstimators ///< number of centrality/mutiplicity estimator -}; - -float overallminp = 0.0f; - -/// \enum TriggerSelectionType -/// \brief The type of trigger to apply for event selection -enum TriggerSelectionType { - kNONE = 0, ///< do not use trigger selection - kMB, ///< Minimum bias trigger - knEventSelection ///< number of triggers for event selection -}; - -//============================================================================================ -// The IdentifiedBfFilter configuration objects -//============================================================================================ -int ptbins = 18; -float ptlow = 0.2, ptup = 2.0; -int etabins = 16; -float etalow = -0.8, etaup = 0.8; -int zvtxbins = 40; -float zvtxlow = -10.0, zvtxup = 10.0; -int phibins = 72; -float philow = 0.0; -float phiup = constants::math::TwoPI; - -std::vector> acceptRange; -std::vector> rejectRange; - -std::vector doPID; -std::vector tofCut; -std::vector tpcCut; - -int tracktype = 1; - -std::vector trackFilters = {}; -bool dca2Dcut = false; -float maxDCAz = 1e6f; -float maxDCAxy = 1e6f; - -inline void initializeTrackSelection() -{ - switch (tracktype) { - case 1: { /* Run2 global track */ - TrackSelection* globalRun2 = new TrackSelection(getGlobalTrackSelection()); - globalRun2->SetTrackType(o2::aod::track::Run2Track); // Run 2 track asked by default - globalRun2->SetMaxChi2PerClusterTPC(2.5f); - TrackSelection* globalSDDRun2 = new TrackSelection(getGlobalTrackSelectionSDD()); - globalSDDRun2->SetTrackType(o2::aod::track::Run2Track); // Run 2 track asked by default - globalSDDRun2->SetMaxChi2PerClusterTPC(2.5f); - trackFilters.push_back(globalRun2); - trackFilters.push_back(globalSDDRun2); - } break; - case 3: { /* Run3 track */ - TrackSelection* globalRun3 = new TrackSelection(getGlobalTrackSelection()); - globalRun3->SetTrackType(o2::aod::track::TrackTypeEnum::Track); - globalRun3->ResetITSRequirements(); - globalRun3->SetRequireHitsInITSLayers(1, {0, 1, 2}); - TrackSelection* globalSDDRun3 = new TrackSelection(getGlobalTrackSelection()); - globalSDDRun3->SetTrackType(o2::aod::track::TrackTypeEnum::Track); - globalSDDRun3->ResetITSRequirements(); - globalSDDRun3->SetRequireNoHitsInITSLayers({0, 1, 2}); - globalSDDRun3->SetRequireHitsInITSLayers(1, {3}); - trackFilters.push_back(globalRun3); - trackFilters.push_back(globalSDDRun3); - } break; - case 5: { /* Run2 TPC only track */ - TrackSelection* tpcOnly = new TrackSelection; - tpcOnly->SetTrackType(o2::aod::track::Run2Track); // Run 2 track asked by default - tpcOnly->SetMinNClustersTPC(50); - tpcOnly->SetMaxChi2PerClusterTPC(4); - tpcOnly->SetMaxDcaZ(3.2f); - maxDCAz = 3.2; - tpcOnly->SetMaxDcaXY(2.4f); - maxDCAxy = 2.4; - dca2Dcut = true; - trackFilters.push_back(tpcOnly); - } break; - case 7: { /* Run3 TPC only track */ - TrackSelection* tpcOnly = new TrackSelection; - tpcOnly->SetTrackType(o2::aod::track::TrackTypeEnum::Track); - tpcOnly->SetMinNClustersTPC(50); - tpcOnly->SetMaxChi2PerClusterTPC(4); - tpcOnly->SetMaxDcaZ(3.2f); - maxDCAz = 3.2; - tpcOnly->SetMaxDcaXY(2.4f); - maxDCAxy = 2.4; - dca2Dcut = true; - trackFilters.push_back(tpcOnly); - } break; - default: - break; - } -} - -SystemType fSystem = kNoSystem; -DataType fDataType = kData; -CentMultEstimatorType fCentMultEstimator = kV0M; -TriggerSelectionType fTriggerSelection = kMB; - -/* adaptations for the pp nightly checks */ -analysis::CheckRangeCfg traceDCAOutliers; -bool traceOutOfSpeciesParticles = false; -int recoIdMethod = 0; -bool useOwnTrackSelection = false; -TrackSelection ownTrackSelection = getGlobalTrackSelection(); -bool useOwnParticleSelection = false; -float particleMaxDCAxy = 999.9f; -float particleMaxDCAZ = 999.9f; -bool traceCollId0 = false; - -inline TriggerSelectionType getTriggerSelection(std::string const& triggstr) -{ - if (triggstr.empty() || triggstr == "MB") { - return kMB; - } else if (triggstr == "None") { - return kNONE; - } else { - LOGF(fatal, "Wrong trigger selection: %s", triggstr.c_str()); - return kNONE; - } -} - -inline SystemType getSystemType(std::string const& sysstr) -{ - /* we have to figure out how extract the system type */ - if (sysstr.empty() || (sysstr == "PbPb")) { - return kPbPb; - } else if (sysstr == "pp") { - return kpp; - } else if (sysstr == "pPb") { - return kpPb; - } else if (sysstr == "Pbp") { - return kPbp; - } else if (sysstr == "pPb") { - return kpPb; - } else if (sysstr == "XeXe") { - return kXeXe; - } else if (sysstr == "ppRun3") { - return kppRun3; - } else if (sysstr == "PbPbRun3") { - return kPbPbRun3; - } else { - LOGF(fatal, "IdentifiedBfCorrelations::getSystemType(). Wrong system type: %s", sysstr.c_str()); - } - return kPbPb; -} - -/// \brief Type of data according to the configuration string -/// \param datastr The data type configuration string -/// \return Internal code for the passed kind of data string -inline DataType getDataType(std::string const& datastr) -{ - /* we have to figure out how extract the type of data*/ - if (datastr.empty() || (datastr == "data")) { - return kData; - } else if (datastr == "datanoevsel") { - return kDataNoEvtSel; - } else if (datastr == "MC") { - return kMC; - } else if (datastr == "FastMC") { - return kFastMC; - } else if (datastr == "OnTheFlyMC") { - return kOnTheFly; - } else { - LOGF(fatal, "IdentifiedBfCorrelations::getDataType(). Wrong type of dat: %d", datastr.c_str()); - } - return kData; -} - -inline CentMultEstimatorType getCentMultEstimator(std::string const& datastr) -{ - if (datastr == "V0M") { - return kV0M; - } else if (datastr == "CL0") { - return kCL0; - } else if (datastr == "CL1") { - return kCL1; - } else if (datastr == "FV0A") { - return kFV0A; - } else if (datastr == "FT0M") { - return kFT0M; - } else if (datastr == "FT0A") { - return kFT0A; - } else if (datastr == "FT0C") { - return kFT0C; - } else if (datastr == "NTPV") { - return kNTPV; - } else if (datastr == "NOCM") { - return kNOCM; - } else { - LOGF(fatal, "Centrality/Multiplicity estimator %s not supported yet", datastr.c_str()); - } - return kNOCM; -} - -inline std::string getCentMultEstimatorName(CentMultEstimatorType est) -{ - switch (est) { - case kV0M: - return "V0M"; - break; - case kCL0: - return "CL0"; - break; - case kCL1: - return "CL1"; - break; - case kFV0A: - return "FV0A"; - break; - case kFT0M: - return "FT0M"; - break; - case kFT0A: - return "FT0A"; - break; - case kFT0C: - return "FT0C"; - break; - case kNTPV: - return "NTPV"; - break; - case kNOCM: - return "NOCM"; - break; - default: - LOGF(fatal, "Centrality/Multiplicity estimator %d not supported yet", (int)est); - return "WRONG"; - break; - } -} - -////////////////////////////////////////////////////////////////////////////////// -/// Trigger selection -////////////////////////////////////////////////////////////////////////////////// - -/// \brief Trigger selection for reconstructed and detector level collision tables -template -inline bool triggerSelectionReco(CollisionObject const& collision) -{ - bool trigsel = false; - switch (fSystem) { - case kpp: - case kpPb: - case kPbp: - case kPbPb: - case kXeXe: - switch (fTriggerSelection) { - case kMB: - switch (fDataType) { - case kData: - if (collision.alias_bit(kINT7)) { - if (collision.sel7()) { - trigsel = true; - } - } - break; - case kMC: - if (collision.sel7()) { - trigsel = true; - } - break; - default: - trigsel = true; - break; - } - break; - case kNONE: - trigsel = true; - break; - default: - break; - } - break; - case kppRun3: - case kPbPbRun3: - switch (fTriggerSelection) { - case kMB: - if (collision.sel8()) { - trigsel = true; - } - break; - case kNONE: - trigsel = true; - break; - default: - break; - } - break; - default: - break; - } - return trigsel; -} - -/// \brief Trigger selection by default: unknow subscribed collision table -template -inline bool triggerSelection(CollisionObject const&) -{ - LOGF(fatal, "Trigger selection not implemented for this kind of collisions"); - return false; -} - -/// \brief Trigger selection for reconstructed collision tables without centrality/multiplicity -template <> -inline bool triggerSelection(aod::CollisionEvSel const& collision) -{ - return triggerSelectionReco(collision); -} - -/// \brief Trigger selection for reconstructed collision tables with Run 2 centrality/multiplicity -template <> -inline bool triggerSelection(aod::CollisionEvSelRun2Cent const& collision) -{ - return triggerSelectionReco(collision); -} - -/// \brief Trigger selection for reconstructed collision tables with centrality/multiplicity -template <> -inline bool triggerSelection(aod::CollisionEvSelCent const& collision) -{ - return triggerSelectionReco(collision); -} - -/// \brief Trigger selection for detector level collision tables without centrality/multiplicity -template <> -inline bool triggerSelection::iterator>(soa::Join::iterator const& collision) -{ - return triggerSelectionReco(collision); -} - -/// \brief Trigger selection for detector level collision tables with Run 2 centrality/multiplicity -template <> -inline bool triggerSelection::iterator>(soa::Join::iterator const& collision) -{ - return triggerSelectionReco(collision); -} - -/// \brief Trigger selection for detector level collision tables with centrality/multiplicity -template <> -inline bool triggerSelection::iterator>(soa::Join::iterator const& collision) -{ - return triggerSelectionReco(collision); -} - -/// \brief Trigger selection for generator level collison table -template <> -inline bool triggerSelection(aod::McCollision const&) -{ - return true; -} - -////////////////////////////////////////////////////////////////////////////////// -/// Multiplicity extraction -////////////////////////////////////////////////////////////////////////////////// - -/// \brief Extract the collision multiplicity from the event selection information -template -inline float extractMultiplicity(CollisionObject const& collision, CentMultEstimatorType est) -{ - switch (est) { - case kV0M: - return collision.multFV0M(); - break; - case kCL0: - return collision.multTracklets(); - break; - case kCL1: - return collision.multTracklets(); - break; - case kFV0A: - return collision.multFV0A(); - break; - case kFT0M: - return collision.multFT0M(); - break; - case kFT0A: - return collision.multFT0A(); - break; - case kFT0C: - return collision.multFT0M(); - break; - case kNTPV: - return collision.multNTracksPV(); - break; - case kNOCM: - return collision.multFT0M(); - break; - default: - LOGF(fatal, "Centrality/Multiplicity estimator %d not supported yet", (int)est); - return collision.multFT0M(); - break; - } -} - -////////////////////////////////////////////////////////////////////////////////// -/// Centrality selection -////////////////////////////////////////////////////////////////////////////////// -/// \brief Centrality/multiplicity percentile -template -float getCentMultPercentile(CollisionObject collision) -{ - if constexpr (framework::has_type_v || - framework::has_type_v || - framework::has_type_v) { - switch (fCentMultEstimator) { - case kV0M: - return collision.centRun2V0M(); - break; - case kCL0: - if constexpr (framework::has_type_v) { - return collision.centRun2CL0(); - } else { - return 105.0; - } - break; - - case kCL1: - if constexpr (framework::has_type_v) { - return collision.centRun2CL1(); - } else { - return 105.0; - } - break; - default: - return 105.0; - break; - } - } - if constexpr (framework::has_type_v || - framework::has_type_v || - framework::has_type_v || - framework::has_type_v || - framework::has_type_v) { - switch (fCentMultEstimator) { - case kFV0A: - return collision.centFV0A(); - break; - case kFT0M: - return collision.centFT0M(); - break; - case kFT0A: - return collision.centFT0A(); - break; - case kFT0C: - return collision.centFT0C(); - break; - case kNTPV: - return collision.centNTPV(); - break; - default: - return 105.0; - break; - } - } -} - -/// \brief Centrality selection when there is centrality/multiplicity information -template -inline bool centralitySelectionMult(CollisionObject collision, float& centmult) -{ - float mult = getCentMultPercentile(collision); - int maxMult = 100; - int minMult = 0; - if (mult < maxMult && minMult < mult) { - centmult = mult; - return true; - } - return false; -} - -/// \brief Centrality selection when there is not centrality/multiplicity information -template -inline bool centralitySelectionNoMult(CollisionObject const&, float& centmult) -{ - bool centmultsel = false; - switch (fCentMultEstimator) { - case kNOCM: - centmult = 50.0; - centmultsel = true; - break; - default: - break; - } - return centmultsel; -} - -/// \brief Centrality selection by default: unknown subscribed collision table -template -inline bool centralitySelection(CollisionObject const&, float&) -{ - LOGF(fatal, "Centrality selection not implemented for this kind of collisions"); - return false; -} - -/// \brief Centrality selection for reconstructed and detector level collision tables with centrality/multiplicity information -template <> -inline bool centralitySelection(aod::CollisionEvSelCent const& collision, float& centmult) -{ - - return centralitySelectionMult(collision, centmult); -} - -/// \brief Centrality selection for reconstructed and detector level collision tables with Run 2 centrality/multiplicity information -template <> -inline bool centralitySelection(aod::CollisionEvSelRun2Cent const& collision, float& centmult) -{ - - return centralitySelectionMult(collision, centmult); -} - -/// \brief Centrality selection for reconstructed and detector level collision tables without centrality/multiplicity information -template <> -inline bool centralitySelection(aod::CollisionEvSel const& collision, float& centmult) -{ - - return centralitySelectionNoMult(collision, centmult); -} - -/// \brief Centrality selection for detector level collision tables without centrality/multiplicity -template <> -inline bool centralitySelection::iterator>(soa::Join::iterator const& collision, float& centmult) -{ - - return centralitySelectionNoMult(collision, centmult); -} - -/// \brief Centrality selection for detector level collision tables with centrality/multiplicity -template <> -inline bool centralitySelection::iterator>(soa::Join::iterator const& collision, float& centmult) -{ - - return centralitySelectionMult(collision, centmult); -} - -/// \brief Centrality selection for detector level collision tables with Run 2 centrality/multiplicity -template <> -inline bool centralitySelection::iterator>(soa::Join::iterator const& collision, float& centmult) -{ - return centralitySelectionMult(collision, centmult); -} - -/// \brief Centrality selection for generator level collision table -template <> -inline bool centralitySelection(aod::McCollision const&, float& centmult) -{ - int maxMult = 100; - int minMult = 0; - if (centmult < maxMult && minMult < centmult) { - return true; - } else { - return false; - } -} - -////////////////////////////////////////////////////////////////////////////////// -/// Event selection -////////////////////////////////////////////////////////////////////////////////// - -template -inline bool isEvtSelected(CollisionObject const& collision, float& centormult) -{ - bool trigsel = triggerSelection(collision); - - bool zvtxsel = false; - /* TODO: vertex quality checks */ - if (zvtxlow < collision.posZ() && collision.posZ() < zvtxup) { - zvtxsel = true; - } - - bool centmultsel = centralitySelection(collision, centormult); - - return trigsel && zvtxsel && centmultsel; -} - -////////////////////////////////////////////////////////////////////////////////// -/// Track selection -////////////////////////////////////////////////////////////////////////////////// - -template -inline bool matchTrackType(TrackObject const& track) -{ - if (useOwnTrackSelection) { - return ownTrackSelection.IsSelected(track); - } else { - for (const auto& filter : trackFilters) { - if (filter->IsSelected(track)) { - if (dca2Dcut) { - if (track.dcaXY() * track.dcaXY() / maxDCAxy / maxDCAxy + track.dcaZ() * track.dcaZ() / maxDCAz / maxDCAz > 1) { - return false; - } else { - return true; - } - } else { - return true; - } - } - } - return false; - } -} - -/// \brief Accepts or not the passed track -/// \param track the track of interest -/// \return the internal track id, -1 if not accepted -/// TODO: the PID implementation -/// For the time being we keep the convention -/// - positive track pid even -/// - negative track pid odd -/// - charged hadron 0/1 -template -void exploreMothers(ParticleObject& particle, MCCollisionObject& collision) -{ - for (const auto& m : particle.template mothers_as()) { - LOGF(info, " mother index: %d", m.globalIndex()); - LOGF(info, " Tracking back mother"); - LOGF(info, " assigned collision Id: %d, looping on collision Id: %d", m.mcCollisionId(), collision.globalIndex()); - LOGF(info, " index: %d, pdg code: %d", m.globalIndex(), m.pdgCode()); - LOGF(info, " Passed isPhysicalPrimary(): %s", m.isPhysicalPrimary() ? "YES" : "NO"); - - exploreMothers(m, collision); - } -} - -inline float getCharge(float pdgCharge) -{ - int posCharge = 1; - int negCharge = -1; - int denom = 3; - float charge = (pdgCharge / denom >= posCharge) ? 1.0 : ((pdgCharge / denom <= negCharge) ? -1.0 : 0); - return charge; -} - -} // namespace identifiedbffilter -} // namespace analysis -} // namespace o2 - -#endif // PWGCF_TWOPARTICLECORRELATIONS_TABLEPRODUCER_IDENTIFIEDBFFILTER_H_ diff --git a/PWGCF/TwoParticleCorrelations/Tasks/CMakeLists.txt b/PWGCF/TwoParticleCorrelations/Tasks/CMakeLists.txt index 0b61a13fbb5..22efd95a8fa 100644 --- a/PWGCF/TwoParticleCorrelations/Tasks/CMakeLists.txt +++ b/PWGCF/TwoParticleCorrelations/Tasks/CMakeLists.txt @@ -9,7 +9,7 @@ # granted to it by virtue of its status as an Intergovernmental Organization # or submit itself to any jurisdiction. -o2physics_add_dpl_workflow(twopartcorr +o2physics_add_dpl_workflow(two-particle-correlations SOURCES twoParticleCorrelations.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2Physics::TwoPartCorrCore COMPONENT_NAME Analysis) @@ -23,16 +23,6 @@ o2physics_add_dpl_workflow(lambdacorr PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore COMPONENT_NAME Analysis) -o2physics_add_dpl_workflow(identifiedbf - SOURCES identifiedbf.cxx - PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2Physics::PWGCFCore - COMPONENT_NAME Analysis) - -o2physics_add_dpl_workflow(identifiedbf-filter-qa - SOURCES identifiedbfqa.cxx - PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2Physics::PWGCFCore - COMPONENT_NAME Analysis) - o2physics_add_dpl_workflow(dpt-dpt-efficiency-and-qc SOURCES dptDptEfficiencyAndQc.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2Physics::PWGCFCore diff --git a/PWGCF/TwoParticleCorrelations/Tasks/identifiedbf.cxx b/PWGCF/TwoParticleCorrelations/Tasks/identifiedbf.cxx deleted file mode 100644 index b357272c17c..00000000000 --- a/PWGCF/TwoParticleCorrelations/Tasks/identifiedbf.cxx +++ /dev/null @@ -1,1507 +0,0 @@ -// Copyright 2019-2020 CERN and copyright holders of ALICE O2. -// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. -// All rights not expressly granted are reserved. -// -// This software is distributed under the terms of the GNU General Public -// License v3 (GPL Version 3), copied verbatim in the file "COPYING". -// -// In applying this license CERN does not waive the privileges and immunities -// granted to it by virtue of its status as an Intergovernmental Organization -// or submit itself to any jurisdiction. - -/// \file identifiedbf.cxx -/// \brief Fills histograms with particles and tracks to calculate the Balance Function -/// \author bghanley1995@gmail.com -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "Common/Core/TrackSelection.h" -#include "Common/DataModel/Centrality.h" -#include "Common/DataModel/EventSelection.h" -#include "Common/DataModel/TrackSelectionTables.h" -#include "Common/Core/RecoDecay.h" -#include "DataFormatsParameters/GRPObject.h" -#include "Framework/ASoAHelpers.h" -#include "Framework/AnalysisDataModel.h" -#include "Framework/AnalysisTask.h" -#include "Framework/runDataProcessing.h" -#include "Framework/O2DatabasePDGPlugin.h" -#include "PWGCF/Core/AnalysisConfigurableCuts.h" -#include "PWGCF/Core/PairCuts.h" -#include "PWGCF/TwoParticleCorrelations/DataModel/IdentifiedBfFiltered.h" -#include "PWGCF/TwoParticleCorrelations/TableProducer/identifiedBfFilter.h" - -using namespace o2; -using namespace o2::framework; -using namespace o2::soa; -using namespace o2::framework::expressions; - -#define IDENTIFIEDBFLOGCOLLISIONS debug -#define IDENTIFIEDBFLOGTRACKS debug - -namespace correlationstask -{ -using namespace o2::analysis::identifiedbffilter; -float phibinshift = 0.5; -float etabinwidth = (etaup - etalow) / static_cast(etabins); -float phibinwidth = (phiup - philow) / static_cast(phibins); -int deltaetabins = etabins * 2 - 1; -float deltaetalow = etalow - etaup, deltaetaup = etaup - etalow; -float deltaetabinwidth = (deltaetaup - deltaetalow) / static_cast(deltaetabins); -int deltaphibins = phibins; -float deltaphibinwidth = constants::math::TwoPI / deltaphibins; -float deltaphilow = 0.0 - deltaphibinwidth / 2.0; -float deltaphiup = constants::math::TwoPI - deltaphibinwidth / 2.0; - -int maxLogComb = 10; - -bool processpairs = false; -bool processmixedevents = false; -bool ptorder = false; - -PairCuts fPairCuts; // pair suppression engine -bool fUseConversionCuts = false; // suppress resonances and conversions -bool fUseTwoTrackCut = false; // suppress too close tracks - -std::vector tname = {"e+", "e-", "pi+", "pi-", "K+", "K-", "p+", "p-"}; ///< the track names -} // namespace correlationstask - -// Task for building correlations -struct IdentifiedbfTask { - - /* the data collecting engine */ - template - struct DataCollectingEngine { - int nspecies = static_cast(analysis::identifiedbffilter::kIdBfNoOfSpecies); /* Doing All Species */ - size_t nch = nspecies * 2; - - //============================================================================================ - // The IdentifiedBfCorrelationsAnalysisTask output objects - //============================================================================================ - /* histograms */ - TH1F* fhVertexZA; //! fhN1VsPt{nch, nullptr}; //! fhN1VsEtaPhi{nch, nullptr}; //! fhSum1PtVsEtaPhi{nch, nullptr}; //! fhN1VsZEtaPhiPt{nch + 1, nullptr}; //! fhN1VsZEtaPhiPtPrimary{nch, nullptr}; //! fhN1VsZEtaPhiPtSecondary{nch, nullptr}; //! fhN1VsZEtaPhiPtPure{nch + 1, nullptr}; //! fhSum1PtVsZEtaPhiPt{nch, nullptr}; //! fhNuaNueVsZEtaPhiPt{nch, nullptr}; //! fhPtAvgVsEtaPhi{nch, nullptr}; //!> fhN2VsPtPt{nch, {nch, nullptr}}; //!> fhN2VsDEtaDPhi{nch, {nch, nullptr}}; //!> fhN2ContVsDEtaDPhi{nch, {nch, nullptr}}; //!> fhSum2PtPtVsDEtaDPhi{nch, {nch, nullptr}}; //!> fhSum2DptDptVsDEtaDPhi{nch, {nch, nullptr}}; //!) ({p_T}_2 - <{p_T}_2>) \f$ distribution vs \f$\Delta\eta,\;\Delta\phi\f$ for the different species combinations - std::vector> fhSupN1N1VsDEtaDPhi{nch, {nch, nullptr}}; //!> fhSupPt1Pt1VsDEtaDPhi{nch, {nch, nullptr}}; //! fhN1VsC{nch, nullptr}; //! fhSum1PtVsC{nch, nullptr}; //! fhN1NWVsC{nch, nullptr}; //! fhSum1PtNWVsC{nch, nullptr}; //!> fhN2VsC{nch, {nch, nullptr}}; //!> fhSum2PtPtVsC{nch, {nch, nullptr}}; //!> fhSum2DptDptVsC{nch, {nch, nullptr}}; //!) ({p_T}_2 - <{p_T}_2>) \f$ distribution vs event centrality/multiplicity 1-1,1-2,2-1,2-2, combinations - std::vector> fhN2NWVsC{nch, {nch, nullptr}}; //!> fhSum2PtPtNWVsC{nch, {nch, nullptr}}; //!> fhSum2DptDptNWVsC{nch, {nch, nullptr}}; //!) ({p_T}_2 - <{p_T}_2>) \f$ distribution vs \f$\Delta\eta,\;\Delta\phi\f$ distribution vs event centrality/multiplicity 1-1,1-2,2-1,2-2, combinations - - std::vector> chargePairsNames = {{"OO", "OT"}, {"TO", "TT"}}; - std::vector> speciesPairNames = {{"e+e+", "e+e-", "e+pi+", "e+pi-", "e+K+", "e+K-", "e+p+", "e+p-"}, - {"e-e+", "e-e-", "e-pi+", "e-pi-", "e-K+", "e-K-", "e-p+", "e-p-"}, - {"pi+e+", "pi+e-", "pi+pi+", "pi+pi-", "pi+K+", "pi+K-", "pi+p+", "pi+p-"}, - {"pi-e+", "pi-e-", "pi-pi+", "pi-pi-", "pi-K+", "pi-K-", "pi-p+", "pi-p-"}, - {"K+e+", "K+e-", "K+pi+", "K+pi-", "K+K+", "K+K-", "K+p+", "K+p-"}, - {"K-e+", "K-e-", "K-pi+", "K-pi-", "K-K+", "K-K-", "K-p+", "K-p-"}, - {"p+e+", "p+e-", "p+pi+", "p+pi-", "p+K+", "p+K-", "p+p+", "p+p-"}, - {"p-e+", "p-e-", "p-pi+", "p-pi-", "p-K+", "p-K-", "p-p+", "p-p-"}}; - bool ccdbstored = false; - - float isCCDBstored() - { - return ccdbstored; - } - - /// \brief Returns the potentially phi origin shifted phi - /// \param phi the track azimuthal angle - /// \return the track phi origin shifted azimuthal angle - float getShiftedPhi(float phi) - { - using namespace correlationstask; - using namespace o2::analysis::identifiedbffilter; - phi = RecoDecay::constrainAngle(phi, philow, 1U); - return phi; - } - - /// \brief Returns the zero based bin index of the eta phi passed track - /// \param t the intended track - /// \return the zero based bin index - /// - /// According to the bining structure, to the track eta will correspond - /// a zero based bin index and similarly for the track phi - /// The returned index is the composition of both considering eta as - /// the first index component - /// WARNING: for performance reasons no checks are done about the consistency - /// of track's eta and phin with the corresponding ranges so, it is suppossed - /// the track has been accepted and it is within that ranges - /// IF THAT IS NOT THE CASE THE ROUTINE WILL PRODUCE NONSENSE RESULTS - template - int getEtaPhiIndex(TrackObject const& t) - { - using namespace correlationstask; - using namespace o2::analysis::identifiedbffilter; - - int etaix = static_cast((t.eta() - etalow) / etabinwidth); - /* consider a potential phi origin shift */ - float phi = getShiftedPhi(t.phi()); - int phiix = static_cast((phi - philow) / phibinwidth); - return etaix * phibins + phiix; - } - - /// \brief Returns the TH2 global index for the differential histograms - /// \param t1 the intended track one - /// \param t2 the intended track two - /// \return the globl TH2 bin for delta eta delta phi - /// - /// WARNING: for performance reasons no checks are done about the consistency - /// of tracks' eta and phi within the corresponding ranges so, it is suppossed - /// the tracks have been accepted and they are within that ranges - /// IF THAT IS NOT THE CASE THE ROUTINE WILL PRODUCE NONSENSE RESULTS - template - int getDEtaDPhiGlobalIndex(TrackObject const& t1, TrackObject const& t2) - { - using namespace correlationstask; - using namespace o2::analysis::identifiedbffilter; - - /* rule: ix are always zero based while bins are always one based */ - int etaix1 = static_cast((t1.eta() - etalow) / etabinwidth); - /* consider a potential phi origin shift */ - float phi = getShiftedPhi(t1.phi()); - int phiix1 = static_cast((phi - philow) / phibinwidth); - int etaix2 = static_cast((t2.eta() - etalow) / etabinwidth); - /* consider a potential phi origin shift */ - phi = getShiftedPhi(t2.phi()); - int phiix2 = static_cast((phi - philow) / phibinwidth); - - int deltaetaix = etaix1 - etaix2 + etabins - 1; - int deltaphiix = phiix1 - phiix2; - if (deltaphiix < 0) { - deltaphiix += phibins; - } - - return fhN2VsDEtaDPhi[0][0]->GetBin(deltaetaix + 1, deltaphiix + 1); - } - - void storeTrackCorrections(std::vector corrs) - { - LOGF(info, "Stored NUA&NUE corrections for %d track ids", corrs.size()); - for (uint i = 0; i < corrs.size(); ++i) { - LOGF(info, " Stored NUA&NUE corrections %s for track id %d %s", corrs[i] != nullptr ? corrs[i]->GetName() : "nullptr", i, corrs[i] != nullptr ? "yes" : "no"); - fhNuaNueVsZEtaPhiPt[i] = corrs[i]; - if (fhNuaNueVsZEtaPhiPt[i] != nullptr) { - int nbins = 0; - double avg = 0.0; - for (int ix = 0; ix < fhNuaNueVsZEtaPhiPt[i]->GetNbinsX(); ++ix) { - for (int iy = 0; iy < fhNuaNueVsZEtaPhiPt[i]->GetNbinsY(); ++iy) { - for (int iz = 0; iz < fhNuaNueVsZEtaPhiPt[i]->GetNbinsZ(); ++iz) { - nbins++; - avg += fhNuaNueVsZEtaPhiPt[i]->GetBinContent(ix + 1, iy + 1, iz + 1); - } - } - } - LOGF(info, "Average NUA&NUE correction for track id %d: %f", i, avg / nbins); - } - } - ccdbstored = true; - } - - void storePtAverages(std::vector ptavgs) - { - LOGF(info, "Stored pT average for %d track ids", ptavgs.size()); - for (uint i = 0; i < ptavgs.size(); ++i) { - LOGF(info, " Stored pT average for track id %d %s", i, ptavgs[i] != nullptr ? "yes" : "no"); - fhPtAvgVsEtaPhi[i] = ptavgs[i]; - } - ccdbstored = true; - } - - template - std::vector* getTrackCorrections(TrackListObject const& tracks, float zvtx) - { - std::vector* corr = new std::vector(tracks.size(), 1.0f); - int index = 0; - for (const auto& t : tracks) { - if (fhNuaNueVsZEtaPhiPt[t.trackacceptedid()] != nullptr) { - (*corr)[index] = fhNuaNueVsZEtaPhiPt[t.trackacceptedid()]->GetBinContent(fhNuaNueVsZEtaPhiPt[t.trackacceptedid()]->FindFixBin(zvtx, getEtaPhiIndex(t) + 0.5, t.pt())); - } - index++; - } - return corr; - } - - template - std::vector* getPtAvg(TrackListObject const& tracks) - { - std::vector* ptavg = new std::vector(tracks.size(), 0.0f); - int index = 0; - for (const auto& t : tracks) { - if (fhPtAvgVsEtaPhi[t.trackacceptedid()] != nullptr) { - (*ptavg)[index] = fhPtAvgVsEtaPhi[t.trackacceptedid()]->GetBinContent(fhPtAvgVsEtaPhi[t.trackacceptedid()]->FindFixBin(t.eta(), t.phi())); - index++; - } - } - return ptavg; - } - - /// \brief checks whether MC track is a physical primary or secondary - /// \param track passed MC track converted to MCParticle - template - void trackPrimaryCheck(TrackObject const& track, float zvtx, float corr) - { - if constexpr (framework::has_type_v) { - if (isPrimaryCheck(track.template mcParticle_as())) { - fhN1VsZEtaPhiPtPrimary[track.trackacceptedid()]->Fill(zvtx, getEtaPhiIndex(track) + 0.5, track.pt(), corr); - } else { - fhN1VsZEtaPhiPtSecondary[track.trackacceptedid()]->Fill(zvtx, getEtaPhiIndex(track) + 0.5, track.pt(), corr); - } - } else if constexpr (framework::has_type_v) { - if (isPrimaryCheck(track)) { - fhN1VsZEtaPhiPtPrimary[track.trackacceptedid()]->Fill(zvtx, getEtaPhiIndex(track) + 0.5, track.pt(), corr); - } else { - fhN1VsZEtaPhiPtSecondary[track.trackacceptedid()]->Fill(zvtx, getEtaPhiIndex(track) + 0.5, track.pt(), corr); - } - } - } - - /// \brief checks whether MC track is a physical primary or secondary - /// \param particle passed MC track converted to MCParticle - template - bool isPrimaryCheck(ParticleObject const& particle) - { - return particle.isPhysicalPrimary(); - } - - /// \brief checks whether MC track is a physical primary or secondary - /// \param particle passed MC track converted to MCParticle - template - bool isSpeciesCheck(ParticleObject const& particle, int trkId) - { - int pdgcode = particle.pdgCode(); - int realPID = -1; - switch (pdgcode) { - case kPositron: - realPID = 0; - break; - case kElectron: - realPID = 1; - break; - case kPiPlus: - realPID = 2; - break; - case kPiMinus: - realPID = 3; - break; - case kKPlus: - realPID = 4; - break; - case kKMinus: - realPID = 5; - break; - case kProton: - realPID = 6; - break; - case kProtonBar: - realPID = 7; - break; - default: - realPID = -1; - break; - } - return (realPID == trkId); - } - - /// \brief checks whether MC track is a physical primary or secondary - /// \param particle passed MC track converted to MCParticle - template - bool isPrimarySpeciesCheck(TrackObject const& track, int trkId) - { - if constexpr (framework::has_type_v) { - return (isPrimaryCheck(track.template mcParticle_as()) && isSpeciesCheck(track.template mcParticle_as(), trkId)); - } - return false; - } - - /// \brief fills the singles histograms in singles execution mode - /// \param passedtracks filtered table with the tracks associated to the passed index - /// \param tix index, in the singles histogram bank, for the passed filetered track table - template - void processSingles(TrackListObject const& passedtracks, std::vector* corrs, float zvtx) - { - int index = 0; - for (const auto& track : passedtracks) { - float corr = (*corrs)[index]; - fhN1VsPt[track.trackacceptedid()]->Fill(track.pt(), corr); - if constexpr (smallsingles) { - fhN1VsEtaPhi[track.trackacceptedid()]->Fill(track.eta(), getShiftedPhi(track.phi()), corr); - fhSum1PtVsEtaPhi[track.trackacceptedid()]->Fill(track.eta(), getShiftedPhi(track.phi()), track.pt() * corr); - } else { - fhN1VsZEtaPhiPt[nch]->Fill(zvtx, getEtaPhiIndex(track) + 0.5, track.pt(), corr); - fhN1VsZEtaPhiPt[track.trackacceptedid()]->Fill(zvtx, getEtaPhiIndex(track) + 0.5, track.pt(), corr); - fhSum1PtVsZEtaPhiPt[track.trackacceptedid()]->Fill(zvtx, getEtaPhiIndex(track) + 0.5, track.pt(), track.pt() * corr); - trackPrimaryCheck(track, zvtx, corr); - if (isPrimarySpeciesCheck(track, track.trackacceptedid())) { - fhN1VsZEtaPhiPtPure[track.trackacceptedid()]->Fill(zvtx, getEtaPhiIndex(track) + 0.5, track.pt(), corr); - } - } - index++; - } - } - - /// \brief fills the singles histograms in pair execution mode - /// \param passedtracks filtered table with the tracks associated to the passed index - /// \param tix index, in the singles histogram bank, for the passed filetered track table - /// \param cmul centrality - multiplicity for the collision being analyzed - template - void processTracks(TrackListObject const& passedtracks, std::vector* corrs, float cmul) - { - LOGF(IDENTIFIEDBFLOGCOLLISIONS, "Processing %d tracks in a collision with cent/mult %f ", passedtracks.size(), cmul); - - /* process magnitudes */ - std::vector n1(nch, 0.0); ///< weighted number of single tracks for current collision - std::vector sum1Pt(nch, 0.0); ///< accumulated sum of weighted single track \f$p_T\f$ for current collision - std::vector n1nw(nch, 0.0); ///< not weighted number of single tracks for current collision - std::vector sum1Ptnw(nch, 0.0); ///< accumulated sum of not weighted single \f$p_T\f$ for current collision - int index = 0; - for (const auto& track : passedtracks) { - float corr = (*corrs)[index]; - n1[track.trackacceptedid()] += corr; - sum1Pt[track.trackacceptedid()] += track.pt() * corr; - n1nw[track.trackacceptedid()] += 1; - sum1Ptnw[track.trackacceptedid()] += track.pt(); - - fhN1VsEtaPhi[track.trackacceptedid()]->Fill(track.eta(), getShiftedPhi(track.phi()), corr); - fhSum1PtVsEtaPhi[track.trackacceptedid()]->Fill(track.eta(), getShiftedPhi(track.phi()), track.pt() * corr); - index++; - } - for (uint tid = 0; tid < nch; ++tid) { - fhN1VsC[tid]->Fill(cmul, n1[tid]); - fhSum1PtVsC[tid]->Fill(cmul, sum1Pt[tid]); - fhN1NWVsC[tid]->Fill(cmul, n1nw[tid]); - fhSum1PtNWVsC[tid]->Fill(cmul, sum1Ptnw[tid]); - } - } - - /// \brief fills the pair histograms in pair execution mode - /// \param trks1 filtered table with the tracks associated to the first track in the pair - /// \param trks2 filtered table with the tracks associated to the second track in the pair - /// \param cmul centrality - multiplicity for the collision being analyzed - /// Be aware that in most of the cases traks1 and trks2 will have the same content (exception: mixed events) - template - void processTrackPairs(TrackOneListObject const& trks1, TrackTwoListObject const& trks2, std::vector* corrs1, std::vector* corrs2, std::vector* ptavgs1, std::vector* ptavgs2, float cmul, int bfield) - { - using namespace correlationstask; - - /* process pair magnitudes */ - std::vector> n2(nch, std::vector(nch, 0.0)); ///< weighted number of track 1 track 2 pairs for current collision - std::vector> n2sup(nch, std::vector(nch, 0.0)); ///< weighted number of track 1 track 2 suppressed pairs for current collision - std::vector> sum2PtPt(nch, std::vector(nch, 0.0)); ///< accumulated sum of weighted track 1 track 2 \f${p_T}_1 {p_T}_2\f$ for current collision - std::vector> sum2DptDpt(nch, std::vector(nch, 0.0)); ///< accumulated sum of weighted number of track 1 tracks times weighted track 2 \f$p_T\f$ for current collision - std::vector> n2nw(nch, std::vector(nch, 0.0)); ///< not weighted number of track1 track 2 pairs for current collision - std::vector> sum2PtPtnw(nch, std::vector(nch, 0.0)); ///< accumulated sum of not weighted track 1 track 2 \f${p_T}_1 {p_T}_2\f$ for current collision - std::vector> sum2DptDptnw(nch, std::vector(nch, 0.0)); ///< accumulated sum of not weighted number of track 1 tracks times not weighted track 2 \f$p_T\f$ for current collision - int index1 = 0; - - for (const auto& track1 : trks1) { - double ptavg1 = (*ptavgs1)[index1]; - double corr1 = (*corrs1)[index1]; - int index2 = 0; - for (const auto& track2 : trks2) { - /* checking the same track id condition */ - if (track1 == track2) { - /* exclude autocorrelations */ - continue; - } - - if constexpr (doptorder) { - if (track2.pt() >= track1.pt()) { - continue; - } - } - /* process pair magnitudes */ - double ptavg2 = (*ptavgs2)[index2]; - double corr2 = (*corrs2)[index2]; - double corr = corr1 * corr2; - double dptdptnw = (track1.pt() - ptavg1) * (track2.pt() - ptavg2); - double dptdptw = (corr1 * track1.pt() - ptavg1) * (corr2 * track2.pt() - ptavg2); - - /* get the global bin for filling the differential histograms */ - int globalbin = getDEtaDPhiGlobalIndex(track1, track2); - float deltaeta = track1.eta() - track2.eta(); - float deltaphi = track1.phi() - track2.phi(); - deltaphi = RecoDecay::constrainAngle(deltaphi, deltaphilow, 1U); - if ((fUseConversionCuts && fPairCuts.conversionCuts(track1, track2)) || (fUseTwoTrackCut && fPairCuts.twoTrackCut(track1, track2, bfield))) { - /* suppress the pair */ - fhSupN1N1VsDEtaDPhi[track1.trackacceptedid()][track2.trackacceptedid()]->AddBinContent(globalbin, corr); - fhSupPt1Pt1VsDEtaDPhi[track1.trackacceptedid()][track2.trackacceptedid()]->AddBinContent(globalbin, track1.pt() * track2.pt() * corr); - n2sup[track1.trackacceptedid()][track2.trackacceptedid()] += corr; - } else { - /* count the pair */ - n2[track1.trackacceptedid()][track2.trackacceptedid()] += corr; - sum2PtPt[track1.trackacceptedid()][track2.trackacceptedid()] += track1.pt() * track2.pt() * corr; - sum2DptDpt[track1.trackacceptedid()][track2.trackacceptedid()] += dptdptw; - n2nw[track1.trackacceptedid()][track2.trackacceptedid()] += 1; - sum2PtPtnw[track1.trackacceptedid()][track2.trackacceptedid()] += track1.pt() * track2.pt(); - sum2DptDptnw[track1.trackacceptedid()][track2.trackacceptedid()] += dptdptnw; - - fhN2VsDEtaDPhi[track1.trackacceptedid()][track2.trackacceptedid()]->AddBinContent(globalbin, corr); - fhN2ContVsDEtaDPhi[track1.trackacceptedid()][track2.trackacceptedid()]->Fill(deltaeta, deltaphi, corr); - fhSum2DptDptVsDEtaDPhi[track1.trackacceptedid()][track2.trackacceptedid()]->AddBinContent(globalbin, dptdptw); - fhSum2PtPtVsDEtaDPhi[track1.trackacceptedid()][track2.trackacceptedid()]->AddBinContent(globalbin, track1.pt() * track2.pt() * corr); - } - fhN2VsPtPt[track1.trackacceptedid()][track2.trackacceptedid()]->Fill(track1.pt(), track2.pt(), corr); - index2++; - } - index1++; - } - for (uint pid1 = 0; pid1 < nch; ++pid1) { - for (uint pid2 = 0; pid2 < nch; ++pid2) { - fhN2VsC[pid1][pid2]->Fill(cmul, n2[pid1][pid2]); - fhSum2PtPtVsC[pid1][pid2]->Fill(cmul, sum2PtPt[pid1][pid2]); - fhSum2DptDptVsC[pid1][pid2]->Fill(cmul, sum2DptDpt[pid1][pid2]); - fhN2NWVsC[pid1][pid2]->Fill(cmul, n2nw[pid1][pid2]); - fhSum2PtPtNWVsC[pid1][pid2]->Fill(cmul, sum2PtPtnw[pid1][pid2]); - fhSum2DptDptNWVsC[pid1][pid2]->Fill(cmul, sum2DptDptnw[pid1][pid2]); - /* let's also update the number of entries in the differential histograms */ - fhN2VsDEtaDPhi[pid1][pid2]->SetEntries(fhN2VsDEtaDPhi[pid1][pid2]->GetEntries() + n2[pid1][pid2]); - fhSum2DptDptVsDEtaDPhi[pid1][pid2]->SetEntries(fhSum2DptDptVsDEtaDPhi[pid1][pid2]->GetEntries() + n2[pid1][pid2]); - fhSum2PtPtVsDEtaDPhi[pid1][pid2]->SetEntries(fhSum2PtPtVsDEtaDPhi[pid1][pid2]->GetEntries() + n2[pid1][pid2]); - fhSupN1N1VsDEtaDPhi[pid1][pid2]->SetEntries(fhSupN1N1VsDEtaDPhi[pid1][pid2]->GetEntries() + n2sup[pid1][pid2]); - fhSupPt1Pt1VsDEtaDPhi[pid1][pid2]->SetEntries(fhSupPt1Pt1VsDEtaDPhi[pid1][pid2]->GetEntries() + n2sup[pid1][pid2]); - } - } - } - - template - void processCollision(TrackOneListObject const& Tracks1, TrackTwoListObject const& Tracks2, float zvtx, float centmult, int bfield) - { - using namespace correlationstask; - std::vector* corrs1; - std::vector* corrs2; - corrs1 = getTrackCorrections(Tracks1, zvtx); - if constexpr (mixed) { - corrs2 = getTrackCorrections(Tracks2, zvtx); - } - - if (!processpairs) { - /* process single tracks */ - fhVertexZA->Fill(zvtx); - processSingles(Tracks1, corrs1, zvtx); - if constexpr (mixed) { - processSingles(Tracks2, corrs2, zvtx); - } - } else { - /* process track magnitudes */ - std::vector* ptavgs1; - std::vector* ptavgs2; - ptavgs1 = getPtAvg(Tracks1); - if constexpr (mixed) { - ptavgs2 = getPtAvg(Tracks2); - } - - /* TODO: the centrality should be chosen non detector dependent */ - processTracks(Tracks1, corrs1, centmult); - if constexpr (mixed) { - processTracks(Tracks2, corrs2, centmult); - } - /* process pair magnitudes */ - if constexpr (mixed) { - if (ptorder) { - processTrackPairs(Tracks1, Tracks2, corrs1, corrs2, ptavgs1, ptavgs2, centmult, bfield); - } else { - processTrackPairs(Tracks1, Tracks2, corrs1, corrs2, ptavgs1, ptavgs2, centmult, bfield); - } - } else { - if (ptorder) { - processTrackPairs(Tracks1, Tracks1, corrs1, corrs1, ptavgs1, ptavgs1, centmult, bfield); - } else { - processTrackPairs(Tracks1, Tracks1, corrs1, corrs1, ptavgs1, ptavgs1, centmult, bfield); - } - } - - delete ptavgs1; - if constexpr (mixed) { - delete ptavgs2; - } - } - delete corrs1; - if constexpr (mixed) { - delete corrs2; - } - } - - void init(TList* fOutputList) - { - using namespace correlationstask; - using namespace o2::analysis::identifiedbffilter; - - /* create the histograms */ - bool oldstatus = TH1::AddDirectoryStatus(); - TH1::AddDirectory(kFALSE); - - if (!processpairs) { - fhVertexZA = new TH1F("VertexZA", "Vertex Z; z_{vtx}", zvtxbins, zvtxlow, zvtxup); - fOutputList->Add(fhVertexZA); - for (uint i = 0; i < nch; ++i) { - /* histograms for each track, one and two */ - fhN1VsPt[i] = new TH1F(TString::Format("n1_%s_vsPt", tname[i].c_str()).Data(), - TString::Format("#LT n_{1} #GT;p_{t,%s} (GeV/c);#LT n_{1} #GT", tname[i].c_str()).Data(), - ptbins, ptlow, ptup); - /* we don't want the Sumw2 structure being created here */ - bool defSumw2 = TH1::GetDefaultSumw2(); - if constexpr (smallsingles) { - fhN1VsEtaPhi[i] = new TH2F(TString::Format("n1_%s_vsEtaPhi", tname[i].c_str()).Data(), - TString::Format("#LT n_{1} #GT;#eta_{%s};#varphi_{%s} (radian);#LT n_{1} #GT", tname[i].c_str(), tname[i].c_str()).Data(), - etabins, etalow, etaup, phibins, philow, phiup); - fhSum1PtVsEtaPhi[i] = new TH2F(TString::Format("sumPt_%s_vsEtaPhi", tname[i].c_str()).Data(), - TString::Format("#LT #Sigma p_{t,%s} #GT;#eta_{%s};#varphi_{%s} (radian);#LT #Sigma p_{t,%s} #GT (GeV/c)", - tname[i].c_str(), tname[i].c_str(), tname[i].c_str(), tname[i].c_str()) - .Data(), - etabins, etalow, etaup, phibins, philow, phiup); - } else { - TH1::SetDefaultSumw2(false); - fhN1VsZEtaPhiPt[i] = new TH3F( - TString::Format("n1_%s_vsZ_vsEtaPhi_vsPt", tname[i].c_str()).Data(), - TString::Format("#LT n_{1} #GT;vtx_{z};#eta_{%s}#times#varphi_{%s};p_{t,%s} (GeV/c)", - tname[i].c_str(), - tname[i].c_str(), - tname[i].c_str()) - .Data(), - zvtxbins, - zvtxlow, - zvtxup, - etabins * phibins, - 0.0, - static_cast(etabins * phibins), - ptbins, - ptlow, - ptup); - - fhN1VsZEtaPhiPtPrimary[i] = new TH3F( - TString::Format("n1_%s_Primary_vsZ_vsEtaPhi_vsPt", tname[i].c_str()).Data(), - TString::Format("#LT n_{1} Primary #GT;vtx_{z};#eta_{%s}#times#varphi_{%s};p_{t,%s} (GeV/c)", - tname[i].c_str(), - tname[i].c_str(), - tname[i].c_str()) - .Data(), - zvtxbins, - zvtxlow, - zvtxup, - etabins * phibins, - 0.0, - static_cast(etabins * phibins), - ptbins, - ptlow, - ptup); - - fhN1VsZEtaPhiPtSecondary[i] = new TH3F( - TString::Format("n1_%s_Secondary_vsZ_vsEtaPhi_vsPt", tname[i].c_str()).Data(), - TString::Format("#LT n_{1} Secondary #GT;vtx_{z};#eta_{%s}#times#varphi_{%s};p_{t,%s} (GeV/c)", - tname[i].c_str(), - tname[i].c_str(), - tname[i].c_str()) - .Data(), - zvtxbins, - zvtxlow, - zvtxup, - etabins * phibins, - 0.0, - static_cast(etabins * phibins), - ptbins, - ptlow, - ptup); - - fhN1VsZEtaPhiPtPure[i] = new TH3F( - TString::Format("n1_%s_Pure_vsZ_vsEtaPhi_vsPt", tname[i].c_str()).Data(), - TString::Format("#LT n_{1} Pure #GT;vtx_{z};#eta_{%s}#times#varphi_{%s};p_{t,%s} (GeV/c)", - tname[i].c_str(), - tname[i].c_str(), - tname[i].c_str()) - .Data(), - zvtxbins, - zvtxlow, - zvtxup, - etabins * phibins, - 0.0, - static_cast(etabins * phibins), - ptbins, - ptlow, - ptup); - - fhSum1PtVsZEtaPhiPt[i] = new TH3F( - TString::Format("sumPt1_%s_vsZ_vsEtaPhi_vsPt", tname[i].c_str()).Data(), - TString::Format( - "#LT #Sigma p_{t,%s}#GT;vtx_{z};#eta_{%s}#times#varphi_{%s};p_{t,%s} (GeV/c)", - tname[i].c_str(), - tname[i].c_str(), - tname[i].c_str(), - tname[i].c_str()) - .Data(), - zvtxbins, - zvtxlow, - zvtxup, - etabins * phibins, - 0.0, - static_cast(etabins * phibins), - ptbins, - ptlow, - ptup); - } - /* we return it back to previuos state */ - TH1::SetDefaultSumw2(defSumw2); - - /* the statistical uncertainties will be estimated by the subsamples method so let's get rid of the error tracking */ - if constexpr (smallsingles) { - fhN1VsEtaPhi[i]->SetBit(TH1::kIsNotW); - fhN1VsEtaPhi[i]->Sumw2(false); - fhSum1PtVsEtaPhi[i]->SetBit(TH1::kIsNotW); - fhSum1PtVsEtaPhi[i]->Sumw2(false); - } else { - fhN1VsZEtaPhiPt[i]->SetBit(TH1::kIsNotW); - fhN1VsZEtaPhiPt[i]->Sumw2(false); - fhN1VsZEtaPhiPtPrimary[i]->SetBit(TH1::kIsNotW); - fhN1VsZEtaPhiPtPrimary[i]->Sumw2(false); - fhN1VsZEtaPhiPtSecondary[i]->SetBit(TH1::kIsNotW); - fhN1VsZEtaPhiPtSecondary[i]->Sumw2(false); - fhN1VsZEtaPhiPtPure[i]->SetBit(TH1::kIsNotW); - fhN1VsZEtaPhiPtPure[i]->Sumw2(false); - fhSum1PtVsZEtaPhiPt[i]->SetBit(TH1::kIsNotW); - fhSum1PtVsZEtaPhiPt[i]->Sumw2(false); - } - fhNuaNueVsZEtaPhiPt[i] = nullptr; - fhPtAvgVsEtaPhi[i] = nullptr; - - fOutputList->Add(fhN1VsPt[i]); - if constexpr (smallsingles) { - fOutputList->Add(fhN1VsEtaPhi[i]); - fOutputList->Add(fhSum1PtVsEtaPhi[i]); - } else { - fOutputList->Add(fhN1VsZEtaPhiPt[i]); - fOutputList->Add(fhN1VsZEtaPhiPtPrimary[i]); - fOutputList->Add(fhN1VsZEtaPhiPtSecondary[i]); - fOutputList->Add(fhN1VsZEtaPhiPtPure[i]); - fOutputList->Add(fhSum1PtVsZEtaPhiPt[i]); - } - } - if (!smallsingles) { - TH1::SetDefaultSumw2(false); - fhN1VsZEtaPhiPt[nch] = new TH3F( - TString::Format("n1_%s_vsZ_vsEtaPhi_vsPt", "h"), - TString::Format("#LT n_{1} #GT;vtx_{z};#eta_{%s}#times#varphi_{%s};p_{t,%s} (GeV/c)", - "h", - "h", - "h") - .Data(), - zvtxbins, - zvtxlow, - zvtxup, - etabins * phibins, - 0.0, - static_cast(etabins * phibins), - ptbins, - ptlow, - ptup); - fOutputList->Add(fhN1VsZEtaPhiPt[nch]); - } - - } else { - for (uint i = 0; i < nch; ++i) { - /* histograms for each track species */ - fhN1VsEtaPhi[i] = new TH2F(TString::Format("n1_%s_vsEtaPhi", tname[i].c_str()).Data(), - TString::Format("#LT n_{1} #GT;#eta_{%s};#varphi_{%s} (radian);#LT n_{1} #GT", tname[i].c_str(), tname[i].c_str()).Data(), - etabins, etalow, etaup, phibins, philow, phiup); - fhSum1PtVsEtaPhi[i] = new TH2F(TString::Format("sumPt_%s_vsEtaPhi", tname[i].c_str()).Data(), - TString::Format("#LT #Sigma p_{t,%s} #GT;#eta_{%s};#varphi_{%s} (radian);#LT #Sigma p_{t,%s} #GT (GeV/c)", - tname[i].c_str(), tname[i].c_str(), tname[i].c_str(), tname[i].c_str()) - .Data(), - etabins, etalow, etaup, phibins, philow, phiup); - fhN1VsC[i] = new TProfile(TString::Format("n1_%s_vsM", tname[i].c_str()).Data(), - TString::Format("#LT n_{1} #GT (weighted);Centrality/Multiplicity (%%);#LT n_{1} #GT").Data(), - 100, 0.0, 100.0); - fhSum1PtVsC[i] = new TProfile(TString::Format("sumPt_%s_vsM", tname[i].c_str()), - TString::Format("#LT #Sigma p_{t,%s} #GT (weighted);Centrality/Multiplicity (%%);#LT #Sigma p_{t,%s} #GT (GeV/c)", tname[i].c_str(), tname[i].c_str()).Data(), - 100, 0.0, 100.0); - fhN1NWVsC[i] = new TProfile(TString::Format("n1Nw_%s_vsM", tname[i].c_str()).Data(), - TString::Format("#LT n_{1} #GT;Centrality/Multiplicity (%%);#LT n_{1} #GT").Data(), - 100, 0.0, 100.0); - fhSum1PtNWVsC[i] = new TProfile(TString::Format("sumPtNw_%s_vsM", tname[i].c_str()).Data(), - TString::Format("#LT #Sigma p_{t,%s} #GT;Centrality/Multiplicity (%%);#LT #Sigma p_{t,%s} #GT (GeV/c)", tname[i].c_str(), tname[i].c_str()).Data(), 100, 0.0, 100.0); - fhNuaNueVsZEtaPhiPt[i] = nullptr; - fhPtAvgVsEtaPhi[i] = nullptr; - fOutputList->Add(fhN1VsEtaPhi[i]); - fOutputList->Add(fhSum1PtVsEtaPhi[i]); - fOutputList->Add(fhN1VsC[i]); - fOutputList->Add(fhSum1PtVsC[i]); - fOutputList->Add(fhN1NWVsC[i]); - fOutputList->Add(fhSum1PtNWVsC[i]); - } - for (uint i = 0; i < nch; ++i) { - for (uint j = 0; j < nch; ++j) { - /* histograms for each track pair combination */ - /* we don't want the Sumw2 structure being created here */ - bool defSumw2 = TH1::GetDefaultSumw2(); - TH1::SetDefaultSumw2(false); - // const char* pname = chargePairsNames[i][j].c_str(); - const char* pname = speciesPairNames[i][j].c_str(); - fhN2VsDEtaDPhi[i][j] = new TH2F(TString::Format("n2_12_vsDEtaDPhi_%s", pname), TString::Format("#LT n_{2} #GT (%s);#Delta#eta;#Delta#varphi;#LT n_{2} #GT", pname), - deltaetabins, deltaetalow, deltaetaup, deltaphibins, deltaphilow, deltaphiup); - fhN2ContVsDEtaDPhi[i][j] = new TH2F(TString::Format("n2_12cont_vsDEtaDPhi_%s", pname), TString::Format("#LT n_{2} #GT (%s);#Delta#eta;#Delta#varphi;#LT n_{2} #GT", pname), - deltaetabins, deltaetalow, deltaetaup, deltaphibins, deltaphilow, deltaphiup); - fhSum2PtPtVsDEtaDPhi[i][j] = new TH2F(TString::Format("sumPtPt_12_vsDEtaDPhi_%s", pname), TString::Format("#LT #Sigma p_{t,1}p_{t,2} #GT (%s);#Delta#eta;#Delta#varphi;#LT #Sigma p_{t,1}p_{t,2} #GT (GeV^{2})", pname), - deltaetabins, deltaetalow, deltaetaup, deltaphibins, deltaphilow, deltaphiup); - fhSum2DptDptVsDEtaDPhi[i][j] = new TH2F(TString::Format("sumDptDpt_12_vsDEtaDPhi_%s", pname), TString::Format("#LT #Sigma (p_{t,1} - #LT p_{t,1} #GT)(p_{t,2} - #LT p_{t,2} #GT) #GT (%s);#Delta#eta;#Delta#varphi;#LT #Sigma (p_{t,1} - #LT p_{t,1} #GT)(p_{t,2} - #LT p_{t,2} #GT) #GT (GeV^{2})", pname), - deltaetabins, deltaetalow, deltaetaup, deltaphibins, deltaphilow, deltaphiup); - fhSupN1N1VsDEtaDPhi[i][j] = new TH2F(TString::Format("suppn1n1_12_vsDEtaDPhi_%s", pname), TString::Format("Suppressed #LT n_{1} #GT#LT n_{1} #GT (%s);#Delta#eta;#Delta#varphi;#LT n_{1} #GT#LT n_{1} #GT", pname), - deltaetabins, deltaetalow, deltaetaup, deltaphibins, deltaphilow, deltaphiup); - fhSupPt1Pt1VsDEtaDPhi[i][j] = new TH2F(TString::Format("suppPtPt_12_vsDEtaDPhi_%s", pname), TString::Format("Suppressed #LT p_{t,1} #GT#LT p_{t,2} #GT (%s);#Delta#eta;#Delta#varphi;#LT p_{t,1} #GT#LT p_{t,2} #GT (GeV^{2})", pname), - deltaetabins, deltaetalow, deltaetaup, deltaphibins, deltaphilow, deltaphiup); - /* we return it back to previuos state */ - TH1::SetDefaultSumw2(defSumw2); - - fhN2VsPtPt[i][j] = new TH2F(TString::Format("n2_12_vsPtVsPt_%s", pname), TString::Format("#LT n_{2} #GT (%s);p_{t,1} (GeV/c);p_{t,2} (GeV/c);#LT n_{2} #GT", pname), - ptbins, ptlow, ptup, ptbins, ptlow, ptup); - - fhN2VsC[i][j] = new TProfile(TString::Format("n2_12_vsM_%s", pname), TString::Format("#LT n_{2} #GT (%s) (weighted);Centrality/Multiplicity (%%);#LT n_{2} #GT", pname), 100, 0.0, 100.0); - fhSum2PtPtVsC[i][j] = new TProfile(TString::Format("sumPtPt_12_vsM_%s", pname), TString::Format("#LT #Sigma p_{t,1}p_{t,2} #GT (%s) (weighted);Centrality/Multiplicity (%%);#LT #Sigma p_{t,1}p_{t,2} #GT (GeV^{2})", pname), 100, 0.0, 100.0); - fhSum2DptDptVsC[i][j] = new TProfile(TString::Format("sumDptDpt_12_vsM_%s", pname), TString::Format("#LT #Sigma (p_{t,1} - #LT p_{t,1} #GT)(p_{t,2} - #LT p_{t,2} #GT) #GT (%s) (weighted);Centrality/Multiplicity (%%);#LT #Sigma (p_{t,1} - #LT p_{t,1} #GT)(p_{t,2} - #LT p_{t,2} #GT) #GT (GeV^{2})", pname), 100, 0.0, 100.0); - fhN2NWVsC[i][j] = new TProfile(TString::Format("n2Nw_12_vsM_%s", pname), TString::Format("#LT n_{2} #GT (%s);Centrality/Multiplicity (%%);#LT n_{2} #GT", pname), 100, 0.0, 100.0); - fhSum2PtPtNWVsC[i][j] = new TProfile(TString::Format("sumPtPtNw_12_vsM_%s", pname), TString::Format("#LT #Sigma p_{t,1}p_{t,2} #GT (%s);Centrality/Multiplicity (%%);#LT #Sigma p_{t,1}p_{t,2} #GT (GeV^{2})", pname), 100, 0.0, 100.0); - fhSum2DptDptNWVsC[i][j] = new TProfile(TString::Format("sumDptDptNw_12_vsM_%s", pname), TString::Format("#LT #Sigma (p_{t,1} - #LT p_{t,1} #GT)(p_{t,2} - #LT p_{t,2} #GT) #GT (%s);Centrality/Multiplicity (%%);#LT #Sigma (p_{t,1} - #LT p_{t,1} #GT)(p_{t,2} - #LT p_{t,2} #GT) #GT (GeV^{2})", pname), 100, 0.0, 100.0); - - /* the statistical uncertainties will be estimated by the subsamples method so let's get rid of the error tracking */ - fhN2VsDEtaDPhi[i][j]->SetBit(TH1::kIsNotW); - fhN2VsDEtaDPhi[i][j]->Sumw2(false); - fhN2ContVsDEtaDPhi[i][j]->SetBit(TH1::kIsNotW); - fhN2ContVsDEtaDPhi[i][j]->Sumw2(false); - fhSum2PtPtVsDEtaDPhi[i][j]->SetBit(TH1::kIsNotW); - fhSum2PtPtVsDEtaDPhi[i][j]->Sumw2(false); - fhSum2DptDptVsDEtaDPhi[i][j]->SetBit(TH1::kIsNotW); - fhSum2DptDptVsDEtaDPhi[i][j]->Sumw2(false); - fhSupN1N1VsDEtaDPhi[i][j]->SetBit(TH1::kIsNotW); - fhSupN1N1VsDEtaDPhi[i][j]->Sumw2(false); - fhSupPt1Pt1VsDEtaDPhi[i][j]->SetBit(TH1::kIsNotW); - fhSupPt1Pt1VsDEtaDPhi[i][j]->Sumw2(false); - - fOutputList->Add(fhN2VsDEtaDPhi[i][j]); - fOutputList->Add(fhN2ContVsDEtaDPhi[i][j]); - fOutputList->Add(fhSum2PtPtVsDEtaDPhi[i][j]); - fOutputList->Add(fhSum2DptDptVsDEtaDPhi[i][j]); - fOutputList->Add(fhSupN1N1VsDEtaDPhi[i][j]); - fOutputList->Add(fhSupPt1Pt1VsDEtaDPhi[i][j]); - fOutputList->Add(fhN2VsPtPt[i][j]); - fOutputList->Add(fhN2VsC[i][j]); - fOutputList->Add(fhSum2PtPtVsC[i][j]); - fOutputList->Add(fhSum2DptDptVsC[i][j]); - fOutputList->Add(fhN2NWVsC[i][j]); - fOutputList->Add(fhSum2PtPtNWVsC[i][j]); - fOutputList->Add(fhSum2DptDptNWVsC[i][j]); - } - } - } - TH1::AddDirectory(oldstatus); - } - }; // DataCollectingEngine - - Service ccdb; - - /* the data memebers for this task */ - /* the centrality / multiplicity limits for collecting data in this task instance */ - int ncmranges = 0; - float* fCentMultMin = nullptr; - float* fCentMultMax = nullptr; - - /* the data collecting engine instances */ - DataCollectingEngine** dataCE; - DataCollectingEngine** dataCESmall; - DataCollectingEngine** dataCEME; - - /* the input file structure from CCDB */ - TList* ccdblst = nullptr; - bool loadfromccdb = false; - - /* pair conversion suppression defaults */ - static constexpr float PairCutDefaults[1][5] = {{-1, -1, -1, -1, -1}}; - Configurable> cfgPairCut{"cfgPairCut", {PairCutDefaults[0], 5, {"Photon", "K0", "Lambda", "Phi", "Rho"}}, "Conversion suppressions"}; - /* two tracks cut */ - Configurable cfgTwoTrackCut{"cfgTwoTrackCut", -1, "Two-tracks cut: -1 = off; >0 otherwise distance value (suggested: 0.02"}; - Configurable cfgTwoTrackCutMinRadius{"cfgTwoTrackCutMinRadius", 0.8f, "Two-tracks cut: radius in m from which two-tracks cut is applied"}; - - Configurable cfgSmallDCE{"cfgSmallDCE", true, "Use small data collecting engine for singles processing, true = yes. Default = true"}; - Configurable cfgProcessPairs{"cfgProcessPairs", false, "Process pairs: false = no, just singles, true = yes, process pairs"}; - Configurable cfgProcessME{"cfgProcessME", false, "Process mixed events: false = no, just same event, true = yes, also process mixed events"}; - Configurable cfgCentSpec{"cfgCentSpec", "00-05,05-10,10-20,20-30,30-40,40-50,50-60,60-70,70-80", "Centrality/multiplicity ranges in min-max separated by commas"}; - - Configurable cfgBinning{"cfgBinning", - {28, -7.0, 7.0, 18, 0.2, 2.0, 16, -0.8, 0.8, 72, 0.5}, - "triplets - nbins, min, max - for z_vtx, pT, eta and phi, binning plus bin fraction of phi origin shift"}; - Configurable cfgPtOrder{"cfgPtOrder", false, "enforce pT_1 < pT_2. Defalut: false"}; - struct : ConfigurableGroup { - Configurable cfgCCDBUrl{"cfgCCDBUrl", "http://ccdb-test.cern.ch:8080", "The CCDB url for the input file"}; - Configurable cfgCCDBPathName{"cfgCCDBPathName", "", "The CCDB path for the input file. Default \"\", i.e. don't load from CCDB"}; - Configurable cfgCCDBDate{"cfgCCDBDate", "20220307", "The CCDB date for the input file"}; - } cfginputfile; - - OutputObj fOutput{"IdentifiedBfCorrelationsData", OutputObjHandlingPolicy::AnalysisObject, OutputObjSourceType::OutputObjSource}; - - void init(InitContext const&) - { - using namespace correlationstask; - using namespace o2::analysis::identifiedbffilter; - - /* update with the configurable values */ - ptbins = cfgBinning->mPTbins; - ptlow = cfgBinning->mPTmin; - ptup = cfgBinning->mPTmax; - etabins = cfgBinning->mEtabins; - etalow = cfgBinning->mEtamin; - etaup = cfgBinning->mEtamax; - zvtxbins = cfgBinning->mZVtxbins; - zvtxlow = cfgBinning->mZVtxmin; - zvtxup = cfgBinning->mZVtxmax; - phibins = cfgBinning->mPhibins; - philow = 0.0f; - phiup = constants::math::TwoPI; - phibinshift = cfgBinning->mPhibinshift; - processpairs = cfgProcessPairs.value; - processmixedevents = cfgProcessME.value; - ptorder = cfgPtOrder.value; - loadfromccdb = cfginputfile.cfgCCDBPathName->length() > 0; - /* update the potential binning change */ - etabinwidth = (etaup - etalow) / static_cast(etabins); - phibinwidth = (phiup - philow) / static_cast(phibins); - - /* the differential bining */ - deltaetabins = etabins * 2 - 1; - deltaetalow = etalow - etaup, deltaetaup = etaup - etalow; - deltaetabinwidth = (deltaetaup - deltaetalow) / static_cast(deltaetabins); - deltaphibins = phibins; - deltaphibinwidth = constants::math::TwoPI / deltaphibins; - deltaphilow = 0.0 - deltaphibinwidth / 2.0; - deltaphiup = constants::math::TwoPI - deltaphibinwidth / 2.0; - - /* create the output directory which will own the task output */ - TList* fGlobalOutputList = new TList(); - fGlobalOutputList->SetOwner(true); - fOutput.setObject(fGlobalOutputList); - - /* incorporate configuration parameters to the output */ - fGlobalOutputList->Add(new TParameter("NoBinsPt", ptbins, 'f')); - fGlobalOutputList->Add(new TParameter("NoBinsEta", etabins, 'f')); - fGlobalOutputList->Add(new TParameter("NoBinsPhi", phibins, 'f')); - fGlobalOutputList->Add(new TParameter("NoBinsVertexZ", zvtxbins, 'f')); - fGlobalOutputList->Add(new TParameter("MinVertexZ", zvtxlow, 'f')); - fGlobalOutputList->Add(new TParameter("MaxVertexZ", zvtxup, 'f')); - fGlobalOutputList->Add(new TParameter("MinPt", ptlow, 'f')); - fGlobalOutputList->Add(new TParameter("MaxPt", ptup, 'f')); - fGlobalOutputList->Add(new TParameter("MinEta", etalow, 'f')); - fGlobalOutputList->Add(new TParameter("MaxEta", etaup, 'f')); - fGlobalOutputList->Add(new TParameter("MinPhi", philow, 'f')); - fGlobalOutputList->Add(new TParameter("MaxPhi", phiup, 'f')); - fGlobalOutputList->Add(new TParameter("PhiBinShift", phibinshift, 'f')); - fGlobalOutputList->Add(new TParameter("DifferentialOutput", true, 'f')); - fGlobalOutputList->Add(new TParameter("SmallDCE", cfgSmallDCE.value, 'f')); - - /* after the parameters dump the proper phi limits are set according to the phi shift */ - phiup = phiup - phibinwidth * phibinshift; - philow = philow - phibinwidth * phibinshift; - - /* create the data collecting engine instances according to the configured centrality/multiplicity ranges */ - { - TObjArray* tokens = TString(cfgCentSpec.value.c_str()).Tokenize(","); - ncmranges = tokens->GetEntries(); - fCentMultMin = new float[ncmranges]; - fCentMultMax = new float[ncmranges]; - dataCE = new DataCollectingEngine*[ncmranges]; - if (cfgSmallDCE) { - dataCESmall = new DataCollectingEngine*[ncmranges]; - } else { - dataCE = new DataCollectingEngine*[ncmranges]; - } - if (processmixedevents) { - dataCEME = new DataCollectingEngine*[ncmranges]; - } - - for (int i = 0; i < ncmranges; ++i) { - auto initializeCEInstance = [&fGlobalOutputList](auto dce, auto name) { - /* crete the output list for the passed centrality/multiplicity range */ - TList* fOutputList = new TList(); - fOutputList->SetName(name); - fOutputList->SetOwner(true); - /* init the data collection instance */ - dce->init(fOutputList); - fGlobalOutputList->Add(fOutputList); - }; - auto builSmallDCEInstance = [&initializeCEInstance](auto rg, bool me = false) { - DataCollectingEngine* dce = new DataCollectingEngine(); - initializeCEInstance(dce, TString::Format("IdentifiedBfCorrelationsData%s-%s", me ? "ME" : "", rg)); - return dce; - }; - auto buildCEInstance = [&initializeCEInstance](auto rg, bool me = false) { - DataCollectingEngine* dce = new DataCollectingEngine(); - initializeCEInstance(dce, TString::Format("IdentifiedBfCorrelationsData%s-%s", me ? "ME" : "", rg)); - return dce; - }; - float cmmin = 0.0f; - float cmmax = 0.0f; - sscanf(tokens->At(i)->GetName(), "%f-%f", &cmmin, &cmmax); - fCentMultMin[i] = cmmin; - fCentMultMax[i] = cmmax; - if (cfgSmallDCE.value) { - if (processpairs) { - LOGF(fatal, "Processing pairs cannot be used with the small DCE, please configure properly!!"); - } - dataCESmall[i] = builSmallDCEInstance(tokens->At(i)->GetName()); - } else { - dataCE[i] = buildCEInstance(tokens->At(i)->GetName()); - } - if (processmixedevents) { - /* consistency check */ - if (cfgSmallDCE.value) { - LOGF(fatal, "Mixed events cannot be used with the small DCE, please configure properly!!"); - } - dataCEME[i] = buildCEInstance(tokens->At(i)->GetName(), true); - } - } - delete tokens; - for (int i = 0; i < ncmranges; ++i) { - LOGF(info, " centrality/multipliicty range: %d, low limit: %f, up limit: %f", i, fCentMultMin[i], fCentMultMax[i]); - } - } - /* two-track cut and conversion suppression */ - fPairCuts.SetHistogramRegistry(nullptr); // not histogram registry for the time being, incompatible with TList when it is empty - if (processpairs && ((cfgPairCut->get("Photon") > 0) || (cfgPairCut->get("K0") > 0) || (cfgPairCut->get("Lambda") > 0) || (cfgPairCut->get("Phi") > 0) || (cfgPairCut->get("Rho") > 0))) { - fPairCuts.SetPairCut(PairCuts::Photon, cfgPairCut->get("Photon")); - fPairCuts.SetPairCut(PairCuts::K0, cfgPairCut->get("K0")); - fPairCuts.SetPairCut(PairCuts::Lambda, cfgPairCut->get("Lambda")); - fPairCuts.SetPairCut(PairCuts::Phi, cfgPairCut->get("Phi")); - fPairCuts.SetPairCut(PairCuts::Rho, cfgPairCut->get("Rho")); - fUseConversionCuts = true; - } - if (processpairs && (cfgTwoTrackCut > 0)) { - fPairCuts.SetTwoTrackCuts(cfgTwoTrackCut, cfgTwoTrackCutMinRadius); - fUseTwoTrackCut = true; - } - - /* initialize access to the CCDB */ - ccdb->setURL(cfginputfile.cfgCCDBUrl); - ccdb->setCaching(true); - ccdb->setLocalObjectValidityChecking(); - } - - /// \brief Get the data collecting engine index corresponding to the passed collision - template - int getDCEindex(FilteredCollision collision) - { - int ixDCE = -1; - float cm = collision.centmult(); - for (int i = 0; i < ncmranges; ++i) { - if (cm < fCentMultMax[i]) { - ixDCE = i; - break; - } - } - if (!(ixDCE < 0)) { - if (cm < fCentMultMin[ixDCE]) { - ixDCE = -1; - } - } - return ixDCE; - } - - TList* getCCDBInput(const char* ccdbpath, const char* ccdbdate) - { - std::tm cfgtm = {}; - std::stringstream ss(ccdbdate); - ss >> std::get_time(&cfgtm, "%Y%m%d"); - cfgtm.tm_hour = 12; - int64_t timestamp = std::mktime(&cfgtm) * 1000; - - TList* lst = ccdb->getForTimeStamp(ccdbpath, timestamp); - if (lst != nullptr) { - LOGF(info, "Correctly loaded CCDB input object"); - } else { - LOGF(error, "CCDB input object could not be loaded"); - } - return lst; - } - - int getMagneticField(uint64_t timestamp) - { - // TODO done only once (and not per run). Will be replaced by CCDBConfigurable - static o2::parameters::GRPObject* grpo = nullptr; - if (grpo == nullptr) { - grpo = ccdb->getForTimeStamp("GLO/GRP/GRP", timestamp); - if (grpo == nullptr) { - LOGF(fatal, "GRP object not found for timestamp %llu", timestamp); - return 0; - } - LOGF(info, "Retrieved GRP for timestamp %llu with magnetic field of %d kG", timestamp, grpo->getNominalL3Field()); - } - return grpo->getNominalL3Field(); - } - - template - void processSame(FilterdCollision const& collision, FilteredTracks const& tracks, uint64_t timestamp = 0) - { - using namespace correlationstask; - if (ccdblst == nullptr) { - if (loadfromccdb) { - ccdblst = getCCDBInput(cfginputfile.cfgCCDBPathName->c_str(), cfginputfile.cfgCCDBDate->c_str()); - } - } - - /* locate the data collecting engine for the collision centrality/multiplicity */ - int ixDCE = getDCEindex(collision); - if (!(ixDCE < 0)) { - if (ccdblst != nullptr && !(dataCE[ixDCE]->isCCDBstored())) { - if constexpr (gen) { - std::vector ptavgs{tname.size(), nullptr}; - for (uint isp = 0; isp < tname.size(); ++isp) { - ptavgs[isp] = reinterpret_cast(ccdblst->FindObject( - TString::Format("trueptavgetaphi_%02d-%02d_%s", - static_cast(fCentMultMin[ixDCE]), - static_cast(fCentMultMax[ixDCE]), - tname[isp].c_str()) - .Data())); - } - if (cfgSmallDCE.value) { - dataCESmall[ixDCE]->storePtAverages(ptavgs); - } else { - dataCE[ixDCE]->storePtAverages(ptavgs); - } - } else { - std::vector corrs{tname.size(), nullptr}; - for (uint isp = 0; isp < tname.size(); ++isp) { - corrs[isp] = reinterpret_cast(ccdblst->FindObject( - TString::Format("correction_%02d-%02d_%s", - static_cast(fCentMultMin[ixDCE]), - static_cast(fCentMultMax[ixDCE]), - tname[isp].c_str()) - .Data())); - } - if (cfgSmallDCE.value) { - dataCESmall[ixDCE]->storeTrackCorrections(corrs); - } else { - dataCE[ixDCE]->storeTrackCorrections(corrs); - } - - std::vector ptavgs{tname.size(), nullptr}; - for (uint isp = 0; isp < tname.size(); ++isp) { - ptavgs[isp] = reinterpret_cast(ccdblst->FindObject( - TString::Format("ptavgetaphi_%02d-%02d_%s", - static_cast(fCentMultMin[ixDCE]), - static_cast(fCentMultMax[ixDCE]), - tname[isp].c_str()) - .Data())); - } - if (cfgSmallDCE.value) { - dataCESmall[ixDCE]->storePtAverages(ptavgs); - } else { - dataCE[ixDCE]->storePtAverages(ptavgs); - } - } - } - - std::string generated = ""; - if constexpr (gen) { - generated = "generated "; - } - - LOGF(IDENTIFIEDBFLOGCOLLISIONS, - "Accepted BC id %d %scollision with cent/mult %f and %d total tracks. Assigned DCE: %d", - collision.bcId(), - generated.c_str(), - collision.centmult(), - tracks.size(), - ixDCE); - int bfield = 0; - if constexpr (!gen) { - bfield = (fUseConversionCuts || fUseTwoTrackCut) ? getMagneticField(timestamp) : 0; - } - if (cfgSmallDCE.value) { - dataCESmall[ixDCE]->processCollision(tracks, tracks, collision.posZ(), collision.centmult(), bfield); - } else { - dataCE[ixDCE]->processCollision(tracks, tracks, collision.posZ(), collision.centmult(), bfield); - } - } - } - - template - void processMixed(FilterdCollision const& collision, FilteredTracks1 const& tracks1, FilteredTracks2 const& tracks2, uint64_t timestamp = 0) - { - using namespace correlationstask; - - if (ccdblst == nullptr) { - if (loadfromccdb) { - ccdblst = getCCDBInput(cfginputfile.cfgCCDBPathName->c_str(), cfginputfile.cfgCCDBDate->c_str()); - } - } - - /* locate the data collecting engine for the collision centrality/multiplicity */ - int ixDCE = getDCEindex(collision); - if (!(ixDCE < 0)) { - if (ccdblst != nullptr && !(dataCEME[ixDCE]->isCCDBstored())) { - if constexpr (gen) { - std::vector ptavgs{tname.size(), nullptr}; - for (uint isp = 0; isp < tname.size(); ++isp) { - ptavgs[isp] = reinterpret_cast(ccdblst->FindObject( - TString::Format("trueptavgetaphi_%02d-%02d_%s", - static_cast(fCentMultMin[ixDCE]), - static_cast(fCentMultMax[ixDCE]), - tname[isp].c_str()) - .Data())); - } - dataCEME[ixDCE]->storePtAverages(ptavgs); - } else { - std::vector corrs{tname.size(), nullptr}; - for (uint isp = 0; isp < tname.size(); ++isp) { - corrs[isp] = reinterpret_cast(ccdblst->FindObject( - TString::Format("correction_%02d-%02d_%s", - static_cast(fCentMultMin[ixDCE]), - static_cast(fCentMultMax[ixDCE]), - tname[isp].c_str()) - .Data())); - } - dataCEME[ixDCE]->storeTrackCorrections(corrs); - - std::vector ptavgs{tname.size(), nullptr}; - for (uint isp = 0; isp < tname.size(); ++isp) { - ptavgs[isp] = reinterpret_cast(ccdblst->FindObject( - TString::Format("ptavgetaphi_%02d-%02d_%s", - static_cast(fCentMultMin[ixDCE]), - static_cast(fCentMultMax[ixDCE]), - tname[isp].c_str()) - .Data())); - } - dataCEME[ixDCE]->storePtAverages(ptavgs); - } - } - - std::string generated = ""; - if constexpr (gen) { - generated = "generated "; - } - - LOGF(IDENTIFIEDBFLOGCOLLISIONS, - "Accepted BC id %d mixed %scollision with cent/mult %f and %d-%d total mixed tracks. " - "Assigned DCE: %d", - collision.bcId(), - generated.c_str(), - collision.centmult(), - tracks1.size(), - tracks2.size(), - ixDCE); - int bfield = 0; - if constexpr (!gen) { - bfield = (fUseConversionCuts || fUseTwoTrackCut) ? getMagneticField(timestamp) : 0; - } - dataCEME[ixDCE]->processCollision(tracks1, tracks2, collision.posZ(), collision.centmult(), bfield); - } - } - - Filter onlyacceptedcollisions = (aod::identifiedbffilter::collisionaccepted == uint8_t(true)); - Filter onlyacceptedtracks = (aod::identifiedbffilter::trackacceptedid >= int8_t(0)); - - void processRecLevel(soa::Filtered::iterator const& collision, aod::BCsWithTimestamps const&, soa::Filtered const& tracks) - { - processSame(collision, tracks, collision.bc_as().timestamp()); - } - PROCESS_SWITCH(IdentifiedbfTask, processRecLevel, "Process reco level correlations", false); - - void processRecLevelCheck(aod::Collisions const& collisions, aod::Tracks const& tracks) - { - int nAssignedTracks = 0; - int nNotAssignedTracks = 0; - int64_t firstNotAssignedIndex = -1; - int64_t lastNotAssignedIndex = -1; - - for (const auto& track : tracks) { - if (track.has_collision()) { - nAssignedTracks++; - } else { - nNotAssignedTracks++; - if (firstNotAssignedIndex < 0) { - firstNotAssignedIndex = track.globalIndex(); - } else { - lastNotAssignedIndex = track.globalIndex(); - } - } - } - LOGF(info, "Received %d collisions and %d tracks.", collisions.size(), tracks.size()); - LOGF(info, " Assigned tracks %d", nAssignedTracks); - LOGF(info, " Not assigned tracks %d", nNotAssignedTracks); - LOGF(info, " First not assigned track index %d", firstNotAssignedIndex); - LOGF(info, " Last not assigned track index %d", lastNotAssignedIndex); - } - PROCESS_SWITCH(IdentifiedbfTask, processRecLevelCheck, "Process reco level checks", true); - - void processGenLevelCheck(aod::McCollisions const& mccollisions, aod::McParticles const& particles) - { - int nAssignedParticles = 0; - int nNotAssignedParticles = 0; - int64_t firstNotAssignedIndex = -1; - int64_t lastNotAssignedIndex = -1; - - for (const auto& particle : particles) { - if (particle.has_mcCollision()) { - nAssignedParticles++; - } else { - nNotAssignedParticles++; - if (firstNotAssignedIndex < 0) { - firstNotAssignedIndex = particle.globalIndex(); - } else { - lastNotAssignedIndex = particle.globalIndex(); - } - } - } - LOGF(info, "Received %d generated collisions and %d particles.", mccollisions.size(), particles.size()); - LOGF(info, " Assigned tracks %d", nAssignedParticles); - LOGF(info, " Not assigned tracks %d", nNotAssignedParticles); - LOGF(info, " First not assigned track index %d", firstNotAssignedIndex); - LOGF(info, " Last not assigned track index %d", lastNotAssignedIndex); - } - PROCESS_SWITCH(IdentifiedbfTask, processGenLevelCheck, "Process generator level checks", true); - - void processRecLevelNotStored( - soa::Filtered>::iterator const& collision, - aod::BCsWithTimestamps const&, - soa::Filtered> const& tracks) - { - processSame(collision, tracks, collision.bc_as().timestamp()); - } - PROCESS_SWITCH(IdentifiedbfTask, processRecLevelNotStored, - "Process reco level correlations for not stored derived data", - true); - - void processDetLevelNotStored( - soa::Filtered>::iterator const& collision, - aod::BCsWithTimestamps const&, - soa::Filtered> const& tracks, - aod::McParticles const&) - { - processSame(collision, tracks, collision.bc_as().timestamp()); - } - PROCESS_SWITCH(IdentifiedbfTask, processDetLevelNotStored, - "Process detecotr level correlations for not stored derived data", - true); - - void processGenLevel( - soa::Filtered::iterator const& collision, - soa::Filtered> const& tracks) - { - processSame(collision, tracks); - } - PROCESS_SWITCH(IdentifiedbfTask, processGenLevel, "Process generator level correlations", false); - - void processGenLevelNotStored( - soa::Filtered>::iterator const& collision, - soa::Filtered> const& particles) - { - processSame(collision, particles); - } - PROCESS_SWITCH(IdentifiedbfTask, processGenLevelNotStored, - "Process generator level correlations for not stored derived data", - false); - - std::vector - vtxBinsEdges{VARIABLE_WIDTH, -7.0f, -5.0f, -3.0f, -1.0f, 1.0f, 3.0f, 5.0f, 7.0f}; - std::vector multBinsEdges{VARIABLE_WIDTH, 0.0f, 5.0f, 10.0f, 20.0f, 30.0f, 40.0f, 50.0, 100.1f}; - SliceCache cache; - using BinningZVtxMultRec = ColumnBinningPolicy; - BinningZVtxMultRec bindingOnVtxAndMultRec{{vtxBinsEdges, multBinsEdges}, true}; // true is for 'ignore overflows' (true by default) - - void processRecLevelMixed(soa::Filtered const& collisions, aod::BCsWithTimestamps const&, soa::Filtered const& tracks) - { - auto tracksTuple = std::make_tuple(tracks); - SameKindPair, soa::Filtered, BinningZVtxMultRec> pairreco{bindingOnVtxAndMultRec, 5, -1, collisions, tracksTuple, &cache}; // indicates that 5 events should be mixed and under/overflow (-1) to be ignored - - LOGF(IDENTIFIEDBFLOGCOLLISIONS, "Received %d collisions", collisions.size()); - int logcomb = 0; - for (const auto& [collision1, tracks1, collision2, tracks2] : pairreco) { - if (logcomb < correlationstask::maxLogComb) { - LOGF(IDENTIFIEDBFLOGCOLLISIONS, "Received collision pair: %ld (%f, %f): %s, %ld (%f, %f): %s", - collision1.globalIndex(), collision1.posZ(), collision1.centmult(), collision1.collisionaccepted() ? "accepted" : "not accepted", - collision2.globalIndex(), collision2.posZ(), collision2.centmult(), collision2.collisionaccepted() ? "accepted" : "not accepted"); - logcomb++; - } - if (!collision1.collisionaccepted() || !collision2.collisionaccepted()) { - LOGF(error, "Received collision pair: %ld (%f, %f): %s, %ld (%f, %f): %s", - collision1.globalIndex(), collision1.posZ(), collision1.centmult(), collision1.collisionaccepted() ? "accepted" : "not accepted", - collision2.globalIndex(), collision2.posZ(), collision2.centmult(), collision2.collisionaccepted() ? "accepted" : "not accepted"); - } - processMixed(collision1, tracks1, tracks2, collision1.bc_as().timestamp()); - } - } - PROCESS_SWITCH(IdentifiedbfTask, processRecLevelMixed, "Process reco level mixed events correlations", false); - - void processRecLevelMixedNotStored( - soa::Filtered> const& collisions, - aod::BCsWithTimestamps const&, - soa::Filtered> const& tracks) - { - auto tracksTuple = std::make_tuple(tracks); - SameKindPair>, - soa::Filtered>, - BinningZVtxMultRec> - pairreco{bindingOnVtxAndMultRec, - 5, - -1, - collisions, - tracksTuple, - &cache}; // indicates that 5 events should be mixed and under/overflow (-1) to be ignored - - LOGF(IDENTIFIEDBFLOGCOLLISIONS, "Received %d collisions", collisions.size()); - int logcomb = 0; - for (const auto& [collision1, tracks1, collision2, tracks2] : pairreco) { - if (logcomb < correlationstask::maxLogComb) { - LOGF(IDENTIFIEDBFLOGCOLLISIONS, - "Received collision pair: %ld (%f, %f): %s, %ld (%f, %f): %s", - collision1.globalIndex(), - collision1.posZ(), - collision1.centmult(), - collision1.collisionaccepted() ? "accepted" : "not accepted", - collision2.globalIndex(), - collision2.posZ(), - collision2.centmult(), - collision2.collisionaccepted() ? "accepted" : "not accepted"); - logcomb++; - } - if (!collision1.collisionaccepted() || !collision2.collisionaccepted()) { - LOGF(error, - "Received collision pair: %ld (%f, %f): %s, %ld (%f, %f): %s", - collision1.globalIndex(), - collision1.posZ(), - collision1.centmult(), - collision1.collisionaccepted() ? "accepted" : "not accepted", - collision2.globalIndex(), - collision2.posZ(), - collision2.centmult(), - collision2.collisionaccepted() ? "accepted" : "not accepted"); - } - processMixed(collision1, - tracks1, - tracks2, - collision1.bc_as().timestamp()); - } - } - PROCESS_SWITCH(IdentifiedbfTask, processRecLevelMixedNotStored, - "Process reco level mixed events correlations for not stored derived data", - false); - - using BinningZVtxMultGen = ColumnBinningPolicy; - BinningZVtxMultGen bindingOnVtxAndMultGen{{vtxBinsEdges, multBinsEdges}, true}; // true is for 'ignore overflows' (true by default) - - void processGenLevelMixed(soa::Filtered const& collisions, soa::Filtered const& tracks) - { - auto tracksTuple = std::make_tuple(tracks); - SameKindPair, soa::Filtered, BinningZVtxMultGen> pairgen{bindingOnVtxAndMultGen, 5, -1, collisions, tracksTuple, &cache}; // indicates that 5 events should be mixed and under/overflow (-1) to be ignored - - LOGF(IDENTIFIEDBFLOGCOLLISIONS, "Received %d generated collisions", collisions.size()); - int logcomb = 0; - for (const auto& [collision1, tracks1, collision2, tracks2] : pairgen) { - if (logcomb < correlationstask::maxLogComb) { - LOGF(IDENTIFIEDBFLOGCOLLISIONS, "Received generated collision pair: %ld (%f, %f): %s, %ld (%f, %f): %s", - collision1.globalIndex(), collision1.posZ(), collision1.centmult(), collision1.collisionaccepted() ? "accepted" : "not accepted", - collision2.globalIndex(), collision2.posZ(), collision2.centmult(), collision2.collisionaccepted() ? "accepted" : "not accepted"); - } - if (!collision1.collisionaccepted() || !collision2.collisionaccepted()) { - LOGF(error, "Received collision pair: %ld (%f, %f): %s, %ld (%f, %f): %s", - collision1.globalIndex(), collision1.posZ(), collision1.centmult(), collision1.collisionaccepted() ? "accepted" : "not accepted", - collision2.globalIndex(), collision2.posZ(), collision2.centmult(), collision2.collisionaccepted() ? "accepted" : "not accepted"); - } - processMixed(collision1, tracks1, tracks2); - } - } - PROCESS_SWITCH(IdentifiedbfTask, processGenLevelMixed, "Process generator level mixed events correlations", false); - - void processGenLevelMixedNotStored( - soa::Filtered> const& collisions, - soa::Filtered> const& tracks) - { - auto tracksTuple = std::make_tuple(tracks); - SameKindPair>, - soa::Filtered>, - BinningZVtxMultGen> - pairgen{bindingOnVtxAndMultGen, - 5, - -1, - collisions, - tracksTuple, - &cache}; // indicates that 5 events should be mixed and under/overflow (-1) to be ignored - - LOGF(IDENTIFIEDBFLOGCOLLISIONS, "Received %d generated collisions", collisions.size()); - int logcomb = 0; - for (const auto& [collision1, tracks1, collision2, tracks2] : pairgen) { - if (logcomb < correlationstask::maxLogComb) { - LOGF(IDENTIFIEDBFLOGCOLLISIONS, - "Received generated collision pair: %ld (%f, %f): %s, %ld (%f, %f): %s", - collision1.globalIndex(), - collision1.posZ(), - collision1.centmult(), - collision1.collisionaccepted() ? "accepted" : "not accepted", - collision2.globalIndex(), - collision2.posZ(), - collision2.centmult(), - collision2.collisionaccepted() ? "accepted" : "not accepted"); - } - if (!collision1.collisionaccepted() || !collision2.collisionaccepted()) { - LOGF(error, - "Received collision pair: %ld (%f, %f): %s, %ld (%f, %f): %s", - collision1.globalIndex(), - collision1.posZ(), - collision1.centmult(), - collision1.collisionaccepted() ? "accepted" : "not accepted", - collision2.globalIndex(), - collision2.posZ(), - collision2.centmult(), - collision2.collisionaccepted() ? "accepted" : "not accepted"); - } - processMixed(collision1, tracks1, tracks2); - } - } - PROCESS_SWITCH(IdentifiedbfTask, processGenLevelMixedNotStored, - "Process generator level mixed events correlations for not stored derived data", - false); - - /// cleans the output object when the task is not used - void processCleaner(soa::Filtered const& colls) - { - LOGF(IDENTIFIEDBFLOGCOLLISIONS, "Got %d new collisions", colls.size()); - fOutput->Clear(); - } - PROCESS_SWITCH(IdentifiedbfTask, processCleaner, "Cleaner process for not used output", false); -}; - -WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) -{ - WorkflowSpec workflow{ - adaptAnalysisTask(cfgc, TaskName{"IdentifiedbfTaskRec"}, SetDefaultProcesses{{{"processRecLevel", true}, {"processRecLevelMixed", false}, {"processCleaner", false}}}), // o2-linter: disable=name/o2-task (Task is adapted multiple times) - adaptAnalysisTask(cfgc, TaskName{"IdentifiedbfTaskGen"}, SetDefaultProcesses{{{"processGenLevel", false}, {"processGenLevelMixed", false}, {"processCleaner", true}}})}; // o2-linter: disable=name/o2-task (Task is adapted multiple times) - return workflow; -} diff --git a/PWGCF/TwoParticleCorrelations/Tasks/identifiedbfqa.cxx b/PWGCF/TwoParticleCorrelations/Tasks/identifiedbfqa.cxx deleted file mode 100644 index a52ff377832..00000000000 --- a/PWGCF/TwoParticleCorrelations/Tasks/identifiedbfqa.cxx +++ /dev/null @@ -1,152 +0,0 @@ -// Copyright 2019-2020 CERN and copyright holders of ALICE O2. -// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. -// All rights not expressly granted are reserved. -// -// This software is distributed under the terms of the GNU General Public -// License v3 (GPL Version 3), copied verbatim in the file "COPYING". -// -// In applying this license CERN does not waive the privileges and immunities -// granted to it by virtue of its status as an Intergovernmental Organization -// or submit itself to any jurisdiction. - -#include - -#include "Framework/ASoAHelpers.h" -#include "Framework/AnalysisDataModel.h" -#include "Framework/AnalysisTask.h" -#include "Framework/runDataProcessing.h" -#include "PWGCF/TwoParticleCorrelations/DataModel/IdentifiedBfFiltered.h" -#include "PWGCF/TwoParticleCorrelations/TableProducer/identifiedBfFilter.h" - -using namespace o2; -using namespace o2::framework; -using namespace o2::soa; -using namespace o2::framework::expressions; - -#define IDENTIFIEDBFFILTERLOGCOLLISIONS debug -// #define IDENTIFIEDBFFILTERLOGTRACKS debug - -namespace o2::analysis::identifiedbffilterqa -{ -typedef enum { kRECO = 0, - kGEN } innerdatatype; -static constexpr std::string_view dirname[] = {"reconstructed/", "generated/"}; -} // namespace o2::analysis::identifiedbffilterqa - -// Checking the filtered tables -struct IdentifiedBfFilterQA { - Configurable cfgDataType{"datatype", "data", "Data type: data, MC, FastMC, OnTheFlyMC. Default data"}; - HistogramRegistry histos{"IdentifiedBfFilterQA", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; - o2::analysis::identifiedbffilter::DataType datatype; - - template - void createHistograms() - { - - using namespace o2::analysis::identifiedbffilterqa; - - histos.add(TString::Format("%s%s", dirname[dir].data(), "TracksOne").Data(), "Tracks as track one", kTH1F, {{1500, 0.0, 1500.0, "number of tracks"}}); - histos.add(TString::Format("%s%s", dirname[dir].data(), "TracksTwo").Data(), "Tracks as track two", kTH1F, {{1500, 0.0, 1500.0, "number of tracks"}}); - histos.add(TString::Format("%s%s", dirname[dir].data(), "TracksOneAndTwo").Data(), "Tracks as track one and as track two", kTH1F, {{1500, 0.0, 1500.0, "number of tracks"}}); - histos.add(TString::Format("%s%s", dirname[dir].data(), "TracksNone").Data(), "Not selected tracks", kTH1F, {{1500, 0.0, 1500.0, "number of tracks"}}); - histos.add(TString::Format("%s%s", dirname[dir].data(), "TracksOneUnsel").Data(), "Tracks as track one", kTH1F, {{1500, 0.0, 1500.0, "number of tracks"}}); - histos.add(TString::Format("%s%s", dirname[dir].data(), "TracksTwoUnsel").Data(), "Tracks as track two", kTH1F, {{1500, 0.0, 1500.0, "number of tracks"}}); - histos.add(TString::Format("%s%s", dirname[dir].data(), "TracksOneAndTwoUnsel").Data(), "Tracks as track one and as track two", kTH1F, {{1500, 0.0, 1500.0, "number of tracks"}}); - histos.add(TString::Format("%s%s", dirname[dir].data(), "TracksNoneUnsel").Data(), "Not selected tracks", kTH1F, {{1500, 0.0, 1500.0}}); - histos.add(TString::Format("%s%s", dirname[dir].data(), "SelectedEvents").Data(), "Selected events", kTH1F, {{2, 0.0, 2.0}}); - histos.get(HIST(dirname[dir]) + HIST("SelectedEvents"))->GetXaxis()->SetBinLabel(1, "Not selected events"); - histos.get(HIST(dirname[dir]) + HIST("SelectedEvents"))->GetXaxis()->SetBinLabel(2, "Selected events"); - }; - - void init(InitContext const&) - { - using namespace o2::analysis::identifiedbffilter; - using namespace o2::analysis::identifiedbffilterqa; - - switch (getDataType(cfgDataType)) { - case kData: - createHistograms(); - break; - case kMC: - createHistograms(); - createHistograms(); - break; - case kFastMC: - case kOnTheFly: - createHistograms(); - break; - default: - LOGF(fatal, "Data type %s not supported", (std::string)cfgDataType); - break; - } - } - - template - void processQATask(FilteredCollision const& collision, - FilteredTracks const& tracks) - { - using namespace o2::analysis::identifiedbffilterqa; - - if (collision.collisionaccepted() != uint8_t(true)) { - histos.fill(HIST(dirname[dir]) + HIST("SelectedEvents"), 0.5); - } else { - histos.fill(HIST(dirname[dir]) + HIST("SelectedEvents"), 1.5); - } - - int ntracks_one = 0; - int ntracks_two = 0; - int ntracks_one_and_two = 0; - int ntracks_none = 0; - for (auto& track : tracks) { - if (!(track.trackacceptedid() < 0) && !(track.trackacceptedid() < 2)) { - LOGF(fatal, "Task not prepared for identified particles"); - } - if (track.trackacceptedid() != 0 && track.trackacceptedid() != 1) { - ntracks_none++; - } - if (track.trackacceptedid() == 0) { - ntracks_one++; - } - if (track.trackacceptedid() == 1) { - ntracks_two++; - } - } - if (collision.collisionaccepted() != uint8_t(true)) { - /* control for non selected events */ - histos.fill(HIST(dirname[dir]) + HIST("TracksOneUnsel"), ntracks_one); - histos.fill(HIST(dirname[dir]) + HIST("TracksTwoUnsel"), ntracks_two); - histos.fill(HIST(dirname[dir]) + HIST("TracksNoneUnsel"), ntracks_none); - histos.fill(HIST(dirname[dir]) + HIST("TracksOneAndTwoUnsel"), ntracks_one_and_two); - } else { - histos.fill(HIST(dirname[dir]) + HIST("TracksOne"), ntracks_one); - histos.fill(HIST(dirname[dir]) + HIST("TracksTwo"), ntracks_two); - histos.fill(HIST(dirname[dir]) + HIST("TracksNone"), ntracks_none); - histos.fill(HIST(dirname[dir]) + HIST("TracksOneAndTwo"), ntracks_one_and_two); - } - } - - Filter onlyacceptedcollisions = (aod::identifiedbffilter::collisionaccepted == uint8_t(true)); - Filter onlyacceptedtracks = (int8_t(0) <= aod::identifiedbffilter::trackacceptedid); - - void processGeneratorLevel(soa::Filtered::iterator const& collision, soa::Filtered const& tracks) - { - using namespace o2::analysis::identifiedbffilterqa; - LOGF(IDENTIFIEDBFFILTERLOGCOLLISIONS, "New filtered generated collision with BC id %d and with %d accepted tracks", collision.bcId(), tracks.size()); - processQATask(collision, tracks); - } - PROCESS_SWITCH(IdentifiedBfFilterQA, processGeneratorLevel, "Process generator level filter task QA", true); - - void processDetectorLevel(soa::Filtered::iterator const& collision, soa::Filtered const& tracks) - { - using namespace o2::analysis::identifiedbffilterqa; - LOGF(IDENTIFIEDBFFILTERLOGCOLLISIONS, "New filtered collision with BC id %d and with %d accepted tracks", collision.bcId(), tracks.size()); - processQATask(collision, tracks); - } - PROCESS_SWITCH(IdentifiedBfFilterQA, processDetectorLevel, "Process detector level filter task QA", true); -}; - -WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) -{ - WorkflowSpec workflow{adaptAnalysisTask(cfgc)}; - return workflow; -}