1919#include " ALICE3/DataModel/OTFCollision.h"
2020#include " ALICE3/DataModel/collisionAlice3.h"
2121#include " ALICE3/DataModel/tracksAlice3.h"
22+ #include " Common/Core/RecoDecay.h"
2223#include " Common/DataModel/TrackSelectionTables.h"
2324
2425#include < Framework/AnalysisDataModel.h>
3536#include < TCollection.h>
3637#include < TFile.h>
3738#include < TH1.h>
39+ #include < TH2.h>
3840#include < TList.h>
3941#include < TString.h>
4042#include < TSystem.h>
@@ -100,13 +102,8 @@ struct Alice3TrackingTranslator {
100102 LOG (info) << " Alice3TrackingTranslator init called" ;
101103 }
102104
103- #define SETADDRESS (branchname, branchvar ) \
104- if (mTree ->SetBranchAddress (branchname, &branchvar)) { \
105- LOG (fatal) << " Could not set branch address for " << branchname; \
106- }
107-
108105 struct FileStruct {
109- FileStruct (const std::string& filename, const std::string& treename) : mFile (filename.c_str(), " READ" )
106+ FileStruct (const std::string& filename, const std::string& treename) : mFile (filename.c_str(), " READ" ), mTree ( nullptr )
110107 {
111108 if (mFile .IsZombie ()) {
112109 LOG (fatal) << " Could not open file '" << filename << " '" ;
@@ -118,6 +115,13 @@ struct Alice3TrackingTranslator {
118115 LOG (fatal) << treename << " tree not found in " << filename;
119116 }
120117 }
118+ template <typename T>
119+ void setBranchAddress (const char * branchname, T& branchvar)
120+ {
121+ if (mTree ->SetBranchAddress (branchname, &branchvar)) {
122+ LOG (fatal) << " Could not set branch address for " << branchname;
123+ }
124+ }
121125 void setEventEntry (Long64_t entry)
122126 {
123127 if (mTree ->GetEntry (entry) < 0 ) {
@@ -130,26 +134,26 @@ struct Alice3TrackingTranslator {
130134 };
131135
132136 struct ParticleStruct : public FileStruct {
133- ParticleStruct (const std::string& filename, const std::string& treename) : FileStruct(std::move( filename), std::move( treename) )
137+ ParticleStruct (const std::string& filename, const std::string& treename) : FileStruct(filename, treename)
134138 {
135139 // mTree->Print();
136- SETADDRESS (" particle_type" , m_particle_type);
137- SETADDRESS (" vx" , m_vx);
138- SETADDRESS (" vy" , m_vy);
139- SETADDRESS (" vz" , m_vz);
140- SETADDRESS (" vt" , m_vt);
141- SETADDRESS (" px" , m_px);
142- SETADDRESS (" py" , m_py);
143- SETADDRESS (" pz" , m_pz);
144- SETADDRESS (" m" , m_m);
145- SETADDRESS (" p" , m_p);
146- SETADDRESS (" q" , m_q);
147- SETADDRESS (" number_of_hits" , m_number_of_hits);
148- SETADDRESS (" vertex_primary" , m_vertex_primary);
149- SETADDRESS (" vertex_secondary" , m_vertex_secondary);
150- SETADDRESS (" generation" , m_generation);
151- SETADDRESS (" sub_particle" , m_sub_particle);
152- SETADDRESS (" particle" , m_particle);
140+ setBranchAddress (" particle_type" , m_particle_type);
141+ setBranchAddress (" vx" , m_vx);
142+ setBranchAddress (" vy" , m_vy);
143+ setBranchAddress (" vz" , m_vz);
144+ setBranchAddress (" vt" , m_vt);
145+ setBranchAddress (" px" , m_px);
146+ setBranchAddress (" py" , m_py);
147+ setBranchAddress (" pz" , m_pz);
148+ setBranchAddress (" m" , m_m);
149+ setBranchAddress (" p" , m_p);
150+ setBranchAddress (" q" , m_q);
151+ setBranchAddress (" number_of_hits" , m_number_of_hits);
152+ setBranchAddress (" vertex_primary" , m_vertex_primary);
153+ setBranchAddress (" vertex_secondary" , m_vertex_secondary);
154+ setBranchAddress (" generation" , m_generation);
155+ setBranchAddress (" sub_particle" , m_sub_particle);
156+ setBranchAddress (" particle" , m_particle);
153157 }
154158 std::vector<int >* m_particle_type = nullptr ;
155159 std::vector<float >* m_vx = nullptr ;
@@ -175,20 +179,20 @@ struct Alice3TrackingTranslator {
175179 struct VertexStruct : public FileStruct {
176180 VertexStruct (const std::string& filename, const std::string& treename) : FileStruct(filename, treename)
177181 {
178- SETADDRESS (" vx" , m_x);
179- SETADDRESS (" vy" , m_y);
180- SETADDRESS (" vz" , m_z);
181- SETADDRESS (" vt" , m_t );
182- SETADDRESS (" incoming_particles_vertex_primary" , m_incoming_particles_vertex_primary);
183- SETADDRESS (" incoming_particles_vertex_secondary" , m_incoming_particles_vertex_secondary);
184- SETADDRESS (" incoming_particles_generation" , m_incoming_particles_generation);
185- SETADDRESS (" incoming_particles_sub_particle" , m_incoming_particles_sub_particle);
186- SETADDRESS (" incoming_particles_particle" , m_incoming_particles_particle);
187- SETADDRESS (" outgoing_particles_vertex_primary" , m_outgoing_particles_vertex_primary);
188- SETADDRESS (" outgoing_particles_vertex_secondary" , m_outgoing_particles_vertex_secondary);
189- SETADDRESS (" outgoing_particles_generation" , m_outgoing_particles_generation);
190- SETADDRESS (" outgoing_particles_sub_particle" , m_outgoing_particles_sub_particle);
191- SETADDRESS (" outgoing_particles_particle" , m_outgoing_particles_particle);
182+ setBranchAddress (" vx" , m_x);
183+ setBranchAddress (" vy" , m_y);
184+ setBranchAddress (" vz" , m_z);
185+ setBranchAddress (" vt" , m_t );
186+ setBranchAddress (" incoming_particles_vertex_primary" , m_incoming_particles_vertex_primary);
187+ setBranchAddress (" incoming_particles_vertex_secondary" , m_incoming_particles_vertex_secondary);
188+ setBranchAddress (" incoming_particles_generation" , m_incoming_particles_generation);
189+ setBranchAddress (" incoming_particles_sub_particle" , m_incoming_particles_sub_particle);
190+ setBranchAddress (" incoming_particles_particle" , m_incoming_particles_particle);
191+ setBranchAddress (" outgoing_particles_vertex_primary" , m_outgoing_particles_vertex_primary);
192+ setBranchAddress (" outgoing_particles_vertex_secondary" , m_outgoing_particles_vertex_secondary);
193+ setBranchAddress (" outgoing_particles_generation" , m_outgoing_particles_generation);
194+ setBranchAddress (" outgoing_particles_sub_particle" , m_outgoing_particles_sub_particle);
195+ setBranchAddress (" outgoing_particles_particle" , m_outgoing_particles_particle);
192196 }
193197 std::vector<float >* m_x = nullptr ;
194198 std::vector<float >* m_y = nullptr ;
@@ -207,58 +211,58 @@ struct Alice3TrackingTranslator {
207211 };
208212
209213 struct TrackStruct : public FileStruct {
210- TrackStruct (const std::string& filename, const std::string& treename) : FileStruct(std::move( filename), std::move( treename) )
214+ TrackStruct (const std::string& filename, const std::string& treename) : FileStruct(filename, treename)
211215 {
212216 mTree ->Print ();
213217 // Set branch addresses for ACTS track parameters
214218
215- SETADDRESS (" event_nr" , m_event_nr);
216- SETADDRESS (" nMeasurements" , m_nMeasurements);
217- SETADDRESS (" nStates" , m_nStates);
218- SETADDRESS (" nHoles" , m_nHoles);
219- SETADDRESS (" chi2Sum" , m_chi2Sum);
220- SETADDRESS (" NDF" , m_NDF);
221- SETADDRESS (" nMajorityHits" , m_nMajorityHits);
222- SETADDRESS (" t_charge" , m_t_charge);
223- SETADDRESS (" t_vx" , m_t_vx);
224- SETADDRESS (" t_vy" , m_t_vy);
225- SETADDRESS (" t_vz" , m_t_vz);
226- SETADDRESS (" t_px" , m_t_px);
227- SETADDRESS (" t_py" , m_t_py);
228- SETADDRESS (" t_pz" , m_t_pz);
229- SETADDRESS (" majorityParticleId_vertex_primary" , m_majorityParticleId_vertex_primary);
230- SETADDRESS (" majorityParticleId_vertex_secondary" , m_majorityParticleId_vertex_secondary);
231- SETADDRESS (" majorityParticleId_generation" , m_majorityParticleId_generation);
232- SETADDRESS (" majorityParticleId_sub_particle" , m_majorityParticleId_sub_particle);
233- SETADDRESS (" majorityParticleId_particle" , m_majorityParticleId_particle);
234- SETADDRESS (" eQOP_fit" , m_eQOP_fit);
235- SETADDRESS (" eX_fit" , m_eX_fit);
236- SETADDRESS (" eY_fit" , m_eY_fit);
237- SETADDRESS (" eZ_fit" , m_eZ_fit);
238- SETADDRESS (" ePX_fit" , m_ePX_fit);
239- SETADDRESS (" ePY_fit" , m_ePY_fit);
240- SETADDRESS (" ePZ_fit" , m_ePZ_fit);
241- SETADDRESS (" cov_eX_eX" , m_cov_eX_eX);
242- SETADDRESS (" cov_eY_eY" , m_cov_eY_eY);
243- SETADDRESS (" cov_eZ_eZ" , m_cov_eZ_eZ);
244- SETADDRESS (" cov_ePX_ePX" , m_cov_ePX_ePX);
245- SETADDRESS (" cov_ePY_ePY" , m_cov_ePY_ePY);
246- SETADDRESS (" cov_ePZ_ePZ" , m_cov_ePZ_ePZ);
247- SETADDRESS (" cov_eX_ePX" , m_cov_eX_ePX);
248- SETADDRESS (" cov_eY_ePY" , m_cov_eY_ePY);
249- SETADDRESS (" cov_eZ_ePZ" , m_cov_eZ_ePZ);
250- SETADDRESS (" cov_eX_eY" , m_cov_eX_eY);
251- SETADDRESS (" cov_eX_eZ" , m_cov_eX_eZ);
252- SETADDRESS (" cov_eY_eZ" , m_cov_eY_eZ);
253- SETADDRESS (" cov_ePX_ePY" , m_cov_ePX_ePY);
254- SETADDRESS (" cov_ePX_ePZ" , m_cov_ePX_ePZ);
255- SETADDRESS (" cov_ePY_ePZ" , m_cov_ePY_ePZ);
256- SETADDRESS (" cov_eX_ePY" , m_cov_eX_ePY);
257- SETADDRESS (" cov_eX_ePZ" , m_cov_eX_ePZ);
258- SETADDRESS (" cov_eY_ePX" , m_cov_eY_ePX);
259- SETADDRESS (" cov_eY_ePZ" , m_cov_eY_ePZ);
260- SETADDRESS (" cov_eZ_ePX" , m_cov_eZ_ePX);
261- SETADDRESS (" cov_eZ_ePY" , m_cov_eZ_ePY);
219+ setBranchAddress (" event_nr" , m_event_nr);
220+ setBranchAddress (" nMeasurements" , m_nMeasurements);
221+ setBranchAddress (" nStates" , m_nStates);
222+ setBranchAddress (" nHoles" , m_nHoles);
223+ setBranchAddress (" chi2Sum" , m_chi2Sum);
224+ setBranchAddress (" NDF" , m_NDF);
225+ setBranchAddress (" nMajorityHits" , m_nMajorityHits);
226+ setBranchAddress (" t_charge" , m_t_charge);
227+ setBranchAddress (" t_vx" , m_t_vx);
228+ setBranchAddress (" t_vy" , m_t_vy);
229+ setBranchAddress (" t_vz" , m_t_vz);
230+ setBranchAddress (" t_px" , m_t_px);
231+ setBranchAddress (" t_py" , m_t_py);
232+ setBranchAddress (" t_pz" , m_t_pz);
233+ setBranchAddress (" majorityParticleId_vertex_primary" , m_majorityParticleId_vertex_primary);
234+ setBranchAddress (" majorityParticleId_vertex_secondary" , m_majorityParticleId_vertex_secondary);
235+ setBranchAddress (" majorityParticleId_generation" , m_majorityParticleId_generation);
236+ setBranchAddress (" majorityParticleId_sub_particle" , m_majorityParticleId_sub_particle);
237+ setBranchAddress (" majorityParticleId_particle" , m_majorityParticleId_particle);
238+ setBranchAddress (" eQOP_fit" , m_eQOP_fit);
239+ setBranchAddress (" eX_fit" , m_eX_fit);
240+ setBranchAddress (" eY_fit" , m_eY_fit);
241+ setBranchAddress (" eZ_fit" , m_eZ_fit);
242+ setBranchAddress (" ePX_fit" , m_ePX_fit);
243+ setBranchAddress (" ePY_fit" , m_ePY_fit);
244+ setBranchAddress (" ePZ_fit" , m_ePZ_fit);
245+ setBranchAddress (" cov_eX_eX" , m_cov_eX_eX);
246+ setBranchAddress (" cov_eY_eY" , m_cov_eY_eY);
247+ setBranchAddress (" cov_eZ_eZ" , m_cov_eZ_eZ);
248+ setBranchAddress (" cov_ePX_ePX" , m_cov_ePX_ePX);
249+ setBranchAddress (" cov_ePY_ePY" , m_cov_ePY_ePY);
250+ setBranchAddress (" cov_ePZ_ePZ" , m_cov_ePZ_ePZ);
251+ setBranchAddress (" cov_eX_ePX" , m_cov_eX_ePX);
252+ setBranchAddress (" cov_eY_ePY" , m_cov_eY_ePY);
253+ setBranchAddress (" cov_eZ_ePZ" , m_cov_eZ_ePZ);
254+ setBranchAddress (" cov_eX_eY" , m_cov_eX_eY);
255+ setBranchAddress (" cov_eX_eZ" , m_cov_eX_eZ);
256+ setBranchAddress (" cov_eY_eZ" , m_cov_eY_eZ);
257+ setBranchAddress (" cov_ePX_ePY" , m_cov_ePX_ePY);
258+ setBranchAddress (" cov_ePX_ePZ" , m_cov_ePX_ePZ);
259+ setBranchAddress (" cov_ePY_ePZ" , m_cov_ePY_ePZ);
260+ setBranchAddress (" cov_eX_ePY" , m_cov_eX_ePY);
261+ setBranchAddress (" cov_eX_ePZ" , m_cov_eX_ePZ);
262+ setBranchAddress (" cov_eY_ePX" , m_cov_eY_ePX);
263+ setBranchAddress (" cov_eY_ePZ" , m_cov_eY_ePZ);
264+ setBranchAddress (" cov_eZ_ePX" , m_cov_eZ_ePX);
265+ setBranchAddress (" cov_eZ_ePY" , m_cov_eZ_ePY);
262266 }
263267 // Define track-related members here
264268 UInt_t* m_event_nr = nullptr ;
@@ -319,23 +323,23 @@ struct Alice3TrackingTranslator {
319323 };
320324
321325 struct HitsStruct : public FileStruct {
322- HitsStruct (const std::string& filename, const std::string& treename) : FileStruct(std::move( filename), std::move( treename) )
326+ HitsStruct (const std::string& filename, const std::string& treename) : FileStruct(filename, treename)
323327 {
324328 mTree ->Print ();
325- SETADDRESS (" barcode" , barcode);
329+ setBranchAddress (" barcode" , barcode);
326330 }
327331 std::vector<unsigned int >* barcode = nullptr ;
328332 };
329333 void addMCParticle (int collIndex, ParticleStruct& fileParticles, int iParticle, uint8_t flags, int firstMother, int firstDaughter, int secondDaughter, int numberOfHits, float secondaryVertexRadius)
330334 {
331- int mothers[ 2 ] = {firstMother, firstMother};
332- int daughters[ 2 ] = {firstDaughter, secondDaughter};
335+ std::array< int , 2 > mothers = {firstMother, firstMother};
336+ std::array< int , 2 > daughters = {firstDaughter, secondDaughter};
333337 tableStoredMcParticles (collIndex, // mcCollisionId
334338 fileParticles.m_particle_type ->at (iParticle), // pdgCode
335339 0 , // statusCode
336340 flags, // flags
337341 mothers, // mothersIds
338- daughters, // daughtersIdSlice
342+ daughters. data (), // daughtersIdSlice
339343 1 .0f , // weight
340344 fileParticles.m_px ->at (iParticle), // m_px
341345 fileParticles.m_py ->at (iParticle), // m_py
@@ -360,7 +364,7 @@ struct Alice3TrackingTranslator {
360364 TList* filesList = dir.GetListOfFiles ();
361365 if (filesList) {
362366 TIter next (filesList);
363- TSystemFile* file;
367+ TSystemFile* file = nullptr ;
364368 while ((file = dynamic_cast <TSystemFile*>(next ()))) {
365369 TString fname = file->GetName ();
366370 LOG (debug) << " Found file: " << fname.Data ();
@@ -491,7 +495,7 @@ struct Alice3TrackingTranslator {
491495 }
492496 for (size_t iPart = 0 ; iPart < nParticlesSim; ++iPart) {
493497 float secondaryVertexRadius = -1 .0f ;
494- int globalIdx = firstIdxThisEvent + ( int ) iPart;
498+ int globalIdx = firstIdxThisEvent + static_cast < int >( iPart) ;
495499 int motherIdx = -1 ;
496500 if (GlobalIdxToMotherIdx.find (globalIdx) != GlobalIdxToMotherIdx.end ()) {
497501 motherIdx = GlobalIdxToMotherIdx[globalIdx];
0 commit comments