From a3481ff028d42c736753fa2c24489ea0ca83ac59 Mon Sep 17 00:00:00 2001 From: Mohsen Rezaei Estabragh Date: Fri, 29 May 2020 09:45:53 +0200 Subject: [PATCH 01/38] Reporting non-standard errors Introducing a knowledge file (nonStandardError.db) contains of non-standard errors. Managing to find this errors during log scan and adding to the FATAL error message. Providing a Unittest. --- Tools/PyJobTransforms/python/trfValidation.py | 12 +++++++++ .../share/nonStandardErrors.db | 2 ++ .../test/test_trfValidation.py | 25 ++++++++++++++++++- 3 files changed, 38 insertions(+), 1 deletion(-) create mode 100644 Tools/PyJobTransforms/share/nonStandardErrors.db diff --git a/Tools/PyJobTransforms/python/trfValidation.py b/Tools/PyJobTransforms/python/trfValidation.py index ae79365a219..a90de04f92a 100644 --- a/Tools/PyJobTransforms/python/trfValidation.py +++ b/Tools/PyJobTransforms/python/trfValidation.py @@ -295,11 +295,14 @@ class athenaLogFileReport(logFileReport): return linesList def scanLogFile(self, resetReport=False): + nonStandardErrorsList = self.knowledgeFileHandler('nonStandardErrors.db') + if resetReport: self.resetReport() for log in self._logfile: msg.debug('Now scanning logfile {0}'.format(log)) + seenNonStandardError = '' # N.B. Use the generator so that lines can be grabbed by subroutines, e.g., core dump svc reporter try: myGen = trfUtils.lineByLine(log, substepName=self._substepName) @@ -350,6 +353,10 @@ class athenaLogFileReport(logFileReport): if 'SysError in ' in line: self.rootSysErrorParser(myGen, line, lineCounter) continue + # Check if the line is among the non-standard logging errors from the knowledge file + if any(line in l for l in nonStandardErrorsList): + seenNonStandardError = line + continue msg.debug('Non-standard line in %s: %s' % (log, line)) self._levelCounter['UNKNOWN'] += 1 @@ -388,6 +395,11 @@ class athenaLogFileReport(logFileReport): if 'std::bad_alloc' in fields['message']: fields['level'] = 'CATASTROPHE' + # concatenate the seen non-standard logging error to the FATAL + if fields['level'] == 'FATAL': + if seenNonStandardError: + line += '; ' + seenNonStandardError + # Count this error self._levelCounter[fields['level']] += 1 diff --git a/Tools/PyJobTransforms/share/nonStandardErrors.db b/Tools/PyJobTransforms/share/nonStandardErrors.db new file mode 100644 index 00000000000..fda62cd8ff5 --- /dev/null +++ b/Tools/PyJobTransforms/share/nonStandardErrors.db @@ -0,0 +1,2 @@ +# List of non-standard logging errors +PYTHIA Abort from Pythia::next: reached end of Les Houches Events File diff --git a/Tools/PyJobTransforms/test/test_trfValidation.py b/Tools/PyJobTransforms/test/test_trfValidation.py index 02582a36856..de66245e3db 100755 --- a/Tools/PyJobTransforms/test/test_trfValidation.py +++ b/Tools/PyJobTransforms/test/test_trfValidation.py @@ -579,6 +579,21 @@ class athenaLogFileReportTests(unittest.TestCase): 18:16:06 Caught signal 11(Segmentation fault). Details: ''' + testKnowledgeFile = ''' +10:38:58 PYTHIA Abort from Pythia::next: reached end of Les Houches Events File +10:38:58 Pythia8 INFO Event generation failed - re-trying. +10:38:58 Pythia8 INFO Event generation failed - re-trying. +10:38:58 Pythia8 INFO Event generation failed - re-trying. +10:38:58 Pythia8 INFO Event generation failed - re-trying. +10:38:58 Pythia8 INFO Event generation failed - re-trying. +10:38:58 Pythia8 INFO Event generation failed - re-trying. +10:38:58 Pythia8 INFO Event generation failed - re-trying. +10:38:58 Pythia8 INFO Event generation failed - re-trying. +10:38:58 Pythia8 INFO Event generation failed - re-trying. +10:38:58 Pythia8 ERROR Exceeded the max number of consecutive event failures. +10:38:58 Pythia8 FATAL /build/atnight/localbuilds/nightlies/21.6/athena/Generators/GeneratorModules/src/GenModule.cxx:56 (StatusCode GenModule::execute()): code 0: this->callGenerator() + ''' + with open('file1', 'w') as f1: print('This is test file 1 w/o meaning', file=f1) with open('file2', 'w') as f2: @@ -605,6 +620,8 @@ class athenaLogFileReportTests(unittest.TestCase): print(testCoreDumpAbNormalLine, file=f11) with open('file12', 'w') as f12: print(testCoreDumpAbnormalPattern, file=f12) + with open('file13', 'w') as f13: + print(testKnowledgeFile, file=f13) self.myFileReport1 = athenaLogFileReport('file1') self.myFileReport2 = athenaLogFileReport('file2') @@ -618,9 +635,10 @@ class athenaLogFileReportTests(unittest.TestCase): self.myFileReport10 = athenaLogFileReport('file10') self.myFileReport11 = athenaLogFileReport('file11') self.myFileReport12 = athenaLogFileReport('file12') + self.myFileReport13 = athenaLogFileReport('file13') def tearDown(self): - for f in 'file1', 'file2', 'file3', 'file4', 'file5', 'file6', 'file7', 'file8', 'file9', 'file10', 'file11', 'file12',\ + for f in 'file1', 'file2', 'file3', 'file4', 'file5', 'file6', 'file7', 'file8', 'file9', 'file10', 'file11', 'file12', 'file13',\ 'logWithSubstepNameSerial', 'logWithSubstepNameMP': try: os.unlink(f) @@ -712,6 +730,11 @@ ManagedAthenaTileMon reported an ERROR, but returned a StatusCode "SUCCESS"''' self.assertEqual(self.myFileReport12.worstError(), {'level': 'FATAL', 'nLevel': logging.FATAL, 'firstError': {'moreDetails': {'abnormalLine(s) before CoreDump': {'message0': 'TBufferFile::CheckObject:0: RuntimeWarning: reference to object of unavailable class TObject, offset=980837731 pointer will be 0', 'firstLine0': 7, 'count0': 2, 'message1': 'Error in : key 980837731 not found at 306', 'firstLine1': 6, 'count1': 2}, 'lastNormalLine before CoreDump': {'message': 'Error in : Cannot find data member # 0 of class Identifier for parent TileTrigger!', 'firstLine': 3, 'count': 1}}, 'message': 'Segmentation fault: Event counter: unknown; Run: unknown; Evt: unknown; Current algorithm: unknown; Current Function: unknown; Abnormal line(s) seen just before core dump: TBufferFile::CheckObject:0: Ru...[truncated] (see the jobReport)', 'firstLine': 9, 'count': 1}}) + def test_knowledgeFile(self): + self.assertEqual(self.myFileReport13.worstError(), {'level': 'FATAL', 'nLevel': logging.FATAL, + 'firstError': {'count': 1, 'firstLine': 13, + 'message': 'Pythia8 FATAL /build/atnight/localbuilds/nightlies/21.6/athena/Generators/GeneratorModules/src/GenModule.cxx:56 (StatusCode GenModule::execute()): code 0: this->callGenerator(); PYTHIA Abort from Pythia::next: reached end of Les Houches Events File'}}) + def test_dbMonitor(self): print(self.myFileReport9) self.assertEqual(self.myFileReport9.dbMonitor(), {'bytes': 579, 'time': 12.45}) -- GitLab From cd6baf6960fac63c2dce5a41aac26662e4a118c6 Mon Sep 17 00:00:00 2001 From: Mohsen Rezaei Estabragh Date: Fri, 5 Jun 2020 14:29:49 +0200 Subject: [PATCH 02/38] minor: removing extra spaces --- Tools/PyJobTransforms/test/test_trfValidation.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Tools/PyJobTransforms/test/test_trfValidation.py b/Tools/PyJobTransforms/test/test_trfValidation.py index de66245e3db..f9d23820a3f 100755 --- a/Tools/PyJobTransforms/test/test_trfValidation.py +++ b/Tools/PyJobTransforms/test/test_trfValidation.py @@ -732,8 +732,7 @@ ManagedAthenaTileMon reported an ERROR, but returned a StatusCode "SUCCESS"''' def test_knowledgeFile(self): self.assertEqual(self.myFileReport13.worstError(), {'level': 'FATAL', 'nLevel': logging.FATAL, - 'firstError': {'count': 1, 'firstLine': 13, - 'message': 'Pythia8 FATAL /build/atnight/localbuilds/nightlies/21.6/athena/Generators/GeneratorModules/src/GenModule.cxx:56 (StatusCode GenModule::execute()): code 0: this->callGenerator(); PYTHIA Abort from Pythia::next: reached end of Les Houches Events File'}}) + 'firstError': {'count': 1, 'firstLine': 13, 'message': 'Pythia8 FATAL /build/atnight/localbuilds/nightlies/21.6/athena/Generators/GeneratorModules/src/GenModule.cxx:56 (StatusCode GenModule::execute()): code 0: this->callGenerator(); PYTHIA Abort from Pythia::next: reached end of Les Houches Events File'}}) def test_dbMonitor(self): print(self.myFileReport9) -- GitLab From a97864394ca8dc5e2bd718a5806f121c628224e2 Mon Sep 17 00:00:00 2001 From: christos Date: Sat, 6 Jun 2020 18:59:37 +0200 Subject: [PATCH 03/38] GlobalChi2 EventContext aware --- .../TrkGlobalChi2Fitter/GlobalChi2Fitter.h | 53 ++- .../TrkGlobalChi2Fitter/src/GXFTrackState.cxx | 2 +- .../src/GlobalChi2Fitter.cxx | 376 +++++++++++------- 3 files changed, 269 insertions(+), 162 deletions(-) diff --git a/Tracking/TrkFitter/TrkGlobalChi2Fitter/TrkGlobalChi2Fitter/GlobalChi2Fitter.h b/Tracking/TrkFitter/TrkGlobalChi2Fitter/TrkGlobalChi2Fitter/GlobalChi2Fitter.h index 4298bfdabba..22954464ea2 100755 --- a/Tracking/TrkFitter/TrkGlobalChi2Fitter/TrkGlobalChi2Fitter/GlobalChi2Fitter.h +++ b/Tracking/TrkFitter/TrkGlobalChi2Fitter/TrkGlobalChi2Fitter/GlobalChi2Fitter.h @@ -9,6 +9,7 @@ #include "TrkDetDescrInterfaces/IMaterialEffectsOnTrackProvider.h" #include "AthenaBaseComps/AthAlgTool.h" #include "GaudiKernel/ToolHandle.h" +#include "GaudiKernel/EventContext.h" #include "TrkFitterInterfaces/IGlobalTrackFitter.h" #include "TrkGlobalChi2Fitter/GXFTrajectory.h" #include "TrkMaterialOnTrack/MaterialEffectsOnTrack.h" @@ -17,6 +18,7 @@ #include "MagFieldConditions/AtlasFieldCacheCondObj.h" #include "MagFieldElements/AtlasFieldCache.h" +#include #include class AtlasDetectorID; @@ -155,47 +157,53 @@ namespace Trk { * EventContext for now */ using ITrackFitter::fit; - - virtual Track *fit( - const PrepRawDataSet &, - const TrackParameters &, + + virtual std::unique_ptr fit( + const EventContext& ctx, + const PrepRawDataSet&, + const TrackParameters&, const RunOutlierRemoval runOutlier = false, const ParticleHypothesis matEffects = nonInteracting - ) const override; + ) const override final; - virtual Track *fit( + virtual std::unique_ptr fit( + const EventContext& ctx, const Track &, const RunOutlierRemoval runOutlier = false, const ParticleHypothesis matEffects = nonInteracting - ) const override; + ) const override final; - virtual Track *fit( + virtual std::unique_ptr fit( + const EventContext& ctx, const MeasurementSet &, const TrackParameters &, const RunOutlierRemoval runOutlier = false, const ParticleHypothesis matEffects = nonInteracting - ) const override ; + ) const override final; - virtual Track *fit( + virtual std::unique_ptr fit( + const EventContext& ctx, const Track &, const PrepRawDataSet &, const RunOutlierRemoval runOutlier = false, const ParticleHypothesis matEffects = nonInteracting - ) const override; + ) const override final; - virtual Track *fit( + virtual std::unique_ptr fit( + const EventContext& ctx, const Track &, const Track &, const RunOutlierRemoval runOutlier = false, const ParticleHypothesis matEffects = nonInteracting - ) const override; + ) const override final; - virtual Track *fit( + virtual std::unique_ptr fit( + const EventContext& ctx, const Track &, const MeasurementSet &, const RunOutlierRemoval runOutlier = false, const ParticleHypothesis matEffects = nonInteracting - ) const override; + ) const override final; virtual Track* alignmentFit( AlignmentCache&, @@ -220,6 +228,7 @@ namespace Trk { ) const; Track * fitIm( + const EventContext& ctx, Cache & cache, const Track & inputTrack, const RunOutlierRemoval runOutlier, @@ -227,6 +236,7 @@ namespace Trk { ) const; Track *myfit( + const EventContext& ctx, Cache &, GXFTrajectory &, const TrackParameters &, @@ -243,6 +253,7 @@ namespace Trk { ) const; Track *mainCombinationStrategy( + const EventContext& ctx, Cache &, const Track &, const Track &, @@ -251,6 +262,7 @@ namespace Trk { ) const; Track *backupCombinationStrategy( + const EventContext& ctx, Cache &, const Track &, const Track &, @@ -415,6 +427,7 @@ namespace Trk { * determine the behaviour of the particle as it traverses materials. */ void addIDMaterialFast( + const EventContext& ctx, Cache & cache, GXFTrajectory & track, const TrackParameters * parameters, @@ -435,6 +448,7 @@ namespace Trk { ) const; Track *makeTrack( + const EventContext& ctx, Cache &, GXFTrajectory &, const ParticleHypothesis @@ -461,6 +475,7 @@ namespace Trk { ) const; FitterStatusCode runIteration( + const EventContext& ctx, Cache &, GXFTrajectory &, int, @@ -477,6 +492,7 @@ namespace Trk { ) const; GXFTrajectory *runTrackCleanerSilicon( + const EventContext& ctx, Cache &, GXFTrajectory &, Amg::SymMatrixX &, @@ -494,13 +510,17 @@ namespace Trk { bool, bool, int ) const; - FitterStatusCode calculateTrackParameters(GXFTrajectory &, bool) const; + FitterStatusCode calculateTrackParameters( + const EventContext& ctx, + GXFTrajectory&, + bool) const; void calculateDerivatives(GXFTrajectory &) const; void calculateTrackErrors(GXFTrajectory &, Amg::SymMatrixX &, bool) const; TransportJacobian *numericalDerivatives( + const EventContext& ctx, const TrackParameters *, const Surface *, PropDirection, @@ -547,6 +567,7 @@ namespace Trk { * field cache. */ void initFieldCache( + const EventContext& ctx, Cache & cache ) const; diff --git a/Tracking/TrkFitter/TrkGlobalChi2Fitter/src/GXFTrackState.cxx b/Tracking/TrkFitter/TrkGlobalChi2Fitter/src/GXFTrackState.cxx index 73093240403..7d887de825e 100644 --- a/Tracking/TrkFitter/TrkGlobalChi2Fitter/src/GXFTrackState.cxx +++ b/Tracking/TrkFitter/TrkGlobalChi2Fitter/src/GXFTrackState.cxx @@ -299,7 +299,7 @@ namespace Trk { return &m_measurement->associatedSurface(); } if (m_trackpar != nullptr) { return &m_trackpar->associatedSurface(); - } else if (m_materialEffects != nullptr) { + } if (m_materialEffects != nullptr) { return m_materialEffects->surface(); } else { return nullptr; diff --git a/Tracking/TrkFitter/TrkGlobalChi2Fitter/src/GlobalChi2Fitter.cxx b/Tracking/TrkFitter/TrkGlobalChi2Fitter/src/GlobalChi2Fitter.cxx index 8f8fa3cca2a..b3562ac57f2 100644 --- a/Tracking/TrkFitter/TrkGlobalChi2Fitter/src/GlobalChi2Fitter.cxx +++ b/Tracking/TrkFitter/TrkGlobalChi2Fitter/src/GlobalChi2Fitter.cxx @@ -277,16 +277,18 @@ namespace Trk { // combined fit of two tracks // -------------------------------- - Track *GlobalChi2Fitter::fit( - const Track & intrk1, - const Track & intrk2, + std::unique_ptr + GlobalChi2Fitter::fit( + const EventContext& ctx, + const Track& intrk1, + const Track& intrk2, const RunOutlierRemoval, - const ParticleHypothesis - ) const { + const ParticleHypothesis) const + { ATH_MSG_DEBUG("--> entering GlobalChi2Fitter::fit(Track,Track,)"); Cache cache(this); - initFieldCache(cache); + initFieldCache(ctx,cache); GXFTrajectory trajectory; if (!m_straightlineprop) { @@ -319,8 +321,10 @@ namespace Trk { Amg::Vector3D measdir = surf->transform().rotation().col(0); double dotprod1 = measdir.dot(Amg::Vector3D(0, 0, 1)); - double dotprod2 = measdir.dot(Amg::Vector3D(surf->center().x(), surf->center().y(), 0) / surf->center().perp()); - + double dotprod2 = measdir.dot( + Amg::Vector3D(surf->center().x(), surf->center().y(), 0) / + surf->center().perp()); + if (std::abs(dotprod1) < .5 && std::abs(dotprod2) < .5) { measphi = true; break; @@ -460,7 +464,7 @@ namespace Trk { qoverpid * qoverpmuon > 0 ) ) { - track = mainCombinationStrategy(cache, intrk1, intrk2, trajectory, calomeots); + track = mainCombinationStrategy(ctx,cache, intrk1, intrk2, trajectory, calomeots); if (m_fit_status[S_FITS] == (unsigned int) (nfits + 1)) { firstfitwasattempted = true; @@ -477,7 +481,7 @@ namespace Trk { trajectory2.m_straightline = trajectory.m_straightline; trajectory2.m_fieldprop = trajectory.m_fieldprop; trajectory = trajectory2; - track = backupCombinationStrategy(cache, intrk1, intrk2, trajectory, calomeots); + track = backupCombinationStrategy(ctx,cache, intrk1, intrk2, trajectory, calomeots); } bool pseudoupdated = false; @@ -536,6 +540,7 @@ namespace Trk { cache.m_matfilled = true; track = myfit( + ctx, cache, trajectory, *oldtrack->perigeeParameters(), @@ -559,10 +564,11 @@ namespace Trk { cache.m_calomat = tmp; cache.m_extmat = tmp2; cache.m_idmat = tmp4; - return track; + return std::unique_ptr(track); } Track *GlobalChi2Fitter::mainCombinationStrategy( + const EventContext& ctx, Cache & cache, const Track & intrk1, const Track & intrk2, @@ -715,6 +721,7 @@ namespace Trk { const Surface *matsurf = &meff->associatedSurface(); tmppar = m_propagator->propagateParameters( + ctx, *tp_closestmuon, *matsurf, propdir, @@ -726,6 +733,7 @@ namespace Trk { if (tmppar == nullptr) { propdir = !firstismuon ? Trk::alongMomentum : oppositeMomentum; tmppar = m_propagator->propagateParameters( + ctx, *tp_closestmuon, *matsurf, propdir, @@ -850,6 +858,7 @@ namespace Trk { } firstscatpar = m_propagator->propagateParameters( + ctx, *(firstismuon ? tp_closestmuon : lastidpar), calomeots[0].associatedSurface(), Trk::alongMomentum, @@ -872,6 +881,7 @@ namespace Trk { } lastscatpar = m_propagator->propagateParameters( + ctx, *(firstismuon ? firstidpar : tp_closestmuon), calomeots[2].associatedSurface(), Trk::oppositeMomentum, @@ -932,6 +942,7 @@ namespace Trk { PropDirection propdir = !firstismuon ? oppositeMomentum : alongMomentum; tmpelosspar = m_propagator->propagateParameters( + ctx, *tmppar1, calomeots[1]. associatedSurface(), @@ -945,6 +956,7 @@ namespace Trk { if (m_numderiv) { delete jac1; jac1 = numericalDerivatives( + ctx, firstscatpar, &calomeots[1].associatedSurface(), propdir, @@ -981,6 +993,7 @@ namespace Trk { } const TrackParameters *scat2 = m_propagator->propagateParameters( + ctx, *elosspar2, !firstismuon ? calomeots[0].associatedSurface() : @@ -995,6 +1008,7 @@ namespace Trk { if (m_numderiv) { delete jac2; jac2 = numericalDerivatives( + ctx, elosspar2, !firstismuon ? &calomeots[0].associatedSurface() : @@ -1306,6 +1320,7 @@ namespace Trk { } Track *track = myfit( + ctx, cache, trajectory, *startPar, @@ -1321,6 +1336,7 @@ namespace Trk { } Track *GlobalChi2Fitter::backupCombinationStrategy( + const EventContext& ctx, Cache & cache, const Track & intrk1, const Track & intrk2, @@ -1408,31 +1424,30 @@ namespace Trk { if (!firstismuon) { firstscatpar.reset(m_propagator->propagateParameters( + ctx, *lastidpar, calomeots[0].associatedSurface(), - Trk::alongMomentum, + Trk::alongMomentum, false, *trajectory.m_fieldprop, - Trk::nonInteracting - )); - + Trk::nonInteracting)); + delete lastidpar; if (!firstscatpar) { return nullptr; } - + std::unique_ptr tmppar( m_propagator->propagateParameters( + ctx, *firstscatpar, calomeots[1].associatedSurface(), - Trk::alongMomentum, + Trk::alongMomentum, false, *trajectory.m_fieldprop, - Trk::nonInteracting - ) - ); - + Trk::nonInteracting)); + if (!tmppar) { return nullptr; } @@ -1458,24 +1473,23 @@ namespace Trk { pars[0], pars[1], pars[2], pars[3], newqoverp, nullptr ) ); - - lastscatpar.reset( - m_propagator->propagateParameters( - *elosspar, - calomeots[2].associatedSurface(), - Trk::alongMomentum, - false, - *trajectory.m_fieldprop, - Trk::nonInteracting - ) - ); - + + lastscatpar.reset(m_propagator->propagateParameters( + ctx, + *elosspar, + calomeots[2].associatedSurface(), + Trk::alongMomentum, + false, + *trajectory.m_fieldprop, + Trk::nonInteracting)); + if (!lastscatpar) { return nullptr; } } else { lastscatpar.reset( m_propagator->propagateParameters( + ctx, *firstidpar, calomeots[2].associatedSurface(), Trk::oppositeMomentum, @@ -1491,6 +1505,7 @@ namespace Trk { elosspar.reset( m_propagator->propagateParameters( + ctx, *lastscatpar, calomeots[1].associatedSurface(), Trk::oppositeMomentum, @@ -1519,6 +1534,7 @@ namespace Trk { firstscatpar.reset( m_propagator->propagateParameters( + ctx, *tmppar, calomeots[0].associatedSurface(), Trk::oppositeMomentum, @@ -1723,17 +1739,17 @@ namespace Trk { std::abs((*itStates2)->measurementOnTrack()->globalPosition().z()) < 10000 ) ) { - const TrackParameters *par2 = - (((*itStates2)->trackParameters() != nullptr) && nphi > 99) ? - (*itStates2)->trackParameters()->clone() : - m_propagator->propagateParameters( - *secondscatstate->trackParameters(), - (*itStates2)->measurementOnTrack()->associatedSurface(), - alongMomentum, - false, - *trajectory.m_fieldprop, - Trk::nonInteracting - ); + const TrackParameters* par2 = + (((*itStates2)->trackParameters() != nullptr) && nphi > 99) + ? (*itStates2)->trackParameters()->clone() + : m_propagator->propagateParameters( + ctx, + *secondscatstate->trackParameters(), + (*itStates2)->measurementOnTrack()->associatedSurface(), + alongMomentum, + false, + *trajectory.m_fieldprop, + Trk::nonInteracting); if (par2 == nullptr) { continue; } @@ -1858,7 +1874,8 @@ namespace Trk { bool tmpacc = cache.m_acceleration; cache.m_acceleration = false; // @TODO eventually track created but not used why ? - std::unique_ptr tmp_track ( myfit(cache, trajectory, *startpar2, false, muon) ); + std::unique_ptr tmp_track( + myfit(ctx, cache, trajectory, *startpar2, false, muon)); cache.m_acceleration = tmpacc; cache.m_matfilled = false; @@ -1914,32 +1931,36 @@ namespace Trk { trajectory.reset(); trajectory.setPrefit(0); trajectory.setNumberOfPerigeeParameters(5); - track = myfit(cache, trajectory, *firstidpar, false, muon); + track = myfit(ctx, cache, trajectory, *firstidpar, false, muon); cache.m_matfilled = false; } return track; } - Track *GlobalChi2Fitter::fit( - const Track & inputTrack, + std::unique_ptr + GlobalChi2Fitter::fit( + const EventContext& ctx, + const Track& inputTrack, const RunOutlierRemoval runOutlier, - const ParticleHypothesis matEffects - ) const { + const ParticleHypothesis matEffects) const + { ATH_MSG_DEBUG("--> entering GlobalChi2Fitter::fit(Track,)"); Cache cache(this); - initFieldCache(cache); + initFieldCache(ctx,cache); GXFTrajectory trajectory; if (!m_straightlineprop) { trajectory.m_straightline = (!cache.m_field_cache.solenoidOn() && !cache.m_field_cache.toroidOn()); } - - trajectory.m_fieldprop = trajectory.m_straightline ? m_fieldpropnofield : m_fieldpropfullfield; - return fitIm(cache, inputTrack, runOutlier, matEffects); + trajectory.m_fieldprop = + trajectory.m_straightline ? m_fieldpropnofield : m_fieldpropfullfield; + + return std::unique_ptr( + fitIm(ctx, cache, inputTrack, runOutlier, matEffects)); } Track * @@ -1949,19 +1970,19 @@ namespace Trk { const ParticleHypothesis matEffects) const { + const EventContext& ctx = Gaudi::Hive::currentContext(); Cache cache(this); - initFieldCache(cache); + initFieldCache(ctx, cache); - - delete alignCache.m_derivMatrix; - alignCache.m_derivMatrix = nullptr; + delete alignCache.m_derivMatrix; + alignCache.m_derivMatrix = nullptr; - - delete alignCache.m_fullCovarianceMatrix; - alignCache.m_fullCovarianceMatrix = nullptr; + delete alignCache.m_fullCovarianceMatrix; + alignCache.m_fullCovarianceMatrix = nullptr; alignCache.m_iterationsOfLastFit = 0; - Trk::Track* newTrack = fitIm( cache, inputTrack, runOutlier, matEffects ); + Trk::Track* newTrack = + fitIm(ctx, cache, inputTrack, runOutlier, matEffects); if(newTrack != nullptr){ if(cache.m_derivmat.size() != 0) alignCache.m_derivMatrix = new Amg::MatrixX(cache.m_derivmat); @@ -1969,15 +1990,17 @@ namespace Trk { alignCache.m_fullCovarianceMatrix = new Amg::MatrixX(cache.m_fullcovmat); alignCache.m_iterationsOfLastFit = cache.m_lastiter; } - return newTrack; } - Track * - GlobalChi2Fitter::fitIm(Cache& cache, - const Track &inputTrack, - const RunOutlierRemoval runOutlier, - const ParticleHypothesis matEffects) const { + Track* + GlobalChi2Fitter::fitIm( + const EventContext& ctx, + Cache& cache, + const Track& inputTrack, + const RunOutlierRemoval runOutlier, + const ParticleHypothesis matEffects) const + { ATH_MSG_DEBUG("--> entering GlobalChi2Fitter::fit(Track,,)"); @@ -2151,8 +2174,8 @@ namespace Trk { if (matEffects == Trk::electron) { cache.m_asymeloss = true; } - - tmptrack = myfit(cache, trajectory, *minpar, false, matEffects); + + tmptrack = myfit(ctx, cache, trajectory, *minpar, false, matEffects); cache.m_sirecal = tmpsirecal; if (tmptrack == nullptr) { @@ -2252,8 +2275,9 @@ namespace Trk { } } - Track *track = myfit(cache, trajectory, *minpar, runOutlier, matEffects); - + Track* track = + myfit(ctx, cache, trajectory, *minpar, runOutlier, matEffects); + if (deleteminpar) { delete minpar; } @@ -2303,7 +2327,8 @@ namespace Trk { Track *oldtrack = track; trajectory.setConverged(false); cache.m_matfilled = true; - track = myfit(cache, trajectory, *oldtrack->perigeeParameters(), false, muon); + track = myfit( + ctx, cache, trajectory, *oldtrack->perigeeParameters(), false, muon); cache.m_matfilled = false; delete oldtrack; } @@ -2327,12 +2352,14 @@ namespace Trk { return track; } - Track *GlobalChi2Fitter::fit( - const PrepRawDataSet & prds, - const TrackParameters & param, + std::unique_ptr + GlobalChi2Fitter::fit( + const EventContext& ctx, + const PrepRawDataSet& prds, + const TrackParameters& param, const RunOutlierRemoval runOutlier, - const ParticleHypothesis matEffects - ) const { + const ParticleHypothesis matEffects) const + { ATH_MSG_DEBUG("--> entering GlobalChi2Fitter::fit(PRDS,TP,)"); MeasurementSet rots; @@ -2391,9 +2418,10 @@ namespace Trk { rots.push_back(rot); } } - - Track *track = fit(rots, param, runOutlier, matEffects); - + + std::unique_ptr track = + fit(ctx, rots, param, runOutlier, matEffects); + for (MeasurementSet::const_iterator it = rots.begin(); it != rots.end(); it++) { delete *it; } @@ -2401,16 +2429,18 @@ namespace Trk { return track; } - Track *GlobalChi2Fitter::fit( - const Track & inputTrack, - const MeasurementSet & addMeasColl, + std::unique_ptr + GlobalChi2Fitter::fit( + const EventContext& ctx, + const Track& inputTrack, + const MeasurementSet& addMeasColl, const RunOutlierRemoval runOutlier, - const ParticleHypothesis matEffects - ) const { + const ParticleHypothesis matEffects) const + { ATH_MSG_DEBUG("--> entering GlobalChi2Fitter::fit(Track,Meas'BaseSet,,)"); Cache cache(this); - initFieldCache(cache); + initFieldCache(ctx,cache); GXFTrajectory trajectory; @@ -2467,7 +2497,8 @@ namespace Trk { // fit set of MeasurementBase using main method, start with first TrkParameter in inputTrack ATH_MSG_VERBOSE("call myfit(GXFTrajectory,TP,,)"); - Track *track = myfit(cache, trajectory, *minpar, runOutlier, matEffects); + Track* track = + myfit(ctx, cache, trajectory, *minpar, runOutlier, matEffects); cache.m_asymeloss = tmpasymeloss; if (track != nullptr) { @@ -2494,17 +2525,19 @@ namespace Trk { incrementFitStatus(S_SUCCESSFUL_FITS); } - return track; + return std::unique_ptr(track); } // extend a track fit to include an additional set of PrepRawData objects // -------------------------------- - Track *GlobalChi2Fitter::fit( - const Track & intrk, - const PrepRawDataSet & prds, + std::unique_ptr + GlobalChi2Fitter::fit( + const EventContext& ctx, + const Track& intrk, + const PrepRawDataSet& prds, const RunOutlierRemoval runOutlier, - const ParticleHypothesis matEffects - ) const { + const ParticleHypothesis matEffects) const + { ATH_MSG_DEBUG("--> entering GlobalChi2Fitter::fit(Track,PRDS,)"); MeasurementSet rots; const TrackParameters *hitparam = intrk.trackParameters()->back(); @@ -2537,7 +2570,7 @@ namespace Trk { } } - Track *track = fit(intrk, rots, runOutlier, matEffects); + std::unique_ptr track = fit(ctx,intrk, rots, runOutlier, matEffects); for (MeasurementSet::const_iterator it = rots.begin(); it != rots.end(); it++) { delete *it; @@ -2546,7 +2579,8 @@ namespace Trk { return track; } - Track *GlobalChi2Fitter::fit( + std::unique_ptr GlobalChi2Fitter::fit( + const EventContext& ctx, const MeasurementSet & rots_in, const TrackParameters & param, const RunOutlierRemoval runOutlier, @@ -2555,7 +2589,7 @@ namespace Trk { ATH_MSG_DEBUG("--> entering GlobalChi2Fitter::fit(Meas'BaseSet,,)"); Cache cache(this); - initFieldCache(cache); + initFieldCache(ctx,cache); GXFTrajectory trajectory; @@ -2637,7 +2671,7 @@ namespace Trk { cache.m_matfilled = true; trajectory.setPrefit(2); - myfit(cache, trajectory, *startpar, runOutlier, matEffects); + myfit(ctx,cache, trajectory, *startpar, runOutlier, matEffects); cache.m_matfilled = false; @@ -2686,7 +2720,7 @@ namespace Trk { trajectory.reset(); - myfit(cache, trajectory, *startpar, runOutlier, matEffects); + myfit(ctx,cache, trajectory, *startpar, runOutlier, matEffects); cache.m_matfilled = true; delete startpar; @@ -2744,10 +2778,10 @@ namespace Trk { } } - Track *track = nullptr; + Track* track = nullptr; if (startpar != nullptr) { - track = myfit(cache, trajectory, *startpar, runOutlier, matEffects); + track = myfit(ctx,cache, trajectory, *startpar, runOutlier, matEffects); } if (deletestartpar) { @@ -2757,10 +2791,9 @@ namespace Trk { if (track != nullptr) { incrementFitStatus(S_SUCCESSFUL_FITS); } - cache.m_matfilled = false; - return track; + return std::unique_ptr (track); } void GlobalChi2Fitter::makeProtoState( @@ -3839,6 +3872,7 @@ namespace Trk { } void GlobalChi2Fitter::addIDMaterialFast( + const EventContext& ctx, Cache & cache, GXFTrajectory & trajectory, const TrackParameters * refpar2, @@ -3930,15 +3964,15 @@ namespace Trk { ) { if (firstsistate == nullptr) { if (oldstates[i]->trackParameters() == nullptr) { - const TrackParameters *tmppar = m_propagator->propagateParameters( - *refpar, - *oldstates[i]->surface(), - alongMomentum, - false, - *trajectory.m_fieldprop, - Trk::nonInteracting - ); - + const TrackParameters* tmppar = m_propagator->propagateParameters( + ctx, + *refpar, + *oldstates[i]->surface(), + alongMomentum, + false, + *trajectory.m_fieldprop, + Trk::nonInteracting); + if (tmppar == nullptr) return; oldstates[i]->setTrackParameters(tmppar); @@ -4941,6 +4975,7 @@ namespace Trk { } Track *GlobalChi2Fitter::myfit( + const EventContext& ctx, Cache & cache, GXFTrajectory & trajectory, const TrackParameters & param, @@ -5028,7 +5063,8 @@ namespace Trk { ) { addMaterial(cache, trajectory, per != nullptr ? per : ¶m, matEffects); } else { - addIDMaterialFast(cache, trajectory, per != nullptr ? per : ¶m, matEffects); + addIDMaterialFast( + ctx, cache, trajectory, per != nullptr ? per : ¶m, matEffects); } } @@ -5080,9 +5116,13 @@ namespace Trk { if ((*it).trackParameters() == nullptr) { continue; } - - double distance = persurf.straightLineDistanceEstimate((*it).trackParameters()->position(),(*it).trackParameters()->momentum().unit()).first(); - + + double distance = persurf + .straightLineDistanceEstimate( + (*it).trackParameters()->position(), + (*it).trackParameters()->momentum().unit()) + .first(); + bool insideid = ( (cache.m_caloEntrance == nullptr) || cache.m_caloEntrance->inside((*it).trackParameters()->position()) @@ -5120,8 +5160,9 @@ namespace Trk { for (int i = 0; i < (int) mymatvec.size(); i++) { Trk::PropDirection propdir = Trk::alongMomentum; const Surface *matsurf = mymatvec[i]->surface(); - DistanceSolution distsol = matsurf->straightLineDistanceEstimate(nearestpar->position(), nearestpar->momentum().unit()); - + DistanceSolution distsol = matsurf->straightLineDistanceEstimate( + nearestpar->position(), nearestpar->momentum().unit()); + double distance = getDistance(distsol); if (distance < 0 && distsol.numberOfSolutions() > 0) { @@ -5129,6 +5170,7 @@ namespace Trk { } const TrackParameters *tmppar = m_propagator->propagateParameters( + ctx, *nearestpar, *matsurf, propdir, @@ -5140,6 +5182,7 @@ namespace Trk { if (tmppar == nullptr) { propdir = (propdir == oppositeMomentum) ? alongMomentum : oppositeMomentum; tmppar = m_propagator->propagateParameters( + ctx, *nearestpar, *matsurf, propdir, @@ -5188,6 +5231,7 @@ namespace Trk { } const Trk::TrackParameters * tmpPars = m_propagator->propagateParameters( + ctx, *nearestpar, persurf, Trk::anyDirection, @@ -5310,7 +5354,8 @@ namespace Trk { } if (!trajectory.converged()) { - cache.m_fittercode = runIteration(cache, trajectory, it, a, b, lu, doderiv); + cache.m_fittercode = + runIteration(ctx, cache, trajectory, it, a, b, lu, doderiv); if (cache.m_fittercode != FitterStatusCode::Success) { if (cache.m_fittercode == FitterStatusCode::ExtrapolationFailure) { incrementFitStatus(S_PROPAGATION_FAIL); @@ -5393,7 +5438,7 @@ namespace Trk { trajectory.numberOfSiliconHits() == trajectory.numberOfHits() ) { calculateTrackErrors(trajectory, a_inv, true); - finaltrajectory = runTrackCleanerSilicon(cache, trajectory, a, a_inv, b, runOutlier); + finaltrajectory = runTrackCleanerSilicon(ctx,cache, trajectory, a, a_inv, b, runOutlier); } if (cache.m_fittercode != FitterStatusCode::Success) { @@ -5457,7 +5502,7 @@ namespace Trk { } if (finaltrajectory->numberOfOutliers() <= m_maxoutliers || !runOutlier) { - track = makeTrack(cache, *finaltrajectory, matEffects); + track = makeTrack(ctx,cache, *finaltrajectory, matEffects); } else { incrementFitStatus(S_NOT_ENOUGH_MEAS); cache.m_fittercode = FitterStatusCode::OutlierLogicFailure; @@ -5993,6 +6038,7 @@ namespace Trk { } FitterStatusCode GlobalChi2Fitter::runIteration( + const EventContext& ctx, Cache & cache, GXFTrajectory & trajectory, int it, @@ -6017,7 +6063,7 @@ namespace Trk { cache.m_phiweight.assign(trajectory.trackStates().size(), 1); } - FitterStatusCode fsc = calculateTrackParameters(trajectory, doderiv); + FitterStatusCode fsc = calculateTrackParameters(ctx,trajectory, doderiv); if (fsc != FitterStatusCode::Success) { return fsc; @@ -6540,6 +6586,7 @@ namespace Trk { } GXFTrajectory *GlobalChi2Fitter::runTrackCleanerSilicon( + const EventContext& ctx, Cache & cache, GXFTrajectory & trajectory, @@ -6932,7 +6979,8 @@ namespace Trk { } if (!newtrajectory->converged()) { - cache.m_fittercode = runIteration(cache, *newtrajectory, it, *newap, *newbp, lu_m, doderiv); + cache.m_fittercode = runIteration( + ctx, cache, *newtrajectory, it, *newap, *newbp, lu_m, doderiv); if (cache.m_fittercode != FitterStatusCode::Success) { incrementFitStatus(S_NOT_ENOUGH_MEAS); @@ -7090,6 +7138,7 @@ namespace Trk { } Track *GlobalChi2Fitter::makeTrack( + const EventContext& ctx, Cache & cache, GXFTrajectory & oldtrajectory, ParticleHypothesis matEffects @@ -7245,6 +7294,7 @@ namespace Trk { } const TrackParameters *layerpar = m_propagator->propagate( + ctx, *prevpar, layer->surfaceRepresentation(), propdir, @@ -7313,6 +7363,7 @@ namespace Trk { if (prevpar != nullptr) { per = m_propagator->propagate( + ctx, *prevpar, PerigeeSurface(Amg::Vector3D(0, 0, 0)), oppositeMomentum, @@ -7372,6 +7423,7 @@ namespace Trk { } FitterStatusCode GlobalChi2Fitter::calculateTrackParameters( + const EventContext& ctx, GXFTrajectory & trajectory, bool calcderiv ) const { @@ -7408,6 +7460,7 @@ namespace Trk { bool curvpar = false; if (calcderiv && !m_numderiv) { currenttrackpar = m_propagator->propagateParameters( + ctx, *prevtrackpar, *surf, propdir, @@ -7419,6 +7472,7 @@ namespace Trk { ); } else { currenttrackpar = m_propagator->propagateParameters( + ctx, *prevtrackpar, *surf, propdir, @@ -7443,6 +7497,7 @@ namespace Trk { if (calcderiv && !m_numderiv) { currenttrackpar = m_propagator->propagateParameters( + ctx, *prevtrackpar, *surf, propdir, @@ -7454,6 +7509,7 @@ namespace Trk { ); } else { currenttrackpar = m_propagator->propagateParameters( + ctx, *prevtrackpar, *surf, propdir, @@ -7467,7 +7523,8 @@ namespace Trk { if ((currenttrackpar != nullptr) && m_numderiv && calcderiv) { delete jac; - jac = numericalDerivatives(prevtrackpar, surf, propdir, trajectory.m_fieldprop); + jac = numericalDerivatives( + ctx, prevtrackpar, surf, propdir, trajectory.m_fieldprop); } if ( @@ -7589,6 +7646,7 @@ namespace Trk { if (calcderiv && !m_numderiv) { currenttrackpar = m_propagator->propagateParameters( + ctx, *prevtrackpar, *surf, propdir, @@ -7600,6 +7658,7 @@ namespace Trk { ); } else { currenttrackpar = m_propagator->propagateParameters( + ctx, *prevtrackpar, *surf, propdir, @@ -7624,6 +7683,7 @@ namespace Trk { if (calcderiv && !m_numderiv) { currenttrackpar = m_propagator->propagateParameters( + ctx, *prevtrackpar, *surf, propdir, @@ -7635,6 +7695,7 @@ namespace Trk { ); } else { currenttrackpar = m_propagator->propagateParameters( + ctx, *prevtrackpar, *surf, propdir, @@ -7648,7 +7709,7 @@ namespace Trk { if ((currenttrackpar != nullptr) && m_numderiv && calcderiv) { delete jac; - jac = numericalDerivatives(prevtrackpar, surf, propdir, trajectory.m_fieldprop); + jac = numericalDerivatives(ctx, prevtrackpar, surf, propdir, trajectory.m_fieldprop); } if ( @@ -8285,10 +8346,14 @@ namespace Trk { } } - TransportJacobian *GlobalChi2Fitter:: - numericalDerivatives(const TrackParameters * prevpar, - const Surface * surf, PropDirection propdir, - const MagneticFieldProperties * fieldprop) const { + TransportJacobian* + GlobalChi2Fitter::numericalDerivatives( + const EventContext& ctx, + const TrackParameters* prevpar, + const Surface* surf, + PropDirection propdir, + const MagneticFieldProperties* fieldprop) const + { ParamDefsAccessor paraccessor; double J[25] = { 1, 0, 0, 0, 0, @@ -8353,26 +8418,44 @@ namespace Trk { vecminuseps[3], vecminuseps[4], nullptr); - const TrackParameters *newparpluseps = - m_propagator->propagateParameters(*parpluseps, *surf, propdir, false, - *fieldprop, Trk::nonInteracting); - const TrackParameters *newparminuseps = - m_propagator->propagateParameters(*parminuseps, *surf, propdir, false, - *fieldprop, Trk::nonInteracting); + const TrackParameters* newparpluseps = m_propagator->propagateParameters( + ctx, + *parpluseps, + *surf, + propdir, + false, + *fieldprop, + Trk::nonInteracting); + const TrackParameters* newparminuseps = m_propagator->propagateParameters( + ctx, + *parminuseps, + *surf, + propdir, + false, + *fieldprop, + Trk::nonInteracting); PropDirection propdir2 = (propdir == Trk::alongMomentum) ? Trk::oppositeMomentum : Trk::alongMomentum; if (newparpluseps == nullptr) { - newparpluseps = - m_propagator->propagateParameters(*parpluseps, *surf, propdir2, - false, *fieldprop, - Trk::nonInteracting); + newparpluseps = m_propagator->propagateParameters( + ctx, + *parpluseps, + *surf, + propdir2, + false, + *fieldprop, + Trk::nonInteracting); } if (newparminuseps == nullptr) { - newparminuseps = - m_propagator->propagateParameters(*parminuseps, *surf, propdir2, - false, *fieldprop, - Trk::nonInteracting); + newparminuseps = m_propagator->propagateParameters( + ctx, + *parminuseps, + *surf, + propdir2, + false, + *fieldprop, + Trk::nonInteracting); } delete parpluseps; delete parminuseps; @@ -8579,10 +8662,13 @@ namespace Trk { m_fit_status[status]++; } - void Trk::GlobalChi2Fitter::initFieldCache(Cache & cache) const { + void + Trk::GlobalChi2Fitter::initFieldCache(const EventContext& ctx, Cache& cache) + const + { SG::ReadCondHandle rh( m_field_cache_key, - Gaudi::Hive::currentContext() + ctx ); const AtlasFieldCacheCondObj * cond_obj(*rh); -- GitLab From a62264856f490ee3d70dd75b1c89502926520c65 Mon Sep 17 00:00:00 2001 From: Tulay Cuhadar Donszelmann Date: Sun, 7 Jun 2020 15:25:01 +0200 Subject: [PATCH 04/38] fix regression step of jobs in SimExoticsTests --- .../SimExoticsTests/test/test_FullG4_DecayingCharginos.sh | 3 ++- .../SimExoticsTests/test/test_FullG4_DecayingCharginos_busy.sh | 3 ++- .../SimExoticsTests/test/test_FullG4_DecayingLightSleptons.sh | 3 ++- .../SimExoticsTests/test/test_FullG4_DecayingNeutralinos.sh | 3 ++- .../Tests/SimExoticsTests/test/test_FullG4_DecayingStaus.sh | 3 ++- .../Tests/SimExoticsTests/test/test_FullG4_StableCharginos.sh | 3 ++- .../Tests/SimExoticsTests/test/test_FullG4_StableSleptons.sh | 3 ++- 7 files changed, 14 insertions(+), 7 deletions(-) diff --git a/Simulation/Tests/SimExoticsTests/test/test_FullG4_DecayingCharginos.sh b/Simulation/Tests/SimExoticsTests/test/test_FullG4_DecayingCharginos.sh index e565afc1cfa..6a536e8d5a2 100755 --- a/Simulation/Tests/SimExoticsTests/test/test_FullG4_DecayingCharginos.sh +++ b/Simulation/Tests/SimExoticsTests/test/test_FullG4_DecayingCharginos.sh @@ -8,6 +8,7 @@ # art-include: 21.9/Athena # art-include: master/Athena # art-include: master/AthSimulation +# art-output: *.root # MC16 setup # ATLAS-R2-2016-01-00-01 and OFLCOND-MC16-SDR-14 @@ -21,7 +22,7 @@ Sim_tf.py \ --DataRunNumber '284500' \ --geometryVersion 'default:ATLAS-R2-2016-01-00-01' \ --inputEVNTFile "/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/SimCoreTests/mc15_13TeV.448307.MGPy8EG_A14N23LO_mAMSB_C1C1_5000_208000_LL4p0_MET60.evgen.EVNT.e6962.EVNT.15631425._000001.pool.root.1" \ ---outputHITSFile "Hits.pool.root" \ +--outputHITSFile "HITS.pool.root" \ --maxEvents 10 \ --imf False diff --git a/Simulation/Tests/SimExoticsTests/test/test_FullG4_DecayingCharginos_busy.sh b/Simulation/Tests/SimExoticsTests/test/test_FullG4_DecayingCharginos_busy.sh index b25a0f7c603..b8152732a6e 100755 --- a/Simulation/Tests/SimExoticsTests/test/test_FullG4_DecayingCharginos_busy.sh +++ b/Simulation/Tests/SimExoticsTests/test/test_FullG4_DecayingCharginos_busy.sh @@ -8,6 +8,7 @@ # art-include: 21.9/Athena # art-include: master/Athena # art-include: master/AthSimulation +# art-output: *.root # MC16 setup # ATLAS-R2-2016-01-00-01 and OFLCOND-MC16-SDR-14 @@ -21,7 +22,7 @@ Sim_tf.py \ --DataRunNumber '284500' \ --geometryVersion 'default:ATLAS-R2-2016-01-00-01' \ --inputEVNTFile "/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/SimCoreTests/mc15_13TeV.448300.MGPy8EG_A14N23LO_GG_mixedC1LLP_0p2_1400_1200.evgen.EVNT.e7183.EVNT.16706750._000001.pool.root.1" \ ---outputHITSFile "Hits.pool.root" \ +--outputHITSFile "HITS.pool.root" \ --maxEvents 4 \ --imf False diff --git a/Simulation/Tests/SimExoticsTests/test/test_FullG4_DecayingLightSleptons.sh b/Simulation/Tests/SimExoticsTests/test/test_FullG4_DecayingLightSleptons.sh index b04bd95213b..a8e6bb86047 100755 --- a/Simulation/Tests/SimExoticsTests/test/test_FullG4_DecayingLightSleptons.sh +++ b/Simulation/Tests/SimExoticsTests/test/test_FullG4_DecayingLightSleptons.sh @@ -8,6 +8,7 @@ # art-include: 21.9/Athena # art-include: master/Athena # art-include: master/AthSimulation +# art-output: *.root # MC16 setup # ATLAS-R2-2016-01-00-01 and OFLCOND-MC16-SDR-14 @@ -21,7 +22,7 @@ Sim_tf.py \ --DataRunNumber '284500' \ --geometryVersion 'default:ATLAS-R2-2016-01-00-01' \ --inputEVNTFile "/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/SimCoreTests/mc15_13TeV.399030.MGPy8EG_A14NNPDF23LO_SlepSlep_directLLP_100_0_0p01ns.evgen.EVNT.e7067.EVNT.16242732._000001.pool.root.1" \ ---outputHITSFile "Hits.pool.root" \ +--outputHITSFile "HITS.pool.root" \ --maxEvents 10 \ --imf False diff --git a/Simulation/Tests/SimExoticsTests/test/test_FullG4_DecayingNeutralinos.sh b/Simulation/Tests/SimExoticsTests/test/test_FullG4_DecayingNeutralinos.sh index 077572bbb90..c79ddcd3cc9 100755 --- a/Simulation/Tests/SimExoticsTests/test/test_FullG4_DecayingNeutralinos.sh +++ b/Simulation/Tests/SimExoticsTests/test/test_FullG4_DecayingNeutralinos.sh @@ -8,6 +8,7 @@ # art-include: 21.9/Athena # art-include: master/Athena # art-include: master/AthSimulation +# art-output: *.root # MC16 setup # ATLAS-R2-2016-01-00-01 and OFLCOND-MC16-SDR-14 @@ -21,7 +22,7 @@ Sim_tf.py \ --DataRunNumber '284500' \ --geometryVersion 'default:ATLAS-R2-2016-01-00-01' \ --inputEVNTFile "/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/SimCoreTests/mc15_13TeV.448168.MGPy8EG_A14NNPDF23LO_GG_qqn1_2400_850_rpvLF_p01ns.evgen.EVNT.e7245.EVNT.17092338._000002.pool.root.1" \ ---outputHITSFile "Hits.pool.root" \ +--outputHITSFile "HITS.pool.root" \ --maxEvents 10 \ --imf False diff --git a/Simulation/Tests/SimExoticsTests/test/test_FullG4_DecayingStaus.sh b/Simulation/Tests/SimExoticsTests/test/test_FullG4_DecayingStaus.sh index 7b99a767758..09ea0775363 100755 --- a/Simulation/Tests/SimExoticsTests/test/test_FullG4_DecayingStaus.sh +++ b/Simulation/Tests/SimExoticsTests/test/test_FullG4_DecayingStaus.sh @@ -8,6 +8,7 @@ # art-include: 21.9/Athena # art-include: master/Athena # art-include: master/AthSimulation +# art-output: *.root # MC16 setup # ATLAS-R2-2016-01-00-01 and OFLCOND-MC16-SDR-14 @@ -21,7 +22,7 @@ Sim_tf.py \ --DataRunNumber '284500' \ --geometryVersion 'default:ATLAS-R2-2016-01-00-01' \ --inputEVNTFile "/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/SimCoreTests/mc15_13TeV.399007.MGPy8EG_A14NNPDF23LO_StauStau_directLLP_100_0_1ns.evgen.EVNT.e7067.EVNT.16137672._000001.pool.root.1" \ ---outputHITSFile "Hits.pool.root" \ +--outputHITSFile "HITS.pool.root" \ --maxEvents 10 \ --imf False diff --git a/Simulation/Tests/SimExoticsTests/test/test_FullG4_StableCharginos.sh b/Simulation/Tests/SimExoticsTests/test/test_FullG4_StableCharginos.sh index c4aedaefea4..be88e9b2e48 100755 --- a/Simulation/Tests/SimExoticsTests/test/test_FullG4_StableCharginos.sh +++ b/Simulation/Tests/SimExoticsTests/test/test_FullG4_StableCharginos.sh @@ -8,6 +8,7 @@ # art-include: 21.9/Athena # art-include: master/Athena # art-include: master/AthSimulation +# art-output: *.root # MC16 setup # ATLAS-R2-2016-01-00-01 and OFLCOND-MC16-SDR-14 @@ -21,7 +22,7 @@ Sim_tf.py \ --DataRunNumber '284500' \ --geometryVersion 'default:ATLAS-R2-2016-01-00-01' \ --inputEVNTFile "/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/SimCoreTests/mc15_13TeV.404460.MGPy8EG_A14N23LO_mAMSB_C1C1_5000_68000_Stable.evgen.EVNT.e5654.EVNT.13360885._000001.pool.root.1" \ ---outputHITSFile "Hits.pool.root" \ +--outputHITSFile "HITS.pool.root" \ --maxEvents 10 \ --imf False diff --git a/Simulation/Tests/SimExoticsTests/test/test_FullG4_StableSleptons.sh b/Simulation/Tests/SimExoticsTests/test/test_FullG4_StableSleptons.sh index 2abc2a9fe23..136b21d0ed2 100755 --- a/Simulation/Tests/SimExoticsTests/test/test_FullG4_StableSleptons.sh +++ b/Simulation/Tests/SimExoticsTests/test/test_FullG4_StableSleptons.sh @@ -8,6 +8,7 @@ # art-include: 21.9/Athena # art-include: master/Athena # art-include: master/AthSimulation +# art-output: *.root # MC16 setup # ATLAS-R2-2016-01-00-01 and OFLCOND-MC16-SDR-14 @@ -21,7 +22,7 @@ Sim_tf.py \ --DataRunNumber '284500' \ --geometryVersion 'default:ATLAS-R2-2016-01-00-01' \ --inputEVNTFile "/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/SimCoreTests/mc15_13TeV.404510.MGPy8EG_A14N23LO_GMSB_stablestau_lambda_090_tanb_10_dy.evgen.EVNT.e5652.EVNT.13360872._000001.pool.root.1" \ ---outputHITSFile "Hits.pool.root" \ +--outputHITSFile "HITS.pool.root" \ --maxEvents 10 \ --imf False -- GitLab From 1ae4d2ba870f74eb989c83b125e542f1c1139c86 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20K=C3=B6hler?= Date: Mon, 8 Jun 2020 14:46:34 +0200 Subject: [PATCH 05/38] check for nullptr in MuonPhiHitSelector --- .../python/MuonTrackBuildingConfig.py | 2 +- .../MuonRecToolInterfaces/IMuonHitSelector.h | 6 +- .../MuonSegmentCleaner/MuonPhiHitSelector.h | 9 - .../src/MuonPhiHitSelector.cxx | 211 +++++++++--------- .../src/MuPatCandidateTool.cxx | 4 +- 5 files changed, 111 insertions(+), 121 deletions(-) diff --git a/MuonSpectrometer/MuonConfig/python/MuonTrackBuildingConfig.py b/MuonSpectrometer/MuonConfig/python/MuonTrackBuildingConfig.py index 65666dadbd4..262bdcda580 100644 --- a/MuonSpectrometer/MuonConfig/python/MuonTrackBuildingConfig.py +++ b/MuonSpectrometer/MuonConfig/python/MuonTrackBuildingConfig.py @@ -517,7 +517,7 @@ if __name__=="__main__": itemsToRecord = ["TrackCollection#MuonSpectrometerTracks"] SetupMuonStandaloneOutput(cfg, ConfigFlags, itemsToRecord) - cfg.printConfig(withDetails = True, summariseProps = True) + cfg.printConfig(withDetails = True) f=open("MuonTrackBuilding.pkl","wb") cfg.store(f) diff --git a/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonRecToolInterfaces/MuonRecToolInterfaces/IMuonHitSelector.h b/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonRecToolInterfaces/MuonRecToolInterfaces/IMuonHitSelector.h index 1c011fe0b9a..c166cd20fd4 100755 --- a/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonRecToolInterfaces/MuonRecToolInterfaces/IMuonHitSelector.h +++ b/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonRecToolInterfaces/MuonRecToolInterfaces/IMuonHitSelector.h @@ -1,14 +1,15 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef MUON_IMUONHITSELECTOR_H #define MUON_IMUONHITSELECTOR_H -#include #include "GaudiKernel/IAlgTool.h" #include "TrkMeasurementBase/MeasurementBase.h" +#include + static const InterfaceID IID_IMuonHitSelector ("Muon::IMuonHitSelector",1,0); @@ -34,7 +35,6 @@ namespace Muon { virtual std::vector* select_rio( const double pmom, const std::vector& associatedHits, const std::vector& unassociatedHits ) const = 0; - virtual double getPhi() const = 0; }; diff --git a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonSegmentCleaner/MuonSegmentCleaner/MuonPhiHitSelector.h b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonSegmentCleaner/MuonSegmentCleaner/MuonPhiHitSelector.h index f3f056dc874..4f0e992d93f 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonSegmentCleaner/MuonSegmentCleaner/MuonPhiHitSelector.h +++ b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonSegmentCleaner/MuonSegmentCleaner/MuonPhiHitSelector.h @@ -33,9 +33,6 @@ class MuonPhiHitSelector : public AthAlgTool, virtual public Muon::IMuonHitSelec virtual std::vector* select_rio( const double pmom, const std::vector& associatedHits, const std::vector& unassociatedHits ) const; - /** return fitted phi */ - virtual double getPhi()const; - private: ServiceHandle m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; @@ -44,8 +41,6 @@ class MuonPhiHitSelector : public AthAlgTool, virtual public Muon::IMuonHitSelec /** Toolhandle to ClusterOnTrackTool creator */ ToolHandle m_clusterCreator; - /** flag to print out debugging information */ - bool m_debug; /** flag to print out a summary of what comes in and what comes out */ bool m_summary; /** flag for use of cosmics, straight line model will be used, no interaction point constraint */ @@ -55,9 +50,6 @@ class MuonPhiHitSelector : public AthAlgTool, virtual public Muon::IMuonHitSelec /** flag that build competing rios on track for amibguous trigger hits (default: false) */ bool m_competingRios; - /** fitted phi value */ - mutable double m_phi; - /** fit method curved track model */ void fitRecPhi( const double pmom, const std::vector & phiId, const std::vector & phiHitx, const std::vector & phiHity, const std::vector & phiHitz, const std::vector & phiError, std::vector & quality, const int nphi, std::vector & phiPull, std::vector & phiMult, std::vector & phiSelect, double & chi2, double & r0, double & phi, std::vector & errorM, int & nfit) const; @@ -92,6 +84,5 @@ class MuonPhiHitSelector : public AthAlgTool, virtual public Muon::IMuonHitSelec void clusterPhi( const std::vector & id, const std::vector & hitx, const std::vector & hity, const std::vector & hitz, const std::vector & error, const std::vector & pull, std::vector & select, const int n, std::vector & clusterX , std::vector & clusterY ,std::vector & clusterZ , std::vector & clusterError , std::vector & clusterId, std::vector & clusterHits, std::vector & clusterSelect, std::vector & clusterInt, int & ncl ) const; }; -inline double MuonPhiHitSelector::getPhi()const{ return m_phi; } #endif // MuonSegmentCleaner_MuonPhiHitSelector_H diff --git a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonSegmentCleaner/src/MuonPhiHitSelector.cxx b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonSegmentCleaner/src/MuonPhiHitSelector.cxx index ed416fa16fb..0c170f6e714 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonSegmentCleaner/src/MuonPhiHitSelector.cxx +++ b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonSegmentCleaner/src/MuonPhiHitSelector.cxx @@ -30,16 +30,12 @@ MuonPhiHitSelector::MuonPhiHitSelector(const std::string& type,const std::string& name,const IInterface* parent) : AthAlgTool(type,name,parent), m_competingRIOsOnTrackTool("Muon::MuonCompetingClustersOnTrackCreator/MuonCompetingClustersOnTrackCreator"), - m_clusterCreator("Muon::MuonClusterOnTrackCreator/MuonClusterOnTrackCreator"), - m_phi(0) { + m_clusterCreator("Muon::MuonClusterOnTrackCreator/MuonClusterOnTrackCreator") { declareInterface(this); m_cosmics = false; declareProperty("DoCosmics",m_cosmics); - m_debug = false; - declareProperty("DoDebug",m_debug); - m_summary = false; declareProperty("DoSummary",m_summary); @@ -53,10 +49,10 @@ MuonPhiHitSelector::MuonPhiHitSelector(const std::string& type,const std::string StatusCode MuonPhiHitSelector::initialize() { - ATH_MSG_VERBOSE(" MuonPhiHitSelector::Initializing "); - ATH_CHECK( m_competingRIOsOnTrackTool.retrieve() ); - ATH_CHECK( m_clusterCreator.retrieve() ); - ATH_CHECK( m_idHelperSvc.retrieve() ); + ATH_MSG_VERBOSE("MuonPhiHitSelector::Initializing"); + ATH_CHECK(m_competingRIOsOnTrackTool.retrieve()); + ATH_CHECK(m_clusterCreator.retrieve()); + ATH_CHECK(m_idHelperSvc.retrieve()); ATH_MSG_VERBOSE("End of Initializing"); return StatusCode::SUCCESS; } @@ -70,12 +66,11 @@ std::vector* MuonPhiHitSelector::select_rio( const std::vector* selectedHits = new std::vector() ; std::vector* selectedClusters = new std::vector() ; - ATH_MSG_VERBOSE(" Executing MuonPhiHitSelectorTool select_rio "); + ATH_MSG_VERBOSE("Executing MuonPhiHitSelectorTool select_rio "); - m_phi =0.; int nhits = associatedHits.size() + unassociatedHits.size(); - if (m_debug) std::cout << " Executing MuonPhiHitSelectorTool nhits select_rio " << nhits << std::endl; + if (msgLvl(MSG::DEBUG)) ATH_MSG_DEBUG("Executing MuonPhiHitSelectorTool nhits select_rio " << nhits); std::vector phiHitx(nhits); std::vector phiHity(nhits); @@ -95,6 +90,10 @@ std::vector* MuonPhiHitSelector::select_rio( const for(; it != it_end ; ++it ) { const Trk::PrepRawData* prd = (*it)->prepRawData(); + if (!prd) { + ATH_MSG_WARNING("prepRawData of associatedHits is nullptr, continuing..."); + continue; + } Identifier id = prd->identify(); phiId[nphi] = id; Amg::Vector3D gHitPos = (*it)->globalPosition(); @@ -122,7 +121,7 @@ std::vector* MuonPhiHitSelector::select_rio( const Er(1,1) = cov(1,1); Er(1,0) = Er(0,1); - double chi = Er(0,0) != Er(1,1) ? atan(-2*Er(0,1)/(Er(0,0)-Er(1,1)))/2. : 0.; + double chi = Er(0,0) != Er(1,1) ? std::atan(-2*Er(0,1)/(Er(0,0)-Er(1,1)))/2. : 0.; CxxUtils::sincos scchi(chi); @@ -132,15 +131,15 @@ std::vector* MuonPhiHitSelector::select_rio( const Rot(0,1) = scchi.sn; Rot(1,0) = -Rot(0,1); AmgMatrix(2,2) D = Rot.transpose()*Er*Rot; - if (m_debug) std::cout << " Diagonalized error matrix " << D << std::endl; + if (msgLvl(MSG::DEBUG)) ATH_MSG_DEBUG("Diagonalized error matrix " << D); error = D(0,0) < D(1,1) ? D(0,0) : D(1,1); } - phiError[nphi] = sqrt(error); + phiError[nphi] = std::sqrt(error); quality[nphi] = 1000; phiMapId[id] = 1; phiPrep[nphi] = prd; - double phipos = atan2(phiHity[nphi],phiHitx[nphi]); - if (m_debug) std::cout << " phi Segment Hit " << nphi << " det " << phiSelect[nphi] << " phi " << phipos << std::endl; + double phipos = std::atan2(phiHity[nphi],phiHitx[nphi]); + if (msgLvl(MSG::DEBUG)) ATH_MSG_DEBUG("phi Segment Hit " << nphi << " det " << phiSelect[nphi] << " phi " << phipos); nphi++; } int nphiseg = nphi; @@ -165,16 +164,17 @@ std::vector* MuonPhiHitSelector::select_rio( const phiError[nphi] = (*itu)->localCovariance()(Trk::locX); quality[nphi] = 10; phiPrep[nphi] = *itu; - double phipos = atan2(phiHity[nphi],phiHitx[nphi]); - if (m_debug) std::cout << " phi Pattern Hit " << nphi << " phi " << phipos << std::endl; + double phipos = std::atan2(phiHity[nphi],phiHitx[nphi]); + if (msgLvl(MSG::DEBUG)) ATH_MSG_DEBUG("phi Pattern Hit " << nphi << " phi " << phipos); nphi++; } - double chi2,r0; + double chi2(0); + double r0(0); int nfit; std::vector errorM(4); - - fitRecPhi( pmom, phiId, phiHitx, phiHity, phiHitz, phiError, quality, nphi, phiPull, phiMult, phiSelect, chi2, r0, m_phi, errorM, nfit); + double phi(DBL_MAX); + fitRecPhi( pmom, phiId, phiHitx, phiHity, phiHitz, phiError, quality, nphi, phiPull, phiMult, phiSelect, chi2, r0, phi, errorM, nfit); // Define global track parameters (not used 27-8 JS) @@ -199,11 +199,11 @@ std::vector* MuonPhiHitSelector::select_rio( const if (rio) selectedHits->push_back(rio); } - if (m_debug) std::cout << " Make ONE rio per PrepData " << std::endl; + if (msgLvl(MSG::DEBUG)) ATH_MSG_DEBUG("Make ONE rio per PrepData"); } } - if (m_debug||m_summary) { - std::cout << " Fit hit results phi " << m_phi << " chi2 " << chi2 << " segment hits " << nphiseg << " pattern hits " << nphi-nphiseg << " nfit " << nfit << " rio size " << selectedHits->size() << std::endl; + if (msgLvl(MSG::DEBUG)||m_summary) { + ATH_MSG_DEBUG("Fit hit results phi " << phi << " chi2 " << chi2 << " segment hits " << nphiseg << " pattern hits " << nphi-nphiseg << " nfit " << nfit << " rio size " << selectedHits->size()); } std::vector clusterX(nphi); @@ -239,24 +239,24 @@ std::vector* MuonPhiHitSelector::select_rio( const } } if (iic > -1) { - if (m_debug) std::cout << " Phi cluster found np " << np << " ip " << ip << std::endl; + if (msgLvl(MSG::DEBUG)) ATH_MSG_DEBUG("Phi cluster found np " << np << " ip " << ip); if (np ==1) { // Only one PrepData: create RIO on Track const Amg::Vector3D globalpos(clusterX[ic],clusterY[ic],clusterZ[ic]); if (phiSelect[ip] == 1) { - if (m_debug) std::cout << " Phi RPC rio " << std::endl; + if (msgLvl(MSG::DEBUG)) ATH_MSG_DEBUG("Phi RPC rio"); const Muon::RpcPrepData* prd = dynamic_cast (phiPrep[ip]); const Muon::MuonClusterOnTrack* rio = m_clusterCreator->createRIO_OnTrack(*prd,globalpos); if (rio) selectedClusters->push_back(rio); } else if (phiSelect[ip] == 2) { - if (m_debug) std::cout << " Phi TGC rio " << std::endl; + if (msgLvl(MSG::DEBUG)) ATH_MSG_DEBUG("Phi TGC rio"); const Muon::TgcPrepData* prd = dynamic_cast (phiPrep[ip]); const Muon::MuonClusterOnTrack* rio = m_clusterCreator->createRIO_OnTrack(*prd,globalpos); if (rio) selectedClusters->push_back(rio); } else if (phiSelect[ip] == 3) { - if (m_debug) std::cout << " Phi CSC rio " << std::endl; + if (msgLvl(MSG::DEBUG)) ATH_MSG_DEBUG("Phi CSC rio"); const Muon::CscPrepData* prd = dynamic_cast (phiPrep[ip]); const Muon::MuonClusterOnTrack* rio = m_clusterCreator->createRIO_OnTrack(*prd,globalpos); if (rio) selectedClusters->push_back(rio); @@ -265,29 +265,29 @@ std::vector* MuonPhiHitSelector::select_rio( const if (m_competingRios) { // More PrepData's: create Competing RIOs on Track - avError = sqrt(1./avError); + avError = std::sqrt(1./avError); double scaleFactor = clusterError[ic]/avError; const Trk::CompetingRIOsOnTrack* rio = m_competingRIOsOnTrackTool->createBroadCluster(prdList,scaleFactor); if (rio) selectedClusters->push_back(rio); - if (m_debug) std::cout << " Make competing rio/cluster " << " scale factor " << scaleFactor << " number of rios " << prdList.size() << std::endl; + if (msgLvl(MSG::DEBUG)) ATH_MSG_DEBUG("Make competing rio/cluster " << " scale factor " << scaleFactor << " number of rios " << prdList.size()); } else { // Make one Rio for central cluster ip = iic; const Amg::Vector3D globalpos(clusterX[ic],clusterY[ic],clusterZ[ic]); if (phiSelect[ip] == 1) { - if (m_debug) std::cout << " Phi RPC rio central cluster" << std::endl; + if (msgLvl(MSG::DEBUG)) ATH_MSG_DEBUG("Phi RPC rio central cluster"); const Muon::RpcPrepData* prd = dynamic_cast (phiPrep[ip]); const Muon::MuonClusterOnTrack* rio = m_clusterCreator->createRIO_OnTrack(*prd,globalpos); if (rio) selectedClusters->push_back(rio); } else if (phiSelect[ip] == 2) { - if (m_debug) std::cout << " Phi TGC rio central cluster" << std::endl; + if (msgLvl(MSG::DEBUG)) ATH_MSG_DEBUG("Phi TGC rio central cluster"); const Muon::TgcPrepData* prd = dynamic_cast (phiPrep[ip]); const Muon::MuonClusterOnTrack* rio = m_clusterCreator->createRIO_OnTrack(*prd,globalpos); if (rio) selectedClusters->push_back(rio); } else if (phiSelect[ip] == 3) { - if (m_debug) std::cout << " Phi CSC rio central cluster" << std::endl; + if (msgLvl(MSG::DEBUG)) ATH_MSG_DEBUG("Phi CSC rio central cluster"); const Muon::CscPrepData* prd = dynamic_cast (phiPrep[ip]); const Muon::MuonClusterOnTrack* rio = m_clusterCreator->createRIO_OnTrack(*prd,globalpos); if (rio) selectedClusters->push_back(rio); @@ -295,20 +295,18 @@ std::vector* MuonPhiHitSelector::select_rio( const } } }else { - if (m_debug) std::cout << " Phi cluster NOT found " << std::endl; + if (msgLvl(MSG::DEBUG)) ATH_MSG_DEBUG("Phi cluster NOT found "); } } fitPhiSL(pmom, clusterId, clusterX, clusterY, clusterZ, clusterError, clusterSelect, ncl, clusterPull, imax, chi2cl, r0cl, phicl, errorMcl , false ); - if (m_debug||m_summary) { - std::cout << " PhiHitSelector Time spent " << std::clock()/1000-time_start << " nhits " << nhits << " segment hits " << associatedHits.size() << " nfit " << nfit << " nclusters " << ncl << std::endl; - std::cout << " Fit cluster results phi " << phicl << " chi2 " << chi2cl << " number of clusters " << ncl << " size cluster Hits " << selectedClusters->size() << std::endl; + if (msgLvl(MSG::DEBUG)||m_summary) { + ATH_MSG_DEBUG("PhiHitSelector Time spent " << std::clock()/1000-time_start << " nhits " << nhits << " segment hits " << associatedHits.size() << " nfit " << nfit << " nclusters " << ncl); + ATH_MSG_DEBUG("Fit cluster results phi " << phicl << " chi2 " << chi2cl << " number of clusters " << ncl << " size cluster Hits " << selectedClusters->size()); } if (m_makeClusters) { - m_phi = phicl; - std::vector::iterator mit = selectedHits->begin(); for (;mit!=selectedHits->end();++mit){ delete *mit; @@ -351,7 +349,7 @@ void MuonPhiHitSelector::clusterPhi( const std::vector & id, const // phi = azimuthal angle of fit at perigee - if (m_debug) std::cout << " Start phi clustering " << std::endl; + if (msgLvl(MSG::DEBUG)) ATH_MSG_DEBUG("Start phi clustering"); ncl = 0; if (n ==0) return; @@ -422,7 +420,7 @@ void MuonPhiHitSelector::clusterPhi( const std::vector & id, const clusterY[ic]+= hity[i]*w; clusterZ[ic]+= hitz[i]*w; clusterError[ic]+= w; - if ( fabs(pull[i]) < fabs(pullMax)) { + if ( std::abs(pull[i]) < std::abs(pullMax)) { pullMax = pull[i]; clusterId[ic] = id[i]; clusterCode[ic] = scode[i]; @@ -437,9 +435,9 @@ void MuonPhiHitSelector::clusterPhi( const std::vector & id, const clusterY[ic] = clusterY[ic]/clusterError[ic]; clusterZ[ic] = clusterZ[ic]/clusterError[ic]; // Don't assume improvement on errors due to clustering - clusterError[ic]= sqrt(clusterHits[ic])/sqrt(clusterError[ic]); - if (m_debug) { - std::cout << " cluster phi " << ic << " x " << clusterX[ic] << " y " << clusterY[ic] << " z " << clusterZ[ic] << " error " << clusterError[ic] << " hits " << clusterHits[ic] << " select " << clusterSelect[ic] << " Code " << clusterCode[ic] << std::endl; + clusterError[ic]= std::sqrt(clusterHits[ic])/std::sqrt(clusterError[ic]); + if (msgLvl(MSG::DEBUG)) { + ATH_MSG_DEBUG("cluster phi " << ic << " x " << clusterX[ic] << " y " << clusterY[ic] << " z " << clusterZ[ic] << " error " << clusterError[ic] << " hits " << clusterHits[ic] << " select " << clusterSelect[ic] << " Code " << clusterCode[ic]); } } @@ -450,7 +448,7 @@ void MuonPhiHitSelector::fitRecPhi( const double pmom, const std::vectorisTgc(id)) n = 1; else if (m_idHelperSvc->isCsc(id)) n = 1; - error0[i]=phiError[i]*sqrt(n)*fact; - error[i]=phiError[i]*sqrt(n)*fact; - double phiHit = atan2 ( phiHity[i], phiHitx[i] ); - if (m_debug) { - std::cout << i << " Station " << int(scode[i]/1000000) << " Hit x " << phiHitx[i] << " Hit y " << phiHity[i] << " Hit z " << phiHitz[i] << " error " << phiError[i] << " phi Hit " << phiHit << std::endl; - std::cout << " station " << phiSelect[i] << std::endl; - std::cout << " code " << scode[i] << " multiplicity " << n << " error " << error0[i] << " quality " << quality[i] << std::endl; - if ( error0[i] < 1. ) std::cout << " TOO small error " << std::endl; + error0[i]=phiError[i]*std::sqrt(n)*fact; + error[i]=phiError[i]*std::sqrt(n)*fact; + double phiHit = std::atan2 ( phiHity[i], phiHitx[i] ); + if (msgLvl(MSG::DEBUG)) { + ATH_MSG_DEBUG(i << " Station " << int(scode[i]/1000000) << " Hit x " << phiHitx[i] << " Hit y " << phiHity[i] << " Hit z " << phiHitz[i] << " error " << phiError[i] << " phi Hit " << phiHit); + ATH_MSG_DEBUG("station " << phiSelect[i]); + ATH_MSG_DEBUG("code " << scode[i] << " multiplicity " << n << " error " << error0[i] << " quality " << quality[i]); + if ( error0[i] < 1. ) ATH_MSG_DEBUG("TOO small error "); } } } @@ -591,7 +589,7 @@ void MuonPhiHitSelector::fitRecPhi( const double pmom, const std::vector phiReSelect(nphi); for(int i = 0; i < nphi ; ++i ) { - if (m_debug) std::cout << " select " << phiSelect[i] << " quality " << quality[i] << std::endl; + if (msgLvl(MSG::DEBUG)) ATH_MSG_DEBUG("select " << phiSelect[i] << " quality " << quality[i]); phiReSelect[i] = 0; if(phiSelect[i] == 0 && quality[i] > 99) { phiReSelect[i] = 1; @@ -660,16 +657,16 @@ void MuonPhiHitSelector::fitRecPhi( const double pmom, const std::vector 10) { // Shower treatment inflate errors with multiplicity for(int i = 0; i < nphi ; ++i ) { - errorf[i] = error[i]*pow(phiMult[i],power); + errorf[i] = error[i]*std::pow(phiMult[i],power); } } fitPhiSL(pfitc, phiId, phiHitx, phiHity, phiHitz, errorf, phiSelect, nphi, phiPull, imax, chi2, r0, phi, errorM, false ); @@ -716,7 +713,7 @@ void MuonPhiHitSelector::fitRecPhi( const double pmom, const std::vector quacut) { layersRecoHit[srcode[i]]++; - if (m_debug) { + if (msgLvl(MSG::DEBUG)) { if (m_idHelperSvc->isRpc(id)) nrpc++; else if (m_idHelperSvc->isTgc(id)) ntgc++; else if (m_idHelperSvc->isCsc(id)) ncsc++; @@ -730,26 +727,26 @@ void MuonPhiHitSelector::fitRecPhi( const double pmom, const std::vector nphi ) { - if (m_debug) std::cout << " Fitphi imax " << imax << std::endl; + if (msgLvl(MSG::DEBUG)) ATH_MSG_DEBUG("Fitphi imax " << imax); break; } - if (chi2 < 5*(nfit+1) || fabs(phiPull[imax]) < 3.0 ) { + if (chi2 < 5*(nfit+1) || std::abs(phiPull[imax]) < 3.0 ) { - if (m_debug) std::cout << " Final phi " << phi << " frac " << frac << " chi2 " << chi2 << std::endl; + if (msgLvl(MSG::DEBUG)) ATH_MSG_DEBUG("Final phi " << phi << " frac " << frac << " chi2 " << chi2); break; } phiSelect[imax] = 0; - if (m_debug) { - std::cout << " = Start hit dropping " << imax << " pullmax " << phiPull[imax] << " phi " << phi << " chi2 " << chi2 << std::endl; + if (msgLvl(MSG::DEBUG)) { + ATH_MSG_DEBUG("Start hit dropping " << imax << " pullmax " << phiPull[imax] << " phi " << phi << " chi2 " << chi2); } } - if (m_debug) { - std::cout << " Fit results phi " << phi << " chi2 " << chi2 << " ndof " << nfit << std::endl; - std::cout << " Reco RPC " << nrpc << " TGC " << ntgc << " CSC " << ncsc << std::endl; + if (msgLvl(MSG::DEBUG)) { + ATH_MSG_DEBUG("Fit results phi " << phi << " chi2 " << chi2 << " ndof " << nfit); + ATH_MSG_DEBUG("Reco RPC " << nrpc << " TGC " << ntgc << " CSC " << ncsc); } @@ -758,16 +755,16 @@ void MuonPhiHitSelector::fitRecPhi( const double pmom, const std::vector 10 && fabs(pull) > 3.0 && phiSelect[i] > 0 ) { + double pull = phiPull[i]*std::pow(phiMult[i],power); + if (niter > 10 && std::abs(pull) > 3.0 && phiSelect[i] > 0 ) { phiSelect[i] = 0; quality[i] = 0; nshowerdrop++; - if (m_debug) std::cout << " Drop shower hit i " << i << " with pull " << pull << " iterations " << niter << " power " << power << std::endl; + if (msgLvl(MSG::DEBUG)) ATH_MSG_DEBUG("Drop shower hit i " << i << " with pull " << pull << " iterations " << niter << " power " << power); } if( phiSelect[i] != 0) nacc++; } - if(m_debug) std::cout << " phi hits " << nphi << " selected for fit " << nfit << " iqua " << iqua << " iterations " << niter << " accepted hits " << nacc << " nshower drop " << nshowerdrop << std::endl; + if(msgLvl(MSG::DEBUG)) ATH_MSG_DEBUG("phi hits " << nphi << " selected for fit " << nfit << " iqua " << iqua << " iterations " << niter << " accepted hits " << nacc << " nshower drop " << nshowerdrop); } } @@ -812,7 +809,7 @@ void MuonPhiHitSelector::fitPhiSL(const double pmom, const std::vector0) phi = atan2(ycc,xcc); + if (em>0) phi = std::atan2(ycc,xcc); CxxUtils::sincos scphi(phi); r0 = xmc*scphi.sn - ymc*scphi.cs; double x0 = r0*scphi.sn; double y0 = -r0*scphi.cs; - if(m_debug) std::cout << " Constraint r0 " << r0 << " xpos " << xmc << " ypos " << ymc << " phi " << phi << std::endl; + if(msgLvl(MSG::DEBUG)) ATH_MSG_DEBUG("Constraint r0 " << r0 << " xpos " << xmc << " ypos " << ymc << " phi " << phi); // assume 0,0 std::vector d(n); std::vector dist(n); @@ -877,11 +874,11 @@ void MuonPhiHitSelector::fitPhiSL(const double pmom, const std::vector fabs(pullmax)) { + if (std::abs(pull[i])> std::abs(pullmax)) { pullmax = pull[i]; imax = i; } @@ -934,7 +931,7 @@ void MuonPhiHitSelector::fitPhiSL(const double pmom, const std::vector 0.2 ) { - std::cout << " Don't trust fit result " << t(1,0) << " Keep Old result " << std::endl; + if (msgLvl(MSG::DEBUG) && std::abs(t(1,0))> 0.2 ) { + ATH_MSG_DEBUG("Don't trust fit result " << t(1,0) << " Keep Old result"); } - if (fabs(t(1,0))> 0.2) return; + if (std::abs(t(1,0))> 0.2) return; // calculate residuals and chi2 std::vector resi(2*nfit); @@ -1023,9 +1020,11 @@ void MuonPhiHitSelector::fitPhiSL(const double pmom, const std::vector=3) { std::cout << " Error angle " << covTI(3,3) << std::endl;} // covTI has dim nfit+1 - std::cout << " errorM[3] " << errorM[3] << std::endl; + if(msgLvl(MSG::DEBUG)) { + if (nfit>=3) { + ATH_MSG_DEBUG("Error angle " << covTI(3,3)); + } // covTI has dim nfit+1 + ATH_MSG_DEBUG("errorM[3] " << errorM[3]); } for(int i = 0; i < 2*nfit ; ++i ) { @@ -1035,8 +1034,8 @@ void MuonPhiHitSelector::fitPhiSL(const double pmom, const std::vector 0) { - // double errinvOut = sqrt(err2invOut); resiOut[i] = (ypred/error2 - yf[i]*inv_ef_i2)/err2invOut - yf[i]; - // pullOut[i] = resiOut[i]*errinvOut; - pullOut[i] = resiOut[i]/sqrt(1./err2invOut+ef_i2); + pullOut[i] = resiOut[i]/std::sqrt(1./err2invOut+ef_i2); } - if (fabs(pullOut[i]) > fabs(pullmax) && i < nfit ) { + if (std::abs(pullOut[i]) > std::abs(pullmax) && i < nfit ) { imax = indexf[i]; jmax = i; pullmax = pullOut[i]; @@ -1072,16 +1069,16 @@ void MuonPhiHitSelector::fitPhiSL(const double pmom, const std::vector nfit) std::cout << " i " << i << " ypred " << ypred << " mst " << yf[i] << " residual " << resi[i] << " error " << ef[i] << std::endl; + if (msgLvl(MSG::DEBUG)&& i < nfit) ATH_MSG_DEBUG("i " << i << " index " << indexf[i] << " det " << select[indexf[i]] << " ypred " << ypred << " mst " << yf[i] << " residual " << resi[i] << " error " << ef[i] << " dist " << dist[i] << " hitz " << hitz[i] << " Pull " << pulli[i] << " Pullf " << pullf[i] << " resi out " << resiOut[i] << " pull out " << pullOut[i]); + if (msgLvl(MSG::DEBUG)&& i > nfit) ATH_MSG_DEBUG("i " << i << " ypred " << ypred << " mst " << yf[i] << " residual " << resi[i] << " error " << ef[i]); } r0 = r0 + t(0,0); phi = phi + t(1,0); - if (m_debug ) std::cout << " delta phi " << t(1,0) << std::endl; - if (m_debug && fabs(t(1,0))> 0.1 ) std::cout << " ALARM delta phi " << t(1,0) << std::endl; + if (msgLvl(MSG::DEBUG) ) ATH_MSG_DEBUG("delta phi " << t(1,0)); + if (msgLvl(MSG::DEBUG) && std::abs(t(1,0))> 0.1 ) ATH_MSG_DEBUG("ALARM delta phi " << t(1,0)); - if(m_debug) std:: cout<< " Track parameters r0 " << r0 << " phi " << phi << " chi2 " << chi2 << " jmax " << jmax << " imax " << imax << " pullmax " << pullmax << std::endl; + if(msgLvl(MSG::DEBUG)) ATH_MSG_DEBUG("Track parameters r0 " << r0 << " phi " << phi << " chi2 " << chi2 << " jmax " << jmax << " imax " << imax << " pullmax " << pullmax); } diff --git a/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackSteeringTools/src/MuPatCandidateTool.cxx b/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackSteeringTools/src/MuPatCandidateTool.cxx index 17d8facbf3e..10bb2098dd7 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackSteeringTools/src/MuPatCandidateTool.cxx +++ b/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackSteeringTools/src/MuPatCandidateTool.cxx @@ -374,7 +374,9 @@ namespace Muon { entry.nrpcHitsPhi = nrpcHitsPhi; entry.ntgcHitsEta = ntgcHitsEta; entry.ntgcHitsPhi = ntgcHitsPhi; + if (!triggerHitsEta.empty() && etaHits.size()==0) ATH_MSG_WARNING("did not find any eta hits"); entry.setEtaHits(etaHits); + if (!triggerHitsPhi.empty() && phiHits.size()==0) ATH_MSG_WARNING("did not find any phi hits"); entry.setPhiHits(phiHits); entry.setFakePhiHits(fakePhiHits); entry.setAllHits(allHits); @@ -462,7 +464,7 @@ namespace Muon { if (prd){ prds.push_back( prd ); } else { - ATH_MSG_ERROR("MuonClusterOnTrack has no PRD."); + ATH_MSG_WARNING("MuonClusterOnTrack has no PRD."); } } -- GitLab From e2f2993a05b15952f149739d7714ab6ce509ea37 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20K=C3=B6hler?= Date: Mon, 8 Jun 2020 16:22:46 +0200 Subject: [PATCH 06/38] remove atomic TrackingVolume pointer by setting it in initialize --- .../CombinedMuonTrackBuilder.h | 7 ++--- .../src/CombinedMuonTrackBuilder.cxx | 29 +++++++++---------- 2 files changed, 15 insertions(+), 21 deletions(-) diff --git a/Reconstruction/MuonIdentification/MuidTrackBuilder/MuidTrackBuilder/CombinedMuonTrackBuilder.h b/Reconstruction/MuonIdentification/MuidTrackBuilder/MuidTrackBuilder/CombinedMuonTrackBuilder.h index 32a3cc6e9ed..6846bb64107 100755 --- a/Reconstruction/MuonIdentification/MuidTrackBuilder/MuidTrackBuilder/CombinedMuonTrackBuilder.h +++ b/Reconstruction/MuonIdentification/MuidTrackBuilder/MuidTrackBuilder/CombinedMuonTrackBuilder.h @@ -221,8 +221,7 @@ class CombinedMuonTrackBuilder : public AthAlgTool, virtual public ICombinedMuon ToolHandle m_trackSummary; ToolHandle m_materialUpdator; - ServiceHandle m_idHelperSvc{this, "MuonIdHelperSvc", - "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; + ServiceHandle m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; // Read handle for conditions object to get the field cache SG::ReadCondHandleKey m_fieldCacheCondObjInputKey {this, "AtlasFieldCacheCondObj", "fieldCondObj", "Name of the Magnetic Field conditions object key"}; @@ -265,9 +264,7 @@ class CombinedMuonTrackBuilder : public AthAlgTool, virtual public ICombinedMuon // constants const Trk::Volume* m_calorimeterVolume; const Trk::Volume* m_indetVolume; - - // constant initialized the first time it's needed - mutable std::atomic m_spectrometerEntrance{nullptr}; + const Trk::TrackingVolume* m_spectrometerEntrance; // vertex region and phi modularity for pseudo-measurement constraints Trk::RecVertex* m_beamAxis; diff --git a/Reconstruction/MuonIdentification/MuidTrackBuilder/src/CombinedMuonTrackBuilder.cxx b/Reconstruction/MuonIdentification/MuidTrackBuilder/src/CombinedMuonTrackBuilder.cxx index bbeeef5eb04..bf8204a11ef 100755 --- a/Reconstruction/MuonIdentification/MuidTrackBuilder/src/CombinedMuonTrackBuilder.cxx +++ b/Reconstruction/MuonIdentification/MuidTrackBuilder/src/CombinedMuonTrackBuilder.cxx @@ -107,6 +107,7 @@ CombinedMuonTrackBuilder::CombinedMuonTrackBuilder(const std::string& type, cons m_inputSlimming(false), m_calorimeterVolume(nullptr), m_indetVolume(nullptr), + m_spectrometerEntrance(nullptr), m_beamAxis(nullptr), m_perigeeSurface(nullptr), m_sigmaPhiSector(0), @@ -366,6 +367,15 @@ CombinedMuonTrackBuilder::initialize() m_vertex->dump(msg(MSG::DEBUG)); #endif + if (!m_trackingGeometrySvc) { + m_perigeeAtSpectrometerEntranceLocal = false; + // missing TrackingGeometrySvc - no perigee will be added at MS entrance + m_messageHelper->printWarning(41); + } else { + const Trk::TrackingGeometry* trkGeo = m_trackingGeometrySvc->trackingGeometry(); + if (trkGeo) m_spectrometerEntrance = trkGeo->trackingVolume("MuonSpectrometerEntrance"); + } + return StatusCode::SUCCESS; } @@ -3916,27 +3926,14 @@ CombinedMuonTrackBuilder::entrancePerigee(const Trk::TrackParameters* parameters // make sure the spectrometer entrance volume is available if (!parameters) return nullptr; - if (!m_spectrometerEntrance.load()) { - if (!m_trackingGeometrySvc) { - m_perigeeAtSpectrometerEntranceLocal = false; - // missing TrackingGeometrySvc - no perigee will be added at MS entrance - m_messageHelper->printWarning(41); - } else { - m_spectrometerEntrance.store( - m_trackingGeometrySvc->trackingGeometry()->trackingVolume("MuonSpectrometerEntrance")); - } - } - - if (!m_spectrometerEntrance.load()) { - return nullptr; - } + if (!m_spectrometerEntrance) return nullptr; const Trk::TrackParameters* entranceParameters = m_extrapolator->extrapolateToVolume( - *parameters, *m_spectrometerEntrance.load(), Trk::anyDirection, Trk::nonInteracting); + *parameters, *m_spectrometerEntrance, Trk::anyDirection, Trk::nonInteracting); if (!entranceParameters) return nullptr; - Trk::PerigeeSurface surface(entranceParameters->position()); + Trk::PerigeeSurface surface(entranceParameters->position()); const Trk::TrackParameters* trackParameters = m_extrapolator->extrapolateDirectly(*entranceParameters, surface); delete entranceParameters; -- GitLab From 34bf961161796a54d92d508f46e7d055f612b55e Mon Sep 17 00:00:00 2001 From: Savanna Marie Shaw Date: Mon, 8 Jun 2020 16:44:21 +0200 Subject: [PATCH 07/38] Change muon trigger input maker to merge by feature Since we can find multiple SA muons in a single view, changing the input maker for the subsequent steps to merge-by-feature instead of merge-by-roi as discussed in ATR-21548. Reference updated since this affects the way the features are counted. --- .../share/ref_RDOtoRDOTrig_mt1_build.ref | 26 +++++++++---------- .../HLTMenuConfig/Muon/MuonSequenceSetup.py | 1 + 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/Trigger/TrigValidation/TrigAnalysisTest/share/ref_RDOtoRDOTrig_mt1_build.ref b/Trigger/TrigValidation/TrigAnalysisTest/share/ref_RDOtoRDOTrig_mt1_build.ref index d126bbd2492..869acfa17a0 100644 --- a/Trigger/TrigValidation/TrigAnalysisTest/share/ref_RDOtoRDOTrig_mt1_build.ref +++ b/Trigger/TrigValidation/TrigAnalysisTest/share/ref_RDOtoRDOTrig_mt1_build.ref @@ -39,31 +39,31 @@ TrigSignatureMoniMT INFO -- #557204938 Events TrigSignatureMoniMT INFO -- #557204938 Features 12 4 4 4 - - TrigSignatureMoniMT INFO HLT_2mu4_bDimu_L12MU4 #1730084172 TrigSignatureMoniMT INFO -- #1730084172 Events 4 4 4 4 4 4 - - 1 -TrigSignatureMoniMT INFO -- #1730084172 Features 16 16 24 11 - - +TrigSignatureMoniMT INFO -- #1730084172 Features 16 16 24 19 - - TrigSignatureMoniMT INFO HLT_2mu4_bJpsimumu_L12MU4 #4276347155 TrigSignatureMoniMT INFO -- #4276347155 Events 4 4 4 4 4 4 - - 1 -TrigSignatureMoniMT INFO -- #4276347155 Features 16 16 24 11 - - +TrigSignatureMoniMT INFO -- #4276347155 Features 16 16 24 19 - - TrigSignatureMoniMT INFO HLT_2mu4_bUpsimumu_L12MU4 #4008168535 TrigSignatureMoniMT INFO -- #4008168535 Events 4 4 4 4 4 4 - - 0 -TrigSignatureMoniMT INFO -- #4008168535 Features 16 16 24 10 - - +TrigSignatureMoniMT INFO -- #4008168535 Features 16 16 24 18 - - TrigSignatureMoniMT INFO HLT_2mu4_muonqual_L12MU4 #1584776935 TrigSignatureMoniMT INFO -- #1584776935 Events 4 4 4 4 4 4 - - 4 -TrigSignatureMoniMT INFO -- #1584776935 Features 16 16 24 20 - - +TrigSignatureMoniMT INFO -- #1584776935 Features 16 16 24 36 - - TrigSignatureMoniMT INFO HLT_2mu6Comb_L12MU6 #2046267508 TrigSignatureMoniMT INFO -- #2046267508 Events 4 4 4 3 - - - - 3 TrigSignatureMoniMT INFO -- #2046267508 Features 16 12 - - - - TrigSignatureMoniMT INFO HLT_2mu6_10invm70_L1MU6 #1316992871 TrigSignatureMoniMT INFO -- #1316992871 Events 10 10 4 3 3 3 2 - 0 -TrigSignatureMoniMT INFO -- #1316992871 Features 16 12 18 16 2 - +TrigSignatureMoniMT INFO -- #1316992871 Features 16 12 18 28 2 - TrigSignatureMoniMT INFO HLT_2mu6_Dr_L12MU4 #3304584056 TrigSignatureMoniMT INFO -- #3304584056 Events 4 4 4 3 - - - - 3 TrigSignatureMoniMT INFO -- #3304584056 Features 16 12 - - - - TrigSignatureMoniMT INFO HLT_2mu6_L12MU6 #1747073535 TrigSignatureMoniMT INFO -- #1747073535 Events 4 4 4 3 3 3 - - 3 -TrigSignatureMoniMT INFO -- #1747073535 Features 16 12 18 16 - - +TrigSignatureMoniMT INFO -- #1747073535 Features 16 12 18 28 - - TrigSignatureMoniMT INFO HLT_2mu6_muonqual_L12MU6 #2398136098 TrigSignatureMoniMT INFO -- #2398136098 Events 4 4 4 3 3 3 - - 3 -TrigSignatureMoniMT INFO -- #2398136098 Features 16 12 18 16 - - +TrigSignatureMoniMT INFO -- #2398136098 Features 16 12 18 28 - - TrigSignatureMoniMT INFO HLT_3j200_L1J100 #2199422919 TrigSignatureMoniMT INFO -- #2199422919 Events 3 3 0 - - - - - 0 TrigSignatureMoniMT INFO -- #2199422919 Features 0 - - - - - @@ -366,22 +366,22 @@ TrigSignatureMoniMT INFO -- #996392590 Events TrigSignatureMoniMT INFO -- #996392590 Features 14 13 - - - - TrigSignatureMoniMT INFO HLT_mu6_L1MU6 #2560542253 TrigSignatureMoniMT INFO -- #2560542253 Events 10 10 10 10 10 10 - - 10 -TrigSignatureMoniMT INFO -- #2560542253 Features 14 13 16 15 - - +TrigSignatureMoniMT INFO -- #2560542253 Features 14 13 16 21 - - TrigSignatureMoniMT INFO HLT_mu6_idperf_L1MU6 #934918532 TrigSignatureMoniMT INFO -- #934918532 Events 10 10 10 10 10 10 - - 10 -TrigSignatureMoniMT INFO -- #934918532 Features 14 14 17 18 - - +TrigSignatureMoniMT INFO -- #934918532 Features 14 14 17 27 - - TrigSignatureMoniMT INFO HLT_mu6_ivarmedium_L1MU6 #1012713062 TrigSignatureMoniMT INFO -- #1012713062 Events 10 10 10 10 10 10 6 - 6 -TrigSignatureMoniMT INFO -- #1012713062 Features 14 13 16 15 6 - +TrigSignatureMoniMT INFO -- #1012713062 Features 14 13 16 21 6 - TrigSignatureMoniMT INFO HLT_mu6_msonly_L1MU6 #3895421032 TrigSignatureMoniMT INFO -- #3895421032 Events 10 10 10 0 10 - - - 10 TrigSignatureMoniMT INFO -- #3895421032 Features 14 0 17 - - - TrigSignatureMoniMT INFO HLT_mu6_mu4_L12MU4 #1713982776 TrigSignatureMoniMT INFO -- #1713982776 Events 4 4 4 4 4 4 - - 4 -TrigSignatureMoniMT INFO -- #1713982776 Features 8 8 12 10 - - +TrigSignatureMoniMT INFO -- #1713982776 Features 8 8 12 18 - - TrigSignatureMoniMT INFO HLT_mu6_mu6noL1_L1MU6 #451489897 TrigSignatureMoniMT INFO -- #451489897 Events 10 10 10 10 10 10 6 4 4 -TrigSignatureMoniMT INFO -- #451489897 Features 14 13 16 15 9 7 +TrigSignatureMoniMT INFO -- #451489897 Features 14 13 16 21 9 7 TrigSignatureMoniMT INFO HLT_mu6fast_L1MU6 #3518031697 TrigSignatureMoniMT INFO -- #3518031697 Events 10 10 10 - - - - - 10 TrigSignatureMoniMT INFO -- #3518031697 Features 14 - - - - - @@ -390,7 +390,7 @@ TrigSignatureMoniMT INFO -- #761101109 Events TrigSignatureMoniMT INFO -- #761101109 Features 10 0 0 - - - TrigSignatureMoniMT INFO HLT_mu8_L1MU6 #1467711434 TrigSignatureMoniMT INFO -- #1467711434 Events 10 10 10 10 10 10 - - 10 -TrigSignatureMoniMT INFO -- #1467711434 Features 14 13 15 15 - - +TrigSignatureMoniMT INFO -- #1467711434 Features 14 13 15 19 - - TrigSignatureMoniMT INFO HLT_noalg_L1EM10VH #314199913 TrigSignatureMoniMT INFO -- #314199913 Events 11 11 - - - - - - 11 TrigSignatureMoniMT INFO -- #314199913 Features - - - - - - diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Muon/MuonSequenceSetup.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Muon/MuonSequenceSetup.py index 1d49eeb29e5..b2b522ddb74 100644 --- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Muon/MuonSequenceSetup.py +++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Muon/MuonSequenceSetup.py @@ -269,6 +269,7 @@ def muEFCBAlgSequence(ConfigFlags): # efcbViewsMaker.RequireParentView = True efcbViewsMaker.ViewFallThrough = True + efcbViewsMaker.mergeUsingFeature = True #outside-in reco sequence muEFCBRecoSequence, sequenceOutCB = muEFCBRecoSequence( efcbViewsMaker.InViewRoIs, "RoI" ) -- GitLab From 6002fc5f156bb2232671f3ddf53938ad74586a52 Mon Sep 17 00:00:00 2001 From: Mark Hodgkinson Date: Mon, 8 Jun 2020 17:15:57 +0200 Subject: [PATCH 08/38] Bug fix to remove RDO from list of output files. --- .../test/test_reco_tf_compare_SerialAndThreadedAthenas.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Reconstruction/RecExample/RecExRecoTest/test/test_reco_tf_compare_SerialAndThreadedAthenas.sh b/Reconstruction/RecExample/RecExRecoTest/test/test_reco_tf_compare_SerialAndThreadedAthenas.sh index abfa1f3e0ad..be3c32849b0 100755 --- a/Reconstruction/RecExample/RecExRecoTest/test/test_reco_tf_compare_SerialAndThreadedAthenas.sh +++ b/Reconstruction/RecExample/RecExRecoTest/test/test_reco_tf_compare_SerialAndThreadedAthenas.sh @@ -2,7 +2,7 @@ echo "Creating new serial directory" mkdir serial; cd serial -Reco_tf.py --AMI=$1 --preExec='RAWtoESD:from AthenaMonitoring.DQMonFlags import jobproperties;jobproperties.DQMonFlagsCont.doMonitoring.set_Value_and_Lock(False)' --outputRDOFile=myRDO.pool.root --outputAODFile=myAOD.pool.root --outputESDFile=myESD.pool.root | tee athenaSerial.log +Reco_tf.py --AMI=$1 --preExec='RAWtoESD:from AthenaMonitoring.DQMonFlags import jobproperties;jobproperties.DQMonFlagsCont.doMonitoring.set_Value_and_Lock(False)' --outputAODFile=myAOD.pool.root --outputESDFile=myESD.pool.root | tee athenaSerial.log rc=${PIPESTATUS[0]} echo "art-result: $rc Serial" @@ -12,7 +12,7 @@ cd ../ echo "Creating new threadOne directory" mkdir threadOne; cd threadOne -Reco_tf.py --athenaopts="--threads=1" --AMI=$1 --preExec='RAWtoESD:from AthenaMonitoring.DQMonFlags import jobproperties;jobproperties.DQMonFlagsCont.doMonitoring.set_Value_and_Lock(False)' --outputRDOFile=myRDO.pool.root --outputAODFile=myAOD.pool.root --outputESDFile=myESD.pool.root | tee athenaOneThread.log +Reco_tf.py --athenaopts="--threads=1" --AMI=$1 --preExec='RAWtoESD:from AthenaMonitoring.DQMonFlags import jobproperties;jobproperties.DQMonFlagsCont.doMonitoring.set_Value_and_Lock(False)' --outputAODFile=myAOD.pool.root --outputESDFile=myESD.pool.root | tee athenaOneThread.log rc1=${PIPESTATUS[0]} echo "art-result: $rc1 OneThread" @@ -33,7 +33,7 @@ cd ../ echo "Creating new threadTwo directory" mkdir threadTwo; cd threadTwo -Reco_tf.py --athenaopts="--threads=2" --AMI=$1 --preExec='RAWtoESD:from AthenaMonitoring.DQMonFlags import jobproperties;jobproperties.DQMonFlagsCont.doMonitoring.set_Value_and_Lock(False)' --outputRDOFile=myRDO.pool.root --outputAODFile=myAOD.pool.root --outputESDFile=myESD.pool.root | tee athenaTwoThreads.log +Reco_tf.py --athenaopts="--threads=2" --AMI=$1 --preExec='RAWtoESD:from AthenaMonitoring.DQMonFlags import jobproperties;jobproperties.DQMonFlagsCont.doMonitoring.set_Value_and_Lock(False)' --outputAODFile=myAOD.pool.root --outputESDFile=myESD.pool.root | tee athenaTwoThreads.log rc2=${PIPESTATUS[0]} echo "art-result: $rc2 TwoThreads" @@ -50,7 +50,7 @@ cd ../ echo "Creating new threadFive directory" mkdir threadFive; cd threadFive -Reco_tf.py --athenaopts="--threads=5" --AMI=$1 --preExec='RAWtoESD:from AthenaMonitoring.DQMonFlags import jobproperties;jobproperties.DQMonFlagsCont.doMonitoring.set_Value_and_Lock(False)' --outputRDOFile=myRDO.pool.root --outputAODFile=myAOD.pool.root --outputESDFile=myESD.pool.root | tee athenaFiveThreads.log +Reco_tf.py --athenaopts="--threads=5" --AMI=$1 --preExec='RAWtoESD:from AthenaMonitoring.DQMonFlags import jobproperties;jobproperties.DQMonFlagsCont.doMonitoring.set_Value_and_Lock(False)' --outputAODFile=myAOD.pool.root --outputESDFile=myESD.pool.root | tee athenaFiveThreads.log rc5=${PIPESTATUS[0]} echo "art-result: $rc5 FiveThreads" -- GitLab From a6cc8dd8c167860443bffe406e6e743f1134dd82 Mon Sep 17 00:00:00 2001 From: Nora Emilia Pettersson Date: Mon, 8 Jun 2020 17:50:03 +0200 Subject: [PATCH 09/38] Increasing CaloClusterEt from 3 to 4.5GeV for TRT Segmentfinding --- .../TRT_TrackSegmentsFinder/TRT_TrackSegmentsFinder.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/InnerDetector/InDetRecAlgs/TRT_TrackSegmentsFinder/TRT_TrackSegmentsFinder/TRT_TrackSegmentsFinder.h b/InnerDetector/InDetRecAlgs/TRT_TrackSegmentsFinder/TRT_TrackSegmentsFinder/TRT_TrackSegmentsFinder.h index a735d8e5970..ce378e6f6d0 100755 --- a/InnerDetector/InDetRecAlgs/TRT_TrackSegmentsFinder/TRT_TrackSegmentsFinder/TRT_TrackSegmentsFinder.h +++ b/InnerDetector/InDetRecAlgs/TRT_TrackSegmentsFinder/TRT_TrackSegmentsFinder/TRT_TrackSegmentsFinder.h @@ -50,7 +50,7 @@ namespace InDet { {this, "MinNumberDriftCircles", 9, "Minimum number of DriftCircles for a TRT segment."}; Gaudi::Property m_ClusterEt - {this, "CaloClusterEt", 3000.0, "Minimum ET of calo clusters in MeV too seed the TRT segment finder."}; + {this, "CaloClusterEt", 4500.0, "Minimum ET of calo clusters in MeV too seed the TRT segment finder."}; SG::ReadHandleKey m_caloKey {this, "InputClusterContainerName", "InDetCaloClusterROIs", "Location of the optional Calo cluster seeds."}; -- GitLab From 97f78e9714af46f6b81069fa2b9abd6b15254c69 Mon Sep 17 00:00:00 2001 From: scott snyder Date: Mon, 8 Jun 2020 16:29:10 +0200 Subject: [PATCH 10/38] AtlasDetDescr: is_muon checks. In the muon subsystem checks is_rpc, etc, we first need to ensure that is_muon passes. Otherwise, we can crash if called for a non-muon identifier. --- .../AtlasDetDescr/AtlasDetDescr/AtlasDetectorID.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/DetectorDescription/AtlasDetDescr/AtlasDetDescr/AtlasDetectorID.h b/DetectorDescription/AtlasDetDescr/AtlasDetDescr/AtlasDetectorID.h index 0ddfceb4815..3989c77f00a 100755 --- a/DetectorDescription/AtlasDetDescr/AtlasDetDescr/AtlasDetectorID.h +++ b/DetectorDescription/AtlasDetDescr/AtlasDetDescr/AtlasDetectorID.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef ATLASDETDESCR_ATLASDETECTORID_H @@ -765,6 +765,7 @@ inline bool AtlasDetectorID::is_mdt(Identifier id) const { bool result = false; + if (!is_muon(id)) return false; unsigned int stationNameIndex = m_muon_station_name_impl.unpack(id); unsigned int techBit = m_muon_tech_bits[stationNameIndex]; // MDT and RPC can only be destinguished by the additional bit in the ID @@ -780,6 +781,7 @@ inline bool AtlasDetectorID::is_rpc(Identifier id) const { bool result = false; + if (!is_muon(id)) return false; unsigned int stationNameIndex = m_muon_station_name_impl.unpack(id); unsigned int techBit = m_muon_tech_bits[stationNameIndex]; // MDT and RPC can only be destinguished by the additional bit in the ID @@ -795,6 +797,7 @@ inline bool AtlasDetectorID::is_csc(Identifier id) const { bool result = false; + if (!is_muon(id)) return false; unsigned int stationNameIndex = m_muon_station_name_impl.unpack(id); unsigned int techBit = m_muon_tech_bits[stationNameIndex]; result = (is_muon(id) && (techBit == AtlasDetDescr::fAtlasCSC)); @@ -805,6 +808,7 @@ inline bool AtlasDetectorID::is_tgc(Identifier id) const { bool result = false; + if (!is_muon(id)) return false; unsigned int stationNameIndex = m_muon_station_name_impl.unpack(id); unsigned int techBit = m_muon_tech_bits[stationNameIndex]; result = (is_muon(id) && (techBit == AtlasDetDescr::fAtlasTGC)); @@ -815,6 +819,7 @@ inline bool AtlasDetectorID::is_mm(Identifier id) const { bool result = false; + if (!is_muon(id)) return false; unsigned int stationNameIndex = m_muon_station_name_impl.unpack(id); unsigned int techBit = m_muon_tech_bits[stationNameIndex]; result = (is_muon(id) && (techBit == AtlasDetDescr::fAtlasMM)); @@ -825,6 +830,7 @@ inline bool AtlasDetectorID::is_stgc(Identifier id) const { bool result = false; + if (!is_muon(id)) return false; unsigned int stationNameIndex = m_muon_station_name_impl.unpack(id); unsigned int techBit = m_muon_tech_bits[stationNameIndex]; result = (is_muon(id) && (techBit == AtlasDetDescr::fAtlasSTGC)); -- GitLab From d68db07a50e113844f2f2481eb9ad949d1eafd10 Mon Sep 17 00:00:00 2001 From: scott snyder Date: Mon, 8 Jun 2020 16:26:33 +0200 Subject: [PATCH 11/38] TrigNavTools: Remove references to ThinningSvc. The old thinning service is now not used from here. Remove references to it. --- .../share/TrigNavigationSlimming_test.py | 1 - .../src/TrigNavigationThinningSvc.cxx | 192 +----------------- .../src/TrigNavigationThinningSvc.h | 118 +---------- 3 files changed, 3 insertions(+), 308 deletions(-) diff --git a/Trigger/TrigEvent/TrigNavTools/share/TrigNavigationSlimming_test.py b/Trigger/TrigEvent/TrigNavTools/share/TrigNavigationSlimming_test.py index e6d1d6443e6..e903cce2ebe 100644 --- a/Trigger/TrigEvent/TrigNavTools/share/TrigNavigationSlimming_test.py +++ b/Trigger/TrigEvent/TrigNavTools/share/TrigNavigationSlimming_test.py @@ -1,5 +1,4 @@ from OutputStreamAthenaPool.MultipleStreamManager import MSMgr -from AthenaServices.Configurables import ThinningSvc, createThinningSvc from PyUtils.MetaReaderPeeker import convert_itemList inputObjects = convert_itemList(layout=None) diff --git a/Trigger/TrigEvent/TrigNavTools/src/TrigNavigationThinningSvc.cxx b/Trigger/TrigEvent/TrigNavTools/src/TrigNavigationThinningSvc.cxx index 193bf23d525..c9603466873 100644 --- a/Trigger/TrigEvent/TrigNavTools/src/TrigNavigationThinningSvc.cxx +++ b/Trigger/TrigEvent/TrigNavTools/src/TrigNavigationThinningSvc.cxx @@ -7,206 +7,16 @@ TrigNavigationThinningSvc::TrigNavigationThinningSvc( const std::string& name, ISvcLocator* pSvcLocator ) - : AthService(name, pSvcLocator), - m_workerThinning("ThinningSvc", name), + : base_class(name, pSvcLocator), m_slimmingTool("TrigNavigationSlimmingTool/TrigNavigationSlimmingTool") { - declareProperty("WorkerThinningSvc", m_workerThinning, "Service which deals wiht all requests except the navigation"); declareProperty("SlimmingTool", m_slimmingTool, "Tool responsible for the actual thinning"); } StatusCode TrigNavigationThinningSvc::initialize() { - CHECK( m_workerThinning.retrieve() ); - CHECK( m_slimmingTool.retrieve() ); return StatusCode::SUCCESS; } -StatusCode TrigNavigationThinningSvc::reinitialize() { - return StatusCode::SUCCESS; -} -StatusCode TrigNavigationThinningSvc::finalize() { - return StatusCode::SUCCESS; -} - - -StatusCode TrigNavigationThinningSvc::queryInterface(const InterfaceID& rrid, void** ppvInterface) { - if ( IThinningSvc::interfaceID().versionMatch(rrid)) { - *ppvInterface = (IThinningSvc*)this; - } else if ( ITrigNavigationThinningSvc::interfaceID().versionMatch(rrid) ) { - *ppvInterface = (ITrigNavigationThinningSvc*)this; - } else { - return Service::queryInterface(rrid, ppvInterface); - } - - return StatusCode::SUCCESS; -} - - - - - -// forwards of ThinningSvc -bool TrigNavigationThinningSvc::thinningOccurred() const { - return m_workerThinning->thinningOccurred(); - } - - -StatusCode TrigNavigationThinningSvc::register_slimmer (Athena::ISlimmingHdlr *handler) { - return m_workerThinning->register_slimmer(handler); -} - -Athena::IThinningHdlr* TrigNavigationThinningSvc::handler( SG::DataProxy* proxy ) { - return m_workerThinning->handler(proxy); -} - -StatusCode TrigNavigationThinningSvc::filter_impl( Athena::IThinningHdlr* handler, - SG::DataProxy* proxy, - const IThinningSvc::Filter_t& filter, - const IThinningSvc::Operator::Type op) { - return m_workerThinning->filter_impl(handler, proxy, filter, op); -} - - - -StatusCode TrigNavigationThinningSvc::commit() { - return m_workerThinning->commit(); -} - - -StatusCode TrigNavigationThinningSvc::rollback() { - return m_workerThinning->rollback(); -} - - - -std::size_t TrigNavigationThinningSvc::index_impl( const SG::DataProxy* objProxy, - std::size_t idx ) const { - return m_workerThinning->index_impl(objProxy, idx); -} - - - -bool TrigNavigationThinningSvc::is_thinned_impl(const SG::DataProxy* p) const { - return m_workerThinning->is_thinned_impl(p); -} - -// IIncidentListener -void TrigNavigationThinningSvc::handle( const Incident& incident ) { - IIncidentListener *incidentListener(0); - if( m_workerThinning->queryInterface(IIncidentListener::interfaceID(), (void**)&incidentListener).isFailure() ) { - ATH_MSG_WARNING("Worker ThinningSvc " << m_workerThinning.type() - <<"/" << m_workerThinning.name() - <<" can not be querried for IncidentListerner interface"); - - } - if ( incidentListener ) - incidentListener->handle(incident); - else - ATH_MSG_WARNING("Worker ThinningSvc " << m_workerThinning.type() - <<"/" << m_workerThinning.name() - <<" does not implement IncidentListener interface, request can not be handled"); -} - - - - /// get proxy for a given data object address in memory -SG::DataProxy* TrigNavigationThinningSvc::proxy( const void* const pTransient ) const { - return m_workerThinning->proxy(pTransient); -} - -/// get proxy with given id and key. Returns 0 to flag failure -SG::DataProxy* TrigNavigationThinningSvc::proxy( const CLID& id, const std::string& key ) const { - return m_workerThinning->proxy(id, key); -} - -/// Get proxy given a hashed key+clid. -/// Find an exact match; no handling of aliases, etc. -/// Returns 0 to flag failure. -SG::DataProxy* TrigNavigationThinningSvc::proxy_exact (SG::sgkey_t sgkey) const { - return m_workerThinning->proxy_exact(sgkey); -} - -/// return the list of all current proxies in store -std::vector TrigNavigationThinningSvc::proxies() const { - return m_workerThinning->proxies(); -} - -/// Add a new proxy to the store. -StatusCode TrigNavigationThinningSvc::addToStore (CLID id, SG::DataProxy* proxy) { - return m_workerThinning->addToStore(id, proxy); -} -/// Record an object in the store. -SG::DataProxy* -TrigNavigationThinningSvc::recordObject (SG::DataObjectSharedPtr obj, - const std::string& key, - bool allowMods, - bool returnExisting) -{ - return m_workerThinning->recordObject (std::move(obj), key, - allowMods, returnExisting); -} - - -/** - * @brief Find the key for a string/CLID pair. - * @param str The string to look up. - * @param clid The CLID associated with the string. - * @return A key identifying the string. - * A given string will always return the same key. - * Will abort in case of a hash collision! - */ -SG::sgkey_t -TrigNavigationThinningSvc::stringToKey (const std::string& str, CLID clid) -{ - return m_workerThinning->stringToKey (str, clid); -} - -/** - * @brief Find the string corresponding to a given key. - * @param key The key to look up. - * @return Pointer to the string found, or null. - * We can find keys as long as the corresponding string - * was given to either @c stringToKey() or @c registerKey(). - */ -const std::string* -TrigNavigationThinningSvc::keyToString (SG::sgkey_t key) const -{ - return m_workerThinning->keyToString (key); -} - -/** - * @brief Find the string and CLID corresponding to a given key. - * @param key The key to look up. - * @param clid[out] The found CLID. - * @return Pointer to the string found, or null. - * We can find keys as long as the corresponding string - * was given to either @c stringToKey() or @c registerKey(). - */ -const std::string* -TrigNavigationThinningSvc::keyToString (SG::sgkey_t key, - CLID& clid) const -{ - return m_workerThinning->keyToString (key, clid); -} - -/** - * @brief Remember an additional mapping from key to string/CLID. - * @param key The key to enter. - * @param str The string to enter. - * @param clid The CLID associated with the string. - * @return True if successful; false if the @c key already - * corresponds to a different string. - * - * This registers an additional mapping from a key to a string; - * it can be found later through @c lookup() on the string. - * Logs an error if @c key already corresponds to a different string. - */ -void TrigNavigationThinningSvc::registerKey (SG::sgkey_t key, - const std::string& str, - CLID clid) -{ - return m_workerThinning->registerKey (key, str, clid); -} diff --git a/Trigger/TrigEvent/TrigNavTools/src/TrigNavigationThinningSvc.h b/Trigger/TrigEvent/TrigNavTools/src/TrigNavigationThinningSvc.h index d6a90764130..0cbf780ef25 100644 --- a/Trigger/TrigEvent/TrigNavTools/src/TrigNavigationThinningSvc.h +++ b/Trigger/TrigEvent/TrigNavTools/src/TrigNavigationThinningSvc.h @@ -9,21 +9,18 @@ #include "GaudiKernel/IIncidentListener.h" #include "AthenaBaseComps/AthService.h" -#include "AthenaKernel/IThinningSvc.h" #include "AthenaKernel/ITrigNavigationThinningSvc.h" #include "TrigNavTools/TrigNavigationSlimmingTool.h" -class TrigNavigationThinningSvc : virtual public IThinningSvc, virtual public ITrigNavigationThinningSvc, virtual public AthService, virtual public IIncidentListener { +class TrigNavigationThinningSvc : public extends +{ public: TrigNavigationThinningSvc( const std::string& name, ISvcLocator* pSvcLocator ); virtual StatusCode initialize() override; - virtual StatusCode reinitialize() override; - virtual StatusCode finalize() override; - virtual StatusCode queryInterface(const InterfaceID& rrid, void** ppvInterface) override; // specifics of ITrigNavigationThinning @@ -31,121 +28,10 @@ public: std::vector& slimmed_and_serialized ) const override { return m_slimmingTool->doSlimming(slimmed_and_serialized); } - // forwards of ThinningSvc - virtual bool thinningOccurred() const override; - - virtual - StatusCode register_slimmer (Athena::ISlimmingHdlr *handler) override; - - virtual Athena::IThinningHdlr* handler( SG::DataProxy* proxy ) override; - - virtual StatusCode - filter_impl( Athena::IThinningHdlr* handler, - SG::DataProxy* proxy, - const IThinningSvc::Filter_t& filter, - const IThinningSvc::Operator::Type op = Operator::And ) override; - - - virtual - StatusCode commit() override; - - virtual - StatusCode rollback() override; - - virtual - std::size_t index_impl( const SG::DataProxy* objProxy, - std::size_t idx ) const override; - - - virtual - bool is_thinned_impl(const SG::DataProxy* p) const override; - - // IIncidentListener - void handle( const Incident& incident ) override; - - - ///@{ @c IProxyDict interface - using IProxyDict::proxy; - - /// get proxy for a given data object address in memory - virtual SG::DataProxy* proxy( const void* const pTransient ) const override; - - /// get proxy with given id and key. Returns 0 to flag failure - virtual SG::DataProxy* proxy( const CLID& id, const std::string& key ) const override; - - /// Get proxy given a hashed key+clid. - /// Find an exact match; no handling of aliases, etc. - /// Returns 0 to flag failure. - virtual SG::DataProxy* proxy_exact (SG::sgkey_t sgkey) const override; - - /// return the list of all current proxies in store - std::vector proxies() const override; - - /// Add a new proxy to the store. - virtual StatusCode addToStore (CLID id, SG::DataProxy* proxy) override; - - /// Record an object in the store. - virtual SG::DataProxy* recordObject (SG::DataObjectSharedPtr obj, - const std::string& key, - bool allowMods, - bool returnExisting) override; - - - /** - * @brief Find the key for a string/CLID pair. - * @param str The string to look up. - * @param clid The CLID associated with the string. - * @return A key identifying the string. - * A given string will always return the same key. - * Will abort in case of a hash collision! - */ - virtual - SG::sgkey_t stringToKey (const std::string& str, CLID clid) override; - - /** - * @brief Find the string corresponding to a given key. - * @param key The key to look up. - * @return Pointer to the string found, or null. - * We can find keys as long as the corresponding string - * was given to either @c stringToKey() or @c registerKey(). - */ - virtual - const std::string* keyToString (SG::sgkey_t key) const override; - - /** - * @brief Find the string and CLID corresponding to a given key. - * @param key The key to look up. - * @param clid[out] The found CLID. - * @return Pointer to the string found, or null. - * We can find keys as long as the corresponding string - * was given to either @c stringToKey() or @c registerKey(). - */ - virtual - const std::string* keyToString (SG::sgkey_t key, - CLID& clid) const override; - - /** - * @brief Remember an additional mapping from key to string/CLID. - * @param key The key to enter. - * @param str The string to enter. - * @param clid The CLID associated with the string. - * @return True if successful; false if the @c key already - * corresponds to a different string. - * - * This registers an additional mapping from a key to a string; - * it can be found later through @c lookup() on the string. - * Logs an error if @c key already corresponds to a different string. - */ - virtual - void registerKey (SG::sgkey_t key, - const std::string& str, - CLID clid) override; private: - ServiceHandle m_workerThinning; ToolHandle m_slimmingTool; - }; -- GitLab From 3383da4dc85b404d983e15fa9dbf724b81af0ee9 Mon Sep 17 00:00:00 2001 From: christos Date: Tue, 9 Jun 2020 01:04:09 +0200 Subject: [PATCH 12/38] IPATFitter event context aware --- .../TrkiPatFitter/ATLAS_CHECK_THREAD_SAFETY | 1 + .../TrkiPatFitter/MaterialAllocator.h | 2 +- .../TrkiPatFitter/TrkiPatFitter/iPatFitter.h | 225 ++++++++++-------- .../TrkiPatFitter/src/MaterialAllocator.cxx | 40 ++-- .../TrkiPatFitter/src/iPatFitter.cxx | 222 ++++++++++------- .../TrkiPatFitter/src/iPatGlobalFitter.cxx | 8 +- 6 files changed, 289 insertions(+), 209 deletions(-) diff --git a/Tracking/TrkFitter/TrkiPatFitter/TrkiPatFitter/ATLAS_CHECK_THREAD_SAFETY b/Tracking/TrkFitter/TrkiPatFitter/TrkiPatFitter/ATLAS_CHECK_THREAD_SAFETY index e69de29bb2d..662149c44a7 100644 --- a/Tracking/TrkFitter/TrkiPatFitter/TrkiPatFitter/ATLAS_CHECK_THREAD_SAFETY +++ b/Tracking/TrkFitter/TrkiPatFitter/TrkiPatFitter/ATLAS_CHECK_THREAD_SAFETY @@ -0,0 +1 @@ +Tracking/TrkFitter/TrkiPatFitter diff --git a/Tracking/TrkFitter/TrkiPatFitter/TrkiPatFitter/MaterialAllocator.h b/Tracking/TrkFitter/TrkiPatFitter/TrkiPatFitter/MaterialAllocator.h index 83a817e9f1e..ee94bd319f7 100755 --- a/Tracking/TrkFitter/TrkiPatFitter/TrkiPatFitter/MaterialAllocator.h +++ b/Tracking/TrkFitter/TrkiPatFitter/TrkiPatFitter/MaterialAllocator.h @@ -101,7 +101,7 @@ private: const TrackParameters& parameters, const Surface& surface, PropDirection dir, - BoundaryCheck boundsCheck, + const BoundaryCheck& boundsCheck, ParticleHypothesis particleHypothesis, Garbage_t& garbage) const; diff --git a/Tracking/TrkFitter/TrkiPatFitter/TrkiPatFitter/iPatFitter.h b/Tracking/TrkFitter/TrkiPatFitter/TrkiPatFitter/iPatFitter.h index 2d87fb1779f..7621b2dacb9 100755 --- a/Tracking/TrkFitter/TrkiPatFitter/TrkiPatFitter/iPatFitter.h +++ b/Tracking/TrkFitter/TrkiPatFitter/TrkiPatFitter/iPatFitter.h @@ -5,12 +5,9 @@ #ifndef TRKIPATFITTER_IPATFITTER_H #define TRKIPATFITTER_IPATFITTER_H -#include -#include -#include #include "AthenaBaseComps/AthAlgTool.h" -#include "GaudiKernel/ServiceHandle.h" #include "GaudiKernel/ToolHandle.h" +#include "GaudiKernel/EventContext.h" #include "TrkiPatFitterUtils/FitMeasurement.h" #include "TrkiPatFitterUtils/FitParameters.h" #include "TrkiPatFitterUtils/IMaterialAllocator.h" @@ -29,6 +26,9 @@ #include "TrkiPatFitterUtils/MessageHelper.h" #include "TrkiPatFitterUtils/FitProcedure.h" +#include +#include +#include namespace Trk { class FitQuality; @@ -56,47 +56,60 @@ public: // RunOutlierRemoval - use logic to remove bad hits /* - * Bring in default impl with + * Bring in default impl without * EventContext for now */ using ITrackFitter::fit; // refit a track - virtual Track* fit (const Track&, - const RunOutlierRemoval runOutlier=false, - const ParticleHypothesis particleHypothesis=Trk::nonInteracting) const override; + virtual std::unique_ptr fit( + const EventContext& ctx, + const Track&, + const RunOutlierRemoval runOutlier = false, + const ParticleHypothesis particleHypothesis = Trk::nonInteracting) const override; // refit a track adding a PrepRawDataSet - virtual Track* fit (const Track&, + virtual std::unique_ptr fit ( + const EventContext& ctx, + const Track&, const PrepRawDataSet&, const RunOutlierRemoval runOutlier=false, const ParticleHypothesis particleHypothesis=Trk::nonInteracting) const override; // fit a set of PrepRawData objects - virtual Track* fit (const PrepRawDataSet&, - const TrackParameters& perigeeStartValue, - const RunOutlierRemoval runOutlier=false, - const ParticleHypothesis particleHypothesis=Trk::nonInteracting) const override; + virtual std::unique_ptr fit( + const EventContext& ctx, + const PrepRawDataSet&, + const TrackParameters& perigeeStartValue, + const RunOutlierRemoval runOutlier = false, + const ParticleHypothesis particleHypothesis = Trk::nonInteracting) const override; // refit a track adding a MeasurementSet - virtual Track* fit (const Track&, - const MeasurementSet&, - const RunOutlierRemoval runOutlier=false, - const ParticleHypothesis particleHypothesis=Trk::nonInteracting) const override; + virtual std::unique_ptr fit( + const EventContext& ctx, + const Track&, + const MeasurementSet&, + const RunOutlierRemoval runOutlier = false, + const ParticleHypothesis particleHypothesis = + Trk::nonInteracting) const override; // fit a set of MeasurementBase objects with starting value for perigeeParameters - virtual Track* fit (const MeasurementSet&, - const TrackParameters& perigeeStartValue, - const RunOutlierRemoval runOutlier=false, - const ParticleHypothesis particleHypothesis=Trk::nonInteracting) const override; + virtual std::unique_ptr fit( + const EventContext& ctx, + const MeasurementSet&, + const TrackParameters& perigeeStartValue, + const RunOutlierRemoval runOutlier = false, + const ParticleHypothesis particleHypothesis = Trk::nonInteracting) const override; // combined muon fit - virtual Track* fit (const Track&, - const Track&, - const RunOutlierRemoval runOutlier=false, - const ParticleHypothesis particleHypothesis=Trk::nonInteracting) const override; - -protected: + virtual std::unique_ptr fit( + const EventContext& ctx, + const Track&, + const Track&, + const RunOutlierRemoval runOutlier = false, + const ParticleHypothesis particleHypothesis = Trk::nonInteracting) const override; + + protected: class FitState { public: ~FitState() { @@ -145,6 +158,7 @@ protected: // fitWithState that creates and returns state std::pair, std::unique_ptr> fitWithState ( + const EventContext& ctx, const Track&, const RunOutlierRemoval runOutlier=false, const ParticleHypothesis particleHypothesis=Trk::nonInteracting) const; @@ -158,74 +172,95 @@ protected: private: // add MeasurementSet - void addMeasurements (std::vector& measurements, - const MeasurementSet& measurementSet, - const FitParameters& parameters) const; - - // add TrackStateOnSurfaces (true means material already allocated on trackTSOS) - bool addMeasurements (std::vector& measurements, - const FitParameters& parameters, - ParticleHypothesis particleHypothesis, - const DataVector& trackTSOS) const; - - // perform fit - Track* performFit( - FitState& fitState, - const ParticleHypothesis particleHypothesis, - const TrackInfo& trackInfo, - const DataVector* leadingTSOS, - const FitQuality* perigeeQuality, - Garbage_t& garbage) const; - - // print TSOS on a track (debugging aid) - void printTSOS (const Track&) const; - - void refit( - FitState& fitState, - const Track& track, - const RunOutlierRemoval runOutlier, - const ParticleHypothesis particleHypothesis) const; - - // configurables (tools and options) - Gaudi::Property m_aggregateMaterial {this, "AggregateMaterial", true}; - Gaudi::Property m_asymmetricCaloEnergy {this, "AsymmetricCaloEnergy", true}; - Gaudi::Property m_fullCombinedFit {this, "FullCombinedFit", true}; - Gaudi::Property m_lineFit {this, "LineFit", false}; - Gaudi::Property m_lineMomentum {this, "LineMomentum", 100. * Gaudi::Units::GeV}; - ToolHandle m_materialAllocator; - ToolHandle m_rungeKuttaIntersector; - ToolHandle m_solenoidalIntersector; - ToolHandle m_stepPropagator; - ToolHandle m_straightLineIntersector; - ServiceHandle m_trackingVolumesSvc; - ToolHandle m_trackSummaryTool; - - // configurable tolerances, warnings - Gaudi::Property m_orderingTolerance {this, "OrderingTolerance", 1. * Gaudi::Units::mm}; - Gaudi::Property m_maxWarnings {this, "MaxNumberOfWarnings", 10, - "Maximum number of permitted WARNING messages per message type."}; - - // configurables for validation purposes - Gaudi::Property m_constrainedAlignmentEffects {this, "ConstrainedAlignmentEffects", false}; - Gaudi::Property m_extendedDebug {this, "ExtendedDebug", false}; - Gaudi::Property m_forcedRefitsForValidation {this, "ForcedRefitsForValidation", 0}; - Gaudi::Property m_maxIterations {this, "MaxIterations", 25}; - - // constants - std::unique_ptr m_calorimeterVolume; - std::unique_ptr m_indetVolume; - Trk::MagneticFieldProperties m_stepField; - - // counters - mutable std::atomic m_countFitAttempts = 0; - mutable std::atomic m_countGoodFits = 0; - mutable std::atomic m_countIterations = 0; - mutable std::atomic m_countRefitAttempts = 0; - mutable std::atomic m_countGoodRefits = 0; - mutable std::atomic m_countRefitIterations = 0; - - // count warnings - mutable std::unique_ptr m_messageHelper ATLAS_THREAD_SAFE; // MessageHelper is thread-safe + void addMeasurements(const EventContext& ctx, + std::vector& measurements, + const MeasurementSet& measurementSet, + const FitParameters& parameters) const; + + // add TrackStateOnSurfaces (true means material already allocated on + // trackTSOS) + bool addMeasurements( + const EventContext& ctx, + std::vector& measurements, + const FitParameters& parameters, + ParticleHypothesis particleHypothesis, + const DataVector& trackTSOS) const; + + // perform fit + std::unique_ptr performFit( + FitState& fitState, + const ParticleHypothesis particleHypothesis, + const TrackInfo& trackInfo, + const DataVector* leadingTSOS, + const FitQuality* perigeeQuality, + Garbage_t& garbage) const; + + // print TSOS on a track (debugging aid) + void printTSOS(const Track&) const; + + void refit(const EventContext& ctx, + FitState& fitState, + const Track& track, + const RunOutlierRemoval runOutlier, + const ParticleHypothesis particleHypothesis) const; + + // configurables (tools and options) + Gaudi::Property m_aggregateMaterial{ this, "AggregateMaterial", true }; + Gaudi::Property m_asymmetricCaloEnergy{ this, + "AsymmetricCaloEnergy", + true }; + Gaudi::Property m_fullCombinedFit{ this, "FullCombinedFit", true }; + Gaudi::Property m_lineFit{ this, "LineFit", false }; + Gaudi::Property m_lineMomentum{ this, + "LineMomentum", + 100. * Gaudi::Units::GeV }; + ToolHandle m_materialAllocator; + ToolHandle m_rungeKuttaIntersector; + ToolHandle m_solenoidalIntersector; + ToolHandle m_stepPropagator; + ToolHandle m_straightLineIntersector; + ServiceHandle m_trackingVolumesSvc; + ToolHandle m_trackSummaryTool; + + // configurable tolerances, warnings + Gaudi::Property m_orderingTolerance{ this, + "OrderingTolerance", + 1. * Gaudi::Units::mm }; + Gaudi::Property m_maxWarnings{ + this, + "MaxNumberOfWarnings", + 10, + "Maximum number of permitted WARNING messages per message type." + }; + + // configurables for validation purposes + Gaudi::Property m_constrainedAlignmentEffects{ + this, + "ConstrainedAlignmentEffects", + false + }; + Gaudi::Property m_extendedDebug{ this, "ExtendedDebug", false }; + Gaudi::Property m_forcedRefitsForValidation{ this, + "ForcedRefitsForValidation", + 0 }; + Gaudi::Property m_maxIterations{ this, "MaxIterations", 25 }; + + // constants + std::unique_ptr m_calorimeterVolume; + std::unique_ptr m_indetVolume; + Trk::MagneticFieldProperties m_stepField; + + // counters + mutable std::atomic m_countFitAttempts = 0; + mutable std::atomic m_countGoodFits = 0; + mutable std::atomic m_countIterations = 0; + mutable std::atomic m_countRefitAttempts = 0; + mutable std::atomic m_countGoodRefits = 0; + mutable std::atomic m_countRefitIterations = 0; + + // count warnings + mutable std::unique_ptr m_messageHelper + ATLAS_THREAD_SAFE; // MessageHelper is thread-safe }; diff --git a/Tracking/TrkFitter/TrkiPatFitter/src/MaterialAllocator.cxx b/Tracking/TrkFitter/TrkiPatFitter/src/MaterialAllocator.cxx index be5e4226be8..427273883f5 100755 --- a/Tracking/TrkFitter/TrkiPatFitter/src/MaterialAllocator.cxx +++ b/Tracking/TrkFitter/TrkiPatFitter/src/MaterialAllocator.cxx @@ -102,35 +102,35 @@ namespace Trk if (m_extrapolator.retrieve().isFailure()) { ATH_MSG_FATAL("Failed to retrieve tool " << m_extrapolator); return StatusCode::FAILURE; - } else { + } ATH_MSG_INFO("Retrieved tool " << m_extrapolator); - } + if (m_intersector.retrieve().isFailure()) { ATH_MSG_FATAL("Failed to retrieve tool " << m_intersector); return StatusCode::FAILURE; - } else { + } ATH_MSG_INFO("Retrieved tool " << m_intersector); - } + // retrieve services if (m_trackingGeometrySvc.retrieve().isFailure()) { ATH_MSG_FATAL("Failed to retrieve Svc " << m_trackingGeometrySvc); return StatusCode::FAILURE; - } else { + } ATH_MSG_INFO("Retrieved Svc " << m_trackingGeometrySvc); - } + // need to create the IndetExit and MuonEntrance TrackingVolumes if (m_trackingVolumesSvc.retrieve().isFailure()) { ATH_MSG_FATAL("Failed to retrieve Svc " << m_trackingVolumesSvc); return StatusCode::FAILURE; - } else { + } ATH_MSG_INFO("Retrieved Svc " << m_trackingVolumesSvc); m_calorimeterVolume = new Volume( m_trackingVolumesSvc->volume(ITrackingVolumesSvc::MuonSpectrometerEntryLayer)); m_indetVolume = new Volume( m_trackingVolumesSvc->volume(ITrackingVolumesSvc::CalorimeterEntryLayer)); - } + if (m_useStepPropagator > 0 && m_stepPropagator.retrieve().isFailure()) { ATH_MSG_FATAL("Failed to retrieve Svc " << m_stepPropagator); @@ -252,8 +252,8 @@ namespace Trk if (haveDelimiter && intersection && surface && m_indetVolume->inside(endPosition)) { // debug if (msgLvl(MSG::VERBOSE)) { - Amg::Vector3D direction = intersection->direction(); - Amg::Vector3D startPosition = intersection->position(); + const Amg::Vector3D& direction = intersection->direction(); + const Amg::Vector3D& startPosition = intersection->position(); ATH_MSG_VERBOSE(" addLeadingMaterial: using extrapolateM from distance " << direction.dot(fitParameters.position() - startPosition)); } @@ -489,7 +489,7 @@ namespace Trk && leadingOutlier->intersection(FittedTrajectory).position().perp() > radius) { leadingOutliers.pop_back(); measurements.insert(measurements.begin(), leadingOutlier); - if (leadingOutliers.size()) { + if (!leadingOutliers.empty()) { leadingOutlier = leadingOutliers.back(); } else { leadingOutlier = nullptr; @@ -723,9 +723,9 @@ namespace Trk // missing TrackingGeometrySvc - no leading material will be added m_messageHelper->printWarning(0); return nullptr; - } else { + } createSpectrometerEntranceOnce(); - } + } // check input parameters are really in the spectrometer @@ -759,7 +759,7 @@ namespace Trk garbage); delete entranceParameters; if (!extrapolatedTSOS - || !extrapolatedTSOS->size() + || extrapolatedTSOS->empty() || !extrapolatedTSOS->front()->trackParameters()) { ATH_MSG_VERBOSE(std::setiosflags(std::ios::fixed) << "leadingSpectrometerTSOS: no material found from RZ" @@ -1115,7 +1115,7 @@ namespace Trk const TrackParameters& parameters, const Surface& surface, PropDirection dir, - BoundaryCheck boundsCheck, + const BoundaryCheck& boundsCheck, ParticleHypothesis particleHypothesis, Garbage_t& garbage) const { // fix up material duplication appearing after recent TrackingGeometry speed-up @@ -1405,7 +1405,7 @@ namespace Trk if (!materialSurface) continue; // or if it's already been allocated upstream - if (surfaces.size() && materialSurface == surfaces.back()) continue; + if (!surfaces.empty() && materialSurface == surfaces.back()) continue; // skip leading material during the fit (up to and including first measurement) // insert an materialDelimiter so the leading material can be allocated after the fit converges @@ -1539,7 +1539,7 @@ namespace Trk ATH_MSG_INFO("segment material aggregation " << material.size()); FitMeasurement* measurement1 = nullptr; FitMeasurement* measurement2 = nullptr; - if (!material.size()) return std::pair(measurement1, measurement2); + if (material.empty()) return std::pair(measurement1, measurement2); Amg::Vector3D* referencePosition = nullptr; @@ -2113,7 +2113,7 @@ namespace Trk ATH_MSG_VERBOSE("measurements and material: distance X0 deltaE E pT" << " R phi Z DoF phi theta"); - if (!measurements.size()) return; + if (measurements.empty()) return; std::vector::iterator m = measurements.begin(); while (m != measurements.end() @@ -2320,9 +2320,9 @@ namespace Trk // missing TrackingGeometrySvc - no spectrometer material added m_messageHelper->printWarning(2); return; - } else { + } createSpectrometerEntranceOnce(); - } + } // entranceParameters are at the MS entrance surface (0 if perigee downstream) diff --git a/Tracking/TrkFitter/TrkiPatFitter/src/iPatFitter.cxx b/Tracking/TrkFitter/TrkiPatFitter/src/iPatFitter.cxx index 05b7a54a139..813a059c211 100755 --- a/Tracking/TrkFitter/TrkiPatFitter/src/iPatFitter.cxx +++ b/Tracking/TrkFitter/TrkiPatFitter/src/iPatFitter.cxx @@ -112,10 +112,10 @@ namespace Trk if (handle.retrieve().isFailure()) { ATH_MSG_FATAL("Failed to retrieve tool " << handle); return false; - } else { + } ATH_MSG_INFO("Retrieved tool " << handle); return true; - } + }; if (!retrieveTool(m_materialAllocator)) { return StatusCode::FAILURE; } if (!retrieveTool(m_rungeKuttaIntersector)) { return StatusCode::FAILURE; } @@ -127,13 +127,13 @@ namespace Trk if (m_trackingVolumesSvc.retrieve().isFailure()) { ATH_MSG_FATAL("Failed to retrieve Svc " << m_trackingVolumesSvc); return StatusCode::FAILURE; - } else { + } ATH_MSG_INFO("Retrieved Svc " << m_trackingVolumesSvc); m_calorimeterVolume = std::make_unique( m_trackingVolumesSvc->volume(ITrackingVolumesSvc::MuonSpectrometerEntryLayer)); m_indetVolume = std::make_unique( m_trackingVolumesSvc->volume(ITrackingVolumesSvc::CalorimeterEntryLayer)); - } + ATH_CHECK(m_trackSummaryTool.retrieve()); @@ -194,10 +194,11 @@ namespace Trk return StatusCode::SUCCESS; } - auto iPatFitter::fitWithState( - const Track& track, - const RunOutlierRemoval runOutlier, - const ParticleHypothesis particleHypothesis) const + auto + iPatFitter::fitWithState(const EventContext& ctx, + const Track& track, + const RunOutlierRemoval runOutlier, + const ParticleHypothesis particleHypothesis) const -> std::pair, std::unique_ptr> { ATH_MSG_VERBOSE(" track fit "); @@ -246,7 +247,8 @@ namespace Trk fitState->newMeasurements(); - bool haveMaterial = addMeasurements(fitState->getMeasurements(), + bool haveMaterial = addMeasurements(ctx, + fitState->getMeasurements(), *fitState->parameters, particleHypothesis, *track.trackStateOnSurfaces()); @@ -273,47 +275,54 @@ namespace Trk // validation for (int i = 0; i < m_forcedRefitsForValidation; ++i) { - if (fittedTrack) { refit(*fitState, *fittedTrack, runOutlier, particleHypothesis); } + if (fittedTrack) { refit(ctx,*fitState, *fittedTrack, runOutlier, particleHypothesis); } } return {std::move(fittedTrack), std::move(fitState)}; } - Track* - iPatFitter::fit(const Track& track, + std::unique_ptr + iPatFitter::fit(const EventContext& ctx, + const Track& track, const RunOutlierRemoval runOutlier, const ParticleHypothesis particleHypothesis) const { - auto [fittedTrack, fitState] = fitWithState(track, runOutlier, particleHypothesis); - return fittedTrack.release(); + auto [fittedTrack, fitState] = fitWithState(ctx,track, runOutlier, particleHypothesis); + return std::move(fittedTrack); } - Track* - iPatFitter::fit(const Track& /*track*/, + std::unique_ptr + iPatFitter::fit(const EventContext&, + const Track& /*track*/, const PrepRawDataSet& /*prepRawDataSet*/, const RunOutlierRemoval /*trackrunOutlier*/, - const ParticleHypothesis /*trackparticleHypothesis*/) const { + const ParticleHypothesis /*trackparticleHypothesis*/) const + { m_countFitAttempts++; // track + PrepRawDataSet interface not implemented m_messageHelper->printWarning(3); return nullptr; } - Track* - iPatFitter::fit(const PrepRawDataSet& /*prepRawDataSet*/, + std::unique_ptr + iPatFitter::fit(const EventContext&, + const PrepRawDataSet& /*prepRawDataSet*/, const TrackParameters& /*estimatedParametersNearOrigin*/, const RunOutlierRemoval /*trackrunOutlier*/, - const ParticleHypothesis /*trackparticleHypothesis*/) const { + const ParticleHypothesis /*trackparticleHypothesis*/) const + { m_countFitAttempts++; // PrepRawDataSet interface not implemented m_messageHelper->printWarning(4); return nullptr; } - Track* - iPatFitter::fit(const Track& track, + std::unique_ptr + iPatFitter::fit(const EventContext& ctx, + const Track& track, const MeasurementSet& measurementSet, const RunOutlierRemoval runOutlier, - const ParticleHypothesis particleHypothesis) const { + const ParticleHypothesis particleHypothesis) const + { ATH_MSG_VERBOSE(" track + measurementSet fit "); m_countFitAttempts++; // outlier removal not implemented @@ -338,12 +347,15 @@ namespace Trk // set up the measurements (and material) fitState.newMeasurements(); - if (addMeasurements(fitState.getMeasurements(), *fitState.parameters, particleHypothesis, - *track.trackStateOnSurfaces())) m_messageHelper->printWarning(8); // FIX needed: material may - // get double counted - addMeasurements(fitState.getMeasurements(), - measurementSet, - *fitState.parameters); + if (addMeasurements(ctx, + fitState.getMeasurements(), + *fitState.parameters, + particleHypothesis, + *track.trackStateOnSurfaces())) + m_messageHelper->printWarning(8); // FIX needed: material may + // get double counted + addMeasurements( + ctx, fitState.getMeasurements(), measurementSet, *fitState.parameters); Garbage_t garbage; if (particleHypothesis != Trk::nonInteracting) { const TrackParameters& endParams = *(track.trackStateOnSurfaces()->back()->trackParameters()); @@ -357,14 +369,21 @@ namespace Trk // perform fit and return fitted track TrackInfo trackInfo(TrackInfo::iPatTrackFitter, particleHypothesis); trackInfo.addPatternReco(track.info()); - return performFit(fitState, particleHypothesis, trackInfo, track.trackStateOnSurfaces(), track.fitQuality(), garbage); + return performFit(fitState, + particleHypothesis, + trackInfo, + track.trackStateOnSurfaces(), + track.fitQuality(), + garbage); } - Track* - iPatFitter::fit(const MeasurementSet& measurementSet, + std::unique_ptr + iPatFitter::fit(const EventContext& ctx, + const MeasurementSet& measurementSet, const TrackParameters& perigeeStartValue, const RunOutlierRemoval runOutlier, - const ParticleHypothesis particleHypothesis) const { + const ParticleHypothesis particleHypothesis) const + { ATH_MSG_VERBOSE(" fit from measurement set + perigeeStartValue "); m_countFitAttempts++; // outlier removal not implemented @@ -382,7 +401,7 @@ namespace Trk // set up the measurements (and material) fitState.newMeasurements(); - addMeasurements(fitState.getMeasurements(), measurementSet, *fitState.parameters); + addMeasurements(ctx,fitState.getMeasurements(), measurementSet, *fitState.parameters); Garbage_t garbage; if (particleHypothesis != Trk::nonInteracting) { m_materialAllocator->allocateMaterial(fitState.getMeasurements(), @@ -397,11 +416,13 @@ namespace Trk return performFit(fitState, particleHypothesis, trackInfo, nullptr, nullptr, garbage); } - Track* - iPatFitter::fit(const Track& indetTrack, + std::unique_ptr + iPatFitter::fit(const EventContext& ctx, + const Track& indetTrack, const Track& spectrometerTrack, const RunOutlierRemoval runOutlier, - const ParticleHypothesis particleHypothesis) const { + const ParticleHypothesis particleHypothesis) const + { ATH_MSG_VERBOSE(" combined muon fit "); m_countFitAttempts++; // outlier removal not implemented @@ -453,17 +474,23 @@ namespace Trk m_messageHelper->printWarning(13); return nullptr; } - if (!addMeasurements(fitState.getMeasurements(), + if (!addMeasurements(ctx, + fitState.getMeasurements(), *fitState.parameters, particleHypothesis, - *indetTrack.trackStateOnSurfaces())) { haveMaterial = false; } + *indetTrack.trackStateOnSurfaces())) { + haveMaterial = false; + } } // add the spectrometer measurements - if (!addMeasurements(fitState.getMeasurements(), + if (!addMeasurements(ctx, + fitState.getMeasurements(), *fitState.parameters, particleHypothesis, - *spectrometerTrack.trackStateOnSurfaces())) { haveMaterial = false; } + *spectrometerTrack.trackStateOnSurfaces())) { + haveMaterial = false; + } Garbage_t garbage; if (!haveMaterial && particleHypothesis != Trk::nonInteracting) { Perigee* startingPerigee = fitState.parameters->startingPerigee(); @@ -482,15 +509,18 @@ namespace Trk trackInfo.addPatternReco(indetTrack.info()); trackInfo.addPatternReco(spectrometerTrack.info()); if (m_fullCombinedFit) { - Trk::Track* fittedTrack = performFit(fitState, particleHypothesis, trackInfo, nullptr, nullptr, garbage); + std::unique_ptr fittedTrack = performFit( + fitState, particleHypothesis, trackInfo, nullptr, nullptr, garbage); // validation for (int i = 0; i < m_forcedRefitsForValidation; ++i) { - if (fittedTrack) { refit(fitState, *fittedTrack, runOutlier, particleHypothesis); } + if (fittedTrack) { + refit(ctx, fitState, *fittedTrack, runOutlier, particleHypothesis); + } } return fittedTrack; - } else { // hybrid fit + } // hybrid fit if (!indetPerigee) { // fail combined muon fit as indet track without measuredPerigee m_messageHelper->printWarning(14); @@ -498,22 +528,31 @@ namespace Trk } fitState.getMeasurements().insert(fitState.getMeasurements().begin(), new FitMeasurement(*indetPerigee)); FitParameters measuredParameters(*indetPerigee); - Trk::Track* fittedTrack = performFit(fitState, particleHypothesis, trackInfo, indetTrack.trackStateOnSurfaces(), - indetTrack.fitQuality(), garbage); + std::unique_ptr fittedTrack = + performFit(fitState, + particleHypothesis, + trackInfo, + indetTrack.trackStateOnSurfaces(), + indetTrack.fitQuality(), + garbage); // validation for (int i = 0; i < m_forcedRefitsForValidation; ++i) { - if (fittedTrack) { refit(fitState, *fittedTrack, runOutlier, particleHypothesis); } + if (fittedTrack) { + refit(ctx, fitState, *fittedTrack, runOutlier, particleHypothesis); + } } return fittedTrack; - } + } void - iPatFitter::addMeasurements(std::vector& measurements, + iPatFitter::addMeasurements(const EventContext& ctx, + std::vector& measurements, const MeasurementSet& measurementSet, - const FitParameters& parameters) const { + const FitParameters& parameters) const + { // extrapolation to set FittedTrajectory double qOverP = parameters.qOverP(); double previousDistance = -m_orderingTolerance; @@ -530,12 +569,14 @@ namespace Trk for (MeasurementSet::const_iterator m = measurementSet.begin(); m != measurementSet.end(); m++, hit++) { - std::unique_ptr newIntersection { - m_stepPropagator->intersectSurface((**m).associatedSurface(), - intersection.get(), - qOverP, - m_stepField, - Trk::muon)}; + std::unique_ptr newIntersection{ + m_stepPropagator->intersectSurface(ctx, + (**m).associatedSurface(), + intersection.get(), + qOverP, + m_stepField, + Trk::muon) + }; if (newIntersection) { intersection = std::move(newIntersection); @@ -565,7 +606,7 @@ namespace Trk // FIXME // no intersection to MeasurementSet m_messageHelper->printWarning(15); - intersection = std::make_unique(*intersection.get()); + intersection = std::make_unique(*intersection); } auto measurement = std::make_unique(hit, nullptr, *m); measurement->intersection(type, intersection.get()); @@ -578,10 +619,13 @@ namespace Trk } bool - iPatFitter::addMeasurements(std::vector& measurements, - const FitParameters& parameters, - ParticleHypothesis particleHypothesis, - const DataVector& trackStateOnSurfaces) const { + iPatFitter::addMeasurements( + const EventContext& ctx, + std::vector& measurements, + const FitParameters& parameters, + ParticleHypothesis particleHypothesis, + const DataVector& trackStateOnSurfaces) const + { // create vector of any TSOS'es which require fitted alignment corrections std::vector misAlignedTSOS; std::vector misAlignmentNumbers; @@ -617,9 +661,9 @@ namespace Trk double previousDistanceR = -m_orderingTolerance; double previousDistanceZ = -m_orderingTolerance; bool reorder = false; - const bool skipVertexMeasurement = measurements.size() > 0; + const bool skipVertexMeasurement = !measurements.empty(); const Amg::Vector3D startDirection = parameters.direction(); - const Amg::Vector3D startPosition = parameters.position(); + const Amg::Vector3D& startPosition = parameters.position(); const TrackSurfaceIntersection* vertex = parameters.intersection(); const TrackSurfaceIntersection* intersection = vertex; bool measurementsFlipped = false; @@ -724,7 +768,6 @@ namespace Trk } } else if (!measurement1 && s.trackParameters()) { if (s.type(TrackStateOnSurface::Hole)) { - // ATH_MSG_VERBOSE( " addMeasurements: adding hole" ); measurement2 = std::make_unique(s); } else if (s.type(TrackStateOnSurface::Perigee)) { if (i == trackStateOnSurfaces.begin()) { continue; } @@ -763,15 +806,11 @@ namespace Trk direction, 0.); } else if (surface) { - const TrackSurfaceIntersection* newIntersection = m_stepPropagator->intersectSurface(*surface, - intersection, - qOverP, - m_stepField, - Trk::muon); + const TrackSurfaceIntersection* newIntersection = + m_stepPropagator->intersectSurface( + ctx, *surface, intersection, qOverP, m_stepField, Trk::muon); if (!newIntersection) { - // addMeasurements: skip measurement as fail to intersect - // associated surface from given starting parameters m_messageHelper->printWarning(18); measurement2.reset(); continue; @@ -783,7 +822,7 @@ namespace Trk intersection = newIntersection; } if (s.materialEffectsOnTrack()) { - Amg::Vector3D position = intersection->position(); + const Amg::Vector3D& position = intersection->position(); bool calo = (!m_indetVolume->inside(position) && m_calorimeterVolume->inside(position)); measurement1 = std::make_unique(s.materialEffectsOnTrack(), @@ -855,14 +894,15 @@ namespace Trk return haveMaterial; } - Track* + std::unique_ptr iPatFitter::performFit( - FitState& fitState, - const ParticleHypothesis particleHypothesis, - const TrackInfo& trackInfo, - const DataVector* leadingTSOS, - const FitQuality* perigeeQuality, - Garbage_t& garbage) const { + FitState& fitState, + const ParticleHypothesis particleHypothesis, + const TrackInfo& trackInfo, + const DataVector* leadingTSOS, + const FitQuality* perigeeQuality, + Garbage_t& garbage) const + { std::vector& measurements = fitState.getMeasurements(); FitParameters* parameters = fitState.parameters.get(); // initialize the scattering centres @@ -962,7 +1002,7 @@ namespace Trk // conflicting energy deposit sign for inDet material if (m->energyLoss() * indetEloss < 0.) { m_messageHelper->printWarning(21); } continue; - } else if (m_calorimeterVolume->inside( + } if (m_calorimeterVolume->inside( m->intersection(FittedTrajectory).position())) { calo++; caloX0 += m->materialEffects()->thicknessInX0(); @@ -1036,7 +1076,7 @@ namespace Trk m_trackSummaryTool->computeAndReplaceTrackSummary(*fittedTrack, nullptr, false); } - return fittedTrack.release(); + return fittedTrack; } void @@ -1083,10 +1123,13 @@ namespace Trk } void - iPatFitter::refit(FitState& fitState, - const Track& track, - const RunOutlierRemoval runOutlier, - const ParticleHypothesis particleHypothesis) const { + iPatFitter::refit( + const EventContext& ctx, + FitState& fitState, + const Track& track, + const RunOutlierRemoval runOutlier, + const ParticleHypothesis particleHypothesis) const + { ATH_MSG_VERBOSE(" refit "); unsigned countGoodFits = m_countGoodFits; unsigned countIterations = m_countIterations; @@ -1140,8 +1183,9 @@ namespace Trk } fitState.newMeasurements(); - - bool haveMaterial = addMeasurements(fitState.getMeasurements(), + + bool haveMaterial = addMeasurements(ctx, + fitState.getMeasurements(), *fitState.parameters, particleHypothesis, *track.trackStateOnSurfaces()); @@ -1165,7 +1209,5 @@ namespace Trk m_countGoodFits = countGoodFits; m_countRefitIterations += m_countIterations - countIterations; m_countIterations = countIterations; - - return; - } + } } // end of namespace diff --git a/Tracking/TrkFitter/TrkiPatFitter/src/iPatGlobalFitter.cxx b/Tracking/TrkFitter/TrkiPatFitter/src/iPatGlobalFitter.cxx index ab2a1f12eca..fb3a1429803 100755 --- a/Tracking/TrkFitter/TrkiPatFitter/src/iPatGlobalFitter.cxx +++ b/Tracking/TrkFitter/TrkiPatFitter/src/iPatGlobalFitter.cxx @@ -11,6 +11,7 @@ #include "GaudiKernel/SystemOfUnits.h" +#include "GaudiKernel/ThreadLocalContext.h" #include "TrkiPatFitterUtils/ExtrapolationType.h" #include "TrkiPatFitterUtils/FitMeasurement.h" #include "TrkiPatFitterUtils/FitParameters.h" @@ -48,9 +49,10 @@ namespace Trk } alignCache.m_fullCovarianceMatrix = nullptr; alignCache.m_iterationsOfLastFit = 0; - - auto [refittedTrack, fitState] = fitWithState(trk, runOutlier, matEffects); - + + auto [refittedTrack, fitState] = + fitWithState(Gaudi::Hive::currentContext(), trk, runOutlier, matEffects); + if(refittedTrack){ alignCache.m_derivMatrix = derivMatrix(*fitState).release(); alignCache.m_fullCovarianceMatrix = fullCovarianceMatrix(*fitState).release(); -- GitLab From 8ad11d2957463d0ae1cd5c79563dc89ff4ee1790 Mon Sep 17 00:00:00 2001 From: scott snyder Date: Mon, 8 Jun 2020 16:32:45 +0200 Subject: [PATCH 13/38] TrigJetMonitoring: Remove TriggerChain property. Remove the TriggerChain property of TrigL1JetMonitorAlgorithm. It duplicates functionality from the base class, and leads to a warning from Gaudi about a duplicated property. --- .../TrigJetMonitoring/src/TrigL1JetMonitorAlgorithm.cxx | 7 ------- .../TrigJetMonitoring/src/TrigL1JetMonitorAlgorithm.h | 1 - 2 files changed, 8 deletions(-) diff --git a/Trigger/TrigMonitoring/TrigJetMonitoring/src/TrigL1JetMonitorAlgorithm.cxx b/Trigger/TrigMonitoring/TrigJetMonitoring/src/TrigL1JetMonitorAlgorithm.cxx index 9a37bbff9ce..b220e6eca93 100644 --- a/Trigger/TrigMonitoring/TrigJetMonitoring/src/TrigL1JetMonitorAlgorithm.cxx +++ b/Trigger/TrigMonitoring/TrigJetMonitoring/src/TrigL1JetMonitorAlgorithm.cxx @@ -8,7 +8,6 @@ TrigL1JetMonitorAlgorithm::TrigL1JetMonitorAlgorithm( const std::string& name, I : AthMonitorAlgorithm(name,pSvcLocator) { declareProperty("L1JetContainer", m_l1jetContainerkey = "LVL1JetRoIs"); - declareProperty("TriggerChain", m_chain = ""); } TrigL1JetMonitorAlgorithm::~TrigL1JetMonitorAlgorithm() {} @@ -21,12 +20,6 @@ StatusCode TrigL1JetMonitorAlgorithm::initialize() { StatusCode TrigL1JetMonitorAlgorithm::fillHistograms( const EventContext& ctx ) const { using namespace Monitored; - bool triggerPassed = true; - if( m_chain != "" ){ - if( !getTrigDecisionTool()->isPassed(m_chain) ) triggerPassed = false; - } - if( !triggerPassed ) return StatusCode::SUCCESS; - // Retrieve the L1 jet container SG::ReadHandle jets(m_l1jetContainerkey, ctx); if( !jets.isValid() ){ diff --git a/Trigger/TrigMonitoring/TrigJetMonitoring/src/TrigL1JetMonitorAlgorithm.h b/Trigger/TrigMonitoring/TrigJetMonitoring/src/TrigL1JetMonitorAlgorithm.h index 49a8c32cb7d..a5e049789c4 100644 --- a/Trigger/TrigMonitoring/TrigJetMonitoring/src/TrigL1JetMonitorAlgorithm.h +++ b/Trigger/TrigMonitoring/TrigJetMonitoring/src/TrigL1JetMonitorAlgorithm.h @@ -19,6 +19,5 @@ class TrigL1JetMonitorAlgorithm : public AthMonitorAlgorithm { // Name of the L1 jet collection to be monitored SG::ReadHandleKey m_l1jetContainerkey; - std::string m_chain; }; #endif -- GitLab From fca3c5652abb9b98fbebc44eeb05b7f4d344d7bd Mon Sep 17 00:00:00 2001 From: scott snyder Date: Mon, 8 Jun 2020 16:46:47 +0200 Subject: [PATCH 14/38] SiLorentzAngleTool: cmake fixes Library dependency fixes. --- InnerDetector/InDetConditions/SiLorentzAngleTool/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/InnerDetector/InDetConditions/SiLorentzAngleTool/CMakeLists.txt b/InnerDetector/InDetConditions/SiLorentzAngleTool/CMakeLists.txt index f09c72283b3..7afdee9b19b 100644 --- a/InnerDetector/InDetConditions/SiLorentzAngleTool/CMakeLists.txt +++ b/InnerDetector/InDetConditions/SiLorentzAngleTool/CMakeLists.txt @@ -36,7 +36,7 @@ atlas_add_component( SiLorentzAngleTool src/*.cxx src/components/*.cxx INCLUDE_DIRS ${EIGEN_INCLUDE_DIRS} - LINK_LIBRARIES ${EIGEN_LIBRARIES} AthenaBaseComps AthenaKernel StoreGateLib SGtests GeoPrimitives GaudiKernel SiPropertiesToolLib AthenaPoolUtilities Identifier InDetIdentifier InDetReadoutGeometry PixelReadoutGeometry MagFieldElements MagFieldConditions) + LINK_LIBRARIES ${EIGEN_LIBRARIES} AthenaBaseComps AthenaKernel StoreGateLib SGtests GeoPrimitives GaudiKernel SiPropertiesToolLib AthenaPoolUtilities Identifier InDetIdentifier InDetReadoutGeometry PixelReadoutGeometry MagFieldElements MagFieldConditions InDetConditionsSummaryService ) # Run tests: atlas_add_test( TestSCTLorentzAngle -- GitLab From aae89802f85d00c5217ca68a5bb5932af2dc4331 Mon Sep 17 00:00:00 2001 From: christos Date: Tue, 9 Jun 2020 03:26:56 +0200 Subject: [PATCH 15/38] IMaterialEffectsUpdator update comments tidy a bit --- .../TrkExInterfaces/IMaterialEffectsUpdator.h | 256 +++++++++++------- .../TrkExTools/src/MaterialEffectsUpdator.cxx | 12 +- .../IMultiStateMaterialEffects.h | 15 - 3 files changed, 158 insertions(+), 125 deletions(-) diff --git a/Tracking/TrkExtrapolation/TrkExInterfaces/TrkExInterfaces/IMaterialEffectsUpdator.h b/Tracking/TrkExtrapolation/TrkExInterfaces/TrkExInterfaces/IMaterialEffectsUpdator.h index 0f1ff35cb98..1334fae9d69 100755 --- a/Tracking/TrkExtrapolation/TrkExInterfaces/TrkExInterfaces/IMaterialEffectsUpdator.h +++ b/Tracking/TrkExtrapolation/TrkExInterfaces/TrkExInterfaces/IMaterialEffectsUpdator.h @@ -25,13 +25,19 @@ class MaterialProperties; class MaterialEffectsOnTrack; /** Interface ID for IMaterialEffectsUpdator*/ -static const InterfaceID IID_IMaterialEffectsUpdator("IMaterialEffectsUpdator", 1, 0); +static const InterfaceID IID_IMaterialEffectsUpdator("IMaterialEffectsUpdator", + 1, + 0); /** @class IMaterialEffectsUpdator Interface class for the updater AlgTool, it inherits from IAlgTool - Detailed information about private members and member functions can be found in the actual - implementation class MaterialEffectsUpdator which inherits from this one. + + Detailed information about private members and member functions can be found + in the actual implementation class MaterialEffectsUpdator which inherits from + this one. + @author Andreas.Salzburger@cern.ch + @author Christos Anastopoulos (Athena MT) */ @@ -43,59 +49,164 @@ public: virtual ~IMaterialEffectsUpdator() {} /** AlgTool and IAlgTool interface methods */ - static const InterfaceID& interfaceID() { return IID_IMaterialEffectsUpdator; } + static const InterfaceID& interfaceID() + { + return IID_IMaterialEffectsUpdator; + } + + /** + * Abstract cache class to allow passing information to/between calls. + * This can be particular useful in Athena MT + * re-entrant algorithms + */ + class ICache + { + public: + /* we can make this concrete + * if we do not need a Dummy + * Material Effects updator + */ + enum MaterialCacheType + { + MaterialEffects = 0, + DummyMaterialEffects = 1 + }; + virtual MaterialCacheType type() const = 0; + virtual ~ICache() = default; + + protected: + ICache() = default; + }; + /** + * Creates an instance of the cache to be used. + * by the client. + */ + virtual std::unique_ptr getCache() const = 0; + + /** Updator interface (full update for a layer): + The parmeters are given as a pointer, they are delete inside the update + method. Layer-based material update + */ + virtual const TrackParameters* update( + ICache& icache, + const TrackParameters* parm, + const Layer& sf, + PropDirection dir = alongMomentum, + ParticleHypothesis particle = pion, + MaterialUpdateMode matupmode = addNoise) const = 0; + + /** User updator interface (full update for a layer): + The parmeters are given as a pointer, they are deleted inside the update + method. Update occurs on the place where the parameters parm are according + to the specified MaterialEffectsOnTrack + */ + virtual const TrackParameters* update( + ICache& icache, + const TrackParameters* parm, + const MaterialEffectsOnTrack& meff, + Trk::ParticleHypothesis particle = pion, + MaterialUpdateMode matupmode = addNoise) const = 0; + + /** Updator interface (pre-update for a layer): + The parmeters are given as a pointer, they are delete inside the update + method. Layer-based material update + */ + virtual const TrackParameters* preUpdate( + ICache& icache, + const TrackParameters* parm, + const Layer& sf, + PropDirection dir = alongMomentum, + ParticleHypothesis particle = pion, + MaterialUpdateMode matupmode = addNoise) const = 0; + + /** Updator interface (pre-update for a layer): + The parmeters are given as a pointer, they are delete inside the update + method. Layer-based material update if the postUpdate fails, it returns 0 + */ + virtual const TrackParameters* postUpdate( + ICache& icache, + const TrackParameters& parm, + const Layer& sf, + PropDirection dir = alongMomentum, + ParticleHypothesis particle = pion, + MaterialUpdateMode matupmode = addNoise) const = 0; + + /** Updator interface: + The parmeters are given as a pointer, they are delete inside the update + method. MaterialProperties based material update + - used by all Layer-based methods + */ + virtual const TrackParameters* update( + ICache& icache, + const TrackParameters& parm, + const MaterialProperties& mprop, + double pathcorrection, + PropDirection dir = alongMomentum, + ParticleHypothesis particle = pion, + MaterialUpdateMode matupmode = addNoise) const = 0; + + /** Validation Action: */ + virtual void validationAction(ICache& icache) const = 0; + + /** Model Action:*/ + virtual void modelAction(ICache& icache, + const TrackParameters* parm = nullptr) const = 0; /** Updator interface (full update for a layer): - The parmeters are given as a pointer, they are delete inside the update method. - Layer-based material update + The parmeters are given as a pointer, they are delete inside the update + method. Layer-based material update */ - virtual const TrackParameters* update(const TrackParameters* parm, - const Layer& sf, - PropDirection dir = alongMomentum, - ParticleHypothesis particle = pion, - MaterialUpdateMode matupmode = addNoise) const = 0; + virtual const TrackParameters* update( + const TrackParameters* parm, + const Layer& sf, + PropDirection dir = alongMomentum, + ParticleHypothesis particle = pion, + MaterialUpdateMode matupmode = addNoise) const = 0; /** User updator interface (full update for a layer): - The parmeters are given as a pointer, they are deleted inside the update method. - Update occurs on the place where the parameters parm are according to the specified - MaterialEffectsOnTrack + The parmeters are given as a pointer, they are deleted inside the update + method. Update occurs on the place where the parameters parm are according + to the specified MaterialEffectsOnTrack */ - virtual const TrackParameters* update(const TrackParameters* parm, - const MaterialEffectsOnTrack& meff, - ParticleHypothesis particle = pion, - MaterialUpdateMode matupmode = addNoise) const = 0; + virtual const TrackParameters* update( + const TrackParameters* parm, + const MaterialEffectsOnTrack& meff, + ParticleHypothesis particle = pion, + MaterialUpdateMode matupmode = addNoise) const = 0; /** Updator interface (pre-update for a layer): - The parmeters are given as a pointer, they are delete inside the update method. - Layer-based material update + The parmeters are given as a pointer, they are delete inside the update + method. Layer-based material update */ - virtual const TrackParameters* preUpdate(const TrackParameters* parm, - const Layer& sf, - PropDirection dir = alongMomentum, - ParticleHypothesis particle = pion, - MaterialUpdateMode matupmode = addNoise) const = 0; + virtual const TrackParameters* preUpdate( + const TrackParameters* parm, + const Layer& sf, + PropDirection dir = alongMomentum, + ParticleHypothesis particle = pion, + MaterialUpdateMode matupmode = addNoise) const = 0; /** Updator interface (pre-update for a layer): - The parmeters are given as a pointer, they are delete inside the update method. - Layer-based material update - if the postUpdate fails, it returns 0 + The parmeters are given as a pointer, they are delete inside the update + method. Layer-based material update if the postUpdate fails, it returns 0 */ - virtual const TrackParameters* postUpdate(const TrackParameters& parm, - const Layer& sf, - PropDirection dir = alongMomentum, - ParticleHypothesis particle = pion, - MaterialUpdateMode matupmode = addNoise) const = 0; + virtual const TrackParameters* postUpdate( + const TrackParameters& parm, + const Layer& sf, + PropDirection dir = alongMomentum, + ParticleHypothesis particle = pion, + MaterialUpdateMode matupmode = addNoise) const = 0; /** Updator interface: - The parmeters are given as a pointer, they are delete inside the update method. - MaterialProperties based material update + The parmeters are given as a pointer, they are delete inside the update + method. MaterialProperties based material update - used by all Layer-based methods */ - virtual const TrackParameters* update(const TrackParameters& parm, - const MaterialProperties& mprop, - double pathcorrection, - PropDirection dir = alongMomentum, - ParticleHypothesis particle = pion, - MaterialUpdateMode matupmode = addNoise) const = 0; + virtual const TrackParameters* update( + const TrackParameters& parm, + const MaterialProperties& mprop, + double pathcorrection, + PropDirection dir = alongMomentum, + ParticleHypothesis particle = pion, + MaterialUpdateMode matupmode = addNoise) const = 0; /** Validation Action: outside access to internal validation steps Optional */ @@ -106,69 +217,6 @@ public: * Optional */ virtual void modelAction(const TrackParameters* parm = nullptr) const = 0; - - /** Interfaces for clients using a local cache.*/ - - /** - * The cache class - */ - class ICache - { - public: - enum MaterialCacheType - { - MaterialEffects = 0, - DummyMaterialEffects = 1 - }; - virtual MaterialCacheType type() const = 0; - virtual ~ICache() = default; - - protected: - ICache() = default; - }; - - virtual std::unique_ptr getCache() const = 0; - - virtual const TrackParameters* update(ICache& icache, - const TrackParameters* parm, - const Layer& sf, - PropDirection dir = alongMomentum, - ParticleHypothesis particle = pion, - MaterialUpdateMode matupmode = addNoise) const = 0; - - virtual const TrackParameters* update(ICache& icache, - const TrackParameters* parm, - const MaterialEffectsOnTrack& meff, - Trk::ParticleHypothesis particle = pion, - MaterialUpdateMode matupmode = addNoise) const = 0; - - virtual const TrackParameters* preUpdate(ICache& icache, - const TrackParameters* parm, - const Layer& sf, - PropDirection dir = alongMomentum, - ParticleHypothesis particle = pion, - MaterialUpdateMode matupmode = addNoise) const = 0; - - virtual const TrackParameters* postUpdate(ICache& icache, - const TrackParameters& parm, - const Layer& sf, - PropDirection dir = alongMomentum, - ParticleHypothesis particle = pion, - MaterialUpdateMode matupmode = addNoise) const = 0; - - virtual const TrackParameters* update(ICache& icache, - const TrackParameters& parm, - const MaterialProperties& mprop, - double pathcorrection, - PropDirection dir = alongMomentum, - ParticleHypothesis particle = pion, - MaterialUpdateMode matupmode = addNoise) const = 0; - - /** Validation Action: */ - virtual void validationAction(ICache& icache) const = 0; - - /** Model Action:*/ - virtual void modelAction(ICache& icache, const TrackParameters* parm = nullptr) const = 0; }; } // end of namespace diff --git a/Tracking/TrkExtrapolation/TrkExTools/src/MaterialEffectsUpdator.cxx b/Tracking/TrkExtrapolation/TrkExTools/src/MaterialEffectsUpdator.cxx index c9ed2a8fc78..6e4eb845895 100755 --- a/Tracking/TrkExtrapolation/TrkExTools/src/MaterialEffectsUpdator.cxx +++ b/Tracking/TrkExtrapolation/TrkExTools/src/MaterialEffectsUpdator.cxx @@ -97,9 +97,9 @@ Trk::MaterialEffectsUpdator::initialize() { "Failed to retrieve tool " << m_eLossUpdator << ". No multiple scattering effects will be taken into account."); m_doEloss = false; return StatusCode::FAILURE; - } else { + } ATH_MSG_DEBUG("Retrieved tool " << m_eLossUpdator); - } + } else { m_eLossUpdator.disable(); @@ -111,9 +111,9 @@ Trk::MaterialEffectsUpdator::initialize() { ". No energy loss effects will be taken into account."); m_doMs = false; return StatusCode::FAILURE; - } else { + } ATH_MSG_DEBUG("Retrieved tool " << m_msUpdator); - } + } else { m_msUpdator.disable(); @@ -124,9 +124,9 @@ Trk::MaterialEffectsUpdator::initialize() { if (m_materialMapper.retrieve().isFailure()) { ATH_MSG_FATAL("Failed to retrieve tool " << m_materialMapper << ". No material recording."); return StatusCode::FAILURE; - } else { + } ATH_MSG_DEBUG("Retrieved tool " << m_materialMapper); - } + } else { m_materialMapper.disable(); diff --git a/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/IMultiStateMaterialEffects.h b/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/IMultiStateMaterialEffects.h index 5118360d4f3..1d235b978b8 100644 --- a/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/IMultiStateMaterialEffects.h +++ b/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/IMultiStateMaterialEffects.h @@ -14,19 +14,6 @@ */ -/************************************************************************************* - IMultiStateMaterialEffects.h - description - -------------------------------------------- -begin : Thursday 17th February 2005 -author : atkinson -email : Tom.Atkinson@cern.ch -decription : (Non-pure) abstract base class for defining material - effects including energy loss and multiple scattering for - use in the multi-component state environment. These - material effects will produce multi-component state -outputs -************************************************************************************/ - #ifndef Trk_IMultiStateMaterialEffects_H #define Trk_IMultiStateMaterialEffects_H @@ -37,8 +24,6 @@ outputs #include "TrkEventPrimitives/PropDirection.h" #include "TrkMultiComponentStateOnSurface/MultiComponentState.h" -#include "TrkExInterfaces/IMaterialEffectsUpdator.h" - #include #include -- GitLab From ebc5501fe20be15e18a75f57e8152cd78c5e7221 Mon Sep 17 00:00:00 2001 From: scott snyder Date: Mon, 8 Jun 2020 17:13:30 +0200 Subject: [PATCH 16/38] SCT_ConditionsData: Fix clang warning. SCT_ReadoutData has a unique_ptr member, so it cannot have a defaulted ctor/assignment op. --- .../SCT_ConditionsData/SCT_ReadoutData.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/InnerDetector/InDetConditions/SCT_ConditionsData/SCT_ConditionsData/SCT_ReadoutData.h b/InnerDetector/InDetConditions/SCT_ConditionsData/SCT_ConditionsData/SCT_ReadoutData.h index f89ba37dc96..9303ef9d82c 100644 --- a/InnerDetector/InDetConditions/SCT_ConditionsData/SCT_ConditionsData/SCT_ReadoutData.h +++ b/InnerDetector/InDetConditions/SCT_ConditionsData/SCT_ConditionsData/SCT_ReadoutData.h @@ -44,10 +44,10 @@ public: SCT_ReadoutData(IMessageSvc* msgSvc=nullptr); ~SCT_ReadoutData() = default; - /** Default copy constructor*/ - SCT_ReadoutData(const SCT_ReadoutData&) = default; - /** Default assignment operator*/ - SCT_ReadoutData& operator=(const SCT_ReadoutData&) = default; + /** No copy ctor due to m_msg*/ + SCT_ReadoutData(const SCT_ReadoutData&) = delete; + /** No assignment operator due to m_msg */ + SCT_ReadoutData& operator=(const SCT_ReadoutData&) = delete; /** Default move constructor*/ SCT_ReadoutData(SCT_ReadoutData&&) = default; /** Default move assignment operator*/ -- GitLab From 7d3cbe3c68113503d595e50b95f033d3381bfee9 Mon Sep 17 00:00:00 2001 From: scott snyder Date: Mon, 8 Jun 2020 17:14:23 +0200 Subject: [PATCH 17/38] SCT_RawDataByteStreamCnv: Fix clang warning. struct/class mismatch. --- .../SCT_RawDataByteStreamCnv/src/SCT_RodDecoder.cxx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/InnerDetector/InDetEventCnv/SCT_RawDataByteStreamCnv/src/SCT_RodDecoder.cxx b/InnerDetector/InDetEventCnv/SCT_RawDataByteStreamCnv/src/SCT_RodDecoder.cxx index 0171dbf8fe1..9efdfee05fd 100644 --- a/InnerDetector/InDetEventCnv/SCT_RawDataByteStreamCnv/src/SCT_RodDecoder.cxx +++ b/InnerDetector/InDetEventCnv/SCT_RawDataByteStreamCnv/src/SCT_RodDecoder.cxx @@ -172,7 +172,8 @@ StatusCode SCT_RodDecoder::finalize() * To be sure that all of the errors are saved this helper class provides add method allowing to update/accumulate erorr. * The IDC, for a very good reasons (MT safety) do not allow for that. **/ -struct SCT_RodDecoderErrorsHelper { +class SCT_RodDecoderErrorsHelper { +public: SCT_RodDecoderErrorsHelper( IDCInDetBSErrContainer& idcContainer ) : errorsIDC{ idcContainer } {} ~SCT_RodDecoderErrorsHelper() { -- GitLab From 546bff7eb815a4eaa340d86e1daffe61d860999e Mon Sep 17 00:00:00 2001 From: scott snyder Date: Mon, 8 Jun 2020 16:53:08 +0200 Subject: [PATCH 18/38] CaloTools: Increase test timeout. Increase timout for test that has been timing out in dbg builds. --- Calorimeter/CaloTools/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/Calorimeter/CaloTools/CMakeLists.txt b/Calorimeter/CaloTools/CMakeLists.txt index c5ad29c9304..a14f3bfad85 100644 --- a/Calorimeter/CaloTools/CMakeLists.txt +++ b/Calorimeter/CaloTools/CMakeLists.txt @@ -71,5 +71,6 @@ atlas_add_test( CaloEstimatedGainToolConfig_test atlas_add_test( CaloEstimatedGainTool_test SCRIPT python -m CaloTools.CaloEstimatedGainTool_test + PROPERTIES TIMEOUT 300 LOG_SELECT_PATTERN "ERROR|error|WARNING [^U]|FATAL|processing|TestAlg" ) -- GitLab From 1212c48136acf70a7756470a69247fae782af6da Mon Sep 17 00:00:00 2001 From: scott snyder Date: Mon, 8 Jun 2020 16:54:32 +0200 Subject: [PATCH 19/38] MuonConfig: Increase test timeouts. Increase timeouts for tests that have been timing out in dbg builds. --- MuonSpectrometer/MuonConfig/CMakeLists.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/MuonSpectrometer/MuonConfig/CMakeLists.txt b/MuonSpectrometer/MuonConfig/CMakeLists.txt index c24cbba5884..43b39d75bac 100644 --- a/MuonSpectrometer/MuonConfig/CMakeLists.txt +++ b/MuonSpectrometer/MuonConfig/CMakeLists.txt @@ -45,9 +45,11 @@ if( NOT SIMULATIONBASE ) atlas_add_test( MuonReconstructionConfigTest SCRIPT python -m MuonConfig.MuonReconstructionConfig --run + PROPERTIES TIMEOUT 1200 POST_EXEC_SCRIPT nopost.sh ) atlas_add_test( MuonSegmentFindingConfigTest SCRIPT python -m MuonConfig.MuonSegmentFindingConfig --run + PROPERTIES TIMEOUT 300 POST_EXEC_SCRIPT nopost.sh ) endif() -- GitLab From 05773e08b88da0eb6eb554e9fdf61202b09ebc3c Mon Sep 17 00:00:00 2001 From: scott snyder Date: Mon, 8 Jun 2020 16:34:51 +0200 Subject: [PATCH 20/38] GeneratorObjects: Fix problems with tests. In HepMcParticleLink::eventIndex(), the second argument to makeIndex() should be the existing position, not a flag. Fixes an assertion failure. In populateFilteredGenEvent(), don't reference a map iterator after it's been removed from the map. --- Generators/GeneratorObjects/src/HepMcParticleLink.cxx | 2 +- .../GeneratorObjects/test/HepMcParticleLink_test.cxx | 11 ++++------- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/Generators/GeneratorObjects/src/HepMcParticleLink.cxx b/Generators/GeneratorObjects/src/HepMcParticleLink.cxx index ddaf6e6243a..a8c41d63fad 100644 --- a/Generators/GeneratorObjects/src/HepMcParticleLink.cxx +++ b/Generators/GeneratorObjects/src/HepMcParticleLink.cxx @@ -258,7 +258,7 @@ HepMcParticleLink::index_type HepMcParticleLink::eventIndex() const } if(event_number>-1) { index = static_cast(event_number); - m_extBarcode.makeIndex (index, HepMcParticleLink::IS_INDEX); + m_extBarcode.makeIndex (index, position); return index; } } diff --git a/Generators/GeneratorObjects/test/HepMcParticleLink_test.cxx b/Generators/GeneratorObjects/test/HepMcParticleLink_test.cxx index bca5b708718..bc5c971c435 100644 --- a/Generators/GeneratorObjects/test/HepMcParticleLink_test.cxx +++ b/Generators/GeneratorObjects/test/HepMcParticleLink_test.cxx @@ -213,15 +213,12 @@ namespace MCTesting { } if(!ge.vertices_empty()){ - std::vector vtxvec; HepMC::GenEvent::vertex_iterator itvtx = ge.vertices_begin(); - for (;itvtx != ge.vertices_end(); ++itvtx ) { - ge.remove_vertex(*itvtx); - vtxvec.push_back((*itvtx)); - //fix me: delete vertex pointer causes crash - //delete (*itvtx); + while (itvtx != ge.vertices_end()) { + HepMC::GenVertex* vtx = *itvtx++; + ge.remove_vertex(vtx); + delete vtx; } - for(unsigned int i=0;i Date: Tue, 9 Jun 2020 10:25:19 +0200 Subject: [PATCH 21/38] TrigCommon: Move flake8 checking to build stage --- HLT/Trigger/TrigControl/TrigCommon/CMakeLists.txt | 11 ++--------- HLT/Trigger/TrigControl/TrigCommon/bin/athenaHLT.py | 12 ++++++------ 2 files changed, 8 insertions(+), 15 deletions(-) diff --git a/HLT/Trigger/TrigControl/TrigCommon/CMakeLists.txt b/HLT/Trigger/TrigControl/TrigCommon/CMakeLists.txt index c9884ce739e..335edfbb831 100644 --- a/HLT/Trigger/TrigControl/TrigCommon/CMakeLists.txt +++ b/HLT/Trigger/TrigControl/TrigCommon/CMakeLists.txt @@ -6,20 +6,13 @@ atlas_subdir( TrigCommon ) # Install files from the package: -atlas_install_python_modules( python/*.py ) +atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} ) +atlas_install_scripts( bin/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} ) atlas_install_joboptions( share/*.py ) -atlas_install_scripts( bin/athenaHLT.py ) -atlas_install_scripts( bin/athenaHLT-select-PEB-stream.py ) -atlas_install_scripts( bin/ros2rob_from_partition.py ) # Aliases: atlas_add_alias( athenaHLT "athenaHLT.py" ) -# Check python syntax: -atlas_add_test( flake8 - SCRIPT flake8 --select=ATL,F,E7,E9,W6 --extend-ignore=E701 ${CMAKE_CURRENT_SOURCE_DIR}/python ${CMAKE_CURRENT_SOURCE_DIR}/bin - POST_EXEC_SCRIPT nopost.sh ) - # Tests: atlas_add_test( test_AthHLT SCRIPT python ${CMAKE_CURRENT_SOURCE_DIR}/python/AthHLT.py diff --git a/HLT/Trigger/TrigControl/TrigCommon/bin/athenaHLT.py b/HLT/Trigger/TrigControl/TrigCommon/bin/athenaHLT.py index 193d2927f81..6441ab66d7d 100755 --- a/HLT/Trigger/TrigControl/TrigCommon/bin/athenaHLT.py +++ b/HLT/Trigger/TrigControl/TrigCommon/bin/athenaHLT.py @@ -16,12 +16,12 @@ export USEIMF=1 for a in ${@} do case "$a" in - --leak-check*) USETCMALLOC=0;; - --stdcmalloc) USETCMALLOC=0;; - --tcmalloc) USETCMALLOC=1;; - --stdcmath) USEIMF=0;; - --imf) USEIMF=1;; - --preloadlib*) export ATHENA_ADD_PRELOAD=${a#*=};; + --leak-check*) USETCMALLOC=0;; + --stdcmalloc) USETCMALLOC=0;; + --tcmalloc) USETCMALLOC=1;; + --stdcmath) USEIMF=0;; + --imf) USEIMF=1;; + --preloadlib*) export ATHENA_ADD_PRELOAD=${a#*=};; --no-ers-signal-handlers) export TDAQ_ERS_NO_SIGNAL_HANDLERS=1;; esac done -- GitLab From 1a6a6913b2bd607fc0a2d902f42d1f1497cf366b Mon Sep 17 00:00:00 2001 From: Frank Winklmeier Date: Tue, 9 Jun 2020 10:57:37 +0200 Subject: [PATCH 22/38] TrigBunchCrossingTool: Remove obsolete flake8 test Remove obsolete flake8 test and the workaround for AnalysisBase. --- .../TrigBunchCrossingTool/CMakeLists.txt | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/Trigger/TrigAnalysis/TrigBunchCrossingTool/CMakeLists.txt b/Trigger/TrigAnalysis/TrigBunchCrossingTool/CMakeLists.txt index a7d2d72a45e..4e05b729c53 100644 --- a/Trigger/TrigAnalysis/TrigBunchCrossingTool/CMakeLists.txt +++ b/Trigger/TrigAnalysis/TrigBunchCrossingTool/CMakeLists.txt @@ -54,15 +54,4 @@ atlas_add_test( ut_web_bunch_tool_test PROPERTIES TIMEOUT 300 ) # Install files from the package: - -# temporarily disabling FLAKE8 in AnalysisBase until it becomes -# available there. -if( XAOD_STANDALONE ) -atlas_install_python_modules( python/*.py ) -else() -atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} ) - -atlas_add_test( flake8_scripts - SCRIPT flake8 --select=ATL,F,E7,E9,W6 ${CMAKE_CURRENT_SOURCE_DIR}/scripts - POST_EXEC_SCRIPT nopost.sh ) -endif() +atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} ) -- GitLab From 8181c17d8fd18007e19eed3a6dc962299dc5babb Mon Sep 17 00:00:00 2001 From: Frank Winklmeier Date: Tue, 9 Jun 2020 10:58:40 +0200 Subject: [PATCH 23/38] AnalysisBase: Add dummy flake8 configuration `flake8` is not available in AnalysisBase. While our cmake configuration does handle this correctly, it fails once developers start using special flake8 options, e.g.: ``` ... POST_BUILD_CMD ${ATLAS_FLAKE8} --enable-extensions ATL902 ``` Even if `ATLAS_FLAKE8` is not defined it will now try to run a command of name `--enable-extensions`, which of course fails. An easy workaround is to `set( ATLAS_FLAKE8 true )` where `true` here is the shell builtin, which returns success and swallows any command line args given to it. --- Projects/AnalysisBase/CMakeLists.txt | 6 ++++++ Projects/AnalysisBase/cmake/PreConfig.cmake.in | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/Projects/AnalysisBase/CMakeLists.txt b/Projects/AnalysisBase/CMakeLists.txt index 2493bcda372..90ed7b81939 100644 --- a/Projects/AnalysisBase/CMakeLists.txt +++ b/Projects/AnalysisBase/CMakeLists.txt @@ -34,6 +34,12 @@ atlas_ctest_setup() atlas_project( USE AnalysisBaseExternals ${AnalysisBaseExternals_VERSION} PROJECT_ROOT ${CMAKE_SOURCE_DIR}/../../ ) +# Configure flake8: +set( ATLAS_FLAKE8 true # <- this is the shell builtin `true` + CACHE STRING "Default flake8 command" ) +set( ATLAS_PYTHON_CHECKER "" + CACHE STRING "Python checker command to run during Python module compilation" ) + # Configure and install the pre/post-configuration files: configure_file( ${CMAKE_SOURCE_DIR}/cmake/PreConfig.cmake.in ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/PreConfig.cmake @ONLY ) diff --git a/Projects/AnalysisBase/cmake/PreConfig.cmake.in b/Projects/AnalysisBase/cmake/PreConfig.cmake.in index c29dae3afd0..8d572f86825 100644 --- a/Projects/AnalysisBase/cmake/PreConfig.cmake.in +++ b/Projects/AnalysisBase/cmake/PreConfig.cmake.in @@ -4,6 +4,12 @@ # @CMAKE_PROJECT_NAME@. # +# Set up the project's flake8 usage. +set( ATLAS_FLAKE8 @ATLAS_FLAKE8@ + CACHE STRING "Default flake8 command" ) +set( ATLAS_PYTHON_CHECKER @ATLAS_PYTHON_CHECKER@ + CACHE STRING "Python checker command to run during Python module compilation" ) + # Figure out whether to use QUIET in the find_package call(s). set( _quietFlag ) if( @CMAKE_PROJECT_NAME@_FIND_QUIETLY ) -- GitLab From 2fe1b4d07196ad4db6d0030f89e7d609306d860f Mon Sep 17 00:00:00 2001 From: Nora Emilia Pettersson Date: Tue, 9 Jun 2020 11:47:09 +0200 Subject: [PATCH 24/38] Updating AOD digests --- Tools/PROCTools/data/master_q221_AOD_digest.ref | 4 ++-- Tools/PROCTools/data/master_q431_AOD_digest.ref | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Tools/PROCTools/data/master_q221_AOD_digest.ref b/Tools/PROCTools/data/master_q221_AOD_digest.ref index f38e246bd99..06f9614cc8c 100644 --- a/Tools/PROCTools/data/master_q221_AOD_digest.ref +++ b/Tools/PROCTools/data/master_q221_AOD_digest.ref @@ -3,7 +3,7 @@ 284500 87473014 85 79 6 0 9 1 8 7 4 3 284500 87473022 38 30 4 0 5 1 4 2 1 1 284500 87473032 27 33 4 1 9 4 5 2 1 1 - 284500 87473037 60 43 7 0 10 2 8 6 4 2 + 284500 87473037 60 42 7 0 10 2 8 6 4 2 284500 87473040 101 96 9 0 17 1 16 7 5 2 284500 87473051 142 114 12 1 14 2 12 22 16 6 284500 87473063 62 76 5 2 6 2 4 6 4 2 @@ -13,7 +13,7 @@ 284500 87473091 43 49 3 0 2 1 1 5 2 3 284500 87473096 72 75 3 2 2 0 2 3 2 1 284500 87473104 61 66 6 0 6 1 5 5 4 1 - 284500 87473114 93 84 7 2 14 1 13 8 5 3 + 284500 87473114 93 83 7 2 13 1 12 8 5 3 284500 87473121 93 101 6 3 15 4 11 7 6 1 284500 87473132 81 59 9 1 10 0 10 5 5 0 284500 87473137 81 71 8 3 15 0 15 6 6 0 diff --git a/Tools/PROCTools/data/master_q431_AOD_digest.ref b/Tools/PROCTools/data/master_q431_AOD_digest.ref index e60e8fed01b..8f5fbb3ab9e 100644 --- a/Tools/PROCTools/data/master_q431_AOD_digest.ref +++ b/Tools/PROCTools/data/master_q431_AOD_digest.ref @@ -1,7 +1,7 @@ run event nTopo nIdTracks nJets nMuons 330470 1183722158 1 0 0 0 - 330470 1183722342 394 429 20 0 - 330470 1183727953 532 595 13 4 + 330470 1183722342 394 428 20 0 + 330470 1183727953 532 594 13 4 330470 1183732647 467 483 12 1 330470 1183733040 381 293 6 1 330470 1183734651 361 375 14 3 -- GitLab From 93b9ad8d701868573a7c42b4a68b53e7cf864ee9 Mon Sep 17 00:00:00 2001 From: Frank Winklmeier Date: Tue, 9 Jun 2020 10:31:15 +0200 Subject: [PATCH 25/38] TrigUpgradeTest: CMake cleanup - Move flake8 checking to build stage. - Remove obsolete unit tests. - Remove `atlas_depends_on_subdirs` statements. --- .../TrigUpgradeTest/CMakeLists.txt | 35 ++----------------- .../test/test_view_schedule.sh | 9 ----- 2 files changed, 2 insertions(+), 42 deletions(-) delete mode 100755 Trigger/TrigValidation/TrigUpgradeTest/test/test_view_schedule.sh diff --git a/Trigger/TrigValidation/TrigUpgradeTest/CMakeLists.txt b/Trigger/TrigValidation/TrigUpgradeTest/CMakeLists.txt index 62a312769c9..4a9b1b7c009 100644 --- a/Trigger/TrigValidation/TrigUpgradeTest/CMakeLists.txt +++ b/Trigger/TrigValidation/TrigUpgradeTest/CMakeLists.txt @@ -1,19 +1,8 @@ -################################################################################ -# Package: TrigUpgradeTest -################################################################################ +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration # Declare the package name: atlas_subdir( TrigUpgradeTest ) -# Declare the package's dependencies: -atlas_depends_on_subdirs( PRIVATE - GaudiKernel - Control/AthenaBaseComps - Trigger/TrigSteer/DecisionHandling - Trigger/TrigSteer/TrigCompositeUtils - Trigger/TrigEvent/TrigSteeringEvent - ) - atlas_add_component( TrigUpgradeTest src/*.cxx src/components/*.cxx @@ -23,25 +12,5 @@ atlas_add_component( TrigUpgradeTest # Install files from the package: atlas_install_joboptions( share/*.py ) atlas_install_data( share/*.ref share/*.conf ) -atlas_install_python_modules( python/*.py ) +atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} ) atlas_install_scripts( test/exec*.sh test/test*.sh ) - -# Check python syntax: -atlas_add_test( flake8 - SCRIPT flake8 --select=ATL,F,E7,E9,W6 --extend-ignore=E701 ${CMAKE_CURRENT_SOURCE_DIR}/python - POST_EXEC_SCRIPT nopost.sh ) - -# Unit tests (they test things from outside TrigUpgradeTest - should be moved or removed): -atlas_add_test( ViewSchedule1 SCRIPT test/test_view_schedule.sh ENVIRONMENT THREADS=1 POST_EXEC_SCRIPT nopost.sh ) -atlas_add_test( ViewSchedule2 SCRIPT test/test_view_schedule.sh ENVIRONMENT THREADS=2 POST_EXEC_SCRIPT nopost.sh ) -atlas_add_test( ViewSchedule64 SCRIPT test/test_view_schedule.sh ENVIRONMENT THREADS=64 POST_EXEC_SCRIPT nopost.sh ) - -# Unit tests of the test scripts -atlas_add_test( flake8_test_dir - SCRIPT flake8 --select=ATL,F,E7,E9,W6 --enable-extension=ATL900,ATL901 ${CMAKE_CURRENT_SOURCE_DIR}/test - POST_EXEC_SCRIPT nopost.sh ) - -atlas_add_test( TrigValSteeringUT - SCRIPT trigvalsteering-unit-tester.py ${CMAKE_CURRENT_SOURCE_DIR}/test - PROPERTIES TIMEOUT 300 - POST_EXEC_SCRIPT nopost.sh ) diff --git a/Trigger/TrigValidation/TrigUpgradeTest/test/test_view_schedule.sh b/Trigger/TrigValidation/TrigUpgradeTest/test/test_view_schedule.sh deleted file mode 100755 index 8637d81c268..00000000000 --- a/Trigger/TrigValidation/TrigUpgradeTest/test/test_view_schedule.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/sh - -# This is not an ART test, but a unit test - -# This should be tested in AthViews rather that in TrigUpgradeTest - -if [ -z ${THREADS+x} ]; then export THREADS=2; fi -athena.py --threads=$THREADS AthViews/ViewScheduling.py -unset THREADS -- GitLab From c086801fabd150a16abaecffb1d389fc995c11d7 Mon Sep 17 00:00:00 2001 From: Savanna Marie Shaw Date: Tue, 9 Jun 2020 13:06:46 +0200 Subject: [PATCH 26/38] Remove view linking from muon trigger hypo Removing the view linking from the muon trigger hypo alg since this is done already in the input maker. Should fix the remaining muon related warnings discussed in ATR-21548. --- Trigger/TrigHypothesis/TrigMuonHypoMT/src/TrigMuonEFHypoAlg.cxx | 1 - 1 file changed, 1 deletion(-) diff --git a/Trigger/TrigHypothesis/TrigMuonHypoMT/src/TrigMuonEFHypoAlg.cxx b/Trigger/TrigHypothesis/TrigMuonHypoMT/src/TrigMuonEFHypoAlg.cxx index 1f280cabd20..c073232c858 100644 --- a/Trigger/TrigHypothesis/TrigMuonHypoMT/src/TrigMuonEFHypoAlg.cxx +++ b/Trigger/TrigHypothesis/TrigMuonHypoMT/src/TrigMuonEFHypoAlg.cxx @@ -85,7 +85,6 @@ StatusCode TrigMuonEFHypoAlg::execute( const EventContext& context ) const toolInput.emplace_back( newd, roi, muon, previousDecision ); newd -> setObjectLink( featureString(), muonEL ); - newd->setObjectLink( viewString(), viewEL); TrigCompositeUtils::linkToPrevious( newd, previousDecision, context ); ATH_MSG_DEBUG("REGTEST: " << m_muonKey.key() << " pT = " << (*muonEL)->pt() << " GeV"); -- GitLab From ef4e3dafbe2423bc36562ce7e249f7e3973e1b79 Mon Sep 17 00:00:00 2001 From: Alexander Solodkov Date: Tue, 9 Jun 2020 13:10:58 +0200 Subject: [PATCH 27/38] adding --end and --endlumi parameters to WriteCellNoiseToCool.py --- .../share/WriteBchToCool.py | 2 +- .../share/WriteCellNoiseToCool.py | 720 +++++++++--------- 2 files changed, 370 insertions(+), 352 deletions(-) diff --git a/TileCalorimeter/TileCalib/TileCalibBlobPython/share/WriteBchToCool.py b/TileCalorimeter/TileCalib/TileCalibBlobPython/share/WriteBchToCool.py index ea5ffa42981..ac487759bb5 100755 --- a/TileCalorimeter/TileCalib/TileCalibBlobPython/share/WriteBchToCool.py +++ b/TileCalorimeter/TileCalib/TileCalibBlobPython/share/WriteBchToCool.py @@ -374,7 +374,7 @@ if len(execFile): else: if comment=="None": comment = comments[io] - elif comments[io] not in comment: + elif iov and comments[io] not in comment: comment += " // " + comments[io] if io>0 and since!=until and 'ALL' not in moduleList: author=commentsSplit[io] diff --git a/TileCalorimeter/TileCalib/TileCalibBlobPython/share/WriteCellNoiseToCool.py b/TileCalorimeter/TileCalib/TileCalibBlobPython/share/WriteCellNoiseToCool.py index 58dc6a6ef34..93e6b63e263 100755 --- a/TileCalorimeter/TileCalib/TileCalibBlobPython/share/WriteCellNoiseToCool.py +++ b/TileCalorimeter/TileCalib/TileCalibBlobPython/share/WriteCellNoiseToCool.py @@ -7,10 +7,11 @@ # # 2014-07-14 - Sasha, based on update_noise_bulk.py from Carlos,Gui,Blake,Yuri # 2016-12-14 - Yuri Smirnov, change for PyCintex->cppyy for ROOT6 +# 2020-06-06 - Sasha - introducing --end and --endlumi parameters from __future__ import print_function -import getopt,sys,os,re +import getopt,sys,os,re,bisect os.environ['TERM'] = 'linux' def usage(): @@ -20,22 +21,26 @@ def usage(): print ("-h, --help shows this help") print ("-i, --infile= specify the input sqlite file or full schema string") print ("-o, --outfile= specify the output sqlite file") - print ("-a, --intag= specify the input tag") - print ("-g, --outtag= specify the output tag") + print ("-t, --intag= specify the input tag") + print ("-T, --outtag= specify the output tag") print ("-f, --folder= specify status folder to use e.g. /TILE/OFL02/NOISE/CELL ") print ("-d, --dbname= specify the database name e.g. OFLP200") - print ("-t, --txtfile= specify the text file with the new noise constants") + print ("-x, --txtfile= specify the text file with the new noise constants") print ("-r, --run= specify run number for start of IOV") - print ("-l, --lumi= specify lumiblock number for start of IOV") - print ("-b, --begin= make IOV in output file from (begin,0) to infinity") + print ("-l, --lumi= specify lumiblock number for start of IOV, default is 0") + print ("-b, --begin= specify run number of first iov in multi-iov mode, by default uses very first iov") + print ("-e, --end= specify run number of last iov in multi-iov mode, by default uses latest iov") + print ("-L, --endlumi= specify lumi block number for last iov in multi-iov mode, default is 0") + print ("-A, --adjust in multi-iov mode adjust iov boundaries to nearest iov available in DB, default is False") print ("-n, --channel= specify cool channel to use (48 by defalt)") print ("-s, --scale= specify scale factor for all the fields except ratio field") + print ("-u --update set this flag if output sqlite file should be updated, otherwise it'll be recreated") print ("--scaleElec= specify separate scale factor for all electronic noise fields except ratio field") print ("if run number and lumiblock number are omitted - all IOVs from input file are updated") -letters = "hi:o:a:g:f:d:t:r:l:b:n:s:" -keywords = ["help","infile=","outfile=","intag=","outtag=","folder=","dbname=","txtfile=","run=","lumi=","begin=","channel=", - "scale=","scaleA=","scaleB=","scaleD=","scaleE=","scaleD4=","scaleC10=","scaleD4sp=","scaleC10sp=","scaleElec="] +letters = "hi:o:t:T:f:d:x:r:l:b:e:L:A:n:s:u" +keywords = ["help","infile=","outfile=","intag=","outtag=","folder=","dbname=","txtfile=","run=","lumi=","begin=","end=","endlumi=","adjust", + "channel=","scale=","scaleA=","scaleB=","scaleD=","scaleE=","scaleD4=","scaleC10=","scaleD4sp=","scaleC10sp=","scaleElec=","update"] try: opts, extraparams = getopt.getopt(sys.argv[1:],letters,keywords) @@ -54,7 +59,12 @@ dbName = '' txtFile = '' run = -1 lumi = 0 -begin = -1 +beg = -1 +end = 2147483647 +endlumi = 0 +iov = True +adjust = False +update = False chan = 48 # represents Tile scale = 0.0 # means do not scale scaleA = 0.0 # scale for pileup term in A cells @@ -72,9 +82,9 @@ for o, a in opts: inFile = a elif o in ("-o","--outfile"): outFile = a - elif o in ("-a","--intag"): + elif o in ("-t","--intag"): inTag = a - elif o in ("-g","--outtag"): + elif o in ("-T","--outtag"): outTag = a elif o in ("-f","--folder"): folderPath = a @@ -82,10 +92,21 @@ for o, a in opts: dbName = a elif o in ("-r","--run"): run = int(a) + if run>=0: + iov = False elif o in ("-l","--lumi"): lumi = int(a) elif o in ("-b","--begin"): - begin = int(a) + beg = int(a) + iov = True + elif o in ("-e","--end"): + end = int(a) + elif o in ("-L","--endlumi"): + endlumi = int(a) + elif o in ("-A","--adjust"): + adjust = True + elif o in ("-u","--update"): + update = True elif o in ("-n","--channel"): chan = int(a) elif o in ("-s","--scale"): @@ -108,7 +129,7 @@ for o, a in opts: scaleC10sp = float(a) elif o in ("-s","--scaleElec"): scaleElec = float(a) - elif o in ("-t","--txtfile"): + elif o in ("-x","--txtfile"): txtFile = a elif o in ("-h","--help"): usage() @@ -173,33 +194,43 @@ if len(folderPath)<1: if len(dbName)<1: raise Exception("Please, provide dbname (e.g. --dbname=OFLP200 or --dbname=CONDBR2)") +import cppyy + +from CaloCondBlobAlgs import CaloCondTools, CaloCondLogger +from TileCalibBlobPython import TileCalibTools +from TileCalibBlobPython import TileCellTools + +# get a logger +log = CaloCondLogger.getLogger("WriteCellNoise") +import logging +if iov: + log.setLevel(logging.INFO) +else: + log.setLevel(logging.DEBUG) + + if inTag=="HEAD": inTag="" if outTag=="HEAD": outTag="" if os.path.isfile(inFile): - ischema = 'sqlite://;schema='+inFile+';dbname='+dbName + ischema = 'sqlite://;schema='+inFile+';dbname='+dbName else: - print ("File %s was not found, assuming it's full schema string" % inFile) - ischema = inFile - # possible strings for inFile: - # "oracle://ATLAS_COOLPROD;schema=ATLAS_COOLOFL_CALO;dbname=OFLP200" - # "oracle://ATLAS_COOLPROD;schema=ATLAS_COOLOFL_TILE;dbname=OFLP200" - # COOLOFL_TILE/OFLP200 COOLOFL_TILE/COMP200 COOLOFL_TILE/CONDBR2 - - -import cppyy - -from CaloCondBlobAlgs import CaloCondTools -from TileCalibBlobPython import TileCalibTools -from TileCalibBlobPython import TileCellTools + log.info("File %s was not found, assuming it's full schema string" , inFile) + ischema = inFile + # possible strings for inFile: + # "oracle://ATLAS_COOLPROD;schema=ATLAS_COOLOFL_CALO;dbname=OFLP200" + # "oracle://ATLAS_COOLPROD;schema=ATLAS_COOLOFL_TILE;dbname=OFLP200" + # COOLOFL_TILE/OFLP200 COOLOFL_TILE/COMP200 COOLOFL_TILE/CONDBR2 + +rb = max(run,beg) if run<0: cabling = 'RUN2a' elif run<222222 or 'COMP200' in ischema: cabling = 'RUN1' else: - if ('OFLP200' in ischema and run>=310000) or run>=343000: + if ('OFLP200' in ischema and rb>=310000) or rb>=343000: cabling = 'RUN2a' else: cabling = 'RUN2' @@ -209,48 +240,84 @@ hashMgrA=TileCellTools.TileCellHashMgr("UpgradeA") hashMgrBC=TileCellTools.TileCellHashMgr("UpgradeBC") hashMgrABC=TileCellTools.TileCellHashMgr("UpgradeABC") -#=== Get list of IOVs by tricking TileCalibTools to read a Calo blob -idb = TileCalibTools.openDbConn(ischema,'READONLY') iovList = [] -try: - blobReader = TileCalibTools.TileBlobReader(idb,folderPath, inTag) - dbobjs = blobReader.getDBobjsWithinRange(-1, chan) - if (dbobjs is None): - raise Exception("No DB objects retrieved when building IOV list!") - while dbobjs.goToNext(): - obj = dbobjs.currentRef() - objsince = obj.since() - sinceRun = objsince >> 32 - sinceLum = objsince & 0xFFFFFFFF - since = (sinceRun, sinceLum) - objuntil = obj.until() - untilRun = objuntil >> 32 - untilLum = objuntil & 0xFFFFFFFF - until = (untilRun, untilLum) - - iov = (since, until) - iovList.append(iov) -except Exception: - print ("Warning: can not read IOVs from input DB file") - if run<0: - raise Exception("Please, provide run number at command line") - else: - print ("Using IOV starting run run %d" %run) - since = (run, lumi) - until = (0xFFFFFFFF, 0xFFFFFFFF) - iov = (since, until) - iovList.append(iov) -idb.closeDatabase() +iovUntil = [] +until = (TileCalibTools.MAXRUN,TileCalibTools.MAXLBK) +if end >= TileCalibTools.MAXRUN: + end = TileCalibTools.MAXRUN + endlumi = TileCalibTools.MAXLBK + +if iov: + #=== Get list of IOVs by tricking TileCalibTools to read a Calo blob + idb = TileCalibTools.openDbConn(ischema,'READONLY') + try: + blobReader = TileCalibTools.TileBlobReader(idb,folderPath, inTag) + iovList = blobReader.getIOVsWithinRange(-1,chan) + except Exception: + log.warning("Can not read IOVs from input DB file") + idb.closeDatabase() + + iovList += [until] + if beg<0: + since = iovList[0] + else: + since = (beg, lumi) + ib=bisect.bisect(iovList,since)-1 + if ib<0: + ib=0 + if iovList[ib] != since: + if adjust: + since = iovList[ib] + log.info( "Moving beginning of first IOV with new cell noise from (%d,%d) to (%d,%d)" , beg,lumi,since[0],since[1]) + else: + iovList[ib] = since + log.info( "Creating new IOV starting from (%d,%d) with new cell noise" , beg,lumi) + + if end<0: + ie=ib+1 + if ie>=len(iovList): + ie=ib + until=iovList[ie] + log.info( "Next IOV with old cell noise starts from (%d,%d)" , until[0],until[1]) + else: + until=(end,endlumi) + ie=bisect.bisect_left(iovList,until) + if ie>=len(iovList): + ie=len(iovList)-1 + + if iovList[ie] != until: + if adjust: + until=iovList[ie] + log.info( "Moving end of last IOV from (%d,%d) to (%d,%d)" , end,endlumi,until[0],until[1]) + else: + log.info( "Keeping end of last IOV at (%d,%d) - new IOV is shorter than IOV in input DB" , end,endlumi) + iovList[ie] = until + + iovList = iovList[ib:ie] + iovUntil = iovList[1:] + [until] + run = since[0] + lumi = since[1] + log.info( "IOVs: %s" , str(iovList)) + log.info( "%d IOVs in total, end of last IOV is %s" , ie-ib,str(until)) + +if len(iovList)==0: + if run<0: + raise Exception("Please, provide run number at command line") + else: + log.info( "Creating single IOV starting from run,lumi %d,%d" , run,lumi) + since = (run, lumi) + until = (end, endlumi) + iovList = [since] + iovUntil = [until] #=== Open DB connections oschema = 'sqlite://;schema='+outFile+';dbname='+dbName dbr = CaloCondTools.openDbConn(ischema,'READONLY') -#dbw = CaloCondTools.openDbConn(oschema,'RECREATE') -dbw = CaloCondTools.openDbConn(oschema,'UPDATE') +update = update or (inFile==outFile) +dbw = CaloCondTools.openDbConn(oschema,('UPDATE' if update else 'RECREATE')) reader = CaloCondTools.CaloBlobReader(dbr,folderPath,inTag) writer = CaloCondTools.CaloBlobWriter(dbw,folderPath,'Flt',(outTag!="" and outTag!="HEAD")) -from TileCalibBlobPython.TileCalibTools import MAXRUN, MAXLBK #== read input file cellData = {} @@ -265,311 +332,262 @@ useGain=None if len(txtFile): # try: with open(txtFile,"r") as f: - cellDataText = f.readlines() + cellDataText = f.readlines() for line in cellDataText: - fields = line.strip().split() - #=== ignore empty and comment lines - if not len(fields) : - continue - if fields[0].startswith("#"): - continue - - if fields[0][:1].isalpha(): - print (fields) - if useNames is not None and not useNames: - raise Exception("Mixture of formats in inpyt file %s - useNames" % (txtFile)) - useNames=True - if fields[0]=='Cell': - if useModuleNames is not None and useModuleNames: - raise Exception("Mixture of formats in inpyt file %s - useModuleNames" % (txtFile)) - useModuleNames=False - modName='' - cellName=fields[1] - else: - if useModuleNames is not None and not useModuleNames: - raise Exception("Mixture of formats in inpyt file %s - useModuleNames" % (txtFile)) - useModuleNames=True - modName=fields[0] - cellName=fields[1] - if fields[2].isdigit(): - if useGain is not None and not useGain: - raise Exception("Mixture of formats in inpyt file %s - useGain" % (txtFile)) - useGain=True - gain=int(fields[2]) - noise = fields[3:] - if ival3: - raise Exception("Too many fields in input file %s" % (txtFile)) - useGain=False - gain=-1 - noise = [-1]+fields[2:] - ival=1 - if cellName=='D0': - cellName='D*0' - if cellName.startswith('BC'): - cellName='B'+cellName[2:] - if not ('+' in cellName or '-' in cellName or '*' in cellName): - p = re.search("\\d", cellName).start() - cellPos = modName+cellName[:p] + '+' + cellName[p:] - cellNeg = modName+cellName[:p] + '-' + cellName[p:] - dictKey = (cellPos,gain) - cellData[dictKey] = noise - dictKey = (cellNeg,gain) - cellData[dictKey] = noise - if (cellName=='spE1'): - for cellNm in ['mbE+1','mbE-1','e4E+1','e4E-1']: - cellN = modName+cellNm - dictKey = (cellN,gain) - if dictKey not in cellData: - cellData[dictKey] = noise - else: - cellN = modName+cellName - dictKey = (cellN,gain) - cellData[dictKey] = noise - if (cellName=='spE+1'): - for cellNm in ['mbE+1','e4E+1']: - cellN = modName+cellNm - dictKey = (cellN,gain) - if dictKey not in cellData: - cellData[dictKey] = noise - if (cellName=='spE-1'): - for cellNm in ['mbE-1','e4E-1']: - cellN = modName+cellNm - dictKey = (cellN,gain) - if dictKey not in cellData: - cellData[dictKey] = noise - icell[gain]+=1 - else: - if useNames is not None and useNames: - raise Exception("Mixture of formats in inpyt file %s - useNames" % (txtFile)) - useNames=False - cellHash = int(fields[0]) - cellGain = int(fields[1]) - noise = fields[2:] - dictKey = (cellHash,cellGain) - cellData[dictKey] = noise - if icell3: + raise Exception("Too many fields in input file %s" % (txtFile)) + useGain=False + gain=-1 + noise = [-1]+fields[2:] + ival=1 + if cellName=='D0': + cellName='D*0' + if cellName.startswith('BC'): + cellName='B'+cellName[2:] + if not ('+' in cellName or '-' in cellName or '*' in cellName): + p = re.search("\\d", cellName).start() + cellPos = modName+cellName[:p] + '+' + cellName[p:] + cellNeg = modName+cellName[:p] + '-' + cellName[p:] + dictKey = (cellPos,gain) + cellData[dictKey] = noise + dictKey = (cellNeg,gain) + cellData[dictKey] = noise + if (cellName=='spE1'): + for cellNm in ['mbE+1','mbE-1','e4E+1','e4E-1']: + cellN = modName+cellNm + dictKey = (cellN,gain) + if dictKey not in cellData: + cellData[dictKey] = noise + else: + cellN = modName+cellName + dictKey = (cellN,gain) + cellData[dictKey] = noise + if (cellName=='spE+1'): + for cellNm in ['mbE+1','e4E+1']: + cellN = modName+cellNm + dictKey = (cellN,gain) + if dictKey not in cellData: + cellData[dictKey] = noise + if (cellName=='spE-1'): + for cellNm in ['mbE-1','e4E-1']: + cellN = modName+cellNm + dictKey = (cellN,gain) + if dictKey not in cellData: + cellData[dictKey] = noise + icell[gain]+=1 + else: + if useNames is not None and useNames: + raise Exception("Mixture of formats in inpyt file %s - useNames" % (txtFile)) + useNames=False + cellHash = int(fields[0]) + cellGain = int(fields[1]) + noise = fields[2:] + dictKey = (cellHash,cellGain) + cellData[dictKey] = noise + if icell[gain]=0 and len(iovList)>0: - if begin>=0: - print ("Updating only one IOV which contains run %d lb %d" % (run,lumi)) - else: - print ("Updating only IOVs starting from run %d lumi %d " % (run,lumi)) - start=0 - for iov in iovList: - until = iov[1] - untilRun = until[0] - if untilRun0: - iovList = iovList[start:] - if begin>=0: - iovList = iovList[:1] -#== update only one IOV from input DB if we are reading numbers from file -if (ncell>0 and nval>2): - if (run>0): - if begin<-1: - iovList=iovList[0:-begin] - print ("Updating",len(iovList),"IOVs") - else: - if (len(iovList)>1): - print ("Updating only single IOV") - iovList = iovList[0:1] - iov=iovList[0] - since = (run, lumi) - until = iov[1] - iov = (since, until) - iovList = [ iov ] - else: - if (len(iovList)>1): - print ("Updating only last IOV") - iovList = iovList[len(iovList)-1:] - -if begin>=0 and len(iovList)>1: - raise Exception("-begin flag can not be used with multiple IOVs, please provide run number inside one IOV") - if not tile: - modName="LAr %2d" % chan - cellName="" - fullName=modName + modName="LAr %2d" % chan + cellName="" + fullName=modName #=== loop over all iovs -for iov in iovList: - - since = iov[0] - sinceRun = since[0] - sinceLum = since[1] - - until = iov[1] - untilRun = until[0] - untilLum = until[1] - - print ("IOV in input DB [%d,%d]-[%d,%d)" % (sinceRun, sinceLum, untilRun, untilLum)) - - blobR = reader.getCells(chan,(sinceRun,sinceLum)) - mcell=blobR.getNChans() - mgain=blobR.getNGains() - mval=blobR.getObjSizeUint32() - - print ("input file: ncell: %d ngain %d nval %d" % (max(icell), igain, ival)) - print ("input db: ncell: %d ngain %d nval %d" % (mcell, mgain, mval)) - if mcell>ncell: - ncell=mcell - if mgain>ngain: - ngain=mgain - if mval>nval: - nval=mval - - print ("output db: ncell: %d ngain %d nval %d" % (ncell, ngain, nval)) - - if ncell>hashMgrA.getHashMax(): - hashMgr=hashMgrABC - elif ncell>hashMgrBC.getHashMax(): - hashMgr=hashMgrA - elif ncell>hashMgrDef.getHashMax(): - hashMgr=hashMgrBC - else: - hashMgr=hashMgrDef - print ("Using %s CellMgr with hashMax %d" % (hashMgr.getGeometry(),hashMgr.getHashMax())) - - GainDefVec = cppyy.gbl.std.vector('float')() - for val in range(nval): - GainDefVec.push_back(0.0) - defVec = cppyy.gbl.std.vector('std::vector')() - for gain in range(ngain): - defVec.push_back(GainDefVec) - blobW = writer.getCells(chan) - blobW.init(defVec,ncell,1) - - src = ['Default','DB','File','Scale'] - FullName=None - cell=None - gain=None - field=None - strval=None - noise=None - - try: - for cell in range(ncell): - exist0 = (cell4: - if 'spC' in cellName: - sc = scaleC10sp - elif 'spD' in cellName: - sc = scaleD4sp - elif 'C' in cellName and '10' in cellName: - sc = scaleC10 - elif 'D' in cellName and '4' in cellName: - sc = scaleD4 - elif 'E' in cellName: - sc = scaleE - elif 'D' in cellName: - sc = scaleD - elif 'B' in cellName: - sc = scaleB - elif 'A' in cellName: - sc = scaleA - else: - sc = scale - if sc>0.0: - exist = 3 - value *= sc - src[exist] = "ScalePileUp %s" % str(sc) - elif field<4 and scaleElec>0.0: - exist = 3 - value *= scaleElec - src[exist] = "ScaleElec %s" % str(scaleElec) - - blobW.setData( cell, gain, field, value ) - if rescale or exist>1: - print ("%s hash %4d gain %d field %d value %f Source %s" % (fullName, cell, gain, field, value, src[exist])) - except Exception as e: - print ("Exception on IOV [%d,%d]-[%d,%d)" % (sinceRun, sinceLum, untilRun, untilLum)) - print (FullName,"Cell",cell,"gain",gain,"field",field,"value",strval,"noise vector",noise) - #e = sys.exc_info()[0] - print (e) - - if begin>=0: - print ("IOV in output DB [%d,%d]-[%d,%d)" % (begin, 0, MAXRUN, MAXLBK)) - writer.register((begin,0), (MAXRUN, MAXLBK), outTag) - else: - print ("IOV in output DB [%d,%d]-[%d,%d)" % (sinceRun, sinceLum, untilRun, untilLum)) - writer.register((sinceRun,sinceLum), (untilRun,untilLum), outTag) - -print ("Using %s CellMgr with hashMax %d" % (hashMgr.getGeometry(),hashMgr.getHashMax())) +for io,since in enumerate(iovList): + + sinceRun = since[0] + sinceLum = since[1] + + until=iovUntil[io] + untilRun = until[0] + untilLum = until[1] + + log.info("") + log.info("Updating IOV [%d,%d] - [%d,%d)" , sinceRun, sinceLum, untilRun, untilLum) + + blobR = reader.getCells(chan,(sinceRun,sinceLum)) + if blobR is None: + continue + mcell=blobR.getNChans() + mgain=blobR.getNGains() + mval=blobR.getObjSizeUint32() + + log.info("input file: ncell: %d ngain %d nval %d" , max(icell), igain, ival) + log.info("input db: ncell: %d ngain %d nval %d" , mcell, mgain, mval) + if mcell>ncell: + ncell=mcell + if mgain>ngain: + ngain=mgain + if mval>nval: + nval=mval + + log.info("output db: ncell: %d ngain %d nval %d" , ncell, ngain, nval) + + if ncell>hashMgrA.getHashMax(): + hashMgr=hashMgrABC + elif ncell>hashMgrBC.getHashMax(): + hashMgr=hashMgrA + elif ncell>hashMgrDef.getHashMax(): + hashMgr=hashMgrBC + else: + hashMgr=hashMgrDef + log.info("Using %s CellMgr with hashMax %d" , hashMgr.getGeometry(),hashMgr.getHashMax()) + + GainDefVec = cppyy.gbl.std.vector('float')() + for val in range(nval): + GainDefVec.push_back(0.0) + defVec = cppyy.gbl.std.vector('std::vector')() + for gain in range(ngain): + defVec.push_back(GainDefVec) + blobW = writer.getCells(chan) + blobW.init(defVec,ncell,1) + + src = ['Default','DB','File','Scale'] + FullName=None + cell=None + gain=None + field=None + strval=None + noise=None + + try: + for cell in range(ncell): + exist0 = (cell4: + if 'spC' in cellName: + sc = scaleC10sp + elif 'spD' in cellName: + sc = scaleD4sp + elif 'C' in cellName and '10' in cellName: + sc = scaleC10 + elif 'D' in cellName and '4' in cellName: + sc = scaleD4 + elif 'E' in cellName: + sc = scaleE + elif 'D' in cellName: + sc = scaleD + elif 'B' in cellName: + sc = scaleB + elif 'A' in cellName: + sc = scaleA + else: + sc = scale + if sc>0.0: + exist = 3 + value *= sc + src[exist] = "ScalePileUp %s" % str(sc) + elif field<4 and scaleElec>0.0: + exist = 3 + value *= scaleElec + src[exist] = "ScaleElec %s" % str(scaleElec) + + blobW.setData( cell, gain, field, value ) + if rescale or exist>1: + print ("%s hash %4d gain %d field %d value %f Source %s" % (fullName, cell, gain, field, value, src[exist])) + except Exception as e: + log.warning("Exception on IOV [%d,%d]-[%d,%d)" , sinceRun, sinceLum, untilRun, untilLum) + print (FullName,"Cell",cell,"gain",gain,"field",field,"value",strval,"noise vector",noise) + #e = sys.exc_info()[0] + print (e) + + writer.register((sinceRun,sinceLum), (untilRun,untilLum), outTag) + +log.info("Using %s CellMgr with hashMax %d" , hashMgr.getGeometry(),hashMgr.getHashMax()) #=== Cleanup dbw.closeDatabase() dbr.closeDatabase() - -- GitLab From 2980c785eb0f3341e5f689d360fb4ab9ae841c86 Mon Sep 17 00:00:00 2001 From: Nicolas Koehler Date: Tue, 9 Jun 2020 13:20:34 +0000 Subject: [PATCH 28/38] Remove import of non-existant assertCastorStager function (ATLASRECTS-5542) --- .../MuonRecExample/share/MuonRec_myTopOptions.py | 1 - .../MuonRecExample/share/MuonRec_myTopOptions_MT.py | 1 - .../RecExRecoTest/share/RecExRecoTest_ART_muons_fromESD.py | 1 - .../share/RecJobTransformTests_MuonRec_myTopOptions_MT.py | 1 - 4 files changed, 4 deletions(-) diff --git a/MuonSpectrometer/MuonReconstruction/MuonRecExample/share/MuonRec_myTopOptions.py b/MuonSpectrometer/MuonReconstruction/MuonRecExample/share/MuonRec_myTopOptions.py index f7190ce0689..4f304b37278 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonRecExample/share/MuonRec_myTopOptions.py +++ b/MuonSpectrometer/MuonReconstruction/MuonRecExample/share/MuonRec_myTopOptions.py @@ -20,7 +20,6 @@ import MuonRecExample.MuonRecStandaloneOnlySetup from MuonCombinedRecExample.MuonCombinedRecFlags import muonCombinedRecFlags from MuonRecExample import MuonRecUtils -from MuonRecExample.MuonRecUtils import assertCastorStager,hasJobPropertyBeenSet #Need the beam spot for the TrackParticleCreator if not ('conddb' in dir()): diff --git a/MuonSpectrometer/MuonReconstruction/MuonRecExample/share/MuonRec_myTopOptions_MT.py b/MuonSpectrometer/MuonReconstruction/MuonRecExample/share/MuonRec_myTopOptions_MT.py index dd87fc0a31b..aca4275e75d 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonRecExample/share/MuonRec_myTopOptions_MT.py +++ b/MuonSpectrometer/MuonReconstruction/MuonRecExample/share/MuonRec_myTopOptions_MT.py @@ -19,7 +19,6 @@ import MuonRecExample.MuonRecStandaloneOnlySetup from MuonCombinedRecExample.MuonCombinedRecFlags import muonCombinedRecFlags from MuonRecExample import MuonRecUtils -from MuonRecExample.MuonRecUtils import assertCastorStager,hasJobPropertyBeenSet #-------------------------------------------------------------------------------- # Input #-------------------------------------------------------------------------------- diff --git a/Reconstruction/RecExample/RecExRecoTest/share/RecExRecoTest_ART_muons_fromESD.py b/Reconstruction/RecExample/RecExRecoTest/share/RecExRecoTest_ART_muons_fromESD.py index 1b73e28c5c0..eee05a6cadb 100644 --- a/Reconstruction/RecExample/RecExRecoTest/share/RecExRecoTest_ART_muons_fromESD.py +++ b/Reconstruction/RecExample/RecExRecoTest/share/RecExRecoTest_ART_muons_fromESD.py @@ -23,7 +23,6 @@ import MuonRecExample.MuonRecStandaloneOnlySetup from MuonCombinedRecExample.MuonCombinedRecFlags import muonCombinedRecFlags from MuonRecExample import MuonRecUtils -from MuonRecExample.MuonRecUtils import assertCastorStager,hasJobPropertyBeenSet #Need the beam spot for the TrackParticleCreator if not ('conddb' in dir()): diff --git a/Reconstruction/RecExample/RecJobTransformTests/share/RecJobTransformTests_MuonRec_myTopOptions_MT.py b/Reconstruction/RecExample/RecJobTransformTests/share/RecJobTransformTests_MuonRec_myTopOptions_MT.py index 702dd511c82..01b64f1749c 100644 --- a/Reconstruction/RecExample/RecJobTransformTests/share/RecJobTransformTests_MuonRec_myTopOptions_MT.py +++ b/Reconstruction/RecExample/RecJobTransformTests/share/RecJobTransformTests_MuonRec_myTopOptions_MT.py @@ -19,7 +19,6 @@ import MuonRecExample.MuonRecStandaloneOnlySetup from MuonCombinedRecExample.MuonCombinedRecFlags import muonCombinedRecFlags from MuonRecExample import MuonRecUtils -from MuonRecExample.MuonRecUtils import assertCastorStager,hasJobPropertyBeenSet #-------------------------------------------------------------------------------- # Input #-------------------------------------------------------------------------------- -- GitLab From 07e32bc3470aca4417d7619da047a6109b0e8b74 Mon Sep 17 00:00:00 2001 From: Frank Berghaus Date: Tue, 9 Jun 2020 15:21:43 +0200 Subject: [PATCH 29/38] Use EventSelector from service manager Fix ATLASSIM-4605 When doing the large scale change removing ByteStreamInputSvc's FullFileName (!33370) I did not realize that EventSelector was not defined in the BSOverlay transform skeleton. This fetches the EventSelector from the service manager. --- .../share/skeleton.BSOverlayFilter_tf.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Event/EventOverlay/EventOverlayJobTransforms/share/skeleton.BSOverlayFilter_tf.py b/Event/EventOverlay/EventOverlayJobTransforms/share/skeleton.BSOverlayFilter_tf.py index 01026f34be5..36e11a18f86 100644 --- a/Event/EventOverlay/EventOverlayJobTransforms/share/skeleton.BSOverlayFilter_tf.py +++ b/Event/EventOverlay/EventOverlayJobTransforms/share/skeleton.BSOverlayFilter_tf.py @@ -37,11 +37,11 @@ BSFilterLog.info( '**** ByteStreamInputSvc configuration' ) include( "ByteStreamCnvSvc/BSEventStorageEventSelector_jobOptions.py" ) ByteStreamInputSvc = svcMgr.ByteStreamInputSvc -# EventSelector.Input = open(runArgs.InputFileMapFile).readline().rstrip().split(',') +# svcMgr.EventSelector.Input = open(runArgs.InputFileMapFile).readline().rstrip().split(',') if hasattr( runArgs, 'inputZeroBiasBSFile'): - EventSelector.Input=runArgs.inputZeroBiasBSFile + svcMgr.EventSelector.Input=runArgs.inputZeroBiasBSFile else: - EventSelector.Input=runArgs.inputBS_SKIMFile + svcMgr.EventSelector.Input=runArgs.inputBS_SKIMFile print ByteStreamInputSvc # --------------------------- -- GitLab From 04b6deea517a66319e36fda8e7ad5f2be819da5f Mon Sep 17 00:00:00 2001 From: Alaettin Serhan Mete Date: Tue, 9 Jun 2020 17:51:21 +0000 Subject: [PATCH 30/38] Code clean-up for PerfMonMT --- .../PerfMonComps/python/MTJobOptCfg.py | 4 - .../PerfMonComps/python/PerfMonFlags.py | 2 +- .../share/PerfMonMTSvc_jobOptions.py | 20 +-- .../share/PerfMonMTSvc_plotter.py | 165 ------------------ .../PerfMonComps/src/PerfMonMTSvc.cxx | 72 ++++---- .../PerfMonComps/src/PerfMonMTSvc.h | 4 +- .../PerfMonComps/src/PerfMonMTUtils.h | 140 +++++++-------- 7 files changed, 115 insertions(+), 292 deletions(-) delete mode 100644 Control/PerformanceMonitoring/PerfMonComps/share/PerfMonMTSvc_plotter.py diff --git a/Control/PerformanceMonitoring/PerfMonComps/python/MTJobOptCfg.py b/Control/PerformanceMonitoring/PerfMonComps/python/MTJobOptCfg.py index 58650844c3c..35b25d9ba70 100644 --- a/Control/PerformanceMonitoring/PerfMonComps/python/MTJobOptCfg.py +++ b/Control/PerformanceMonitoring/PerfMonComps/python/MTJobOptCfg.py @@ -48,7 +48,6 @@ class PerfMonMTSvc ( _PerfMonMTSvc ): ## Set the monitoring check points from AthenaCommon.ConcurrencyFlags import jobproperties as jp - handle.checkPointFactor = max(10,jp.ConcurrencyFlags.NumThreads()) handle.numberOfThreads = max(1,jp.ConcurrencyFlags.NumThreads()) handle.numberOfSlots = max(1,jp.ConcurrencyFlags.NumConcurrentEvents()) @@ -61,9 +60,6 @@ class PerfMonMTSvc ( _PerfMonMTSvc ): if jobproperties.PerfMonFlags.doFullMonMT(): handle.doComponentLevelMonitoring = True - ## Turn on JSON reporting - handle.reportResultsToJSON = True - return pass # class PerfMonMTSvc diff --git a/Control/PerformanceMonitoring/PerfMonComps/python/PerfMonFlags.py b/Control/PerformanceMonitoring/PerfMonComps/python/PerfMonFlags.py index 5df1cf26217..6dddf2c60f6 100644 --- a/Control/PerformanceMonitoring/PerfMonComps/python/PerfMonFlags.py +++ b/Control/PerformanceMonitoring/PerfMonComps/python/PerfMonFlags.py @@ -136,7 +136,7 @@ class doMonitoringMT(JobProperty): # Setup PerfMonAlg from AthenaCommon.AlgSequence import AthSequencer topSequence = AthSequencer("AthAlgSeq") - if not hasattr(topSequence, "PerfMonMTSvcAlg"): + if not hasattr(topSequence, "PerfMonMTAlg"): from PerfMonComps.PerfMonCompsConf import PerfMonMTAlg topSequence += PerfMonMTAlg("PerfMonMTAlg") return diff --git a/Control/PerformanceMonitoring/PerfMonComps/share/PerfMonMTSvc_jobOptions.py b/Control/PerformanceMonitoring/PerfMonComps/share/PerfMonMTSvc_jobOptions.py index dcc0c03ecc1..3936f4053b1 100644 --- a/Control/PerformanceMonitoring/PerfMonComps/share/PerfMonMTSvc_jobOptions.py +++ b/Control/PerformanceMonitoring/PerfMonComps/share/PerfMonMTSvc_jobOptions.py @@ -6,30 +6,16 @@ from AthenaCommon.AppMgr import ServiceMgr as svcMgr from AthenaCommon.ConcurrencyFlags import jobproperties as jp import os,psutil -log = logging.getLogger("PerfMonMTSvc_jobOptions.py") +log = logging.getLogger("PerfMonMT") log.info("Setting up PerfMonMT...") - ############################### # Load PerfMonMTSvc ############################### if not hasattr(svcMgr, 'PerfMonMTSvc'): from PerfMonComps.MTJobOptCfg import PerfMonMTSvc svcMgr += PerfMonMTSvc("PerfMonMTSvc") - # Report results into json by default - svcMgr.PerfMonMTSvc.reportResultsToJSON = True - # Enable event loop monitoring by default - svcMgr.PerfMonMTSvc.doEventLoopMonitoring = True - # Disable component level monitoring by default - svcMgr.PerfMonMTSvc.doComponentLevelMonitoring = False - # Enable detailed table printing by default - svcMgr.PerfMonMTSvc.printDetailedTables = True - # Print only the top 50 components (sorted by CPU time) by default - svcMgr.PerfMonMTSvc.printNComps = 50 - # Configure the check point sequence in the event loop monitoring. - # By default common difference is the number of threads with which the job is running - svcMgr.PerfMonMTSvc.checkPointType = "Arithmetic" - svcMgr.PerfMonMTSvc.checkPointFactor = max(10,jp.ConcurrencyFlags.NumThreads()) + # Set the job start time svcMgr.PerfMonMTSvc.wallTimeOffset = psutil.Process(os.getpid()).create_time() * 1000 # Get the job start time in ms # Set number of threads/slots svcMgr.PerfMonMTSvc.numberOfThreads = max(1,jp.ConcurrencyFlags.NumThreads()) @@ -40,7 +26,7 @@ if not hasattr(svcMgr, 'PerfMonMTSvc'): ############################### from AthenaCommon.AlgSequence import AthSequencer topSequence = AthSequencer("AthAlgSeq") -if not hasattr(topSequence, "PerfMonMTSvcAlg"): +if not hasattr(topSequence, "PerfMonMTAlg"): from PerfMonComps.PerfMonCompsConf import PerfMonMTAlg topSequence += PerfMonMTAlg("PerfMonMTAlg") pass diff --git a/Control/PerformanceMonitoring/PerfMonComps/share/PerfMonMTSvc_plotter.py b/Control/PerformanceMonitoring/PerfMonComps/share/PerfMonMTSvc_plotter.py deleted file mode 100644 index c2264f07ad8..00000000000 --- a/Control/PerformanceMonitoring/PerfMonComps/share/PerfMonMTSvc_plotter.py +++ /dev/null @@ -1,165 +0,0 @@ -# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration - -# @author: Hasan Ozturk - - -__author__ = "Hasan Ozturk measurement_threshold: - components.append(component) - cpu_times.append(cpu_time) # Clear! - wall_times.append(wall_time) - - # Sort the components - - # Prepare the necessary data structures for sorting ( could be more efficient! ) - cpu_wall_tuple_list = zip(cpu_times, wall_times) - comp_dict = dict( zip(components, cpu_wall_tuple_list) ) - sortby_list = [ cpu + wall for cpu, wall in zip(cpu_times, wall_times)] - sort_dict = dict(zip(components, sortby_list)) - - # Sort the components according to wall_time + cpu time - sorted_comp_tuple_list = sorted(sort_dict.items() , key = operator.itemgetter(1)) - - sorted_components = [] - sorted_cpu_times = [] - sorted_wall_times = [] - - # Fill the necessary lists for plotting - for idx in sorted_comp_tuple_list: - curr_comp = idx[0] - curr_cpu = comp_dict[curr_comp][0] - curr_wall = comp_dict[curr_comp][1] - - sorted_components.append(curr_comp) - sorted_cpu_times.append(curr_cpu) - sorted_wall_times.append(curr_wall) - - # if there is no nonzero measurement in the step, then skip it - if len(sorted_components) == 0: - continue - - # Horizontal Bar Chart - ax = fig.add_subplot(stepNum,1,i+1) - - index = np.arange(len(sorted_components)) - bar_width = 0.35 - opacity = 0.8 - - rects1 = plt.barh(index + (1.5)*bar_width, sorted_cpu_times,bar_width, - alpha=opacity, - label='CPU Time') - - rects2 = plt.barh(index + bar_width/2, sorted_wall_times, bar_width, - alpha=opacity, - label='Wall Time') - - plt.ylabel('Components',fontsize = 35) - plt.xlabel('Time(ms)', fontsize = 35) - plt.title(step, fontsize = 40, fontweight = "bold") - plt.yticks(index + bar_width, sorted_components) - plt.legend(prop={'size': 30}) - - ax.tick_params(axis='both', which='major', labelsize=30) - ax.tick_params(axis='both', which='minor', labelsize=30) - - - fig.set_tight_layout( True ) - - - fig.savefig(plotname) - - -with open( result_file ) as json_file: - data = json.load(json_file) - - snapshot_data = data['Snapshot_level'] - snapshot_plotter(snapshot_data, 'snapshot_level.pdf') - - serial_complevel_data = data['Serial_Component_level'] - comp_plotter(serial_complevel_data, 'serial_complevel.pdf') - - parallel_complevel_data = data['Parallel_Component_level'] - comp_plotter(parallel_complevel_data, 'parallel_complevel.pdf') - diff --git a/Control/PerformanceMonitoring/PerfMonComps/src/PerfMonMTSvc.cxx b/Control/PerformanceMonitoring/PerfMonComps/src/PerfMonMTSvc.cxx index cd52c4c97ac..8a812befddc 100644 --- a/Control/PerformanceMonitoring/PerfMonComps/src/PerfMonMTSvc.cxx +++ b/Control/PerformanceMonitoring/PerfMonComps/src/PerfMonMTSvc.cxx @@ -16,8 +16,6 @@ // STD includes #include -using json = nlohmann::json; // for convenience - /* * Constructor */ @@ -60,6 +58,12 @@ StatusCode PerfMonMTSvc::initialize() { // Print where we are ATH_MSG_INFO("Initializing " << name()); + // Check if /proc exists, if not memory statistics are not available + const bool procExists = PMonMT::doesDirectoryExist("/proc"); + if(!procExists) { + ATH_MSG_INFO("The system doesn't support /proc. Therefore, memory measurements are not available"); + } + // Print some information minimal information about our configuration ATH_MSG_INFO("Service is configured for [" << m_numberOfThreads.toString() << "] threads " << "analyzing [" << m_numberOfSlots.toString() << "] events concurrently"); @@ -248,20 +252,20 @@ void PerfMonMTSvc::eventLevelMon() { // Lock for data integrity std::lock_guard lock(m_mutex_capture); - // If enabled, do event level monitoring - if (m_doEventLoopMonitoring) { - if (isCheckPoint()) { - // Capture - m_measurement_events.capture_event(m_eventCounter); - m_eventLevelData.record_event(m_measurement_events, m_eventCounter); - // Report instantly - no more than m_eventLoopMsgLimit times - if(m_eventLoopMsgCounter < m_eventLoopMsgLimit) { - report2Log_EventLevel_instant(); - m_eventLoopMsgCounter++; - } + // Increment the internal counter + incrementEventCounter(); + + // Monitor + if (m_doEventLoopMonitoring && isCheckPoint()) { + // Capture + m_measurement_events.capture_event(); + m_eventLevelData.record_event(m_measurement_events, m_eventCounter); + // Report instantly - no more than m_eventLoopMsgLimit times + if(m_eventLoopMsgCounter < m_eventLoopMsgLimit) { + report2Log_EventLevel_instant(); + m_eventLoopMsgCounter++; } } - incrementEventCounter(); } /* @@ -274,10 +278,17 @@ void PerfMonMTSvc::incrementEventCounter() { m_eventCounter++; } * Is it event-level monitoring check point yet? */ bool PerfMonMTSvc::isCheckPoint() { + // Always check 1, 10, 25 for short tests + if (m_eventCounter == 1 || m_eventCounter == 10 || m_eventCounter == 25) + return true; + + // Check the user settings if (m_checkPointType == "Arithmetic") return (m_eventCounter % m_checkPointFactor == 0); - else + else if (m_checkPointType == "Geometric") return isPower(m_eventCounter, m_checkPointFactor); + else + return false; } /* @@ -308,19 +319,13 @@ void PerfMonMTSvc::report2Log() { // Header report2Log_Description(); - // Detailed tables - const bool procExists = doesDirectoryExist("/proc"); - if (!procExists) { - ATH_MSG_INFO("There is no /proc directory in this system, therefore memory monitoring has failed!"); - } - // Component-level - if (m_printDetailedTables && procExists && m_doComponentLevelMonitoring) { + if (m_printDetailedTables && m_doComponentLevelMonitoring) { report2Log_ComponentLevel(); } // Event-level - if (m_printDetailedTables && procExists && m_doEventLoopMonitoring) { + if (m_printDetailedTables && m_doEventLoopMonitoring) { report2Log_EventLevel(); } @@ -434,7 +439,7 @@ void PerfMonMTSvc::report2Log_EventLevel() { m_eventLoopMsgCounter++; } // Add to leak estimate - if (it.first >= std::max(uint64_t(10), uint64_t(m_checkPointFactor))) { + if (it.first >= 25) { m_fit_vmem.addPoint(it.first, it.second.mem_stats.at("vmem")); m_fit_pss.addPoint(it.first, it.second.mem_stats.at("pss")); } @@ -507,21 +512,17 @@ void PerfMonMTSvc::report2Log_CpuInfo() const { * Report data to JSON */ void PerfMonMTSvc::report2JsonFile() { - json j; + nlohmann::json j; // CPU and Wall-time report2JsonFile_Summary(j); // Snapshots // Memory - const bool procExists = doesDirectoryExist("/proc"); - - if (procExists) { - if (m_doComponentLevelMonitoring) { - report2JsonFile_ComponentLevel(j); // Component-level - } - if (m_doEventLoopMonitoring) { - report2JsonFile_EventLevel(j); // Event-level - } + if (m_doComponentLevelMonitoring) { + report2JsonFile_ComponentLevel(j); // Component-level + } + if (m_doEventLoopMonitoring) { + report2JsonFile_EventLevel(j); // Event-level } // Write @@ -746,6 +747,9 @@ std::string PerfMonMTSvc::scaleMem(long memMeas) const { return stringObj; } +/* + * Collect some hardware information + */ std::string PerfMonMTSvc::get_cpu_model_info() const { std::string cpu_model; diff --git a/Control/PerformanceMonitoring/PerfMonComps/src/PerfMonMTSvc.h b/Control/PerformanceMonitoring/PerfMonComps/src/PerfMonMTSvc.h index 1981f195d1e..5ff69c0e2f5 100644 --- a/Control/PerformanceMonitoring/PerfMonComps/src/PerfMonMTSvc.h +++ b/Control/PerformanceMonitoring/PerfMonComps/src/PerfMonMTSvc.h @@ -123,7 +123,7 @@ class PerfMonMTSvc : virtual public IPerfMonMTSvc, public AthService { "True if component level monitoring is enabled, false o/w. Component monitoring may cause a decrease in the " "performance due to the usage of locks."}; /// Report results to JSON - Gaudi::Property m_reportResultsToJSON{this, "reportResultsToJSON", false, "Report results into the json file."}; + Gaudi::Property m_reportResultsToJSON{this, "reportResultsToJSON", true, "Report results into the json file."}; /// Name of the JSON file Gaudi::Property m_jsonFileName{this, "jsonFileName", "PerfMonMTSvc_result.json", "Name of the JSON file that contains the results."}; @@ -136,7 +136,7 @@ class PerfMonMTSvc : virtual public IPerfMonMTSvc, public AthService { "Type of the check point sequence: Arithmetic(0, k, 2k...) or Geometric(0,k,k^2...)."}; /// Frequency of event level monitoring Gaudi::Property m_checkPointFactor{ - this, "checkPointFactor", 10, + this, "checkPointFactor", 50, "Common difference if check point sequence is arithmetic, Common ratio if it is Geometric."}; /// Offset for the wall-time, comes from configuration Gaudi::Property m_wallTimeOffset{this, "wallTimeOffset", 0, "Job start wall time in miliseconds."}; diff --git a/Control/PerformanceMonitoring/PerfMonComps/src/PerfMonMTUtils.h b/Control/PerformanceMonitoring/PerfMonComps/src/PerfMonMTUtils.h index 1436fbf007c..2b592779bd7 100644 --- a/Control/PerformanceMonitoring/PerfMonComps/src/PerfMonMTUtils.h +++ b/Control/PerformanceMonitoring/PerfMonComps/src/PerfMonMTUtils.h @@ -24,7 +24,6 @@ typedef std::map memory_map_t; // Component : Memory Measure * Inline function prototypes */ inline memory_map_t operator-(memory_map_t& map1, memory_map_t& map2); -inline bool doesDirectoryExist(const std::string dir); /* * Necessary tools @@ -39,6 +38,8 @@ memory_map_t get_mem_stats(); // Efficient memory measurements double get_malloc(); double get_vmem(); +// Simple check if directory exists +bool doesDirectoryExist(const std::string dir); // Step name and Component name pairs. Ex: Initialize - StoreGateSvc struct StepComp { @@ -53,16 +54,12 @@ struct StepComp { // Basic Measurement struct Measurement { - typedef std::map event_meas_map_t; // Event number: Measurement // Variables to store measurements double cpu_time, wall_time; // Timing memory_map_t mem_stats; // Memory: Vmem, Rss, Pss, Swap double vmem, malloc; // Memory: Vmem, Malloc (faster than above) - // Event level measurements - event_meas_map_t eventLevel_meas_map; // [Event count so far]: Measurement - // Peak values for Vmem, Rss and Pss long vmemPeak = LONG_MIN; long rssPeak = LONG_MIN; @@ -75,9 +72,7 @@ struct Measurement { wall_time = get_wall_time(); // Memory - if (doesDirectoryExist("/proc")) { - mem_stats = get_mem_stats(); - } + mem_stats = get_mem_stats(); } // Capture component-level measurements @@ -91,32 +86,21 @@ struct Measurement { // Efficient Memory Measurements malloc = get_malloc(); - if (doesDirectoryExist("/proc")) { - vmem = get_vmem(); - } + vmem = get_vmem(); } // Capture event-level measurements - void capture_event(int eventCount) { + void capture_event() { // Timing cpu_time = get_process_cpu_time(); wall_time = get_wall_time(); - Measurement meas; - - if (doesDirectoryExist("/proc")) { - mem_stats = get_mem_stats(); - meas.mem_stats = mem_stats; - - if (mem_stats["vmem"] > vmemPeak) vmemPeak = mem_stats["vmem"]; - if (mem_stats["rss"] > rssPeak) rssPeak = mem_stats["rss"]; - if (mem_stats["pss"] > pssPeak) pssPeak = mem_stats["pss"]; - } - meas.cpu_time = cpu_time; - meas.wall_time = wall_time; + // Memory + mem_stats = get_mem_stats(); - // Capture for event level measurements - eventLevel_meas_map[eventCount] = meas; + if (mem_stats["vmem"] > vmemPeak) vmemPeak = mem_stats["vmem"]; + if (mem_stats["rss"] > rssPeak) rssPeak = mem_stats["rss"]; + if (mem_stats["pss"] > pssPeak) pssPeak = mem_stats["pss"]; } Measurement() : cpu_time{0.}, wall_time{0.}, vmem{0.}, malloc{0.} { @@ -149,7 +133,7 @@ struct MeasurementData { m_tmp_wall = meas.wall_time; // Non-efficient memory measurements - if (doesDirectoryExist("/proc")) m_memMon_tmp_map = meas.mem_stats; + m_memMon_tmp_map = meas.mem_stats; } // [Component Level Monitoring - Serial Steps] : Record the measurement for the current state @@ -158,7 +142,7 @@ struct MeasurementData { m_delta_wall = meas.wall_time - m_tmp_wall; // Non-efficient memory measurements - if (doesDirectoryExist("/proc")) m_memMon_delta_map = meas.mem_stats - m_memMon_tmp_map; + m_memMon_delta_map = meas.mem_stats - m_memMon_tmp_map; } // [Component Level Monitoring] : Start @@ -172,7 +156,7 @@ struct MeasurementData { // Efficient memory measurements m_tmp_malloc = meas.malloc; - if (doesDirectoryExist("/proc")) m_tmp_vmem = meas.vmem; + m_tmp_vmem = meas.vmem; } // [Component Level Monitoring] : Stop @@ -190,20 +174,17 @@ struct MeasurementData { // Efficient memory measurements m_delta_malloc += meas.malloc - m_tmp_malloc; - if (doesDirectoryExist("/proc")) m_delta_vmem += meas.vmem - m_tmp_vmem; + m_delta_vmem += meas.vmem - m_tmp_vmem; } // [Event Level Monitoring - Parallel Steps] : Record the measurement for the current checkpoint - void record_event(Measurement& meas, int eventCount) { - m_eventLevel_delta_map[eventCount].cpu_time = meas.eventLevel_meas_map[eventCount].cpu_time; - m_eventLevel_delta_map[eventCount].wall_time = meas.eventLevel_meas_map[eventCount].wall_time - m_offset_wall; - - if (doesDirectoryExist("/proc")) { - m_eventLevel_delta_map[eventCount].mem_stats["vmem"] = meas.eventLevel_meas_map[eventCount].mem_stats["vmem"]; - m_eventLevel_delta_map[eventCount].mem_stats["rss"] = meas.eventLevel_meas_map[eventCount].mem_stats["rss"]; - m_eventLevel_delta_map[eventCount].mem_stats["pss"] = meas.eventLevel_meas_map[eventCount].mem_stats["pss"]; - m_eventLevel_delta_map[eventCount].mem_stats["swap"] = meas.eventLevel_meas_map[eventCount].mem_stats["swap"]; - } + void record_event(const Measurement& meas, int eventCount) { + // Timing + m_eventLevel_delta_map[eventCount].cpu_time = meas.cpu_time; + m_eventLevel_delta_map[eventCount].wall_time = meas.wall_time - m_offset_wall; + + // Memory + m_eventLevel_delta_map[eventCount].mem_stats = meas.mem_stats; } void set_wall_time_offset(double wall_time_offset) { m_offset_wall = wall_time_offset; } @@ -297,49 +278,67 @@ inline double PMonMT::get_wall_time() { */ // Read from proc's smaps file. It is costly to do this operation too often. +// In a realistic RAWtoESD job, the smaps for the the whole application can get large. +// Therefore, this operation might take about 100 ms per call, which is fairly substantial. +// However, this is one of the most reliable way to get PSS. +// Therefore, keep it as is but don't call it too often! inline memory_map_t PMonMT::get_mem_stats() { + // Result object memory_map_t result; - std::string fileName = "/proc/self/smaps"; - std::ifstream smaps_file(fileName); - - std::string line; - std::string key; - std::string value; - while (getline(smaps_file, line)) { - std::stringstream ss(line); - ss >> key >> value; - - if (key == "Size:") { - result["vmem"] += stol(value); - } - if (key == "Rss:") { - result["rss"] += stol(value); - } - if (key == "Pss:") { - result["pss"] += stol(value); - } - if (key == "Swap:") { - result["swap"] += stol(value); + // Zero initialize + result["vmem"] = result["rss"] = result["pss"] = result["swap"] = 0; + + // This is the input where we read the stats from + static const std::string fileName = "/proc/self/smaps"; + std::ifstream smaps_file{fileName}; + + std::string line{}, key{}, value{}; + + // Loop over the file + while (smaps_file) { + // Read interesting key value pairs + smaps_file >> key >> value; + smaps_file.ignore(std::numeric_limits::max(),'\n'); + + if(smaps_file) { + if (key == "Size:") { + result["vmem"] += std::stol(value); + } + if (key == "Rss:") { + result["rss"] += std::stol(value); + } + if (key == "Pss:") { + result["pss"] += std::stol(value); + } + if (key == "Swap:") { + result["swap"] += std::stol(value); + } } } + return result; } // This operation is less costly than the previous one. Since statm is a much smaller file compared to smaps. inline double PMonMT::get_vmem() { - const std::string fileName = "/proc/self/statm"; - std::ifstream statm_file(fileName); + // Result + double result = 0.; - std::string vmem_in_pages; // vmem measured in pages - std::string line; + // This is where we read the stats from + static const std::string fileName = "/proc/self/statm"; + std::ifstream statm_file{fileName}; + + std::string vmem_in_pages{}, line{}; // vmem measured in pages + + // We simply get the first line if (getline(statm_file, line)) { - std::stringstream ss(line); + std::stringstream ss{line}; ss >> vmem_in_pages; // The first number in this file is the vmem measured in pages } - const double page_size = sysconf(_SC_PAGESIZE) / 1024.0; // page size in KB - const double result = stod(vmem_in_pages) * page_size; + static const double page_size = sysconf(_SC_PAGESIZE) / 1024.0; // page size in KB + result = std::stod(vmem_in_pages) * page_size; return result; } @@ -391,7 +390,10 @@ inline memory_map_t operator-(memory_map_t& map1, memory_map_t& map2) { return result_map; } -inline bool doesDirectoryExist(const std::string dir) { +/* + * Simple check if a given directory exists + */ +inline bool PMonMT::doesDirectoryExist(const std::string dir) { struct stat buffer; return (stat(dir.c_str(), &buffer) == 0); } -- GitLab From d5d2b495e1ce806d7302ac77fecf6ee855b7b1cd Mon Sep 17 00:00:00 2001 From: Nicolas Koehler Date: Tue, 9 Jun 2020 17:58:37 +0000 Subject: [PATCH 31/38] Allow to read amdb geometry from AmdcDb --- .../GeoModel/AtlasGeoModel/python/MuonGM.py | 4 +- .../Amdcsimrec/AmdcDb/AmdcDb/AmdcDb.h | 4 +- .../AmdcDb/AmdcDb/AmdcDbSvcMakerFromAmdc.h | 7 +- .../AmdcDb/AmdcDb/AmdcDbSvcMakerFromRDB.h | 10 +- .../Amdcsimrec/AmdcDb/src/AmdcDb2Sql.cxx | 1 + .../AmdcDb/src/AmdcDbSvcMakerFromAmdc.cxx | 34 +- .../AmdcDb/src/AmdcDbSvcMakerFromRDB.cxx | 20 +- .../MuonConfig/python/MuonGeometryConfig.py | 1 - .../MuonGMdbObjects/CMakeLists.txt | 4 +- .../MuonGMdbObjects/DblQ00Acut.h | 11 +- .../MuonGMdbObjects/DblQ00Alin.h | 11 +- .../MuonGMdbObjects/DblQ00Almn.h | 10 +- .../MuonGMdbObjects/DblQ00Aptp.h | 9 +- .../MuonGMdbObjects/DblQ00Asmp.h | 12 +- .../MuonGMdbObjects/DblQ00Aszt.h | 13 +- .../MuonGMdbObjects/DblQ00Atln.h | 11 +- .../MuonGMdbObjects/DblQ00Atyp.h | 11 +- .../MuonGMdbObjects/DblQ00Awln.h | 11 +- .../MuonGMdbObjects/DblQ00Dbam.h | 11 +- .../MuonGMdbObjects/DblQ00IAcsc.h | 13 +- .../MuonGMdbObjects/DblQ00Wchv.h | 11 +- .../MuonGMdbObjects/DblQ00Wcmi.h | 11 +- .../MuonGMdbObjects/DblQ00Wcro.h | 11 +- .../MuonGMdbObjects/DblQ00Wcsc.h | 11 +- .../MuonGMdbObjects/DblQ00Wded.h | 11 +- .../MuonGMdbObjects/DblQ00Wlbi.h | 11 +- .../MuonGMdbObjects/DblQ00Wmdt.h | 11 +- .../MuonGMdbObjects/DblQ00Wrpc.h | 11 +- .../MuonGMdbObjects/DblQ00Wspa.h | 10 +- .../MuonGMdbObjects/DblQ00Wsup.h | 11 +- .../MuonGMdbObjects/DblQ00Wtgc.h | 11 +- .../MuonGMdbObjects/DblQ00Xtomo.h | 16 +- .../MuonGMdbObjects/src/DblQ00Acut.cxx | 67 ++-- .../MuonGMdbObjects/src/DblQ00Alin.cxx | 75 +++-- .../MuonGMdbObjects/src/DblQ00Almn.cxx | 83 +++-- .../MuonGMdbObjects/src/DblQ00Aptp.cxx | 89 ++++-- .../MuonGMdbObjects/src/DblQ00Asmp.cxx | 68 ++-- .../MuonGMdbObjects/src/DblQ00Aszt.cxx | 93 ++++-- .../MuonGMdbObjects/src/DblQ00Atln.cxx | 70 ++-- .../MuonGMdbObjects/src/DblQ00Atyp.cxx | 68 ++-- .../MuonGMdbObjects/src/DblQ00Awln.cxx | 78 +++-- .../MuonGMdbObjects/src/DblQ00Dbam.cxx | 83 +++-- .../MuonGMdbObjects/src/DblQ00IAcsc.cxx | 111 ++++--- .../MuonGMdbObjects/src/DblQ00Wchv.cxx | 73 +++-- .../MuonGMdbObjects/src/DblQ00Wcmi.cxx | 71 ++-- .../MuonGMdbObjects/src/DblQ00Wcro.cxx | 70 ++-- .../MuonGMdbObjects/src/DblQ00Wcsc.cxx | 106 ++++-- .../MuonGMdbObjects/src/DblQ00Wded.cxx | 70 ++-- .../MuonGMdbObjects/src/DblQ00Wlbi.cxx | 73 +++-- .../MuonGMdbObjects/src/DblQ00Wmdt.cxx | 86 +++-- .../MuonGMdbObjects/src/DblQ00Wrpc.cxx | 84 +++-- .../MuonGMdbObjects/src/DblQ00Wspa.cxx | 69 ++-- .../MuonGMdbObjects/src/DblQ00Wsup.cxx | 79 +++-- .../MuonGMdbObjects/src/DblQ00Wtgc.cxx | 79 +++-- .../MuonGMdbObjects/src/DblQ00Xtomo.cxx | 99 +++++- MuonSpectrometer/MuonGeoModel/CMakeLists.txt | 5 +- .../MuonGeoModel/MuonDetectorFactory001.h | 3 + .../MuonGeoModel/MuonDetectorTool.h | 2 +- .../share/MuonGeoModel_MinimalSetup.py | 4 +- .../src/MuonDetectorFactory001.cxx | 177 +++++----- .../MuonGeoModel/src/MuonDetectorTool.cxx | 39 ++- .../MuonGeoModel/src/RDBReaderAtlas.cxx | 302 +++++++++++++----- .../test/MuonGeoModelTestMaps.py | 16 +- Projects/AthSimulation/package_filters.txt | 4 + 64 files changed, 1864 insertions(+), 876 deletions(-) diff --git a/DetectorDescription/GeoModel/AtlasGeoModel/python/MuonGM.py b/DetectorDescription/GeoModel/AtlasGeoModel/python/MuonGM.py index 8c0210f2825..7315d5bb9b6 100755 --- a/DetectorDescription/GeoModel/AtlasGeoModel/python/MuonGM.py +++ b/DetectorDescription/GeoModel/AtlasGeoModel/python/MuonGM.py @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration from AthenaCommon.JobProperties import jobproperties from AthenaCommon.DetFlags import DetFlags @@ -17,9 +17,7 @@ elif ( DetFlags.detdescr.Muon_on() ): HasSTgc=MuonGeometryFlags.hasSTGC(), HasMM=MuonGeometryFlags.hasMM()) ] import os - GeoModelSvc.DetectorTools[ "MuonDetectorTool" ].BuildFromNova = 0 if ( ( not DetFlags.simulate.any_on() or DetFlags.overlay.any_on() ) and "AthSimulation_DIR" not in os.environ ): -# GeoModelSvc.DetectorTools[ "MuonDetectorTool" ].TheMuonAlignmentTool = "MuonAlignmentDbTool/MGM_AlignmentDbTool" pass else: GeoModelSvc.DetectorTools[ "MuonDetectorTool" ].UseConditionDb = 0 diff --git a/MuonSpectrometer/Amdcsimrec/AmdcDb/AmdcDb/AmdcDb.h b/MuonSpectrometer/Amdcsimrec/AmdcDb/AmdcDb/AmdcDb.h index bbcd576b4b8..14b6f95fd17 100755 --- a/MuonSpectrometer/Amdcsimrec/AmdcDb/AmdcDb/AmdcDb.h +++ b/MuonSpectrometer/Amdcsimrec/AmdcDb/AmdcDb/AmdcDb.h @@ -47,8 +47,8 @@ class AmdcDb final : public AthService, virtual public IRDBAccessSvcWithUpdate { virtual IRDBRecordset_ptr getRecordsetPtr(const std::string& node, const std::string& tag, - const std::string& tag2node , - const std::string& connName) override; + const std::string& tag2node="", + const std::string& connName="") override; //Functions of IRDBAccessSvc Not implemented virtual bool connect (const std::string& connName) override; diff --git a/MuonSpectrometer/Amdcsimrec/AmdcDb/AmdcDb/AmdcDbSvcMakerFromAmdc.h b/MuonSpectrometer/Amdcsimrec/AmdcDb/AmdcDb/AmdcDbSvcMakerFromAmdc.h index 9e539b12d1f..e7200df3d4a 100755 --- a/MuonSpectrometer/Amdcsimrec/AmdcDb/AmdcDb/AmdcDbSvcMakerFromAmdc.h +++ b/MuonSpectrometer/Amdcsimrec/AmdcDb/AmdcDb/AmdcDbSvcMakerFromAmdc.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef AmdcDbSvcMakerFromAmdc_H @@ -23,7 +23,7 @@ class AmdcDbRecord; class AmdcDbSvcMakerFromAmdc{ public: AmdcDbSvcMakerFromAmdc(); - virtual ~AmdcDbSvcMakerFromAmdc(); + virtual ~AmdcDbSvcMakerFromAmdc()=default; public: /////////////////////////////////// @@ -54,10 +54,9 @@ private: int GetEpsAngle (std::string NameOfTheSet) ; void AMDC(Amdcsimrec* pAmdcsimrec,AmdcDbSvc* pAmdcDbSvc); - + void AGDD(Amdcsimrec* pAmdcsimrec,AmdcDbSvc* pAmdcDbSvc); void ATYP(Amdcsimrec* pAmdcsimrec,AmdcDbSvc* pAmdcDbSvc); void ACUT(Amdcsimrec* pAmdcsimrec,AmdcDbSvc* pAmdcDbSvc); - void WRPC(Amdcsimrec* pAmdcsimrec,AmdcDbSvc* pAmdcDbSvc); void AWLN(Amdcsimrec* pAmdcsimrec,AmdcDbSvc* pAmdcDbSvc); void WTGC(Amdcsimrec* pAmdcsimrec,AmdcDbSvc* pAmdcDbSvc); diff --git a/MuonSpectrometer/Amdcsimrec/AmdcDb/AmdcDb/AmdcDbSvcMakerFromRDB.h b/MuonSpectrometer/Amdcsimrec/AmdcDb/AmdcDb/AmdcDbSvcMakerFromRDB.h index 3367892de38..5290740e77d 100755 --- a/MuonSpectrometer/Amdcsimrec/AmdcDb/AmdcDb/AmdcDbSvcMakerFromRDB.h +++ b/MuonSpectrometer/Amdcsimrec/AmdcDb/AmdcDb/AmdcDbSvcMakerFromRDB.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef AmdcDbSvcMakerFromRDB_H @@ -27,7 +27,7 @@ namespace AmdcDb_detail { class AmdcDbSvcMakerFromRDB{ public: AmdcDbSvcMakerFromRDB(); - virtual ~AmdcDbSvcMakerFromRDB(); + virtual ~AmdcDbSvcMakerFromRDB()=default; public: /////////////////////////////////// @@ -62,10 +62,9 @@ private: int GetEpsAngle (std::string NameOfTheSet) ; void AMDC(IRDBAccessSvc* pIRDBAccessSvc,AmdcDbSvc* pAmdcDbSvc); - + void AGDD(IRDBAccessSvc* pIRDBAccessSvc,AmdcDbSvc* pAmdcDbSvc); void ATYP(IRDBAccessSvc* pIRDBAccessSvc,AmdcDbSvc* pAmdcDbSvc); void ACUT(IRDBAccessSvc* pIRDBAccessSvc,AmdcDbSvc* pAmdcDbSvc); - void WRPC(IRDBAccessSvc* pIRDBAccessSvc,AmdcDbSvc* pAmdcDbSvc); void AWLN(IRDBAccessSvc* pIRDBAccessSvc,AmdcDbSvc* pAmdcDbSvc); void WTGC(IRDBAccessSvc* pIRDBAccessSvc,AmdcDbSvc* pAmdcDbSvc); @@ -85,9 +84,10 @@ private: void ALIN(IRDBAccessSvc* pIRDBAccessSvc,AmdcDbSvc* pAmdcDbSvc); void ALMN(IRDBAccessSvc* pIRDBAccessSvc,AmdcDbSvc* pAmdcDbSvc); void APTP(IRDBAccessSvc* pIRDBAccessSvc,AmdcDbSvc* pAmdcDbSvc); - void ASZT(IRDBAccessSvc* pIRDBAccessSvc,AmdcDbSvc* pAmdcDbSvc); void ISZT(IRDBAccessSvc* pIRDBAccessSvc,AmdcDbSvc* pAmdcDbSvc); + + void AgddXMLVariables(IRDBAccessSvc* pIRDBAccessSvc,AmdcDbSvc* pAmdcDbSvc); void HwSwIdMapping(IRDBAccessSvc* pIRDBAccessSvc,AmdcDbSvc* pAmdcDbSvc); diff --git a/MuonSpectrometer/Amdcsimrec/AmdcDb/src/AmdcDb2Sql.cxx b/MuonSpectrometer/Amdcsimrec/AmdcDb/src/AmdcDb2Sql.cxx index b40e6e76469..1fcbe908bd8 100755 --- a/MuonSpectrometer/Amdcsimrec/AmdcDb/src/AmdcDb2Sql.cxx +++ b/MuonSpectrometer/Amdcsimrec/AmdcDb/src/AmdcDb2Sql.cxx @@ -26,6 +26,7 @@ void AmdcDb2Sql::SetUseKeysOn(int UseKeysOn){ m_UseKeysOn = UseKeysOn ;} void AmdcDb2Sql::DoIt(std::string TagFileName,std::string tag,IRDBAccessSvc* pIRDBAccessSvc){ DoSql(TagFileName,"AMDC",tag,pIRDBAccessSvc); + DoSql(TagFileName,"AGDD",tag,pIRDBAccessSvc); DoSql(TagFileName,"ATYP",tag,pIRDBAccessSvc); DoSql(TagFileName,"ACUT",tag,pIRDBAccessSvc); DoSql(TagFileName,"WRPC",tag,pIRDBAccessSvc); diff --git a/MuonSpectrometer/Amdcsimrec/AmdcDb/src/AmdcDbSvcMakerFromAmdc.cxx b/MuonSpectrometer/Amdcsimrec/AmdcDb/src/AmdcDbSvcMakerFromAmdc.cxx index c90562f22a4..89285e9eacf 100755 --- a/MuonSpectrometer/Amdcsimrec/AmdcDb/src/AmdcDbSvcMakerFromAmdc.cxx +++ b/MuonSpectrometer/Amdcsimrec/AmdcDb/src/AmdcDbSvcMakerFromAmdc.cxx @@ -26,10 +26,6 @@ AmdcDbSvcMakerFromAmdc::AmdcDbSvcMakerFromAmdc(){ } - -AmdcDbSvcMakerFromAmdc::~AmdcDbSvcMakerFromAmdc(){} - - // Set a AmdcDbSvc void AmdcDbSvcMakerFromAmdc::SetUglyCodeOn(int UglyCodeOn){ m_UglyCodeOn = UglyCodeOn ;} void AmdcDbSvcMakerFromAmdc::SetEpsLengthMM(int EpsLengthMM){ m_EpsLengthMM = EpsLengthMM ;} @@ -41,6 +37,7 @@ void AmdcDbSvcMakerFromAmdc::SetEpsAngle (std::string NameOfTheSet, int EpsAng void AmdcDbSvcMakerFromAmdc::Set(Amdcsimrec* pAmdcsimrec,AmdcDbSvc* pAmdcDbSvc){ AMDC(pAmdcsimrec,pAmdcDbSvc); + AGDD(pAmdcsimrec,pAmdcDbSvc); ATYP(pAmdcsimrec,pAmdcDbSvc); ACUT(pAmdcsimrec,pAmdcDbSvc); @@ -81,14 +78,10 @@ int AmdcDbSvcMakerFromAmdc::GetEpsAngle (std::string NameOfTheSet){ if (m_Map_ void AmdcDbSvcMakerFromAmdc::AMDC(Amdcsimrec* pAmdcsimrec,AmdcDbSvc* pAmdcDbSvc){ std::string NameOfTheSet = "AMDC"; -// int LocalEpsLengthMM = GetEpsLengthMM(NameOfTheSet) ; -// int LocalEpsLengthCM = GetEpsLengthCM(NameOfTheSet) ; -// int LocalEpsAngle = GetEpsAngle (NameOfTheSet) ; std::string DbVar = ""; std::string DbVarComment = ""; int iDbVal = 0 ; -//double dDbVal = 0.; std::string sDbVal = ""; AmdcDbRecordset* pAmdcDbRecordset = new AmdcDbRecordset(); @@ -116,17 +109,32 @@ void AmdcDbSvcMakerFromAmdc::AMDC(Amdcsimrec* pAmdcsimrec,AmdcDbSvc* pAmdcDbSvc) } +void AmdcDbSvcMakerFromAmdc::AGDD(Amdcsimrec* pAmdcsimrec,AmdcDbSvc* pAmdcDbSvc){ + std::string NameOfTheSet = "AGDD"; + std::string DbVar = ""; + std::string DbVarComment = ""; + int iDbVal = 0 ; + std::string sDbVal = ""; + AmdcDbRecordset* pAmdcDbRecordset = new AmdcDbRecordset(); + m_UniversalIdKounter = m_UniversalIdKounter + 1; + AmdcDbRecord* pAmdcDbRecord = new AmdcDbRecord(m_UniversalIdKounter,NameOfTheSet); + DbVar = "VERS" ; DbVarComment="VERSION" ; iDbVal = m_version ; pAmdcDbRecord->addInt(DbVar,DbVarComment,iDbVal); + std::string TheAmdcName = pAmdcsimrec->AmdcName() ; + DbVar = "VNAME" ; DbVarComment="NAME" ; sDbVal = TheAmdcName.substr(0,4) ; pAmdcDbRecord->addString(DbVar,DbVarComment,sDbVal); + std::string TheBlob = pAmdcsimrec->GetAgddString() ; + DbVar = "LENAGDD" ; DbVarComment="STRING LENGTH" ; iDbVal = TheBlob.size() ; pAmdcDbRecord->addInt(DbVar,DbVarComment,iDbVal); + DbVar = "NLINE" ; DbVarComment="CHAR4 NUMBER" ; iDbVal = int ( (TheBlob.size()+2.)/4. ) ; pAmdcDbRecord->addInt(DbVar,DbVarComment,iDbVal); + DbVar = "DATA" ; DbVarComment="(NLINE)-ASCII" ; sDbVal = TheBlob ; pAmdcDbRecord->addBlob(DbVar,DbVarComment,sDbVal); + pAmdcDbRecordset->addIRDBRecord(pAmdcDbRecord); + pAmdcDbSvc->addIRDBRecordset(NameOfTheSet,pAmdcDbRecordset); +} + void AmdcDbSvcMakerFromAmdc::ATYP(Amdcsimrec* pAmdcsimrec,AmdcDbSvc* pAmdcDbSvc){ std::string NameOfTheSet = "ATYP"; -// int LocalEpsLengthMM = GetEpsLengthMM(NameOfTheSet) ; -// int LocalEpsLengthCM = GetEpsLengthCM(NameOfTheSet) ; -// int LocalEpsAngle = GetEpsAngle (NameOfTheSet) ; - std::string DbVar = ""; std::string DbVarComment = ""; int iDbVal = 0 ; -//double dDbVal = 0.; std::string sDbVal = ""; AmdcDbRecordset* pAmdcDbRecordset = new AmdcDbRecordset(); diff --git a/MuonSpectrometer/Amdcsimrec/AmdcDb/src/AmdcDbSvcMakerFromRDB.cxx b/MuonSpectrometer/Amdcsimrec/AmdcDb/src/AmdcDbSvcMakerFromRDB.cxx index 38578744d59..da7eb91953f 100755 --- a/MuonSpectrometer/Amdcsimrec/AmdcDb/src/AmdcDbSvcMakerFromRDB.cxx +++ b/MuonSpectrometer/Amdcsimrec/AmdcDb/src/AmdcDbSvcMakerFromRDB.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include "AmdcDb/AmdcDbSvcMakerFromRDB.h" @@ -11,7 +11,6 @@ #include "AmdcDb/AmdcDbRecord.h" #include "boost/range/iterator_range.hpp" - namespace AmdcDb_detail { @@ -96,6 +95,13 @@ VarDesc AMDC_Vars[] = { {VarDesc::String, "DATA", "(NLINE)-ASCII"}, }; +VarDesc AGDD_Vars[] = { + {VarDesc::Int, "VERS", "VERSION"}, + {VarDesc::String, "VNAME", "NAME"}, + {VarDesc::Int, "LENAGDD", "STRING LENGTH"}, + {VarDesc::Int, "NLINE", "CHAR4 NUMBER"}, + {VarDesc::String, "DATA", "(NLINE)-ASCII"}, +}; VarDesc ATYP_Vars[] = { {VarDesc::Int, "VERS", "VERSION"}, @@ -537,8 +543,6 @@ AmdcDbSvcMakerFromRDB::AmdcDbSvcMakerFromRDB(){ } -AmdcDbSvcMakerFromRDB::~AmdcDbSvcMakerFromRDB(){} - // Set a AmdcDbSvc void AmdcDbSvcMakerFromRDB::SetEpsLengthMM(int EpsLengthMM){ m_EpsLengthMM = EpsLengthMM ;} void AmdcDbSvcMakerFromRDB::SetEpsLengthCM(int EpsLengthCM){ m_EpsLengthCM = EpsLengthCM ;} @@ -557,10 +561,9 @@ void AmdcDbSvcMakerFromRDB::Set( m_detectorNode = detectorNode ; AMDC(pIRDBAccessSvc,pAmdcDbSvc); - + AGDD(pIRDBAccessSvc,pAmdcDbSvc); ATYP(pIRDBAccessSvc,pAmdcDbSvc); ACUT(pIRDBAccessSvc,pAmdcDbSvc); - WRPC(pIRDBAccessSvc,pAmdcDbSvc); AWLN(pIRDBAccessSvc,pAmdcDbSvc); WTGC(pIRDBAccessSvc,pAmdcDbSvc); @@ -580,7 +583,6 @@ void AmdcDbSvcMakerFromRDB::Set( ALIN(pIRDBAccessSvc,pAmdcDbSvc); ALMN(pIRDBAccessSvc,pAmdcDbSvc); APTP(pIRDBAccessSvc,pAmdcDbSvc); - ASZT(pIRDBAccessSvc,pAmdcDbSvc); ISZT(pIRDBAccessSvc,pAmdcDbSvc); @@ -600,6 +602,10 @@ void AmdcDbSvcMakerFromRDB::AMDC(IRDBAccessSvc* pIRDBAccessSvc,AmdcDbSvc* pAmdcD addVars ("AMDC", RANGE(AMDC_Vars), pIRDBAccessSvc, pAmdcDbSvc); } +void AmdcDbSvcMakerFromRDB::AGDD(IRDBAccessSvc* pIRDBAccessSvc,AmdcDbSvc* pAmdcDbSvc) +{ + addVars ("AGDD", RANGE(AGDD_Vars), pIRDBAccessSvc, pAmdcDbSvc); +} void AmdcDbSvcMakerFromRDB::ATYP(IRDBAccessSvc* pIRDBAccessSvc,AmdcDbSvc* pAmdcDbSvc) { diff --git a/MuonSpectrometer/MuonConfig/python/MuonGeometryConfig.py b/MuonSpectrometer/MuonConfig/python/MuonGeometryConfig.py index 6f42015f4d9..49e06d18e39 100644 --- a/MuonSpectrometer/MuonConfig/python/MuonGeometryConfig.py +++ b/MuonSpectrometer/MuonConfig/python/MuonGeometryConfig.py @@ -23,7 +23,6 @@ def MuonGeoModelCfg(flags): ) detTool.UseConditionDb = 1 detTool.UseIlinesFromGM = 1 - detTool.BuildFromNova = 0 enableAlignment = flags.Common.Project != 'AthSimulation' and not flags.Detector.SimulateMuon and not flags.Detector.OverlayMuon if enableAlignment: diff --git a/MuonSpectrometer/MuonGMdbObjects/CMakeLists.txt b/MuonSpectrometer/MuonGMdbObjects/CMakeLists.txt index 92e4dcedfb3..368e24c0221 100644 --- a/MuonSpectrometer/MuonGMdbObjects/CMakeLists.txt +++ b/MuonSpectrometer/MuonGMdbObjects/CMakeLists.txt @@ -6,7 +6,7 @@ atlas_subdir( MuonGMdbObjects ) # Declare the package's dependencies: -atlas_depends_on_subdirs( PRIVATE +atlas_depends_on_subdirs( Amdcsimrec/AmdcDb Database/RDBAccessSvc ) # External dependencies: @@ -17,7 +17,7 @@ find_package( CORAL COMPONENTS CoralBase CoralKernel RelationalAccess ) atlas_add_library( MuonGMdbObjects src/*.cxx PUBLIC_HEADERS MuonGMdbObjects - LINK_LIBRARIES RDBAccessSvcLib + LINK_LIBRARIES RDBAccessSvcLib AmdcDbLib PRIVATE_INCLUDE_DIRS ${Boost_INCLUDE_DIRS} ${CORAL_INCLUDE_DIRS} PRIVATE_LINK_LIBRARIES ${Boost_LIBRARIES} ${CORAL_LIBRARIES} ) diff --git a/MuonSpectrometer/MuonGMdbObjects/MuonGMdbObjects/DblQ00Acut.h b/MuonSpectrometer/MuonGMdbObjects/MuonGMdbObjects/DblQ00Acut.h index 2d3515f0f46..61c69e8d33b 100644 --- a/MuonSpectrometer/MuonGMdbObjects/MuonGMdbObjects/DblQ00Acut.h +++ b/MuonSpectrometer/MuonGMdbObjects/MuonGMdbObjects/DblQ00Acut.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /******************************************************** @@ -14,15 +14,18 @@ #define DBLQ00_ACUT_H #include "RDBAccessSvc/IRDBQuery.h" + #include -namespace MuonGM -{ -class DblQ00Acut { +class AmdcDb; + +namespace MuonGM { +class DblQ00Acut { public: DblQ00Acut(){}; ~DblQ00Acut(); DblQ00Acut(std::unique_ptr&&); + DblQ00Acut(AmdcDb* acut); // data members for DblQ00/ACUT fields struct ACUT { diff --git a/MuonSpectrometer/MuonGMdbObjects/MuonGMdbObjects/DblQ00Alin.h b/MuonSpectrometer/MuonGMdbObjects/MuonGMdbObjects/DblQ00Alin.h index fb923bdb440..ce349433556 100644 --- a/MuonSpectrometer/MuonGMdbObjects/MuonGMdbObjects/DblQ00Alin.h +++ b/MuonSpectrometer/MuonGMdbObjects/MuonGMdbObjects/DblQ00Alin.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /******************************************************** @@ -14,15 +14,18 @@ #define DBLQ00_ALIN_H #include "RDBAccessSvc/IRDBQuery.h" + #include -namespace MuonGM -{ -class DblQ00Alin { +class AmdcDb; + +namespace MuonGM { +class DblQ00Alin { public: DblQ00Alin(){}; ~DblQ00Alin(); DblQ00Alin(std::unique_ptr&&); + DblQ00Alin(AmdcDb* alin); // data members for DblQ00/ALIN fields struct ALIN { diff --git a/MuonSpectrometer/MuonGMdbObjects/MuonGMdbObjects/DblQ00Almn.h b/MuonSpectrometer/MuonGMdbObjects/MuonGMdbObjects/DblQ00Almn.h index efb9e5248e4..ee7c6389428 100644 --- a/MuonSpectrometer/MuonGMdbObjects/MuonGMdbObjects/DblQ00Almn.h +++ b/MuonSpectrometer/MuonGMdbObjects/MuonGMdbObjects/DblQ00Almn.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /******************************************************** @@ -14,18 +14,18 @@ #define DBLQ00_ALMN_H #include "RDBAccessSvc/IRDBQuery.h" + #include -namespace MuonGM -{ - +class AmdcDb; +namespace MuonGM { class DblQ00Almn { - public: DblQ00Almn(){}; ~DblQ00Almn(); DblQ00Almn(std::unique_ptr&&); + DblQ00Almn(AmdcDb* almn); // data members for DblQ00/ALMN fields struct ALMN { diff --git a/MuonSpectrometer/MuonGMdbObjects/MuonGMdbObjects/DblQ00Aptp.h b/MuonSpectrometer/MuonGMdbObjects/MuonGMdbObjects/DblQ00Aptp.h index 9ce480a02d5..a95950ac3c8 100644 --- a/MuonSpectrometer/MuonGMdbObjects/MuonGMdbObjects/DblQ00Aptp.h +++ b/MuonSpectrometer/MuonGMdbObjects/MuonGMdbObjects/DblQ00Aptp.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /******************************************************** @@ -14,17 +14,18 @@ #define DBLQ00_APTP_H #include "RDBAccessSvc/IRDBQuery.h" + #include -namespace MuonGM -{ +class AmdcDb; +namespace MuonGM { class DblQ00Aptp { - public: DblQ00Aptp(){}; ~DblQ00Aptp(); DblQ00Aptp(std::unique_ptr&&); + DblQ00Aptp(AmdcDb* aptp); // data members for DblQ00/APTP fields struct APTP { diff --git a/MuonSpectrometer/MuonGMdbObjects/MuonGMdbObjects/DblQ00Asmp.h b/MuonSpectrometer/MuonGMdbObjects/MuonGMdbObjects/DblQ00Asmp.h index b1dc95e1973..5dc4b29dd0b 100644 --- a/MuonSpectrometer/MuonGMdbObjects/MuonGMdbObjects/DblQ00Asmp.h +++ b/MuonSpectrometer/MuonGMdbObjects/MuonGMdbObjects/DblQ00Asmp.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /******************************************************** @@ -14,18 +14,20 @@ #define DBLQ00_ASMP_H #include "RDBAccessSvc/IRDBQuery.h" + #include -namespace MuonGM -{ -class DblQ00Asmp { +class AmdcDb; +namespace MuonGM { +class DblQ00Asmp { public: DblQ00Asmp(){}; ~DblQ00Asmp(); DblQ00Asmp(std::unique_ptr&&); - // data members for DblQ00/ASMP fields + DblQ00Asmp(AmdcDb* asmp); + // data members for DblQ00/ASMP fields struct ASMP { int version; // VERSION int indx; // STATION NUMBER (INSIDE TYPE) diff --git a/MuonSpectrometer/MuonGMdbObjects/MuonGMdbObjects/DblQ00Aszt.h b/MuonSpectrometer/MuonGMdbObjects/MuonGMdbObjects/DblQ00Aszt.h index 44b15573ad5..36bacc4e258 100644 --- a/MuonSpectrometer/MuonGMdbObjects/MuonGMdbObjects/DblQ00Aszt.h +++ b/MuonSpectrometer/MuonGMdbObjects/MuonGMdbObjects/DblQ00Aszt.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /******************************************************** @@ -10,25 +10,24 @@ // entered: 07/28/04 // comment: MUON STATION ELEMENT -#include - #ifndef DBLQ00_ASZT_H #define DBLQ00_ASZT_H #include "RDBAccessSvc/IRDBQuery.h" + #include +#include -namespace MuonGM -{ - +class AmdcDb; +namespace MuonGM { class DblQ00Aszt { - public: DblQ00Aszt(); ~DblQ00Aszt(); DblQ00Aszt(std::unique_ptr&&); DblQ00Aszt(std::string asciiFileName); + DblQ00Aszt(AmdcDb* aszt); void WriteAsztToAsciiFile(std::string filename); diff --git a/MuonSpectrometer/MuonGMdbObjects/MuonGMdbObjects/DblQ00Atln.h b/MuonSpectrometer/MuonGMdbObjects/MuonGMdbObjects/DblQ00Atln.h index 67a29d3c53d..fadbb72de6d 100644 --- a/MuonSpectrometer/MuonGMdbObjects/MuonGMdbObjects/DblQ00Atln.h +++ b/MuonSpectrometer/MuonGMdbObjects/MuonGMdbObjects/DblQ00Atln.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /******************************************************** @@ -14,17 +14,18 @@ #define DBLQ00_ATLN_H #include "RDBAccessSvc/IRDBQuery.h" + #include -namespace MuonGM -{ - -class DblQ00Atln { +class AmdcDb; +namespace MuonGM { +class DblQ00Atln { public: DblQ00Atln(){}; ~DblQ00Atln(); DblQ00Atln(std::unique_ptr&&); + DblQ00Atln(AmdcDb* atln); // data members for DblQ00/ATLN fields struct ATLN { diff --git a/MuonSpectrometer/MuonGMdbObjects/MuonGMdbObjects/DblQ00Atyp.h b/MuonSpectrometer/MuonGMdbObjects/MuonGMdbObjects/DblQ00Atyp.h index a045ddfe259..75c3570a734 100644 --- a/MuonSpectrometer/MuonGMdbObjects/MuonGMdbObjects/DblQ00Atyp.h +++ b/MuonSpectrometer/MuonGMdbObjects/MuonGMdbObjects/DblQ00Atyp.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /******************************************************** @@ -14,17 +14,18 @@ #define DBLQ00_ATYP_H #include "RDBAccessSvc/IRDBQuery.h" + #include -namespace MuonGM -{ - -class DblQ00Atyp { +class AmdcDb; +namespace MuonGM { +class DblQ00Atyp { public: DblQ00Atyp(){}; ~DblQ00Atyp(); DblQ00Atyp(std::unique_ptr&&); + DblQ00Atyp(AmdcDb* atyp); // data members for DblQ00/ATYP fields struct ATYP { diff --git a/MuonSpectrometer/MuonGMdbObjects/MuonGMdbObjects/DblQ00Awln.h b/MuonSpectrometer/MuonGMdbObjects/MuonGMdbObjects/DblQ00Awln.h index d700386741a..9b9adecbb08 100644 --- a/MuonSpectrometer/MuonGMdbObjects/MuonGMdbObjects/DblQ00Awln.h +++ b/MuonSpectrometer/MuonGMdbObjects/MuonGMdbObjects/DblQ00Awln.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /******************************************************** @@ -14,15 +14,18 @@ #define DBLQ00_AWLN_H #include "RDBAccessSvc/IRDBQuery.h" + #include -namespace MuonGM -{ -class DblQ00Awln { +class AmdcDb; + +namespace MuonGM { +class DblQ00Awln { public: DblQ00Awln(){}; ~DblQ00Awln(); DblQ00Awln(std::unique_ptr&&); + DblQ00Awln(AmdcDb* awln); // data members for DblQ00/AWLN fields struct AWLN { diff --git a/MuonSpectrometer/MuonGMdbObjects/MuonGMdbObjects/DblQ00Dbam.h b/MuonSpectrometer/MuonGMdbObjects/MuonGMdbObjects/DblQ00Dbam.h index 1541081fde2..8cfb02b8459 100644 --- a/MuonSpectrometer/MuonGMdbObjects/MuonGMdbObjects/DblQ00Dbam.h +++ b/MuonSpectrometer/MuonGMdbObjects/MuonGMdbObjects/DblQ00Dbam.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /******************************************************** @@ -14,15 +14,18 @@ #define DBLQ00_DBAM_H #include "RDBAccessSvc/IRDBQuery.h" + #include -namespace MuonGM -{ -class DblQ00Dbam { +class AmdcDb; + +namespace MuonGM { +class DblQ00Dbam { public: DblQ00Dbam(){}; ~DblQ00Dbam(); DblQ00Dbam(std::unique_ptr&&); + DblQ00Dbam(AmdcDb* dbam); // data members for DblQ00/DBAM fields struct DBAM { diff --git a/MuonSpectrometer/MuonGMdbObjects/MuonGMdbObjects/DblQ00IAcsc.h b/MuonSpectrometer/MuonGMdbObjects/MuonGMdbObjects/DblQ00IAcsc.h index ab1f5430546..e05d179267b 100644 --- a/MuonSpectrometer/MuonGMdbObjects/MuonGMdbObjects/DblQ00IAcsc.h +++ b/MuonSpectrometer/MuonGMdbObjects/MuonGMdbObjects/DblQ00IAcsc.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /******************************************************** @@ -10,25 +10,24 @@ // entered: 07/28/04 // comment: CSC internal alignment parameters - class to read from DB -#include - #ifndef DBLQ00_IACSC_H #define DBLQ00_IACSC_H #include "RDBAccessSvc/IRDBQuery.h" + #include +#include -namespace MuonGM -{ - +class AmdcDb; +namespace MuonGM { class DblQ00IAcsc { - public: DblQ00IAcsc(); ~DblQ00IAcsc(); DblQ00IAcsc(std::unique_ptr&&); DblQ00IAcsc(std::string asciiFileName); + DblQ00IAcsc(AmdcDb* iacsc); void WriteIAcscToAsciiFile(std::string filename); diff --git a/MuonSpectrometer/MuonGMdbObjects/MuonGMdbObjects/DblQ00Wchv.h b/MuonSpectrometer/MuonGMdbObjects/MuonGMdbObjects/DblQ00Wchv.h index ace268b82b2..a715ab98eab 100644 --- a/MuonSpectrometer/MuonGMdbObjects/MuonGMdbObjects/DblQ00Wchv.h +++ b/MuonSpectrometer/MuonGMdbObjects/MuonGMdbObjects/DblQ00Wchv.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /******************************************************** @@ -14,15 +14,18 @@ #define DBLQ00_WCHV_H #include "RDBAccessSvc/IRDBQuery.h" + #include -namespace MuonGM -{ -class DblQ00Wchv { +class AmdcDb; + +namespace MuonGM { +class DblQ00Wchv { public: DblQ00Wchv(){}; ~DblQ00Wchv(); DblQ00Wchv(std::unique_ptr&&); + DblQ00Wchv(AmdcDb* wchv); // data members for DblQ00/WCHV fields struct WCHV { diff --git a/MuonSpectrometer/MuonGMdbObjects/MuonGMdbObjects/DblQ00Wcmi.h b/MuonSpectrometer/MuonGMdbObjects/MuonGMdbObjects/DblQ00Wcmi.h index 0977b12810a..147429f1850 100644 --- a/MuonSpectrometer/MuonGMdbObjects/MuonGMdbObjects/DblQ00Wcmi.h +++ b/MuonSpectrometer/MuonGMdbObjects/MuonGMdbObjects/DblQ00Wcmi.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /******************************************************** @@ -14,15 +14,18 @@ #define DBLQ00_WCMI_H #include "RDBAccessSvc/IRDBQuery.h" + #include -namespace MuonGM -{ -class DblQ00Wcmi { +class AmdcDb; + +namespace MuonGM { +class DblQ00Wcmi { public: DblQ00Wcmi(){}; ~DblQ00Wcmi(); DblQ00Wcmi(std::unique_ptr&&); + DblQ00Wcmi(AmdcDb* wcmi); // data members for DblQ00/WCMI fields struct WCMI { diff --git a/MuonSpectrometer/MuonGMdbObjects/MuonGMdbObjects/DblQ00Wcro.h b/MuonSpectrometer/MuonGMdbObjects/MuonGMdbObjects/DblQ00Wcro.h index d7d88940ec7..5e8b4b6f16b 100644 --- a/MuonSpectrometer/MuonGMdbObjects/MuonGMdbObjects/DblQ00Wcro.h +++ b/MuonSpectrometer/MuonGMdbObjects/MuonGMdbObjects/DblQ00Wcro.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /******************************************************** @@ -14,15 +14,18 @@ #define DBLQ00_WCRO_H #include "RDBAccessSvc/IRDBQuery.h" + #include -namespace MuonGM -{ -class DblQ00Wcro { +class AmdcDb; + +namespace MuonGM { +class DblQ00Wcro { public: DblQ00Wcro(){}; ~DblQ00Wcro(); DblQ00Wcro(std::unique_ptr&&); + DblQ00Wcro(AmdcDb* wcro); // data members for DblQ00/WCRO fields struct WCRO { diff --git a/MuonSpectrometer/MuonGMdbObjects/MuonGMdbObjects/DblQ00Wcsc.h b/MuonSpectrometer/MuonGMdbObjects/MuonGMdbObjects/DblQ00Wcsc.h index f75be569045..9625229c8f9 100644 --- a/MuonSpectrometer/MuonGMdbObjects/MuonGMdbObjects/DblQ00Wcsc.h +++ b/MuonSpectrometer/MuonGMdbObjects/MuonGMdbObjects/DblQ00Wcsc.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /******************************************************** @@ -14,15 +14,18 @@ #define DBLQ00_WCSC_H #include "RDBAccessSvc/IRDBQuery.h" + #include -namespace MuonGM -{ -class DblQ00Wcsc { +class AmdcDb; + +namespace MuonGM { +class DblQ00Wcsc { public: DblQ00Wcsc(){}; ~DblQ00Wcsc(); DblQ00Wcsc(std::unique_ptr&&); + DblQ00Wcsc(AmdcDb* wcsc); // data members for DblQ00/WCSC fields struct WCSC { diff --git a/MuonSpectrometer/MuonGMdbObjects/MuonGMdbObjects/DblQ00Wded.h b/MuonSpectrometer/MuonGMdbObjects/MuonGMdbObjects/DblQ00Wded.h index 601ac612a1d..e851d1a17cc 100644 --- a/MuonSpectrometer/MuonGMdbObjects/MuonGMdbObjects/DblQ00Wded.h +++ b/MuonSpectrometer/MuonGMdbObjects/MuonGMdbObjects/DblQ00Wded.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /******************************************************** @@ -14,15 +14,18 @@ #define DBLQ00_WDED_H #include "RDBAccessSvc/IRDBQuery.h" + #include -namespace MuonGM -{ -class DblQ00Wded { +class AmdcDb; + +namespace MuonGM { +class DblQ00Wded { public: DblQ00Wded(){}; ~DblQ00Wded(); DblQ00Wded(std::unique_ptr&&); + DblQ00Wded(AmdcDb* wded); // data members for DblQ00/WDED fields struct WDED { diff --git a/MuonSpectrometer/MuonGMdbObjects/MuonGMdbObjects/DblQ00Wlbi.h b/MuonSpectrometer/MuonGMdbObjects/MuonGMdbObjects/DblQ00Wlbi.h index a63b3573a97..7c400111a09 100644 --- a/MuonSpectrometer/MuonGMdbObjects/MuonGMdbObjects/DblQ00Wlbi.h +++ b/MuonSpectrometer/MuonGMdbObjects/MuonGMdbObjects/DblQ00Wlbi.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /******************************************************** @@ -14,15 +14,18 @@ #define DBLQ00_WLBI_H #include "RDBAccessSvc/IRDBQuery.h" + #include -namespace MuonGM -{ -class DblQ00Wlbi { +class AmdcDb; + +namespace MuonGM { +class DblQ00Wlbi { public: DblQ00Wlbi(){}; ~DblQ00Wlbi(); DblQ00Wlbi(std::unique_ptr&&); + DblQ00Wlbi(AmdcDb* wlbi); struct WLBI { int version; // VERSION diff --git a/MuonSpectrometer/MuonGMdbObjects/MuonGMdbObjects/DblQ00Wmdt.h b/MuonSpectrometer/MuonGMdbObjects/MuonGMdbObjects/DblQ00Wmdt.h index 6c64b803e30..93012da4ce3 100644 --- a/MuonSpectrometer/MuonGMdbObjects/MuonGMdbObjects/DblQ00Wmdt.h +++ b/MuonSpectrometer/MuonGMdbObjects/MuonGMdbObjects/DblQ00Wmdt.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /******************************************************** @@ -14,15 +14,18 @@ #define DBLQ00_WMDT_H #include "RDBAccessSvc/IRDBQuery.h" + #include -namespace MuonGM -{ -class DblQ00Wmdt { +class AmdcDb; + +namespace MuonGM { +class DblQ00Wmdt { public: DblQ00Wmdt(){}; ~DblQ00Wmdt(); DblQ00Wmdt(std::unique_ptr&&); + DblQ00Wmdt(AmdcDb* wmdt); // data members for DblQ00/WMDT fields struct WMDT { diff --git a/MuonSpectrometer/MuonGMdbObjects/MuonGMdbObjects/DblQ00Wrpc.h b/MuonSpectrometer/MuonGMdbObjects/MuonGMdbObjects/DblQ00Wrpc.h index 399158d91a3..b9fa5e2bd31 100644 --- a/MuonSpectrometer/MuonGMdbObjects/MuonGMdbObjects/DblQ00Wrpc.h +++ b/MuonSpectrometer/MuonGMdbObjects/MuonGMdbObjects/DblQ00Wrpc.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /******************************************************** @@ -14,15 +14,18 @@ #define DBLQ00_WRPC_H #include "RDBAccessSvc/IRDBQuery.h" + #include -namespace MuonGM -{ -class DblQ00Wrpc { +class AmdcDb; + +namespace MuonGM { +class DblQ00Wrpc { public: DblQ00Wrpc(){}; ~DblQ00Wrpc(); DblQ00Wrpc(std::unique_ptr&&); + DblQ00Wrpc(AmdcDb* wrpc); // data members for DblQ00/WRPC fields struct WRPC { diff --git a/MuonSpectrometer/MuonGMdbObjects/MuonGMdbObjects/DblQ00Wspa.h b/MuonSpectrometer/MuonGMdbObjects/MuonGMdbObjects/DblQ00Wspa.h index 081a91ae1ac..9b0db5619e5 100644 --- a/MuonSpectrometer/MuonGMdbObjects/MuonGMdbObjects/DblQ00Wspa.h +++ b/MuonSpectrometer/MuonGMdbObjects/MuonGMdbObjects/DblQ00Wspa.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /******************************************************** @@ -15,14 +15,16 @@ #include "RDBAccessSvc/IRDBQuery.h" #include -namespace MuonGM -{ -class DblQ00Wspa { +class AmdcDb; + +namespace MuonGM { +class DblQ00Wspa { public: DblQ00Wspa(){}; ~DblQ00Wspa(); DblQ00Wspa(std::unique_ptr&&); + DblQ00Wspa(AmdcDb* wspa); // data members for DblQ00/WSPA fields struct WSPA { diff --git a/MuonSpectrometer/MuonGMdbObjects/MuonGMdbObjects/DblQ00Wsup.h b/MuonSpectrometer/MuonGMdbObjects/MuonGMdbObjects/DblQ00Wsup.h index 2d8ab09f3d8..7a55b244949 100644 --- a/MuonSpectrometer/MuonGMdbObjects/MuonGMdbObjects/DblQ00Wsup.h +++ b/MuonSpectrometer/MuonGMdbObjects/MuonGMdbObjects/DblQ00Wsup.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /******************************************************** @@ -14,15 +14,18 @@ #define DBLQ00_WSUP_H #include "RDBAccessSvc/IRDBQuery.h" + #include -namespace MuonGM -{ -class DblQ00Wsup { +class AmdcDb; + +namespace MuonGM { +class DblQ00Wsup { public: DblQ00Wsup(){}; ~DblQ00Wsup(); DblQ00Wsup(std::unique_ptr&&); + DblQ00Wsup(AmdcDb* wsup); // data members for DblQ00/WSUP fields struct WSUP { diff --git a/MuonSpectrometer/MuonGMdbObjects/MuonGMdbObjects/DblQ00Wtgc.h b/MuonSpectrometer/MuonGMdbObjects/MuonGMdbObjects/DblQ00Wtgc.h index 4ff2d3e1844..ed359d0960b 100644 --- a/MuonSpectrometer/MuonGMdbObjects/MuonGMdbObjects/DblQ00Wtgc.h +++ b/MuonSpectrometer/MuonGMdbObjects/MuonGMdbObjects/DblQ00Wtgc.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /******************************************************** @@ -14,15 +14,18 @@ #define DBLQ00_WTGC_H #include "RDBAccessSvc/IRDBQuery.h" + #include -namespace MuonGM -{ -class DblQ00Wtgc { +class AmdcDb; + +namespace MuonGM { +class DblQ00Wtgc { public: DblQ00Wtgc(){}; ~DblQ00Wtgc(); DblQ00Wtgc(std::unique_ptr&&); + DblQ00Wtgc(AmdcDb* wtgc); // data members for DblQ00/WTGC fields struct WTGC { diff --git a/MuonSpectrometer/MuonGMdbObjects/MuonGMdbObjects/DblQ00Xtomo.h b/MuonSpectrometer/MuonGMdbObjects/MuonGMdbObjects/DblQ00Xtomo.h index 706a7fe70ce..49912fbc753 100644 --- a/MuonSpectrometer/MuonGMdbObjects/MuonGMdbObjects/DblQ00Xtomo.h +++ b/MuonSpectrometer/MuonGMdbObjects/MuonGMdbObjects/DblQ00Xtomo.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /******************************************************** @@ -10,27 +10,23 @@ // entered: 2012-09-24 // comment: Mdt AsBuilt parameters - class to read from DB -#include - #ifndef DBLQ00_XTOMO_H #define DBLQ00_XTOMO_H #include "RDBAccessSvc/IRDBQuery.h" + #include +#include -namespace MuonGM -{ - +class AmdcDb; +namespace MuonGM { class DblQ00Xtomo { - public: DblQ00Xtomo(); ~DblQ00Xtomo(); DblQ00Xtomo(std::unique_ptr&& xtomo); -// DblQ00Xtomo(std::string asciiFileName); - -// void WriteXtomoToAsciiFile(std::string filename); + DblQ00Xtomo(AmdcDb* xtomo); // data members for DblQ00/XTOMO fields struct XTOMO { diff --git a/MuonSpectrometer/MuonGMdbObjects/src/DblQ00Acut.cxx b/MuonSpectrometer/MuonGMdbObjects/src/DblQ00Acut.cxx index 42959289a5b..ecb03bc4732 100644 --- a/MuonSpectrometer/MuonGMdbObjects/src/DblQ00Acut.cxx +++ b/MuonSpectrometer/MuonGMdbObjects/src/DblQ00Acut.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /*************************************************************************** @@ -7,31 +7,19 @@ ----------------------------------------- ***************************************************************************/ -// $Id: DblQ00Acut.cxx,v 1.4 2007-02-12 17:33:50 stefspa Exp $ -// $Name: not supported by cvs2svn $ - -//<<<<<< INCLUDES >>>>>> - #include "MuonGMdbObjects/DblQ00Acut.h" +#include "RDBAccessSvc/IRDBRecordset.h" +#include "AmdcDb/AmdcDb.h" +#include "AmdcDb/AmdcDbRecord.h" + #include #include -//<<<<<< PRIVATE DEFINES >>>>>> -//<<<<<< PRIVATE CONSTANTS >>>>>> -//<<<<<< PRIVATE TYPES >>>>>> -//<<<<<< PRIVATE VARIABLE DEFINITIONS >>>>>> -//<<<<<< PUBLIC VARIABLE DEFINITIONS >>>>>> -//<<<<<< CLASS STRUCTURE INITIALIZATION >>>>>> -//<<<<<< PRIVATE FUNCTION DEFINITIONS >>>>>> -//<<<<<< PUBLIC FUNCTION DEFINITIONS >>>>>> -//<<<<<< MEMBER FUNCTION DEFINITIONS >>>>>> - namespace MuonGM { -DblQ00Acut::DblQ00Acut(std::unique_ptr&& acut) - : m_nObj(0) -{ +DblQ00Acut::DblQ00Acut(std::unique_ptr&& acut) : + m_nObj(0) { if(acut) { acut->execute(); m_nObj = acut->size(); @@ -53,7 +41,46 @@ DblQ00Acut::DblQ00Acut(std::unique_ptr&& acut) std::cerr<<"NO Acut banks in the MuonDD Database"<getRecordsetPtr(std::string(getObjName()),"Amdc"); + std::vector::const_iterator it = pIRDBRecordset->begin(); + + m_nObj = pIRDBRecordset->size(); + m_d = new ACUT[m_nObj]; + if (m_nObj == 0) std::cerr<<"NO Acut banks in the AmdcDbRecord"<((*it)); + if (pAmdcDbRecord == 0){ + std::cerr << "No way to cast in AmdcDbRecord for " << getObjName() << std::endl; + return; + } + + std::vector< std::string> VariableList = pAmdcDbRecord->getVariableList(); + int ItemTot = VariableList.size() ; + for(int Item=0 ; Itembegin(); + for( ; itend(); it++){ + pAmdcDbRecord = dynamic_cast((*it)); + if(pAmdcDbRecord == 0){ + std::cerr << "No way to cast in AmdcDbRecord for " << getObjName() << std::endl; + return; + } + + i = i + 1; + + m_d[i].version = (*it)->getInt("VERS"); + m_d[i].i = (*it)->getInt("I"); + m_d[i].icut = (*it)->getInt("ICUT"); + m_d[i].n = (*it)->getInt("N"); + } +} + DblQ00Acut::~DblQ00Acut() { delete [] m_d; diff --git a/MuonSpectrometer/MuonGMdbObjects/src/DblQ00Alin.cxx b/MuonSpectrometer/MuonGMdbObjects/src/DblQ00Alin.cxx index 91d4c041dd2..c4361ead967 100644 --- a/MuonSpectrometer/MuonGMdbObjects/src/DblQ00Alin.cxx +++ b/MuonSpectrometer/MuonGMdbObjects/src/DblQ00Alin.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /*************************************************************************** @@ -7,31 +7,19 @@ ----------------------------------------- ***************************************************************************/ -// $Id: DblQ00Alin.cxx,v 1.5 2007-02-12 17:33:50 stefspa Exp $ -// $Name: not supported by cvs2svn $ - -//<<<<<< INCLUDES >>>>>> - #include "MuonGMdbObjects/DblQ00Alin.h" +#include "RDBAccessSvc/IRDBRecordset.h" +#include "AmdcDb/AmdcDb.h" +#include "AmdcDb/AmdcDbRecord.h" + #include #include -//<<<<<< PRIVATE DEFINES >>>>>> -//<<<<<< PRIVATE CONSTANTS >>>>>> -//<<<<<< PRIVATE TYPES >>>>>> -//<<<<<< PRIVATE VARIABLE DEFINITIONS >>>>>> -//<<<<<< PUBLIC VARIABLE DEFINITIONS >>>>>> -//<<<<<< CLASS STRUCTURE INITIALIZATION >>>>>> -//<<<<<< PRIVATE FUNCTION DEFINITIONS >>>>>> -//<<<<<< PUBLIC FUNCTION DEFINITIONS >>>>>> -//<<<<<< MEMBER FUNCTION DEFINITIONS >>>>>> - namespace MuonGM { -DblQ00Alin::DblQ00Alin(std::unique_ptr&& alin) - : m_nObj(0) -{ +DblQ00Alin::DblQ00Alin(std::unique_ptr&& alin) : + m_nObj(0) { if(alin) { alin->execute(); m_nObj = alin->size(); @@ -75,7 +63,54 @@ DblQ00Alin::DblQ00Alin(std::unique_ptr&& alin) std::cerr<<"NO Alin banks in the MuonDD Database"<getRecordsetPtr(std::string(getObjName()),"Amdc"); + std::vector::const_iterator it = pIRDBRecordset->begin(); + + m_nObj = pIRDBRecordset->size(); + m_d = new ALIN[m_nObj]; + if (m_nObj == 0) std::cerr<<"NO Alin banks in the AmdcDbRecord"<((*it)); + if (pAmdcDbRecord == 0){ + std::cerr << "No way to cast in AmdcDbRecord for " << getObjName() << std::endl; + return; + } + + std::vector< std::string> VariableList = pAmdcDbRecord->getVariableList(); + int ItemTot = VariableList.size() ; + for(int Item=0 ; Itembegin(); + for( ; itend(); it++){ + pAmdcDbRecord = dynamic_cast((*it)); + if(pAmdcDbRecord == 0){ + std::cerr << "No way to cast in AmdcDbRecord for " << getObjName() << std::endl; + return; + } + + i = i + 1; + + m_d[i].version = (*it)->getInt("VERS"); + m_d[i].dx = (*it)->getFloat("DX"); + m_d[i].dy = (*it)->getFloat("DY"); + m_d[i].i = (*it)->getInt("I"); + m_d[i].width_xs = (*it)->getFloat("WIDTH_XS"); + m_d[i].width_xl = (*it)->getFloat("WIDTH_XL"); + m_d[i].length_y = (*it)->getFloat("LENGTH_Y"); + m_d[i].excent = (*it)->getFloat("EXCENT"); + m_d[i].dead1 = (*it)->getFloat("DEAD1"); + m_d[i].jtyp = (*it)->getInt("JTYP"); + m_d[i].indx = (*it)->getInt("INDX"); + m_d[i].icut = (*it)->getInt("ICUT"); + } +} + DblQ00Alin::~DblQ00Alin() { delete [] m_d; diff --git a/MuonSpectrometer/MuonGMdbObjects/src/DblQ00Almn.cxx b/MuonSpectrometer/MuonGMdbObjects/src/DblQ00Almn.cxx index eddcc30269b..4ab2802195a 100644 --- a/MuonSpectrometer/MuonGMdbObjects/src/DblQ00Almn.cxx +++ b/MuonSpectrometer/MuonGMdbObjects/src/DblQ00Almn.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /*************************************************************************** @@ -7,31 +7,19 @@ ----------------------------------------- ***************************************************************************/ -// $Id: DblQ00Almn.cxx,v 1.5 2007-02-12 17:33:50 stefspa Exp $ -// $Name: not supported by cvs2svn $ - -//<<<<<< INCLUDES >>>>>> - #include "MuonGMdbObjects/DblQ00Almn.h" +#include "RDBAccessSvc/IRDBRecordset.h" +#include "AmdcDb/AmdcDb.h" +#include "AmdcDb/AmdcDbRecord.h" + #include #include -//<<<<<< PRIVATE DEFINES >>>>>> -//<<<<<< PRIVATE CONSTANTS >>>>>> -//<<<<<< PRIVATE TYPES >>>>>> -//<<<<<< PRIVATE VARIABLE DEFINITIONS >>>>>> -//<<<<<< PUBLIC VARIABLE DEFINITIONS >>>>>> -//<<<<<< CLASS STRUCTURE INITIALIZATION >>>>>> -//<<<<<< PRIVATE FUNCTION DEFINITIONS >>>>>> -//<<<<<< PUBLIC FUNCTION DEFINITIONS >>>>>> -//<<<<<< MEMBER FUNCTION DEFINITIONS >>>>>> - namespace MuonGM { -DblQ00Almn::DblQ00Almn(std::unique_ptr&& almn) - : m_nObj(0) -{ +DblQ00Almn::DblQ00Almn(std::unique_ptr&& almn) : + m_nObj(0) { if(almn) { almn->execute(); m_nObj = almn->size(); @@ -91,7 +79,62 @@ DblQ00Almn::DblQ00Almn(std::unique_ptr&& almn) std::cerr<<"NO Almn banks in the MuonDD Database"<getRecordsetPtr(std::string(getObjName()),"Amdc"); + std::vector::const_iterator it = pIRDBRecordset->begin(); + + m_nObj = pIRDBRecordset->size(); + m_d = new ALMN[m_nObj]; + if (m_nObj == 0) std::cerr<<"NO Almn banks in the AmdcDbRecord"<((*it)); + if (pAmdcDbRecord == 0){ + std::cerr << "No way to cast in AmdcDbRecord for " << getObjName() << std::endl; + return; + } + + std::vector< std::string> VariableList = pAmdcDbRecord->getVariableList(); + int ItemTot = VariableList.size() ; + for(int Item=0 ; Itembegin(); + for( ; itend(); it++){ + pAmdcDbRecord = dynamic_cast((*it)); + if(pAmdcDbRecord == 0){ + std::cerr << "No way to cast in AmdcDbRecord for " << getObjName() << std::endl; + return; + } + + i = i + 1; + + m_d[i].version = (*it)->getInt("VERS"); + m_d[i].i = (*it)->getInt("I"); + m_d[i].dx = (*it)->getFloat("DX"); + m_d[i].dy = (*it)->getFloat("DY"); + m_d[i].dz = (*it)->getFloat("DZ"); + m_d[i].job = (*it)->getInt("JOB"); + sprintf(m_d[i].tec,"%s",(*it)->getString("TEC").c_str()); + m_d[i].iw = (*it)->getInt("IW"); + m_d[i].isplit_x = (*it)->getInt("ISPLIT_X"); + m_d[i].isplit_y = (*it)->getInt("ISPLIT_Y"); + m_d[i].ishape = (*it)->getInt("ISHAPE"); + m_d[i].width_xs = (*it)->getFloat("WIDTH_XS"); + m_d[i].width_xl = (*it)->getFloat("WIDTH_XL"); + m_d[i].length_y = (*it)->getFloat("LENGTH_Y"); + m_d[i].excent = (*it)->getFloat("EXCENT"); + m_d[i].dead1 = (*it)->getFloat("DEAD1"); + m_d[i].dead2 = (*it)->getFloat("DEAD2"); + m_d[i].dead3 = (*it)->getFloat("DEAD3"); + m_d[i].jtyp = (*it)->getInt("JTYP"); + m_d[i].indx = (*it)->getInt("INDX"); + } +} + DblQ00Almn::~DblQ00Almn() { delete [] m_d; diff --git a/MuonSpectrometer/MuonGMdbObjects/src/DblQ00Aptp.cxx b/MuonSpectrometer/MuonGMdbObjects/src/DblQ00Aptp.cxx index d1f9a281114..2603209828a 100644 --- a/MuonSpectrometer/MuonGMdbObjects/src/DblQ00Aptp.cxx +++ b/MuonSpectrometer/MuonGMdbObjects/src/DblQ00Aptp.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /*************************************************************************** @@ -7,32 +7,20 @@ ----------------------------------------- ***************************************************************************/ -// $Id: DblQ00Aptp.cxx,v 1.4 2007-02-12 17:33:50 stefspa Exp $ -// $Name: not supported by cvs2svn $ - -//<<<<<< INCLUDES >>>>>> - #include "MuonGMdbObjects/DblQ00Aptp.h" +#include "RDBAccessSvc/IRDBRecordset.h" +#include "AmdcDb/AmdcDb.h" +#include "AmdcDb/AmdcDbRecord.h" + #include #include #include -//<<<<<< PRIVATE DEFINES >>>>>> -//<<<<<< PRIVATE CONSTANTS >>>>>> -//<<<<<< PRIVATE TYPES >>>>>> -//<<<<<< PRIVATE VARIABLE DEFINITIONS >>>>>> -//<<<<<< PUBLIC VARIABLE DEFINITIONS >>>>>> -//<<<<<< CLASS STRUCTURE INITIALIZATION >>>>>> -//<<<<<< PRIVATE FUNCTION DEFINITIONS >>>>>> -//<<<<<< PUBLIC FUNCTION DEFINITIONS >>>>>> -//<<<<<< MEMBER FUNCTION DEFINITIONS >>>>>> - namespace MuonGM { -DblQ00Aptp::DblQ00Aptp(std::unique_ptr&& aptp) - : m_nObj(0) -{ +DblQ00Aptp::DblQ00Aptp(std::unique_ptr&& aptp) : + m_nObj(0) { if(aptp) { aptp->execute(); m_nObj = aptp->size(); @@ -63,9 +51,6 @@ DblQ00Aptp::DblQ00Aptp(std::unique_ptr&& aptp) m_d[i].icut = aptp->data(fieldIcut); for (unsigned int j=0; j<8; j++) { - // std::ostringstream tem; -// tem << j; -// std::string tag = "APTP_DATA.IPHI_"+tem.str(); m_d[i].iphi[j] = aptp->data(fieldIphi+j); } m_d[i].iz = aptp->data(fieldIz); @@ -76,9 +61,6 @@ DblQ00Aptp::DblQ00Aptp(std::unique_ptr&& aptp) m_d[i].alfa = aptp->data(fieldAlfa); m_d[i].beta = aptp->data(fieldBeta); m_d[i].gamma = aptp->data(fieldGamma); -// std::cerr<finalize(); @@ -88,7 +70,62 @@ DblQ00Aptp::DblQ00Aptp(std::unique_ptr&& aptp) std::cerr<<"NO Aptp banks in the MuonDD Database"<getRecordsetPtr(std::string(getObjName()),"Amdc"); + std::vector::const_iterator it = pIRDBRecordset->begin(); + + m_nObj = pIRDBRecordset->size(); + m_d = new APTP[m_nObj]; + if (m_nObj == 0) std::cerr<<"NO Aptp banks in the AmdcDbRecord"<((*it)); + if (pAmdcDbRecord == 0){ + std::cerr << "No way to cast in AmdcDbRecord for " << getObjName() << std::endl; + return; + } + + std::vector< std::string> VariableList = pAmdcDbRecord->getVariableList(); + int ItemTot = VariableList.size() ; + for(int Item=0 ; Itembegin(); + for( ; itend(); it++){ + pAmdcDbRecord = dynamic_cast((*it)); + if(pAmdcDbRecord == 0){ + std::cerr << "No way to cast in AmdcDbRecord for " << getObjName() << std::endl; + return; + } + + i = i + 1; + + m_d[i].version = (*it)->getInt("VERS"); + m_d[i].line = (*it)->getInt("LINE"); + sprintf(m_d[i].type,"%s",(*it)->getString("TYP").c_str()); + m_d[i].i = (*it)->getInt("I"); + m_d[i].icut = (*it)->getInt("ICUT"); + for(int DB_JFF=0; DB_JFF<8 ; DB_JFF++) { + std::string DbVar = ""; + std::ostringstream Aostringstream; + Aostringstream << DB_JFF; + DbVar = "IPHI_"+Aostringstream.str(); + m_d[i].iphi[DB_JFF] =(*it)->getInt(DbVar); + } + m_d[i].iz = (*it)->getInt("IZ"); + m_d[i].dphi = (*it)->getFloat("DPHI"); + m_d[i].z = (*it)->getFloat("Z"); + m_d[i].r = (*it)->getFloat("R"); + m_d[i].s = (*it)->getFloat("S"); + m_d[i].alfa = (*it)->getFloat("ALFA"); + m_d[i].beta = (*it)->getFloat("BETA"); + m_d[i].gamma = (*it)->getFloat("GAMMA"); + } +} + DblQ00Aptp::~DblQ00Aptp() { delete [] m_d; diff --git a/MuonSpectrometer/MuonGMdbObjects/src/DblQ00Asmp.cxx b/MuonSpectrometer/MuonGMdbObjects/src/DblQ00Asmp.cxx index 3662c64d017..539c6a22d9e 100644 --- a/MuonSpectrometer/MuonGMdbObjects/src/DblQ00Asmp.cxx +++ b/MuonSpectrometer/MuonGMdbObjects/src/DblQ00Asmp.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /*************************************************************************** @@ -7,31 +7,18 @@ ----------------------------------------- ***************************************************************************/ -// $Id: DblQ00Asmp.cxx,v 1.5 2007-02-12 17:33:50 stefspa Exp $ -// $Name: not supported by cvs2svn $ - -//<<<<<< INCLUDES >>>>>> - #include "MuonGMdbObjects/DblQ00Asmp.h" +#include "RDBAccessSvc/IRDBRecordset.h" +#include "AmdcDb/AmdcDb.h" +#include "AmdcDb/AmdcDbRecord.h" + #include -//#include - -//<<<<<< PRIVATE DEFINES >>>>>> -//<<<<<< PRIVATE CONSTANTS >>>>>> -//<<<<<< PRIVATE TYPES >>>>>> -//<<<<<< PRIVATE VARIABLE DEFINITIONS >>>>>> -//<<<<<< PUBLIC VARIABLE DEFINITIONS >>>>>> -//<<<<<< CLASS STRUCTURE INITIALIZATION >>>>>> -//<<<<<< PRIVATE FUNCTION DEFINITIONS >>>>>> -//<<<<<< PUBLIC FUNCTION DEFINITIONS >>>>>> -//<<<<<< MEMBER FUNCTION DEFINITIONS >>>>>> namespace MuonGM { -DblQ00Asmp::DblQ00Asmp(std::unique_ptr&& asmp) - : m_nObj(0) -{ +DblQ00Asmp::DblQ00Asmp(std::unique_ptr&& asmp) : + m_nObj(0) { if(asmp) { asmp->execute(); m_nObj = asmp->size(); @@ -53,7 +40,46 @@ DblQ00Asmp::DblQ00Asmp(std::unique_ptr&& asmp) std::cerr<<"NO Asmp banks in the MuonDD Database"<getRecordsetPtr(std::string(getObjName()),"Amdc"); + std::vector::const_iterator it = pIRDBRecordset->begin(); + + m_nObj = pIRDBRecordset->size(); + m_d = new ASMP[m_nObj]; + if (m_nObj == 0) std::cerr<<"NO Asmp banks in the AmdcDbRecord"<((*it)); + if (pAmdcDbRecord == 0){ + std::cerr << "No way to cast in AmdcDbRecord for " << getObjName() << std::endl; + return; + } + + std::vector< std::string> VariableList = pAmdcDbRecord->getVariableList(); + int ItemTot = VariableList.size() ; + for(int Item=0 ; Itembegin(); + for( ; itend(); it++){ + pAmdcDbRecord = dynamic_cast((*it)); + if(pAmdcDbRecord == 0){ + std::cerr << "No way to cast in AmdcDbRecord for " << getObjName() << std::endl; + return; + } + + i = i + 1; + + m_d[i].version = (*it)->getInt("VERS"); + m_d[i].indx = (*it)->getInt("INDX"); + m_d[i].n = (*it)->getInt("N"); + m_d[i].jtyp = (*it)->getInt("JTYP"); + } +} + DblQ00Asmp::~DblQ00Asmp() { delete [] m_d; diff --git a/MuonSpectrometer/MuonGMdbObjects/src/DblQ00Aszt.cxx b/MuonSpectrometer/MuonGMdbObjects/src/DblQ00Aszt.cxx index 487ad755f42..d61d998a0e1 100644 --- a/MuonSpectrometer/MuonGMdbObjects/src/DblQ00Aszt.cxx +++ b/MuonSpectrometer/MuonGMdbObjects/src/DblQ00Aszt.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /*************************************************************************** @@ -7,27 +7,15 @@ ----------------------------------------- ***************************************************************************/ -// $Id: DblQ00Aszt.cxx,v 1.8 2009-03-30 18:13:51 roberth Exp $ -// $Name: not supported by cvs2svn $ - -//<<<<<< INCLUDES >>>>>> - #include "MuonGMdbObjects/DblQ00Aszt.h" +#include "RDBAccessSvc/IRDBRecordset.h" +#include "AmdcDb/AmdcDb.h" +#include "AmdcDb/AmdcDbRecord.h" + #include #include #include #include -//#include - -//<<<<<< PRIVATE DEFINES >>>>>> -//<<<<<< PRIVATE CONSTANTS >>>>>> -//<<<<<< PRIVATE TYPES >>>>>> -//<<<<<< PRIVATE VARIABLE DEFINITIONS >>>>>> -//<<<<<< PUBLIC VARIABLE DEFINITIONS >>>>>> -//<<<<<< CLASS STRUCTURE INITIALIZATION >>>>>> -//<<<<<< PRIVATE FUNCTION DEFINITIONS >>>>>> -//<<<<<< PUBLIC FUNCTION DEFINITIONS >>>>>> -//<<<<<< MEMBER FUNCTION DEFINITIONS >>>>>> namespace MuonGM { @@ -36,9 +24,8 @@ DblQ00Aszt::DblQ00Aszt() : m_d(NULL) m_nObj = 0; } -DblQ00Aszt::DblQ00Aszt(std::unique_ptr&& aszt) - : m_nObj(0) -{ +DblQ00Aszt::DblQ00Aszt(std::unique_ptr&& aszt) : + m_nObj(0) { if(aszt) { aszt->execute(); m_nObj = aszt->size(); @@ -70,9 +57,56 @@ DblQ00Aszt::DblQ00Aszt(std::unique_ptr&& aszt) std::cerr<<"NO Aszt banks in the MuonDD Database"<getRecordsetPtr(std::string(getObjName()),"Amdc"); + std::vector::const_iterator it = pIRDBRecordset->begin(); + + m_nObj = pIRDBRecordset->size(); + m_d = new ASZT[m_nObj]; + if (m_nObj == 0) std::cerr<<"NO Aszt banks in the AmdcDbRecord"<((*it)); + if (pAmdcDbRecord == 0){ + std::cerr << "No way to cast in AmdcDbRecord for " << getObjName() << std::endl; + return; + } -DblQ00Aszt::DblQ00Aszt(std::string asciiFileName) -{ + std::vector< std::string> VariableList = pAmdcDbRecord->getVariableList(); + int ItemTot = VariableList.size() ; + for(int Item=0 ; Itembegin(); + for( ; itend(); it++){ + pAmdcDbRecord = dynamic_cast((*it)); + if(pAmdcDbRecord == 0){ + std::cerr << "No way to cast in AmdcDbRecord for " << getObjName() << std::endl; + return; + } + + i = i + 1; + + m_d[i].version = (*it)->getInt("VERS"); + m_d[i].line = (*it)->getInt("LINE"); + m_d[i].jff = (*it)->getInt("JFF"); + m_d[i].jzz = (*it)->getInt("JZZ"); + m_d[i].job = (*it)->getInt("JOB"); + m_d[i].tras = (*it)->getFloat("TRAS"); + m_d[i].traz = (*it)->getFloat("TRAZ"); + m_d[i].trat = (*it)->getFloat("TRAT"); + m_d[i].rots = (*it)->getFloat("ROTS"); + m_d[i].rotz = (*it)->getFloat("ROTZ"); + m_d[i].rott = (*it)->getFloat("ROTT"); + m_d[i].i = (*it)->getInt("I"); + sprintf(m_d[i].type,"%s",(*it)->getString("TYP").c_str()); + } +} + +DblQ00Aszt::DblQ00Aszt(std::string asciiFileName) { std::cerr<<"Aszt with asciiFileName = : <"< "<> index - // >> m_d[j].version - // >> m_d[j].line >> AlineMarker >> m_d[j].type >> m_d[j].jff @@ -115,7 +145,6 @@ DblQ00Aszt::DblQ00Aszt(std::string asciiFileName) >> m_d[j].rott ) { - //std::cout<<" Aszt:: line "< $Id: DblQ00Atln.cxx,v 1.4 2007-02-12 17:33:50 stefspa Exp $ -// $Name: not supported by cvs2svn $ - -//<<<<<< INCLUDES >>>>>> - #include "MuonGMdbObjects/DblQ00Atln.h" +#include "RDBAccessSvc/IRDBRecordset.h" +#include "AmdcDb/AmdcDb.h" +#include "AmdcDb/AmdcDbRecord.h" + #include #include -//<<<<<< PRIVATE DEFINES >>>>>> -//<<<<<< PRIVATE CONSTANTS >>>>>> -//<<<<<< PRIVATE TYPES >>>>>> -//<<<<<< PRIVATE VARIABLE DEFINITIONS >>>>>> -//<<<<<< PUBLIC VARIABLE DEFINITIONS >>>>>> -//<<<<<< CLASS STRUCTURE INITIALIZATION >>>>>> -//<<<<<< PRIVATE FUNCTION DEFINITIONS >>>>>> -//<<<<<< PUBLIC FUNCTION DEFINITIONS >>>>>> -//<<<<<< MEMBER FUNCTION DEFINITIONS >>>>>> - namespace MuonGM { -DblQ00Atln::DblQ00Atln(std::unique_ptr&& atln) - : m_nObj(0) -{ +DblQ00Atln::DblQ00Atln(std::unique_ptr&& atln) : + m_nObj(0) { if(atln) { atln->execute(); m_nObj = atln->size(); @@ -64,7 +52,49 @@ DblQ00Atln::DblQ00Atln(std::unique_ptr&& atln) std::cerr<<"NO Atln banks in the MuonDD Database"<getRecordsetPtr(std::string(getObjName()),"Amdc"); + std::vector::const_iterator it = pIRDBRecordset->begin(); + + m_nObj = pIRDBRecordset->size(); + m_d = new ATLN[m_nObj]; + if (m_nObj == 0) std::cerr<<"NO Atln banks in the AmdcDbRecord"<((*it)); + if (pAmdcDbRecord == 0){ + std::cerr << "No way to cast in AmdcDbRecord for " << getObjName() << std::endl; + return; + } + + std::vector< std::string> VariableList = pAmdcDbRecord->getVariableList(); + int ItemTot = VariableList.size() ; + for(int Item=0 ; Itembegin(); + for( ; itend(); it++){ + pAmdcDbRecord = dynamic_cast((*it)); + if(pAmdcDbRecord == 0){ + std::cerr << "No way to cast in AmdcDbRecord for " << getObjName() << std::endl; + return; + } + + i = i + 1; + + m_d[i].version = (*it)->getInt("VERS"); + m_d[i].i = (*it)->getInt("I"); + m_d[i].icovol = (*it)->getInt("ICOVOL"); + m_d[i].zpovol = (*it)->getFloat("ZPOVOL"); + m_d[i].widvol = (*it)->getFloat("WIDVOL"); + sprintf(m_d[i].namvol,"%s",(*it)->getString("NAMVOL").c_str()); + m_d[i].jsta = (*it)->getInt("JSTA"); + } +} + DblQ00Atln::~DblQ00Atln() { delete [] m_d; diff --git a/MuonSpectrometer/MuonGMdbObjects/src/DblQ00Atyp.cxx b/MuonSpectrometer/MuonGMdbObjects/src/DblQ00Atyp.cxx index 75c28303ec3..11e2a56f337 100644 --- a/MuonSpectrometer/MuonGMdbObjects/src/DblQ00Atyp.cxx +++ b/MuonSpectrometer/MuonGMdbObjects/src/DblQ00Atyp.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /*************************************************************************** @@ -7,31 +7,19 @@ ----------------------------------------- ***************************************************************************/ -// $Id: DblQ00Atyp.cxx,v 1.4 2007-02-12 17:33:50 stefspa Exp $ -// $Name: not supported by cvs2svn $ - -//<<<<<< INCLUDES >>>>>> - #include "MuonGMdbObjects/DblQ00Atyp.h" +#include "RDBAccessSvc/IRDBRecordset.h" +#include "AmdcDb/AmdcDb.h" +#include "AmdcDb/AmdcDbRecord.h" + #include #include -//<<<<<< PRIVATE DEFINES >>>>>> -//<<<<<< PRIVATE CONSTANTS >>>>>> -//<<<<<< PRIVATE TYPES >>>>>> -//<<<<<< PRIVATE VARIABLE DEFINITIONS >>>>>> -//<<<<<< PUBLIC VARIABLE DEFINITIONS >>>>>> -//<<<<<< CLASS STRUCTURE INITIALIZATION >>>>>> -//<<<<<< PRIVATE FUNCTION DEFINITIONS >>>>>> -//<<<<<< PUBLIC FUNCTION DEFINITIONS >>>>>> -//<<<<<< MEMBER FUNCTION DEFINITIONS >>>>>> - namespace MuonGM { -DblQ00Atyp::DblQ00Atyp(std::unique_ptr&& atyp) - : m_nObj(0) -{ +DblQ00Atyp::DblQ00Atyp(std::unique_ptr&& atyp) : + m_nObj(0) { if(atyp) { atyp->execute(); m_nObj = atyp->size(); @@ -44,7 +32,6 @@ DblQ00Atyp::DblQ00Atyp(std::unique_ptr&& atyp) m_d[i].jtyp = atyp->data("ATYP_DATA.JTYP"); m_d[i].nsta = atyp->data("ATYP_DATA.NSTA"); sprintf(m_d[i].type,"%s",atyp->data("ATYP_DATA.TYP").c_str()); - //std::cerr<<" Atyp:: version, type, jtyp, nsta "<finalize(); @@ -54,7 +41,46 @@ DblQ00Atyp::DblQ00Atyp(std::unique_ptr&& atyp) std::cerr<<"NO Atyp banks in the MuonDD Database"<getRecordsetPtr(std::string(getObjName()),"Amdc"); + std::vector::const_iterator it = pIRDBRecordset->begin(); + + m_nObj = pIRDBRecordset->size(); + m_d = new ATYP[m_nObj]; + if (m_nObj == 0) std::cerr<<"NO Atyp banks in the AmdcDbRecord"<((*it)); + if (pAmdcDbRecord == 0){ + std::cerr << "No way to cast in AmdcDbRecord for " << getObjName() << std::endl; + return; + } + + std::vector< std::string> VariableList = pAmdcDbRecord->getVariableList(); + int ItemTot = VariableList.size() ; + for(int Item=0 ; Itembegin(); + for( ; itend(); it++){ + pAmdcDbRecord = dynamic_cast((*it)); + if(pAmdcDbRecord == 0){ + std::cerr << "No way to cast in AmdcDbRecord for " << getObjName() << std::endl; + return; + } + + i = i + 1; + + m_d[i].version = (*it)->getInt("VERS"); + m_d[i].jtyp = (*it)->getInt("JTYP"); + m_d[i].nsta = (*it)->getInt("NSTA"); + sprintf(m_d[i].type,"%s",(*it)->getString("TYP").c_str()); + } +} + DblQ00Atyp::~DblQ00Atyp() { delete [] m_d; diff --git a/MuonSpectrometer/MuonGMdbObjects/src/DblQ00Awln.cxx b/MuonSpectrometer/MuonGMdbObjects/src/DblQ00Awln.cxx index 912291a1343..17904fd4aae 100644 --- a/MuonSpectrometer/MuonGMdbObjects/src/DblQ00Awln.cxx +++ b/MuonSpectrometer/MuonGMdbObjects/src/DblQ00Awln.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /*************************************************************************** @@ -7,32 +7,19 @@ ----------------------------------------- ***************************************************************************/ -// $Id: DblQ00Awln.cxx,v 1.4 2007-02-12 17:33:50 stefspa Exp $ -// $Name: not supported by cvs2svn $ - -//<<<<<< INCLUDES >>>>>> - #include "MuonGMdbObjects/DblQ00Awln.h" +#include "RDBAccessSvc/IRDBRecordset.h" +#include "AmdcDb/AmdcDb.h" +#include "AmdcDb/AmdcDbRecord.h" + #include #include -//#include - -//<<<<<< PRIVATE DEFINES >>>>>> -//<<<<<< PRIVATE CONSTANTS >>>>>> -//<<<<<< PRIVATE TYPES >>>>>> -//<<<<<< PRIVATE VARIABLE DEFINITIONS >>>>>> -//<<<<<< PUBLIC VARIABLE DEFINITIONS >>>>>> -//<<<<<< CLASS STRUCTURE INITIALIZATION >>>>>> -//<<<<<< PRIVATE FUNCTION DEFINITIONS >>>>>> -//<<<<<< PUBLIC FUNCTION DEFINITIONS >>>>>> -//<<<<<< MEMBER FUNCTION DEFINITIONS >>>>>> namespace MuonGM { -DblQ00Awln::DblQ00Awln(std::unique_ptr&& awln) - : m_nObj(0) -{ +DblQ00Awln::DblQ00Awln(std::unique_ptr&& awln) : + m_nObj(0) { if(awln) { awln->execute(); m_nObj = awln->size(); @@ -53,8 +40,6 @@ DblQ00Awln::DblQ00Awln(std::unique_ptr&& awln) m_d[i].dedsep = awln->data("AWLN_DATA.DEDSEP"); m_d[i].nsrost = awln->data("AWLN_DATA.NSROST"); m_d[i].nzrost = awln->data("AWLN_DATA.NZROST"); - // std::cerr<<" wRPC"<finalize(); @@ -64,7 +49,54 @@ DblQ00Awln::DblQ00Awln(std::unique_ptr&& awln) std::cerr<<"NO Awln banks in the MuonDD Database"<getRecordsetPtr(std::string(getObjName()),"Amdc"); + std::vector::const_iterator it = pIRDBRecordset->begin(); + + m_nObj = pIRDBRecordset->size(); + m_d = new AWLN[m_nObj]; + if (m_nObj == 0) std::cerr<<"NO Aszt banks in the AmdcDbRecord"<((*it)); + if (pAmdcDbRecord == 0){ + std::cerr << "No way to cast in AmdcDbRecord for " << getObjName() << std::endl; + return; + } + + std::vector< std::string> VariableList = pAmdcDbRecord->getVariableList(); + int ItemTot = VariableList.size() ; + for(int Item=0 ; Itembegin(); + for( ; itend(); it++){ + pAmdcDbRecord = dynamic_cast((*it)); + if(pAmdcDbRecord == 0){ + std::cerr << "No way to cast in AmdcDbRecord for " << getObjName() << std::endl; + return; + } + + i = i + 1; + + m_d[i].version = (*it)->getInt("VERS"); + m_d[i].jsta = (*it)->getInt("JSTA"); + m_d[i].spitch = (*it)->getFloat("SPITCH"); + m_d[i].zpitch = (*it)->getFloat("ZPITCH"); + m_d[i].dedstr = (*it)->getFloat("DEDSTR"); + m_d[i].nsrest = (*it)->getInt("NSREST"); + m_d[i].nzrest = (*it)->getInt("NZREST"); + m_d[i].sfirst = (*it)->getFloat("SFIRST"); + m_d[i].zfirst = (*it)->getFloat("ZFIRST"); + m_d[i].dedsep = (*it)->getFloat("DEDSEP"); + m_d[i].nsrost = (*it)->getInt("NSROST"); + m_d[i].nzrost = (*it)->getInt("NZROST"); + } +} + DblQ00Awln::~DblQ00Awln() { delete [] m_d; diff --git a/MuonSpectrometer/MuonGMdbObjects/src/DblQ00Dbam.cxx b/MuonSpectrometer/MuonGMdbObjects/src/DblQ00Dbam.cxx index bd3dae580b0..986d08a704b 100644 --- a/MuonSpectrometer/MuonGMdbObjects/src/DblQ00Dbam.cxx +++ b/MuonSpectrometer/MuonGMdbObjects/src/DblQ00Dbam.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /*************************************************************************** @@ -7,33 +7,21 @@ ----------------------------------------- ***************************************************************************/ -// $Id: DblQ00Dbam.cxx,v 1.5 2007-02-12 17:33:50 stefspa Exp $ -// $Name: not supported by cvs2svn $ - -//<<<<<< INCLUDES >>>>>> - #include "MuonGMdbObjects/DblQ00Dbam.h" +#include "RDBAccessSvc/IRDBRecordset.h" +#include "AmdcDb/AmdcDb.h" +#include "AmdcDb/AmdcDbRecord.h" + #include #include #include #include -//<<<<<< PRIVATE DEFINES >>>>>> -//<<<<<< PRIVATE CONSTANTS >>>>>> -//<<<<<< PRIVATE TYPES >>>>>> -//<<<<<< PRIVATE VARIABLE DEFINITIONS >>>>>> -//<<<<<< PUBLIC VARIABLE DEFINITIONS >>>>>> -//<<<<<< CLASS STRUCTURE INITIALIZATION >>>>>> -//<<<<<< PRIVATE FUNCTION DEFINITIONS >>>>>> -//<<<<<< PUBLIC FUNCTION DEFINITIONS >>>>>> -//<<<<<< MEMBER FUNCTION DEFINITIONS >>>>>> - namespace MuonGM { -DblQ00Dbam::DblQ00Dbam(std::unique_ptr&& dbam) - : m_nObj(0) -{ +DblQ00Dbam::DblQ00Dbam(std::unique_ptr&& dbam) : + m_nObj(0) { if(dbam) { dbam->execute(); m_nObj = dbam->size(); @@ -65,13 +53,9 @@ DblQ00Dbam::DblQ00Dbam(std::unique_ptr&& dbam) } catch (const std::runtime_error&) { - //std::cerr<<"End of station-name list"<finalize(); @@ -81,7 +65,58 @@ DblQ00Dbam::DblQ00Dbam(std::unique_ptr&& dbam) std::cerr<<"NO Dbam banks in the MuonDD Database"<getRecordsetPtr(std::string(getObjName()),"Amdc"); + std::vector::const_iterator it = pIRDBRecordset->begin(); + + m_nObj = pIRDBRecordset->size(); + m_d = new DBAM[m_nObj]; + if (m_nObj == 0) std::cerr<<"NO Dbam banks in the AmdcDbRecord"<((*it)); + if (pAmdcDbRecord == 0){ + std::cerr << "No way to cast in AmdcDbRecord for " << getObjName() << std::endl; + return; + } + + std::vector< std::string> VariableList = pAmdcDbRecord->getVariableList(); + int ItemTot = VariableList.size() ; + for(int Item=0 ; Itembegin(); + for( ; itend(); it++){ + pAmdcDbRecord = dynamic_cast((*it)); + if(pAmdcDbRecord == 0){ + std::cerr << "No way to cast in AmdcDbRecord for " << getObjName() << std::endl; + return; + } + + i = i + 1; + + m_d[i].version = (*it)->getInt("VERS"); + m_d[i].nvrs = (*it)->getInt("NVRS"); + m_d[i].mtyp = (*it)->getInt("MTYP"); + m_d[i].numbox = (*it)->getInt("NUMBOX"); + sprintf(m_d[i].amdb,"%s",(*it)->getString("AMDB").c_str()); + if(((*it)->getString("TEST")).compare("NOT FOUND") == 0 ) sprintf(m_d[i].test,"unknown"); + else sprintf(m_d[i].test,"%s",(*it)->getString("TEST").c_str()); + + for(unsigned int j=0; j<53; j++) + { + std::ostringstream tem; + tem << j; + std::string tag = "NAME_"+tem.str(); + if(((*it)->getString(tag)).compare("NOT FOUND") == 0 ) break; + sprintf(m_d[i].name[j],"%s",(*it)->getString(tag).c_str()); + } + } +} + DblQ00Dbam::~DblQ00Dbam() { delete [] m_d; diff --git a/MuonSpectrometer/MuonGMdbObjects/src/DblQ00IAcsc.cxx b/MuonSpectrometer/MuonGMdbObjects/src/DblQ00IAcsc.cxx index 4fbdf143c28..cfe09283070 100644 --- a/MuonSpectrometer/MuonGMdbObjects/src/DblQ00IAcsc.cxx +++ b/MuonSpectrometer/MuonGMdbObjects/src/DblQ00IAcsc.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /*************************************************************************** @@ -7,46 +7,28 @@ ----------------------------------------- ***************************************************************************/ -// $Id: DblQ00Iacsc.cxx,v 1.8 2009-03-30 18:13:51 roberth Exp $ -// $Name: not supported by cvs2svn $ - -//<<<<<< INCLUDES >>>>>> - #include "MuonGMdbObjects/DblQ00IAcsc.h" +#include "RDBAccessSvc/IRDBRecordset.h" +#include "AmdcDb/AmdcDb.h" +#include "AmdcDb/AmdcDbRecord.h" + #include #include #include #include -//#include - -//<<<<<< PRIVATE DEFINES >>>>>> -//<<<<<< PRIVATE CONSTANTS >>>>>> -//<<<<<< PRIVATE TYPES >>>>>> -//<<<<<< PRIVATE VARIABLE DEFINITIONS >>>>>> -//<<<<<< PUBLIC VARIABLE DEFINITIONS >>>>>> -//<<<<<< CLASS STRUCTURE INITIALIZATION >>>>>> -//<<<<<< PRIVATE FUNCTION DEFINITIONS >>>>>> -//<<<<<< PUBLIC FUNCTION DEFINITIONS >>>>>> -//<<<<<< MEMBER FUNCTION DEFINITIONS >>>>>> namespace MuonGM { DblQ00IAcsc::DblQ00IAcsc() { m_nObj = 0; - m_d = 0; -// std::cerr <<" here we are"<&& iacsc) - : m_nObj(0) -{ - //std::cerr<<" pointer to ISZT data "<< iacsc<&& iacsc) : + m_nObj(0) { if(iacsc) { iacsc->execute(); - //std::cerr<<" after execute"<size(); m_d = new IACSC[m_nObj]; @@ -54,7 +36,6 @@ DblQ00IAcsc::DblQ00IAcsc(std::unique_ptr&& iacsc) int i=0; while(iacsc->next()) { - //std::cerr<<" do we ever come here ???"<data("ISZT_DATA.VERS"); m_d[i].line = i; @@ -62,21 +43,13 @@ DblQ00IAcsc::DblQ00IAcsc(std::unique_ptr&& iacsc) m_d[i].jzz = iacsc->data("ISZT_DATA.JZZ"); m_d[i].job = iacsc->data("ISZT_DATA.JOB"); m_d[i].wireLayer = iacsc->data("ISZT_DATA.JLAY"); - //std::cerr<<" do we ever come here1 ???"<data("ISZT_DATA.TRAS"); // I lines in mm, but ISZT in cm m_d[i].traz = 10.*iacsc->data("ISZT_DATA.TRAZ"); // I lines in mm, but ISZT in cm m_d[i].trat = 10.*iacsc->data("ISZT_DATA.TRAT"); // I lines in mm, but ISZT in cm m_d[i].rots = iacsc->data("ISZT_DATA.ROTS"); m_d[i].rotz = iacsc->data("ISZT_DATA.ROTZ"); m_d[i].rott = iacsc->data("ISZT_DATA.ROTT"); - //m_d[i].i = iacsc->data("ISZT_DATA.I"); - //std::cerr<<" do we ever come here 2???"<data("ISZT_DATA.TYP").c_str()); - //std::cerr<<" do we ever come here 3???"<finalize(); @@ -86,10 +59,56 @@ DblQ00IAcsc::DblQ00IAcsc(std::unique_ptr&& iacsc) std::cerr<<"NO IAcsc banks in the MuonDD Database"<getRecordsetPtr("ISZT","Amdc"); + std::vector::const_iterator it = pIRDBRecordset->begin(); + + m_nObj = pIRDBRecordset->size(); + m_d = new IACSC[m_nObj]; + if (m_nObj == 0) std::cerr<<"NO IAcsc banks in the AmdcDbRecord"<((*it)); + if (pAmdcDbRecord == 0){ + std::cerr << "No way to cast in AmdcDbRecord for " << getObjName() << std::endl; + return; + } + + std::vector< std::string> VariableList = pAmdcDbRecord->getVariableList(); + int ItemTot = VariableList.size() ; + for(int Item=0 ; Itembegin(); + for( ; itend(); it++){ + pAmdcDbRecord = dynamic_cast((*it)); + if(pAmdcDbRecord == 0){ + std::cerr << "No way to cast in AmdcDbRecord for " << getObjName() << std::endl; + return; + } + + i = i + 1; + + m_d[i].version = (*it)->getInt("VERS"); + m_d[i].line = i; + m_d[i].jff = (*it)->getInt("JFF"); + m_d[i].jzz = (*it)->getInt("JZZ"); + m_d[i].job = (*it)->getInt("JOB"); + m_d[i].wireLayer = (*it)->getInt("JLAY"); + m_d[i].tras = 10.*(*it)->getFloat("TRAS"); + m_d[i].traz = 10.*(*it)->getFloat("TRAZ"); + m_d[i].trat = 10.*(*it)->getFloat("TRAT"); + m_d[i].rots = (*it)->getFloat("ROTS"); + m_d[i].rotz = (*it)->getFloat("ROTZ"); + m_d[i].rott = (*it)->getFloat("ROTT"); + sprintf(m_d[i].type,"%s",(*it)->getString("TYP").c_str()); + } +} + +DblQ00IAcsc::DblQ00IAcsc(std::string asciiFileName) { std::cerr<<"IAcsc with asciiFileName = : <"< "<> index - // >> m_d[j].version - // >> m_d[j].line >> AlineMarker >> m_d[j].type >> m_d[j].jff @@ -136,20 +151,16 @@ DblQ00IAcsc::DblQ00IAcsc(std::string asciiFileName) < $Id: DblQ00Wchv.cxx,v 1.4 2007-02-12 17:33:50 stefspa Exp $ -// $Name: not supported by cvs2svn $ - -//<<<<<< INCLUDES >>>>>> - #include "MuonGMdbObjects/DblQ00Wchv.h" +#include "RDBAccessSvc/IRDBRecordset.h" +#include "AmdcDb/AmdcDb.h" +#include "AmdcDb/AmdcDbRecord.h" + #include #include -//#include - -//<<<<<< PRIVATE DEFINES >>>>>> -//<<<<<< PRIVATE CONSTANTS >>>>>> -//<<<<<< PRIVATE TYPES >>>>>> -//<<<<<< PRIVATE VARIABLE DEFINITIONS >>>>>> -//<<<<<< PUBLIC VARIABLE DEFINITIONS >>>>>> -//<<<<<< CLASS STRUCTURE INITIALIZATION >>>>>> -//<<<<<< PRIVATE FUNCTION DEFINITIONS >>>>>> -//<<<<<< PUBLIC FUNCTION DEFINITIONS >>>>>> -//<<<<<< MEMBER FUNCTION DEFINITIONS >>>>>> namespace MuonGM { -DblQ00Wchv::DblQ00Wchv(std::unique_ptr&& wchv) - : m_nObj(0) -{ +DblQ00Wchv::DblQ00Wchv(std::unique_ptr&& wchv) : + m_nObj(0) { if(wchv) { wchv->execute(); m_nObj = wchv->size(); @@ -47,9 +34,6 @@ DblQ00Wchv::DblQ00Wchv(std::unique_ptr&& wchv) m_d[i].heightness = wchv->data("WCHV_DATA.HEIGHTNESS"); m_d[i].largeness = wchv->data("WCHV_DATA.LARGENESS"); m_d[i].thickness = wchv->data("WCHV_DATA.THICKNESS"); -// std::cerr<finalize(); @@ -59,7 +43,48 @@ DblQ00Wchv::DblQ00Wchv(std::unique_ptr&& wchv) std::cerr<<"NO Wchv banks in the MuonDD Database"<getRecordsetPtr(std::string(getObjName()),"Amdc"); + std::vector::const_iterator it = pIRDBRecordset->begin(); + + m_nObj = pIRDBRecordset->size(); + m_d = new WCHV[m_nObj]; + if (m_nObj == 0) std::cerr<<"NO Wchv banks in the AmdcDbRecord"<((*it)); + if (pAmdcDbRecord == 0){ + std::cerr << "No way to cast in AmdcDbRecord for " << getObjName() << std::endl; + return; + } + + std::vector< std::string> VariableList = pAmdcDbRecord->getVariableList(); + int ItemTot = VariableList.size() ; + for(int Item=0 ; Itembegin(); + for( ; itend(); it++){ + pAmdcDbRecord = dynamic_cast((*it)); + if(pAmdcDbRecord == 0){ + std::cerr << "No way to cast in AmdcDbRecord for " << getObjName() << std::endl; + return; + } + + i = i + 1; + + m_d[i].version = (*it)->getInt("VERS"); + m_d[i].jsta = (*it)->getInt("JSTA"); + m_d[i].num = (*it)->getInt("NUM"); + m_d[i].heightness = (*it)->getFloat("HEIGHTNESS"); + m_d[i].largeness = (*it)->getFloat("LARGENESS"); + m_d[i].thickness = (*it)->getFloat("THICKNESS"); + } +} + DblQ00Wchv::~DblQ00Wchv() { delete [] m_d; diff --git a/MuonSpectrometer/MuonGMdbObjects/src/DblQ00Wcmi.cxx b/MuonSpectrometer/MuonGMdbObjects/src/DblQ00Wcmi.cxx index d4c53e3cfde..bf3edef510f 100644 --- a/MuonSpectrometer/MuonGMdbObjects/src/DblQ00Wcmi.cxx +++ b/MuonSpectrometer/MuonGMdbObjects/src/DblQ00Wcmi.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /*************************************************************************** @@ -7,32 +7,19 @@ ----------------------------------------- ***************************************************************************/ -// $Id: DblQ00Wcmi.cxx,v 1.5 2007-02-12 17:33:50 stefspa Exp $ -// $Name: not supported by cvs2svn $ - -//<<<<<< INCLUDES >>>>>> - #include "MuonGMdbObjects/DblQ00Wcmi.h" +#include "RDBAccessSvc/IRDBRecordset.h" +#include "AmdcDb/AmdcDb.h" +#include "AmdcDb/AmdcDbRecord.h" + #include #include -//#include - -//<<<<<< PRIVATE DEFINES >>>>>> -//<<<<<< PRIVATE CONSTANTS >>>>>> -//<<<<<< PRIVATE TYPES >>>>>> -//<<<<<< PRIVATE VARIABLE DEFINITIONS >>>>>> -//<<<<<< PUBLIC VARIABLE DEFINITIONS >>>>>> -//<<<<<< CLASS STRUCTURE INITIALIZATION >>>>>> -//<<<<<< PRIVATE FUNCTION DEFINITIONS >>>>>> -//<<<<<< PUBLIC FUNCTION DEFINITIONS >>>>>> -//<<<<<< MEMBER FUNCTION DEFINITIONS >>>>>> namespace MuonGM { -DblQ00Wcmi::DblQ00Wcmi(std::unique_ptr&& wcmi) - : m_nObj(0) -{ +DblQ00Wcmi::DblQ00Wcmi(std::unique_ptr&& wcmi) : + m_nObj(0) { if(wcmi) { wcmi->execute(); m_nObj = wcmi->size(); @@ -47,7 +34,6 @@ DblQ00Wcmi::DblQ00Wcmi(std::unique_ptr&& wcmi) m_d[i].heightness = wcmi->data("WCMI_DATA.HEIGHTNESS"); m_d[i].largeness = wcmi->data("WCMI_DATA.LARGENESS"); m_d[i].thickness = wcmi->data("WCMI_DATA.THICKNESS"); - //std::cerr<<" FROM ORACLE: CMI "<finalize(); @@ -57,7 +43,48 @@ DblQ00Wcmi::DblQ00Wcmi(std::unique_ptr&& wcmi) std::cerr<<"NO Wcmi banks in the MuonDD Database"<getRecordsetPtr(std::string(getObjName()),"Amdc"); + std::vector::const_iterator it = pIRDBRecordset->begin(); + + m_nObj = pIRDBRecordset->size(); + m_d = new WCMI[m_nObj]; + if (m_nObj == 0) std::cerr<<"NO Wcmi banks in the AmdcDbRecord"<((*it)); + if (pAmdcDbRecord == 0){ + std::cerr << "No way to cast in AmdcDbRecord for " << getObjName() << std::endl; + return; + } + + std::vector< std::string> VariableList = pAmdcDbRecord->getVariableList(); + int ItemTot = VariableList.size() ; + for(int Item=0 ; Itembegin(); + for( ; itend(); it++){ + pAmdcDbRecord = dynamic_cast((*it)); + if(pAmdcDbRecord == 0){ + std::cerr << "No way to cast in AmdcDbRecord for " << getObjName() << std::endl; + return; + } + + i = i + 1; + + m_d[i].version = (*it)->getInt("VERS"); + m_d[i].jsta = (*it)->getInt("JSTA"); + m_d[i].num = (*it)->getInt("NUM"); + m_d[i].heightness = (*it)->getFloat("HEIGHTNESS"); + m_d[i].largeness = (*it)->getFloat("LARGENESS"); + m_d[i].thickness = (*it)->getFloat("THICKNESS"); + } +} + DblQ00Wcmi::~DblQ00Wcmi() { delete [] m_d; diff --git a/MuonSpectrometer/MuonGMdbObjects/src/DblQ00Wcro.cxx b/MuonSpectrometer/MuonGMdbObjects/src/DblQ00Wcro.cxx index 25b0bacf61e..3e4a1a9fd3e 100644 --- a/MuonSpectrometer/MuonGMdbObjects/src/DblQ00Wcro.cxx +++ b/MuonSpectrometer/MuonGMdbObjects/src/DblQ00Wcro.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /*************************************************************************** @@ -7,32 +7,19 @@ ----------------------------------------- ***************************************************************************/ -// $Id: DblQ00Wcro.cxx,v 1.4 2007-02-12 17:33:50 stefspa Exp $ -// $Name: not supported by cvs2svn $ - -//<<<<<< INCLUDES >>>>>> - #include "MuonGMdbObjects/DblQ00Wcro.h" +#include "RDBAccessSvc/IRDBRecordset.h" +#include "AmdcDb/AmdcDb.h" +#include "AmdcDb/AmdcDbRecord.h" + #include #include -//#include - -//<<<<<< PRIVATE DEFINES >>>>>> -//<<<<<< PRIVATE CONSTANTS >>>>>> -//<<<<<< PRIVATE TYPES >>>>>> -//<<<<<< PRIVATE VARIABLE DEFINITIONS >>>>>> -//<<<<<< PUBLIC VARIABLE DEFINITIONS >>>>>> -//<<<<<< CLASS STRUCTURE INITIALIZATION >>>>>> -//<<<<<< PRIVATE FUNCTION DEFINITIONS >>>>>> -//<<<<<< PUBLIC FUNCTION DEFINITIONS >>>>>> -//<<<<<< MEMBER FUNCTION DEFINITIONS >>>>>> namespace MuonGM { -DblQ00Wcro::DblQ00Wcro(std::unique_ptr&& wcro) - : m_nObj(0) -{ +DblQ00Wcro::DblQ00Wcro(std::unique_ptr&& wcro) : + m_nObj(0) { if(wcro) { wcro->execute(); m_nObj = wcro->size(); @@ -56,7 +43,48 @@ DblQ00Wcro::DblQ00Wcro(std::unique_ptr&& wcro) std::cerr<<"NO Wcro banks in the MuonDD Database"<getRecordsetPtr(std::string(getObjName()),"Amdc"); + std::vector::const_iterator it = pIRDBRecordset->begin(); + + m_nObj = pIRDBRecordset->size(); + m_d = new WCRO[m_nObj]; + if (m_nObj == 0) std::cerr<<"NO Wcro banks in the AmdcDbRecord"<((*it)); + if (pAmdcDbRecord == 0){ + std::cerr << "No way to cast in AmdcDbRecord for " << getObjName() << std::endl; + return; + } + + std::vector< std::string> VariableList = pAmdcDbRecord->getVariableList(); + int ItemTot = VariableList.size() ; + for(int Item=0 ; Itembegin(); + for( ; itend(); it++){ + pAmdcDbRecord = dynamic_cast((*it)); + if(pAmdcDbRecord == 0){ + std::cerr << "No way to cast in AmdcDbRecord for " << getObjName() << std::endl; + return; + } + + i = i + 1; + + m_d[i].version = (*it)->getInt("VERS"); + m_d[i].jsta = (*it)->getInt("JSTA"); + m_d[i].num = (*it)->getInt("NUM"); + m_d[i].heightness = (*it)->getFloat("HEIGHTNESS"); + m_d[i].largeness = (*it)->getFloat("LARGENESS"); + m_d[i].thickness = (*it)->getFloat("THICKNESS"); + } +} + DblQ00Wcro::~DblQ00Wcro() { delete [] m_d; diff --git a/MuonSpectrometer/MuonGMdbObjects/src/DblQ00Wcsc.cxx b/MuonSpectrometer/MuonGMdbObjects/src/DblQ00Wcsc.cxx index d267064eb3f..ee8cce4eb5b 100644 --- a/MuonSpectrometer/MuonGMdbObjects/src/DblQ00Wcsc.cxx +++ b/MuonSpectrometer/MuonGMdbObjects/src/DblQ00Wcsc.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /*************************************************************************** @@ -7,33 +7,20 @@ ----------------------------------------- ***************************************************************************/ -// $Id: DblQ00Wcsc.cxx,v 1.6 2007-02-12 17:33:50 stefspa Exp $ -// $Name: not supported by cvs2svn $ - -//<<<<<< INCLUDES >>>>>> - #include "MuonGMdbObjects/DblQ00Wcsc.h" +#include "RDBAccessSvc/IRDBRecordset.h" +#include "AmdcDb/AmdcDb.h" +#include "AmdcDb/AmdcDbRecord.h" + #include #include -//#include #include -//<<<<<< PRIVATE DEFINES >>>>>> -//<<<<<< PRIVATE CONSTANTS >>>>>> -//<<<<<< PRIVATE TYPES >>>>>> -//<<<<<< PRIVATE VARIABLE DEFINITIONS >>>>>> -//<<<<<< PUBLIC VARIABLE DEFINITIONS >>>>>> -//<<<<<< CLASS STRUCTURE INITIALIZATION >>>>>> -//<<<<<< PRIVATE FUNCTION DEFINITIONS >>>>>> -//<<<<<< PUBLIC FUNCTION DEFINITIONS >>>>>> -//<<<<<< MEMBER FUNCTION DEFINITIONS >>>>>> - namespace MuonGM { -DblQ00Wcsc::DblQ00Wcsc(std::unique_ptr&& wcsc) - : m_nObj(0) -{ +DblQ00Wcsc::DblQ00Wcsc(std::unique_ptr&& wcsc) : + m_nObj(0) { if(wcsc) { wcsc->execute(); m_nObj = wcsc->size(); @@ -67,21 +54,16 @@ DblQ00Wcsc::DblQ00Wcsc(std::unique_ptr&& wcsc) m_d[i].pba2wi = wcsc->data("WCSC_DATA.PBA2WI"); m_d[i].pba3wi = wcsc->data("WCSC_DATA.PBA3WI"); m_d[i].psndco = wcsc->data("WCSC_DATA.PSNDCO"); - //std::cerr<<" original psndco = "<data("WCSC_DATA.AZCAT"); m_d[i].azcat = azcat; - //m_d[i].psndco = m_d[i].azcat; - //std::cerr<<" redefined psndco = "<&& wcsc) std::cerr<<"NO Wcsc banks in the MuonDD Database"<getRecordsetPtr(std::string(getObjName()),"Amdc"); + std::vector::const_iterator it = pIRDBRecordset->begin(); + + m_nObj = pIRDBRecordset->size(); + m_d = new WCSC[m_nObj]; + if (m_nObj == 0) std::cerr<<"NO Wcsc banks in the AmdcDbRecord"<((*it)); + if (pAmdcDbRecord == 0){ + std::cerr << "No way to cast in AmdcDbRecord for " << getObjName() << std::endl; + return; + } + + std::vector< std::string> VariableList = pAmdcDbRecord->getVariableList(); + int ItemTot = VariableList.size() ; + for(int Item=0 ; Itembegin(); + for( ; itend(); it++){ + pAmdcDbRecord = dynamic_cast((*it)); + if(pAmdcDbRecord == 0){ + std::cerr << "No way to cast in AmdcDbRecord for " << getObjName() << std::endl; + return; + } + + i = i + 1; + + m_d[i].version = (*it)->getInt("VERS"); + m_d[i].jsta = (*it)->getInt("JSTA"); + m_d[i].laycsc = (*it)->getInt("LAYCSC"); + m_d[i].ttotal = (*it)->getFloat("TTOTAL"); + m_d[i].tnomex = (*it)->getFloat("TNOMEX"); + m_d[i].tlag10 = (*it)->getFloat("TLAG10"); + m_d[i].wispa = (*it)->getFloat("WISPA"); + m_d[i].dancat = (*it)->getFloat("DANCAT"); + m_d[i].pcatre = (*it)->getFloat("PCATRE"); + m_d[i].gstrip = (*it)->getFloat("GSTRIP"); + m_d[i].wrestr = (*it)->getFloat("WRESTR"); + m_d[i].wflstr = (*it)->getFloat("WFLSTR"); + m_d[i].trrwas = (*it)->getFloat("TRRWAS"); + m_d[i].wroxa = (*it)->getFloat("WROXA"); + m_d[i].groxwi = (*it)->getFloat("GROXWI"); + m_d[i].wgasba = (*it)->getFloat("WGASBA"); + m_d[i].tgasba = (*it)->getFloat("TGASBA"); + m_d[i].wgascu = (*it)->getFloat("WGASCU"); + m_d[i].tgascu = (*it)->getFloat("TGASCU"); + m_d[i].wfixwi = (*it)->getFloat("WFIXWI"); + m_d[i].tfixwi = (*it)->getFloat("TFIXWI"); + m_d[i].pba1wi = (*it)->getFloat("PBA1WI"); + m_d[i].pba2wi = (*it)->getFloat("PBA2WI"); + m_d[i].pba3wi = (*it)->getFloat("PBA3WI"); + m_d[i].psndco = (*it)->getFloat("PSNDCO"); + m_d[i].azcat = 0.; + float azcat = 0.; + if((*it)->getFloat("AZCAT") != 999999999999.) + { + azcat = (*it)->getFloat("AZCAT"); + m_d[i].azcat = azcat; + } + else + { + std::cerr<<" azcat field does not exists !"< $Id: DblQ00Wded.cxx,v 1.4 2007-02-12 17:33:50 stefspa Exp $ -// $Name: not supported by cvs2svn $ - -//<<<<<< INCLUDES >>>>>> - #include "MuonGMdbObjects/DblQ00Wded.h" +#include "RDBAccessSvc/IRDBRecordset.h" +#include "AmdcDb/AmdcDb.h" +#include "AmdcDb/AmdcDbRecord.h" + #include #include -//#include - -//<<<<<< PRIVATE DEFINES >>>>>> -//<<<<<< PRIVATE CONSTANTS >>>>>> -//<<<<<< PRIVATE TYPES >>>>>> -//<<<<<< PRIVATE VARIABLE DEFINITIONS >>>>>> -//<<<<<< PUBLIC VARIABLE DEFINITIONS >>>>>> -//<<<<<< CLASS STRUCTURE INITIALIZATION >>>>>> -//<<<<<< PRIVATE FUNCTION DEFINITIONS >>>>>> -//<<<<<< PUBLIC FUNCTION DEFINITIONS >>>>>> -//<<<<<< MEMBER FUNCTION DEFINITIONS >>>>>> namespace MuonGM { -DblQ00Wded::DblQ00Wded(std::unique_ptr&& wded) - : m_nObj(0) -{ +DblQ00Wded::DblQ00Wded(std::unique_ptr&& wded) : + m_nObj(0) { if(wded) { wded->execute(); m_nObj = wded->size(); @@ -56,7 +43,48 @@ DblQ00Wded::DblQ00Wded(std::unique_ptr&& wded) std::cerr<<"NO Wded banks in the MuonDD Database"<getRecordsetPtr(std::string(getObjName()),"Amdc"); + std::vector::const_iterator it = pIRDBRecordset->begin(); + + m_nObj = pIRDBRecordset->size(); + m_d = new WDED[m_nObj]; + if (m_nObj == 0) std::cerr<<"NO Wded banks in the AmdcDbRecord"<((*it)); + if (pAmdcDbRecord == 0){ + std::cerr << "No way to cast in AmdcDbRecord for " << getObjName() << std::endl; + return; + } + + std::vector< std::string> VariableList = pAmdcDbRecord->getVariableList(); + int ItemTot = VariableList.size() ; + for(int Item=0 ; Itembegin(); + for( ; itend(); it++){ + pAmdcDbRecord = dynamic_cast((*it)); + if(pAmdcDbRecord == 0){ + std::cerr << "No way to cast in AmdcDbRecord for " << getObjName() << std::endl; + return; + } + + i = i + 1; + + m_d[i].version = (*it)->getInt("VERS"); + m_d[i].jsta = (*it)->getInt("JSTA"); + m_d[i].nb = (*it)->getInt("NB"); + m_d[i].x0 = (*it)->getFloat("X0"); + m_d[i].auphcb = (*it)->getFloat("AUPHCB"); + m_d[i].tckded = (*it)->getFloat("TCKDED"); + } +} + DblQ00Wded::~DblQ00Wded() { delete [] m_d; diff --git a/MuonSpectrometer/MuonGMdbObjects/src/DblQ00Wlbi.cxx b/MuonSpectrometer/MuonGMdbObjects/src/DblQ00Wlbi.cxx index 1f15902d168..473192c3ba5 100644 --- a/MuonSpectrometer/MuonGMdbObjects/src/DblQ00Wlbi.cxx +++ b/MuonSpectrometer/MuonGMdbObjects/src/DblQ00Wlbi.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /*************************************************************************** @@ -7,35 +7,22 @@ ----------------------------------------- ***************************************************************************/ -// $Id: DblQ00Wlbi.cxx,v 1.4 2007-02-12 17:33:50 stefspa Exp $ -// $Name: not supported by cvs2svn $ - -//<<<<<< INCLUDES >>>>>> - #include "MuonGMdbObjects/DblQ00Wlbi.h" #include "RelationalAccess/ICursor.h" #include "CoralBase/AttributeList.h" #include "CoralBase/Attribute.h" +#include "RDBAccessSvc/IRDBRecordset.h" +#include "AmdcDb/AmdcDb.h" +#include "AmdcDb/AmdcDbRecord.h" + #include #include -//#include - -//<<<<<< PRIVATE DEFINES >>>>>> -//<<<<<< PRIVATE CONSTANTS >>>>>> -//<<<<<< PRIVATE TYPES >>>>>> -//<<<<<< PRIVATE VARIABLE DEFINITIONS >>>>>> -//<<<<<< PUBLIC VARIABLE DEFINITIONS >>>>>> -//<<<<<< CLASS STRUCTURE INITIALIZATION >>>>>> -//<<<<<< PRIVATE FUNCTION DEFINITIONS >>>>>> -//<<<<<< PUBLIC FUNCTION DEFINITIONS >>>>>> -//<<<<<< MEMBER FUNCTION DEFINITIONS >>>>>> namespace MuonGM { -DblQ00Wlbi::DblQ00Wlbi(std::unique_ptr&& wlbi) - : m_nObj(0) -{ +DblQ00Wlbi::DblQ00Wlbi(std::unique_ptr&& wlbi) : + m_nObj(0) { if(wlbi) { wlbi->execute(); m_nObj = wlbi->size(); @@ -68,7 +55,51 @@ DblQ00Wlbi::DblQ00Wlbi(std::unique_ptr&& wlbi) std::cerr<<"NO Wlbi banks in the MuonDD Database"<getRecordsetPtr(std::string(getObjName()),"Amdc"); + std::vector::const_iterator it = pIRDBRecordset->begin(); + + m_nObj = pIRDBRecordset->size(); + m_d = new WLBI[m_nObj]; + if (m_nObj == 0) std::cerr<<"NO Wlbi banks in the AmdcDbRecord"<((*it)); + if (pAmdcDbRecord == 0){ + std::cerr << "No way to cast in AmdcDbRecord for " << getObjName() << std::endl; + return; + } + + std::vector< std::string> VariableList = pAmdcDbRecord->getVariableList(); + int ItemTot = VariableList.size() ; + for(int Item=0 ; Itembegin(); + for( ; itend(); it++){ + pAmdcDbRecord = dynamic_cast((*it)); + if(pAmdcDbRecord == 0){ + std::cerr << "No way to cast in AmdcDbRecord for " << getObjName() << std::endl; + return; + } + + i = i + 1; + + m_d[i].version = (*it)->getInt("VERS"); + m_d[i].jsta = (*it)->getInt("JSTA"); + m_d[i].num = (*it)->getInt("NUM"); + m_d[i].height = (*it)->getFloat("HEIGHT"); + m_d[i].thickness = (*it)->getFloat("THICKNESS"); + if((*it)->getFloat("LOWERTHICK") != 999999999999.) m_d[i].lowerThickness = (*it)->getFloat("LOWERTHICK"); + else m_d[i].lowerThickness = m_d[i].thickness ; + if ((*it)->getFloat(".SHIFTYSTATION") != 999999999999.) m_d[i].yShift = (*it)->getFloat("SHIFTYSTATION"); + else m_d[i].yShift = 0.; + } +} + DblQ00Wlbi::~DblQ00Wlbi() { delete [] m_d; diff --git a/MuonSpectrometer/MuonGMdbObjects/src/DblQ00Wmdt.cxx b/MuonSpectrometer/MuonGMdbObjects/src/DblQ00Wmdt.cxx index e2ea1befea8..bd4ca08af3f 100644 --- a/MuonSpectrometer/MuonGMdbObjects/src/DblQ00Wmdt.cxx +++ b/MuonSpectrometer/MuonGMdbObjects/src/DblQ00Wmdt.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /*************************************************************************** @@ -7,32 +7,20 @@ ----------------------------------------- ***************************************************************************/ -// $Id: DblQ00Wmdt.cxx,v 1.4 2007-02-12 17:33:50 stefspa Exp $ -// $Name: not supported by cvs2svn $ - -//<<<<<< INCLUDES >>>>>> - #include "MuonGMdbObjects/DblQ00Wmdt.h" +#include "RDBAccessSvc/IRDBRecordset.h" +#include "AmdcDb/AmdcDb.h" +#include "AmdcDb/AmdcDbRecord.h" + #include #include #include -//<<<<<< PRIVATE DEFINES >>>>>> -//<<<<<< PRIVATE CONSTANTS >>>>>> -//<<<<<< PRIVATE TYPES >>>>>> -//<<<<<< PRIVATE VARIABLE DEFINITIONS >>>>>> -//<<<<<< PUBLIC VARIABLE DEFINITIONS >>>>>> -//<<<<<< CLASS STRUCTURE INITIALIZATION >>>>>> -//<<<<<< PRIVATE FUNCTION DEFINITIONS >>>>>> -//<<<<<< PUBLIC FUNCTION DEFINITIONS >>>>>> -//<<<<<< MEMBER FUNCTION DEFINITIONS >>>>>> - namespace MuonGM { -DblQ00Wmdt::DblQ00Wmdt(std::unique_ptr&& wmdt) - : m_nObj(0) -{ +DblQ00Wmdt::DblQ00Wmdt(std::unique_ptr&& wmdt) : + m_nObj(0) { if(wmdt) { wmdt->execute(); m_nObj = wmdt->size(); @@ -60,10 +48,6 @@ DblQ00Wmdt::DblQ00Wmdt(std::unique_ptr&& wmdt) m_d[i].tubxco[j] = wmdt->data(tagx); m_d[i].tubyco[j] = wmdt->data(tagy); } -// std::cerr<finalize(); @@ -73,7 +57,61 @@ DblQ00Wmdt::DblQ00Wmdt(std::unique_ptr&& wmdt) std::cerr<<"NO Wmdt banks in the MuonDD Database"<getRecordsetPtr(std::string(getObjName()),"Amdc"); + std::vector::const_iterator it = pIRDBRecordset->begin(); + + m_nObj = pIRDBRecordset->size(); + m_d = new WMDT[m_nObj]; + if (m_nObj == 0) std::cerr<<"NO Wmdt banks in the AmdcDbRecord"<((*it)); + if (pAmdcDbRecord == 0){ + std::cerr << "No way to cast in AmdcDbRecord for " << getObjName() << std::endl; + return; + } + + std::vector< std::string> VariableList = pAmdcDbRecord->getVariableList(); + int ItemTot = VariableList.size() ; + for(int Item=0 ; Itembegin(); + for( ; itend(); it++){ + pAmdcDbRecord = dynamic_cast((*it)); + if(pAmdcDbRecord == 0){ + std::cerr << "No way to cast in AmdcDbRecord for " << getObjName() << std::endl; + return; + } + + i = i + 1; + + m_d[i].version = (*it)->getInt("VERS"); + m_d[i].iw = (*it)->getInt("IW"); + m_d[i].laymdt = (*it)->getInt("LAYMDT"); + sprintf(m_d[i].typ,"%s",(*it)->getString("TYP").c_str()); + m_d[i].x0 = (*it)->getFloat("X0"); + m_d[i].tubpit = (*it)->getFloat("TUBPIT"); + m_d[i].tubrad = (*it)->getFloat("TUBRAD"); + m_d[i].tubsta = (*it)->getFloat("TUBSTA"); + m_d[i].tubdea = (*it)->getFloat("TUBDEA"); + m_d[i].tubwal = (*it)->getFloat("TUBWAL"); + for(unsigned int j=0; j<4; j++) + { + std::ostringstream tem; + tem << j; + std::string tagx = "TUBXCO_"+tem.str(); + std::string tagy = "TUBYCO_"+tem.str(); + m_d[i].tubxco[j] = (*it)->getFloat(tagx); + m_d[i].tubyco[j] = (*it)->getFloat(tagy); + } + } +} + DblQ00Wmdt::~DblQ00Wmdt() { delete [] m_d; diff --git a/MuonSpectrometer/MuonGMdbObjects/src/DblQ00Wrpc.cxx b/MuonSpectrometer/MuonGMdbObjects/src/DblQ00Wrpc.cxx index 1b4a22cca12..d2dfd39d10b 100644 --- a/MuonSpectrometer/MuonGMdbObjects/src/DblQ00Wrpc.cxx +++ b/MuonSpectrometer/MuonGMdbObjects/src/DblQ00Wrpc.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /*************************************************************************** @@ -7,32 +7,19 @@ ----------------------------------------- ***************************************************************************/ -// $Id: DblQ00Wrpc.cxx,v 1.4 2007-02-12 17:33:50 stefspa Exp $ -// $Name: not supported by cvs2svn $ - -//<<<<<< INCLUDES >>>>>> - #include "MuonGMdbObjects/DblQ00Wrpc.h" +#include "RDBAccessSvc/IRDBRecordset.h" +#include "AmdcDb/AmdcDb.h" +#include "AmdcDb/AmdcDbRecord.h" + #include #include -//#include - -//<<<<<< PRIVATE DEFINES >>>>>> -//<<<<<< PRIVATE CONSTANTS >>>>>> -//<<<<<< PRIVATE TYPES >>>>>> -//<<<<<< PRIVATE VARIABLE DEFINITIONS >>>>>> -//<<<<<< PUBLIC VARIABLE DEFINITIONS >>>>>> -//<<<<<< CLASS STRUCTURE INITIALIZATION >>>>>> -//<<<<<< PRIVATE FUNCTION DEFINITIONS >>>>>> -//<<<<<< PUBLIC FUNCTION DEFINITIONS >>>>>> -//<<<<<< MEMBER FUNCTION DEFINITIONS >>>>>> namespace MuonGM { -DblQ00Wrpc::DblQ00Wrpc(std::unique_ptr&& wrpc) - : m_nObj(0) -{ +DblQ00Wrpc::DblQ00Wrpc(std::unique_ptr&& wrpc) : + m_nObj(0) { if(wrpc) { wrpc->execute(); m_nObj = wrpc->size(); @@ -70,7 +57,62 @@ DblQ00Wrpc::DblQ00Wrpc(std::unique_ptr&& wrpc) std::cerr<<"NO Wrpc banks in the MuonDD Database"<getRecordsetPtr(std::string(getObjName()),"Amdc"); + std::vector::const_iterator it = pIRDBRecordset->begin(); + + m_nObj = pIRDBRecordset->size(); + m_d = new WRPC[m_nObj]; + if (m_nObj == 0) std::cerr<<"NO Wrpc banks in the AmdcDbRecord"<((*it)); + if (pAmdcDbRecord == 0){ + std::cerr << "No way to cast in AmdcDbRecord for " << getObjName() << std::endl; + return; + } + + std::vector< std::string> VariableList = pAmdcDbRecord->getVariableList(); + int ItemTot = VariableList.size() ; + for(int Item=0 ; Itembegin(); + for( ; itend(); it++){ + pAmdcDbRecord = dynamic_cast((*it)); + if(pAmdcDbRecord == 0){ + std::cerr << "No way to cast in AmdcDbRecord for " << getObjName() << std::endl; + return; + } + + i = i + 1; + + m_d[i].version = (*it)->getInt("VERS"); + m_d[i].nvrs = (*it)->getInt("NVRS"); + m_d[i].layrpc = (*it)->getInt("LAYRPC"); + m_d[i].tckrla = (*it)->getFloat("TCKRLA"); + m_d[i].tottck = (*it)->getFloat("TOTTCK"); + m_d[i].tckfsp = (*it)->getFloat("TCKFSP"); + m_d[i].ackfsp = (*it)->getFloat("ACKFSP"); + m_d[i].tlohcb = (*it)->getFloat("TLOHCB"); + m_d[i].alohcb = (*it)->getFloat("ALOHCB"); + m_d[i].tckbak = (*it)->getFloat("TCKBAK"); + m_d[i].tckgas = (*it)->getFloat("TCKGAS"); + m_d[i].tckssu = (*it)->getFloat("TCKSSU"); + m_d[i].tckstr = (*it)->getFloat("TCKSTR"); + m_d[i].sdedmi = (*it)->getFloat("SDEDMI"); + m_d[i].zdedmi = (*it)->getFloat("ZDEDMI"); + m_d[i].spdiam = (*it)->getFloat("SPDIAM"); + m_d[i].sppitc = (*it)->getFloat("SPPITC"); + m_d[i].stroff[0] = (*it)->getFloat("STROFF_0"); + m_d[i].stroff[1] = (*it)->getFloat("STROFF_1"); + m_d[i].stroff[2] = (*it)->getFloat("STROFF_2"); + } +} + DblQ00Wrpc::~DblQ00Wrpc() { delete [] m_d; diff --git a/MuonSpectrometer/MuonGMdbObjects/src/DblQ00Wspa.cxx b/MuonSpectrometer/MuonGMdbObjects/src/DblQ00Wspa.cxx index fe370a71d8f..0840a0d251f 100644 --- a/MuonSpectrometer/MuonGMdbObjects/src/DblQ00Wspa.cxx +++ b/MuonSpectrometer/MuonGMdbObjects/src/DblQ00Wspa.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /*************************************************************************** @@ -7,32 +7,19 @@ ----------------------------------------- ***************************************************************************/ -// $Id: DblQ00Wspa.cxx,v 1.4 2007-02-12 17:33:50 stefspa Exp $ -// $Name: not supported by cvs2svn $ - -//<<<<<< INCLUDES >>>>>> - #include "MuonGMdbObjects/DblQ00Wspa.h" +#include "RDBAccessSvc/IRDBRecordset.h" +#include "AmdcDb/AmdcDb.h" +#include "AmdcDb/AmdcDbRecord.h" + #include #include -//#include - -//<<<<<< PRIVATE DEFINES >>>>>> -//<<<<<< PRIVATE CONSTANTS >>>>>> -//<<<<<< PRIVATE TYPES >>>>>> -//<<<<<< PRIVATE VARIABLE DEFINITIONS >>>>>> -//<<<<<< PUBLIC VARIABLE DEFINITIONS >>>>>> -//<<<<<< CLASS STRUCTURE INITIALIZATION >>>>>> -//<<<<<< PRIVATE FUNCTION DEFINITIONS >>>>>> -//<<<<<< PUBLIC FUNCTION DEFINITIONS >>>>>> -//<<<<<< MEMBER FUNCTION DEFINITIONS >>>>>> namespace MuonGM { -DblQ00Wspa::DblQ00Wspa(std::unique_ptr&& wspa) - : m_nObj(0) -{ +DblQ00Wspa::DblQ00Wspa(std::unique_ptr&& wspa) : + m_nObj(0) { if(wspa) { wspa->execute(); m_nObj = wspa->size(); @@ -55,7 +42,47 @@ DblQ00Wspa::DblQ00Wspa(std::unique_ptr&& wspa) std::cerr<<"NO Wspa banks in the MuonDD Database"<getRecordsetPtr(std::string(getObjName()),"Amdc"); + std::vector::const_iterator it = pIRDBRecordset->begin(); + + m_nObj = pIRDBRecordset->size(); + m_d = new WSPA[m_nObj]; + if (m_nObj == 0) std::cerr<<"NO Wspa banks in the AmdcDbRecord"<((*it)); + if (pAmdcDbRecord == 0){ + std::cerr << "No way to cast in AmdcDbRecord for " << getObjName() << std::endl; + return; + } + + std::vector< std::string> VariableList = pAmdcDbRecord->getVariableList(); + int ItemTot = VariableList.size() ; + for(int Item=0 ; Itembegin(); + for( ; itend(); it++){ + pAmdcDbRecord = dynamic_cast((*it)); + if(pAmdcDbRecord == 0){ + std::cerr << "No way to cast in AmdcDbRecord for " << getObjName() << std::endl; + return; + } + + i = i + 1; + + m_d[i].version = (*it)->getInt("VERS"); + m_d[i].jsta = (*it)->getInt("JSTA"); + m_d[i].nb = (*it)->getInt("NB"); + m_d[i].x0 = (*it)->getFloat("X0"); + m_d[i].tckspa = (*it)->getFloat("TCKSPA"); + } +} + DblQ00Wspa::~DblQ00Wspa() { delete [] m_d; diff --git a/MuonSpectrometer/MuonGMdbObjects/src/DblQ00Wsup.cxx b/MuonSpectrometer/MuonGMdbObjects/src/DblQ00Wsup.cxx index 9adc1eddd0e..9640257f637 100644 --- a/MuonSpectrometer/MuonGMdbObjects/src/DblQ00Wsup.cxx +++ b/MuonSpectrometer/MuonGMdbObjects/src/DblQ00Wsup.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /*************************************************************************** @@ -7,32 +7,19 @@ ----------------------------------------- ***************************************************************************/ -// $Id: DblQ00Wsup.cxx,v 1.4 2007-02-12 17:33:50 stefspa Exp $ -// $Name: not supported by cvs2svn $ - -//<<<<<< INCLUDES >>>>>> - #include "MuonGMdbObjects/DblQ00Wsup.h" +#include "RDBAccessSvc/IRDBRecordset.h" +#include "AmdcDb/AmdcDb.h" +#include "AmdcDb/AmdcDbRecord.h" + #include #include -//#include - -//<<<<<< PRIVATE DEFINES >>>>>> -//<<<<<< PRIVATE CONSTANTS >>>>>> -//<<<<<< PRIVATE TYPES >>>>>> -//<<<<<< PRIVATE VARIABLE DEFINITIONS >>>>>> -//<<<<<< PUBLIC VARIABLE DEFINITIONS >>>>>> -//<<<<<< CLASS STRUCTURE INITIALIZATION >>>>>> -//<<<<<< PRIVATE FUNCTION DEFINITIONS >>>>>> -//<<<<<< PUBLIC FUNCTION DEFINITIONS >>>>>> -//<<<<<< MEMBER FUNCTION DEFINITIONS >>>>>> namespace MuonGM { -DblQ00Wsup::DblQ00Wsup(std::unique_ptr&& wsup) - : m_nObj(0) -{ +DblQ00Wsup::DblQ00Wsup(std::unique_ptr&& wsup) : + m_nObj(0) { if(wsup) { wsup->execute(); m_nObj = wsup->size(); @@ -65,7 +52,57 @@ DblQ00Wsup::DblQ00Wsup(std::unique_ptr&& wsup) std::cerr<<"NO Wsup banks in the MuonDD Database"<getRecordsetPtr(std::string(getObjName()),"Amdc"); + std::vector::const_iterator it = pIRDBRecordset->begin(); + + m_nObj = pIRDBRecordset->size(); + m_d = new WSUP[m_nObj]; + if (m_nObj == 0) std::cerr<<"NO Wsup banks in the AmdcDbRecord"<((*it)); + if (pAmdcDbRecord == 0){ + std::cerr << "No way to cast in AmdcDbRecord for " << getObjName() << std::endl; + return; + } + + std::vector< std::string> VariableList = pAmdcDbRecord->getVariableList(); + int ItemTot = VariableList.size() ; + for(int Item=0 ; Itembegin(); + for( ; itend(); it++){ + pAmdcDbRecord = dynamic_cast((*it)); + if(pAmdcDbRecord == 0){ + std::cerr << "No way to cast in AmdcDbRecord for " << getObjName() << std::endl; + return; + } + + i = i + 1; + + m_d[i].version = (*it)->getInt("VERS"); + m_d[i].jsta = (*it)->getInt("JSTA"); + m_d[i].nxxsup = (*it)->getInt("NXXSUP"); + m_d[i].nzzsup = (*it)->getInt("NZZSUP"); + m_d[i].x0 = (*it)->getFloat("X0"); + m_d[i].thickn = (*it)->getFloat("THICKN"); + for(unsigned int j=0; j<4; j++) + { + std::ostringstream tem; + tem << j; + std::string tagx = "XXSUP_"+tem.str(); + std::string tagy = "ZZSUP_"+tem.str(); + m_d[i].xxsup[j] = (*it)->getFloat(tagx); + m_d[i].zzsup[j] = (*it)->getFloat(tagy); + } + } +} + DblQ00Wsup::~DblQ00Wsup() { delete [] m_d; diff --git a/MuonSpectrometer/MuonGMdbObjects/src/DblQ00Wtgc.cxx b/MuonSpectrometer/MuonGMdbObjects/src/DblQ00Wtgc.cxx index 31dbaa8c3cf..e09c3075e6f 100644 --- a/MuonSpectrometer/MuonGMdbObjects/src/DblQ00Wtgc.cxx +++ b/MuonSpectrometer/MuonGMdbObjects/src/DblQ00Wtgc.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /*************************************************************************** @@ -7,33 +7,21 @@ ----------------------------------------- ***************************************************************************/ -// $Id: DblQ00Wtgc.cxx,v 1.4 2007-02-12 17:33:50 stefspa Exp $ -// $Name: not supported by cvs2svn $ - -//<<<<<< INCLUDES >>>>>> - #include "MuonGMdbObjects/DblQ00Wtgc.h" +#include "RDBAccessSvc/IRDBRecordset.h" +#include "AmdcDb/AmdcDb.h" +#include "AmdcDb/AmdcDbRecord.h" + #include #include #include #include -//<<<<<< PRIVATE DEFINES >>>>>> -//<<<<<< PRIVATE CONSTANTS >>>>>> -//<<<<<< PRIVATE TYPES >>>>>> -//<<<<<< PRIVATE VARIABLE DEFINITIONS >>>>>> -//<<<<<< PUBLIC VARIABLE DEFINITIONS >>>>>> -//<<<<<< CLASS STRUCTURE INITIALIZATION >>>>>> -//<<<<<< PRIVATE FUNCTION DEFINITIONS >>>>>> -//<<<<<< PUBLIC FUNCTION DEFINITIONS >>>>>> -//<<<<<< MEMBER FUNCTION DEFINITIONS >>>>>> - namespace MuonGM { -DblQ00Wtgc::DblQ00Wtgc(std::unique_ptr&& wtgc) - : m_nObj(0) -{ +DblQ00Wtgc::DblQ00Wtgc(std::unique_ptr&& wtgc) : + m_nObj(0) { if(wtgc) { wtgc->execute(); m_nObj = wtgc->size(); @@ -59,7 +47,6 @@ DblQ00Wtgc::DblQ00Wtgc(std::unique_ptr&& wtgc) } catch (const std::runtime_error&) { - //std::cerr<<"MuonGM::DblQ00-Wtgc- End of material-name list"<&& wtgc) std::cerr<<"NO Wtgc banks in the MuonDD Database"<getRecordsetPtr(std::string(getObjName()),"Amdc"); + std::vector::const_iterator it = pIRDBRecordset->begin(); + + m_nObj = pIRDBRecordset->size(); + m_d = new WTGC[m_nObj]; + if (m_nObj == 0) std::cerr<<"NO Wtgc banks in the AmdcDbRecord"<((*it)); + if (pAmdcDbRecord == 0){ + std::cerr << "No way to cast in AmdcDbRecord for " << getObjName() << std::endl; + return; + } + + std::vector< std::string> VariableList = pAmdcDbRecord->getVariableList(); + int ItemTot = VariableList.size() ; + for(int Item=0 ; Itembegin(); + for( ; itend(); it++){ + pAmdcDbRecord = dynamic_cast((*it)); + if(pAmdcDbRecord == 0){ + std::cerr << "No way to cast in AmdcDbRecord for " << getObjName() << std::endl; + return; + } + + i = i + 1; + + m_d[i].version = (*it)->getInt("VERS"); + m_d[i].jsta = (*it)->getInt("JSTA"); + m_d[i].nbevol = (*it)->getInt("NBEVOL"); + m_d[i].x0 = (*it)->getFloat("X0"); + m_d[i].widchb = (*it)->getFloat("WIDCHB"); + m_d[i].fwirch = (*it)->getFloat("FWIRCH"); + m_d[i].fwixch = (*it)->getFloat("FWIXCH"); + for(unsigned int j=0; j<9; j++) + { + std::ostringstream tem; + tem << j; + std::string tag = "ALLNAME_"+tem.str(); + if(((*it)->getString(tag)).compare("NOT FOUND") == 0 ) break; + sprintf(m_d[i].allname[j],"%s",(*it)->getString(tag).c_str()); + } + } +} + DblQ00Wtgc::~DblQ00Wtgc() { delete [] m_d; diff --git a/MuonSpectrometer/MuonGMdbObjects/src/DblQ00Xtomo.cxx b/MuonSpectrometer/MuonGMdbObjects/src/DblQ00Xtomo.cxx index a4bfd1e653d..c76cbeb64b7 100644 --- a/MuonSpectrometer/MuonGMdbObjects/src/DblQ00Xtomo.cxx +++ b/MuonSpectrometer/MuonGMdbObjects/src/DblQ00Xtomo.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /*************************************************************************** @@ -7,20 +7,22 @@ ----------------------------------------- ***************************************************************************/ - #include "MuonGMdbObjects/DblQ00Xtomo.h" +#include "RDBAccessSvc/IRDBRecordset.h" +#include "AmdcDb/AmdcDb.h" +#include "AmdcDb/AmdcDbRecord.h" + #include namespace MuonGM { -DblQ00Xtomo::DblQ00Xtomo() : m_nObj(0) -{ - m_d = NULL; +DblQ00Xtomo::DblQ00Xtomo() : + m_nObj(0) { + m_d = nullptr; } -DblQ00Xtomo::DblQ00Xtomo(std::unique_ptr&& xtomo) - : m_nObj(0) -{ +DblQ00Xtomo::DblQ00Xtomo(std::unique_ptr&& xtomo) : + m_nObj(0) { std::cout << "In DblQ00Xtomo(data)" << std::endl; if(xtomo) { xtomo->execute(); @@ -81,13 +83,90 @@ DblQ00Xtomo::DblQ00Xtomo(std::unique_ptr&& xtomo) xtomo->finalize(); } else { - m_d = 0; + m_d = nullptr; std::cerr << "No XtomoData table in the MuonDD Database" << std::endl; } } + +DblQ00Xtomo::DblQ00Xtomo(AmdcDb* xtomo) : + m_nObj(0) { + IRDBRecordset_ptr pIRDBRecordset = xtomo->getRecordsetPtr(std::string(getObjName()),"Amdc"); + std::vector::const_iterator it = pIRDBRecordset->begin(); + + m_nObj = pIRDBRecordset->size(); + m_d = new XTOMO[m_nObj]; + if (m_nObj == 0) std::cerr<<"NO Xtomo banks in the AmdcDbRecord"<((*it)); + if (pAmdcDbRecord == 0){ + std::cerr << "No way to cast in AmdcDbRecord for " << getObjName() << std::endl; + return; + } - + std::vector< std::string> VariableList = pAmdcDbRecord->getVariableList(); + int ItemTot = VariableList.size() ; + for(int Item=0 ; Itembegin(); + for( ; itend(); it++){ + pAmdcDbRecord = dynamic_cast((*it)); + if(pAmdcDbRecord == 0){ + std::cerr << "No way to cast in AmdcDbRecord for " << getObjName() << std::endl; + return; + } + + i = i + 1; + + m_d[i].line = i; + m_d[i].XTOMOCHBERNAME = (*it)->getString("XTOMODATA_DATA.XTOMOCHBERNAME"); + m_d[i].XTOMOSITE = (*it)->getString("XTOMODATA_DATA.XTOMOSITE"); + m_d[i].XTOMOSITEID = (*it)->getInt("XTOMODATA_DATA.XTOMOSITEID"); + m_d[i].XTOMOTIME = (*it)->getInt("XTOMODATA_DATA.XTOMOTIME"); + m_d[i].XTOMOPASSED = (*it)->getInt("XTOMODATA_DATA.XTOMOPASSED"); + m_d[i].XTOMOSIDE = (*it)->getString("XTOMODATA_DATA.XTOMOSIDE"); + m_d[i].XTOMONBERTUBE1 = (*it)->getInt("XTOMODATA_DATA.XTOMONBERTUBE1"); + m_d[i].XTOMONBERTUBE2 = (*it)->getInt("XTOMODATA_DATA.XTOMONBERTUBE2"); + m_d[i].XTOMONBERML = (*it)->getInt("XTOMODATA_DATA.XTOMONBERML"); + m_d[i].XTOMONBERLAYER = (*it)->getInt("XTOMODATA_DATA.XTOMONBERLAYER"); + try { + m_d[i].XTOMOML1STAGG = (*it)->getInt("XTOMODATA_DATA.XTOMOML1STAGG"); + } catch (std::exception&) {} // ignore exception for now: field missing in MuonSpectrometer-R.06.01-tomotest + try { + m_d[i].XTOMOML2STAGG = (*it)->getInt("XTOMODATA_DATA.XTOMOML2STAGG"); + } catch (std::exception&) {} // ignore exception for now: field missing in MuonSpectrometer-R.06.01-tomotest + try { + m_d[i].XTOMOD1 = (*it)->getFloat("XTOMODATA_DATA.XTOMOD1"); + } catch (std::exception&) {} // ignore exception for now: field missing in MuonSpectrometer-R.06.01-tomotest + try { + m_d[i].XTOMONMEZ = (*it)->getInt("XTOMODATA_DATA.XTOMONMEZ"); + } catch (std::exception&) {} // ignore exception for now: field missing in MuonSpectrometer-R.06.01-tomotest + m_d[i].XTOMOML1NYTUB = (*it)->getFloat("XTOMODATA_DATA.XTOMOML1NYTUB"); + m_d[i].XTOMOML1NZTUB = (*it)->getFloat("XTOMODATA_DATA.XTOMOML1NZTUB"); + m_d[i].XTOMOML1NDELA = (*it)->getFloat("XTOMODATA_DATA.XTOMOML1NDELA"); + m_d[i].XTOMOML1NYPIT = (*it)->getFloat("XTOMODATA_DATA.XTOMOML1NYPIT"); + m_d[i].XTOMOML1NZPIT = (*it)->getFloat("XTOMODATA_DATA.XTOMOML1NZPIT"); + m_d[i].XTOMOML1PYTUB = (*it)->getFloat("XTOMODATA_DATA.XTOMOML1PYTUB"); + m_d[i].XTOMOML1PZTUB = (*it)->getFloat("XTOMODATA_DATA.XTOMOML1PZTUB"); + m_d[i].XTOMOML1PDELA = (*it)->getFloat("XTOMODATA_DATA.XTOMOML1PDELA"); + m_d[i].XTOMOML1PYPIT = (*it)->getFloat("XTOMODATA_DATA.XTOMOML1PYPIT"); + m_d[i].XTOMOML1PZPIT = (*it)->getFloat("XTOMODATA_DATA.XTOMOML1PZPIT"); + m_d[i].XTOMOML2NYTUB = (*it)->getFloat("XTOMODATA_DATA.XTOMOML2NYTUB"); + m_d[i].XTOMOML2NZTUB = (*it)->getFloat("XTOMODATA_DATA.XTOMOML2NZTUB"); + m_d[i].XTOMOML2NDELA = (*it)->getFloat("XTOMODATA_DATA.XTOMOML2NDELA"); + m_d[i].XTOMOML2NYPIT = (*it)->getFloat("XTOMODATA_DATA.XTOMOML2NYPIT"); + m_d[i].XTOMOML2NZPIT = (*it)->getFloat("XTOMODATA_DATA.XTOMOML2NZPIT"); + m_d[i].XTOMOML2PYTUB = (*it)->getFloat("XTOMODATA_DATA.XTOMOML2PYTUB"); + m_d[i].XTOMOML2PZTUB = (*it)->getFloat("XTOMODATA_DATA.XTOMOML2PZTUB"); + m_d[i].XTOMOML2PDELA = (*it)->getFloat("XTOMODATA_DATA.XTOMOML2PDELA"); + m_d[i].XTOMOML2PYPIT = (*it)->getFloat("XTOMODATA_DATA.XTOMOML2PYPIT"); + m_d[i].XTOMOML2PZPIT = (*it)->getFloat("XTOMODATA_DATA.XTOMOML2PZPIT"); + } +} + DblQ00Xtomo::~DblQ00Xtomo() { if (m_nObj > 0 && m_d) delete [] m_d; diff --git a/MuonSpectrometer/MuonGeoModel/CMakeLists.txt b/MuonSpectrometer/MuonGeoModel/CMakeLists.txt index 4839ed8800f..240ff7dc590 100644 --- a/MuonSpectrometer/MuonGeoModel/CMakeLists.txt +++ b/MuonSpectrometer/MuonGeoModel/CMakeLists.txt @@ -16,6 +16,7 @@ atlas_depends_on_subdirs( PUBLIC MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondInterface MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry MuonSpectrometer/MuonGMdbObjects + Amdcsimrec/AmdcDb PRIVATE Database/AthenaPOOL/AthenaPoolUtilities Database/RDBAccessSvc @@ -36,13 +37,13 @@ atlas_add_library( MuonGeoModelLib src/*.cxx PUBLIC_HEADERS MuonGeoModel PRIVATE_INCLUDE_DIRS ${Boost_INCLUDE_DIRS} ${CORAL_INCLUDE_DIRS} - LINK_LIBRARIES ${GEOMODELCORE_LIBRARIES} AthenaKernel GeoModelUtilities GaudiKernel MuonCondInterface MuonReadoutGeometry MuonGMdbObjects StoreGateLib SGtests MuonIdHelpersLib + LINK_LIBRARIES ${GEOMODELCORE_LIBRARIES} AthenaKernel GeoModelUtilities GaudiKernel MuonCondInterface MuonReadoutGeometry MuonGMdbObjects StoreGateLib SGtests MuonIdHelpersLib AmdcDbLib PRIVATE_LINK_LIBRARIES ${Boost_LIBRARIES} ${CORAL_LIBRARIES} AthenaPoolUtilities AGDDKernel IdDictDetDescr MuonAGDDDescription MuonDetDescrUtils ) atlas_add_component( MuonGeoModel src/components/*.cxx INCLUDE_DIRS ${Boost_INCLUDE_DIRS} ${CORAL_INCLUDE_DIRS} - LINK_LIBRARIES ${Boost_LIBRARIES} ${CORAL_LIBRARIES} ${GEOMODELCORE_LIBRARIES} AthenaKernel StoreGateLib SGtests GeoModelUtilities GaudiKernel MuonCondInterface MuonReadoutGeometry MuonGMdbObjects AthenaPoolUtilities AGDDKernel IdDictDetDescr MuonAGDDDescription MuonDetDescrUtils MuonIdHelpersLib MuonGeoModelLib ) + LINK_LIBRARIES ${Boost_LIBRARIES} ${CORAL_LIBRARIES} ${GEOMODELCORE_LIBRARIES} AthenaKernel StoreGateLib SGtests GeoModelUtilities GaudiKernel MuonCondInterface MuonReadoutGeometry MuonGMdbObjects AthenaPoolUtilities AGDDKernel IdDictDetDescr MuonAGDDDescription MuonDetDescrUtils MuonIdHelpersLib MuonGeoModelLib AmdcDbLib ) # Install files from the package: atlas_install_joboptions( share/*.py ) diff --git a/MuonSpectrometer/MuonGeoModel/MuonGeoModel/MuonDetectorFactory001.h b/MuonSpectrometer/MuonGeoModel/MuonGeoModel/MuonDetectorFactory001.h index 0fddbc2cf6a..42c9d516944 100755 --- a/MuonSpectrometer/MuonGeoModel/MuonGeoModel/MuonDetectorFactory001.h +++ b/MuonSpectrometer/MuonGeoModel/MuonGeoModel/MuonDetectorFactory001.h @@ -42,6 +42,7 @@ public: inline void setDBkey(std::string v); inline void setDBnode(std::string v); + inline void setAmdcDb(bool value); inline void setLayout(std::string ); inline void setCutoutsFlag(int ); inline void setCutoutsBogFlag(int ); @@ -75,6 +76,7 @@ private: std::string m_DBkey; std::string m_DBnode; + bool m_isAmdcDb; std::string m_layout; int m_includeCutouts; int m_includeCutoutsBog; @@ -117,6 +119,7 @@ void MuonDetectorFactory001::setDBMuonVersion(std::string v) {m_DBMuonVersion = void MuonDetectorFactory001::setDBkey(std::string v) {m_DBkey = v;} void MuonDetectorFactory001::setDBnode(std::string v) {m_DBnode = v;} +void MuonDetectorFactory001::setAmdcDb(bool value) {m_isAmdcDb = value;} void MuonDetectorFactory001::setLayout(std::string str) {m_layout = str;} void MuonDetectorFactory001::setCutoutsFlag(int flag) {m_includeCutouts = flag;} void MuonDetectorFactory001::setCutoutsBogFlag(int flag) {m_includeCutoutsBog = flag;} diff --git a/MuonSpectrometer/MuonGeoModel/MuonGeoModel/MuonDetectorTool.h b/MuonSpectrometer/MuonGeoModel/MuonGeoModel/MuonDetectorTool.h index add78c6b2ff..9e7b4eec6bd 100755 --- a/MuonSpectrometer/MuonGeoModel/MuonGeoModel/MuonDetectorTool.h +++ b/MuonSpectrometer/MuonGeoModel/MuonGeoModel/MuonDetectorTool.h @@ -39,7 +39,7 @@ private: std::string m_layout; int m_accessCondDb; int m_asciiCondData; - int m_nova; + Gaudi::Property m_amdcDb { this, "BuildFromAmdcDb", 0, "Build the geometry from AMDB file (expert only!)" }; int m_includeCutouts; int m_includeCutoutsBog; int m_includeCtbBis; diff --git a/MuonSpectrometer/MuonGeoModel/share/MuonGeoModel_MinimalSetup.py b/MuonSpectrometer/MuonGeoModel/share/MuonGeoModel_MinimalSetup.py index fe6438c95a8..d36058e1789 100644 --- a/MuonSpectrometer/MuonGeoModel/share/MuonGeoModel_MinimalSetup.py +++ b/MuonSpectrometer/MuonGeoModel/share/MuonGeoModel_MinimalSetup.py @@ -1,11 +1,11 @@ +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration + from AtlasGeoModel import GeoModelInit from GeoModelSvc.GeoModelSvcConf import GeoModelSvc GeoModelSvc = GeoModelSvc() from MuonGeoModel.MuonGeoModelConf import MuonDetectorTool GeoModelSvc.DetectorTools += [ MuonDetectorTool() ] -GeoModelSvc.DetectorTools[ "MuonDetectorTool" ].BuildFromNova = 0 -# GeoModelSvc.DetectorTools[ "MuonDetectorTool" ].TheMuonAlignmentTool = "" GeoModelSvc.DetectorTools[ "MuonDetectorTool" ].UseConditionDb = 0 GeoModelSvc.DetectorTools[ "MuonDetectorTool" ].UseAsciiConditionData = 0 GeoModelSvc.SupportedGeometry=21 diff --git a/MuonSpectrometer/MuonGeoModel/src/MuonDetectorFactory001.cxx b/MuonSpectrometer/MuonGeoModel/src/MuonDetectorFactory001.cxx index 0f500c9f411..12b0f35fea8 100755 --- a/MuonSpectrometer/MuonGeoModel/src/MuonDetectorFactory001.cxx +++ b/MuonSpectrometer/MuonGeoModel/src/MuonDetectorFactory001.cxx @@ -261,24 +261,18 @@ namespace MuonGM { log << " *** Start building the Muon Geometry Tree **********************" << endmsg; - DBReader* dbr = NULL; std::string OracleTag = m_DBkey; std::string OracleNode = m_DBnode; - // Production Rome Final - // OracleTag = "ATLAS-Rome-Final-00"; - // dbr = new RDBReaderAtlas(m_pDetStore, m_pRDBAccess, OracleTag, OracleNode); - if (log.level()<=MSG::DEBUG) log << MSG::DEBUG << "calling RDBReaderAtlas with m_altAsciiDBMap" << endmsg; - dbr = new RDBReaderAtlas( + RDBReaderAtlas* dbr = new RDBReaderAtlas( m_pDetStore, m_pRDBAccess, OracleTag, OracleNode, m_dumpAlines, m_useCscIntAlinesFromGM, m_dumpCscIntAlines, &m_altAsciiDBMap ); - RDBReaderAtlas* thisDbr = (RDBReaderAtlas*)dbr; - thisDbr->setControlCscIntAlines(m_controlCscIntAlines); + dbr->setControlCscIntAlines(m_controlCscIntAlines); // set here the flag deciding whether to include cutouts: // m_includeCutouts = 1 => include cutouts @@ -384,78 +378,113 @@ namespace MuonGM { GeoLogVol* l4; GeoPcon* c4 = new GeoPcon( 0, 360*Gaudi::Units::deg ); - //--- --- --- CREATE ENVELOPE --- --- --- - // First try to get data from the GeomDB - IRDBRecordset_ptr muonSysRec = m_pRDBAccess->getRecordsetPtr("MuonSystem",OracleTag,OracleNode); - - // -- Next two lines allow to use MuonSystem-00 by default instead of hardwired numbers - // even for geometry tags where MuonSystem was not collected - if(muonSysRec->size()==0) { - muonSysRec = m_pRDBAccess->getRecordsetPtr("MuonSystem","MuonSystem-00"); - log << MSG::INFO - << "MuonSystem description from default node in GeomDB, i.e. MuonSystem-00" - << endmsg; + if(m_isAmdcDb) { + log<< MSG::INFO <<" Using hardcoded envelope dimesions from MuonSystem-11 table" <addPlane(-26046. , 1050. , 1500. ); + c4->addPlane(-23001. , 1050. , 1500. ); + c4->addPlane(-23001. , 1050. , 2750. ); + c4->addPlane(-22030. , 1050. , 2750. ); + c4->addPlane(-22030. , 436. , 12650. ); + c4->addPlane(-18650. , 436. , 12650. ); + c4->addPlane(-18650. , 279. , 13400. ); + c4->addPlane(-12900. , 279. , 13400. ); + c4->addPlane(-12900. , 70. , 13910. ); + c4->addPlane( -6783. , 70. , 13910. ); + c4->addPlane( -6783. , 420. , 13910. ); + c4->addPlane( -6736. , 420. , 13910. ); + c4->addPlane( -6736. , 3800. , 13910. ); + c4->addPlane( -6550. , 3800. , 13910. ); + c4->addPlane( -6550. , 4255. , 13000. ); + c4->addPlane( 6550. , 4255. , 13000. ); + c4->addPlane( 6550. , 3800. , 13910. ); + c4->addPlane( 6736. , 3800. , 13910. ); + c4->addPlane( 6736. , 420. , 13910. ); + c4->addPlane( 6783. , 420. , 13910. ); + c4->addPlane( 6783. , 70. , 13910. ); + c4->addPlane( 12900. , 70. , 13910. ); + c4->addPlane( 12900. , 279. , 13400. ); + c4->addPlane( 18650. , 279. , 13400. ); + c4->addPlane( 18650. , 436. , 12650. ); + c4->addPlane( 22030. , 436. , 12650. ); + c4->addPlane( 22030. , 1050. , 2750. ); + c4->addPlane( 23001. , 1050. , 2750. ); + c4->addPlane( 23001. , 1050. , 1500. ); + c4->addPlane( 26046. , 1050. , 1500. ); } else { - log << MSG::INFO - << "MuonSystem description from OracleTag=<" << OracleTag << "> and node=<" << OracleNode << ">" - << endmsg; - } - // --- Envelope from DB .... - if(muonSysRec->size()!=0) { - // Data retrieved - muonsysIndMap indmap; - muonsysIndMap::const_iterator iter; - const IRDBRecord* currentRecord; - - // First fill the contents of muonsysIndMap - for (unsigned int ind=0; indsize(); ind++) { - int key = (*muonSysRec)[ind]->getInt("PLANE_ID"); - indmap[key] = ind; + //--- --- --- CREATE ENVELOPE --- --- --- + // First try to get data from the GeomDB + IRDBRecordset_ptr muonSysRec = m_pRDBAccess->getRecordsetPtr("MuonSystem",OracleTag,OracleNode); + + // -- Next two lines allow to use MuonSystem-00 by default instead of hardwired numbers + // even for geometry tags where MuonSystem was not collected + if(muonSysRec->size()==0) { + muonSysRec = m_pRDBAccess->getRecordsetPtr("MuonSystem","MuonSystem-00"); + log << MSG::INFO + << "MuonSystem description from default node in GeomDB, i.e. MuonSystem-00" + << endmsg; + } else { + log << MSG::INFO + << "MuonSystem description from OracleTag=<" << OracleTag << "> and node=<" << OracleNode << ">" + << endmsg; } - // Create the polycone - for(unsigned int ind=0; indaddPlane(currentRecord->getDouble("ZPLANE"), - currentRecord->getDouble("RMIN"), - currentRecord->getDouble("RMAX")); + // --- Envelope from DB .... + if(muonSysRec->size()!=0) { + // Data retrieved + muonsysIndMap indmap; + muonsysIndMap::const_iterator iter; + const IRDBRecord* currentRecord; + + // First fill the contents of muonsysIndMap + for (unsigned int ind=0; indsize(); ind++) { + int key = (*muonSysRec)[ind]->getInt("PLANE_ID"); + indmap[key] = ind; } - } - } else {// ... end if Envelope from DB --- - // Muon System node is not present, go for handcoded version - log << MSG::INFO - << "MuonSystem description not available in GeomDB - using hard-wired description" - << endmsg; - - double ir = m_muon->barrelInnerRadius; - double pir = m_muon->innerRadius; - double orad = m_muon->outerRadius; - double l = m_muon->length; - double eff = m_muon->endcapFrontFace; - - double extraR = m_muon->extraR; - double extraZ = m_muon->extraZ; - - c4->addPlane( -l, pir, extraR); - c4->addPlane(-extraZ, pir, extraR); - c4->addPlane(-extraZ, pir, orad); - - c4->addPlane(-eff, pir, orad); - c4->addPlane(-eff, ir, orad); - c4->addPlane(+eff, ir, orad); - c4->addPlane(+eff, pir, orad); - - c4->addPlane(extraZ, pir, orad); - c4->addPlane(extraZ, pir, extraR); - c4->addPlane( l, pir, extraR); - } // ... end if Envelope from DB --- + // Create the polycone + for(unsigned int ind=0; indaddPlane(currentRecord->getDouble("ZPLANE"), + currentRecord->getDouble("RMIN"), + currentRecord->getDouble("RMAX")); + } + } + } else {// ... end if Envelope from DB --- + // Muon System node is not present, go for handcoded version + log << MSG::INFO + << "MuonSystem description not available in GeomDB - using hard-wired description" + << endmsg; + + double ir = m_muon->barrelInnerRadius; + double pir = m_muon->innerRadius; + double orad = m_muon->outerRadius; + double l = m_muon->length; + double eff = m_muon->endcapFrontFace; + + double extraR = m_muon->extraR; + double extraZ = m_muon->extraZ; + + + c4->addPlane( -l, pir, extraR); + c4->addPlane(-extraZ, pir, extraR); + c4->addPlane(-extraZ, pir, orad); + + c4->addPlane(-eff, pir, orad); + c4->addPlane(-eff, ir, orad); + c4->addPlane(+eff, ir, orad); + c4->addPlane(+eff, pir, orad); + + c4->addPlane(extraZ, pir, orad); + c4->addPlane(extraZ, pir, extraR); + c4->addPlane( l, pir, extraR); + } // ... end if Envelope from DB --- + } // end if not m_isAmdcDb l4 = new GeoLogVol( "MuonSys", c4, m4 ); diff --git a/MuonSpectrometer/MuonGeoModel/src/MuonDetectorTool.cxx b/MuonSpectrometer/MuonGeoModel/src/MuonDetectorTool.cxx index 5e5cfb48124..1e410e8a7ff 100755 --- a/MuonSpectrometer/MuonGeoModel/src/MuonDetectorTool.cxx +++ b/MuonSpectrometer/MuonGeoModel/src/MuonDetectorTool.cxx @@ -2,27 +2,25 @@ Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ -#include "MuonGeoModel/MuonDetectorTool.h" -// #include "MuonGeoModel/MuonDetectorFactory001.h" +#include "MuonGeoModel/MuonDetectorTool.h" + #include "MuonGeoModel/StationSelector.h" #include "MuonReadoutGeometry/MuonDetectorManager.h" #include "MuonReadoutGeometry/TgcReadoutElement.h" #include "MuonDetDescrUtils/MuonSectorMapping.h" - #include "GeoModelInterfaces/IGeoModelSvc.h" #include "GeoModelUtilities/GeoModelExperiment.h" #include "GeoModelInterfaces/StoredMaterialManager.h" #include "GeoModelKernel/GeoPhysVol.h" #include "GeoModelKernel/GeoPerfUtils.h" - #include "RDBAccessSvc/IRDBAccessSvc.h" #include "RDBAccessSvc/IRDBRecord.h" #include "RDBAccessSvc/IRDBRecordset.h" - +#include "AmdcDb/AmdcDb.h" #include "AthenaPoolUtilities/CondAttrListCollection.h" +#include "AthenaKernel/ClassID_traits.h" #include -#include "AthenaKernel/ClassID_traits.h" using namespace MuonGM; @@ -34,7 +32,6 @@ MuonDetectorTool::MuonDetectorTool( const std::string& type, const std::string& m_layout("R.08"), m_accessCondDb(1), m_asciiCondData(0), - m_nova(0), m_includeCutouts(0), m_includeCutoutsBog(0), m_includeCtbBis(0), @@ -63,7 +60,6 @@ MuonDetectorTool::MuonDetectorTool( const std::string& type, const std::string& declareProperty("LayoutName" , m_layout ); declareProperty("UseConditionDb" , m_accessCondDb); declareProperty("UseAsciiConditionData" , m_asciiCondData); - declareProperty("BuildFromNova",m_nova); declareProperty("IncludeCutouts" , m_includeCutouts); declareProperty("IncludeCutoutsBog" , m_includeCutoutsBog); declareProperty("IncludeCtbBis" , m_includeCtbBis); @@ -320,22 +316,31 @@ MuonDetectorTool::createFactory(MuonDetectorFactory001& theFactory) const if ( 0 == m_detector ) { IRDBAccessSvc* access = 0; - ATH_CHECK(service("RDBAccessSvc",access)); - - // MuonDetectorFactory001 theFactory(detStore().operator->()); - + if(m_amdcDb) ATH_CHECK(service("AmdcDb",access)); + else ATH_CHECK(service("RDBAccessSvc",access)); + + bool isAmdcDb = false; + if( dynamic_cast(access) && m_amdcDb) { + ATH_MSG_INFO("AmdcDb is used instead of RDBAccessSvc"); + AmdcDb* p_access = dynamic_cast(access); + isAmdcDb = true; + if (p_access->InitializedSvc()) { + ATH_MSG_INFO("AmdcDb->InitializedSvc() is true") ; + }else{ + ATH_MSG_INFO("AmdcDb->InitializedSvc() is false"); + if(p_access->initialize()) ATH_MSG_INFO("Now it's initialized. Go ahead and use it!"); + ATH_MSG_INFO("\t\t BUT PAY ATTENTION THE HARD WIRED ENVELOPE IS USED (see MuonDetectorFactory001.cxx)!!"); + } + } + theFactory.setDBAtlasVersion(AtlasVersion); theFactory.setDBMuonVersion(MuonVersion); theFactory.setDBkey( detectorKey ); theFactory.setDBnode(detectorNode); theFactory.setABLinesAsciiSideA(m_NSWABLinesAsciiSideA); theFactory.setABLinesAsciiSideC(m_NSWABLinesAsciiSideC); - - // theFactory.setLayout(m_layout); + theFactory.setAmdcDb(isAmdcDb); theFactory.setLayout(tempLayout); - //theFactory.setIncludeInertMats(m_includeInertMaterials); - //theFactory.setIdhFromCnv(m_idhfromconverters); - //theFactory.setMinimalGeoFlag(m_minimalgeo); theFactory.setCutoutsFlag(m_includeCutouts); theFactory.setCutoutsBogFlag(m_includeCutoutsBog); theFactory.setCtbBisFlag(m_includeCtbBis); diff --git a/MuonSpectrometer/MuonGeoModel/src/RDBReaderAtlas.cxx b/MuonSpectrometer/MuonGeoModel/src/RDBReaderAtlas.cxx index 2945716c04f..0bc1b2a361e 100755 --- a/MuonSpectrometer/MuonGeoModel/src/RDBReaderAtlas.cxx +++ b/MuonSpectrometer/MuonGeoModel/src/RDBReaderAtlas.cxx @@ -2,8 +2,8 @@ Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ - #include "MuonGeoModel/RDBReaderAtlas.h" + #include "MuonReadoutGeometry/GlobalUtilities.h" #include "MuonGeoModel/StationSelector.h" #include "MuonGeoModel/MdtComponent.h" @@ -14,7 +14,7 @@ #include "RDBAccessSvc/IRDBQuery.h" #include "MuonReadoutGeometry/TgcReadoutParams.h" #include "GaudiKernel/SystemOfUnits.h" - +#include "AmdcDb/AmdcDb.h" #include "MuonGeoModel/TGC_Technology.h" namespace MuonGM { @@ -26,96 +26,212 @@ RDBReaderAtlas::RDBReaderAtlas(StoreGateSvc *pDetStore, IRDBAccessSvc* pRDBAcces bool dumpCscInternalAlinesFromOracle, const std::map* asciiFileDBMap): DBReader(pDetStore), + m_controlCscIntAlines(0), + m_dhdbam(nullptr), + m_dbam(nullptr), + m_dhatyp(nullptr), + m_atyp(nullptr), + m_dhasmp(nullptr), + m_asmp(nullptr), + m_dhalmn(nullptr), + m_almn(nullptr), + m_dhaptp(nullptr), + m_aptp(nullptr), + m_dhwrpc(nullptr), + m_wrpc(nullptr), + m_dhwtgc(nullptr), + m_wtgc(nullptr), + m_dhacut(nullptr), + m_acut(nullptr), + m_dhalin(nullptr), + m_alin(nullptr), + m_dhwmdt(nullptr), + m_wmdt(nullptr), + m_dhwcsc(nullptr), + m_wcsc(nullptr), + m_dhwrpcall(nullptr), + m_wrpcall(nullptr), + m_dhwtgcall(nullptr), + m_wtgcall(nullptr), + m_dhwded(nullptr), + m_wded(nullptr), + m_dhwsup(nullptr), + m_wsup(nullptr), + m_dhwspa(nullptr), + m_wspa(nullptr), + m_dhwchv(nullptr), + m_wchv(nullptr), + m_dhwcro(nullptr), + m_wcro(nullptr), + m_dhwcmi(nullptr), + m_wcmi(nullptr), + m_dhwlbi(nullptr), + m_wlbi(nullptr), + m_dhaszt(nullptr), + m_aszt(nullptr), + m_dhiacsc(nullptr), + m_iacsc(nullptr), + m_dhxtomo(nullptr), + m_xtomo(nullptr), m_geoTag(geoTag), m_geoNode(geoNode), m_pRDBAccess(pRDBAccess), m_useICSCAlines(useCscInternalAlinesFromOracle) { - - m_controlCscIntAlines = 0; m_msgSvc = Athena::getMessageSvc(); MsgStream log(m_msgSvc, "MuGM:RDBReadAtlas"); m_SCdbaccess = StatusCode::FAILURE; - log << MSG::INFO + AmdcDb* theAmdcDb = dynamic_cast(m_pRDBAccess); + if(theAmdcDb) { + log< node <" << geoNode << ">" << endmsg; + } // here putting RDB data in private "objects" form std::unique_ptr dbdata; - dbdata = m_pRDBAccess->getQuery("ATYP",geoTag,geoNode); - m_dhatyp = new DblQ00Atyp(std::move(dbdata)); - + if(theAmdcDb) { + m_dhatyp = new DblQ00Atyp(theAmdcDb); + } else { + dbdata = m_pRDBAccess->getQuery("ATYP",geoTag,geoNode); + m_dhatyp = new DblQ00Atyp(std::move(dbdata)); + } m_atyp = m_dhatyp->data(); - dbdata = m_pRDBAccess->getQuery("ASMP",geoTag,geoNode); - m_dhasmp = new DblQ00Asmp(std::move(dbdata)); + if(theAmdcDb) { + m_dhasmp = new DblQ00Asmp(theAmdcDb); + } else { + dbdata = m_pRDBAccess->getQuery("ASMP",geoTag,geoNode); + m_dhasmp = new DblQ00Asmp(std::move(dbdata)); + } m_asmp = m_dhasmp->data(); - dbdata = m_pRDBAccess->getQuery("ALMN",geoTag,geoNode); - m_dhalmn = new DblQ00Almn(std::move(dbdata)); + if(theAmdcDb) { + m_dhalmn = new DblQ00Almn(theAmdcDb); + } else { + dbdata = m_pRDBAccess->getQuery("ALMN",geoTag,geoNode); + m_dhalmn = new DblQ00Almn(std::move(dbdata)); + } m_almn = m_dhalmn->data(); - dbdata = m_pRDBAccess->getQuery("APTP",geoTag,geoNode); - m_dhaptp = new DblQ00Aptp(std::move(dbdata)); + if(theAmdcDb) { + m_dhaptp = new DblQ00Aptp(theAmdcDb); + } else { + dbdata = m_pRDBAccess->getQuery("APTP",geoTag,geoNode); + m_dhaptp = new DblQ00Aptp(std::move(dbdata)); + } m_aptp = m_dhaptp->data(); - dbdata = m_pRDBAccess->getQuery("ACUT",geoTag,geoNode); - m_dhacut = new DblQ00Acut(std::move(dbdata)); + if(theAmdcDb) { + m_dhacut = new DblQ00Acut(theAmdcDb); + } else { + dbdata = m_pRDBAccess->getQuery("ACUT",geoTag,geoNode); + m_dhacut = new DblQ00Acut(std::move(dbdata)); + } m_acut = m_dhacut->data(); - dbdata = m_pRDBAccess->getQuery("ALIN",geoTag,geoNode); - m_dhalin = new DblQ00Alin(std::move(dbdata)); + if(theAmdcDb) { + m_dhalin = new DblQ00Alin(theAmdcDb); + } else { + dbdata = m_pRDBAccess->getQuery("ALIN",geoTag,geoNode); + m_dhalin = new DblQ00Alin(std::move(dbdata)); + } m_alin = m_dhalin->data(); - dbdata = m_pRDBAccess->getQuery("DBAM",geoTag,geoNode); - m_dhdbam = new DblQ00Dbam(std::move(dbdata)); + if(theAmdcDb) { + m_dhdbam = new DblQ00Dbam(theAmdcDb); + } else { + dbdata = m_pRDBAccess->getQuery("DBAM",geoTag,geoNode); + m_dhdbam = new DblQ00Dbam(std::move(dbdata)); + } m_dbam = m_dhdbam->data(); - dbdata = m_pRDBAccess->getQuery("AWLN",geoTag,geoNode); - m_dhwrpc = new DblQ00Awln(std::move(dbdata)); + if(theAmdcDb) { + m_dhwrpc = new DblQ00Awln(theAmdcDb); + } else { + dbdata = m_pRDBAccess->getQuery("AWLN",geoTag,geoNode); + m_dhwrpc = new DblQ00Awln(std::move(dbdata)); + } m_wrpc= m_dhwrpc->data(); - dbdata = m_pRDBAccess->getQuery("ATLN",geoTag,geoNode); - m_dhwtgc = new DblQ00Atln(std::move(dbdata)); + if(theAmdcDb) { + m_dhwtgc = new DblQ00Atln(theAmdcDb); + } else { + dbdata = m_pRDBAccess->getQuery("ATLN",geoTag,geoNode); + m_dhwtgc = new DblQ00Atln(std::move(dbdata)); + } m_wtgc= m_dhwtgc->data(); - dbdata = m_pRDBAccess->getQuery("WMDT",geoTag,geoNode); - m_dhwmdt = new DblQ00Wmdt(std::move(dbdata)); + if(theAmdcDb) { + m_dhwmdt = new DblQ00Wmdt(theAmdcDb); + } else { + dbdata = m_pRDBAccess->getQuery("WMDT",geoTag,geoNode); + m_dhwmdt = new DblQ00Wmdt(std::move(dbdata)); + } m_wmdt= m_dhwmdt->data(); - dbdata = m_pRDBAccess->getQuery("WCSC",geoTag,geoNode); - m_dhwcsc = new DblQ00Wcsc(std::move(dbdata)); + if(theAmdcDb) { + m_dhwcsc = new DblQ00Wcsc(theAmdcDb); + } else { + dbdata = m_pRDBAccess->getQuery("WCSC",geoTag,geoNode); + m_dhwcsc = new DblQ00Wcsc(std::move(dbdata)); + } m_wcsc= m_dhwcsc->data(); - dbdata = m_pRDBAccess->getQuery("WRPC",geoTag,geoNode); - m_dhwrpcall = new DblQ00Wrpc(std::move(dbdata)); + if(theAmdcDb) { + m_dhwrpcall = new DblQ00Wrpc(theAmdcDb); + } else { + dbdata = m_pRDBAccess->getQuery("WRPC",geoTag,geoNode); + m_dhwrpcall = new DblQ00Wrpc(std::move(dbdata)); + } m_wrpcall= m_dhwrpcall->data(); - dbdata = m_pRDBAccess->getQuery("WTGC",geoTag,geoNode); - m_dhwtgcall = new DblQ00Wtgc(std::move(dbdata)); + if(theAmdcDb) { + m_dhwtgcall = new DblQ00Wtgc(theAmdcDb); + } else { + dbdata = m_pRDBAccess->getQuery("WTGC",geoTag,geoNode); + m_dhwtgcall = new DblQ00Wtgc(std::move(dbdata)); + } m_wtgcall= m_dhwtgcall->data(); - dbdata = m_pRDBAccess->getQuery("WSPA",geoTag,geoNode); - m_dhwspa = new DblQ00Wspa(std::move(dbdata)); + if(theAmdcDb) { + m_dhwspa = new DblQ00Wspa(theAmdcDb); + } else { + dbdata = m_pRDBAccess->getQuery("WSPA",geoTag,geoNode); + m_dhwspa = new DblQ00Wspa(std::move(dbdata)); + } m_wspa= m_dhwspa->data(); - dbdata = m_pRDBAccess->getQuery("WDED",geoTag,geoNode); - m_dhwded = new DblQ00Wded(std::move(dbdata)); + if(theAmdcDb) { + m_dhwded = new DblQ00Wded(theAmdcDb); + } else { + dbdata = m_pRDBAccess->getQuery("WDED",geoTag,geoNode); + m_dhwded = new DblQ00Wded(std::move(dbdata)); + } m_wded= m_dhwded->data(); - dbdata = m_pRDBAccess->getQuery("WSUP",geoTag,geoNode); - m_dhwsup = new DblQ00Wsup(std::move(dbdata)); + if(theAmdcDb) { + m_dhwsup = new DblQ00Wsup(theAmdcDb); + } else { + dbdata = m_pRDBAccess->getQuery("WSUP",geoTag,geoNode); + m_dhwsup = new DblQ00Wsup(std::move(dbdata)); + } m_wsup= m_dhwsup->data(); + // Mdt AsBuilt parameters - dbdata = m_pRDBAccess->getQuery("XtomoData",geoTag,geoNode); - log << MSG::INFO << "After getQuery XtomoData" << endmsg; - m_dhxtomo = new DblQ00Xtomo(std::move(dbdata)); - log << MSG::INFO << "After new DblQ00Xtomo" << endmsg; - m_xtomo = m_dhxtomo->data(); - log << MSG::INFO << "After m_dhxtomo.data()" << endmsg; + if(theAmdcDb) { + log << MSG::INFO << "skipping XtomoData" << endmsg; + } else { + dbdata = m_pRDBAccess->getQuery("XtomoData",geoTag,geoNode); + log << MSG::INFO << "After getQuery XtomoData" << endmsg; + m_dhxtomo = new DblQ00Xtomo(std::move(dbdata)); + log << MSG::INFO << "After new DblQ00Xtomo" << endmsg; + } + if(m_dhxtomo) m_xtomo = m_dhxtomo->data(); // ASZT - m_dhaszt = 0; if (asciiFileDBMap!=0 && asciiFileDBMap->find("ASZT") != asciiFileDBMap->end()) { @@ -138,28 +254,31 @@ RDBReaderAtlas::RDBReaderAtlas(StoreGateSvc *pDetStore, IRDBAccessSvc* pRDBAcces if (m_dhaszt==0 || m_dhaszt->size()==0) { log << MSG::INFO << "No Ascii aszt input found: looking for A-lines in ORACLE" << endmsg; - dbdata = m_pRDBAccess->getQuery("ASZT",geoTag,geoNode); - if (!dbdata) { - m_dhaszt = new DblQ00Aszt(); - log << MSG::INFO << "No ASZT table in Oracle" << endmsg; + if(theAmdcDb){ + m_dhaszt = new DblQ00Aszt(theAmdcDb); } else { - log << MSG::INFO << "ASZT table found in Oracle" << endmsg; - m_dhaszt = new DblQ00Aszt(std::move(dbdata)); - log << MSG::INFO << "ASZT size is " << m_dhaszt->size() << endmsg; + dbdata = m_pRDBAccess->getQuery("ASZT",geoTag,geoNode); + if (!dbdata) { + m_dhaszt = new DblQ00Aszt(); + log << MSG::INFO << "No ASZT table in Oracle" << endmsg; + } else { + log << MSG::INFO << "ASZT table found in Oracle" << endmsg; + m_dhaszt = new DblQ00Aszt(std::move(dbdata)); + log << MSG::INFO << "ASZT size is " << m_dhaszt->size() << endmsg; + } } } else { log << MSG::INFO << "ASZT table in Oracle, if any, will not be read" << endmsg; } - m_aszt= m_dhaszt->data(); + if(m_dhaszt) m_aszt = m_dhaszt->data(); // - if (dumpAlinesFromOracle) { + if (dumpAlinesFromOracle && m_dhaszt) { log << MSG::DEBUG << "writing ASZT values to file" << endmsg; m_dhaszt->WriteAsztToAsciiFile("aszt_fromAscii_or_Oracle.txt"); } // Internal CSC Alignment parameters - m_dhiacsc = 0; if (asciiFileDBMap!=0 && asciiFileDBMap->find("IACSC") != asciiFileDBMap->end()) { @@ -181,52 +300,60 @@ RDBReaderAtlas::RDBReaderAtlas(StoreGateSvc *pDetStore, IRDBAccessSvc* pRDBAcces log << MSG::INFO << "No Ascii iacsc input found: looking for A-lines in ORACLE" << endmsg; dbdata = m_pRDBAccess->getQuery("ISZT",geoTag,geoNode); - if (!dbdata) { - m_dhiacsc = new DblQ00IAcsc(); - log << MSG::INFO << "No ISZT table in Oracle" << endmsg; + if(theAmdcDb){ + log << MSG::INFO << "skipping ISZT" << endmsg; + m_dhiacsc = nullptr; } else { - log << MSG::INFO << "ISZT table found in Oracle" << endmsg; - m_dhiacsc = new DblQ00IAcsc(std::move(dbdata)); + if (!dbdata) { + m_dhiacsc = new DblQ00IAcsc(); + log << MSG::INFO << "No ISZT table in Oracle" << endmsg; + } else { + log << MSG::INFO << "ISZT table found in Oracle" << endmsg; + m_dhiacsc = new DblQ00IAcsc(std::move(dbdata)); + } } - } else { log << MSG::INFO << "ISZT table in Oracle, if any, will not be read" << endmsg; } - m_iacsc= m_dhiacsc->data(); + if(m_dhiacsc) m_iacsc = m_dhiacsc->data(); // - if (dumpCscInternalAlinesFromOracle) { + if (dumpCscInternalAlinesFromOracle && m_dhiacsc) { log << MSG::DEBUG << "writing ISZT values to file" << endmsg; m_dhiacsc->WriteIAcscToAsciiFile("IAcsc_fromAscii_or_Oracle.txt"); } - if (geoTag != "ATLAS-00") { + if(theAmdcDb) { + m_dhwchv = new DblQ00Wchv(theAmdcDb); + } else { dbdata = m_pRDBAccess->getQuery("WCHV",geoTag,geoNode); m_dhwchv = new DblQ00Wchv(std::move(dbdata)); + } + m_wchv= m_dhwchv->data(); - m_wchv= m_dhwchv->data(); + if(theAmdcDb) { + m_dhwcro = new DblQ00Wcro(theAmdcDb); + } else { dbdata = m_pRDBAccess->getQuery("WCRO",geoTag,geoNode); m_dhwcro = new DblQ00Wcro(std::move(dbdata)); + } + m_wcro= m_dhwcro->data(); - m_wcro= m_dhwcro->data(); + if(theAmdcDb) { + m_dhwcmi = new DblQ00Wcmi(theAmdcDb); + } else { dbdata = m_pRDBAccess->getQuery("WCMI",geoTag,geoNode); m_dhwcmi = new DblQ00Wcmi(std::move(dbdata)); + } + m_wcmi= m_dhwcmi->data(); - m_wcmi= m_dhwcmi->data(); + if(theAmdcDb) { + m_dhwlbi = new DblQ00Wlbi(theAmdcDb); + } else { dbdata = m_pRDBAccess->getQuery("WLBI",geoTag,geoNode); m_dhwlbi = new DblQ00Wlbi(std::move(dbdata)); - - m_wlbi= m_dhwlbi->data(); - } else { - m_dhwchv = NULL; - m_wchv = NULL; - m_dhwcro = NULL; - m_wcro = NULL; - m_dhwcmi = NULL; - m_wcmi = NULL; - m_dhwlbi = NULL; - m_wlbi = NULL; } + m_wlbi= m_dhwlbi->data(); // everything fetched m_SCdbaccess = StatusCode::SUCCESS; @@ -266,7 +393,7 @@ StatusCode RDBReaderAtlas::ProcessDB() } // Process Alignements - if (m_dhaszt->size() >0) { + if (m_dhaszt && m_dhaszt->size() >0) { MuonGM::ProcessAlignements(m_dhaszt, m_aszt); } @@ -274,12 +401,12 @@ StatusCode RDBReaderAtlas::ProcessDB() RDBReaderAtlas::ProcessTGCreadout(); // Process CSC Internal Alignements - if (m_dhiacsc->size() >0 && m_useICSCAlines) { + if (m_dhiacsc && m_dhiacsc->size() >0 && m_useICSCAlines) { ProcessCscInternalAlignments(); } // Proccess Mdt AsBuilt parameters - if (m_dhxtomo->size() > 0) { + if (m_dhxtomo && m_dhxtomo->size() > 0) { ProcessMdtAsBuiltParams(); } @@ -490,12 +617,17 @@ void RDBReaderAtlas::ProcessTGCreadout () { // // in case of layout Q and following // - // if (m_geoTag == "ATLAS-01") ggln = m_pRDBAccess->getRecordset("GGLN","GGLN-02"); - // else ggln = m_pRDBAccess->getRecordset("GGLN",m_geoTag,m_geoNode); + AmdcDb* theAmdcDb = dynamic_cast(m_pRDBAccess); IRDBRecordset_ptr ggln = m_pRDBAccess->getRecordsetPtr("GGLN",m_geoTag,m_geoNode); + if (theAmdcDb) ggln = theAmdcDb->getRecordsetPtr("GGLN",m_geoTag,m_geoNode); + + int version(0); + float wirespacing(0); + if(ggln->size()){ + version = (int) (*ggln)[0]->getInt("VERS"); + wirespacing = (*ggln)[0]->getFloat("WIRESP")*Gaudi::Units::mm; + } - int version = (int) (*ggln)[0]->getInt("VERS"); - float wirespacing = (*ggln)[0]->getFloat("WIRESP")*Gaudi::Units::mm; log << MSG::INFO << " ProcessTGCreadout - version " << version << " wirespacing " << wirespacing << endmsg; diff --git a/MuonSpectrometer/MuonGeoModelTest/test/MuonGeoModelTestMaps.py b/MuonSpectrometer/MuonGeoModelTest/test/MuonGeoModelTestMaps.py index 778c1f79e5f..eefaa27f36d 100644 --- a/MuonSpectrometer/MuonGeoModelTest/test/MuonGeoModelTestMaps.py +++ b/MuonSpectrometer/MuonGeoModelTest/test/MuonGeoModelTestMaps.py @@ -1,6 +1,5 @@ -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration -#---- include ( "DetDescrCnvSvc/DetStore_joboptions.py" ) theApp.setup( NO_EVSEL ) @@ -8,26 +7,13 @@ theApp.setup( NO_EVSEL ) #(0=NIL 1=VERBOSE, 2=DEBUG, 3=INFO, 4=WARNING, 5=ERROR, 6=FATAL ) MessageSvc.OutputLevel = 3 -#---- -#DetDescrVersion = "Rome-Final" include ( "AtlasGeoModel/SetGeometryVersion.py" ) theApp.Dlls += [ "GeoModelSvc" ] theApp.ExtSvc += [ "GeoModelSvc"] include( "AtlasGeoModel/MuonGeoModel.py" ) -#include( "NovaCnvSvc/NovaCnvSvc_jobOptions.py" ) -#include( "NovaConverters/NovaConverters_jobOptions.py" ) -#GeoModelSvc = Service("GeoModelSvc") -#GeoModelSvc.Detectors += [ "MuonDetectorTool" ] -## options -#GeoModelSvc.MuonDetectorTool.BuildFromNova = 1 -#NovaCnvSvc.Version = 1 - theApp.EvtSel = "EventSelector"; theApp.EvtMax = 0; -#EventSelector = Service ("EventSelector"); -#EventSelector.firstRun=1; -#EventSelector.lastRun=10000; theApp.DLLs += [ "MuonGeoModelTest"] diff --git a/Projects/AthSimulation/package_filters.txt b/Projects/AthSimulation/package_filters.txt index 20caeb65b6c..ae9ce6dae54 100644 --- a/Projects/AthSimulation/package_filters.txt +++ b/Projects/AthSimulation/package_filters.txt @@ -239,6 +239,10 @@ + MagneticField/MagFieldUtils + MagneticField/MagFieldConditions + MagneticField/MagFieldElements ++ MuonSpectrometer/Amdcsimrec/AmdcAth ++ MuonSpectrometer/Amdcsimrec/AmdcCore ++ MuonSpectrometer/Amdcsimrec/AmdcDb ++ MuonSpectrometer/Amdcsimrec/AmdcStand + MuonSpectrometer/MuonAlignment/MuonAlignmentData + MuonSpectrometer/MuonCnv/MuonIdCnv + MuonSpectrometer/MuonCnv/MuonSimEventAthenaPool -- GitLab From d182a2b224d598c4bc26b29bb906c61029128b98 Mon Sep 17 00:00:00 2001 From: scott snyder Date: Tue, 9 Jun 2020 16:10:15 +0200 Subject: [PATCH 32/38] AthenaServices: Thread-safety checking fix. Need to declare all overloads of AthDictLoaderSvc::load_type as not thread-safe, as they call one another. --- Control/AthenaServices/src/AthDictLoaderSvc.cxx | 4 ++-- Control/AthenaServices/src/AthDictLoaderSvc.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Control/AthenaServices/src/AthDictLoaderSvc.cxx b/Control/AthenaServices/src/AthDictLoaderSvc.cxx index 1140b37d2f2..be0751a16b8 100644 --- a/Control/AthenaServices/src/AthDictLoaderSvc.cxx +++ b/Control/AthenaServices/src/AthDictLoaderSvc.cxx @@ -164,7 +164,7 @@ AthDictLoaderSvc::load_type ATLAS_NOT_THREAD_SAFE (const std::string& type_name) * succeed *IF* the dictionary for that type has been generated. */ const RootType -AthDictLoaderSvc::load_type (const std::type_info& typeinfo) +AthDictLoaderSvc::load_type ATLAS_NOT_THREAD_SAFE (const std::type_info& typeinfo) { ATH_MSG_DEBUG ("loading [" << System::typeinfoName(typeinfo) << " (from typeinfo)]..."); @@ -175,7 +175,7 @@ AthDictLoaderSvc::load_type (const std::type_info& typeinfo) * by any necessary means. */ const RootType -AthDictLoaderSvc::load_type (CLID clid) +AthDictLoaderSvc::load_type ATLAS_NOT_THREAD_SAFE (CLID clid) { std::string name = ""; if (!m_clidSvc->getTypeNameOfID(clid, name).isSuccess()) { diff --git a/Control/AthenaServices/src/AthDictLoaderSvc.h b/Control/AthenaServices/src/AthDictLoaderSvc.h index 11f5d28c1a0..fb611289eec 100644 --- a/Control/AthenaServices/src/AthDictLoaderSvc.h +++ b/Control/AthenaServices/src/AthDictLoaderSvc.h @@ -98,13 +98,13 @@ class ATLAS_CHECK_THREAD_SAFETY AthDictLoaderSvc * succeed *IF* the dictionary for that type has been generated. */ virtual - const RootType load_type (const std::type_info& typeinfo); + const RootType load_type ATLAS_NOT_THREAD_SAFE (const std::type_info& typeinfo); /** @brief retrieve a @c Reflex::Type by name (auto)loading the dictionary * by any necessary means. */ virtual - const RootType load_type (CLID clid); + const RootType load_type ATLAS_NOT_THREAD_SAFE (CLID clid); /////////////////////////////////////////////////////////////////// // Private data: -- GitLab From a5f19f9846bd1f83988c86d9ec8dcd7967dfbce8 Mon Sep 17 00:00:00 2001 From: scott snyder Date: Tue, 9 Jun 2020 16:09:55 +0200 Subject: [PATCH 33/38] AthenaKernel: Fix for thread-safety checking. Need to declare all overloads of IDictLoaderSvc::load_type as not thread-safe, as they end up calling one another. --- Control/AthenaKernel/AthenaKernel/IDictLoaderSvc.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Control/AthenaKernel/AthenaKernel/IDictLoaderSvc.h b/Control/AthenaKernel/AthenaKernel/IDictLoaderSvc.h index 52d2e9f776e..b1a403c6ff4 100644 --- a/Control/AthenaKernel/AthenaKernel/IDictLoaderSvc.h +++ b/Control/AthenaKernel/AthenaKernel/IDictLoaderSvc.h @@ -81,13 +81,13 @@ class IDictLoaderSvc * succeed *IF* the dictionary for that type has been generated. */ virtual - const RootType load_type (const std::type_info& typeinfo) = 0; + const RootType load_type ATLAS_NOT_THREAD_SAFE (const std::type_info& typeinfo) = 0; /** @brief retrieve a @c RootType by name (auto)loading the dictionary * by any necessary means. */ virtual - const RootType load_type (CLID clid) = 0; + const RootType load_type ATLAS_NOT_THREAD_SAFE (CLID clid) = 0; }; -- GitLab From 42daefb5dded5c0142f92ce47af65b259d593e5a Mon Sep 17 00:00:00 2001 From: Christos Anastopoulos Date: Wed, 10 Jun 2020 09:48:46 +0000 Subject: [PATCH 34/38] Add/pass Event Context to the egamma extrapolation tools and then to the CaloExtension tool --- .../src/ConversionFinder.cxx | 16 +- .../src/EMGSFCaloExtensionBuilder.cxx | 7 +- .../egamma/egammaAlgs/src/EMVertexBuilder.cxx | 44 +-- .../egammaInterfaces/IEMConversionBuilder.h | 2 - .../egammaInterfaces/IEMExtrapolationTools.h | 44 +-- .../egammaTools/src/EMConversionBuilder.cxx | 75 ++-- .../egammaTools/src/EMConversionBuilder.h | 216 +++++++----- .../src/EMExtrapolationTools.cxx | 321 +++++++++++------- .../src/EMExtrapolationTools.h | 197 ++++++----- 9 files changed, 545 insertions(+), 377 deletions(-) diff --git a/InnerDetector/InDetRecAlgs/InDetConversionFinder/src/ConversionFinder.cxx b/InnerDetector/InDetRecAlgs/InDetConversionFinder/src/ConversionFinder.cxx index c4296366229..9eec3234d96 100755 --- a/InnerDetector/InDetRecAlgs/InDetConversionFinder/src/ConversionFinder.cxx +++ b/InnerDetector/InDetRecAlgs/InDetConversionFinder/src/ConversionFinder.cxx @@ -16,7 +16,7 @@ #include "InDetRecToolInterfaces/IVertexFinder.h" #include "TrkTrackSummary/TrackSummary.h" #include "GaudiKernel/MsgStream.h" - +#include "GaudiKernel/EventContext.h" #include "xAODTracking/TrackParticle.h" #include "xAODTracking/Vertex.h" @@ -102,7 +102,10 @@ namespace InDet class cleanup_pair : public std::pair { public: - cleanup_pair(const std::pair &a_pair) : std::pair(a_pair) {} + cleanup_pair(const std::pair& a_pair) + : std::pair(a_pair) + {} ~cleanup_pair() { delete this->first; delete this->second; @@ -123,9 +126,10 @@ namespace InDet StatusCode ConversionFinder::execute() { + const EventContext& ctx =Algorithm::getContext(); m_events_processed++; - SG::ReadHandle trackParticleCollection(m_tracksName); + SG::ReadHandle trackParticleCollection(m_tracksName,ctx); if ( !trackParticleCollection.isValid()) { ATH_MSG_WARNING( "Could not find xAOD::TrackParticleContainer " << m_tracksName << " in StoreGate."); @@ -154,14 +158,14 @@ namespace InDet Amg::Vector3D momentum(0., 0., 0.); for (unsigned int i = 0; i < vertex->nTrackParticles(); ++i){ - momentum += m_EMExtrapolationTool->getMomentumAtVertex(*vertex, i); + momentum += m_EMExtrapolationTool->getMomentumAtVertex(ctx,*vertex, i); } vertex->auxdata("px") = momentum.x(); vertex->auxdata("py") = momentum.y(); vertex->auxdata("pz") = momentum.z(); - if (!m_EMExtrapolationTool->getEtaPhiAtCalo(vertex, &etaAtCalo, &phiAtCalo)) + if (!m_EMExtrapolationTool->getEtaPhiAtCalo(ctx,vertex, &etaAtCalo, &phiAtCalo)) { ATH_MSG_DEBUG("getEtaPhiAtCalo failed!"); } @@ -174,7 +178,7 @@ namespace InDet analyzeResults(conversions.first); - SG::WriteHandle output(m_InDetConversionOutputName ); + SG::WriteHandle output(m_InDetConversionOutputName,ctx); if (output.record( std::unique_ptr(conversions.releaseFirst()) , std::unique_ptr(conversions.releaseSecond())).isFailure()) { ATH_MSG_ERROR("Failed to record conversion vertices " << m_InDetConversionOutputName.key()); diff --git a/Reconstruction/egamma/egammaAlgs/src/EMGSFCaloExtensionBuilder.cxx b/Reconstruction/egamma/egammaAlgs/src/EMGSFCaloExtensionBuilder.cxx index dc8706d2c5d..ac8170d3284 100644 --- a/Reconstruction/egamma/egammaAlgs/src/EMGSFCaloExtensionBuilder.cxx +++ b/Reconstruction/egamma/egammaAlgs/src/EMGSFCaloExtensionBuilder.cxx @@ -77,9 +77,10 @@ EMGSFCaloExtensionBuilder::execute_r(const EventContext& ctx) const mask[trkIt->index()] = false; } } - ATH_CHECK( - m_perigeeParticleCaloExtensionTool->caloExtensionCollection(*ptrTracks, mask, *ptrPerigee)); - ATH_CHECK(m_lastParticleCaloExtensionTool->caloExtensionCollection(*ptrTracks, mask, *ptrLast)); + ATH_CHECK(m_perigeeParticleCaloExtensionTool->caloExtensionCollection( + ctx, *ptrTracks, mask, *ptrPerigee)); + ATH_CHECK(m_lastParticleCaloExtensionTool->caloExtensionCollection( + ctx, *ptrTracks, mask, *ptrLast)); return StatusCode::SUCCESS; } diff --git a/Reconstruction/egamma/egammaAlgs/src/EMVertexBuilder.cxx b/Reconstruction/egamma/egammaAlgs/src/EMVertexBuilder.cxx index 13a693671b9..f7488632796 100644 --- a/Reconstruction/egamma/egammaAlgs/src/EMVertexBuilder.cxx +++ b/Reconstruction/egamma/egammaAlgs/src/EMVertexBuilder.cxx @@ -12,11 +12,12 @@ email : kerstin.tackmann@cern.ch, Bruno.Lenzi@cern.ch changes : Nov 2011 (KT) Initial version Mar 2014 (BL) xAOD migration, creates both double and single track vertices - + ***************************************************************************/ #include "EMVertexBuilder.h" +#include "GaudiKernel/EventContext.h" #include "xAODTracking/TrackParticleContainer.h" #include "xAODTracking/VertexContainer.h" #include "xAODTracking/VertexAuxContainer.h" @@ -24,13 +25,12 @@ changes : #include "StoreGate/ReadHandle.h" #include "StoreGate/WriteHandle.h" -EMVertexBuilder::EMVertexBuilder(const std::string& name, - ISvcLocator* pSvcLocator): - AthAlgorithm(name, pSvcLocator) +EMVertexBuilder::EMVertexBuilder(const std::string& name, + ISvcLocator* pSvcLocator) + : AthAlgorithm(name, pSvcLocator) { } -// ============================================================ StatusCode EMVertexBuilder::initialize() { ATH_MSG_DEBUG( "Initializing " << name() << "..."); @@ -60,16 +60,16 @@ StatusCode EMVertexBuilder::initialize() { return StatusCode::SUCCESS; } -// ============================================================ StatusCode EMVertexBuilder::finalize() { return StatusCode::SUCCESS; } -// ============================================================ StatusCode EMVertexBuilder::execute() -{ +{ + + const EventContext& ctx =Algorithm::getContext(); //retrieve TrackParticleContainer - SG::ReadHandle TPCol(m_inputTrackParticleContainerKey); + SG::ReadHandle TPCol(m_inputTrackParticleContainerKey,ctx); // check for serial running only, remove in MT if(!TPCol.isValid()){ @@ -77,13 +77,16 @@ StatusCode EMVertexBuilder::execute() return StatusCode::FAILURE; } - std::pair verticesPair = m_vertexFinderTool->findVertex(TPCol.cptr()); + std::pair verticesPair = + m_vertexFinderTool->findVertex(TPCol.cptr()); + if (!verticesPair.first || !verticesPair.second){ ATH_MSG_ERROR("Null pointer to conversion container"); return StatusCode::SUCCESS; } - SG::WriteHandlevertices(m_outputConversionContainerKey); + SG::WriteHandlevertices(m_outputConversionContainerKey,ctx); + ATH_CHECK(vertices.record(std::unique_ptr(verticesPair.first), std::unique_ptr(verticesPair.second))); @@ -98,7 +101,7 @@ StatusCode EMVertexBuilder::execute() Amg::Vector3D momentum(0., 0., 0.); for (unsigned int i = 0; i < vertex.nTrackParticles(); ++i){ - momentum += m_EMExtrapolationTool->getMomentumAtVertex(vertex, i); + momentum += m_EMExtrapolationTool->getMomentumAtVertex(ctx,vertex, i); } static const SG::AuxElement::Accessor accPx("px"); @@ -113,13 +116,12 @@ StatusCode EMVertexBuilder::execute() bool vxSingleTRT = (convType == xAOD::EgammaParameters::singleTRT); if ((vxDoubleTRT && momentum.perp() < m_minPtCut_DoubleTrack) || - (vxSingleTRT && momentum.perp()< m_minPtCut_SingleTrack) || - ((*itVtx)->position().perp() > m_maxRadius)){ - + (vxSingleTRT && momentum.perp() < m_minPtCut_SingleTrack) || + ((*itVtx)->position().perp() > m_maxRadius)) { + itVtx = vertices->erase(itVtx); itVtxEnd = vertices->end(); - } - else{ + } else { ++itVtx; } } @@ -130,12 +132,12 @@ StatusCode EMVertexBuilder::execute() float phiAtCalo = -9999.; for (itVtx = vertices->begin(); itVtx != vertices->end(); ++itVtx ){ xAOD::Vertex *vertex = *itVtx; - - - if (!m_EMExtrapolationTool->getEtaPhiAtCalo(vertex, &etaAtCalo, &phiAtCalo)){ + + if (!m_EMExtrapolationTool->getEtaPhiAtCalo( + ctx, vertex, &etaAtCalo, &phiAtCalo)) { ATH_MSG_DEBUG("getEtaPhiAtCalo failed!"); } - + // Decorate vertex with etaAtCalo, phiAtCalo static const SG::AuxElement::Accessor accetaAtCalo("etaAtCalo"); static const SG::AuxElement::Accessor accphiAtCalo("phiAtCalo"); diff --git a/Reconstruction/egamma/egammaInterfaces/egammaInterfaces/IEMConversionBuilder.h b/Reconstruction/egamma/egammaInterfaces/egammaInterfaces/IEMConversionBuilder.h index 62773192a1d..1c8929f7cb8 100755 --- a/Reconstruction/egamma/egammaInterfaces/egammaInterfaces/IEMConversionBuilder.h +++ b/Reconstruction/egamma/egammaInterfaces/egammaInterfaces/IEMConversionBuilder.h @@ -44,8 +44,6 @@ class IEMConversionBuilder : virtual public IAlgTool virtual StatusCode executeRec(const EventContext& ctx,egammaRec* egRec) const = 0; /** @brief execute method*/ virtual StatusCode hltExecute(egammaRec* egRec, const xAOD::VertexContainer* conversions) const =0; - /** @brief execute method*/ - virtual StatusCode vertexExecute(egammaRec* egRec, const xAOD::VertexContainer* conversions) const =0; /** @brief finalize method*/ virtual StatusCode finalize() = 0; diff --git a/Reconstruction/egamma/egammaInterfaces/egammaInterfaces/IEMExtrapolationTools.h b/Reconstruction/egamma/egammaInterfaces/egammaInterfaces/IEMExtrapolationTools.h index d44cd5cb3d9..f35d5f4fe9e 100644 --- a/Reconstruction/egamma/egammaInterfaces/egammaInterfaces/IEMExtrapolationTools.h +++ b/Reconstruction/egamma/egammaInterfaces/egammaInterfaces/IEMExtrapolationTools.h @@ -55,17 +55,16 @@ public: * layers given the Trk::ParametersBase. * whether or not to extrapolate to each calo sample */ - virtual StatusCode getMatchAtCalo (const EventContext& ctx, - const xAOD::CaloCluster& cluster, - const xAOD::TrackParticle& trkPB, - Trk::PropDirection direction, - std::array& eta, - std::array& phi, - std::array& deltaEta, - std::array& deltaPhi, - unsigned int extrapFrom = fromPerigee, - Cache* cache=nullptr) const = 0; - + virtual StatusCode getMatchAtCalo(const EventContext& ctx, + const xAOD::CaloCluster& cluster, + const xAOD::TrackParticle& trkPB, + Trk::PropDirection direction, + std::array& eta, + std::array& phi, + std::array& deltaEta, + std::array& deltaPhi, + unsigned int extrapFrom = fromPerigee, + Cache* cache = nullptr) const = 0; /** test for vertex-to-cluster match given also the positions * at the calorimeter from the vertex extrapolation **/ @@ -77,23 +76,28 @@ public: /** get eta, phi at EM2 given a vertex which is converted to NeutralParameters. Return false if the extrapolation fails **/ - virtual bool getEtaPhiAtCalo (const xAOD::Vertex* vertex, - float *etaAtCalo, - float *phiAtCalo) const = 0; + virtual bool getEtaPhiAtCalo(const EventContext& ctx, + const xAOD::Vertex* vertex, + float* etaAtCalo, + float* phiAtCalo) const = 0; /** get eta, phi at EM2 given NeutralParameters. Return false if the extrapolation fails **/ - virtual bool getEtaPhiAtCalo (const Trk::TrackParameters* trkPar, - float *etaAtCalo, - float *phiAtCalo) const =0; + virtual bool getEtaPhiAtCalo(const EventContext& ctx, + const Trk::TrackParameters* trkPar, + float* etaAtCalo, + float* phiAtCalo) const = 0; /** get the momentum of the i-th trackParticle attached to the vertex * at the vertex (designed for conversions) **/ - virtual Amg::Vector3D getMomentumAtVertex(const xAOD::Vertex&, unsigned int) const = 0; + virtual Amg::Vector3D getMomentumAtVertex(const EventContext& ctx, + const xAOD::Vertex&, + unsigned int) const = 0; /** get sum of the momenta at the vertex (designed for conversions). Retrieve from auxdata if available and \ is true **/ - virtual Amg::Vector3D getMomentumAtVertex(const xAOD::Vertex&, bool reuse = true) const = 0; - + virtual Amg::Vector3D getMomentumAtVertex(const EventContext& ctx, + const xAOD::Vertex&, + bool reuse = true) const = 0; }; inline const InterfaceID& IEMExtrapolationTools::interfaceID() diff --git a/Reconstruction/egamma/egammaTools/src/EMConversionBuilder.cxx b/Reconstruction/egamma/egammaTools/src/EMConversionBuilder.cxx index cb34165b9b7..89bd5dc02b6 100644 --- a/Reconstruction/egamma/egammaTools/src/EMConversionBuilder.cxx +++ b/Reconstruction/egamma/egammaTools/src/EMConversionBuilder.cxx @@ -3,13 +3,13 @@ */ /******************************************************************** - NAME: EMConversionBuilder.cxx PACKAGE: offline/Reconstruction/egamma/egammaRec -AUTHORS: D. Zerwas, B. Lenzi +AUTHORS: D. Zerwas, B. Lenzi , C. Anastopoulos CREATED: Jul, 2005 CHANGES: Mar, 2014 (BL) xAOD migration +CHANGES: 2020 (CA) Athena MT migration PURPOSE: subAlgorithm which creates an EMConversion object. @@ -73,8 +73,8 @@ namespace { using namespace xAOD::EgammaParameters; EMConversionBuilder::EMConversionBuilder(const std::string& type, - const std::string& name, - const IInterface* parent) + const std::string& name, + const IInterface* parent) : AthAlgTool(type, name, parent) { @@ -85,13 +85,10 @@ EMConversionBuilder::EMConversionBuilder(const std::string& type, // ================================================================= // DESTRUCTOR: -EMConversionBuilder::~EMConversionBuilder() -{ -} +EMConversionBuilder::~EMConversionBuilder() {} -// ================================================================== -// INITIALIZE METHOD: -StatusCode EMConversionBuilder::initialize() +StatusCode +EMConversionBuilder::initialize() { ATH_MSG_DEBUG("Initializing EMConversionBuilder"); @@ -109,31 +106,42 @@ StatusCode EMConversionBuilder::initialize() return StatusCode::SUCCESS; } -StatusCode EMConversionBuilder::executeRec(const EventContext& ctx, egammaRec* egRec) const { +StatusCode +EMConversionBuilder::executeRec(const EventContext& ctx, egammaRec* egRec) const +{ // retrieve Conversion Container SG::ReadHandle conversions(m_conversionContainerKey, ctx); // only for serial running; remove for MT if(!conversions.isValid()){ - ATH_MSG_ERROR("Could not retrieve Conversion container with key: " << m_conversionContainerKey.key()); + ATH_MSG_ERROR( + "Could not retrieve Conversion container with key: " + << m_conversionContainerKey.key()); return StatusCode::FAILURE; } //reset the vertices std::vector< ElementLink< xAOD::VertexContainer > > vertices; egRec->setVertices(vertices); - ATH_CHECK(vertexExecute(egRec,conversions.cptr())); + ATH_CHECK(vertexExecute(ctx,egRec,conversions.cptr())); return StatusCode::SUCCESS; } -// ============================================================= -StatusCode EMConversionBuilder::hltExecute(egammaRec* egRec, const xAOD::VertexContainer* conversions) const { - ATH_CHECK(vertexExecute(egRec,conversions)); +StatusCode +EMConversionBuilder::hltExecute(egammaRec* egRec, + const xAOD::VertexContainer* conversions) const +{ + ATH_CHECK(vertexExecute(Gaudi::Hive::currentContext(), egRec, conversions)); return StatusCode::SUCCESS; } -StatusCode EMConversionBuilder::vertexExecute(egammaRec* egRec, const xAOD::VertexContainer* conversions) const { - +StatusCode +EMConversionBuilder::vertexExecute( + const EventContext& ctx, + egammaRec* egRec, + const xAOD::VertexContainer* conversions) const +{ + if (!egRec || !conversions){ ATH_MSG_WARNING("trackExecute: NULL pointer to egammaRec or VertexContainer"); return StatusCode::SUCCESS; @@ -154,40 +162,43 @@ StatusCode EMConversionBuilder::vertexExecute(egammaRec* egRec, const xAOD::Vert phiAtCalo = accphiAtCalo(*vertex); } // check extrapolation, skip vertex in case of failure - else if (!m_extrapolationTool->getEtaPhiAtCalo(vertex, &etaAtCalo, &phiAtCalo)){ + else if (!m_extrapolationTool->getEtaPhiAtCalo( + ctx, vertex, &etaAtCalo, &phiAtCalo)) { continue; } const xAOD::CaloCluster *cluster = egRec->caloCluster(); - if (!passPtAndEoverP(*vertex, *cluster)){ + if (!passPtAndEoverP(ctx, *vertex, *cluster)) { continue; } - if (!m_extrapolationTool->matchesAtCalo(cluster, vertex, etaAtCalo, phiAtCalo)){ + if (!m_extrapolationTool->matchesAtCalo( + cluster, vertex, etaAtCalo, phiAtCalo)) { continue; } const ElementLink< xAOD::VertexContainer > vertexLink( *conversions, iVtx ); // If this is the best (or the first) vertex, push front and keep deltaEta, deltaPhi - if (!egRec->getNumberOfVertices() || ConvVxSorter(*vertex, *egRec->vertex())){ + if (!egRec->getNumberOfVertices() || + ConvVxSorter(*vertex, *egRec->vertex())) { egRec->pushFrontVertex( vertexLink ); egRec->setDeltaEtaVtx( cluster->etaBE(2) - etaAtCalo ); egRec->setDeltaPhiVtx( P4Helpers::deltaPhi(cluster->phiBE(2), phiAtCalo) ); - } - else {// Not the best vertex, push back - egRec->pushBackVertex( vertexLink ); + } else { // Not the best vertex, push back + egRec->pushBackVertex( vertexLink ); } } return StatusCode::SUCCESS; } -// ================================================================== -// FINALIZE METHOD: StatusCode EMConversionBuilder::finalize(){ return StatusCode::SUCCESS; } -// ================================================================== -bool EMConversionBuilder::passPtAndEoverP(const xAOD::Vertex& vertex, const xAOD::CaloCluster& cluster) const + +bool +EMConversionBuilder::passPtAndEoverP(const EventContext& ctx, + const xAOD::Vertex& vertex, + const xAOD::CaloCluster& cluster) const { - Amg::Vector3D momentum = m_extrapolationTool->getMomentumAtVertex(vertex); + Amg::Vector3D momentum = m_extrapolationTool->getMomentumAtVertex(ctx,vertex); float pt = momentum.perp(); float EoverP = cluster.e() / momentum.mag(); @@ -218,7 +229,9 @@ bool EMConversionBuilder::passPtAndEoverP(const xAOD::Vertex& vertex, const xAOD return !reject; } -float EMConversionBuilder::getMaxTRTTubeHitFraction(const xAOD::Vertex& vertex) const{ +float +EMConversionBuilder::getMaxTRTTubeHitFraction(const xAOD::Vertex& vertex) const +{ auto getTRTTubeHitFraction = [](const xAOD::TrackParticle *trk){ uint8_t nTRT; uint8_t nTRTTube; diff --git a/Reconstruction/egamma/egammaTools/src/EMConversionBuilder.h b/Reconstruction/egamma/egammaTools/src/EMConversionBuilder.h index 3f6a5cc5ba4..92d24d67751 100644 --- a/Reconstruction/egamma/egammaTools/src/EMConversionBuilder.h +++ b/Reconstruction/egamma/egammaTools/src/EMConversionBuilder.h @@ -7,40 +7,42 @@ /** @class EMConversionBuilder EMConversion data object builder. This is an Algorithm class. - Selects conversion vertices reconstructed by the ID software - after matching them to an EM calorimeter cluster. - For normal two-track conversions the original photon track parameters - at the conversion vertex are reconstructed. It is then extrapolated - to the calorimeter and checked whether it matches the cluster. - For single-track conversions, the reconstructed electron track is - extrapolated to the calorimeter. - A TrackToCalo extrapolation tool that can handle both neutral and charged - track parameters (using a Trk::ParametersBase interface) is used throughout. - The extrapolation starts at the last track measurement. - Matching is done in both eta and phi. The eta matching WAS disabled for TRT-only - tracks due to lack of accurate eta prediction BEFORE 12/2011. + Selects conversion vertices reconstructed by the ID software + after matching them to an EM calorimeter cluster. + For normal two-track conversions the original photon track parameters + at the conversion vertex are reconstructed. It is then extrapolated + to the calorimeter and checked whether it matches the cluster. + For single-track conversions, the reconstructed electron track is + extrapolated to the calorimeter. + A TrackToCalo extrapolation tool that can handle both neutral and + charged track parameters (using a Trk::ParametersBase interface) is used + throughout. The extrapolation starts at the last track measurement. Matching + is done in both eta and phi. The eta matching WAS disabled for TRT-only tracks + due to lack of accurate eta prediction BEFORE 12/2011. @author D. Zerwas changes: June 16, 2010 (JM) bring some stuff from PhotonRecoveryTool here Mar, 2014 (BL) xAOD migration and new logic + 2020 Athena Mt migration. */ -// INCLUDE HEADER FILES: -#include "GaudiKernel/ToolHandle.h" +// INCLUDE HEADER FILES: +#include "AthenaBaseComps/AthAlgTool.h" #include "GaudiKernel/EventContext.h" #include "GaudiKernel/SystemOfUnits.h" -#include "AthenaBaseComps/AthAlgTool.h" +#include "GaudiKernel/ToolHandle.h" +#include "StoreGate/ReadHandleKey.h" #include "egammaInterfaces/IEMConversionBuilder.h" #include "egammaInterfaces/IEMExtrapolationTools.h" -#include "xAODTracking/VertexContainerFwd.h" #include "xAODCaloEvent/CaloClusterFwd.h" -#include "StoreGate/ReadHandleKey.h" +#include "xAODTracking/VertexContainerFwd.h" -class EMConversionBuilder : public AthAlgTool, virtual public IEMConversionBuilder +class EMConversionBuilder + : public AthAlgTool + , virtual public IEMConversionBuilder { - public: - +public: /** @brief Default constructor*/ EMConversionBuilder(const std::string& type, const std::string& name, @@ -48,95 +50,139 @@ class EMConversionBuilder : public AthAlgTool, virtual public IEMConversionBuild /** @brief Destructor*/ ~EMConversionBuilder(); - + /** @brief initialize method*/ StatusCode initialize() override; /** @brief execute method*/ - virtual StatusCode executeRec(const EventContext& ctx, egammaRec* egRec) const override final; + virtual StatusCode executeRec(const EventContext& ctx, + egammaRec* egRec) const override final; /** @brief execute method*/ - virtual StatusCode hltExecute(egammaRec* egRec, const xAOD::VertexContainer* conversions) const override final; - /** @brief execute method*/ - virtual StatusCode vertexExecute(egammaRec* egRec, const xAOD::VertexContainer* conversions) const override final; - /** @brief finalize method*/ + virtual StatusCode hltExecute( + egammaRec* egRec, + const xAOD::VertexContainer* conversions) const override final; + /** @brief finalize method*/ StatusCode finalize() override; private: - + /** @brief actual implementation method*/ + StatusCode vertexExecute( + const EventContext& ctx, + egammaRec* egRec, + const xAOD::VertexContainer* conversions) const; + + /** @brief Return true if vertex and cluster pass Pt and E/p cuts **/ - bool passPtAndEoverP(const xAOD::Vertex&, const xAOD::CaloCluster&) const; - + bool passPtAndEoverP(const EventContext& ctx, + const xAOD::Vertex&, + const xAOD::CaloCluster&) const; + /** @brief Return the maximum fraction of TRT tube hits among the tracks **/ float getMaxTRTTubeHitFraction(const xAOD::Vertex& vertex) const; - + // configuration: /** @brief Name of conversion container*/ - SG::ReadHandleKey m_conversionContainerKey {this, - "ConversionContainerName", "PhotonConversionVertices", - "Name of the input conversion container"}; - + SG::ReadHandleKey m_conversionContainerKey{ + this, + "ConversionContainerName", + "PhotonConversionVertices", + "Name of the input conversion container" + }; + /** @brief EMExtrapolationTools */ - ToolHandle m_extrapolationTool {this, - "ExtrapolationTool", "EMExtrapolationTools", - "Handle of the extrapolation tool"}; - - /** @brief Ignore all conversion vertices that contain exclusively TRT-only tracks */ - Gaudi::Property m_rejectAllTRT {this, "RejectAllTRTConversions", false, - "Ignore all conversion vertices containing exclusively TRT-only tracks"}; - - /** @brief minimum number of TRT hits for TRT-only tracks (both single and double track conversion vertices) */ - Gaudi::Property m_minTRTHits {this, "minTRTHits", 0, - "minimum number of TRT hits for TRT-only tracks (both single and double track conversion vertices)"}; + ToolHandle m_extrapolationTool{ + this, + "ExtrapolationTool", + "EMExtrapolationTools", + "Handle of the extrapolation tool" + }; + + /** @brief Ignore all conversion vertices that contain exclusively TRT-only + * tracks */ + Gaudi::Property m_rejectAllTRT{ + this, + "RejectAllTRTConversions", + false, + "Ignore all conversion vertices containing exclusively TRT-only tracks" + }; + + /** @brief minimum number of TRT hits for TRT-only tracks (both single and + * double track conversion vertices) */ + Gaudi::Property m_minTRTHits{ + this, + "minTRTHits", + 0, + "minimum number of TRT hits for TRT-only tracks (both single and double " + "track conversion vertices)" + }; /** @brief minimum pT for single-track conversion vertices */ - Gaudi::Property m_minPt_singleTrack {this, - "minPt_singleTrack", 0*Gaudi::Units::GeV, - "minimum pT for single-track conversion vertices"}; + Gaudi::Property m_minPt_singleTrack{ + this, + "minPt_singleTrack", + 0 * Gaudi::Units::GeV, + "minimum pT for single-track conversion vertices" + }; /** @brief minimum pT for TRT-only single-track conversion vertices */ - Gaudi::Property m_minPt_singleTRT {this, - "minPt_singleTRT", 2*Gaudi::Units::GeV, - "minimum pT for TRT-only single-track conversion vertices"}; - - /** @brief minimum pT for each track in TRT-only double-track conversion vertices */ - Gaudi::Property m_minTRTonlyTrackPt {this, - "minTRTonlyTrackPt", 0*Gaudi::Units::GeV, - "minimum pT for each track in TRT-only double-track conversion vertices"}; + Gaudi::Property m_minPt_singleTRT{ + this, + "minPt_singleTRT", + 2 * Gaudi::Units::GeV, + "minimum pT for TRT-only single-track conversion vertices" + }; + + /** @brief minimum pT for each track in TRT-only double-track conversion + * vertices */ + Gaudi::Property m_minTRTonlyTrackPt{ + this, + "minTRTonlyTrackPt", + 0 * Gaudi::Units::GeV, + "minimum pT for each track in TRT-only double-track conversion vertices" + }; /** @brief minimum sum pT for double track conversion vertices */ - Gaudi::Property m_minSumPt_double {this, - "minSumPt_double", 0*Gaudi::Units::GeV, - "minimum sum pT for double track conversion vertices"}; + Gaudi::Property m_minSumPt_double{ + this, + "minSumPt_double", + 0 * Gaudi::Units::GeV, + "minimum sum pT for double track conversion vertices" + }; /** @brief minimum sum pT for double TRT track conversion vertices */ - Gaudi::Property m_minSumPt_doubleTRT {this, - "minSumPt_doubleTRT", 2*Gaudi::Units::GeV, - "minimum sum pT for double TRT track conversion vertices"}; - - /** @brief maximum E/p for single track conversion vertices (E is not calibrated) */ - Gaudi::Property m_maxEoverP_singleTrack {this, - "maxEoverP_singleTrack", 10., - "Maximum E/p for single track conversion vertices"}; + Gaudi::Property m_minSumPt_doubleTRT{ + this, + "minSumPt_doubleTRT", + 2 * Gaudi::Units::GeV, + "minimum sum pT for double TRT track conversion vertices" + }; + + /** @brief maximum E/p for single track conversion vertices (E is not + * calibrated) */ + Gaudi::Property m_maxEoverP_singleTrack{ + this, + "maxEoverP_singleTrack", + 10., + "Maximum E/p for single track conversion vertices" + }; /** @brief Scale maxEoverP_singleTrack by 1+sf*Et(cluster)/GeV **/ - Gaudi::Property m_maxEoverP_singleTrack_EtSf {this, - "maxEoverP_singleTrack_EtSf", 0.01, - "Scale maxEoverP_singleTrack by ( 1+sf*Et(cluster)/GeV )"}; - - /** @brief "Maximum fraction of tube hits for vertices with TRT tracks **/ - Gaudi::Property m_maxTRTTubeHitFraction {this, - "maxTRTTubeHitFraction", 999., - "Maximum fraction of tube hits for vertices with TRT tracks"}; - // for 21.0.X: minTRTPrecisionFraction cut applied InDetTRT_StandaloneScoringTool - + Gaudi::Property m_maxEoverP_singleTrack_EtSf{ + this, + "maxEoverP_singleTrack_EtSf", + 0.01, + "Scale maxEoverP_singleTrack by ( 1+sf*Et(cluster)/GeV )" + }; + + /** @brief "Maximum fraction of tube hits for vertices with TRT tracks **/ + Gaudi::Property m_maxTRTTubeHitFraction{ + this, + "maxTRTTubeHitFraction", + 999., + "Maximum fraction of tube hits for vertices with TRT tracks" + }; + // for 21.0.X: minTRTPrecisionFraction cut applied + // InDetTRT_StandaloneScoringTool }; #endif - - - - - - - - diff --git a/Reconstruction/egamma/egammaTrackTools/src/EMExtrapolationTools.cxx b/Reconstruction/egamma/egammaTrackTools/src/EMExtrapolationTools.cxx index f5c50f4e237..c8f2e1260bd 100644 --- a/Reconstruction/egamma/egammaTrackTools/src/EMExtrapolationTools.cxx +++ b/Reconstruction/egamma/egammaTrackTools/src/EMExtrapolationTools.cxx @@ -28,18 +28,24 @@ #include namespace { -const CaloExtensionHelpers::LayersToSelect barrelLayers = { CaloSampling::PreSamplerB, - CaloSampling::EMB1, - CaloSampling::EMB2, - CaloSampling::EMB3 }; +const CaloExtensionHelpers::LayersToSelect barrelLayers = { + CaloSampling::PreSamplerB, + CaloSampling::EMB1, + CaloSampling::EMB2, + CaloSampling::EMB3 +}; -const CaloExtensionHelpers::LayersToSelect endCapLayers = { CaloSampling::PreSamplerE, - CaloSampling::EME1, - CaloSampling::EME2, - CaloSampling::EME3 }; +const CaloExtensionHelpers::LayersToSelect endCapLayers = { + CaloSampling::PreSamplerE, + CaloSampling::EME1, + CaloSampling::EME2, + CaloSampling::EME3 +}; } -EMExtrapolationTools::EMExtrapolationTools(const std::string& type, const std::string& name, const IInterface* parent) +EMExtrapolationTools::EMExtrapolationTools(const std::string& type, + const std::string& name, + const IInterface* parent) : AthAlgTool(type, name, parent) , m_trtId(nullptr) { @@ -96,7 +102,7 @@ EMExtrapolationTools::getMatchAtCalo(const EventContext& ctx, std::array& eta, std::array& phi, std::array& deltaEta, - std::array& deltaPhi, + std::array& deltaPhi, unsigned int extrapFrom, Cache* cache) const { @@ -104,101 +110,116 @@ EMExtrapolationTools::getMatchAtCalo(const EventContext& ctx, * the extrapolated eta/phi and * the deta/dphi between cluster and track * We allow different ways to extrapolate: - * 1) from the last measurement track parameters (this is always the case for TRT standalone) - * 2) from the perigee track parameters - * 3) from the perigee with the track momentum rescaled by the cluster energy + * 1) from the last measurement track parameters (this is always the case for + * TRT standalone) 2) from the perigee track parameters 3) from the perigee + * with the track momentum rescaled by the cluster energy */ - if (cluster.e()<10 && trkPB.pt()<10) {//This is 10 MeV - ATH_MSG_WARNING("Too small cluster E :" << cluster.e() << " , or too small track pt" << trkPB.pt()); + if (cluster.e() < 10 && trkPB.pt() < 10) { // This is 10 MeV + ATH_MSG_WARNING("Too small cluster E :" + << cluster.e() << " , or too small track pt" << trkPB.pt()); return StatusCode::FAILURE; } bool didExtension = false; CaloExtensionHelpers::EtaPhiPerLayerVector intersections; switch (extrapFrom) { - /* - * Rescaled Perigee does not have a cache - */ - case fromPerigeeRescaled: { - Trk::Perigee trkPar = getRescaledPerigee(trkPB, cluster); - std::unique_ptr extension = - m_perigeeParticleCaloExtensionTool->caloExtension(trkPar, direction, Trk::muon); - didExtension = extension != nullptr; - if (didExtension) { - intersections = getIntersections(*extension, cluster); - } - } break; - /* For the other cases - * See if there is a collection cache - * else if there is an in algorithm cache passed to us - * else do it without a caching + /* + * Rescaled Perigee does not have a cache */ - case fromPerigee: { - if (m_usePerigeeCaching) { - SG::ReadHandle PerigeeCache(m_PerigeeCacheKey, ctx); - if (!PerigeeCache.isValid()) { - ATH_MSG_ERROR("Could not retrieve Perigee Cache " << PerigeeCache.key()); - return StatusCode::FAILURE; - } - const Trk::CaloExtension* extension = m_perigeeParticleCaloExtensionTool->caloExtension(trkPB, *PerigeeCache); + case fromPerigeeRescaled: { + Trk::Perigee trkPar = getRescaledPerigee(trkPB, cluster); + std::unique_ptr extension = + m_perigeeParticleCaloExtensionTool->caloExtension( + ctx, trkPar, direction, Trk::muon); didExtension = extension != nullptr; if (didExtension) { intersections = getIntersections(*extension, cluster); } - } else if (cache) { - const Trk::CaloExtension* extension = m_perigeeParticleCaloExtensionTool->caloExtension(trkPB, *cache); - didExtension = extension != nullptr; - if (didExtension) { - intersections = getIntersections(*extension, cluster); - } - } else { - std::unique_ptr extension = m_perigeeParticleCaloExtensionTool->caloExtension(trkPB); - didExtension = extension != nullptr; - if (didExtension) { - intersections = getIntersections(*extension, cluster); - } - } - } break; + } break; + /* For the other cases + * See if there is a collection cache + * else if there is an in algorithm cache passed to us + * else do it without a caching + */ + case fromPerigee: { + if (m_usePerigeeCaching) { + SG::ReadHandle PerigeeCache(m_PerigeeCacheKey, + ctx); - case fromLastMeasurement: { - if (m_useLastCaching) { - SG::ReadHandle LastCache(m_LastCacheKey, ctx); - if (!LastCache.isValid()) { - ATH_MSG_ERROR("Could not retrieve Last Cache " << LastCache.key()); - return StatusCode::FAILURE; - } - const Trk::CaloExtension* extension = m_lastParticleCaloExtensionTool->caloExtension(trkPB, *LastCache); - didExtension = extension != nullptr; - if (didExtension) { - intersections = getIntersections(*extension, cluster); - } - } else if (cache) { - const Trk::CaloExtension* extension = m_lastParticleCaloExtensionTool->caloExtension(trkPB, *cache); - didExtension = extension != nullptr; - if (didExtension) { - intersections = getIntersections(*extension, cluster); + if (!PerigeeCache.isValid()) { + ATH_MSG_ERROR("Could not retrieve Perigee Cache " + << PerigeeCache.key()); + return StatusCode::FAILURE; + } + + const Trk::CaloExtension* extension = + m_perigeeParticleCaloExtensionTool->caloExtension(trkPB, + *PerigeeCache); + + didExtension = extension != nullptr; + if (didExtension) { + intersections = getIntersections(*extension, cluster); + } + } else if (cache) { + const Trk::CaloExtension* extension = + m_perigeeParticleCaloExtensionTool->caloExtension(ctx, trkPB, *cache); + didExtension = extension != nullptr; + if (didExtension) { + intersections = getIntersections(*extension, cluster); + } + } else { + std::unique_ptr extension = + m_perigeeParticleCaloExtensionTool->caloExtension(ctx, trkPB); + didExtension = extension != nullptr; + if (didExtension) { + intersections = getIntersections(*extension, cluster); + } } - } else { - std::unique_ptr extension = m_lastParticleCaloExtensionTool->caloExtension(trkPB); - didExtension = extension != nullptr; - if (didExtension) { - intersections = getIntersections(*extension, cluster); + } break; + + case fromLastMeasurement: { + if (m_useLastCaching) { + SG::ReadHandle LastCache(m_LastCacheKey, ctx); + if (!LastCache.isValid()) { + ATH_MSG_ERROR("Could not retrieve Last Cache " << LastCache.key()); + return StatusCode::FAILURE; + } + const Trk::CaloExtension* extension = + m_lastParticleCaloExtensionTool->caloExtension(trkPB, *LastCache); + didExtension = extension != nullptr; + if (didExtension) { + intersections = getIntersections(*extension, cluster); + } + } else if (cache) { + const Trk::CaloExtension* extension = + m_lastParticleCaloExtensionTool->caloExtension(ctx, trkPB, *cache); + didExtension = extension != nullptr; + if (didExtension) { + intersections = getIntersections(*extension, cluster); + } + } else { + std::unique_ptr extension = + m_lastParticleCaloExtensionTool->caloExtension(ctx, trkPB); + didExtension = extension != nullptr; + if (didExtension) { + intersections = getIntersections(*extension, cluster); + } } - } - } break; + } break; - default: { - ATH_MSG_ERROR("Invalid ExtrapolateFrom " << extrapFrom); - } + default: { + ATH_MSG_ERROR("Invalid ExtrapolateFrom " << extrapFrom); + } } /* * Given the extension calculate the deta/dphi for the layers */ if (!didExtension) { - ATH_MSG_DEBUG("Could not create an extension from " << extrapFrom << " for a track with : " - << " Track Pt " << trkPB.pt() << " Track Eta " << trkPB.eta() - << " Track Phi " << trkPB.phi() << " Track Fitter " - << trkPB.trackFitter()); + ATH_MSG_DEBUG("Could not create an extension from " + << extrapFrom << " for a track with : " + << " Track Pt " << trkPB.pt() << " Track Eta " << trkPB.eta() + << " Track Phi " << trkPB.phi() << " Track Fitter " + << trkPB.trackFitter()); return StatusCode::FAILURE; } // Negative tracks bend to the positive direction. @@ -208,7 +229,8 @@ EMExtrapolationTools::getMatchAtCalo(const EventContext& ctx, for (const auto& p : intersections) { int i(0); CaloSampling::CaloSample sample = std::get<0>(p); - if (sample == CaloSampling::PreSamplerE || sample == CaloSampling::PreSamplerB) { + if (sample == CaloSampling::PreSamplerE || + sample == CaloSampling::PreSamplerB) { i = 0; } else if (sample == CaloSampling::EME1 || sample == CaloSampling::EMB1) { i = 1; @@ -222,13 +244,15 @@ EMExtrapolationTools::getMatchAtCalo(const EventContext& ctx, eta[i] = std::get<1>(p); phi[i] = std::get<2>(p); deltaEta[i] = cluster.etaSample(sample) - std::get<1>(p); - deltaPhi[i] = P4Helpers::deltaPhi(cluster.phiSample(sample), std::get<2>(p)); + deltaPhi[i] = + P4Helpers::deltaPhi(cluster.phiSample(sample), std::get<2>(p)); // Should we flip the sign for deltaPhi? if (flipSign) { deltaPhi[i] = -deltaPhi[i]; } - ATH_MSG_DEBUG("getMatchAtCalo: i, eta, phi, deta, dphi: " << i << " " << eta[i] << " " << phi[i] << " " - << deltaEta[i] << " " << deltaPhi[i]); + ATH_MSG_DEBUG("getMatchAtCalo: i, eta, phi, deta, dphi: " + << i << " " << eta[i] << " " << phi[i] << " " << deltaEta[i] + << " " << deltaPhi[i]); } return StatusCode::SUCCESS; } @@ -244,7 +268,7 @@ EMExtrapolationTools::matchesAtCalo(const xAOD::CaloCluster* cluster, float etaAtCalo, float phiAtCalo) const { - if (!cluster || !vertex){ + if (!cluster || !vertex) { return false; } float deltaEta = fabs(etaAtCalo - cluster->etaBE(2)); @@ -254,19 +278,26 @@ EMExtrapolationTools::matchesAtCalo(const xAOD::CaloCluster* cluster, if (xAOD::EgammaHelpers::numberOfSiTracks(vertex) == 0) TRTsection = getTRTsection(vertex->trackParticle(0)); - // First pass on TRT tracks, skip barrel tracks matching endcap clusters and vice-versa + // First pass on TRT tracks, skip barrel tracks matching endcap clusters and + // vice-versa if ((TRTsection == 2 && (cluster->eta() <= 0.6 || cluster->eta() >= 2.4)) || - (TRTsection == -2 && (cluster->eta() >= -0.6 || cluster->eta() <= -2.4)) || + (TRTsection == -2 && + (cluster->eta() >= -0.6 || cluster->eta() <= -2.4)) || (TRTsection == 1 && (cluster->eta() <= -0.1 || cluster->eta() >= 1.3)) || (TRTsection == -1 && (cluster->eta() >= 0.1 || cluster->eta() <= -1.3))) { return false; } // The maximum deltaEta/deltaPhi for Si, TRT barrel, TRT endcap - static const std::vector dEtaV{ m_narrowDeltaEta, m_TRTbarrelDeltaEta, m_TRTendcapDeltaEta }; - static const std::vector dPhiV{ m_narrowDeltaPhi, m_narrowDeltaPhiTRTbarrel, m_narrowDeltaPhiTRTendcap }; + static const std::vector dEtaV{ m_narrowDeltaEta, + m_TRTbarrelDeltaEta, + m_TRTendcapDeltaEta }; + static const std::vector dPhiV{ m_narrowDeltaPhi, + m_narrowDeltaPhiTRTbarrel, + m_narrowDeltaPhiTRTendcap }; - return (deltaEta < dEtaV[abs(TRTsection)] && deltaPhi < dPhiV[abs(TRTsection)]); + return (deltaEta < dEtaV[abs(TRTsection)] && + deltaPhi < dPhiV[abs(TRTsection)]); } /* * The following two are the heavy lifting methods. @@ -274,12 +305,15 @@ EMExtrapolationTools::matchesAtCalo(const xAOD::CaloCluster* cluster, * and then calculate the eta/phi at calo */ bool -EMExtrapolationTools::getEtaPhiAtCalo(const xAOD::Vertex* vertex, float* etaAtCalo, float* phiAtCalo) const +EMExtrapolationTools::getEtaPhiAtCalo(const EventContext& ctx, + const xAOD::Vertex* vertex, + float* etaAtCalo, + float* phiAtCalo) const { - if (!vertex){ + if (!vertex) { return false; } - Amg::Vector3D momentum = getMomentumAtVertex(*vertex); + Amg::Vector3D momentum = getMomentumAtVertex(ctx,*vertex); if (momentum.mag() < 1e-5) { ATH_MSG_DEBUG("Intersection failed"); return false; @@ -289,15 +323,18 @@ EMExtrapolationTools::getEtaPhiAtCalo(const xAOD::Vertex* vertex, float* etaAtCa * Create high pt track parameters to mimic a neutral particle. * This in principle is an approximation */ - const Trk::TrackParameters* trkPar = - surface.createTrackParameters(vertex->position(), momentum.unit() * 1.e10, +1, nullptr); - bool success = getEtaPhiAtCalo(trkPar, etaAtCalo, phiAtCalo); + const Trk::TrackParameters* trkPar = surface.createTrackParameters( + vertex->position(), momentum.unit() * 1.e10, +1, nullptr); + bool success = getEtaPhiAtCalo(ctx,trkPar, etaAtCalo, phiAtCalo); delete trkPar; return success; } /* The actual calculation happens here*/ bool -EMExtrapolationTools::getEtaPhiAtCalo(const Trk::TrackParameters* trkPar, float* etaAtCalo, float* phiAtCalo) const +EMExtrapolationTools::getEtaPhiAtCalo(const EventContext& ctx, + const Trk::TrackParameters* trkPar, + float* etaAtCalo, + float* phiAtCalo) const { if (!trkPar) return false; @@ -311,13 +348,15 @@ EMExtrapolationTools::getEtaPhiAtCalo(const Trk::TrackParameters* trkPar, float* } std::unique_ptr extension = nullptr; - extension = m_perigeeParticleCaloExtensionTool->caloExtension(*trkPar, Trk::alongMomentum, Trk::muon); + extension = m_perigeeParticleCaloExtensionTool->caloExtension( + ctx, *trkPar, Trk::alongMomentum, Trk::muon); if (!extension) { ATH_MSG_WARNING("Could not create an extension from geEtaPhiAtCalo "); return false; } CaloExtensionHelpers::EtaPhiPerLayerVector intersections; - CaloExtensionHelpers::midPointEtaPhiPerLayerVector(*extension, intersections, &layersToSelect); + CaloExtensionHelpers::midPointEtaPhiPerLayerVector( + *extension, intersections, &layersToSelect); bool hitEM2(false); for (const auto& p : intersections) { int i(0); @@ -327,7 +366,8 @@ EMExtrapolationTools::getEtaPhiAtCalo(const Trk::TrackParameters* trkPar, float* *phiAtCalo = std::get<2>(p); hitEM2 = true; ++i; - ATH_MSG_DEBUG("getMatchAtCalo: i, eta, phi : " << i << " " << std::get<1>(p) << " " << std::get<2>(p)); + ATH_MSG_DEBUG("getMatchAtCalo: i, eta, phi : " + << i << " " << std::get<1>(p) << " " << std::get<2>(p)); } } return hitEM2; @@ -335,12 +375,15 @@ EMExtrapolationTools::getEtaPhiAtCalo(const Trk::TrackParameters* trkPar, float* /* Methods to get the momemtum at the conversion vertex*/ Amg::Vector3D -EMExtrapolationTools::getMomentumAtVertex(const xAOD::Vertex& vertex, unsigned int index) const +EMExtrapolationTools::getMomentumAtVertex(const EventContext& ctx, + const xAOD::Vertex& vertex, + unsigned int index) const { Amg::Vector3D momentum(0., 0., 0.); if (vertex.nTrackParticles() <= index) { ATH_MSG_WARNING("Invalid track index"); - } else if (vertex.vxTrackAtVertexAvailable() && !vertex.vxTrackAtVertex().empty()) { + } else if (vertex.vxTrackAtVertexAvailable() && + !vertex.vxTrackAtVertex().empty()) { // Use the parameters at the vertex // (the tracks should be parallel but we will do the sum anyway) ATH_MSG_DEBUG("getMomentumAtVertex : getting from vxTrackAtVertex"); @@ -353,10 +396,12 @@ EMExtrapolationTools::getMomentumAtVertex(const xAOD::Vertex& vertex, unsigned i } } else if (vertex.nTrackParticles() == 1) { // Use the first measurement - ATH_MSG_DEBUG("getMomentumAtVertex : 1 track only, getting from first measurement"); + ATH_MSG_DEBUG( + "getMomentumAtVertex : 1 track only, getting from first measurement"); const xAOD::TrackParticle* tp = vertex.trackParticle(0); unsigned int paramindex(0); - if (!tp || !tp->indexOfParameterAtPosition(paramindex, xAOD::FirstMeasurement)) { + if (!tp || + !tp->indexOfParameterAtPosition(paramindex, xAOD::FirstMeasurement)) { ATH_MSG_WARNING("No TrackParticle or no have first measurement"); } else { momentum += tp->curvilinearParameters(paramindex).momentum(); @@ -368,13 +413,16 @@ EMExtrapolationTools::getMomentumAtVertex(const xAOD::Vertex& vertex, unsigned i if (!tp) { ATH_MSG_WARNING("NULL pointer to TrackParticle in vertex"); } else { - const Trk::PerigeeSurface* surface = new Trk::PerigeeSurface(vertex.position()); - const Trk::TrackParameters* params = m_extrapolator->extrapolate(*tp, *surface, Trk::alongMomentum); + const Trk::PerigeeSurface* surface = + new Trk::PerigeeSurface(vertex.position()); + const Trk::TrackParameters* params = + m_extrapolator->extrapolate(ctx, *tp, *surface, Trk::alongMomentum); delete surface; - if (!params) + if (!params) { ATH_MSG_DEBUG("Extrapolation to vertex (perigee) failed"); - else + } else { momentum += params->momentum(); + } delete params; } } @@ -382,7 +430,9 @@ EMExtrapolationTools::getMomentumAtVertex(const xAOD::Vertex& vertex, unsigned i } Amg::Vector3D -EMExtrapolationTools::getMomentumAtVertex(const xAOD::Vertex& vertex, bool reuse /* = true */) const +EMExtrapolationTools::getMomentumAtVertex(const EventContext& ctx, + const xAOD::Vertex& vertex, + bool reuse /* = true */) const { Amg::Vector3D momentum(0., 0., 0.); const static SG::AuxElement::Accessor accPx("px"); @@ -392,13 +442,14 @@ EMExtrapolationTools::getMomentumAtVertex(const xAOD::Vertex& vertex, bool reuse ATH_MSG_WARNING("getMomentumAtVertex : vertex has no track particles!"); return momentum; } - if (reuse && accPx.isAvailable(vertex) && accPy.isAvailable(vertex) && accPz.isAvailable(vertex)) { + if (reuse && accPx.isAvailable(vertex) && accPy.isAvailable(vertex) && + accPz.isAvailable(vertex)) { // Already decorated with parameters at vertex ATH_MSG_DEBUG("getMomentumAtVertex : getting from auxdata"); return Amg::Vector3D(accPx(vertex), accPy(vertex), accPz(vertex)); } else { for (unsigned int i = 0; i < vertex.nTrackParticles(); ++i) { - momentum += getMomentumAtVertex(vertex, i); + momentum += getMomentumAtVertex(ctx, vertex, i); } } return momentum; @@ -407,7 +458,8 @@ EMExtrapolationTools::getMomentumAtVertex(const xAOD::Vertex& vertex, bool reuse * Create Rescaled Perigee Parametrs */ Trk::Perigee -EMExtrapolationTools::getRescaledPerigee(const xAOD::TrackParticle& trkPB, const xAOD::CaloCluster& cluster) const +EMExtrapolationTools::getRescaledPerigee(const xAOD::TrackParticle& trkPB, + const xAOD::CaloCluster& cluster) const { /* @@ -417,25 +469,29 @@ EMExtrapolationTools::getRescaledPerigee(const xAOD::TrackParticle& trkPB, const * Then replace the q/p with q/cluster->e() * e.g create a new Perigee with q/cluster->e() rather than track->p() */ - return Trk::Perigee(trkPB.d0(), - trkPB.z0(), - trkPB.phi0(), - trkPB.theta(), - trkPB.charge() / cluster.e(), - Trk::PerigeeSurface(Amg::Vector3D(trkPB.vx(), trkPB.vy(), trkPB.vz()))); + return Trk::Perigee( + trkPB.d0(), + trkPB.z0(), + trkPB.phi0(), + trkPB.theta(), + trkPB.charge() / cluster.e(), + Trk::PerigeeSurface(Amg::Vector3D(trkPB.vx(), trkPB.vy(), trkPB.vz()))); } /* * Helper to get the Eta/Phi intersections per Layer */ CaloExtensionHelpers::EtaPhiPerLayerVector -EMExtrapolationTools::getIntersections(const Trk::CaloExtension& extension, const xAOD::CaloCluster& cluster) const +EMExtrapolationTools::getIntersections(const Trk::CaloExtension& extension, + const xAOD::CaloCluster& cluster) const { // Layers to calculate intersections CaloExtensionHelpers::EtaPhiPerLayerVector intersections; if (xAOD::EgammaHelpers::isBarrel(&cluster)) { - CaloExtensionHelpers::midPointEtaPhiPerLayerVector(extension, intersections, &barrelLayers); + CaloExtensionHelpers::midPointEtaPhiPerLayerVector( + extension, intersections, &barrelLayers); } else { - CaloExtensionHelpers::midPointEtaPhiPerLayerVector(extension, intersections, &endCapLayers); + CaloExtensionHelpers::midPointEtaPhiPerLayerVector( + extension, intersections, &endCapLayers); } return intersections; } @@ -450,24 +506,29 @@ EMExtrapolationTools::getTRTsection(const xAOD::TrackParticle* trkPB) const return 0; } if (!m_trtId) { - ATH_MSG_DEBUG("No trt ID guessing TRT section based on eta: " << trkPB->eta()); + ATH_MSG_DEBUG( + "No trt ID guessing TRT section based on eta: " << trkPB->eta()); return (trkPB->eta() > 0 ? 1 : -1) * (fabs(trkPB->eta()) < 0.6 ? 1 : 2); } const Trk::MeasurementBase* trkPar = nullptr; if (trkPB->trackLink().isValid() && trkPB->track() != nullptr) { ATH_MSG_DEBUG("Will get TrackParameters from Trk::Track"); - const DataVector* trackStates = trkPB->track()->trackStateOnSurfaces(); + const DataVector* trackStates = + trkPB->track()->trackStateOnSurfaces(); if (!trackStates) { ATH_MSG_WARNING("NULL pointer to trackStateOnSurfaces"); return 0; } // Loop over the TrkStateOnSurfaces search last valid TSOS first - for (DataVector::const_reverse_iterator rItTSoS = trackStates->rbegin(); + for (DataVector::const_reverse_iterator + rItTSoS = trackStates->rbegin(); rItTSoS != trackStates->rend(); ++rItTSoS) { if ((*rItTSoS)->type(Trk::TrackStateOnSurface::Measurement) && - !((*rItTSoS)->type(Trk::TrackStateOnSurface::Outlier)) && (*rItTSoS)->measurementOnTrack() != nullptr && - !((*rItTSoS)->measurementOnTrack()->type(Trk::MeasurementBaseType::PseudoMeasurementOnTrack))) { + !((*rItTSoS)->type(Trk::TrackStateOnSurface::Outlier)) && + (*rItTSoS)->measurementOnTrack() != nullptr && + !((*rItTSoS)->measurementOnTrack()->type( + Trk::MeasurementBaseType::PseudoMeasurementOnTrack))) { trkPar = (*rItTSoS)->measurementOnTrack(); break; } diff --git a/Reconstruction/egamma/egammaTrackTools/src/EMExtrapolationTools.h b/Reconstruction/egamma/egammaTrackTools/src/EMExtrapolationTools.h index 4438b1918f5..5cd63e0601c 100644 --- a/Reconstruction/egamma/egammaTrackTools/src/EMExtrapolationTools.h +++ b/Reconstruction/egamma/egammaTrackTools/src/EMExtrapolationTools.h @@ -1,10 +1,10 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef EGAMMATRACKTOOLS_EMEXTRAPOLATIONTOOLS_H #define EGAMMATRACKTOOLS_EMEXTRAPOLATIONTOOLS_H -/** +/** @class EMExtrapolationTools Tools for track extrapolation to the calorimeter @author Thomas Koffas, Christos Anastopoulos @@ -17,8 +17,8 @@ PURPOSE: Tool which propagate track and vertices to the calorimeter cluster ********************************************************************/ #include "AthenaBaseComps/AthAlgTool.h" -#include "GaudiKernel/ToolHandle.h" #include "GaudiKernel/EventContext.h" +#include "GaudiKernel/ToolHandle.h" #include "StoreGate/ReadHandleKey.h" #include "egammaInterfaces/IEMExtrapolationTools.h" @@ -29,26 +29,28 @@ PURPOSE: Tool which propagate track and vertices to the calorimeter cluster #include "xAODTracking/TrackParticleFwd.h" #include "xAODTracking/VertexFwd.h" -#include "TrkCaloExtension/CaloExtensionHelpers.h" -#include "TrkCaloExtension/CaloExtensionCollection.h" #include "RecoToolInterfaces/IParticleCaloExtensionTool.h" +#include "TrkCaloExtension/CaloExtensionCollection.h" +#include "TrkCaloExtension/CaloExtensionHelpers.h" #include "TrkExInterfaces/IExtrapolator.h" class TRT_ID; class CaloDepthTool; -namespace Trk -{ +namespace Trk { class INeutralParticleParameterCalculator; } - -class EMExtrapolationTools final : virtual public IEMExtrapolationTools, public AthAlgTool { +class EMExtrapolationTools final + : virtual public IEMExtrapolationTools + , public AthAlgTool +{ public: - /** @brief Constructor with parameters */ - EMExtrapolationTools (const std::string& type,const std::string& name, const IInterface* parent); + EMExtrapolationTools(const std::string& type, + const std::string& name, + const IInterface* parent); /** @brief Destructor */ virtual ~EMExtrapolationTools(); @@ -57,96 +59,133 @@ public: /** @brief finalize method */ virtual StatusCode finalize() override final; - typedef std::unordered_map> Cache; + typedef std::unordered_map> Cache; /** get eta, phi, deltaEta, and deltaPhi at the four calorimeter * layers given the Trk::ParametersBase. */ - virtual StatusCode getMatchAtCalo (const EventContext& ctx, - const xAOD::CaloCluster& cluster, - const xAOD::TrackParticle& trkPB, - Trk::PropDirection direction, - std::array& eta, - std::array& phi, - std::array& deltaEta, - std::array& deltaPhi, - unsigned int extrapFrom = fromPerigee, - Cache* cache=nullptr) const override final; - - /** test for vertex-to-cluster match given also the positions + virtual StatusCode getMatchAtCalo( + const EventContext& ctx, + const xAOD::CaloCluster& cluster, + const xAOD::TrackParticle& trkPB, + Trk::PropDirection direction, + std::array& eta, + std::array& phi, + std::array& deltaEta, + std::array& deltaPhi, + unsigned int extrapFrom = fromPerigee, + Cache* cache = nullptr) const override final; + + /** test for vertex-to-cluster match given also the positions at the calorimeter from the vertex extrapolation **/ virtual bool matchesAtCalo(const xAOD::CaloCluster* cluster, - const xAOD::Vertex *vertex, + const xAOD::Vertex* vertex, float etaAtCalo, - float phiAtCalo) const override final; + float phiAtCalo) const override final; - - /** get eta, phi at EM2 given a vertex which is converted to NeutralParameters. - Return false if the extrapolation fails **/ - virtual bool getEtaPhiAtCalo (const xAOD::Vertex* vertex, - float *etaAtCalo, - float *phiAtCalo) const override final; + /** get eta, phi at EM2 given a vertex which is converted to + NeutralParameters. Return false if the extrapolation fails **/ + virtual bool getEtaPhiAtCalo(const EventContext& ctx, + const xAOD::Vertex* vertex, + float* etaAtCalo, + float* phiAtCalo) const override final; /** get eta, phi at EM2 given NeutralParameters. Return false if the extrapolation fails **/ - virtual bool getEtaPhiAtCalo (const Trk::TrackParameters* trkPar, - float *etaAtCalo, - float *phiAtCalo) const override final; + virtual bool getEtaPhiAtCalo(const EventContext& ctx, + const Trk::TrackParameters* trkPar, + float* etaAtCalo, + float* phiAtCalo) const override final; - /** get the momentum of the i-th trackParticle assiciated to the vertex + /** get the momentum of the i-th trackParticle assiciated to the vertex * at vertex (designed for conversions) **/ - Amg::Vector3D getMomentumAtVertex(const xAOD::Vertex&, unsigned int) const override final; + Amg::Vector3D getMomentumAtVertex(const EventContext& ctx, + const xAOD::Vertex&, + unsigned int) const override final; - /** get sum of the momenta at the vertex (designed for conversions). + /** get sum of the momenta at the vertex (designed for conversions). * Retrieve from auxdata if available and \ is true **/ - Amg::Vector3D getMomentumAtVertex(const xAOD::Vertex&, bool reuse = true) const override final; - + Amg::Vector3D getMomentumAtVertex(const EventContext& ctx, + const xAOD::Vertex&, + bool reuse = true) const override final; private: - - /** @Helper to get the per Layer Intersections **/ - CaloExtensionHelpers::EtaPhiPerLayerVector getIntersections (const Trk::CaloExtension& extension, - const xAOD::CaloCluster& cluster) const; - - /** @Perform the Rescaling of the perigee parameters with the cluster energy **/ - Trk::Perigee getRescaledPerigee(const xAOD::TrackParticle& trkPB, const xAOD::CaloCluster& cluster) const; - - /** @brief Return +/- 1 (2) if track is in positive/negative TRT barrel (endcap) **/ + /** @Helper to get the per Layer Intersections **/ + CaloExtensionHelpers::EtaPhiPerLayerVector getIntersections( + const Trk::CaloExtension& extension, + const xAOD::CaloCluster& cluster) const; + + /** @Perform the Rescaling of the perigee parameters with the cluster energy + * **/ + Trk::Perigee getRescaledPerigee(const xAOD::TrackParticle& trkPB, + const xAOD::CaloCluster& cluster) const; + + /** @brief Return +/- 1 (2) if track is in positive/negative TRT barrel + * (endcap) **/ int getTRTsection(const xAOD::TrackParticle* trkPB) const; - ToolHandle m_lastParticleCaloExtensionTool {this, - "LastCaloExtensionTool", "Trk::ParticleCaloExtensionTool/EMLastCaloExtensionTool"}; - - ToolHandle m_perigeeParticleCaloExtensionTool {this, - "PerigeeCaloExtensionTool", "Trk::ParticleCaloExtensionTool/EMParticleCaloExtensionTool"}; - - ToolHandle m_extrapolator {this, - "Extrapolator", "Trk::Extrapolator/AtlasExtrapolator"}; + ToolHandle m_lastParticleCaloExtensionTool{ + this, + "LastCaloExtensionTool", + "Trk::ParticleCaloExtensionTool/EMLastCaloExtensionTool" + }; + + ToolHandle + m_perigeeParticleCaloExtensionTool{ + this, + "PerigeeCaloExtensionTool", + "Trk::ParticleCaloExtensionTool/EMParticleCaloExtensionTool" + }; + + ToolHandle m_extrapolator{ + this, + "Extrapolator", + "Trk::Extrapolator/AtlasExtrapolator" + }; // vertex-to-cluster match cuts used in matchesAtCalo - Gaudi::Property m_narrowDeltaPhi{this, "NarrowDeltaPhi", 0.05}; - Gaudi::Property m_narrowDeltaPhiTRTbarrel{this, - "NarrowDeltaPhiTRTbarrel", 0.02}; - Gaudi::Property m_narrowDeltaPhiTRTendcap{this, - "NarrowDeltaPhiTRTendcap", 0.02}; - Gaudi::Property m_narrowDeltaEta{this, "NarrowDeltaEta", 0.05}; - Gaudi::Property m_TRTbarrelDeltaEta{this, "TRTbarrelDeltaEta", 0.35}; - Gaudi::Property m_TRTendcapDeltaEta{this, "TRTendcapDeltaEta", 0.2}; + Gaudi::Property m_narrowDeltaPhi{ this, "NarrowDeltaPhi", 0.05 }; + Gaudi::Property m_narrowDeltaPhiTRTbarrel{ this, + "NarrowDeltaPhiTRTbarrel", + 0.02 }; + Gaudi::Property m_narrowDeltaPhiTRTendcap{ this, + "NarrowDeltaPhiTRTendcap", + 0.02 }; + Gaudi::Property m_narrowDeltaEta{ this, "NarrowDeltaEta", 0.05 }; + Gaudi::Property m_TRTbarrelDeltaEta{ this, + "TRTbarrelDeltaEta", + 0.35 }; + Gaudi::Property m_TRTendcapDeltaEta{ this, "TRTendcapDeltaEta", 0.2 }; // ID TRT helper - const TRT_ID* m_trtId; - - //Cache collections for GSF Track Particle extrapolation Perigee - SG::ReadHandleKey m_PerigeeCacheKey{this, - "PerigeeCache", "PerigeeCaloExtension", "Name of GSF Perigee extrapolation cache"}; - SG::ReadHandleKey m_LastCacheKey{this, - "LastCache", "LastCaloExtension", "Name of Last measurement extrapolation cache"}; - - //Use a cache for Track Particle extrapolation - Gaudi::Property m_usePerigeeCaching {this, - "useCaching", false, "Use a CaloExtension Collection as cache from Perigee"}; - Gaudi::Property m_useLastCaching {this, - "useLastCaching", false, "Use a CaloExtension Collection as cache"}; + const TRT_ID* m_trtId; + + // Cache collections for GSF Track Particle extrapolation Perigee + SG::ReadHandleKey m_PerigeeCacheKey{ + this, + "PerigeeCache", + "PerigeeCaloExtension", + "Name of GSF Perigee extrapolation cache" + }; + SG::ReadHandleKey m_LastCacheKey{ + this, + "LastCache", + "LastCaloExtension", + "Name of Last measurement extrapolation cache" + }; + + // Use a cache for Track Particle extrapolation + Gaudi::Property m_usePerigeeCaching{ + this, + "useCaching", + false, + "Use a CaloExtension Collection as cache from Perigee" + }; + Gaudi::Property m_useLastCaching{ + this, + "useLastCaching", + false, + "Use a CaloExtension Collection as cache" + }; }; - #endif -- GitLab From dcf2393556332a08dcbb13180325d2c5b02d52f4 Mon Sep 17 00:00:00 2001 From: Nicolas Koehler Date: Wed, 10 Jun 2020 09:49:52 +0000 Subject: [PATCH 35/38] Cleanup of MuonCombined packages --- .../src/MuonCombinedMuonCandidateAlg.cxx | 14 +--------- .../src/MuonCombinedMuonCandidateAlg.h | 10 +++---- .../src/MuonCandidateTool.cxx | 26 ++++++------------- .../src/MuonCandidateTool.h | 25 ++++++------------ 4 files changed, 20 insertions(+), 55 deletions(-) diff --git a/Reconstruction/MuonIdentification/MuonCombinedAlgs/src/MuonCombinedMuonCandidateAlg.cxx b/Reconstruction/MuonIdentification/MuonCombinedAlgs/src/MuonCombinedMuonCandidateAlg.cxx index 81879daf093..060d710d458 100644 --- a/Reconstruction/MuonIdentification/MuonCombinedAlgs/src/MuonCombinedMuonCandidateAlg.cxx +++ b/Reconstruction/MuonIdentification/MuonCombinedAlgs/src/MuonCombinedMuonCandidateAlg.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include "MuonCombinedMuonCandidateAlg.h" @@ -11,9 +11,6 @@ MuonCombinedMuonCandidateAlg::MuonCombinedMuonCandidateAlg(const std::string& na declareProperty("MuonCandidateTool", m_muonCandidateTool); } -MuonCombinedMuonCandidateAlg::~MuonCombinedMuonCandidateAlg() -{} - StatusCode MuonCombinedMuonCandidateAlg::initialize() { ATH_CHECK(m_muonCandidateTool.retrieve()); @@ -25,7 +22,6 @@ StatusCode MuonCombinedMuonCandidateAlg::initialize() StatusCode MuonCombinedMuonCandidateAlg::execute() { - // retrieve MuonSpectrometer tracks SG::ReadHandle muonTrackParticles(m_muonTrackParticleLocation); if(!muonTrackParticles.isValid()){ @@ -36,18 +32,10 @@ StatusCode MuonCombinedMuonCandidateAlg::execute() ATH_MSG_WARNING(m_muonTrackParticleLocation<<" not present"); return StatusCode::SUCCESS; } - SG::WriteHandle muonCandidates(m_candidateCollectionName); ATH_CHECK(muonCandidates.record(std::make_unique())); SG::WriteHandle msOnlyTracks(m_msOnlyTracks); ATH_CHECK(msOnlyTracks.record(std::make_unique())); m_muonCandidateTool->create(*muonTrackParticles,*muonCandidates,*msOnlyTracks); - - return StatusCode::SUCCESS; -} - - -StatusCode MuonCombinedMuonCandidateAlg::finalize() -{ return StatusCode::SUCCESS; } diff --git a/Reconstruction/MuonIdentification/MuonCombinedAlgs/src/MuonCombinedMuonCandidateAlg.h b/Reconstruction/MuonIdentification/MuonCombinedAlgs/src/MuonCombinedMuonCandidateAlg.h index 2399c955958..9b87317b46b 100644 --- a/Reconstruction/MuonIdentification/MuonCombinedAlgs/src/MuonCombinedMuonCandidateAlg.h +++ b/Reconstruction/MuonIdentification/MuonCombinedAlgs/src/MuonCombinedMuonCandidateAlg.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef MUONCOMBINEDALGS_MUONCOMBINEDMUONCANDIDATEALG_H @@ -13,22 +13,18 @@ #include "MuonCombinedEvent/MuonCandidateCollection.h" #include "MuonCombinedToolInterfaces/IMuonCandidateTool.h" #include "TrkTrack/TrackCollection.h" -#include -namespace MuonCombined { - class IMuonCandidateTool; -} +#include class MuonCombinedMuonCandidateAlg : public AthAlgorithm { public: MuonCombinedMuonCandidateAlg(const std::string& name, ISvcLocator* pSvcLocator); - ~MuonCombinedMuonCandidateAlg(); + ~MuonCombinedMuonCandidateAlg()=default; StatusCode initialize(); StatusCode execute(); - StatusCode finalize(); private: ToolHandle m_muonCandidateTool; diff --git a/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/MuonCandidateTool.cxx b/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/MuonCandidateTool.cxx index 9317c22cf42..2e36749dbaf 100644 --- a/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/MuonCandidateTool.cxx +++ b/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/MuonCandidateTool.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ ////////////////////////////////////////////////////////////////////////////// @@ -11,11 +11,6 @@ ////////////////////////////////////////////////////////////////////////////// #include "MuonCandidateTool.h" -#include "MuidInterfaces/ICombinedMuonTrackBuilder.h" -#include "MuonRecHelperTools/MuonEDMPrinterTool.h" -#include "TrkToolInterfaces/ITrackAmbiguityProcessorTool.h" -#include "MuonRecToolInterfaces/IMuonTrackExtrapolationTool.h" - namespace MuonCombined { @@ -36,14 +31,11 @@ namespace MuonCombined { declareProperty("AmbiguityProcessor",m_ambiguityProcessor ); } - MuonCandidateTool::~MuonCandidateTool() - {} - //<<<<<< PUBLIC MEMBER FUNCTION DEFINITIONS >>>>>> StatusCode MuonCandidateTool::initialize() { ATH_CHECK(m_printer.retrieve()); - if( !m_trackBuilder.empty() ) ATH_CHECK(m_trackBuilder.retrieve()); + if( !m_trackBuilder.empty()) ATH_CHECK(m_trackBuilder.retrieve()); else m_trackBuilder.disable(); if( !m_trackExtrapolationTool.empty() ) ATH_CHECK(m_trackExtrapolationTool.retrieve()); else m_trackExtrapolationTool.disable(); @@ -52,10 +44,6 @@ namespace MuonCombined { return StatusCode::SUCCESS; } - StatusCode MuonCandidateTool::finalize() { - return StatusCode::SUCCESS; - } - void MuonCandidateTool::create( const xAOD::TrackParticleContainer& tracks, MuonCandidateCollection& outputCollection, TrackCollection& outputTracks ) { ATH_MSG_DEBUG("Producing MuonCandidates for " << tracks.size() ); unsigned int ntracks = 0; @@ -65,7 +53,7 @@ namespace MuonCombined { float beamSpotY = beamSpotHandle->beamPos()[Amg::y]; float beamSpotZ = beamSpotHandle->beamPos()[Amg::z]; - ATH_MSG_DEBUG( " Beamspot position bs_x " << beamSpotX << " bs_y " << beamSpotY << " bs_z " << beamSpotZ); + ATH_MSG_DEBUG("Beamspot position bs_x=" << beamSpotX << ", bs_y=" << beamSpotY << ", bs_z=" << beamSpotZ); // Temporary collection for extrapolated tracks and links with correspondent MS tracks std::map, Trk::Track*> > trackLinks; @@ -81,15 +69,17 @@ namespace MuonCombined { continue; } ElementLink trackLink(tracks,index++); - //trackLink.toPersistent(); const Trk::Track& msTrack = *track->track(); ATH_MSG_VERBOSE("Re-Fitting track " << std::endl << m_printer->print(msTrack) << std::endl << m_printer->printStations(msTrack)); Trk::Track* standaloneTrack = 0; const Trk::Vertex* vertex = 0; - if( m_extrapolationStrategy == 0 ) standaloneTrack = m_trackBuilder->standaloneFit(msTrack, vertex, beamSpotX, beamSpotY, beamSpotZ); - else standaloneTrack = m_trackExtrapolationTool->extrapolate(msTrack); + if( m_extrapolationStrategy == 0 ) { + standaloneTrack = m_trackBuilder->standaloneFit(msTrack, vertex, beamSpotX, beamSpotY, beamSpotZ); + } else { + standaloneTrack = m_trackExtrapolationTool->extrapolate(msTrack); + } if (standaloneTrack) { standaloneTrack->info().setParticleHypothesis(Trk::muon); standaloneTrack->info().setPatternRecognitionInfo(Trk::TrackInfo::MuidStandAlone); diff --git a/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/MuonCandidateTool.h b/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/MuonCandidateTool.h index 065a0fa3ab7..29a84b2b5b4 100644 --- a/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/MuonCandidateTool.h +++ b/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/MuonCandidateTool.h @@ -5,25 +5,17 @@ #ifndef MUONCOMBINEDBASETOOLS_MUONCANDIDATETOOL_H #define MUONCOMBINEDBASETOOLS_MUONCANDIDATETOOL_H +#include "MuonCombinedToolInterfaces/IMuonCandidateTool.h" #include "AthenaBaseComps/AthAlgTool.h" #include "GaudiKernel/ToolHandle.h" -#include "MuonCombinedToolInterfaces/IMuonCandidateTool.h" + #include "xAODTracking/TrackParticleContainer.h" -#include "MuonCombinedEvent/InDetCandidateCollection.h" -#include "StoreGate/ReadHandleKey.h" +#include "StoreGate/ReadCondHandleKey.h" #include "BeamSpotConditionsData/BeamSpotData.h" - -namespace Trk { - class ITrackAmbiguityProcessorTool; -} - -namespace Rec { - class ICombinedMuonTrackBuilder; -} -namespace Muon { - class MuonEDMPrinterTool; - class IMuonTrackExtrapolationTool; -} +#include "TrkToolInterfaces/ITrackAmbiguityProcessorTool.h" +#include "MuidInterfaces/ICombinedMuonTrackBuilder.h" +#include "MuonRecHelperTools/MuonEDMPrinterTool.h" +#include "MuonRecToolInterfaces/IMuonTrackExtrapolationTool.h" namespace MuonCombined { @@ -32,10 +24,9 @@ namespace MuonCombined { public: MuonCandidateTool(const std::string& type, const std::string& name, const IInterface* parent); - virtual ~MuonCandidateTool(void); // destructor + virtual ~MuonCandidateTool()=default; virtual StatusCode initialize() override; - virtual StatusCode finalize() override; /**IMuonCandidateTool interface: build a MuonCandidateCollection from a TrackCollection of spectrometer tracks */ virtual -- GitLab From bc685811407c0b71fed7cd890e7233a79516b7c6 Mon Sep 17 00:00:00 2001 From: Tim Martin Date: Wed, 10 Jun 2020 09:50:43 +0000 Subject: [PATCH 36/38] [ATR-19256] Make CostMon service execution dependent on CostMon chain --- .../TrigCostMonitorMT/share/TrigCostMonitorMT_jobOptions.py | 2 +- .../TrigCostMonitorMT/src/TrigCostDataStore.icc | 4 ++-- .../TriggerCommon/TriggerJobOpts/python/TriggerConfigFlags.py | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Trigger/TrigMonitoring/TrigCostMonitorMT/share/TrigCostMonitorMT_jobOptions.py b/Trigger/TrigMonitoring/TrigCostMonitorMT/share/TrigCostMonitorMT_jobOptions.py index 176ac51520a..d50981472fa 100644 --- a/Trigger/TrigMonitoring/TrigCostMonitorMT/share/TrigCostMonitorMT_jobOptions.py +++ b/Trigger/TrigMonitoring/TrigCostMonitorMT/share/TrigCostMonitorMT_jobOptions.py @@ -15,7 +15,7 @@ from AthenaConfiguration.AllConfigFlags import ConfigFlags if ConfigFlags.Trigger.CostMonitoring.doCostMonitoring: trigCostService = TrigCostMTSvc() - trigCostService.MonitorAllEvents = True + trigCostService.MonitorAllEvents = ConfigFlags.Trigger.CostMonitoring.monitorAllEvents trigCostService.SaveHashes = True # This option will go away once the TrigConfigSvc is fully up & running ServiceMgr += trigCostService diff --git a/Trigger/TrigMonitoring/TrigCostMonitorMT/src/TrigCostDataStore.icc b/Trigger/TrigMonitoring/TrigCostMonitorMT/src/TrigCostDataStore.icc index 69077edb021..615552518e9 100644 --- a/Trigger/TrigMonitoring/TrigCostMonitorMT/src/TrigCostDataStore.icc +++ b/Trigger/TrigMonitoring/TrigCostMonitorMT/src/TrigCostDataStore.icc @@ -23,8 +23,8 @@ StatusCode TrigCostDataStore::insert(const AlgorithmIdentifier& ai, con if (mapReference.insert(acc, ai)) { // Obtains lock on the key value 'name' until 'acc' goes out of scope or calls release() acc->second = payload; - } else if (msg.level() <= MSG::WARNING) { - msg << MSG::WARNING << "Key caller:'" << ai.m_caller << "' store:'" << ai.m_store + } else if (msg.level() <= MSG::DEBUG) { + msg << MSG::DEBUG << "Key caller:'" << ai.m_caller << "' store:'" << ai.m_store << "' slot:" << ai.m_realSlot <<" already in the TrigCostDataStore" << endmsg; } return StatusCode::SUCCESS; diff --git a/Trigger/TriggerCommon/TriggerJobOpts/python/TriggerConfigFlags.py b/Trigger/TriggerCommon/TriggerJobOpts/python/TriggerConfigFlags.py index c744bd8e006..424342251df 100644 --- a/Trigger/TriggerCommon/TriggerJobOpts/python/TriggerConfigFlags.py +++ b/Trigger/TriggerCommon/TriggerJobOpts/python/TriggerConfigFlags.py @@ -105,9 +105,9 @@ def createTriggerFlags(): # Enables collection and export of detailed monitoring data of the HLT execution flags.addFlag('Trigger.CostMonitoring.doCostMonitoring', False) - flags.addFlag('Trigger.CostMonitoring.chain', 'HLT_costmonitor') + flags.addFlag('Trigger.CostMonitoring.chain', 'HLT_costmonitor_CostMonDS_L1All') flags.addFlag('Trigger.CostMonitoring.outputCollection', 'HLT_TrigCostContainer') - flags.addFlag('Trigger.CostMonitoring.monitorAllEvents', True) # Defaulting to "True" is temporary + flags.addFlag('Trigger.CostMonitoring.monitorAllEvents', False) # enable Bcm inputs simulation -- GitLab From bcc2e780d5af60df260ecbce06608694a224b641 Mon Sep 17 00:00:00 2001 From: Christos Anastopoulos Date: Wed, 10 Jun 2020 11:38:12 +0000 Subject: [PATCH 37/38] Make IVertexFinder() and findVertex() const --- .../ATLAS_CHECK_THREAD_SAFETY | 1 + .../ConversionFinderUtils.h | 31 +- .../ConversionPostSelector.h | 35 +- .../InDetConversionFinderTools.h | 222 +++++--- .../SingleTrackConversionTool.h | 16 +- .../TrackPairsSelector.h | 38 +- .../src/ConversionFinderUtils.cxx | 118 ++-- .../src/ConversionPostSelector.cxx | 43 +- .../src/InDetConversionFinderTools.cxx | 445 ++++++++------- .../src/SingleTrackConversionTool.cxx | 271 +++++---- .../src/TrackPairsSelector.cxx | 86 +-- .../src/VertexPointEstimator.cxx | 12 +- .../InDetPriVxFinderTool/CMakeLists.txt | 10 +- .../InDetAdaptiveMultiPriVxFinderTool.h | 515 +++++++++--------- .../InDetAdaptivePriVxFinderTool.h | 167 +++--- .../InDetIterativePriVxFinderTool.h | 190 ++++--- .../InDetMultiPriVxFinderTool.h | 36 +- .../InDetPriVxFinderTool.h | 164 +++--- .../src/InDetAdaptiveMultiPriVxFinderTool.cxx | 132 ++--- .../src/InDetAdaptivePriVxFinderTool.cxx | 57 +- .../src/InDetIterativePriVxFinderTool.cxx | 143 ++--- .../src/InDetMultiPriVxFinderTool.cxx | 38 +- .../src/InDetPriVxFinderTool.cxx | 60 +- .../InDetRecToolInterfaces/IVertexFinder.h | 117 ++-- .../InDetVKalPriVxFinderTool/CMakeLists.txt | 5 +- .../InDetVKalPriVxFinderTool.h | 458 +++++++++------- .../InDetVKalPriVxFinderTool/src/CutTrk.cxx | 44 +- .../src/InDetVKalPriVxFinder.cxx | 296 +++++----- .../InDetVKalPriVxFinderTool/src/PVrtFind.cxx | 314 ++++++----- .../InDetVKalPriVxFinderTool/src/PVrtFit.cxx | 430 +++++++++------ .../src/Utilities.cxx | 198 ++++--- .../InDetZVTOPVxFinder/ZVTOP_Tool.h | 20 +- .../src/ZVTOP_SecVtxTool.cxx | 64 +-- .../src/ZVTOP_SlowSpatialPointFinder.cxx | 56 +- .../src/ZVTOP_SpatialPointFinder.cxx | 52 +- .../InDetZVTOPVxFinder/src/ZVTOP_Tool.cxx | 94 ++-- .../src/ZVTOP_TrkProbTubeCalc.cxx | 6 +- 37 files changed, 2811 insertions(+), 2173 deletions(-) create mode 100644 InnerDetector/InDetRecTools/InDetConversionFinderTools/InDetConversionFinderTools/ATLAS_CHECK_THREAD_SAFETY diff --git a/InnerDetector/InDetRecTools/InDetConversionFinderTools/InDetConversionFinderTools/ATLAS_CHECK_THREAD_SAFETY b/InnerDetector/InDetRecTools/InDetConversionFinderTools/InDetConversionFinderTools/ATLAS_CHECK_THREAD_SAFETY new file mode 100644 index 00000000000..8ee23b54bd0 --- /dev/null +++ b/InnerDetector/InDetRecTools/InDetConversionFinderTools/InDetConversionFinderTools/ATLAS_CHECK_THREAD_SAFETY @@ -0,0 +1 @@ +InnerDetector/InDetRecTools/InDetConversionFinderTools diff --git a/InnerDetector/InDetRecTools/InDetConversionFinderTools/InDetConversionFinderTools/ConversionFinderUtils.h b/InnerDetector/InDetRecTools/InDetConversionFinderTools/InDetConversionFinderTools/ConversionFinderUtils.h index ed30e903d42..c72c38172d9 100644 --- a/InnerDetector/InDetRecTools/InDetConversionFinderTools/InDetConversionFinderTools/ConversionFinderUtils.h +++ b/InnerDetector/InDetRecTools/InDetConversionFinderTools/InDetConversionFinderTools/ConversionFinderUtils.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef INDETCONVERSIONFINDERTOOLS_CONVERSIONFINDERUTILS_H @@ -33,29 +33,34 @@ namespace InDet { static const InterfaceID& interfaceID(); - virtual StatusCode initialize(); + virtual StatusCode initialize() override; - virtual StatusCode finalize(); + virtual StatusCode finalize() override; /** helper functions */ /** Hit counter. */ - void countHits(const DataVector* mb, int& ntrt, int& nclus); + void countHits(const DataVector* mb, + int& ntrt, + int& nclus) const; /** Estimate ratio of high-to-low level TRT hits. */ - double trRatio(const DataVector* mb); + double trRatio(const DataVector* mb) const; /** Momentum fraction of tracks in pair. */ - double momFraction(const Trk::TrackParameters* per1, const Trk::TrackParameters* per2); + double momFraction(const Trk::TrackParameters* per1, + const Trk::TrackParameters* per2) const; /** Approximate distance of minimum approach between tracks in pair. */ - double distBetweenTracks(const Trk::Track *trk_pos, const Trk::Track *trk_neg); + double distBetweenTracks(const Trk::Track* trk_pos, + const Trk::Track* trk_neg) const; /** Get measured track parameters at first hit. Trk::Track interface. */ - const Trk::TrackParameters* getTrkParameters(const Trk::Track* track); + const Trk::TrackParameters* getTrkParameters(const Trk::Track* track) const; /** Add new perigee to track. */ - const Trk::Track* addNewPerigeeToTrack(const Trk::Track* track, const Trk::Perigee* mp); + const Trk::Track* addNewPerigeeToTrack(const Trk::Track* track, + const Trk::Perigee* mp) const; /** Correct VxCandidate with respect to a user defined vertex. */ - xAOD::Vertex* correctVxCandidate(xAOD::Vertex*,Amg::Vector3D); + xAOD::Vertex* correctVxCandidate(xAOD::Vertex*, Amg::Vector3D) const; /** Get measured track parameters at first hit. Trk::TrackParticleBase interface. */ - const Trk::TrackParameters* getTrkParticleParameters(const Trk::TrackParticleBase*); - private: - + const Trk::TrackParameters* getTrkParticleParameters( + const Trk::TrackParticleBase*) const; + }; } diff --git a/InnerDetector/InDetRecTools/InDetConversionFinderTools/InDetConversionFinderTools/ConversionPostSelector.h b/InnerDetector/InDetRecTools/InDetConversionFinderTools/InDetConversionFinderTools/ConversionPostSelector.h index 44c223cc4f9..c6fb2656484 100644 --- a/InnerDetector/InDetRecTools/InDetConversionFinderTools/InDetConversionFinderTools/ConversionPostSelector.h +++ b/InnerDetector/InDetRecTools/InDetConversionFinderTools/InDetConversionFinderTools/ConversionPostSelector.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef INDETCONVERSIONFINDERTOOLS_CONVERSIONPOSTSELECTOR_H @@ -33,16 +33,27 @@ namespace InDet { virtual ~ConversionPostSelector(); static const InterfaceID& interfaceID(); - virtual StatusCode initialize(); - virtual StatusCode finalize(); - - /** Conversion candidate post-fit selectors. Return true if the argument track fulfills the selection*/ - bool selectConversionCandidate(xAOD::Vertex * myCandidate, int flag, std::vector& trkL); - bool selectSecVtxCandidate(xAOD::Vertex * myCandidate, int flag, std::vector& trkL, int&); - + virtual StatusCode initialize() override; + virtual StatusCode finalize() override; + + /** Conversion candidate post-fit selectors. Return true if the argument + * track fulfills the selection*/ + bool selectConversionCandidate(xAOD::Vertex* myCandidate, + int flag, + std::vector& trkL) const; + bool selectSecVtxCandidate(xAOD::Vertex* myCandidate, + int flag, + std::vector& trkL, + int&) const; + /** Decorate vertices with values used in post selector **/ - void decorateVertex(xAOD::Vertex &vertex, float inv_mass, float pt1, float pt2, float fR, float deltaPhiVtxTrk); - + void decorateVertex(xAOD::Vertex& vertex, + float inv_mass, + float pt1, + float pt2, + float fR, + float deltaPhiVtxTrk) const; + private: /** Properties for track selection: all cuts are ANDed */ @@ -64,10 +75,10 @@ namespace InDet { int m_nsig ; /** struct of Particle Masses */ - static Trk::ParticleMasses s_particleMasses; + static const Trk::ParticleMasses s_particleMasses; /** Compute the four-momentum of a particle according to a mass hypothesis. */ - CLHEP::HepLorentzVector fourP(const Trk::TrackParameters&, const Trk::TrackParameters&, double, bool); + CLHEP::HepLorentzVector fourP(const Trk::TrackParameters&, const Trk::TrackParameters&, double, bool) const; }; } diff --git a/InnerDetector/InDetRecTools/InDetConversionFinderTools/InDetConversionFinderTools/InDetConversionFinderTools.h b/InnerDetector/InDetRecTools/InDetConversionFinderTools/InDetConversionFinderTools/InDetConversionFinderTools.h index 65b8c77ff88..94f175383f3 100755 --- a/InnerDetector/InDetRecTools/InDetConversionFinderTools/InDetConversionFinderTools/InDetConversionFinderTools.h +++ b/InnerDetector/InDetRecTools/InDetConversionFinderTools/InDetConversionFinderTools/InDetConversionFinderTools.h @@ -1,100 +1,166 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /*************************************************************************** - InDetConversionFinderTools.h - Description - ------------------- - begin : 28-08-2006 - authors : Tatjana Lenz - email : tatjana.lenz@cern.ch - changes : + InDetConversionFinderTools.h - Description + ------------------- + begin : 28-08-2006 + authors : Tatjana Lenz + email : tatjana.lenz@cern.ch + changes : ***************************************************************************/ #ifndef INDETCONVERSIONFINDERTOOLS_INDETCONVERSIONFINDERTOOLS_H #define INDETCONVERSIONFINDERTOOLS_INDETCONVERSIONFINDERTOOLS_H -#include "AthenaBaseComps/AthAlgTool.h" -#include "GaudiKernel/ToolHandle.h" - #include "InDetRecToolInterfaces/IVertexFinder.h" -#include "TrkTrack/TrackCollection.h" -#include "TrkParticleBase/TrackParticleBaseCollection.h" +#include "AthenaBaseComps/AthAlgTool.h" +#include "GaudiKernel/ToolHandle.h" -#include +/* Tools*/ +#include "TrkVertexFitterInterfaces/IVertexFitter.h" +#include "InDetConversionFinderTools/TrackPairsSelector.h" +#include "TrkExInterfaces/IExtrapolator.h" +#include "InDetConversionFinderTools/ConversionPostSelector.h" +#include "InDetConversionFinderTools/SingleTrackConversionTool.h" +#include "InDetConversionFinderTools/ConversionFinderUtils.h" +#include "InDetConversionFinderTools/VertexPointEstimator.h" +#include "InDetConversionFinderTools/ConversionPostSelector.h" +#include "InDetConversionFinderTools/SingleTrackConversionTool.h" +#include "TrkToolInterfaces/ITrackSelectorTool.h" -/* Forward declarations */ +#include "TrkParticleBase/TrackParticleBaseCollection.h" +#include "TrkTrack/TrackCollection.h" +/*xAOD collections */ #include "xAODTracking/TrackParticle.h" #include "xAODTracking/TrackParticleContainer.h" #include "xAODTracking/VertexContainer.h" -namespace Trk +#include + +/** + @class InDetConversionFinderTools + + InDet::InDetConversionFinderTools is a tool which reconstructs conversion + vertex candidates in the form of xAOD::Vertex using Trk::Track (no longer + available) or Trk::TrackParticleBase (default) as an input +*/ + +namespace InDet { + +class InDetConversionFinderTools + : public AthAlgTool + , virtual public IVertexFinder { - class IVertexFitter; - class IExtrapolator; - class ITrackSelectorTool; -} +public: + InDetConversionFinderTools(const std::string& t, + const std::string& n, + const IInterface* p); + ~InDetConversionFinderTools(); + + virtual StatusCode initialize() override; + virtual StatusCode finalize() override; + + //!< Remove standalone TRT tracks + bool m_removeTrt; + //!< Conversions or V0s + bool m_isConversion; + //!< Decorate vertices with values used for vertex selection + bool m_decorateVertices; + + using IVertexFinder::findVertex; + //!< Conversion candidate reconstruction for Trk::Tracks. + virtual std::pair + findVertex(const TrackCollection* trk_coll) const override; + + virtual std::pair + findVertex(const Trk::TrackParticleBaseCollection* trk_coll) const override; + + /** Conversion candidate reconstruction for Trk::TrackParticle (default) */ + virtual std::pair + findVertex(const xAOD::TrackParticleContainer* trk_coll) const override; + +protected: + + /** Vertex fitter interface. */ + /** Track pair selection tool. */ + ToolHandle m_iVertexFitter{ this, + "VertexFitterTool", + "Trk::TrkVKalVrtFitter", + "Vertex fitter Tool" }; + /** Initial conversion vertex estimator tool. */ + ToolHandle m_trackPairsSelector{ + this, + "TrackPairsSelector", + "InDet::TrackPairsSelector", + "Track Pair Selector Tool" + }; + /** Initial conversion vertex estimator tool. */ + ToolHandle m_vertexEstimator{ + this, + "VertexPointEstimator", + "InDet::VertexPointEstimator", + "Vertex point estimator" + }; + /** Conversion post-fit selector tool. */ + ToolHandle m_postSelector{ + this, + "PostSelector", + "InDet::ConversionPostSelector", + "Tool for post selection of conversion candidates" + }; + /** Single track conversion tool. */ + ToolHandle m_singleTrkConvTool{ + this, + "SingleTrackConversionTool", + "InDet::SingleTrackConversionTool", + "Tool for single track conversions" + }; + + /** Track extrapolator tool. */ + ToolHandle m_extrapolator{ this, + "Extrapolator", + "", + "Extrapolation Tool" }; + /** Track Selector Tool. */ + ToolHandle m_trkSelector{ + this, + "TrackSelectorTool", + "InDet::TrackSelectorTool", + "Tool for track Selection" + }; -namespace InDet{ - class ConversionFinderUtils; - class VertexPointEstimator; - class ConversionPostSelector; - class SingleTrackConversionTool; - class TrackPairsSelector; - - /** - @class InDetConversionFinderTools - - InDet::InDetConversionFinderTools is a tool which reconstructs conversion - vertex candidates in the form of xAOD::Vertex using Trk::Track (no longer available) or - Trk::TrackParticleBase (default) as an input - */ - - class InDetConversionFinderTools : public AthAlgTool, virtual public IVertexFinder - { - public: - InDetConversionFinderTools(const std::string& t, const std::string& n, const IInterface* p); - ~InDetConversionFinderTools(); - - StatusCode initialize(); - StatusCode finalize(); - - std::string m_TrkParticleCollection ; //!< Name of input track particle collection - bool m_removeTrt ; //!< Remove standalone TRT tracks - bool m_isConversion ; //!< Conversions or V0s - bool m_decorateVertices ; //!< Decorate vertices with values used for vertex selection - - std::pair findVertex(const TrackCollection* trk_coll); //!< Conversion candidate reconstruction for Trk::Tracks. - - std::pair findVertex(const Trk::TrackParticleBaseCollection* trk_coll); - - /** Conversion candidate reconstruction for Trk::TrackParticle (default) */ - virtual std::pair findVertex(const xAOD::TrackParticleContainer* trk_coll); - - - protected: - ToolHandle < Trk::IVertexFitter > m_iVertexFitter; /** Vertex fitter interface. */ - ToolHandle m_trackPairsSelector; /** Track pair selection tool. */ - ToolHandle m_vertexEstimator; /** Initial conversion vertex estimator tool. */ - ToolHandle m_postSelector; /** Conversion post-fit selector tool. */ - ToolHandle m_singleTrkConvTool; /** Single track conversion tool. */ - ToolHandle m_extrapolator; /** Track extrapolator tool. */ - ToolHandle m_trkSelector; /** Track Selector Tool. */ - - - bool passPreSelection(const xAOD::TrackParticle* track_pos, const xAOD::TrackParticle* track_neg, std::vector& trackList, Amg::Vector3D& initPos, int& flag, - std::map& intersectionDecors); - - - static double s_innerDetectorR; - - /** Cuts. */ - double m_mindR; //!< Minimum allwoed radial distance beteeen guess vertex and closest 1st hit of participating track. - double m_maxdR; //!< Maximum allowed radial distance beteeen guess vertex and closest 1st hit of participating track. - double m_MinInitVtxR; //!< Minimum allowed radial position for initial guess vertex. Used only in V0 reconstruction. - double m_MinFlightAngle; //!< Minimum allowed angular difference between V0 and children direction. Used only in V0 reconstruction. + SG::ReadHandleKey m_TrkParticleCollectionKey{ + this, + "TrackParticleCollection", + "", + "Name of the input track particle container" }; - + + bool passPreSelection(TrackPairsSelector::Cache& cache, + const xAOD::TrackParticle* track_pos, + const xAOD::TrackParticle* track_neg, + std::vector& trackList, + Amg::Vector3D& initPos, + int& flag, + std::map& intersectionDecors) const; + + /** Cuts. */ + //!< Minimum allwoed radial distance beteeen guess vertex and closest 1st hit + //!< of participating track. + double m_mindR; + //!< Maximum allowed radial distance beteeen guess vertex and closest 1st hit + //!< of participating track. + double m_maxdR; + //!< Minimum allowed radial position for initial guess vertex. Used only in V0 + //!< reconstruction. + double m_MinInitVtxR; + //!< Minimum allowed angular difference between V0 and children direction. + //!< Used only in V0 reconstruction. + double m_MinFlightAngle; +}; + } #endif // INDETCONVERSIONFINDERTOOLS_INDETCONVERSIONFINDERTOOL_H diff --git a/InnerDetector/InDetRecTools/InDetConversionFinderTools/InDetConversionFinderTools/SingleTrackConversionTool.h b/InnerDetector/InDetRecTools/InDetConversionFinderTools/InDetConversionFinderTools/SingleTrackConversionTool.h index 9ddee4e56b4..89adfbb309f 100644 --- a/InnerDetector/InDetRecTools/InDetConversionFinderTools/InDetConversionFinderTools/SingleTrackConversionTool.h +++ b/InnerDetector/InDetRecTools/InDetConversionFinderTools/InDetConversionFinderTools/SingleTrackConversionTool.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef INDETCONVERSIONFINDERTOOLS_SINGLETRACKCONVERSION_H @@ -35,17 +35,19 @@ namespace InDet { virtual ~SingleTrackConversionTool(); static const InterfaceID& interfaceID(); - virtual StatusCode initialize(); - virtual StatusCode finalize(); + virtual StatusCode initialize() override; + virtual StatusCode finalize() override; /** Build single track conversion candidate. Trk::Track interface. */ - xAOD::Vertex* buildSingleTrackConversion(const Trk::Track* track); + xAOD::Vertex* buildSingleTrackConversion(const Trk::Track* track) const; /** Select single track conversion candidates. Trk::Track interface. */ - bool selectSingleTrackConversion(const Trk::Track* track); + bool selectSingleTrackConversion(const Trk::Track* track) const; /** Build single track conversion candidate. xAOD::TrackParticle interface. */ - xAOD::Vertex* buildSingleTrackParticleConversion(const xAOD::TrackParticle*, xAOD::VertexContainer* container ); + xAOD::Vertex* buildSingleTrackParticleConversion( + const xAOD::TrackParticle*, + xAOD::VertexContainer* container) const; /** Select single track conversion candidates. xAOD::TrackParticle. */ - bool selectSingleTrackParticleConversion(const xAOD::TrackParticle*); + bool selectSingleTrackParticleConversion(const xAOD::TrackParticle*) const; protected: ToolHandle m_helpertool; /** Conversion helper tool. */ diff --git a/InnerDetector/InDetRecTools/InDetConversionFinderTools/InDetConversionFinderTools/TrackPairsSelector.h b/InnerDetector/InDetRecTools/InDetConversionFinderTools/InDetConversionFinderTools/TrackPairsSelector.h index bf3155de861..4be35614b20 100644 --- a/InnerDetector/InDetRecTools/InDetConversionFinderTools/InDetConversionFinderTools/TrackPairsSelector.h +++ b/InnerDetector/InDetRecTools/InDetConversionFinderTools/InDetConversionFinderTools/TrackPairsSelector.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef INDETCONVERSIONFINDERTOOLS_TRACKPAIRSSELECTOR_H @@ -32,26 +32,40 @@ namespace InDet { class TrackPairsSelector : public AthAlgTool { public: - TrackPairsSelector (const std::string& type, - const std::string& name, const IInterface* parent); + + struct Cache{ + float m_distance = 9999. ; /** Distance of closest approach between the tracks **/ + float m_deltaCotTheta= 9999.; /** Delta cot theta between the tracks **/ + float m_deltaInit = 9999.; /** Distance difference between initial hits of tracks */ + }; + + TrackPairsSelector(const std::string& type, + const std::string& name, + const IInterface* parent); + virtual ~TrackPairsSelector(); static const InterfaceID& interfaceID(); - virtual StatusCode initialize(); - virtual StatusCode finalize(); + + virtual StatusCode initialize() override; + virtual StatusCode finalize() override; /** Track pair selectors.Return true if the argument track fulfills the selection */ - bool selectTrackParticlePair(const xAOD::TrackParticle* trkPpos, const xAOD::TrackParticle* trkPneg); - bool selectTrackPair(const Trk::Track* trkpos, const Trk::Track* trkneg); - + bool selectTrackParticlePair(const xAOD::TrackParticle* trkPpos, + const xAOD::TrackParticle* trkPneg, + Cache& cache) const; + + bool selectTrackPair(const Trk::Track* trkpos, + const Trk::Track* trkneg) const; + /** Return a map with the values calculated for the last pair * to decorate the vertex once it is created **/ - std::map getLastValues(); + std::map getLastValues(const Cache& cache) const; private: + ToolHandle m_helpertool; /**Conversion helper tool. */ ToolHandle m_distanceTool; /** Distance of minimum approach tool */ - /** Properties for track selection: all cuts are ANDed */ double m_maxR; /** Maximum initial hit radius in order to apply the impact point cut*/ double m_MinTrkAngle; /** Minimum allowed angle between decay tracks. Used only in V0 reconstruction. */ @@ -59,10 +73,6 @@ namespace InDet { std::vector m_etaCut; /** Maximum eta difference between tracks in pair. */ std::vector m_initCut; /** Maximum distance difference between initial hits of tracks in pair. */ - /** Values we cut on, to be returned later **/ - float m_distance; /** Distance of closest approach between the tracks **/ - float m_deltaCotTheta; /** Delta cot theta between the tracks **/ - float m_deltaInit; /** Distance difference between initial hits of tracks */ }; diff --git a/InnerDetector/InDetRecTools/InDetConversionFinderTools/src/ConversionFinderUtils.cxx b/InnerDetector/InDetRecTools/InDetConversionFinderTools/src/ConversionFinderUtils.cxx index 2695bb96e53..7ee56527de4 100644 --- a/InnerDetector/InDetRecTools/InDetConversionFinderTools/src/ConversionFinderUtils.cxx +++ b/InnerDetector/InDetRecTools/InDetConversionFinderTools/src/ConversionFinderUtils.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /*************************************************************************** @@ -24,8 +24,10 @@ using HepGeom::Point3D; namespace InDet { static const InterfaceID IID_IConversionFinderUtils("InDet::ConversionFinderUtils", 1, 0); - - ConversionFinderUtils::ConversionFinderUtils(const std::string& type, const std::string& name, const IInterface* parent) + + ConversionFinderUtils::ConversionFinderUtils(const std::string& type, + const std::string& name, + const IInterface* parent) : AthAlgTool(type, name, parent) { declareInterface(this); @@ -49,7 +51,12 @@ namespace InDet { /** * hits counter */ - void ConversionFinderUtils::countHits(const DataVector* mb, int& ntrt, int& nclus) { + void + ConversionFinderUtils::countHits( + const DataVector* mb, + int& ntrt, + int& nclus) const + { DataVector::const_iterator its, itse=mb->end(); @@ -68,12 +75,15 @@ namespace InDet { if(dc) { ++ntrt; continue;} }//end of loop over meas.bases - }//end of count hits method - + } // end of count hits method + /** * hl trt hits / trt hits ratio calculater */ - double ConversionFinderUtils::trRatio(const DataVector* mb) { + double + ConversionFinderUtils::trRatio( + const DataVector* mb) const + { DataVector::const_iterator itp=mb->begin(), itpe=mb->end(); int ntrth = 0; @@ -93,23 +103,29 @@ namespace InDet { if(ntrth>0) return double(nHL)/double(ntrth); return 1000.; - }//end of trRatio method - + } // end of trRatio method + /** * mom fraction */ - double ConversionFinderUtils::momFraction(const Trk::TrackParameters* per1, const Trk::TrackParameters* per2) { + double + ConversionFinderUtils::momFraction(const Trk::TrackParameters* per1, + const Trk::TrackParameters* per2) const + { - Amg::Vector3D mom_pos = per1->momentum(); - Amg::Vector3D mom_neg = per2->momentum(); + const Amg::Vector3D& mom_pos = per1->momentum(); + const Amg::Vector3D& mom_neg = per2->momentum(); double momFraction = mom_pos.mag()/(mom_pos.mag() + mom_neg.mag()); return momFraction; } - + /** * distance between two tracks */ - double ConversionFinderUtils::distBetweenTracks(const Trk::Track *trk_pos, const Trk::Track *trk_neg) { + double + ConversionFinderUtils::distBetweenTracks(const Trk::Track* trk_pos, + const Trk::Track* trk_neg) const + { //position of the first measurement on the positive track const Trk::MeasurementBase* first_pos_meas = trk_pos->measurementsOnTrack()->front(); @@ -147,15 +163,16 @@ namespace InDet { const Trk::Perigee* perigee; if (first_pos_meas->globalPosition().mag() < first_neg_meas->globalPosition().mag()) { - ref_point = first_pos_meas->globalPosition(); - perigee = trk_neg->perigeeParameters(); - } else { - ref_point = first_neg_meas->globalPosition(); - perigee = trk_pos->perigeeParameters(); - } - - //when the helix can be approximated as a straight line, when the distance of closest approach can be calculated as - //distance^2 = [momentum x (ref_point-position)]^2/momentum^2 + ref_point = first_pos_meas->globalPosition(); + perigee = trk_neg->perigeeParameters(); + } else { + ref_point = first_neg_meas->globalPosition(); + perigee = trk_pos->perigeeParameters(); + } + + // when the helix can be approximated as a straight line, when the + // distance of closest approach can be calculated as distance^2 = [momentum + // x (ref_point-position)]^2/momentum^2 Amg::Vector3D momentum = perigee->momentum(); Amg::Vector3D position = perigee->position(); double p = momentum.mag(); @@ -165,59 +182,67 @@ namespace InDet { ATH_MSG_DEBUG("Distance between two tracks = "<* tsos = track->trackStateOnSurfaces(); - if(!tsos) return 0; + if(!tsos) return nullptr; DataVector::const_iterator itse = tsos->end(); DataVector::const_iterator itsb = tsos->begin(); for(;itsb!=itse;++itsb) { if((*itsb)->measurementOnTrack()) { - const Trk::TrackParameters* trkP = (*itsb)->trackParameters(); - if(trkP->associatedSurface().center().perp()>=10.) return trkP; + const Trk::TrackParameters* trkP = (*itsb)->trackParameters(); + if(trkP->associatedSurface().center().perp()>=10.) return trkP; }//end of meas on track check }//end of loop over all track states on surface - return 0; + return nullptr; } /** * return first track particle parameters */ - const Trk::TrackParameters* ConversionFinderUtils::getTrkParticleParameters(const Trk::TrackParticleBase* track) { - + const Trk::TrackParameters* + ConversionFinderUtils::getTrkParticleParameters( + const Trk::TrackParticleBase* track) const + { + std::vector::const_iterator vpb = track->trackParameters().begin(); std::vector::const_iterator vpe = track->trackParameters().end(); for(;vpb != vpe; ++vpb) if((*vpb)->position().perp()>=10.) return (*vpb); - return 0; + return nullptr; } - + /* add recalculated perigees to the track*/ - const Trk::Track* ConversionFinderUtils::addNewPerigeeToTrack(const Trk::Track* track, const Trk::Perigee* mp) + const Trk::Track* + ConversionFinderUtils::addNewPerigeeToTrack(const Trk::Track* track, + const Trk::Perigee* mp) const { // fitQuality from track const Trk::FitQuality* fq = track->fitQuality()->clone(); - if(!fq) return 0; + if(!fq) return nullptr; // output datavector of TSOS DataVector* ntsos = new DataVector; const DataVector* tsos = track->trackStateOnSurfaces(); - if(!tsos) {delete ntsos; return 0;} + if(!tsos) {delete ntsos; return nullptr;} DataVector::const_iterator its,itse = tsos->end(); for(its=tsos->begin();its!=itse;++its) { std::bitset typePattern; typePattern.set(Trk::TrackStateOnSurface::Perigee); - const Trk::TrackStateOnSurface * per_tsos = ((*its)->type(Trk::TrackStateOnSurface::Perigee)) ? - new Trk::TrackStateOnSurface(0,mp->clone(),0,0,typePattern) : (*its)->clone(); + const Trk::TrackStateOnSurface* per_tsos = + ((*its)->type(Trk::TrackStateOnSurface::Perigee)) + ? new Trk::TrackStateOnSurface(nullptr, mp->clone(), nullptr, nullptr, typePattern) + : (*its)->clone(); ntsos->push_back(per_tsos); } @@ -226,8 +251,10 @@ namespace InDet { Trk::Track* newTrk = new Trk::Track(info, ntsos, fq); return newTrk; } - - xAOD::Vertex* ConversionFinderUtils::correctVxCandidate(xAOD::Vertex* initVxCandidate, Amg::Vector3D guessVertex) + + xAOD::Vertex* + ConversionFinderUtils::correctVxCandidate(xAOD::Vertex* initVxCandidate, + Amg::Vector3D guessVertex) const { Amg::Vector3D correctVertex(initVxCandidate->position().x()+guessVertex.x(), initVxCandidate->position().y()+guessVertex.y(), @@ -245,13 +272,14 @@ namespace InDet { AmgSymMatrix(5) em(*(vtxPer->covariance())); Trk::PerigeeSurface surface (globalVertexPosition); - const Trk::TrackParameters* tmpMeasPer = surface.createParameters<5,Trk::Charged>(0.,0.,iv[2],iv[3],iv[4],&em); - - Trk::VxTrackAtVertex trkV(vtxTrack.trackQuality().chiSquared(), const_cast(tmpMeasPer)); + Trk::TrackParameters* tmpMeasPer = surface.createParameters<5,Trk::Charged>(0.,0.,iv[2],iv[3],iv[4],&em); + + Trk::VxTrackAtVertex trkV(vtxTrack.trackQuality().chiSquared(), + tmpMeasPer); tmpVTAV.push_back(trkV); }//end of loop over VxTracksAtVertex - if(tmpVTAV.size()!=2) return 0; + if(tmpVTAV.size()!=2) return nullptr; //Create the xAOD::Vertex and set the position and VxTrackAtVertex properly xAOD::Vertex *vx = new xAOD::Vertex(*initVxCandidate); diff --git a/InnerDetector/InDetRecTools/InDetConversionFinderTools/src/ConversionPostSelector.cxx b/InnerDetector/InDetRecTools/InDetConversionFinderTools/src/ConversionPostSelector.cxx index b5c87d88fc1..2660598de0a 100644 --- a/InnerDetector/InDetRecTools/InDetConversionFinderTools/src/ConversionPostSelector.cxx +++ b/InnerDetector/InDetRecTools/InDetConversionFinderTools/src/ConversionPostSelector.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /*************************************************************************** @@ -22,12 +22,14 @@ namespace{ namespace InDet { - Trk::ParticleMasses ConversionPostSelector::s_particleMasses; + Trk::ParticleMasses const ConversionPostSelector::s_particleMasses; static const InterfaceID IID_IConversionPostSelector("InDet::ConversionPostSelector", 1, 0); - - ConversionPostSelector::ConversionPostSelector(const std::string& type, const std::string& name, const IInterface* parent) : - AthAlgTool(type, name, parent) + + ConversionPostSelector::ConversionPostSelector(const std::string& type, + const std::string& name, + const IInterface* parent) + : AthAlgTool(type, name, parent) { m_massK0 = 497.672; m_sigmaK0 = 8.5; @@ -81,7 +83,7 @@ namespace InDet { } bool ConversionPostSelector::selectConversionCandidate(xAOD::Vertex * vertex, int flag, - std::vector& trkL){ + std::vector& trkL) const{ bool pass = true; //Determine the cuts @@ -172,9 +174,14 @@ namespace InDet { } return pass; } - - bool ConversionPostSelector::selectSecVtxCandidate(xAOD::Vertex * vertex, int flag, - std::vector& trkL, int& type){ + + bool + ConversionPostSelector::selectSecVtxCandidate( + xAOD::Vertex* vertex, + int flag, + std::vector& trkL, + int& type) const + { bool pass = true; bool isK0 = false; bool isLambda = false; @@ -263,9 +270,13 @@ namespace InDet { type = kind; return pass; } - - CLHEP::HepLorentzVector - ConversionPostSelector::fourP(const Trk::TrackParameters& per1,const Trk::TrackParameters& per2,double mass, bool isBar){ + + CLHEP::HepLorentzVector + ConversionPostSelector::fourP(const Trk::TrackParameters& per1, + const Trk::TrackParameters& per2, + double mass, + bool isBar) const + { CLHEP::HepLorentzVector momentum; Amg::Vector3D sum_mom = per1.momentum() + per2.momentum(); double mp1 = 0.; double mp2 = 0.; @@ -296,7 +307,13 @@ namespace InDet { return momentum; } -void ConversionPostSelector::decorateVertex(xAOD::Vertex &vertex, float inv_mass, float pt1, float pt2, float fR, float deltaPhiVtxTrk) + void + ConversionPostSelector::decorateVertex(xAOD::Vertex& vertex, + float inv_mass, + float pt1, + float pt2, + float fR, + float deltaPhiVtxTrk) const { vertex.auxdata("mass") = inv_mass; vertex.auxdata("pt1") = pt1; diff --git a/InnerDetector/InDetRecTools/InDetConversionFinderTools/src/InDetConversionFinderTools.cxx b/InnerDetector/InDetRecTools/InDetConversionFinderTools/src/InDetConversionFinderTools.cxx index 23b932c14e8..251880cb9b5 100755 --- a/InnerDetector/InDetRecTools/InDetConversionFinderTools/src/InDetConversionFinderTools.cxx +++ b/InnerDetector/InDetRecTools/InDetConversionFinderTools/src/InDetConversionFinderTools.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /*************************************************************************** @@ -17,66 +17,38 @@ #include "AthLinks/ElementLink.h" #include "TrkTrack/LinkToTrack.h" #include "TrkParticleBase/LinkToTrackParticleBase.h" -#include "TrkVertexFitterInterfaces/IVertexFitter.h" -#include "TrkExInterfaces/IExtrapolator.h" -#include "InDetConversionFinderTools/ConversionPostSelector.h" -#include "InDetConversionFinderTools/SingleTrackConversionTool.h" -#include "TrkToolInterfaces/ITrackSelectorTool.h" -#include "InDetConversionFinderTools/ConversionFinderUtils.h" -#include "InDetConversionFinderTools/VertexPointEstimator.h" -#include "InDetConversionFinderTools/ConversionPostSelector.h" -#include "InDetConversionFinderTools/SingleTrackConversionTool.h" -#include "InDetConversionFinderTools/TrackPairsSelector.h" -#include -#include - #include "xAODTracking/TrackParticle.h" #include "xAODTracking/Vertex.h" #include "xAODTracking/TrackParticleContainer.h" #include "xAODTracking/VertexContainer.h" -//using CLHEP::Hep3Vector; - -//Necessary for the TrackParticleContainer -#include "Particle/TrackParticleContainer.h" +#include +#include namespace InDet { - double InDetConversionFinderTools::s_innerDetectorR = 500.; - - InDetConversionFinderTools::InDetConversionFinderTools(const std::string& t, const std::string& n, const IInterface* p) - : AthAlgTool(t,n,p), - m_TrkParticleCollection("TrackParticleCandidate"), - m_iVertexFitter("Trk::FullVertexFitter"), - m_trackPairsSelector("InDet::TrackPairsSelector"), - m_vertexEstimator("InDet::VertexPointEstimator"), - m_postSelector("InDet::ConversionPostSelector"), - m_singleTrkConvTool("InDet::SingleTrackConversionTool"), - m_extrapolator ("Trk::Extrapolator/InDetExtrapolator"), - m_trkSelector("InDet::TrackSelectorTool") - { - m_mindR = -350.; - m_maxdR = 250.; - m_MinInitVtxR = 0.; - m_MinFlightAngle = 0.; - - declareInterface(this); - declareProperty("VertexFitterTool", m_iVertexFitter); - declareProperty("TrackPairsSelector", m_trackPairsSelector); - declareProperty("VertexPointEstimator", m_vertexEstimator); - declareProperty("PostSelector", m_postSelector); - declareProperty("SingleTrackConversionTool", m_singleTrkConvTool); - declareProperty("Extrapolator", m_extrapolator ); - declareProperty("TrackParticleCollection", m_TrkParticleCollection); //Input track particle collection - declareProperty("RemoveTrtTracks", m_removeTrt); //Remove standalone TRT tracks - declareProperty("IsConversion", m_isConversion); //Conversion or V0s - declareProperty("DecorateVertices", m_decorateVertices=true); //Decorate vertices with values used for vertex selection - declareProperty("TrackSelectorTool", m_trkSelector); - declareProperty("MinDistVtxHit", m_mindR); - declareProperty("MaxDistVtxHit", m_maxdR); - declareProperty("MinInitVtxR", m_MinInitVtxR); - declareProperty("MinFlightAngle", m_MinFlightAngle); + +InDetConversionFinderTools::InDetConversionFinderTools(const std::string& t, + const std::string& n, + const IInterface* p) + : AthAlgTool(t, n, p) + , m_mindR{ -350. } + , m_maxdR{ 250. } + , m_MinInitVtxR{ 0 } + , m_MinFlightAngle{ 0 } +{ + declareInterface(this); + // Remove standalone TRT tracks + declareProperty("RemoveTrtTracks", m_removeTrt); + // Conversion or V0s + declareProperty("IsConversion", m_isConversion); + // Decorate vertices with values used for vertex selection + declareProperty("DecorateVertices", m_decorateVertices = true); + declareProperty("MinDistVtxHit", m_mindR); + declareProperty("MaxDistVtxHit", m_maxdR); + declareProperty("MinInitVtxR", m_MinInitVtxR); + declareProperty("MinFlightAngle", m_MinFlightAngle); } InDetConversionFinderTools::~InDetConversionFinderTools(){} @@ -84,62 +56,63 @@ namespace InDet StatusCode InDetConversionFinderTools::initialize() { StatusCode sc = AthAlgTool::initialize(); - if ( sc.isFailure() ) { - msg(MSG::FATAL) << "Unable to initialize InDetConversionFinderTools" << endmsg; + if (sc.isFailure()) { + ATH_MSG_FATAL("Unable to initialize InDetConversionFinderTools"); return StatusCode::FAILURE; - } + } /* Get the right vertex fitting tool from ToolSvc */ - if ( m_iVertexFitter.retrieve().isFailure() ) { - msg(MSG::FATAL) << "Failed to retrieve tool " << m_iVertexFitter << endmsg; + if (m_iVertexFitter.retrieve().isFailure()) { + ATH_MSG_FATAL("Failed to retrieve tool " << m_iVertexFitter); return StatusCode::FAILURE; - } else { - msg(MSG::INFO) << "Retrieved tool " << m_iVertexFitter << endmsg; } + ATH_MSG_INFO("Retrieved tool " << m_iVertexFitter); + /* Get the track pairs selector tool from ToolSvc */ - if ( m_trackPairsSelector.retrieve().isFailure() ) { - msg(MSG::FATAL) << "Failed to retrieve tool " << m_trackPairsSelector << endmsg; + if (m_trackPairsSelector.retrieve().isFailure()) { + ATH_MSG_FATAL("Failed to retrieve tool " << m_trackPairsSelector); return StatusCode::FAILURE; - } else { - msg(MSG::INFO) << "Retrieved tool " << m_trackPairsSelector << endmsg; } - + ATH_MSG_INFO("Retrieved tool " << m_trackPairsSelector); + /* Get the vertex point estimator tool from ToolSvc */ - if ( m_vertexEstimator.retrieve().isFailure() ) { - msg(MSG::FATAL) << "Failed to retrieve tool " << m_vertexEstimator << endmsg; + if (m_vertexEstimator.retrieve().isFailure()) { + ATH_MSG_FATAL("Failed to retrieve tool " << m_vertexEstimator); return StatusCode::FAILURE; - } else { - msg(MSG::INFO) << "Retrieved tool " << m_vertexEstimator << endmsg; } + ATH_MSG_INFO("Retrieved tool " << m_vertexEstimator); + /* Get the postselector tool from ToolSvc */ - if ( m_postSelector.retrieve().isFailure() ) { - msg(MSG::FATAL) << "Failed to retrieve tool " << m_postSelector << endmsg; + if (m_postSelector.retrieve().isFailure()) { + ATH_MSG_FATAL("Failed to retrieve tool " << m_postSelector); return StatusCode::FAILURE; - } else { - msg(MSG::INFO) << "Retrieved tool " << m_postSelector << endmsg; } + ATH_MSG_INFO("Retrieved tool " << m_postSelector); + /* Get the single track conversion tool from ToolSvc */ - if ( m_singleTrkConvTool.retrieve().isFailure() ) { - msg(MSG::FATAL) << "Failed to retrieve tool " << m_singleTrkConvTool << endmsg; + if (m_singleTrkConvTool.retrieve().isFailure()) { + ATH_MSG_FATAL("Failed to retrieve tool " << m_singleTrkConvTool); return StatusCode::FAILURE; - } else { - msg(MSG::INFO) << "Retrieved tool " << m_singleTrkConvTool << endmsg; } + ATH_MSG_INFO("Retrieved tool " << m_singleTrkConvTool); + /* Get the extrapolator tool from ToolSvc */ - if ( m_extrapolator.retrieve().isFailure() ) { - msg(MSG::FATAL) << "Failed to retrieve tool " << m_extrapolator << endmsg; + if (m_extrapolator.retrieve().isFailure()) { + ATH_MSG_FATAL("Failed to retrieve tool " << m_extrapolator); return StatusCode::FAILURE; - } else { - msg(MSG::INFO) << "Retrieved tool " << m_extrapolator << endmsg; } + ATH_MSG_INFO("Retrieved tool " << m_extrapolator); + /* Get the track selector tool from ToolSvc */ - if ( m_trkSelector.retrieve().isFailure() ) { - msg(MSG::FATAL) << "Failed to retrieve tool " << m_trkSelector << endmsg; + if (m_trkSelector.retrieve().isFailure()) { + ATH_MSG_FATAL("Failed to retrieve tool " << m_trkSelector); return StatusCode::FAILURE; - } else { - msg(MSG::INFO) << "Retrieved tool " << m_trkSelector << endmsg; } - - msg(MSG::INFO) << "Initialization successful" << endmsg; + ATH_MSG_INFO("Retrieved tool " << m_trkSelector); + + ATH_CHECK(m_TrkParticleCollectionKey.initialize( + !m_TrkParticleCollectionKey.key().empty())); + + ATH_MSG_INFO("Initialization successful"); return StatusCode::SUCCESS; } @@ -148,8 +121,11 @@ namespace InDet return StatusCode::SUCCESS; } - std::pair InDetConversionFinderTools::findVertex(const Trk::TrackParticleBaseCollection* /*trk_coll*/){ - + std::pair + InDetConversionFinderTools::findVertex( + const Trk::TrackParticleBaseCollection* /*trk_coll*/) const + { + ATH_MSG_ERROR("Using old TrackParticle Container no longer supported returning an empty conatiner"); // Make collection for conversions. @@ -157,12 +133,12 @@ namespace InDet xAOD::VertexAuxContainer* InDetConversionContainerAux = new xAOD::VertexAuxContainer(); InDetConversionContainer->setStore( InDetConversionContainerAux ); - return std::make_pair(InDetConversionContainer,InDetConversionContainerAux); - } - + return std::make_pair(InDetConversionContainer,InDetConversionContainerAux); + } //TrackCollection - std::pair InDetConversionFinderTools::findVertex(const TrackCollection* /*trk_coll*/) + std::pair + InDetConversionFinderTools::findVertex(const TrackCollection* /*trk_coll*/) const { ATH_MSG_ERROR("Using Track Container not currently supported returning an empty conatiner"); @@ -175,185 +151,232 @@ namespace InDet return std::make_pair(InDetConversionContainer,InDetConversionContainerAux); } - //TrackParticleBaseCollection - std::pair InDetConversionFinderTools::findVertex ( const xAOD::TrackParticleContainer* trk_coll ) + // TrackParticleBaseCollection + std::pair + InDetConversionFinderTools::findVertex( + const xAOD::TrackParticleContainer* trk_coll) const { // Make collection for conversions. - xAOD::VertexContainer* InDetConversionContainer = new xAOD::VertexContainer(); - xAOD::VertexAuxContainer* InDetConversionContainerAux = new xAOD::VertexAuxContainer(); - InDetConversionContainer->setStore( InDetConversionContainerAux ); + xAOD::VertexContainer* InDetConversionContainer = + new xAOD::VertexContainer(); + xAOD::VertexAuxContainer* InDetConversionContainerAux = + new xAOD::VertexAuxContainer(); + InDetConversionContainer->setStore(InDetConversionContainerAux); // Count for number of successful conversions int numConversions = 0; - - //have to be used for the vertex fit - Amg::Vector3D pos(0.,0.,0.); Amg::Vector3D initPos(0.,0.,0.); - - // Make seperate lists of positive and negative tracks (after presection cuts) - std::vector negSelectedTracks; negSelectedTracks.clear(); - std::vector posSelectedTracks; posSelectedTracks.clear(); - std::vector negIndx; std::vector posIndx; - - //track preselection -->pt-cut + + // have to be used for the vertex fit + Amg::Vector3D pos(0., 0., 0.); + Amg::Vector3D initPos(0., 0., 0.); + + // Make seperate lists of positive and negative tracks (after presection + // cuts) + std::vector negSelectedTracks; + negSelectedTracks.clear(); + std::vector posSelectedTracks; + posSelectedTracks.clear(); + std::vector negIndx; + std::vector posIndx; + + TrackPairsSelector::Cache cache{}; + // track preselection -->pt-cut xAOD::TrackParticleContainer::const_iterator iter; - for ( iter =(*trk_coll).begin(); iter !=(*trk_coll).end(); ++iter ) { - if (m_trkSelector->decision(**iter, 0)){ // Only save if track passes the pt, d0, z0 and TRT PID cuts + for (iter = (*trk_coll).begin(); iter != (*trk_coll).end(); ++iter) { + if (m_trkSelector->decision( + **iter, + nullptr)) { // Only save if track passes the pt, d0, z0 and TRT PID cuts ATH_MSG_DEBUG("Track passed preselection"); - if ( (*iter)->charge() < 0) {negSelectedTracks.push_back(*iter); negIndx.push_back(0);} - else {posSelectedTracks.push_back(*iter); posIndx.push_back(0);} - } - else ATH_MSG_DEBUG("Track failed preselection"); - }// end pt,d0.z0-cuts - + if ((*iter)->charge() < 0) { + negSelectedTracks.push_back(*iter); + negIndx.push_back(0); + } else { + posSelectedTracks.push_back(*iter); + posIndx.push_back(0); + } + } else + ATH_MSG_DEBUG("Track failed preselection"); + } // end pt,d0.z0-cuts + // Make track pairs. std::vector::const_iterator iter_pos; std::vector::const_iterator iter_neg; - std::vector positionList; positionList.clear(); - std::vector trackParticleList; trackParticleList.clear(); - std::vector singleTrackConvList; singleTrackConvList.clear(); - int ipos = -1; int ineg = -1; - // Outer loop: Loop over positive tracks - for (iter_pos = posSelectedTracks.begin(); iter_pos != posSelectedTracks.end(); ++iter_pos) { + std::vector positionList; + positionList.clear(); + std::vector trackParticleList; + trackParticleList.clear(); + std::vector singleTrackConvList; + singleTrackConvList.clear(); + int ipos = -1; + int ineg = -1; + // Outer loop: Loop over positive tracks + for (iter_pos = posSelectedTracks.begin(); + iter_pos != posSelectedTracks.end(); + ++iter_pos) { ineg = -1; ipos++; - // Inner loop: Loop over negative tracks - for (iter_neg = negSelectedTracks.begin(); iter_neg != negSelectedTracks.end(); ++iter_neg) { + // Inner loop: Loop over negative tracks + for (iter_neg = negSelectedTracks.begin(); + iter_neg != negSelectedTracks.end(); + ++iter_neg) { ineg++; int flag = 0; + std::map intersectionDecors; - if (!passPreSelection( *iter_pos , *iter_neg, positionList, initPos, flag, - intersectionDecors)) - { - positionList.clear(); + if (!passPreSelection(cache, + *iter_pos, + *iter_neg, + positionList, + initPos, + flag, + intersectionDecors)) { + positionList.clear(); continue; } - + // Do the fit if (positionList.size() < 2) { ATH_MSG_DEBUG("No tracks to fit "); - positionList.clear(); + positionList.clear(); continue; - } - - trackParticleList.push_back( *iter_pos ); - trackParticleList.push_back( *iter_neg ); - - xAOD::Vertex* myVertex =0; - myVertex = m_iVertexFitter->fit(trackParticleList, initPos); + } + + trackParticleList.push_back(*iter_pos); + trackParticleList.push_back(*iter_neg); + + xAOD::Vertex* myVertex = nullptr; + myVertex = m_iVertexFitter->fit(trackParticleList, initPos); trackParticleList.clear(); - if(myVertex) { - ATH_MSG_DEBUG("VertexFit successful!"); + if (myVertex) { + ATH_MSG_DEBUG("VertexFit successful!"); int type = -1; - if (( m_isConversion && m_postSelector->selectConversionCandidate(myVertex,flag,positionList)) || - (!m_isConversion && m_postSelector->selectSecVtxCandidate(myVertex, flag, positionList, type))){ + if ((m_isConversion && m_postSelector->selectConversionCandidate( + myVertex, flag, positionList)) || + (!m_isConversion && m_postSelector->selectSecVtxCandidate( + myVertex, flag, positionList, type))) { ATH_MSG_DEBUG(" Conversion passed postselection cuts"); - - //Really need to check that this correct. - //Remove old element links + + // Really need to check that this correct. + // Remove old element links myVertex->clearTracks(); - - if (m_isConversion){ + + if (m_isConversion) { myVertex->setVertexType(xAOD::VxType::ConvVtx); InDetConversionContainer->push_back(myVertex); - } - else if (type==101 || type==110 || type==11) {// V0 + } else if (type == 101 || type == 110 || type == 11) { // V0 myVertex->setVertexType(xAOD::VxType::V0Vtx); InDetConversionContainer->push_back(myVertex); + } else { + ATH_MSG_WARNING("Unknown type of vertex"); + delete myVertex; + myVertex = nullptr; + } + + if (myVertex) { + if (m_decorateVertices) { + ATH_MSG_DEBUG( + "Decorating vertex with values used in track pair selector"); + for (const auto& kv : m_trackPairsSelector->getLastValues(cache)) { + myVertex->auxdata(kv.first) = kv.second; + } + ATH_MSG_DEBUG("Decorating vertex with values used in vertex " + "point estimator"); + for (const auto& kv : intersectionDecors) { + myVertex->auxdata(kv.first) = kv.second; + } + } + ElementLink newLinkPos(*iter_pos, + *trk_coll); + ElementLink newLinkNeg(*iter_neg, + *trk_coll); + myVertex->addTrackAtVertex(newLinkPos); + myVertex->addTrackAtVertex(newLinkNeg); } - else{ - ATH_MSG_WARNING("Unknown type of vertex"); - delete myVertex; - myVertex = 0; - } - - if(myVertex){ - if (m_decorateVertices){ - ATH_MSG_DEBUG("Decorating vertex with values used in track pair selector"); - for (const auto& kv : m_trackPairsSelector->getLastValues()){ - myVertex->auxdata(kv.first) = kv.second; - } - ATH_MSG_DEBUG("Decorating vertex with values used in vertex point estimator"); - for (const auto& kv : intersectionDecors){ - myVertex->auxdata(kv.first) = kv.second; - } - } - ElementLink newLinkPos(*iter_pos, *trk_coll); - ElementLink newLinkNeg(*iter_neg, *trk_coll); - myVertex->addTrackAtVertex(newLinkPos); - myVertex->addTrackAtVertex(newLinkNeg); - } negIndx[ineg] = 1; posIndx[ipos] = 1; numConversions++; - - }else { + + } else { ATH_MSG_DEBUG("VxCandidate failed the post selection cuts!"); delete myVertex; - myVertex = 0; + myVertex = nullptr; } } else { ATH_MSG_DEBUG("VertexFit was NOT successful!"); - } + } positionList.clear(); } // neg loop - } // pos loop - ATH_MSG_DEBUG("Number of conversions found passing post selection cuts: "<::iterator itk, itke=singleTrackConvList.end(); + + std::vector::iterator itk, + itke = singleTrackConvList.end(); int numSingle = 0; - for(itk=singleTrackConvList.begin();itk!=itke;++itk){ - if(!m_singleTrkConvTool->selectSingleTrackParticleConversion((*itk))) + for (itk = singleTrackConvList.begin(); itk != itke; ++itk) { + if (!m_singleTrkConvTool->selectSingleTrackParticleConversion((*itk))) ATH_MSG_DEBUG("Track failed single track conversion selection"); - else - { - xAOD::Vertex * sConver(0); - sConver = m_singleTrkConvTool->buildSingleTrackParticleConversion((*itk), InDetConversionContainer); - if(sConver) { + else { + xAOD::Vertex* sConver(nullptr); + sConver = m_singleTrkConvTool->buildSingleTrackParticleConversion( + (*itk), InDetConversionContainer); + if (sConver) { sConver->clearTracks(); ElementLink newLink; - newLink.toContainedElement( *trk_coll, *itk ); + newLink.toContainedElement(*trk_coll, *itk); sConver->addTrackAtVertex(newLink); sConver->setVertexType(xAOD::VxType::ConvVtx); numSingle++; - - if (m_decorateVertices) - { - ATH_MSG_DEBUG("Decorating single track vertex with dummy values used in track pair selector"); - for (const auto& kv : m_trackPairsSelector->getLastValues()) + + if (m_decorateVertices) { + ATH_MSG_DEBUG("Decorating single track vertex with dummy values " + "used in track pair selector"); + for (const auto& kv : m_trackPairsSelector->getLastValues(cache)) sConver->auxdata(kv.first) = 0.; - ATH_MSG_DEBUG("Decorating single track vertex with dummy values used in vertex point estimator"); + ATH_MSG_DEBUG("Decorating single track vertex with dummy values " + "used in vertex point estimator"); for (const std::string& k : m_vertexEstimator->decorKeys()) sConver->auxdata(k) = 0.; - - ATH_MSG_DEBUG("Decorating single track vertex with dummy values used in post selector"); + + ATH_MSG_DEBUG("Decorating single track vertex with dummy values " + "used in post selector"); m_postSelector->decorateVertex(*sConver, 0., 0., 0., 0., 0.); } - - } } } - ATH_MSG_DEBUG("Number successful reconstructed single track conversion: "<& trackList, Amg::Vector3D& initPos, int& flag, - std::map& intersectionDecors) + return std::make_pair(InDetConversionContainer, + InDetConversionContainerAux); + } + + bool + InDetConversionFinderTools::passPreSelection( + TrackPairsSelector::Cache& cache, + const xAOD::TrackParticle* track_pos, + const xAOD::TrackParticle* track_neg, + std::vector& trackList, + Amg::Vector3D& initPos, + int& flag, + std::map& intersectionDecors) const { //Track summary information @@ -380,12 +403,14 @@ namespace InDet if(nclusNeg==0 && nclusPos==0) flag = 2; if(m_removeTrt && (flag==1 || flag==2)) return false; - if (m_trackPairsSelector->selectTrackParticlePair( track_pos,track_neg)){ + if (m_trackPairsSelector->selectTrackParticlePair( track_pos,track_neg,cache)){ const Trk::Perigee& perPos = track_pos->perigeeParameters(); const Trk::Perigee& perNeg = track_neg->perigeeParameters(); int errorcode = 0; - Amg::Vector3D startingPoint(m_vertexEstimator->getCirclesIntersectionPoint(&perPos,&perNeg,flag,errorcode,intersectionDecors)); + Amg::Vector3D startingPoint( + m_vertexEstimator->getCirclesIntersectionPoint( + &perPos, &perNeg, flag, errorcode, intersectionDecors)); if(m_isConversion && errorcode != 0) return false; if(!m_isConversion){ Amg::Vector3D v_direction = perPos.momentum() + perNeg.momentum(); diff --git a/InnerDetector/InDetRecTools/InDetConversionFinderTools/src/SingleTrackConversionTool.cxx b/InnerDetector/InDetRecTools/InDetConversionFinderTools/src/SingleTrackConversionTool.cxx index 7fad1948199..53c3b1d946c 100644 --- a/InnerDetector/InDetRecTools/InDetConversionFinderTools/src/SingleTrackConversionTool.cxx +++ b/InnerDetector/InDetRecTools/InDetConversionFinderTools/src/SingleTrackConversionTool.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /*************************************************************************** @@ -44,16 +44,18 @@ namespace InDet { // ------------------------------------------------------- // constructor // ------------------------------------------------------- - SingleTrackConversionTool::SingleTrackConversionTool(const std::string& type, const std::string& name, const IInterface* parent) : - AthAlgTool(type, name, parent), - m_helpertool("InDet::ConversionFinderUtils"), - m_trkSumTool("Trk::TrackSummaryTool"), - m_extrapolator ("Trk::Extrapolator/InDetExtrapolator"), - m_minInitR(70.), - m_minInitR_noBLay(120.), - m_singleThreshold(0.1), - m_maxBLhits(0) - //m_maxPhiVtxTrk(0.2) + SingleTrackConversionTool::SingleTrackConversionTool(const std::string& type, + const std::string& name, + const IInterface* parent) + : AthAlgTool(type, name, parent) + , m_helpertool("InDet::ConversionFinderUtils") + , m_trkSumTool("Trk::TrackSummaryTool") + , m_extrapolator("Trk::Extrapolator/InDetExtrapolator") + , m_minInitR(70.) + , m_minInitR_noBLay(120.) + , m_singleThreshold(0.1) + , m_maxBLhits(0) + // m_maxPhiVtxTrk(0.2) { declareInterface(this); declareProperty("ConversionFinderHelperTool" , m_helpertool); @@ -89,25 +91,25 @@ namespace InDet { if ( m_helpertool.retrieve().isFailure() ) { ATH_MSG_FATAL("Failed to retrieve tool " << m_helpertool); return StatusCode::FAILURE; - } else { + } ATH_MSG_INFO("Retrieved tool " << m_helpertool); - } + /* Get the track summary tool from ToolSvc */ if ( m_trkSumTool.retrieve().isFailure() ) { ATH_MSG_FATAL("Failed to retrieve tool " << m_trkSumTool); return StatusCode::FAILURE; - } else { + } ATH_MSG_INFO("Retrieved tool " << m_trkSumTool); - } + /* Get the extrapolator */ if (m_extrapolator.retrieve().isFailure()) { ATH_MSG_FATAL("Failed to retrieve tool " << m_extrapolator); return StatusCode::FAILURE; - }else{ - ATH_MSG_INFO("Retrieved tool " << m_extrapolator); } + ATH_MSG_INFO("Retrieved tool " << m_extrapolator); + return StatusCode::SUCCESS; } @@ -122,11 +124,13 @@ namespace InDet { // ------------------------------------------------------- // Create a RecVertex at the first measurement of the track // ------------------------------------------------------- - xAOD::Vertex* SingleTrackConversionTool::buildSingleTrackConversion(const Trk::Track* track) + xAOD::Vertex* + SingleTrackConversionTool::buildSingleTrackConversion( + const Trk::Track* track) const { // some local variables - const Trk::TrackParameters* tp = 0; + const Trk::TrackParameters* tp = nullptr; AmgSymMatrix(5) em ; em.setZero(); Amg::Vector3D gp ; @@ -135,7 +139,7 @@ namespace InDet { // get track states on surface const DataVector* tsos = track->trackStateOnSurfaces(); - if(!tsos) return 0; + if(!tsos) return nullptr; // iterate over them DataVector::const_iterator its,itse = tsos->end(); @@ -148,7 +152,7 @@ namespace InDet { tp = (*its)->trackParameters(); if(!tp) { ATH_MSG_WARNING ("Require parameters at first measurement, conversion finder logic broken"); - return 0; + return nullptr; } em = *(tp->covariance()); @@ -157,7 +161,9 @@ namespace InDet { } } - if(!tp) return 0; + if(!tp) { + return nullptr; + } // // --- Need to compute a global position covariance matrix as J.C.JT @@ -243,35 +249,23 @@ namespace InDet { } else { ATH_MSG_ERROR ("Wrong type of surface, not supported !"); - return 0; + return nullptr; } - - //Create the corresponding vector of tracks at that RecVertex. Contains one track with a new redefined measured perigee. - // + + // Create the corresponding vector of tracks at that RecVertex. Contains one + // track with a new redefined measured perigee. std::vector tmpVTAV; // get the perigee Trk::PerigeeSurface perigeeSurface(gp); - const Trk::TrackParameters *perpar=m_extrapolator->extrapolate(*tp,perigeeSurface,Trk::anyDirection,false,Trk::pion); + const Trk::TrackParameters* perpar = m_extrapolator->extrapolate( + *tp, perigeeSurface, Trk::anyDirection, false, Trk::pion); if(!perpar || !perpar->covariance() ){ ATH_MSG_WARNING ("Perigee creation for single track at its first measurement failed, should never happen !"); - return 0; + return nullptr; } - /* // --- final cut on pointing - double PhiVtxTrk = fabs(gp->phi() - parm->parameters()[Trk::phi0]); - if (PhiVtxTrk < -pi) PhiVtxTrk += twopi; - if (PhiVtxTrk > pi) PhiVtxTrk -= twopi; - ATH_MSG_VERBOSE ("candidate with position = " << *gp << " , phi(vtx) = " << gp->phi() << " phi(trk) = " << parm->parameters()[Trk::phi0] << " dphi = " << PhiVtxTrk); - if(PhiVtxTrk > m_maxPhiVtxTrk) { - ATH_MSG_VERBOSE ("==> reject candidate"); - delete tmpRecV; delete tmpVTAV; - return 0; - } - // --- - */ - Trk::TrackParameters* pp = perpar->clone(); delete perpar; Trk::VxTrackAtVertex trkV(1., pp); @@ -295,120 +289,156 @@ namespace InDet { return vertex; } - + // ------------------------------------------------------- // preselection cuts on tracks // ------------------------------------------------------- - bool SingleTrackConversionTool::selectSingleTrackConversion(const Trk::Track* track){ + bool + SingleTrackConversionTool::selectSingleTrackConversion( + const Trk::Track* track) const + { const Trk::TrackParameters* trkPar = m_helpertool->getTrkParameters(track); - if(!trkPar) + if (!trkPar) { return false; + } - else { - const Trk::TrackSummary* tSum = m_trkSumTool->createSummaryNoHoleSearch(*track); - if(!tSum) return false; - - bool pass = true; - - const bool expectedHitInBLayer = tSum->get(Trk::expectInnermostPixelLayerHit); - if (expectedHitInBLayer) { - // ME: cut on minInitR if blayer is ok - if(trkPar->position().perp() < m_minInitR ) pass = false; - } else { - // ME: cut on minInitR_NBLay if blayer is off - if(trkPar->position().perp() < m_minInitR_noBLay ) pass = false; - } - - int nTrtHits = tSum->get(Trk::numberOfTRTHits); - int nTrtOutliers = tSum->get(Trk::numberOfTRTOutliers); - int ntrt = nTrtHits + nTrtOutliers; - int nTrtXenonHits = tSum->get(Trk::numberOfTRTXenonHits); + /* + * This should be already present from previous + * steps + */ + const Trk::TrackSummary* tSum =track->trackSummary(); + if (!tSum) { + return false; + } + bool pass = true; - if(ntrt > 0 && (!m_PIDonlyForXe || nTrtXenonHits==ntrt) ) { // only check TRT PID if m_PIDonlyForXe is false or all TRT hits are Xenon hits - double prob = tSum->getPID(Trk::eProbabilityHT); - if(prob < m_singleThreshold) pass = false; - } + const bool expectedHitInBLayer = + tSum->get(Trk::expectInnermostPixelLayerHit); + if (expectedHitInBLayer) { + // ME: cut on minInitR if blayer is ok + if (trkPar->position().perp() < m_minInitR) + pass = false; + } else { + // ME: cut on minInitR_NBLay if blayer is off + if (trkPar->position().perp() < m_minInitR_noBLay) + pass = false; + } - // do we reject tracks with blayer ? - int nBLHits = tSum->get(Trk::numberOfInnermostPixelLayerHits) + tSum->get(Trk::numberOfInnermostPixelLayerOutliers); - if(nBLHits > m_maxBLhits) pass = false; + int nTrtHits = tSum->get(Trk::numberOfTRTHits); + int nTrtOutliers = tSum->get(Trk::numberOfTRTOutliers); + int ntrt = nTrtHits + nTrtOutliers; + int nTrtXenonHits = tSum->get(Trk::numberOfTRTXenonHits); - delete tSum; - return pass; + if (ntrt > 0 && + (!m_PIDonlyForXe || + nTrtXenonHits == ntrt)) { // only check TRT PID if m_PIDonlyForXe is + // false or all TRT hits are Xenon hits + double prob = tSum->getPID(Trk::eProbabilityHT); + if (prob < m_singleThreshold) + pass = false; } + + // do we reject tracks with blayer ? + int nBLHits = tSum->get(Trk::numberOfInnermostPixelLayerHits) + + tSum->get(Trk::numberOfInnermostPixelLayerOutliers); + if (nBLHits > m_maxBLhits) + pass = false; + + delete tSum; + return pass; } - + // ------------------------------------------------------- // building single track conversions from a particle // ------------------------------------------------------- - xAOD::Vertex* SingleTrackConversionTool::buildSingleTrackParticleConversion(const xAOD::TrackParticle* track, xAOD::VertexContainer* container) - { - ///Create a RecVertex at the first measurement of the track. + xAOD::Vertex* + SingleTrackConversionTool::buildSingleTrackParticleConversion( + const xAOD::TrackParticle* track, + xAOD::VertexContainer* container) const + { + /// Create a RecVertex at the first measurement of the track. unsigned int index(0); - if (!track->indexOfParameterAtPosition(index, xAOD::FirstMeasurement)) - { - ATH_MSG_WARNING("TrackParticle has no first measurement"); - return NULL; - } + if (!track->indexOfParameterAtPosition(index, xAOD::FirstMeasurement)) { + ATH_MSG_WARNING("TrackParticle has no first measurement"); + return nullptr; + } - const Trk::CurvilinearParameters trkPar = track->curvilinearParameters(index); + const Trk::CurvilinearParameters trkPar = + track->curvilinearParameters(index); - - const Amg::Vector3D gp = trkPar.position(); - const AmgSymMatrix(5) em = *(trkPar.covariance()); + const Amg::Vector3D& gp = trkPar.position(); + const AmgSymMatrix(5) em = *(trkPar.covariance()); // ME: this is nuts, those values are 0, 0 // double chi2 = track->fitQuality()->chiSquared(); // int Ndf = track->fitQuality()->numberDoF(); - ///Need to compute a global position covariance matrix as J.C.JT - const Amg::Transform3D& T = trkPar.associatedSurface().transform(); + /// Need to compute a global position covariance matrix as J.C.JT + const Amg::Transform3D& T = trkPar.associatedSurface().transform(); AmgSymMatrix(3) nCovVtx; // Should use eigen to do all of this - + // ME: use the surface to find out what we do, do not hardcode the geoemtry - if ( Trk::Surface::Plane == trkPar.associatedSurface().type() ){ + if (Trk::Surface::Plane == trkPar.associatedSurface().type()) { - ///The local position parameters covariance matrix C (2x2) + /// The local position parameters covariance matrix C (2x2) double p11 = em(Trk::locX, Trk::locX); double p12 = em(Trk::locX, Trk::locY); double p21 = em(Trk::locY, Trk::locX); double p22 = em(Trk::locY, Trk::locY); - - ///The Jacobian matrix J (3x2) - double Ax[3] = {T(0,0),T(1,0),T(2,0)}; - double Ay[3] = {T(0,1),T(1,1),T(2,1)}; - double a11 = Ax[0]; double a12 = Ay[0]; - double a21 = Ax[1]; double a22 = Ay[1]; - double a31 = Ax[2]; double a32 = Ay[2]; - - ///The A = J.C (3x2) - double A11 = a11*p11 + a12*p21; double A12 = a11*p12 + a12*p22; - double A21 = a21*p11 + a22*p21; double A22 = a21*p12 + a22*p22; - double A31 = a31*p11 + a32*p21; double A32 = a31*p12 + a32*p22; - - ///The A.JT = J.C.JT (3x3) - double P11 = a11*A11 + A12*a12; double P12 = A11*a21 + A12*a22; double P13 = A11*a31 + A12*a32; - double P21 = A21*a11 + A22*a12; double P22 = A21*a21 + A22*a22; double P23 = A21*a31 + A22*a32; - double P31 = A31*a11 + A32*a12; double P32 = A31*a21 + A32*a22; double P33 = A31*a31 + A32*a32; - - ///Construct the new covariance matrix (3x3) - nCovVtx(0,0) = P11; nCovVtx(0,1) = P12; nCovVtx(0,2) = P13; - nCovVtx(1,0) = P21; nCovVtx(1,1) = P22; nCovVtx(1,2) = P23; - nCovVtx(2,0) = P31; nCovVtx(2,1) = P32; nCovVtx(2,2) = P33; - - } else if ( Trk::Surface::Line == trkPar.associatedSurface().type() ){ - ///The local position parameters covariance matrix C (2x2) + /// The Jacobian matrix J (3x2) + double Ax[3] = { T(0, 0), T(1, 0), T(2, 0) }; + double Ay[3] = { T(0, 1), T(1, 1), T(2, 1) }; + double a11 = Ax[0]; + double a12 = Ay[0]; + double a21 = Ax[1]; + double a22 = Ay[1]; + double a31 = Ax[2]; + double a32 = Ay[2]; + + /// The A = J.C (3x2) + double A11 = a11 * p11 + a12 * p21; + double A12 = a11 * p12 + a12 * p22; + double A21 = a21 * p11 + a22 * p21; + double A22 = a21 * p12 + a22 * p22; + double A31 = a31 * p11 + a32 * p21; + double A32 = a31 * p12 + a32 * p22; + + /// The A.JT = J.C.JT (3x3) + double P11 = a11 * A11 + A12 * a12; + double P12 = A11 * a21 + A12 * a22; + double P13 = A11 * a31 + A12 * a32; + double P21 = A21 * a11 + A22 * a12; + double P22 = A21 * a21 + A22 * a22; + double P23 = A21 * a31 + A22 * a32; + double P31 = A31 * a11 + A32 * a12; + double P32 = A31 * a21 + A32 * a22; + double P33 = A31 * a31 + A32 * a32; + + /// Construct the new covariance matrix (3x3) + nCovVtx(0, 0) = P11; + nCovVtx(0, 1) = P12; + nCovVtx(0, 2) = P13; + nCovVtx(1, 0) = P21; + nCovVtx(1, 1) = P22; + nCovVtx(1, 2) = P23; + nCovVtx(2, 0) = P31; + nCovVtx(2, 1) = P32; + nCovVtx(2, 2) = P33; + + } else if (Trk::Surface::Line == trkPar.associatedSurface().type()) { + + /// The local position parameters covariance matrix C (2x2) double p11 = em(Trk::locR, Trk::locR); double p12 = em(Trk::locR, Trk::locZ); double p21 = em(Trk::locZ, Trk::locR); double p22 = em(Trk::locZ, Trk::locZ); - + ///The straight line surface (wire) global directions double A[3] = {T(0,2),T(1,2),T(2,2)}; @@ -440,7 +470,6 @@ namespace InDet { nCovVtx(0,0) = P11; nCovVtx(0,1) = P12; nCovVtx(0,2) = P13; nCovVtx(1,0) = P21; nCovVtx(1,1) = P22; nCovVtx(1,2) = P23; nCovVtx(2,0) = P31; nCovVtx(2,1) = P32; nCovVtx(2,2) = P33; - } // now construct the vertex from the global position, cov. put NdF and chi2 to zero (Markus) @@ -454,14 +483,13 @@ namespace InDet { vertex->setVertexType(xAOD::VxType::ConvVtx); vertex->setFitQuality( 0, 0); - return vertex; - + return vertex; } // ------------------------------------------------------- // preselection cuts on track particles // ------------------------------------------------------- - bool SingleTrackConversionTool::selectSingleTrackParticleConversion(const xAOD::TrackParticle* track){ + bool SingleTrackConversionTool::selectSingleTrackParticleConversion(const xAOD::TrackParticle* track) const{ //Position of first hit in track particle @@ -524,7 +552,8 @@ namespace InDet { - if(ntrt > 0 && (!m_PIDonlyForXe || nTrtXenonHits==ntrt) ) { // only check TRT PID if m_PIDonlyForXe is false or all TRT hits are Xenon hits + if(ntrt > 0 && (!m_PIDonlyForXe || nTrtXenonHits==ntrt) ) { + // only check TRT PID if m_PIDonlyForXe is false or all TRT hits are Xenon hits float prob = 1.0; if( !track->summaryValue(prob,xAOD::eProbabilityHT) ) { diff --git a/InnerDetector/InDetRecTools/InDetConversionFinderTools/src/TrackPairsSelector.cxx b/InnerDetector/InDetRecTools/InDetConversionFinderTools/src/TrackPairsSelector.cxx index 00ff0a4c31f..db3f86987b3 100644 --- a/InnerDetector/InDetRecTools/InDetConversionFinderTools/src/TrackPairsSelector.cxx +++ b/InnerDetector/InDetRecTools/InDetConversionFinderTools/src/TrackPairsSelector.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /*************************************************************************** @@ -37,17 +37,17 @@ namespace InDet { // ------------------------------------------------------------- static const InterfaceID IID_ITrackPairsSelector("InDet::TrackPairsSelector", 1, 0); - + // ------------------------------------------------------------- - TrackPairsSelector::TrackPairsSelector(const std::string& type, const std::string& name, const IInterface* parent) : - AthAlgTool(type, name, parent), - m_helpertool("InDet::ConversionFinderUtils"), - m_distanceTool("Trk::SeedNewtonDistanceFinder/InDetConversionTrkDistanceFinder"), - m_maxR(500.), - m_MinTrkAngle(0.), - m_distance(9999.), - m_deltaCotTheta(9999.), - m_deltaInit(9999.) + TrackPairsSelector::TrackPairsSelector(const std::string& type, + const std::string& name, + const IInterface* parent) + : AthAlgTool(type, name, parent) + , m_helpertool("InDet::ConversionFinderUtils") + , m_distanceTool( + "Trk::SeedNewtonDistanceFinder/InDetConversionTrkDistanceFinder") + , m_maxR(500.) + , m_MinTrkAngle(0.) { m_etaCut.push_back(0.8); m_etaCut.push_back(1.2); @@ -86,16 +86,16 @@ namespace InDet { if ( m_helpertool.retrieve().isFailure() ) { msg(MSG::ERROR) << "Failed to retrieve tool " << m_helpertool << endmsg; return StatusCode::FAILURE; - } else { + } msg(MSG::INFO) << "Retrieved tool " << m_helpertool << endmsg; - } + /* Get the distance tool from ToolsSvc */ if(m_distanceTool.retrieve().isFailure()) { msg(MSG::ERROR) << "Could not get " << m_distanceTool << endmsg; return StatusCode::FAILURE; - }else{ - msg(MSG::INFO) << "Got the distance tool " << m_distanceTool << endmsg; } + msg(MSG::INFO) << "Got the distance tool " << m_distanceTool << endmsg; + msg(MSG::INFO) << "Initialization successful" << endmsg; return StatusCode::SUCCESS; } @@ -106,7 +106,12 @@ namespace InDet { } // ------------------------------------------------------------- - bool TrackPairsSelector::selectTrackParticlePair(const xAOD::TrackParticle* trkPpos, const xAOD::TrackParticle* trkPneg) { + bool + TrackPairsSelector::selectTrackParticlePair( + const xAOD::TrackParticle* trkPpos, + const xAOD::TrackParticle* trkPneg, + TrackPairsSelector::Cache& cache) const + { bool pass = true; //Getting the track perigee parameters @@ -172,10 +177,6 @@ namespace InDet { return false; } - - -// Need to work out a way to do this elegently -// if(!parPos || !parNeg) {pass = false; return pass;} double firstRpos = parPos.position().perp(); double firstRneg = parNeg.position().perp(); @@ -190,9 +191,11 @@ namespace InDet { else detaCut = m_etaCut[2]; } - m_deltaCotTheta = fabs(1./tan(perPos->parameters()[Trk::theta]) - 1./tan(perNeg->parameters()[Trk::theta])); - if (m_deltaCotTheta > detaCut) return false; - + cache.m_deltaCotTheta = fabs(1. / tan(perPos->parameters()[Trk::theta]) - + 1. / tan(perNeg->parameters()[Trk::theta])); + if (cache.m_deltaCotTheta > detaCut) + return false; + //Cut on distance between the initial hit position of the two tracks. double dinit = 1000.; if(sCase == 0) { @@ -203,8 +206,8 @@ namespace InDet { dinit = m_initCut[2]; } - m_deltaInit = fabs(firstRpos - firstRneg); - if (m_deltaInit > dinit) return false; + cache.m_deltaInit = fabs(firstRpos - firstRneg); + if (cache.m_deltaInit > dinit) return false; //Cut on distance of minimum approach between the two tracks. double maxDist = 1000.; @@ -216,23 +219,27 @@ namespace InDet { maxDist = m_maxDist[2]; } - m_distance = 1000000.; + cache.m_distance = 1000000.; std::optional result = m_distanceTool->CalculateMinimumDistance(trkPneg->perigeeParameters(), trkPpos->perigeeParameters() ); if (!result) return false; - m_distance = dist (result.value()); - if (m_distance>maxDist) return false; + cache.m_distance = dist (result.value()); + if (cache.m_distance>maxDist) return false; //3D angle cut in the case of V0s, not used in the case of conversions - double d_beta = (perPos->momentum().dot(perNeg->momentum()))/(perPos->momentum().mag()*perNeg->momentum().mag()); + double d_beta = (perPos->momentum().dot(perNeg->momentum())) / + (perPos->momentum().mag() * perNeg->momentum().mag()); if(d_beta parameters()[Trk::theta]) - 1./tan(perNeg->parameters()[Trk::theta])) > detaCut) pass = false; + if (fabs(1. / tan(perPos->parameters()[Trk::theta]) - + 1. / tan(perNeg->parameters()[Trk::theta])) > detaCut) + pass = false; //Cut on distance between the initial hit position of the two tracks. double dinit = 1000.; @@ -299,18 +308,21 @@ namespace InDet { } //3D angle cut in the case of V0s, not used in the case of conversions - double d_beta = (perPos->momentum().dot(perNeg->momentum()))/(perPos->momentum().mag()*perNeg->momentum().mag()); + double d_beta = (perPos->momentum().dot(perNeg->momentum())) / + (perPos->momentum().mag() * perNeg->momentum().mag()); if(d_beta TrackPairsSelector::getLastValues() + std::map + TrackPairsSelector::getLastValues( + const TrackPairsSelector::Cache& cache) const { - return {{"minimumDistanceTrk", m_distance}, - {"deltaCotThetaTrk", m_deltaCotTheta}, - {"deltaInitRadius", m_deltaInit} }; + return {{"minimumDistanceTrk", cache.m_distance}, + {"deltaCotThetaTrk", cache.m_deltaCotTheta}, + {"deltaInitRadius", cache.m_deltaInit} }; } } // namespace InDet diff --git a/InnerDetector/InDetRecTools/InDetConversionFinderTools/src/VertexPointEstimator.cxx b/InnerDetector/InDetRecTools/InDetConversionFinderTools/src/VertexPointEstimator.cxx index 6b565d8d91b..4394c4b4c4c 100644 --- a/InnerDetector/InDetRecTools/InDetConversionFinderTools/src/VertexPointEstimator.cxx +++ b/InnerDetector/InDetRecTools/InDetConversionFinderTools/src/VertexPointEstimator.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /*************************************************************************** @@ -475,9 +475,9 @@ namespace InDet { yi2 = A*xi2 + B; return true; } - else return false; + return false; } - else if (xc1 != xc2){ + if (xc1 != xc2){ double A = (yc1 - yc2) / (xc2- xc1); double B = (r1*r1 - r2*r2 - xc1*xc1 + xc2*xc2 - yc1*yc1 + yc2*yc2) / 2. / ( xc2 -xc1); double a = 1 + A*A; @@ -488,12 +488,12 @@ namespace InDet { xi2 = A*yi2 + B; return true; } - else return false; + return false; } - else { + // circles are concentric and we don't care return false; - } + return false; } diff --git a/InnerDetector/InDetRecTools/InDetPriVxFinderTool/CMakeLists.txt b/InnerDetector/InDetRecTools/InDetPriVxFinderTool/CMakeLists.txt index bc34afcd990..ef916000b2a 100644 --- a/InnerDetector/InDetRecTools/InDetPriVxFinderTool/CMakeLists.txt +++ b/InnerDetector/InDetRecTools/InDetPriVxFinderTool/CMakeLists.txt @@ -8,7 +8,7 @@ atlas_subdir( InDetPriVxFinderTool ) # Declare the package's dependencies: atlas_depends_on_subdirs( PUBLIC Control/AthenaBaseComps - Control/StoreGate + Control/StoreGate Event/xAOD/xAODTracking GaudiKernel InnerDetector/InDetRecTools/InDetRecToolInterfaces @@ -16,7 +16,8 @@ atlas_depends_on_subdirs( PUBLIC Tracking/TrkEvent/TrkParameters Tracking/TrkEvent/TrkParticleBase Tracking/TrkEvent/TrkTrack - InnerDetector/InDetConditions/BeamSpotConditionsData + InnerDetector/InDetConditions/BeamSpotConditionsData + Control/CxxUtils PRIVATE Control/AthContainers DetectorDescription/GeoPrimitives @@ -42,7 +43,10 @@ atlas_add_component( InDetPriVxFinderTool src/*.cxx src/components/*.cxx INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} ${EIGEN_INCLUDE_DIRS} - LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} ${EIGEN_LIBRARIES} AthenaBaseComps xAODTracking GaudiKernel InDetRecToolInterfaces PATCoreLib TrkParameters TrkParticleBase TrkTrack AthContainers GeoPrimitives EventPrimitives TrkSurfaces TrkEventPrimitives TrkLinks TrkTrackSummary VxMultiVertex VxVertex TrkVertexFitterInterfaces TrkVertexFittersLib BeamSpotConditionsData StoreGateLib) + LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} ${EIGEN_LIBRARIES} AthenaBaseComps xAODTracking + GaudiKernel InDetRecToolInterfaces PATCoreLib TrkParameters TrkParticleBase TrkTrack CxxUtils AthContainers GeoPrimitives + EventPrimitives TrkSurfaces TrkEventPrimitives TrkLinks TrkTrackSummary VxMultiVertex VxVertex + TrkVertexFitterInterfaces TrkVertexFittersLib BeamSpotConditionsData StoreGateLib) # Install files from the package: atlas_install_headers( InDetPriVxFinderTool ) diff --git a/InnerDetector/InDetRecTools/InDetPriVxFinderTool/InDetPriVxFinderTool/InDetAdaptiveMultiPriVxFinderTool.h b/InnerDetector/InDetRecTools/InDetPriVxFinderTool/InDetPriVxFinderTool/InDetAdaptiveMultiPriVxFinderTool.h index dc8abc17203..f604fcd6c17 100755 --- a/InnerDetector/InDetRecTools/InDetPriVxFinderTool/InDetPriVxFinderTool/InDetAdaptiveMultiPriVxFinderTool.h +++ b/InnerDetector/InDetRecTools/InDetPriVxFinderTool/InDetPriVxFinderTool/InDetAdaptiveMultiPriVxFinderTool.h @@ -6,45 +6,45 @@ * @class InDet::InDetAdaptiveMultiPriVxFinderTool * * @author Giacinto Piacquadio (Freiburg University) - * + * * (giacinto.piacquadio@physik.uni-freiburg.de) - * - * This class provides an implementation for a primary - * vertex finding tool, which uses the \Adaptive MultiVertex\ - * Fitter to solve the problem of finding the multiple - * interaction vertices and to find out the best possible + * + * This class provides an implementation for a primary + * vertex finding tool, which uses the \Adaptive MultiVertex\ + * Fitter to solve the problem of finding the multiple + * interaction vertices and to find out the best possible * assignment of the track to the vertices. * * The steps done are the following: * - the selection cuts are applied - * + * * then iteratively: * - a new vertex is seeded with the remaining tracks * (the seed finder is used) - * - all the tracks whose Z at PCA is closer to the seeded - * vertex by more than TracksMaxZinterval (by JobOption), + * - all the tracks whose Z at PCA is closer to the seeded + * vertex by more than TracksMaxZinterval (by JobOption), * are added to the new vertex candidate - * - the new vertex candidate is added on top of the previous fit and - * the AdaptiveMultiVertexFitter is used to fit all them + * - the new vertex candidate is added on top of the previous fit and + * the AdaptiveMultiVertexFitter is used to fit all them * together (more information in the \\TrkVertexFitters\\ * package). - * - the tracks already used are removed from the tracks - * from which the next seed would be obtained and if there + * - the tracks already used are removed from the tracks + * from which the next seed would be obtained and if there * are more than 2 left, a new iteration is started. * * when no more than 2 seeding tracks are left: - * - a vector of MVFVxCandidate is provided as result and - * according to the selection type, the order in which it is - * provided represents how high the probability of that - * particular vertex to come from the primary vertex is. + * - a vector of MVFVxCandidate is provided as result and + * according to the selection type, the order in which it is + * provided represents how high the probability of that + * particular vertex to come from the primary vertex is. * - * In general the first VxCandidate* in the collection is - * the one with highest sqrt(N_tracks)*Sum Pt_track^2. This - * is the case if the selectiontype in the jobOptions is set + * In general the first VxCandidate* in the collection is + * the one with highest sqrt(N_tracks)*Sum Pt_track^2. This + * is the case if the selectiontype in the jobOptions is set * to 0 (default). * * - * This finder is particularly suited for the high luminosities + * This finder is particularly suited for the high luminosities * scenarios which will came up at LHC. * * ------------------------------------------------------------ @@ -52,13 +52,13 @@ * * David Shope (2016-04-19) * - * EDM Migration to xAOD - from Trk::VxCandidate to xAOD::Vertex, + * EDM Migration to xAOD - from Trk::VxCandidate to xAOD::Vertex, * from Trk::RecVertex to xAOD::Vertex, * from Trk::Vertex to Amg::Vector3D * * Also, VxMultiVertex EDM has been migrated to the following: * - * Trk::MvfFitInfo + * Trk::MvfFitInfo * constraintVertex now uses xAOD::Vertex * seedVertex now uses Amg::Vector3D * linearizationVertex now uses Amg::Vector3D @@ -66,263 +66,276 @@ * Trk::TrackToVtxLink * Vertex objects stored using this class are now xAOD::Vertex * - * Instead of using the MVFVxCandidate class, xAOD::Vertex is employed by decorating it - * with the multi-vertex information: + * Instead of using the MVFVxCandidate class, xAOD::Vertex is employed by + * decorating it with the multi-vertex information: * * bool isInitialized * MvfFitInfo* MvfFitInfo * std::Vector\ VTAV * - * This last decoration is needed in order to be able to use MVFVxTrackAtVertex objects - * which have the additional information of xAOD::Vertices associated to the track - * and (through polymorphism) to still be able to pass them to the KalmanVertexUpdator as - * VxTracksAtVertex objects. + * This last decoration is needed in order to be able to use + * MVFVxTrackAtVertex objects which have the additional information of + * xAOD::Vertices associated to the track and (through polymorphism) to still be + * able to pass them to the KalmanVertexUpdator as VxTracksAtVertex objects. */ #ifndef INDETPRIVXFINDERTOOL_INDETADAPTIVEMULTIPRIVXFINDERTOOL_H #define INDETPRIVXFINDERTOOL_INDETADAPTIVEMULTIPRIVXFINDERTOOL_H -#include "InDetRecToolInterfaces/IVertexFinder.h" #include "AthenaBaseComps/AthAlgTool.h" -#include "GaudiKernel/ToolHandle.h" +#include "CxxUtils/checker_macros.h" #include "GaudiKernel/ServiceHandle.h" -#include "TrkTrack/TrackCollection.h" // type def ... -#include "TrkParticleBase/TrackParticleBaseCollection.h" +#include "GaudiKernel/ToolHandle.h" +#include "InDetRecToolInterfaces/IVertexFinder.h" #include "TrkParameters/TrackParameters.h" +#include "TrkParticleBase/TrackParticleBaseCollection.h" +#include "TrkTrack/TrackCollection.h" // type def ... #include /** - * Forward declarations + * Forward declarations */ -#include "xAODTracking/VertexFwd.h" -#include "xAODTracking/TrackParticleFwd.h" -#include "xAODTracking/VertexContainerFwd.h" -#include "xAODTracking/TrackParticleContainerFwd.h" #include "BeamSpotConditionsData/BeamSpotData.h" #include "TrkVertexFitterInterfaces/ITrackToVertexIPEstimator.h" +#include "xAODTracking/TrackParticleContainerFwd.h" +#include "xAODTracking/TrackParticleFwd.h" +#include "xAODTracking/VertexContainerFwd.h" +#include "xAODTracking/VertexFwd.h" class TrackToVtxLinkContainer; -class NN; - -namespace Trk -{ - class IVertexAnalyticSeedFinder; - class AdaptiveMultiVertexFitter; - class Track; - class ITrackLink; - class TrkQuality; - class IVxCandidateXAODVertex; +namespace Trk { +class IVertexAnalyticSeedFinder; +class AdaptiveMultiVertexFitter; +class Track; +class ITrackLink; +class TrkQuality; +class IVxCandidateXAODVertex; } +namespace InDet { +class IInDetTrackSelectionTool; -namespace InDet +class InDetAdaptiveMultiPriVxFinderTool + : public AthAlgTool + , virtual public IVertexFinder { - class IInDetTrackSelectionTool; - - class InDetAdaptiveMultiPriVxFinderTool : public AthAlgTool, virtual public IVertexFinder - { - - public: - - InDetAdaptiveMultiPriVxFinderTool(const std::string& t, const std::string& n, const IInterface* p); - virtual ~InDetAdaptiveMultiPriVxFinderTool(); - - StatusCode initialize(); - - /** - * The MultiVertexFinding is performed. - * - * Input is the Track Collection. Output is the VertexContainer - * with a list of fitted vertices, according to the probability - * of being the primary interaction point. - * - * Description of the finder is provided as doxygen info on the class. - * - */ - - std::pair findVertex(const TrackCollection* trackTES); - std::pair findVertex(const Trk::TrackParticleBaseCollection* trackTES); - std::pair findVertex(const xAOD::TrackParticleContainer* trackParticles); - - StatusCode finalize(); - - private: - - std::pair findVertex(const std::vector & trackVector); - - void SGError(std::string errService); - virtual void printParameterSettings(); - - ToolHandle< Trk::AdaptiveMultiVertexFitter > m_MultiVertexFitter; - ToolHandle< Trk::IVertexAnalyticSeedFinder > m_analyticSeedFinder; - ToolHandle< InDet::IInDetTrackSelectionTool > m_trkFilter; - - SG::ReadCondHandleKey m_beamSpotKey { this, "BeamSpotKey", "BeamSpotData", "SG key for beam spot" }; - - /** Define a beam constraint for the fit */ - bool m_useBeamConstraint; //!< Use a vertex/beam constraint - - - /** - * When adding a new vertex to the multi vertex fit, - * only the tracks whose Z at PCA is closer - * to the seeded by more than this TracksMaxZinterval - * value are added to this new vertex. - * - * Default is 4 mm. If you cut too hard, you cut out - * the good cases where the seed finder is not - * reliable, but the fit would be still able to converge - * towards the right vertex. If you cut too soft, you - * consider a lot of tracks which just slow down the fit. - */ - - double m_TracksMaxZinterval; - - /** - * After having added one vertex to the fit and having - * performed the MultiVertex fit again, all the tracks - * which are compatible to the new vertex by more than - * this maxVertexChi2 (in units of chi2) value are eliminated from the - * tracks from which still to seed the next vertex. - * - */ - - double m_maxVertexChi2; - - /** - * As a default the realMultiVertex should stay to false (because this is very well tested). - * - * If switched to true, all the tracks are considered to be added to the new vertex - * after this new one is seeded, and not only the ones which are considered as outliers - * of previous fitted vertices. - * - * The presence of a core of tracks the previous vertices are as attached to stabilizes - * the fit quite drastically. In case of luminosities higher than the low lumi scenario, - * one should probably to try to switch this on, or, if this doesn't work, decrease the - * maxVertexChi2 and the cleaningZinterval to lower values. - */ - - bool m_realMultiVertex; - - - /* - * Decides if you want to use the vtxCompatibility() of the track (set to true) or - * the chi2() (set to false) as an estimate for a track being an outlier or not. - * The vtxCompatibility() is the default. In case the track refitting - * is switched on in the AdaptiveMultiVertex fitter, you may want to - * use the refutted chi2(). - * - */ - - bool m_useFastCompatibility; - - /* - * Selection of the most probable primary interaction vertex is done accordingly to: - * - selectiontype is 0: just sqrt(N_tracks)*Sum_track p_t_track^2 - * - selectiontype is 1: Neural Network is used, trained on WH(120) - */ - - int m_selectiontype; - - /* - * During the estimation of probability of vertex candidate to be the primary interaction - * vertex, only all the tracks which have chi2 in the vertex fit higher than this value - * are used for the sum of p_t^2 or as input for the Neural Network. - */ - - double m_finalCutMaxVertexChi2; - - - /* - * Maximum significance on the distance between two vertices - * to allow merging of two vertices. - * - */ - - double m_cutVertexDependence; - - - /* - * Has to be setup equal to the minimum weight set in the fitter. - * - * In the fitting, when a track has a weight lower than this value, - * the track is not updated during that iteration. - */ - - double m_minweight; - - - /* - * Impact parameter estimator used to calculate significance - */ - ToolHandle< Trk::ITrackToVertexIPEstimator > m_ipEstimator { "Trk::TrackToVertexIPEstimator" }; - - /* - * Maximum amount of iterations allowed for vertex finding. - * - * The more vertices you have in the event, the more iterations you have to - * allow (safe factor: number of expected vertices * 10) - * - */ - - double m_maxIterations; - - NN* m_testingclass; - - /* - * Fit also single track vertices - * (could be usefull for example for H-> gamma gamma)\ - * - */ - - bool m_addSingleTrackVertices; - - bool m_do3dSplitting; - - double m_zBfieldApprox; - - double m_maximumVertexContamination; - - /* - * Maximum allowed significance of track position to vertex seed - */ - double m_tracksMaxSignificance ; - - /* - * Toggle vertex seed constraint on/off - */ - bool m_useSeedConstraint ; - - - struct CompareTheTwoVertices { - bool operator()( xAOD::Vertex* const & first, xAOD::Vertex* const & second); - }; - - /** - * Internal method to estimate the probability to be signal vertex of a certain vertex candidate. - */ - double estimateSignalCompatibility(xAOD::Vertex *myxAODVertex); +public: + InDetAdaptiveMultiPriVxFinderTool(const std::string& t, + const std::string& n, + const IInterface* p); + virtual ~InDetAdaptiveMultiPriVxFinderTool(); + + virtual StatusCode initialize() override; + + /** + * The MultiVertexFinding is performed. + * + * Input is the Track Collection. Output is the VertexContainer + * with a list of fitted vertices, according to the probability + * of being the primary interaction point. + * + * Description of the finder is provided as doxygen info on the class. + * + */ + using IVertexFinder::findVertex; + + virtual std::pair + findVertex(const TrackCollection* trackTES) const override; + + virtual std::pair + findVertex(const Trk::TrackParticleBaseCollection* trackTES) const override; + + virtual std::pair + findVertex(const xAOD::TrackParticleContainer* trackParticles) const override; + + virtual StatusCode finalize() override; + +private: + std::pair findVertex( + const std::vector& trackVector) const; + + void SGError(const std::string& errService); + virtual void printParameterSettings(); + + ToolHandle m_MultiVertexFitter; + ToolHandle m_analyticSeedFinder; + ToolHandle m_trkFilter; + + SG::ReadCondHandleKey m_beamSpotKey{ + this, + "BeamSpotKey", + "BeamSpotData", + "SG key for beam spot" + }; + + /** Define a beam constraint for the fit */ + bool m_useBeamConstraint; //!< Use a vertex/beam constraint + + /** + * When adding a new vertex to the multi vertex fit, + * only the tracks whose Z at PCA is closer + * to the seeded by more than this TracksMaxZinterval + * value are added to this new vertex. + * + * Default is 4 mm. If you cut too hard, you cut out + * the good cases where the seed finder is not + * reliable, but the fit would be still able to converge + * towards the right vertex. If you cut too soft, you + * consider a lot of tracks which just slow down the fit. + */ + + double m_TracksMaxZinterval; + + /** + * After having added one vertex to the fit and having + * performed the MultiVertex fit again, all the tracks + * which are compatible to the new vertex by more than + * this maxVertexChi2 (in units of chi2) value are eliminated from the + * tracks from which still to seed the next vertex. + * + */ + + double m_maxVertexChi2; + + /** + * As a default the realMultiVertex should stay to false (because this is very + * well tested). + * + * If switched to true, all the tracks are considered to be added to the new + * vertex after this new one is seeded, and not only the ones which are + * considered as outliers of previous fitted vertices. + * + * The presence of a core of tracks the previous vertices are as attached to + * stabilizes the fit quite drastically. In case of luminosities higher than + * the low lumi scenario, one should probably to try to switch this on, or, if + * this doesn't work, decrease the maxVertexChi2 and the cleaningZinterval to + * lower values. + */ + + bool m_realMultiVertex; + + /* + * Decides if you want to use the vtxCompatibility() of the track (set to + * true) or the chi2() (set to false) as an estimate for a track being an + * outlier or not. The vtxCompatibility() is the default. In case the track + * refitting is switched on in the AdaptiveMultiVertex fitter, you may want to + * use the refutted chi2(). + * + */ + + bool m_useFastCompatibility; + + /* + * Selection of the most probable primary interaction vertex is done + * accordingly to: + * - selectiontype is 0: just sqrt(N_tracks)*Sum_track p_t_track^2 + * - selectiontype is 1: Neural Network is used, trained on WH(120) + */ - /** - * Estimate DeltaZ given a certain track parameters and beam spot center position - * ONLY TEMPORARY 15-08-2009: common tool needed to collect this method - */ - - double estimateDeltaZ(const Trk::TrackParameters& myPerigee, const Amg::Vector3D& myTransvVertex); + int m_selectiontype; - /** + /* + * During the estimation of probability of vertex candidate to be the primary + * interaction vertex, only all the tracks which have chi2 in the vertex fit + * higher than this value are used for the sum of p_t^2 or as input for the + * Neural Network. + */ + + double m_finalCutMaxVertexChi2; + + /* + * Maximum significance on the distance between two vertices + * to allow merging of two vertices. + * + */ + + double m_cutVertexDependence; + + /* + * Has to be setup equal to the minimum weight set in the fitter. + * + * In the fitting, when a track has a weight lower than this value, + * the track is not updated during that iteration. + */ + + double m_minweight; + + /* + * Impact parameter estimator used to calculate significance + */ + ToolHandle m_ipEstimator{ + "Trk::TrackToVertexIPEstimator" + }; + + /* + * Maximum amount of iterations allowed for vertex finding. + * + * The more vertices you have in the event, the more iterations you have to + * allow (safe factor: number of expected vertices * 10) + * + */ + + double m_maxIterations; + + /* + * Fit also single track vertices + * (could be usefull for example for H-> gamma gamma)\ + * + */ + + bool m_addSingleTrackVertices; + + bool m_do3dSplitting; + + double m_zBfieldApprox; + + double m_maximumVertexContamination; + + /* + * Maximum allowed significance of track position to vertex seed + */ + double m_tracksMaxSignificance; + + /* + * Toggle vertex seed constraint on/off + */ + bool m_useSeedConstraint; + + struct CompareTheTwoVertices + { + bool operator()(xAOD::Vertex* const& first, xAOD::Vertex* const& second); + }; + + /** + * Internal method to estimate the probability to be signal vertex of a + * certain vertex candidate. + */ + + double estimateSignalCompatibility(xAOD::Vertex* myxAODVertex) const; + + /** + * Estimate DeltaZ given a certain track parameters and beam spot center + * position ONLY TEMPORARY 15-08-2009: common tool needed to collect this + * method + */ + + double estimateDeltaZ(const Trk::TrackParameters& myPerigee, + const Amg::Vector3D& myTransvVertex) const; + + /** * copying from the guassian density alg */ - double ipSignificance(const Trk::TrackParameters* params, const Amg::Vector3D * vertex) const; + double ipSignificance(const Trk::TrackParameters* params, + const Amg::Vector3D* vertex) const; + + /** + * Clean decorator data from a vertex candidate (to avoid memory leaks) and + * then delete it and set to zero + */ - /** - * Clean decorator data from a vertex candidate (to avoid memory leaks) and then delete it and set to zero - */ - - void releaseCandidate(xAOD::Vertex*& candidate); - + void releaseCandidate(xAOD::Vertex*& candidate) const; - };//end of class -}//end of namespace definitions +}; // end of class +} // end of namespace definitions #endif - + diff --git a/InnerDetector/InDetRecTools/InDetPriVxFinderTool/InDetPriVxFinderTool/InDetAdaptivePriVxFinderTool.h b/InnerDetector/InDetRecTools/InDetPriVxFinderTool/InDetPriVxFinderTool/InDetAdaptivePriVxFinderTool.h index f1974942d56..7d707e52eb7 100755 --- a/InnerDetector/InDetRecTools/InDetPriVxFinderTool/InDetPriVxFinderTool/InDetAdaptivePriVxFinderTool.h +++ b/InnerDetector/InDetRecTools/InDetPriVxFinderTool/InDetPriVxFinderTool/InDetAdaptivePriVxFinderTool.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /** @@ -9,27 +9,26 @@ * @author Giacinto Piacquadio (Freiburg University) * * - * This class provides an implementation for a primary - * vertex finding tool, which uses the Adaptive Vertex - * Fitter to reject outliers not belonging to the primary + * This class provides an implementation for a primary + * vertex finding tool, which uses the Adaptive Vertex + * Fitter to reject outliers not belonging to the primary * vertex interaction. * * The steps done are simply; * - Tracks are selected according to the specified cuts * - The Adaptive Vertex Finder is used to fit them * - * Contrary to the InDetPriVxFinderTool, the outlier + * Contrary to the InDetPriVxFinderTool, the outlier * rejection is done by the fitter and not by the finder. * - * One only vertex can be fit, so it is not suited (as a + * One only vertex can be fit, so it is not suited (as a * finder) when many minimum bias vertices can be expected. * In this case please use the InDetPriVxFinderTool. * * - * (this is a modified verson of InDetPriVxFinderTool.h of A. Wildauer & F. Akesson) - * changes : - * 06/12/2006 Kirill.Prokofiev@cern.ch - * EDM cleanup and switching to the FitQuality use + * (this is a modified verson of InDetPriVxFinderTool.h of A. Wildauer & F. + *Akesson) changes : 06/12/2006 Kirill.Prokofiev@cern.ch EDM cleanup and + *switching to the FitQuality use * * 2016-04-26 David Shope * EDM Migration to xAOD - from Trk::VxCandidate to xAOD::Vertex @@ -40,91 +39,105 @@ * ***************************************************************************/ -//implemented using as template the InDetPriVxFinderTool class of A. Wildauer and F. Akesson +// implemented using as template the InDetPriVxFinderTool class of A. Wildauer +// and F. Akesson #ifndef INDETPRIVXFINDERTOOL_INDETADAPTIVEPRIVXFINDERTOOL_H #define INDETPRIVXFINDERTOOL_INDETADAPTIVEPRIVXFINDERTOOL_H -#include "InDetRecToolInterfaces/IVertexFinder.h" #include "AthenaBaseComps/AthAlgTool.h" -#include "GaudiKernel/ToolHandle.h" #include "GaudiKernel/ServiceHandle.h" -#include "TrkTrack/TrackCollection.h" // type def ... -#include "TrkParticleBase/TrackParticleBaseCollection.h" // type def ... +#include "GaudiKernel/ToolHandle.h" +#include "InDetRecToolInterfaces/IVertexFinder.h" #include "TrkParameters/TrackParameters.h" +#include "TrkParticleBase/TrackParticleBaseCollection.h" // type def ... +#include "TrkTrack/TrackCollection.h" // type def ... /** - * Forward declarations + * Forward declarations */ - + #include "BeamSpotConditionsData/BeamSpotData.h" -#include "xAODTracking/VertexFwd.h" +#include "xAODTracking/TrackParticleContainerFwd.h" #include "xAODTracking/TrackParticleFwd.h" #include "xAODTracking/VertexContainerFwd.h" -#include "xAODTracking/TrackParticleContainerFwd.h" +#include "xAODTracking/VertexFwd.h" -namespace Trk -{ - class IVertexFitter; - class Track; - class TrackParticleBase; - class IVxCandidateXAODVertex; +namespace Trk { +class IVertexFitter; +class Track; +class TrackParticleBase; +class IVxCandidateXAODVertex; } -namespace InDet +namespace InDet { +class IInDetTrackSelectionTool; + +class InDetAdaptivePriVxFinderTool + : public AthAlgTool + , virtual public IVertexFinder { - class IInDetTrackSelectionTool; - - class InDetAdaptivePriVxFinderTool : public AthAlgTool, virtual public IVertexFinder - { public: + /** + * Constructor + */ + + InDetAdaptivePriVxFinderTool(const std::string& t, + const std::string& n, + const IInterface* p); - /** - * Constructor - */ - - InDetAdaptivePriVxFinderTool(const std::string& t, const std::string& n, const IInterface* p); - - /** - * Destructor - */ - - virtual ~InDetAdaptivePriVxFinderTool(); - - StatusCode initialize(); - - /** - * Finding method. - * Has as input a track collection and as output - * a VxContainer. - */ - - std::pair findVertex(const TrackCollection* trackTES); - std::pair findVertex(const Trk::TrackParticleBaseCollection* trackTES); - std::pair findVertex(const xAOD::TrackParticleContainer* trackParticles); - - StatusCode finalize(); - - private: - - /** the common finding code (regardless of Track or TrackParticle(Base) is here */ - std::pair findVertex(std::vector& origParameters); - - ToolHandle< Trk::IVertexFitter > m_iVertexFitter; - ToolHandle< InDet::IInDetTrackSelectionTool > m_trkFilter; - - SG::ReadCondHandleKey m_beamSpotKey { this, "BeamSpotKey", "BeamSpotData", "SG key for beam spot" }; - - - void SGError(std::string errService); - - /** - * Internal method to print the parameters setting - */ - - virtual void printParameterSettings(); + /** + * Destructor + */ + + virtual ~InDetAdaptivePriVxFinderTool(); + + virtual StatusCode initialize() override; + + /** + * Finding method. + * Has as input a track collection and as output + * a VxContainer. + */ + + using IVertexFinder::findVertex; + + virtual std::pair findVertex( + const TrackCollection* trackTES) const override; + + virtual std::pair findVertex( + const Trk::TrackParticleBaseCollection* trackTES) const override; - };//end of class definitions -}//end of namespace definitions + virtual std::pair findVertex( + const xAOD::TrackParticleContainer* trackParticles) const override; + + virtual StatusCode finalize() override; + +private: + /** the common finding code (regardless of Track or TrackParticle(Base) is + * here */ + std::pair findVertex( + std::vector& origParameters) const; + + ToolHandle m_iVertexFitter; + ToolHandle m_trkFilter; + + SG::ReadCondHandleKey m_beamSpotKey{ + this, + "BeamSpotKey", + "BeamSpotData", + "SG key for beam spot" + }; + + void SGError(const std::string& errService); + + /** + * Internal method to print the parameters setting + */ + + virtual void printParameterSettings(); + +}; // end of class definitions +} // end of namespace definitions #endif - + diff --git a/InnerDetector/InDetRecTools/InDetPriVxFinderTool/InDetPriVxFinderTool/InDetIterativePriVxFinderTool.h b/InnerDetector/InDetRecTools/InDetPriVxFinderTool/InDetPriVxFinderTool/InDetIterativePriVxFinderTool.h index 8c9b8898e9a..61272955381 100755 --- a/InnerDetector/InDetRecTools/InDetPriVxFinderTool/InDetPriVxFinderTool/InDetIterativePriVxFinderTool.h +++ b/InnerDetector/InDetRecTools/InDetPriVxFinderTool/InDetPriVxFinderTool/InDetIterativePriVxFinderTool.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /** @@ -9,11 +9,11 @@ * @author Giacinto Piacquadio (Freiburg University) * * - * This class provides an implementation for a primary - * vertex finding tool, which uses the Adaptive Vertex - * Fitter to reject outliers not belonging to the primary + * This class provides an implementation for a primary + * vertex finding tool, which uses the Adaptive Vertex + * Fitter to reject outliers not belonging to the primary * vertex interaction. - * + * * ------------------------------------------------------ * Changes: * @@ -30,129 +30,139 @@ * ***************************************************************************/ -//implemented using as template the InDetPriVxFinderTool class of A. Wildauer and F. Akesson +// implemented using as template the InDetPriVxFinderTool class of A. Wildauer +// and F. Akesson #ifndef INDETPRIVXFINDERTOOL_INDETITERATIVEPRIVXFINDERTOOL_H #define INDETPRIVXFINDERTOOL_INDETITERATIVEPRIVXFINDERTOOL_H -#include "InDetRecToolInterfaces/IVertexFinder.h" #include "AthenaBaseComps/AthAlgTool.h" +#include "BeamSpotConditionsData/BeamSpotData.h" #include "GaudiKernel/ToolHandle.h" -#include "TrkTrack/TrackCollection.h" // type def ... -#include "TrkParticleBase/TrackParticleBaseCollection.h" // type def ... -#include "TrkParameters/TrackParameters.h" +#include "InDetRecToolInterfaces/IVertexFinder.h" #include "StoreGate/ReadCondHandleKey.h" -#include "BeamSpotConditionsData/BeamSpotData.h" +#include "TrkParameters/TrackParameters.h" +#include "TrkParticleBase/TrackParticleBaseCollection.h" // type def ... +#include "TrkTrack/TrackCollection.h" // type def ... /** - * Forward declarations + * Forward declarations */ - -#include "xAODTracking/VertexFwd.h" + +#include "xAODTracking/TrackParticleContainerFwd.h" #include "xAODTracking/TrackParticleFwd.h" #include "xAODTracking/VertexContainerFwd.h" -#include "xAODTracking/TrackParticleContainerFwd.h" +#include "xAODTracking/VertexFwd.h" -namespace Trk -{ - class IVertexFitter; - class Track; - class TrackParticleBase; - class ITrackLink; - class IVertexSeedFinder; - class IImpactPoint3dEstimator; +namespace Trk { +class IVertexFitter; +class Track; +class TrackParticleBase; +class ITrackLink; +class IVertexSeedFinder; +class IImpactPoint3dEstimator; // class IVertexTrackCompatibilityEstimator; // class ImpactPoint3dAtaPlaneFactory; - class IVertexLinearizedTrackFactory; +class IVertexLinearizedTrackFactory; // class ITrkDistanceFinder; - - class IVxCandidateXAODVertex; + +class IVxCandidateXAODVertex; } -namespace InDet +namespace InDet { +class IInDetTrackSelectionTool; + +class InDetIterativePriVxFinderTool + : public AthAlgTool + , virtual public IVertexFinder { - class IInDetTrackSelectionTool; - - class InDetIterativePriVxFinderTool : public AthAlgTool, virtual public IVertexFinder - { public: + /** + * Constructor + */ - /** - * Constructor - */ - - InDetIterativePriVxFinderTool(const std::string& t, const std::string& n, const IInterface* p); - - /** - * Destructor - */ - - virtual ~InDetIterativePriVxFinderTool(); - - StatusCode initialize(); + InDetIterativePriVxFinderTool(const std::string& t, + const std::string& n, + const IInterface* p); - /** - * Finding method. - * Has as input a track collection and as output - * a VxContainer. - */ + /** + * Destructor + */ - std::pair findVertex(const TrackCollection* trackTES); - std::pair findVertex(const Trk::TrackParticleBaseCollection* trackTES); - std::pair findVertex(const xAOD::TrackParticleContainer* trackParticles); + virtual ~InDetIterativePriVxFinderTool(); - StatusCode finalize(); - - private: + virtual StatusCode initialize() override; - std::pair findVertex(const std::vector & trackVector) const; + /** + * Finding method. + * Has as input a track collection and as output + * a VxContainer. + */ + using IVertexFinder::findVertex; + virtual std::pair findVertex( + const TrackCollection* trackTES) const override; + virtual std::pair findVertex( + const Trk::TrackParticleBaseCollection* trackTES) const override; + virtual std::pair findVertex( + const xAOD::TrackParticleContainer* trackParticles) const override; - void removeCompatibleTracks(xAOD::Vertex * myxAODVertex, - std::vector & perigeesToFit, - std::vector & seedTracks) const; + virtual StatusCode finalize() override; - void removeAllFrom(std::vector & perigeesToFit, - std::vector & seedTracks) const; +private: + std::pair findVertex( + const std::vector& trackVector) const; - double compatibility(const Trk::TrackParameters& measPerigee, - const xAOD::Vertex & vertex) const; + void removeCompatibleTracks( + xAOD::Vertex* myxAODVertex, + std::vector& perigeesToFit, + std::vector& seedTracks) const; - void countTracksAndNdf(xAOD::Vertex * myxAODVertex, - double & ndf, int & ntracks) const; + void removeAllFrom(std::vector& perigeesToFit, + std::vector& seedTracks) const; - ToolHandle< Trk::IVertexFitter > m_iVertexFitter; - ToolHandle< InDet::IInDetTrackSelectionTool > m_trkFilter; - ToolHandle< Trk::IVertexSeedFinder > m_SeedFinder; - ToolHandle< Trk::IImpactPoint3dEstimator > m_ImpactPoint3dEstimator; - ToolHandle< Trk::IVertexLinearizedTrackFactory > m_LinearizedTrackFactory; - - SG::ReadCondHandleKey m_beamSpotKey { this, "BeamSpotKey", "BeamSpotData", "SG key for beam spot" }; + double compatibility(const Trk::TrackParameters& measPerigee, + const xAOD::Vertex& vertex) const; - bool m_useBeamConstraint; - double m_significanceCutSeeding; - double m_maximumChi2cutForSeeding; - double m_maxVertices; + void countTracksAndNdf(xAOD::Vertex* myxAODVertex, + double& ndf, + int& ntracks) const; - bool m_createSplitVertices; - int m_splitVerticesTrkInvFraction; ///< Integer: 1./fraction of tracks to be assigned to the tag split vertex + ToolHandle m_iVertexFitter; + ToolHandle m_trkFilter; + ToolHandle m_SeedFinder; + ToolHandle m_ImpactPoint3dEstimator; + ToolHandle m_LinearizedTrackFactory; - bool m_reassignTracksAfterFirstFit; + SG::ReadCondHandleKey m_beamSpotKey{ + this, + "BeamSpotKey", + "BeamSpotData", + "SG key for beam spot" + }; - bool m_doMaxTracksCut; - unsigned int m_maxTracks; + bool m_useBeamConstraint; + double m_significanceCutSeeding; + double m_maximumChi2cutForSeeding; + double m_maxVertices; - void SGError(std::string errService); + bool m_createSplitVertices; + int m_splitVerticesTrkInvFraction; ///< Integer: 1./fraction of tracks to be + ///< assigned to the tag split vertex - /** - * Internal method to print the parameters setting - */ + bool m_reassignTracksAfterFirstFit; - virtual void printParameterSettings(); - + bool m_doMaxTracksCut; + unsigned int m_maxTracks; + void SGError(const std::string& errService); + /** + * Internal method to print the parameters setting + */ - };//end of class definitions -}//end of namespace definitions + virtual void printParameterSettings(); + +}; // end of class definitions +} // end of namespace definitions #endif - + diff --git a/InnerDetector/InDetRecTools/InDetPriVxFinderTool/InDetPriVxFinderTool/InDetMultiPriVxFinderTool.h b/InnerDetector/InDetRecTools/InDetPriVxFinderTool/InDetPriVxFinderTool/InDetMultiPriVxFinderTool.h index b8b10285211..f1f64c06e2f 100644 --- a/InnerDetector/InDetRecTools/InDetPriVxFinderTool/InDetPriVxFinderTool/InDetMultiPriVxFinderTool.h +++ b/InnerDetector/InDetRecTools/InDetPriVxFinderTool/InDetPriVxFinderTool/InDetMultiPriVxFinderTool.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /** @@ -79,23 +79,29 @@ public: virtual ~InDetMultiPriVxFinderTool(); - StatusCode initialize(); + virtual StatusCode initialize() override; /** * Finding method. * Has as input a track collection and as output * a VxContainer. */ + using IVertexFinder::findVertex; - std::pair findVertex(const TrackCollection* trackTES); - std::pair findVertex(const Trk::TrackParticleBaseCollection* trackTES); - std::pair findVertex(const xAOD::TrackParticleContainer* trackParticles); + virtual std::pair findVertex( + const TrackCollection* trackTES) const override; - StatusCode finalize(); + virtual std::pair findVertex( + const Trk::TrackParticleBaseCollection* trackTES) const override; - private: + virtual std::pair findVertex( + const xAOD::TrackParticleContainer* trackParticles) const override; + + virtual StatusCode finalize() override; - std::pair findVertex(const std::vector & trackVector) const; + private: + std::pair findVertex( + const std::vector& trackVector) const; void removeCompatibleTracks(xAOD::Vertex * myxAODVertex, std::vector & perigeesToFit, @@ -110,15 +116,21 @@ public: void countTracksAndNdf(xAOD::Vertex * myxAODVertex, double & ndf, int & ntracks) const; - double distanceAndError(const Trk::TrackParameters* params, const Amg::Vector3D * vertex, double & err) const; - + double distanceAndError(const Trk::TrackParameters* params, + const Amg::Vector3D* vertex, + double& err) const; ToolHandle< Trk::IVertexFitter > m_iVertexFitter; ToolHandle< InDet::IInDetTrackSelectionTool > m_trkFilter; ToolHandle< Trk::IVertexSeedFinder > m_SeedFinder; ToolHandle< Trk::IImpactPoint3dEstimator > m_ImpactPoint3dEstimator; - SG::ReadCondHandleKey m_beamSpotKey { this, "BeamSpotKey", "BeamSpotData", "SG key for beam spot" }; + SG::ReadCondHandleKey m_beamSpotKey{ + this, + "BeamSpotKey", + "BeamSpotData", + "SG key for beam spot" + }; bool m_useBeamConstraint; double m_significanceCutSeeding; @@ -133,7 +145,7 @@ public: /// enable merging of vertices after finding // bool m_doRemerging; - void SGError(std::string errService); + void SGError(const std::string& errService); /** * Internal method to print the parameters setting diff --git a/InnerDetector/InDetRecTools/InDetPriVxFinderTool/InDetPriVxFinderTool/InDetPriVxFinderTool.h b/InnerDetector/InDetRecTools/InDetPriVxFinderTool/InDetPriVxFinderTool/InDetPriVxFinderTool.h index befc34946fa..fcf56dc401e 100755 --- a/InnerDetector/InDetRecTools/InDetPriVxFinderTool/InDetPriVxFinderTool/InDetPriVxFinderTool.h +++ b/InnerDetector/InDetRecTools/InDetPriVxFinderTool/InDetPriVxFinderTool/InDetPriVxFinderTool.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /*************************************************************************** @@ -13,58 +13,59 @@ (necessary to compile with gcc starting from 3.3.x) by GP (Freiburg University) - changes: 18-11-2010 Kirill Prokofiev - Development never stops ;). - Now adding the split vertices for the HI run + changes: 18-11-2010 Kirill Prokofiev + Development never stops ;). + Now adding the split vertices for the HI run 2016-04-26 David Shope EDM Migration to xAOD - from Trk::VxCandidate to xAOD::Vertex - + findVertex will now always return an xAOD::VertexContainer, - even when using a TrackCollection or a TrackParticleBaseCollection - as input. + even when using a TrackCollection or a + TrackParticleBaseCollection as input. ***************************************************************************/ #ifndef INDETPRIVXFINDERTOOL_INDETPRIVXFINDERTOOL_H #define INDETPRIVXFINDERTOOL_INDETPRIVXFINDERTOOL_H -#include "InDetRecToolInterfaces/IVertexFinder.h" #include "AthenaBaseComps/AthAlgTool.h" -#include "GaudiKernel/ToolHandle.h" #include "GaudiKernel/ServiceHandle.h" -//cannot be forward declared because of typedef -#include "TrkTrack/TrackCollection.h" -#include "TrkParticleBase/TrackParticleBaseCollection.h" +#include "GaudiKernel/ToolHandle.h" +#include "InDetRecToolInterfaces/IVertexFinder.h" +// cannot be forward declared because of typedef #include "TrkParameters/TrackParameters.h" +#include "TrkParticleBase/TrackParticleBaseCollection.h" +#include "TrkTrack/TrackCollection.h" #include /** Primary Vertex Finder Tool. - InDetPriVxFinderTool uses the Billoir method to fit a primary vertex in the event. The - method includes taking all tracks passing the preselection and to fit them. - In a second iteration tracks with a 'too big' chi-squared contribution are - left out and the remaining tracks are refitted. The 'too big' contribution - (maximum chi-square) can be set by jobOptions. Preselection cuts can be - given via jobOptions for d0, z0 and minimum Pt. It is also possible to set - a beam constraint to be considered in the fit. this is also done in the + InDetPriVxFinderTool uses the Billoir method to fit a primary vertex in the + event. The method includes taking all tracks passing the preselection and to + fit them. In a second iteration tracks with a 'too big' chi-squared + contribution are left out and the remaining tracks are refitted. The 'too big' + contribution (maximum chi-square) can be set by jobOptions. Preselection cuts + can be given via jobOptions for d0, z0 and minimum Pt. It is also possible to + set a beam constraint to be considered in the fit. this is also done in the jobOptions. - \c TracksName: The name of the StoreGate input container from which the tracks are read. The default is "TrkTracks", the container from the legacy converters/ambiguity processor. - - \c VxCandidatesOutputName: The name of the StoreGate container where the fit - results are put. default is "VxPrimaryCandidate". + - \c VxCandidatesOutputName: The name of the StoreGate container where the + fit results are put. default is "VxPrimaryCandidate". - \c FitRoutine: The routine which should be used for the fitting. The default is "FastVertexFitter". - - \c chi2 cut method: Specifies how to chi2 cut on tracks. There are two possibilities: - Version 1: (chi2CutMethod = 1) + - \c chi2 cut method: Specifies how to chi2 cut on tracks. There are two + possibilities: Version 1: (chi2CutMethod = 1) - get rid of all tracks with chi2 > m_maxChi2PerTrack in one go - no refit after removing one track - refit after all tracks with too high chi2 were removed Version 2: (chi2CutMethod = 2) - - get rid of tracks one by one starting with the one with highest chi2 > m_maxChi2PerTrack + - get rid of tracks one by one starting with the one with highest chi2 + > m_maxChi2PerTrack - refit after this track has been removed and do a chi2 cut again until all chi2 < m_maxChi2PerTrack - \c maxChi2PerTrack: The maximum chi-squared of a track to be considered @@ -76,7 +77,8 @@ - \c BeamConstraint_x: Constrained z-position of beam spot. default is 0. - \c BeamConstraint_err_x: Error on constrained x-position. default is 0. - \c BeamConstraint_err_y: Error on constrained y-position. default is 0. - - \c BeamConstraint_err_z: Error on constrained z-position. default is 5.6 cm. + - \c BeamConstraint_err_z: Error on constrained z-position. default is 5.6 + cm. - \c Track selection cuts: minPt = 1000. CLHEP::MeV: the minimum pt(CLHEP::MeV) of a track. @@ -87,61 +89,83 @@ /* Forward declarations */ -#include "xAODTracking/Vertex.h" +#include "BeamSpotConditionsData/BeamSpotData.h" #include "xAODTracking/TrackParticle.h" -#include "xAODTracking/VertexContainer.h" #include "xAODTracking/TrackParticleContainer.h" -#include "BeamSpotConditionsData/BeamSpotData.h" -namespace Trk -{ +#include "xAODTracking/Vertex.h" +#include "xAODTracking/VertexContainer.h" +namespace Trk { class IVertexFitter; class Track; class TrackParticleBase; class IVxCandidateXAODVertex; } -namespace InDet -{ - class IMultiPVSeedFinder; - class IInDetTrackSelectionTool; - - class InDetPriVxFinderTool : public AthAlgTool, virtual public IVertexFinder +namespace InDet { +class IMultiPVSeedFinder; +class IInDetTrackSelectionTool; + +class InDetPriVxFinderTool + : public AthAlgTool + , virtual public IVertexFinder { public: - InDetPriVxFinderTool(const std::string& t, const std::string& n, const IInterface* p); - virtual ~InDetPriVxFinderTool(); - StatusCode initialize(); - std::pair findVertex(const TrackCollection* trackTES); - std::pair findVertex(const Trk::TrackParticleBaseCollection* trackTES); - std::pair findVertex(const xAOD::TrackParticleContainer* trackParticles); - StatusCode finalize(); + InDetPriVxFinderTool(const std::string& t, + const std::string& n, + const IInterface* p); + virtual ~InDetPriVxFinderTool(); + StatusCode initialize() override; + + using IVertexFinder::findVertex; + std::pair findVertex( + const TrackCollection* trackTES) const override; + + std::pair findVertex( + const Trk::TrackParticleBaseCollection* trackTES) const override; + + std::pair findVertex( + const xAOD::TrackParticleContainer* trackParticles) const override; + + virtual StatusCode finalize() override; + private: - ToolHandle < InDet::IMultiPVSeedFinder > m_iPriVxSeedFinder; - ToolHandle < Trk::IVertexFitter > m_iVertexFitter; - ToolHandle< InDet::IInDetTrackSelectionTool > m_trkFilter; - - SG::ReadCondHandleKey m_beamSpotKey { this, "BeamSpotKey", "BeamSpotData", "SG key for beam spot" }; //!< pointer to the beam condition service - - /** Define a beam constraint for the fit */ - bool m_useBeamConstraint; //!< Use a vertex/beam constraint - - /** choose the chi2 cut method */ - int m_chi2CutMethod; - bool m_enableMultipleVertices; - double m_clusterLength; - /** The maximum chi-squared per track which is allowed in the fit. */ - double m_maxChi2PerTrack; - - /** the common finding code (regardless of Track or TrackParticle(Base) is here */ - //VxContainer* m_findVertex(std::vector< std::vector >& origParameters); - std::pair findVertex(std::vector< std::vector >& origParameters); - - virtual void sortTracksInChi2(std::vector &indexOfSortedChi2, xAOD::Vertex * myxAODVertex); - virtual void sortTracksInZ0(std::vector tv,std::vector& indexOfSortedZ0); - - - bool m_createSplitVertices; - int m_splitVerticesTrkInvFraction; ///< Integer: 1./fraction of tracks to be assigned to the tag split vertex - }; + ToolHandle m_iPriVxSeedFinder; + ToolHandle m_iVertexFitter; + ToolHandle m_trkFilter; + + SG::ReadCondHandleKey m_beamSpotKey{ + this, + "BeamSpotKey", + "BeamSpotData", + "SG key for beam spot" + }; //!< pointer to the beam condition service + + /** Define a beam constraint for the fit */ + bool m_useBeamConstraint; //!< Use a vertex/beam constraint + + /** choose the chi2 cut method */ + int m_chi2CutMethod; + bool m_enableMultipleVertices; + double m_clusterLength; + /** The maximum chi-squared per track which is allowed in the fit. */ + double m_maxChi2PerTrack; + + /** the common finding code (regardless of Track or TrackParticle(Base) is + * here */ + // VxContainer* m_findVertex(std::vector< std::vector >& origParameters); + std::pair findVertex( + std::vector>& origParameters) + const; + + virtual void sortTracksInChi2(std::vector& indexOfSortedChi2, + xAOD::Vertex* myxAODVertex) const; + virtual void sortTracksInZ0(std::vector tv, + std::vector& indexOfSortedZ0) const; + + bool m_createSplitVertices; + int m_splitVerticesTrkInvFraction; ///< Integer: 1./fraction of tracks to be + ///< assigned to the tag split vertex +}; } #endif diff --git a/InnerDetector/InDetRecTools/InDetPriVxFinderTool/src/InDetAdaptiveMultiPriVxFinderTool.cxx b/InnerDetector/InDetRecTools/InDetPriVxFinderTool/src/InDetAdaptiveMultiPriVxFinderTool.cxx index 783a5bc1492..06c7aba5aea 100755 --- a/InnerDetector/InDetRecTools/InDetPriVxFinderTool/src/InDetAdaptiveMultiPriVxFinderTool.cxx +++ b/InnerDetector/InDetRecTools/InDetPriVxFinderTool/src/InDetAdaptiveMultiPriVxFinderTool.cxx @@ -33,10 +33,8 @@ #include "EventPrimitives/EventPrimitivesHelpers.h" #include "GeoPrimitives/GeoPrimitives.h" -#include "NN.h" #include "InDetTrackSelectionTool/IInDetTrackSelectionTool.h" - #include "VxMultiVertex/MvfFitInfo.h" #include "VxMultiVertex/MVFVxTrackAtVertex.h" #include "VxMultiVertex/TrackToVtxLink.h" @@ -57,8 +55,6 @@ #include - - namespace InDet { InDetAdaptiveMultiPriVxFinderTool::InDetAdaptiveMultiPriVxFinderTool(const std::string& t, const std::string& n, @@ -77,7 +73,6 @@ namespace InDet m_cutVertexDependence(3.), m_minweight(0.0001), m_maxIterations(100), - m_testingclass(0), m_addSingleTrackVertices(false), m_do3dSplitting(false), m_zBfieldApprox(0.60407), @@ -152,7 +147,7 @@ namespace InDet } //anonymous namespace std::pair - InDetAdaptiveMultiPriVxFinderTool::findVertex(const TrackCollection* trackTES) { + InDetAdaptiveMultiPriVxFinderTool::findVertex(const TrackCollection* trackTES) const{ SG::ReadCondHandle beamSpotHandle { m_beamSpotKey }; const Trk::RecVertex &beamposition(beamSpotHandle->beamVtx()); @@ -196,7 +191,7 @@ namespace InDet } std::pair - InDetAdaptiveMultiPriVxFinderTool::findVertex(const Trk::TrackParticleBaseCollection* trackTES) { + InDetAdaptiveMultiPriVxFinderTool::findVertex(const Trk::TrackParticleBaseCollection* trackTES) const{ std::vector selectedTracks; SG::ReadCondHandle beamSpotHandle { m_beamSpotKey }; @@ -241,7 +236,7 @@ namespace InDet } std::pair - InDetAdaptiveMultiPriVxFinderTool::findVertex(const xAOD::TrackParticleContainer* trackParticles) { + InDetAdaptiveMultiPriVxFinderTool::findVertex(const xAOD::TrackParticleContainer* trackParticles) const { std::vector selectedTracks; SG::ReadCondHandle beamSpotHandle { m_beamSpotKey }; xAOD::Vertex beamposition; @@ -294,7 +289,7 @@ namespace InDet } std::pair - InDetAdaptiveMultiPriVxFinderTool::findVertex(const std::vector& trackVector) { + InDetAdaptiveMultiPriVxFinderTool::findVertex(const std::vector& trackVector) const { // TODO: put this in a better place // Prepare objects holding the decoration of xAOD::Vertex with MVF auxdata // For optimization of access speed @@ -302,8 +297,8 @@ namespace InDet xAOD::Vertex::Decorator< bool > isInitialized("isInitialized"); xAOD::Vertex::Decorator< std::vector< Trk::VxTrackAtVertex* > > VTAV("VTAV"); - if (m_selectiontype == 1) {//if you have to use NN, load the class - m_testingclass = new NN();//check later for MEMORY LEAK + if (m_selectiontype == 1) { + ATH_MSG_WARNING("Only Selection Type 0 supported for MT"); } //---- Start of preselection of tracks according to perigee parameters ---------------// @@ -358,7 +353,7 @@ namespace InDet iteration += 1; ATH_MSG_DEBUG("Starting iteration number " << iteration << " with " << seedtracknumber << " seed tracks."); //now use all the perigee parameters you have so far - if (m_realMultiVertex == true) { + if (m_realMultiVertex) { trkbegin = origTracks.begin(); trkend = origTracks.end(); } else { @@ -370,7 +365,7 @@ namespace InDet seedtrkAtVtxIter != seedtrkend; ++seedtrkAtVtxIter) { perigeeList.push_back((*seedtrkAtVtxIter)->parameters()); } - xAOD::Vertex* constraintVertex = 0; + xAOD::Vertex* constraintVertex = nullptr; if (m_useBeamConstraint) { constraintVertex = new xAOD::Vertex(); @@ -402,7 +397,7 @@ namespace InDet ATH_MSG_DEBUG(perigeeList.size() << " tracks passed to seed finder, but no seed returned."); // TODO: Do I need this? delete constraintVertex; - constraintVertex = 0; + constraintVertex = nullptr; break; } //new xAOD::Vertex with this @@ -437,12 +432,16 @@ namespace InDet } } } - ATH_MSG_DEBUG(VTAV(*actualcandidate).size() << " tracks added to vertex candidate for IP significance less than " << m_tracksMaxSignificance << " within " << m_TracksMaxZinterval << " mm of seed position."); + ATH_MSG_DEBUG( + VTAV(*actualcandidate).size() + << " tracks added to vertex candidate for IP significance less than " + << m_tracksMaxSignificance << " within " << m_TracksMaxZinterval + << " mm of seed position."); //now consider to recovery from the case where no tracks were added to the vertex if (VTAV(*actualcandidate).empty()) { //you need to define a new seed (because the old one is probably in between two ones...) double zdistance = 1e8; - const Trk::ITrackLink* nearestTrack = 0; + const Trk::ITrackLink* nearestTrack = nullptr; for (std::vector::const_iterator seedtrkiter = seedtrkbegin; seedtrkiter != seedtrkend; ++seedtrkiter) { if (std::fabs((*seedtrkiter)->parameters()->position()[Trk::z] - actualVertex.z()) < zdistance) { @@ -520,7 +519,7 @@ namespace InDet ((*trkAtVtxIter)->weight() > m_minweight && (*trkAtVtxIter)->trackQuality().chiSquared() < m_maxVertexChi2 && !m_useFastCompatibility)) { - const Trk::ITrackLink* foundTrack = 0; + const Trk::ITrackLink* foundTrack = nullptr; for (std::vector::const_iterator seedtrkiter = seedtrkbegin; seedtrkiter != seedtrkend; ++seedtrkiter) { @@ -528,7 +527,7 @@ namespace InDet foundTrack = *seedtrkiter; } } - if (foundTrack != 0) { + if (foundTrack != nullptr) { atleastonecompatibletrack = true; numberOfCompatibleTracks += 1; ATH_MSG_VERBOSE("Found compatible track"); @@ -598,14 +597,14 @@ namespace InDet } else {//no compatible track found... //in this case put out the highest seeding track which didn't give any good result... double highestcompatibility = 0; - Trk::VxTrackAtVertex* trackHighestCompatibility = 0; + Trk::VxTrackAtVertex* trackHighestCompatibility = nullptr; ATH_MSG_VERBOSE("Analyzing new vertex"); for (std::vector::iterator trkAtVtxIter = trkAtVtxbegin; trkAtVtxIter != trkAtVtxend; ++trkAtVtxIter) { ATH_MSG_VERBOSE("Checking new track for compatibility"); - const Trk::ITrackLink* foundTrack = 0; + const Trk::ITrackLink* foundTrack = nullptr; for (std::vector::const_iterator seedtrkiter = seedtrkbegin; seedtrkiter != seedtrkend; ++seedtrkiter) { @@ -613,7 +612,7 @@ namespace InDet foundTrack = *seedtrkiter; } } - if (foundTrack != 0) { + if (foundTrack != nullptr) { double compatibility = (*trkAtVtxIter)->vtxCompatibility(); ATH_MSG_VERBOSE("New track has compatibility: " << compatibility); if (compatibility > highestcompatibility) { @@ -624,7 +623,7 @@ namespace InDet } ATH_MSG_VERBOSE("Highest compatibility track:" << trackHighestCompatibility << "with compatibility: " << highestcompatibility); - if (trackHighestCompatibility != 0) { + if (trackHighestCompatibility != nullptr) { std::vector::iterator foundTrack = seedtrkend; for (std::vector::iterator seedtrkiter = seedtrkbegin; seedtrkiter != seedtrkend; ++seedtrkiter) { @@ -643,7 +642,7 @@ namespace InDet } else { //alternative method: delete seed track nearest in z to the seed double zdistance = 1e8; - const Trk::ITrackLink* nearestTrack = 0; + const Trk::ITrackLink* nearestTrack = nullptr; for (std::vector::const_iterator seedtrkiter = seedtrkbegin; seedtrkiter != seedtrkend; ++seedtrkiter) { if (std::fabs((*seedtrkiter)->parameters()->position()[Trk::z] - actualVertex.z()) < zdistance) { @@ -651,7 +650,7 @@ namespace InDet nearestTrack = *seedtrkiter; } } - if (nearestTrack != 0) { + if (nearestTrack != nullptr) { std::vector::iterator foundTrackToDelete = std::find(seedtrkbegin, seedtrkend, nearestTrack); if (foundTrackToDelete != seedtrkend) { @@ -762,10 +761,10 @@ namespace InDet } else { seedtracknumber = seedTracks.size(); ATH_MSG_VERBOSE("Storing new vertex with " << actualcandidate->vxTrackAtVertex().size() << " tracks"); - myxAODVertices.push_back(xAODVertex_pair(0,actualcandidate)); + myxAODVertices.emplace_back(0,actualcandidate); } } while (( - (m_addSingleTrackVertices && seedTracks.size() > 0) || + (m_addSingleTrackVertices && !seedTracks.empty()) || ((!m_addSingleTrackVertices) && seedTracks.size() > 1)) && iteration < m_maxIterations); if (iteration >= m_maxIterations) { @@ -810,7 +809,7 @@ namespace InDet ATH_MSG_VERBOSE("z position: " << (*vtxIter).second->position().z()); } } - if (myxAODVertices.size() == 0) { + if (myxAODVertices.empty()) { ATH_MSG_WARNING("No vertices found: returning a place-holder at the beam spot center."); xAOD::Vertex* beamspotCandidate = new xAOD::Vertex; beamspotCandidate->makePrivateStore(); @@ -818,7 +817,7 @@ namespace InDet beamspotCandidate->setCovariancePosition(beamSpotHandle->beamVtx().covariancePosition()); beamspotCandidate->vxTrackAtVertex() = std::vector(); // TODO: I don't need to set fitQuality too do I? - myxAODVertices.push_back(xAODVertex_pair(0, beamspotCandidate)); + myxAODVertices.emplace_back(0, beamspotCandidate); } vtxBegin = myxAODVertices.begin(); vtxEnd = myxAODVertices.end(); @@ -830,7 +829,7 @@ namespace InDet for (std::vector::iterator MVFtrkIter = MVFtrkBegin; MVFtrkIter != MVFtrkEnd; ++MVFtrkIter) { //setting link to TrackToVtxLink to 0 (all TrackToVtxLink will be deleted some lines later) - (static_cast(*MVFtrkIter))->setLinkToVertices(0); + (static_cast(*MVFtrkIter))->setLinkToVertices(nullptr); delete *MVFtrkIter; *MVFtrkIter = 0; } @@ -873,7 +872,6 @@ namespace InDet // there to be xAOD::TrackParticleLinks! } } - if (m_selectiontype == 1 && m_testingclass != 0) delete m_testingclass; std::vector::iterator begin = myTrackToVtxLinks.begin(); std::vector::iterator end = myTrackToVtxLinks.end(); //delete all TrackToVtxLink objects @@ -882,9 +880,9 @@ namespace InDet } //---- add dummy vertex at the end ------------------------------------------------------// //---- if one or more vertices are already there: let dummy have same position as primary vertex - if (theVertexContainer->size() >= 1) { + if (!theVertexContainer->empty()) { xAOD::Vertex* primaryVtx = theVertexContainer->front(); - if (primaryVtx->vxTrackAtVertex().size() > 0) { + if (!primaryVtx->vxTrackAtVertex().empty()) { primaryVtx->setVertexType(xAOD::VxType::PriVtx); xAOD::Vertex* dummyxAODVertex = new xAOD::Vertex; theVertexContainer->push_back(dummyxAODVertex); // have to add vertex to container here first so it can use its @@ -898,7 +896,7 @@ namespace InDet } } //---- if no vertex is there let dummy be at beam spot - else if (theVertexContainer->size() == 0) { + else if (theVertexContainer->empty()) { xAOD::Vertex* dummyxAODVertex = new xAOD::Vertex; theVertexContainer->push_back(dummyxAODVertex); // have to add vertex to container here first so it can use its // aux store @@ -919,7 +917,7 @@ namespace InDet } double - InDetAdaptiveMultiPriVxFinderTool::estimateSignalCompatibility(xAOD::Vertex* mycand) { + InDetAdaptiveMultiPriVxFinderTool::estimateSignalCompatibility(xAOD::Vertex* mycand) const{ // TODO: put this in a better place // Prepare objects holding the decoration of xAOD::Vertex with MVF auxdata // For optimization of access speed @@ -943,73 +941,27 @@ namespace InDet ((*i)->weight() > m_minweight && (*i)->trackQuality().chiSquared() < m_finalCutMaxVertexChi2 && !m_useFastCompatibility)) { - const Trk::TrackParameters* perigee(0); - if ((*i)->perigeeAtVertex() != 0) { + const Trk::TrackParameters* perigee(nullptr); + if ((*i)->perigeeAtVertex() != nullptr) { perigee = (*i)->perigeeAtVertex(); } else { ATH_MSG_VERBOSE("Only initialPerigee is available"); perigee = (*i)->initialPerigee(); } - if (perigee == 0) { + if (perigee == nullptr) { ATH_MSG_ERROR("Neutrals are not supported. Skipping track in pT calculation..."); continue; } total_pt_squared += - std::pow(std::fabs(1. / perigee->parameters()[Trk::qOverP]) * sin(perigee->parameters()[Trk::theta]), 2); + std::pow(std::fabs(1. / perigee->parameters()[Trk::qOverP]) * + sin(perigee->parameters()[Trk::theta]),2); total_num_tracks += 1; } }//finishing iterating on VxTrackAtVertex associated to **vtxIter xAOD::Vertex return total_pt_squared * std::sqrt((double) total_num_tracks); - } else if (m_selectiontype == 1) {//use NN - double pt_track1 = 0.; - double pt_track2 = 0.; - double pt_track3 = 0.; - double pt_sum_linear = 0.; - double pt_sum_quadratic = 0.; - - int total_num_tracks = 0; - int prognumber = 0; - - for (std::vector::iterator i = begintracks; i != endtracks; i++) { - if (((*i)->vtxCompatibility() < m_finalCutMaxVertexChi2 && m_useFastCompatibility) || - ((*i)->weight() > m_minweight - && (*i)->trackQuality().chiSquared() < m_finalCutMaxVertexChi2 - && !m_useFastCompatibility)) { - const Trk::TrackParameters* perigee(0); - if ((*i)->perigeeAtVertex() != 0) { - perigee = (*i)->perigeeAtVertex(); - } else { - ATH_MSG_VERBOSE("Only initialPerigee is available"); - perigee = (*i)->initialPerigee(); - } - if (perigee == 0) { - ATH_MSG_ERROR("Neutrals not supported. Skipping track in pT calculation..."); - continue; - } - double actualpt(std::fabs(1. / perigee->parameters()[Trk::qOverP]) * sin(perigee->parameters()[Trk::theta])); - pt_sum_quadratic += std::pow(actualpt, 2); - pt_sum_linear += actualpt; - if (prognumber == 0) { - pt_track1 = actualpt; - prognumber += 1; - } else if (prognumber == 1) { - pt_track2 = actualpt; - prognumber += 1; - } else if (prognumber == 2) { - pt_track3 = actualpt; - prognumber += 1; - } - total_num_tracks += 1; - } - } - if (total_num_tracks == 0 || pt_track2 == 0 || pt_track3 == 0) { - return 0.; - } else { - return m_testingclass->value(0, pt_track1, pt_track2, pt_track3, - pt_sum_linear, pt_sum_quadratic, - total_num_tracks); - } + } if (m_selectiontype == 1) {//use NN + ATH_MSG_WARNING("Only Selection Type 0 supported for MT"); } return 0; } @@ -1041,13 +993,13 @@ namespace InDet } void - InDetAdaptiveMultiPriVxFinderTool::SGError(std::string errService) { + InDetAdaptiveMultiPriVxFinderTool::SGError(const std::string& errService) { ATH_MSG_FATAL(errService << " not found. Exiting !"); } double InDetAdaptiveMultiPriVxFinderTool::estimateDeltaZ(const Trk::TrackParameters& myPerigee, - const Amg::Vector3D& myTransvVertex) { + const Amg::Vector3D& myTransvVertex) const { Amg::Vector3D lp = myTransvVertex; Amg::Vector3D expPoint; @@ -1099,7 +1051,7 @@ namespace InDet } void - InDetAdaptiveMultiPriVxFinderTool::releaseCandidate(xAOD::Vertex*& candidate) { + InDetAdaptiveMultiPriVxFinderTool::releaseCandidate(xAOD::Vertex*& candidate) const { if (candidate == nullptr) return; // decorators diff --git a/InnerDetector/InDetRecTools/InDetPriVxFinderTool/src/InDetAdaptivePriVxFinderTool.cxx b/InnerDetector/InDetRecTools/InDetPriVxFinderTool/src/InDetAdaptivePriVxFinderTool.cxx index e213911d5be..a9bc696a97f 100755 --- a/InnerDetector/InDetRecTools/InDetPriVxFinderTool/src/InDetAdaptivePriVxFinderTool.cxx +++ b/InnerDetector/InDetRecTools/InDetPriVxFinderTool/src/InDetAdaptivePriVxFinderTool.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /*************************************************************************** @@ -112,7 +112,9 @@ namespace InDet } std::pair - InDetAdaptivePriVxFinderTool::findVertex(const TrackCollection* trackTES) { + InDetAdaptivePriVxFinderTool::findVertex( + const TrackCollection* trackTES) const + { // TODO: change trkFilter to allow for this replacement /* xAOD::Vertex beamposition; @@ -127,7 +129,7 @@ namespace InDet std::vector origParameters; origParameters.clear(); for (TrackCollection::const_iterator itr = trackTES->begin(); itr != trackTES->end(); itr++) { - if (static_cast(m_trkFilter->accept(**itr, &beamposition)) == false) continue; + if (!static_cast(m_trkFilter->accept(**itr, &beamposition))) continue; origParameters.push_back((*itr)->perigeeParameters()); } if (msgLvl(MSG::DEBUG)) msg() << "Of " << trackTES->size() << " tracks " << origParameters.size() << @@ -142,7 +144,7 @@ namespace InDet std::vector* tmpVxTAVtx = &(*vxContItr)->vxTrackAtVertex(); for (std::vector::iterator itr = tmpVxTAVtx->begin(); itr != tmpVxTAVtx->end(); itr++) { const Trk::TrackParameters* initialPerigee = (*itr).initialPerigee(); - const Trk::Track* correspondingTrack(0); + const Trk::Track* correspondingTrack(nullptr); // find the track to that perigee ... for (TrackCollection::const_iterator itr1 = trackTES->begin(); itr1 != trackTES->end(); itr1++) { if (initialPerigee == (*itr1)->perigeeParameters()) { @@ -152,7 +154,7 @@ namespace InDet } // validate the track link - if (correspondingTrack != 0) { + if (correspondingTrack != nullptr) { Trk::LinkToTrack* link = new Trk::LinkToTrack; link->setStorableObject(*trackTES); link->setElement(correspondingTrack); @@ -168,7 +170,9 @@ namespace InDet } std::pair - InDetAdaptivePriVxFinderTool::findVertex(const Trk::TrackParticleBaseCollection* trackTES) { + InDetAdaptivePriVxFinderTool::findVertex( + const Trk::TrackParticleBaseCollection* trackTES) const + { // TODO: change trkFilter to allow for this replacement /* xAOD::Vertex beamposition; @@ -188,7 +192,7 @@ namespace InDet // if (msgLvl(MSG::VERBOSE)) msg() << "TrackParticleBaseContainer @ " << trackTES << endmsg; // if (msgLvl(MSG::VERBOSE)) msg() << "Size of the container: " << size << endmsg; for (Trk::TrackParticleBaseCollection::const_iterator itr = trackTES->begin(); itr != trackTES->end(); itr++) { - if (static_cast (m_trkFilter->accept(*((*itr)->originalTrack()), &beamposition)) == false) continue; + if (!static_cast(m_trkFilter->accept(*((*itr)->originalTrack()), &beamposition))) continue; origParameters.push_back(&(*itr)->definingParameters()); // std::cout << "originalPerigee at " << & ( *itr )->definingParameters() << std::endl; } @@ -206,7 +210,7 @@ namespace InDet std::vector* tmpVxTAVtx = &(*vxContItr)->vxTrackAtVertex(); for (std::vector::iterator itr = tmpVxTAVtx->begin(); itr != tmpVxTAVtx->end(); itr++) { const Trk::TrackParameters* initialPerigee = (*itr).initialPerigee(); - const Trk::TrackParticleBase* correspondingTrack(0); + const Trk::TrackParticleBase* correspondingTrack(nullptr); // find the track to that perigee ... for (Trk::TrackParticleBaseCollection::const_iterator itr1 = trackTES->begin(); itr1 != trackTES->end(); itr1++) { @@ -218,7 +222,7 @@ namespace InDet } } - if (correspondingTrack != 0) { + if (correspondingTrack != nullptr) { Trk::LinkToTrackParticleBase* link = new Trk::LinkToTrackParticleBase; link->setStorableObject(*trackTES); link->setElement(correspondingTrack); @@ -235,7 +239,9 @@ namespace InDet } std::pair - InDetAdaptivePriVxFinderTool::findVertex(const xAOD::TrackParticleContainer* trackParticles) { + InDetAdaptivePriVxFinderTool::findVertex( + const xAOD::TrackParticleContainer* trackParticles) const + { ATH_MSG_DEBUG(" Number of input tracks before track selection: " << trackParticles->size()); SG::ReadCondHandle beamSpotHandle { m_beamSpotKey }; @@ -251,7 +257,7 @@ namespace InDet typedef DataVector::const_iterator TrackParticleDataVecIter; for (TrackParticleDataVecIter itr = trackParticles->begin(); itr != trackParticles->end(); ++itr) { - if (static_cast(m_trkFilter->accept(**itr, &beamposition)) == false) continue; + if (!static_cast(m_trkFilter->accept(**itr, &beamposition))) continue; origParameters.push_back(&(*itr)->perigeeParameters()); ATH_MSG_DEBUG("originalPerigee at " << &(*itr)->perigeeParameters()); } @@ -270,7 +276,7 @@ namespace InDet //assigning the input tracks to the fitted vertices through VxTrackAtVertices for (std::vector::iterator itr = tmpVxTAVtx->begin(); itr != tmpVxTAVtx->end(); itr++) { const Trk::TrackParameters* initialPerigee = (*itr).initialPerigee(); - const xAOD::TrackParticle* correspondingTrack(0); + const xAOD::TrackParticle* correspondingTrack(nullptr); // find the track to that perigee ... for (TrackParticleDataVecIter itr1 = trackParticles->begin(); itr1 != trackParticles->end(); ++itr1) { if (initialPerigee == &((*itr1)->perigeeParameters())) { @@ -278,7 +284,7 @@ namespace InDet continue; } } - if (correspondingTrack != 0) { + if (correspondingTrack != nullptr) { Trk::LinkToXAODTrackParticle* link = new Trk::LinkToXAODTrackParticle; link->setStorableObject(*trackParticles); link->setElement(correspondingTrack); @@ -313,7 +319,7 @@ namespace InDet } std::pair - InDetAdaptivePriVxFinderTool::findVertex(std::vector& origParameters) { + InDetAdaptivePriVxFinderTool::findVertex(std::vector& origParameters) const{ std::vector* trkAtVtx; double vertexPt = 0.; @@ -321,10 +327,10 @@ namespace InDet xAOD::VertexAuxContainer* theVertexAuxContainer = new xAOD::VertexAuxContainer; theVertexContainer->setStore(theVertexAuxContainer); - xAOD::Vertex* myxAODVertex = 0; + xAOD::Vertex* myxAODVertex = nullptr; //---- Start of fitting section ------------------------------------------------------// - if (origParameters.size() >= 1) { + if (!origParameters.empty()) { SG::ReadCondHandle beamSpotHandle { m_beamSpotKey }; xAOD::Vertex beamposition; beamposition.makePrivateStore(); @@ -337,7 +343,7 @@ namespace InDet } else if (msgLvl(MSG::DEBUG)) msg() << "Less than two tracks or fitting without constraint - drop candidate vertex." << endmsg; // end if preselection for first iteration - if (origParameters.size() >= 1) { + if (!origParameters.empty()) { /* Store the primary vertex */ trkAtVtx = &(myxAODVertex->vxTrackAtVertex()); // do a loop through the element links to tracks in myVxCandidate.vxTrackAtVertex[] @@ -349,14 +355,14 @@ namespace InDet if (tmpTP) vertexPt += tmpTP->pT(); } } else { - if (myxAODVertex != 0) { + if (myxAODVertex != nullptr) { delete myxAODVertex; - myxAODVertex = 0; + myxAODVertex = nullptr; } } - if (myxAODVertex != 0) { + if (myxAODVertex != nullptr) { theVertexContainer->push_back(myxAODVertex); if (msgLvl(MSG::DEBUG)) { /* Print info only if requested */ double xVtxError = Amg::error(myxAODVertex->covariancePosition(), 0); @@ -373,9 +379,9 @@ namespace InDet //---- add dummy vertex at the end ------------------------------------------------------// //---- if one or more vertices are already there: let dummy have same position as primary vertex - if (theVertexContainer->size() >= 1) { + if (!theVertexContainer->empty()) { xAOD::Vertex* primaryVtx = theVertexContainer->front(); - if (primaryVtx->vxTrackAtVertex().size() > 0) { + if (!primaryVtx->vxTrackAtVertex().empty()) { primaryVtx->setVertexType(xAOD::VxType::PriVtx); xAOD::Vertex* dummyxAODVertex = new xAOD::Vertex; theVertexContainer->push_back(dummyxAODVertex); // have to add vertex to container here first so it can use its @@ -389,7 +395,7 @@ namespace InDet } } //---- if no vertex is there let dummy be at beam spot - else if (theVertexContainer->size() == 0) { + else if (theVertexContainer->empty()) { SG::ReadCondHandle beamSpotHandle { m_beamSpotKey }; xAOD::Vertex* dummyxAODVertex = new xAOD::Vertex; theVertexContainer->push_back(dummyxAODVertex); // have to add vertex to container here first so it can use its @@ -421,8 +427,7 @@ namespace InDet } void - InDetAdaptivePriVxFinderTool::SGError(std::string errService) { + InDetAdaptivePriVxFinderTool::SGError(const std::string& errService) { msg(MSG::FATAL) << errService << " not found. Exiting !" << endmsg; - return; - } + } } // end namespace InDet diff --git a/InnerDetector/InDetRecTools/InDetPriVxFinderTool/src/InDetIterativePriVxFinderTool.cxx b/InnerDetector/InDetRecTools/InDetPriVxFinderTool/src/InDetIterativePriVxFinderTool.cxx index 3bc515a2bfd..c43e3a7b938 100755 --- a/InnerDetector/InDetRecTools/InDetPriVxFinderTool/src/InDetIterativePriVxFinderTool.cxx +++ b/InnerDetector/InDetRecTools/InDetPriVxFinderTool/src/InDetIterativePriVxFinderTool.cxx @@ -100,7 +100,7 @@ InDetIterativePriVxFinderTool::~InDetIterativePriVxFinderTool() StatusCode InDetIterativePriVxFinderTool::initialize() { - if (m_createSplitVertices==true && m_useBeamConstraint==true) + if (m_createSplitVertices && m_useBeamConstraint) { ATH_MSG_FATAL(" Split vertices cannot be obtained if beam spot constraint is true! Change settings..."); return StatusCode::FAILURE; @@ -158,7 +158,7 @@ StatusCode InDetIterativePriVxFinderTool::initialize() std::pair -InDetIterativePriVxFinderTool::findVertex(const TrackCollection* trackTES) +InDetIterativePriVxFinderTool::findVertex(const TrackCollection* trackTES) const { ATH_MSG_DEBUG(" Number of input tracks before track selection: " << trackTES->size()); @@ -202,10 +202,11 @@ InDetIterativePriVxFinderTool::findVertex(const TrackCollection* trackTES) return returnContainers; } +std::pair +InDetIterativePriVxFinderTool::findVertex( + const Trk::TrackParticleBaseCollection* trackTES) const +{ -std::pair -InDetIterativePriVxFinderTool::findVertex(const Trk::TrackParticleBaseCollection* trackTES) { - ATH_MSG_DEBUG(" Number of input tracks before track selection: " << trackTES->size()); SG::ReadCondHandle beamSpotHandle { m_beamSpotKey }; @@ -243,57 +244,64 @@ InDetIterativePriVxFinderTool::findVertex(const Trk::TrackParticleBaseCollection return returnContainers; } - std::pair - InDetIterativePriVxFinderTool::findVertex(const xAOD::TrackParticleContainer* trackParticles) { - ATH_MSG_DEBUG(" Number of input tracks before track selection: " << trackParticles->size()); - - SG::ReadCondHandle beamSpotHandle { m_beamSpotKey }; - const InDet::BeamSpotData* beamSpot = *beamSpotHandle; - - std::vector selectedTracks; +std::pair +InDetIterativePriVxFinderTool::findVertex( + const xAOD::TrackParticleContainer* trackParticles) const +{ + ATH_MSG_DEBUG(" Number of input tracks before track selection: " + << trackParticles->size()); - typedef DataVector::const_iterator TrackParticleDataVecIter; + SG::ReadCondHandle beamSpotHandle{ m_beamSpotKey }; + const InDet::BeamSpotData* beamSpot = *beamSpotHandle; - bool selectionPassed; - for (TrackParticleDataVecIter itr = trackParticles->begin(); itr != trackParticles->end(); ++itr) { + std::vector selectedTracks; - if (m_useBeamConstraint && beamSpot != nullptr) - { - xAOD::Vertex beamPosition; - beamPosition.makePrivateStore(); - beamPosition.setPosition( beamSpot->beamVtx().position()); - beamPosition.setCovariancePosition( beamSpot->beamVtx().covariancePosition() ); - selectionPassed=static_cast(m_trkFilter->accept(**itr, &beamPosition)); - } - else - { + typedef DataVector::const_iterator + TrackParticleDataVecIter; - xAOD::Vertex null; - null.makePrivateStore(); - null.setPosition(Amg::Vector3D(0, 0, 0)); - AmgSymMatrix(3) vertexError; - vertexError.setZero(); - null.setCovariancePosition(vertexError); - selectionPassed = static_cast(m_trkFilter->accept(**itr, &null)); - } - - if (selectionPassed) { - ElementLink link; - link.setElement(*itr); - Trk::LinkToXAODTrackParticle* linkTT = new Trk::LinkToXAODTrackParticle(link); - linkTT->setStorableObject(*trackParticles); - selectedTracks.push_back(linkTT); - } + bool selectionPassed; + for (TrackParticleDataVecIter itr = trackParticles->begin(); + itr != trackParticles->end(); + ++itr) { + + if (m_useBeamConstraint && beamSpot != nullptr) { + xAOD::Vertex beamPosition; + beamPosition.makePrivateStore(); + beamPosition.setPosition(beamSpot->beamVtx().position()); + beamPosition.setCovariancePosition( + beamSpot->beamVtx().covariancePosition()); + selectionPassed = + static_cast(m_trkFilter->accept(**itr, &beamPosition)); + } else { + + xAOD::Vertex null; + null.makePrivateStore(); + null.setPosition(Amg::Vector3D(0, 0, 0)); + AmgSymMatrix(3) vertexError; + vertexError.setZero(); + null.setCovariancePosition(vertexError); + selectionPassed = static_cast(m_trkFilter->accept(**itr, &null)); } - ATH_MSG_DEBUG( - "Of " << trackParticles->size() << " tracks " << selectedTracks.size() << " survived the preselection."); + if (selectionPassed) { + ElementLink link; + link.setElement(*itr); + Trk::LinkToXAODTrackParticle* linkTT = + new Trk::LinkToXAODTrackParticle(link); + linkTT->setStorableObject(*trackParticles); + selectedTracks.push_back(linkTT); + } + } - std::pair returnContainers=findVertex(selectedTracks); + ATH_MSG_DEBUG("Of " << trackParticles->size() << " tracks " + << selectedTracks.size() + << " survived the preselection."); - return returnContainers; - } + std::pair + returnContainers = findVertex(selectedTracks); + return returnContainers; +} std::pair InDetIterativePriVxFinderTool::findVertex(const std::vector & trackVector) const @@ -485,7 +493,7 @@ InDetIterativePriVxFinderTool::findVertex(const Trk::TrackParticleBaseCollection } } - if (perigeesToFit.size() == 0) { + if (perigeesToFit.empty()) { if (msgLvl(MSG::DEBUG)) { msg(MSG::DEBUG) << " No good seed found. Exiting search for vertices..." << endmsg; } @@ -499,10 +507,10 @@ InDetIterativePriVxFinderTool::findVertex(const Trk::TrackParticleBaseCollection //to reassign vertices you look ino what is already in myVxCandidate //you do it only ONCE! - xAOD::Vertex* myxAODVertex = 0; - xAOD::Vertex* myxAODSplitVertex = 0; + xAOD::Vertex* myxAODVertex = nullptr; + xAOD::Vertex* myxAODSplitVertex = nullptr; - if (m_useBeamConstraint && perigeesToFit.size() > 0) { + if (m_useBeamConstraint && !perigeesToFit.empty()) { myxAODVertex = m_iVertexFitter->fit(perigeesToFit, theconstraint); } else if (!m_useBeamConstraint && perigeesToFit.size() > 1) { myxAODVertex = m_iVertexFitter->fit(perigeesToFit); @@ -520,7 +528,7 @@ InDetIterativePriVxFinderTool::findVertex(const Trk::TrackParticleBaseCollection countTracksAndNdf(myxAODSplitVertex, ndfSplitVertex, ntracksSplitVertex); bool goodVertex = - myxAODVertex != 0 && + myxAODVertex != nullptr && ((!m_useBeamConstraint && ndf > 0 && ntracks >= 2) || (m_useBeamConstraint && ndf > 3 && ntracks >= 2)); @@ -576,7 +584,7 @@ InDetIterativePriVxFinderTool::findVertex(const Trk::TrackParticleBaseCollection const Trk::TrackParameters* trackPerigee = (*tracksIter).initialPerigee(); - if (trackPerigee == 0) { + if (trackPerigee == nullptr) { msg(MSG::ERROR) << " Cast to perigee gives 0 pointer " << endmsg; } @@ -653,9 +661,9 @@ InDetIterativePriVxFinderTool::findVertex(const Trk::TrackParticleBaseCollection if (numberOfAddedTracks > 0) { delete myxAODVertex; - myxAODVertex = 0; + myxAODVertex = nullptr; - if (m_useBeamConstraint && perigeesToFit.size() > 0) { + if (m_useBeamConstraint && !perigeesToFit.empty()) { myxAODVertex = m_iVertexFitter->fit(perigeesToFit, theconstraint); } else if (!m_useBeamConstraint && perigeesToFit.size() > 1) { myxAODVertex = m_iVertexFitter->fit(perigeesToFit); @@ -666,7 +674,7 @@ InDetIterativePriVxFinderTool::findVertex(const Trk::TrackParticleBaseCollection countTracksAndNdf(myxAODVertex, ndf, ntracks); goodVertex = - myxAODVertex != 0 && + myxAODVertex != nullptr && ((!m_useBeamConstraint && ndf > 0 && ntracks >= 2) || (m_useBeamConstraint && ndf > 3 && ntracks >= 2)); @@ -714,7 +722,7 @@ InDetIterativePriVxFinderTool::findVertex(const Trk::TrackParticleBaseCollection if (m_createSplitVertices) { goodSplitVertex = - myxAODSplitVertex != 0 && + myxAODSplitVertex != nullptr && ndfSplitVertex > 0 && ntracksSplitVertex >= 2; @@ -753,7 +761,7 @@ InDetIterativePriVxFinderTool::findVertex(const Trk::TrackParticleBaseCollection } else { if (myxAODVertex) { delete myxAODVertex; - myxAODVertex = 0; + myxAODVertex = nullptr; } } } else { @@ -764,7 +772,7 @@ InDetIterativePriVxFinderTool::findVertex(const Trk::TrackParticleBaseCollection } else { if (myxAODVertex) { delete myxAODVertex; - myxAODVertex = 0; + myxAODVertex = nullptr; } xAOD::Vertex * dummyxAODVertex = new xAOD::Vertex; @@ -781,7 +789,7 @@ InDetIterativePriVxFinderTool::findVertex(const Trk::TrackParticleBaseCollection } else { if (myxAODSplitVertex) { delete myxAODSplitVertex; - myxAODSplitVertex = 0; + myxAODSplitVertex = nullptr; } xAOD::Vertex * dummyxAODVertex = new xAOD::Vertex; @@ -803,9 +811,9 @@ InDetIterativePriVxFinderTool::findVertex(const Trk::TrackParticleBaseCollection //---- add dummy vertex at the end ------------------------------------------------------// //---- if one or more vertices are already there: let dummy have same position as primary vertex if (!m_createSplitVertices) { - if (theVertexContainer->size() >= 1) { + if (!theVertexContainer->empty()) { xAOD::Vertex* primaryVtx = theVertexContainer->front(); - if (primaryVtx->vxTrackAtVertex().size() > 0) { + if (!primaryVtx->vxTrackAtVertex().empty()) { primaryVtx->setVertexType((xAOD::VxType::VertexType) Trk::PriVtx); xAOD::Vertex* dummyxAODVertex = new xAOD::Vertex; theVertexContainer->push_back(dummyxAODVertex); // have to add vertex to container here first so it can use @@ -820,7 +828,7 @@ InDetIterativePriVxFinderTool::findVertex(const Trk::TrackParticleBaseCollection } //---- if no vertex is there let dummy be at beam spot - else if ( theVertexContainer->size() == 0 ) + else if ( theVertexContainer->empty() ) { xAOD::Vertex * dummyxAODVertex = new xAOD::Vertex; theVertexContainer->push_back( dummyxAODVertex ); // have to add vertex to container here first so it can use its aux store @@ -927,10 +935,9 @@ InDetIterativePriVxFinderTool::findVertex(const Trk::TrackParticleBaseCollection } void - InDetIterativePriVxFinderTool::SGError(std::string errService) { + InDetIterativePriVxFinderTool::SGError(const std::string& errService) { msg(MSG::FATAL) << errService << " not found. Exiting !" << endmsg; - return; - } + } double InDetIterativePriVxFinderTool::compatibility(const Trk::TrackParameters& measPerigee, @@ -951,7 +958,7 @@ InDetIterativePriVxFinderTool::findVertex(const Trk::TrackParticleBaseCollection double returnValue = trackParameters2D.dot(weightReduced * trackParameters2D); delete myLinearizedTrack; - myLinearizedTrack = 0; + myLinearizedTrack = nullptr; return returnValue; } @@ -1104,7 +1111,7 @@ InDetIterativePriVxFinderTool::findVertex(const Trk::TrackParticleBaseCollection const Trk::TrackParameters* myPerigee = (*perigeesToFitIter); - if (myPerigee == 0) { + if (myPerigee == nullptr) { msg(MSG::ERROR) << " Cast to perigee gives 0 pointer " << endmsg; } diff --git a/InnerDetector/InDetRecTools/InDetPriVxFinderTool/src/InDetMultiPriVxFinderTool.cxx b/InnerDetector/InDetRecTools/InDetPriVxFinderTool/src/InDetMultiPriVxFinderTool.cxx index 9c7b1272ae2..33a251497de 100755 --- a/InnerDetector/InDetRecTools/InDetPriVxFinderTool/src/InDetMultiPriVxFinderTool.cxx +++ b/InnerDetector/InDetRecTools/InDetPriVxFinderTool/src/InDetMultiPriVxFinderTool.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /*************************************************************************** @@ -97,7 +97,7 @@ namespace InDet StatusCode InDetMultiPriVxFinderTool::initialize() { - if (m_createSplitVertices == true && m_useBeamConstraint == true) { + if (m_createSplitVertices && m_useBeamConstraint) { msg(MSG::FATAL) << " Split vertices cannot be obtained if beam spot constraint is true! Change settings..." << endmsg; return StatusCode::FAILURE; @@ -137,7 +137,8 @@ namespace InDet //Find vertex from TrackCollection std::pair - InDetMultiPriVxFinderTool::findVertex(const TrackCollection* trackTES) { + InDetMultiPriVxFinderTool::findVertex(const TrackCollection* trackTES) const + { if (msgLvl(MSG::DEBUG)) msg() << " Number of input tracks before track selection: " << trackTES->size() << endmsg; std::vector selectedTracks; @@ -182,7 +183,9 @@ namespace InDet } std::pair - InDetMultiPriVxFinderTool::findVertex(const Trk::TrackParticleBaseCollection* trackTES) { + InDetMultiPriVxFinderTool::findVertex( + const Trk::TrackParticleBaseCollection* trackTES) const + { if (msgLvl(MSG::DEBUG)) msg() << " Number of input tracks before track selection: " << trackTES->size() << endmsg; std::vector selectedTracks; @@ -228,7 +231,9 @@ namespace InDet } std::pair - InDetMultiPriVxFinderTool::findVertex(const xAOD::TrackParticleContainer* trackParticles) { + InDetMultiPriVxFinderTool::findVertex( + const xAOD::TrackParticleContainer* trackParticles) const + { ATH_MSG_DEBUG(" Number of input tracks before track selection: " << trackParticles->size()); std::vector selectedTracks; @@ -274,7 +279,9 @@ namespace InDet } std::pair - InDetMultiPriVxFinderTool::findVertex(const std::vector& trackVector) const { + InDetMultiPriVxFinderTool::findVertex( + const std::vector& trackVector) const + { //copy the input vector. will drop used tracks from here as they are added to vertices // then what is left is used to then delete all unused ITrackLink objects at the end. std::vector seedTracks = trackVector; @@ -380,7 +387,7 @@ namespace InDet //add to list of tracks for new vertex if the new vertex already has a track. //then erase from this collection in case another track gets moved here we don't want to have the same track // in 2 places - if (closestSeedIndex != seedVertices.size() && tracksToFitCollection[closestSeedIndex].size() > 0) { + if (closestSeedIndex != seedVertices.size() && !tracksToFitCollection[closestSeedIndex].empty()) { tracksToFitCollection[closestSeedIndex].push_back(tracksToFitCollection[i][0]); tracksToFitCollection[i].clear(); } //if didn't find another one to attach to, just leave it there. if nothing else gets added here will be @@ -413,7 +420,7 @@ namespace InDet } - xAOD::Vertex* myxAODVertex = 0; + xAOD::Vertex* myxAODVertex = nullptr; if (m_useBeamConstraint) { myxAODVertex = m_iVertexFitter->fit(perigeesToFit, theconstraint); } else { @@ -426,7 +433,7 @@ namespace InDet countTracksAndNdf(myxAODVertex, ndf, ntracks); bool goodVertex = - myxAODVertex != 0 && + myxAODVertex != nullptr && ((!m_useBeamConstraint && ndf > 0 && ntracks >= 2) || (m_useBeamConstraint && ndf > 3 && ntracks >= 2)); @@ -477,7 +484,7 @@ namespace InDet } else { if (myxAODVertex) { delete myxAODVertex; - myxAODVertex = 0; + myxAODVertex = nullptr; } } @@ -505,9 +512,9 @@ namespace InDet } //This bit was done in iterative finder -- not sure why but will copy it here too - if (theVertexContainer->size() >= 1) { + if (!theVertexContainer->empty()) { xAOD::Vertex* primaryVtx = theVertexContainer->front(); - if (primaryVtx->vxTrackAtVertex().size() > 0) { + if (!primaryVtx->vxTrackAtVertex().empty()) { primaryVtx->setVertexType((xAOD::VxType::VertexType) Trk::PriVtx); xAOD::Vertex* dummyxAODVertex = new xAOD::Vertex; theVertexContainer->push_back(dummyxAODVertex); // have to add vertex to container here first so it can use its @@ -519,7 +526,7 @@ namespace InDet } else { primaryVtx->setVertexType(xAOD::VxType::NoVtx); } - } else if (theVertexContainer->size() == 0) { //---- if no vertex is there let dummy be at beam spot + } else if (theVertexContainer->empty()) { //---- if no vertex is there let dummy be at beam spot xAOD::Vertex* dummyxAODVertex = new xAOD::Vertex; theVertexContainer->push_back(dummyxAODVertex); // have to add vertex to container here first so it can use its // aux store @@ -585,10 +592,9 @@ namespace InDet } void - InDetMultiPriVxFinderTool::SGError(std::string errService) { + InDetMultiPriVxFinderTool::SGError(const std::string& errService) { msg(MSG::FATAL) << errService << " not found. Exiting !" << endmsg; - return; - } + } void InDetMultiPriVxFinderTool::countTracksAndNdf(xAOD::Vertex* myxAODVertex, diff --git a/InnerDetector/InDetRecTools/InDetPriVxFinderTool/src/InDetPriVxFinderTool.cxx b/InnerDetector/InDetRecTools/InDetPriVxFinderTool/src/InDetPriVxFinderTool.cxx index 09f3cec9fe9..96c0e469c98 100755 --- a/InnerDetector/InDetRecTools/InDetPriVxFinderTool/src/InDetPriVxFinderTool.cxx +++ b/InnerDetector/InDetRecTools/InDetPriVxFinderTool/src/InDetPriVxFinderTool.cxx @@ -99,7 +99,7 @@ namespace InDet StatusCode InDetPriVxFinderTool::initialize() { //check if the split was requested and it is still possible to make it - if (m_createSplitVertices == true && m_useBeamConstraint == true) { + if (m_createSplitVertices && m_useBeamConstraint) { ATH_MSG_FATAL(" Split vertices cannot be obtained if beam spot constraint is true! Change settings..." ); return StatusCode::FAILURE; } @@ -118,7 +118,7 @@ namespace InDet } std::pair - InDetPriVxFinderTool::findVertex(const TrackCollection* trackTES) { + InDetPriVxFinderTool::findVertex(const TrackCollection* trackTES) const { // std::cout<<" find vertex called "<* tmpVxTAVtx = &(*vxContItr)->vxTrackAtVertex(); for (std::vector::iterator itr = tmpVxTAVtx->begin(); itr != tmpVxTAVtx->end(); itr++) { const Trk::TrackParameters* initialPerigee = (*itr).initialPerigee(); - const Trk::Track* correspondingTrack(0); + const Trk::Track* correspondingTrack(nullptr); // find the track to that perigee ... for (TrackCollection::const_iterator itr1 = trackTES->begin(); itr1 != trackTES->end(); itr1++) { if (initialPerigee == (*itr1)->perigeeParameters()) { @@ -219,7 +219,7 @@ namespace InDet } // validate the track link - if (correspondingTrack != 0) { + if (correspondingTrack != nullptr) { Trk::LinkToTrack* link = new Trk::LinkToTrack; link->setStorableObject(*trackTES); link->setElement(correspondingTrack); @@ -235,7 +235,7 @@ namespace InDet } std::pair - InDetPriVxFinderTool::findVertex(const Trk::TrackParticleBaseCollection* trackTES) { + InDetPriVxFinderTool::findVertex(const Trk::TrackParticleBaseCollection* trackTES) const { // std::cout<<"Calling find vertex from trackparticles "<* tmpVxTAVtx = &(*vxContItr)->vxTrackAtVertex(); for (std::vector::iterator itr = tmpVxTAVtx->begin(); itr != tmpVxTAVtx->end(); itr++) { const Trk::TrackParameters* initialPerigee = (*itr).initialPerigee(); - const Trk::TrackParticleBase* correspondingTrack(0); + const Trk::TrackParticleBase* correspondingTrack(nullptr); // find the track to that perigee ... for (Trk::TrackParticleBaseCollection::const_iterator itr1 = trackTES->begin(); itr1 != trackTES->end(); itr1++) { @@ -342,12 +342,15 @@ namespace InDet } } - if (correspondingTrack != 0) { + if (correspondingTrack != nullptr) { Trk::LinkToTrackParticleBase* link = new Trk::LinkToTrackParticleBase; link->setStorableObject(*trackTES); link->setElement(correspondingTrack); (*itr).setOrigTrack(link); - } else if (msgLvl(MSG::WARNING)) msg() << "No corresponding track found for this initial perigee! Vertex will have no link to the track." << endmsg; + } else if (msgLvl(MSG::WARNING)) + msg() << "No corresponding track found for this initial perigee! " + "Vertex will have no link to the track." + << endmsg; // TODO: also mention that links stored directly in xAOD::Vertices are not set because a // TrackParticleBaseCollection was given as input } @@ -358,7 +361,9 @@ namespace InDet } std::pair - InDetPriVxFinderTool::findVertex(const xAOD::TrackParticleContainer* trackParticles) { + InDetPriVxFinderTool::findVertex( + const xAOD::TrackParticleContainer* trackParticles) const + { ATH_MSG_DEBUG(" Number of input tracks before track selection: " << trackParticles->size()); SG::ReadCondHandle beamSpotHandle { m_beamSpotKey }; @@ -425,7 +430,7 @@ namespace InDet //assigning the input tracks to the fitted vertices through VxTrackAtVertices for (std::vector::iterator itr = tmpVxTAVtx->begin(); itr != tmpVxTAVtx->end(); itr++) { const Trk::TrackParameters* initialPerigee = (*itr).initialPerigee(); - const xAOD::TrackParticle* correspondingTrack(0); + const xAOD::TrackParticle* correspondingTrack(nullptr); // find the track to that perigee ... for (TrackParticleDataVecIter itr1 = trackParticles->begin(); itr1 != trackParticles->end(); ++itr1) { if (initialPerigee == &(*itr1)->perigeeParameters()) { @@ -434,7 +439,7 @@ namespace InDet } } // validate the track link - if (correspondingTrack != 0) { + if (correspondingTrack != nullptr) { Trk::LinkToXAODTrackParticle* link = new Trk::LinkToXAODTrackParticle; link->setStorableObject(*trackParticles); link->setElement(correspondingTrack); @@ -469,7 +474,9 @@ namespace InDet } std::pair - InDetPriVxFinderTool::findVertex(std::vector< std::vector >& zTrackColl) { + InDetPriVxFinderTool::findVertex( + std::vector>& zTrackColl) const + { //---- Constraint vertex section: if enabled in jobOptions a constraint is assigned --// Amg::Vector3D vertex = Amg::Vector3D(0., 0., 0.); //for fit() we need Amg::Vector3D or Trk::RecVertex std::vector* trkAtVtx = nullptr; @@ -483,12 +490,12 @@ namespace InDet std::map vertexMap; std::vector splitVtxVector; double vertexPt; - xAOD::Vertex* myxAODVertex = 0; + xAOD::Vertex* myxAODVertex = nullptr; SG::ReadCondHandle beamSpotHandle { m_beamSpotKey }; for (unsigned int i = 0; i < zTrackColl.size(); i++) { // std::cout<<"Inside the loop"< origParameters; origParameters.clear(); origParameters = zTrackColl[i]; @@ -553,7 +560,7 @@ namespace InDet // delete old xAOD::Vertex first if (myxAODVertex) { delete myxAODVertex; - myxAODVertex = 0; + myxAODVertex = nullptr; } if (msgLvl(MSG::VERBOSE)) msg() << "Second call of fitting tool!" << endmsg; if (m_useBeamConstraint) { @@ -586,7 +593,7 @@ namespace InDet // delete old xAOD::Vertex first delete myxAODVertex; - myxAODVertex = 0; + myxAODVertex = nullptr; if (msgLvl(MSG::VERBOSE)) msg() << "Second call of fitting tool!" << endmsg; @@ -644,7 +651,7 @@ namespace InDet }//end of successful reconstruction check } else if (myxAODVertex) { delete myxAODVertex; - myxAODVertex = 0; + myxAODVertex = nullptr; } }//end of loop over the pre-defined seeds //no sorting for the split vertices -otherwise, why splitting at all? @@ -668,7 +675,7 @@ namespace InDet theVertexContainer->push_back(*l_vt); //---- add dummy vertex at the end ------------------------------------------------------// //---- if one or more vertices are already there: let dummy have same position as primary vertex - if (theVertexContainer->size() >= 1 && !m_createSplitVertices) { + if (!theVertexContainer->empty() && !m_createSplitVertices) { xAOD::Vertex* primaryVtx = theVertexContainer->front(); primaryVtx->setVertexType(xAOD::VxType::PriVtx); xAOD::Vertex* dummyxAODVertex = new xAOD::Vertex; @@ -689,7 +696,7 @@ namespace InDet dummyxAODVertex->setVertexType(xAOD::VxType::NoVtx); } //---- if no vertex is there let dummy be at beam spot - else if (theVertexContainer->size() == 0) { + else if (theVertexContainer->empty()) { // std::cout<<"Zero size vx container! "<push_back(dummyxAODVertex); // have to add vertex to container here first so it can use its @@ -716,7 +723,7 @@ namespace InDet } } return std::make_pair(theVertexContainer, theVertexAuxContainer); - }//end m_find vertex ethod + } // end m_find vertex ethod StatusCode InDetPriVxFinderTool::finalize() { @@ -724,7 +731,9 @@ namespace InDet } void - InDetPriVxFinderTool::sortTracksInChi2(std::vector& indexOfSortedChi2, xAOD::Vertex* myxAODVertex) { + InDetPriVxFinderTool::sortTracksInChi2(std::vector& indexOfSortedChi2, + xAOD::Vertex* myxAODVertex) const + { // we need an index vector here which tells us the right order from smallest to // largest of the chi2PerTrack vector // then loop over the index vector and replace all iRP with iRP = index[i] @@ -753,10 +762,13 @@ namespace InDet indexOfSortedChi2.push_back((*mItr).second); } // std::cout<<"Sorting performed "< tv, std::vector& indexOfSortedZ0) { + InDetPriVxFinderTool::sortTracksInZ0( + std::vector tv, + std::vector& indexOfSortedZ0) const + { // we need an index vector here which tells us the right order from smallest to // largest of the z0 vector // then loop over the index vector and replace all iRP with iRP = index[i] diff --git a/InnerDetector/InDetRecTools/InDetRecToolInterfaces/InDetRecToolInterfaces/IVertexFinder.h b/InnerDetector/InDetRecTools/InDetRecToolInterfaces/InDetRecToolInterfaces/IVertexFinder.h index 1749d2fb603..c24ab18d84d 100755 --- a/InnerDetector/InDetRecTools/InDetRecToolInterfaces/InDetRecToolInterfaces/IVertexFinder.h +++ b/InnerDetector/InDetRecTools/InDetRecToolInterfaces/InDetRecToolInterfaces/IVertexFinder.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /*************************************************************************** @@ -7,66 +7,105 @@ ------------------- begin : 14-02-2006 authors : Andreas Wildauer (CERN PH-ATC) - : Giacinto Piacquadio (Freiburg University), Kirill Prokofiev (Sheffield University) - email : andreas.wildauer@cern.ch + : Giacinto Piacquadio (Freiburg University), Kirill Prokofiev + (Sheffield University) email : andreas.wildauer@cern.ch giacinto.piacquadio@physik.uni-freiburg.de changes : David Shope (2016-04-26) EDM Migration to xAOD - from Trk::VxCandidate to xAOD::Vertex findVertex will now always return an xAOD::VertexContainer, - even when using a TrackCollection or a TrackParticleBaseCollection - as input. + even when using a TrackCollection or a + TrackParticleBaseCollection as input. + : Christos Anastopoulos Athena MT ***************************************************************************/ - -#ifndef InDetRecToolInterfaces_IVertexFinder_H -#define InDetRecToolInterfaces_IVertexFinder_H -#include "GaudiKernel/AlgTool.h" -#include "TrkTrack/TrackCollection.h" // it is a typedef -#include "TrkParticleBase/TrackParticleBaseCollection.h" - /** Vertex Finder Tool. - Abstract class which provides the possibility to implement more than one + Abstract class which provides the possibility to implement more than one vertex finder tool (every vertex finder tool inherits from this class). - It was implemented to create a new primary vertex finding algorithm, + It was implemented to create a new primary vertex finding algorithm, different from the one already used by InDetPriVxFinderTool (by AW and FK), the InDetAdaptivePriVxFinderTool... - */ -//xAOD includes -#include "xAODTracking/VertexFwd.h" +#ifndef InDetRecToolInterfaces_IVertexFinder_H +#define InDetRecToolInterfaces_IVertexFinder_H +#include "GaudiKernel/AlgTool.h" +#include "GaudiKernel/EventContext.h" +#include "GaudiKernel/ThreadLocalContext.h" +#include "TrkParticleBase/TrackParticleBaseCollection.h" +#include "TrkTrack/TrackCollection.h" + +// xAOD includes +#include "xAODTracking/TrackParticleAuxContainer.h" +#include "xAODTracking/TrackParticleContainerFwd.h" #include "xAODTracking/TrackParticleFwd.h" -#include "xAODTracking/VertexContainerFwd.h" #include "xAODTracking/VertexAuxContainer.h" -#include "xAODTracking/TrackParticleContainerFwd.h" -#include "xAODTracking/TrackParticleAuxContainer.h" +#include "xAODTracking/VertexContainerFwd.h" +#include "xAODTracking/VertexFwd.h" -namespace InDet -{ +namespace InDet { static const InterfaceID IID_IVertexFinder("IVertexFinder", 1, 0); class IVertexFinder : virtual public IAlgTool - { +{ public: - virtual ~IVertexFinder() {}; - static const InterfaceID& interfaceID() - { - return IID_IVertexFinder; - } - - virtual std::pair findVertex(const TrackCollection* trackTES)=0; - - virtual std::pair findVertex(const Trk::TrackParticleBaseCollection* trackTES)=0; - - /** Find vertex from xAOD::TrackParticleContainer. - * @param trackParticles input track container - * @return a pair of newly created container and auxiliary store - */ - virtual std::pair findVertex(const xAOD::TrackParticleContainer* trackParticles) = 0; - }; + virtual ~IVertexFinder(){}; + static const InterfaceID& interfaceID() { return IID_IVertexFinder; } + + /* + * For MT we have 2 sets , one with EventContext and one without + * Implementation really need to overload only one + * The clients can call either + */ + + virtual std::pair + findVertex(const EventContext& ctx, const TrackCollection* trackTES) const + { + + (void)(ctx); // We do not use ctx + return findVertex(trackTES); + } + + virtual std::pair + findVertex(const EventContext& ctx, + const Trk::TrackParticleBaseCollection* trackTES) const + { + (void)(ctx); // We do not use ctx + return findVertex(trackTES); + } + + /** Find vertex from xAOD::TrackParticleContainer. + * @param EventContext + * @param trackParticles input track container + * @return a pair of newly created container and auxiliary store + */ + virtual std::pair + findVertex(const EventContext& ctx, + const xAOD::TrackParticleContainer* trackParticles) const + { + (void)(ctx); // We do not use ctx + return findVertex(trackParticles); + } + + virtual std::pair + findVertex(const TrackCollection* trackTES) const + { + return findVertex(Gaudi::Hive::currentContext(), trackTES); + } + + virtual std::pair + findVertex(const Trk::TrackParticleBaseCollection* trackTES) const + { + return findVertex(Gaudi::Hive::currentContext(), trackTES); + } + virtual std::pair + findVertex(const xAOD::TrackParticleContainer* trackParticles) const + { + return findVertex(Gaudi::Hive::currentContext(), trackParticles); + } +}; } #endif diff --git a/InnerDetector/InDetRecTools/InDetVKalPriVxFinderTool/CMakeLists.txt b/InnerDetector/InDetRecTools/InDetVKalPriVxFinderTool/CMakeLists.txt index 2eacc5281dd..9e7a0112d12 100644 --- a/InnerDetector/InDetRecTools/InDetVKalPriVxFinderTool/CMakeLists.txt +++ b/InnerDetector/InDetRecTools/InDetVKalPriVxFinderTool/CMakeLists.txt @@ -16,6 +16,7 @@ atlas_depends_on_subdirs( PUBLIC Tracking/TrkEvent/TrkParticleBase Tracking/TrkEvent/TrkTrack Tracking/TrkVertexFitter/TrkVKalVrtFitter + Control/CxxUtils PRIVATE Tracking/TrkEvent/TrkEventPrimitives Tracking/TrkEvent/TrkTrackLink @@ -31,7 +32,9 @@ atlas_add_component( InDetVKalPriVxFinderTool src/*.cxx src/components/*.cxx INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} - LINK_LIBRARIES ${ROOT_LIBRARIES} AthenaBaseComps xAODTracking GaudiKernel InDetRecToolInterfaces TrkParameters TrkParticleBase TrkTrack TrkVKalVrtFitterLib TrkEventPrimitives TrkTrackSummary VxVertex TrkToolInterfaces ) + LINK_LIBRARIES ${ROOT_LIBRARIES} AthenaBaseComps xAODTracking GaudiKernel InDetRecToolInterfaces + TrkParameters TrkParticleBase TrkTrack TrkVKalVrtFitterLib CxxUtils TrkEventPrimitives TrkTrackSummary + VxVertex TrkToolInterfaces ) # Install files from the package: atlas_install_headers( InDetVKalPriVxFinderTool ) diff --git a/InnerDetector/InDetRecTools/InDetVKalPriVxFinderTool/InDetVKalPriVxFinderTool/InDetVKalPriVxFinderTool.h b/InnerDetector/InDetRecTools/InDetVKalPriVxFinderTool/InDetVKalPriVxFinderTool/InDetVKalPriVxFinderTool.h index 8dc9f90b457..5447fee83ac 100755 --- a/InnerDetector/InDetRecTools/InDetVKalPriVxFinderTool/InDetVKalPriVxFinderTool/InDetVKalPriVxFinderTool.h +++ b/InnerDetector/InDetRecTools/InDetVKalPriVxFinderTool/InDetVKalPriVxFinderTool/InDetVKalPriVxFinderTool.h @@ -1,28 +1,23 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /******************************************************* InDetVKalPriVxFinderTool.h - description - A tool to find primary vertex with or without pileup, with or without beam constraint. - It works with TrackCollection of TrackParticleBaseCollection. - Beam position if needed is provided via BeamCond service or - jobOptions. - - Tool used VKalVrt vertex fitter (TrkVKalVrtFitter tool). - - By default primary vertex finder user robust functional Rob=5 (see VKalVrt - descrption for details) which provides optimal pulls. + A tool to find primary vertex with or without pileup, with or without beam + constraint. It works with TrackCollection of TrackParticleBaseCollection. Beam + position if needed is provided via BeamCond service or jobOptions. - Author: Vadim Kostyukhin - e-mail: vadim.kostyukhin@cern.ch + Tool used VKalVrt vertex fitter (TrkVKalVrtFitter tool). + By default primary vertex finder user robust functional Rob=5 (see VKalVrt + descrption for details) which provides optimal pulls. + Author: Vadim Kostyukhin + e-mail: vadim.kostyukhin@cern.ch ********************************************************/ - - #ifndef _VKalVrt_InDetVKalPriVxFinderTool_H #define _VKalVrt_InDetVKalPriVxFinderTool_H // Normal STL and physical vectors @@ -30,205 +25,272 @@ #include "TrkToolInterfaces/ITrackSummaryTool.h" // Gaudi includes -#include "TrkTrack/TrackCollection.h" -#include "TrkParameters/TrackParameters.h" -#include "TrkParticleBase/TrackParticleBaseCollection.h" +#include "TrkParameters/TrackParameters.h" +#include "TrkParticleBase/TrackParticleBaseCollection.h" +#include "TrkTrack/TrackCollection.h" // Gaudi includes -#include "AthenaBaseComps/AthAlgTool.h" -#include "GaudiKernel/ToolHandle.h" -#include "GaudiKernel/ServiceHandle.h" +#include "AthenaBaseComps/AthAlgTool.h" +#include "GaudiKernel/ServiceHandle.h" +#include "GaudiKernel/ToolHandle.h" // -#include "TrkVKalVrtFitter/TrkVKalVrtFitter.h" -#include "InDetRecToolInterfaces/IVertexFinder.h" -#include "xAODTracking/VertexContainerFwd.h" -#include "xAODTracking/VertexAuxContainer.h" +#include "InDetRecToolInterfaces/IVertexFinder.h" +#include "TrkVKalVrtFitter/TrkVKalVrtFitter.h" +#include "xAODTracking/VertexAuxContainer.h" +#include "xAODTracking/VertexContainerFwd.h" // +#include //for std::pair #include -#include //for std::pair #include "BeamSpotConditionsData/BeamSpotData.h" +#include "CxxUtils/checker_macros.h" namespace Trk { - class TrackParticle; +class TrackParticle; } namespace InDet { - - class InDetVKalPriVxFinderTool : public AthAlgTool, virtual public IVertexFinder +class InDetVKalPriVxFinderTool + : public AthAlgTool + , virtual public IVertexFinder { - public: - - InDetVKalPriVxFinderTool(const std::string& t, const std::string& n, const IInterface* p); - virtual ~InDetVKalPriVxFinderTool(); - StatusCode initialize(); - StatusCode finalize(); -// -// Tool interface -// - std::pair findVertex(const TrackCollection* trackTES); - std::pair findVertex(const Trk::TrackParticleBaseCollection* trackTES); - std::pair findVertex(const xAOD::TrackParticleContainer* trackTES); -// - - - private: - - -/* JobOption tunable parameters */ - -// Beam position - double m_BeamPositionX; - double m_BeamPositionY; - long int m_BeamConstraint; - long int m_TypeRobust; - double m_RobustScale; - -// Track selection - long int m_CutSctHits; - long int m_CutPixelHits; - long int m_CutSiHits; - long int m_CutBLayHits; - long int m_CutSharedHits; - double m_CutPt; - double m_CutZVrt; - double m_CutA0; - double m_CutChi2; - double m_A0TrkErrorCut; - double m_ZTrkErrorCut; -// Cuts for track - initial vertex association - double m_RImpSelCut; - double m_ZImpSelCut; - double m_RDistSelCut; - double m_ZDistSelCut; - double m_SignifSelCut; -// Stop point for the common fit - double m_SecTrkChi2Cut; - double m_WeightCut; -// Maximal number of vertices - long int m_NPVertexMax; - - - PublicToolHandle< Trk::ITrkVKalVrtFitter > m_fitSvc - {this,"TrkVKalVrtFitter","Trk::TrkVKalVrtFitter",""}; - PublicToolHandle< Trk::ITrackSummaryTool > m_sumSvc - {this,"TrackSummaryTool","Trk::TrackSummaryTool/AtlasTrackSummaryTool",""}; //!< Pointer to the track summary tool - SG::ReadCondHandleKey m_beamSpotKey { this, "BeamSpotKey", "BeamSpotData", "SG key for beam spot" }; - PublicToolHandle m_trkSelector - {this,"DefaultTrackSelection","DefaultTrackSelection",""}; - - Amg::Vector3D m_BeamCnst; - std::vector m_BeamCnstWid; -// - int m_SummaryToolExist; - int m_trkSelectorExist; -// -// To simplify life.... - StatusCode m_sc; - TLorentzVector m_Momentum; - long int m_Charge; -//---------------------------------------------------------------------------------------------- -// Private functions -// - void CleanTrkSet(std::vector& ,std::vector&, - Amg::Vector3D &FitVertex, std::vector &Chi2PerTrk, - std::vector& ,std::vector&); - int FindMax( std::vector& ); - int FindMin( std::vector& ); - int FindMaxSecond( std::vector& ); - const Trk::Perigee* GetPerigee( const Trk::TrackParticleBase* List); - const Trk::Perigee* GetPerigee( const Trk::Track* List); - void RemoveEntryInList(std::vector& ListTracks, int ); - void RemoveEntryInList(std::vector& ListTracks, int ); - void RemoveEntryInList(std::vector& List, int Outlier); - double GetLimitAngle(double); - void UniqList(std::vector & List); - void UniqList(std::vector & List); - void RemoveUsedEntry(std::vector& ,std::vector& , std::vector &); - void RemoveUsedEntry(std::vector& , - std::vector&, std::vector & ); - - void inpSelector(std::vector & ListParticles, - std::vector & ListTracks, - Amg::Vector3D & IniVertex, - std::vector & SelectedParticles, - std::vector & SelectedTracks); - - double FitCommonVrt(std::vector& ListP, - std::vector& ListT, - double ZEstimation, - Amg::Vector3D & FitVertex, - std::vector & ErrorMatrix, - std::vector & TrkWeights); - - double FindZPosTrk(std::vector& ListTracks,double & ControlVariable); - double FindZPosTrk(std::vector& ListTracks,double & ControlVariable); - - double FindZPos( std::vector &ZTrk, - std::vector &PtTrk, - std::vector &PxTrk, - std::vector &PyTrk, - std::vector &PhiTrk, - double & ControlVar); - - void SetTrkParamVectors(std::vector& ListTracks, - std::vector &ZTrk, - std::vector &PtTrk, - std::vector &PxTrk, - std::vector &PyTrk, - std::vector &PhiTrk); - - void SetTrkParamVectors(std::vector& ListTracks, - std::vector &ZTrk, - std::vector &PtTrk, - std::vector &PxTrk, - std::vector &PyTrk, - std::vector &PhiTrk); - - int PVrtListFind(std::vector & ListParticles, - std::vector & ListTracks, - std::vector< Amg::Vector3D > & PVrtList, - std::vector< AmgSymMatrix(3) > & ErrorMatrixPerVrt, - std::vector & Chi2PerVrt, - std::vector & ControlVariablePerVrt, - std::vector< std::vector > & PrtPerVrt, - std::vector< std::vector > & TrkPerVrt, - std::vector< std::vector > & TrkWgtPerVrt); - - std::pair SaveResults( int NVrt, - std::vector< Amg::Vector3D > & PVrtList, - std::vector< AmgSymMatrix(3) > & ErrorMatrixPerVrt, - std::vector & Chi2PerVrt, - std::vector & NTrkPerVrt, - std::vector< std::vector > & PrtPerVrt, - std::vector< std::vector > & TrkPerVrt, - std::vector< std::vector > & TrkWgtPerVrt, - const TrackCollection* trackTES = 0, - const Trk::TrackParticleBaseCollection* partTES = 0); - - - - StatusCode CutTrk(double PInvVert, double ThetaVert, double A0Vert, double Chi2, - long int PixelHits,long int SctHits,long int SharedHits, long int BLayHits); - - - double** getWorkArr2(long int dim1,long int dim2); - void removeWorkArr2(double **Arr,long int dim1,long int dim2); - double*** getWorkArr3(long int dim1,long int dim2,long int dim3); - void removeWorkArr3(double ***Arr,long int dim1,long int dim2,long int dim3); - AmgSymMatrix(5) FillCovMatrix(int iTrk, std::vector & Matrix); - Amg::Vector3D findIniXY(const Trk::TrackParticleBaseCollection* newPrtCol); - Amg::Vector3D findIniXY(const TrackCollection* newPrtCol); -//--------------------------------------------------------------------------- -// Arrays for propagation of fit results to steering procedure -// - std::vector m_savedTrkFittedPerigees; - std::vector< std::vector< AmgSymMatrix(5) > > m_fittedTrkCov; - - - }; +public: + InDetVKalPriVxFinderTool(const std::string& t, + const std::string& n, + const IInterface* p); + virtual ~InDetVKalPriVxFinderTool(); + virtual StatusCode initialize() override; + virtual StatusCode finalize() override; + // + // Tool interface + // + using IVertexFinder::findVertex; + + virtual std::pair + findVertex(const TrackCollection* trackTES) const override; + + virtual std::pair + findVertex(const Trk::TrackParticleBaseCollection* trackTES) const override; + + virtual std::pair + findVertex(const xAOD::TrackParticleContainer* trackTES) const override; + // + +private: + /* JobOption tunable parameters */ + + // Beam position + double m_BeamPositionX; + double m_BeamPositionY; + long int m_BeamConstraint; + long int m_TypeRobust; + double m_RobustScale; + + // Track selection + long int m_CutSctHits; + long int m_CutPixelHits; + long int m_CutSiHits; + long int m_CutBLayHits; + long int m_CutSharedHits; + double m_CutPt; + double m_CutZVrt; + double m_CutA0; + double m_CutChi2; + double m_A0TrkErrorCut; + double m_ZTrkErrorCut; + // Cuts for track - initial vertex association + double m_RImpSelCut; + double m_ZImpSelCut; + double m_RDistSelCut; + double m_ZDistSelCut; + double m_SignifSelCut; + // Stop point for the common fit + double m_SecTrkChi2Cut; + double m_WeightCut; + // Maximal number of vertices + long int m_NPVertexMax; + + PublicToolHandle m_fitSvc{ this, + "TrkVKalVrtFitter", + "Trk::TrkVKalVrtFitter", + "" }; + PublicToolHandle m_sumSvc{ + this, + "TrackSummaryTool", + "Trk::TrackSummaryTool/AtlasTrackSummaryTool", + "" + }; //!< Pointer to the track summary tool + SG::ReadCondHandleKey m_beamSpotKey{ + this, + "BeamSpotKey", + "BeamSpotData", + "SG key for beam spot" + }; + PublicToolHandle + m_trkSelector{ this, "DefaultTrackSelection", "DefaultTrackSelection", "" }; + + // + int m_SummaryToolExist; + int m_trkSelectorExist; + + /* + * C.A + * Cache for passing arguements between methods + * Added for the MT migration to avoid state + */ + struct Cache { + Amg::Vector3D m_BeamCnst; + std::vector m_BeamCnstWid; + StatusCode m_sc; + TLorentzVector m_Momentum; + long int m_Charge; + std::vector m_savedTrkFittedPerigees; + std::vector> m_fittedTrkCov; + }; + //---------------------------------------------------------------------------------------------- + // Private functions + // + void CleanTrkSet(Cache& cache, + std::vector&, + std::vector&, + Amg::Vector3D& FitVertex, + std::vector& Chi2PerTrk, + std::vector&, + std::vector&) const; + + int FindMax(std::vector&) const; + + int FindMin(std::vector&) const; + + int FindMaxSecond(std::vector&) const; + + const Trk::Perigee* GetPerigee(const Trk::TrackParticleBase* List) const; + + const Trk::Perigee* GetPerigee(const Trk::Track* List) const; + + void RemoveEntryInList(std::vector& ListTracks, int) const; + + void RemoveEntryInList(std::vector& ListTracks, + int) const; + + void RemoveEntryInList(std::vector& List, int Outlier) const; + + double GetLimitAngle(double) const; + + void UniqList(std::vector& List) const; + + void UniqList(std::vector& List) const; + + void RemoveUsedEntry(std::vector&, + std::vector&, + std::vector&) const; + + void RemoveUsedEntry(std::vector&, + std::vector&, + std::vector&) const; + + void inpSelector( + std::vector& ListParticles, + std::vector& ListTracks, + Amg::Vector3D& IniVertex, + std::vector& SelectedParticles, + std::vector& SelectedTracks) const; + + double FitCommonVrt(Cache& cache, + std::vector& ListP, + std::vector& ListT, + double ZEstimation, + Amg::Vector3D& FitVertex, + std::vector& ErrorMatrix, + std::vector& TrkWeights) const; + + double FindZPosTrk(Cache& cache, + std::vector& ListTracks, + double& ControlVariable) const; + + double FindZPosTrk(Cache& cache, + std::vector& ListTracks, + double& ControlVariable) const; + + double FindZPos(std::vector& ZTrk, + std::vector& PtTrk, + std::vector& PxTrk, + std::vector& PyTrk, + std::vector& PhiTrk, + double& ControlVar) const; + + void SetTrkParamVectors( + Cache& cache, + std::vector& ListTracks, + std::vector& ZTrk, + std::vector& PtTrk, + std::vector& PxTrk, + std::vector& PyTrk, + std::vector& PhiTrk) const; + + void SetTrkParamVectors(Cache& cache, + std::vector& ListTracks, + std::vector& ZTrk, + std::vector& PtTrk, + std::vector& PxTrk, + std::vector& PyTrk, + std::vector& PhiTrk) const; + + int PVrtListFind( + Cache& cache, + std::vector& ListParticles, + std::vector& ListTracks, + std::vector& PVrtList, + std::vector& ErrorMatrixPerVrt, + std::vector& Chi2PerVrt, + std::vector& ControlVariablePerVrt, + std::vector>& PrtPerVrt, + std::vector>& TrkPerVrt, + std::vector>& TrkWgtPerVrt) const; + + std::pair SaveResults( + Cache& cache, + int NVrt, + std::vector& PVrtList, + std::vector& ErrorMatrixPerVrt, + std::vector& Chi2PerVrt, + std::vector& NTrkPerVrt, + std::vector>& PrtPerVrt, + std::vector>& TrkPerVrt, + std::vector>& TrkWgtPerVrt, + const TrackCollection* trackTES = 0, + const Trk::TrackParticleBaseCollection* partTES = 0) const; + + StatusCode CutTrk(double PInvVert, + double ThetaVert, + double A0Vert, + double Chi2, + long int PixelHits, + long int SctHits, + long int SharedHits, + long int BLayHits) const; + + double** getWorkArr2(long int dim1, long int dim2) const; + void removeWorkArr2(double** Arr, long int dim1, long int dim2) const; + double*** getWorkArr3(long int dim1, long int dim2, long int dim3) const; + void removeWorkArr3(double*** Arr, + long int dim1, + long int dim2, + long int dim3) const; + AmgSymMatrix(5) FillCovMatrix(int iTrk, std::vector& Matrix) const; + Amg::Vector3D findIniXY( + const Trk::TrackParticleBaseCollection* newPrtCol) const; + Amg::Vector3D findIniXY(const TrackCollection* newPrtCol) const; + //--------------------------------------------------------------------------- + // Arrays for propagation of fit results to steering procedure + // + /* + * Consider having an internal stuct Cache {.... }; + * and then pass it to methods to keep track + */ +}; } // end of namespace bracket diff --git a/InnerDetector/InDetRecTools/InDetVKalPriVxFinderTool/src/CutTrk.cxx b/InnerDetector/InDetRecTools/InDetVKalPriVxFinderTool/src/CutTrk.cxx index f8977d07855..227103698ad 100755 --- a/InnerDetector/InDetRecTools/InDetVKalPriVxFinderTool/src/CutTrk.cxx +++ b/InnerDetector/InDetRecTools/InDetVKalPriVxFinderTool/src/CutTrk.cxx @@ -7,23 +7,37 @@ //------------------------------------------------- namespace InDet { - StatusCode InDetVKalPriVxFinderTool::CutTrk(double PInvVert, double ThetaVert, double A0Vert, double Chi2, - long int PixelHits,long int SctHits,long int SharedHits, long int BLayHits) - { - double Pt = sin(ThetaVert)/fabs(PInvVert); -//- Track quality - if(Pt < m_CutPt) return StatusCode::FAILURE; - if(Chi2 > m_CutChi2) return StatusCode::FAILURE; - if(fabs(A0Vert) > m_CutA0) return StatusCode::FAILURE; +StatusCode +InDetVKalPriVxFinderTool::CutTrk(double PInvVert, + double ThetaVert, + double A0Vert, + double Chi2, + long int PixelHits, + long int SctHits, + long int SharedHits, + long int BLayHits) const +{ + double Pt = sin(ThetaVert) / fabs(PInvVert); + //- Track quality + if (Pt < m_CutPt) + return StatusCode::FAILURE; + if (Chi2 > m_CutChi2) + return StatusCode::FAILURE; + if (fabs(A0Vert) > m_CutA0) + return StatusCode::FAILURE; + if (PixelHits < m_CutPixelHits) + return StatusCode::FAILURE; + if (SctHits < m_CutSctHits) + return StatusCode::FAILURE; + if ((PixelHits + SctHits) < m_CutSiHits) + return StatusCode::FAILURE; + if (BLayHits < m_CutBLayHits) + return StatusCode::FAILURE; + if (SharedHits > m_CutSharedHits) + return StatusCode::FAILURE; - if(PixelHits < m_CutPixelHits) return StatusCode::FAILURE; - if(SctHits < m_CutSctHits) return StatusCode::FAILURE; - if((PixelHits+SctHits) < m_CutSiHits) return StatusCode::FAILURE; - if(BLayHits < m_CutBLayHits) return StatusCode::FAILURE; - if(SharedHits > m_CutSharedHits) return StatusCode::FAILURE; - - return StatusCode::SUCCESS; + return StatusCode::SUCCESS; } } diff --git a/InnerDetector/InDetRecTools/InDetVKalPriVxFinderTool/src/InDetVKalPriVxFinder.cxx b/InnerDetector/InDetRecTools/InDetVKalPriVxFinderTool/src/InDetVKalPriVxFinder.cxx index 2b35589ce93..e4eeaf33701 100644 --- a/InnerDetector/InDetRecTools/InDetVKalPriVxFinderTool/src/InDetVKalPriVxFinder.cxx +++ b/InnerDetector/InDetRecTools/InDetVKalPriVxFinderTool/src/InDetVKalPriVxFinder.cxx @@ -110,14 +110,6 @@ InDetVKalPriVxFinderTool::InDetVKalPriVxFinderTool(const std::string& type, { if(msgLvl(MSG::DEBUG))msg(MSG::DEBUG)<<"InDetVKalVrtPriVxTool initialize()" << endmsg; m_SummaryToolExist = 0; -// --------------- -/* Tool Service initialisation. NOT NEEDED now*/ -// IToolSvc* toolSvc; -// StatusCode sc = service("ToolSvc", toolSvc); -// if (sc.isFailure()) { -// if(msgLvl(MSG::ERROR))msg(MSG::ERROR) << "Could not find ToolSvc" << endmsg; -// return StatusCode::SUCCESS; -// } if (m_fitSvc.retrieve().isFailure()) { @@ -134,14 +126,6 @@ InDetVKalPriVxFinderTool::InDetVKalPriVxFinderTool(const std::string& type, // // Data for beam spot constraint // - m_BeamCnst[0]=m_BeamPositionX; - m_BeamCnst[1]=m_BeamPositionY; - m_BeamCnst[2]=0.; - m_BeamCnstWid.resize(3); - m_BeamCnstWid[0]=0.015; - m_BeamCnstWid[1]=0.015; - m_BeamCnstWid[2]=56.; - ATH_CHECK(m_beamSpotKey.initialize(m_BeamConstraint)); @@ -175,80 +159,97 @@ InDetVKalPriVxFinderTool::InDetVKalPriVxFinderTool(const std::string& type, if(msgLvl(MSG::DEBUG))msg(MSG::DEBUG) <<"InDetVKalPriVxFinderTool finalize()" << endmsg; return StatusCode::SUCCESS; } - - - - std::pair InDetVKalPriVxFinderTool::findVertex(const xAOD::TrackParticleContainer* trackTES) - { - if(msgLvl(MSG::DEBUG)){ - msg(MSG::DEBUG) << "N="<size()<<" xAOD::TrackParticles found" << endmsg; - msg(MSG::DEBUG) << "No InDetVKalPriVxFinderTool implementation for xAOD::TrackParticle" << endmsg; - } - return std::pair (0,0); + std::pair + InDetVKalPriVxFinderTool::findVertex ( + const xAOD::TrackParticleContainer* trackTES) const + { + if (msgLvl(MSG::DEBUG)) { + msg(MSG::DEBUG) << "N=" << trackTES->size() + << " xAOD::TrackParticles found" << endmsg; + msg(MSG::DEBUG) + << "No InDetVKalPriVxFinderTool implementation for xAOD::TrackParticle" + << endmsg; + } + return std::pair(0, 0); } //__________________________________________________________________________ - std::pair InDetVKalPriVxFinderTool::findVertex(const TrackCollection* trackTES) - { - //............................................. - - if(msgLvl(MSG::DEBUG))msg(MSG::DEBUG) << "Primary vertex with InDetVKalPriVxFinderTool starts" << endmsg; -// -// - m_savedTrkFittedPerigees.clear(); - m_fittedTrkCov.clear(); -//------------------------------------------------------------------------------------------ -// Creating the necessary vectors - - std::vector SelectedTrkTracks; - std::vector SelectedTrackParticles; - std::vector PrimVrtList; - std::vector< AmgSymMatrix(3) > ErrorMatrixPerVrt; - std::vector Chi2PerVrt; - std::vector ControlVariablePerVrt; - std::vector< std::vector > TrkPerVrt; - std::vector< std::vector > PrtPerVrt; - std::vector< std::vector > TrkWgtPerVrt; - std::vector NTrkPerVrt; -// - int NFoundVrt=0; - SelectedTrkTracks.clear(); SelectedTrackParticles.clear(); NTrkPerVrt.clear(); - TrkPerVrt.clear(); PrtPerVrt.clear(); - - const Trk::Perigee* mPer=NULL; - AmgVector(5) VectPerig; VectPerig<<0.,0.,0.,0.,0.; - const Trk::FitQuality* TrkQual=0; - std::vector Impact,ImpactError; - -// -// Now we start a work. -// - const DataVector* newTrkCol = trackTES; - - if(m_BeamConstraint){ - SG::ReadCondHandle beamSpotHandle { m_beamSpotKey }; - if(beamSpotHandle.isValid()){ + std::pair + InDetVKalPriVxFinderTool::findVertex(const TrackCollection* trackTES) const + { + //............................................. + + if (msgLvl(MSG::DEBUG)) + msg(MSG::DEBUG) << "Primary vertex with InDetVKalPriVxFinderTool starts" + << endmsg; + // + // + Cache cache{}; + cache.m_BeamCnst[0] = m_BeamPositionX; + cache.m_BeamCnst[1] = m_BeamPositionY; + cache.m_BeamCnst[2] = 0.; + cache.m_BeamCnstWid.resize(3); + cache.m_BeamCnstWid[0] = 0.015; + cache.m_BeamCnstWid[1] = 0.015; + cache.m_BeamCnstWid[2] = 56.; + cache.m_savedTrkFittedPerigees.clear(); + cache.m_fittedTrkCov.clear(); + //------------------------------------------------------------------------------------------ + // Creating the necessary vectors + + std::vector SelectedTrkTracks; + std::vector SelectedTrackParticles; + std::vector PrimVrtList; + std::vector ErrorMatrixPerVrt; + std::vector Chi2PerVrt; + std::vector ControlVariablePerVrt; + std::vector> TrkPerVrt; + std::vector> PrtPerVrt; + std::vector> TrkWgtPerVrt; + std::vector NTrkPerVrt; + // + int NFoundVrt = 0; + SelectedTrkTracks.clear(); + SelectedTrackParticles.clear(); + NTrkPerVrt.clear(); + TrkPerVrt.clear(); + PrtPerVrt.clear(); + + const Trk::Perigee* mPer = NULL; + AmgVector(5) VectPerig; + VectPerig << 0., 0., 0., 0., 0.; + const Trk::FitQuality* TrkQual = 0; + std::vector Impact, ImpactError; + + // + // Now we start a work. + // + const DataVector* newTrkCol = trackTES; + + if (m_BeamConstraint) { + SG::ReadCondHandle beamSpotHandle{ m_beamSpotKey }; + if (beamSpotHandle.isValid()) { const Amg::Vector3D &beam=beamSpotHandle->beamPos(); - m_BeamCnst[0]=beam.x(); - m_BeamCnst[1]=beam.y(); - m_BeamCnst[2]=beam.z(); - m_BeamCnstWid[0]=beamSpotHandle->beamSigma(0); - m_BeamCnstWid[1]=beamSpotHandle->beamSigma(1); - if(msgLvl(MSG::DEBUG))msg(MSG::DEBUG) << "BeamSpot from SVC="<beamSigma(0); + cache.m_BeamCnstWid[1]=beamSpotHandle->beamSigma(1); + if(msgLvl(MSG::DEBUG))msg(MSG::DEBUG) << "BeamSpot from SVC="< beamSpotHandle { m_beamSpotKey }; if(beamSpotHandle.isValid()){ const Amg::Vector3D &beam=beamSpotHandle->beamPos(); - m_BeamCnst[0]=beam.x(); - m_BeamCnst[1]=beam.y(); - m_BeamCnst[2]=beam.z(); - m_BeamCnstWid[0]=beamSpotHandle->beamSigma(0); - m_BeamCnstWid[1]=beamSpotHandle->beamSigma(1); - if(msgLvl(MSG::DEBUG))msg(MSG::DEBUG) << "BeamSpot from SVC="<beamSigma(0); + cache.m_BeamCnstWid[1]=beamSpotHandle->beamSigma(1); + if(msgLvl(MSG::DEBUG))msg(MSG::DEBUG) << "BeamSpot from SVC="< new_secVertices(0); //if (msgLvl(MSG::DEBUG)) msg () << "jet momentum Et s= "< secVertices; //if (msgLvl(MSG::DEBUG)) msg () << "jet momentum Et = "<(trk_2->perigeeParameters())); if (!perigee_1 | !perigee_2) { if (msgLvl(MSG::VERBOSE)) msg() << "Dynamic cast to MeasuredPerigee failed. Skipping this pair" << endmsg; - return 0; - } else { + return nullptr; + } Trk::Vertex* vertex = findSpatialPoint(perigee_1, perigee_2); return vertex; - }//if measured perigee + //if measured perigee } //============================================================================================ @@ -78,12 +78,12 @@ Trk::Vertex* InDet::ZVTOP_SlowSpatialPointFinder::findSpatialPoint(const Trk::Re const Trk::TrackParameters *perigee_1(dynamic_cast(trk_1->perigeeParameters())); if (!perigee_1) { if (msgLvl(MSG::VERBOSE)) msg() << "Dynamic cast to MeasuredPerigee failed. Skipping this pair" << endmsg; - return 0; - } else { + return nullptr; + } //we need Trk::Vertex Trk::Vertex* vertex = findSpatialPoint(vtx, perigee_1); return vertex; - } + } //============================================================================================ @@ -93,12 +93,12 @@ Trk::Vertex* InDet::ZVTOP_SlowSpatialPointFinder::findSpatialPoint(const Rec::Tr const Trk::TrackParameters* perigee_2(trk_2->measuredPerigee()); if (!perigee_1 | !perigee_2) { if (msgLvl(MSG::VERBOSE)) msg() << "Dynamic cast to MeasuredPerigee failed. Skipping this pair" << endmsg; - return 0; - } else { + return nullptr; + } //we need Trk::Vertex Trk::Vertex* vertex = findSpatialPoint(perigee_1, perigee_2); return vertex; - }//if measured perigee + //if measured perigee } //============================================================================================ @@ -107,11 +107,11 @@ Trk::Vertex* InDet::ZVTOP_SlowSpatialPointFinder::findSpatialPoint(const Trk::Re const Trk::TrackParameters* perigee_1(trk_1->measuredPerigee()); if (!perigee_1) { if (msgLvl(MSG::VERBOSE)) msg() << "Dynamic cast to MeasuredPerigee failed. Skipping this pair" << endmsg; - return 0; - } else { + return nullptr; + } Trk::Vertex* vertex = findSpatialPoint(vtx, perigee_1); return vertex; - } + } //============================================================================================ @@ -121,12 +121,12 @@ Trk::Vertex* InDet::ZVTOP_SlowSpatialPointFinder::findSpatialPoint(const Trk::Tr const Trk::TrackParameters* perigee_2 = dynamic_cast(&(trk_2)->definingParameters()); if (!perigee_1 | !perigee_2) { if (msgLvl(MSG::VERBOSE)) msg() << "Dynamic cast to MeasuredPerigee failed. Skipping this pair" << endmsg; - return 0; - } else { + return nullptr; + } //we need Trk::Vertex Trk::Vertex* vertex = findSpatialPoint(perigee_1, perigee_2); return vertex; - }//if measured perigee + //if measured perigee } //============================================================================================ Trk::Vertex* InDet::ZVTOP_SlowSpatialPointFinder::findSpatialPoint(const Trk::RecVertex vtx, const Trk::TrackParticleBase* trk_1) const @@ -134,11 +134,11 @@ Trk::Vertex* InDet::ZVTOP_SlowSpatialPointFinder::findSpatialPoint(const Trk::Re const Trk::TrackParameters* perigee_1 = dynamic_cast(&(trk_1)->definingParameters()); if (!perigee_1) { if (msgLvl(MSG::VERBOSE)) msg() << "Dynamic cast to MeasuredPerigee failed. Skipping this pair" << endmsg; - return 0; - } else { + return nullptr; + } Trk::Vertex* vertex = findSpatialPoint(vtx, perigee_1); return vertex; - } + } //============================================================================================= @@ -193,13 +193,13 @@ Trk::Vertex* InDet::ZVTOP_SlowSpatialPointFinder::findSpatialPoint(const Trk::Tr if (msgLvl(MSG::VERBOSE)) msg() <<"chi2 = "<(trk_2->perigeeParameters())); if ((!perigee_1) or (!perigee_2)) { ATH_MSG_DEBUG( "Dynamic cast to MeasuredPerigee failed. Skipping this pair" ); - return 0; - } else { + return nullptr; + } Trk::Vertex * vertex = findSpatialPoint(perigee_1,perigee_2); return vertex; - }//if measured perigee + //if measured perigee } //=============================================================================================== @@ -66,10 +66,10 @@ Trk::Vertex* InDet::ZVTOP_SpatialPointFinder::findSpatialPoint(const Trk::RecVer if (!perigee_1) { ATH_MSG_DEBUG( "Dynamic cast to MeasuredPerigee failed. Skipping this pair" ); return nullptr; - } else { + } Trk::Vertex * vertex = findSpatialPoint(vtx,perigee_1); return vertex; - } + } //============================================================================================ @@ -79,11 +79,11 @@ Trk::Vertex* InDet::ZVTOP_SpatialPointFinder::findSpatialPoint(const Rec::TrackP const Trk::TrackParameters* perigee_2(trk_2->measuredPerigee()); if ((!perigee_1) or (!perigee_2)) { ATH_MSG_DEBUG( "Dynamic cast to MeasuredPerigee failed. Skipping this pair" ); - return 0; - } else { + return nullptr; + } Trk::Vertex * vertex = findSpatialPoint(perigee_1,perigee_2); return vertex; - }//if measured perigee + //if measured perigee } //============================================================================================ @@ -92,11 +92,11 @@ Trk::Vertex* InDet::ZVTOP_SpatialPointFinder::findSpatialPoint(const Trk::RecVer const Trk::TrackParameters* perigee_1(trk_1->measuredPerigee()); if (!perigee_1) { ATH_MSG_DEBUG( "Dynamic cast to MeasuredPerigee failed. Skipping this pair" ); - return 0; - } else { + return nullptr; + } Trk::Vertex * vertex = findSpatialPoint(vtx,perigee_1); return vertex; - } + } //============================================================================================ Trk::Vertex* InDet::ZVTOP_SpatialPointFinder::findSpatialPoint(const Trk::TrackParticleBase* trk_1, const Trk::TrackParticleBase* trk_2) const @@ -105,11 +105,11 @@ Trk::Vertex* InDet::ZVTOP_SpatialPointFinder::findSpatialPoint(const Trk::TrackP const Trk::TrackParameters* perigee_2 = dynamic_cast(&trk_2->definingParameters()); if ((!perigee_1) or (!perigee_2)) { ATH_MSG_DEBUG ("Dynamic cast to MeasuredPerigee failed. Skipping this pair" ); - return 0; - } else { + return nullptr; + } Trk::Vertex * vertex = findSpatialPoint(perigee_1,perigee_2); return vertex; - }//if measured perigee + //if measured perigee } //============================================================================================ @@ -118,11 +118,11 @@ Trk::Vertex* InDet::ZVTOP_SpatialPointFinder::findSpatialPoint(const Trk::RecVer const Trk::TrackParameters* perigee_1 = dynamic_cast(&trk_1->definingParameters()); if (!perigee_1) { ATH_MSG_DEBUG( "Dynamic cast to MeasuredPerigee failed. Skipping this pair" ); - return 0; - } else { + return nullptr; + } Trk::Vertex * vertex = findSpatialPoint(vtx,perigee_1); return vertex; - } + } //=============================================================================================== @@ -189,11 +189,11 @@ Trk::Vertex* InDet::ZVTOP_SpatialPointFinder::findSpatialPoint(const Trk::TrackP { ATH_MSG_DEBUG("found spatial point = ("< InDet::ZVTOP_Tool::findVertex(const TrackCollection* trackTES) +std::pair +InDet::ZVTOP_Tool::findVertex(const TrackCollection* trackTES) const { //VxContainer* newVxContainer = new VxContainer; --David S. xAOD::VertexContainer* newVertexContainer = new xAOD::VertexContainer; xAOD::VertexAuxContainer* newVertexAuxContainer = new xAOD::VertexAuxContainer; newVertexContainer->setStore( newVertexAuxContainer ); -if (trackTES->size() != 0) { +if (!trackTES->empty()) { //some variables typedef DataVector::const_iterator TrackDataVecIter; const Trk::RecVertex beam_spot = m_iBeamCondSvc->beamVtx(); @@ -153,7 +154,7 @@ if (trackTES->size() != 0) { { Trk::Vertex* spatialPoint; spatialPoint = m_iSpatialPointFinder->findSpatialPoint((*itr_1),(*itr_2)); - if (spatialPoint != 0) + if (spatialPoint != nullptr) { double TrkProbTube_1 = m_iTrkProbTubeCalc->calcProbTube(*(*itr_1),*spatialPoint); double TrkProbTube_2 = m_iTrkProbTubeCalc->calcProbTube(*(*itr_2),*spatialPoint); @@ -172,9 +173,9 @@ if (trackTES->size() != 0) { delete spatialPoint; } //trk-IP combination - Trk::Vertex* spatialPoint = 0; + Trk::Vertex* spatialPoint = nullptr; spatialPoint = m_iSpatialPointFinder->findSpatialPoint(beam_spot,(*itr_1)); - if (spatialPoint != 0) + if (spatialPoint != nullptr) { double BeamProbTube = m_iTrkProbTubeCalc->calcProbTube(beam_spot,*spatialPoint); double TrkProbTube = m_iTrkProbTubeCalc->calcProbTube(*(*itr_1),*spatialPoint); @@ -198,7 +199,7 @@ if (trackTES->size() != 0) { for (Sp_Iter itr1 = vtxState_org.begin(); itr1 != vtxState_org.end(); itr1++) { - if (vtxState.size() == 0) vtxState.push_back(*itr1); + if (vtxState.empty()) vtxState.push_back(*itr1); else { Trk::Vertex vtx_new = (*itr1)->vertex(); bool can_be_resolved = false; @@ -227,7 +228,7 @@ if (trackTES->size() != 0) { //------------------------------------------------------------------------------// - if (vtxState.size() != 0 ){ + if (!vtxState.empty() ){ if (msgLvl(MSG::DEBUG)) msg() << " step TWO vertex clustering, number of reduced vertices = "< vtxState_sorted; @@ -268,7 +269,7 @@ if (trackTES->size() != 0) { break; // break inner loop if found } } - if (vtx_is_stored == true) break; // break outer loop if found + if (vtx_is_stored) break; // break outer loop if found } if (!vtx_is_stored) { //if not stored @@ -344,7 +345,7 @@ if (trackTES->size() != 0) { } //call the fitter //Trk::VxCandidate * myVxCandidate(0); --David S. - xAOD::Vertex * myxAODVertex(0); + xAOD::Vertex * myxAODVertex(nullptr); //if (with_beam_spot) myVxCandidate = m_iVertexFitter->fit(trk_coll,beam_spot); --David S. if (with_beam_spot) myxAODVertex = m_iVertexFitter->fit(trk_coll,theconstraint); //else myVxCandidate = m_iVertexFitter->fit(trk_coll); --David S. @@ -373,26 +374,26 @@ if (trackTES->size() != 0) { if (largest_chi2 > m_trk_chi2_cut) { if (trk_coll.size() < 3) break; - else { + trk_coll.erase(index); if (trk_coll.size() >= 2) { //if (myVxCandidate!=0) { delete myVxCandidate; myVxCandidate=0; } --David S. - if (myxAODVertex!=0) { delete myxAODVertex; myxAODVertex=0; } + if (myxAODVertex!=nullptr) { delete myxAODVertex; myxAODVertex=nullptr; } //if (with_beam_spot) myVxCandidate = m_iVertexFitter->fit(trk_coll, beam_spot); --David S. if (with_beam_spot) myxAODVertex = m_iVertexFitter->fit(trk_coll, theconstraint); //else myVxCandidate = m_iVertexFitter->fit(trk_coll); --David S. else myxAODVertex = m_iVertexFitter->fit(trk_coll); } //if (myVxCandidate == 0) break; --David S. - if (myxAODVertex == 0) break; - } + if (myxAODVertex == nullptr) break; + } else bad_chi2 = false; } } //if (myVxCandidate && bad_chi2 == false && with_beam_spot) newVxContainer->push_back(myVxCandidate); --David S. - if (myxAODVertex && bad_chi2 == false && with_beam_spot) newVertexContainer->push_back(myxAODVertex); + if (myxAODVertex && !bad_chi2 && with_beam_spot) newVertexContainer->push_back(myxAODVertex); //if (myVxCandidate && bad_chi2 == false && !with_beam_spot) theVxContainer.push_back(myVxCandidate); --David S. - if (myxAODVertex && bad_chi2 == false && !with_beam_spot) theVertexContainer.push_back(myxAODVertex); + if (myxAODVertex && !bad_chi2 && !with_beam_spot) theVertexContainer.push_back(myxAODVertex); } //if (msgLvl(MSG::DEBUG)) msg() <<"vertex container size = "<parameters()[Trk::phi0]; double f_theta = trkPer->parameters()[Trk::theta]; @@ -109,7 +109,7 @@ double InDet::ZVTOP_TrkProbTubeCalc::calcProbTube(const Trk::Perigee* trkPer, Tr diff[2]= extrapolatedPerigee->parameters()[Trk::phi0] - f_phi0; diff[3]= extrapolatedPerigee->parameters()[Trk::theta] - f_theta; diff[4]= extrapolatedPerigee->parameters()[Trk::qOverP] - f_qOverP; - if (extrapolatedPerigee->covariance() != 0) { + if (extrapolatedPerigee->covariance() != nullptr) { AmgMatrix(5,5) exp_perigee_weight = (*extrapolatedPerigee->covariance()).inverse(); probTube = std::exp(-0.5*diff.transpose()*exp_perigee_weight*diff); } else { -- GitLab From e1202c88a1f5bdcad42b9a15f89825a6eefafa62 Mon Sep 17 00:00:00 2001 From: Teng Jian Khoo Date: Thu, 11 Jun 2020 01:47:05 +0200 Subject: [PATCH 38/38] Converting JetTrimming into a subclass of JetGroomer --- .../Jet/JetRec/JetRec/JetClusterer.h | 5 +- Reconstruction/Jet/JetRec/JetRec/JetGroomer.h | 37 +++-- .../Jet/JetRec/JetRec/PseudoJetTranslator.h | 14 +- .../Jet/JetRec/Root/JetClusterer.cxx | 20 +-- Reconstruction/Jet/JetRec/Root/JetGroomer.cxx | 69 ++++++--- Reconstruction/Jet/JetRec/Root/JetTrimmer.cxx | 4 +- .../Jet/JetRec/Root/PseudoJetTranslator.cxx | 37 ++--- .../Jet/JetRec/share/JetRecAlgTestCfg.py | 11 +- Reconstruction/Jet/JetRec/src/JetTrimming.cxx | 131 ++++++------------ Reconstruction/Jet/JetRec/src/JetTrimming.h | 36 ++--- .../JetRec/src/components/JetRec_entries.cxx | 2 - 11 files changed, 175 insertions(+), 191 deletions(-) diff --git a/Reconstruction/Jet/JetRec/JetRec/JetClusterer.h b/Reconstruction/Jet/JetRec/JetRec/JetClusterer.h index 32fbe46d8b8..64b71f7bd2e 100644 --- a/Reconstruction/Jet/JetRec/JetRec/JetClusterer.h +++ b/Reconstruction/Jet/JetRec/JetRec/JetClusterer.h @@ -19,13 +19,14 @@ #include "xAODEventInfo/EventInfo.h" #include "StoreGate/ReadHandleKey.h" +#include "StoreGate/WriteHandleKey.h" #include "JetInterface/IJetProvider.h" #include "AsgTools/AsgTool.h" #include "JetRec/PseudoJetContainer.h" #include "JetRec/JetFromPseudojet.h" - +#include "JetEDM/PseudoJetVector.h" #include "fastjet/PseudoJet.hh" #include "fastjet/AreaDefinition.hh" @@ -61,7 +62,7 @@ protected: SG::ReadHandleKey m_inputPseudoJets {this, "InputPseudoJets", "inputpseudojet", "input constituents"}; /// used to build the key under which the final PJ will be stored in evtStore() - std::string m_finalPseudoJets; + SG::WriteHandleKey m_finalPseudoJets {this, "FinalPseudoJets_DONOTSET", "", "output pseudojets -- autoconfigured name"}; // Job options. Gaudi::Property m_jetalg {this, "JetAlgorithm", "AntiKt", "alg type : AntiKt, Kt, CA..."}; diff --git a/Reconstruction/Jet/JetRec/JetRec/JetGroomer.h b/Reconstruction/Jet/JetRec/JetRec/JetGroomer.h index 3cbff98faf6..eca09b0d535 100644 --- a/Reconstruction/Jet/JetRec/JetRec/JetGroomer.h +++ b/Reconstruction/Jet/JetRec/JetRec/JetGroomer.h @@ -9,16 +9,23 @@ /// /// \class JetGroomer /// -/// Creates a new JetContainer by grooming an input jet collection +/// Base class for tools that create a new JetContainer by grooming an input jet collection /// -/// This tool implements the IJetProvider interface. The JetContainer it returns is built by -/// running an IJetGroomer tool (e.g. JetTrimmer) on the input jets. +/// This tool implements the IJetProvider interface. Children should override (only) +/// the initialize and insertGroomedJet methods, to implement a specific instance of +/// jet grooming. /// #include "AsgTools/AsgTool.h" + #include "StoreGate/ReadHandleKey.h" +#include "StoreGate/WriteHandleKey.h" + #include "JetInterface/IJetProvider.h" -#include "JetInterface/IJetGroomer.h" + +#include "JetEDM/PseudoJetVector.h" +#include "JetRec/PseudoJetContainer.h" + #include "xAODJet/JetContainer.h" #include "xAODJet/JetAuxContainer.h" @@ -32,17 +39,23 @@ class JetGroomer using asg::AsgTool::AsgTool; virtual StatusCode initialize() override; - virtual std::pair, std::unique_ptr > getJets() const override; - private: - // Handle Input JetContainer - SG::ReadHandleKey m_inputJetsKey {this, "UngroomedJets", "", "Jet collection to be groomed"}; + // From IJetProvider + virtual std::pair, std::unique_ptr > getJets() const override final; + + // Implementation of grooming goes here + // The jet is inserted into the output container, which is necessary for speed + // in the xAOD container paradigm + virtual void insertGroomedJet(const xAOD::Jet&, const PseudoJetContainer&, xAOD::JetContainer&, PseudoJetVector&) const = 0; - // Handle Input PseudoJetContainer - // Needed to extract the constituents - SG::ReadHandleKey m_inputPseudoJetsKey {this, "ParentPseudoJets", "", "Input constituents"}; + protected: + /// Handle Input JetContainer (this contains the parent ungroomed jets to be trimmed) + SG::ReadHandleKey m_inputJetContainer {this, "UngroomedJets", "ungroomedinput", "Input ungroomed jet container"}; - ToolHandle m_groomer ={this , "Groomer" , {} , "Tool grooming the jets (trim, prune, softdrop etc)"}; + /// This is the input to the parent JetContainer. It is needed in order to re-assign the ghost constituents from the final groomed PJ to the xAOD::Jet + SG::ReadHandleKey m_inputPseudoJets {this, "ParentPseudoJets", "inputpseudojet", "input constituents of parent JetContainer"}; + + SG::WriteHandleKey m_finalPseudoJets {this, "FinalPseudoJets_DONOTSET", "", "output pseudojets -- autoconfigured name"}; }; diff --git a/Reconstruction/Jet/JetRec/JetRec/PseudoJetTranslator.h b/Reconstruction/Jet/JetRec/JetRec/PseudoJetTranslator.h index 6053fd625d0..84cd8386558 100644 --- a/Reconstruction/Jet/JetRec/JetRec/PseudoJetTranslator.h +++ b/Reconstruction/Jet/JetRec/JetRec/PseudoJetTranslator.h @@ -15,14 +15,14 @@ public: PseudoJetTranslator(bool saveArea, bool saveArea4Vec) : m_saveArea(saveArea), m_saveArea4Vec(saveArea4Vec) {} - xAOD::Jet * translate(const fastjet::PseudoJet& pj, - const PseudoJetContainer& pjCont, - xAOD::JetContainer& jetCont) const ; + xAOD::Jet& translate(const fastjet::PseudoJet& pj, + const PseudoJetContainer& pjCont, + xAOD::JetContainer& jetCont) const ; - xAOD::Jet * translate(const fastjet::PseudoJet& pj, - const PseudoJetContainer& pjCont, - xAOD::JetContainer& jetCont, - const xAOD::Jet &parent) const ; + xAOD::Jet& translate(const fastjet::PseudoJet& pj, + const PseudoJetContainer& pjCont, + xAOD::JetContainer& jetCont, + const xAOD::Jet &parent) const ; diff --git a/Reconstruction/Jet/JetRec/Root/JetClusterer.cxx b/Reconstruction/Jet/JetRec/Root/JetClusterer.cxx index a4cf76d335f..f9f4b00ed60 100644 --- a/Reconstruction/Jet/JetRec/Root/JetClusterer.cxx +++ b/Reconstruction/Jet/JetRec/Root/JetClusterer.cxx @@ -14,7 +14,6 @@ #include "xAODJet/JetAuxContainer.h" #include "JetEDM/FastJetUtils.h" -#include "JetEDM/PseudoJetVector.h" #include "JetRec/PseudoJetTranslator.h" @@ -58,9 +57,14 @@ StatusCode JetClusterer::initialize() { cs.inclusive_jets(m_ptmin); // Input DataHandles + if( !m_finalPseudoJets.empty() ) { + ATH_MSG_WARNING("A non-empty value was found for the FinalPseudoJets WriteHandleKey -- this will be ignored!"); + } + ATH_CHECK( m_eventinfokey.initialize() ); ATH_CHECK( m_inputPseudoJets.initialize() ); - m_finalPseudoJets = m_inputPseudoJets.key() +"FinalPJ"; + m_finalPseudoJets = name() + "FinalPJ"; + ATH_CHECK( m_finalPseudoJets.initialize() ); return StatusCode::SUCCESS; } @@ -121,16 +125,16 @@ std::pair, std::unique_ptr > PseudoJetTranslator pjTranslator(useArea, useArea); for (const fastjet::PseudoJet & pj: *pjVector ) { // create the xAOD::Jet from the PseudoJet, doing the signal & ghost constituents extraction - xAOD::Jet* jet = pjTranslator.translate(pj, *pjContHandle, *jets); + xAOD::Jet& jet = pjTranslator.translate(pj, *pjContHandle, *jets); // Add the PseudoJet onto the xAOD jet. Maybe we should do it in the above JetFromPseudojet call ?? - pjAccessor(*jet) = &pj; + pjAccessor(jet) = &pj; - jet->setInputType( xAOD::JetInput::Type( (int) m_inputType) ) ; + jet.setInputType( xAOD::JetInput::Type( (int) m_inputType) ) ; xAOD::JetAlgorithmType::ID ialg = xAOD::JetAlgorithmType::algId(m_fjalg); - jet->setAlgorithmType(ialg); - jet->setSizeParameter((float)m_jetrad); - if(useArea) jet->setAttribute(xAOD::JetAttribute::JetGhostArea, (float)m_ghostarea); + jet.setAlgorithmType(ialg); + jet.setSizeParameter((float)m_jetrad); + if(useArea) jet.setAttribute(xAOD::JetAttribute::JetGhostArea, (float)m_ghostarea); } // ------------------------------------- diff --git a/Reconstruction/Jet/JetRec/Root/JetGroomer.cxx b/Reconstruction/Jet/JetRec/Root/JetGroomer.cxx index 44aefcb547a..2b4207c180d 100644 --- a/Reconstruction/Jet/JetRec/Root/JetGroomer.cxx +++ b/Reconstruction/Jet/JetRec/Root/JetGroomer.cxx @@ -4,6 +4,7 @@ #include "JetRec/JetGroomer.h" +#include "fastjet/PseudoJet.hh" #include "JetRec/PseudoJetContainer.h" using xAOD::JetContainer; @@ -12,47 +13,73 @@ StatusCode JetGroomer::initialize() { ATH_MSG_DEBUG("Initializing..."); - if(m_inputJetsKey.empty()){ + if(m_inputJetContainer.empty()){ ATH_MSG_ERROR("Jet grooming requested with no input ungroomed jets"); return StatusCode::FAILURE; - } else if(m_inputPseudoJetsKey.empty()){ + } else if(m_inputPseudoJets.empty()){ ATH_MSG_ERROR("Jet grooming requested with no input pseudojets"); return StatusCode::FAILURE; } else{ - ATH_CHECK(m_inputJetsKey.initialize()); - ATH_CHECK(m_inputPseudoJetsKey.initialize()); - ATH_CHECK(m_groomer.retrieve()); + if(!m_finalPseudoJets.empty()){ + ATH_MSG_WARNING("A non-empty value was found for the FinalPseudoJets WriteHandleKey -- this will be ignored!"); + } + + ATH_CHECK(m_inputJetContainer.initialize()); + ATH_CHECK(m_inputPseudoJets.initialize()); + m_finalPseudoJets = name() + "FinalPJ"; + ATH_CHECK(m_finalPseudoJets.initialize()); } return StatusCode::SUCCESS; } +// Common operations for any jet groomer std::pair,std::unique_ptr > JetGroomer::getJets() const { + // Return this in case of any problems + auto nullreturn = std::make_pair(std::unique_ptr(nullptr), std::unique_ptr(nullptr)); + // ----------------------- // retrieve input - SG::ReadHandle inputJets(m_inputJetsKey); + SG::ReadHandle jetContHandle(m_inputJetContainer); + if(!jetContHandle.isValid()) { + ATH_MSG_ERROR("No valid JetContainer with key "<< m_inputJetContainer.key()); + return nullreturn; + } - if(inputJets.isValid()) { - ATH_MSG_DEBUG("Retrieval of ungroomed jets succeeded"); - } else { - ATH_MSG_ERROR("Retrieval of ungroomed jets failed"); - return std::make_pair(std::unique_ptr(nullptr),std::unique_ptr(nullptr)); + SG::ReadHandle pjContHandle(m_inputPseudoJets); + if(!pjContHandle.isValid()) { + ATH_MSG_ERROR("No valid PseudoJetContainer with key "<< m_inputPseudoJets.key()); + return nullreturn; } - ATH_MSG_DEBUG("Grooming jets"); - // Create the output containers - // Make sure that memory is managed safely - auto outjets = std::make_unique(); - auto outaux = std::make_unique(); - outjets->setStore(outaux.get()); + // Build the container to be returned + // Avoid memory leaks with unique_ptr + auto groomedJets = std::make_unique(); + auto auxCont = std::make_unique(); + groomedJets->setStore(auxCont.get()); - SG::ReadHandle inputPseudoJets(m_inputPseudoJetsKey); + // ----------------------- + // Build a new pointer to a PseudoJetVector containing the final groomed PseudoJets + // This allows us to own the vector of PseudoJet which we will put in the evt store. + // Thus the contained PseudoJet will be kept frozen there and we can safely use pointer to them from the xAOD::Jet objects + auto groomPJVector = std::make_unique( ); + groomPJVector->resize( jetContHandle->size() ); + + // loop over input jets + for (const xAOD::Jet* parentJet: *jetContHandle){ + // Child will create a groomed jet and insert it into the output container + this->insertGroomedJet(*parentJet, *pjContHandle, *groomedJets, *groomPJVector); + } - for (const xAOD::Jet* jet : *inputJets){ - m_groomer->groom(*jet, *inputPseudoJets, *outjets); + // ------------------------------------- + // record final PseudoJetVector + SG::WriteHandle pjVectorHandle(m_finalPseudoJets); + if(!pjVectorHandle.record(std::move(groomPJVector))){ + ATH_MSG_ERROR("Can't record PseudoJetVector under key "<< m_finalPseudoJets); + return nullreturn; } - return std::make_pair(std::move(outjets),std::move(outaux)); + return std::make_pair(std::move(groomedJets),std::move(auxCont)); } diff --git a/Reconstruction/Jet/JetRec/Root/JetTrimmer.cxx b/Reconstruction/Jet/JetRec/Root/JetTrimmer.cxx index 507e04ecf79..5c52857d1e8 100644 --- a/Reconstruction/Jet/JetRec/Root/JetTrimmer.cxx +++ b/Reconstruction/Jet/JetRec/Root/JetTrimmer.cxx @@ -73,8 +73,8 @@ int JetTrimmer::groom(const xAOD::Jet& jin, // Add jet to collection. xAOD::Jet* pjet = m_bld->add(pjtrim, pjContainer, jets, &jin); pjet->setAttribute("TransformType", xAOD::JetTransform::Trim); - pjet->setAttribute("RClus", m_rclus); - pjet->setAttribute("PtFrac", m_ptfrac); + pjet->setAttribute("RClus", float(m_rclus)); + pjet->setAttribute("PtFrac", float(m_ptfrac)); pjet->setAttribute("NTrimSubjets", nptrim); ATH_MSG_DEBUG("Properties after trimming:"); ATH_MSG_DEBUG(" ncon: " << pjtrim.constituents().size() << "/" diff --git a/Reconstruction/Jet/JetRec/Root/PseudoJetTranslator.cxx b/Reconstruction/Jet/JetRec/Root/PseudoJetTranslator.cxx index c194e9044ad..d5ae49d2096 100644 --- a/Reconstruction/Jet/JetRec/Root/PseudoJetTranslator.cxx +++ b/Reconstruction/Jet/JetRec/Root/PseudoJetTranslator.cxx @@ -4,53 +4,54 @@ #include "JetRec/PseudoJetTranslator.h" -xAOD::Jet* PseudoJetTranslator::translate(const fastjet::PseudoJet& pj, +xAOD::Jet& PseudoJetTranslator::translate(const fastjet::PseudoJet& pj, const PseudoJetContainer& pjCont, xAOD::JetContainer& jetCont) const { - xAOD::Jet* jet = new xAOD::Jet(); - jetCont.push_back(jet); - jet->setJetP4( xAOD::JetFourMom_t( pj.pt(), pj.eta(), pj.phi(), pj.m() ) ); + // Create a new jet in place at the end of the container + jetCont.emplace_back(new xAOD::Jet()); + xAOD::Jet& jet = *jetCont.back(); + jet.setJetP4( xAOD::JetFourMom_t( pj.pt(), pj.eta(), pj.phi(), pj.m() ) ); - static SG::AuxElement::Accessor pjAccessor("PseudoJet"); - pjAccessor(*jet) = &pj; + const static SG::AuxElement::Accessor pjAccessor("PseudoJet"); + pjAccessor(jet) = &pj; // Record the jet-finding momentum, i.e. the one used to find/groom the jet. - jet->setJetP4(xAOD::JetConstitScaleMomentum, jet->jetP4()); + jet.setJetP4(xAOD::JetConstitScaleMomentum, jet.jetP4()); // save area if needed --------- if( pj.has_area() ){ - if(m_saveArea) jet->setAttribute(xAOD::JetAttribute::ActiveArea,pj.area()); + if(m_saveArea) jet.setAttribute(xAOD::JetAttribute::ActiveArea,pj.area()); if(m_saveArea4Vec){ fastjet::PseudoJet pja = pj.area_4vector(); xAOD::JetFourMom_t fvarea(pja.pt(), pja.eta(), pja.phi(), pja.m()); - jet->setAttribute(xAOD::JetAttribute::ActiveArea4vec, fvarea); + jet.setAttribute(xAOD::JetAttribute::ActiveArea4vec, fvarea); } }// area ------------- - pjCont.extractConstituents(*jet, pj); + pjCont.extractConstituents(jet, pj); return jet; } -xAOD::Jet* PseudoJetTranslator::translate(const fastjet::PseudoJet& pj, +xAOD::Jet& PseudoJetTranslator::translate(const fastjet::PseudoJet& pj, const PseudoJetContainer& pjCont, xAOD::JetContainer& jetCont, const xAOD::Jet &parent ) const { - xAOD::Jet * jet = translate(pj, pjCont, jetCont); + xAOD::Jet& jet = translate(pj, pjCont, jetCont); const xAOD::JetContainer* parentCont = dynamic_cast(parent.container()); if ( parentCont == 0 ) { return jet ;} // can this happen? if so THIS IS an ERROR ! should do something ElementLink el(*parentCont, parent.index()); - jet->setAttribute("Parent", el); + jet.setAttribute("Parent", el); - jet->setInputType(parent.getInputType()); - jet->setAlgorithmType(parent.getAlgorithmType()); - jet->setSizeParameter(parent.getSizeParameter()); - jet->setConstituentsSignalState(parent.getConstituentsSignalState()); - jet->setAttribute(xAOD::JetAttribute::JetGhostArea, parent.getAttribute(xAOD::JetAttribute::JetGhostArea)); + jet.setInputType(parent.getInputType()); + jet.setAlgorithmType(parent.getAlgorithmType()); + jet.setSizeParameter(parent.getSizeParameter()); + jet.setConstituentsSignalState(parent.getConstituentsSignalState()); + jet.setAttribute(xAOD::JetAttribute::JetGhostArea, parent.getAttribute(xAOD::JetAttribute::JetGhostArea)); return jet; } diff --git a/Reconstruction/Jet/JetRec/share/JetRecAlgTestCfg.py b/Reconstruction/Jet/JetRec/share/JetRecAlgTestCfg.py index ccf56adce35..2d0612094b8 100755 --- a/Reconstruction/Jet/JetRec/share/JetRecAlgTestCfg.py +++ b/Reconstruction/Jet/JetRec/share/JetRecAlgTestCfg.py @@ -163,17 +163,16 @@ def JetGroomAlgCfg(ConfigFlags,buildjetsname,groomjetsname): groomcfg.addSequence( CompFactory.AthSequencer(sequencename) ) # Create the JetGroomer, provide it with a JetTrimmer - jgroom = CompFactory.JetGroomer("groomer") - jgroom.Groomer = CompFactory.JetTrimmer("trimSmallR2Frac5",RClus=0.2,PtFrac=0.05,JetBuilder=CompFactory.JetFromPseudojet()) - jgroom.UngroomedJets = buildjetsname - jgroom.ParentPseudoJets = "PseudoJetMerged_"+buildjetsname + jtrim = CompFactory.JetTrimming("trimSmallR2Frac5",RClus=0.2,PtFrac=0.05) + jtrim.UngroomedJets = buildjetsname + jtrim.ParentPseudoJets = "PseudoJetMerged_"+buildjetsname # Create the JetRecAlg, configure it to use the builder # using constructor syntax instead # (equivalent to setting properties with "=") jra = CompFactory.JetRecAlg( - "JRA_groom", - Provider = jgroom, # Single ToolHandle + "JRA_trim", + Provider = jtrim, # Single ToolHandle Modifiers = [], # ToolHandleArray OutputContainer = groomjetsname) diff --git a/Reconstruction/Jet/JetRec/src/JetTrimming.cxx b/Reconstruction/Jet/JetRec/src/JetTrimming.cxx index 353de103e94..56030808d8c 100644 --- a/Reconstruction/Jet/JetRec/src/JetTrimming.cxx +++ b/Reconstruction/Jet/JetRec/src/JetTrimming.cxx @@ -7,123 +7,76 @@ #include "fastjet/PseudoJet.hh" #include "fastjet/JetDefinition.hh" #include "fastjet/Selector.hh" -#include "fastjet/tools/Filter.hh" #include "JetEDM/PseudoJetVector.h" #include "JetRec/PseudoJetTranslator.h" -using fastjet::PseudoJet; -using xAOD::JetContainer; - - + // tool implementing the operations to convert fastjet::PseudoJet -> xAOD::Jet +const static PseudoJetTranslator s_pjTranslator(false, false); // false => do not save jet areas //********************************************************************** StatusCode JetTrimming::initialize() { + ATH_CHECK( JetGroomer::initialize() ); + + // Unfortunately not possible to do this because there is no + // declareProperty overload for CheckedProperty in AsgTool + // + // Enforce upper/lower limits of Gaudi::Properties + // m_rclus.verifier().setBounds(0.,10.); + // m_ptfrac.verifier().setBounds(0.,1.); if ( m_rclus < 0.0 || m_rclus > 10.0 ) { - ATH_MSG_ERROR("Invalid value for RClus " << m_rclus); + ATH_MSG_ERROR("Invalid value " << m_rclus << "for RClus. Allowable range is 0-10"); return StatusCode::FAILURE; } if ( m_ptfrac < 0.0 || m_ptfrac > 1.0 ) { - ATH_MSG_ERROR("Invalid value for PtFrac " << m_ptfrac); + ATH_MSG_ERROR("Invalid value " << m_ptfrac << "for PtFrac. Allowable range is 0-1"); return StatusCode::FAILURE; } - - ATH_CHECK( m_inputPseudoJets.initialize() ); - ATH_CHECK( m_inputJetContainer.initialize() ); + + // Define the trimmer + m_trimmer = std::make_unique(fastjet::JetDefinition(fastjet::kt_algorithm, m_rclus), + fastjet::SelectorPtFractionMin(m_ptfrac)); ATH_MSG_INFO(" Recluster R: " << m_rclus); ATH_MSG_INFO(" pT faction min: " << m_ptfrac); + return StatusCode::SUCCESS; } //********************************************************************** -std::pair, std::unique_ptr > JetTrimming::getJets() const { - // Return this in case of any problems - auto nullreturn = std::make_pair(std::unique_ptr(nullptr), std::unique_ptr(nullptr)); - - // ----------------------- - // retrieve input - SG::ReadHandle jetContHandle(m_inputJetContainer); - if(!jetContHandle.isValid()) { - ATH_MSG_ERROR("No valid JetContainer with key "<< m_inputJetContainer.key()); - return nullreturn; - } - SG::ReadHandle pjContHandle(m_inputPseudoJets); - if(!pjContHandle.isValid()) { - ATH_MSG_ERROR("No valid PseudoJetContainer with key "<< m_inputPseudoJets.key()); - return nullreturn; - } +void JetTrimming::insertGroomedJet(const xAOD::Jet& parentjet, const PseudoJetContainer& inpjcont, xAOD::JetContainer& outcont, PseudoJetVector& trimpjvec) const { - // Build the container to be returned - // Avoid memory leaks with unique_ptr - auto trimmedJets = std::make_unique(); - auto auxCont = std::make_unique(); - trimmedJets->setStore(auxCont.get()); + const static SG::AuxElement::Accessor s_pjAcc("PseudoJet"); + const static SG::AuxElement::ConstAccessor s_pjConstAcc("PseudoJet"); + // retrieve the PseudoJet from the parent : + const fastjet::PseudoJet& parentPJ = *s_pjConstAcc(parentjet); - // The trimmer - fastjet::Filter trimmer(fastjet::JetDefinition(fastjet::kt_algorithm, m_rclus), - fastjet::SelectorPtFractionMin(m_ptfrac)); + // Trim : + fastjet::PseudoJet trimmedPJ = m_trimmer->result(parentPJ) ; + ATH_MSG_VERBOSE(" Input cluster sequence: " << parentPJ.associated_cluster_sequence()); + ATH_MSG_VERBOSE(" Trimmed cluster sequence: " << trimmedPJ.associated_cluster_sequence()); - // tool implementing the operations to convert fastjet::PseudoJet -> xAOD::Jet - PseudoJetTranslator pjTranslator(false, false); // false => do not save jet areas - - // ----------------------- - // Build a new pointer to a PseudoJetVector containing the final trimmed PseudoJets - // This allows us to own the vector of PseudoJet which we will put in the evt store. - // Thus the contained PseudoJet will be kept frozen there and we can safely use pointer to them from the xAOD::Jet objects - auto trimPJVector = std::make_unique( ); - trimPJVector->resize( jetContHandle->size() ); - // Accessors to retrieve and set the pointers to PseudoJet - static SG::AuxElement::ConstAccessor pjConstAcc("PseudoJet"); - static SG::AuxElement::Accessor pjAcc("PseudoJet"); - - - // loop over input jets - int count = 0; - for (const xAOD::Jet* parentJet: *jetContHandle){ - // retrieve the PseudoJet from the parent : - const PseudoJet * parentPJ = pjConstAcc(*parentJet); - - // Trim : - PseudoJet trimmedPJ = trimmer(*parentPJ) ; - (*trimPJVector)[count] = trimmedPJ; // save a *copy* of this trimmed PJ - - ATH_MSG_VERBOSE(" Input cluster sequence: " << parentPJ->associated_cluster_sequence()); - ATH_MSG_VERBOSE(" Trimmed cluster sequence: " << trimmedPJ.associated_cluster_sequence()); + // build the xAOD::Jet from the PseudoJet, and put it in the container + xAOD::Jet& jet = s_pjTranslator.translate(trimmedPJ, inpjcont, outcont, parentjet); + // The vector is resized externally to match the jet container size, + // so just fill the corresponding entry + trimpjvec[jet.index()] = trimmedPJ; // save a *copy* of this trimmed PJ - // build the xAOD::Jet from the PseudoJet, and put it in the container - xAOD::Jet* jet = pjTranslator.translate(trimmedPJ, *pjContHandle, *trimmedJets, *parentJet); - - // decorate with the pointer to the PJ we keep in the evt store. - pjAcc(*jet) = & (*trimPJVector)[count] ; + // decorate with the pointer to the PJ we keep in the evt store. + s_pjAcc(jet) = & trimpjvec[jet.index()]; - int nptrim = trimmedPJ.pieces().size(); - jet->setAttribute(xAOD::JetAttribute::TransformType, xAOD::JetTransform::Trim); - jet->setAttribute(xAOD::JetAttribute::RClus, m_rclus); - jet->setAttribute(xAOD::JetAttribute::PtFrac, m_ptfrac); - jet->setAttribute(xAOD::JetAttribute::NTrimSubjets, nptrim); - ATH_MSG_DEBUG("Properties after trimming:"); - ATH_MSG_DEBUG(" ncon: " << trimmedPJ.constituents().size() << "/" - << parentPJ->constituents().size()); - ATH_MSG_DEBUG(" nsub: " << nptrim); - count++; - } - - // ------------------------------------- - // record final PseudoJetVector - SG::WriteHandle pjVectorHandle(m_finalPseudoJets); - if(!pjVectorHandle.record(std::move(trimPJVector))){ - ATH_MSG_ERROR("Can't record PseudoJetVector under key "<< m_finalPseudoJets); - return nullreturn; - } - - // Return the jet container and aux, use move to transfer - // ownership of pointers to caller - return std::make_pair(std::move(trimmedJets), std::move(auxCont)); - + int nptrim = trimmedPJ.pieces().size(); + jet.setAttribute(xAOD::JetAttribute::TransformType, xAOD::JetTransform::Trim); + jet.setAttribute(xAOD::JetAttribute::RClus, m_rclus); + jet.setAttribute(xAOD::JetAttribute::PtFrac, m_ptfrac); + jet.setAttribute(xAOD::JetAttribute::NTrimSubjets, nptrim); + ATH_MSG_VERBOSE("Properties after trimming:"); + ATH_MSG_VERBOSE(" ncon: " << trimmedPJ.constituents().size() << "/" + << parentPJ.constituents().size()); + ATH_MSG_VERBOSE(" nsub: " << nptrim); } diff --git a/Reconstruction/Jet/JetRec/src/JetTrimming.h b/Reconstruction/Jet/JetRec/src/JetTrimming.h index faa7d192ac1..4302969abe1 100644 --- a/Reconstruction/Jet/JetRec/src/JetTrimming.h +++ b/Reconstruction/Jet/JetRec/src/JetTrimming.h @@ -15,47 +15,35 @@ /// running the trimming procedure on each jet of the parent JetContainer the tool is acting on. /// Obviously the parent JetContainer must be present in the evt store, but also the input PseudoJetContainer from which it has been built. -#include "xAODEventInfo/EventInfo.h" -#include "StoreGate/ReadHandleKey.h" -#include "xAODJet/JetAuxContainer.h" +#include "fastjet/PseudoJet.hh" +#include "fastjet/tools/Filter.hh" -#include "JetInterface/IJetProvider.h" -#include "AsgTools/AsgTool.h" +#include "xAODJet/JetContainer.h" +#include "JetInterface/IJetProvider.h" +#include "JetRec/JetGroomer.h" #include "JetRec/PseudoJetContainer.h" - class JetTrimming -: public asg::AsgTool, - virtual public JetProvider { +: virtual public JetGroomer { ASG_TOOL_CLASS(JetTrimming, IJetProvider) public: - using asg::AsgTool::AsgTool; + using JetGroomer::JetGroomer; - StatusCode initialize() override; + StatusCode initialize() override final; - /// Return the final jets with their aux store. - /// Can return a pair of null pointers if an error occurs. - std::pair, std::unique_ptr > getJets() const override; + virtual void insertGroomedJet(const xAOD::Jet&, const PseudoJetContainer&, xAOD::JetContainer&, PseudoJetVector&) const override final; +private: -protected: + // The filter object that will apply the grooming + std::unique_ptr m_trimmer; - - /// Handle Input JetContainer (this contains the parent ungroomed jets to be trimmed) - SG::ReadHandleKey m_inputJetContainer {this, "InputJetContainer", "ungroomedinput", "Input ungroomed jet container"}; - - /// This is the input to the parent JetContainer. It is needed in order to re-assign the ghost constituents from the final trimmed PJ to the xAOD::Jet - SG::ReadHandleKey m_inputPseudoJets {this, "InputPseudoJets", "inputpseudojet", "input constituents of parent JetContainer"}; - - // Job options. Gaudi::Property m_rclus {this, "RClus", 0.3 , "R for reclustering (0 for none)"}; Gaudi::Property m_ptfrac {this, "PtFrac", 0.03, "pT fraction for retaining subjets"}; - Gaudi::Property m_finalPseudoJets {this, "TrimmedOutputPseudoJets", "undef", "Key to save the final trimmed pj. Necessary in order to ensure a valid PJ can be linked from xAOD::Jet"}; - }; diff --git a/Reconstruction/Jet/JetRec/src/components/JetRec_entries.cxx b/Reconstruction/Jet/JetRec/src/components/JetRec_entries.cxx index 87ea18b902c..bc1988eef27 100644 --- a/Reconstruction/Jet/JetRec/src/components/JetRec_entries.cxx +++ b/Reconstruction/Jet/JetRec/src/components/JetRec_entries.cxx @@ -27,7 +27,6 @@ #include "JetRec/JetConstitRemover.h" #include "JetRec/JetClusterer.h" #include "JetRec/JetCopier.h" -#include "JetRec/JetGroomer.h" DECLARE_COMPONENT( JetToolRunner ) DECLARE_COMPONENT( JetRecTool ) @@ -48,7 +47,6 @@ DECLARE_COMPONENT( JetPseudojetCopier ) DECLARE_COMPONENT( JetConstitRemover ) DECLARE_COMPONENT( JetClusterer ) DECLARE_COMPONENT( JetCopier ) -DECLARE_COMPONENT( JetGroomer ) DECLARE_COMPONENT( PseudoJetMerger ) DECLARE_COMPONENT( JetAlgorithm ) -- GitLab