Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 13 additions & 7 deletions PWGEM/PhotonMeson/DataModel/gammaTables.h
Original file line number Diff line number Diff line change
Expand Up @@ -173,19 +173,25 @@ DECLARE_SOA_INDEX_COLUMN(V0DaughterMcParticle, v0DaughterMcParticle);
// DECLARE_SOA_INDEX_TABLE_USER(MCTrackIndex, V0MCDaughterParticles, "MCTRACKINDEX", MCParticleTrueIndex::V0DaughterTrackId);
DECLARE_SOA_TABLE(MCParticleIndex, "AOD", "MCPARTICLEINDEX", MCParticleTrueIndex::V0DaughterMcParticleId);

namespace gammarecalculated
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice! I have wanted to change this for ages! thanks :)

namespace v0Recalculations
{
DECLARE_SOA_COLUMN(RecalculatedVtxX, recalculatedVtxX, float); //! Recalculated conversion point
DECLARE_SOA_COLUMN(RecalculatedVtxY, recalculatedVtxY, float); //! Recalculated conversion point
DECLARE_SOA_COLUMN(RecalculatedVtxZ, recalculatedVtxZ, float); //! Recalculated conversion point
DECLARE_SOA_DYNAMIC_COLUMN(RecalculatedVtxR, recalculatedVtxR, [](float x, float y) { return TMath::Sqrt(x * x + y * y); });
} // namespace gammarecalculated
} // namespace v0Recalculations

DECLARE_SOA_TABLE(V0Recalculated, "AOD", "V0RECALCULATED",
gammarecalculated::RecalculatedVtxX,
gammarecalculated::RecalculatedVtxY,
gammarecalculated::RecalculatedVtxZ,
gammarecalculated::RecalculatedVtxR<o2::aod::gammarecalculated::RecalculatedVtxX, o2::aod::gammarecalculated::RecalculatedVtxY>);
namespace v0KFParticle
{
DECLARE_SOA_COLUMN(ChiSquare, chiSquare, float); // Chi2 of the reconstructed V0
} // namespace v0KFParticle

DECLARE_SOA_TABLE(V0RecalculationAndKF, "AOD", "V0RECALCANDKF",
v0Recalculations::RecalculatedVtxX,
v0Recalculations::RecalculatedVtxY,
v0Recalculations::RecalculatedVtxZ,
v0Recalculations::RecalculatedVtxR<o2::aod::v0Recalculations::RecalculatedVtxX, o2::aod::v0Recalculations::RecalculatedVtxY>,
v0KFParticle::ChiSquare);

namespace gammamctrue
{
Expand Down
49 changes: 19 additions & 30 deletions PWGEM/PhotonMeson/TableProducer/skimmerGammaConversions.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,6 @@
// *****revision history*****:
//
// added recalculation of the conversion point on 08.07.22 by Nikita Philip Tatsch (tatsch@physi.uni-heidelberg.de)
//
// **************************

// *****revision history*****:
//
// added recalculation of the conversion point on 08.07.22 by Nikita Philip Tatsch (tatsch@physi.uni-heidelberg.de)
//
// **************************

// *****revision history*****:
//
// adding accesing to ccdb objects for 2022 data taking on 30.11.22 by A. Marin (a.marin@gsi.de)
//
// **************************
Expand All @@ -53,24 +42,23 @@
#include "ReconstructionDataFormats/TrackFwd.h"
#include "Common/Core/trackUtilities.h"

#include <TMath.h> // for ATan2, Cos, Sin, Sqrt
#include "TVector2.h"
#include <TMath.h>
#include <TVector2.h>

using namespace o2;
using namespace o2::framework;
using namespace o2::framework::expressions;

// using collisionEvSelIt = soa::Join<aod::Collisions, aod::EvSels>::iterator;
using tracksAndTPCInfo = soa::Join<aod::Tracks, aod::TracksExtra, aod::TracksDCA, aod::pidTPCEl, aod::pidTPCPi>;
using tracksAndTPCInfoMC = soa::Join<aod::Tracks, aod::TracksExtra, aod::TracksDCA, aod::pidTPCEl, aod::pidTPCPi, aod::McTrackLabels>;

struct skimmerGammaConversions {

//configurables for CCDB access
Configurable<std::string> path{"ccdb-path", "GLO/GRP/GRP", "path to the ccdb object"};
Configurable<std::string> grpmagPath{"grpmagPath", "GLO/Config/GRPMagField", "CCDB path of the GRPMagField object"};
Configurable<std::string> url{"ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"};
Configurable<int64_t> nolaterthan{"ccdb-no-later-than", std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now().time_since_epoch()).count(), "latest acceptable timestamp of creation for the object"};
Configurable<std::string> ccdbPath{"ccdb-path", "GLO/GRP/GRP", "path to the ccdb object"};
Configurable<std::string> grpmagPath{"grpmagPath", "GLO/Config/GRPMagField", "path to the GRPMagField object"};
Configurable<std::string> ccdbUrl{"ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"};
Configurable<int64_t> ccdbNoLaterThan{"ccdb-no-later-than", std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now().time_since_epoch()).count(), "latest acceptable timestamp of creation for the object"};

HistogramRegistry fRegistry{
"fRegistry",
Expand Down Expand Up @@ -108,7 +96,7 @@ struct skimmerGammaConversions {

Produces<aod::V0DaughterTracks> fFuncTableV0DaughterTracks;
Produces<aod::McGammasTrue> fFuncTableMcGammasFromConfirmedV0s;
Produces<aod::V0Recalculated> fFuncTableV0Recalculated;
Produces<aod::V0RecalculationAndKF> fFuncTableV0Recalculated;
Produces<aod::V0DaughterMcParticles> fFuncTableMCTrackInformation;
Produces<aod::MCParticleIndex> fIndexTableMCTrackIndex;

Expand All @@ -130,14 +118,12 @@ struct skimmerGammaConversions {
lXaxis->SetBinLabel(lPairIt.first + 1, lPairIt.second.data());
}

// This is added in order to access the ccdb

ccdb->setURL(url.value);
ccdb->setURL(ccdbUrl);
ccdb->setCaching(true);
ccdb->setLocalObjectValidityChecking(); // no idea wether this is useful or not, there is no documentation
ccdb->setLocalObjectValidityChecking();
// Not later than now, will be replaced by the value of the train creation
// This avoids that users can replace objects **while** a train is running
ccdb->setCreatedNotAfter(nolaterthan.value); // was like that in the tutorial efficiencyPerRun
ccdb->setCreatedNotAfter(ccdbNoLaterThan);
ccdb->setFatalWhenNull(false);
}

Expand All @@ -147,20 +133,23 @@ struct skimmerGammaConversions {
if (runNumber == bc.runNumber()) {
return;
}

auto run3grp_timestamp = bc.timestamp();
o2::parameters::GRPObject* grpo = ccdb->getForTimeStamp<o2::parameters::GRPObject>(path.value, bc.timestamp());
o2::parameters::GRPMagField* grpmag = 0x0;
o2::parameters::GRPObject* grpo = ccdb->getForTimeStamp<o2::parameters::GRPObject>(ccdbPath, run3grp_timestamp);
o2::parameters::GRPMagField* grpmag = nullptr;

if (grpo) {
o2::base::Propagator::initFieldFromGRP(grpo);
} else {
grpmag = ccdb->getForTimeStamp<o2::parameters::GRPMagField>(grpmagPath, run3grp_timestamp);
if (!grpmag) {
LOG(fatal) << "Got nullptr from CCDB for path " << grpmagPath << " of object GRPMagField and " << path << " of object GRPObject for timestamp " << run3grp_timestamp;
LOG(fatal) << "Got nullptr from CCDB for path " << grpmagPath << " of object GRPMagField and " << ccdbPath << " of object GRPObject for timestamp " << run3grp_timestamp;
} else {
LOG(info) << "Magnetic field initialized from GRPMagField";
}
o2::base::Propagator::initFieldFromGRP(grpmag);
}
//o2::base::Propagator::Instance()->setMatLUT(lut);

runNumber = bc.runNumber();
}

Expand Down Expand Up @@ -189,7 +178,8 @@ struct skimmerGammaConversions {
fFuncTableV0Recalculated(
recalculatedVtx[0],
recalculatedVtx[1],
recalculatedVtx[2]);
recalculatedVtx[2],
0.0); // temporarily add 0
}

template <typename TTRACK>
Expand Down Expand Up @@ -393,7 +383,6 @@ struct skimmerGammaConversions {
void Vtx_recalculation(T lTrackPos, T lTrackNeg, float* conversionPosition)
{
o2::base::Propagator* prop = o2::base::Propagator::Instance(); //This singleton propagator requires some initialisation of the CCDB object.

float bz = prop->getNominalBz();

//*******************************************************
Expand Down
19 changes: 13 additions & 6 deletions PWGEM/PhotonMeson/Tasks/gammaConversions.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@
/// \author stephan.friedrich.stiefelmaier@cern.ch

#include "PWGEM/PhotonMeson/Tasks/gammaConversions.h"

#include <map>
#include <vector>
#include <string>
#include <memory>

#include "PWGEM/PhotonMeson/DataModel/gammaTables.h"
#include "PWGEM/PhotonMeson/Utils/gammaConvDefinitions.h"

Expand All @@ -29,7 +35,7 @@ using namespace o2;
using namespace o2::framework;
using namespace o2::framework::expressions;

using V0DatasAdditional = soa::Join<aod::V0Datas, aod::V0Recalculated>;
using V0DatasAdditional = soa::Join<aod::V0Datas, aod::V0RecalculationAndKF>;
using V0DaughterTracksWithMC = soa::Join<aod::V0DaughterTracks, aod::MCParticleIndex>;

// using collisionEvSelIt = soa::Join<aod::Collisions, aod::EvSels>::iterator;
Expand Down Expand Up @@ -64,7 +70,7 @@ struct GammaConversions {
Configurable<float> fV0QtPtMultiplicator{"fV0QtPtMultiplicator", 0.125, "Multiply pt of V0s by this value to get the 2nd denominator in the armenteros cut. The products maximum value is fV0QtMax."};
Configurable<float> fV0QtMax{"fV0QtMax", 0.050, "the maximum value of the product, that is the maximum qt"};
Configurable<float> fLineCutZ0{"fLineCutZ0", 12.0, "The offset for the linecute used in the Z vs R plot"};
Configurable<float> fLineCutZRSlope{"fLineCutZRSlope", (float)TMath::Tan(2 * TMath::ATan(TMath::Exp(-fTruePhotonEtaMax))), "The slope for the line cut"};
Configurable<float> fLineCutZRSlope{"fLineCutZRSlope", static_cast<float>(TMath::Tan(2 * TMath::ATan(TMath::Exp(-fTruePhotonEtaMax)))), "The slope for the line cut"};
Configurable<bool> fPhysicalPrimaryOnly{"fPhysicalPrimaryOnly", true, "fPhysicalPrimaryOnly"};

std::map<ePhotonCuts, std::string> fPhotonCutLabels{
Expand Down Expand Up @@ -146,6 +152,7 @@ struct GammaConversions {
{"hPsiPt", "hPsiPt;#Psi;p_{T} (GeV/c)", {HistType::kTH2F, {gAxis_eta, gAxis_pT}}},
{"hCosPAngle", "hCosPAngle;CosPAngle;counts", {HistType::kTH1F, {{800, 0.99f, 1.005f}}}},
{"hRVsZ", "hRVsZ;R (cm);z (cm)", {HistType::kTH2F, {gAxis_r, gAxis_xyz}}},
{"hXVsY", "hXVsY;conversion x (cm);conversion y (cm)", {HistType::kTH2F, {gAxis_z2d, gAxis_z2d}}},
{"hpeDivpGamma", "hpeDivpGamma;p_{T} (GeV/c);p_{T, e}/p_{T, #gamma};counts", {HistType::kTH2F, {gAxis_pT, {220, 0.f, 1.1f}}}}};

// recalculated conversion Point for V0, only Rec and MCVal need this
Expand Down Expand Up @@ -732,7 +739,8 @@ struct GammaConversions {
fillTH2(theContainer, "hArmenteros", theV0.alpha(), theV0.qtarm());
fillTH2(theContainer, "hinvestigationOfQtCut", theV0.qtarm(), theV0.pt());
fillTH2(theContainer, "hPsiPt", theV0.psipair(), theV0.pt());
fillTH2(theContainer, "hRVsZ", theV0.recalculatedVtxR(), theV0.z()); // as long as z recalculation is not fixed use this
fillTH2(theContainer, "hRVsZ", theV0.recalculatedVtxR(), theV0.recalculatedVtxZ());
fillTH2(theContainer, "hXVsY", theV0.recalculatedVtxX(), theV0.recalculatedVtxY());
fillTH2(theContainer, "hpeDivpGamma", RecoDecay::sqrtSumOfSquares(theV0.px(), theV0.py()), theV0.pfracpos());
fillTH2(theContainer, "hpeDivpGamma", RecoDecay::sqrtSumOfSquares(theV0.px(), theV0.py()), theV0.pfracneg());
}
Expand Down Expand Up @@ -880,9 +888,8 @@ struct GammaConversions {
fillV0SelectionHisto(ePhotonCuts::kPionRejLowMom);
return kFALSE;
}
}
// High Pt Pion rej
else {
} else {
if (theTrack.tpcNSigmaEl() > fPIDnSigmaElectronMin && theTrack.tpcNSigmaEl() < fPIDnSigmaElectronMax && theTrack.tpcNSigmaPi() < fPIDnSigmaAbovePionLineHighPMin) {
fillV0SelectionHisto(ePhotonCuts::kPionRejHighMom);
return kFALSE;
Expand All @@ -896,4 +903,4 @@ struct GammaConversions {
WorkflowSpec defineDataProcessing(ConfigContext const& cfgc)
{
return WorkflowSpec{adaptAnalysisTask<GammaConversions>(cfgc)};
}
}
2 changes: 1 addition & 1 deletion PWGEM/PhotonMeson/Utils/gammaConvDefinitions.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ AxisSpec const gAxis_r{800, 0.f, 200.f};
AxisSpec const gAxis_r_extended{800, 0.f, 500.f};
AxisSpec const gAxis_dr{200, -100.f, 100.f};
AxisSpec const gAxis_r2d{400, 0.f, 250.f};
AxisSpec const gAxis_z2d{400, -250.f, 250.f};
AxisSpec const gAxis_z2d{1000, -250.f, 250.f};
AxisSpec const gAxis_TPCdEdxSig{401, -10.025f, 10.025f};
AxisSpec const gAxis_radRes{800, -PI, PI};
AxisSpec const gAxis_xyz{2400, -300.f, 300.f};
Expand Down