Skip to content

Commit d4421b0

Browse files
author
tgundem
committed
Revert "Store the monopole mass in the MCEventHeader and use it when reading kinematics"
This reverts commit dafdd19.
1 parent dafdd19 commit d4421b0

4 files changed

Lines changed: 13 additions & 114 deletions

File tree

‎DataFormats/simulation/include/SimulationDataFormat/MonopoleParticles.h‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,6 @@ constexpr int MonopolePdgAsymm = 4120000;
3434
/// Default monopole mass in GeV.
3535
constexpr double MonopoleMassDefaultGeV = 100.;
3636

37-
/// Key under which the monopole mass (GeV) used in a simulation is stored in the MCEventHeader,
38-
/// so that readers of the kinematics can use the mass the events were produced with.
39-
constexpr const char* MonopoleMassHeaderKey = "monopoleMass";
40-
4137
/// true for the monopole and antimonopole of both species
4238
constexpr bool isMonopole(int pdg) noexcept
4339
{

‎DataFormats/simulation/include/SimulationDataFormat/O2DatabasePDG.h‎

Lines changed: 13 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
#ifndef O2_O2DATABASEPDG_H
1717
#define O2_O2DATABASEPDG_H
1818

19-
#include <atomic>
2019
#include <cmath>
2120
#include <string>
2221
#include "TDatabasePDG.h"
@@ -40,8 +39,7 @@ class O2DatabasePDG
4039
static bool initialized = false; // initialize this --> adds particles to TDatabasePDG;
4140
auto db = TDatabasePDG::Instance();
4241
if (!initialized) {
43-
// uses the monopole mass of the simulation if a reader has already set it
44-
addALICEParticles(db, getMonopoleMass());
42+
addALICEParticles(db);
4543
initialized = true;
4644
}
4745
return db;
@@ -70,26 +68,6 @@ class O2DatabasePDG
7068
return true;
7169
}
7270

73-
// Sets the mass (GeV) of the monopole species for consumers of simulated data, which do not
74-
// have access to G4Params.monopoleMass. It is taken from the MCEventHeader of the
75-
// simulation (key o2::sim::MonopoleMassHeaderKey) by MCKinematicsReader.
76-
// It only affects Mass() (hence MCTrack::GetMass() / GetEnergy() / GetRapidity()) and
77-
// Instance() if called before the first Instance(): particles already registered in a
78-
// TDatabasePDG keep their mass, since ROOT offers no way to change it afterwards.
79-
// Not used (and not needed) in the simulation itself, where TDatabasePDG is registered
80-
// with G4Params.monopoleMass.
81-
static void setMonopoleMass(double massGeV) { monopoleMassOverride().store(massGeV); }
82-
83-
// mass set by setMonopoleMass(), or the default if it was never set
84-
static double getMonopoleMass()
85-
{
86-
const double mass = monopoleMassOverride().load();
87-
return mass > 0. ? mass : o2::sim::MonopoleMassDefaultGeV;
88-
}
89-
90-
// true if a monopole mass was set by setMonopoleMass()
91-
static bool hasMonopoleMassOverride() { return monopoleMassOverride().load() > 0.; }
92-
9371
// get particle's (if any) mass
9472
static Double_t MassImpl(TParticlePDG* particle, bool& success)
9573
{
@@ -104,11 +82,6 @@ class O2DatabasePDG
10482
// determine particle to get mass for based on PDG
10583
static Double_t Mass(int pdg, bool& success, TDatabasePDG* db = O2DatabasePDG::Instance())
10684
{
107-
if (hasMonopoleMassOverride() && o2::sim::isMonopole(pdg)) {
108-
// the table may have been filled with the default mass before the simulation mass was known
109-
success = true;
110-
return getMonopoleMass();
111-
}
11285
if (pdg < IONBASELOW || pdg > IONBASEHIGH) {
11386
// not an ion, return immediately
11487
return MassImpl(db->GetParticle(pdg), success);
@@ -126,13 +99,6 @@ class O2DatabasePDG
12699
O2DatabasePDG() = delete;
127100

128101
private:
129-
// negative: not set (the TDatabasePDG content is used)
130-
static std::atomic<double>& monopoleMassOverride()
131-
{
132-
static std::atomic<double> mass{-1.};
133-
return mass;
134-
}
135-
136102
static constexpr int IONBASELOW{1000000000};
137103
static constexpr int IONBASEHIGH{1099999999};
138104
};
@@ -195,7 +161,7 @@ inline void O2DatabasePDG::addALICEParticles(TDatabasePDG* db, double monopoleMa
195161
db->AddParticle("A_0+ ", " ", 0.9960, kFALSE, 0.0, +3, "meson", 9000211);
196162
db->AddParticle("A_0- ", " ", 0.9960, kFALSE, 0.0, -3, "meson", -9000211);
197163

198-
// db->AddParticle("F0P0 ", " ", 0.9960, kFALSE, 0.0, 0, "meson", 9010221);
164+
//db->AddParticle("F0P0 ", " ", 0.9960, kFALSE, 0.0, 0, "meson", 9010221);
199165

200166
db->AddParticle("KDL_2+ ", " ", 1.773, kFALSE, 0.0, +3, "meson", 10325);
201167
db->AddParticle("KDL_2- ", " ", 1.773, kFALSE, 0.0, -3, "meson", -10325);
@@ -295,7 +261,7 @@ inline void O2DatabasePDG::addALICEParticles(TDatabasePDG* db, double monopoleMa
295261
db->AddParticle("FeedbackPhoton", "FeedbackPhoton", 0, kFALSE,
296262
0, 0, "Special", kspe + 51);
297263

298-
// Hyper nuclei and exotica
264+
//Hyper nuclei and exotica
299265
ionCode = 1010010030;
300266
if (!db->GetParticle(ionCode)) {
301267
db->AddParticle("HyperTriton", "HyperTriton", 2.991134, kFALSE,
@@ -308,25 +274,25 @@ inline void O2DatabasePDG::addALICEParticles(TDatabasePDG* db, double monopoleMa
308274
2.5e-15, 3, "Ion", ionCode);
309275
}
310276

311-
// hyper hydrogen 4 ground state
277+
//hyper hydrogen 4 ground state
312278
ionCode = 1010010040;
313279
if (!db->GetParticle(ionCode)) {
314280
db->AddParticle("Hyperhydrog4", "Hyperhydrog4", 3.922434, kFALSE,
315281
2.5e-15, 3, "Ion", ionCode);
316282
}
317-
// anti hyper hydrogen 4 ground state
283+
//anti hyper hydrogen 4 ground state
318284
ionCode = -1010010040;
319285
if (!db->GetParticle(ionCode)) {
320286
db->AddParticle("AntiHyperhydrog4", "AntiHyperhydrog4", 3.922434, kFALSE,
321287
2.5e-15, 3, "Ion", ionCode);
322288
}
323-
// hyper helium 4 ground state
289+
//hyper helium 4 ground state
324290
ionCode = 1010020040;
325291
if (!db->GetParticle(ionCode)) {
326292
db->AddParticle("Hyperhelium4", "Hyperhelium4", 3.921728, kFALSE,
327293
2.5e-15, 6, "Ion", ionCode);
328294
}
329-
// anti hyper helium 4 ground state
295+
//anti hyper helium 4 ground state
330296
ionCode = -1010020040;
331297
if (!db->GetParticle(ionCode)) {
332298
db->AddParticle("AntiHyperhelium4", "AntiHyperhelium4", 3.921728, kFALSE,
@@ -676,9 +642,9 @@ inline void O2DatabasePDG::addALICEParticles(TDatabasePDG* db, double monopoleMa
676642
0.040, -3, "Resonance", -ionCode);
677643
}
678644

679-
// Additional Hidden Strangeness Pentaquarks
645+
//Additional Hidden Strangeness Pentaquarks
680646

681-
// Ps +/-
647+
//Ps +/-
682648
ionCode = 9322132;
683649
if (!db->GetParticle(ionCode)) {
684650
db->AddParticle("Ps_Plus_1870", "Ps_Plus_1870", 1.870, kFALSE,
@@ -716,7 +682,7 @@ inline void O2DatabasePDG::addALICEParticles(TDatabasePDG* db, double monopoleMa
716682
0.10, -3, "Resonance", -ionCode);
717683
}
718684

719-
// Ps0
685+
//Ps0
720686
ionCode = 9322131;
721687
if (!db->GetParticle(ionCode)) {
722688
db->AddParticle("Ps_0_1870", "Ps_0_1870", 1.870, kFALSE,
@@ -820,14 +786,14 @@ inline void O2DatabasePDG::addALICEParticles(TDatabasePDG* db, double monopoleMa
820786

821787
// d*(2380) - dibaryon resonance
822788

823-
ionCode = 900010020; // Arbitrary choice - as deuteron but with leading 9 instead of 10
789+
ionCode = 900010020; //Arbitrary choice - as deuteron but with leading 9 instead of 10
824790
if (!db->GetParticle(ionCode)) {
825791
db->AddParticle("d*_2380", "d*_2380", 2.38, kFALSE,
826792
0.070, 3, "Resonance", ionCode);
827793
}
828794
db->AddAntiParticle("d*_2380_bar", -ionCode);
829795

830-
// Sexaquark (uuddss): compact, neutral and stable hypothetical bound state (arxiv.org/abs/1708.08951)
796+
//Sexaquark (uuddss): compact, neutral and stable hypothetical bound state (arxiv.org/abs/1708.08951)
831797
ionCode = 900000020;
832798
if (!db->GetParticle(ionCode)) {
833799
db->AddParticle("Sexaquark", "Sexaquark", 2.0, kTRUE, 0.0, 0, "Special", ionCode);
@@ -860,4 +826,4 @@ inline void O2DatabasePDG::addParticlesFromExternalFile(TDatabasePDG* db)
860826

861827
} // namespace o2
862828

863-
#endif // O2_O2DATABASEPDG_H
829+
#endif //O2_O2DATABASEPDG_H

‎Steer/src/MCKinematicsReader.cxx‎

Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@
1313
#include "Steer/MCKinematicsReader.h"
1414
#include "SimulationDataFormat/MCEventHeader.h"
1515
#include "SimulationDataFormat/TrackReference.h"
16-
#include "SimulationDataFormat/MonopoleParticles.h"
17-
#include "SimulationDataFormat/O2DatabasePDG.h"
1816
#include <TChain.h>
1917
#include <stdexcept>
2018
#include <string>
@@ -84,29 +82,6 @@ void MCKinematicsReader::initTracksForSource(int source) const
8482
}
8583
}
8684

87-
namespace
88-
{
89-
// Makes the monopole mass used by the simulation, which is stored in the event header, the
90-
// one of O2DatabasePDG; otherwise MCTrack::GetMass() (and GetEnergy(), GetRapidity(), ...) would
91-
// give the default mass for monopoles of a run with another G4.monopoleMass.
92-
void applyMonopoleMass(o2::dataformats::MCEventHeader const& header)
93-
{
94-
if (!header.hasInfo(o2::sim::MonopoleMassHeaderKey)) {
95-
return;
96-
}
97-
bool valid = false;
98-
const double mass = header.getInfo<double>(o2::sim::MonopoleMassHeaderKey, valid);
99-
if (!valid || !(mass > 0.)) {
100-
return;
101-
}
102-
if (o2::O2DatabasePDG::hasMonopoleMassOverride() && std::abs(o2::O2DatabasePDG::getMonopoleMass() - mass) > 1.e-6 * mass) {
103-
LOG(warn) << "Kinematics with different monopole masses (" << o2::O2DatabasePDG::getMonopoleMass() << " and " << mass
104-
<< " GeV) are read in the same process; monopole masses will be wrong for one of them";
105-
}
106-
o2::O2DatabasePDG::setMonopoleMass(mass);
107-
}
108-
} // namespace
109-
11085
void MCKinematicsReader::loadTracksForSourceAndEvent(int source, int event) const
11186
{
11287
auto chain = mInputChains[source];
@@ -120,17 +95,6 @@ void MCKinematicsReader::loadTracksForSourceAndEvent(int source, int event) cons
12095
mTracks[source][event] = new std::vector<o2::MCTrack>;
12196
*mTracks[source][event] = *loadtracks;
12297
delete loadtracks;
123-
// the monopole mass has to be known before the tracks are used
124-
if (auto hbr = chain->GetBranch("MCEventHeader.")) {
125-
o2::dataformats::MCEventHeader* header = nullptr;
126-
hbr->SetAddress(&header);
127-
hbr->GetEntry(event);
128-
if (header) {
129-
applyMonopoleMass(*header);
130-
}
131-
delete header;
132-
hbr->ResetAddress();
133-
}
13498
}
13599
}
136100
}
@@ -156,7 +120,6 @@ void MCKinematicsReader::loadHeadersForSource(int source) const
156120
for (int event = 0; event < br->GetEntries(); ++event) {
157121
br->GetEntry(event);
158122
mHeaders[source][event] = *header;
159-
applyMonopoleMass(mHeaders[source][event]);
160123
}
161124
delete header;
162125
header = nullptr;

‎run/O2HitMerger.cxx‎

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,6 @@
4141

4242
#include "PrimaryServerState.h"
4343
#include <SimConfig/SimConfig.h>
44-
#include <SimConfig/G4Params.h>
45-
#include <CommonUtils/ConfigurableParam.h>
46-
#include <SimulationDataFormat/MonopoleParticles.h>
4744
#include <TPCSimulation/Detector.h>
4845
#include <ITSSimulation/Detector.h>
4946
#include <MFTSimulation/Detector.h>
@@ -150,23 +147,6 @@ void O2HitMerger::InitTask()
150147
// we didn't manage to get a configuration --> better to fail
151148
LOG(fatal) << "No configuration received. Aborting";
152149
}
153-
// The config key-values are not applied to the ConfigurableParams in this process. The merger needs the G4 ones
154-
// to record the monopole mass in the event headers (G4.monopole, G4.monopoleMass), so apply those.
155-
// Note: G4 parameters given via a config file (--configFile) are not applied here.
156-
{
157-
std::string g4Tokens;
158-
std::stringstream tokens(o2::conf::SimConfig::Instance().getKeyValueString());
159-
std::string token;
160-
while (std::getline(tokens, token, ';')) {
161-
const auto first = token.find_first_not_of(" \t");
162-
if (first != std::string::npos && token.compare(first, 3, "G4.") == 0) {
163-
g4Tokens += token.substr(first) + ";";
164-
}
165-
}
166-
if (!g4Tokens.empty()) {
167-
o2::conf::ConfigurableParam::updateFromString(g4Tokens);
168-
}
169-
}
170150
mAsService = o2::conf::SimConfig::Instance().asService();
171151
mForwardKine = o2::conf::SimConfig::Instance().forwardKine();
172152
mWriteToDisc = o2::conf::SimConfig::Instance().writeToDisc();
@@ -714,12 +694,6 @@ bool O2HitMerger::mergeAndFlushData()
714694
}
715695
}
716696

717-
// record the mass used for the monopoles, such that readers of the kinematics
718-
// (MCTrack::GetMass() and derived quantities) do not fall back to the default
719-
if (eventheader && o2::conf::G4Params::Instance().monopole) {
720-
eventheader->putInfo<double>(o2::sim::MonopoleMassHeaderKey, o2::conf::G4Params::Instance().monopoleMass);
721-
}
722-
723697
// now see which events can be discarded in any case due to no hits
724698
if (confref.isFilterOutNoHitEvents()) {
725699
if (eventheader && eventheader->getMCEventStats().getNHits() == 0) {

0 commit comments

Comments
 (0)