58 return StatusCode::SUCCESS;
70 TTree *old_tree = (TTree*)
file->Get(
"slice");
71 old_tree->SetBranchAddress(
"c_max", &
max.qOverPt);
72 old_tree->SetBranchAddress(
"c_min", &
min.qOverPt);
73 old_tree->SetBranchAddress(
"c_slices", &nBins.qOverPt);
75 old_tree->SetBranchAddress(
"phi_max", &
max.phi);
76 old_tree->SetBranchAddress(
"phi_min", &
min.phi);
77 old_tree->SetBranchAddress(
"phi_slices", &nBins.phi);
79 old_tree->SetBranchAddress(
"d0_max", &
max.d0);
80 old_tree->SetBranchAddress(
"d0_min", &
min.d0);
81 old_tree->SetBranchAddress(
"d0_slices", &nBins.d0);
83 old_tree->SetBranchAddress(
"z0_max", &
max.z0);
84 old_tree->SetBranchAddress(
"z0_min", &
min.z0);
85 old_tree->SetBranchAddress(
"z0_slices", &nBins.z0);
87 old_tree->SetBranchAddress(
"eta_max", &
max.eta);
88 old_tree->SetBranchAddress(
"eta_min", &
min.eta);
89 old_tree->SetBranchAddress(
"eta_slices", &nBins.eta);
91 old_tree->GetEntry(0);
94 TTree *new_tree =
new TTree(
"slice",
"Slice boundaries");
97 new_tree->Branch(
"c_max", &
max.qOverPt);
98 new_tree->Branch(
"c_min", &
min.qOverPt);
99 new_tree->Branch(
"c_slices", &nBins.qOverPt);
101 new_tree->Branch(
"phi_max", &
max.phi);
102 new_tree->Branch(
"phi_min", &
min.phi);
103 new_tree->Branch(
"phi_slices", &nBins.phi);
105 new_tree->Branch(
"d0_max", &
max.d0);
106 new_tree->Branch(
"d0_min", &
min.d0);
107 new_tree->Branch(
"d0_slices", &nBins.d0);
109 new_tree->Branch(
"z0_max", &
max.z0);
110 new_tree->Branch(
"z0_min", &
min.z0);
111 new_tree->Branch(
"z0_slices", &nBins.z0);
113 new_tree->Branch(
"eta_max", &
max.eta);
114 new_tree->Branch(
"eta_min", &
min.eta);
115 new_tree->Branch(
"eta_slices", &nBins.eta);
119 return StatusCode::SUCCESS;
138 size_t iCoord_1st = 0;
140 std::vector<size_t> layers_1st_to_2nd(
m_pmap_1st->getNLogiLayers());
141 std::vector<size_t> coords_1st_to_2nd(
m_pmap_1st->getNCoords());
143 for (
unsigned layer_1st = 0; layer_1st <
m_pmap_1st->getNLogiLayers(); layer_1st++)
150 layers_1st_to_2nd[layer_1st] = ls_2nd.
layer + inversion;
151 for (
size_t iDim = 0; iDim <
m_pmap_1st->getDim(layer_1st); iDim++)
153 coords_1st_to_2nd[iCoord_1st] =
m_pmap_2nd->getCoordOffset(ls_2nd.
layer) + iDim + inversion;
158 assert(iCoord_1st ==
m_pmap_1st->getNCoords());
159 return { layers_1st_to_2nd, coords_1st_to_2nd };
183 std::vector<size_t>
const & layers_1st_to_2nd, std::vector<size_t>
const & coords_1st_to_2nd)
185 std::vector<module_t> modules_1st(
m_pmap_1st->getNLogiLayers());
192 for (
size_t layer_1st = 0; layer_1st <
m_pmap_1st->getNLogiLayers(); layer_1st++)
194 size_t layer_2nd = layers_1st_to_2nd[layer_1st];
195 modules_1st[layer_1st] = modules_2nd[layer_2nd];
200 for (
size_t iCoord_1st = 0; iCoord_1st <
m_pmap_1st->getNCoords(); iCoord_1st++)
202 size_t iCoord_2nd = coords_1st_to_2nd[iCoord_1st];
214 for (
size_t iCoord_1st_j = iCoord_1st; iCoord_1st_j <
m_pmap_1st->getNCoords(); iCoord_1st_j++)
216 size_t iCoord_2nd_j = coords_1st_to_2nd[iCoord_1st_j];
222 return { modules_1st, acc_1st };
233 TTree *tree_2nd = (TTree*)
file->Get(Form(
"am0"));
237 while (reader.nextEntry())
239 auto sector_acc =
reduce(reader.getModules(), reader.getAccumulator(), matched_layers_coords.first, matched_layers_coords.second);
254 return StatusCode::SUCCESS;
265 std::stringstream name;
266 std::stringstream title;
268 title <<
"Ambank 0" <<
" parameters";
269 TTree*
tree =
new TTree(name.str().c_str(), title.str().c_str());
277 return StatusCode::SUCCESS;
#define ATH_CHECK
Evaluate an expression and check for errors.
bool accumulate(AccumulateMap &map, std::vector< module_t > const &modules, FPGATrackSimMatrixAccumulator const &acc)
Accumulates an accumulator (e.g.
void fillTree(AccumulateMap &map, TTree *tree, int nLayers, int nCoords)
Writes the contents of an AccumulateMap into the supplied tree (one entry per sector).
Classes to read/write matrix files event by event.
Algorithm to reduce matrix files from 2nd stage to 1st stage.
Maps physical layers to logical layers.
AthAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Constructor with parameters:
ServiceHandle< ITHistSvc > m_tHistSvc
FPGATrackSimPlaneMap const * m_pmap_2nd
StatusCode finalize() override
StatusCode copySliceTree(TFile *file)
Gaudi::Property< bool > m_allregion
std::pair< std::vector< module_t >, FPGATrackSimMatrixAccumulator > reduce(std::vector< module_t > const &modules_2nd, FPGATrackSimMatrixAccumulator const &acc_2nd, std::vector< size_t > const &layers_1st_to_2nd, std::vector< size_t > const &coords_1st_to_2nd)
ServiceHandle< IFPGATrackSimMappingSvc > m_FPGATrackSimMapping
Gaudi::Property< std::string > m_filePath
FPGATrackSimMatrixReductionAlgo(const std::string &name, ISvcLocator *pSvcLocator)
StatusCode execute() override
FPGATrackSimPlaneMap const * m_pmap_1st
Gaudi::Property< int > m_region
void extract_1stStage(TFile *file)
std::vector< AccumulateMap > m_sector_cum
Gaudi::Property< int > m_nRegions
std::pair< std::vector< size_t >, std::vector< size_t > > matchStages()
StatusCode initialize() override
std::vector< float > hit_coords
std::vector< double > hit_x_eta
std::vector< double > hit_x_phi
std::vector< double > covariance
std::vector< module_t > FTK_modules
std::vector< FPGATrackSimTrackParsI > track_bins
std::vector< double > hit_x_z0
FPGATrackSimTrackPars pars
std::vector< double > hit_x_d0
std::vector< double > hit_x_QoP