ATLAS Offline Software
Loading...
Searching...
No Matches
Trk::BasicValTrkParticleNtupleTool Class Reference

This validation tool writes basic information about Trk::TrackParticleBase into an ntuple;. More...

#include <BasicValTrkParticleNtupleTool.h>

Inheritance diagram for Trk::BasicValTrkParticleNtupleTool:
Collaboration diagram for Trk::BasicValTrkParticleNtupleTool:

Public Member Functions

 BasicValTrkParticleNtupleTool (const std::string &, const std::string &, const IInterface *)
 ~BasicValTrkParticleNtupleTool ()
StatusCode initialize ()
StatusCode finalize ()
 finalize
virtual StatusCode addNtupleItems (TTree *tree)
 add branches to the tree Should be called once (per track collection and tree) dunring the initialisation phase by the calling algorithm (usually Trk::TrackValidationNtupleWriter)
virtual StatusCode writeTrackData (const Trk::Track &, const int iterationIndex, const unsigned int fitStatCode)
 fill AND write ntuple data of a given track
virtual StatusCode writeTrackParticleData (const Trk::TrackParticleBase &)
 fill AND write ntuple data of a given track particle
virtual StatusCode fillTrackData (const Trk::Track &, const int iterationIndex, const unsigned int fitStatCode)
 fill ntuple data of a given track without writing the record.
virtual StatusCode fillTrackParticleData (const Trk::TrackParticleBase &)
 fill ntuple data of a given track particle without writing the record.
virtual StatusCode fillTrackParameter (const Trk::TrackParameters *, const int iterationIndex)
 fill ntuple data of a given track without writing the record.
virtual StatusCode fillMeasurementData (const Trk::MeasurementBase *, const Trk::TrackParameters *)
 fill ntuple data of given measurement and track parameters without writing the record
virtual StatusCode fillOutlierData (const Trk::MeasurementBase *, const Trk::TrackParameters *, const Trk::FitQualityOnSurface *)
 fill ntuple data of an outlier measurement (without writing the record yet).
virtual StatusCode fillHoleData (const Trk::TrackStateOnSurface &)
 fill ntuple data of holes on track without writing the record
virtual StatusCode fillTrackTruthData (const TrackParameters *&, const TrackTruth &, const int truthIndex=-1)
 fill ntuple data of holes on track without writing the record
virtual StatusCode writeRecord (TTree *tree)
 write the filled data into the ntuple
ServiceHandle< StoreGateSvc > & evtStore ()
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
const ServiceHandle< StoreGateSvc > & detStore () const
 The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
virtual StatusCode sysInitialize () override
 Perform system initialization for an algorithm.
virtual StatusCode sysStart () override
 Handle START transition.
virtual std::vector< Gaudi::DataHandle * > inputHandles () const override
 Return this algorithm's input handles.
virtual std::vector< Gaudi::DataHandle * > outputHandles () const override
 Return this algorithm's output handles.
Gaudi::Details::PropertyBase & declareProperty (Gaudi::Property< T, V, H > &t)
void updateVHKA (Gaudi::Details::PropertyBase &)
MsgStream & msg () const
bool msgLvl (const MSG::Level lvl) const

Static Public Member Functions

static const InterfaceID & interfaceID ()
 Interface ID, declared here, and defined below.

Protected Member Functions

void renounceArray (SG::VarHandleKeyArray &handlesArray)
 remove all handles from I/O resolution
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce (T &h)
void extraDeps_update_handler (Gaudi::Details::PropertyBase &ExtraDeps)
 Add StoreName to extra input/output deps as needed.

Private Types

typedef ServiceHandle< StoreGateSvcStoreGateSvc_t

Private Member Functions

StatusCode fillTrkParticlePerigee (const Trk::Perigee *perigee)
 fill the perigee in ntuple
StatusCode fillTrkParticleSummary (const Trk::TrackSummary *summary)
 fill the perigee in ntuple
StatusCode fillFitQualityData (const Trk::FitQuality *fitQuality)
void resetVariables ()
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey>

Private Attributes

bool m_bookNewNtuple
 jobOption: book new ntuple?
std::string m_ntupleFileName
 jobOption: Ntuple file name
std::string m_ntupleDirName
 jobOption: Ntuple directory name
std::string m_ntupleTreeName
 jobOption: Ntuple tree name
TTree * m_nt
 Pointer to the NTuple tree.
int m_TrackIDcounter
 help variable to link with event property tree
unsigned int m_lastEventNumber
 help variable to link with event property tree
int m_runNumber
 run number the track belongs to
int m_eventNumber
 event number the track belongs to
unsigned char m_TrackID
 number of the track within the current event
float m_Rec_d0
 reconstructed track params: local d0 at perigee UNIT:mm
float m_Rec_z0
 reconstructed track params: local z0 at perigee UNIT:mm
float m_Rec_phi0
 reconstructed track params: angle phi at perigee UNIT:rad
float m_Rec_eta
 reconstructed track params: pseudorapidity UNIT:1
float m_Rec_qOverP
 reconstructed track params: curvature q/p UNIT:1/MeV
float m_errord0
 error on local d0 at perigee UNIT:mm
float m_errorz0
 error on local z0 at perigee UNIT:mm
float m_errorphi0
 error on angle phi at perigee UNIT:rad
float m_errortheta0
 error on angle theta at perigee UNIT:rad
float m_errorqoverp
 error on curvature q/p UNIT:1/MeV
float m_chi2
 chi sqared of the track fit normalized to DOF
unsigned char m_numberOfPixelHits
 number of measurements in the Pixels
unsigned char m_numberOfContribPixelLayers
 number of contributing layers of the pixel detector
unsigned char m_numberOfPixelHoles
 number of pixel layers on track with absence of hits
unsigned char m_numberOfPixelDeadSensors
 number of dead pixel sensors crossed
unsigned char m_numberOfSCTHits
 number of measurements in the SCT
unsigned char m_numberOfSCTHoles
 number of SCT holes
unsigned char m_numberOfSCTDeadSensors
 number of dead SCT sensors crossed
unsigned char m_numberOfTRTHits
 number of TRT hits
unsigned char m_numberOfTRTHoles
 number of TRT holes
unsigned char m_numberOfTRTDeadStraws
 number of dead TRT straws crossed
unsigned char m_numberOfTRTHighThresholdHits
 number of TRT hits which pass the high threshold
unsigned long m_idHitPattern
 bit word carrying information about hit layers
SG::ReadHandleKey< xAOD::EventInfom_evt {this, "EvtInfo", "EventInfo", "EventInfo name"}
StoreGateSvc_t m_evtStore
 Pointer to StoreGate (event store by default)
StoreGateSvc_t m_detStore
 Pointer to StoreGate (detector store by default)
std::vector< SG::VarHandleKeyArray * > m_vhka
bool m_varHandleArraysDeclared

Static Private Attributes

static const float s_errorEntry = -99999.0
 error entry costant

Detailed Description

This validation tool writes basic information about Trk::TrackParticleBase into an ntuple;.

It can book the ntuple, create the tree directory and add basic entries. This tool is also able to write the current record to the ntuple file and start a new entry. You can also use an existing ntuple tree (which has to have the same track-wise structure) and just use the Trk::BasicValidationNtupleTool to add some ntuple variables.

Every entry (Rec:TrackPartcile) contains the event number, a track id (numbering the tracks within one event).

Perigee parameters and track summary are filled for every track if available.

Author
Pavel.nosp@m..Ruz.nosp@m.icka@.nosp@m.cern.nosp@m..ch

Definition at line 39 of file BasicValTrkParticleNtupleTool.h.

Member Typedef Documentation

◆ StoreGateSvc_t

typedef ServiceHandle<StoreGateSvc> AthCommonDataStore< AthCommonMsg< AlgTool > >::StoreGateSvc_t
privateinherited

Definition at line 388 of file AthCommonDataStore.h.

Constructor & Destructor Documentation

◆ BasicValTrkParticleNtupleTool()

Trk::BasicValTrkParticleNtupleTool::BasicValTrkParticleNtupleTool ( const std::string & t,
const std::string & n,
const IInterface * p )

Definition at line 27 of file BasicValTrkParticleNtupleTool.cxx.

31 :
32 AthAlgTool(t,n,p), // retrieve as private tools
34 m_nt(nullptr),
39 m_TrackID{},
40 m_Rec_d0{},
41 m_Rec_z0{},
42 m_Rec_phi0{},
43 m_Rec_eta{},
44 m_Rec_qOverP{},
45
46 m_errord0{},
47 m_errorz0{},
48 m_errorphi0{},
51 m_chi2{},
64{
65
66 declareInterface<IValidationNtupleTool>(this);
67 // Declare the properties
68 declareProperty("BookNewNtuple", m_bookNewNtuple = false, "Create the ntuple tree or use existing one?");
69 declareProperty("NtupleFileName", m_ntupleFileName = "/NTUPLES/FILE1", "Ntuple file handle");
70 declareProperty("NtupleDirectoryName", m_ntupleDirName = "FitterValidation", "dircetory name for ntuple tree");
71 declareProperty("NtupleTreeName", m_ntupleTreeName = "Validation", "Name of the ntuple tree");
72}
AthAlgTool()
Default constructor:
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
unsigned char m_numberOfPixelDeadSensors
number of dead pixel sensors crossed
unsigned char m_numberOfPixelHoles
number of pixel layers on track with absence of hits
float m_errortheta0
error on angle theta at perigee UNIT:rad
float m_errorqoverp
error on curvature q/p UNIT:1/MeV
unsigned char m_numberOfTRTHits
number of TRT hits
unsigned char m_numberOfSCTDeadSensors
number of dead SCT sensors crossed
unsigned char m_numberOfTRTHighThresholdHits
number of TRT hits which pass the high threshold
unsigned char m_numberOfContribPixelLayers
number of contributing layers of the pixel detector
float m_errord0
error on local d0 at perigee UNIT:mm
bool m_bookNewNtuple
jobOption: book new ntuple?
float m_errorz0
error on local z0 at perigee UNIT:mm
unsigned char m_numberOfTRTDeadStraws
number of dead TRT straws crossed
unsigned char m_numberOfPixelHits
number of measurements in the Pixels
unsigned char m_numberOfSCTHits
number of measurements in the SCT
float m_Rec_phi0
reconstructed track params: angle phi at perigee UNIT:rad
unsigned char m_TrackID
number of the track within the current event
std::string m_ntupleDirName
jobOption: Ntuple directory name
unsigned char m_numberOfSCTHoles
number of SCT holes
TTree * m_nt
Pointer to the NTuple tree.
std::string m_ntupleTreeName
jobOption: Ntuple tree name
unsigned int m_lastEventNumber
help variable to link with event property tree
int m_TrackIDcounter
help variable to link with event property tree
float m_errorphi0
error on angle phi at perigee UNIT:rad
float m_Rec_qOverP
reconstructed track params: curvature q/p UNIT:1/MeV
float m_Rec_z0
reconstructed track params: local z0 at perigee UNIT:mm
float m_chi2
chi sqared of the track fit normalized to DOF
float m_Rec_d0
reconstructed track params: local d0 at perigee UNIT:mm
std::string m_ntupleFileName
jobOption: Ntuple file name
int m_runNumber
run number the track belongs to
int m_eventNumber
event number the track belongs to
float m_Rec_eta
reconstructed track params: pseudorapidity UNIT:1
unsigned char m_numberOfTRTHoles
number of TRT holes
unsigned long m_idHitPattern
bit word carrying information about hit layers

◆ ~BasicValTrkParticleNtupleTool()

Trk::BasicValTrkParticleNtupleTool::~BasicValTrkParticleNtupleTool ( )
default

Member Function Documentation

◆ addNtupleItems()

StatusCode Trk::BasicValTrkParticleNtupleTool::addNtupleItems ( TTree * tree)
virtual

add branches to the tree Should be called once (per track collection and tree) dunring the initialisation phase by the calling algorithm (usually Trk::TrackValidationNtupleWriter)

Implements Trk::IValidationNtupleTool.

Definition at line 123 of file BasicValTrkParticleNtupleTool.cxx.

123 {
124 if (!tree) return StatusCode::FAILURE;
125 //-----------------
126 // add items *** Note: Documentation is in the header file, doxygen and wikis! ***
127 //
128 // event info:
129 tree->Branch("RunNumber", &m_runNumber, "run_number/I");
130 tree->Branch("EventNumber", &m_eventNumber, "event_number/I");
131 tree->Branch("TrackID", &m_TrackID, "ID_of_track_in_event/b");
132
133 // reconstructed track parameters
134 tree->Branch("RecD0", &m_Rec_d0, "Reconstructed_d0/F");
135 tree->Branch("RecZ0", &m_Rec_z0, "Reconstructed_z0/F");
136 tree->Branch("RecPhi0", &m_Rec_phi0, "Reconstructed_phi0/F");
137 tree->Branch("RecEta", &m_Rec_eta, "Reconstructed_eta/F");
138 tree->Branch("RecQoverP", &m_Rec_qOverP, "Reconstructed_Q_over_p/F");
139
140 // errors of reconstructed track parameters
141 tree->Branch("RecErrD0", &m_errord0, "err_d0/F");
142 tree->Branch("RecErrZ0", &m_errorz0, "err_z0/F");
143 tree->Branch("RecErrPhi0", &m_errorphi0, "err_phi0/F");
144 tree->Branch("RecErrTheta", &m_errortheta0, "err_theta/F");
145 tree->Branch("RecErrQoverP", &m_errorqoverp, "err_Q_over_p/F");
146
147 // fit quality parameters
148 tree->Branch("chi2", &m_chi2, "chi2/F");
149
150 //track particle summary parameters
151 tree->Branch("nPixelHits", &m_numberOfPixelHits, "numberOfPixelHits/b");
152 tree->Branch("nContribPixelLayers", &m_numberOfContribPixelLayers, "numberOfContribPixelLayers/b");
153 tree->Branch("nPixelHoles", &m_numberOfPixelHoles, "numberOfPixelHoles/b");
154 tree->Branch("nPixelDeadSensors", &m_numberOfPixelDeadSensors, "numberOfPixelDeadSensors/b");
155 tree->Branch("nSCTHits", &m_numberOfSCTHits, "numberOfSCTHits/b");
156 tree->Branch("nSCTHoles", &m_numberOfSCTHoles, "numberOfSCTHoles/b");
157 tree->Branch("nSCTDeadSensors" , &m_numberOfSCTDeadSensors, "numberOfSCTDeadSensors/b");
158 tree->Branch("nTRTHits" , &m_numberOfTRTHits, "numberOfTRTHits/b");
159 tree->Branch("nTRTHoles", &m_numberOfTRTHoles, "numberOfTRTHoles/b");
160 tree->Branch("nTRTDeadStraws", &m_numberOfTRTDeadStraws, "numberOfTRTDeadStraws/b");
161 tree->Branch("nTRTHighThresholdHits", &m_numberOfTRTHighThresholdHits, "numberOfTRTHighThresholdHits/b");
162
163 tree->Branch("idHitPattern", &m_idHitPattern, "idHitPattern/l");
164
165 ATH_MSG_DEBUG ("added own branches to ntuple");
166
167 return StatusCode::SUCCESS;
168}
#define ATH_MSG_DEBUG(x)
TChain * tree

◆ declareGaudiProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< AlgTool > >::declareGaudiProperty ( Gaudi::Property< T, V, H > & hndl,
const SG::VarHandleKeyType &  )
inlineprivateinherited

specialization for handling Gaudi::Property<SG::VarHandleKey>

Definition at line 156 of file AthCommonDataStore.h.

158 {
160 hndl.value(),
161 hndl.documentation());
162
163 }

◆ declareProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( Gaudi::Property< T, V, H > & t)
inlineinherited

Definition at line 145 of file AthCommonDataStore.h.

145 {
146 typedef typename SG::HandleClassifier<T>::type htype;
148 }
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>

◆ detStore()

const ServiceHandle< StoreGateSvc > & AthCommonDataStore< AthCommonMsg< AlgTool > >::detStore ( ) const
inlineinherited

The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 95 of file AthCommonDataStore.h.

◆ evtStore()

ServiceHandle< StoreGateSvc > & AthCommonDataStore< AthCommonMsg< AlgTool > >::evtStore ( )
inlineinherited

The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 85 of file AthCommonDataStore.h.

◆ extraDeps_update_handler()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::extraDeps_update_handler ( Gaudi::Details::PropertyBase & ExtraDeps)
protectedinherited

Add StoreName to extra input/output deps as needed.

use the logic of the VarHandleKey to parse the DataObjID keys supplied via the ExtraInputs and ExtraOuputs Properties to add the StoreName if it's not explicitly given

◆ fillFitQualityData()

StatusCode Trk::BasicValTrkParticleNtupleTool::fillFitQualityData ( const Trk::FitQuality * fitQuality)
private

Definition at line 311 of file BasicValTrkParticleNtupleTool.cxx.

311 {
312 if (!fitQuality) {
313 ATH_MSG_WARNING("Something is wrong - track has no fit quality data !!");
314 m_chi2 = 0;
315
316 return StatusCode::FAILURE;
317 }
318
319 if(fitQuality->numberDoF() == 0) {
320 ATH_MSG_WARNING("Number of DOF is zero !! Could not normalize chi2 ");
321 return StatusCode::FAILURE;
322 }
323
325
326 return StatusCode::SUCCESS;
327}
#define ATH_MSG_WARNING(x)
int numberDoF() const
returns the number of degrees of freedom of the overall track or vertex fit as integer
Definition FitQuality.h:60
double chiSquared() const
returns the of the overall track fit
Definition FitQuality.h:56
FitQualityOnSurface fitQuality(const MultiComponentState &, const MeasurementBase &)
Method for determining the chi2 of the multi-component state and the number of degrees of freedom.

◆ fillHoleData()

StatusCode Trk::BasicValTrkParticleNtupleTool::fillHoleData ( const Trk::TrackStateOnSurface & )
virtual

fill ntuple data of holes on track without writing the record

Implements Trk::IValidationNtupleTool.

Definition at line 382 of file BasicValTrkParticleNtupleTool.cxx.

383 {return StatusCode::SUCCESS;}

◆ fillMeasurementData()

StatusCode Trk::BasicValTrkParticleNtupleTool::fillMeasurementData ( const Trk::MeasurementBase * ,
const Trk::TrackParameters *  )
virtual

fill ntuple data of given measurement and track parameters without writing the record

Implements Trk::IValidationNtupleTool.

Definition at line 371 of file BasicValTrkParticleNtupleTool.cxx.

373 {return StatusCode::SUCCESS;}

◆ fillOutlierData()

StatusCode Trk::BasicValTrkParticleNtupleTool::fillOutlierData ( const Trk::MeasurementBase * ,
const Trk::TrackParameters * ,
const Trk::FitQualityOnSurface *  )
virtual

fill ntuple data of an outlier measurement (without writing the record yet).

The TrackParameters and FQoS are optional, i.e. NULL pointers should be handled by the implementation

Implements Trk::IValidationNtupleTool.

Definition at line 376 of file BasicValTrkParticleNtupleTool.cxx.

379 {return StatusCode::SUCCESS;}

◆ fillTrackData()

StatusCode Trk::BasicValTrkParticleNtupleTool::fillTrackData ( const Trk::Track & ,
const int iterationIndex,
const unsigned int fitStatCode )
virtual

fill ntuple data of a given track without writing the record.

  • if this method is called twice without writing the ntuple inbetween the first data will be lost!

Implements Trk::IValidationNtupleTool.

Definition at line 359 of file BasicValTrkParticleNtupleTool.cxx.

362 {return StatusCode::SUCCESS;}

◆ fillTrackParameter()

StatusCode Trk::BasicValTrkParticleNtupleTool::fillTrackParameter ( const Trk::TrackParameters * ,
const int iterationIndex )
virtual

fill ntuple data of a given track without writing the record.

  • if this method is called twice without writing the ntuple inbetween the first data will be lost!

Implements Trk::IValidationNtupleTool.

Definition at line 366 of file BasicValTrkParticleNtupleTool.cxx.

368 {return StatusCode::SUCCESS;}

◆ fillTrackParticleData()

StatusCode Trk::BasicValTrkParticleNtupleTool::fillTrackParticleData ( const Trk::TrackParticleBase & track)
virtual

fill ntuple data of a given track particle without writing the record.

fill track data into variables without actually writing the record

  • if this method is called twice without writing the ntuple inbetween the first data will be lost!

Implements Trk::IValidationNtupleTool.

Definition at line 190 of file BasicValTrkParticleNtupleTool.cxx.

191 {
192
193 // ---------------------------------------
194 // detect new event, reset TrackParticle counter if new event
195 SG::ReadHandle<xAOD::EventInfo> evt(m_evt);
196 if (!evt.isValid()) {
197 ATH_MSG_WARNING("Could not retrieve event info");
200 return StatusCode::FAILURE;
201 }
202
203 if (m_lastEventNumber!=evt->eventNumber()) {
204 // we have a new event, reset TrackParticleID:
206 m_lastEventNumber = evt->eventNumber();
207 }
209 m_TrackID = (unsigned char)m_TrackIDcounter;
210 m_eventNumber = evt->eventNumber();
211 m_runNumber = evt->runNumber();
212
213 ATH_MSG_VERBOSE ("Event: " << m_eventNumber << ", Run: "<< m_runNumber << " TrackID: " << m_TrackID);
214
215 //----------------------------------------------
216 // fill track parameters in ntuple
217 const Trk::Perigee* perpars = track.perigee();
218 if (perpars != nullptr && fillTrkParticlePerigee(perpars).isFailure()) ATH_MSG_WARNING("Perigee parameters could not be written to ntuple");
219
220 const Trk::TrackSummary* summary = track.trackSummary();
221 if((!summary) || fillTrkParticleSummary(summary).isFailure()) ATH_MSG_WARNING("Summary parameters could not be written to ntuple");
222
223 const Trk::FitQuality* fitQuality = track.fitQuality();
224 if((!fitQuality) || fillFitQualityData(fitQuality).isFailure() ) ATH_MSG_WARNING("Fit Quality data could not be written to ntuple");
225
226 return StatusCode::SUCCESS;
227}
#define ATH_MSG_VERBOSE(x)
StatusCode fillTrkParticlePerigee(const Trk::Perigee *perigee)
fill the perigee in ntuple
StatusCode fillFitQualityData(const Trk::FitQuality *fitQuality)
static const float s_errorEntry
error entry costant
SG::ReadHandleKey< xAOD::EventInfo > m_evt
StatusCode fillTrkParticleSummary(const Trk::TrackSummary *summary)
fill the perigee in ntuple
ParametersT< TrackParametersDim, Charged, PerigeeSurface > Perigee

◆ fillTrackTruthData()

StatusCode Trk::BasicValTrkParticleNtupleTool::fillTrackTruthData ( const TrackParameters *& ,
const TrackTruth & ,
const int truthIndex = -1 )
virtual

fill ntuple data of holes on track without writing the record

Implements Trk::IValidationNtupleTool.

Definition at line 386 of file BasicValTrkParticleNtupleTool.cxx.

389 {return StatusCode::SUCCESS;}

◆ fillTrkParticlePerigee()

StatusCode Trk::BasicValTrkParticleNtupleTool::fillTrkParticlePerigee ( const Trk::Perigee * perigee)
private

fill the perigee in ntuple

Definition at line 233 of file BasicValTrkParticleNtupleTool.cxx.

233 {
234
235 ATH_MSG_VERBOSE ("in fillTrackPerigee");
236
237 if (!perigee) {
238 ATH_MSG_WARNING("Something is wrong - track has no perigee at all!");
239 m_Rec_d0 = 0;
240 m_Rec_z0 = 0;
241 m_Rec_phi0 = 0;
242 m_Rec_eta = 0;
243 m_Rec_qOverP = 0;
244 return StatusCode::FAILURE;
245 }
246
247 ATH_MSG_VERBOSE("Fill Perigee Parameters now");
248 // track parameters
249 m_Rec_d0 = perigee->parameters()[Trk::d0];
250 m_Rec_z0 = perigee->parameters()[Trk::z0];
251 m_Rec_phi0 = perigee->parameters()[Trk::phi0];
252 m_Rec_eta = perigee->eta();
253 m_Rec_qOverP = perigee->parameters()[Trk::qOverP];
254
255 if (perigee->covariance()) {
256
257 // error of track parameters
258 m_errord0 = Amg::error(*perigee->covariance(),Trk::d0);
259 m_errorz0 = Amg::error(*perigee->covariance(),Trk::z0);
260 m_errorphi0 = Amg::error(*perigee->covariance(),Trk::phi0);
261 m_errortheta0 = Amg::error(*perigee->covariance(),Trk::theta);
262 m_errorqoverp = Amg::error(*perigee->covariance(),Trk::qOverP);
263
264
265 } // end if measPerigee
266 ATH_MSG_DEBUG ("Trackparameters: d0=" << m_Rec_d0 << ", z0=" << m_Rec_z0 << ", phi0=" << m_Rec_phi0 << ", eta=" << m_Rec_eta);
267
268 return StatusCode::SUCCESS;
269}
double eta() const
Access method for pseudorapidity - from momentum.
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 ...
@ phi0
Definition ParamDefs.h:65
@ theta
Definition ParamDefs.h:66
@ qOverP
perigee
Definition ParamDefs.h:67
@ d0
Definition ParamDefs.h:63
@ z0
Definition ParamDefs.h:64

◆ fillTrkParticleSummary()

StatusCode Trk::BasicValTrkParticleNtupleTool::fillTrkParticleSummary ( const Trk::TrackSummary * summary)
private

fill the perigee in ntuple

Definition at line 274 of file BasicValTrkParticleNtupleTool.cxx.

274 {
275
276 ATH_MSG_VERBOSE ("in fillTrackSummary");
277
278 if (!summary) {
279 ATH_MSG_WARNING("Something is wrong - track has no summary at all!");
282
283 return StatusCode::FAILURE;
284 }
285
286 ATH_MSG_VERBOSE("Fill Summary Parameters now");
287 // summary of the track
299
300 std::bitset<Trk::numberOfDetectorTypes> hitPattern; // all position are set to 0
301 for (int i=0; i<Trk::numberOfDetectorTypes; ++i) {
302 if (summary->isHit(static_cast<Trk::DetectorType>(i))) hitPattern.set(i,1); // set position i to 1
303 }
304 m_idHitPattern = hitPattern.to_ulong();
305
306 ATH_MSG_DEBUG ("Track summary: number of Pixel hit=" << m_numberOfPixelHits << ", number of SCT hits=" << m_numberOfSCTHits );
307
308 return StatusCode::SUCCESS;
309}
DetectorType
enumerates the various detector types currently accessible from the isHit() method.
@ numberOfTRTHoles
number of TRT hits which pass the high threshold (only xenon counted) total number of TRT hits which ...
@ numberOfContribPixelLayers
number of contributing layers of the pixel detector
@ numberOfPixelHits
number of pixel layers on track with absence of hits
@ numberOfTRTHighThresholdHits
total number of TRT hits which pass the high threshold
@ numberOfSCTHoles
number of Holes in both sides of a SCT module
@ numberOfPixelHoles
number of pixels which have a ganged ambiguity.
@ numberOfPixelDeadSensors
number of pixel hits with broad errors (width/sqrt(12))

◆ finalize()

StatusCode Trk::BasicValTrkParticleNtupleTool::finalize ( )

finalize

Definition at line 112 of file BasicValTrkParticleNtupleTool.cxx.

112 {
113
114 ATH_MSG_DEBUG("start finalize() in " << name());
115 if (m_nt) {
116 delete m_nt;
117 m_nt = nullptr;
118 }
119
120 return StatusCode::SUCCESS;
121}

◆ initialize()

StatusCode Trk::BasicValTrkParticleNtupleTool::initialize ( )

Definition at line 81 of file BasicValTrkParticleNtupleTool.cxx.

81 {
82
83 ATH_CHECK( m_evt.initialize() );
84
85 // create ntuple tree
86 if (m_bookNewNtuple) {
87 // ---------------------------
88 // retrieve pointer to THistSvc
89 SmartIF<ITHistSvc> tHistSvc{service("THistSvc")};
90 ATH_CHECK( tHistSvc.isValid() );
91
92 // ---------------------------
93 // create tree and register it to THistSvc
94
95 m_nt = new TTree(TString(m_ntupleTreeName), "Track Particle Validation");
96 // NB: we must not delete the tree, this is done by THistSvc
97
98 std::string fullNtupleName = "/"+m_ntupleFileName+"/"+m_ntupleDirName+"/"+m_ntupleTreeName;
99 ATH_CHECK( tHistSvc->regTree(fullNtupleName, m_nt) );
100
101 // add the ntuple branches (this function has to be called by the client of this tool, if m_bookNewNtuple is set to false...)
103 }
104
106 return StatusCode::SUCCESS;
107}
#define ATH_CHECK
Evaluate an expression and check for errors.
virtual StatusCode addNtupleItems(TTree *tree)
add branches to the tree Should be called once (per track collection and tree) dunring the initialisa...

◆ inputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< AlgTool > >::inputHandles ( ) const
overridevirtualinherited

Return this algorithm's input handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ interfaceID()

const InterfaceID & Trk::IValidationNtupleTool::interfaceID ( )
inlinestaticinherited

Interface ID, declared here, and defined below.

Definition at line 105 of file IValidationNtupleTool.h.

105 {
107}
static const InterfaceID IID_IValidationNtupleTool("IValidationNtupleTool", 1, 0)

◆ msg()

MsgStream & AthCommonMsg< AlgTool >::msg ( ) const
inlineinherited

Definition at line 24 of file AthCommonMsg.h.

24 {
25 return this->msgStream();
26 }

◆ msgLvl()

bool AthCommonMsg< AlgTool >::msgLvl ( const MSG::Level lvl) const
inlineinherited

Definition at line 30 of file AthCommonMsg.h.

30 {
31 return this->msgLevel(lvl);
32 }

◆ outputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< AlgTool > >::outputHandles ( ) const
overridevirtualinherited

Return this algorithm's output handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ renounce()

std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > AthCommonDataStore< AthCommonMsg< AlgTool > >::renounce ( T & h)
inlineprotectedinherited

Definition at line 380 of file AthCommonDataStore.h.

381 {
382 h.renounce();
384 }
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce(T &h)

◆ renounceArray()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::renounceArray ( SG::VarHandleKeyArray & handlesArray)
inlineprotectedinherited

remove all handles from I/O resolution

Definition at line 364 of file AthCommonDataStore.h.

364 {
366 }

◆ resetVariables()

void Trk::BasicValTrkParticleNtupleTool::resetVariables ( )
private

◆ sysInitialize()

virtual StatusCode AthCommonDataStore< AthCommonMsg< AlgTool > >::sysInitialize ( )
overridevirtualinherited

Perform system initialization for an algorithm.

We override this to declare all the elements of handle key arrays at the end of initialization. See comments on updateVHKA.

Reimplemented in asg::AsgMetadataTool, AthCheckedComponent< AthAlgTool >, AthCheckedComponent<::AthAlgTool >, and DerivationFramework::CfAthAlgTool.

◆ sysStart()

virtual StatusCode AthCommonDataStore< AthCommonMsg< AlgTool > >::sysStart ( )
overridevirtualinherited

Handle START transition.

We override this in order to make sure that conditions handle keys can cache a pointer to the conditions container.

◆ updateVHKA()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::updateVHKA ( Gaudi::Details::PropertyBase & )
inlineinherited

Definition at line 308 of file AthCommonDataStore.h.

308 {
309 // debug() << "updateVHKA for property " << p.name() << " " << p.toString()
310 // << " size: " << m_vhka.size() << endmsg;
311 for (auto &a : m_vhka) {
313 for (auto k : keys) {
314 k->setOwner(this);
315 }
316 }
317 }
std::vector< SG::VarHandleKeyArray * > m_vhka

◆ writeRecord()

StatusCode Trk::BasicValTrkParticleNtupleTool::writeRecord ( TTree * tree)
virtual

write the filled data into the ntuple

Implements Trk::IValidationNtupleTool.

Definition at line 329 of file BasicValTrkParticleNtupleTool.cxx.

329 {
330 if (!tree) return StatusCode::FAILURE;
331 ATH_MSG_VERBOSE ("Writting Track Particles into the Tree");
332 tree->Fill();
334 return StatusCode::SUCCESS;
335}

◆ writeTrackData()

StatusCode Trk::BasicValTrkParticleNtupleTool::writeTrackData ( const Trk::Track & ,
const int iterationIndex,
const unsigned int fitStatCode )
virtual

fill AND write ntuple data of a given track

Implements Trk::IValidationNtupleTool.

Definition at line 352 of file BasicValTrkParticleNtupleTool.cxx.

355 {return StatusCode::SUCCESS;}

◆ writeTrackParticleData()

StatusCode Trk::BasicValTrkParticleNtupleTool::writeTrackParticleData ( const Trk::TrackParticleBase & track)
virtual

fill AND write ntuple data of a given track particle

Implements Trk::IValidationNtupleTool.

Definition at line 171 of file BasicValTrkParticleNtupleTool.cxx.

172 {
173 if (!m_nt) {
174 ATH_MSG_ERROR("writeTrackParticleData(...) can only be used, if property BookNewNtuple is set to true" );
175 return StatusCode::FAILURE;
176 }
178
179 ATH_MSG_DEBUG ("in writeTrackParticleData(trk, indx)");
180
181 sc = fillTrackParticleData(track);
182 if (sc.isFailure()) return sc;
183
184 return writeRecord(m_nt);
185}
#define ATH_MSG_ERROR(x)
static Double_t sc
virtual StatusCode fillTrackParticleData(const Trk::TrackParticleBase &)
fill ntuple data of a given track particle without writing the record.
virtual StatusCode writeRecord(TTree *tree)
write the filled data into the ntuple
::StatusCode StatusCode
StatusCode definition for legacy code.

Member Data Documentation

◆ m_bookNewNtuple

bool Trk::BasicValTrkParticleNtupleTool::m_bookNewNtuple
private

jobOption: book new ntuple?

Definition at line 114 of file BasicValTrkParticleNtupleTool.h.

◆ m_chi2

float Trk::BasicValTrkParticleNtupleTool::m_chi2
private

chi sqared of the track fit normalized to DOF

Definition at line 143 of file BasicValTrkParticleNtupleTool.h.

◆ m_detStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< AlgTool > >::m_detStore
privateinherited

Pointer to StoreGate (detector store by default)

Definition at line 393 of file AthCommonDataStore.h.

◆ m_errord0

float Trk::BasicValTrkParticleNtupleTool::m_errord0
private

error on local d0 at perigee UNIT:mm

Definition at line 136 of file BasicValTrkParticleNtupleTool.h.

◆ m_errorphi0

float Trk::BasicValTrkParticleNtupleTool::m_errorphi0
private

error on angle phi at perigee UNIT:rad

Definition at line 138 of file BasicValTrkParticleNtupleTool.h.

◆ m_errorqoverp

float Trk::BasicValTrkParticleNtupleTool::m_errorqoverp
private

error on curvature q/p UNIT:1/MeV

Definition at line 140 of file BasicValTrkParticleNtupleTool.h.

◆ m_errortheta0

float Trk::BasicValTrkParticleNtupleTool::m_errortheta0
private

error on angle theta at perigee UNIT:rad

Definition at line 139 of file BasicValTrkParticleNtupleTool.h.

◆ m_errorz0

float Trk::BasicValTrkParticleNtupleTool::m_errorz0
private

error on local z0 at perigee UNIT:mm

Definition at line 137 of file BasicValTrkParticleNtupleTool.h.

◆ m_eventNumber

int Trk::BasicValTrkParticleNtupleTool::m_eventNumber
private

event number the track belongs to

Definition at line 126 of file BasicValTrkParticleNtupleTool.h.

◆ m_evt

SG::ReadHandleKey<xAOD::EventInfo> Trk::BasicValTrkParticleNtupleTool::m_evt {this, "EvtInfo", "EventInfo", "EventInfo name"}
private

Definition at line 162 of file BasicValTrkParticleNtupleTool.h.

162{this, "EvtInfo", "EventInfo", "EventInfo name"};

◆ m_evtStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< AlgTool > >::m_evtStore
privateinherited

Pointer to StoreGate (event store by default)

Definition at line 390 of file AthCommonDataStore.h.

◆ m_idHitPattern

unsigned long Trk::BasicValTrkParticleNtupleTool::m_idHitPattern
private

bit word carrying information about hit layers

Definition at line 158 of file BasicValTrkParticleNtupleTool.h.

◆ m_lastEventNumber

unsigned int Trk::BasicValTrkParticleNtupleTool::m_lastEventNumber
private

help variable to link with event property tree

Definition at line 122 of file BasicValTrkParticleNtupleTool.h.

◆ m_nt

TTree* Trk::BasicValTrkParticleNtupleTool::m_nt
private

Pointer to the NTuple tree.

Definition at line 119 of file BasicValTrkParticleNtupleTool.h.

◆ m_ntupleDirName

std::string Trk::BasicValTrkParticleNtupleTool::m_ntupleDirName
private

jobOption: Ntuple directory name

Definition at line 116 of file BasicValTrkParticleNtupleTool.h.

◆ m_ntupleFileName

std::string Trk::BasicValTrkParticleNtupleTool::m_ntupleFileName
private

jobOption: Ntuple file name

Definition at line 115 of file BasicValTrkParticleNtupleTool.h.

◆ m_ntupleTreeName

std::string Trk::BasicValTrkParticleNtupleTool::m_ntupleTreeName
private

jobOption: Ntuple tree name

Definition at line 117 of file BasicValTrkParticleNtupleTool.h.

◆ m_numberOfContribPixelLayers

unsigned char Trk::BasicValTrkParticleNtupleTool::m_numberOfContribPixelLayers
private

number of contributing layers of the pixel detector

Definition at line 147 of file BasicValTrkParticleNtupleTool.h.

◆ m_numberOfPixelDeadSensors

unsigned char Trk::BasicValTrkParticleNtupleTool::m_numberOfPixelDeadSensors
private

number of dead pixel sensors crossed

Definition at line 149 of file BasicValTrkParticleNtupleTool.h.

◆ m_numberOfPixelHits

unsigned char Trk::BasicValTrkParticleNtupleTool::m_numberOfPixelHits
private

number of measurements in the Pixels

Definition at line 146 of file BasicValTrkParticleNtupleTool.h.

◆ m_numberOfPixelHoles

unsigned char Trk::BasicValTrkParticleNtupleTool::m_numberOfPixelHoles
private

number of pixel layers on track with absence of hits

Definition at line 148 of file BasicValTrkParticleNtupleTool.h.

◆ m_numberOfSCTDeadSensors

unsigned char Trk::BasicValTrkParticleNtupleTool::m_numberOfSCTDeadSensors
private

number of dead SCT sensors crossed

Definition at line 152 of file BasicValTrkParticleNtupleTool.h.

◆ m_numberOfSCTHits

unsigned char Trk::BasicValTrkParticleNtupleTool::m_numberOfSCTHits
private

number of measurements in the SCT

Definition at line 150 of file BasicValTrkParticleNtupleTool.h.

◆ m_numberOfSCTHoles

unsigned char Trk::BasicValTrkParticleNtupleTool::m_numberOfSCTHoles
private

number of SCT holes

Definition at line 151 of file BasicValTrkParticleNtupleTool.h.

◆ m_numberOfTRTDeadStraws

unsigned char Trk::BasicValTrkParticleNtupleTool::m_numberOfTRTDeadStraws
private

number of dead TRT straws crossed

Definition at line 155 of file BasicValTrkParticleNtupleTool.h.

◆ m_numberOfTRTHighThresholdHits

unsigned char Trk::BasicValTrkParticleNtupleTool::m_numberOfTRTHighThresholdHits
private

number of TRT hits which pass the high threshold

Definition at line 156 of file BasicValTrkParticleNtupleTool.h.

◆ m_numberOfTRTHits

unsigned char Trk::BasicValTrkParticleNtupleTool::m_numberOfTRTHits
private

number of TRT hits

Definition at line 153 of file BasicValTrkParticleNtupleTool.h.

◆ m_numberOfTRTHoles

unsigned char Trk::BasicValTrkParticleNtupleTool::m_numberOfTRTHoles
private

number of TRT holes

Definition at line 154 of file BasicValTrkParticleNtupleTool.h.

◆ m_Rec_d0

float Trk::BasicValTrkParticleNtupleTool::m_Rec_d0
private

reconstructed track params: local d0 at perigee UNIT:mm

Definition at line 130 of file BasicValTrkParticleNtupleTool.h.

◆ m_Rec_eta

float Trk::BasicValTrkParticleNtupleTool::m_Rec_eta
private

reconstructed track params: pseudorapidity UNIT:1

Definition at line 133 of file BasicValTrkParticleNtupleTool.h.

◆ m_Rec_phi0

float Trk::BasicValTrkParticleNtupleTool::m_Rec_phi0
private

reconstructed track params: angle phi at perigee UNIT:rad

Definition at line 132 of file BasicValTrkParticleNtupleTool.h.

◆ m_Rec_qOverP

float Trk::BasicValTrkParticleNtupleTool::m_Rec_qOverP
private

reconstructed track params: curvature q/p UNIT:1/MeV

Definition at line 134 of file BasicValTrkParticleNtupleTool.h.

◆ m_Rec_z0

float Trk::BasicValTrkParticleNtupleTool::m_Rec_z0
private

reconstructed track params: local z0 at perigee UNIT:mm

Definition at line 131 of file BasicValTrkParticleNtupleTool.h.

◆ m_runNumber

int Trk::BasicValTrkParticleNtupleTool::m_runNumber
private

run number the track belongs to

Definition at line 125 of file BasicValTrkParticleNtupleTool.h.

◆ m_TrackID

unsigned char Trk::BasicValTrkParticleNtupleTool::m_TrackID
private

number of the track within the current event

Definition at line 127 of file BasicValTrkParticleNtupleTool.h.

◆ m_TrackIDcounter

int Trk::BasicValTrkParticleNtupleTool::m_TrackIDcounter
private

help variable to link with event property tree

Definition at line 121 of file BasicValTrkParticleNtupleTool.h.

◆ m_varHandleArraysDeclared

bool AthCommonDataStore< AthCommonMsg< AlgTool > >::m_varHandleArraysDeclared
privateinherited

Definition at line 399 of file AthCommonDataStore.h.

◆ m_vhka

std::vector<SG::VarHandleKeyArray*> AthCommonDataStore< AthCommonMsg< AlgTool > >::m_vhka
privateinherited

Definition at line 398 of file AthCommonDataStore.h.

◆ s_errorEntry

const float Trk::BasicValTrkParticleNtupleTool::s_errorEntry = -99999.0
staticprivate

error entry costant

Definition at line 160 of file BasicValTrkParticleNtupleTool.h.


The documentation for this class was generated from the following files: