|
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) {
89 SmartIF<ITHistSvc> tHistSvc{service(
"THistSvc")};
95 m_nt =
new TTree(TString(m_ntupleTreeName),
"Track Particle Validation");
98 std::string fullNtupleName =
"/"+m_ntupleFileName+
"/"+m_ntupleDirName+
"/"+m_ntupleTreeName;
99 ATH_CHECK( tHistSvc->regTree(fullNtupleName, m_nt) );
105 m_TrackIDcounter = 0;
106 return StatusCode::SUCCESS;
120 return StatusCode::SUCCESS;
124 if (!
tree)
return StatusCode::FAILURE;
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");
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");
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");
148 tree->Branch(
"chi2", &m_chi2,
"chi2/F");
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");
163 tree->Branch(
"idHitPattern", &m_idHitPattern,
"idHitPattern/l");
167 return StatusCode::SUCCESS;
174 ATH_MSG_ERROR(
"writeTrackParticleData(...) can only be used, if property BookNewNtuple is set to true" );
175 return StatusCode::FAILURE;
181 sc = fillTrackParticleData(
track);
182 if (
sc.isFailure())
return sc;
184 return writeRecord(m_nt);
196 if (!
evt.isValid()) {
198 m_runNumber = (
int)s_errorEntry;
199 m_eventNumber = (
int)s_errorEntry;
200 return StatusCode::FAILURE;
203 if (m_lastEventNumber!=
evt->eventNumber()) {
205 m_TrackIDcounter = 0;
206 m_lastEventNumber =
evt->eventNumber();
209 m_TrackID = (
unsigned char)m_TrackIDcounter;
210 m_eventNumber =
evt->eventNumber();
211 m_runNumber =
evt->runNumber();
213 ATH_MSG_VERBOSE (
"Event: " << m_eventNumber <<
", Run: "<< m_runNumber <<
" TrackID: " << m_TrackID);
218 if (perpars !=
nullptr && fillTrkParticlePerigee(perpars).isFailure())
ATH_MSG_WARNING(
"Perigee parameters could not be written to ntuple");
226 return StatusCode::SUCCESS;
244 return StatusCode::FAILURE;
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();
255 if (perigee->covariance()) {
266 ATH_MSG_DEBUG (
"Trackparameters: d0=" << m_Rec_d0 <<
", z0=" << m_Rec_z0 <<
", phi0=" << m_Rec_phi0 <<
", eta=" << m_Rec_eta);
268 return StatusCode::SUCCESS;
280 m_numberOfPixelHits = 0;
281 m_numberOfSCTHits = 0;
283 return StatusCode::FAILURE;
300 std::bitset<Trk::numberOfDetectorTypes> hitPattern;
304 m_idHitPattern = hitPattern.to_ulong();
306 ATH_MSG_DEBUG (
"Track summary: number of Pixel hit=" << m_numberOfPixelHits <<
", number of SCT hits=" << m_numberOfSCTHits );
308 return StatusCode::SUCCESS;
313 ATH_MSG_WARNING(
"Something is wrong - track has no fit quality data !!");
316 return StatusCode::FAILURE;
321 return StatusCode::FAILURE;
326 return StatusCode::SUCCESS;
330 if (!
tree)
return StatusCode::FAILURE;
334 return StatusCode::SUCCESS;
338 m_numberOfPixelHits=0;
339 m_numberOfContribPixelLayers=0;
340 m_numberOfPixelHoles=0;
341 m_numberOfPixelDeadSensors=0;
343 m_numberOfSCTHoles=0;
344 m_numberOfSCTDeadSensors=0;
346 m_numberOfTRTHoles=0;
347 m_numberOfTRTDeadStraws=0;
348 m_numberOfTRTHighThresholdHits=0;
355 const unsigned int ) {
return StatusCode::SUCCESS;}
362 const unsigned int ) {
return StatusCode::SUCCESS;}
368 const int ) {
return StatusCode::SUCCESS;}
389 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.