@@ -24,8 +24,13 @@ bool hasKeys(o2::dataformats::MCEventHeader const& header,
2424 const std::vector<std::string>& keys,
2525 bool anyNotAll)
2626{
27- auto check = [&header](const std::string& key) { return header.hasInfo (key); };
28- return (anyNotAll ? std::any_of (keys.cbegin (), keys.cend (), check) : std::all_of (keys.cbegin (), keys.cend (), check));
27+ auto check = [&header](const std::string& key) { // Do not format
28+ return header.hasInfo (key);
29+ };
30+ return (anyNotAll ? // Do not format
31+ std::any_of (keys.cbegin (), keys.cend (), check)
32+ : // Do not format
33+ std::all_of (keys.cbegin (), keys.cend (), check));
2934}
3035// ====================================================================
3136short updateMCCollisions (const CollisionCursor& cursor,
@@ -70,10 +75,15 @@ bool updateHepMCXSection(const XSectionCursor& cursor,
7075
7176 if (when == HepMCUpdate::never or
7277 (when != HepMCUpdate::always and
73- not hasKeys (header, {Key::acceptedEvents, Key::attemptedEvents, Key::xSection, Key::xSectionError}, when == HepMCUpdate::anyKey))) {
78+ not hasKeys (header, { // Do not
79+ Key::acceptedEvents, // mess with
80+ Key::attemptedEvents, // with
81+ Key::xSection, // my
82+ Key::xSectionError}, // formatting
83+ when == HepMCUpdate::anyKey))) {
7484 return false ;
7585 }
76-
86+
7787 cursor (0 ,
7888 collisionID,
7989 generatorID,
@@ -96,10 +106,20 @@ bool updateHepMCPdfInfo(const PdfInfoCursor& cursor,
96106 using Key = o2::dataformats::MCInfoKeys;
97107
98108 if (when == HepMCUpdate::never or
99- (when != HepMCUpdate::always and not hasKeys (header, {Key::pdfParton1Id, Key::pdfParton2Id, Key::pdfCode1, Key::pdfCode2, Key::pdfX1, Key::pdfX2, Key::pdfScale, Key::pdfXF1, Key::pdfXF2}, when == HepMCUpdate::anyKey))) {
109+ (when != HepMCUpdate::always and // Do
110+ not hasKeys (header, {Key::pdfParton1Id, // not
111+ Key::pdfParton2Id, // mess
112+ Key::pdfCode1, // with
113+ Key::pdfCode2, // my
114+ Key::pdfX1, // formatting
115+ Key::pdfX2, // .
116+ Key::pdfScale, // It
117+ Key::pdfXF1, // is
118+ Key::pdfXF2}, // better
119+ when == HepMCUpdate::anyKey))) {
100120 return false ;
101121 }
102-
122+
103123 cursor (0 ,
104124 collisionID,
105125 generatorID,
@@ -125,10 +145,26 @@ bool updateHepMCHeavyIon(const HeavyIonCursor& cursor,
125145 using Key = dataformats::MCInfoKeys;
126146
127147 if (when == HepMCUpdate::never or
128- (when != HepMCUpdate::always and not hasKeys (header, {Key::nCollHard, Key::nPartProjectile, Key::nPartTarget, Key::nColl, Key::nCollNNWounded, Key::nCollNWoundedN, Key::nCollNWoundedNwounded, Key::nSpecProjectileNeutron, Key::nSpecTargetNeutron, Key::nSpecProjectileProton, Key::nSpecTargetProton, Key::planeAngle, " eccentricity" , Key::sigmaInelNN, Key::centrality}, when == HepMCUpdate::anyKey))) {
148+ (when != HepMCUpdate::always and // clang
149+ not hasKeys (header, {Key::nCollHard, // format
150+ Key::nPartProjectile, // is
151+ Key::nPartTarget, // so
152+ Key::nColl, // annoying
153+ Key::nCollNNWounded, // .
154+ Key::nCollNWoundedN, // It
155+ Key::nCollNWoundedNwounded, // messes
156+ Key::nSpecProjectileNeutron, // up
157+ Key::nSpecTargetNeutron, // the
158+ Key::nSpecProjectileProton, // clarity
159+ Key::nSpecTargetProton, // of
160+ Key::planeAngle, // the
161+ " eccentricity" , // code
162+ Key::sigmaInelNN, // to
163+ Key::centrality}, // noavail
164+ when == HepMCUpdate::anyKey))) {
129165 return false ;
130166 }
131-
167+
132168 int specNeutrons = (getEventInfo (header, Key::nSpecProjectileNeutron, -1 ) +
133169 getEventInfo (header, Key::nSpecTargetNeutron, -1 ));
134170 int specProtons = (getEventInfo (header, Key::nSpecProjectileProton, -1 ) +
@@ -186,7 +222,7 @@ void updateParticle(const ParticleCursor& cursor,
186222 if (MCTrackNavigator::isPhysicalPrimary (track, tracks)) {
187223 flags = PhysicalPrimary;
188224 }
189-
225+
190226 int daughters[2 ] = {-1 , -1 };
191227 std::vector<int > mothers;
192228 int id;
@@ -201,8 +237,7 @@ void updateParticle(const ParticleCursor& cursor,
201237 }
202238 if ((id = mapping (track.getFirstDaughterTrackId ())) >= 0 ) {
203239 daughters[1 ] = id;
204- }
205- else {
240+ } else {
206241 daughters[1 ] = daughters[0 ];
207242 }
208243 if (daughters[0 ] < 0 and daughters[1 ] >= 0 ) {
@@ -213,7 +248,7 @@ void updateParticle(const ParticleCursor& cursor,
213248 if (daughters[0 ] > daughters[1 ]) {
214249 std::swap (daughters[0 ], daughters[1 ]);
215250 }
216-
251+
217252 float weight = track.getWeight ();
218253 float pX = float (track.Px ());
219254 float pY = float (track.Py ());
@@ -333,7 +368,7 @@ uint32_t updateParticles(const ParticleCursor& cursor,
333368 if (storeIt < 0 ) {
334369 continue ;
335370 }
336-
371+
337372 auto & track = tracks[trackNo];
338373 auto hepmc = getHepMCStatusCode (track.getStatusCode ());
339374 uint8_t flags = (background ? FromBackgroundEvent : 0 );
0 commit comments