Skip to content

Commit bf3eff8

Browse files
authored
PWGEM/PhotonMeson: remove bz dependency (#6091)
* PWGEM/PhotonMeson: fix for event mixing in ee * PWGEM/PhotonMeson: remove bz dependency
1 parent 6912a9d commit bf3eff8

File tree

8 files changed

+67
-9
lines changed

8 files changed

+67
-9
lines changed

PWGEM/PhotonMeson/DataModel/gammaTables.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ DECLARE_SOA_DYNAMIC_COLUMN(EP2BNeg, ep2bneg, [](float q2x, float q2y) -> float {
7878
DECLARE_SOA_TABLE(EMEvents, "AOD", "EMEVENT", //! Main event information table
7979
o2::soa::Index<>, emevent::CollisionId, bc::GlobalBC, bc::RunNumber, evsel::Sel8, evsel::Alias, evsel::Selection, emevent::NcollsPerBC,
8080
collision::PosX, collision::PosY, collision::PosZ,
81-
collision::NumContrib, collision::CollisionTime, collision::CollisionTimeRes);
81+
collision::NumContrib, collision::CollisionTime, collision::CollisionTimeRes, emevent::Bz);
8282
using EMEvent = EMEvents::iterator;
8383

8484
DECLARE_SOA_TABLE(EMEventsBz, "AOD", "EMEVENTBZ", emevent::Bz); // joinable to EMEvents

PWGEM/PhotonMeson/TableProducer/createEMEvent.cxx

Lines changed: 60 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,20 @@
1919
#include "Framework/AnalysisDataModel.h"
2020
#include "Framework/ASoAHelpers.h"
2121
#include "ReconstructionDataFormats/Track.h"
22+
23+
#include "DetectorsBase/GeometryManager.h"
24+
#include "DataFormatsParameters/GRPObject.h"
25+
#include "DataFormatsParameters/GRPMagField.h"
26+
#include "CCDB/BasicCCDBManager.h"
27+
2228
#include "PWGEM/PhotonMeson/DataModel/gammaTables.h"
2329

2430
using namespace o2;
2531
using namespace o2::framework;
2632
using namespace o2::framework::expressions;
2733
using namespace o2::soa;
2834

29-
using MyBCs = soa::Join<aod::BCs, aod::BcSels>;
35+
using MyBCs = soa::Join<aod::BCsWithTimestamps, aod::BcSels>;
3036

3137
using MyCollisions = soa::Join<aod::Collisions, aod::EvSels, aod::Mults>;
3238
using MyCollisions_Cent = soa::Join<MyCollisions, aod::CentFT0Ms, aod::CentFT0As, aod::CentFT0Cs, aod::CentNTPVs>; // centrality table has dependency on multiplicity table.
@@ -48,6 +54,13 @@ struct CreateEMEvent {
4854
kEvent_Cent_Qvec = 2,
4955
};
5056

57+
// CCDB options
58+
Configurable<std::string> ccdburl{"ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"};
59+
Configurable<std::string> grpPath{"grpPath", "GLO/GRP/GRP", "Path of the grp file"};
60+
Configurable<std::string> grpmagPath{"grpmagPath", "GLO/Config/GRPMagField", "CCDB path of the GRPMagField object"};
61+
Configurable<bool> skipGRPOquery{"skipGRPOquery", true, "skip grpo query"};
62+
Configurable<double> d_bz_input{"d_bz", -999, "bz field, -999 is automatic"};
63+
5164
HistogramRegistry registry{"registry"};
5265
void init(o2::framework::InitContext&)
5366
{
@@ -56,6 +69,49 @@ struct CreateEMEvent {
5669
hEventCounter->GetXaxis()->SetBinLabel(2, "sel8");
5770
}
5871

72+
int mRunNumber;
73+
float d_bz;
74+
Service<o2::ccdb::BasicCCDBManager> ccdb;
75+
76+
template <typename TBC>
77+
void initCCDB(TBC const& bc)
78+
{
79+
if (mRunNumber == bc.runNumber()) {
80+
return;
81+
}
82+
83+
// In case override, don't proceed, please - no CCDB access required
84+
if (d_bz_input > -990) {
85+
d_bz = d_bz_input;
86+
o2::parameters::GRPMagField grpmag;
87+
if (fabs(d_bz) > 1e-5) {
88+
grpmag.setL3Current(30000.f / (d_bz / 5.0f));
89+
}
90+
mRunNumber = bc.runNumber();
91+
return;
92+
}
93+
94+
auto run3grp_timestamp = bc.timestamp();
95+
o2::parameters::GRPObject* grpo = 0x0;
96+
o2::parameters::GRPMagField* grpmag = 0x0;
97+
if (!skipGRPOquery)
98+
grpo = ccdb->getForTimeStamp<o2::parameters::GRPObject>(grpPath, run3grp_timestamp);
99+
if (grpo) {
100+
// Fetch magnetic field from ccdb for current collision
101+
d_bz = grpo->getNominalL3Field();
102+
LOG(info) << "Retrieved GRP for timestamp " << run3grp_timestamp << " with magnetic field of " << d_bz << " kZG";
103+
} else {
104+
grpmag = ccdb->getForTimeStamp<o2::parameters::GRPMagField>(grpmagPath, run3grp_timestamp);
105+
if (!grpmag) {
106+
LOG(fatal) << "Got nullptr from CCDB for path " << grpmagPath << " of object GRPMagField and " << grpPath << " of object GRPObject for timestamp " << run3grp_timestamp;
107+
}
108+
// Fetch magnetic field from ccdb for current collision
109+
d_bz = std::lround(5.f * grpmag->getL3Current() / 30000.f);
110+
LOG(info) << "Retrieved GRP for timestamp " << run3grp_timestamp << " with magnetic field of " << d_bz << " kZG";
111+
}
112+
mRunNumber = bc.runNumber();
113+
}
114+
59115
PresliceUnsorted<MyCollisions> preslice_collisions_per_bc = o2::aod::evsel::foundBCId;
60116
std::unordered_map<uint64_t, int> map_ncolls_per_bc;
61117

@@ -76,7 +132,9 @@ struct CreateEMEvent {
76132
continue;
77133
}
78134
}
135+
79136
auto bc = collision.template foundBC_as<TBCs>();
137+
initCCDB(bc);
80138

81139
// LOGF(info, "collision-loop | bc.globalIndex() = %d, ncolls_per_bc = %d", bc.globalIndex(), map_ncolls_per_bc[bc.globalIndex()]);
82140
registry.fill(HIST("hEventCounter"), 1);
@@ -88,7 +146,7 @@ struct CreateEMEvent {
88146
// uint64_t tag = collision.selection_raw();
89147
event(collision.globalIndex(), bc.globalBC(), bc.runNumber(), collision.sel8(), collision.alias_raw(), collision.selection_raw(), map_ncolls_per_bc[bc.globalIndex()],
90148
collision.posX(), collision.posY(), collision.posZ(),
91-
collision.numContrib(), collision.collisionTime(), collision.collisionTimeRes());
149+
collision.numContrib(), collision.collisionTime(), collision.collisionTimeRes(), d_bz);
92150

93151
event_mult(collision.multFV0A(), collision.multFV0C(), collision.multFT0A(), collision.multFT0C(), collision.multFDDA(), collision.multFDDC(),
94152
collision.multZNA(), collision.multZNC(),

PWGEM/PhotonMeson/TableProducer/skimmerDalitzEE.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ using namespace o2::framework;
2626
using namespace o2::framework::expressions;
2727
using namespace o2::constants::physics;
2828

29-
using MyCollisions = soa::Join<aod::EMEvents, aod::EMEventsMult, aod::EMEventsCent, aod::EMEventsBz>;
29+
using MyCollisions = soa::Join<aod::EMEvents, aod::EMEventsMult, aod::EMEventsCent>;
3030
using MyCollision = MyCollisions::iterator;
3131

3232
using MyTracks = soa::Join<aod::EMPrimaryElectrons, aod::EMPrimaryElectronEMEventIds>;

PWGEM/PhotonMeson/Tasks/PhotonHBT.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ using namespace o2::soa;
4343
using namespace o2::aod::photonpair;
4444
using namespace o2::aod::pwgem::photon;
4545

46-
using MyCollisions = soa::Join<aod::EMEvents, aod::EMEventsMult, aod::EMEventsCent, aod::EMEventsNgPCM, aod::EMEventsNee, aod::EMEventsBz>;
46+
using MyCollisions = soa::Join<aod::EMEvents, aod::EMEventsMult, aod::EMEventsCent, aod::EMEventsNgPCM, aod::EMEventsNee>;
4747
using MyCollision = MyCollisions::iterator;
4848

4949
using MyV0Photons = soa::Join<aod::V0PhotonsKF, aod::V0KFEMEventIds>;

PWGEM/PhotonMeson/Tasks/Pi0EtaToGammaGamma.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ using namespace o2::soa;
4747
using namespace o2::aod::photonpair;
4848
using namespace o2::aod::pwgem::photon;
4949

50-
using MyCollisions = soa::Join<aod::EMEvents, aod::EMEventsMult, aod::EMEventsCent, aod::EMEventsQvec, aod::EMEventsNgPCM, aod::EMEventsNgPHOS, aod::EMEventsNgEMC, aod::EMEventsNee, aod::EMEventsBz>;
50+
using MyCollisions = soa::Join<aod::EMEvents, aod::EMEventsMult, aod::EMEventsCent, aod::EMEventsQvec, aod::EMEventsNgPCM, aod::EMEventsNgPHOS, aod::EMEventsNgEMC, aod::EMEventsNee>;
5151
using MyCollision = MyCollisions::iterator;
5252

5353
using MyV0Photons = soa::Join<aod::V0PhotonsKF, aod::V0KFEMEventIds>;

PWGEM/PhotonMeson/Tasks/Pi0EtaToGammaGammaMC.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ using namespace o2::aod::photonpair;
4242
using namespace o2::aod::pwgem::mcutil;
4343
using namespace o2::aod::pwgem::photon;
4444

45-
using MyCollisions = soa::Join<aod::EMEvents, aod::EMEventsMult, aod::EMEventsCent, aod::EMEventsQvec, aod::EMMCEventLabels, aod::EMEventsBz>;
45+
using MyCollisions = soa::Join<aod::EMEvents, aod::EMEventsMult, aod::EMEventsCent, aod::EMEventsQvec, aod::EMMCEventLabels>;
4646
using MyCollision = MyCollisions::iterator;
4747

4848
using MyV0Photons = soa::Join<aod::V0PhotonsKF, aod::V0KFEMEventIds>;

PWGEM/PhotonMeson/Tasks/TaggingPi0.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ using namespace o2::soa;
4242
using namespace o2::aod::photonpair;
4343
using namespace o2::aod::pwgem::photon;
4444

45-
using MyCollisions = soa::Join<aod::EMEvents, aod::EMEventsMult, aod::EMEventsCent, aod::EMEventsNgPCM, aod::EMEventsNgPHOS, aod::EMEventsNgEMC, aod::EMEventsNee, aod::EMEventsBz>;
45+
using MyCollisions = soa::Join<aod::EMEvents, aod::EMEventsMult, aod::EMEventsCent, aod::EMEventsNgPCM, aod::EMEventsNgPHOS, aod::EMEventsNgEMC, aod::EMEventsNee>;
4646
using MyCollision = MyCollisions::iterator;
4747

4848
using MyV0Photons = soa::Join<aod::V0PhotonsKF, aod::V0KFEMEventIds>;

PWGEM/PhotonMeson/Tasks/TaggingPi0MC.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ using namespace o2::aod::photonpair;
4646
using namespace o2::aod::pwgem::mcutil;
4747
using namespace o2::aod::pwgem::photon;
4848

49-
using MyCollisions = soa::Join<aod::EMEvents, aod::EMEventsMult, aod::EMEventsCent, aod::EMMCEventLabels, aod::EMEventsBz>;
49+
using MyCollisions = soa::Join<aod::EMEvents, aod::EMEventsMult, aod::EMEventsCent, aod::EMMCEventLabels>;
5050
using MyCollision = MyCollisions::iterator;
5151

5252
using MyV0Photons = soa::Join<aod::V0PhotonsKF, aod::V0KFEMEventIds>;

0 commit comments

Comments
 (0)