Skip to content

Commit a94f5f1

Browse files
author
Christian Holm Christensen
authored
Merge pull request AliceO2Group#1 from alibuild/alibot-cleanup-11913
Please consider the following formatting changes to AliceO2Group#11913
2 parents ae319c5 + 0558c4b commit a94f5f1

File tree

10 files changed

+415
-422
lines changed

10 files changed

+415
-422
lines changed

DataFormats/simulation/include/SimulationDataFormat/MCEventHeader.h

Lines changed: 60 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -27,67 +27,66 @@ namespace dataformats
2727

2828
class GeneratorHeader;
2929

30-
/** Common keys for information in MC event header */
31-
struct MCInfoKeys {
32-
/** @{
33-
@name HepMC3 heavy-ion fields */
34-
static constexpr const char* impactParameter = "Bimpact";
35-
static constexpr const char* nPart = "Npart";
36-
static constexpr const char* nPartProjectile = "Npart_proj";
37-
static constexpr const char* nPartTarget = "Npart_targ";
38-
static constexpr const char* nColl = "Ncoll";
39-
static constexpr const char* nCollHard = "Ncoll_hard";
40-
static constexpr const char* nCollNNWounded = "NColl_NNw";
41-
static constexpr const char* nCollNWoundedN = "NColl_NwN";
42-
static constexpr const char* nCollNWoundedNwounded = "NColl_NwNW";
43-
static constexpr const char* planeAngle = "eventPsi";
44-
static constexpr const char* sigmaInelNN = "sigmaInelNN";
45-
static constexpr const char* centrality = "centrality";
46-
static constexpr const char* nSpecProjectileProton = "Nspec_proj_p";
47-
static constexpr const char* nSpecProjectileNeutron = "Nspec_proj_n";
48-
static constexpr const char* nSpecTargetProton = "Nspec_targ_p";
49-
static constexpr const char* nSpecTargetNeutron = "Nspec_targ_n";
50-
/** @} */
51-
/** @{
52-
@name HepMC3 PDF information
53-
54-
In principle a header can have many of these. In that case,
55-
each set should be prefixed with "_<X>" where "<X>" is a
56-
serial number.
57-
*/
58-
static constexpr const char* pdfParton1Id = "pdf_parton_1_id";
59-
static constexpr const char* pdfParton2Id = "pdf_parton_2_id";
60-
static constexpr const char* pdfX1 = "pdf_x1";
61-
static constexpr const char* pdfX2 = "pdf_x2";
62-
static constexpr const char* pdfScale = "pdf_scale";
63-
static constexpr const char* pdfXF1 = "pdf_par_x1";
64-
static constexpr const char* pdfXF2 = "pdf_par_x2";
65-
static constexpr const char* pdfCode1 = "pdf_lhc_1_id";
66-
static constexpr const char* pdfCode2 = "pdf_lhc_2_id";
67-
/** @} */
68-
/** @{
69-
@name HepMC3 cross-section information
70-
71-
In principle we can have one cross section per weight. In that
72-
case, each should be post-fixed by "_<X>" where "<X>" is a
73-
serial number. These should then matcht possible names of
74-
weights.
75-
*/
76-
static constexpr const char* acceptedEvents = "accepted_events";
77-
static constexpr const char* attemptedEvents = "attempted_events";
78-
static constexpr const char* xSection = "cross_section";
79-
static constexpr const char* xSectionError = "cross_section_error";
80-
/** @} */
81-
/** @{
82-
@name Common fields */
83-
static constexpr const char* generator = "generator";
84-
static constexpr const char* generatorVersion = "version";
85-
static constexpr const char* processName = "processName";
86-
static constexpr const char* processCode = "processCode";
87-
static constexpr const char* weight = "weight";
88-
/** @} */
89-
90-
};
30+
/** Common keys for information in MC event header */
31+
struct MCInfoKeys {
32+
/** @{
33+
@name HepMC3 heavy-ion fields */
34+
static constexpr const char* impactParameter = "Bimpact";
35+
static constexpr const char* nPart = "Npart";
36+
static constexpr const char* nPartProjectile = "Npart_proj";
37+
static constexpr const char* nPartTarget = "Npart_targ";
38+
static constexpr const char* nColl = "Ncoll";
39+
static constexpr const char* nCollHard = "Ncoll_hard";
40+
static constexpr const char* nCollNNWounded = "NColl_NNw";
41+
static constexpr const char* nCollNWoundedN = "NColl_NwN";
42+
static constexpr const char* nCollNWoundedNwounded = "NColl_NwNW";
43+
static constexpr const char* planeAngle = "eventPsi";
44+
static constexpr const char* sigmaInelNN = "sigmaInelNN";
45+
static constexpr const char* centrality = "centrality";
46+
static constexpr const char* nSpecProjectileProton = "Nspec_proj_p";
47+
static constexpr const char* nSpecProjectileNeutron = "Nspec_proj_n";
48+
static constexpr const char* nSpecTargetProton = "Nspec_targ_p";
49+
static constexpr const char* nSpecTargetNeutron = "Nspec_targ_n";
50+
/** @} */
51+
/** @{
52+
@name HepMC3 PDF information
53+
54+
In principle a header can have many of these. In that case,
55+
each set should be prefixed with "_<X>" where "<X>" is a
56+
serial number.
57+
*/
58+
static constexpr const char* pdfParton1Id = "pdf_parton_1_id";
59+
static constexpr const char* pdfParton2Id = "pdf_parton_2_id";
60+
static constexpr const char* pdfX1 = "pdf_x1";
61+
static constexpr const char* pdfX2 = "pdf_x2";
62+
static constexpr const char* pdfScale = "pdf_scale";
63+
static constexpr const char* pdfXF1 = "pdf_par_x1";
64+
static constexpr const char* pdfXF2 = "pdf_par_x2";
65+
static constexpr const char* pdfCode1 = "pdf_lhc_1_id";
66+
static constexpr const char* pdfCode2 = "pdf_lhc_2_id";
67+
/** @} */
68+
/** @{
69+
@name HepMC3 cross-section information
70+
71+
In principle we can have one cross section per weight. In that
72+
case, each should be post-fixed by "_<X>" where "<X>" is a
73+
serial number. These should then matcht possible names of
74+
weights.
75+
*/
76+
static constexpr const char* acceptedEvents = "accepted_events";
77+
static constexpr const char* attemptedEvents = "attempted_events";
78+
static constexpr const char* xSection = "cross_section";
79+
static constexpr const char* xSectionError = "cross_section_error";
80+
/** @} */
81+
/** @{
82+
@name Common fields */
83+
static constexpr const char* generator = "generator";
84+
static constexpr const char* generatorVersion = "version";
85+
static constexpr const char* processName = "processName";
86+
static constexpr const char* processCode = "processCode";
87+
static constexpr const char* weight = "weight";
88+
/** @} */
89+
};
9190

9291
/*****************************************************************/
9392
/*****************************************************************/

Generators/include/Generators/GeneratorHepMC.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ class GeneratorHepMC : public Generator
6565
void setProgCmd(std::string val) { mProgCmd = val; };
6666
void setEventsToSkip(uint64_t val) { mEventsToSkip = val; };
6767
void setNEvents(unsigned int val) { mNEvents = val; }
68+
6869
protected:
6970
/** copy constructor **/
7071
GeneratorHepMC(const GeneratorHepMC&);
@@ -80,7 +81,7 @@ class GeneratorHepMC : public Generator
8081

8182
/** methods that can be overridded **/
8283
void updateHeader(o2::dataformats::MCEventHeader* eventHeader) override;
83-
84+
8485
/** HepMC interface **/
8586
std::ifstream mStream; //!
8687
std::string mFileName;

Generators/include/Generators/GeneratorHepMCParam.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ namespace eventgen
3131

3232
struct GeneratorHepMCParam : public o2::conf::ConfigurableParamHelper<GeneratorHepMCParam> {
3333
std::string fileName = "";
34-
std::string progCmd = "";//Program command line to spawn, must write HepMC on stdout
34+
std::string progCmd = ""; // Program command line to spawn, must write HepMC on stdout
3535
int version = 2;
3636
uint64_t eventsToSkip = 0;
3737
O2ParamDef(GeneratorHepMCParam, "HepMC");

Generators/include/Generators/GeneratorTParticle.h

Lines changed: 75 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -27,91 +27,89 @@ class TClonesArray;
2727

2828
namespace o2
2929
{
30-
namespace eventgen
30+
namespace eventgen
31+
{
32+
/// A class that reads in particles of class @c TParticle from a
33+
/// branch in a @c TChain.
34+
///
35+
/// Optionally, a program that generates such a @c TTree can be
36+
/// spawn, and the @c TParticles written to a file from which this
37+
/// object reads them in. This is done with
38+
///
39+
/// --configKeyValues "TParticle.progCmd=<eg program and options>"
40+
///
41+
/// which will execute the specified EG program with the given
42+
/// options. The EG program _must_ support the command line options
43+
///
44+
/// -n NUMBER Number of events to generate
45+
/// -o FILENAME Name of file to write to
46+
///
47+
/// The tree name and particle branch names can be configured.
48+
///
49+
/// --configKeyValues "TParticle.treeName=T,TParticle.branchName=P"
50+
///
51+
/// File(s) to read are also configurable
52+
///
53+
/// --configKeyValues "TParticle.fileNames=foo.root,bar.root"
54+
///
55+
class GeneratorTParticle : public Generator
56+
{
57+
public:
58+
/** CTOR */
59+
GeneratorTParticle() = default;
60+
/** CTOR */
61+
GeneratorTParticle(const std::string& name)
62+
: Generator(name.c_str(), "ALICEo2 TParticle Generator")
3163
{
32-
/// A class that reads in particles of class @c TParticle from a
33-
/// branch in a @c TChain.
34-
///
35-
/// Optionally, a program that generates such a @c TTree can be
36-
/// spawn, and the @c TParticles written to a file from which this
37-
/// object reads them in. This is done with
38-
///
39-
/// --configKeyValues "TParticle.progCmd=<eg program and options>"
40-
///
41-
/// which will execute the specified EG program with the given
42-
/// options. The EG program _must_ support the command line options
43-
///
44-
/// -n NUMBER Number of events to generate
45-
/// -o FILENAME Name of file to write to
46-
///
47-
/// The tree name and particle branch names can be configured.
48-
///
49-
/// --configKeyValues "TParticle.treeName=T,TParticle.branchName=P"
50-
///
51-
/// File(s) to read are also configurable
52-
///
53-
/// --configKeyValues "TParticle.fileNames=foo.root,bar.root"
54-
///
55-
class GeneratorTParticle : public Generator
56-
{
57-
public:
58-
/** CTOR */
59-
GeneratorTParticle() = default;
60-
/** CTOR */
61-
GeneratorTParticle(const std::string& name)
62-
: Generator(name.c_str(),"ALICEo2 TParticle Generator")
63-
{}
64-
/** DTOR */
65-
virtual ~GeneratorTParticle();
64+
}
65+
/** DTOR */
66+
virtual ~GeneratorTParticle();
6667

67-
/** Initialize this generator. This will set up the chain.
68-
Optionally, if a command line was specified by @c
69-
TParticle.progCmd then that command line is executed in the
70-
background and events are read from the output file of that
71-
program */
72-
Bool_t Init() override;
68+
/** Initialize this generator. This will set up the chain.
69+
Optionally, if a command line was specified by @c
70+
TParticle.progCmd then that command line is executed in the
71+
background and events are read from the output file of that
72+
program */
73+
Bool_t Init() override;
7374

74-
/** Read in the next entry from the chain. Returns false in
75-
case of errors or no more entries to read. */
76-
Bool_t generateEvent() override;
75+
/** Read in the next entry from the chain. Returns false in
76+
case of errors or no more entries to read. */
77+
Bool_t generateEvent() override;
7778

78-
/** Import the read-in particles into the steer particle
79-
stack */
80-
Bool_t importParticles() override;
79+
/** Import the read-in particles into the steer particle
80+
stack */
81+
Bool_t importParticles() override;
8182

82-
/** Set the names of files to read, separated by commas */
83-
void setFileNames(const std::string& val);
84-
/** Set the name of the tree in the files. The tree _must_
85-
reside in the top-level directory of the files. */
86-
void setTreeName(const std::string& val) { mTreeName = val; }
87-
/** Set the branch name of the branch that holds a @c
88-
TClonesArray of @c TParticle objects */
89-
void setBranchName(const std::string& val) { mBranchName = val; }
90-
/** Set child program command line to (optionally) execute */
91-
void setProgCmd(const std::string& val) { mProgCmd = val; }
92-
/** Set the number of events to generate. */
93-
void setNEvents(unsigned int nev) { mNEvents = nev; }
94-
protected:
95-
std::string mTreeName = "T";
96-
std::string mBranchName = "Particles";
97-
std::string mProgCmd = "";
98-
std::list<std::string> mFileNames;
99-
unsigned int mNEvents = 0;
100-
unsigned int mEntry = 0;
101-
TChain* mChain;
102-
TClonesArray* mTParticles;
83+
/** Set the names of files to read, separated by commas */
84+
void setFileNames(const std::string& val);
85+
/** Set the name of the tree in the files. The tree _must_
86+
reside in the top-level directory of the files. */
87+
void setTreeName(const std::string& val) { mTreeName = val; }
88+
/** Set the branch name of the branch that holds a @c
89+
TClonesArray of @c TParticle objects */
90+
void setBranchName(const std::string& val) { mBranchName = val; }
91+
/** Set child program command line to (optionally) execute */
92+
void setProgCmd(const std::string& val) { mProgCmd = val; }
93+
/** Set the number of events to generate. */
94+
void setNEvents(unsigned int nev) { mNEvents = nev; }
10395

104-
void waitForData();
96+
protected:
97+
std::string mTreeName = "T";
98+
std::string mBranchName = "Particles";
99+
std::string mProgCmd = "";
100+
std::list<std::string> mFileNames;
101+
unsigned int mNEvents = 0;
102+
unsigned int mEntry = 0;
103+
TChain* mChain;
104+
TClonesArray* mTParticles;
105105

106-
ClassDefOverride(GeneratorTParticle,1);
107-
};
108-
}
109-
}
106+
void waitForData();
107+
108+
ClassDefOverride(GeneratorTParticle, 1);
109+
};
110+
} // namespace eventgen
111+
} // namespace o2
110112
#endif
111113
//
112114
// EOF
113115
//
114-
115-
116-
117-

Generators/include/Generators/GeneratorTParticleParam.h

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
// immunities granted to it by virtue of its status as an
1212
// Intergovernmental Organization or submit itself to any
1313
// jurisdiction.
14-
//
14+
//
1515
// @author: Christian Holm Christensen <cholm@nbi.dk>
1616
#ifndef ALICEO2_EVENTGEN_GENERATORTPARTICLEPARAM_H_
1717
#define ALICEO2_EVENTGEN_GENERATORTPARTICLEPARAM_H_
@@ -22,22 +22,20 @@
2222

2323
namespace o2
2424
{
25-
namespace eventgen
26-
{
25+
namespace eventgen
26+
{
2727

28-
/**
29-
a parameter class/struct to keep the settings of the TGenerator
30-
event generator and allow the user to modify them */
31-
struct GeneratorTParticleParam :
32-
public o2::conf::ConfigurableParamHelper<GeneratorTParticleParam>
33-
{
34-
std::string treeName = "T";
35-
std::string branchName = "Particles";
36-
std::string fileNames = "tparticle.root";
37-
std::string progCmd = "";
38-
O2ParamDef(GeneratorTParticleParam, "TParticle");
39-
};
40-
} // end namespace eventgen
28+
/**
29+
a parameter class/struct to keep the settings of the TGenerator
30+
event generator and allow the user to modify them */
31+
struct GeneratorTParticleParam : public o2::conf::ConfigurableParamHelper<GeneratorTParticleParam> {
32+
std::string treeName = "T";
33+
std::string branchName = "Particles";
34+
std::string fileNames = "tparticle.root";
35+
std::string progCmd = "";
36+
O2ParamDef(GeneratorTParticleParam, "TParticle");
37+
};
38+
} // end namespace eventgen
4139
} // end namespace o2
4240

4341
#endif // ALICEO2_EVENTGEN_GENERATORHEPMCPARAM_H_

Generators/src/GeneratorFactory.cxx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,10 +157,11 @@ void GeneratorFactory::setPrimaryGenerator(o2::conf::SimConfig const& conf, Fair
157157
if (o2PrimGen) {
158158
o2PrimGen->setApplyVertex(false);
159159
}
160-
} LOG(info) << "using external O2 kinematics";
160+
}
161+
LOG(info) << "using external O2 kinematics";
161162
} else if (genconfig.compare("tparticle") == 0) {
162163
// External ROOT file(s) with tree of TParticle in clones array,
163-
// or external program generating such a file
164+
// or external program generating such a file
164165
auto& param = GeneratorTParticleParam::Instance();
165166
LOG(info) << "Init 'GeneratorTParticle' with the following parameters";
166167
LOG(info) << param;

0 commit comments

Comments
 (0)