ATLAS Offline Software
Loading...
Searching...
No Matches
MuonInsideOutValidationNtuple.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3*/
4
5#ifndef MUON_MUONINSIDEOUTVALIDATIONNTUPLE_H
6#define MUON_MUONINSIDEOUTVALIDATIONNTUPLE_H
7
11
12#include <vector>
13#include <string>
14#include "TTree.h"
15
16namespace Muon {
17
27 // type defs of the types
28 typedef std::pair<std::reference_wrapper<std::vector<int>*>,std::string> IntBlock;
29 typedef std::pair<std::reference_wrapper<std::vector<unsigned int>*>,std::string> UnsignedIntBlock;
30 typedef std::pair<std::reference_wrapper<std::vector<float>*>,std::string> FloatBlock;
31 typedef std::pair< MuonValidationBlockBase*, std::string > SubBlock;
32
33 // destructor, cleans up memory
35
36 // add a block to the internal caches, the name should correspond to the leave name of the block
37 void addBlock( std::vector<int>*& block, std::string name ) { block=nullptr; intBlocks.push_back( IntBlock(block,name) ); }
38 void addBlock( std::vector<unsigned int>*& block, std::string name ) { block=nullptr; unsignedIntBlocks.push_back( UnsignedIntBlock(block,name) ); }
39 void addBlock( std::vector<float>*& block, std::string name ) { block=nullptr; floatBlocks.push_back( FloatBlock(block,name) ); }
40 void addBlock( MuonValidationBlockBase* block, std::string name ) { subBlocks.push_back( SubBlock(block,name) ); }
41
42 // caches for the pointers
43 std::vector< IntBlock > intBlocks;
44 std::vector< UnsignedIntBlock > unsignedIntBlocks;
45 std::vector< FloatBlock > floatBlocks;
46 std::vector< SubBlock > subBlocks;
47
48 // initialize the ntuple for writing or reading
49 void init( const std::string& prefix, TTree*, bool write = true);
50
51 // clear, to be called with filling the ntuple at the end of the event
52 void clear();
53
54 };
55
61
62 std::vector<int>* sector = nullptr; // sector
63 std::vector<int>* chIndex = nullptr; // chamber index
64
65 void fill( int sector_, int chIndex_ ) { sector->push_back(sector_); chIndex->push_back(chIndex_); }
66
67 };
68
74
75 std::vector<int>* pdg = nullptr; // pdg id
76 std::vector<int>* barcode = nullptr; // barcode // FIXME barcode-based
77 std::vector<float>* beta = nullptr; // beta
78
79 void fill( int pdg_, int barcode_, float beta_=1. ) { pdg->push_back(pdg_); barcode->push_back(barcode_);beta->push_back(beta_); } // FIXME barcode-based
80
81 };
82
88
89 std::vector<int>* trkid = nullptr; // track index
90
91 void fill( int trkid_ ) { trkid->push_back(trkid_); }
92
93 };
94
95
101
102 MuonValidationIdBlock id; // identifier information for the segment
103 MuonValidationTrackBlock track; // index of corresponding track particle
104 MuonValidationTruthBlock truth; // truth matching based on the hit content of the segment
105
106 std::vector<int>* type = nullptr; // type: 0 = rpc, 1 = segment, 2 = rpc, 10 MDTT, 12 RPC track
107 std::vector<int>* stage = nullptr; // stage of reco
108 std::vector<unsigned int>* gasgapId = nullptr; // gasgapId (set to the chamber id for segments)
109 std::vector<float>* r = nullptr; // r-position
110 std::vector<float>* z = nullptr; // z-position
111 std::vector<float>* d = nullptr; // total distance from ip
112 std::vector<float>* time = nullptr; // time
113 std::vector<float>* err = nullptr; // error
114 std::vector<float>* timeProp = nullptr; // propagation time
115 std::vector<float>* avTimeProp = nullptr;// average propagation time
116 std::vector<float>* tof = nullptr; // time of flight
117 std::vector<float>* avTof = nullptr; // average time of flight
118 std::vector<float>* timeCor = nullptr; // time correction
119
120 void fill( int type_, unsigned int gasgapId_, float r_, float z_, float time_, float err_,
121 float timeProp_ = 0., float avTimeProp_ = 0., float tof_ = 0., float avTof_ = 0., float timeCor_ = 0., int stage_ = 0 ) {
122 type->push_back(type_); gasgapId->push_back(gasgapId_); r->push_back(r_); z->push_back(z_); d->push_back(sqrt(r_*r_+z_*z_)); time->push_back(time_);
123 err->push_back(err_); timeProp->push_back(timeProp_); avTimeProp->push_back(avTimeProp_); tof->push_back(tof_);
124 avTof->push_back(avTof_); timeCor->push_back(timeCor_); stage->push_back(stage_);
125 }
126
127 };
128
129
135
137 float pos_ = hit.localParameters()[par];
138 float err_ = Amg::error(hit.localCovariance(),par);
139 fill(pos_,err_,intersection,par);
140 }
141
142 void fill( float pos_, float err_, const MuonSystemExtension::Intersection& intersection, Trk::ParamDefs par ){
143 float expos_ = intersection.trackParameters->parameters()[Trk::loc1];
144 auto cov = intersection.trackParameters->covariance();
145 float expos_err_ = cov ? Amg::error(*cov,par) : 0;
146 fill(pos_,err_,expos_,expos_err_, cov!=nullptr );
147 }
148
149 void fill( float pos_, float err_, float expos_, float expos_err_, int status=1 ){
150
151 float res = pos_ - expos_;
152 float err2 = err_*err_ + expos_err_*expos_err_;
153 float pull_ = res/sqrt(err2);
154
155 residual->push_back(res);
156 pull->push_back(pull_);
157 pos->push_back(pos_);
158 err->push_back(err_);
159 expos->push_back(expos_);
160 expos_err->push_back(expos_err_);
161 expos_errstatus->push_back(status);
162 }
163
164 void fillResPull( float res_, float pull_, int status=1 ){
165 fillResPull(res_,pull_,1.,1.,status);
166 }
167
168 void fillResPull( float res_, float pull_, float err_, float expos_err_, int status=1 ){
169
170 residual->push_back(res_);
171 pull->push_back(pull_);
172 pos->push_back(0.);
173 err->push_back(err_);
174 expos->push_back(0.);
175 expos_err->push_back(expos_err_);
176 expos_errstatus->push_back(status);
177 }
178
179 std::vector<float>* residual = nullptr; // residual
180 std::vector<float>* pull = nullptr; // pull
181 std::vector<float>* pos = nullptr; // measured position
182 std::vector<float>* err = nullptr; // error on the measured position
183 std::vector<float>* expos = nullptr; // extrapolated position (prediction)
184 std::vector<float>* expos_err = nullptr; // error on extrapolated position
185 std::vector<int>* expos_errstatus = nullptr; // status, 0 if no error estimate was provided on the extrapolated position
186
187 };
188
194
195 std::vector<float>* pt = nullptr; // pt (at the vertex)
196 std::vector<float>* p = nullptr; // p (at the vertex)
197 std::vector<float>* eta = nullptr; // eta (at the vertex)
198 std::vector<float>* phi = nullptr; // phi (at the vertex)
199 MuonValidationTruthBlock truth; // truth information
200
201 };
202
208
209 std::vector<int>* stage = nullptr; // reco stage (0 : segment finding, 1: after matching with ID track)
210 std::vector<int>* quality = nullptr; // segment quality
211 std::vector<int>* nmdtHits = nullptr; // number of MDT hits
212 std::vector<int>* ntrigEtaHits = nullptr; // number of trigger eta hits
213 std::vector<int>* ntrigPhiHits = nullptr; // number of trigger phi hits
214 std::vector<float>* r = nullptr; // r-position
215 std::vector<float>* z = nullptr; // z-position
216 std::vector<float>* t0 = nullptr; // t0 from t0 fit
217 std::vector<float>* t0Error = nullptr; // error on t0 from t0 fit
218 std::vector<float>* t0Trig = nullptr; // t0 from trigger hits
219 std::vector<float>* t0TrigError = nullptr; // error on t0 from trigger hits
220 MuonValidationIdBlock id; // identifier information for the segment
221 MuonValidationTrackBlock track; // index of corresponding track particle
222 MuonValidationTruthBlock truth; // truth matching based on the hit content of the segment
223 MuonValidationResidualBlock xresiduals; // residuals in the position in the non-bending plane
224 MuonValidationResidualBlock yresiduals; // residuals in the position in the bending plane
225 MuonValidationResidualBlock angleXZ; // residuals in the angle in the non-bending plane
226 MuonValidationResidualBlock angleYZ; // residuals in the angle in the bending plane
227 MuonValidationResidualBlock combinedYZ; // combined residuals in the position/angle in the bending plane
228
229 };
230
236
237 std::vector<float>* maximum = nullptr; // height of the maximum
238 MuonValidationIdBlock id; // identifier information for the maximum
239 MuonValidationTrackBlock track; // index of corresponding track particle
240 MuonValidationTruthBlock truth; // truth matching based on the hit content of the maximum
241 MuonValidationResidualBlock residuals; // residuals in the position in the bending plane
242
243 };
244
247
248 MuonValidationIdBlock id; // identifier information for the hit
249 MuonValidationTrackBlock track; // index of corresponding track particle
250 MuonValidationTruthBlock truth; // truth matching based on the hit identifier
251 MuonValidationResidualBlock residuals; // residuals in the position in the measurement plane of the hit
252 };
253
256
257 std::vector<int>* ntimes = nullptr; // number of time measurements
258 std::vector<float>* beta = nullptr; // beta
259 std::vector<float>* chi2ndof = nullptr; // chi2/ndof beta fit
260 std::vector<int>* nseg = nullptr; // number of segments
261 std::vector<int>* nprec = nullptr; // precision layers
262 std::vector<int>* ntrigPhi = nullptr; // trigger phi layers
263 std::vector<int>* ntrigEta = nullptr; // trigger eta layers
264 std::vector<int>* stage = nullptr; // reco stage
265
266 MuonValidationTrackBlock track; // index of corresponding track particle
267
268 void fill( int ntimes_, float beta_, float chi2ndof_, int nseg_, int nprec_, int ntrigPhi_, int ntrigEta_, int stage_ ){
269 ntimes->push_back(ntimes_);
270 beta->push_back(beta_);
271 chi2ndof->push_back(chi2ndof_);
272 nseg->push_back(nseg_);
273 nprec->push_back(nprec_);
274 ntrigPhi->push_back(ntrigPhi_);
275 ntrigEta->push_back(ntrigEta_);
276 stage->push_back(stage_);
277 }
278
279 };
280
281
293
294}
295
296#endif
std::pair< std::vector< unsigned int >, bool > res
MuonValidationTrackParticleBlock trackParticleBlock
This class is the pure abstract base class for all fittable tracking measurements.
const LocalParameters & localParameters() const
Interface method to get the LocalParameters.
const Amg::MatrixX & localCovariance() const
Interface method to get the localError.
std::vector< std::string > intersection(std::vector< std::string > &v1, std::vector< std::string > &v2)
double error(const Amg::MatrixX &mat, int index)
return diagonal error of the matrix caller should ensure the matrix is symmetric and the index is in ...
NRpcCablingAlg reads raw condition data and writes derived condition data to the condition store.
ParamDefs
This file defines the parameter enums in the Trk namespace.
Definition ParamDefs.h:32
@ loc1
Definition ParamDefs.h:34
base class for ntuple block The class can handle float and integer block and supports sub blocks.
void init(const std::string &prefix, TTree *, bool write=true)
std::pair< std::reference_wrapper< std::vector< unsigned int > * >, std::string > UnsignedIntBlock
std::pair< std::reference_wrapper< std::vector< float > * >, std::string > FloatBlock
std::pair< MuonValidationBlockBase *, std::string > SubBlock
void addBlock(std::vector< int > *&block, std::string name)
std::vector< UnsignedIntBlock > unsignedIntBlocks
void addBlock(std::vector< float > *&block, std::string name)
void addBlock(std::vector< unsigned int > *&block, std::string name)
std::pair< std::reference_wrapper< std::vector< int > * >, std::string > IntBlock
void addBlock(MuonValidationBlockBase *block, std::string name)
void fill(int ntimes_, float beta_, float chi2ndof_, int nseg_, int nprec_, int ntrigPhi_, int ntrigEta_, int stage_)
Block with hough maxima information.
Block with identifier information.
void fill(int sector_, int chIndex_)
Block with residual and pull information.
void fill(const Trk::MeasurementBase &hit, const MuonSystemExtension::Intersection &intersection, Trk::ParamDefs par)
void fill(float pos_, float err_, const MuonSystemExtension::Intersection &intersection, Trk::ParamDefs par)
void fillResPull(float res_, float pull_, float err_, float expos_err_, int status=1)
void fill(float pos_, float err_, float expos_, float expos_err_, int status=1)
void fillResPull(float res_, float pull_, int status=1)
void fill(int type_, unsigned int gasgapId_, float r_, float z_, float time_, float err_, float timeProp_=0., float avTimeProp_=0., float tof_=0., float avTof_=0., float timeCor_=0., int stage_=0)
Block with information on the incoming track particle.
void fill(int pdg_, int barcode_, float beta_=1.)