Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
RootTrajectorySummaryWriter.hpp
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file RootTrajectorySummaryWriter.hpp
1 // This file is part of the Acts project.
2 //
3 // Copyright (C) 2019-2021 CERN for the benefit of the Acts project
4 //
5 // This Source Code Form is subject to the terms of the Mozilla Public
6 // License, v. 2.0. If a copy of the MPL was not distributed with this
7 // file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 
9 #pragma once
10 
19 
20 #include <cstdint>
21 #include <mutex>
22 #include <string>
23 #include <vector>
24 
25 #include <TMatrixD.h>
26 
27 class TFile;
28 class TTree;
29 namespace ActsFatras {
30 class Barcode;
31 } // namespace ActsFatras
32 
33 namespace ActsExamples {
34 struct AlgorithmContext;
35 
53  : public WriterT<TrajectoriesContainer> {
54  public:
56 
57  struct Config {
65  std::string filePath = "tracksummary.root";
67  std::string treeName = "tracksummary";
69  std::string fileMode = "RECREATE";
71  bool writeCovMat = false;
72  };
73 
80 
82  ProcessCode finalize() override;
83 
85  const Config& config() const { return m_cfg; }
86 
87  protected:
92  const TrajectoriesContainer& trajectories) override;
93 
94  private:
96 
99  this, "InputMeasurementParticlesMaps"};
100 
101  std::mutex m_writeMutex;
102  TFile* m_outputFile{nullptr};
103  TTree* m_outputTree{nullptr};
104  uint32_t m_eventNr{0};
105  std::vector<uint32_t>
107  std::vector<unsigned int>
109 
110  std::vector<unsigned int> m_nStates;
111  std::vector<unsigned int> m_nMeasurements;
112  std::vector<unsigned int> m_nOutliers;
113  std::vector<unsigned int> m_nHoles;
114  std::vector<unsigned int> m_nSharedHits;
115  std::vector<float> m_chi2Sum;
116  std::vector<unsigned int>
118  std::vector<std::vector<double>>
120  std::vector<std::vector<double>>
122  std::vector<std::vector<double>>
124  std::vector<std::vector<double>>
126  std::vector<std::vector<double>>
128  std::vector<std::vector<double>>
130 
131  // The majority truth particle info
132  std::vector<unsigned int>
134  std::vector<uint64_t>
136  std::vector<int> m_t_charge;
137  std::vector<float> m_t_time;
138  std::vector<float> m_t_vx;
139  std::vector<float> m_t_vy;
140  std::vector<float> m_t_vz;
141  std::vector<float> m_t_px;
142  std::vector<float> m_t_py;
143  std::vector<float> m_t_pz;
144  std::vector<float> m_t_theta;
145  std::vector<float> m_t_phi;
146  std::vector<float> m_t_p;
147  std::vector<float> m_t_pT;
148  std::vector<float> m_t_eta;
149  std::vector<float>
151  std::vector<float>
153 
154  std::vector<bool> m_hasFittedParams;
155  // The fitted parameters
156  std::vector<float> m_eLOC0_fit;
157  std::vector<float> m_eLOC1_fit;
158  std::vector<float> m_ePHI_fit;
159  std::vector<float> m_eTHETA_fit;
160  std::vector<float> m_eQOP_fit;
161  std::vector<float> m_eT_fit;
162  // The error of fitted parameters
163  std::vector<float> m_err_eLOC0_fit;
164  std::vector<float>
166  std::vector<float> m_err_ePHI_fit;
167  std::vector<float>
169  std::vector<float> m_err_eQOP_fit;
170  std::vector<float> m_err_eT_fit;
171  // The residual of fitted parameters
172  std::vector<float> m_res_eLOC0_fit;
173  std::vector<float>
175  std::vector<float> m_res_ePHI_fit;
176  std::vector<float>
178  std::vector<float> m_res_eQOP_fit;
179  std::vector<float> m_res_eT_fit;
180  // The pull of fitted parameters
181  std::vector<float>
183  std::vector<float>
185  std::vector<float> m_pull_ePHI_fit;
186  std::vector<float>
188  std::vector<float> m_pull_eQOP_fit;
189  std::vector<float> m_pull_eT_fit;
190 
191  // entries of the full covariance matrix. One block for every row of the
192  // matrix
193  std::vector<float> m_cov_eLOC0_eLOC0;
194  std::vector<float> m_cov_eLOC0_eLOC1;
195  std::vector<float> m_cov_eLOC0_ePHI;
196  std::vector<float> m_cov_eLOC0_eTHETA;
197  std::vector<float> m_cov_eLOC0_eQOP;
198  std::vector<float> m_cov_eLOC0_eT;
199 
200  std::vector<float> m_cov_eLOC1_eLOC0;
201  std::vector<float> m_cov_eLOC1_eLOC1;
202  std::vector<float> m_cov_eLOC1_ePHI;
203  std::vector<float> m_cov_eLOC1_eTHETA;
204  std::vector<float> m_cov_eLOC1_eQOP;
205  std::vector<float> m_cov_eLOC1_eT;
206 
207  std::vector<float> m_cov_ePHI_eLOC0;
208  std::vector<float> m_cov_ePHI_eLOC1;
209  std::vector<float> m_cov_ePHI_ePHI;
210  std::vector<float> m_cov_ePHI_eTHETA;
211  std::vector<float> m_cov_ePHI_eQOP;
212  std::vector<float> m_cov_ePHI_eT;
213 
214  std::vector<float> m_cov_eTHETA_eLOC0;
215  std::vector<float> m_cov_eTHETA_eLOC1;
216  std::vector<float> m_cov_eTHETA_ePHI;
217  std::vector<float> m_cov_eTHETA_eTHETA;
218  std::vector<float> m_cov_eTHETA_eQOP;
219  std::vector<float> m_cov_eTHETA_eT;
220 
221  std::vector<float> m_cov_eQOP_eLOC0;
222  std::vector<float> m_cov_eQOP_eLOC1;
223  std::vector<float> m_cov_eQOP_ePHI;
224  std::vector<float> m_cov_eQOP_eTHETA;
225  std::vector<float> m_cov_eQOP_eQOP;
226  std::vector<float> m_cov_eQOP_eT;
227 
228  std::vector<float> m_cov_eT_eLOC0;
229  std::vector<float> m_cov_eT_eLOC1;
230  std::vector<float> m_cov_eT_ePHI;
231  std::vector<float> m_cov_eT_eTHETA;
232  std::vector<float> m_cov_eT_eQOP;
233  std::vector<float> m_cov_eT_eT;
234 };
235 
236 } // namespace ActsExamples