ATLAS Offline Software
FPGATrackSimMatrixMergeAlgo.h
Go to the documentation of this file.
1 // Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
2 
3 #ifndef FPGATrackSimMatrixMergeAlgo_h
4 #define FPGATrackSimMatrixMergeAlgo_h
5 
20 #include "GaudiKernel/ITHistSvc.h"
22 #include "FPGATrackSimMatrixIO.h"
23 
24 #include "TTree.h"
25 #include "TH1I.h"
26 #include "TH1F.h"
27 
28 #include <string>
29 #include <vector>
30 
31 class ITHistSvc;
32 
33 
35 {
36  public:
37  FPGATrackSimMatrixMergeAlgo(const std::string& name, ISvcLocator* pSvcLocator);
38  virtual ~FPGATrackSimMatrixMergeAlgo() = default;
39  StatusCode initialize() override;
40  // Execute does not do anything for this alg. This class does not process events, everything is done in init and finalize
41  StatusCode execute() override;
42  StatusCode finalize() override;
43 
44  private:
45 
47  // Objects
48 
49  // Main logic. For each sector, store a struct that accumulates the track parameters, hit coordinates, etc.
50  std::vector<AccumulateMap> m_sector_cum; // Index by region
51 
53  // Handles
54 
55  ServiceHandle<ITHistSvc> m_tHistSvc{this,"THistSvc","THistSvc"};
56 
58  // Configuration
59 
60  Gaudi::Property<std::vector<std::string> > m_fpath {this, "file_path",{},"vector of files to merge"};
61  Gaudi::Property<bool> m_allregion {this, "allregion",false, "Run all regions?"};
62  Gaudi::Property<int> m_region {this, "region", 0, "Region to run"};
63  Gaudi::Property<int> m_nRegions {this, "nbank", 96, "Number of regions"};
64  Gaudi::Property<bool> m_Monitor {this, "Monitor", false, "flag to enable the monitor"};
65 
66 
67  int m_region_start = 0;
68  int m_region_end = 0;
69 
70  int m_nFiles = 0;
71  int m_nLayers = 0;
72  int m_nDim = 0;
73  int m_nDim2 = 0;
74 
76  // Meta Data
77 
78  // Histograms
79  TH1I* m_h_nSector = nullptr;
80  TH1I* m_h_nHit = nullptr;
81  TH1F* m_h_c = nullptr;
82  TH1F* m_h_d = nullptr;
83  TH1F* m_h_phi = nullptr;
84  TH1F* m_h_coto = nullptr;
85  TH1F* m_h_z = nullptr;
86 
88  // Helper Functions
89 
92  void readFiles();
93  void readTree(TTree *matrix_tree, int region);
94  std::vector<TTree*> createMatrixTrees();
95  void fillMatrixTrees(std::vector<TTree*> const & matrixTrees);
96 };
97 
98 
99 #endif // FPGATrackSimMatrixMergeAlgo_h
100 
FPGATrackSimMatrixMergeAlgo::FPGATrackSimMatrixMergeAlgo
FPGATrackSimMatrixMergeAlgo(const std::string &name, ISvcLocator *pSvcLocator)
Definition: FPGATrackSimMatrixMergeAlgo.cxx:36
FPGATrackSimMatrixMergeAlgo::m_nDim2
int m_nDim2
Definition: FPGATrackSimMatrixMergeAlgo.h:73
FPGATrackSimMatrixMergeAlgo::m_sector_cum
std::vector< AccumulateMap > m_sector_cum
Definition: FPGATrackSimMatrixMergeAlgo.h:50
FPGATrackSimMatrixMergeAlgo::readFiles
void readFiles()
Definition: FPGATrackSimMatrixMergeAlgo.cxx:184
TH1I
Definition: rootspy.cxx:332
FPGATrackSimMatrixMergeAlgo::m_nRegions
Gaudi::Property< int > m_nRegions
Definition: FPGATrackSimMatrixMergeAlgo.h:63
FPGATrackSimMatrixMergeAlgo::m_h_nSector
TH1I * m_h_nSector
Definition: FPGATrackSimMatrixMergeAlgo.h:79
FPGATrackSimMatrixMergeAlgo::createMatrixTrees
std::vector< TTree * > createMatrixTrees()
FPGATrackSimMatrixMergeAlgo::m_nFiles
int m_nFiles
Definition: FPGATrackSimMatrixMergeAlgo.h:70
FPGATrackSimMatrixMergeAlgo::m_tHistSvc
ServiceHandle< ITHistSvc > m_tHistSvc
Definition: FPGATrackSimMatrixMergeAlgo.h:55
FPGATrackSimMatrixMergeAlgo::finalize
StatusCode finalize() override
Definition: FPGATrackSimMatrixMergeAlgo.cxx:229
FPGATrackSimMatrixMergeAlgo::m_h_phi
TH1F * m_h_phi
Definition: FPGATrackSimMatrixMergeAlgo.h:83
FPGATrackSimMatrixMergeAlgo::m_nDim
int m_nDim
Definition: FPGATrackSimMatrixMergeAlgo.h:72
FPGATrackSimMatrixMergeAlgo::initialize
StatusCode initialize() override
Definition: FPGATrackSimMatrixMergeAlgo.cxx:42
FPGATrackSimMatrixMergeAlgo::readTree
void readTree(TTree *matrix_tree, int region)
FPGATrackSimMatrixMergeAlgo::m_h_coto
TH1F * m_h_coto
Definition: FPGATrackSimMatrixMergeAlgo.h:84
AthAlgorithm.h
FPGATrackSimMatrixMergeAlgo::m_region_start
int m_region_start
Definition: FPGATrackSimMatrixMergeAlgo.h:67
FPGATrackSimMatrixMergeAlgo::m_region_end
int m_region_end
Definition: FPGATrackSimMatrixMergeAlgo.h:68
FPGATrackSimMatrixIO.h
Classes to read/write matrix files event by event.
FPGATrackSimMatrixMergeAlgo::m_allregion
Gaudi::Property< bool > m_allregion
Definition: FPGATrackSimMatrixMergeAlgo.h:61
FPGATrackSimMatrixMergeAlgo::m_h_nHit
TH1I * m_h_nHit
Definition: FPGATrackSimMatrixMergeAlgo.h:80
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
file
TFile * file
Definition: tile_monitor.h:29
FPGATrackSimMatrixMergeAlgo::m_h_z
TH1F * m_h_z
Definition: FPGATrackSimMatrixMergeAlgo.h:85
AthAlgorithm
Definition: AthAlgorithm.h:47
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
FPGATrackSimMatrixMergeAlgo::m_nLayers
int m_nLayers
Definition: FPGATrackSimMatrixMergeAlgo.h:71
FPGATrackSimMatrixMergeAlgo::fillMatrixTrees
void fillMatrixTrees(std::vector< TTree * > const &matrixTrees)
FPGATrackSimMatrixMergeAlgo::execute
StatusCode execute() override
Definition: FPGATrackSimMatrixMergeAlgo.cxx:218
TH1F
Definition: rootspy.cxx:320
FPGATrackSimMatrixMergeAlgo::bookHistograms
StatusCode bookHistograms()
Definition: FPGATrackSimMatrixMergeAlgo.cxx:96
FPGATrackSimMatrixMergeAlgo::copySliceTree
StatusCode copySliceTree(TFile *file)
Definition: FPGATrackSimMatrixMergeAlgo.cxx:123
FPGATrackSimMatrixMergeAlgo::m_h_c
TH1F * m_h_c
Definition: FPGATrackSimMatrixMergeAlgo.h:81
FPGATrackSimMatrixMergeAlgo::m_fpath
Gaudi::Property< std::vector< std::string > > m_fpath
Definition: FPGATrackSimMatrixMergeAlgo.h:60
FPGATrackSimMatrixMergeAlgo::m_h_d
TH1F * m_h_d
Definition: FPGATrackSimMatrixMergeAlgo.h:82
FPGATrackSimMatrixMergeAlgo::~FPGATrackSimMatrixMergeAlgo
virtual ~FPGATrackSimMatrixMergeAlgo()=default
FPGATrackSimMatrixMergeAlgo::m_Monitor
Gaudi::Property< bool > m_Monitor
Definition: FPGATrackSimMatrixMergeAlgo.h:64
FPGATrackSimMatrixMergeAlgo
Definition: FPGATrackSimMatrixMergeAlgo.h:35
FPGATrackSimMatrixMergeAlgo::m_region
Gaudi::Property< int > m_region
Definition: FPGATrackSimMatrixMergeAlgo.h:62
ServiceHandle< ITHistSvc >