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

#include <AlignAlg.h>

Inheritance diagram for Trk::AlignAlg:
Collaboration diagram for Trk::AlignAlg:

Public Member Functions

virtual ~AlignAlg ()
 destructor
virtual StatusCode initialize ()
 initialize method
virtual StatusCode start ()
 set up geometry and prepare the tools
virtual StatusCode execute (const EventContext &ctx)
 loops over tracks in event, and accumulates information necessary for alignmnet
virtual StatusCode stop ()
 processes information accumulated in execute method to determine alignment parameters
virtual StatusCode finalize ()
 finalize method
void showStatistics ()
 dumps statistics accumulated in each event
 AthAlgorithm (const std::string &name, ISvcLocator *pSvcLocator)
 constructor
virtual StatusCode sysInitialize () override
 Override sysInitialize.
virtual bool isClonable () const override
 Specify if the algorithm is clonable.
virtual StatusCode sysExecute (const EventContext &ctx) override
 Execute an algorithm.
virtual const DataObjIDColl & extraOutputDeps () const override
 Return the list of extra output dependencies.
virtual bool filterPassed (const EventContext &ctx) const
 Get filter decision:
virtual void setFilterPassed (bool state, const EventContext &ctx) const
 Set filter decision:
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 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

Protected Member Functions

virtual bool isReEntrant () const override final
 Legacy algorithms are not thread-safe.
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

Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey>

Private Attributes

ToolHandle< ITrackCollectionProviderm_trackCollectionProvider
ToolHandle< IAlignTrackPreProcessorm_alignTrackPreProcessor
 Pointer to AlignTrackPreProcessor, used to select hits on tracks and/or tracks before passing to AlignTrackCreator.
ToolHandle< IAlignTrackCreatorm_alignTrackCreator
 Pointer to alignTrackCreator, used to convert Trk::Track to vector of AlignTrack.
ToolHandle< IAlignTrackDresserm_alignTrackDresser
 Pointer to alignTrackDresser, used to add residuals, derivatives, etc.
ToolHandle< IAlignToolm_alignTool
 Pointer to alignTool.
PublicToolHandle< IGeometryManagerToolm_geometryManagerTool
 Pointer to GeometryManagerTool, used to get lists of chambers for which alignment parameters will be determined.
ToolHandle< ITrkAlignDBToolm_trkAlignDBTool
 Pointer to TrkAlignDBTool, used for reading/writing alignment parameters from/to the database.
ToolHandle< IFillNtupleToolm_fillNtupleTool
 Pointer to FillNtupleTool, used to write track information to ntuple.
StringProperty m_filename {this, "FileName", "Align.root", "name of ntuple file"}
StringProperty m_filepath {this, "FilePath", "./", "path to ntuple file"}
BooleanProperty m_solveOnly
BooleanProperty m_writeNtuple
IntegerProperty m_alignSolveLevel
TFile * m_ntuple = nullptr
 output ntuple
BooleanProperty m_writeLogfile
StringProperty m_logfileName
std::ostream * m_logStream = nullptr
 logfile output stream
int m_nevents = 0
 number of processed events
int m_ntracks = 0
 number of processed tracks
int m_ntracksSel = 0
 number of selected tracks
int m_ntracksProc = 0
 number of tracks successfully processed
int m_ntracksDress = 0
 number of tracks successfully dressed
int m_ntracksAccum = 0
 number of tracks successfully accumulated
StringProperty m_alignTracksName
DataObjIDColl m_extendedExtraObjects
 Extra output dependency collection, extended by AthAlgorithmDHUpdate to add symlinks.
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

Detailed Description

Definition at line 40 of file AlignAlg.h.

Member Typedef Documentation

◆ StoreGateSvc_t

typedef ServiceHandle<StoreGateSvc> AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::StoreGateSvc_t
privateinherited

Definition at line 388 of file AthCommonDataStore.h.

Constructor & Destructor Documentation

◆ ~AlignAlg()

AlignAlg::~AlignAlg ( )
virtual

destructor

Definition at line 17 of file AlignAlg.cxx.

18{
19
20 if (m_ntuple && m_solveOnly) {
21 ATH_MSG_DEBUG("closing file");
22 m_ntuple->Close();
23 ATH_MSG_DEBUG("file closed");
24 }
25}
#define ATH_MSG_DEBUG(x)
BooleanProperty m_solveOnly
Definition AlignAlg.h:112
TFile * m_ntuple
output ntuple
Definition AlignAlg.h:120

Member Function Documentation

◆ AthAlgorithm()

AthAlgorithm::AthAlgorithm ( const std::string & name,
ISvcLocator * pSvcLocator )

constructor

Definition at line 31 of file AthAlgorithm.cxx.

11 :
12 AthCommonAlgorithm<Gaudi::Algorithm>( name, pSvcLocator )
13{
14 // default cardinality for non-reentrant algorithms
15 setProperty( "Cardinality", 1 ).orThrow("Unable to set property 'Cardinality'", name);
16}
void setProperty(columnar::PythonToolHandle &self, const std::string &key, nb::object value)
AthCommonAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)

◆ declareGaudiProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::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 }
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)

◆ declareProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::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< Gaudi::Algorithm > >::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< Gaudi::Algorithm > >::evtStore ( )
inlineinherited

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

Definition at line 85 of file AthCommonDataStore.h.

◆ execute()

StatusCode AlignAlg::execute ( const EventContext & ctx)
virtual

loops over tracks in event, and accumulates information necessary for alignmnet

Implements AthAlgorithm.

Definition at line 181 of file AlignAlg.cxx.

182{
183 ATH_MSG_DEBUG("AlignAlg::execute()");
184
185
186 // increment number of events
187 m_nevents++;
188
189 if(m_solveOnly) {
190 if (m_nevents<=1)
191 return StatusCode::SUCCESS;
192 else {
193 // return FAILURE to make sure that the job ends after 1st event
194 msg(MSG::INFO)<<"Only doing the solving. Aborting event processing after first event."<<endmsg;
195 msg(MSG::INFO)<<"Following ERROR message is not a problem..."<<endmsg;
196 return StatusCode::FAILURE;
197 }
198 }
199
200
202 // 1. apply event selection, select hits, refit tracks
204 // m_trackSelector->cleanTracks();
205
206 // loop over tracks
207 TrackCollection * alignTracks;
208 const TrackCollection* originalTracks;
209
210 StatusCode sc = m_trackCollectionProvider->trackCollection(originalTracks);
211 if (!originalTracks || sc.isFailure()) return sc;
212
213 if(originalTracks->empty()) {
214 ATH_MSG_DEBUG("found no tracks");
215 return StatusCode::SUCCESS;
216 }
217
218 // increment number of processed tracks
219 m_ntracks += originalTracks->size();
220 ATH_MSG_DEBUG("nTracks: "<<m_ntracks);
221
222 // process track collection and create collection of AlignTracks
223 alignTracks = m_alignTrackPreProcessor->processTrackCollection(originalTracks);
224
225 // method returns zero or empty collection
226 if (!alignTracks || alignTracks->empty()) {
227 ATH_MSG_DEBUG("processTrackCollection() returned empty Track collection.");
228 return StatusCode::SUCCESS;
229 }
230
231 // increment number of selected tracks
232 m_ntracksSel += alignTracks->size();
233
234 // loop over AlignTracks and pass to AlignTrackCreator and Dresser for more processing
235 int itrk = 0;
236 for (Track* trk : *alignTracks) { // first loop over AlignTracks
237
238 ATH_MSG_DEBUG("1st loop: Processing track "<<itrk);
239
240 // each track in the collection HAS to be an AlignTrack
241 AlignTrack * alignTrack = dynamic_cast<AlignTrack*>(trk);
242 if(!alignTrack) {
243 msg(MSG::FATAL)<<"Track is not an AlignTrack. PreProcessor returns TrackCollection but"
244 <<"it has to be filled with AlignTracks. Otherwise the code doesn't work."<<endmsg;
245 return StatusCode::FAILURE;
246 }
247
248 // process AlignTrack
249 bool success = m_alignTrackCreator->processAlignTrack(alignTrack);
250 if (!success) {
251 ATH_MSG_DEBUG("processAlignTrack() returned FALSE, Skipping the track.");
252 continue;
253 }
254
256
257 // dress AlignTrack with extra info
258 success = m_alignTrackDresser->dressAlignTrack(alignTrack);
259 ATH_MSG_DEBUG("back from dressing AlignTrack");
260
261 if (!success) {
262 ATH_MSG_DEBUG("dressAlignTrack() returned FALSE, Skipping the track.");
263 continue;
264 }
265
267
268 // accumulate vertex fit information:
269 m_alignTrackPreProcessor->accumulateVTX(alignTrack);
270
271 ATH_MSG_DEBUG("back from accumulateVTX");
272
273 } // end of the first loop over AlignTracks
274
275
276 // solve existing vertices:
277 m_alignTrackPreProcessor->solveVTX();
278
279
280 for (Track* trk : *alignTracks) { // second loop over AlignTracks
281
282 ATH_MSG_DEBUG("2nd loop: Processing tracks");
283
284 // each track in the collection HAS to be an AlignTrack
285 AlignTrack * alignTrack = dynamic_cast<AlignTrack*>(trk);
286 if(!alignTrack) {
287 msg(MSG::FATAL)<<"Track is not an AlignTrack. PreProcessor returns TrackCollection but"
288 <<"it has to be filled with AlignTracks. Otherwise the code doesn't work."<<endmsg;
289 return StatusCode::FAILURE;
290 }
291
292
293 // check if the dressing was successful:
294 const Amg::SymMatrixX * ptrWeights = alignTrack->weightMatrix(); //Symmetric Matrix
295 if ( !ptrWeights ) {
296 ATH_MSG_DEBUG("dressAlignTrack failed, Skipping the track.");
297 continue;
298 }
299
300 // check if the eventual VTX solving was successful:
301 const AlignVertex * ptrVertex = alignTrack->getVtx();
302 if ( ptrVertex && (ptrVertex->type() < AlignVertex::Refitted) ) {
303 ATH_MSG_DEBUG("Vertex fit failed for this track. Skipping the track.");
304 continue;
305 }
306
307
308 // pass to AlignTool for processing of track information
309 bool success = m_alignTool->accumulate(alignTrack);
310 ATH_MSG_DEBUG("back from accumulate");
311
312 if (!success) {
313 ATH_MSG_DEBUG("accumulate() returned FALSE, Skipping the track.");
314 continue;
315 }
316
317 ATH_MSG_DEBUG("calling fillntuple::dumptrack");
318
320
321 if (m_writeNtuple)
322 m_fillNtupleTool->dumpTrack(ctx, itrk,alignTrack);
323 ATH_MSG_DEBUG("done with track "<<itrk);
324
325 } // end of the second loop over AlignTracks
326
327
328
329
330 // record the collection in the StoreGate
331 // the ownership is transferred to StoreGate so we don't delete the collection here
332 if(evtStore()->record(alignTracks,m_alignTracksName,false).isFailure()) {
333 ATH_MSG_ERROR("Unable to record "<<m_alignTracksName<<" in the StoreGate");
334 delete alignTracks;
335 alignTracks = nullptr;
336 }
337 if (alignTracks) ATH_MSG_DEBUG("Recorded \'"<<m_alignTracksName<<"\' with size "<<alignTracks->size()<<" to StoreGate");
338
339 ATH_MSG_DEBUG("returning SUCCESS");
340 return StatusCode::SUCCESS;
341}
#define endmsg
#define ATH_MSG_ERROR(x)
static Double_t sc
DataVector< Trk::Track > TrackCollection
This typedef represents a collection of Trk::Track objects.
ServiceHandle< StoreGateSvc > & evtStore()
size_type size() const noexcept
Returns the number of elements in the collection.
bool empty() const noexcept
Returns true if the collection is empty.
ToolHandle< ITrackCollectionProvider > m_trackCollectionProvider
Definition AlignAlg.h:70
StringProperty m_alignTracksName
Definition AlignAlg.h:134
int m_ntracksProc
number of tracks successfully processed
Definition AlignAlg.h:130
ToolHandle< IAlignTool > m_alignTool
Pointer to alignTool.
Definition AlignAlg.h:90
int m_ntracksAccum
number of tracks successfully accumulated
Definition AlignAlg.h:132
int m_nevents
number of processed events
Definition AlignAlg.h:127
int m_ntracksSel
number of selected tracks
Definition AlignAlg.h:129
BooleanProperty m_writeNtuple
Definition AlignAlg.h:114
int m_ntracks
number of processed tracks
Definition AlignAlg.h:128
ToolHandle< IAlignTrackPreProcessor > m_alignTrackPreProcessor
Pointer to AlignTrackPreProcessor, used to select hits on tracks and/or tracks before passing to Alig...
Definition AlignAlg.h:75
ToolHandle< IAlignTrackDresser > m_alignTrackDresser
Pointer to alignTrackDresser, used to add residuals, derivatives, etc.
Definition AlignAlg.h:85
ToolHandle< IFillNtupleTool > m_fillNtupleTool
Pointer to FillNtupleTool, used to write track information to ntuple.
Definition AlignAlg.h:104
int m_ntracksDress
number of tracks successfully dressed
Definition AlignAlg.h:131
ToolHandle< IAlignTrackCreator > m_alignTrackCreator
Pointer to alignTrackCreator, used to convert Trk::Track to vector of AlignTrack.
Definition AlignAlg.h:80
@ Refitted
normally refitted, without adding any pseudo-measurement
Definition AlignVertex.h:46
Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic > SymMatrixX
::StatusCode StatusCode
StatusCode definition for legacy code.

◆ extraDeps_update_handler()

void AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::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

◆ extraOutputDeps()

const DataObjIDColl & AthCommonAlgorithm< Gaudi::Algorithm >::extraOutputDeps ( ) const
overridevirtualinherited

Return the list of extra output dependencies.

This list is extended to include symlinks implied by inheritance relations.

Definition at line 89 of file AthCommonAlgorithm.cxx.

54{
55 // If we didn't find any symlinks to add, just return the collection
56 // from the base class. Otherwise, return the extended collection.
57 if (!m_extendedExtraObjects.empty()) {
59 }
61}
Common base class for algorithms.

◆ filterPassed()

virtual bool AthCommonAlgorithm< Gaudi::Algorithm >::filterPassed ( const EventContext & ctx) const
inlinevirtualinherited

Get filter decision:

Definition at line 93 of file AthCommonAlgorithm.h.

93 {
94 return execState( ctx ).filterPassed();
95 }
virtual bool filterPassed(const EventContext &ctx) const
Get filter decision:

◆ finalize()

StatusCode AlignAlg::finalize ( )
virtual

finalize method

Definition at line 416 of file AlignAlg.cxx.

417{
418 ATH_MSG_INFO("AlignAlg::finalize()");
419
420 // close the logfile
421 if(m_writeLogfile) {
422 if(std::ofstream * ofs = dynamic_cast<std::ofstream *>(m_logStream)) {
423 if(ofs->is_open()) {
424 *ofs<<std::flush;
425 ofs->close();
426 }
427 delete m_logStream;
428 }
429 }
430
431 if (m_writeNtuple) {
432 ATH_MSG_INFO("closing "<<m_ntuple->GetName());
433 m_ntuple->Close();
434 }
435
436 return StatusCode::SUCCESS;
437}
#define ATH_MSG_INFO(x)
std::ostream * m_logStream
logfile output stream
Definition AlignAlg.h:125
BooleanProperty m_writeLogfile
Definition AlignAlg.h:121

◆ initialize()

StatusCode AlignAlg::initialize ( )
virtual

initialize method

Definition at line 28 of file AlignAlg.cxx.

29{
30 ATH_MSG_INFO("AlignAlg::initialize()");
31
32 // Get GeometryManagerTool
33 if ( m_geometryManagerTool.retrieve().isFailure() ) {
34 msg(MSG::FATAL)<<"Failed to retrieve tool " << m_geometryManagerTool
35 << endmsg;
36 return StatusCode::FAILURE;
37 }
38 else
39 ATH_MSG_INFO("Retrieved tool " << m_geometryManagerTool);
40
41 // some tools are not needed if only solving is done
42 if ( !m_solveOnly ) {
43
44 // get TrackCollectionProvider
45 if (m_trackCollectionProvider.retrieve().isSuccess())
47 else{
48 msg(MSG::FATAL) << "Could not get " << m_trackCollectionProvider << endmsg;
49 return StatusCode::FAILURE;
50 }
51
52 // get AlignTrackPreProcessor
53 if (m_alignTrackPreProcessor.retrieve().isSuccess())
55 else{
56 msg(MSG::FATAL) << "Could not get " << m_alignTrackPreProcessor << endmsg;
57 return StatusCode::FAILURE;
58 }
59
60 // Get AlignTrackCreator tool
61 if ( m_alignTrackCreator.retrieve().isFailure() ) {
62 msg(MSG::FATAL)<<"Failed to retrieve tool "<<m_alignTrackCreator<<endmsg;
63 return StatusCode::FAILURE;
64 }
65 else
66 ATH_MSG_INFO("Retrieved tool "<<m_alignTrackCreator);
67
68 // Get AlignTrackDresser tool
69 if ( m_alignTrackDresser.retrieve().isFailure() ) {
70 msg(MSG::FATAL)<<"Failed to retrieve tool "<<m_alignTrackDresser<<endmsg;
71 return StatusCode::FAILURE;
72 }
73 else
74 ATH_MSG_INFO("Retrieved tool "<<m_alignTrackDresser);
75
76 // Get TrkAlign::FillTrack
77 if (m_writeNtuple) {
78 if ( m_fillNtupleTool.retrieve().isFailure() ) {
79 msg(MSG::FATAL)<<"Failed to retrieve tool "<<m_fillNtupleTool<<endmsg;
80 return StatusCode::FAILURE;
81 }
82 else
83 ATH_MSG_INFO("Retrieved tool "<<m_fillNtupleTool);
84 }
85 }
86
87 // Get AlignTool tool
88 if ( m_alignTool.retrieve().isFailure() ) {
89 msg(MSG::FATAL)<<"Failed to retrieve tool "<<m_alignTool<<endmsg;
90 return StatusCode::FAILURE;
91 }
92 else
93 ATH_MSG_INFO("Retrieved tool "<<m_alignTool);
94
95 // Get TrkAlignDataBaseTool
96 if ( m_trkAlignDBTool.retrieve().isFailure() ) {
97 msg(MSG::FATAL)<<"Failed to retrieve tool "<<m_trkAlignDBTool<<endmsg;
98 return StatusCode::FAILURE;
99 }
100 else
101 ATH_MSG_INFO("Retrieved tool "<<m_trkAlignDBTool);
102
103 // Alignment Level
104 // Number of layers in the superstructures
106 msg(MSG::FATAL)<<"AlignSolveLevel could be 1, 2 or 3"<<endmsg;
107 return StatusCode::FAILURE;
108 }
109
110 // open logfile
111 if(m_writeLogfile) {
112 std::ostream * out = &std::cout;
113 std::ofstream * ofile = new std::ofstream(m_logfileName.value().c_str());
114 if(!ofile->is_open()) {
115 msg(MSG::ERROR)<<"Couldn't open logfile. Writing to standard output."<<endmsg;
116 delete ofile;
117 }
118 else
119 out = ofile;
120
122
123 // set logStream in the tools
124 m_geometryManagerTool->setLogStream(m_logStream);
125 m_alignTool->setLogStream(m_logStream);
126 m_trkAlignDBTool->setLogStream(m_logStream);
127 if( !m_solveOnly ) {
130 m_alignTrackCreator->setLogStream(m_logStream);
131 m_alignTrackDresser->setLogStream(m_logStream);
132 if (m_writeNtuple)
133 m_fillNtupleTool->setLogStream(m_logStream);
134 }
135 }
136
137 return StatusCode::SUCCESS;
138}
StringProperty m_logfileName
Definition AlignAlg.h:123
PublicToolHandle< IGeometryManagerTool > m_geometryManagerTool
Pointer to GeometryManagerTool, used to get lists of chambers for which alignment parameters will be ...
Definition AlignAlg.h:95
ToolHandle< ITrkAlignDBTool > m_trkAlignDBTool
Pointer to TrkAlignDBTool, used for reading/writing alignment parameters from/to the database.
Definition AlignAlg.h:100
IntegerProperty m_alignSolveLevel
Definition AlignAlg.h:117

◆ inputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::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.

◆ isClonable()

virtual bool AthCommonAlgorithm< Gaudi::Algorithm >::isClonable ( ) const
inlineoverridevirtualinherited

Specify if the algorithm is clonable.

Only relevant for non-reentrant algorithms. Actual number of clones needs to be set via the "Cardinality" property.

Reimplemented in AFP_DigiTop, AlgB, AlgT, BCM_Digitization, CscDigitBuilder, CscDigitToCscRDO, G4AtlasAlg, G4RunAlg, HGTD_Digitization, HiveAlgBase, InDet::GNNSeedingTrackMaker, InDet::SCT_Clusterization, InDet::SiSPGNNTrackMaker, InDet::SiSPSeededTrackFinder, InDet::SiTrackerSpacePointFinder, ISF::SimKernelMT, ITk::StripDigitization, ITkPixelCablingAlg, ITkStripCablingAlg, LArHitEMapMaker, LArTTL1Maker, LUCID_DigiTop, LVL1::L1TopoSimulation, MergeCalibHits, MergeGenericMuonSimHitColl, MergeHijingPars, MergeMcEventCollection, MergeTrackRecordCollection, MergeTruthJets, MergeTruthParticles, MuonDigitizer, PileUpMTAlg, PixelDigitization, RoIBResultToxAOD, SCT_ByteStreamErrorsTestAlg, SCT_CablingCondAlgFromCoraCool, SCT_CablingCondAlgFromText, SCT_ConditionsParameterTestAlg, SCT_ConditionsSummaryTestAlg, SCT_ConfigurationConditionsTestAlg, SCT_Digitization, SCT_FlaggedConditionTestAlg, SCT_LinkMaskingTestAlg, SCT_MajorityConditionsTestAlg, SCT_ModuleVetoTestAlg, SCT_MonitorConditionsTestAlg, SCT_PrepDataToxAOD, SCT_RawDataToxAOD, SCT_ReadCalibChipDataTestAlg, SCT_ReadCalibDataTestAlg, SCT_RODVetoTestAlg, SCT_SensorsTestAlg, SCT_SiliconConditionsTestAlg, SCT_StripVetoTestAlg, SCT_TdaqEnabledTestAlg, SCT_TestCablingAlg, SCTEventFlagWriter, SCTRawDataProvider, SCTSiLorentzAngleTestAlg, SCTSiPropertiesTestAlg, SGInputLoader, Simulation::BeamEffectsAlg, TileHitVecToCnt, TileMuonFitter, TilePulseForTileMuonReceiver, TileRawChannelMaker, TRTDigitization, and ZDC_DigiTop.

Definition at line 68 of file AthCommonAlgorithm.h.

68 {
69 return true;
70 }

◆ isReEntrant()

virtual bool AthAlgorithm::isReEntrant ( ) const
inlinefinaloverrideprotectedvirtualinherited

Legacy algorithms are not thread-safe.

Definition at line 47 of file AthAlgorithm.h.

47{ return false; }

◆ msg()

MsgStream & AthCommonMsg< Gaudi::Algorithm >::msg ( ) const
inlineinherited

Definition at line 24 of file AthCommonMsg.h.

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

◆ msgLvl()

bool AthCommonMsg< Gaudi::Algorithm >::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< Gaudi::Algorithm > >::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< Gaudi::Algorithm > >::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< Gaudi::Algorithm > >::renounceArray ( SG::VarHandleKeyArray & handlesArray)
inlineprotectedinherited

remove all handles from I/O resolution

Definition at line 364 of file AthCommonDataStore.h.

364 {
366 }

◆ setFilterPassed()

virtual void AthCommonAlgorithm< Gaudi::Algorithm >::setFilterPassed ( bool state,
const EventContext & ctx ) const
inlinevirtualinherited

Set filter decision:

Reimplemented in AthFilterAlgorithm.

Definition at line 99 of file AthCommonAlgorithm.h.

99 {
101 }
virtual void setFilterPassed(bool state, const EventContext &ctx) const
Set filter decision:

◆ showStatistics()

void Trk::AlignAlg::showStatistics ( )

dumps statistics accumulated in each event

◆ start()

StatusCode AlignAlg::start ( )
virtual

set up geometry and prepare the tools

Definition at line 141 of file AlignAlg.cxx.

142{
143 ATH_MSG_DEBUG("AlignAlg::start()");
144
145 if (m_writeNtuple) {
146 m_ntuple = new TFile((m_filepath.value()+m_filename.value()).c_str(),"RECREATE");
147 // set the ntuple points of the tools
151 m_alignTool->setNtuple(m_ntuple);
152 m_trkAlignDBTool->setNtuple(m_ntuple);
153 m_fillNtupleTool->setNtuple(m_ntuple);
154 }
155
156 ATH_MSG_DEBUG("reading geometry");
157 int NDoF = m_geometryManagerTool->ReadGeometry(m_alignSolveLevel);
158 ATH_MSG_DEBUG("read geometry, "<<NDoF<<" alignment parameters");
159
160 m_geometryManagerTool->PrintModPositions();
161
162 // fix pathname (used to be m_pathbin+m+prefixName)
163 // m_geometryManagerTool->StoreModPositions(pathname);
164
165 StatusCode sc = m_alignTool->firstEventInitialize();
166
167 if (sc != StatusCode::SUCCESS) {
168 msg(MSG::FATAL)<<"problem with alignTool->firstEventInitialize()"<<endmsg;
169 return StatusCode::FAILURE;
170 }
171
172 if(m_solveOnly) {
173 ATH_MSG_DEBUG("getting data from files");
174 m_alignTool->accumulateFromFiles();
175 }
176
177 return StatusCode::SUCCESS;
178}
StringProperty m_filename
Definition AlignAlg.h:109
StringProperty m_filepath
Definition AlignAlg.h:110

◆ stop()

StatusCode AlignAlg::stop ( )
virtual

processes information accumulated in execute method to determine alignment parameters

Definition at line 344 of file AlignAlg.cxx.

345{
346 ATH_MSG_INFO("AlignAlg::stop()");
347
348 if(m_logStream && !m_solveOnly) {
349 *m_logStream<<"*************************************************************"<<std::endl;
350 *m_logStream<<"****** Alignment Job summary ******"<<std::endl;
351 *m_logStream<<"*************************************************************"<<std::endl;
352 *m_logStream<<"*"<<std::endl;
353 *m_logStream<<"* number of processed events: "<<m_nevents<<std::endl;
354 *m_logStream<<"* number of processed tracks: "<<m_ntracks<<std::endl;
355 *m_logStream<<"* number of selected tracks: "<<m_ntracksSel<<std::endl;
356 *m_logStream<<"* number of tracks processed: "<<m_ntracksProc<<std::endl;
357 *m_logStream<<"* number of tracks dressed: "<<m_ntracksDress<<std::endl;
358 *m_logStream<<"* number of tracks accumulated: "<<m_ntracksAccum<<std::endl;
359
360 *m_logStream<<"*"<<std::endl;
361
362 m_alignTrackPreProcessor->printSummary();
363 m_trackCollectionProvider->printSummary();
364 }
365
366 // fill ntuple for all tools
367 if (m_writeNtuple) {
368 ATH_MSG_INFO("calling alignTool->fillNtuple()");
369 if(m_alignTool->fillNtuple().isFailure()) {
370 msg(MSG::ERROR)<<"problem with alignTool fillNtuple()!"<<endmsg;
371 return StatusCode::FAILURE;
372 }
373 ATH_MSG_INFO("calling fillNtupleTool->fillNtuple()");
374 if(m_fillNtupleTool->fillNtuple().isFailure()) {
375 msg(MSG::ERROR)<<"problem with fillNtupleTool fillNtuple()!"<<endmsg;
376 return StatusCode::FAILURE;
377 }
378
379 ATH_MSG_INFO("calling alignTrackPreProcessor->fillNtuple()");
380 if(m_alignTrackPreProcessor->fillNtuple().isFailure()) {
381 msg(MSG::ERROR)<<"problem with alignTrackPreProcessor fillNtuple()!"<<endmsg;
382 return StatusCode::FAILURE;
383 }
384
385 ATH_MSG_INFO("calling trackCollectionProvider->fillNtuple()");
386 if(m_trackCollectionProvider->fillNtuple().isFailure()) {
387 msg(MSG::ERROR)<<"problem with trackCollectionProvider fillNtuple()!"<<endmsg;
388 return StatusCode::FAILURE;
389 }
390 }
391
392 if(!m_solveOnly && m_ntracksSel==0) {
393 msg(MSG::WARNING)<<"No tracks passed track selection. No solving."<<endmsg;
394 return StatusCode::SUCCESS;
395 }
396
397 ATH_MSG_INFO("calling trkAlignDBTool->preSolve()");
398 if (m_trkAlignDBTool->preSolve().isFailure()) {
399 msg(MSG::FATAL)<<"failure in ITrkAlignDBTool->preSolve()"<<endmsg;
400 return StatusCode::FAILURE;
401 }
402
403 ATH_MSG_INFO("calling alignTool->solve()");
404 if (m_alignTool->solve().isFailure()) {
405 msg(MSG::FATAL)<<"failure in IAlignTool->solve()"<<endmsg;
406 return StatusCode::FAILURE;
407 }
408
409 ATH_MSG_INFO("calling trkAlignDBTool->writeAlignPar()");
410 m_trkAlignDBTool->writeAlignPar();
411
412 return StatusCode::SUCCESS;
413}

◆ sysExecute()

StatusCode AthCommonAlgorithm< Gaudi::Algorithm >::sysExecute ( const EventContext & ctx)
overridevirtualinherited

Execute an algorithm.

We override this in order to work around an issue with the Algorithm base class storing the event context in a member variable that can cause crashes in MT jobs.

Reimplemented in AthAnalysisAlgorithm.

Definition at line 80 of file AthCommonAlgorithm.cxx.

41{
42 return BaseAlg::sysExecute (ctx);
43}

◆ sysInitialize()

StatusCode AthCommonAlgorithm< Gaudi::Algorithm >::sysInitialize ( )
overridevirtualinherited

Override sysInitialize.

Override sysInitialize from the base class.

Loop through all output handles, and if they're WriteCondHandles, automatically register them and this Algorithm with the CondSvc

Scan through all outputHandles, and if they're WriteCondHandles, register them with the CondSvc

Reimplemented from AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >.

Reimplemented in AthAnalysisAlgorithm, AthFilterAlgorithm, AthHistogramAlgorithm, HypoBase, InputMakerBase, and PyAthena::Alg.

Definition at line 60 of file AthCommonAlgorithm.cxx.

71 {
73
74 if (sc.isFailure()) {
75 return sc;
76 }
77
78 ServiceHandle<ICondSvc> cs("CondSvc",name());
79 for (auto h : outputHandles()) {
80 if (h->isCondition() && h->mode() == Gaudi::DataHandle::Writer) {
81 // do this inside the loop so we don't create the CondSvc until needed
82 if ( cs.retrieve().isFailure() ) {
83 ATH_MSG_WARNING("no CondSvc found: won't autoreg WriteCondHandles");
85 }
86 if (cs->regHandle(this,*h).isFailure()) {
88 ATH_MSG_ERROR("unable to register WriteCondHandle " << h->fullKey()
89 << " with CondSvc");
90 }
91 }
92 }
93 return sc;
94}
#define ATH_MSG_WARNING(x)
virtual StatusCode sysInitialize() override
virtual std::vector< Gaudi::DataHandle * > outputHandles() const override

◆ sysStart()

virtual StatusCode AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::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< Gaudi::Algorithm > >::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 }

Member Data Documentation

◆ m_alignSolveLevel

IntegerProperty Trk::AlignAlg::m_alignSolveLevel
private
Initial value:
{this, "AlignSolveLevel", 3,
"Set the Alignment Solve Level"}

Definition at line 117 of file AlignAlg.h.

117 {this, "AlignSolveLevel", 3,
118 "Set the Alignment Solve Level"};

◆ m_alignTool

ToolHandle<IAlignTool> Trk::AlignAlg::m_alignTool
private
Initial value:
{
this, "AlignTool", "Trk::GlobalChi2AlignTool",
"alignment algorithm-specific tool"}

Pointer to alignTool.

Definition at line 90 of file AlignAlg.h.

90 {
91 this, "AlignTool", "Trk::GlobalChi2AlignTool",
92 "alignment algorithm-specific tool"};

◆ m_alignTrackCreator

ToolHandle<IAlignTrackCreator> Trk::AlignAlg::m_alignTrackCreator
private
Initial value:
{
this, "AlignTrackCreator", "Trk::AlignTrackCreator",
"tool for creating AlignTSOSCollection to store on AlignTrack"}

Pointer to alignTrackCreator, used to convert Trk::Track to vector of AlignTrack.

Definition at line 80 of file AlignAlg.h.

80 {
81 this, "AlignTrackCreator", "Trk::AlignTrackCreator",
82 "tool for creating AlignTSOSCollection to store on AlignTrack"};

◆ m_alignTrackDresser

ToolHandle<IAlignTrackDresser> Trk::AlignAlg::m_alignTrackDresser
private
Initial value:
{
this, "AlignTrackDresser", "Trk::AlignTrackDresser",
"tool for dressing AlignTrack with residuals, derivatives, etc."}

Pointer to alignTrackDresser, used to add residuals, derivatives, etc.

to vector of AlignTrack

Definition at line 85 of file AlignAlg.h.

85 {
86 this, "AlignTrackDresser", "Trk::AlignTrackDresser",
87 "tool for dressing AlignTrack with residuals, derivatives, etc."};

◆ m_alignTrackPreProcessor

ToolHandle<IAlignTrackPreProcessor> Trk::AlignAlg::m_alignTrackPreProcessor
private
Initial value:
{
this, "AlignTrackPreProcessor", "Trk::AlignTrackPreProcessor",
"tool for converting Trk::Track to AlignTrack after processing if necessary"}

Pointer to AlignTrackPreProcessor, used to select hits on tracks and/or tracks before passing to AlignTrackCreator.

Definition at line 75 of file AlignAlg.h.

75 {
76 this, "AlignTrackPreProcessor", "Trk::AlignTrackPreProcessor",
77 "tool for converting Trk::Track to AlignTrack after processing if necessary"};

◆ m_alignTracksName

StringProperty Trk::AlignAlg::m_alignTracksName
private
Initial value:
{this, "AlignTracksName", "AlignTracks",
"name of the AlignTrack collection in the StoreGate"}

Definition at line 134 of file AlignAlg.h.

134 {this, "AlignTracksName", "AlignTracks",
135 "name of the AlignTrack collection in the StoreGate"};

◆ m_detStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::m_detStore
privateinherited

Pointer to StoreGate (detector store by default).

Definition at line 393 of file AthCommonDataStore.h.

◆ m_evtStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::m_evtStore
privateinherited

Pointer to StoreGate (event store by default).

Definition at line 390 of file AthCommonDataStore.h.

◆ m_extendedExtraObjects

DataObjIDColl AthCommonAlgorithm< Gaudi::Algorithm >::m_extendedExtraObjects
privateinherited

Extra output dependency collection, extended by AthAlgorithmDHUpdate to add symlinks.

Empty if no symlinks were found.

Definition at line 108 of file AthCommonAlgorithm.h.

◆ m_filename

StringProperty Trk::AlignAlg::m_filename {this, "FileName", "Align.root", "name of ntuple file"}
private

Definition at line 109 of file AlignAlg.h.

109{this, "FileName", "Align.root", "name of ntuple file"};

◆ m_filepath

StringProperty Trk::AlignAlg::m_filepath {this, "FilePath", "./", "path to ntuple file"}
private

Definition at line 110 of file AlignAlg.h.

110{this, "FilePath", "./", "path to ntuple file"};

◆ m_fillNtupleTool

ToolHandle<IFillNtupleTool> Trk::AlignAlg::m_fillNtupleTool
private
Initial value:
{
this, "FillNtupleTool", "",
"tool for storing Trk::Track information into the ntuple"}

Pointer to FillNtupleTool, used to write track information to ntuple.

Definition at line 104 of file AlignAlg.h.

104 {
105 this, "FillNtupleTool", "",
106 "tool for storing Trk::Track information into the ntuple"};

◆ m_geometryManagerTool

PublicToolHandle<IGeometryManagerTool> Trk::AlignAlg::m_geometryManagerTool
private
Initial value:
{
this, "GeometryManagerTool", "InDet::InDetGeometryManagerTool",
"tool for configuring geometry"}

Pointer to GeometryManagerTool, used to get lists of chambers for which alignment parameters will be determined.

Definition at line 95 of file AlignAlg.h.

95 {
96 this, "GeometryManagerTool", "InDet::InDetGeometryManagerTool",
97 "tool for configuring geometry"};

◆ m_logfileName

StringProperty Trk::AlignAlg::m_logfileName
private
Initial value:
{this, "LogFileName", "alignlogfile.txt",
"name of the logfile"}

Definition at line 123 of file AlignAlg.h.

123 {this, "LogFileName", "alignlogfile.txt",
124 "name of the logfile"};

◆ m_logStream

std::ostream* Trk::AlignAlg::m_logStream = nullptr
private

logfile output stream

Definition at line 125 of file AlignAlg.h.

◆ m_nevents

int Trk::AlignAlg::m_nevents = 0
private

number of processed events

Definition at line 127 of file AlignAlg.h.

◆ m_ntracks

int Trk::AlignAlg::m_ntracks = 0
private

number of processed tracks

Definition at line 128 of file AlignAlg.h.

◆ m_ntracksAccum

int Trk::AlignAlg::m_ntracksAccum = 0
private

number of tracks successfully accumulated

Definition at line 132 of file AlignAlg.h.

◆ m_ntracksDress

int Trk::AlignAlg::m_ntracksDress = 0
private

number of tracks successfully dressed

Definition at line 131 of file AlignAlg.h.

◆ m_ntracksProc

int Trk::AlignAlg::m_ntracksProc = 0
private

number of tracks successfully processed

Definition at line 130 of file AlignAlg.h.

◆ m_ntracksSel

int Trk::AlignAlg::m_ntracksSel = 0
private

number of selected tracks

Definition at line 129 of file AlignAlg.h.

◆ m_ntuple

TFile* Trk::AlignAlg::m_ntuple = nullptr
private

output ntuple

Definition at line 120 of file AlignAlg.h.

◆ m_solveOnly

BooleanProperty Trk::AlignAlg::m_solveOnly
private
Initial value:
{this, "SolveOnly", false,
"only do the solving (accumulate from binaries)"}

Definition at line 112 of file AlignAlg.h.

112 {this, "SolveOnly", false,
113 "only do the solving (accumulate from binaries)"};

◆ m_trackCollectionProvider

ToolHandle<ITrackCollectionProvider> Trk::AlignAlg::m_trackCollectionProvider
private
Initial value:
{
this, "TrackCollectionProvider", "Trk::TrackCollectionProvider",
"tool for getting track collection from StoreGate"}

Definition at line 70 of file AlignAlg.h.

70 {
71 this, "TrackCollectionProvider", "Trk::TrackCollectionProvider",
72 "tool for getting track collection from StoreGate"};

◆ m_trkAlignDBTool

ToolHandle<ITrkAlignDBTool> Trk::AlignAlg::m_trkAlignDBTool
private
Initial value:
{
this, "AlignDBTool", "Trk::TrkAlignDBTool", "tool for handling DB stuff"}

Pointer to TrkAlignDBTool, used for reading/writing alignment parameters from/to the database.

Definition at line 100 of file AlignAlg.h.

100 {
101 this, "AlignDBTool", "Trk::TrkAlignDBTool", "tool for handling DB stuff"};

◆ m_varHandleArraysDeclared

bool AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::m_varHandleArraysDeclared
privateinherited

Definition at line 399 of file AthCommonDataStore.h.

◆ m_vhka

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

Definition at line 398 of file AthCommonDataStore.h.

◆ m_writeLogfile

BooleanProperty Trk::AlignAlg::m_writeLogfile
private
Initial value:
{this, "WriteLogFile", true,
"write a logfile for solving"}

Definition at line 121 of file AlignAlg.h.

121 {this, "WriteLogFile", true,
122 "write a logfile for solving"};

◆ m_writeNtuple

BooleanProperty Trk::AlignAlg::m_writeNtuple
private
Initial value:
{this, "WriteNtuple", true,
"write track and event information to ntuple"}

Definition at line 114 of file AlignAlg.h.

114 {this, "WriteNtuple", true,
115 "write track and event information to ntuple"};

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