![Logo](../../ATLAS-Logo-Square-Blue-RGB.png) |
ATLAS Offline Software
|
Go to the documentation of this file.
16 #include "GaudiKernel/ITHistSvc.h"
52 m_numberOfPixelHits{},
53 m_numberOfContribPixelLayers{},
54 m_numberOfPixelHoles{},
55 m_numberOfPixelDeadSensors{},
58 m_numberOfSCTDeadSensors{},
61 m_numberOfTRTDeadStraws{},
62 m_numberOfTRTHighThresholdHits{},
66 declareInterface<IValidationNtupleTool>(
this);
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");
86 if (m_bookNewNtuple) {
99 m_nt =
new TTree(TString(m_ntupleTreeName),
"Track Particle Validation");
102 std::string fullNtupleName =
"/"+m_ntupleFileName+
"/"+m_ntupleDirName+
"/"+m_ntupleTreeName;
103 sc = tHistSvc->regTree(fullNtupleName, m_nt);
104 if (
sc.isFailure()) {
105 ATH_MSG_ERROR(
"Unable to register TTree : " << fullNtupleName);
112 m_TrackIDcounter = 0;
113 return StatusCode::SUCCESS;
127 return StatusCode::SUCCESS;
131 if (!
tree)
return StatusCode::FAILURE;
136 tree->Branch(
"RunNumber", &m_runNumber,
"run_number/I");
137 tree->Branch(
"EventNumber", &m_eventNumber,
"event_number/I");
138 tree->Branch(
"TrackID", &m_TrackID,
"ID_of_track_in_event/b");
141 tree->Branch(
"RecD0", &m_Rec_d0,
"Reconstructed_d0/F");
142 tree->Branch(
"RecZ0", &m_Rec_z0,
"Reconstructed_z0/F");
143 tree->Branch(
"RecPhi0", &m_Rec_phi0,
"Reconstructed_phi0/F");
144 tree->Branch(
"RecEta", &m_Rec_eta,
"Reconstructed_eta/F");
145 tree->Branch(
"RecQoverP", &m_Rec_qOverP,
"Reconstructed_Q_over_p/F");
148 tree->Branch(
"RecErrD0", &m_errord0,
"err_d0/F");
149 tree->Branch(
"RecErrZ0", &m_errorz0,
"err_z0/F");
150 tree->Branch(
"RecErrPhi0", &m_errorphi0,
"err_phi0/F");
151 tree->Branch(
"RecErrTheta", &m_errortheta0,
"err_theta/F");
152 tree->Branch(
"RecErrQoverP", &m_errorqoverp,
"err_Q_over_p/F");
155 tree->Branch(
"chi2", &m_chi2,
"chi2/F");
158 tree->Branch(
"nPixelHits", &m_numberOfPixelHits,
"numberOfPixelHits/b");
159 tree->Branch(
"nContribPixelLayers", &m_numberOfContribPixelLayers,
"numberOfContribPixelLayers/b");
160 tree->Branch(
"nPixelHoles", &m_numberOfPixelHoles,
"numberOfPixelHoles/b");
161 tree->Branch(
"nPixelDeadSensors", &m_numberOfPixelDeadSensors,
"numberOfPixelDeadSensors/b");
162 tree->Branch(
"nSCTHits", &m_numberOfSCTHits,
"numberOfSCTHits/b");
163 tree->Branch(
"nSCTHoles", &m_numberOfSCTHoles,
"numberOfSCTHoles/b");
164 tree->Branch(
"nSCTDeadSensors" , &m_numberOfSCTDeadSensors,
"numberOfSCTDeadSensors/b");
165 tree->Branch(
"nTRTHits" , &m_numberOfTRTHits,
"numberOfTRTHits/b");
166 tree->Branch(
"nTRTHoles", &m_numberOfTRTHoles,
"numberOfTRTHoles/b");
167 tree->Branch(
"nTRTDeadStraws", &m_numberOfTRTDeadStraws,
"numberOfTRTDeadStraws/b");
168 tree->Branch(
"nTRTHighThresholdHits", &m_numberOfTRTHighThresholdHits,
"numberOfTRTHighThresholdHits/b");
170 tree->Branch(
"idHitPattern", &m_idHitPattern,
"idHitPattern/l");
174 return StatusCode::SUCCESS;
181 ATH_MSG_ERROR(
"writeTrackParticleData(...) can only be used, if property BookNewNtuple is set to true" );
182 return StatusCode::FAILURE;
188 sc = fillTrackParticleData(
track);
189 if (
sc.isFailure())
return sc;
191 return writeRecord(m_nt);
203 if (!
evt.isValid()) {
205 m_runNumber = (
int)s_errorEntry;
206 m_eventNumber = (
int)s_errorEntry;
207 return StatusCode::FAILURE;
210 if (m_lastEventNumber!=
evt->eventNumber()) {
212 m_TrackIDcounter = 0;
213 m_lastEventNumber =
evt->eventNumber();
216 m_TrackID = (
unsigned char)m_TrackIDcounter;
217 m_eventNumber =
evt->eventNumber();
218 m_runNumber =
evt->runNumber();
220 ATH_MSG_VERBOSE (
"Event: " << m_eventNumber <<
", Run: "<< m_runNumber <<
" TrackID: " << m_TrackID);
225 if (perpars !=
nullptr && fillTrkParticlePerigee(perpars).isFailure())
ATH_MSG_WARNING(
"Perigee parameters could not be written to ntuple");
233 return StatusCode::SUCCESS;
251 return StatusCode::FAILURE;
256 m_Rec_d0 = perigee->parameters()[
Trk::d0];
257 m_Rec_z0 = perigee->parameters()[
Trk::z0];
258 m_Rec_phi0 = perigee->parameters()[
Trk::phi0];
259 m_Rec_eta = perigee->eta();
262 if (perigee->covariance()) {
273 ATH_MSG_DEBUG (
"Trackparameters: d0=" << m_Rec_d0 <<
", z0=" << m_Rec_z0 <<
", phi0=" << m_Rec_phi0 <<
", eta=" << m_Rec_eta);
275 return StatusCode::SUCCESS;
287 m_numberOfPixelHits = 0;
288 m_numberOfSCTHits = 0;
290 return StatusCode::FAILURE;
307 std::bitset<Trk::numberOfDetectorTypes> hitPattern;
311 m_idHitPattern = hitPattern.to_ulong();
313 ATH_MSG_DEBUG (
"Track summary: number of Pixel hit=" << m_numberOfPixelHits <<
", number of SCT hits=" << m_numberOfSCTHits );
315 return StatusCode::SUCCESS;
320 ATH_MSG_WARNING(
"Something is wrong - track has no fit quality data !!");
323 return StatusCode::FAILURE;
328 return StatusCode::FAILURE;
333 return StatusCode::SUCCESS;
337 if (!
tree)
return StatusCode::FAILURE;
341 return StatusCode::SUCCESS;
345 m_numberOfPixelHits=0;
346 m_numberOfContribPixelLayers=0;
347 m_numberOfPixelHoles=0;
348 m_numberOfPixelDeadSensors=0;
350 m_numberOfSCTHoles=0;
351 m_numberOfSCTDeadSensors=0;
353 m_numberOfTRTHoles=0;
354 m_numberOfTRTDeadStraws=0;
355 m_numberOfTRTHighThresholdHits=0;
362 const unsigned int ) {
return StatusCode::SUCCESS;}
369 const unsigned int ) {
return StatusCode::SUCCESS;}
375 const int ) {
return StatusCode::SUCCESS;}
396 const int) {
return StatusCode::SUCCESS;}
@ numberOfPixelHits
number of pixel layers on track with absence of hits
@ numberOfContribPixelLayers
number of contributing layers of the pixel detector
virtual StatusCode writeRecord(TTree *tree)
write the filled data into the ntuple
virtual StatusCode writeTrackParticleData(const Trk::TrackParticleBase &)
fill AND write ntuple data of a given track particle
@ numberOfTRTHighThresholdHits
total number of TRT hits which pass the high threshold
static const float s_errorEntry
error entry costant
~BasicValTrkParticleNtupleTool()
virtual StatusCode fillMeasurementData(const Trk::MeasurementBase *, const Trk::TrackParameters *)
fill ntuple data of given measurement and track parameters without writing the record
virtual StatusCode fillTrackParameter(const Trk::TrackParameters *, const int iterationIndex)
fill ntuple data of a given track without writing the record.
@ numberOfSCTDeadSensors
number of TRT hits
Dummy class used to allow special convertors to be called for surfaces owned by a detector element.
StatusCode fillTrkParticleSummary(const Trk::TrackSummary *summary)
fill the perigee in ntuple
StatusCode finalize()
finalize
virtual StatusCode fillHoleData(const Trk::TrackStateOnSurface &)
fill ntuple data of holes on track without writing the record
#define ATH_MSG_VERBOSE(x)
@ numberOfSCTHoles
number of Holes in both sides of a SCT module
@ numberOfTRTHoles
number of TRT hits which pass the high threshold (only xenon counted) total number of TRT hits which ...
@ numberOfTRTDeadStraws
number of TRT tube hits
BasicValTrkParticleNtupleTool(const std::string &, const std::string &, const IInterface *)
virtual StatusCode fillTrackTruthData(const TrackParameters *&, const TrackTruth &, const int truthIndex=-1)
fill ntuple data of holes on track without writing the record
::StatusCode StatusCode
StatusCode definition for legacy code.
@ numberOfSCTHits
number of SCT holes
@ numberOfPixelDeadSensors
number of pixel hits with broad errors (width/sqrt(12))
Class to represent and store fit qualities from track reconstruction in terms of and number of degre...
int numberDoF() const
returns the number of degrees of freedom of the overall track or vertex fit as integer
@ numberOfPixelHoles
number of pixels which have a ganged ambiguity.
virtual StatusCode fillTrackData(const Trk::Track &, const int iterationIndex, const unsigned int fitStatCode)
fill ntuple data of a given track without writing the record.
@ numberOfTRTHits
number of TRT outliers
represents the track state (measurement, material, fit parameters and quality) at a surface.
A summary of the information contained by a track.
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 ...
FitQualityOnSurface fitQuality(const MultiComponentState &, const MeasurementBase &)
Method for determining the chi2 of the multi-component state and the number of degrees of freedom.
DetectorType
enumerates the various detector types currently accessible from the isHit() method.
virtual StatusCode fillOutlierData(const Trk::MeasurementBase *, const Trk::TrackParameters *, const Trk::FitQualityOnSurface *)
fill ntuple data of an outlier measurement (without writing the record yet).
MC particle associated with a reco track + the quality of match.
#define ATH_MSG_WARNING(x)
virtual StatusCode addNtupleItems(TTree *tree)
add branches to the tree Should be called once (per track collection and tree) dunring the initialisa...
StatusCode fillFitQualityData(const Trk::FitQuality *fitQuality)
StatusCode fillTrkParticlePerigee(const Trk::Perigee *perigee)
fill the perigee in ntuple
double chiSquared() const
returns the of the overall track fit
virtual StatusCode writeTrackData(const Trk::Track &, const int iterationIndex, const unsigned int fitStatCode)
fill AND write ntuple data of a given track
virtual StatusCode fillTrackParticleData(const Trk::TrackParticleBase &)
fill ntuple data of a given track particle without writing the record.