diff --git a/InnerDetector/InDetRecTools/SiClusterizationTool/SiClusterizationTool/ClusterMakerTool.h b/InnerDetector/InDetRecTools/SiClusterizationTool/SiClusterizationTool/ClusterMakerTool.h index 4e3c1ceca928e6d3e9ba797ca3bc5a38a6a0dab5..be2fd29feb693b055ed19f760df447a395465bc3 100755 --- a/InnerDetector/InDetRecTools/SiClusterizationTool/SiClusterizationTool/ClusterMakerTool.h +++ b/InnerDetector/InDetRecTools/SiClusterizationTool/SiClusterizationTool/ClusterMakerTool.h @@ -30,7 +30,6 @@ class IPixelCalibSvc; template <class T> class ServiceHandle; class Identifier; class StatusCode; -class IBLParameterSvc; namespace InDetDD { class SiDetectorElement; @@ -139,10 +138,8 @@ public: private: // mutable MsgStream m_log; - ServiceHandle<IBLParameterSvc> m_IBLParameterSvc; bool m_calibrateCharge; ServiceHandle<IPixelCalibSvc> m_calibSvc; - mutable int m_overflowIBLToT; ServiceHandle<IPixelOfflineCalibSvc> m_offlineCalibSvc; // Parametrization of the Pixel errors diff --git a/InnerDetector/InDetRecTools/SiClusterizationTool/SiClusterizationTool/NnClusterizationFactory.h b/InnerDetector/InDetRecTools/SiClusterizationTool/SiClusterizationTool/NnClusterizationFactory.h index 97bbb8a1ced2382417b9242b9682e82b9b62dd3f..9be495d60b8823216521317d5480c30ddea4f636 100644 --- a/InnerDetector/InDetRecTools/SiClusterizationTool/SiClusterizationTool/NnClusterizationFactory.h +++ b/InnerDetector/InDetRecTools/SiClusterizationTool/SiClusterizationTool/NnClusterizationFactory.h @@ -40,8 +40,6 @@ class TH1; class ICoolHistSvc; class IPixelCalibSvc; - class IPixelOfflineCalibSvc; - class IBLParameterSvc; namespace Trk { class NeuralNetworkToHistoTool; @@ -217,10 +215,6 @@ namespace InDet { bool m_useRecenteringNNWithTracks; double m_correctLorShiftBarrelWithoutTracks; double m_correctLorShiftBarrelWithTracks; - ServiceHandle<IBLParameterSvc> m_IBLParameterSvc; - mutable int m_overflowIBLToT; - ServiceHandle<IPixelOfflineCalibSvc> m_offlineCalibSvc; - }; }//end InDet namespace diff --git a/InnerDetector/InDetRecTools/SiClusterizationTool/SiClusterizationTool/TotPixelClusterSplitter.h b/InnerDetector/InDetRecTools/SiClusterizationTool/SiClusterizationTool/TotPixelClusterSplitter.h index 331fc1d5fcd0578047404566fa29b01ffb33b7c3..0b73de1d964573db57027dcfb046eda7e8b1f527 100644 --- a/InnerDetector/InDetRecTools/SiClusterizationTool/SiClusterizationTool/TotPixelClusterSplitter.h +++ b/InnerDetector/InDetRecTools/SiClusterizationTool/SiClusterizationTool/TotPixelClusterSplitter.h @@ -16,9 +16,7 @@ #include "InDetPrepRawData/PixelClusterSplitProb.h" #include "InDetIdentifier/PixelID.h" -class IBLParameterSvc; class IPixelCalibSvc; -class IPixelOfflineCalibSvc; template <class T> class ServiceHandle; namespace InDet @@ -78,7 +76,6 @@ namespace InDet 5 : long inter-ganged pixel */ int pixelType(const int PhiIdx, const int EtaIdx) const; - int chargeToToT(const Identifier & PixID, const PixelID& pixelID, const float Charge) const; enum SplitType { PhiSplit = 0, EtaSplit = 1, NoSplit = 2 }; @@ -92,9 +89,6 @@ namespace InDet /** Indicates whether or not to consider long pixels. */ bool m_doLongPixels; - ServiceHandle<IBLParameterSvc> m_IBLParameterSvc; - mutable int m_overflowIBLToT; - ServiceHandle<IPixelOfflineCalibSvc> m_offlineCalibSvc; }; inline void TotPixelClusterSplitter::setMinPixels(unsigned int minPix) diff --git a/InnerDetector/InDetRecTools/SiClusterizationTool/src/ClusterMakerTool.cxx b/InnerDetector/InDetRecTools/SiClusterizationTool/src/ClusterMakerTool.cxx index cd3a7c4b2bc0f66160a95bd2fe1be9077a066902..5fe0882002d538943e990d94416dc84977b89420 100755 --- a/InnerDetector/InDetRecTools/SiClusterizationTool/src/ClusterMakerTool.cxx +++ b/InnerDetector/InDetRecTools/SiClusterizationTool/src/ClusterMakerTool.cxx @@ -26,7 +26,6 @@ #include "PixelConditionsServices/IPixelOfflineCalibSvc.h" #include "PixelConditionsServices/IPixelCalibSvc.h" -#include "PixelGeoModel/IBLParameterSvc.h" #include "EventPrimitives/EventPrimitives.h" @@ -50,9 +49,7 @@ ClusterMakerTool::ClusterMakerTool(const std::string& t, const std::string& n, const IInterface* p) : AthAlgTool(t,n,p), - m_IBLParameterSvc("IBLParameterSvc",n), m_calibSvc("PixelCalibSvc", n), - m_overflowIBLToT(0), m_offlineCalibSvc("PixelOfflineCalibSvc", n) { declareInterface<ClusterMakerTool>(this); @@ -70,7 +67,8 @@ StatusCode ClusterMakerTool::initialize(){ // Code entered here will be executed once at program start. ATH_MSG_INFO ( name() << " initialize()" ); - + +/* if (m_IBLParameterSvc.retrieve().isFailure()) { ATH_MSG_WARNING( "Could not retrieve IBLParameterSvc"); } @@ -79,6 +77,7 @@ StatusCode ClusterMakerTool::initialize(){ m_calibSvc.setTypeAndName(m_IBLParameterSvc->setStringParameters(m_calibSvc.typeAndName(),"PixelCalibSvc")); m_IBLParameterSvc->setBoolParameters(m_calibrateCharge,"UsePixelCalibCondDB"); } +*/ // Protect from the situation in which the PixelOfflineCalibSvc is not // configured: that should be the case if no PixelRDO are read in. @@ -180,8 +179,6 @@ PixelCluster* ClusterMakerTool::pixelCluster( issueError=false; } - if (m_IBLParameterSvc->containsIBL() && !m_offlineCalibSvc.empty()) m_overflowIBLToT = m_offlineCalibSvc->getIBLToToverflow(); //Do we really need this for every cluster? Every event would be sufficient I think, but a lot of client code may need changing to do that... to be looked at in future //NS - const AtlasDetectorID* aid = element->getIdHelper(); const PixelID* pid = dynamic_cast<const PixelID*>(aid); if (not pid){ @@ -198,17 +195,7 @@ PixelCluster* ClusterMakerTool::pixelCluster( for (int i=0; i<nRDO; i++) { Identifier pixid=rdoList[i]; int ToT=totList[i]; - float charge; - if( m_IBLParameterSvc->containsIBL() && pid->barrel_ec(pixid) == 0 && pid->layer_disk(pixid) == 0 ) { - if (ToT >= m_overflowIBLToT ) ToT = m_overflowIBLToT; - msg(MSG::DEBUG) << "barrel_ec = " << pid->barrel_ec(pixid) << " layer_disque = " << pid->layer_disk(pixid) << " ToT = " << totList[i] << " Real ToT = " << ToT << endreq; - } - float A = m_calibSvc->getQ2TotA(pixid); - if ( A>0. && (ToT/A)<1. ) { - float E = m_calibSvc->getQ2TotE(pixid); - float C = m_calibSvc->getQ2TotC(pixid); - charge = (C*ToT/A-E)/(1-ToT/A); - } else charge=0.; + float charge = m_calibSvc->getCharge(pixid,ToT); chargeList.push_back(charge); } } @@ -345,8 +332,6 @@ PixelCluster* ClusterMakerTool::pixelCluster( } if ( errorStrategy==2 && forceErrorStrategy1 ) errorStrategy=1; - if (m_IBLParameterSvc->containsIBL() && !m_offlineCalibSvc.empty()) m_overflowIBLToT = m_offlineCalibSvc->getIBLToToverflow(); //Do we really need this for every cluster? Every event would be sufficient I think, but a lot of client code may need changing to do that... to be looked at in future //NS - // Fill vector of charges and compute charge balance const InDetDD::PixelModuleDesign* design = (dynamic_cast<const InDetDD::PixelModuleDesign*>(&element->design())); if (not design){ @@ -365,21 +350,13 @@ PixelCluster* ClusterMakerTool::pixelCluster( for (int i=0; i<nRDO; i++) { Identifier pixid=rdoList[i]; int ToT=totList[i]; - if( m_IBLParameterSvc->containsIBL() && pixelID.barrel_ec(pixid) == 0 && pixelID.layer_disk(pixid) == 0 ) { - if (ToT >= m_overflowIBLToT ) ToT = m_overflowIBLToT; - msg(MSG::DEBUG) << "barrel_ec = " << pixelID.barrel_ec(pixid) << " layer_disque = " << pixelID.layer_disk(pixid) << " ToT = " << totList[i] << " Real ToT = " << ToT << endreq; - } - + float charge = ToT; if (m_calibrateCharge){ - float A = m_calibSvc->getQ2TotA(pixid); - if ( A>0. && (ToT/A)<1. ) { - float E = m_calibSvc->getQ2TotE(pixid); - float C = m_calibSvc->getQ2TotC(pixid); - charge = (C*ToT/A-E)/(1-ToT/A); - } else charge=0.; + charge = m_calibSvc->getCharge(pixid,ToT); chargeList.push_back(charge); } + // std::cout << "tot, charge = " << ToT << " " << charge << std::endl; int row = pixelID.phi_index(pixid); int col = pixelID.eta_index(pixid); diff --git a/InnerDetector/InDetRecTools/SiClusterizationTool/src/NnClusterizationFactory.cxx b/InnerDetector/InDetRecTools/SiClusterizationTool/src/NnClusterizationFactory.cxx index aa0a30eece2200fc9a0f888540287b581badf4e4..8b16b751ee70949966616731d5d261aef2338e90 100644 --- a/InnerDetector/InDetRecTools/SiClusterizationTool/src/NnClusterizationFactory.cxx +++ b/InnerDetector/InDetRecTools/SiClusterizationTool/src/NnClusterizationFactory.cxx @@ -39,10 +39,8 @@ #include "TrkEventPrimitives/ParamDefs.h" -#include "PixelGeoModel/IBLParameterSvc.h" #include "PixelConditionsServices/IPixelCalibSvc.h" #include "DetDescrCondTools/ICoolHistSvc.h" -#include "PixelConditionsServices/IPixelOfflineCalibSvc.h" #include "AthenaPoolUtilities/CondAttrListCollection.h" @@ -73,10 +71,7 @@ namespace InDet { m_useRecenteringNNWithouTracks(false), m_useRecenteringNNWithTracks(false), m_correctLorShiftBarrelWithoutTracks(0.), - m_correctLorShiftBarrelWithTracks(0.), - m_IBLParameterSvc("IBLParameterSvc",n), - m_overflowIBLToT(0), - m_offlineCalibSvc("PixelOfflineCalibSvc", n) + m_correctLorShiftBarrelWithTracks(0.) { // histogram loading from COOL declareProperty("CoolFolder", m_coolFolder); @@ -175,23 +170,6 @@ namespace InDet { return StatusCode::FAILURE; } - if ( !m_offlineCalibSvc.empty() ) { - StatusCode sc = m_offlineCalibSvc.retrieve(); - if (sc.isFailure() || !m_offlineCalibSvc ) { - ATH_MSG_ERROR( m_offlineCalibSvc.type() << " not found! "); - return StatusCode::RECOVERABLE; - } - else{ - ATH_MSG_INFO ( "Retrieved tool " << m_offlineCalibSvc.type() ); - } - } - - if (m_IBLParameterSvc.retrieve().isFailure()) { - ATH_MSG_FATAL("Could not retrieve IBLParameterSvc"); - return StatusCode::FAILURE; - } else - ATH_MSG_INFO("Retrieved service " << m_IBLParameterSvc); - return StatusCode::SUCCESS; } @@ -1017,7 +995,6 @@ if(m_doRunI){ return assembleInputRunI( input, sizeX, sizeY ); }els std::vector<int> totListRecreated; std::vector<int>::const_iterator totRecreated = totListRecreated.begin(); - if( m_IBLParameterSvc->containsIBL()) m_overflowIBLToT = m_offlineCalibSvc->getIBLToToverflow(); //if (!chList.size() && totList.size()){ // // Recreate both charge list and ToT list to correct for the IBL ToT overflow (and later for small hits): @@ -1025,19 +1002,9 @@ if(m_doRunI){ return assembleInputRunI( input, sizeX, sizeY ); }els for ( ; rdosBegin!= rdosEnd && tot != totList.end(); ++tot, ++rdosBegin, ++totRecreated ){ // recreate the charge: should be a method of the calibSvc int tot0 = *tot; - if( m_IBLParameterSvc->containsIBL() && pixelID.barrel_ec(*rdosBegin) == 0 && pixelID.layer_disk(*rdosBegin) == 0 ) { - if ( tot0 >= m_overflowIBLToT ) tot0 = m_overflowIBLToT; - msg(MSG::DEBUG) << "barrel_ec = " << pixelID.barrel_ec(*rdosBegin) << " layer_disque = " << pixelID.layer_disk(*rdosBegin) << " ToT = " << *tot << " Real ToT = " << tot0 << endreq; - } - float ch = 0; - float A = m_calibSvc->getQ2TotA(*rdosBegin); - if ( A>0. && (tot0/A)<1. ) { - float E = m_calibSvc->getQ2TotE(*rdosBegin); - float C = m_calibSvc->getQ2TotC(*rdosBegin); - ch = (C*(tot0)/A-E)/(1-(tot0)/A); - } else ch=0.; - chListRecreated.push_back(ch); - totListRecreated.push_back(tot0); + float ch = m_calibSvc->getCharge(*rdosBegin,tot0); + chListRecreated.push_back(ch); + totListRecreated.push_back(tot0); } // reset the rdo iterator rdosBegin = rdos.begin(); diff --git a/InnerDetector/InDetRecTools/SiClusterizationTool/src/TotPixelClusterSplitter.cxx b/InnerDetector/InDetRecTools/SiClusterizationTool/src/TotPixelClusterSplitter.cxx index c4a8d4780dab318a10fdf1821d18e303f46966b1..f6e91a74263500338d55f3425f277862d3ea06a4 100644 --- a/InnerDetector/InDetRecTools/SiClusterizationTool/src/TotPixelClusterSplitter.cxx +++ b/InnerDetector/InDetRecTools/SiClusterizationTool/src/TotPixelClusterSplitter.cxx @@ -12,9 +12,7 @@ #include "InDetReadoutGeometry/SiDetectorElement.h" -#include "PixelGeoModel/IBLParameterSvc.h" #include "PixelConditionsServices/IPixelCalibSvc.h" -#include "PixelConditionsServices/IPixelOfflineCalibSvc.h" InDet::TotPixelClusterSplitter::TotPixelClusterSplitter(const std::string & type, const std::string & name, @@ -23,10 +21,7 @@ InDet::TotPixelClusterSplitter::TotPixelClusterSplitter(const std::string & type m_calibSvc("PixelCalibSvc", name), m_minPixels(3), m_maxPixels(25), - m_doLongPixels(true), - m_IBLParameterSvc("IBLParameterSvc",name), - m_overflowIBLToT(0), - m_offlineCalibSvc("PixelOfflineCalibSvc", name) + m_doLongPixels(true) { declareInterface<IPixelClusterSplitter>(this); declareProperty("PixelCalibSvc", m_calibSvc); @@ -37,31 +32,7 @@ InDet::TotPixelClusterSplitter::~TotPixelClusterSplitter() StatusCode InDet::TotPixelClusterSplitter::initialize() { -// ATH_MSG_INFO("initialize()"); - StatusCode sc = m_calibSvc.retrieve(); - if (sc.isFailure() || !m_calibSvc) - { - ATH_MSG_WARNING("Requesting charge calibration, but ServiceHandle is not configured."); - ATH_MSG_WARNING("Charge splitting will be WRONG."); - return sc; - } - - if ( !m_offlineCalibSvc.empty() ) { - StatusCode sc = m_offlineCalibSvc.retrieve(); - if (sc.isFailure() || !m_offlineCalibSvc ) { - ATH_MSG_ERROR( m_offlineCalibSvc.type() << " not found! "); - return StatusCode::RECOVERABLE; - } - else{ - ATH_MSG_INFO ( "Retrieved tool " << m_offlineCalibSvc.type() ); - } - } - - if (m_IBLParameterSvc.retrieve().isFailure()) { - ATH_MSG_FATAL("Could not retrieve IBLParameterSvc"); - return StatusCode::FAILURE; - } else - ATH_MSG_INFO("Retrieved service " << m_IBLParameterSvc); + CHECK(m_calibSvc.retrieve()); return StatusCode::SUCCESS; } @@ -270,7 +241,7 @@ std::vector<InDet::PixelClusterParts> InDet::TotPixelClusterSplitter::splitClust for (int j = 0; j < 2; j++) { SplitRdos[j].push_back(Rdos[i]); - Totgroups[j].push_back(chargeToToT(Rdos[i], pixelID, Charges[i]/2.)); + Totgroups[j].push_back(static_cast<int>(m_calibSvc->getTotMean(Rdos[i],Charges[i]/2.))); Lvl1groups[j].push_back(Lvl1a); } } @@ -318,25 +289,3 @@ int InDet::TotPixelClusterSplitter::pixelType(const int PhiIdx, const int EtaIdx } } -int InDet::TotPixelClusterSplitter::chargeToToT(const Identifier & PixID, const PixelID& pixelID, const float Charge) const -{ - float FLT_ToT; - float A = m_calibSvc->getQ2TotA(PixID); - if ( A > 0. ) - { - float E = m_calibSvc->getQ2TotE(PixID); - float C = m_calibSvc->getQ2TotC(PixID); - FLT_ToT = A*(Charge + E)/(Charge + C); - } - else FLT_ToT = 0.; - - int ToT = static_cast<int>(FLT_ToT); - - if( m_IBLParameterSvc->containsIBL() && pixelID.barrel_ec(PixID) == 0 && pixelID.layer_disk(PixID) == 0 ) { - m_overflowIBLToT = m_offlineCalibSvc->getIBLToToverflow(); - if (ToT >= m_overflowIBLToT ) ToT = m_overflowIBLToT; - msg(MSG::DEBUG) << "barrel_ec = " << pixelID.barrel_ec(PixID) << " layer_disque = " << pixelID.layer_disk(PixID) << " ToT = " << FLT_ToT << " Real ToT = " << ToT << endreq; - } - - return ToT; -}