diff --git a/Calorimeter/CaloCalibHitRec/src/CaloCalibClusterMomentsMaker.cxx b/Calorimeter/CaloCalibHitRec/src/CaloCalibClusterMomentsMaker.cxx index 85a7010df259a72bc52466391aaa1cbb93007a2e..1ff361ca0ece246e6444f32fbe5aa000d81b2763 100644 --- a/Calorimeter/CaloCalibHitRec/src/CaloCalibClusterMomentsMaker.cxx +++ b/Calorimeter/CaloCalibHitRec/src/CaloCalibClusterMomentsMaker.cxx @@ -429,18 +429,19 @@ CaloCalibClusterMomentsMaker::execute(const EventContext& ctx, jphi += 2*m_n_phi_out; if ( jphi >= m_n_phi_out ) jphi -= 2*m_n_phi_out; - unsigned int iBin; unsigned int iEtaBin(jeta); if ( jeta < 0 ) iEtaBin = abs(jeta)-1; - for (iBin=0;iBin<m_i_phi_eta[ii][iEtaBin].size();iBin++) { - int jp = m_i_phi_eta[ii][iEtaBin][iBin].iPhi+jphi; + const std::vector<CalibHitIPhiIEtaRange>& bins + = m_i_phi_eta[ii][iEtaBin]; + for (const CalibHitIPhiIEtaRange& range : bins) { + int jp = range.iPhi+jphi; if ( jp < -m_n_phi_out ) jp += 2*m_n_phi_out; if ( jp >= m_n_phi_out ) jp -= 2*m_n_phi_out; - int jEtaMin = iEtaSign<0?-m_i_phi_eta[ii][iEtaBin][iBin].iEtaMax-1:m_i_phi_eta[ii][iEtaBin][iBin].iEtaMin; - int jEtaMax = iEtaSign<0?-m_i_phi_eta[ii][iEtaBin][iBin].iEtaMin-1:m_i_phi_eta[ii][iEtaBin][iBin].iEtaMax; + int jEtaMin = iEtaSign<0?-range.iEtaMax-1:range.iEtaMin; + int jEtaMax = iEtaSign<0?-range.iEtaMin-1:range.iEtaMax; for( int je = jEtaMin;je<=jEtaMax;je++ ) { if(ii == 0 ) clusListL[(jp+m_n_phi_out)*(2*m_n_eta_out+1)+je+m_n_eta_out].push_back(iClus); else if(ii == 1 ) clusListM[(jp+m_n_phi_out)*(2*m_n_eta_out+1)+je+m_n_eta_out].push_back(iClus); diff --git a/Calorimeter/CaloCalibHitRec/src/CaloCalibClusterMomentsMaker2.cxx b/Calorimeter/CaloCalibHitRec/src/CaloCalibClusterMomentsMaker2.cxx index eb9ce78bae2b9149529c98f0fccc7d9ae55a9fad..066caa2664c79640ffe1f230df92490175f90c13 100644 --- a/Calorimeter/CaloCalibHitRec/src/CaloCalibClusterMomentsMaker2.cxx +++ b/Calorimeter/CaloCalibHitRec/src/CaloCalibClusterMomentsMaker2.cxx @@ -442,15 +442,16 @@ CaloCalibClusterMomentsMaker2::execute(const EventContext& ctx, if ( jeta >= -m_n_eta_out && jeta < m_n_eta_out ) { if ( jphi < -m_n_phi_out ) jphi += 2*m_n_phi_out; if ( jphi >= m_n_phi_out ) jphi -= 2*m_n_phi_out; - unsigned int iBin; unsigned int iEtaBin(jeta); if ( jeta < 0 ) iEtaBin = abs(jeta)-1; - for (iBin=0;iBin<m_i_phi_eta[ii][iEtaBin].size();iBin++) { - int jp = m_i_phi_eta[ii][iEtaBin][iBin].iPhi+jphi; + const std::vector<CalibHitIPhiIEtaRange>& bins + = m_i_phi_eta[ii][iEtaBin]; + for (const CalibHitIPhiIEtaRange& range : bins) { + int jp = range.iPhi+jphi; if ( jp < -m_n_phi_out ) jp += 2*m_n_phi_out; if ( jp >= m_n_phi_out ) jp -= 2*m_n_phi_out; - int jEtaMin = iEtaSign<0?-m_i_phi_eta[ii][iEtaBin][iBin].iEtaMax-1:m_i_phi_eta[ii][iEtaBin][iBin].iEtaMin; - int jEtaMax = iEtaSign<0?-m_i_phi_eta[ii][iEtaBin][iBin].iEtaMin-1:m_i_phi_eta[ii][iEtaBin][iBin].iEtaMax; + int jEtaMin = iEtaSign<0?-range.iEtaMax-1:range.iEtaMin; + int jEtaMax = iEtaSign<0?-range.iEtaMin-1:range.iEtaMax; for( int je = jEtaMin;je<=jEtaMax;je++ ) { if(ii == 0 ) clusListL[(jp+m_n_phi_out)*(2*m_n_eta_out+1)+je+m_n_eta_out].push_back(iClus); else if(ii == 1 ) clusListM[(jp+m_n_phi_out)*(2*m_n_eta_out+1)+je+m_n_eta_out].push_back(iClus); diff --git a/Calorimeter/CaloTrackingGeometry/CaloTrackingGeometry/CaloSurfaceBuilder.h b/Calorimeter/CaloTrackingGeometry/CaloTrackingGeometry/CaloSurfaceBuilder.h index 0657003fe31b472415f62a2e3f4f2fe37e726908..bf7375fbb249138213b76c525d3446ace61562e0 100755 --- a/Calorimeter/CaloTrackingGeometry/CaloTrackingGeometry/CaloSurfaceBuilder.h +++ b/Calorimeter/CaloTrackingGeometry/CaloTrackingGeometry/CaloSurfaceBuilder.h @@ -145,21 +145,6 @@ public: std::vector<double>& rmin, std::vector<double>& rmax) const override final; - virtual std::vector<const Trk::Surface*> allSampleSurfaces() - const override final; - virtual std::vector<const Trk::Surface*> allTileBarSurfaces() - const override final; - virtual std::vector<const Trk::Surface*> allTileExtSurfaces() - const override final; - virtual std::vector<const Trk::Surface*> allTileGapSurfaces() - const override final; - virtual std::vector<const Trk::Surface*> allEMBSurfaces() - const override final; - virtual std::vector<const Trk::Surface*> allEMESurfaces() - const override final; - virtual std::vector<const Trk::Surface*> allHECSurfaces() - const override final; - virtual std::vector<std::pair<const Trk::Surface*, const Trk::Surface*>> entrySurfaces() const override final; virtual std::vector<std::pair<const Trk::Surface*, const Trk::Surface*>> diff --git a/Calorimeter/CaloTrackingGeometry/CaloTrackingGeometry/ICaloSurfaceBuilder.h b/Calorimeter/CaloTrackingGeometry/CaloTrackingGeometry/ICaloSurfaceBuilder.h index 1bb1944bacd35a6e879036ab4016cff40d4da7f2..212b87b7e7bef62441ded2ef26c9cb93f02abde6 100755 --- a/Calorimeter/CaloTrackingGeometry/CaloTrackingGeometry/ICaloSurfaceBuilder.h +++ b/Calorimeter/CaloTrackingGeometry/CaloTrackingGeometry/ICaloSurfaceBuilder.h @@ -126,14 +126,6 @@ public: std::vector<double>& rmin, std::vector<double>& rmax) const = 0; - virtual std::vector<const Trk::Surface*> allSampleSurfaces() const = 0; - virtual std::vector<const Trk::Surface*> allTileBarSurfaces() const = 0; - virtual std::vector<const Trk::Surface*> allTileExtSurfaces() const = 0; - virtual std::vector<const Trk::Surface*> allTileGapSurfaces() const = 0; - virtual std::vector<const Trk::Surface*> allEMBSurfaces() const = 0; - virtual std::vector<const Trk::Surface*> allEMESurfaces() const = 0; - virtual std::vector<const Trk::Surface*> allHECSurfaces() const = 0; - virtual std::vector<std::pair<const Trk::Surface*, const Trk::Surface*>> entrySurfaces() const = 0; virtual std::vector<std::pair<const Trk::Surface*, const Trk::Surface*>> diff --git a/Calorimeter/CaloTrackingGeometry/src/CaloSurfaceBuilder.cxx b/Calorimeter/CaloTrackingGeometry/src/CaloSurfaceBuilder.cxx index 74e0ebf0fd8672a1b9e68abb0519aab111f84597..99ba5edface03095a7e6331bc672aeace3e205f4 100755 --- a/Calorimeter/CaloTrackingGeometry/src/CaloSurfaceBuilder.cxx +++ b/Calorimeter/CaloTrackingGeometry/src/CaloSurfaceBuilder.cxx @@ -8,94 +8,89 @@ #include "CaloTrackingGeometry/CaloSurfaceBuilder.h" -#include "GaudiKernel/Bootstrap.h" -#include "GaudiKernel/MsgStream.h" #include "Gaudi/Property.h" +#include "GaudiKernel/Bootstrap.h" +#include "GaudiKernel/IMessageSvc.h" #include "GaudiKernel/IService.h" -#include "GaudiKernel/IToolSvc.h" #include "GaudiKernel/ISvcLocator.h" -#include "GaudiKernel/IMessageSvc.h" +#include "GaudiKernel/IToolSvc.h" +#include "GaudiKernel/MsgStream.h" #include "GaudiKernel/SystemOfUnits.h" - - -#include "TrkSurfaces/CylinderSurface.h" #include "TrkGeometry/CylinderLayer.h" #include "TrkSurfaces/CylinderBounds.h" +#include "TrkSurfaces/CylinderSurface.h" -#include "TrkSurfaces/DiscSurface.h" #include "TrkGeometry/DiscLayer.h" #include "TrkSurfaces/DiscBounds.h" +#include "TrkSurfaces/DiscSurface.h" -#include "TrkGeometry/MaterialProperties.h" #include "TrkGeometry/HomogeneousLayerMaterial.h" +#include "TrkGeometry/MaterialProperties.h" // Amg #include "GeoPrimitives/GeoPrimitives.h" // Calo specific stuff : +#include "CaloDetDescr/CaloDetDescrElement.h" #include "CaloDetDescr/CaloDetDescrManager.h" #include "CaloDetDescr/CaloDetDescriptor.h" -#include "CaloDetDescr/CaloDetDescrElement.h" #include "CaloDetDescr/ICaloCoordinateTool.h" #include "CaloDetDescr/ICaloRecoMaterialTool.h" #include "CaloDetDescr/ICaloRecoSimpleGeomTool.h" // Tile specific stuff : +#include "CaloIdentifier/TileID.h" #include "TileDetDescr/TileDetDescrManager.h" #include "TileDetDescr/TileDetDescriptor.h" -#include "CaloIdentifier/TileID.h" #include "TrkDetDescrInterfaces/ITrackingVolumeBuilder.h" -#include "TrkVolumes/CylinderVolumeBounds.h" #include "TrkGeometry/TrackingVolume.h" #include "TrkGeometrySurfaces/SlidingCylinderSurface.h" #include "TrkGeometrySurfaces/SlidingDiscSurface.h" +#include "TrkVolumes/CylinderVolumeBounds.h" - -#include <cmath> #include <algorithm> //for std::min, std::max - +#include <cmath> CaloSurfaceBuilder::CaloSurfaceBuilder(const std::string& type, - const std::string& name, - const IInterface* parent) : - AthAlgTool(type, name, parent), - m_tile_dd(nullptr), - m_lar_mat("LArRecoMaterialTool"), - m_lar_simplegeom("LArRecoSimpleGeomTool") + const std::string& name, + const IInterface* parent) + : AthAlgTool(type, name, parent) + , m_tile_dd(nullptr) + , m_lar_mat("LArRecoMaterialTool") + , m_lar_simplegeom("LArRecoSimpleGeomTool") { - declareInterface<ICaloSurfaceBuilder>( this ); - declareProperty ("LArRecoMaterialTool", m_lar_mat); - declareProperty ("LarRecoSimpleGeometryTool", m_lar_simplegeom); + declareInterface<ICaloSurfaceBuilder>(this); + declareProperty("LArRecoMaterialTool", m_lar_mat); + declareProperty("LarRecoSimpleGeometryTool", m_lar_simplegeom); } -CaloSurfaceBuilder::~CaloSurfaceBuilder() -{} +CaloSurfaceBuilder::~CaloSurfaceBuilder() {} StatusCode CaloSurfaceBuilder::initialize() { - if (m_lar_mat.retrieve().isFailure()){ - ATH_MSG_FATAL("Failed to retrieve "<< m_lar_mat << ". Aborting."); - return StatusCode::FAILURE; + if (m_lar_mat.retrieve().isFailure()) { + ATH_MSG_FATAL("Failed to retrieve " << m_lar_mat << ". Aborting."); + return StatusCode::FAILURE; } else - ATH_MSG_DEBUG("Sucessfully retrieved "<< m_lar_mat << "."); + ATH_MSG_DEBUG("Sucessfully retrieved " << m_lar_mat << "."); - if (m_lar_simplegeom.retrieve().isFailure()){ - ATH_MSG_FATAL("Failed to retrieve "<< m_lar_simplegeom << ". Aborting."); - return StatusCode::FAILURE; + if (m_lar_simplegeom.retrieve().isFailure()) { + ATH_MSG_FATAL("Failed to retrieve " << m_lar_simplegeom << ". Aborting."); + return StatusCode::FAILURE; } else - ATH_MSG_DEBUG("Sucessfully retrieved "<< m_lar_simplegeom << "."); + ATH_MSG_DEBUG("Sucessfully retrieved " << m_lar_simplegeom << "."); - if (m_calodepth.retrieve().isFailure()){ - ATH_MSG_FATAL("Failed to retrieve "<< m_calodepth << ". Aborting."); - return StatusCode::FAILURE; + if (m_calodepth.retrieve().isFailure()) { + ATH_MSG_FATAL("Failed to retrieve " << m_calodepth << ". Aborting."); + return StatusCode::FAILURE; } else - ATH_MSG_DEBUG("Sucessfully retrieved "<< m_calodepth << "."); + ATH_MSG_DEBUG("Sucessfully retrieved " << m_calodepth << "."); - if (detStore()->retrieve(m_tile_dd).isFailure()){ - ATH_MSG_FATAL("Could not find TileDetDescrManager in DetStore" ); + if (detStore()->retrieve(m_tile_dd).isFailure()) { + ATH_MSG_FATAL("Could not find TileDetDescrManager in DetStore"); return StatusCode::FAILURE; } @@ -106,12 +101,12 @@ StatusCode CaloSurfaceBuilder::finalize() { // clear surface cash - for (unsigned int i=0; i<m_layerEntries.size(); i++) { + for (unsigned int i = 0; i < m_layerEntries.size(); i++) { delete m_layerEntries[i].first; delete m_layerEntries[i].second; } - if ( !m_layerExits.empty() ) { + if (!m_layerExits.empty()) { delete m_layerExits[CaloCell_ID::TileBar2].first; delete m_layerExits[CaloCell_ID::TileBar2].second; delete m_layerExits[CaloCell_ID::TileExt2].first; @@ -123,13 +118,14 @@ CaloSurfaceBuilder::finalize() delete m_layerExits[CaloCell_ID::HEC3].first; delete m_layerExits[CaloCell_ID::HEC3].second; } - + StatusCode sc = StatusCode::SUCCESS; return sc; } Trk::Surface* -CaloSurfaceBuilder:: CreateDDSurface (const CaloCell_ID::CaloSample sample, const int side) const +CaloSurfaceBuilder::CreateDDSurface(const CaloCell_ID::CaloSample sample, + const int side) const { // NB: the Transform3D created here belong to the surface, // and will be deleted by it @@ -142,47 +138,49 @@ CaloSurfaceBuilder:: CreateDDSurface (const CaloCell_ID::CaloSample sample, con double radius = 0.; double hphi = 0.; double hlen = 0.; - double z =0.; - double depth =0.; + double z = 0.; + double depth = 0.; - // too bad, I need this ugly if to decide which type of surface should be built - // cylinder of disk ? + // too bad, I need this ugly if to decide which type of surface should be + // built cylinder of disk ? bool barrel = true; - if ( sample == CaloCell_ID::PreSamplerE || sample == CaloCell_ID::EME1 || - sample == CaloCell_ID::EME2 || sample == CaloCell_ID::EME3 || - sample == CaloCell_ID::HEC0 || sample == CaloCell_ID::HEC1 || - sample == CaloCell_ID::HEC2 || sample == CaloCell_ID::HEC3 || - sample == CaloCell_ID::FCAL0 || sample == CaloCell_ID::FCAL1 || sample == CaloCell_ID::FCAL2 ) + if (sample == CaloCell_ID::PreSamplerE || sample == CaloCell_ID::EME1 || + sample == CaloCell_ID::EME2 || sample == CaloCell_ID::EME3 || + sample == CaloCell_ID::HEC0 || sample == CaloCell_ID::HEC1 || + sample == CaloCell_ID::HEC2 || sample == CaloCell_ID::HEC3 || + sample == CaloCell_ID::FCAL0 || sample == CaloCell_ID::FCAL1 || + sample == CaloCell_ID::FCAL2) barrel = false; - if ( barrel ) { - result = this->get_cylinder_surface (sample,side, pos.get(), radius, hphi, hlen, depth, nullptr); - if (!result){ + if (barrel) { + result = this->get_cylinder_surface( + sample, side, pos.get(), radius, hphi, hlen, depth, nullptr); + if (!result) { return nullptr; } - ATH_MSG_VERBOSE("got -flat- cylinder for Sample " << (int) sample << " radius, hlen are " << radius - << " " << hlen ); - if ( hphi < 0.9*M_PI){ - surf = new Trk::CylinderSurface(*pos,radius,hphi,hlen); + ATH_MSG_VERBOSE("got -flat- cylinder for Sample " + << (int)sample << " radius, hlen are " << radius << " " + << hlen); + if (hphi < 0.9 * M_PI) { + surf = new Trk::CylinderSurface(*pos, radius, hphi, hlen); + } else { + surf = new Trk::CylinderSurface(*pos, radius, hlen); } - else{ - surf = new Trk::CylinderSurface(*pos,radius,hlen); - } - } - else { - bool result = this->get_disk_surface (sample,side,pos.get(),z,rmin, rmax, hphi, depth, nullptr); - if (!result){ + } else { + bool result = this->get_disk_surface( + sample, side, pos.get(), z, rmin, rmax, hphi, depth, nullptr); + if (!result) { return nullptr; } - ATH_MSG_VERBOSE(" got -flat- disk for Sample " << (int) sample << " rmin rmax = " << rmin - << " " << rmax << " z = " << pos->translation().z()); + ATH_MSG_VERBOSE(" got -flat- disk for Sample " + << (int)sample << " rmin rmax = " << rmin << " " << rmax + << " z = " << pos->translation().z()); // for Atlas configuration, avoid to create a hole a phi ~ pi by hphi // rounding effects. the phi range was introduced for the testbeam - if ( hphi < 0.9*M_PI){ - surf = new Trk::DiscSurface(*pos,rmin,rmax,hphi); - } - else{ - surf = new Trk::DiscSurface(*pos,rmin,rmax); + if (hphi < 0.9 * M_PI) { + surf = new Trk::DiscSurface(*pos, rmin, rmax, hphi); + } else { + surf = new Trk::DiscSurface(*pos, rmin, rmax); } } @@ -196,7 +194,8 @@ CaloSurfaceBuilder::CreateUserSurface(const CaloCell_ID::CaloSample sample, const CaloDetDescrManager* calo_dd) const { - if (sample == CaloCell_ID::Unknown) return nullptr; + if (sample == CaloCell_ID::Unknown) + return nullptr; // See ATLASRECTS-5012 // Here we prb want to move to conditions data @@ -210,100 +209,113 @@ CaloSurfaceBuilder::CreateUserSurface(const CaloCell_ID::CaloSample sample, // NB: the Transform3D created here belong to the surface, // and will be deleted by it auto pos = std::make_unique<Amg::Transform3D>(Trk::s_idTransform); - Trk::Surface* surf =nullptr; + Trk::Surface* surf = nullptr; bool result = false; double rmin = 0.; - double z=0.; + double z = 0.; double rmax = 0.; double radius = 0.; double hphi = 0.; double hlen = 0.; - double depth =0.; + double depth = 0.; int side = 1; bool tile = false; - if ( sample == CaloCell_ID::TileBar0 || sample == CaloCell_ID::TileBar1 || sample == CaloCell_ID::TileBar2 || - sample == CaloCell_ID::TileExt0 || sample == CaloCell_ID::TileExt1 || sample == CaloCell_ID::TileExt2 || - sample == CaloCell_ID::TileGap1 || sample == CaloCell_ID::TileGap2 || sample == CaloCell_ID::TileGap3 ) + if (sample == CaloCell_ID::TileBar0 || sample == CaloCell_ID::TileBar1 || + sample == CaloCell_ID::TileBar2 || sample == CaloCell_ID::TileExt0 || + sample == CaloCell_ID::TileExt1 || sample == CaloCell_ID::TileExt2 || + sample == CaloCell_ID::TileGap1 || sample == CaloCell_ID::TileGap2 || + sample == CaloCell_ID::TileGap3) tile = true; bool HEC3 = false; - if ( sample == CaloCell_ID::HEC3) + if (sample == CaloCell_ID::HEC3) HEC3 = true; - if (etaCaloLocal<0) side = -1; + if (etaCaloLocal < 0) + side = -1; - // Specific hack for the testbeam : even if tracks have eta<0, ask for the positive - // side - if ( calo_dd->lar_geometry() == "H8" ) side = 1; + // Specific hack for the testbeam : even if tracks have eta<0, ask for the + // positive side + if (calo_dd->lar_geometry() == "H8") + side = 1; - // too bad, I need this ugly if to decide which type of surface should be built - // cylinder of disk ? - //Note: TileGap3 is in the barrel but is a disk!! + // too bad, I need this ugly if to decide which type of surface should be + // built cylinder of disk ? + // Note: TileGap3 is in the barrel but is a disk!! bool barrel = true; - if ( sample == CaloCell_ID::PreSamplerE || sample == CaloCell_ID::EME1 || - sample == CaloCell_ID::EME2 || sample == CaloCell_ID::EME3 || - sample == CaloCell_ID::HEC0 || sample == CaloCell_ID::HEC1 || - sample == CaloCell_ID::HEC2 || sample == CaloCell_ID::HEC3 || - sample == CaloCell_ID::FCAL0 || sample == CaloCell_ID::FCAL1 || - sample == CaloCell_ID::FCAL2 || sample == CaloCell_ID::TileGap3 ) + if (sample == CaloCell_ID::PreSamplerE || sample == CaloCell_ID::EME1 || + sample == CaloCell_ID::EME2 || sample == CaloCell_ID::EME3 || + sample == CaloCell_ID::HEC0 || sample == CaloCell_ID::HEC1 || + sample == CaloCell_ID::HEC2 || sample == CaloCell_ID::HEC3 || + sample == CaloCell_ID::FCAL0 || sample == CaloCell_ID::FCAL1 || + sample == CaloCell_ID::FCAL2 || sample == CaloCell_ID::TileGap3) barrel = false; - if ( barrel ) { + if (barrel) { - /*To avoid the funny numbers given by the CaloDescriptors to TileBar2, (due to the cell D type) + /*To avoid the funny numbers given by the CaloDescriptors to TileBar2, (due + to the cell D type) we'll take only the radius from them, the rest we copy from TileBar1 */ - if ( sample == CaloCell_ID::TileBar2){ - double radius2=0; + if (sample == CaloCell_ID::TileBar2) { + double radius2 = 0; Amg::Transform3D* pos2 = new Amg::Transform3D(Trk::s_idTransform); - result = this->get_cylinder_surface (sample,side,pos2, radius, hphi, hlen, depth, calo_dd); + result = this->get_cylinder_surface( + sample, side, pos2, radius, hphi, hlen, depth, calo_dd); delete pos2; - result = this->get_cylinder_surface (CaloCell_ID::TileBar1,side, pos.get(), radius2, hphi, hlen, depth, calo_dd); - }else{ - result = this->get_cylinder_surface (sample,side, pos.get(), radius, hphi, hlen, depth, calo_dd); + result = this->get_cylinder_surface(CaloCell_ID::TileBar1, + side, + pos.get(), + radius2, + hphi, + hlen, + depth, + calo_dd); + } else { + result = this->get_cylinder_surface( + sample, side, pos.get(), radius, hphi, hlen, depth, calo_dd); } - if (!result){ + if (!result) { return nullptr; } - //this correction will only work for LAr + // this correction will only work for LAr double betterrad = 0; - if(!tile){ - betterrad = m_calodepth->radius(sample,etaCaloLocal,0.); + if (!tile) { + betterrad = m_calodepth->radius(sample, etaCaloLocal, 0., calo_dd); radius = offset + betterrad; } - if (tile) hlen = hlen/2; + if (tile) + hlen = hlen / 2; // for Atlas configuration, avoid to create a hole at phi ~ pi by hphi // rounding effects (the phi range was introduced for the testbeam) - if ( hphi < 0.9*M_PI) { - surf = new Trk::CylinderSurface(*pos,radius,hphi,hlen); + if (hphi < 0.9 * M_PI) { + surf = new Trk::CylinderSurface(*pos, radius, hphi, hlen); + } else { + surf = new Trk::CylinderSurface(*pos, radius, hlen); } - else{ - surf = new Trk::CylinderSurface(*pos,radius,hlen); - } - } - else { - bool result = this->get_disk_surface (sample,side, pos.get(), z,rmin, rmax, hphi, depth, calo_dd); - if (!result){ + } else { + bool result = this->get_disk_surface( + sample, side, pos.get(), z, rmin, rmax, hphi, depth, calo_dd); + if (!result) { return nullptr; } - double betterz =0; + double betterz = 0; if (!tile && !HEC3) { - betterz = m_calodepth->radius(sample, etaCaloLocal, 0.); + betterz = m_calodepth->radius(sample, etaCaloLocal, 0., calo_dd); z = offset + betterz - (*pos)(2, 3); Amg::Translation3D vec(0., 0., z); *pos = (*pos) * vec; - } + } // for Atlas configuration, avoid to create a hole a phi ~ pi by hphi // rounding effects. the phi range was introduced for the testbeam - if ( hphi < 0.9*M_PI){ - surf = new Trk::DiscSurface(*pos,rmin,rmax,hphi); - } - else{ - surf = new Trk::DiscSurface(*pos,rmin,rmax); + if (hphi < 0.9 * M_PI) { + surf = new Trk::DiscSurface(*pos, rmin, rmax, hphi); + } else { + surf = new Trk::DiscSurface(*pos, rmin, rmax); } } @@ -316,7 +328,7 @@ CaloSurfaceBuilder::CreateLastSurface(const CaloCell_ID::CaloSample sample, const double etaCaloLocal, const CaloDetDescrManager* calo_dd) const { - ATH_MSG_DEBUG( "In CreateLastSurface()" ); + ATH_MSG_DEBUG("In CreateLastSurface()"); // See ATLASRECTS-5012 // Here we prb want to move to conditions data @@ -327,12 +339,14 @@ CaloSurfaceBuilder::CreateLastSurface(const CaloCell_ID::CaloSample sample, } } - Trk::Surface* surf =nullptr; + Trk::Surface* surf = nullptr; bool tile = false; - if ( sample == CaloCell_ID::TileBar0 || sample == CaloCell_ID::TileBar1 || sample == CaloCell_ID::TileBar2 || - sample == CaloCell_ID::TileExt0 || sample == CaloCell_ID::TileExt1 || sample == CaloCell_ID::TileExt2 || - sample == CaloCell_ID::TileGap1 || sample == CaloCell_ID::TileGap2 || sample == CaloCell_ID::TileGap3 ) + if (sample == CaloCell_ID::TileBar0 || sample == CaloCell_ID::TileBar1 || + sample == CaloCell_ID::TileBar2 || sample == CaloCell_ID::TileExt0 || + sample == CaloCell_ID::TileExt1 || sample == CaloCell_ID::TileExt2 || + sample == CaloCell_ID::TileGap1 || sample == CaloCell_ID::TileGap2 || + sample == CaloCell_ID::TileGap3) tile = true; // NB: the Transform3D created here belong to the surface, @@ -341,80 +355,93 @@ CaloSurfaceBuilder::CreateLastSurface(const CaloCell_ID::CaloSample sample, bool result = false; double rmin = 0.; - double z=0.; + double z = 0.; double rmax = 0.; double radius = 0.; double hphi = 0.; double hlen = 0.; - double depth =0.; + double depth = 0.; int side = 1; - if (etaCaloLocal<0) side = -1; - - if ( sample == CaloCell_ID::TileBar2 || sample == CaloCell_ID::TileExt2 || sample == CaloCell_ID::TileGap2){ + if (etaCaloLocal < 0) + side = -1; + if (sample == CaloCell_ID::TileBar2 || sample == CaloCell_ID::TileExt2 || + sample == CaloCell_ID::TileGap2) { - /*To avoid the funny numbers given by the CaloDescriptors to TileBar2, (due to the cell D type) + /*To avoid the funny numbers given by the CaloDescriptors to TileBar2, (due + to the cell D type) we'll take only the radius from them, the rest we copy from TileBar1 */ - if ( sample == CaloCell_ID::TileBar2){ - double radius2=0; + if (sample == CaloCell_ID::TileBar2) { + double radius2 = 0; Amg::Transform3D* pos2 = new Amg::Transform3D(Trk::s_idTransform); - result = this->get_cylinder_surface (sample,side,pos2, radius, hphi, hlen, depth, calo_dd); + result = this->get_cylinder_surface( + sample, side, pos2, radius, hphi, hlen, depth, calo_dd); delete pos2; - result = this->get_cylinder_surface (CaloCell_ID::TileBar1,side, pos.get(), radius2, hphi, hlen, depth, calo_dd); - }else{ - - result = this->get_cylinder_surface (sample,side, pos.get(), radius, hphi, hlen, depth, calo_dd); + result = this->get_cylinder_surface(CaloCell_ID::TileBar1, + side, + pos.get(), + radius2, + hphi, + hlen, + depth, + calo_dd); + } else { + + result = this->get_cylinder_surface( + sample, side, pos.get(), radius, hphi, hlen, depth, calo_dd); } - if (!result){ + if (!result) { return nullptr; } - // for Atlas configuration, avoid to create a hole at phi ~ pi by hphi // rounding effects (the phi range was introduced for the testbeam) - else{ - std::vector <TileDetDescriptor*>::const_iterator Tile_first = m_tile_dd->tile_descriptors_begin(); - TileDetDescriptor* TileBar_descr = *(Tile_first+1); - TileDetDescriptor* TileExt_descr = *(Tile_first+3); - TileDetDescriptor* TileGap_descr = *(Tile_first+5); - if (sample == CaloCell_ID::TileBar2 ) radius = TileBar_descr->rcenter(2) + .5*TileBar_descr->dr(2) ; - else if (sample == CaloCell_ID::TileExt2 ) radius = TileExt_descr->rcenter(2) + .5*TileExt_descr->dr(2) ; - else if (sample == CaloCell_ID::TileGap2 ) radius = TileGap_descr->rcenter(2) + .5*TileGap_descr->dr(2) ; - else ATH_MSG_DEBUG("Not a considered cylinder tile"); + else { + std::vector<TileDetDescriptor*>::const_iterator Tile_first = + m_tile_dd->tile_descriptors_begin(); + TileDetDescriptor* TileBar_descr = *(Tile_first + 1); + TileDetDescriptor* TileExt_descr = *(Tile_first + 3); + TileDetDescriptor* TileGap_descr = *(Tile_first + 5); + if (sample == CaloCell_ID::TileBar2) + radius = TileBar_descr->rcenter(2) + .5 * TileBar_descr->dr(2); + else if (sample == CaloCell_ID::TileExt2) + radius = TileExt_descr->rcenter(2) + .5 * TileExt_descr->dr(2); + else if (sample == CaloCell_ID::TileGap2) + radius = TileGap_descr->rcenter(2) + .5 * TileGap_descr->dr(2); + else + ATH_MSG_DEBUG("Not a considered cylinder tile"); if (tile) - hlen = hlen/2; - ATH_MSG_DEBUG("got -real- cylinder for Sample " << (int) sample << " eta= " - << etaCaloLocal << " offset=" << offset - << " ==> radius, hlen are " << radius - << " " << hlen); - - - if ( hphi < 0.9*M_PI){ - return surf = new Trk::CylinderSurface(*pos,radius,hphi,hlen); - } - else{ - return surf = new Trk::CylinderSurface(*pos,radius,hlen); + hlen = hlen / 2; + ATH_MSG_DEBUG("got -real- cylinder for Sample " + << (int)sample << " eta= " << etaCaloLocal + << " offset=" << offset << " ==> radius, hlen are " + << radius << " " << hlen); + + if (hphi < 0.9 * M_PI) { + return surf = new Trk::CylinderSurface(*pos, radius, hphi, hlen); + } else { + return surf = new Trk::CylinderSurface(*pos, radius, hlen); } } - } - else if ( sample == CaloCell_ID::TileGap3 || sample == CaloCell_ID::HEC3 ){ + } else if (sample == CaloCell_ID::TileGap3 || sample == CaloCell_ID::HEC3) { - bool result = this->get_disk_surface (sample,side, pos.get(), z,rmin, rmax, hphi, depth, calo_dd); - if (!result){ + bool result = this->get_disk_surface( + sample, side, pos.get(), z, rmin, rmax, hphi, depth, calo_dd); + if (!result) { return nullptr; } - double zend=0; - if (sample == CaloCell_ID::TileGap3){ - std::vector <TileDetDescriptor*>::const_iterator Tile_first = m_tile_dd->tile_descriptors_begin(); - TileDetDescriptor* TileGap_descr = *(Tile_first+5); - zend = TileGap_descr->zcenter(2) + .5*TileGap_descr->dz(2) ; + double zend = 0; + if (sample == CaloCell_ID::TileGap3) { + std::vector<TileDetDescriptor*>::const_iterator Tile_first = + m_tile_dd->tile_descriptors_begin(); + TileDetDescriptor* TileGap_descr = *(Tile_first + 5); + zend = TileGap_descr->zcenter(2) + .5 * TileGap_descr->dz(2); zend = zend * side; } if (sample == CaloCell_ID::HEC3) { - for (const CaloDetDescriptor* descr : - calo_dd->calo_descriptors_range()) { + for (const CaloDetDescriptor* descr : calo_dd->calo_descriptors_range()) { if (descr) { if (descr->getSampling(0) == CaloCell_ID::HEC3) { zend = descr->calo_z_max(); @@ -424,28 +451,29 @@ CaloSurfaceBuilder::CreateLastSurface(const CaloCell_ID::CaloSample sample, } } - z = offset + zend - (*pos)(2,3); - ATH_MSG_DEBUG(" LastSurface shift z by : offset - zend + oldz = " << offset << " - " - <<zend << " + " << (*pos)(2,3) << " = " << z); + z = offset + zend - (*pos)(2, 3); + ATH_MSG_DEBUG(" LastSurface shift z by : offset - zend + oldz = " + << offset << " - " << zend << " + " << (*pos)(2, 3) << " = " + << z); - Amg::Translation3D vec(0.,0.,z); + Amg::Translation3D vec(0., 0., z); *pos = (*pos) * vec; - ATH_MSG_DEBUG(" got -real- disk for Sample " << (int) sample << " rmin: "<< rmin <<" rmax: " - << rmax << " z = " << (*pos)(2,3) << " for etaCaloLocal=" << etaCaloLocal); - + ATH_MSG_DEBUG(" got -real- disk for Sample " + << (int)sample << " rmin: " << rmin << " rmax: " << rmax + << " z = " << (*pos)(2, 3) + << " for etaCaloLocal=" << etaCaloLocal); // for Atlas configuration, avoid to create a hole a phi ~ pi by hphi // rounding effects. the phi range was introduced for the testbeam - if ( hphi < 0.9*M_PI){ - return new Trk::DiscSurface(*pos,rmin,rmax,hphi); - } - else{ - return new Trk::DiscSurface(*pos,rmin,rmax); + if (hphi < 0.9 * M_PI) { + return new Trk::DiscSurface(*pos, rmin, rmax, hphi); + } else { + return new Trk::DiscSurface(*pos, rmin, rmax); } - } - else{ - ATH_MSG_ERROR("This sample is not a 'LAST' surface... returning dummy surface"); + } else { + ATH_MSG_ERROR( + "This sample is not a 'LAST' surface... returning dummy surface"); return surf; } @@ -453,14 +481,17 @@ CaloSurfaceBuilder::CreateLastSurface(const CaloCell_ID::CaloSample sample, } Trk::Surface* -CaloSurfaceBuilder::CreateGirderSurface() const { - ATH_MSG_FATAL("CaloSufraceBuilder::CreateGirderSurface not implemented in mig5!"); +CaloSurfaceBuilder::CreateGirderSurface() const +{ + ATH_MSG_FATAL( + "CaloSufraceBuilder::CreateGirderSurface not implemented in mig5!"); return nullptr; } - bool -CaloSurfaceBuilder::CreateDDLayers(CaloSubdetNames::ALIGNVOL alvol, std::vector< Trk::CylinderLayer*>* thelayer) const +CaloSurfaceBuilder::CreateDDLayers( + CaloSubdetNames::ALIGNVOL alvol, + std::vector<Trk::CylinderLayer*>* thelayer) const { bool result = false; thelayer->clear(); @@ -476,28 +507,37 @@ CaloSurfaceBuilder::CreateDDLayers(CaloSubdetNames::ALIGNVOL alvol, std::vector< result = m_lar_mat->get_material(alvol, mass, volume, x0, dEdx, aveA, aveZ); // the layers - result = this->get_cylinder_surface(alvol, &htrans, hphi, radius, depth, hlength); - if (!result){ - return 0; - } - + result = + this->get_cylinder_surface(alvol, &htrans, hphi, radius, depth, hlength); + if (!result) { + return 0; + } - for ( unsigned int i = 0; i<radius.size(); i++ ) { - Trk::MaterialProperties objectMaterial(depth[i], x0, 3*x0/aveZ, aveA, aveZ, mass/volume); // TODO set l0 properly + for (unsigned int i = 0; i < radius.size(); i++) { + Trk::MaterialProperties objectMaterial(depth[i], + x0, + 3 * x0 / aveZ, + aveA, + aveZ, + mass / + volume); // TODO set l0 properly Trk::HomogeneousLayerMaterial objectLayerMaterial(objectMaterial, 1.0); - Trk::CylinderBounds* objectBounds = new Trk::CylinderBounds(radius[i], hlength[i]); + Trk::CylinderBounds* objectBounds = + new Trk::CylinderBounds(radius[i], hlength[i]); // CylinderLayer takes ownership of the transformation. - thelayer->push_back(new Trk::CylinderLayer(Amg::Transform3D(htrans), - objectBounds, objectLayerMaterial)); + thelayer->push_back(new Trk::CylinderLayer( + Amg::Transform3D(htrans), objectBounds, objectLayerMaterial)); } return result; } bool -CaloSurfaceBuilder::CreateDDECLayers(CaloSubdetNames::ALIGNVOL alvol, std::vector< Trk::DiscLayer*>* thelayer) const +CaloSurfaceBuilder::CreateDDECLayers( + CaloSubdetNames::ALIGNVOL alvol, + std::vector<Trk::DiscLayer*>* thelayer) const { bool result = false; thelayer->clear(); @@ -516,28 +556,35 @@ CaloSurfaceBuilder::CreateDDECLayers(CaloSubdetNames::ALIGNVOL alvol, std::vecto // the layers Amg::Transform3D* ptrans = &theTrans; result = this->get_disk_surface(alvol, ptrans, hphi, z, depth, rmin, rmax); - if (!result){ - return result; + if (!result) { + return result; } - for ( unsigned int i = 0; i<z.size(); i++ ) { + for (unsigned int i = 0; i < z.size(); i++) { // Fix the z ( convention is different in Calo's and Tracking ) Amg::Transform3D eachtrans = Amg::Transform3D(Trk::s_idTransform); - Amg::Translation3D vec(0.,0.,z[i] - theTrans(2,3)); + Amg::Translation3D vec(0., 0., z[i] - theTrans(2, 3)); eachtrans = theTrans * vec; - Trk::MaterialProperties objectMaterial(depth[i], x0, 3*x0/aveZ, aveA, aveZ, mass/volume); // TODO: set l0 properly + Trk::MaterialProperties objectMaterial(depth[i], + x0, + 3 * x0 / aveZ, + aveA, + aveZ, + mass / + volume); // TODO: set l0 properly Trk::HomogeneousLayerMaterial objectLayerMaterial(objectMaterial, 1.0); - Trk::DiscBounds* objectBounds = new Trk::DiscBounds(rmin[i], rmax[i] ); - thelayer->push_back(new Trk::DiscLayer(eachtrans, objectBounds, objectLayerMaterial)); + Trk::DiscBounds* objectBounds = new Trk::DiscBounds(rmin[i], rmax[i]); + thelayer->push_back( + new Trk::DiscLayer(eachtrans, objectBounds, objectLayerMaterial)); } return result; } void -CaloSurfaceBuilder::setCaloDepth(CaloDepthTool* /*mytool*/ ) +CaloSurfaceBuilder::setCaloDepth(CaloDepthTool* /*mytool*/) { // This allows clients who already have a CaloDepthTool to use it // and be sure that the properties set via jobOpt are used consistently @@ -549,7 +596,7 @@ CaloSurfaceBuilder::setCaloDepth(CaloDepthTool* /*mytool*/ ) CaloDepthTool* CaloSurfaceBuilder::getCaloDepth() { - return &(*m_calodepth); // from ToolHandle to pointer + return &(*m_calodepth); // from ToolHandle to pointer } // End of the general user methods : @@ -582,62 +629,72 @@ CaloSurfaceBuilder::get_cylinder_surface( hlength = 0; // these ones are definitely not cylinders : - if ( sample == CaloCell_ID::PreSamplerE ) return false; - if ( sample == CaloCell_ID::EME1 ) return false; - if ( sample == CaloCell_ID::EME2 ) return false; - if ( sample == CaloCell_ID::EME3 ) return false; - if ( sample == CaloCell_ID::HEC0 ) return false; - if ( sample == CaloCell_ID::HEC1 ) return false; - if ( sample == CaloCell_ID::HEC2 ) return false; - if ( sample == CaloCell_ID::HEC3 ) return false; - if ( sample == CaloCell_ID::FCAL0 ) return false; - if ( sample == CaloCell_ID::FCAL1 ) return false; - if ( sample == CaloCell_ID::FCAL2 ) return false; - if ( sample == CaloCell_ID::Unknown ) return false; - if ( sample == CaloCell_ID::TileGap3 ) return false; - - - if ( sample == CaloCell_ID::PreSamplerB || - sample == CaloCell_ID::EMB1 || - sample == CaloCell_ID::EMB2 || - sample == CaloCell_ID::EMB3 ) { + if (sample == CaloCell_ID::PreSamplerE) + return false; + if (sample == CaloCell_ID::EME1) + return false; + if (sample == CaloCell_ID::EME2) + return false; + if (sample == CaloCell_ID::EME3) + return false; + if (sample == CaloCell_ID::HEC0) + return false; + if (sample == CaloCell_ID::HEC1) + return false; + if (sample == CaloCell_ID::HEC2) + return false; + if (sample == CaloCell_ID::HEC3) + return false; + if (sample == CaloCell_ID::FCAL0) + return false; + if (sample == CaloCell_ID::FCAL1) + return false; + if (sample == CaloCell_ID::FCAL2) + return false; + if (sample == CaloCell_ID::Unknown) + return false; + if (sample == CaloCell_ID::TileGap3) + return false; + + if (sample == CaloCell_ID::PreSamplerB || sample == CaloCell_ID::EMB1 || + sample == CaloCell_ID::EMB2 || sample == CaloCell_ID::EMB3) { for (const CaloDetDescriptor* reg : calo_dd->calo_descriptors_range()) { if (reg) { - if ( reg->getSampling(0) == sample && reg->calo_sign()*side > 0) - { - result = reg->get_cylinder_surface(htrans,radius,hphi,hl,depth); - hlength = std::max(hl, hlength); - } + if (reg->getSampling(0) == sample && reg->calo_sign() * side > 0) { + result = reg->get_cylinder_surface(htrans, radius, hphi, hl, depth); + hlength = std::max(hl, hlength); + } } } } - else{ - //this are not cylinders + else { + // this are not cylinders switch (sample) { - case CaloCell_ID::TileBar0: - case CaloCell_ID::TileBar1: - case CaloCell_ID::TileBar2: - case CaloCell_ID::TileExt0: - case CaloCell_ID::TileExt1: - case CaloCell_ID::TileExt2: - case CaloCell_ID::TileGap1: - case CaloCell_ID::TileGap2: - break; - default: - ATH_MSG_ERROR(" get_cylinder_surface Not Cylindrical Tile found!!! "); - return 0; + case CaloCell_ID::TileBar0: + case CaloCell_ID::TileBar1: + case CaloCell_ID::TileBar2: + case CaloCell_ID::TileExt0: + case CaloCell_ID::TileExt1: + case CaloCell_ID::TileExt2: + case CaloCell_ID::TileGap1: + case CaloCell_ID::TileGap2: + break; + default: + ATH_MSG_ERROR(" get_cylinder_surface Not Cylindrical Tile found!!! "); + return 0; } for (const CaloDetDescriptor* reg : calo_dd->tile_descriptors_range()) { if (reg) { - if ( reg->getSampling(0) == sample && reg->calo_sign()*side > 0){ - (void) reg->get_cylinder_surface(htrans,radius,hphi,hl,depth); - if (hl > hlength) hlength = hl; - hphi = .5*reg->dphi()*reg->n_phi(); - } + if (reg->getSampling(0) == sample && reg->calo_sign() * side > 0) { + (void)reg->get_cylinder_surface(htrans, radius, hphi, hl, depth); + if (hl > hlength) + hlength = hl; + hphi = .5 * reg->dphi() * reg->n_phi(); + } } } result = true; @@ -679,38 +736,49 @@ CaloSurfaceBuilder::get_disk_surface(CaloCell_ID::CaloSample sample, // take OW z and fix the HepTransform accordingly // these ones are definitely not disks : - if ( sample == CaloCell_ID::PreSamplerB ) return false; - if ( sample == CaloCell_ID::EMB1 ) return false; - if ( sample == CaloCell_ID::EMB2 ) return false; - if ( sample == CaloCell_ID::EMB3 ) return false; - if ( sample == CaloCell_ID::TileBar0 ) return false; - if ( sample == CaloCell_ID::TileBar1 ) return false; - if ( sample == CaloCell_ID::TileBar2 ) return false; - if ( sample == CaloCell_ID::TileGap1 ) return false; - if ( sample == CaloCell_ID::TileGap2 ) return false; - if ( sample == CaloCell_ID::TileExt0 ) return false; - if ( sample == CaloCell_ID::TileExt1 ) return false; - if ( sample == CaloCell_ID::TileExt2 ) return false; + if (sample == CaloCell_ID::PreSamplerB) + return false; + if (sample == CaloCell_ID::EMB1) + return false; + if (sample == CaloCell_ID::EMB2) + return false; + if (sample == CaloCell_ID::EMB3) + return false; + if (sample == CaloCell_ID::TileBar0) + return false; + if (sample == CaloCell_ID::TileBar1) + return false; + if (sample == CaloCell_ID::TileBar2) + return false; + if (sample == CaloCell_ID::TileGap1) + return false; + if (sample == CaloCell_ID::TileGap2) + return false; + if (sample == CaloCell_ID::TileExt0) + return false; + if (sample == CaloCell_ID::TileExt1) + return false; + if (sample == CaloCell_ID::TileExt2) + return false; double ri, ra, zow; for (const CaloDetDescriptor* reg : calo_dd->calo_descriptors_range()) { if (reg) { - if ( reg->getSampling(0) == sample && reg->calo_sign()*side > 0 ) - { - result = reg->get_disk_surface(htrans,zow,ri,ra,hphisec,depth); - if ( !reg->is_lar_em_endcap_inner() ) z = zow; - rmin = std::min(ri, rmin); - rmax = std::max(rmax, ra); - } + if (reg->getSampling(0) == sample && reg->calo_sign() * side > 0) { + result = reg->get_disk_surface(htrans, zow, ri, ra, hphisec, depth); + if (!reg->is_lar_em_endcap_inner()) + z = zow; + rmin = std::min(ri, rmin); + rmax = std::max(rmax, ra); + } } } - if ( sample == CaloCell_ID::TileGap3 ){ + if (sample == CaloCell_ID::TileGap3) { for (const CaloDetDescriptor* reg : calo_dd->tile_descriptors_range()) { if (reg) { if (reg->getSampling(0) == sample && reg->calo_sign() * side > 0) { - result = - reg->get_disk_surface(htrans, zow, ri, ra, hphisec, depth); + result = reg->get_disk_surface(htrans, zow, ri, ra, hphisec, depth); if (!reg->is_lar_em_endcap_inner()) z = zow; rmin = std::min(ri, rmin); @@ -720,9 +788,10 @@ CaloSurfaceBuilder::get_disk_surface(CaloCell_ID::CaloSample sample, } } - if ( rmin > rmax ) rmin = 0.; + if (rmin > rmax) + rmin = 0.; // Fix the z ( convention is different in Calo's and Tracking ) - Amg::Translation3D vec(0.,0.,z - (*htrans)(2,3)); + Amg::Translation3D vec(0., 0., z - (*htrans)(2, 3)); *htrans = (*htrans) * vec; return result; } @@ -735,20 +804,25 @@ CaloSurfaceBuilder::get_cylinder_surface(CaloSubdetNames::ALIGNVOL alvol, std::vector<double>& depth, std::vector<double>& hlength) const { - bool result = m_lar_simplegeom->get_cylinder_surface(alvol, *htrans, hphi, radius, depth, hlength); + bool result = m_lar_simplegeom->get_cylinder_surface( + alvol, *htrans, hphi, radius, depth, hlength); - // Shift the POS/NEG sides ( htrans convention is different in Calo's and Tracking ) + // Shift the POS/NEG sides ( htrans convention is different in Calo's and + // Tracking ) // FIXME : for this, assume that the 1rst hlength is the good one - if ( alvol == CaloSubdetNames::EMB_POS || alvol == CaloSubdetNames::PRESAMPLER_B_POS ) { - result = m_lar_simplegeom->get_cylinder_surface(alvol, *htrans, hphi, radius, depth, hlength); - Amg::Translation3D vec(0.,0.,hlength[0]); + if (alvol == CaloSubdetNames::EMB_POS || + alvol == CaloSubdetNames::PRESAMPLER_B_POS) { + result = m_lar_simplegeom->get_cylinder_surface( + alvol, *htrans, hphi, radius, depth, hlength); + Amg::Translation3D vec(0., 0., hlength[0]); *htrans = (*htrans) * vec; return result; - } - else if ( alvol == CaloSubdetNames::EMB_NEG || alvol == CaloSubdetNames::PRESAMPLER_B_NEG ) { - result = m_lar_simplegeom->get_cylinder_surface(alvol, *htrans, hphi, radius, depth, hlength); - Amg::Translation3D vec(0.,0.,-1.*hlength[0]); + } else if (alvol == CaloSubdetNames::EMB_NEG || + alvol == CaloSubdetNames::PRESAMPLER_B_NEG) { + result = m_lar_simplegeom->get_cylinder_surface( + alvol, *htrans, hphi, radius, depth, hlength); + Amg::Translation3D vec(0., 0., -1. * hlength[0]); *htrans = (*htrans) * vec; return result; } @@ -765,206 +839,19 @@ CaloSurfaceBuilder::get_disk_surface(CaloSubdetNames::ALIGNVOL alvol, std::vector<double>& rmin, std::vector<double>& rmax) const { - bool result = m_lar_simplegeom->get_disk_surface(alvol, *htrans, hphi, z, depth, rmin, rmax ); + bool result = m_lar_simplegeom->get_disk_surface( + alvol, *htrans, hphi, z, depth, rmin, rmax); // Fix the z ( htrans convention is different in Calo's and Tracking ) ? - // = left to the CreateDDEClayer method, because z is a vector => 1 fix per disk element + // = left to the CreateDDEClayer method, because z is a vector => 1 fix per + // disk element return result; } - - - -//Write all the surfaces into a vector for debugging porposes -std::vector<const Trk::Surface*> CaloSurfaceBuilder::allSampleSurfaces() const -{ - std::vector<const Trk::Surface*> surfaces; - Trk::Surface * surf; - for (CaloCell_ID::CaloSample sample = CaloCell_ID::PreSamplerB; sample< CaloCell_ID::Unknown; sample = CaloCell_ID::CaloSample(sample+1) ){ - surf = CreateUserSurface(sample,0.,-1., nullptr); - if(surf) - surfaces.push_back(surf); - surf = CreateUserSurface(sample,0.,1., nullptr); - if(surf) - surfaces.push_back(surf); - - if ( sample == CaloCell_ID::TileBar2 || sample == CaloCell_ID::TileExt2 || sample == CaloCell_ID::TileGap3 || sample == CaloCell_ID::HEC3 ){ - surf = CreateLastSurface(sample,0.,-1., nullptr); - if(surf) - surfaces.push_back(surf); - surf = CreateLastSurface(sample,0.,1., nullptr); - if(surf) - surfaces.push_back(surf); - } - } - return (surfaces); -} - - - -//Write all TileBar surfaces into a vector for debugging porposes -std::vector<const Trk::Surface*> -CaloSurfaceBuilder::allTileBarSurfaces() const -{ - std::vector<const Trk::Surface*> surfaces; - Trk::Surface * surf; - for (CaloCell_ID::CaloSample sample = CaloCell_ID::PreSamplerB; sample < CaloCell_ID::Unknown; sample = CaloCell_ID::CaloSample(sample+1) ){ - if ( sample == CaloCell_ID::TileBar0 || - sample == CaloCell_ID::TileBar1 || - sample == CaloCell_ID::TileBar2 ){ - surf = CreateUserSurface(sample,0.,-1., nullptr); - if(surf) surfaces.push_back(surf); - surf = CreateUserSurface(sample,0.,1., nullptr); - if(surf) surfaces.push_back(surf); - if ( sample == CaloCell_ID::TileBar2 || - sample == CaloCell_ID::TileExt2 || - sample == CaloCell_ID::TileGap3 ){ - surf = CreateLastSurface(sample,0.,-1., nullptr); - if(surf) surfaces.push_back(surf); - surf = CreateLastSurface(sample,0.,1., nullptr); - if(surf) surfaces.push_back(surf); - } - } - } - return (surfaces); -} - - -//Write all TileBar surfaces into a vector for debugging porposes -std::vector<const Trk::Surface*> -CaloSurfaceBuilder::allTileExtSurfaces() const -{ - std::vector<const Trk::Surface*> surfaces; - Trk::Surface * surf; - for (CaloCell_ID::CaloSample sample = CaloCell_ID::PreSamplerB; sample < CaloCell_ID::Unknown; sample = CaloCell_ID::CaloSample(sample+1) ){ - if ( - sample == CaloCell_ID::TileExt0 || - sample == CaloCell_ID::TileExt1 || - sample == CaloCell_ID::TileExt2 ){ - surf = CreateUserSurface(sample, 0., -1., nullptr); - if (surf) - surfaces.push_back(surf); - surf = CreateUserSurface(sample, 0., 1., nullptr); - if (surf) - surfaces.push_back(surf); - - if (sample == CaloCell_ID::TileBar2 || sample == CaloCell_ID::TileExt2 || - sample == CaloCell_ID::TileGap3) { - surf = CreateLastSurface(sample, 0., -1., nullptr); - if (surf) - surfaces.push_back(surf); - surf = CreateLastSurface(sample,0.,1., nullptr); - if(surf) - surfaces.push_back(surf); - } - } - } - return (surfaces); -} - -//Write all TileBar surfaces into a vector for debugging porposes -std::vector<const Trk::Surface*> CaloSurfaceBuilder::allTileGapSurfaces() const -{ - std::vector<const Trk::Surface*> surfaces; - Trk::Surface * surf; - for (CaloCell_ID::CaloSample sample = CaloCell_ID::PreSamplerB; sample < CaloCell_ID::Unknown; sample = CaloCell_ID::CaloSample(sample+1) ){ - if (sample == CaloCell_ID::TileGap1 || sample == CaloCell_ID::TileGap2 || - sample == CaloCell_ID::TileGap3) { - surf = CreateUserSurface(sample, 0., -1., nullptr ); - if (surf) - surfaces.push_back(surf); - surf = CreateUserSurface(sample, 0., 1., nullptr); - if (surf) - surfaces.push_back(surf); - - if (sample == CaloCell_ID::TileBar2 || sample == CaloCell_ID::TileExt2 || - sample == CaloCell_ID::TileGap3) { - surf = CreateLastSurface(sample,0.,-1., nullptr); - if (surf) - surfaces.push_back(surf); - surf = CreateLastSurface(sample, 0., 1., nullptr); - if (surf) - surfaces.push_back(surf); - } - } - } - return (surfaces); -} - - -//Write all EMB surfaces into a vector for debugging porposes -std::vector<const Trk::Surface*> CaloSurfaceBuilder::allEMBSurfaces() const -{ - std::vector<const Trk::Surface*> surfaces; - Trk::Surface * surf; - for (CaloCell_ID::CaloSample sample = CaloCell_ID::PreSamplerB; - sample < CaloCell_ID::Unknown; - sample = CaloCell_ID::CaloSample(sample + 1)) { - if (sample == CaloCell_ID::EMB1 || sample == CaloCell_ID::EMB2 || - sample == CaloCell_ID::EMB3) { - surf = CreateUserSurface(sample, 0., -1., nullptr); - if (surf) - surfaces.push_back(surf); - surf = CreateUserSurface(sample, 0., 1., nullptr); - if (surf) - surfaces.push_back(surf); - } - } - return (surfaces); -} - - -//Write all EME surfaces into a vector for debugging porposes -std::vector<const Trk::Surface*> CaloSurfaceBuilder::allEMESurfaces() const -{ - std::vector<const Trk::Surface*> surfaces; - Trk::Surface * surf; - for (CaloCell_ID::CaloSample sample = CaloCell_ID::PreSamplerB; sample< CaloCell_ID::Unknown; sample = CaloCell_ID::CaloSample(sample+1) ){ - if (sample == CaloCell_ID::EME1 || sample == CaloCell_ID::EME2 || - sample == CaloCell_ID::EME3) { - surf = CreateUserSurface(sample, 0., -1., nullptr); - if (surf) - surfaces.push_back(surf); - surf = CreateUserSurface(sample, 0., 1., nullptr); - if (surf) - surfaces.push_back(surf); - } - } - return (surfaces); -} - - -//Write all HEC surfaces into a vector for debugging porposes -std::vector<const Trk::Surface*> CaloSurfaceBuilder::allHECSurfaces() const -{ - std::vector<const Trk::Surface*> surfaces; - Trk::Surface * surf; - for (CaloCell_ID::CaloSample sample = CaloCell_ID::PreSamplerB; sample< CaloCell_ID::Unknown; sample = CaloCell_ID::CaloSample(sample+1) ){ - if (sample == CaloCell_ID::HEC0 || sample == CaloCell_ID::HEC1 || - sample == CaloCell_ID::HEC2 || sample == CaloCell_ID::HEC3) { - surf = CreateUserSurface(sample, 0., -1., nullptr); - if (surf) - surfaces.push_back(surf); - surf = CreateUserSurface(sample, 0., 1., nullptr); - if (surf) - surfaces.push_back(surf); - - if (sample == CaloCell_ID::HEC3) { - surf = CreateLastSurface(sample, 0., -1., nullptr); - if (surf) - surfaces.push_back(surf); - surf = CreateLastSurface(sample, 0., 1., nullptr); - if (surf) - surfaces.push_back(surf); - } - } - } - return (surfaces); -} - -//store all the surfaces into a vector -void CaloSurfaceBuilder::fill_tg_surfaces() const +// store all the surfaces into a vector +void +CaloSurfaceBuilder::fill_tg_surfaces() const { // See ATLASRECTS-5012 // Here we prb want to move to conditions data @@ -975,28 +862,34 @@ void CaloSurfaceBuilder::fill_tg_surfaces() const } // entry surfaces ( id<24 to avoid error messages ) - for (CaloCell_ID::CaloSample sample = CaloCell_ID::PreSamplerB; sample< 24; sample = CaloCell_ID::CaloSample(sample+1) ){ - float etaRef = ( sample<4 || std::abs(sample-13)<2 ) ? 1. : 2. ; - Trk::Surface* spos = CreateUserSurface(sample,0.,etaRef, calo_dd); - Trk::Surface* sneg = CreateUserSurface(sample,0.,-etaRef, calo_dd); - if (spos) spos->setOwner(Trk::TGOwn); - if (sneg) sneg->setOwner(Trk::TGOwn); - m_layerEntries.emplace_back(spos,sneg); - + for (CaloCell_ID::CaloSample sample = CaloCell_ID::PreSamplerB; sample < 24; + sample = CaloCell_ID::CaloSample(sample + 1)) { + float etaRef = (sample < 4 || std::abs(sample - 13) < 2) ? 1. : 2.; + Trk::Surface* spos = CreateUserSurface(sample, 0., etaRef, calo_dd); + Trk::Surface* sneg = CreateUserSurface(sample, 0., -etaRef, calo_dd); + if (spos) + spos->setOwner(Trk::TGOwn); + if (sneg) + sneg->setOwner(Trk::TGOwn); + m_layerEntries.emplace_back(spos, sneg); } - // turn into SlidingSurfaces + // turn into SlidingSurfaces // EMB2 neg - float etaMin = -1.5; float etaMax = 0.; float deta = 0.05; - unsigned int neta = (etaMax-etaMin)/deta; + float etaMin = -1.5; + float etaMax = 0.; + float deta = 0.05; + unsigned int neta = (etaMax - etaMin) / deta; std::vector<float> offset(neta); - float rbase = m_layerEntries[CaloCell_ID::EMB2].second->bounds().r(); - for (unsigned int ie=0; ie<neta; ie++ ) { - float eta = etaMin+(ie+0.5)*deta; - const Trk::Surface* surf = CreateUserSurface(CaloCell_ID::EMB2,0.,eta, calo_dd); - offset[ie] = surf->bounds().r()- rbase; - delete surf; + float rbase = m_layerEntries[CaloCell_ID::EMB2].second->bounds().r(); + for (unsigned int ie = 0; ie < neta; ie++) { + float eta = etaMin + (ie + 0.5) * deta; + const Trk::Surface* surf = + CreateUserSurface(CaloCell_ID::EMB2, 0., eta, calo_dd); + offset[ie] = surf->bounds().r() - rbase; + delete surf; } - const Trk::CylinderSurface* cyl = dynamic_cast<const Trk::CylinderSurface*> (m_layerEntries[CaloCell_ID::EMB2].second); + const Trk::CylinderSurface* cyl = dynamic_cast<const Trk::CylinderSurface*>( + m_layerEntries[CaloCell_ID::EMB2].second); if (!cyl) { std::abort(); } @@ -1008,17 +901,20 @@ void CaloSurfaceBuilder::fill_tg_surfaces() const m_layerEntries[CaloCell_ID::EMB2].second = tmpSlidCyl; delete cyl; // EMB2 pos - etaMin = 0.; etaMax = 1.5; deta = 0.05; - neta = (etaMax-etaMin)/deta; + etaMin = 0.; + etaMax = 1.5; + deta = 0.05; + neta = (etaMax - etaMin) / deta; offset.resize(neta); - rbase = m_layerEntries[CaloCell_ID::EMB2].first->bounds().r(); - for (unsigned int ie=0; ie<neta; ie++ ) { - float eta = etaMin+(ie+0.5)*deta; - Trk::Surface* surf = CreateUserSurface(CaloCell_ID::EMB2,0.,eta, calo_dd); - offset[ie] = surf->bounds().r()- rbase; - delete surf; + rbase = m_layerEntries[CaloCell_ID::EMB2].first->bounds().r(); + for (unsigned int ie = 0; ie < neta; ie++) { + float eta = etaMin + (ie + 0.5) * deta; + Trk::Surface* surf = CreateUserSurface(CaloCell_ID::EMB2, 0., eta, calo_dd); + offset[ie] = surf->bounds().r() - rbase; + delete surf; } - cyl = dynamic_cast<const Trk::CylinderSurface*> (m_layerEntries[CaloCell_ID::EMB2].first); + cyl = dynamic_cast<const Trk::CylinderSurface*>( + m_layerEntries[CaloCell_ID::EMB2].first); if (!cyl) { std::abort(); } @@ -1030,16 +926,20 @@ void CaloSurfaceBuilder::fill_tg_surfaces() const m_layerEntries[CaloCell_ID::EMB2].first = tmpSlidCyl; delete cyl; // EMB3 neg - etaMin = -1.5; etaMax = 0.; deta = 0.05; - neta = (etaMax-etaMin)/deta; offset.resize(neta); - rbase = m_layerEntries[CaloCell_ID::EMB3].second->bounds().r(); - for (unsigned int ie=0; ie<neta; ie++ ) { - float eta = etaMin+(ie+0.5)*deta; - Trk::Surface* surf = CreateUserSurface(CaloCell_ID::EMB3,0.,eta, calo_dd); - offset[ie] = surf->bounds().r()- rbase; - delete surf; + etaMin = -1.5; + etaMax = 0.; + deta = 0.05; + neta = (etaMax - etaMin) / deta; + offset.resize(neta); + rbase = m_layerEntries[CaloCell_ID::EMB3].second->bounds().r(); + for (unsigned int ie = 0; ie < neta; ie++) { + float eta = etaMin + (ie + 0.5) * deta; + Trk::Surface* surf = CreateUserSurface(CaloCell_ID::EMB3, 0., eta, calo_dd); + offset[ie] = surf->bounds().r() - rbase; + delete surf; } - cyl = dynamic_cast<const Trk::CylinderSurface*> (m_layerEntries[CaloCell_ID::EMB3].second); + cyl = dynamic_cast<const Trk::CylinderSurface*>( + m_layerEntries[CaloCell_ID::EMB3].second); if (!cyl) { std::abort(); } @@ -1052,16 +952,21 @@ void CaloSurfaceBuilder::fill_tg_surfaces() const delete cyl; // EMB3 pos - etaMin = 0.; etaMax = 1.5; deta = 0.05; - neta = (etaMax-etaMin)/deta; offset.resize(neta); - rbase = m_layerEntries[CaloCell_ID::EMB3].first->bounds().r(); - for (unsigned int ie=0; ie<neta; ie++ ) { - float eta = etaMin+(ie+0.5)*deta; - const Trk::Surface* surf = CreateUserSurface(CaloCell_ID::EMB3,0.,eta, calo_dd); - offset[ie] = surf->bounds().r()- rbase; - delete surf; + etaMin = 0.; + etaMax = 1.5; + deta = 0.05; + neta = (etaMax - etaMin) / deta; + offset.resize(neta); + rbase = m_layerEntries[CaloCell_ID::EMB3].first->bounds().r(); + for (unsigned int ie = 0; ie < neta; ie++) { + float eta = etaMin + (ie + 0.5) * deta; + const Trk::Surface* surf = + CreateUserSurface(CaloCell_ID::EMB3, 0., eta, calo_dd); + offset[ie] = surf->bounds().r() - rbase; + delete surf; } - cyl = dynamic_cast<const Trk::CylinderSurface*> (m_layerEntries[CaloCell_ID::EMB3].first); + cyl = dynamic_cast<const Trk::CylinderSurface*>( + m_layerEntries[CaloCell_ID::EMB3].first); if (!cyl) { std::abort(); } @@ -1074,16 +979,21 @@ void CaloSurfaceBuilder::fill_tg_surfaces() const delete cyl; // EME2 neg - etaMin = -3.2; etaMax = -1.35; deta = 0.05; - neta = (etaMax-etaMin)/deta; offset.resize(neta); - float zbase = m_layerEntries[CaloCell_ID::EME2].second->center().z(); - for (unsigned int ie=0; ie<neta; ie++ ) { - float eta = etaMin+(ie+0.5)*deta; - const Trk::Surface* surf = CreateUserSurface(CaloCell_ID::EME2,0.,eta, calo_dd); - offset[ie] = surf->center().z()- zbase; - delete surf; + etaMin = -3.2; + etaMax = -1.35; + deta = 0.05; + neta = (etaMax - etaMin) / deta; + offset.resize(neta); + float zbase = m_layerEntries[CaloCell_ID::EME2].second->center().z(); + for (unsigned int ie = 0; ie < neta; ie++) { + float eta = etaMin + (ie + 0.5) * deta; + const Trk::Surface* surf = + CreateUserSurface(CaloCell_ID::EME2, 0., eta, calo_dd); + offset[ie] = surf->center().z() - zbase; + delete surf; } - const Trk::DiscSurface* disc = dynamic_cast<const Trk::DiscSurface*> (m_layerEntries[CaloCell_ID::EME2].second); + const Trk::DiscSurface* disc = dynamic_cast<const Trk::DiscSurface*>( + m_layerEntries[CaloCell_ID::EME2].second); if (!disc) { std::abort(); } @@ -1096,16 +1006,20 @@ void CaloSurfaceBuilder::fill_tg_surfaces() const delete disc; // EME2 pos - etaMin = 1.35; etaMax = 3.2; deta = 0.05; - neta = (etaMax-etaMin)/deta; offset.resize(neta); - zbase = m_layerEntries[CaloCell_ID::EME2].first->center().z(); - for (unsigned int ie=0; ie<neta; ie++ ) { - float eta = etaMin+(ie+0.5)*deta; - Trk::Surface* surf = CreateUserSurface(CaloCell_ID::EME2,0.,eta, calo_dd); - offset[ie] = surf->center().z()- zbase; - delete surf; + etaMin = 1.35; + etaMax = 3.2; + deta = 0.05; + neta = (etaMax - etaMin) / deta; + offset.resize(neta); + zbase = m_layerEntries[CaloCell_ID::EME2].first->center().z(); + for (unsigned int ie = 0; ie < neta; ie++) { + float eta = etaMin + (ie + 0.5) * deta; + Trk::Surface* surf = CreateUserSurface(CaloCell_ID::EME2, 0., eta, calo_dd); + offset[ie] = surf->center().z() - zbase; + delete surf; } - disc = dynamic_cast<const Trk::DiscSurface*> (m_layerEntries[CaloCell_ID::EME2].first); + disc = dynamic_cast<const Trk::DiscSurface*>( + m_layerEntries[CaloCell_ID::EME2].first); if (!disc) { std::abort(); } @@ -1118,16 +1032,21 @@ void CaloSurfaceBuilder::fill_tg_surfaces() const delete disc; // EME3 neg - etaMin = -3.2; etaMax = -1.35; deta = 0.05; - neta = (etaMax-etaMin)/deta; offset.resize(neta); - zbase = m_layerEntries[CaloCell_ID::EME3].second->center().z(); - for (unsigned int ie=0; ie<neta; ie++ ) { - float eta = etaMin+(ie+0.5)*deta; - const Trk::Surface* surf = CreateUserSurface(CaloCell_ID::EME3,0.,eta, calo_dd); - offset[ie] = surf->center().z()- zbase; - delete surf; + etaMin = -3.2; + etaMax = -1.35; + deta = 0.05; + neta = (etaMax - etaMin) / deta; + offset.resize(neta); + zbase = m_layerEntries[CaloCell_ID::EME3].second->center().z(); + for (unsigned int ie = 0; ie < neta; ie++) { + float eta = etaMin + (ie + 0.5) * deta; + const Trk::Surface* surf = + CreateUserSurface(CaloCell_ID::EME3, 0., eta, calo_dd); + offset[ie] = surf->center().z() - zbase; + delete surf; } - disc = dynamic_cast<const Trk::DiscSurface*> (m_layerEntries[CaloCell_ID::EME3].second); + disc = dynamic_cast<const Trk::DiscSurface*>( + m_layerEntries[CaloCell_ID::EME3].second); if (!disc) { std::abort(); } @@ -1140,16 +1059,20 @@ void CaloSurfaceBuilder::fill_tg_surfaces() const delete disc; // EME3 pos - etaMin = 1.35; etaMax = 3.2; deta = 0.05; - neta = (etaMax-etaMin)/deta; offset.resize(neta); - zbase = m_layerEntries[CaloCell_ID::EME3].first->center().z(); - for (unsigned int ie=0; ie<neta; ie++ ) { - float eta = etaMin+(ie+0.5)*deta; - Trk::Surface* surf = CreateUserSurface(CaloCell_ID::EME3,0.,eta, calo_dd); - offset[ie] = surf->center().z()- zbase; - delete surf; + etaMin = 1.35; + etaMax = 3.2; + deta = 0.05; + neta = (etaMax - etaMin) / deta; + offset.resize(neta); + zbase = m_layerEntries[CaloCell_ID::EME3].first->center().z(); + for (unsigned int ie = 0; ie < neta; ie++) { + float eta = etaMin + (ie + 0.5) * deta; + Trk::Surface* surf = CreateUserSurface(CaloCell_ID::EME3, 0., eta, calo_dd); + offset[ie] = surf->center().z() - zbase; + delete surf; } - disc = dynamic_cast<const Trk::DiscSurface*> (m_layerEntries[CaloCell_ID::EME3].first); + disc = dynamic_cast<const Trk::DiscSurface*>( + m_layerEntries[CaloCell_ID::EME3].first); if (!disc) { std::abort(); } @@ -1162,40 +1085,57 @@ void CaloSurfaceBuilder::fill_tg_surfaces() const delete disc; // exit surfaces - for (CaloCell_ID::CaloSample sample = CaloCell_ID::PreSamplerB; sample+1< CaloCell_ID::Unknown; sample = CaloCell_ID::CaloSample(sample+1) ){ - m_layerExits.push_back(m_layerEntries[sample+1]); + for (CaloCell_ID::CaloSample sample = CaloCell_ID::PreSamplerB; + sample + 1 < CaloCell_ID::Unknown; + sample = CaloCell_ID::CaloSample(sample + 1)) { + m_layerExits.push_back(m_layerEntries[sample + 1]); } // fix exit for outer layers - Trk::Surface* lpos = CreateLastSurface(CaloCell_ID::TileBar2,0.,1., calo_dd); - Trk::Surface* lneg = CreateLastSurface(CaloCell_ID::TileBar2,0.,-1., calo_dd); - if (lpos) lpos->setOwner(Trk::TGOwn); - if (lneg) lneg->setOwner(Trk::TGOwn); - m_layerExits[CaloCell_ID::TileBar2]=std::pair<const Trk::Surface*,const Trk::Surface*>(lpos,lneg); - - lpos = CreateLastSurface(CaloCell_ID::TileExt2,0.,1., calo_dd); - lneg = CreateLastSurface(CaloCell_ID::TileExt2,0.,-1., calo_dd); - if (lpos) lpos->setOwner(Trk::TGOwn); + Trk::Surface* lpos = + CreateLastSurface(CaloCell_ID::TileBar2, 0., 1., calo_dd); + Trk::Surface* lneg = + CreateLastSurface(CaloCell_ID::TileBar2, 0., -1., calo_dd); + if (lpos) + lpos->setOwner(Trk::TGOwn); + if (lneg) + lneg->setOwner(Trk::TGOwn); + m_layerExits[CaloCell_ID::TileBar2] = + std::pair<const Trk::Surface*, const Trk::Surface*>(lpos, lneg); + + lpos = CreateLastSurface(CaloCell_ID::TileExt2, 0., 1., calo_dd); + lneg = CreateLastSurface(CaloCell_ID::TileExt2, 0., -1., calo_dd); + if (lpos) + lpos->setOwner(Trk::TGOwn); lneg->setOwner(Trk::TGOwn); - m_layerExits[CaloCell_ID::TileExt2]=std::pair<const Trk::Surface*,const Trk::Surface*>(lpos,lneg); - - lpos = CreateLastSurface(CaloCell_ID::TileGap2,0.,1., calo_dd); - lneg = CreateLastSurface(CaloCell_ID::TileGap2,0.,-1., calo_dd); - if (lpos) lpos->setOwner(Trk::TGOwn); - if (lneg) lneg->setOwner(Trk::TGOwn); - m_layerExits[CaloCell_ID::TileGap2]=std::pair<const Trk::Surface*,const Trk::Surface*>(lpos,lneg); - - lpos = CreateLastSurface(CaloCell_ID::TileGap3,0.,1., calo_dd); - lneg = CreateLastSurface(CaloCell_ID::TileGap3,0.,-1., calo_dd); - if (lpos) lpos->setOwner(Trk::TGOwn); - if (lneg) lneg->setOwner(Trk::TGOwn); - m_layerExits[CaloCell_ID::TileGap3]=std::pair<const Trk::Surface*,const Trk::Surface*>(lpos,lneg); - - lpos = CreateLastSurface(CaloCell_ID::HEC3,0.,1., calo_dd); - lneg = CreateLastSurface(CaloCell_ID::HEC3,0.,-1., calo_dd); - if (lpos) lpos->setOwner(Trk::TGOwn); - if (lneg) lneg->setOwner(Trk::TGOwn); - m_layerExits[CaloCell_ID::HEC3]=std::pair<const Trk::Surface*,const Trk::Surface*>(lpos,lneg); - + m_layerExits[CaloCell_ID::TileExt2] = + std::pair<const Trk::Surface*, const Trk::Surface*>(lpos, lneg); + + lpos = CreateLastSurface(CaloCell_ID::TileGap2, 0., 1., calo_dd); + lneg = CreateLastSurface(CaloCell_ID::TileGap2, 0., -1., calo_dd); + if (lpos) + lpos->setOwner(Trk::TGOwn); + if (lneg) + lneg->setOwner(Trk::TGOwn); + m_layerExits[CaloCell_ID::TileGap2] = + std::pair<const Trk::Surface*, const Trk::Surface*>(lpos, lneg); + + lpos = CreateLastSurface(CaloCell_ID::TileGap3, 0., 1., calo_dd); + lneg = CreateLastSurface(CaloCell_ID::TileGap3, 0., -1., calo_dd); + if (lpos) + lpos->setOwner(Trk::TGOwn); + if (lneg) + lneg->setOwner(Trk::TGOwn); + m_layerExits[CaloCell_ID::TileGap3] = + std::pair<const Trk::Surface*, const Trk::Surface*>(lpos, lneg); + + lpos = CreateLastSurface(CaloCell_ID::HEC3, 0., 1., calo_dd); + lneg = CreateLastSurface(CaloCell_ID::HEC3, 0., -1., calo_dd); + if (lpos) + lpos->setOwner(Trk::TGOwn); + if (lneg) + lneg->setOwner(Trk::TGOwn); + m_layerExits[CaloCell_ID::HEC3] = + std::pair<const Trk::Surface*, const Trk::Surface*>(lpos, lneg); } diff --git a/Calorimeter/CaloUtils/test/CaloLayerCalculator_test.cxx b/Calorimeter/CaloUtils/test/CaloLayerCalculator_test.cxx index 9b74fce2a8351a7d768c3f27bca335756a077974..0001b4b1213cbcd2886ac4af580e085b02f52091 100644 --- a/Calorimeter/CaloUtils/test/CaloLayerCalculator_test.cxx +++ b/Calorimeter/CaloUtils/test/CaloLayerCalculator_test.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration */ /** @@ -148,7 +148,8 @@ const CaloDetDescriptor* make_dd (CaloTester& tester) } -CaloCell* make_cell (const CaloDetDescriptor* descr, +CaloCell* make_cell (CaloTester& tester, + const CaloDetDescriptor* descr, float energy, float eta, float phi) { int ieta = static_cast<int> (eta * (1./deta)); @@ -163,12 +164,13 @@ CaloCell* make_cell (const CaloDetDescriptor* descr, dde->set_cylindric ((double)eta, (double)phi, (double)1000); dde->set_cylindric_raw (eta, phi, 1000); dde->set_cylindric_size (deta, dphi, 1); - const_cast<CaloDetDescrManager*> (CaloDetDescrManager::instance())->add(dde); + tester.mgr().add(dde); return new CaloCell (dde, energy, 0, 0, CaloGain::LARHIGHGAIN); } -void make_cells (CaloCellContainer* cont, +void make_cells (CaloTester& tester, + CaloCellContainer* cont, const CaloDetDescriptor* descr, const Testcell* cells, double eta0, @@ -177,7 +179,8 @@ void make_cells (CaloCellContainer* cont, for (; cells->energy != 0; ++cells) { double phi = static_cast<float> (cells->iphi) * dphi + phi0; double eta = static_cast<float> (cells->ieta) * deta + eta0; - cont->push_back (make_cell (descr, + cont->push_back (make_cell (tester, + descr, cells->energy, static_cast<float> (eta), static_cast<float> (CaloPhiRange::fix (phi)))); @@ -189,12 +192,14 @@ const CaloCellContainer* fill_cells (CaloTester& tester) { const CaloDetDescriptor* descr = make_dd (tester); CaloCellContainer* cells = new CaloCellContainer; - make_cells (cells, + make_cells (tester, + cells, descr, clust1, clust1_eta0, clust1_phi0); - make_cells (cells, + make_cells (tester, + cells, descr, clust2, clust2_eta0, @@ -203,11 +208,11 @@ const CaloCellContainer* fill_cells (CaloTester& tester) } -void test1 (const CaloCellContainer* cells) +void test1 (const CaloCellContainer* cells, + const CaloDetDescrManager* mgr) { CaloLayerCalculator calc; - const CaloDetDescrManager* mgr=CaloDetDescrManager::instance(); assert( calc.fill (*mgr,cells, clust1_eta0, clust1_phi0, 5*deta, 5*dphi, CaloSampling::EMB2) ); clust1_check (calc); @@ -248,11 +253,10 @@ int main() assert ( svcLoc->service("StoreGateSvc", sg).isSuccess() ); CaloTester tester; - assert ( tester.record_mgr() ); const CaloCellContainer* cells = fill_cells (tester); assert (sg->record (cells, "cells").isSuccess()); - test1(cells); + test1(cells,&tester.mgr()); return 0; } diff --git a/Control/AthContainers/Root/AuxVectorData.cxx b/Control/AthContainers/Root/AuxVectorData.cxx index 6d0c881998fc41e64c3af873ffeb5b021dcc4c66..329a2fadc75676a8b784f4d5d20998acf162e551 100644 --- a/Control/AthContainers/Root/AuxVectorData.cxx +++ b/Control/AthContainers/Root/AuxVectorData.cxx @@ -380,8 +380,11 @@ void* AuxVectorData::getDecorationOol (SG::auxid_t auxid) const // Fetch the pointer from the store, or raise an exception if we don't // have a non-const store. void* ptr = 0; - if (m_store) - ptr = m_store->getDecoration (auxid, this->size_v(), this->capacity_v()); + if (m_store) { + // Avoid warning about calling non-const function. OK here. + IAuxStore* store ATLAS_THREAD_SAFE = m_store; + ptr = store->getDecoration (auxid, this->size_v(), this->capacity_v()); + } else if (getConstStore()) { // The whole point of decorations is to allow adding information to // something that's otherwise const. So we have the const_cast here. @@ -562,7 +565,9 @@ bool AuxVectorData::clearDecorations() const { bool ret = false; if (m_store) { - ret = m_store->clearDecorations(); + // Avoid warning about calling non-const function. OK here. + IAuxStore* store ATLAS_THREAD_SAFE = m_store; + ret = store->clearDecorations(); m_cache.clear(); m_constCache.clear(); m_decorCache.clear(); diff --git a/Control/StoreGateBindings/python/Bindings.py b/Control/StoreGateBindings/python/Bindings.py index 9797e0490a0b5680d9a634963ee8259d10f35c4c..7143a7b2afc826149054e95d22d1f4e3cd28dbf3 100644 --- a/Control/StoreGateBindings/python/Bindings.py +++ b/Control/StoreGateBindings/python/Bindings.py @@ -54,7 +54,6 @@ def _setup(): # add specialized contains method def contains( self, klass_or_clid, key ): - print ("---- StoreGateSvc.contains() ", klass_or_clid, key) from builtins import int if isinstance(klass_or_clid, str): try: diff --git a/Database/IOVDbSvc/src/IOVDbSvc.cxx b/Database/IOVDbSvc/src/IOVDbSvc.cxx index 01354ce86fa8a250fb57f7cc680aad1afe71358c..e27ddcabc63cbfd23da13a077aa81a26ac5f995b 100644 --- a/Database/IOVDbSvc/src/IOVDbSvc.cxx +++ b/Database/IOVDbSvc/src/IOVDbSvc.cxx @@ -537,7 +537,8 @@ StatusCode IOVDbSvc::updateAddress(StoreID::type storeID, SG::TransientAddress* // reload cache for this folder (and all others sharing this DB connection) ATH_MSG_DEBUG( "Triggering cache load for folder " << folder->folderName()); if (StatusCode::SUCCESS!=loadCaches(folder->conn())) { - ATH_MSG_ERROR( "Cache load failed for folder " << folder->folderName() ); + ATH_MSG_ERROR( "Cache load failed for at least one folder from " << folder->conn()->name() + << ". You may see errors from other folders sharing the same connection." ); return StatusCode::FAILURE; } } @@ -630,7 +631,8 @@ StatusCode IOVDbSvc::getRange( const CLID& clid, // reload cache for this folder (and all others sharing this DB connection) ATH_MSG_DEBUG( "Triggering cache load for folder " << folder->folderName() ); if (StatusCode::SUCCESS!=loadCaches(folder->conn(),&time)) { - ATH_MSG_ERROR( "Cache load failed for folder " << folder->folderName() ); + ATH_MSG_ERROR( "Cache load failed for at least one folder from " << folder->conn()->name() + << ". You may see errors from other folders sharing the same connection." ); return StatusCode::FAILURE; } } diff --git a/DetectorDescription/GeoModel/GeoModelExamples/GeoModelExamples/ATLAS_CHECK_THREAD_SAFETY b/DetectorDescription/GeoModel/GeoModelExamples/GeoModelExamples/ATLAS_CHECK_THREAD_SAFETY new file mode 100644 index 0000000000000000000000000000000000000000..29c21961948aa5975ea7c5eafb9a26d48b3d0552 --- /dev/null +++ b/DetectorDescription/GeoModel/GeoModelExamples/GeoModelExamples/ATLAS_CHECK_THREAD_SAFETY @@ -0,0 +1 @@ +DetectorDescription/GeoModel/GeoModelExamples diff --git a/DetectorDescription/GeoModel/GeoModelExamples/src/ToyDetectorTool.cxx b/DetectorDescription/GeoModel/GeoModelExamples/src/ToyDetectorTool.cxx index d780fb296a7787bfb0475c12412a64f263e52082..cc24b6dafa6371b651e916220e254a5912e33d14 100755 --- a/DetectorDescription/GeoModel/GeoModelExamples/src/ToyDetectorTool.cxx +++ b/DetectorDescription/GeoModel/GeoModelExamples/src/ToyDetectorTool.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration */ #ifndef BUILDVP1LIGHT @@ -60,9 +60,8 @@ StatusCode ToyDetectorTool::create() return StatusCode::FAILURE; } -void ToyDetectorTool::printVolume(GeoPVConstLink volume) +void ToyDetectorTool::printVolume(GeoPVConstLink volume, int level /*= 0*/) { - static int level{0}; GeoVolumeCursor cursor(volume); while(!cursor.atEnd()) { GeoPVConstLink physChild = cursor.getVolume(); @@ -76,9 +75,7 @@ void ToyDetectorTool::printVolume(GeoPVConstLink volume) } std::cout << "\n"; } - level++; - printVolume(physChild); - level--; + printVolume(physChild, level+1); cursor.next(); } } diff --git a/DetectorDescription/GeoModel/GeoModelExamples/src/ToyDetectorTool.h b/DetectorDescription/GeoModel/GeoModelExamples/src/ToyDetectorTool.h index bcc2c2a1992202deb5defb8a3845d00a09fa909f..96c524f46b2ba8f46b792b14740977d698f873b8 100755 --- a/DetectorDescription/GeoModel/GeoModelExamples/src/ToyDetectorTool.h +++ b/DetectorDescription/GeoModel/GeoModelExamples/src/ToyDetectorTool.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration */ #ifndef GEOMODELEXAMPLES_TOYDETECTORTOOL_H @@ -18,7 +18,7 @@ class ToyDetectorTool final : public GeoModelTool virtual StatusCode create() override final; private: - void printVolume(GeoPVConstLink volime); + void printVolume(GeoPVConstLink volime, int level = 0); }; #endif // BUILDVP1LIGHT diff --git a/DetectorDescription/GeoModel/GeoModelSvc/CMakeLists.txt b/DetectorDescription/GeoModel/GeoModelSvc/CMakeLists.txt index a733e4297d7dbeb44f0985add8a33bf51798fdfd..6b3383a704efaa8a602f87957d69b55512c0c40a 100644 --- a/DetectorDescription/GeoModel/GeoModelSvc/CMakeLists.txt +++ b/DetectorDescription/GeoModel/GeoModelSvc/CMakeLists.txt @@ -5,11 +5,12 @@ atlas_subdir( GeoModelSvc ) # External dependencies: find_package( GeoModel COMPONENTS GeoModelKernel GeoModelDBManager GeoModelRead) +find_package( Boost ) # Component(s) in the package: atlas_add_component( GeoModelSvc src/*.h src/*.cxx src/components/*.cxx - INCLUDE_DIRS ${GEOMODEL_INCLUDE_DIRS} + INCLUDE_DIRS ${GEOMODEL_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS} LINK_LIBRARIES ${GEOMODEL_LIBRARIES} AthenaBaseComps AthenaKernel SGTools StoreGateLib GeoModelInterfaces GeoModelUtilities GaudiKernel RDBAccessSvcLib EventInfoMgtLib ) diff --git a/DetectorDescription/GeoModel/GeoModelSvc/src/GeoModelSvc.cxx b/DetectorDescription/GeoModel/GeoModelSvc/src/GeoModelSvc.cxx index 39543a4c14322e0c4a577d91613c38ca8cd7f6dc..4e5d2b754ee2f432b3322cf23481956003b015a9 100755 --- a/DetectorDescription/GeoModel/GeoModelSvc/src/GeoModelSvc.cxx +++ b/DetectorDescription/GeoModel/GeoModelSvc/src/GeoModelSvc.cxx @@ -614,12 +614,9 @@ StatusCode GeoModelSvc::fillTagInfo() const const IGeoModelTool* GeoModelSvc::getTool(std::string toolName) const { - ToolHandleArray< IGeoModelTool >::const_iterator itPriv = m_detectorTools.begin(); - - for(; itPriv!=m_detectorTools.end(); itPriv++) { - const IGeoModelTool* theTool = &(**itPriv); - if(theTool->name().find(toolName)!=std::string::npos) - return theTool; + for (const ToolHandle<IGeoModelTool>& tool : m_detectorTools) { + if(tool->name().find(toolName)!=std::string::npos) + return tool.get(); } return 0; @@ -630,37 +627,34 @@ StatusCode GeoModelSvc::clear() ATH_MSG_DEBUG("In clear()"); // Call clear() for all tools - ToolHandleArray< IGeoModelTool >::iterator itPriv = m_detectorTools.begin(); - for(; itPriv!=m_detectorTools.end(); itPriv++) { - IGeoModelTool* theTool = &(**itPriv); - if(theTool->clear().isFailure()) { - ATH_MSG_ERROR("clear() failed for the tool: " << theTool->name()); + for (ToolHandle<IGeoModelTool>& tool : m_detectorTools) { + if(tool->clear().isFailure()) { + ATH_MSG_ERROR("clear() failed for the tool: " << tool->name()); return StatusCode::FAILURE; } else { - ATH_MSG_DEBUG(theTool->name() << " tool released"); + ATH_MSG_DEBUG(tool->name() << " tool released"); } } // Delete GeoModelExperiment - cascade delete of the entire GeoModel tree - std::vector<std::string>::const_iterator it; std::vector<std::string> sgkeysExp; m_detStore->keys<GeoModelExperiment>(sgkeysExp); - for(it=sgkeysExp.begin(); it!=sgkeysExp.end(); it++) { - SG::DataProxy* proxy = m_detStore->proxy(ClassID_traits<GeoModelExperiment>::ID(),*it); + for (const std::string& key : sgkeysExp) { + SG::DataProxy* proxy = m_detStore->proxy(ClassID_traits<GeoModelExperiment>::ID(),key); if(proxy) { proxy->reset(); - ATH_MSG_DEBUG(*it << " GeoModel experiment released"); + ATH_MSG_DEBUG(key << " GeoModel experiment released"); } } // Release stored material manager std::vector<std::string> sgkeysMat; m_detStore->keys<StoredMaterialManager>(sgkeysMat); - for(it=sgkeysMat.begin(); it!=sgkeysMat.end(); it++) { - SG::DataProxy* proxy = m_detStore->proxy(ClassID_traits<StoredMaterialManager>::ID(),*it); + for (const std::string& key : sgkeysMat) { + SG::DataProxy* proxy = m_detStore->proxy(ClassID_traits<StoredMaterialManager>::ID(),key); if(proxy) { proxy->reset(); - ATH_MSG_DEBUG(*it << " material manager released"); + ATH_MSG_DEBUG(key << " material manager released"); } } diff --git a/DetectorDescription/GeoModel/GeoModelSvc/src/RDBMaterialManager.cxx b/DetectorDescription/GeoModel/GeoModelSvc/src/RDBMaterialManager.cxx index 2b0b36ca6a96cf371b9badef05ff36778beff4c4..1c2bca66f56dc224b69caa973c121ab8d3ee7ffc 100755 --- a/DetectorDescription/GeoModel/GeoModelSvc/src/RDBMaterialManager.cxx +++ b/DetectorDescription/GeoModel/GeoModelSvc/src/RDBMaterialManager.cxx @@ -22,6 +22,7 @@ #include "GaudiKernel/MsgStream.h" #include "GaudiKernel/SystemOfUnits.h" #include "AthenaBaseComps/AthCheckMacros.h" +#include "boost/algorithm/string/predicate.hpp" #include <algorithm> #include <iostream> @@ -325,12 +326,14 @@ StatusCode RDBMaterialManager::readMaterialsFromDB(ISvcLocator* pSvcLocator) RDBMaterialManager::~RDBMaterialManager() { // Unreference the materials: - std::map< std::string, GeoMaterial * >::iterator m, begin = m_materialMap.begin(),end = m_materialMap.end(); - for (m=begin;m!=end;m++) (*m).second->unref(); + for (auto &p : m_materialMap) { + p.second->unref(); + } // Unreference the elements: - for (size_t i=0;i<m_elementVector.size();i++) m_elementVector[i]->unref(); - + for (GeoElement *elt : m_elementVector) { + elt->unref(); + } } GeoMaterial* RDBMaterialManager::searchMaterialMap(const std::string & name) const @@ -435,78 +438,78 @@ const GeoMaterial* RDBMaterialManager:: getMaterial(const std::string &name) co pmaterial = searchMaterialMap( name); if (pmaterial!= NULL) return pmaterial; - - if(name.find("std",0) == 0) + + if(boost::starts_with(name, "std")) { detector = "std"; tmp_materials = m_stdmaterials; tmp_matcomponents = m_stdmatcomponents; data_id = "STDMATERIALS_DATA_ID"; } - else if(name.find("trt",0) == 0) + else if(boost::starts_with(name, "trt")) { detector = "trt"; tmp_materials = m_trtmaterials; tmp_matcomponents = m_trtmatcomponents; data_id = "TRTMATERIALS_DATA_ID"; } - else if(name.find("LAr",0) == 0) + else if(boost::starts_with(name, "LAr")) { detector = "LAr"; tmp_materials = m_larmaterials; tmp_matcomponents = m_larmatcomponents; data_id = "LARMATERIALS_DATA_ID"; } - else if(name.find("muo",0) == 0) + else if(boost::starts_with(name, "muo")) { detector = "muo"; tmp_materials = m_muomaterials; tmp_matcomponents = m_muomatcomponents; data_id = "MUOMATERIALS_DATA_ID"; } - else if(name.find("pixtb",0) == 0) + else if(boost::starts_with(name, "pixtb")) { detector = "pixtb"; tmp_materials = m_pixtbmaterials; tmp_matcomponents = m_pixtbmatcomponents; data_id = "PIXELTBMATERIALS_DATA_ID"; } - else if(name.find("pix",0) == 0) + else if(boost::starts_with(name, "pix")) { detector = "pix"; tmp_materials = m_pixmaterials; tmp_matcomponents = m_pixmatcomponents; data_id = "PIXMATERIALS_DATA_ID"; } - else if(name.find("sct",0) == 0) + else if(boost::starts_with(name, "sct")) { detector = "sct"; tmp_materials = m_sctmaterials; tmp_matcomponents = m_sctmatcomponents; data_id = "SCTMATERIALS_DATA_ID"; } - else if(name.find("indet",0) == 0) + else if(boost::starts_with(name, "indet")) { detector = "indet"; tmp_materials = m_indetmaterials; tmp_matcomponents = m_indetmatcomponents; data_id = "INDETMATERIALS_DATA_ID"; } - else if(name.find("shield",0) == 0) + else if(boost::starts_with(name, "shield")) { detector = "shield"; tmp_materials = m_shieldmaterials; tmp_matcomponents = m_shieldmatcomponents; data_id = "SHIELDMATERIALS_DATA_ID"; } - else if(name.find("tile",0) == 0) + else if(boost::starts_with(name, "tile")) { detector = "tile"; tmp_materials = m_tilematerials; tmp_matcomponents = m_tilematcomponents; data_id = "TILEMATERIALS_DATA_ID"; } - else if(name.find("toro",0) == 0) + else if(boost::starts_with(name, "toro")) { detector = "toro"; tmp_materials = m_toromaterials; @@ -727,19 +730,17 @@ size_t RDBMaterialManager::size() std::ostream & RDBMaterialManager::printAll(std::ostream & o) const { o << "============Material Manager Element List========================" << std::endl; - std::vector<GeoElement *>::const_iterator e; - for (e=m_elementVector.begin();e!= m_elementVector.end();e++) + for (GeoElement* elt : m_elementVector) { - o << (*e)->getSymbol() << '\t' << (*e)->getZ() << '\t' << (*e)->getA() * (Gaudi::Units::mole / GeoModelKernelUnits::gram) << '\t' << (*e)->getName() << std::endl; + o << elt->getSymbol() << '\t' << elt->getZ() << '\t' << elt->getA() * (Gaudi::Units::mole / GeoModelKernelUnits::gram) << '\t' << elt->getName() << std::endl; } - std::map<std::string, GeoMaterial *>::const_iterator m; - - for (m=m_materialMap.begin();m!=m_materialMap.end();m++) + + for (const auto& p : m_materialMap) { - o << "Material: " << (*m).first << " Density " << (*m).second->getDensity() * (Gaudi::Units::cm3 / GeoModelKernelUnits::gram) << std::endl; - for (size_t i = 0; i< (*m).second->getNumElements();i++) + o << "Material: " << p.first << " Density " << p.second->getDensity() * (Gaudi::Units::cm3 / GeoModelKernelUnits::gram) << std::endl; + for (size_t i = 0; i< p.second->getNumElements();i++) { - o <<" ***** ***** "<< int ((*m).second->getFraction(i)*100) << "% \t" << (*m).second->getElement(i)->getName() << std::endl; + o <<" ***** ***** "<< int (p.second->getFraction(i)*100) << "% \t" << p.second->getElement(i)->getName() << std::endl; } } diff --git a/Generators/EvgenProdTools/src/FixHepMC.cxx b/Generators/EvgenProdTools/src/FixHepMC.cxx index 4ad8a1590c05b9cee2035d659a435e280a06c995..b06dc877dd5595cf5485fa58c6398feb5735c531 100644 --- a/Generators/EvgenProdTools/src/FixHepMC.cxx +++ b/Generators/EvgenProdTools/src/FixHepMC.cxx @@ -63,7 +63,7 @@ StatusCode FixHepMC::execute() { // SHERPA has problems with bad beam particles. 16.11.2021 auto beams_t = evt->beams(); - if (beams_t.size() != 2) { + if (beams_t.size() > 2) { ATH_MSG_INFO("Invalid number of beam particles " << beams_t.size() << ". Will try to fix."); std::vector<HepMC::GenParticlePtr> bparttoremove; for (auto bpart: beams_t) if (bpart->id() == 0 && bpart->production_vertex()) bparttoremove.push_back(bpart); diff --git a/Generators/ParticleGun/python/__init__.py b/Generators/ParticleGun/python/__init__.py index 4e88fc56c49679a210ad57b62055a6a7c0867ddd..509d4cb5c9fc777527e477c943c8369a265bbd77 100644 --- a/Generators/ParticleGun/python/__init__.py +++ b/Generators/ParticleGun/python/__init__.py @@ -74,8 +74,10 @@ class ParticleGun(EvgenAlg): # TODO: allow weighted sampling? try: from AthenaPython.PyAthena import HepMC3 as HepMC + GeVtoMeV = 1000 except ImportError: - from AthenaPython.PyAthena import HepMC as HepMC + from AthenaPython.PyAthena import HepMC as HepMC + GeVtoMeV = 1 evt.weights().push_back(1.0) ## Make and fill particles @@ -96,13 +98,13 @@ class ParticleGun(EvgenAlg): evt.add_vertex(gv) ## Make particle with status == 1 - mom = HepMC.FourVector(p.mom.Px(), p.mom.Py(), p.mom.Pz(), p.mom.E()) + mom = HepMC.FourVector(p.mom.Px()*GeVtoMeV, p.mom.Py()*GeVtoMeV, p.mom.Pz()*GeVtoMeV, p.mom.E()*GeVtoMeV) gp = HepMC.GenParticle() gp.set_status(1) gp.set_pdg_id(p.pid) gp.set_momentum(mom) if p.mass is not None: - gp.set_generated_mass(p.mass) + gp.set_generated_mass(p.mass*GeVtoMeV) ROOT.SetOwnership(gp, False) gv.add_particle_out(gp) diff --git a/InnerDetector/InDetMonitoring/InDetGlobalMonitoringRun3Test/python/InDetGlobalMonitoringRun3TestConfig.py b/InnerDetector/InDetMonitoring/InDetGlobalMonitoringRun3Test/python/InDetGlobalMonitoringRun3TestConfig.py index 9019ff62ea9b1702acf8af96258de73a10585069..59eaa183618852e6f0cceceb0840984aaec9b8fb 100644 --- a/InnerDetector/InDetMonitoring/InDetGlobalMonitoringRun3Test/python/InDetGlobalMonitoringRun3TestConfig.py +++ b/InnerDetector/InDetMonitoring/InDetGlobalMonitoringRun3Test/python/InDetGlobalMonitoringRun3TestConfig.py @@ -78,9 +78,8 @@ def InDetGlobalMonitoringRun3TestConfig(flags): inDetGlobalLRTMonAlg.TrackSelectionTool = CompFactory.InDet.InDetTrackSelectionTool('InDetGlobalLRTMonAlg_TrackSelectionTool') inDetGlobalLRTMonAlg.TrackSelectionTool.UseTrkTrackTools = True - inDetGlobalLRTMonAlg.TrackSelectionTool.CutLevel = "TightPrimary" inDetGlobalLRTMonAlg.TrackSelectionTool.maxNPixelHoles = 1 - inDetGlobalLRTMonAlg.TrackSelectionTool.minPt = 5000 + inDetGlobalLRTMonAlg.TrackSelectionTool.minPt = 1000 from InDetConfig.TrackingCommonConfig import InDetTrackSummaryToolCfg InDetTrackSummaryTool = acc.getPrimaryAndMerge(InDetTrackSummaryToolCfg(flags)) diff --git a/InnerDetector/InDetRecAlgs/InDetExtensionProcessor/src/InDetExtensionProcessor.cxx b/InnerDetector/InDetRecAlgs/InDetExtensionProcessor/src/InDetExtensionProcessor.cxx index 2962ab4254e8129c3646531bfc2b3b8b035fca92..c41ed158a10ead0512238c4eb6231af7d444df5d 100644 --- a/InnerDetector/InDetRecAlgs/InDetExtensionProcessor/src/InDetExtensionProcessor.cxx +++ b/InnerDetector/InDetRecAlgs/InDetExtensionProcessor/src/InDetExtensionProcessor.cxx @@ -15,7 +15,6 @@ #include "TrkPrepRawData/PrepRawData.h" #include "TrkRIO_OnTrack/RIO_OnTrack.h" #include "TrkToolInterfaces/ITrackScoringTool.h" -#include "TrkTrack/TrackStateOnSurfaceContainer.h" #include <algorithm> //for std::transform #include <cmath> //for std::abs #include <functional> //for std::plus<> @@ -439,21 +438,23 @@ InDet::InDetExtensionProcessor::trackPlusExtension( const std::vector<const Trk::MeasurementBase*>& extension) const { const auto& trackStatesOnSurfaces{ *(siTrack->trackStateOnSurfaces()) }; - auto pExtendedTrajectory = Trk::TrackStateOnSurfaceProtContainer::make_unique(); + auto pExtendedTrajectory = DataVector<const Trk::TrackStateOnSurface>(); - pExtendedTrajectory->reserve(trackStatesOnSurfaces.size() + extension.size()); + pExtendedTrajectory.reserve(trackStatesOnSurfaces.size() + extension.size()); int nSiStates = 0, nExtStates = 0; // copy existing si track as first part to new track - including all track pars since fit does not change - for (const Trk::TrackStateOnSurface* ptsos : trackStatesOnSurfaces) { - pExtendedTrajectory->push_back (pExtendedTrajectory->allocate (*ptsos)); - } + auto cloneTSOS = [](const Trk::TrackStateOnSurface* pTSOS) { + return new Trk::TrackStateOnSurface(*pTSOS); + }; + std::transform(trackStatesOnSurfaces.begin(), trackStatesOnSurfaces.end(), std::back_inserter( + pExtendedTrajectory), cloneTSOS); nSiStates += trackStatesOnSurfaces.size(); // copy proposed (but failed) extension as second part onto new track - all hits flagged as outliers. constexpr auto outlierDigit {1 << Trk::TrackStateOnSurface::Outlier}; constexpr std::bitset<Trk::TrackStateOnSurface::NumberOfTrackStateOnSurfaceTypes> outlierPattern(outlierDigit); //create new track state on surface - auto createNewTSOS = [outlierPattern, &pExtendedTrajectory](const Trk::MeasurementBase* pm) { - return pExtendedTrajectory->allocate(pm->uniqueClone(), nullptr, nullptr, nullptr, outlierPattern); + auto createNewTSOS = [outlierPattern](const Trk::MeasurementBase* pm) -> const Trk::TrackStateOnSurface*{ + return new Trk::TrackStateOnSurface(pm->uniqueClone(), nullptr, nullptr, nullptr, outlierPattern); }; //Adding to cosmic tracks beginning or end depending on the direction of track auto addNewTSOS_ForCosmics = [&pExtendedTrajectory, siTrack, createNewTSOS](const Trk::MeasurementBase* pm) { @@ -462,25 +463,22 @@ InDet::InDetExtensionProcessor::trackPlusExtension( const double inprod = (pm->associatedSurface().center() - perigee->position()).dot( perigee->momentum()); if (inprod < 0) { - pExtendedTrajectory->insert(pExtendedTrajectory->begin(), createNewTSOS(pm)); + pExtendedTrajectory.insert(pExtendedTrajectory.begin(), createNewTSOS(pm)); } else { - pExtendedTrajectory->push_back(createNewTSOS(pm)); + pExtendedTrajectory.push_back(createNewTSOS(pm)); } }; //actual copying done here, using preceding lambda functions if (not m_cosmics) { - for (const Trk::MeasurementBase* m : extension) { - pExtendedTrajectory->push_back (createNewTSOS (m)); - } + std::transform(extension.begin(), extension.end(), std::back_inserter(pExtendedTrajectory), createNewTSOS); } else { //difficult to use std::transform here, since don't know whether back or front are added to for (const auto *const pMeasurementBase: extension) { addNewTSOS_ForCosmics(pMeasurementBase); } } - nExtStates += pExtendedTrajectory->size(); + nExtStates += pExtendedTrajectory.size(); const auto& pFitQuality {siTrack->fitQuality()}; - pExtendedTrajectory->elt_allocator().protect(); Trk::Track* extTrack = new Trk::Track(siTrack->info(), std::move(pExtendedTrajectory), (pFitQuality ? pFitQuality->clone() : nullptr)); if (m_trackSummaryTool.isEnabled()) { diff --git a/InnerDetector/InDetRecTools/InDetConversionFinderTools/src/ConversionFinderUtils.cxx b/InnerDetector/InDetRecTools/InDetConversionFinderTools/src/ConversionFinderUtils.cxx index 72416007ab7f2040508e06ba869006d7bc68c93b..d1f749d36dc0835c7e087681d0e9396ff722d0da 100644 --- a/InnerDetector/InDetRecTools/InDetConversionFinderTools/src/ConversionFinderUtils.cxx +++ b/InnerDetector/InDetRecTools/InDetConversionFinderTools/src/ConversionFinderUtils.cxx @@ -17,7 +17,6 @@ #include "InDetPrepRawData/TRT_DriftCircle.h" #include "InDetPrepRawData/SiCluster.h" #include "TrkTrack/Track.h" -#include "TrkTrack/TrackStateOnSurfaceContainer.h" #include "VxVertex/VxTrackAtVertex.h" #include <cmath> @@ -241,28 +240,23 @@ namespace InDet { if(!fq) return nullptr; // output datavector of TSOS + auto ntsos = DataVector<const Trk::TrackStateOnSurface>(); const DataVector<const Trk::TrackStateOnSurface>* tsos = track->trackStateOnSurfaces(); if(!tsos) {return nullptr;} - auto ntsos = Trk::TrackStateOnSurfaceProtContainer::make_unique(); - ntsos->reserve (tsos->size()); DataVector<const Trk::TrackStateOnSurface>::const_iterator its,itse = tsos->end(); for(its=tsos->begin();its!=itse;++its) { std::bitset<Trk::TrackStateOnSurface::NumberOfTrackStateOnSurfaceTypes> typePattern; typePattern.set(Trk::TrackStateOnSurface::Perigee); - const Trk::TrackStateOnSurface* p_tsos = *its; - // We only support containers containing exactly TSOS. - if (strcmp (typeid(*p_tsos).name(), typeid(Trk::TrackStateOnSurface).name()) != 0) std::abort(); - Trk::TrackStateOnSurfaceProtContainer::Ptr per_tsos = - (p_tsos->type(Trk::TrackStateOnSurface::Perigee)) - ? ntsos->allocate(nullptr, mp->uniqueClone(), nullptr, nullptr, typePattern) - : ntsos->allocate(*p_tsos); - ntsos->push_back(std::move(per_tsos)); + const Trk::TrackStateOnSurface* per_tsos = + ((*its)->type(Trk::TrackStateOnSurface::Perigee)) + ? new Trk::TrackStateOnSurface(nullptr, mp->uniqueClone(), nullptr, nullptr, typePattern) + : (*its)->clone(); + ntsos.push_back(per_tsos); } //Construct the new track Trk::TrackInfo info; - ntsos->elt_allocator().protect(); Trk::Track* newTrk = new Trk::Track(info, std::move(ntsos), fq); return newTrk; } diff --git a/InnerDetector/InDetRecTools/SeedToTrackConversionTool/src/SeedToTrackConversionTool.cxx b/InnerDetector/InDetRecTools/SeedToTrackConversionTool/src/SeedToTrackConversionTool.cxx index 9be06cf4256a402816c0eb9fd0719bfaedaba83f..3a4a66551fead03ffde5ac692ab7347f77c184c0 100644 --- a/InnerDetector/InDetRecTools/SeedToTrackConversionTool/src/SeedToTrackConversionTool.cxx +++ b/InnerDetector/InDetRecTools/SeedToTrackConversionTool/src/SeedToTrackConversionTool.cxx @@ -13,7 +13,6 @@ #include "SiSPSeededTrackFinderData/SeedToTrackConversionData.h" #include "StoreGate/WriteHandle.h" #include "TrkRIO_OnTrack/RIO_OnTrack.h" -#include "TrkTrack/TrackStateOnSurfaceContainer.h" #include <iomanip> #include <iostream> @@ -113,10 +112,9 @@ void InDet::SeedToTrackConversionTool::executeSiSPSeedSegments(SeedToTrackConver if (per) { std::bitset<Trk::TrackStateOnSurface::NumberOfTrackStateOnSurfaceTypes> typePattern; typePattern.set(Trk::TrackStateOnSurface::Perigee); - auto traj = Trk::TrackStateOnSurfaceProtContainer::make_unique(); - auto pertsos = traj->allocate(nullptr, std::move(per), nullptr, nullptr, typePattern); - traj->reserve (prdsInSp.size() + 1); - traj->push_back(std::move(pertsos)); + const Trk::TrackStateOnSurface* pertsos = new Trk::TrackStateOnSurface(nullptr, std::move(per), nullptr, nullptr, typePattern); + auto traj = DataVector<const Trk::TrackStateOnSurface>(); + traj.push_back(pertsos); for (const Trk::PrepRawData* prd: prdsInSp) { const Trk::Surface& surf = prd->detectorElement()->surface(prd->identify()); std::unique_ptr<const Trk::TrackParameters> thispar(m_extrapolator->extrapolate(*prevpar, surf, Trk::alongMomentum, false, Trk::nonInteracting)); @@ -125,8 +123,8 @@ void InDet::SeedToTrackConversionTool::executeSiSPSeedSegments(SeedToTrackConver typePattern.set(Trk::TrackStateOnSurface::Measurement); std::unique_ptr<const Trk::RIO_OnTrack> rot(m_rotcreator->correct(*prd, *thispar)); if (rot) { - auto tsos = traj->allocate(std::move(rot), thispar->uniqueClone(), nullptr, nullptr, typePattern); - traj->push_back(std::move(tsos)); + const Trk::TrackStateOnSurface* tsos = new Trk::TrackStateOnSurface(std::move(rot), thispar->uniqueClone(), nullptr, nullptr, typePattern); + traj.push_back(tsos); prevpar = std::move(thispar); } } @@ -134,7 +132,6 @@ void InDet::SeedToTrackConversionTool::executeSiSPSeedSegments(SeedToTrackConver if (mtrk>0) { // survived seeds set as data.trackInfo().setTrackFitter(Trk::TrackInfo::xKalman); // xk seedfinder } - traj->elt_allocator().protect(); Trk::Track* t = new Trk::Track(data.trackInfo(), std::move(traj), nullptr); if (t) data.seedSegmentsCollection()->push_back(t); } diff --git a/InnerDetector/InDetRecTools/TRT_TrackExtensionTool_xk/src/TRT_Trajectory_xk.cxx b/InnerDetector/InDetRecTools/TRT_TrackExtensionTool_xk/src/TRT_Trajectory_xk.cxx index 4483a261e7ca314b07f7f2237943387504bb369e..b9c4d7744c477635252de2a499f38653a3714b09 100755 --- a/InnerDetector/InDetRecTools/TRT_TrackExtensionTool_xk/src/TRT_Trajectory_xk.cxx +++ b/InnerDetector/InDetRecTools/TRT_TrackExtensionTool_xk/src/TRT_Trajectory_xk.cxx @@ -10,7 +10,6 @@ #include "TRT_TrackExtensionTool_xk/TRT_Trajectory_xk.h" #include "TrkRIO_OnTrack/RIO_OnTrack.h" #include "TrkTrack/Track.h" -#include "TrkTrack/TrackStateOnSurfaceContainer.h" /////////////////////////////////////////////////////////////////// // Set TRT detector manager @@ -928,15 +927,14 @@ Trk::Track* InDet::TRT_Trajectory_xk::convert(const Trk::Track& Tr) // Fill new track information // - auto tsosn = Trk::TrackStateOnSurfaceProtContainer::make_unique(); - tsosn->reserve (2 + tsos->size() + m_lastTrajectory - m_firstTrajectory); + auto tsosn = DataVector<const Trk::TrackStateOnSurface>(); - tsosn->push_back(tsosn->allocate(nullptr,Tp.convert(true),nullptr,nullptr,(*s)->types())); + tsosn.push_back(new Trk::TrackStateOnSurface(nullptr,Tp.convert(true),nullptr,nullptr,(*s)->types())); // Copy old information to new track // for(++s; s!=se; ++s) { - tsosn->push_back(tsosn->allocate(*(*s))); + tsosn.push_back(new Trk::TrackStateOnSurface(*(*s))); } // Add new information from TRT without parameters @@ -946,7 +944,7 @@ Trk::Track* InDet::TRT_Trajectory_xk::convert(const Trk::Track& Tr) if(mb) { std::bitset<Trk::TrackStateOnSurface::NumberOfTrackStateOnSurfaceTypes> typePattern; typePattern.set(Trk::TrackStateOnSurface::Measurement); - tsosn->push_back(tsosn->allocate(std::move(mb),nullptr,nullptr,nullptr,typePattern)); + tsosn.push_back(new Trk::TrackStateOnSurface(std::move(mb),nullptr,nullptr,nullptr,typePattern)); } } @@ -956,8 +954,8 @@ Trk::Track* InDet::TRT_Trajectory_xk::convert(const Trk::Track& Tr) if(mb) { std::bitset<Trk::TrackStateOnSurface::NumberOfTrackStateOnSurfaceTypes> typePattern; typePattern.set(Trk::TrackStateOnSurface::Measurement); - tsosn->push_back - (tsosn->allocate(std::move(mb),m_parameters.convert(true),nullptr,nullptr,typePattern)); + tsosn.push_back + (new Trk::TrackStateOnSurface(std::move(mb),m_parameters.convert(true),nullptr,nullptr,typePattern)); } // New fit quality production @@ -968,7 +966,6 @@ Trk::Track* InDet::TRT_Trajectory_xk::convert(const Trk::Track& Tr) m_ndf+= fqo->numberDoF (); } Trk::FitQuality* fq = new Trk::FitQuality(m_xi2,m_ndf); - tsosn->elt_allocator().protect(); return new Trk::Track (Tr.info(),std::move(tsosn),fq); } diff --git a/InnerDetector/InDetValidation/InDetTrackValidation/src/HoleSearchValidation.cxx b/InnerDetector/InDetValidation/InDetTrackValidation/src/HoleSearchValidation.cxx index 81633e32bd03dccd74dabaa60fd78adc4155e7fd..4111ebdb4b2b344a37da223411d764ee7d6f0bea 100755 --- a/InnerDetector/InDetValidation/InDetTrackValidation/src/HoleSearchValidation.cxx +++ b/InnerDetector/InDetValidation/InDetTrackValidation/src/HoleSearchValidation.cxx @@ -11,7 +11,6 @@ #include "GaudiKernel/MsgStream.h" // Trk #include "TrkTrack/Track.h" -#include "TrkTrack/TrackStateOnSurfaceContainer.h" #include "TrkToolInterfaces/ITrackHoleSearchTool.h" @@ -188,8 +187,7 @@ StatusCode HoleSearchValidation::execute(const EventContext& ctx) const { // perform hole search unsigned int oldHoles = doHoleSearch( *trackIterator ); - auto vecTsos = Trk::TrackStateOnSurfaceProtContainer::make_unique(); - vecTsos->reserve (tsos->size()); + auto vecTsos = DataVector<const Trk::TrackStateOnSurface>(); // loop over TSOS, copy TSOS and push into vector DataVector<const Trk::TrackStateOnSurface>::const_iterator iTsos = tsos->begin(); @@ -408,12 +406,12 @@ StatusCode HoleSearchValidation::execute(const EventContext& ctx) const { } // end have identifier } // end TSoS is of type measurement - vecTsos->push_back(vecTsos->allocate (**iTsos)); + const Trk::TrackStateOnSurface* newTsos = new Trk::TrackStateOnSurface(**iTsos); + vecTsos.push_back(newTsos); } // end loop over all TSoS ATH_MSG_DEBUG( "Removed total of " << nRemoved << " TSoS on track." ) ; - vecTsos->elt_allocator().protect(); Trk::Track* newTrack = new Trk::Track(track.info(), std::move(vecTsos), nullptr ); ATH_MSG_VERBOSE( "Perform hole search on new track:" ) ; // perform hole search diff --git a/LArCalorimeter/LArCalibUtils/src/LArTimePhysPrediction.cxx b/LArCalorimeter/LArCalibUtils/src/LArTimePhysPrediction.cxx index a14d10e585caf3b545fcab03062c7a77f6ce1a00..d51fce9beabe02a0f5683d864bd67d12e94ddd3f 100644 --- a/LArCalorimeter/LArCalibUtils/src/LArTimePhysPrediction.cxx +++ b/LArCalorimeter/LArCalibUtils/src/LArTimePhysPrediction.cxx @@ -288,7 +288,7 @@ StatusCode LArTimePhysPrediction::stop() //WARNING: use the CaloDepthTool's convention radius=r(barrel), radius=z(end-cap) //for HEC and FCAL: lengths could be moved in the job options if(emId->is_lar_em(id) && m_CaloDepthTool){ - radius = m_CaloDepthTool->cscopt2_parametrized(sample,real_eta,real_phi); + radius = m_CaloDepthTool->cscopt2_parametrized(sample,real_eta,real_phi,caloDDM); } else if(hecId->is_lar_hec(id)){//assumption: "arrival point" = middle of the compartment if(layer==0) radius=4398.; diff --git a/MagneticField/MagFieldElements/MagFieldElements/AtlasFieldMap.h b/MagneticField/MagFieldElements/MagFieldElements/AtlasFieldMap.h index 4984ba38cf84d9496d8a2e39c71d475ee504850f..12b37932c034e77b725625584e7423814e1fd093 100644 --- a/MagneticField/MagFieldElements/MagFieldElements/AtlasFieldMap.h +++ b/MagneticField/MagFieldElements/MagFieldElements/AtlasFieldMap.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration */ /** @@ -38,8 +38,8 @@ namespace MagField { class AtlasFieldMap { public: - AtlasFieldMap(); - ~AtlasFieldMap(); + AtlasFieldMap() = default; + ~AtlasFieldMap() { delete m_meshZR; } // initialize map from root file bool initializeMap(TFile* rootfile, @@ -112,4 +112,5 @@ private: } // namespace MagField +#include "AtlasFieldMap.icc" #endif // MAGFIELDCONDITIONS_ATLASFIELDMAP_H diff --git a/MagneticField/MagFieldElements/MagFieldElements/AtlasFieldMap.icc b/MagneticField/MagFieldElements/MagFieldElements/AtlasFieldMap.icc new file mode 100644 index 0000000000000000000000000000000000000000..b27d2f356036b25ab7b8377d7dbbcae90945848f --- /dev/null +++ b/MagneticField/MagFieldElements/MagFieldElements/AtlasFieldMap.icc @@ -0,0 +1,47 @@ +/* + Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration +*/ + +namespace MagField { +inline const BFieldZone* +MagField::AtlasFieldMap::findBFieldZone(double z, double r, double phi) const +{ + + // make sure it's inside the largest zone + // NB: the sign of the logic is chosen in order to return 0 on NaN inputs + if (z >= m_zmin && z <= m_zmax && r <= m_rmax) { + // find the edges of the zone + // z + int iz = int(m_invq[0] * (z - m_zmin)); // index to LUT + iz = m_edgeLUT[0][iz]; // tentative index from LUT + if (z > m_edge[0][iz + 1]) { + iz++; + } + // r + int ir = int(m_invq[1] * r); // index to LUT - note minimum r is always 0 + ir = m_edgeLUT[1][ir]; // tentative index from LUT + if (r > m_edge[1][ir + 1]) { + ir++; + } + // phi + int iphi = + int(m_invq[2] * (phi + M_PI)); // index to LUT - minimum phi is -pi + iphi = m_edgeLUT[2][iphi]; // tentative index from LUT + if (phi > m_edge[2][iphi + 1]) { + iphi++; + } + // use LUT to get the zone + return m_zoneLUT[(iz * m_nr + ir) * m_nphi + iphi]; + } + return nullptr; +} + +// fast 2d map (made of one zone) +inline const BFieldMeshZR* +AtlasFieldMap::getBFieldMesh() const +{ + return m_meshZR; +} + +} + diff --git a/MagneticField/MagFieldElements/src/AtlasFieldMap.cxx b/MagneticField/MagFieldElements/src/AtlasFieldMap.cxx index d1f928528cd028487eaf0df143f9039f55ee1b4b..f9db402a62427eab9b549558bde327060e930c1c 100644 --- a/MagneticField/MagFieldElements/src/AtlasFieldMap.cxx +++ b/MagneticField/MagFieldElements/src/AtlasFieldMap.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration */ /////////////////////////////////////////////////////////////////// @@ -16,56 +16,7 @@ #include "TFile.h" #include "TTree.h" -/** Constructor **/ -MagField::AtlasFieldMap::AtlasFieldMap() = default; -MagField::AtlasFieldMap::~AtlasFieldMap() -{ - delete m_meshZR; -} - -const BFieldZone* -MagField::AtlasFieldMap::findBFieldZone(double z, double r, double phi) const -{ - - // make sure it's inside the largest zone - // NB: the sign of the logic is chosen in order to return 0 on NaN inputs - if (z >= m_zmin && z <= m_zmax && r <= m_rmax) { - // find the edges of the zone - // z - const std::vector<double>& edgez(m_edge[0]); - int iz = int(m_invq[0] * (z - m_zmin)); // index to LUT - iz = m_edgeLUT[0][iz]; // tentative index from LUT - if (z > edgez[iz + 1]) { - iz++; - } - // r - const std::vector<double>& edger(m_edge[1]); - int ir = int(m_invq[1] * r); // index to LUT - note minimum r is always 0 - ir = m_edgeLUT[1][ir]; // tentative index from LUT - if (r > edger[ir + 1]) { - ir++; - } - // phi - const std::vector<double>& edgephi(m_edge[2]); - int iphi = - int(m_invq[2] * (phi + M_PI)); // index to LUT - minimum phi is -pi - iphi = m_edgeLUT[2][iphi]; // tentative index from LUT - if (phi > edgephi[iphi + 1]) { - iphi++; - } - // use LUT to get the zone - return m_zoneLUT[(iz * m_nr + ir) * m_nphi + iphi]; - } - return nullptr; -} - -// fast 2d map (made of one zone) -const BFieldMeshZR* -MagField::AtlasFieldMap::getBFieldMesh() const -{ - return m_meshZR; -} // // read the map from a ROOT file. diff --git a/MuonSpectrometer/MuonConditions/MuonCondCabling/RPC_CondCabling/src/EvenPhiCMA.cxx b/MuonSpectrometer/MuonConditions/MuonCondCabling/RPC_CondCabling/src/EvenPhiCMA.cxx index e6a580a6739d7da224d9adab5c23bbd5289dd4ac..2f59bf3faa0e121c2a8420a2a8d46d53d423075e 100755 --- a/MuonSpectrometer/MuonConditions/MuonCondCabling/RPC_CondCabling/src/EvenPhiCMA.cxx +++ b/MuonSpectrometer/MuonConditions/MuonCondCabling/RPC_CondCabling/src/EvenPhiCMA.cxx @@ -10,6 +10,7 @@ #include "RPC_CondCabling/SectorLogicSetup.h" #include <fstream> +#include <stdexcept> using namespace RPC_CondCabling; @@ -167,9 +168,8 @@ bool EvenPhiCMA::cable_CMA_channels(void) { for (int w = lowPt_start_ch(); w <= lowPt_stop_ch(); ++w) { WORlink::iterator found = m_lowPt_WORs.find(w); WiredOR* wor = (*found).second; - std::vector<int> multiplicity(wor->give_max_phi_strips()); - multiplicity.clear(); - + std::vector<int> multiplicity(wor->give_max_phi_strips(),0); + for (int i = 0; i < wor->RPCacquired(); ++i) { const RPCchamber* rpc = wor->connected_rpc(i); @@ -284,8 +284,8 @@ bool EvenPhiCMA::cable_CMA_channels(void) { for (int w = highPt_start_ch(); w <= highPt_stop_ch(); ++w) { WORlink::iterator found = m_highPt_WORs.find(w); WiredOR* wor = (*found).second; - std::vector<int> multiplicity(wor->give_max_phi_strips()); - multiplicity.clear(); + std::vector<int> multiplicity(wor->give_max_phi_strips(),0); + for (int i = 0; i < wor->RPCacquired(); ++i) { const RPCchamber* rpc = wor->connected_rpc(i); diff --git a/MuonSpectrometer/MuonConditions/MuonCondCabling/RPC_CondCabling/src/OddPhiCMA.cxx b/MuonSpectrometer/MuonConditions/MuonCondCabling/RPC_CondCabling/src/OddPhiCMA.cxx index 24f7443ef26369b5b6c5d2ae1b31557f1f811035..462661de41f220996add1a8ac1b212aba7d86134 100755 --- a/MuonSpectrometer/MuonConditions/MuonCondCabling/RPC_CondCabling/src/OddPhiCMA.cxx +++ b/MuonSpectrometer/MuonConditions/MuonCondCabling/RPC_CondCabling/src/OddPhiCMA.cxx @@ -8,6 +8,7 @@ #include "RPC_CondCabling/OddPhiCMA.h" #include "RPC_CondCabling/CMAprogram.h" #include "RPC_CondCabling/SectorLogicSetup.h" +#include <stdexcept> #include <fstream> @@ -65,7 +66,10 @@ bool OddPhiCMA::cable_CMA_channels(void) { if (pivot_station()) // Check and connect strips with Pivot matrix channels { WORlink::iterator found = m_pivot_WORs.find(pivot_start_ch()); - WiredOR* wor = (*found).second; + if (found == m_pivot_WORs.end()){ + throw std::runtime_error("Channel not found in OddPhiCMA::cable_CMA_channels"); + } + WiredOR* wor = found->second; m_pivot_rpc_read = wor->RPCacquired(); create_pivot_map(m_pivot_rpc_read); @@ -86,7 +90,7 @@ bool OddPhiCMA::cable_CMA_channels(void) { int local_strip = max_st - (max_st - start); int final_strip = max_st - (max_st - stop); - int chs = (id().Ixx_index() == 0) ? pivot_channels - abs(stop - start) - 1 : 0; + int chs = (id().Ixx_index() == 0) ? pivot_channels - std::abs(stop - start) - 1 : 0; if (chs >= pivot_channels) { REPORT_MESSAGE_WITH_CONTEXT(MSG::ERROR, "OddPhiCMA") << noMoreChannels("Pivot"); return false; @@ -148,6 +152,9 @@ bool OddPhiCMA::cable_CMA_channels(void) { if (lowPt_station() && lowPt_start_ch() != -1) { // Check and connect strips with Low Pt matrix channels for (int i = lowPt_start_ch(); i <= lowPt_stop_ch(); ++i) { WORlink::iterator found = m_lowPt_WORs.find(i); + if (found == m_lowPt_WORs.end()){ + throw std::runtime_error("Channel not found in OddPhiCMA::cable_CMA_channels"); + } m_lowPt_rpc_read += (*found).second->RPCacquired(); } @@ -164,9 +171,11 @@ bool OddPhiCMA::cable_CMA_channels(void) { for (int w = lowPt_start_ch(); w <= lowPt_stop_ch(); ++w) { WORlink::iterator found = m_lowPt_WORs.find(w); + if (found == m_lowPt_WORs.end()){ + throw std::runtime_error("Channel not found in OddPhiCMA::cable_CMA_channels"); + } WiredOR* wor = (*found).second; - std::vector<int> multiplicity(wor->give_max_phi_strips()); - multiplicity.clear(); + std::vector<int> multiplicity(wor->give_max_phi_strips(), 0); for (int i = 0; i < wor->RPCacquired(); ++i) { const RPCchamber* rpc = wor->connected_rpc(i); @@ -246,6 +255,9 @@ bool OddPhiCMA::cable_CMA_channels(void) { if (highPt_station() && highPt_start_ch() != -1) { // Check and connect strips with High Pt matrix channels for (int i = highPt_start_ch(); i <= highPt_stop_ch(); ++i) { WORlink::iterator found = m_highPt_WORs.find(i); + if (found == m_highPt_WORs.end()){ + throw std::runtime_error("Channel not found in OddPhiCMA::cable_CMA_channels"); + } m_highPt_rpc_read += (*found).second->RPCacquired(); } @@ -262,10 +274,12 @@ bool OddPhiCMA::cable_CMA_channels(void) { for (int w = highPt_start_ch(); w <= highPt_stop_ch(); ++w) { WORlink::iterator found = m_highPt_WORs.find(w); - WiredOR* wor = (*found).second; - std::vector<int> multiplicity(wor->give_max_phi_strips()); - multiplicity.clear(); - + if (found == m_highPt_WORs.end()){ + throw std::runtime_error("Channel not found in OddPhiCMA::cable_CMA_channels"); + } + WiredOR* wor = found->second; + std::vector<int> multiplicity(wor->give_max_phi_strips(), 0); + for (int i = 0; i < wor->RPCacquired(); ++i) { const RPCchamber* rpc = wor->connected_rpc(i); diff --git a/MuonSpectrometer/MuonConditions/MuonCondCabling/RPC_CondCabling/src/SectorLogicSetup.cxx b/MuonSpectrometer/MuonConditions/MuonCondCabling/RPC_CondCabling/src/SectorLogicSetup.cxx index b9d0f789f91acce0ade57f813aea6aad0ce222e7..c2fc4b4f324798637eea10425401475a8bcbe8e2 100755 --- a/MuonSpectrometer/MuonConditions/MuonCondCabling/RPC_CondCabling/src/SectorLogicSetup.cxx +++ b/MuonSpectrometer/MuonConditions/MuonCondCabling/RPC_CondCabling/src/SectorLogicSetup.cxx @@ -725,7 +725,7 @@ bool SectorLogicSetup::operator+=(RPCchamberdata& data) { int eta_st_of = (*current).second.eta_strip_global() / div; int eta_co = (*current).second.eta_connectors() / div; int eta_co_of = (*current).second.eta_conn_global() / div; - current++; + ++current; if (current != m_RPCs.end()) { (*current).second.set_eta_st_global(eta_st + eta_st_of); (*current).second.set_eta_co_global(eta_co + eta_co_of); diff --git a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerAlgs/CscSegmentMakers/src/CscSegmentUtilTool.cxx b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerAlgs/CscSegmentMakers/src/CscSegmentUtilTool.cxx index 74479caab3248862aba0040e4eed04f3c384c212..a906a23706e49ca6ac62a8e9b90d554242ed5892 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerAlgs/CscSegmentMakers/src/CscSegmentUtilTool.cxx +++ b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerAlgs/CscSegmentMakers/src/CscSegmentUtilTool.cxx @@ -1065,11 +1065,7 @@ void CscSegmentUtilTool::find_2dsegments(bool measphi, int station, int eta, int for (ICscSegmentFinder::TrkClusters::const_iterator icl2 = clus2.begin(); icl2 != clus2.end(); ++icl2) { for (ICscSegmentFinder::TrkClusters::const_iterator icl3 = clus3.begin(); icl3 != clus3.end(); ++icl3) { for (ICscSegmentFinder::TrkClusters::const_iterator icl4 = clus4.begin(); icl4 != clus4.end(); ++icl4) { - fitclus.clear(); - fitclus.push_back(*icl1); - fitclus.push_back(*icl2); - fitclus.push_back(*icl3); - fitclus.push_back(*icl4); + fitclus = {*icl1, *icl2, *icl3, *icl4}; Trk::ParamDefs ierr = Trk::loc1; ATH_MSG_VERBOSE(" +++++++ find_2dsegments ++ Errors " << Amg::error((*icl1).cl->localCovariance(), ierr) << " " @@ -1150,27 +1146,27 @@ void CscSegmentUtilTool::find_2dsegments(bool measphi, int station, int eta, int void CscSegmentUtilTool::add_2dsegments(ICscSegmentFinder::Segments& segs4, ICscSegmentFinder::Segments& segs3) const { // Limit number of segments - if (segs4.size() == 0 && segs3.size() == 0) return; + if (segs4.empty() and segs3.empty()) return; ATH_MSG_DEBUG(" Total Input seg4 segment size " << segs4.size()); ATH_MSG_DEBUG(" Total Input seg3 segment size " << segs3.size()); std::vector<int> isegs4OK(segs4.size(), 1); std::vector<int> isegs3OK(segs3.size(), 1); - ICscSegmentFinder::Segments segs4All; + ICscSegmentFinder::Segments segs4All{segs4}; ICscSegmentFinder::Segments::const_iterator iseg; ICscSegmentFinder::Segments::const_iterator iseg2; - for (iseg = segs4.begin(); iseg != segs4.end(); iseg++) { segs4All.push_back(*iseg); } - segs4.clear(); + + int iiseg = -1; - for (iseg = segs4All.begin(); iseg != segs4All.end(); iseg++) { + for (iseg = segs4All.begin(); iseg != segs4All.end(); ++iseg) { iiseg++; int iiseg2 = iiseg; - for (iseg2 = iseg + 1; iseg2 != segs4All.end(); iseg2++) { + for (iseg2 = iseg + 1; iseg2 != segs4All.end(); ++iseg2) { int nhits_common = 0; iiseg2++; for (int iclus = 0; iclus < iseg->nclus; iclus++) { @@ -1188,7 +1184,7 @@ void CscSegmentUtilTool::add_2dsegments(ICscSegmentFinder::Segments& segs4, ICsc } iiseg = -1; - for (iseg = segs4All.begin(); iseg != segs4All.end(); iseg++) { + for (iseg = segs4All.begin(); iseg != segs4All.end(); ++iseg) { iiseg++; const Muon::CscClusterOnTrack* cot = iseg->clus[0].cl; Identifier id = cot->identify(); @@ -1213,9 +1209,9 @@ void CscSegmentUtilTool::add_2dsegments(ICscSegmentFinder::Segments& segs4, ICsc if (segs4.size() == m_max_seg_per_chamber) { return; } - for (iseg = segs4.begin(); iseg != segs4.end(); iseg++) { + for (iseg = segs4.begin(); iseg != segs4.end(); ++iseg) { int iiseg2 = -1; - for (iseg2 = segs3.begin(); iseg2 != segs3.end(); iseg2++) { + for (iseg2 = segs3.begin(); iseg2 != segs3.end(); ++iseg2) { iiseg2++; int nhits_common = 0; for (int iclus = 0; iclus < iseg->nclus; iclus++) { @@ -1233,10 +1229,10 @@ void CscSegmentUtilTool::add_2dsegments(ICscSegmentFinder::Segments& segs4, ICsc } iiseg = -1; - for (iseg = segs3.begin(); iseg != segs3.end(); iseg++) { + for (iseg = segs3.begin(); iseg != segs3.end(); ++iseg) { iiseg++; int iiseg2 = iiseg; - for (iseg2 = iseg + 1; iseg2 != segs3.end(); iseg2++) { + for (iseg2 = iseg + 1; iseg2 != segs3.end(); ++iseg2) { iiseg2++; int nhits_common = 0; for (int iclus = 0; iclus < iseg->nclus; iclus++) { @@ -1255,7 +1251,7 @@ void CscSegmentUtilTool::add_2dsegments(ICscSegmentFinder::Segments& segs4, ICsc // As long as we don't exceed max size, add segments from segs3 to end of segs4 iiseg = -1; - for (iseg = segs3.begin(); iseg != segs3.end(); iseg++) { + for (iseg = segs3.begin(); iseg != segs3.end(); ++iseg) { iiseg++; const Muon::CscClusterOnTrack* cot = iseg->clus[0].cl; Identifier id = cot->identify(); @@ -1300,16 +1296,16 @@ void CscSegmentUtilTool::add_2dseg2hits(ICscSegmentFinder::Segments& segs, ICscS std::vector<int> isegs2OK(segs2.size(), 1); ICscSegmentFinder::Segments::const_iterator iseg; ICscSegmentFinder::Segments::const_iterator iseg2; - ICscSegmentFinder::Segments segsAll; - for (iseg = segs.begin(); iseg != segs.end(); iseg++) { segsAll.push_back(*iseg); } + ICscSegmentFinder::Segments segsAll{segs}; + segs.clear(); int iiseg = -1; - for (iseg = segs2.begin(); iseg != segs2.end(); iseg++) { + for (iseg = segs2.begin(); iseg != segs2.end(); ++iseg) { iiseg++; if (!isegs2OK[iiseg]) continue; int iiseg2 = iiseg; - for (iseg2 = iseg + 1; iseg2 != segs2.end(); iseg2++) { + for (iseg2 = iseg + 1; iseg2 != segs2.end(); ++iseg2) { int nhits_common = 0; iiseg2++; if (!isegs2OK[iiseg2]) continue; @@ -1356,10 +1352,10 @@ void CscSegmentUtilTool::add_2dseg2hits(ICscSegmentFinder::Segments& segs, ICscS } } iiseg = -1; - for (iseg = segsAll.begin(); iseg != segsAll.end(); iseg++) { + for (iseg = segsAll.begin(); iseg != segsAll.end(); ++iseg) { iiseg++; int iiseg2 = -1; - for (iseg2 = segs2.begin(); iseg2 != segs2.end(); iseg2++) { + for (iseg2 = segs2.begin(); iseg2 != segs2.end(); ++iseg2) { int nhits_common = 0; iiseg2++; if (isegs2OK[iiseg2] == 0) continue; // already rejected this segment @@ -1387,7 +1383,7 @@ void CscSegmentUtilTool::add_2dseg2hits(ICscSegmentFinder::Segments& segs, ICscS } } iiseg = -1; - for (iseg = segs2.begin(); iseg != segs2.end(); iseg++) { + for (iseg = segs2.begin(); iseg != segs2.end(); ++iseg) { iiseg++; const Muon::CscClusterOnTrack* cot = iseg->clus[0].cl; Identifier id = cot->identify(); @@ -1410,15 +1406,15 @@ void CscSegmentUtilTool::find_2dseg3hit(bool measphi, int station, int eta, int ATH_MSG_DEBUG("find_2dseg3hit called"); // List of possible combinations for three hits. - const int maxcomb = 4; - int layAcomb[maxcomb] = {1, 2, 3, 0}; - int layBcomb[maxcomb] = {2, 3, 0, 1}; - int layCcomb[maxcomb] = {3, 0, 1, 2}; + constexpr int maxcomb = 4; + constexpr std::array<int, maxcomb> layAcomb{1, 2, 3, 0}; + constexpr std::array<int, maxcomb> layBcomb{2, 3, 0, 1}; + constexpr std::array<int, maxcomb> layCcomb{3, 0, 1, 2}; ATH_MSG_VERBOSE("station " << station << " eta " << eta << " phi " << phi); // Maximum number of hits per segment - const int maxhits = 3; + constexpr int maxhits = 3; ICscSegmentFinder::TrkClusters fitclus; fitclus.reserve(3); ICscSegmentFinder::Segment seg; @@ -1427,20 +1423,21 @@ void CscSegmentUtilTool::find_2dseg3hit(bool measphi, int station, int eta, int for (int icomb = 0; icomb < maxcomb; icomb++) { // iterator over clusters ICscSegmentFinder::TrkClusters::const_iterator icl[maxhits]; - + auto & pCluster1 = icl[0]; + auto & pCluster2 = icl[1]; + auto & pCluster3 = icl[2]; // Select appropriate layer for first layer const ICscSegmentFinder::TrkClusters& clus1 = chclus[layAcomb[icomb]]; - for (icl[0] = clus1.begin(); icl[0] != clus1.end(); ++icl[0]) { + for (pCluster1 = clus1.begin(); pCluster1 != clus1.end(); ++pCluster1) { // Select appropriate layer for second layer const ICscSegmentFinder::TrkClusters& clus2 = chclus[layBcomb[icomb]]; - for (icl[1] = clus2.begin(); icl[1] != clus2.end(); ++icl[1]) { + for (pCluster2 = clus2.begin(); pCluster2 != clus2.end(); ++pCluster2) { // Select appropriate layer for third layer const ICscSegmentFinder::TrkClusters& clus3 = chclus[layCcomb[icomb]]; - for (icl[2] = clus3.begin(); icl[2] != clus3.end(); ++icl[2]) { - fitclus.clear(); + for (pCluster3 = clus3.begin(); pCluster3 != clus3.end(); ++pCluster3) { // Use these three clusters as a segment. - for (int i = 0; i < maxhits; i++) { fitclus.push_back(*icl[i]); } - + fitclus = {*pCluster1, *pCluster2, *pCluster3}; + // Check if these hits are used by any other segments if (!unique_hits(fitclus, segs4hit)) { ATH_MSG_VERBOSE(" hits already used by other segments "); @@ -1454,7 +1451,7 @@ void CscSegmentUtilTool::find_2dseg3hit(bool measphi, int station, int eta, int // Count number of unspoiled clusters int nunspoil = 0; for (int i = 0; i < maxhits; i++) { - seg.clus[i] = *icl[i]; + seg.clus[i] = *(icl[i]); if (IsUnspoiled(seg.clus[i].cl->status())) ++nunspoil; } @@ -1470,7 +1467,7 @@ void CscSegmentUtilTool::find_2dseg3hit(bool measphi, int station, int eta, int local_max_chi = m_max_chisquare; // tighten chi2 cut - if (m_TightenChi2) local_max_chi = 2. * m_max_chisquare / 3.; + if (m_TightenChi2) local_max_chi = (2./3.) * m_max_chisquare ; bool keep = true; if (seg.chsq > local_max_chi) keep = false; @@ -1545,7 +1542,7 @@ void CscSegmentUtilTool::find_2dseg2hit(bool measphi, int station, int eta, int ATH_MSG_DEBUG("got 2 clusters for segment"); ICscSegmentFinder::TrkClusters fitclus; - for (int i = 0; i < maxhits; i++) { fitclus.push_back(*icl[i]); } + for (int i = 0; i < maxhits; i++) { fitclus.push_back(*(icl[i])); } // Calculate chi2 for this segment. ICscSegmentFinder::Segment seg; @@ -1556,7 +1553,7 @@ void CscSegmentUtilTool::find_2dseg2hit(bool measphi, int station, int eta, int // Count number of unspoiled clusters int nunspoil = 0; for (int i = 0; i < maxhits; i++) { - seg.clus[i] = *icl[i]; + seg.clus[i] = *(icl[i]); if (IsUnspoiled(seg.clus[i].cl->status())) ++nunspoil; } seg.nunspoil = nunspoil; @@ -2088,13 +2085,13 @@ bool CscSegmentUtilTool::unique_hits(ICscSegmentFinder::TrkClusters& fitclus, ATH_MSG_VERBOSE(" unique_hits nclus " << nclus << " segs size " << segs.size()); // Loop over segments ICscSegmentFinder::Segments::const_iterator iseg; - for (iseg = segs.begin(); iseg != segs.end(); iseg++) { + for (iseg = segs.begin(); iseg != segs.end(); ++iseg) { int nhits_common = 0; // Loop over hits in the 4-hit segment for (int iclus = 0; iclus < iseg->nclus; iclus++) { // Loop over hits in fitclus ICscSegmentFinder::TrkClusters::const_iterator ihit; - for (ihit = fitclus.begin(); ihit != fitclus.end(); ihit++) { + for (ihit = fitclus.begin(); ihit != fitclus.end(); ++ihit) { // Increment number of common hits if the ids are the same. const Muon::CscClusterOnTrack* cot = iseg->clus[iclus].cl; const Muon::CscClusterOnTrack* hit = ihit->cl; diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/src/MergedElectronDetailsDecorator.cxx b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/src/MergedElectronDetailsDecorator.cxx index 4e93878d64a492b8259b7f109a39686742fc483f..29845d5f610241d1343ad2e783737c22686d33fd 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/src/MergedElectronDetailsDecorator.cxx +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/src/MergedElectronDetailsDecorator.cxx @@ -152,6 +152,7 @@ namespace DerivationFramework { phi, deltaEta, deltaPhi, + nullptr, IEMExtrapolationTools::fromPerigee).isSuccess()) // Perigee { trkMatchTrk[0] = deltaEta[1]; @@ -167,6 +168,7 @@ namespace DerivationFramework { phi, deltaEta, deltaPhi, + nullptr, IEMExtrapolationTools::fromLastMeasurement).isSuccess()) //Last Measurement { trkMatchTrk[4] = deltaEta[1]; @@ -182,6 +184,7 @@ namespace DerivationFramework { phi, deltaEta, deltaPhi, + nullptr, IEMExtrapolationTools::fromPerigeeRescaled).isSuccess()) //Last Measurement { trkMatchTrk[8] = deltaPhi[2]; diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkInDet/share/IDTIDE1.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkInDet/share/IDTIDE1.py index 242b86af4cff86123ce5800e5539f47096042c56..b500a64ca36942e381f5b42af97092b21c788a44 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkInDet/share/IDTIDE1.py +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkInDet/share/IDTIDE1.py @@ -503,8 +503,6 @@ IDTIDE1Stream.AddItem("xAOD::JetContainer#AntiKt4EMTopoJets") IDTIDE1Stream.AddItem("xAOD::JetAuxContainer#AntiKt4EMTopoJetsAux.") IDTIDE1Stream.AddItem("xAOD::JetContainer#AntiKt4EMPFlowJets") IDTIDE1Stream.AddItem("xAOD::JetAuxContainer#AntiKt4EMPFlowJetsAux.") -IDTIDE1Stream.AddItem("xAOD::JetContainer#AntiKt4LCTopoJets") -IDTIDE1Stream.AddItem("xAOD::JetAuxContainer#AntiKt4LCTopoJetsAux.") IDTIDE1Stream.AddItem("xAOD::JetContainer#AntiKt2PV0TrackJets") IDTIDE1Stream.AddItem("xAOD::JetAuxContainer#AntiKt2PV0TrackJetsAux.") #IDTIDE1Stream.AddItem("xAOD::JetContainer#AntiKt3PV0TrackJets") @@ -515,8 +513,6 @@ IDTIDE1Stream.AddItem("xAOD::BTaggingContainer#BTagging_AntiKt4EMTopo") IDTIDE1Stream.AddItem("xAOD::BTaggingAuxContainer#BTagging_AntiKt4EMTopoAux.") IDTIDE1Stream.AddItem("xAOD::BTaggingContainer#BTagging_AntiKt4EMPFlow") IDTIDE1Stream.AddItem("xAOD::BTaggingAuxContainer#BTagging_AntiKt4EMPFlowAux.") -IDTIDE1Stream.AddItem("xAOD::BTaggingContainer#BTagging_AntiKt4LCTopo") -IDTIDE1Stream.AddItem("xAOD::BTaggingAuxContainer#BTagging_AntiKt4LCTopoAux.") IDTIDE1Stream.AddItem("xAOD::BTaggingContainer#BTagging_AntiKt2Track") IDTIDE1Stream.AddItem("xAOD::BTaggingAuxContainer#BTagging_AntiKt2TrackAux.") #IDTIDE1Stream.AddItem("xAOD::BTaggingContainer#BTagging_AntiKt3Track") diff --git a/PhysicsAnalysis/MCTruthClassifier/src/MCTruthClassifierAthena.cxx b/PhysicsAnalysis/MCTruthClassifier/src/MCTruthClassifierAthena.cxx index 3a0e9e1202963b6a3d96ba21231237ea8a6a233d..562a75733891e79b7b45c9d14c9a17eac876d6f8 100644 --- a/PhysicsAnalysis/MCTruthClassifier/src/MCTruthClassifierAthena.cxx +++ b/PhysicsAnalysis/MCTruthClassifier/src/MCTruthClassifierAthena.cxx @@ -415,7 +415,7 @@ MCTruthClassifier::genPartToCalo(const EventContext& ctx, std::vector<std::pair<CaloSampling::CaloSample, std::unique_ptr<const Trk::TrackParameters>>> extension = m_caloExtensionTool->layersCaloExtension( - ctx, *params, samples, etaClus, Trk::nonInteracting); + ctx, *params, samples, etaClus); double etaCalo = -99; double phiCalo = -99; bool extensionOK = (!extension.empty()); diff --git a/Projects/AthGeneration/build_externals.sh b/Projects/AthGeneration/build_externals.sh index d03bb1469b7084437a2cc527c451892d941aab53..0d916248d1f6438f32794a3a5ade830bc9241a9b 100755 --- a/Projects/AthGeneration/build_externals.sh +++ b/Projects/AthGeneration/build_externals.sh @@ -13,7 +13,7 @@ ATLAS_EXTRA_CMAKE_ARGS=(-DLCG_VERSION_NUMBER=101 -DLCG_VERSION_POSTFIX="_ATLAS_7" -DATLAS_GAUDI_TAG="v36r2.000" -DATLAS_COOL_TAG="COOL_3_3_9" - -DATLAS_GEOMODEL_TAG="3ce7f324") + -DATLAS_GEOMODEL_TAG="ad59da70") ATLAS_EXTRA_MAKE_ARGS=() # Let "the common script" do all the heavy lifting. diff --git a/Projects/AthSimulation/build_externals.sh b/Projects/AthSimulation/build_externals.sh index cdb5cf79de379cb2d6b9a14f1f7cc2d5919826a8..2401fc9623cb641bcb480225f167ee2636d55877 100755 --- a/Projects/AthSimulation/build_externals.sh +++ b/Projects/AthSimulation/build_externals.sh @@ -13,7 +13,7 @@ ATLAS_EXTRA_CMAKE_ARGS=(-DLCG_VERSION_NUMBER=101 -DLCG_VERSION_POSTFIX="_ATLAS_7" -DATLAS_GAUDI_TAG="v36r2.000" -DATLAS_COOL_TAG="COOL_3_3_9" - -DATLAS_GEOMODEL_TAG="3ce7f324") + -DATLAS_GEOMODEL_TAG="ad59da70") ATLAS_EXTRA_MAKE_ARGS=() # Let "the common script" do all the heavy lifting. diff --git a/Projects/Athena/build_externals.sh b/Projects/Athena/build_externals.sh index 73ee9536802926fcb29b99234781464ef5bb0436..77f434869b0bc5c452a69276ee4e0ae806b397c4 100755 --- a/Projects/Athena/build_externals.sh +++ b/Projects/Athena/build_externals.sh @@ -14,7 +14,7 @@ ATLAS_EXTRA_CMAKE_ARGS=(-DLCG_VERSION_NUMBER=101 -DATLAS_GAUDI_TAG="v36r2.000" -DATLAS_ACTS_TAG="v14.1.0" -DATLAS_ONNXRUNTIME_USE_CUDA=FALSE - -DATLAS_GEOMODEL_TAG="3ce7f324" + -DATLAS_GEOMODEL_TAG="ad59da70" -DATLAS_BUILD_CORAL=TRUE -DATLAS_CORAL_TAG="9d9d9725") ATLAS_EXTRA_MAKE_ARGS=() diff --git a/Reconstruction/HeavyIonRec/HIRecExample/share/hip_flagsESD.py b/Reconstruction/HeavyIonRec/HIRecExample/share/hip_flagsESD.py index f439c65bf9edf9790ae093fc11e01f6e51abda40..ec4768b648f27d83a0d318f62a77b17df1bfa58b 100644 --- a/Reconstruction/HeavyIonRec/HIRecExample/share/hip_flagsESD.py +++ b/Reconstruction/HeavyIonRec/HIRecExample/share/hip_flagsESD.py @@ -2,7 +2,7 @@ include.block("HIRecExample/hip_flagsESD.py") # put here HeavyIon-proton specific ESD configuration if rec.doESD : - print "Applying HIP ESD flags mods" + print("Applying HIP ESD flags mods") from RecExConfig.RecFlags import rec rec.Commissioning.set_Value_and_Lock(True) diff --git a/Reconstruction/Jet/JetMomentTools/src/JetBadChanCorrTool.cxx b/Reconstruction/Jet/JetMomentTools/src/JetBadChanCorrTool.cxx index 11d5c402b303a9a475a9bdcfee413c56f9caef73..1a504df3d93cf49b9c3d2972aa0c74b73951d9ad 100644 --- a/Reconstruction/Jet/JetMomentTools/src/JetBadChanCorrTool.cxx +++ b/Reconstruction/Jet/JetMomentTools/src/JetBadChanCorrTool.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration */ #ifndef XAOD_ANALYSIS @@ -181,9 +181,6 @@ StatusCode JetBadChanCorrTool::correctionFromCellsInJet(const xAOD::JetContainer double corr_cell=0; double corr_dotx=0; - // jet energy - double total_energy=0;//for calib, with h1 weight but without jet-scale corr. - jet::JetCellAccessor::const_iterator cellIt = jet::JetCellAccessor::begin(jet); jet::JetCellAccessor::const_iterator cellItE = jet::JetCellAccessor::end(jet); @@ -194,7 +191,6 @@ StatusCode JetBadChanCorrTool::correctionFromCellsInJet(const xAOD::JetContainer double cellWeight = cellIt.weight(); double cell_energy = cell->e() * cellWeight; - total_energy += cell_energy; CaloCell_ID::CaloSample sampling = dde->getSampling(); diff --git a/Reconstruction/Jet/JetRecConfig/python/JetRecConfig.py b/Reconstruction/Jet/JetRecConfig/python/JetRecConfig.py index cad3d2bc582da9d34dd8bb8d9466f699b5a648cd..fa9ac18260e4ebb8d819f5f683e546b223f04153 100644 --- a/Reconstruction/Jet/JetRecConfig/python/JetRecConfig.py +++ b/Reconstruction/Jet/JetRecConfig/python/JetRecConfig.py @@ -89,7 +89,10 @@ def JetInputCfg(configFlags,jetOrConstitdef , context="default"): algs = getInputAlgs(jetOrConstitdef, configFlags, context) for a in algs: - components.addEventAlgo( a ) + if isinstance(a, ComponentAccumulator): + components.merge(a) + else: + components.addEventAlgo(a) return components diff --git a/Reconstruction/Jet/JetRecConfig/python/StandardJetConstits.py b/Reconstruction/Jet/JetRecConfig/python/StandardJetConstits.py index 230a985ae791feb361342b56d91c8076e63ea0e3..81c09b7007d8e2eb5215afba048adefa8725d5cf 100644 --- a/Reconstruction/Jet/JetRecConfig/python/StandardJetConstits.py +++ b/Reconstruction/Jet/JetRecConfig/python/StandardJetConstits.py @@ -181,7 +181,10 @@ _stdSeqList = [ # see JetDefinition.py for details. # ***************************** - # Cluster constituents + # Cluster constituents : the first one is a relic used for isolation, and might disappear soon + JetInputConstitSeq("EMTopo", xAODType.CaloCluster, ["EM"], + "CaloCalTopoClusters", "EMTopoClusters", jetinputtype="EMTopo", + ), JetInputConstitSeq("EMTopoOrigin", xAODType.CaloCluster, ["EM","Origin"], "CaloCalTopoClusters", "EMOriginTopoClusters", jetinputtype="EMTopo", ), diff --git a/Reconstruction/Jet/OjfJet/OjfJet/OJFZD.h b/Reconstruction/Jet/OjfJet/OjfJet/OJFZD.h index bdcdaf0d3e56804e70b2bfc76b34e4802ca84e08..832ed5e124110766acee63b21db978435090b7aa 100755 --- a/Reconstruction/Jet/OjfJet/OjfJet/OJFZD.h +++ b/Reconstruction/Jet/OjfJet/OjfJet/OJFZD.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration */ // $Id: OJFZD.h,v 1.3 2008-02-15 14:31:34 seuster Exp $ @@ -34,7 +34,6 @@ // for ATLAS random engine #include "CLHEP/Random/RandFlat.h" -#include "AthenaKernel/IAtRndmGenSvc.h" namespace OptimalJetFinder { diff --git a/Reconstruction/RecJobTransforms/python/RecoSteering.py b/Reconstruction/RecJobTransforms/python/RecoSteering.py index 01ba3f8d74205323253a7b43faea64b527717735..8c119b10331bd68bbd2da774c0a48e93b135fcf1 100644 --- a/Reconstruction/RecJobTransforms/python/RecoSteering.py +++ b/Reconstruction/RecJobTransforms/python/RecoSteering.py @@ -85,6 +85,12 @@ def RecoSteering(flags, tryConfiguringAll=False): acc.merge(PFCfg(flags)) log.info("---------- Configured particle flow") + # EGamma and CombinedMuon isolation + if flags.Reco.EnableCombinedMuon or flags.Reco.EnableEgamma: + from IsolationAlgs.IsolationSteeringConfig import IsolationSteeringCfg + acc.merge(IsolationSteeringCfg(flags, doIsoMuon = tryConfiguringAll)) + log.info("---------- Configured isolation") + # jets # btagging diff --git a/Reconstruction/RecJobTransforms/test/RecoSteeringTest.py b/Reconstruction/RecJobTransforms/test/RecoSteeringTest.py index ec3d7406586fb5c5b6d6a696e6e62b1376fa98a4..a086b25ad2820f222de94cbadc8fcf93d75836d8 100755 --- a/Reconstruction/RecJobTransforms/test/RecoSteeringTest.py +++ b/Reconstruction/RecJobTransforms/test/RecoSteeringTest.py @@ -16,7 +16,6 @@ def _run(input): #TODO these flags should be defaulted in the divier function above, #TODO but then we ought to have option to set them from command line should the parser be passed there too? - flags.Calo.TopoCluster.doTopoClusterLocalCalib=False flags.Output.ESDFileName="myESD.pool.root" flags.Output.AODFileName="myAOD.pool.root" parser = flags.getArgumentParser() diff --git a/Reconstruction/RecoAlgs/IsolationAlgs/python/IsoDensityConfig.py b/Reconstruction/RecoAlgs/IsolationAlgs/python/IsoDensityConfig.py new file mode 100644 index 0000000000000000000000000000000000000000..8c50824640f96c5f627791129e5e36e40c86b318 --- /dev/null +++ b/Reconstruction/RecoAlgs/IsolationAlgs/python/IsoDensityConfig.py @@ -0,0 +1,128 @@ +# Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration + +__doc__ = """ + Instantiate the electron, photon and muon isolation + """ + +from AthenaCommon.Logging import logging +from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator +from AthenaConfiguration.ComponentFactory import CompFactory + +def EMTopoInputAlgCfg(flags, name='EMTopoInputAlg', **kwargs): + + mlog = logging.getLogger(name) + mlog.info('Starting input building for isolation density configuration') + + acc = ComponentAccumulator() + + from JetRecConfig.StandardJetConstits import stdConstitDic as cst + from JetRecConfig.JetRecConfig import JetInputCfg, getConstitPJGAlg + + # Get the input (from CaloCal to EM scale, no origin correction) + acc.merge(JetInputCfg(flags, cst.EMTopo)) + + # Get the pseudo jets for this input + acc.addEventAlgo(getConstitPJGAlg(cst.EMTopo)) + + return acc + +def NFlowInputAlgCfg(flags, name='NFlowInputAlg', **kwargs): + + mlog = logging.getLogger(name) + mlog.info('Starting input building for neutral eflow isolation density configuration') + + acc = ComponentAccumulator() + + from JetRecConfig.StandardJetConstits import stdConstitDic as cst + from JetRecConfig.JetRecConfig import JetInputCfg + + # Get the input (FlowObject, with CHS and origin (for neutral) and weight (for charged) correction) + acc.merge(JetInputCfg(flags, cst.EMPFlow) ) + + # Then transform into pseudo-jets for the neutral only + constitpjalg = CompFactory.PseudoJetAlgorithm( + name = "PseudoJetAlgForIsoNFlow", + InputContainer = "CHSNeutralParticleFlowObjects", + OutputContainer = "PseudoJetNFlow", + Label = "EMNPFlow", + SkipNegativeEnergy=True) + + # Add the algs to the sequence in the ComponentAccumulator + acc.addEventAlgo(constitpjalg) + + return acc + + +def DensityForIsoAlgCfg(flags, name = "CentralDensityForTopoIso", **kwargs): + + mlog = logging.getLogger(name) + mlog.info('Starting density alg for isolation configuration') + + acc = ComponentAccumulator() + + # Need to understand how to know that the above has been configured + #acc.merge(EMTopoInputAlgCfg(flags)) + + # And then the density tool and algs. By default the central one + if name.find('Topo') >= 0: + inputO = 'PseudoJetEMTopo' + outputS = 'TopoCluster' + elif name.find('NFlow') >= 0: + inputO = 'PseudoJetNFlow' + outputS = 'NeutralParticleFlow' + kwargs['InputContainer'] = inputO + kwargs['JetRadius'] = 0.5 + kwargs['UseFourMomArea'] = True + kwargs['VoronoiRfact'] = 0.9 + kwargs['JetAlgorithm'] = 'Kt' + if name.find('Central') >= 0: + kwargs['OutputContainer'] = outputS+'IsoCentralEventShape' + kwargs['AbsRapidityMin'] = 0.0 + kwargs['AbsRapidityMax'] = 1.5 + elif name.find('Forward') >= 0: + kwargs['OutputContainer'] = outputS+'IsoForwardEventShape' + kwargs['AbsRapidityMin'] = 1.5 + kwargs['AbsRapidityMax'] = 3.0 + densityTool = CompFactory.EventDensityTool( + name = name+'Tool',**kwargs) + + densityAlg = CompFactory.EventDensityAthAlg( + name = name+'Alg', + EventDensityTool = densityTool) + acc.addEventAlgo(densityAlg) + + return acc + + +if __name__ == "__main__": + from AthenaCommon.Configurable import Configurable + Configurable.configurableRun3Behavior = True + from AthenaConfiguration.AllConfigFlags import ConfigFlags as flags + from AthenaConfiguration.ComponentAccumulator import printProperties + from AthenaConfiguration.TestDefaults import defaultTestFiles + from AthenaConfiguration.MainServicesConfig import MainServicesCfg + flags.Input.Files = defaultTestFiles.RDO + flags.Output.doWriteESD = True # To test the ESD parts + flags.Output.doWriteAOD = True # To test the AOD parts + flags.lock() + + mlog = logging.getLogger("densityForIsolationConfigTest") + mlog.info("Configuring density for isolation: ") + + acc = MainServicesCfg(flags) + acc.merge(EMTopoInputAlgCfg(flags)) + acc.merge(DensityForIsoAlgCfg(flags)) + acc.merge(DensityForIsoAlgCfg(flags, name='ForwardDensityForIso')) + acc.merge(NFlowInputAlgCfg(flags)) + acc.merge(DensityForIsoAlgCfg(flags,name='CentralDensityForNFlowIso')) + printProperties(mlog, + acc.getEventAlgo('CentralDensityForTopoIsoAlg'), + nestLevel=1, + printDefaults=True) + printProperties(mlog, + acc.getEventAlgo('JetModAlgForIsoNFlow'), + nestLevel=1, + printDefaults=True) + + with open("isolationdensityconfig.pkl", "wb") as f: + acc.store(f) diff --git a/Reconstruction/RecoAlgs/IsolationAlgs/python/IsoToolsConfig.py b/Reconstruction/RecoAlgs/IsolationAlgs/python/IsoToolsConfig.py new file mode 100644 index 0000000000000000000000000000000000000000..3ae9f0570be71c1d1e2b3272494aef191bca2b54 --- /dev/null +++ b/Reconstruction/RecoAlgs/IsolationAlgs/python/IsoToolsConfig.py @@ -0,0 +1,90 @@ +# Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration + +__doc__ = """Tool configuration to instantiate all + isolationTools with default configuration""" + +from AthenaCommon.SystemOfUnits import GeV +from AthenaConfiguration.ComponentFactory import CompFactory +from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator + +def isoTTVAToolCfg(flags,**kwargs): + from TrackVertexAssociationTool.TTVAToolConfig import TTVAToolCfg + kwargs.setdefault('name', 'ttvaToolForIso') + kwargs.setdefault('WorkingPoint','Nonprompt_All_MaxWeight') + return TTVAToolCfg(flags,**kwargs) + +def isoTrackSelectionToolCfg(flags, **kwargs): + acc = ComponentAccumulator() + + kwargs.setdefault('name', 'isoTrackSelectionTool') + kwargs.setdefault('CutLevel','Loose') + kwargs.setdefault('minPt',1*GeV) + + acc.setPrivateTools( + CompFactory.InDet.InDetTrackSelectionTool(**kwargs)) + return acc + +def TrackIsolationToolCfg(flags, **kwargs): + acc = ComponentAccumulator() + + if 'TrackSelectionTool' not in kwargs: + kwargs['TrackSelectionTool'] = acc.popToolsAndMerge(isoTrackSelectionToolCfg(flags)) + if 'TTVATool' not in kwargs: + kwargs['TTVATool'] = acc.popToolsAndMerge(isoTTVAToolCfg(flags)) + + if flags.Beam.Type == 'cosmics': + kwargs['VertexLocation'] = '' + + acc.setPrivateTools(CompFactory.xAOD.TrackIsolationTool(**kwargs)) + return acc + +def ElectronTrackIsolationToolCfg(flags, **kwargs): + kwargs.setdefault('name','ElectronTrackIsolationTool') + kwargs.setdefault('CoreTrackEtaRange',0.01) + return TrackIsolationToolCfg(flags,**kwargs) + +def EGammaCaloIsolationToolCfg(flags, **kwargs): + acc = ComponentAccumulator() + + if 'IsoLeakCorrectionTool' not in kwargs: + IsoCorrectionTool = CompFactory.CP.IsolationCorrectionTool( + name = 'LeakageCorrTool', + LogLogFitForLeakage = True) + kwargs['IsoLeakCorrectionTool'] = IsoCorrectionTool + + if 'CaloFillRectangularClusterTool' not in kwargs: + cfrc = CompFactory.CaloFillRectangularCluster( + name="egamma_CaloFillRectangularCluster", + eta_size=5, + phi_size=7, + cells_name=flags.Egamma.Keys.Input.CaloCells) + kwargs['CaloFillRectangularClusterTool'] = cfrc + + kwargs.setdefault('name','egCaloIsolationTool') + kwargs.setdefault('ParticleCaloExtensionTool',None) + kwargs.setdefault('ParticleCaloCellAssociationTool',None) + kwargs.setdefault('isMC',flags.Input.isMC) + + acc.setPrivateTools(CompFactory.xAOD.CaloIsolationTool(**kwargs)) + return acc + +def MuonCaloIsolationToolCfg(flags, **kwargs): + acc = ComponentAccumulator() + + if 'ParticleCaloExtensionTool' not in kwargs: + from TrackToCalo.TrackToCaloConfig import ParticleCaloExtensionToolCfg + kwargs['ParticleCaloExtensionTool'] = acc.popToolsAndMerge( + ParticleCaloExtensionToolCfg(flags)) + if 'FlowElementsInConeTool' not in kwargs and flags.Reco.EnablePFlow: + kwargs['FlowElementsInConeTool'] = CompFactory.xAOD.FlowElementsInConeTool( + name='FlowElementsInConeTool') + + from CaloIdentifier import SUBCALO + kwargs.setdefault('EMCaloNums',[SUBCALO.LAREM]) + kwargs.setdefault('HadCaloNums',[SUBCALO.LARHEC, SUBCALO.TILE]) + kwargs.setdefault('ParticleCaloCellAssociationTool',None) + kwargs.setdefault('UseEtaDepPUCorr',False) + kwargs.setdefault('name','muonCaloIsolationTool') + + acc.setPrivateTools(CompFactory.xAOD.CaloIsolationTool(**kwargs)) + return acc diff --git a/Reconstruction/RecoAlgs/IsolationAlgs/python/IsolationBuilderConfig.py b/Reconstruction/RecoAlgs/IsolationAlgs/python/IsolationBuilderConfig.py new file mode 100644 index 0000000000000000000000000000000000000000..1bff452572dc2429c6ede8784768295fc1f608eb --- /dev/null +++ b/Reconstruction/RecoAlgs/IsolationAlgs/python/IsolationBuilderConfig.py @@ -0,0 +1,149 @@ +# Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration + +__doc__ = """ + Instantiate the electron or photon isolation + """ + +from AthenaCommon.Logging import logging +from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator +from AthenaConfiguration.ComponentFactory import CompFactory + +def egIsolationCfg(flags, name='egIsolation', **kwargs): + + mlog = logging.getLogger(name) + mlog.info('Starting '+name+' configuration') + + acc = ComponentAccumulator() + + suff = '' + if name.find('photon') >= 0: + suff = 'photon' + pref = 'Ph' + elif name.find('electron') >= 0: + suff = 'electron' + pref = 'El' + else: + mlog.error('Name '+name+' should contain electron or photon') + return acc + + from xAODPrimitives.xAODIso import xAODIso as isoPar + from IsolationAlgs.IsoToolsConfig import ( + TrackIsolationToolCfg, ElectronTrackIsolationToolCfg, + EGammaCaloIsolationToolCfg) + + if flags.Detector.EnableID or flags.Detector.EnableITk: + isoType = [ [ isoPar.ptcone30, isoPar.ptcone20 ] ] + isoCor = [ [ isoPar.coreTrackPtr ] ] + isoExCor = [ [] ] + if 'TrackIsolationTool' not in kwargs: + if pref == 'Ph': + kwargs['TrackIsolationTool'] = acc.popToolsAndMerge( + TrackIsolationToolCfg(flags)) + else: + kwargs['TrackIsolationTool'] = acc.popToolsAndMerge( + ElectronTrackIsolationToolCfg(flags)) + + if flags.Detector.EnableCalo: + isoType.append( + [ isoPar.topoetcone20, isoPar.topoetcone30, isoPar.topoetcone40 ]) + isoCor.append( + [ isoPar.core57cells, isoPar.ptCorrection, isoPar.pileupCorrection ]) + isoExCor.append([]) + if 'CaloTopoIsolationTool' not in kwargs: + kwargs['CaloTopoIsolationTool'] = acc.popToolsAndMerge( + EGammaCaloIsolationToolCfg(flags)) + + kwargs[f'{pref}IsoTypes'] = isoType + kwargs[f'{pref}CorTypes'] = isoCor + kwargs[f'{pref}CorTypesExtra'] = isoExCor + + kwargs['name'] = suff+'IsolationBuilder' + + acc.addEventAlgo(CompFactory.IsolationBuilder(**kwargs)) + + mlog.info(suff+" isolation configured") + + return acc + +def muIsolationCfg(flags, name='muIsolation', **kwargs): + + mlog = logging.getLogger(name) + mlog.info('Starting '+name+' configuration') + + acc = ComponentAccumulator() + + from xAODPrimitives.xAODIso import xAODIso as isoPar + from IsolationAlgs.IsoToolsConfig import ( + TrackIsolationToolCfg, MuonCaloIsolationToolCfg) + + if flags.Detector.EnableID or flags.Detector.EnableITk: + isoType = [ [ isoPar.ptcone40, isoPar.ptcone30, isoPar.ptcone20 ] ] + isoCor = [ [ isoPar.coreTrackPtr ] ] + isoExCor = [ [] ] + if 'TrackIsolationTool' not in kwargs: + kwargs['TrackIsolationTool'] = acc.popToolsAndMerge( + TrackIsolationToolCfg(flags)) + + if flags.Detector.EnableCalo: + isoType.append( + [ isoPar.topoetcone20, isoPar.topoetcone30, isoPar.topoetcone40 ]) + isoCor.append([ isoPar.coreCone, isoPar.pileupCorrection ]) + isoExCor.append([]) + if ('CaloTopoIsolationTool' not in kwargs) or ( + 'PFlowIsolationTool' not in kwargs): + cisoTool = acc.popToolsAndMerge(MuonCaloIsolationToolCfg(flags)) + if 'CaloTopoIsolationTool' not in kwargs: + kwargs['CaloTopoIsolationTool'] = cisoTool + if flags.Reco.EnablePFlow and 'PFlowIsolationTool' not in kwargs: + isoType.append( + [ isoPar.neflowisol20, isoPar.neflowisol30, isoPar.neflowisol40 ]) + isoCor.append([ isoPar.coreCone, isoPar.pileupCorrection ]) + isoExCor.append([]) + kwargs['PFlowIsolationTool'] = cisoTool + + kwargs['MuIsoTypes'] = isoType + kwargs['MuCorTypes'] = isoCor + kwargs['MuCorTypesExtra'] = isoExCor + kwargs['name'] = 'muonIsolationBuilder' + + acc.addEventAlgo(CompFactory.IsolationBuilder(**kwargs)) + + mlog.info("muon isolation configured") + + return acc + + +if __name__ == "__main__": + from AthenaCommon.Configurable import Configurable + Configurable.configurableRun3Behavior = True + from AthenaConfiguration.AllConfigFlags import ConfigFlags as flags + from AthenaConfiguration.ComponentAccumulator import printProperties + from AthenaConfiguration.TestDefaults import defaultTestFiles + from AthenaConfiguration.MainServicesConfig import MainServicesCfg + flags.Input.Files = defaultTestFiles.RDO + flags.Output.doWriteESD = True # To test the ESD parts + flags.Output.doWriteAOD = True # To test the AOD parts + flags.lock() + + mlog = logging.getLogger("isolationConfigTest") + mlog.info("Configuring photon isolation: ") + + acc = MainServicesCfg(flags) + acc.merge(egIsolationCfg(flags,name = 'photonIsolation')) + acc.merge(egIsolationCfg(flags,name = 'electronIsolation')) + acc.merge(muIsolationCfg(flags,name = 'muonIsolation')) + printProperties(mlog, + acc.getEventAlgo("photonIsolationBuilder"), + nestLevel=1, + printDefaults=True) + printProperties(mlog, + acc.getEventAlgo("electronIsolationBuilder"), + nestLevel=1, + printDefaults=True) + printProperties(mlog, + acc.getEventAlgo("muonIsolationBuilder"), + nestLevel=1, + printDefaults=True) + + with open("isolationconfig.pkl", "wb") as f: + acc.store(f) diff --git a/Reconstruction/RecoAlgs/IsolationAlgs/python/IsolationSteeringConfig.py b/Reconstruction/RecoAlgs/IsolationAlgs/python/IsolationSteeringConfig.py new file mode 100644 index 0000000000000000000000000000000000000000..b28e789e520448a436007a10adf961e40e7419bc --- /dev/null +++ b/Reconstruction/RecoAlgs/IsolationAlgs/python/IsolationSteeringConfig.py @@ -0,0 +1,70 @@ +# Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration + +__doc__ = """ + Instantiate the isolation + """ + +from AthenaCommon.Logging import logging +from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator + +def IsolationSteeringCfg(flags, name = 'IsolationSteering', doIsoMuon = True): + + mlog = logging.getLogger(name) + mlog.info('Starting Isolation steering') + + acc = ComponentAccumulator() + + from IsolationAlgs.IsoDensityConfig import ( + EMTopoInputAlgCfg, NFlowInputAlgCfg, DensityForIsoAlgCfg) + if flags.Reco.EnableEgamma or flags.Reco.Reco.EnableCombinedMuon: + if flags.Detector.EnableCalo: + acc.merge(EMTopoInputAlgCfg(flags)) + acc.merge(DensityForIsoAlgCfg(flags)) + acc.merge(DensityForIsoAlgCfg(flags,name='ForwardDensityForTopoIso')) + if flags.Reco.EnablePFlow: + acc.merge(NFlowInputAlgCfg(flags)) + acc.merge(DensityForIsoAlgCfg(flags,name='CentralDensityForNFlowIso')) + acc.merge(DensityForIsoAlgCfg(flags,name='ForwardDensityForNFlowIso')) + + from IsolationAlgs.IsolationBuilderConfig import egIsolationCfg, muIsolationCfg + if flags.Reco.EnableEgamma: + acc.merge(egIsolationCfg(flags,name = 'photonIsolation')) + acc.merge(egIsolationCfg(flags,name = 'electronIsolation')) + if flags.Reco.EnableCombinedMuon and doIsoMuon: + acc.merge(muIsolationCfg(flags,name = 'muonIsolation')) + + # To use isolation CA within standard config + import inspect + stack = inspect.stack() + if len(stack) >= 2 and stack[1].function == 'CAtoGlobalWrapper': + for el in acc._allSequences: + el.name = "TopAlg" + + return acc + +if __name__ == "__main__": + from AthenaCommon.Configurable import Configurable + Configurable.configurableRun3Behavior = True + from AthenaConfiguration.AllConfigFlags import ConfigFlags as flags + from AthenaConfiguration.ComponentAccumulator import printProperties + from AthenaConfiguration.TestDefaults import defaultTestFiles + from AthenaConfiguration.MainServicesConfig import MainServicesCfg + flags.Input.Files = defaultTestFiles.RDO + flags.Output.doWriteESD = True # To test the ESD parts + flags.Output.doWriteAOD = True # To test the AOD parts + flags.lock() + + mlog = logging.getLogger("isolationConfigTest") + mlog.info("Configuring isolation: ") + + acc = MainServicesCfg(flags) + acc.merge(IsolationSteeringCfg(flags)) + acc.printConfig(withDetails=True, + printDefaults=True) + printProperties(mlog, + acc.getEventAlgo('photonIsolationBuilder'), + nestLevel=1, + printDefaults=True) + + with open("isolationconfig.pkl", "wb") as f: + acc.store(f) diff --git a/Reconstruction/RecoTools/RecoToolInterfaces/RecoToolInterfaces/IParticleCaloExtensionTool.h b/Reconstruction/RecoTools/RecoToolInterfaces/RecoToolInterfaces/IParticleCaloExtensionTool.h index aacfcbfdc5d37b466330b7245aebf2bb3d265b6e..79cecb088d23beb4fb9f16f745f1d0d230ad4f51 100644 --- a/Reconstruction/RecoTools/RecoToolInterfaces/RecoToolInterfaces/IParticleCaloExtensionTool.h +++ b/Reconstruction/RecoTools/RecoToolInterfaces/RecoToolInterfaces/IParticleCaloExtensionTool.h @@ -87,6 +87,7 @@ #include <unordered_map> #include <vector> +class CaloDetDescrManager; namespace Trk { static const InterfaceID IID_IParticleCaloExtensionTool("Trk::IParticleCaloExtensionTool", 1, 0); @@ -202,7 +203,8 @@ public: const TrackParameters& startPars, const std::vector<CaloSampling::CaloSample>& clusterLayers, double eta, - ParticleHypothesis particleType) const = 0; + const CaloDetDescrManager* caloDD = nullptr, + ParticleHypothesis particleType = Trk::nonInteracting) const = 0; /** * Method returning a vector of the Track Parameters at the @@ -219,6 +221,7 @@ public: const EventContext& ctx, const TrackParameters& startPars, const xAOD::CaloCluster& cluster, + const CaloDetDescrManager* caloDD = nullptr, ParticleHypothesis particleType = Trk::nonInteracting) const = 0; static const InterfaceID& interfaceID(); diff --git a/Reconstruction/RecoTools/TrackToCalo/src/ParticleCaloExtensionTool.cxx b/Reconstruction/RecoTools/TrackToCalo/src/ParticleCaloExtensionTool.cxx index 489b10654a685c2158d08771f4a8a07fced3887a..bb9d78093a37d1b04c8a5d9eb2a09cc43bb6c1f0 100644 --- a/Reconstruction/RecoTools/TrackToCalo/src/ParticleCaloExtensionTool.cxx +++ b/Reconstruction/RecoTools/TrackToCalo/src/ParticleCaloExtensionTool.cxx @@ -438,6 +438,7 @@ ParticleCaloExtensionTool::layersCaloExtension( const TrackParameters& startPars, const std::vector<CaloSampling::CaloSample>& clusterLayers, double eta, + const CaloDetDescrManager* caloDD, ParticleHypothesis particleType) const { @@ -449,7 +450,7 @@ ParticleCaloExtensionTool::layersCaloExtension( std::vector<std::unique_ptr<Trk::Surface>> caloSurfaces; caloSurfaces.reserve(clusterLayers.size()); for (CaloSampling::CaloSample lay : clusterLayers) { - auto* surf = m_calosurf->CreateUserSurface(lay, 0., eta); + auto* surf = m_calosurf->CreateUserSurface(lay, 0., eta, caloDD); if (surf) { caloSurfaces.emplace_back(surf); } @@ -476,6 +477,7 @@ ParticleCaloExtensionTool::egammaCaloExtension( const EventContext& ctx, const TrackParameters& startPars, const xAOD::CaloCluster& cluster, + const CaloDetDescrManager* caloDD, ParticleHypothesis particleType) const { @@ -535,7 +537,8 @@ ParticleCaloExtensionTool::egammaCaloExtension( } } } - return layersCaloExtension(ctx, startPars, clusterLayers, cluster.eta(), particleType); + return layersCaloExtension( + ctx, startPars, clusterLayers, cluster.eta(), caloDD, particleType); } } // end of namespace Trk diff --git a/Reconstruction/RecoTools/TrackToCalo/src/ParticleCaloExtensionTool.h b/Reconstruction/RecoTools/TrackToCalo/src/ParticleCaloExtensionTool.h index a7e9c41c2fb39d9110b4887e27d37273081c2dde..1a454720be2583538bdaae76fa5b1640a082b5ea 100644 --- a/Reconstruction/RecoTools/TrackToCalo/src/ParticleCaloExtensionTool.h +++ b/Reconstruction/RecoTools/TrackToCalo/src/ParticleCaloExtensionTool.h @@ -32,7 +32,7 @@ #include "xAODTruth/TruthParticle.h" class AtlasDetectorID; - +class CaloDetDescrManager; namespace Trk { class IExtrapolator; @@ -87,6 +87,7 @@ public: const TrackParameters& startPars, const std::vector<CaloSampling::CaloSample>& clusterLayers, double eta, + const CaloDetDescrManager* caloDD, ParticleHypothesis particleType) const override final; virtual std::vector<std::pair<CaloSampling::CaloSample, @@ -94,6 +95,7 @@ public: egammaCaloExtension(const EventContext& ctx, const TrackParameters& startPars, const xAOD::CaloCluster& cluster, + const CaloDetDescrManager* caloDD, ParticleHypothesis particleType) const override final; private: diff --git a/Reconstruction/eflowRec/src/PFCellLevelSubtractionTool.cxx b/Reconstruction/eflowRec/src/PFCellLevelSubtractionTool.cxx index 150a07f7a4cb413f9be36b3b63e929c6b8fe2687..f2ffcf464d03d57468ae46b3a40bbe88f6309ace 100644 --- a/Reconstruction/eflowRec/src/PFCellLevelSubtractionTool.cxx +++ b/Reconstruction/eflowRec/src/PFCellLevelSubtractionTool.cxx @@ -245,7 +245,6 @@ void PFCellLevelSubtractionTool::calculateRadialEnergyProfiles(eflowData& data) double totalEnergyPerRing = 0; double cellVolume = 0; - int totalCells = 0; /* 100 is chosen as a number higher than the number of cells found in a normal list */ bool breakloop = false; @@ -277,7 +276,6 @@ void PFCellLevelSubtractionTool::calculateRadialEnergyProfiles(eflowData& data) ATH_MSG_DEBUG(" cell eta and phi are " << (thisPair.first)->eta() << " and " << (thisPair.first)->phi() << " with index " << thisPair.second << " and sampling of " << sampling); ATH_MSG_DEBUG(" cell energy is " << (thisPair.first)->energy()); - totalCells += 1; totalCellsinRing += 1; totalEnergyPerRing += (thisPair.first)->energy(); diff --git a/Reconstruction/egamma/egammaAlgs/src/egammaSelectedTrackCopy.cxx b/Reconstruction/egamma/egammaAlgs/src/egammaSelectedTrackCopy.cxx index c3c4b8b6f2adc8b3ad3d0f559e29a4c324bae899..44d6dc12a0bac80fba0ab41037ea0fa4009f1e92 100644 --- a/Reconstruction/egamma/egammaAlgs/src/egammaSelectedTrackCopy.cxx +++ b/Reconstruction/egamma/egammaAlgs/src/egammaSelectedTrackCopy.cxx @@ -163,7 +163,7 @@ egammaSelectedTrackCopy::execute(const EventContext& ctx) const check if it the track is selected due to this cluster. If not continue to next cluster */ - if (!selectTrack(ctx, cluster, track, isTRT)) { + if (!selectTrack(ctx, cluster, track, isTRT, calodetdescrmgr)) { continue; } viewCopy->push_back(track); @@ -191,7 +191,8 @@ bool egammaSelectedTrackCopy::selectTrack(const EventContext& ctx, const xAOD::CaloCluster* cluster, const xAOD::TrackParticle* track, - bool trkTRT) const + bool trkTRT, + const CaloDetDescrManager* caloDD) const { if (cluster == nullptr || track == nullptr) { @@ -293,6 +294,7 @@ egammaSelectedTrackCopy::selectTrack(const EventContext& ctx, phi, deltaEta, deltaPhi, + caloDD, IEMExtrapolationTools::fromLastMeasurement) .isFailure()) { return false; @@ -326,6 +328,7 @@ egammaSelectedTrackCopy::selectTrack(const EventContext& ctx, phiRes, deltaEtaRes, deltaPhiRes, + caloDD, IEMExtrapolationTools::fromPerigeeRescaled) .isFailure()) { return false; diff --git a/Reconstruction/egamma/egammaAlgs/src/egammaSelectedTrackCopy.h b/Reconstruction/egamma/egammaAlgs/src/egammaSelectedTrackCopy.h index 5e02fe3a89d8aa68a0c2b16c6ff3e76cf05fd590..aae77cab1510a548030fb491f02b246146277fd0 100644 --- a/Reconstruction/egamma/egammaAlgs/src/egammaSelectedTrackCopy.h +++ b/Reconstruction/egamma/egammaAlgs/src/egammaSelectedTrackCopy.h @@ -64,7 +64,8 @@ private: bool selectTrack(const EventContext& ctx, const xAOD::CaloCluster* cluster, const xAOD::TrackParticle* track, - bool trkTRT) const; + bool trkTRT, + const CaloDetDescrManager* caloDD) const; /** @brief Tool for extrapolation */ ToolHandle<IEMExtrapolationTools> m_extrapolationTool{ this, diff --git a/Reconstruction/egamma/egammaInterfaces/egammaInterfaces/IEMExtrapolationTools.h b/Reconstruction/egamma/egammaInterfaces/egammaInterfaces/IEMExtrapolationTools.h index 0473491a38f5314a2d12ce3c019046c807fbde1a..d6a00b96bfe8edca56316b3720843985784d5837 100644 --- a/Reconstruction/egamma/egammaInterfaces/egammaInterfaces/IEMExtrapolationTools.h +++ b/Reconstruction/egamma/egammaInterfaces/egammaInterfaces/IEMExtrapolationTools.h @@ -19,6 +19,7 @@ #include <memory> #include <unordered_map> +class CaloDetDescrManager; static const InterfaceID IID_IEMExtrapolationTools("IEMExtrapolationTools", 1, 0); @@ -64,6 +65,7 @@ public: std::array<double, 4>& phi, std::array<double, 4>& deltaEta, std::array<double, 4>& deltaPhi, + const CaloDetDescrManager* caloDD = nullptr, unsigned int extrapFrom = fromPerigee) const = 0; /** test for vertex-to-cluster match given also the positions diff --git a/Reconstruction/egamma/egammaInterfaces/egammaInterfaces/IEMTrackMatchBuilder.h b/Reconstruction/egamma/egammaInterfaces/egammaInterfaces/IEMTrackMatchBuilder.h index 5e5896dd8812130854e218dc95d5263fa527ba7d..16871b8e0bfc4ba2f208fad169c8eecf0d7953e0 100755 --- a/Reconstruction/egamma/egammaInterfaces/egammaInterfaces/IEMTrackMatchBuilder.h +++ b/Reconstruction/egamma/egammaInterfaces/egammaInterfaces/IEMTrackMatchBuilder.h @@ -22,10 +22,10 @@ MODIFIED : #include "egammaInterfaces/IegammaBaseTool.h" // Forward declarations -#include "xAODCaloEvent/CaloClusterFwd.h" -#include "xAODTracking/TrackParticleContainerFwd.h" -#include "egammaRecEvent/egammaRecContainer.h" #include "GaudiKernel/EventContext.h" +#include "egammaRecEvent/egammaRecContainer.h" +#include "xAODCaloEvent/CaloClusterFwd.h" +#include "xAODTracking/TrackParticleContainerFwd.h" class egammaRec; static const InterfaceID IID_IEMTrackMatchBuilder("IEMTrackMatchBuilder", 1, 0); @@ -33,36 +33,24 @@ static const InterfaceID IID_IEMTrackMatchBuilder("IEMTrackMatchBuilder", 1, 0); class IEMTrackMatchBuilder : virtual public IAlgTool { - public: - +public: /** @brief Virtual destructor*/ - virtual ~IEMTrackMatchBuilder() {}; - + virtual ~IEMTrackMatchBuilder(){}; + /** @brief AlgTool interface methods */ - static const InterfaceID& interfaceID(); + static const InterfaceID& interfaceID(); /** @brief initialize method*/ virtual StatusCode initialize() = 0; /** @brief execute method*/ - virtual StatusCode executeRec(const EventContext& ctx, + virtual StatusCode executeRec(const EventContext& ctx, EgammaRecContainer* egammas) const = 0; - /** @brief execute method*/ - virtual StatusCode trackExecute(const EventContext& ctx, - egammaRec* eg, - const xAOD::TrackParticleContainer * trackPC) const = 0; }; -inline const InterfaceID& IEMTrackMatchBuilder::interfaceID() +inline const InterfaceID& +IEMTrackMatchBuilder::interfaceID() { return IID_IEMTrackMatchBuilder; } #endif - - - - - - - - diff --git a/Reconstruction/egamma/egammaTools/src/EMTrackMatchBuilder.cxx b/Reconstruction/egamma/egammaTools/src/EMTrackMatchBuilder.cxx index 56100edd1cd2daa10a4ec88bb3ccfddda37c17d4..2dec891dfb158d165bdd642a1d1759f938a953f6 100644 --- a/Reconstruction/egamma/egammaTools/src/EMTrackMatchBuilder.cxx +++ b/Reconstruction/egamma/egammaTools/src/EMTrackMatchBuilder.cxx @@ -39,7 +39,7 @@ StatusCode EMTrackMatchBuilder::initialize() { ATH_CHECK(m_TrackParticlesKey.initialize()); - + ATH_CHECK(m_caloDetDescrMgrKey.initialize()); // the extrapolation tool ATH_CHECK(m_extrapolationTool.retrieve()); @@ -64,6 +64,13 @@ EMTrackMatchBuilder::executeRec(const EventContext& ctx, SG::ReadHandle<xAOD::TrackParticleContainer> trackPC(m_TrackParticlesKey, ctx); + SG::ReadCondHandle<CaloDetDescrManager> caloDetDescrMgrHandle{ + m_caloDetDescrMgrKey, ctx + }; + ATH_CHECK(caloDetDescrMgrHandle.isValid()); + + const CaloDetDescrManager* caloDD = *caloDetDescrMgrHandle; + // check is only used for serial running; remove when MT scheduler used if (!trackPC.isValid()) { ATH_MSG_ERROR("Couldn't retrieve TrackParticle container with key: " @@ -73,16 +80,16 @@ EMTrackMatchBuilder::executeRec(const EventContext& ctx, // Loop over calling the trackExecute method for (egammaRec* eg : *egammas) { // retrieve the cluster - ATH_CHECK(trackExecute(ctx, eg, trackPC.cptr())); + ATH_CHECK(trackExecute(ctx, eg, trackPC.cptr(), caloDD)); } return StatusCode::SUCCESS; } StatusCode -EMTrackMatchBuilder::trackExecute( - const EventContext& ctx, - egammaRec* eg, - const xAOD::TrackParticleContainer* trackPC) const +EMTrackMatchBuilder::trackExecute(const EventContext& ctx, + egammaRec* eg, + const xAOD::TrackParticleContainer* trackPC, + const CaloDetDescrManager* caloDD) const { if (!eg || !trackPC) { ATH_MSG_WARNING( @@ -111,8 +118,7 @@ EMTrackMatchBuilder::trackExecute( * For cosmics allow a retry with inverted direction. */ if (isCandidateMatch(cluster, (*trkIt), false)) { - inBroadWindow( - ctx, trkMatches, *cluster, trackNumber, (**trkIt)); + inBroadWindow(ctx, trkMatches, *cluster, trackNumber, (**trkIt), caloDD); } } @@ -151,7 +157,8 @@ EMTrackMatchBuilder::inBroadWindow(const EventContext& ctx, std::vector<TrackMatch>& trackMatches, const xAOD::CaloCluster& cluster, int trackNumber, - const xAOD::TrackParticle& trkPB) const + const xAOD::TrackParticle& trkPB, + const CaloDetDescrManager* caloDD) const { IEMExtrapolationTools::TrkExtrapDef extrapFrom = @@ -175,7 +182,7 @@ EMTrackMatchBuilder::inBroadWindow(const EventContext& ctx, */ if (m_extrapolationTool ->getMatchAtCalo( - ctx, cluster, trkPB, eta, phi, deltaEta, deltaPhi, extrapFrom) + ctx, cluster, trkPB, eta, phi, deltaEta, deltaPhi, caloDD, extrapFrom) .isFailure()) { return false; } @@ -195,6 +202,7 @@ EMTrackMatchBuilder::inBroadWindow(const EventContext& ctx, phiRes, deltaEtaRes, deltaPhiRes, + caloDD, extrapFromRes) .isFailure()) { return false; @@ -250,6 +258,7 @@ EMTrackMatchBuilder::inBroadWindow(const EventContext& ctx, phi1, deltaEta1, deltaPhi1, + caloDD, extrapFrom1) .isFailure()) { ATH_MSG_DEBUG("Extrapolation from last measurement failed"); diff --git a/Reconstruction/egamma/egammaTools/src/EMTrackMatchBuilder.h b/Reconstruction/egamma/egammaTools/src/EMTrackMatchBuilder.h index f84a98f8a60b9d503090dc4f13af687ce056ea9a..735e0c9ddb3dab38f6768baf79a361de6cf509c0 100644 --- a/Reconstruction/egamma/egammaTools/src/EMTrackMatchBuilder.h +++ b/Reconstruction/egamma/egammaTools/src/EMTrackMatchBuilder.h @@ -34,6 +34,8 @@ namespace Reco { class ITrackToVertex; } +class CaloDetDescrManager; + class EMTrackMatchBuilder final : public AthAlgTool , virtual public IEMTrackMatchBuilder @@ -55,13 +57,13 @@ public: const EventContext& ctx, EgammaRecContainer* egammas) const override final; +private: /** @brief execute method*/ - virtual StatusCode trackExecute( - const EventContext& ctx, - egammaRec* eg, - const xAOD::TrackParticleContainer* trackPC) const override final; + StatusCode trackExecute(const EventContext& ctx, + egammaRec* eg, + const xAOD::TrackParticleContainer* trackPC, + const CaloDetDescrManager* caloDD) const; -private: /** @brief A structure for keeping track match information */ struct TrackMatch { @@ -95,7 +97,8 @@ private: std::vector<TrackMatch>& trackMatches, const xAOD::CaloCluster& cluster, int trackNumber, - const xAOD::TrackParticle& trkPB) const; + const xAOD::TrackParticle& trkPB, + const CaloDetDescrManager* caloDD) const; /** @brief Loose track-cluster matching */ bool isCandidateMatch(const xAOD::CaloCluster* cluster, @@ -111,6 +114,13 @@ private: "Name of the input track particle container" }; + SG::ReadCondHandleKey<CaloDetDescrManager> m_caloDetDescrMgrKey{ + this, + "CaloDetDescrManager", + "CaloDetDescrManager", + "SG Key for CaloDetDescrManager in the Condition Store" + }; + /** @brief broad cut on deltaEta*/ Gaudi::Property<double> m_broadDeltaEta{ this, "broadDeltaEta", diff --git a/Reconstruction/egamma/egammaTrackTools/src/EMExtrapolationTools.cxx b/Reconstruction/egamma/egammaTrackTools/src/EMExtrapolationTools.cxx index f691d3ea6ae622bceb3db5247032666fec77d238..d5dde4ae38c8502ffed734714811bfae1d147eb7 100644 --- a/Reconstruction/egamma/egammaTrackTools/src/EMExtrapolationTools.cxx +++ b/Reconstruction/egamma/egammaTrackTools/src/EMExtrapolationTools.cxx @@ -119,6 +119,7 @@ EMExtrapolationTools::getMatchAtCalo(const EventContext& ctx, std::array<double, 4>& phi, std::array<double, 4>& deltaEta, std::array<double, 4>& deltaPhi, + const CaloDetDescrManager* caloDD, unsigned int extrapFrom) const { /* Extrapolate track to calo and return @@ -142,8 +143,8 @@ EMExtrapolationTools::getMatchAtCalo(const EventContext& ctx, switch (extrapFrom) { case fromPerigeeRescaled: { Trk::Perigee trkPar = getRescaledPerigee(trkPB, cluster); - const auto extension = - m_ParticleCaloExtensionTool->egammaCaloExtension(ctx, trkPar, cluster); + const auto extension = m_ParticleCaloExtensionTool->egammaCaloExtension( + ctx, trkPar, cluster, caloDD); didExtension = !extension.empty(); for (const auto& i : extension) { intersections.emplace_back( @@ -153,7 +154,7 @@ EMExtrapolationTools::getMatchAtCalo(const EventContext& ctx, case fromPerigee: { const auto extension = m_ParticleCaloExtensionTool->egammaCaloExtension( - ctx, trkPB.perigeeParameters(), cluster); + ctx, trkPB.perigeeParameters(), cluster, caloDD); didExtension = !extension.empty(); for (const auto& i : extension) { intersections.emplace_back( @@ -174,7 +175,7 @@ EMExtrapolationTools::getMatchAtCalo(const EventContext& ctx, } else { const auto extension = m_ParticleCaloExtensionTool->egammaCaloExtension( - ctx, lastParams, cluster); + ctx, lastParams, cluster, caloDD); didExtension = !extension.empty(); for (const auto& i : extension) { intersections.emplace_back( diff --git a/Reconstruction/egamma/egammaTrackTools/src/EMExtrapolationTools.h b/Reconstruction/egamma/egammaTrackTools/src/EMExtrapolationTools.h index 13114627df1212122fa1fe19c01622d2ddaa1ca5..365e490f02064e606b0e0681d4a12ec07014ab38 100644 --- a/Reconstruction/egamma/egammaTrackTools/src/EMExtrapolationTools.h +++ b/Reconstruction/egamma/egammaTrackTools/src/EMExtrapolationTools.h @@ -71,6 +71,7 @@ public: std::array<double, 4>& phi, std::array<double, 4>& deltaEta, std::array<double, 4>& deltaPhi, + const CaloDetDescrManager* caloDD, unsigned int extrapFrom = fromPerigee) const override final; /** test for vertex-to-cluster match given also the positions diff --git a/Simulation/G4Sim/MCTruth/MCTruth/VTrackInformation.h b/Simulation/G4Sim/MCTruth/MCTruth/VTrackInformation.h index 57d2a9f0d088b5d2feb55c03412cf11f72f6655b..902492c41c04bce562ce4e376875681d900f1e0e 100644 --- a/Simulation/G4Sim/MCTruth/MCTruth/VTrackInformation.h +++ b/Simulation/G4Sim/MCTruth/MCTruth/VTrackInformation.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration */ #ifndef VTrackInformation_H @@ -29,7 +29,7 @@ public: virtual void SetReturnedToISF(bool) ; virtual void Print() const {} void SetClassification(TrackClassification tc) {m_classify=tc;} - TrackClassification GetClassification() {return m_classify;} + TrackClassification GetClassification() const {return m_classify;} private: TrackClassification m_classify; HepMC::ConstGenParticlePtr m_thePrimaryParticle{}; diff --git a/Simulation/ISF/ISF_Geant4/ISF_Geant4Tools/src/TransportTool.cxx b/Simulation/ISF/ISF_Geant4/ISF_Geant4Tools/src/TransportTool.cxx index fb28db9d30faf071df7c019f1955a91ebfcb9ef3..5dc9ae819696b3faf02daade04d00b7ee8a3fd09 100644 --- a/Simulation/ISF/ISF_Geant4/ISF_Geant4Tools/src/TransportTool.cxx +++ b/Simulation/ISF/ISF_Geant4/ISF_Geant4Tools/src/TransportTool.cxx @@ -227,10 +227,11 @@ StatusCode iGeant4::G4TransportTool::finalize() if (m_doTiming) { m_runTimer->Stop(); - float runTime=m_runTimer->GetUserElapsed()+m_runTimer->GetSystemElapsed(); - float avgTimePerEvent=(m_nrOfEntries>1) ? m_accumulatedEventTime/(m_nrOfEntries-1.) : runTime; - float sigma=( m_nrOfEntries>2) ? std::sqrt((m_accumulatedEventTimeSq/float(m_nrOfEntries-1)- - avgTimePerEvent*avgTimePerEvent)/float(m_nrOfEntries-2)) : 0; + const float numEntriesFloat(m_nrOfEntries); + const float runTime=m_runTimer->GetUserElapsed()+m_runTimer->GetSystemElapsed(); + const float avgTimePerEvent=(m_nrOfEntries>1) ? m_accumulatedEventTime/(numEntriesFloat-1.f) : runTime; + const float avgTimeSqPerEvent=(m_nrOfEntries>1) ? m_accumulatedEventTimeSq/(numEntriesFloat-1.f) : runTime*runTime; + const float sigma=(m_nrOfEntries>2) ? std::sqrt(std::abs(avgTimeSqPerEvent - avgTimePerEvent*avgTimePerEvent)/(numEntriesFloat-2.f)) : 0; ATH_MSG_INFO("*****************************************"<<endmsg<< "** **"<<endmsg<< " End of run - time spent is "<<std::setprecision(4) << @@ -416,15 +417,16 @@ StatusCode iGeant4::G4TransportTool::releaseEvent(const EventContext&) if (m_doTiming) { m_eventTimer->Stop(); - double eventTime=m_eventTimer->GetUserElapsed()+m_eventTimer->GetSystemElapsed(); + const double eventTime=m_eventTimer->GetUserElapsed()+m_eventTimer->GetSystemElapsed(); if (m_nrOfEntries>1) { m_accumulatedEventTime +=eventTime; m_accumulatedEventTimeSq+=eventTime*eventTime; } - float avgTimePerEvent=(m_nrOfEntries>1) ? m_accumulatedEventTime/(m_nrOfEntries-1.) : eventTime; - float sigma=(m_nrOfEntries>2) ? std::sqrt((m_accumulatedEventTimeSq/float(m_nrOfEntries-1)- - avgTimePerEvent*avgTimePerEvent)/float(m_nrOfEntries-2)) : 0.; + const float numEntriesFloat(m_nrOfEntries); + const float avgTimePerEvent=(m_nrOfEntries>1) ? m_accumulatedEventTime/(numEntriesFloat-1.f) : eventTime; + const float avgTimeSqPerEvent=(m_nrOfEntries>1) ? m_accumulatedEventTimeSq/(numEntriesFloat-1.f) : eventTime*eventTime; + const float sigma=(m_nrOfEntries>2) ? std::sqrt(std::abs(avgTimeSqPerEvent - avgTimePerEvent*avgTimePerEvent)/(numEntriesFloat-2.f)) : 0; ATH_MSG_INFO("\t Event nr. "<<m_nrOfEntries<<" took " << std::setprecision(4) << eventTime << " s. New average " << std::setprecision(4) << diff --git a/Simulation/ISF/ISF_ParametricSim/ISF_ParSimTools/ISF_ParSimTools/DefaultSmearer.h b/Simulation/ISF/ISF_ParametricSim/ISF_ParSimTools/ISF_ParSimTools/DefaultSmearer.h index 5cdb6389f6750d5d56f1eecc1fbc18cb247505d1..80904dd47cf50771fed6160b3ea5cb683739765a 100644 --- a/Simulation/ISF/ISF_ParametricSim/ISF_ParSimTools/ISF_ParSimTools/DefaultSmearer.h +++ b/Simulation/ISF/ISF_ParametricSim/ISF_ParSimTools/ISF_ParSimTools/DefaultSmearer.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration */ /////////////////////////////////////////////////////////////////// @@ -14,7 +14,6 @@ #include "ISF_ParSimInterfaces/IChargedSmearer.h" // Gaudi #include "AthenaBaseComps/AthAlgTool.h" -#include "AthenaKernel/IAtRndmGenSvc.h" #include "GaudiKernel/RndmGenerators.h" #include "GaudiKernel/ServiceHandle.h" #include "GaudiKernel/ToolHandle.h" diff --git a/Simulation/ISF/ISF_ParametricSim/ISF_ParSimTools/ISF_ParSimTools/ElectronSmearer.h b/Simulation/ISF/ISF_ParametricSim/ISF_ParSimTools/ISF_ParSimTools/ElectronSmearer.h index e8a0e7c4633d12d935496491c2fd6c7b78ccca32..6bb398539c1b776bd1de5d9a4485b55f051078df 100644 --- a/Simulation/ISF/ISF_ParametricSim/ISF_ParSimTools/ISF_ParSimTools/ElectronSmearer.h +++ b/Simulation/ISF/ISF_ParametricSim/ISF_ParSimTools/ISF_ParSimTools/ElectronSmearer.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration */ /////////////////////////////////////////////////////////////////// @@ -14,7 +14,6 @@ #include "ISF_ParSimInterfaces/IChargedSmearer.h" // Gaudi #include "AthenaBaseComps/AthAlgTool.h" -#include "AthenaKernel/IAtRndmGenSvc.h" #include "GaudiKernel/RndmGenerators.h" #include "GaudiKernel/ServiceHandle.h" #include "GaudiKernel/ToolHandle.h" diff --git a/Simulation/ISF/ISF_ParametricSim/ISF_ParSimTools/ISF_ParSimTools/MuonSmearer.h b/Simulation/ISF/ISF_ParametricSim/ISF_ParSimTools/ISF_ParSimTools/MuonSmearer.h index 0cfcda8d01743260f1a33dfedf94d2dfcf17c40f..8207e6c340261b22e103ca19cde6655c814a48eb 100644 --- a/Simulation/ISF/ISF_ParametricSim/ISF_ParSimTools/ISF_ParSimTools/MuonSmearer.h +++ b/Simulation/ISF/ISF_ParametricSim/ISF_ParSimTools/ISF_ParSimTools/MuonSmearer.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration */ /////////////////////////////////////////////////////////////////// @@ -14,7 +14,6 @@ // Gaudi #include "AthenaBaseComps/AthAlgTool.h" -#include "AthenaKernel/IAtRndmGenSvc.h" #include "GaudiKernel/RndmGenerators.h" #include "GaudiKernel/ServiceHandle.h" #include "GaudiKernel/ToolHandle.h" diff --git a/Simulation/ISF/ISF_ParametricSim/ISF_ParSimTools/ISF_ParSimTools/PionSmearer.h b/Simulation/ISF/ISF_ParametricSim/ISF_ParSimTools/ISF_ParSimTools/PionSmearer.h index 7beeec3e7968fc7dfff11553f03f3d1fe6457fc1..06a0918dab5b04ddfefa1ee72073df68709a1cf9 100644 --- a/Simulation/ISF/ISF_ParametricSim/ISF_ParSimTools/ISF_ParSimTools/PionSmearer.h +++ b/Simulation/ISF/ISF_ParametricSim/ISF_ParSimTools/ISF_ParSimTools/PionSmearer.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration */ /////////////////////////////////////////////////////////////////// @@ -14,7 +14,6 @@ #include "ISF_ParSimInterfaces/IChargedSmearer.h" // Gaudi #include "AthenaBaseComps/AthAlgTool.h" -#include "AthenaKernel/IAtRndmGenSvc.h" #include "GaudiKernel/RndmGenerators.h" #include "GaudiKernel/ServiceHandle.h" #include "GaudiKernel/ToolHandle.h" diff --git a/Simulation/ISF/ISF_ParametricSim/ISF_ParSimTools/ISF_ParSimTools/TrackParticleSmearer.h b/Simulation/ISF/ISF_ParametricSim/ISF_ParSimTools/ISF_ParSimTools/TrackParticleSmearer.h index 43e7b53025bdbc7ae069616c49b5c906c5023558..f94d7f5deeed73155d6974218164ae2821ad0df5 100644 --- a/Simulation/ISF/ISF_ParametricSim/ISF_ParSimTools/ISF_ParSimTools/TrackParticleSmearer.h +++ b/Simulation/ISF/ISF_ParametricSim/ISF_ParSimTools/ISF_ParSimTools/TrackParticleSmearer.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration */ /////////////////////////////////////////////////////////////////// @@ -15,7 +15,6 @@ #include "ISF_ParSimInterfaces/IISPtoPerigeeTool.h" // Gaudi #include "AthenaBaseComps/AthAlgTool.h" -#include "AthenaKernel/IAtRndmGenSvc.h" #include "GaudiKernel/RndmGenerators.h" #include "GaudiKernel/ServiceHandle.h" #include "GaudiKernel/ToolHandle.h" diff --git a/Simulation/SimuJobTransforms/share/skeleton.EVGENtoHIT.py b/Simulation/SimuJobTransforms/share/skeleton.EVGENtoHIT.py index 353b7d0b84dcd2355935f5dc0eae4c8554b233f8..70e4b9c3b6e55c8ca3a21a3eea0b670cc1705004 100644 --- a/Simulation/SimuJobTransforms/share/skeleton.EVGENtoHIT.py +++ b/Simulation/SimuJobTransforms/share/skeleton.EVGENtoHIT.py @@ -17,12 +17,12 @@ if hasattr(runArgs, 'truthStrategy'): try: from BarcodeServices.BarcodeServicesConfig import barcodeOffsetForTruthStrategy - simFlags.SimBarcodeOffset = barcodeOffsetForTruthStrategy(str(simFlags.TruthStrategy)) + simFlags.SimBarcodeOffset = barcodeOffsetForTruthStrategy(str(simFlags.TruthStrategy.get_Value())) except RuntimeError: Offset200kStrings = ['MC12', 'MC15a', 'MC16'] - is200kOffset = any(x in str(simFlags.TruthStrategy) for x in Offset200kStrings) + is200kOffset = any(x in str(simFlags.TruthStrategy.get_Value()) for x in Offset200kStrings) if is200kOffset: simFlags.SimBarcodeOffset = 200000 #MC12, MC15a, MC16 setting else: simFlags.SimBarcodeOffset = 1000000 #MC15 setting - atlasG4log.warning('Using unknown truth strategy '+str(simFlags.TruthStrategy)+' guessing that barcode offset is '+str(simFlags.SimBarcodeOffset)) + atlasG4log.warning('Using unknown truth strategy '+str(simFlags.TruthStrategy.get_Value())+' guessing that barcode offset is '+str(simFlags.SimBarcodeOffset.get_Value())) diff --git a/Simulation/SimuJobTransforms/share/skeleton.EVGENtoHIT_ISF.py b/Simulation/SimuJobTransforms/share/skeleton.EVGENtoHIT_ISF.py index 37a3b9edc9c538723d1cb36ea42177ec858c6903..a54e6dc388a72a676274b064be0a53be4ffd0013 100644 --- a/Simulation/SimuJobTransforms/share/skeleton.EVGENtoHIT_ISF.py +++ b/Simulation/SimuJobTransforms/share/skeleton.EVGENtoHIT_ISF.py @@ -208,7 +208,7 @@ if hasattr(runArgs, 'physicsList'): if hasattr(runArgs, "randomSeed"): simFlags.RandomSeedOffset = int(runArgs.randomSeed) else: - atlasG4log.warning('randomSeed not set') + atlasG4log.info('randomSeed not set') ## Don't use the SeedsG4 override simFlags.SeedsG4.set_Off() diff --git a/Simulation/SimuJobTransforms/share/skeleton.EVGENtoHIT_MC12.py b/Simulation/SimuJobTransforms/share/skeleton.EVGENtoHIT_MC12.py index 6fd9a9207384e0f95a0adb9fedd2ef14fe9fad04..e9fd5c09c04897cb3cfb3be8808c47953ce62c45 100644 --- a/Simulation/SimuJobTransforms/share/skeleton.EVGENtoHIT_MC12.py +++ b/Simulation/SimuJobTransforms/share/skeleton.EVGENtoHIT_MC12.py @@ -188,7 +188,7 @@ if hasattr(runArgs, 'physicsList'): if hasattr(runArgs, "randomSeed"): simFlags.RandomSeedOffset = int(runArgs.randomSeed) else: - atlasG4log.warning('randomSeed not set') + atlasG4log.info('randomSeed not set') ## Don't use the SeedsG4 override simFlags.SeedsG4.set_Off() diff --git a/Simulation/SimuJobTransforms/share/skeleton.ReSim.py b/Simulation/SimuJobTransforms/share/skeleton.ReSim.py index 67a6b564e8876e4cd512426c9c79ddeded64479b..0b1c4e4a1d3a8b1c75e5330f6924c17bfcc5d949 100644 --- a/Simulation/SimuJobTransforms/share/skeleton.ReSim.py +++ b/Simulation/SimuJobTransforms/share/skeleton.ReSim.py @@ -156,7 +156,7 @@ if hasattr(runArgs, 'physicsList'): if hasattr(runArgs, "randomSeed"): simFlags.RandomSeedOffset = int(runArgs.randomSeed) else: - atlasG4log.warning('randomSeed not set') + atlasG4log.info('randomSeed not set') ## Don't use the SeedsG4 override simFlags.SeedsG4.set_Off() diff --git a/Simulation/SimuJobTransforms/share/skeleton.TestBeam.py b/Simulation/SimuJobTransforms/share/skeleton.TestBeam.py index 0578c2ff07ea1bcad235b7411656953d796ce685..647051d0976be35ae250d80e6c752f861ef85996 100644 --- a/Simulation/SimuJobTransforms/share/skeleton.TestBeam.py +++ b/Simulation/SimuJobTransforms/share/skeleton.TestBeam.py @@ -123,7 +123,7 @@ if hasattr(runArgs, 'physicsList'): if hasattr(runArgs, "randomSeed"): simFlags.RandomSeedOffset = int(runArgs.randomSeed) else: - atlasG4log.warning('randomSeed not set') + atlasG4log.info('randomSeed not set') if hasattr(runArgs,"Eta") and ( hasattr(runArgs,"Theta") or hasattr(runArgs,"Z") ): raise RuntimeError("Eta cannot be specified at the same time as Theta and Z.") diff --git a/Simulation/Tests/SimCoreTests/test/test_AtlasG4_2010GeomSim.sh b/Simulation/Tests/SimCoreTests/test/test_AtlasG4_2010GeomSim.sh index 02ef860504d03d3d3c92c7920df7b5076b0c364b..0dcc6c2e23b249539b8915242add3eacdcaedd5c 100755 --- a/Simulation/Tests/SimCoreTests/test/test_AtlasG4_2010GeomSim.sh +++ b/Simulation/Tests/SimCoreTests/test/test_AtlasG4_2010GeomSim.sh @@ -4,7 +4,7 @@ # art-include: master/Athena # art-include: master/AthSimulation # art-type: grid -# art-output: test.*.HITS.pool.root +# art-output: *.HITS.pool.root # art-output: log.* # art-output: Config*.pkl @@ -64,7 +64,7 @@ echo "art-result: $rc2 simOLD" rc3=-9999 if [ $rc -eq 0 ] && [ $rc2 -eq 0 ] then - acmd.py diff-root test.HITS.pool.root test.CA.HITS.pool.root --error-mode resilient --mode=semi-detailed --order-trees --ignore-leaves RecoTimingObj_p1_AtlasG4Tf_timings index_ref + acmd.py diff-root test.HITS.pool.root test.CA.HITS.pool.root --error-mode resilient --mode=semi-detailed --order-trees --ignore-leaves RecoTimingObj_p1_EVNTtoHITS_timings index_ref rc3=$? fi echo "art-result: $rc3 OLDvsCA" @@ -72,7 +72,9 @@ echo "art-result: $rc3 OLDvsCA" rc4=-9999 if [ $rc2 -eq 0 ] then - art.py compare grid --entries 10 --mode=semi-detailed test.HITS.pool.root + ArtPackage=$1 + ArtJobName=$2 + art.py compare grid --entries 10 ${ArtPackage} ${ArtJobName} --mode=semi-detailed --file=test.HITS.pool.root rc4=$? fi echo "art-result: $rc4 regression" diff --git a/Simulation/Tests/SimCoreTests/test/test_AtlasG4_2011GeomSim.sh b/Simulation/Tests/SimCoreTests/test/test_AtlasG4_2011GeomSim.sh index a0e43469f6155b82dfa1ca1363036902ad6c1175..bb27cf650f35e864a7fb8445d60b852512340c8f 100755 --- a/Simulation/Tests/SimCoreTests/test/test_AtlasG4_2011GeomSim.sh +++ b/Simulation/Tests/SimCoreTests/test/test_AtlasG4_2011GeomSim.sh @@ -4,7 +4,7 @@ # art-include: master/Athena # art-include: master/AthSimulation # art-type: grid -# art-output: test.*.HITS.pool.root +# art-output: *.HITS.pool.root # art-output: log.* # art-output: Config*.pkl @@ -64,7 +64,7 @@ echo "art-result: $rc2 simOLD" rc3=-9999 if [ $rc -eq 0 ] && [ $rc2 -eq 0 ] then - acmd.py diff-root test.HITS.pool.root test.CA.HITS.pool.root --error-mode resilient --mode=semi-detailed --order-trees --ignore-leaves RecoTimingObj_p1_AtlasG4Tf_timings index_ref + acmd.py diff-root test.HITS.pool.root test.CA.HITS.pool.root --error-mode resilient --mode=semi-detailed --order-trees --ignore-leaves RecoTimingObj_p1_EVNTtoHITS_timings index_ref rc3=$? fi echo "art-result: $rc3 OLDvsCA" @@ -72,7 +72,9 @@ echo "art-result: $rc3 OLDvsCA" rc4=-9999 if [ $rc2 -eq 0 ] then - art.py compare grid --entries 10 --mode=semi-detailed test.HITS.pool.root + ArtPackage=$1 + ArtJobName=$2 + art.py compare grid --entries 10 ${ArtPackage} ${ArtJobName} --mode=semi-detailed --file=test.HITS.pool.root rc4=$? fi echo "art-result: $rc4 regression" diff --git a/Simulation/Tests/SimCoreTests/test/test_AtlasG4_2012GeomSim.sh b/Simulation/Tests/SimCoreTests/test/test_AtlasG4_2012GeomSim.sh index ab9258e83d1ad0f09f013547c0b930b8e3696dae..9a69a9020fbfad0d1ad431e14c52db1a0f70a4d4 100755 --- a/Simulation/Tests/SimCoreTests/test/test_AtlasG4_2012GeomSim.sh +++ b/Simulation/Tests/SimCoreTests/test/test_AtlasG4_2012GeomSim.sh @@ -4,7 +4,7 @@ # art-include: master/Athena # art-include: master/AthSimulation # art-type: grid -# art-output: test.*.HITS.pool.root +# art-output: *.HITS.pool.root # art-output: log.* # art-output: Config*.pkl @@ -64,7 +64,7 @@ echo "art-result: $rc2 simOLD" rc3=-9999 if [ $rc -eq 0 ] && [ $rc2 -eq 0 ] then - acmd.py diff-root test.HITS.pool.root test.CA.HITS.pool.root --error-mode resilient --mode=semi-detailed --order-trees --ignore-leaves RecoTimingObj_p1_AtlasG4Tf_timings index_ref + acmd.py diff-root test.HITS.pool.root test.CA.HITS.pool.root --error-mode resilient --mode=semi-detailed --order-trees --ignore-leaves RecoTimingObj_p1_EVNTtoHITS_timings index_ref rc3=$? fi echo "art-result: $rc3 OLDvsCA" @@ -72,7 +72,9 @@ echo "art-result: $rc3 OLDvsCA" rc4=-9999 if [ $rc2 -eq 0 ] then - art.py compare grid --entries 10 --mode=semi-detailed test.HITS.pool.root + ArtPackage=$1 + ArtJobName=$2 + art.py compare grid --entries 10 ${ArtPackage} ${ArtJobName} --mode=semi-detailed --file=test.HITS.pool.root rc4=$? fi echo "art-result: $rc4 regression" diff --git a/Simulation/Tests/SimCoreTests/test/test_AtlasG4_CavernBg_EVNT2TR.sh b/Simulation/Tests/SimCoreTests/test/test_AtlasG4_CavernBg_EVNT2TR.sh index c99897ee7bd3bd5a786127e213914d0d366f1e59..60294ed5c4d574b30883f78903e7d1e1bc2ae018 100755 --- a/Simulation/Tests/SimCoreTests/test/test_AtlasG4_CavernBg_EVNT2TR.sh +++ b/Simulation/Tests/SimCoreTests/test/test_AtlasG4_CavernBg_EVNT2TR.sh @@ -3,7 +3,7 @@ # art-description: Run simulation outside ISF, reading min bias events, write cavern background track records, using 2015 geometry and conditions # art-type: grid # art-include: master/Athena -# art-output: test.*.EVNT_TR.pool.root +# art-output: *.EVNT_TR.pool.root # art-output: log.* # art-output: Config*.pkl @@ -69,7 +69,7 @@ rm discard.HITS.pool.root rc3=-9999 if [ $rc -eq 0 ] && [ $rc2 -eq 0 ] then - acmd.py diff-root test.EVNT_TR.pool.root test.CA.EVNT_TR.pool.root --error-mode resilient --mode=semi-detailed --order-trees --ignore-leaves RecoTimingObj_p1_AtlasG4Tf_timings index_ref + acmd.py diff-root test.EVNT_TR.pool.root test.CA.EVNT_TR.pool.root --error-mode resilient --mode=semi-detailed --order-trees --ignore-leaves RecoTimingObj_p1_EVNTtoHITS_timings index_ref rc3=$? fi echo "art-result: $rc3 OLDvsCA" @@ -77,7 +77,9 @@ echo "art-result: $rc3 OLDvsCA" rc4=-9999 if [ $rc2 -eq 0 ] then - art.py compare grid --entries 2 --mode=semi-detailed test.EVNT_TR.pool.root + ArtPackage=$1 + ArtJobName=$2 + art.py compare grid --entries 2 ${ArtPackage} ${ArtJobName} --mode=semi-detailed --file=test.EVNT_TR.pool.root rc4=$? fi echo "art-result: $rc4 regression" diff --git a/Simulation/Tests/SimCoreTests/test/test_AtlasG4_CavernBg_TR2HITS.sh b/Simulation/Tests/SimCoreTests/test/test_AtlasG4_CavernBg_TR2HITS.sh index 5a500c8dca451c6e03a2abd0742f8569b05cbda2..31d5720331b57305faa42871a4170655650cea30 100755 --- a/Simulation/Tests/SimCoreTests/test/test_AtlasG4_CavernBg_TR2HITS.sh +++ b/Simulation/Tests/SimCoreTests/test/test_AtlasG4_CavernBg_TR2HITS.sh @@ -2,7 +2,7 @@ # # art-description: Run simulation outside ISF, reading cavern background track records, writing cavern background HITS, using 2015 geometry and conditions # art-type: grid -# art-output: test.*.HITS.pool.root +# art-output: *.HITS.pool.root # art-output: log.* # art-output: Config*.pkl @@ -62,7 +62,7 @@ echo "art-result: $rc2 simOLD" rc3=-9999 if [ $rc -eq 0 ] && [ $rc2 -eq 0 ] then - acmd.py diff-root test.HITS.pool.root test.CA.HITS.pool.root --error-mode resilient --mode=semi-detailed --order-trees --ignore-leaves RecoTimingObj_p1_AtlasG4Tf_timings index_ref + acmd.py diff-root test.HITS.pool.root test.CA.HITS.pool.root --error-mode resilient --mode=semi-detailed --order-trees --ignore-leaves RecoTimingObj_p1_EVNTtoHITS_timings index_ref rc3=$? fi echo "art-result: $rc3 OLDvsCA" @@ -70,7 +70,9 @@ echo "art-result: $rc3 OLDvsCA" rc4=-9999 if [ $rc2 -eq 0 ] then - art.py compare grid --entries 5 --mode=semi-detailed test.HITS.pool.root + ArtPackage=$1 + ArtJobName=$2 + art.py compare grid --entries 5 ${ArtPackage} ${ArtJobName} --mode=semi-detailed --file=test.HITS.pool.root rc4=$? fi echo "art-result: $rc4 regression" diff --git a/Simulation/Tests/SimCoreTests/test/test_AtlasG4_CosmicSim.sh b/Simulation/Tests/SimCoreTests/test/test_AtlasG4_CosmicSim.sh index 83bd6150aa877e8e0de74bcf1cd69bf4f3f441ca..c2a5fae0632871722343c78edb0c11274c4fa7e2 100755 --- a/Simulation/Tests/SimCoreTests/test/test_AtlasG4_CosmicSim.sh +++ b/Simulation/Tests/SimCoreTests/test/test_AtlasG4_CosmicSim.sh @@ -3,8 +3,8 @@ # art-description: Run cosmics simulation outside ISF, generating events on-the-fly, using 2015 geometry and conditions # art-include: master/Athena # art-type: grid -# art-output: test.*.HITS.pool.root -# art-output: test.*.TR.pool.root +# art-output: *.HITS.pool.root +# art-output: *.TR.pool.root # art-output: log.* # art-output: Config*.pkl @@ -73,7 +73,7 @@ echo "art-result: $rc2 simOLD" rc3=-9999 if [ $rc -eq 0 ] && [ $rc2 -eq 0 ] then - acmd.py diff-root test.TR.pool.root test.CA.TR.pool.root --error-mode resilient --mode=semi-detailed --order-trees --ignore-leaves RecoTimingObj_p1_AtlasG4Tf_timings index_ref + acmd.py diff-root test.TR.pool.root test.CA.TR.pool.root --error-mode resilient --mode=semi-detailed --order-trees --ignore-leaves RecoTimingObj_p1_EVNTtoHITS_timings index_ref rc3=$? fi echo "art-result: $rc3 TR_OLDvsCA" @@ -81,7 +81,7 @@ echo "art-result: $rc3 TR_OLDvsCA" rc4=-9999 if [ $rc -eq 0 ] && [ $rc2 -eq 0 ] then - acmd.py diff-root test.HITS.pool.root test.CA.HITS.pool.root --error-mode resilient --mode=semi-detailed --order-trees --ignore-leaves RecoTimingObj_p1_AtlasG4Tf_timings index_ref + acmd.py diff-root test.HITS.pool.root test.CA.HITS.pool.root --error-mode resilient --mode=semi-detailed --order-trees --ignore-leaves RecoTimingObj_p1_EVNTtoHITS_timings index_ref rc4=$? fi echo "art-result: $rc4 HITS_OLDvsCA" @@ -89,7 +89,9 @@ echo "art-result: $rc4 HITS_OLDvsCA" rc5=-9999 if [ $rc2 -eq 0 ] then - art.py compare grid --entries 10 --mode=semi-detailed test.HITS.pool.root test.TR.pool.root + ArtPackage=$1 + ArtJobName=$2 + art.py compare grid --entries 10 ${ArtPackage} ${ArtJobName} --mode=semi-detailed --file=test.HITS.pool.root test.TR.pool.root rc5=$? fi echo "art-result: $rc5 regression" diff --git a/Simulation/Tests/SimCoreTests/test/test_AtlasG4_CosmicSimTR.sh b/Simulation/Tests/SimCoreTests/test/test_AtlasG4_CosmicSimTR.sh index f06eff0347ef6f0a59394f8305e047340d08a524..38a4dd97cbdb6e55bbc2ff2ecb9ec323b8c57fb0 100755 --- a/Simulation/Tests/SimCoreTests/test/test_AtlasG4_CosmicSimTR.sh +++ b/Simulation/Tests/SimCoreTests/test/test_AtlasG4_CosmicSimTR.sh @@ -3,7 +3,7 @@ # art-description: Run cosmics simulation outside ISF, using TrackRecords as input, using 2015 geometry and conditions # art-type: grid # art-include: master/Athena -# art-output: test.*.HITS.pool.root +# art-output: *.HITS.pool.root # art-output: log.* # art-output: Config*.pkl @@ -66,7 +66,7 @@ echo "art-result: $rc2 simOLD" rc3=-9999 if [ $rc -eq 0 ] && [ $rc2 -eq 0 ] then - acmd.py diff-root test.HITS.pool.root test.CA.HITS.pool.root --error-mode resilient --mode=semi-detailed --order-trees --ignore-leaves RecoTimingObj_p1_AtlasG4Tf_timings index_ref + acmd.py diff-root test.HITS.pool.root test.CA.HITS.pool.root --error-mode resilient --mode=semi-detailed --order-trees --ignore-leaves RecoTimingObj_p1_EVNTtoHITS_timings index_ref rc3=$? fi echo "art-result: $rc3 OLDvsCA" @@ -74,7 +74,9 @@ echo "art-result: $rc3 OLDvsCA" rc4=-9999 if [ $rc2 -eq 0 ] then - art.py compare grid --entries 10 --mode=semi-detailed test.HITS.pool.root + ArtPackage=$1 + ArtJobName=$2 + art.py compare grid --entries 10 ${ArtPackage} ${ArtJobName} --mode=semi-detailed --file=test.HITS.pool.root rc4=$? fi echo "art-result: $rc4 regression" diff --git a/Simulation/Tests/SimCoreTests/test/test_AtlasG4_FrozenShowerFCalOnly.sh b/Simulation/Tests/SimCoreTests/test/test_AtlasG4_FrozenShowerFCalOnly.sh index dfebcc22994e0a38e0f1a25afeb98a8230b9e3ee..70417b4ff5c68e6cce020ec9e9a1080dc426e272 100755 --- a/Simulation/Tests/SimCoreTests/test/test_AtlasG4_FrozenShowerFCalOnly.sh +++ b/Simulation/Tests/SimCoreTests/test/test_AtlasG4_FrozenShowerFCalOnly.sh @@ -4,7 +4,7 @@ # art-include: master/Athena # art-include: master/AthSimulation # art-type: grid -# art-output: test.*.HITS.pool.root +# art-output: *.HITS.pool.root # art-output: log.* # art-output: Config*.pkl @@ -67,7 +67,7 @@ echo "art-result: $rc2 simOLD" rc3=-9999 if [ $rc -eq 0 ] && [ $rc2 -eq 0 ] then - acmd.py diff-root test.HITS.pool.root test.CA.HITS.pool.root --error-mode resilient --mode=semi-detailed --order-trees --ignore-leaves RecoTimingObj_p1_AtlasG4Tf_timings index_ref + acmd.py diff-root test.HITS.pool.root test.CA.HITS.pool.root --error-mode resilient --mode=semi-detailed --order-trees --ignore-leaves RecoTimingObj_p1_EVNTtoHITS_timings index_ref rc3=$? fi echo "art-result: $rc3 OLDvsCA" @@ -75,7 +75,9 @@ echo "art-result: $rc3 OLDvsCA" rc4=-9999 if [ $rc2 -eq 0 ] then - art.py compare grid --entries 10 --mode=semi-detailed test.HITS.pool.root + ArtPackage=$1 + ArtJobName=$2 + art.py compare grid --entries 10 ${ArtPackage} ${ArtJobName} --mode=semi-detailed --file=test.HITS.pool.root rc4=$? fi echo "art-result: $rc4 regression" diff --git a/Simulation/Tests/SimCoreTests/test/test_AtlasG4_FtfpBertAtlTest_CGvsCA.sh b/Simulation/Tests/SimCoreTests/test/test_AtlasG4_FtfpBertAtlTest_CGvsCA.sh index c9261ae56c7f1cee95435c6dfa4b16476485b6b1..18d6409cdf762b5eda723fd44d8953d0db151333 100755 --- a/Simulation/Tests/SimCoreTests/test/test_AtlasG4_FtfpBertAtlTest_CGvsCA.sh +++ b/Simulation/Tests/SimCoreTests/test/test_AtlasG4_FtfpBertAtlTest_CGvsCA.sh @@ -4,7 +4,7 @@ # art-include: master/Athena # art-include: master/AthSimulation # art-type: grid -# art-output: test.*.HITS.pool.root +# art-output: *.HITS.pool.root # art-output: log.* # art-output: Config*.pkl @@ -65,7 +65,7 @@ echo "art-result: $rc2 simOLD" rc4=-9999 if [ $rc2 -eq 0 ] then - acmd.py diff-root test.HITS.pool.root test.CA.HITS.pool.root --error-mode resilient --mode=semi-detailed --order-trees --ignore-leaves RecoTimingObj_p1_AtlasG4Tf_timings index_ref + acmd.py diff-root test.HITS.pool.root test.CA.HITS.pool.root --error-mode resilient --mode=semi-detailed --order-trees --ignore-leaves RecoTimingObj_p1_EVNTtoHITS_timings index_ref rc4=$? fi echo "art-result: $rc4 FullG4MT_OLDvsCA" diff --git a/Simulation/Tests/SimCoreTests/test/test_AtlasG4_HeavyIonSim.sh b/Simulation/Tests/SimCoreTests/test/test_AtlasG4_HeavyIonSim.sh index 70ab3db396c79d20f90f23c4cce419db5c4242ae..15a54d6cab5e74e7614a7076e531990cc4575c1b 100755 --- a/Simulation/Tests/SimCoreTests/test/test_AtlasG4_HeavyIonSim.sh +++ b/Simulation/Tests/SimCoreTests/test/test_AtlasG4_HeavyIonSim.sh @@ -3,7 +3,7 @@ # art-description: Run simulation outside ISF, reading lead ions peripheral simulation (low multiplicity) events, writing HITS, using 2015 geometry and conditions # art-include: master/Athena # art-type: grid -# art-output: test.*.HITS.pool.root +# art-output: *.HITS.pool.root # art-output: log.* # art-output: Config*.pkl @@ -64,7 +64,7 @@ echo "art-result: $rc2 simOLD" rc3=-9999 if [ $rc -eq 0 ] && [ $rc2 -eq 0 ] then - acmd.py diff-root test.HITS.pool.root test.CA.HITS.pool.root --error-mode resilient --mode=semi-detailed --order-trees --ignore-leaves RecoTimingObj_p1_AtlasG4Tf_timings index_ref + acmd.py diff-root test.HITS.pool.root test.CA.HITS.pool.root --error-mode resilient --mode=semi-detailed --order-trees --ignore-leaves RecoTimingObj_p1_EVNTtoHITS_timings index_ref rc3=$? fi echo "art-result: $rc3 OLDvsCA" @@ -72,7 +72,9 @@ echo "art-result: $rc3 OLDvsCA" rc4=-9999 if [ $rc2 -eq 0 ] then - art.py compare grid --entries 1 --mode=semi-detailed test.HITS.pool.root + ArtPackage=$1 + ArtJobName=$2 + art.py compare grid --entries 1 ${ArtPackage} ${ArtJobName} --mode=semi-detailed --file=test.HITS.pool.root rc4=$? fi echo "art-result: $rc4 regression" diff --git a/Simulation/Tests/SimCoreTests/test/test_AtlasG4_NeutronCutTest.sh b/Simulation/Tests/SimCoreTests/test/test_AtlasG4_NeutronCutTest.sh index dcf79fc84103bf567bf07c3295b8f6917291b36d..815ab87812dfeb9da8df08a38192f3054b7bdab0 100755 --- a/Simulation/Tests/SimCoreTests/test/test_AtlasG4_NeutronCutTest.sh +++ b/Simulation/Tests/SimCoreTests/test/test_AtlasG4_NeutronCutTest.sh @@ -3,7 +3,7 @@ # art-description: Run simulation outside ISF, reading Z->tau tau events, modifying the Neutron timing cut, writing HITS, using 2015 geometry and conditions # art-include: master/Athena # art-type: grid -# art-output: test.*.HITS.pool.root +# art-output: *.HITS.pool.root # art-output: log.* # art-output: Config*.pkl @@ -65,7 +65,7 @@ echo "art-result: $rc2 simOLD" rc3=-9999 if [ $rc -eq 0 ] && [ $rc2 -eq 0 ] then - acmd.py diff-root test.HITS.pool.root test.CA.HITS.pool.root --error-mode resilient --mode=semi-detailed --order-trees --ignore-leaves RecoTimingObj_p1_AtlasG4Tf_timings index_ref + acmd.py diff-root test.HITS.pool.root test.CA.HITS.pool.root --error-mode resilient --mode=semi-detailed --order-trees --ignore-leaves RecoTimingObj_p1_EVNTtoHITS_timings index_ref rc3=$? fi echo "art-result: $rc3 OLDvsCA" @@ -73,7 +73,9 @@ echo "art-result: $rc3 OLDvsCA" rc4=-9999 if [ $rc2 -eq 0 ] then - art.py compare grid --entries 5 --mode=semi-detailed test.HITS.pool.root + ArtPackage=$1 + ArtJobName=$2 + art.py compare grid --entries 5 ${ArtPackage} ${ArtJobName} --mode=semi-detailed --file=test.HITS.pool.root rc4=$? fi echo "art-result: $rc4 regression" diff --git a/Simulation/Tests/SimCoreTests/test/test_AtlasG4_QgsBicTest.sh b/Simulation/Tests/SimCoreTests/test/test_AtlasG4_QgsBicTest.sh index aa6adfdfc8b553c5b6a72bf2fe630be5de4a3603..85cf23f5b131f0e4ac052eaacbfe523543df17d5 100755 --- a/Simulation/Tests/SimCoreTests/test/test_AtlasG4_QgsBicTest.sh +++ b/Simulation/Tests/SimCoreTests/test/test_AtlasG4_QgsBicTest.sh @@ -4,7 +4,7 @@ # art-include: master/Athena # art-include: master/AthSimulation # art-type: grid -# art-output: test.*.HITS.pool.root +# art-output: *.HITS.pool.root # art-output: log.* # art-output: Config*.pkl @@ -64,7 +64,7 @@ echo "art-result: $rc2 simOLD" rc3=-9999 if [ $rc -eq 0 ] && [ $rc2 -eq 0 ] then - acmd.py diff-root test.HITS.pool.root test.CA.HITS.pool.root --error-mode resilient --mode=semi-detailed --order-trees --ignore-leaves RecoTimingObj_p1_AtlasG4Tf_timings index_ref + acmd.py diff-root test.HITS.pool.root test.CA.HITS.pool.root --error-mode resilient --mode=semi-detailed --order-trees --ignore-leaves RecoTimingObj_p1_EVNTtoHITS_timings index_ref rc3=$? fi echo "art-result: $rc3 OLDvsCA" @@ -72,7 +72,9 @@ echo "art-result: $rc3 OLDvsCA" rc4=-9999 if [ $rc2 -eq 0 ] then - art.py compare grid --entries 5 --mode=semi-detailed test.HITS.pool.root + ArtPackage=$1 + ArtJobName=$2 + art.py compare grid --entries 5 ${ArtPackage} ${ArtJobName} --mode=semi-detailed --file=test.HITS.pool.root rc4=$? fi echo "art-result: $rc4 regression" diff --git a/Simulation/Tests/SimCoreTests/test/test_AtlasG4_WriteCalHitsTest.sh b/Simulation/Tests/SimCoreTests/test/test_AtlasG4_WriteCalHitsTest.sh index 37c63b607777b5e13fe0a04ecdc5f7970b9fec78..3b1882f0431d71def4fadf3f50e35acfae3eb87e 100755 --- a/Simulation/Tests/SimCoreTests/test/test_AtlasG4_WriteCalHitsTest.sh +++ b/Simulation/Tests/SimCoreTests/test/test_AtlasG4_WriteCalHitsTest.sh @@ -3,7 +3,7 @@ # art-description: Reading in single particle gen events, writing out full CaloCalibrationHit information, using 2015 geometry and conditions # art-include: master/Athena # art-type: grid -# art-output: test.*.HITS.pool.root +# art-output: *.HITS.pool.root # art-output: log.* # art-output: Config*.pkl @@ -69,7 +69,7 @@ echo "art-result: $rc2 simOLD" rc3=-9999 if [ $rc -eq 0 ] && [ $rc2 -eq 0 ] then - acmd.py diff-root test.HITS.pool.root test.CA.HITS.pool.root --error-mode resilient --mode=semi-detailed --order-trees --ignore-leaves RecoTimingObj_p1_AtlasG4Tf_timings index_ref + acmd.py diff-root test.HITS.pool.root test.CA.HITS.pool.root --error-mode resilient --mode=semi-detailed --order-trees --ignore-leaves RecoTimingObj_p1_EVNTtoHITS_timings index_ref rc3=$? fi echo "art-result: $rc3 OLDvsCA" @@ -77,7 +77,9 @@ echo "art-result: $rc3 OLDvsCA" rc4=-9999 if [ $rc2 -eq 0 ] then - art.py compare grid --entries 10 --mode=semi-detailed test.HITS.pool.root + ArtPackage=$1 + ArtJobName=$2 + art.py compare grid --entries 10 ${ArtPackage} ${ArtJobName} --mode=semi-detailed --file=test.HITS.pool.root rc4=$? fi echo "art-result: $rc4 regression" diff --git a/Simulation/Tests/SimCoreTests/test/test_AtlasG4_ttbar_CGvsCA.sh b/Simulation/Tests/SimCoreTests/test/test_AtlasG4_ttbar_CGvsCA.sh index 9c049ca73e38b6af7f7a4d988e6bc1da384beb1e..91c3e5ec00f5cd7489e5cf7b9af01e0d38ce9170 100755 --- a/Simulation/Tests/SimCoreTests/test/test_AtlasG4_ttbar_CGvsCA.sh +++ b/Simulation/Tests/SimCoreTests/test/test_AtlasG4_ttbar_CGvsCA.sh @@ -5,8 +5,8 @@ # art-type: grid # art-output: log.* -# art-output: test.HITS.pool.root -# art-output: test.CA.HITS.pool.root +# art-output: HITS.pool.root +# art-output: CA.HITS.pool.root # art-output: Config*.pkl AtlasG4_tf.py \ @@ -55,7 +55,7 @@ echo "art-result: $rc2 simOLD" rc4=-9999 if [ $rc2 -eq 0 ] then - acmd.py diff-root test.HITS.pool.root test.CA.HITS.pool.root --error-mode resilient --mode=semi-detailed --order-trees --ignore-leaves RecoTimingObj_p1_AtlasG4Tf_timings index_ref + acmd.py diff-root test.HITS.pool.root test.CA.HITS.pool.root --error-mode resilient --mode=semi-detailed --order-trees --ignore-leaves RecoTimingObj_p1_EVNTtoHITS_timings index_ref rc4=$? fi echo "art-result: $rc4 FullG4MT_OLDvsCA" diff --git a/TileCalorimeter/TileSvc/TileByteStream/TileByteStream/TileROD_Decoder.h b/TileCalorimeter/TileSvc/TileByteStream/TileByteStream/TileROD_Decoder.h index 4de60229347d9b1f81370342ed950c8e36c7b844..c6c777157ee559c49768c324c23a972f2c9cc898 100644 --- a/TileCalorimeter/TileSvc/TileByteStream/TileByteStream/TileROD_Decoder.h +++ b/TileCalorimeter/TileSvc/TileByteStream/TileByteStream/TileROD_Decoder.h @@ -1022,9 +1022,6 @@ void TileROD_Decoder::fillCollection(const ROBData * rob, } else { - // remember all fragment types found in this ROD - int createdFrom = 0; - pDigiVec pDigits; pRwChVec pChannel; pChannel.reserve(48); @@ -1059,8 +1056,6 @@ void TileROD_Decoder::fillCollection(const ROBData * rob, ATH_MSG_VERBOSE( "Unpacking frag: 0x" << MSG::hex << (idAndType & 0xFFFF) << " type " << type << MSG::dec ); - createdFrom |= (1 << type); - switch (type) { case 0: if (m_useFrag0) unpack_frag0(version, sizeOverhead, digitsMetaData, p, pDigits); diff --git a/Tracking/TrkVertexFitter/TrkVKalVrtCore/TrkVKalVrtCore/TrkVKalVrtCoreBase.h b/Tracking/TrkVertexFitter/TrkVKalVrtCore/TrkVKalVrtCore/TrkVKalVrtCoreBase.h index c2d491ba761ea79ea5c9496327b7b3e40a6c9afa..69268318a4e5abb1785be6e88fb842f221b35cfb 100755 --- a/Tracking/TrkVertexFitter/TrkVKalVrtCore/TrkVKalVrtCore/TrkVKalVrtCoreBase.h +++ b/Tracking/TrkVertexFitter/TrkVKalVrtCore/TrkVKalVrtCore/TrkVKalVrtCoreBase.h @@ -184,7 +184,8 @@ namespace Trk { bool truncatedStep; int existFullCov; - double ader[(3*vkalNTrkM+3)*(3*vkalNTrkM+3)]{}; // was [903][903] + //this is quite large to 0 initialize here + double ader[(3*vkalNTrkM+3)*(3*vkalNTrkM+3)]; // was [903][903] public: // Object with defining information for VKalVrtCore library. // Each vertex has a copy of VKalVrtControl object what allows diff --git a/Tracking/TrkVertexFitter/TrkVKalVrtCore/src/CFitCascade.cxx b/Tracking/TrkVertexFitter/TrkVKalVrtCore/src/CFitCascade.cxx index 5e19688a4c6b15b20fc7551082a23ee80feca15a..7965a119b672c5c2e4284c2130cd58b6c6fccc22 100755 --- a/Tracking/TrkVertexFitter/TrkVKalVrtCore/src/CFitCascade.cxx +++ b/Tracking/TrkVertexFitter/TrkVKalVrtCore/src/CFitCascade.cxx @@ -255,17 +255,13 @@ int fitVertexCascade( VKVertex * vk, int Pointing) // // Iteration over complete cascade // - int processCascade(CascadeEvent & cascadeEvent_ ) +int processCascade(CascadeEvent & cascadeEvent_ ) { int translateToFittedPos(CascadeEvent &, double Step=1.); int restorePreviousPos(CascadeEvent &, std::vector<VKVertex> & ); VKVertex * vk; long int Iter, IERR, iv, i; - int countTrk=0; // Number of tracks in cascade - for( iv=0; iv<cascadeEvent_.cascadeNV; iv++){ - countTrk += cascadeEvent_.cascadeVertexList[iv]->TrackList.size(); - } //============================================================================================ // // First without pointing to get initial estimations and resolve mass constraints diff --git a/Tracking/TrkVertexFitter/TrkVKalVrtCore/src/CFitCascadeScale.cxx b/Tracking/TrkVertexFitter/TrkVKalVrtCore/src/CFitCascadeScale.cxx index eab8178064bf67ec5a724230d2aea02f31720986..37fd036be12d0559fd76c0af159c25a4387f906e 100755 --- a/Tracking/TrkVertexFitter/TrkVKalVrtCore/src/CFitCascadeScale.cxx +++ b/Tracking/TrkVertexFitter/TrkVKalVrtCore/src/CFitCascadeScale.cxx @@ -141,10 +141,6 @@ int fitVertexCascadeScale( VKVertex * vk, double & distToVertex ) VKVertex * vk=nullptr; long int Iter, IERR, iv; - int countTrk=0; // Number of tracks in cascade - for( iv=0; iv<cascadeEvent_.cascadeNV; iv++){ - countTrk += cascadeEvent_.cascadeVertexList[iv]->TrackList.size(); - } cascadeEvent_.setSCALE(1.); // Safety //============================================================================================ // diff --git a/Tracking/TrkVertexFitter/TrkVKalVrtCore/src/CascadeDefinition.cxx b/Tracking/TrkVertexFitter/TrkVKalVrtCore/src/CascadeDefinition.cxx index 348991dbb33a8008e0bf22cc8cd27f179d471790..a0d355be5ac6c5b82dcba77ee1ac7f7d56f032ef 100755 --- a/Tracking/TrkVertexFitter/TrkVKalVrtCore/src/CascadeDefinition.cxx +++ b/Tracking/TrkVertexFitter/TrkVKalVrtCore/src/CascadeDefinition.cxx @@ -88,7 +88,7 @@ int makeCascade(VKalVrtControl & FitCONTROL, long int NTRK, long int *ich, doubl double tmpWgt[15],out[3]; double vBx,vBy,vBz; VKTrack * trk; - int vEstimDone=0, nTrkTot=0; + int vEstimDone=0; for(iv=0; iv<NV; iv++){ auto VRT = std::make_unique< VKVertex >(FitCONTROL); @@ -96,12 +96,12 @@ int makeCascade(VKalVrtControl & FitCONTROL, long int NTRK, long int *ich, doubl VRT->setRefIterV(xyz); //iteration ref. point VRT->setIniV(xyz); VRT->setCnstV(xyz); // initial guess. 0 of course. auto arr = std::make_unique<double[]>(vertexDefinition[iv].size()*5); - int NTv=vertexDefinition[iv].size(); nTrkTot += NTv; + int NTv=vertexDefinition[iv].size(); for (it=0; it<NTv ; it++) { tk=vertexDefinition[iv][it]; if( tk >= NTRK ) { return -1; - } + } VRT->TrackList.emplace_back(new VKTrack(tk, &inp_Trk5[tk*5], &inp_CovTrk5[tk*15] , VRT.get(), wm[tk])); VRT->tmpArr.emplace_back(new TWRK()); trk = VRT->TrackList[it].get(); @@ -109,9 +109,9 @@ int makeCascade(VKalVrtControl & FitCONTROL, long int NTRK, long int *ich, doubl trk->iniP[0]=trk->cnstP[0]=trk->fitP[0]=inp_Trk5[tk*5+2]; //initial guess trk->iniP[1]=trk->cnstP[1]=trk->fitP[1]=inp_Trk5[tk*5+3]; trk->iniP[2]=trk->cnstP[2]=trk->fitP[2]=inp_Trk5[tk*5+4]; - IERR=cfInv5(&inp_CovTrk5[tk*15], tmpWgt); - if (IERR) IERR=cfdinv(&inp_CovTrk5[tk*15], tmpWgt, 5); - if (IERR) { return -1; } + IERR=cfInv5(&inp_CovTrk5[tk*15], tmpWgt); + if (IERR) IERR=cfdinv(&inp_CovTrk5[tk*15], tmpWgt, 5); + if (IERR) { return -1; } trk->setCurrent(&inp_Trk5[tk*5],tmpWgt); arr[it*5]=inp_Trk5[tk*5];arr[it*5+1]=inp_Trk5[tk*5+1];arr[it*5+2]=inp_Trk5[tk*5+2]; arr[it*5+3]=inp_Trk5[tk*5+3];arr[it*5+4]=inp_Trk5[tk*5+4]; @@ -177,10 +177,6 @@ int initCascadeEngine(CascadeEvent & cascadeEvent_) VKVertex * VRT; long int IERR=0, iv, i; - int countTrk=0; // Number of tracks in cascade - for( iv=0; iv<cascadeEvent_.cascadeNV; iv++){ - countTrk += cascadeEvent_.cascadeVertexList[iv]->TrackList.size(); - } //---------------------Some check----------- // VKMassConstraint * tmpc0=0; VKMassConstraint * tmpc1=0; // if(cascadeEvent_.cascadeVertexList[0]->ConstraintList.size()>0){ diff --git a/Tracking/TrkVertexFitter/TrkVKalVrtCore/src/CascadeUtils.cxx b/Tracking/TrkVertexFitter/TrkVKalVrtCore/src/CascadeUtils.cxx index 48edfcf8c94f1c0a9ffef0c3871874e1a99fe1db..3453159ee05749efc6b627bd54b4b6d36fd15459 100755 --- a/Tracking/TrkVertexFitter/TrkVKalVrtCore/src/CascadeUtils.cxx +++ b/Tracking/TrkVertexFitter/TrkVKalVrtCore/src/CascadeUtils.cxx @@ -40,7 +40,7 @@ int fixPseudoTrackPt(long int NPar, double * fullMtx, double * LSide, CascadeEve int posCombTrk=0; /* Conbined track position in global matrix */ VKVertex* vk = cascadeEvent_.cascadeVertexList[iv].get(); if(vk->nextCascadeVrt){ //next vertex exists - ivnext=-1; //index of next vertex in common structure + ivnext=-1; //index of next vertex in common structure for(int ivt=0;ivt<cascadeEvent_.cascadeNV;ivt++)if(vk->nextCascadeVrt==cascadeEvent_.cascadeVertexList[ivt].get())ivnext=ivt; if(ivnext<0){return -1;}; //error in cascade // @@ -62,27 +62,25 @@ int fixPseudoTrackPt(long int NPar, double * fullMtx, double * LSide, CascadeEve DerivT[posCombTrk+0]=-1.; DerivP[posCombTrk+1]=-1.; std::array<double, 4> ppsum = getIniParticleMom( vk->nextCascadeVrt->TrackList[indCombTrk].get(), vMagFld[ivnext] ); // INI for pseudo - double csum=vk->nextCascadeVrt->TrackList[indCombTrk]->iniP[2]; // INI for pseudo + double csum=vk->nextCascadeVrt->TrackList[indCombTrk]->iniP[2]; // INI for pseudo double ptsum=sqrt(ppsum[0]*ppsum[0] + ppsum[1]*ppsum[1]); double sinth2sum=(ppsum[0]*ppsum[0] + ppsum[1]*ppsum[1])/(ppsum[0]*ppsum[0] + ppsum[1]*ppsum[1] + ppsum[2]*ppsum[2]); // // Momenta+Derivatives of tracks in vertex itself - double tpx,tpy; tpx=tpy=0; - for(it=0; it<(int)vk->TrackList.size(); it++){ - std::array<double, 4> pp = getIniParticleMom( vk->TrackList[it].get(), vMagFld[iv]); + for(it=0; it<(int)vk->TrackList.size(); it++){ + std::array<double, 4> pp = getIniParticleMom( vk->TrackList[it].get(), vMagFld[iv]); double curv=vk->TrackList[it]->iniP[2]; - double pt=sqrt(pp[0]*pp[0] + pp[1]*pp[1]); - double cth=pp[2]/pt; - double sinth2=(pp[0]*pp[0] + pp[1]*pp[1])/(pp[0]*pp[0] + pp[1]*pp[1] + pp[2]*pp[2]); - DerivC[iniPosTrk+it*3+1] = csum/ptsum/ptsum*(ppsum[0]*pp[1]-ppsum[1]*pp[0]); // dC/dPhi_i - DerivC[iniPosTrk+it*3+2] = csum/ptsum/ptsum*(ppsum[0]*pp[0]+ppsum[1]*pp[1])/curv; // dC/dC_i - DerivP[iniPosTrk+it*3+1] = (ppsum[0]*pp[0]+ppsum[1]*pp[1])/ptsum/ptsum; // dPhi/dPhi_i - DerivP[iniPosTrk+it*3+2] = (ppsum[1]*pp[0]-ppsum[0]*pp[1])/ptsum/ptsum/curv; // dPhi/dC_i - DerivT[iniPosTrk+it*3+0] = (sinth2sum*pt)/(sinth2*ptsum); // dTheta/dTheta_i - DerivT[iniPosTrk+it*3+2] = (sinth2sum*pt*cth)/(curv*ptsum); // dTheta/dC_i - tpx+=pp[0]; tpy+=pp[1]; - } + double pt=sqrt(pp[0]*pp[0] + pp[1]*pp[1]); + double cth=pp[2]/pt; + double sinth2=(pp[0]*pp[0] + pp[1]*pp[1])/(pp[0]*pp[0] + pp[1]*pp[1] + pp[2]*pp[2]); + DerivC[iniPosTrk+it*3+1] = csum/ptsum/ptsum*(ppsum[0]*pp[1]-ppsum[1]*pp[0]); // dC/dPhi_i + DerivC[iniPosTrk+it*3+2] = csum/ptsum/ptsum*(ppsum[0]*pp[0]+ppsum[1]*pp[1])/curv; // dC/dC_i + DerivP[iniPosTrk+it*3+1] = (ppsum[0]*pp[0]+ppsum[1]*pp[1])/ptsum/ptsum; // dPhi/dPhi_i + DerivP[iniPosTrk+it*3+2] = (ppsum[1]*pp[0]-ppsum[0]*pp[1])/ptsum/ptsum/curv; // dPhi/dC_i + DerivT[iniPosTrk+it*3+0] = (sinth2sum*pt)/(sinth2*ptsum); // dTheta/dTheta_i + DerivT[iniPosTrk+it*3+2] = (sinth2sum*pt*cth)/(curv*ptsum); // dTheta/dC_i + } // double iniV0Curv=myMagFld.getCnvCst()*vMagFld[iv]/sqrt(tpx*tpx+tpy*tpy); //initial PseudoTrack Curvature // if(csum<0)iniV0Curv *= -1.; // iniV0Curv *= vMagFld[ivnext]/vMagFld[iv]; //magnetic field correction @@ -157,7 +155,6 @@ void setFittedParameters(double * result, std::vector<int> & matrixPnt, CascadeE { extern double cfchi2(double *, double *, VKTrack *); int iv,it,Pnt; - double Chi2=0.; for( iv=0; iv<cascadeEvent_.cascadeNV; iv++){ VKVertex *vk = cascadeEvent_.cascadeVertexList[iv].get(); Pnt=matrixPnt[iv]; // start of vertex parameters @@ -167,8 +164,7 @@ void setFittedParameters(double * result, std::vector<int> & matrixPnt, CascadeE trk->fitP[0]=trk->iniP[0]+result[Pnt+3+it*3 + 0]; trk->fitP[1]=trk->iniP[1]+result[Pnt+3+it*3 + 1]; trk->fitP[2]=trk->iniP[2]+result[Pnt+3+it*3 + 2]; - trk->Chi2 = cfchi2(vk->fitV, trk->fitP, trk ); - Chi2+=trk->Chi2; + trk->Chi2 = cfchi2(vk->fitV, trk->fitP, trk ); } } } diff --git a/Tracking/TrkVertexFitter/TrkVKalVrtCore/src/VtCFit.cxx b/Tracking/TrkVertexFitter/TrkVKalVrtCore/src/VtCFit.cxx index 5c26dbe19e58d55d71106c245c75dcc879473bbd..18f4912352ce754e00818af032cb0f6f7fe1c86b 100755 --- a/Tracking/TrkVertexFitter/TrkVKalVrtCore/src/VtCFit.cxx +++ b/Tracking/TrkVertexFitter/TrkVKalVrtCore/src/VtCFit.cxx @@ -155,7 +155,6 @@ namespace Trk { } } - double chi2i = 0.; for ( kt = 0; kt < NTRK; ++kt) { VKTrack* trk = vk->TrackList[kt].get(); double theta_ini =trk->iniP[0]; @@ -182,22 +181,15 @@ namespace Trk { /* contribution of this track to chi2 with initial values */ deps[kt] = trk->a0() - eps; - dzp[kt] = trk->z() - xyz[2]; // Precision - dzp[kt]-= zp; + dzp[kt] = trk->z() - xyz[2]; // Precision + dzp[kt]-= zp; dtet[kt] = trk->theta() - theta_ini; dphi[kt] = trk->phi() - phi_ini; // Precision dphi[kt]-= phip; drho[kt] = trk->invR() - invR_ini; - //zp += xyz[2]; //To recover standard zp definition in case of further use. Not needed - //phip += phi_ini; //To recover standard phip definition in case of further use. Not needed while(dphi[kt] > M_PI)dphi[kt]-=2.*M_PI; while(dphi[kt] < -M_PI)dphi[kt]+=2.*M_PI; -//std::cout.precision(11); -//std::cout<<" newpar="<<deps[kt]<<", "<<dzp[kt]<<", "<<dtet[kt]<<", "<<dphi[kt]<<", "<<drho[kt]<<", "<<trk->Id<<'\n'; - chi2i += trk->WgtM[0] * deps[kt]*deps[kt] - + 2.*trk->WgtM[1] * deps[kt]* dzp[kt] - + trk->WgtM[2] * dzp[kt]* dzp[kt]; /* derivatives (deriv1) of perigee param. w.r.t. X,Y,Z (vertex) uu=Q, vv=R */ double d11 = sinf - ( uu*cosf *invR_ini); diff --git a/Trigger/TrigAlgorithms/TrigEFMissingET/Root/METComponent.cxx b/Trigger/TrigAlgorithms/TrigEFMissingET/Root/METComponent.cxx index f000813943f6a0887c90b63b890257877c00c977..950d599a9504ef07b4419a1484515bfc9d781820 100644 --- a/Trigger/TrigAlgorithms/TrigEFMissingET/Root/METComponent.cxx +++ b/Trigger/TrigAlgorithms/TrigEFMissingET/Root/METComponent.cxx @@ -34,6 +34,8 @@ namespace HLT { namespace MET { } float METComponent::phi() const { + if (mpy == 0 && mpx == 0) + return 0; return std::atan2(mpy, mpx); } diff --git a/Trigger/TrigAlgorithms/TrigEFMissingET/Root/PufitUtils.cxx b/Trigger/TrigAlgorithms/TrigEFMissingET/Root/PufitUtils.cxx index 23b0541569668fcdf1479f6c96452e1f6ea3de0d..71501e6bd15ab8b2df5b95bf3653a9ae8c4e5c78 100644 --- a/Trigger/TrigAlgorithms/TrigEFMissingET/Root/PufitUtils.cxx +++ b/Trigger/TrigAlgorithms/TrigEFMissingET/Root/PufitUtils.cxx @@ -174,6 +174,13 @@ namespace HLT // will do this by default unless you force it to evaluate an expression by // binding it to a vector matrix type. Therefore we use 'auto' to store the // individual expression pieces, rather than forcing an early evaluation. + if (pileupCovariance.determinant() == 0) + { + // In very rare circumstances the pileup covariance can be 0. This essentially means that + // there is nothing interpreted as pileup. The calculation will fail in this case so we + // cannot run the fit. Just return the expectations + return towerExpectations; + } auto constants = // Constant part derived from the uniformity constraint towerExpectations.cwiseQuotient(towerVariances) - diff --git a/Trigger/TrigDataAccess/TrigSerializeCnvSvc/src/TrigStreamAddress.cxx b/Trigger/TrigDataAccess/TrigSerializeCnvSvc/src/TrigStreamAddress.cxx index 51278d9408df9ccbbd9247ffb0c585c4974ca992..7dfae025b6bc49dab9bba717484bfbdc9ceb15b0 100755 --- a/Trigger/TrigDataAccess/TrigSerializeCnvSvc/src/TrigStreamAddress.cxx +++ b/Trigger/TrigDataAccess/TrigSerializeCnvSvc/src/TrigStreamAddress.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration */ //==================================================================== @@ -12,9 +12,9 @@ /// Standard Constructor TrigStreamAddress::TrigStreamAddress(const CLID& clid, const std::string& fname, const std::string& cname, int p1, int p2) - : GenericAddress(storageType(), clid, fname, cname, p1, p2 ) + : GenericAddress(storageType(), clid, fname, cname, p1, p2 ), + m_key (fname) { - m_key = fname; } TrigStreamAddress::TrigStreamAddress(const CLID& clid) diff --git a/Trigger/TrigDataAccess/TrigSerializeResult/src/TrigTSerializer.cxx b/Trigger/TrigDataAccess/TrigSerializeResult/src/TrigTSerializer.cxx index 781f0f8ed675b777198ae8d9922e657805098ef6..cfc04b9c66e458664af9b4efe701dc0bde99b632 100755 --- a/Trigger/TrigDataAccess/TrigSerializeResult/src/TrigTSerializer.cxx +++ b/Trigger/TrigDataAccess/TrigSerializeResult/src/TrigTSerializer.cxx @@ -668,11 +668,11 @@ void TrigTSerializerUnimplError() { abort(); } -void TrigTSerializer::do_persistify(const std::string , void* ) { TrigTSerializerUnimplError(); } -void TrigTSerializer::do_persistify_obj(const std::string , void*) { TrigTSerializerUnimplError(); } +void TrigTSerializer::do_persistify(const std::string& , void* ) { TrigTSerializerUnimplError(); } +void TrigTSerializer::do_persistify_obj(const std::string& , void*) { TrigTSerializerUnimplError(); } -void TrigTSerializer::do_follow_ptr(const std::string name, void *ptr){ +void TrigTSerializer::do_follow_ptr(const std::string& name, void *ptr){ ATH_MSG_VERBOSE("Entering do_follow_ptr for " << name << " at " << ptr ); diff --git a/Trigger/TrigDataAccess/TrigSerializeResult/src/TrigTSerializer.h b/Trigger/TrigDataAccess/TrigSerializeResult/src/TrigTSerializer.h index f48016336db9f8259e471d4564fecef54597ce81..438f3e04039edd0933b2471fbbac0ecda7d27bb3 100755 --- a/Trigger/TrigDataAccess/TrigSerializeResult/src/TrigTSerializer.h +++ b/Trigger/TrigDataAccess/TrigSerializeResult/src/TrigTSerializer.h @@ -66,9 +66,9 @@ public: void setCLID(const uint32_t *guid); private: - void do_persistify(const std::string nameOfClass, void* instance); - void do_persistify_obj(const std::string nameOfClass, void* instance); - void do_follow_ptr(const std::string nameOfClass, void* instance); + void do_persistify(const std::string& nameOfClass, void* instance); + void do_persistify_obj(const std::string& nameOfClass, void* instance); + void do_follow_ptr(const std::string& nameOfClass, void* instance); void add_previous_streamerinfos(); static bool streamerErrorHandler(Int_t level, Bool_t abort_bool, diff --git a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigJetHypoTool.cxx b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigJetHypoTool.cxx index 92204cdd1f0698d1c51139ad723226d7acca9ec5..5715fed783ed9db16e06837e078d16577622ee8c 100644 --- a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigJetHypoTool.cxx +++ b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigJetHypoTool.cxx @@ -35,8 +35,8 @@ TrigJetHypoTool::TrigJetHypoTool(const std::string& type, const std::string& name, const IInterface* parent) : AthAlgTool(type, name, parent), - m_decisionID(HLT::Identifier::fromToolName(name)), - m_eventSN(std::make_unique<EventSN>()){ + m_decisionID(HLT::Identifier::fromToolName(name)) +{ } @@ -107,10 +107,10 @@ TrigJetHypoTool::decide(const xAOD::JetContainer* jets, std::unique_ptr<ITrigJetHypoInfoCollector> infocollector(nullptr); std::unique_ptr<ITrigJetHypoInfoCollector> jetdumper(nullptr); if(m_visitDebug){ - auto collectorName = name() + "_" + std::to_string(m_eventSN->getSN()); + auto collectorName = name() + "_" + std::to_string(m_id++); infocollector.reset(new DebugInfoCollector(collectorName)); auto jetdumperName = - name()+"_passingjets_" + std::to_string(m_eventSN->getSN()); + name()+"_passingjets_" + std::to_string(m_id++); jetdumper.reset(new DebugInfoCollector(jetdumperName)); } @@ -199,7 +199,7 @@ TrigJetHypoTool::checkPassingJets(const xAODJetCollector& jetCollector, if (jetCollector.empty()) { ATH_MSG_ERROR("HypoTool passed the event for " << - m_chainName << " ev " << m_eventSN->m_id << + m_chainName << " ev " << m_id << ", but did not specify which jets participated"); return StatusCode::FAILURE; } diff --git a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigJetHypoTool.h b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigJetHypoTool.h index 39b19a055871ef89e2ae9294546a0ffe871e2847..d0536cb8d460fdd6618c24bfc62a953307bad4fb 100644 --- a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigJetHypoTool.h +++ b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigJetHypoTool.h @@ -26,11 +26,6 @@ #include <string> #include <optional> -struct EventSN{ - std::size_t m_id{0}; - std::size_t getSN(){return m_id++;} -}; - class TrigJetHypoTool: public AthAlgTool{ public: @@ -89,7 +84,8 @@ public: this, "chain_name", {}, "chain name"}; - std::unique_ptr<EventSN> m_eventSN; + mutable std::atomic<size_t> m_id = 0; + StatusCode checkPassingJets(const xAODJetCollector&, diff --git a/Trigger/TrigT1/TrigT1NSWSimTools/TrigT1NSWSimTools/tdr_compat_enum.h b/Trigger/TrigT1/TrigT1NSWSimTools/TrigT1NSWSimTools/tdr_compat_enum.h index 1f341e554d2ed776ba7684ea42293e289cb7145f..0745ff3ad11a38429108190c43171d8d4514c7ce 100644 --- a/Trigger/TrigT1/TrigT1NSWSimTools/TrigT1NSWSimTools/tdr_compat_enum.h +++ b/Trigger/TrigT1/TrigT1NSWSimTools/TrigT1NSWSimTools/tdr_compat_enum.h @@ -11,7 +11,6 @@ namespace NSWL1 { const double c_inverse = 3.33564095198e-3; // unit here is [ns/mm] - const float PI=3.14159265; const int STGC_LAYER_1=1, STGC_LAYER_2=2, STGC_LAYER_3=3, STGC_LAYER_4=4; const int SMALL_PIVOT=0, SMALL_CONFIRM=1, LARGE_PIVOT=2, LARGE_CONFIRM=3; const int MAXLAYERSHIT=4; @@ -23,4 +22,4 @@ namespace NSWL1 { } -#endif \ No newline at end of file +#endif diff --git a/Trigger/TrigT1/TrigT1NSWSimTools/src/GeoUtils.cxx b/Trigger/TrigT1/TrigT1NSWSimTools/src/GeoUtils.cxx index 238784d50b9cadb796f6423031f07ce16995f4bd..07c8cde855320939284196c4357a82907dc78e11 100644 --- a/Trigger/TrigT1/TrigT1NSWSimTools/src/GeoUtils.cxx +++ b/Trigger/TrigT1/TrigT1NSWSimTools/src/GeoUtils.cxx @@ -3,7 +3,7 @@ */ #include "TrigT1NSWSimTools/GeoUtils.h" -#include <TMath.h> +#include <cmath> #include <TVector3.h> #include <algorithm> @@ -35,9 +35,9 @@ Polygon etaphi2xyTransform(const Polygon& p, float Z){ float eta=coordinate<0>(v); float phi=coordinate<1>(v); float z=Z; - float theta=2*TMath::ATan(TMath::Exp(-1*eta)); - float x=z*TMath::Tan(theta)*TMath::Cos(phi); - float y=z*TMath::Tan(theta)*TMath::Sin(phi); + float theta=2*std::atan(std::exp(-1*eta)); + float x=z*std::tan(theta)*std::cos(phi); + float y=z*std::tan(theta)*std::sin(phi); vts.push_back(Vertex(x,y)); } return buildPolygon(vts); @@ -53,10 +53,10 @@ Polygon Project(const Polygon& p,float Zinit,float Zfin){ float z=Zinit; float et=eta(x,y,z); float p=phi(x,y,z); - float theta=2*TMath::ATan(TMath::Exp(-1*et)); - float r=Zfin*TMath::Tan(theta); - float xproj=r*TMath::Cos(p); - float yproj=r*TMath::Sin(p); + float theta=2*std::atan(std::exp(-1*et)); + float r=Zfin*std::tan(theta); + float xproj=r*std::cos(p); + float yproj=r*std::sin(p); vt.push_back(Vertex(xproj,yproj)); } return buildPolygon(vt); diff --git a/Trigger/TrigT1/TrigT1NSWSimTools/src/MMLoadVariables.cxx b/Trigger/TrigT1/TrigT1NSWSimTools/src/MMLoadVariables.cxx index 8ab0d49ccdeda490fb1ec6588945c505fcdda63a..69b9fb5e9115733d45c88cada4f4ba3ce6be177a 100644 --- a/Trigger/TrigT1/TrigT1NSWSimTools/src/MMLoadVariables.cxx +++ b/Trigger/TrigT1/TrigT1NSWSimTools/src/MMLoadVariables.cxx @@ -472,7 +472,7 @@ MMLoadVariables::MMLoadVariables(StoreGateSvc* evtStore, const MuonGM::MuonDetec } void MMLoadVariables::hit_rot_stereo_fwd(ROOT::Math::XYZVector& hit, std::shared_ptr<MMT_Parameters> par)const{ - double degree=TMath::DegToRad()*(par->stereo_degree); + double degree=M_PI/180.0*(par->stereo_degree); if(m_striphack) hit.SetY(hit.Y()*cos(degree)); else{ double xnew=hit.X()*std::cos(degree)+hit.Y()*std::sin(degree),ynew=-hit.X()*std::sin(degree)+hit.Y()*std::cos(degree); @@ -481,7 +481,7 @@ MMLoadVariables::MMLoadVariables(StoreGateSvc* evtStore, const MuonGM::MuonDetec } void MMLoadVariables::hit_rot_stereo_bck(ROOT::Math::XYZVector& hit, std::shared_ptr<MMT_Parameters> par)const{ - double degree=-TMath::DegToRad()*(par->stereo_degree); + double degree=-M_PI/180.0*(par->stereo_degree); if(m_striphack) hit.SetY(hit.Y()*std::cos(degree)); else{ double xnew=hit.X()*std::cos(degree)+hit.Y()*std::sin(degree),ynew=-hit.X()*std::sin(degree)+hit.Y()*std::cos(degree); diff --git a/Trigger/TrigT1/TrigT1NSWSimTools/src/MMStripTdsOfflineTool.cxx b/Trigger/TrigT1/TrigT1NSWSimTools/src/MMStripTdsOfflineTool.cxx index c0662339b9110e577e88f0b1575064602086a69a..ad683a672414d9f54b648fa96d1573b92831bc3e 100644 --- a/Trigger/TrigT1/TrigT1NSWSimTools/src/MMStripTdsOfflineTool.cxx +++ b/Trigger/TrigT1/TrigT1NSWSimTools/src/MMStripTdsOfflineTool.cxx @@ -15,8 +15,7 @@ #include "EventInfo/EventInfo.h" #include "EventInfo/EventID.h" -// ROOT includes -#include "TMath.h" +#include <cmath> const bool striphack=true; @@ -559,8 +558,8 @@ namespace NSWL1 { } double MMStripTdsOfflineTool::phi_shift(double athena_phi) const{ - return athena_phi+(athena_phi>=0?-1:1)*TMath::Pi(); - return (-1.*athena_phi+(athena_phi>=0?1.5*TMath::Pi():-0.5*TMath::Pi())); + return athena_phi+(athena_phi>=0?-1:1)*M_PI; + return (-1.*athena_phi+(athena_phi>=0?1.5*M_PI:-0.5*M_PI)); } void MMStripTdsOfflineTool::xxuv_to_uvxx(ROOT::Math::XYZVector& hit,int plane)const{ if(plane<4)return; @@ -571,7 +570,7 @@ namespace NSWL1 { } void MMStripTdsOfflineTool::hit_rot_stereo_fwd(ROOT::Math::XYZVector& hit)const{ - double degree=TMath::DegToRad()*(m_par->stereo_degree); + double degree=M_PI/180.0*(m_par->stereo_degree); if(striphack) hit.SetY(hit.Y()*cos(degree)); else{ double xnew=hit.X()*cos(degree)+hit.Y()*sin(degree),ynew=-hit.X()*sin(degree)+hit.Y()*cos(degree); @@ -580,7 +579,7 @@ namespace NSWL1 { } void MMStripTdsOfflineTool::hit_rot_stereo_bck(ROOT::Math::XYZVector& hit)const{ - double degree=-TMath::DegToRad()*(m_par->stereo_degree); + double degree=-M_PI/180.0*(m_par->stereo_degree); if(striphack) hit.SetY(hit.Y()*cos(degree)); else{ double xnew=hit.X()*cos(degree)+hit.Y()*sin(degree),ynew=-hit.X()*sin(degree)+hit.Y()*cos(degree); @@ -605,7 +604,7 @@ namespace NSWL1 { int MMStripTdsOfflineTool::Get_Strip_ID(double X,double Y,int plane) const{ //athena_strip_id,module_y_center,plane) if(Y==-9999) return -1; std::string setup(m_par->setup); - double strip_width=m_par->strip_width, degree=TMath::DegToRad()*(m_par->stereo_degree);//,vertical_strip_width_UV = strip_width/cos(degree); + double strip_width=m_par->strip_width, degree=M_PI/180.0*(m_par->stereo_degree);//,vertical_strip_width_UV = strip_width/cos(degree); double y_hit=Y; int setl=setup.length(); if(plane>=setl||plane<0){ diff --git a/Trigger/TrigT1/TrigT1NSWSimTools/src/MMT_Diamond.cxx b/Trigger/TrigT1/TrigT1NSWSimTools/src/MMT_Diamond.cxx index 665da6f58990f179fdfd2681b016f74b99f7aea0..9c3c011b9855c27a1dbc5b8b11be6167cb7872a0 100644 --- a/Trigger/TrigT1/TrigT1NSWSimTools/src/MMT_Diamond.cxx +++ b/Trigger/TrigT1/TrigT1NSWSimTools/src/MMT_Diamond.cxx @@ -2,6 +2,7 @@ #include "AthenaKernel/getMessageSvc.h" #include "MuonAGDDDescription/MMDetectorDescription.h" #include "MuonAGDDDescription/MMDetectorHelper.h" +#include <cmath> MMT_Diamond::MMT_Diamond(const MuonGM::MuonDetectorManager* detManager): AthMessaging(Athena::getMessageSvc(), "MMT_Diamond") { m_detManager = detManager; @@ -82,7 +83,7 @@ void MMT_Diamond::createRoads_fillHits(const unsigned int iterator, std::vector< } int nroad = 8192/this->getRoadSize(); - double B = (1./TMath::Tan(1.5/180.*TMath::Pi())); + double B = (1./std::tan(1.5/180.*M_PI)); int uvfactor = std::round( mm2->lWidth() / (B * 0.4 * 2.)/this->getRoadSize() ); // mm2 pointer is used because the full wedge has to be considered, i.e. S(L/M)2 this->setUVfactor(uvfactor); @@ -264,13 +265,13 @@ void MMT_Diamond::findDiamonds(const unsigned int iterator, const double &sm_bc, slope.xavg = road->avgSofX(); // defined as my in ATL-COM-UPGRADE-2015-033 slope.uavg = road->avgSofUV(2,4); slope.vavg = road->avgSofUV(3,5); - slope.mx = (slope.uavg-slope.vavg)/(2.*TMath::Tan(0.02618)); // The stereo angle is fixed and can be hardcoded - double theta = TMath::ATan(TMath::Sqrt(TMath::Power(slope.mx,2) + TMath::Power(slope.xavg,2))); - slope.theta = (slope.xavg > 0.) ? theta : TMath::Pi() - theta; - slope.eta = -1.*TMath::Log(TMath::Tan(slope.theta/2.)); + slope.mx = (slope.uavg-slope.vavg)/(2.*std::tan(0.02618)); // The stereo angle is fixed and can be hardcoded + double theta = std::atan(std::sqrt(std::pow(slope.mx,2) + std::pow(slope.xavg,2))); + slope.theta = (slope.xavg > 0.) ? theta : M_PI - theta; + slope.eta = -1.*std::log(std::tan(slope.theta/2.)); slope.dtheta = (slope.mxl - slope.xavg)/(1. + slope.mxl*slope.xavg); slope.side = (slope.xavg > 0.) ? 'A' : 'C'; - double phi = TMath::ATan(slope.mx/slope.xavg), phiShifted = this->phiShift(this->getDiamond(iterator).stationPhi, phi, slope.side); + double phi = std::atan(slope.mx/slope.xavg), phiShifted = this->phiShift(this->getDiamond(iterator).stationPhi, phi, slope.side); slope.phi = phi; slope.phiShf = phiShifted; slope.lowRes = road->evaluateLowRes(); @@ -285,7 +286,7 @@ void MMT_Diamond::findDiamonds(const unsigned int iterator, const double &sm_bc, double MMT_Diamond::phiShift(const int n, const double &phi, const char &side) { double Phi = (side == 'A') ? phi : -phi; - float shift = (n > 8) ? (16-n)*TMath::Pi()/8. : n*TMath::Pi()/8.; + float shift = (n > 8) ? (16-n)*M_PI/8. : n*M_PI/8.; if (n < 8) return (Phi + shift); else if (n == 8) return (Phi + ((Phi > 0.) ? -1. : 1.)*shift); else return (Phi - shift); diff --git a/Trigger/TrigT1/TrigT1NSWSimTools/src/MMT_Fitter.cxx b/Trigger/TrigT1/TrigT1NSWSimTools/src/MMT_Fitter.cxx index 6c7ca95b5e739c421ea7852320ea48f77284f685..dae4f825a3f4c04d3579ff1517b67ea36e9f6a04 100644 --- a/Trigger/TrigT1/TrigT1NSWSimTools/src/MMT_Fitter.cxx +++ b/Trigger/TrigT1/TrigT1NSWSimTools/src/MMT_Fitter.cxx @@ -349,7 +349,7 @@ ROI MMT_Fitter::Get_ROI(double M_x, double M_u, double M_v, const vector<Hit>&tr ATH_MSG_DEBUG("\nGet_ROI(" << M_x << "," << M_u << "," << M_v << ") "); //--- calc constants ------ - double b=TMath::DegToRad()*(par->stereo_degree); + double b=M_PI/180.0*(par->stereo_degree); double A=1./std::tan(b); double B=1./std::tan(b); diff --git a/Trigger/TrigT1/TrigT1NSWSimTools/src/MMT_Hit.cxx b/Trigger/TrigT1/TrigT1NSWSimTools/src/MMT_Hit.cxx index 3203438e0c3bfe21f1de694629404201aaf47c30..3a945c78fd2622d52f85ca7ae86ec9d67a0ac9c9 100644 --- a/Trigger/TrigT1/TrigT1NSWSimTools/src/MMT_Hit.cxx +++ b/Trigger/TrigT1/TrigT1NSWSimTools/src/MMT_Hit.cxx @@ -5,12 +5,13 @@ #include "MuonReadoutGeometry/MuonChannelDesign.h" #include "MuonReadoutGeometry/MuonDetectorManager.h" #include "MuonReadoutGeometry/MMReadoutElement.h" - +#include <cmath> + MMT_Hit::MMT_Hit(char wedge, hitData_entry entry, const MuonGM::MuonDetectorManager* detManager) : AthMessaging(Athena::getMessageSvc(), "MMT_Hit") { m_sector = wedge; std::string module(1, wedge); - module += (TMath::Abs(entry.station_eta) == 1) ? "M1" : "M2"; + module += (std::abs(entry.station_eta) == 1) ? "M1" : "M2"; m_module = module; m_station_name = "MM"; @@ -138,7 +139,7 @@ void MMT_Hit::updateHitProperties(std::shared_ptr<MMT_Parameters> par) { MMDetectorHelper aHelper; char side = (globalPos.z() > 0.) ? 'A' : 'C'; - MMDetectorDescription* mm = aHelper.Get_MMDetector(this->getSector(), TMath::Abs(this->getStationEta()), this->getStationPhi(), this->getMultiplet(), side); + MMDetectorDescription* mm = aHelper.Get_MMDetector(this->getSector(), std::abs(this->getStationEta()), this->getStationPhi(), this->getMultiplet(), side); MMReadoutParameters roP = mm->GetReadoutParameters(); double R = roP.distanceFromZAxis + this->getChannel()*roP.stripPitch - roP.stripPitch/2.; @@ -153,7 +154,7 @@ void MMT_Hit::updateHitProperties(std::shared_ptr<MMT_Parameters> par) { " ----- Z: " << this->getZ() << ", Plane: " << this->getPlane() << ", eta " << this->getStationEta() << " -- BC: " << this->getBC() << " RZslope: " << this->getRZSlope()); - int eta = TMath::Abs(this->getStationEta())-1; + int eta = std::abs(this->getStationEta())-1; double base = par->ybases[this->getPlane()][eta]; double Y = base + this->getChannel()*roP.stripPitch - roP.stripPitch/2.; m_Y = Y; diff --git a/Trigger/TrigT1/TrigT1NSWSimTools/src/MMT_Road.cxx b/Trigger/TrigT1/TrigT1NSWSimTools/src/MMT_Road.cxx index 9b75e7746709354f056ea3c4799015cd737bf98e..1a86e4a327a51cff0c9c04dd394726c9e2f8832c 100644 --- a/Trigger/TrigT1/TrigT1NSWSimTools/src/MMT_Road.cxx +++ b/Trigger/TrigT1/TrigT1NSWSimTools/src/MMT_Road.cxx @@ -1,5 +1,6 @@ #include "TrigT1NSWSimTools/MMT_Road.h" #include "AthenaKernel/getMessageSvc.h" +#include <cmath> MMT_Road::MMT_Road(const char sector, const MuonGM::MuonDetectorManager* detManager, const micromegas_t mm, int xthr, int uvthr, int iroadx, int iroadu, int iroadv): AthMessaging(Athena::getMessageSvc(), "MMT_Road") { m_sector = sector; @@ -20,7 +21,7 @@ MMT_Road::MMT_Road(const char sector, const MuonGM::MuonDetectorManager* detMana m_roadSizeDownX = mm.nstrip_dn_XX; m_roadSizeUpUV = mm.nstrip_up_UV; m_roadSizeDownUV = mm.nstrip_dn_UV; - m_B = (1./TMath::Tan(1.5/180.*TMath::Pi())); + m_B = (1./std::tan(1.5/180.*M_PI)); } MMT_Road::~MMT_Road() { @@ -68,10 +69,10 @@ bool MMT_Road::containsNeighbors(const MMT_Hit &hit) { } double pitch = this->getMM().pitch; - double R = (TMath::Abs(hit.getStationEta()) == 1) ? this->getMM().innerRadiusEta1 : this->getMM().innerRadiusEta2; + double R = (std::abs(hit.getStationEta()) == 1) ? this->getMM().innerRadiusEta1 : this->getMM().innerRadiusEta2; double Z = hit.getZ(); - double index = std::round((TMath::Abs(hit.getRZSlope())-0.1)/5e-04); // 0.0005 is approx. the step in slope achievable with a road size of 8 strips + double index = std::round((std::abs(hit.getRZSlope())-0.1)/5e-04); // 0.0005 is approx. the step in slope achievable with a road size of 8 strips double roundedSlope = 0.1 + index*((0.6 - 0.1)/1000.); double shift = roundedSlope*(this->getMM().planeCoordinates[hit.getPlane()].Z() - this->getMM().planeCoordinates[0].Z()); @@ -211,7 +212,7 @@ double MMT_Road::mxl() { double mxl = 0; double avg_z = std::accumulate(zs.begin(), zs.end(), 0.0)/(double)zs.size(); double sum_sq_z = std::inner_product(zs.begin(), zs.end(), zs.begin(), 0.0); - for (unsigned int i = 0; i < ys.size(); i++) mxl += ys[i]*( (zs[i]-avg_z) / (sum_sq_z - zs.size()*TMath::Power(avg_z,2)) ); + for (unsigned int i = 0; i < ys.size(); i++) mxl += ys[i]*( (zs[i]-avg_z) / (sum_sq_z - zs.size()*std::pow(avg_z,2)) ); return mxl; } diff --git a/Trigger/TrigT1/TrigT1NSWSimTools/src/MMT_struct.cxx b/Trigger/TrigT1/TrigT1NSWSimTools/src/MMT_struct.cxx index cd3bbd4ff1454efd4a129cc3a54e46d2ba16f78e..3b2c5dd2508aa9e27cd574c7c2530e447748f6f3 100644 --- a/Trigger/TrigT1/TrigT1NSWSimTools/src/MMT_struct.cxx +++ b/Trigger/TrigT1/TrigT1NSWSimTools/src/MMT_struct.cxx @@ -13,6 +13,7 @@ #include <stdexcept> #include <utility> +#include <cmath> using std::vector; using std::string; @@ -396,8 +397,8 @@ MMT_Parameters::MMT_Parameters(par_par inputParams, char wedgeSize, const MuonGM // MM_firststrip_positions returns the position for phi sector 1. // => for the small sectors, rotate this by -1/16 of a rotation to make our lives easier. // in this coordinate basis, x is up/down the wedge (radial), and y is left/right (phi). - float cos_rotation = std::cos(-2*TMath::Pi() / 16.0); - float sin_rotation = std::sin(-2*TMath::Pi() / 16.0); + float cos_rotation = std::cos(-2*M_PI / 16.0); + float sin_rotation = std::sin(-2*M_PI / 16.0); float x_rotated = 0.0; float y_rotated = 0.0; @@ -420,13 +421,13 @@ MMT_Parameters::MMT_Parameters(par_par inputParams, char wedgeSize, const MuonGM y_rotated = pos.y(); } - if (is_u(layer)) st_angle = -1*abs(stereo_degree); - else if (is_v(layer)) st_angle = abs(stereo_degree); + if (is_u(layer)) st_angle = -1*std::abs(stereo_degree); + else if (is_v(layer)) st_angle = std::abs(stereo_degree); else st_angle = 0; // walk from the center of the strip to the position of the strip at the center of the wedge. // NB: for X-planes, this is simply the center of the strip: tan(0) = 0. - radial_pos = abs(x_rotated - y_rotated*std::tan(st_angle * TMath::Pi()/180.0)); + radial_pos = std::abs(x_rotated - y_rotated*std::tan(st_angle * M_PI/180.0)); if (is_x(layer) && eta==1) radial_pos_xx_1 = radial_pos; if (is_x(layer) && eta==2) radial_pos_xx_2 = radial_pos; @@ -490,8 +491,8 @@ MMT_Parameters::MMT_Parameters(par_par inputParams, char wedgeSize, const MuonGM //BLC had some interesting bounds...let's do the ones that make sense to me minimum_large_theta = std::atan(H/z_nominal.back()) + tol; maximum_large_theta = std::atan(std::sqrt(std::pow( (Hnom+h1),2) + 0.25*std::pow(w1,2))/z_nominal.back()) - tol; - minimum_large_phi = -TMath::DegToRad()*0.5*wedge_opening_angle + tol; - maximum_large_phi = TMath::DegToRad()*(0.5*wedge_opening_angle) - tol; + minimum_large_phi = -M_PI/180.0*0.5*wedge_opening_angle + tol; + maximum_large_phi = M_PI/180.0*(0.5*wedge_opening_angle) - tol; /////////////////////////////////////////////////// double phiseg= ((maximum_large_phi-minimum_large_phi)/n_phibins); @@ -611,13 +612,13 @@ par_par MMT_Parameters::param_par() const{ double MMT_Parameters::y_from_eta_wedge(double eta,int plane)const{ //assumes wedge geometry--average x^2, is 1/3 y^2*tan^2(stereo_degree), for eta/y correspondence double z=z_nominal[plane]; - double zeta=TMath::DegToRad()*(0.5*stereo_degree); + double zeta=M_PI/180.0*(0.5*stereo_degree); return z*std::tan(2*std::atan(std::exp(-1.*eta)))/std::sqrt(1+std::tan(zeta)*std::tan(zeta)/3.); } double MMT_Parameters::eta_wedge_from_y(double y,int plane)const{ double z=z_nominal[plane]; - double zeta=TMath::DegToRad()*(0.5*stereo_degree); + double zeta=M_PI/180.0*(0.5*stereo_degree); return -1.*std::log(std::tan(0.5*std::atan(y/z*std::sqrt(1+std::tan(zeta)*std::tan(zeta)/3.)))); } @@ -1091,9 +1092,9 @@ hitData_info::hitData_info(int pl,int station_eta,int strip,std::shared_ptr<MMT_ char schar=par->setup[plane]; bool horizontal=(schar=='x'||schar=='X'); double swidth=par->strip_width; - int eta = TMath::Abs(station_eta) -1; + int eta = std::abs(station_eta) -1; double base=par->ybases[plane][eta]; - if(!horizontal) swidth/=std::cos(TMath::DegToRad()*(par->stereo_degree)); + if(!horizontal) swidth/=std::cos(M_PI/180.0*(par->stereo_degree)); //Next, we initialize some constants--y will eventually be calculated as y=base+scale*(width*strip+delta_y(misalignment,correction)). //The correction portion of delta_y is done in in the calculations on the ybases object in par //yup, or "y up" is the portion of y above the base of the plane (i.e. in the detector) @@ -1148,7 +1149,7 @@ double hitData_info::mis_dy(int plane,std::shared_ptr<MMT_Parameters> par,double char schar=par->setup[plane]; if(!(schar=='x'||schar=='X')){ //if we're in a stereo plane, calculate different coefficients. - double omega=TMath::DegToRad()*(par->stereo_degree); + double omega=M_PI/180.0*(par->stereo_degree); double pm=(schar=='u'||schar=='U'?1.:-1.); yhat_x=pm*std::cos(alpha)*std::cos(beta)*std::sin(omega)-std::sin(alpha)*std::cos(beta)*std::cos(omega); yhat_y=pm*std::sin(omega)*(std::sin(alpha)*std::cos(gamma)+std::cos(alpha)*std::sin(beta)*std::sin(gamma))+std::cos(omega)*(std::cos(alpha)*std::cos(gamma)-std::sin(alpha)*std::sin(beta)*std::sin(gamma)); diff --git a/Trigger/TrigT1/TrigT1NSWSimTools/src/MMTriggerTool.cxx b/Trigger/TrigT1/TrigT1NSWSimTools/src/MMTriggerTool.cxx index 52a9c6f7b1f84690844226a3bb98af3b03e562e3..203ba6ca0b62a800ded590da9c1134e007e5c67c 100644 --- a/Trigger/TrigT1/TrigT1NSWSimTools/src/MMTriggerTool.cxx +++ b/Trigger/TrigT1/TrigT1NSWSimTools/src/MMTriggerTool.cxx @@ -113,8 +113,8 @@ namespace NSWL1 { m_par_small = std::make_shared<MMT_Parameters>(xxuvuvxx,'S', m_detManager); // Variables for RDO encoding - this->setPhiMin(-16.*TMath::DegToRad()); - this->setPhiMax(16.*TMath::DegToRad()); + this->setPhiMin(-16.*M_PI/180.0); + this->setPhiMax(16.*M_PI/180.0); this->setPhiBits(6); this->setRMin(900); // mm this->setRMax(5000); @@ -386,7 +386,7 @@ namespace NSWL1 { else if(n == 8) fitPhi = (fitPhi + (fitPhi >= 0 ? -1 : 1)*shift); else if(n > 8) fitPhi = (fitPhi - shift); - double fitEta = -1. * TMath::Log(TMath::Tan(fitTheta/2.)); //VALE: trueta was filled!!!! + double fitEta = -1. * std::log(std::tan(fitTheta/2.)); //VALE: trueta was filled!!!! ATH_MSG_DEBUG( "Truth " << tpos << " " << ppos << " " << dt ); ATH_MSG_DEBUG( "FIT!! " << fitTheta << " " << fitPhi << " " << fitDeltaTheta ); @@ -452,10 +452,10 @@ namespace NSWL1 { // Phi-id uint8_t phi_id = 0; - if (slope.phiShf*TMath::DegToRad() > this->getPhiMax() || slope.phiShf*TMath::DegToRad() < this->getPhiMin()) trigRawDataSegment->setPhiIndex(phi_id); + if (slope.phiShf*M_PI/180.0 > this->getPhiMax() || slope.phiShf*M_PI/180.0 < this->getPhiMin()) trigRawDataSegment->setPhiIndex(phi_id); unsigned int nPhi = (1<<this->getPhiBits()) -2; // To accomodate the new phi-id encoding prescription around 0 float phiSteps = (this->getPhiMax()-this->getPhiMin())/nPhi; - phi_id = std::abs( (slope.phiShf*TMath::DegToRad())/phiSteps ); + phi_id = std::abs( (slope.phiShf*M_PI/180.0)/phiSteps ); trigRawDataSegment->setPhiIndex(phi_id); // R-id @@ -469,10 +469,10 @@ namespace NSWL1 { // DeltaTheta-id uint8_t dTheta_id = 0; - if (slope.dtheta*TMath::DegToRad() > this->getdThetaMax() || slope.dtheta*TMath::DegToRad() < this->getdThetaMin()) trigRawDataSegment->setDeltaTheta(dTheta_id); + if (slope.dtheta*M_PI/180.0 > this->getdThetaMax() || slope.dtheta*M_PI/180.0 < this->getdThetaMin()) trigRawDataSegment->setDeltaTheta(dTheta_id); unsigned int ndTheta = (1<<this->getdThetaBits()) -1; float dThetaSteps = (this->getdThetaMax()-this->getdThetaMin())/ndTheta; - dTheta_id = std::abs( (slope.dtheta*TMath::DegToRad())/dThetaSteps ); + dTheta_id = std::abs( (slope.dtheta*M_PI/180.0)/dThetaSteps ); trigRawDataSegment->setDeltaTheta(dTheta_id); // Low R-resolution bit diff --git a/Trigger/TrigT1/TrigT1NSWSimTools/src/SingleWedgePadTrigger.cxx b/Trigger/TrigT1/TrigT1NSWSimTools/src/SingleWedgePadTrigger.cxx index 0d7cfe83fe87d0f35badbd703baddd1ac0e5350d..747d8a939b5c8a4d03725fa22b9e079a25ab0564 100644 --- a/Trigger/TrigT1/TrigT1NSWSimTools/src/SingleWedgePadTrigger.cxx +++ b/Trigger/TrigT1/TrigT1NSWSimTools/src/SingleWedgePadTrigger.cxx @@ -80,8 +80,8 @@ namespace NSWL1{ bool SingleWedgePadTrigger::isInTransitionRegion() const{ Polygon ROI=padOverlap3(this->pads()); if(area(ROI)==0) return false; - float phi0=m_pads[0]->sectorType()==1 ? (PI/4)*(m_pads[0]->sectorId()-1) : (PI/8)+(PI/4)*(m_pads[0]->sectorId()-1); - if(phi0>PI) phi0-=2*PI; + float phi0=m_pads[0]->sectorType()==1 ? (M_PI/4)*(m_pads[0]->sectorId()-1) : (M_PI/8)+(M_PI/4)*(m_pads[0]->sectorId()-1); + if(phi0>M_PI) phi0-=2*M_PI; float ROIx=centroid(ROI).x(); float ROIy=centroid(ROI).y(); //YR 8-18 using the center local Y of the ROI for the decision if in the TR float ROIr=sqrt(ROIx*ROIx+ROIy*ROIy); diff --git a/Trigger/TrigT1/TrigT1NSWSimTools/src/StripSegmentTool.cxx b/Trigger/TrigT1/TrigT1NSWSimTools/src/StripSegmentTool.cxx index 11d42336abec61de74e136a1858f9b2abbee9b10..7d6b83d38973168fcca204eca34763072d650f1b 100644 --- a/Trigger/TrigT1/TrigT1NSWSimTools/src/StripSegmentTool.cxx +++ b/Trigger/TrigT1/TrigT1NSWSimTools/src/StripSegmentTool.cxx @@ -277,8 +277,8 @@ namespace NSWL1 { float avg_z=(z1+z2)/2.; float inf_slope=(avg_r/avg_z); //float dR=slope-inf_slope; - float theta_inf=atan(inf_slope); - float theta=atan(slope); + float theta_inf=std::atan(inf_slope); + float theta=std::atan(slope); float dtheta=(theta_inf-theta)*1000;//In Milliradian if(avg_z>0){ eta_inf=-log(tan(theta_inf/2)); @@ -295,17 +295,17 @@ namespace NSWL1 { //S.I instead of doing all these stuff like below, which is quite error prone why dont we use TVectors? if(glx>=0 && gly>=0){ - phi=atan(gly/glx); + phi=std::atan(gly/glx); } else if(glx<0 && gly>0){ - phi=PI-atan(abs(gly/glx)); + phi=M_PI-std::atan(std::abs(gly/glx)); } else if(glx<0 && gly<0){ - phi=-1*PI+atan(gly/glx); + phi=-1*M_PI+std::atan(gly/glx); } else if(glx>0 && gly<0){ - phi=-atan(abs(gly/glx)); + phi=-std::atan(std::abs(gly/glx)); } else{ ATH_MSG_ERROR("Unexpected error, global x or global y are not a number");//S.I does this even necessary ? then what ? diff --git a/Trigger/TrigValidation/TrigAnalysisTest/share/ref_RDOtoRDOTrig_v1Dev_build.ref b/Trigger/TrigValidation/TrigAnalysisTest/share/ref_RDOtoRDOTrig_v1Dev_build.ref index 437cab0af635b9b4196c83b5115f6a66d781563f..3fad96b040152695d2a97a24d562058bd5d5f700 100644 --- a/Trigger/TrigValidation/TrigAnalysisTest/share/ref_RDOtoRDOTrig_v1Dev_build.ref +++ b/Trigger/TrigValidation/TrigAnalysisTest/share/ref_RDOtoRDOTrig_v1Dev_build.ref @@ -7444,7 +7444,7 @@ HLT_j450_pf_ftf_preselj225_L1jJ100: stepFeatures: 0: 1 1: 2 -HLT_j45_0eta290_020jvt_020jvt_pf_ftf_bdl1r70_L1J20: +HLT_j45_0eta290_020jvt_pf_ftf_bdl1r70_L1J20: eventCount: 11 stepCounts: 0: 20 diff --git a/Trigger/TrigValidation/TrigP1Test/share/ref_v1Dev_decodeBS_build.ref b/Trigger/TrigValidation/TrigP1Test/share/ref_v1Dev_decodeBS_build.ref index 8cd15c67cd766782acb990334f80e3f67ae75bc9..64fc34485d17c2581431b6e2cc627d63a08a3946 100644 --- a/Trigger/TrigValidation/TrigP1Test/share/ref_v1Dev_decodeBS_build.ref +++ b/Trigger/TrigValidation/TrigP1Test/share/ref_v1Dev_decodeBS_build.ref @@ -2626,7 +2626,7 @@ HLT_j450_pf_ftf_preselj225_L1J100: eventCount: 0 HLT_j450_pf_ftf_preselj225_L1jJ100: eventCount: 0 -HLT_j45_0eta290_020jvt_020jvt_pf_ftf_bdl1r70_L1J20: +HLT_j45_0eta290_020jvt_pf_ftf_bdl1r70_L1J20: eventCount: 2 stepCounts: 0: 16 diff --git a/Trigger/TriggerCommon/TrigEDMConfig/python/TriggerEDMRun3.py b/Trigger/TriggerCommon/TrigEDMConfig/python/TriggerEDMRun3.py index 5d1331e1624d014d39fe2f36c2f6dc8edf3cee99..63938a1aab4dae2121995386a7748fb48b507f59 100644 --- a/Trigger/TriggerCommon/TrigEDMConfig/python/TriggerEDMRun3.py +++ b/Trigger/TriggerCommon/TrigEDMConfig/python/TriggerEDMRun3.py @@ -854,7 +854,7 @@ TriggerHLTListRun3 = [ ('xAOD::TrigCompositeContainer#HLT_TrackCount', 'BS ESD AODFULL AODSLIM', 'MinBias'), ('xAOD::TrigCompositeAuxContainer#HLT_TrackCountAux.ntrks.pTcuts.z0cuts.counts', 'BS ESD AODFULL AODSLIM', 'MinBias'), - ('xAOD::TrigCompositeContainer#HLT_vtx_z', 'BS ESD AODFULL', 'MinBias' ,'inViews:ZVertFinderView'), + ('xAOD::TrigCompositeContainer#HLT_vtx_z', 'BS ESD AODFULL', 'MinBias' ,'inViews:ZVertFinderRecoViews'), ('xAOD::TrigCompositeAuxContainer#HLT_vtx_zAux.zfinder_vtx_z.zfinder_vtx_weight.zfinder_tool', 'BS ESD AODFULL', 'MinBias'), ('xAOD::AFPTrackContainer#HLT_AFPTrackContainer', 'BS ESD AODFULL', 'MinBias'), diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/DictFromChainName.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/DictFromChainName.py index fc15460faa936287546896c730b9ef3e01ee92f6..e7283881840c7e8f4b49cb7509811c4a1e3bc1f6 100755 --- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/DictFromChainName.py +++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/DictFromChainName.py @@ -3,8 +3,7 @@ """ Class to obtain the chain configuration dictionary from the short or long name -Author: Catrin Bernius -Original code from TriggerMenu with CB, Joerg Stelzer, Moritz Backes +Authors of original code in TriggerMenu: Joerg Stelzer, Moritz Backes, Catrin Bernius """ __author__ = 'Catrin Bernius' @@ -13,6 +12,9 @@ __doc__="Decoding of chain name into a dictionary" from TrigConfHLTUtils.HLTUtils import string2hash from AthenaCommon.Logging import logging + +import collections + log = logging.getLogger( __name__ ) def getOverallL1item(chainName): @@ -153,6 +155,11 @@ def analyseChainName(chainName, L1thresholds, L1item): # ---- remove the L1 item from the name ---- hltChainName = chainName[:chainName.index("_L1")] + # ---- check for HLT_HLT in name --- + if 'HLT_HLT' in hltChainName: + log.error("%s is incorrect, please fix the HLT_HLT part", hltChainName) + raise RuntimeError("[analyseChainName] chain name contains HLT_HLT, please fix in corresponding menu where this chain is included") + # ---- specific chain part information ---- allChainProperties=[] cparts = hltChainName.split("_") @@ -315,6 +322,7 @@ def analyseChainName(chainName, L1thresholds, L1item): # build the chainProperties dictionary for each part of the chain # add it to a allChainProperties multichainparts.reverse() + log.debug('multichainparts after reverse: %s', multichainparts) # verify if the L1 setup is consistent with the chain # sizes of seeds matter @@ -348,12 +356,20 @@ def analyseChainName(chainName, L1thresholds, L1item): chainpartsNoL1 = chainparts parts=chainpartsNoL1.split('_') + log.debug("[analyseChainName] chain parts w/o L1 are %s", parts) if None in parts: log.error("[analyseChainName] chainpartsNoL1 -> parts: %s -> %s", chainpartsNoL1, parts) raise Exception("[analyseChainName] parts contains None, please identify how this is happening") parts=list(filter(None,parts)) log.debug("[analyseChainName] chainpartsNoL1 %s, parts %s", chainpartsNoL1, parts) - + + # --- check for duplicate strings in chain part name --- + duplicateParts = ([item for item, count in collections.Counter(parts).items() if count > 1]) + log.debug("[analyseChainName] chainpartsNoL1 %s contains duplicate strins %s", chainpartsNoL1, duplicateParts) + if duplicateParts: + log.error("[analyseChainName] chain %s has duplicate strings %s, please fix!!", chainName, duplicateParts) + raise RuntimeError("[analyseChainName] Check the chain name, there are duplicate configurations: %s", duplicateParts) + chainProperties['trigType']=mdicts[chainindex]['trigType'] chainProperties['extra']=mdicts[chainindex]['extra'] multiplicity = mdicts[chainindex]['multiplicity'] if not mdicts[chainindex]['multiplicity'] == '' else '1' @@ -371,7 +387,7 @@ def analyseChainName(chainName, L1thresholds, L1item): if len(multichainparts) > 1 and L1item.count("_") > 1 : chainProperties['chainPartName'] = chainpartsNoL1 - log.debug('Chainparts: %s', chainparts) + log.debug('[analyseChainname] Chainparts: %s', chainparts) if (chainProperties['signature'] != 'Cosmic') \ & (chainProperties['signature'] != 'Calib')\ & (chainProperties['signature'] != 'Streaming') \ @@ -394,16 +410,26 @@ def analyseChainName(chainName, L1thresholds, L1item): from .SignatureDicts import getSignatureInformation SignatureDefaultValues, allowedSignaturePropertiesAndValues = getSignatureInformation(chainProperties['signature']) log.debug('SignatureDefaultValues: %s', SignatureDefaultValues) + allDefaults = list(SignatureDefaultValues.values()) + log.debug('All default values in a list') # ---- update chain properties with default properties ---- result = deepcopy(SignatureDefaultValues) result.update(chainProperties) chainProperties = result + # ---- check that all parts to be matched are not specified as defaults already ---- + overlaps = [x for x in parts if x in allDefaults] + log.debug("parts that are also in defaults: %s ", overlaps) + if overlaps: + #log.error("[analyseChainName] The following string(s) is/are already defined as defaults, please remove: %s", overlaps) + #raise RuntimeError("[analyseChainname] Default config appearing in chain name, please remove: %s", overlaps) + log.warning("[analyseChainName] The following string(s) is/are already defined as defaults, please remove: %s", overlaps) + # ---- check remaining parts for complete matches in allowedPropertiesAndValues Dict ---- # ---- unmatched = list of tokens that are not found in the allowed values as a whole ---- - matchedparts = [] + log.debug("[analyseChainname] parts to match are %s", parts) for pindex, part in enumerate(parts): for prop, allowedValues in allowedSignaturePropertiesAndValues.items(): if part in allowedValues: @@ -430,6 +456,7 @@ def analyseChainName(chainName, L1thresholds, L1item): log.debug('Changing %s from %s to %s', prop, str(chainProperties[prop]), str(bJetDefaultValues[prop])) chainProperties[prop] = bJetDefaultValues[prop] + # ---- checking the parts that haven't been matched yet ---- log.debug("matched parts %s", matchedparts) leftoverparts = set(parts)-set(matchedparts) log.debug('leftoverparts %s', leftoverparts) diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/LS2_v1.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/LS2_v1.py index 7a5025124dc974e95d259147c4aba73d1874de18..6a37b64edd25c2b3296662767ab18d06380e99ad 100644 --- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/LS2_v1.py +++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/LS2_v1.py @@ -67,6 +67,7 @@ def setupMenu(): log.info('[setupMenu] going to add the Dev menu chains now') chains['Muon'] += [ + #test chains ChainProp(name="HLT_noalg_L1MU5VF", l1SeedThresholds=['FSNOSEED'], groups=SingleMuonGroup+LowMuGroup), @@ -398,7 +399,6 @@ def setupMenu(): chains['Jet'] += [ - ### PURE TEST CHAINS # Low-pt jet chains -- keep any? @@ -699,7 +699,7 @@ def setupMenu(): # for monitoring ### IS THIS SUPPORT? - ChainProp(name='HLT_j45_0eta290_020jvt_020jvt_pf_ftf_bdl1r70_L1J20', l1SeedThresholds=['FSNOSEED'], groups=SingleBjetGroup), + ChainProp(name='HLT_j45_0eta290_020jvt_pf_ftf_bdl1r70_L1J20', l1SeedThresholds=['FSNOSEED'], groups=SingleBjetGroup), #### TESTING CHAINS @@ -806,7 +806,6 @@ def setupMenu(): ChainProp(name='HLT_j20_pf_ftf_boffperf_L1J100', l1SeedThresholds=['FSNOSEED'], groups=SingleBjetGroup+DevGroup), ChainProp(name='HLT_j20_pf_ftf_boffperf_L1J50_DETA20-J50J', l1SeedThresholds=['FSNOSEED'], groups=SingleBjetGroup+DevGroup), - ] chains['Tau'] += [