diff --git a/LArCalorimeter/LArROD/CMakeLists.txt b/LArCalorimeter/LArROD/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..42550a079e085ba10b59ce728959027a71274d77 --- /dev/null +++ b/LArCalorimeter/LArROD/CMakeLists.txt @@ -0,0 +1,56 @@ +################################################################################ +# Package: LArROD +################################################################################ + +# Declare the package name: +atlas_subdir( LArROD ) + +# Declare the package's dependencies: +atlas_depends_on_subdirs( PUBLIC + Calorimeter/CaloIdentifier + Control/AthenaBaseComps + Control/StoreGate + DetectorDescription/Identifier + GaudiKernel + LArCalorimeter/LArCabling + LArCalorimeter/LArElecCalib + LArCalorimeter/LArIdentifier + LArCalorimeter/LArRawConditions + LArCalorimeter/LArRawEvent + LArCalorimeter/LArRawUtils + LArCalorimeter/LArRecConditions + LArCalorimeter/LArRecUtils + TestBeam/TBEvent + PRIVATE + Calorimeter/CaloDetDescr + Calorimeter/CaloEvent + Commission/CommissionEvent + Control/AthContainers + Database/AthenaPOOL/AthenaPoolUtilities + Event/EventInfo + LArCalorimeter/LArCOOLConditions ) + +# External dependencies: +find_package( CLHEP ) +find_package( ROOT COMPONENTS Core Tree MathCore Hist RIO pthread ) + +# Component(s) in the package: +atlas_add_library( LArRODLib + src/*.cxx + src/tests/*.cxx + PUBLIC_HEADERS LArROD + INCLUDE_DIRS ${CLHEP_INCLUDE_DIRS} + PRIVATE_INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} + DEFINITIONS ${CLHEP_DEFINITIONS} + LINK_LIBRARIES ${CLHEP_LIBRARIES} CaloIdentifier AthenaBaseComps Identifier GaudiKernel LArIdentifier LArRawConditions LArRawEvent LArRecConditions TBEvent StoreGateLib SGtests LArCablingLib LArRawUtilsLib LArRecUtilsLib CaloDetDescrLib + PRIVATE_LINK_LIBRARIES ${ROOT_LIBRARIES} CaloEvent CommissionEvent AthContainers AthenaPoolUtilities EventInfo LArCOOLConditions ) + +atlas_add_component( LArROD + src/components/*.cxx + INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} + LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} CaloIdentifier AthenaBaseComps StoreGateLib SGtests Identifier GaudiKernel LArCablingLib LArIdentifier LArRawConditions LArRawEvent LArRawUtilsLib LArRecConditions LArRecUtilsLib TBEvent CaloDetDescrLib CaloEvent CommissionEvent AthContainers AthenaPoolUtilities EventInfo LArCOOLConditions LArRODLib ) + +# Install files from the package: +atlas_install_python_modules( python/*.py ) +atlas_install_joboptions( share/*.py ) + diff --git a/LArCalorimeter/LArROD/LArROD/LArCalibDigitsAccumulator.h b/LArCalorimeter/LArROD/LArROD/LArCalibDigitsAccumulator.h index 39b01cfc2c8f7f8063aaa7d9796f51fbd259b116..7280ac3452aa9e5430886300051d0aba0b39c050 100755 --- a/LArCalorimeter/LArROD/LArROD/LArCalibDigitsAccumulator.h +++ b/LArCalorimeter/LArROD/LArROD/LArCalibDigitsAccumulator.h @@ -26,7 +26,7 @@ #include "LArIdentifier/LArOnlineID.h" #include "StoreGate/StoreGateSvc.h" #include "LArRawConditions/LArCalibParams.h" -#include "LArTools/LArCablingService.h" +#include "LArCabling/LArCablingService.h" class LArCalibDigitsAccumulator : public AthAlgorithm { diff --git a/LArCalorimeter/LArROD/LArROD/LArCalibDigitsAccumulatorFreeGain.h b/LArCalorimeter/LArROD/LArROD/LArCalibDigitsAccumulatorFreeGain.h index c8478200f04235658904245384e3f91209b89846..2952afcd1720129e1fea16ff84a60e5cf459ed23 100644 --- a/LArCalorimeter/LArROD/LArROD/LArCalibDigitsAccumulatorFreeGain.h +++ b/LArCalorimeter/LArROD/LArROD/LArCalibDigitsAccumulatorFreeGain.h @@ -25,7 +25,7 @@ #include "LArIdentifier/LArOnlineID.h" #include "StoreGate/StoreGateSvc.h" #include "LArRawConditions/LArCalibParams.h" -#include "LArTools/LArCablingService.h" +#include "LArCabling/LArCablingService.h" class LArCalibDigitsAccumulatorFreeGain : public AthAlgorithm { diff --git a/LArCalorimeter/LArROD/LArROD/LArCellBuilderDriver.h b/LArCalorimeter/LArROD/LArROD/LArCellBuilderDriver.h index 22de41e1a5168ff02c6c0fb4cc15d71c978c1c57..efedace976a3ae6a64f9df430234f75a449d2461 100755 --- a/LArCalorimeter/LArROD/LArROD/LArCellBuilderDriver.h +++ b/LArCalorimeter/LArROD/LArROD/LArCellBuilderDriver.h @@ -18,7 +18,7 @@ #include "GaudiKernel/ToolHandle.h" #include "StoreGate/StoreGateSvc.h" -#include "LArTools/LArCablingService.h" +#include "LArCabling/LArCablingService.h" #include "CaloIdentifier/CaloGain.h" #include "LArIdentifier/LArOnlineID.h" diff --git a/LArCalorimeter/LArROD/LArROD/LArDigitPreprocessor.icc b/LArCalorimeter/LArROD/LArROD/LArDigitPreprocessor.icc index 5462bc3b5121dd4665ee510d5766a1b98f56c165..c483617129dbd2b339bfbc1f666c51021f95e219 100755 --- a/LArCalorimeter/LArROD/LArROD/LArDigitPreprocessor.icc +++ b/LArCalorimeter/LArROD/LArROD/LArDigitPreprocessor.icc @@ -34,7 +34,7 @@ LArDigitPreProcessor<DIGITCONTAINER>::LArDigitPreProcessor (const std::string& n const float highGainFactor=9.8; //MedGain*highGainFactor=highGain Value correct?? m_medGainLowerLimit=0x4fe; //Comes from old LArRawChannelBuilder class m_medGainUpperLimit=0xe0f; //Comes from old LArRawChannelBuilder class - m_highGainLowerLimit=(short)(m_medGainUpperLimit/highGainFactor); + m_highGainLowerLimit=(short)(m_medGainUpperLimit*(1./highGainFactor)); m_lowGainUpperLimit=(short)(m_medGainLowerLimit*medGainFactor); } diff --git a/LArCalorimeter/LArROD/LArROD/LArDigitThinner.h b/LArCalorimeter/LArROD/LArROD/LArDigitThinner.h index f74504d61afd6e5eadfdddbe8efa1e5f92e0854f..062f280173efdb1e49e636c4bd5092e31edf5a7f 100755 --- a/LArCalorimeter/LArROD/LArROD/LArDigitThinner.h +++ b/LArCalorimeter/LArROD/LArROD/LArDigitThinner.h @@ -17,7 +17,7 @@ #include "AthenaBaseComps/AthAlgorithm.h" #include "GaudiKernel/ToolHandle.h" -#include "LArTools/LArCablingService.h" +#include "LArCabling/LArCablingService.h" #include "Identifier/HWIdentifier.h" #include <vector> diff --git a/LArCalorimeter/LArROD/LArROD/LArDigitsAccumulator.h b/LArCalorimeter/LArROD/LArROD/LArDigitsAccumulator.h index fff9dda6803021c8893cc77ec88945272b5a66a2..b1667a7a8f870dc705605cdcde50880fb8c1b0b4 100644 --- a/LArCalorimeter/LArROD/LArROD/LArDigitsAccumulator.h +++ b/LArCalorimeter/LArROD/LArROD/LArDigitsAccumulator.h @@ -20,7 +20,7 @@ #include "LArRawEvent/LArAccumulatedDigitContainer.h" #include "LArIdentifier/LArOnlineID.h" #include "StoreGate/StoreGateSvc.h" -#include "LArTools/LArCablingService.h" +#include "LArCabling/LArCablingService.h" class LArDigitsAccumulator : public AthAlgorithm { diff --git a/LArCalorimeter/LArROD/LArROD/LArRawChannelBuilder.h b/LArCalorimeter/LArROD/LArROD/LArRawChannelBuilder.h index b6d8b44fbc4d32e06450d8a585c20fefbd927705..18a2a79e7a242b59a25b11f48e35d0ca94232c5d 100755 --- a/LArCalorimeter/LArROD/LArROD/LArRawChannelBuilder.h +++ b/LArCalorimeter/LArROD/LArROD/LArRawChannelBuilder.h @@ -25,7 +25,7 @@ #include "LArElecCalib/ILArHVCorrTool.h" // sandrine -//#include "LArTools/LArCablingService.h" +//#include "LArCabling/LArCablingService.h" //#include "CaloIdentifier/LArEM_ID.h" //#include "LArRawUtils/LArRoI_Map.h" @@ -36,7 +36,7 @@ #include "LArIdentifier/LArOnlineID.h" #include "CaloIdentifier/CaloIdManager.h" -#include "LArTools/LArCablingService.h" +#include "LArCabling/LArCablingService.h" class LArRawChannelBuilder : public AthAlgorithm { diff --git a/LArCalorimeter/LArROD/LArROD/LArRawChannelBuilderDriver.h b/LArCalorimeter/LArROD/LArROD/LArRawChannelBuilderDriver.h index 6ea722a1719347c6531ce728a586d6a44d3eefd1..558a679ef6a1a1a9222a8c15e85e47daba7caf02 100755 --- a/LArCalorimeter/LArROD/LArROD/LArRawChannelBuilderDriver.h +++ b/LArCalorimeter/LArROD/LArROD/LArRawChannelBuilderDriver.h @@ -20,7 +20,7 @@ #include "AthenaBaseComps/AthAlgorithm.h" #include "StoreGate/StoreGateSvc.h" -#include "LArTools/LArCablingService.h" +#include "LArCabling/LArCablingService.h" #include "CaloIdentifier/CaloGain.h" #include "LArIdentifier/LArOnlineID.h" diff --git a/LArCalorimeter/LArROD/LArROD/LArRawChannelBuilderToolBase.h b/LArCalorimeter/LArROD/LArROD/LArRawChannelBuilderToolBase.h index 421935659fc5eee6e7c28fcd16475c0a12e2ba2d..abf18ce3602063d65e483afb0aea5c85f7c38ea1 100755 --- a/LArCalorimeter/LArROD/LArROD/LArRawChannelBuilderToolBase.h +++ b/LArCalorimeter/LArROD/LArROD/LArRawChannelBuilderToolBase.h @@ -36,7 +36,7 @@ class LArRawChannelBuilderToolBase : public LArRawChannelBuilderToolBaseClass, const std::string& name, const IInterface* parent); void initEventHidden() - { m_larRawChannelContainer=pParent->m_larRawChannelContainer; + { m_larRawChannelContainer=m_parent->m_larRawChannelContainer; if ( m_larRawChannelContainer !=NULL ) m_buildIt = &LArRawChannelBuilderToolBase::BuildLArRawChannel; else diff --git a/LArCalorimeter/LArROD/LArROD/LArRawChannelBuilderToolBaseClass.h b/LArCalorimeter/LArROD/LArROD/LArRawChannelBuilderToolBaseClass.h index cd80168c44ea271f1f5e43f65a04898ed8ecaf11..f2f5bd6c01604d33cf10ac191c9f54fac3bf2126 100755 --- a/LArCalorimeter/LArROD/LArROD/LArRawChannelBuilderToolBaseClass.h +++ b/LArCalorimeter/LArROD/LArROD/LArRawChannelBuilderToolBaseClass.h @@ -26,8 +26,8 @@ #include "StoreGate/StoreGateSvc.h" -#include "LArTools/LArCablingService.h" -#include "LArTools/LArSuperCellCablingTool.h" +#include "LArCabling/LArCablingService.h" +#include "LArCabling/LArSuperCellCablingTool.h" class LArRawChannelBuilderToolBaseClass : public AthAlgTool, public virtual ILArRawChannelBuilderToolBaseClass @@ -45,7 +45,7 @@ class LArRawChannelBuilderToolBaseClass : public AthAlgTool, StatusCode initToolHidden(LArRawChannelBuilderParams *myParent) { - pParent=myParent; + m_parent=myParent; if ( m_isSC ) { ToolHandle<LArSuperCellCablingTool> lscct; CHECK( lscct.retrieve() ); @@ -83,9 +83,9 @@ class LArRawChannelBuilderToolBaseClass : public AthAlgTool, protected: - LArRawChannelBuilderParams *pParent; + LArRawChannelBuilderParams *m_parent; - LArRawChannelBuilderStatistics *helper; + LArRawChannelBuilderStatistics *m_helper; StoreGateSvc* m_detStore; diff --git a/LArCalorimeter/LArROD/LArROD/LArRawChannelSimpleBuilder.h b/LArCalorimeter/LArROD/LArROD/LArRawChannelSimpleBuilder.h index 1a9538cf8105d0c107d2f3bd7aed14513a4b6503..6a93bbdac1e9ebe54845d3051f732e5d3189ccc4 100755 --- a/LArCalorimeter/LArROD/LArROD/LArRawChannelSimpleBuilder.h +++ b/LArCalorimeter/LArROD/LArROD/LArRawChannelSimpleBuilder.h @@ -17,7 +17,7 @@ #include "AthenaBaseComps/AthAlgorithm.h" #include "GaudiKernel/ToolHandle.h" #include "LArRawEvent/LArRawChannelContainer.h" -#include "LArTools/LArCablingService.h" +#include "LArCabling/LArCablingService.h" #include "CaloIdentifier/LArEM_ID.h" #include "CaloIdentifier/LArFCAL_ID.h" #include "CaloIdentifier/LArHEC_ID.h" diff --git a/LArCalorimeter/LArROD/LArROD/LArSuperCellBuilderDriver.h b/LArCalorimeter/LArROD/LArROD/LArSuperCellBuilderDriver.h index 6656a6bb47d268b3659122313f5eadc32a8a5c87..0f7249bc896eed529b88de935ef88305c8b26cef 100755 --- a/LArCalorimeter/LArROD/LArROD/LArSuperCellBuilderDriver.h +++ b/LArCalorimeter/LArROD/LArROD/LArSuperCellBuilderDriver.h @@ -19,7 +19,7 @@ #include "StoreGate/StoreGateSvc.h" #include "AthenaBaseComps/AthAlgorithm.h" -#include "LArTools/LArSuperCellCablingTool.h" +#include "LArCabling/LArSuperCellCablingTool.h" #include "CaloIdentifier/CaloGain.h" #include "LArIdentifier/LArOnline_SuperCellID.h" diff --git a/LArCalorimeter/LArROD/LArROD/ReadLArDigits.h b/LArCalorimeter/LArROD/LArROD/ReadLArDigits.h index af2d1821de03d132518a9a11ccd25aa04e2dd180..3ccabb7d4c1810a51c1087414c541704f209b30f 100755 --- a/LArCalorimeter/LArROD/LArROD/ReadLArDigits.h +++ b/LArCalorimeter/LArROD/LArROD/ReadLArDigits.h @@ -19,7 +19,7 @@ #include "GaudiKernel/MsgStream.h" #include "StoreGate/StoreGateSvc.h" #include "LArRawEvent/LArDigitContainer.h" -#include "LArTools/LArCablingService.h" +#include "LArCabling/LArCablingService.h" #include "CaloIdentifier/LArEM_ID.h" #include "GaudiKernel/INTupleSvc.h" #include "GaudiKernel/NTuple.h" diff --git a/LArCalorimeter/LArROD/cmt/requirements b/LArCalorimeter/LArROD/cmt/requirements index 3723f3a7bad39e62243ed8ad9e67e6a3901e2379..290d70cb9fb610d93e60c88b74f6de2dec8414a7 100755 --- a/LArCalorimeter/LArROD/cmt/requirements +++ b/LArCalorimeter/LArROD/cmt/requirements @@ -17,7 +17,7 @@ use LArRawEvent LArRawEvent-* LArCalorimeter #use LArRawUtils LArRawUtils-* LArCalorimeter use LArRawConditions LArRawConditions-* LArCalorimeter use LArRecUtils LArRecUtils-* LArCalorimeter -use LArTools LArTools-* LArCalorimeter +use LArCabling LArCabling-* LArCalorimeter use LArRecConditions LArRecConditions-* LArCalorimeter @@ -42,10 +42,8 @@ use CaloEvent CaloEvent-* Calorimeter use LArCOOLConditions LArCOOLConditions-* LArCalorimeter use AthenaPoolUtilities AthenaPoolUtilities-* Database/AthenaPOOL -use CaloTriggerTool CaloTriggerTool-* Calorimeter - use AtlasROOT AtlasROOT-* External - +use EventInfo EventInfo-* Event end_private #use GaudiPython v* diff --git a/LArCalorimeter/LArROD/share/superCellVsCaloCellTestAlg_jobOptions.py b/LArCalorimeter/LArROD/share/superCellVsCaloCellTestAlg_jobOptions.py index 73fce7764b200f2fbe4346c497018a48dfbf5816..eeea9605d9821d07055a1517d779c05894174462 100644 --- a/LArCalorimeter/LArROD/share/superCellVsCaloCellTestAlg_jobOptions.py +++ b/LArCalorimeter/LArROD/share/superCellVsCaloCellTestAlg_jobOptions.py @@ -1,6 +1,6 @@ from glob import glob -filelist = ['/var/clus/usera/will/testareas/ValidateDPS/DigiJobOptions/out.FixedELSB_middle64_nopileup_RDO.pool.root'] +filelist = ['/var/clus/usera/will/testareas/ValidateDPS/DigiJobOptions/out.allConstantsSV_mV_LSB_RDO.pool.root'] from AthenaCommon.AthenaCommonFlags import athenaCommonFlags athenaCommonFlags.FilesInput = filelist @@ -35,4 +35,7 @@ include("RecExCond/AllDet_detDescr.py") job = CfgMgr.AthSequencer("AthAlgSeq") job += CfgMgr.SuperCellVsCaloCellTestAlg("MyAlg") -svcMgr += CfgMgr.AthenaEventLoopMgr(EventPrintoutInterval=500) +#svcMgr += CfgMgr.AthenaEventLoopMgr(EventPrintoutInterval=500) + +if not hasattr(svcMgr,"THistSvc"): svcMgr += CfgMgr.THistSvc() +svcMgr.THistSvc.Output += ["SUPERCELLTEST DATAFILE='hist.root' OPT='RECREATE' "] \ No newline at end of file diff --git a/LArCalorimeter/LArROD/src/LArCellBuilderDriver.cxx b/LArCalorimeter/LArROD/src/LArCellBuilderDriver.cxx index 13564f9a20cc943d265550b62ab7916468069a10..f8b09fb6cac7ad659a60e6609c917f946ed4573f 100755 --- a/LArCalorimeter/LArROD/src/LArCellBuilderDriver.cxx +++ b/LArCalorimeter/LArROD/src/LArCellBuilderDriver.cxx @@ -50,8 +50,6 @@ LArCellBuilderDriver::~LArCellBuilderDriver() StatusCode LArCellBuilderDriver::initialize() { - MsgStream m_log(msgSvc(), name()); - // initialize parameters m_params = new LArRawChannelBuilderParams; m_params->m_larRawChannelContainer = NULL; @@ -60,18 +58,18 @@ StatusCode LArCellBuilderDriver::initialize() if (this->retrieveDetectorStore(m_onlineHelper, "LArOnlineID").isFailure()) { - m_log << MSG::ERROR << "Could not get LArOnlineID helper !" << endreq; + ATH_MSG_ERROR( "Could not get LArOnlineID helper !" ); return StatusCode::FAILURE; } // if (m_roiMap.retrieve().isFailure()) // { -// m_log << MSG::ERROR << "Unable to find tool LArRoI_Map" << endreq; +// ATH_MSG_ERROR( "Unable to find tool LArRoI_Map" ); // return StatusCode::FAILURE; // } if(m_larCablingSvc.retrieve().isFailure()) { - m_log << MSG::ERROR << "Could not retrieve LArCablingService Tool" << endreq; + ATH_MSG_ERROR( "Could not retrieve LArCablingService Tool" ); return StatusCode::FAILURE; } @@ -80,51 +78,51 @@ StatusCode LArCellBuilderDriver::initialize() if ( m_buildTools.retrieve().isFailure() ) { - m_log << MSG::ERROR << "Unable to find Builder Tools " << m_buildTools << endreq; + ATH_MSG_ERROR( "Unable to find Builder Tools " << m_buildTools ); return StatusCode::FAILURE; }else{ - m_log << MSG::INFO << "Successfully retrieved Builder Tools " << m_buildTools << endreq; + ATH_MSG_INFO( "Successfully retrieved Builder Tools " << m_buildTools ); } for( builderToolVector::iterator it = m_buildTools.begin(); it != m_buildTools.end(); it++ ) if( ( (*it)->initToolHidden(m_params) ).isFailure() ) - m_log << MSG::ERROR << "Unable to initialize Builder Tool " << (*it)->name() << endreq; + ATH_MSG_ERROR( "Unable to initialize Builder Tool " << (*it)->name() ); if ( m_adc2eTools.retrieve().isFailure() ) { - m_log << MSG::ERROR << "Unable to find ADC2E Tools " << m_buildTools << endreq; + ATH_MSG_ERROR( "Unable to find ADC2E Tools " << m_buildTools ); return StatusCode::FAILURE; }else{ - m_log << MSG::INFO << "Successfully retrieved ADC2E Tools " << m_buildTools << endreq; + ATH_MSG_INFO( "Successfully retrieved ADC2E Tools " << m_buildTools ); } for( adc2eToolVector::iterator it = m_adc2eTools.begin(); it != m_adc2eTools.end(); it++ ) if( ( (*it)->initToolHidden(m_params) ).isFailure() ) - m_log << MSG::ERROR << "Unable to initialize ADC2E Tool " << (*it)->name() << endreq; + ATH_MSG_ERROR( "Unable to initialize ADC2E Tool " << (*it)->name() ); if ( m_pedestalTools.retrieve().isFailure() ) { - m_log << MSG::ERROR << "Unable to find Pedestal Tools " << m_buildTools << endreq; + ATH_MSG_ERROR( "Unable to find Pedestal Tools " << m_buildTools ); return StatusCode::FAILURE; }else{ - m_log << MSG::INFO << "Successfully retrieved Pedestal Tools " << m_buildTools << endreq; - } + ATH_MSG_INFO( "Successfully retrieved Pedestal Tools " << m_buildTools ); + } for( pedestalToolVector::iterator it = m_pedestalTools.begin(); it != m_pedestalTools.end(); it++ ) if( ( (*it)->initToolHidden(m_params) ).isFailure() ) - m_log << MSG::ERROR << "Unable to initialize Pedestal Tool " << (*it)->name() << endreq; + ATH_MSG_ERROR( "Unable to initialize Pedestal Tool " << (*it)->name() ); // check that we have tools to run the reconstruction ! if( m_buildTools.size() == 0 ) { - m_log << MSG::ERROR << "Didn't find any BuilderTools to do reconstruction !" << endreq; + ATH_MSG_ERROR( "Didn't find any BuilderTools to do reconstruction !" ); return(StatusCode::FAILURE); } if( m_adc2eTools.size() == 0 ) { - m_log << MSG::ERROR << "Didn't find and ADC2ETools to do reconstruction !" << endreq; + ATH_MSG_ERROR( "Didn't find and ADC2ETools to do reconstruction !" ); return(StatusCode::FAILURE); } if( m_pedestalTools.size() == 0 ) { - m_log << MSG::ERROR << "Didn't find and PedestalTools to do reconstruction !" << endreq; + ATH_MSG_ERROR( "Didn't find and PedestalTools to do reconstruction !" ); return(StatusCode::FAILURE); } return StatusCode::SUCCESS; @@ -277,18 +275,16 @@ void LArCellBuilderDriver::ADC2energy(MsgStream* pLog) StatusCode LArCellBuilderDriver::finalize() { - MsgStream m_log(msgSvc(), name()); - - m_log << MSG::INFO << "LArCellBuilderdriver finalize." << endreq; - m_log << MSG::INFO << " Build Tools:" << endreq; + ATH_MSG_INFO( "LArCellBuilderdriver finalize." ); + ATH_MSG_INFO( " Build Tools:" ); for( builderToolVector::iterator it = m_buildTools.begin(); it != m_buildTools.end(); it++ ) (*it)->printSummary(); - m_log << MSG::INFO << " ADC2Energy Tools:" << endreq; + ATH_MSG_INFO( " ADC2Energy Tools:" ); for( adc2eToolVector::iterator it = m_adc2eTools.begin(); it != m_adc2eTools.end(); it++ ) (*it)->printSummary(); - m_log << MSG::INFO << " Pedestal Tools:" << endreq; + ATH_MSG_INFO( " Pedestal Tools:" ); for( pedestalToolVector::iterator it = m_pedestalTools.begin(); it != m_pedestalTools.end(); it++ ) (*it)->printSummary(); diff --git a/LArCalorimeter/LArROD/src/LArDigitThinner.cxx b/LArCalorimeter/LArROD/src/LArDigitThinner.cxx index 9225f2aa9619d968ceaa4463a23461716edef750..0297b71ad61017c6193992aa8ce504ecb4655cf6 100755 --- a/LArCalorimeter/LArROD/src/LArDigitThinner.cxx +++ b/LArCalorimeter/LArROD/src/LArDigitThinner.cxx @@ -65,19 +65,19 @@ StatusCode LArDigitThinner::initialize() { } //Fix up jobOptions if needed: - int m_defaultCuts_barrel[] = { 1000, 1000, 1000, 1000 }; - int m_defaultCuts_endcap[] = { 2000, 2000, 2000, 2000 }; + int defaultCuts_barrel[] = { 1000, 1000, 1000, 1000 }; + int defaultCuts_endcap[] = { 2000, 2000, 2000, 2000 }; if (m_energyCuts_barrel.size() != 4) { msg(MSG::WARNING) << "Only " << m_energyCuts_barrel.size() << " energy cut values provided for the endcap : reverting to default" << endreq; - for (size_t i=0;i<4;++i) m_energyCuts_barrel.push_back(m_defaultCuts_barrel[i]); + for (size_t i=0;i<4;++i) m_energyCuts_barrel.push_back(defaultCuts_barrel[i]); } if (m_energyCuts_endcap.size() != 4) { msg(MSG::WARNING) << "Only " << m_energyCuts_endcap.size() << " energy cut values provided for the endcap : reverting to default" << endreq; - for (size_t i=0;i<4;++i) m_energyCuts_endcap.push_back(m_defaultCuts_endcap[i]); + for (size_t i=0;i<4;++i) m_energyCuts_endcap.push_back(defaultCuts_endcap[i]); } msg(MSG::INFO) << "Energy cuts (Barrel) : "; @@ -109,11 +109,13 @@ void LArDigitThinner::initCutValues() { const Identifier id=(*it); HWIdentifier chid=m_larCablingSvc->createSignalChannelID(id); IdentifierHash onlHash=m_onlineID->channel_Hash(chid); + int sampling = m_caloCellId->sampling(id); + if (sampling < 0) continue; if (m_caloCellId->is_em_barrel(id)) { - m_energyCuts[onlHash]=m_energyCuts_barrel[m_caloCellId->sampling(id)]; + m_energyCuts[onlHash]=m_energyCuts_barrel[sampling]; } else { //endcap - m_energyCuts[onlHash]=m_energyCuts_endcap[m_caloCellId->sampling(id)]; + m_energyCuts[onlHash]=m_energyCuts_endcap[sampling]; continue; } }//end loop over EM cells; diff --git a/LArCalorimeter/LArROD/src/LArRawChannelBuilder.cxx b/LArCalorimeter/LArROD/src/LArRawChannelBuilder.cxx index 14a9a153e69164ad46782283483dcb09e28262f6..756585f7039ecca7bff0c9ca99f4ce68527210a9 100755 --- a/LArCalorimeter/LArROD/src/LArRawChannelBuilder.cxx +++ b/LArCalorimeter/LArROD/src/LArRawChannelBuilder.cxx @@ -22,6 +22,7 @@ using CLHEP::MeV; using CLHEP::megahertz; +using CLHEP::nanosecond; using CLHEP::picosecond; LArRawChannelBuilder::LArRawChannelBuilder (const std::string& name, ISvcLocator* pSvcLocator): @@ -656,7 +657,7 @@ StatusCode LArRawChannelBuilder::execute() else quality=-1; //in case E<Ecut //time*=1000.0; - time=time/picosecond; //Convert time to ps + time=time*(nanosecond/picosecond); //Convert time to ps //Make LArRawChannel Object with new data uint16_t iqual=0; diff --git a/LArCalorimeter/LArROD/src/LArRawChannelBuilderADC2EConstants.cxx b/LArCalorimeter/LArROD/src/LArRawChannelBuilderADC2EConstants.cxx index 258fb6986ca0e98f4033f97c487c4fd74db7c6f1..64296c9515c9e8939c9c4634afa1344fb5f1f3ae 100755 --- a/LArCalorimeter/LArROD/src/LArRawChannelBuilderADC2EConstants.cxx +++ b/LArCalorimeter/LArROD/src/LArRawChannelBuilderADC2EConstants.cxx @@ -19,10 +19,10 @@ LArRawChannelBuilderADC2EConstants::LArRawChannelBuilderADC2EConstants(const std m_fcalId(0), m_hecId(0) { - helper = new LArRawChannelBuilderStatistics( 1, // number of possible errors + m_helper = new LArRawChannelBuilderStatistics( 1, // number of possible errors 0x10); // bit pattern special for this tool, // to be stored in "uint16_t provenance" - helper->setErrorString(0, "no errors"); + m_helper->setErrorString(0, "no errors"); } StatusCode LArRawChannelBuilderADC2EConstants::initTool() @@ -43,59 +43,59 @@ LArRawChannelBuilderADC2EConstants::ADC2E(std::vector<float>& Ramps, MsgStream* Ramps[1]=1; float GainFactor; - if( pParent->curr_gain == CaloGain::LARLOWGAIN ) { + if( m_parent->curr_gain == CaloGain::LARLOWGAIN ) { GainFactor = 9.8*9.8; - } else if (pParent->curr_gain == CaloGain::LARMEDIUMGAIN ) { + } else if (m_parent->curr_gain == CaloGain::LARMEDIUMGAIN ) { GainFactor = 9.8; - } else if (pParent->curr_gain == CaloGain::LARHIGHGAIN ) { + } else if (m_parent->curr_gain == CaloGain::LARHIGHGAIN ) { GainFactor = 1.0; } else { GainFactor = 1.0; if(bool(pLog)) - (*pLog) << MSG::WARNING << "Channel " << std::hex << pParent->curr_chid << std::dec - << "unknown gain: " << pParent->curr_gain << endreq; + (*pLog) << MSG::WARNING << "Channel " << std::hex << m_parent->curr_chid << std::dec + << "unknown gain: " << m_parent->curr_gain << endreq; } Ramps[1]*=GainFactor; Identifier id=currentID(); - float m_ADCtoMeVFCAL[3]; - float m_ADCtoMeVHEC[2]; - float m_ADCtoMeVEMECInner[2]; - float m_ADCtoMeVEMECOuter[2]; - float m_ADCtoMeVEMB[4]; - m_ADCtoMeVFCAL[0] = 87.0 * MeV; // FCAL1 High gain - m_ADCtoMeVFCAL[1] = 117.0 * MeV; // FCAL2 High gain - m_ADCtoMeVFCAL[2] = 193.0 * MeV; // FCAL3 High gain - m_ADCtoMeVHEC[0] = 136.0 / 9.8 * MeV; // HEC 1 Medium gain from Monika. - m_ADCtoMeVHEC[1] = 136.0 / 9.8 * MeV; // HEC 2 Medium gain from Monika. - m_ADCtoMeVEMECInner[0] = 20.0 * MeV; // EMEC High gain : fixed 18/8/2004 RMcP - m_ADCtoMeVEMECInner[1] = 20.0 * MeV; // EMEC High gain : fixed 18/8/2004 RMcP - m_ADCtoMeVEMECOuter[0] = 16.0 * MeV; // EMEC High gain from Monika, approximate - m_ADCtoMeVEMECOuter[1] = 16.0 * MeV; // EMEC High gain from Monika, approximate - m_ADCtoMeVEMB[0] = 7.0 * MeV; // EMB High gain from Isabelle, approximate - m_ADCtoMeVEMB[1] = 2.5 * MeV; // EMB High gain from Isabelle, approximate - m_ADCtoMeVEMB[2] = 18.0 * MeV; // EMB High gain from Isabelle, approximate - m_ADCtoMeVEMB[3] = 9.0 * MeV; // EMB High gain from Isabelle, approximate + float ADCtoMeVFCAL[3]; + float ADCtoMeVHEC[2]; + float ADCtoMeVEMECInner[2]; + float ADCtoMeVEMECOuter[2]; + float ADCtoMeVEMB[4]; + ADCtoMeVFCAL[0] = 87.0 * MeV; // FCAL1 High gain + ADCtoMeVFCAL[1] = 117.0 * MeV; // FCAL2 High gain + ADCtoMeVFCAL[2] = 193.0 * MeV; // FCAL3 High gain + ADCtoMeVHEC[0] = 136.0 / 9.8 * MeV; // HEC 1 Medium gain from Monika. + ADCtoMeVHEC[1] = 136.0 / 9.8 * MeV; // HEC 2 Medium gain from Monika. + ADCtoMeVEMECInner[0] = 20.0 * MeV; // EMEC High gain : fixed 18/8/2004 RMcP + ADCtoMeVEMECInner[1] = 20.0 * MeV; // EMEC High gain : fixed 18/8/2004 RMcP + ADCtoMeVEMECOuter[0] = 16.0 * MeV; // EMEC High gain from Monika, approximate + ADCtoMeVEMECOuter[1] = 16.0 * MeV; // EMEC High gain from Monika, approximate + ADCtoMeVEMB[0] = 7.0 * MeV; // EMB High gain from Isabelle, approximate + ADCtoMeVEMB[1] = 2.5 * MeV; // EMB High gain from Isabelle, approximate + ADCtoMeVEMB[2] = 18.0 * MeV; // EMB High gain from Isabelle, approximate + ADCtoMeVEMB[3] = 9.0 * MeV; // EMB High gain from Isabelle, approximate if (m_emId->is_em_barrel(id)) { const int layer= m_emId->sampling(id); const int eta=m_emId->eta(id); - Ramps[1] *= m_ADCtoMeVEMB[layer]; + Ramps[1] *= ADCtoMeVEMB[layer]; if (layer==2 && eta<32) Ramps[1] *= (12./18.); //Correct for lead thickness } else if (m_emId->is_em_endcap_inner(id)) { - Ramps[1] *= m_ADCtoMeVEMECInner[m_emId->sampling(id)-1]; + Ramps[1] *= ADCtoMeVEMECInner[m_emId->sampling(id)-1]; } else if (m_emId->is_em_endcap_outer(id)) { - Ramps[1] *= m_ADCtoMeVEMECOuter[m_emId->sampling(id)-1]; + Ramps[1] *= ADCtoMeVEMECOuter[m_emId->sampling(id)-1]; } else if (m_fcalId->is_lar_fcal(id)) { - Ramps[1] *= m_ADCtoMeVFCAL[m_fcalId->module(id)-1]; + Ramps[1] *= ADCtoMeVFCAL[m_fcalId->module(id)-1]; } else if (m_hecId->is_lar_hec(id)) { - Ramps[1] *= m_ADCtoMeVHEC[0]; + Ramps[1] *= ADCtoMeVHEC[0]; } // (*pLog) << MSG::VERBOSE << "ADC2EConstants tool - energy : " << energy << endreq; - helper->incrementErrorCount(0); - pParent->qualityBitPattern |= helper->returnBitPattern(); + m_helper->incrementErrorCount(0); + m_parent->qualityBitPattern |= m_helper->returnBitPattern(); return true; } diff --git a/LArCalorimeter/LArROD/src/LArRawChannelBuilderADC2EDataBase.cxx b/LArCalorimeter/LArROD/src/LArRawChannelBuilderADC2EDataBase.cxx index 390994145a90f1315cc7fbdcbfbcec143e9570d6..b3fd853abafb1ef4d638695b7c8b5b6afd6387e7 100755 --- a/LArCalorimeter/LArROD/src/LArRawChannelBuilderADC2EDataBase.cxx +++ b/LArCalorimeter/LArROD/src/LArRawChannelBuilderADC2EDataBase.cxx @@ -20,12 +20,12 @@ LArRawChannelBuilderADC2EDataBase::LArRawChannelBuilderADC2EDataBase(const std:: m_adc2mevTool("LArADC2MeVTool"), m_onlineHelper(0) { - helper = new LArRawChannelBuilderStatistics( 3, // number of possible errors + m_helper = new LArRawChannelBuilderStatistics( 3, // number of possible errors 0x20); // bit pattern special for this tool, // to be stored in "uint16_t provenance" - helper->setErrorString(0, "no errors"); - helper->setErrorString(1, "no DataBase"); - helper->setErrorString(2, "bad Ramps"); + m_helper->setErrorString(0, "no errors"); + m_helper->setErrorString(1, "no DataBase"); + m_helper->setErrorString(2, "bad Ramps"); declareProperty("TestBadRamps", m_testRamps = true); @@ -66,38 +66,38 @@ bool LArRawChannelBuilderADC2EDataBase::ADC2E(std::vector<float>& Ramps, MsgStream* /*pLog*/) { //ADC2MeV (a.k.a. Ramp) - Ramps=m_adc2mevTool->ADC2MEV(pParent->curr_chid,pParent->curr_gain); + Ramps=m_adc2mevTool->ADC2MEV(m_parent->curr_chid,m_parent->curr_gain); //Check ramp coefficents if (Ramps.size()==0) { ATH_MSG_DEBUG("No ADC2MeV data found for channel 0x" << MSG::hex - << pParent->curr_chid.get_compact() << MSG::dec - << " Gain "<< pParent->curr_gain << " Skipping channel."); - helper->incrementErrorCount(1); + << m_parent->curr_chid.get_compact() << MSG::dec + << " Gain "<< m_parent->curr_gain << " Skipping channel."); + m_helper->incrementErrorCount(1); return false; } // temporary fix for bad ramps... should be done in the DB if( m_testRamps && - ((( pParent->curr_gain == CaloGain::LARHIGHGAIN ) && Ramps[1]>m_ramp_max_high) || - (( pParent->curr_gain == CaloGain::LARMEDIUMGAIN ) && Ramps[1]>m_ramp_max_medium) || - (( pParent->curr_gain == CaloGain::LARLOWGAIN ) && Ramps[1]>m_ramp_max_low) || + ((( m_parent->curr_gain == CaloGain::LARHIGHGAIN ) && Ramps[1]>m_ramp_max_high) || + (( m_parent->curr_gain == CaloGain::LARMEDIUMGAIN ) && Ramps[1]>m_ramp_max_medium) || + (( m_parent->curr_gain == CaloGain::LARLOWGAIN ) && Ramps[1]>m_ramp_max_low) || Ramps[1]<0 ) ) { - ATH_MSG_DEBUG("Bad ramp for channel " << pParent->curr_chid + ATH_MSG_DEBUG("Bad ramp for channel " << m_parent->curr_chid << " (Ramps[1] = " << Ramps[1] << "): skip this channel"); - helper->incrementErrorCount(2); + m_helper->incrementErrorCount(2); return false; } //use intercept ? // for HEC treat medium gain as high gains in the others subsystems bool useIntercept_medium = m_useIntercept_medium; - if (m_onlineHelper->isHECchannel(pParent->curr_chid)) useIntercept_medium = m_useIntercept_high; + if (m_onlineHelper->isHECchannel(m_parent->curr_chid)) useIntercept_medium = m_useIntercept_high; - if( !((( pParent->curr_gain == CaloGain::LARHIGHGAIN ) && m_useIntercept_high ) || - (( pParent->curr_gain == CaloGain::LARMEDIUMGAIN ) && useIntercept_medium ) || - (( pParent->curr_gain == CaloGain::LARLOWGAIN ) && m_useIntercept_low )) ) + if( !((( m_parent->curr_gain == CaloGain::LARHIGHGAIN ) && m_useIntercept_high ) || + (( m_parent->curr_gain == CaloGain::LARMEDIUMGAIN ) && useIntercept_medium ) || + (( m_parent->curr_gain == CaloGain::LARLOWGAIN ) && m_useIntercept_low )) ) Ramps[0]=0; /* //otherwise ignore intercept, E=0; @@ -110,13 +110,13 @@ LArRawChannelBuilderADC2EDataBase::ADC2E(std::vector<float>& Ramps, MsgStream* / */ /* energy=Peak; - helper->incrementErrorCount(1); + m_helper->incrementErrorCount(1); return false; */ // (*pLog) << MSG::VERBOSE << "ADC2EDataBase tool - energy : " << energy << endreq; - helper->incrementErrorCount(0); - pParent->qualityBitPattern |= helper->returnBitPattern(); + m_helper->incrementErrorCount(0); + m_parent->qualityBitPattern |= m_helper->returnBitPattern(); return true; } diff --git a/LArCalorimeter/LArROD/src/LArRawChannelBuilderPedestalDataBase.cxx b/LArCalorimeter/LArROD/src/LArRawChannelBuilderPedestalDataBase.cxx index cd137fd5c1256545258765929ed1fd1e157550c2..0486d3c6e36c605ff421a7341a70266a950caed0 100755 --- a/LArCalorimeter/LArROD/src/LArRawChannelBuilderPedestalDataBase.cxx +++ b/LArCalorimeter/LArROD/src/LArRawChannelBuilderPedestalDataBase.cxx @@ -10,12 +10,12 @@ LArRawChannelBuilderPedestalDataBase::LArRawChannelBuilderPedestalDataBase(const const IInterface* parent): LArRawChannelBuilderPedestalToolBase(type,name,parent) { - helper = new LArRawChannelBuilderStatistics( 2, // number of possible errors + m_helper = new LArRawChannelBuilderStatistics( 2, // number of possible errors 0x80); // bit pattern special for this tool, // to be stored in "uint16_t provenance" - helper->setErrorString(0, "no errors"); - helper->setErrorString(1, "no DataBase"); - helper->setErrorString(2, "no DataBase entry"); + m_helper->setErrorString(0, "no errors"); + m_helper->setErrorString(1, "no DataBase"); + m_helper->setErrorString(2, "no DataBase entry"); declareProperty("LArPedestalKey", m_pedestalKey="LArPedestal"); } @@ -24,7 +24,7 @@ StatusCode LArRawChannelBuilderPedestalDataBase::initTool() { if (detStore()->regHandle(m_larPedestal,m_pedestalKey).isFailure()){ msg(MSG::ERROR) << "No pedestals with key <" << m_pedestalKey << "> found in database." << endreq; - helper->incrementErrorCount(1); + m_helper->incrementErrorCount(1); return StatusCode::FAILURE; } return StatusCode::SUCCESS; @@ -40,20 +40,20 @@ bool LArRawChannelBuilderPedestalDataBase::pedestal(float& pedestal, MsgStream* if(bool(pLog)) (*pLog) << MSG::WARNING << "No pedestal found in database." << endreq; - helper->incrementErrorCount(1); + m_helper->incrementErrorCount(1); return false; } float DBpedestal - =m_larPedestal->pedestal(pParent->curr_chid,pParent->curr_gain); + =m_larPedestal->pedestal(m_parent->curr_chid,m_parent->curr_gain); if (DBpedestal <= (1.0+LArElecCalib::ERRORCODE)) { - helper->incrementErrorCount(2); + m_helper->incrementErrorCount(2); return false; } pedestal=DBpedestal; - helper->incrementErrorCount(0); - pParent->qualityBitPattern |= helper->returnBitPattern(); + m_helper->incrementErrorCount(0); + m_parent->qualityBitPattern |= m_helper->returnBitPattern(); return true; } diff --git a/LArCalorimeter/LArROD/src/LArRawChannelBuilderPedestalSampleZero.cxx b/LArCalorimeter/LArROD/src/LArRawChannelBuilderPedestalSampleZero.cxx index f3cc8f595fcb70ad7a8c90bdb0bce3b020911263..aa45ee3b198636a902c74b2dc0d5b2ca27206dc1 100755 --- a/LArCalorimeter/LArROD/src/LArRawChannelBuilderPedestalSampleZero.cxx +++ b/LArCalorimeter/LArROD/src/LArRawChannelBuilderPedestalSampleZero.cxx @@ -10,17 +10,17 @@ LArRawChannelBuilderPedestalSampleZero::LArRawChannelBuilderPedestalSampleZero(c const IInterface* parent): LArRawChannelBuilderPedestalToolBase(type,name,parent) { - helper = new LArRawChannelBuilderStatistics( 1, // number of possible errors + m_helper = new LArRawChannelBuilderStatistics( 1, // number of possible errors 0x40); // bit pattern special for this tool, // to be stored in "uint16_t provenance" - helper->setErrorString(0, "no errors"); + m_helper->setErrorString(0, "no errors"); } bool LArRawChannelBuilderPedestalSampleZero::pedestal(float& pedestal, MsgStream* /* pLog */ ) { - pedestal = pParent->curr_sample0; - helper->incrementErrorCount(0); - pParent->qualityBitPattern |= helper->returnBitPattern(); + pedestal = m_parent->curr_sample0; + m_helper->incrementErrorCount(0); + m_parent->qualityBitPattern |= m_helper->returnBitPattern(); return true; } diff --git a/LArCalorimeter/LArROD/src/LArRawChannelBuilderToolAverage.cxx b/LArCalorimeter/LArROD/src/LArRawChannelBuilderToolAverage.cxx index 6fa324e6179cf08915f00a62c89275eadc12f34c..1688d231bde50c828e32afccb567180e1d38c763 100755 --- a/LArCalorimeter/LArROD/src/LArRawChannelBuilderToolAverage.cxx +++ b/LArCalorimeter/LArROD/src/LArRawChannelBuilderToolAverage.cxx @@ -31,10 +31,10 @@ LArRawChannelBuilderToolAverage::LArRawChannelBuilderToolAverage(const std::stri m_hecId(NULL), m_onlineHelper(NULL) { - helper = new LArRawChannelBuilderStatistics( 1, // number of possible errors + m_helper = new LArRawChannelBuilderStatistics( 1, // number of possible errors 0x01); // bit pattern special for this tool, // to be stored in "uint16_t provenance" - helper->setErrorString(0, "no errors"); + m_helper->setErrorString(0, "no errors"); declareProperty("AverageSamplesEM",m_averageSamplesEM=5); declareProperty("AverageSamplesHEC",m_averageSamplesHEC=5); @@ -55,7 +55,7 @@ StatusCode LArRawChannelBuilderToolAverage::initTool() if (detStore()->retrieve(m_onlineHelper, "LArOnlineID").isFailure()){ - msg(MSG::ERROR) << "Could not get LArOnlineID helper !" << endreq; + msg(MSG::ERROR) << "Could not get LArOnlineID m_helper !" << endreq; return StatusCode::FAILURE; } @@ -67,7 +67,7 @@ bool LArRawChannelBuilderToolAverage::buildRawChannel(const LArDigit* digit, const std::vector<float>& ramps, MsgStream* /* plog */ ) { - HWIdentifier chid = pParent->curr_chid; + HWIdentifier chid = m_parent->curr_chid; //int nMin = 0; unsigned int nAverage = 1; float myScale = 1; @@ -88,19 +88,19 @@ bool LArRawChannelBuilderToolAverage::buildRawChannel(const LArDigit* digit, // look for maximum of all possible windows of size nAverage long sum=0; unsigned nSummedSamples=0; - for( unsigned int i=pParent->curr_shiftTimeSamples; - i<(pParent->curr_shiftTimeSamples+nAverage) && - i<pParent->curr_nsamples; i++,nSummedSamples++ ) + for( unsigned int i=m_parent->curr_shiftTimeSamples; + i<(m_parent->curr_shiftTimeSamples+nAverage) && + i<m_parent->curr_nsamples; i++,nSummedSamples++ ) sum += digit->samples()[i]; long max=sum; - unsigned int maxsample=pParent->curr_shiftTimeSamples; + unsigned int maxsample=m_parent->curr_shiftTimeSamples; - unsigned int nmax = pParent->curr_shiftTimeSamples+1+m_nScan; - if(nmax>pParent->curr_nsamples-nAverage+1) - nmax = pParent->curr_nsamples-nAverage+1 ; + unsigned int nmax = m_parent->curr_shiftTimeSamples+1+m_nScan; + if(nmax>m_parent->curr_nsamples-nAverage+1) + nmax = m_parent->curr_nsamples-nAverage+1 ; - for( unsigned int i=pParent->curr_shiftTimeSamples+1; + for( unsigned int i=m_parent->curr_shiftTimeSamples+1; i<nmax; i++ ) { sum += digit->samples()[i+nAverage-1] - digit->samples()[i-1]; @@ -121,13 +121,13 @@ bool LArRawChannelBuilderToolAverage::buildRawChannel(const LArDigit* digit, } // LArRawChannel has a non-standard unit of pico-second. - int time=int(25.0 * maxsample * nanosecond /picosecond ); + int time=int((25.0 * nanosecond /picosecond) * maxsample ); uint16_t iquality=0; // store which tool created this channel uint16_t iprovenance=0; - iprovenance |= pParent->qualityBitPattern; - iprovenance |= helper->returnBitPattern(); + iprovenance |= m_parent->qualityBitPattern; + iprovenance |= m_helper->returnBitPattern(); iprovenance = iprovenance & 0x3FFF; if (time>MAXINT) time=MAXINT; @@ -139,7 +139,7 @@ bool LArRawChannelBuilderToolAverage::buildRawChannel(const LArDigit* digit, (this->*m_buildIt)((int)(floor(energy+0.5)),time,iquality,iprovenance,digit); - helper->incrementErrorCount(0); + m_helper->incrementErrorCount(0); return true; } diff --git a/LArCalorimeter/LArROD/src/LArRawChannelBuilderToolBadChannelTool.cxx b/LArCalorimeter/LArROD/src/LArRawChannelBuilderToolBadChannelTool.cxx index d15e0823643902a1111caac0f108a95b80788808..916bdee4f82a4c072de66370f1cc90b6bd206a57 100755 --- a/LArCalorimeter/LArROD/src/LArRawChannelBuilderToolBadChannelTool.cxx +++ b/LArCalorimeter/LArROD/src/LArRawChannelBuilderToolBadChannelTool.cxx @@ -14,11 +14,11 @@ LArRawChannelBuilderToolBadChannelTool::LArRawChannelBuilderToolBadChannelTool(c LArRawChannelBuilderToolBase(type,name,parent), m_badChannelMask("BadLArRawChannelMask",this) { - helper = new LArRawChannelBuilderStatistics( 2, // number of possible errors + m_helper = new LArRawChannelBuilderStatistics( 2, // number of possible errors 0x01); // bit pattern special for this tool, // to be stored in "int quality" - helper->setErrorString(0, "no errors"); - helper->setErrorString(1, "known bad channel"); + m_helper->setErrorString(0, "no errors"); + m_helper->setErrorString(1, "known bad channel"); declareProperty("BadChannelMask",m_badChannelMask); } @@ -42,15 +42,15 @@ bool LArRawChannelBuilderToolBadChannelTool::buildRawChannel(const LArDigit* /*d MsgStream* /* pLog */ ) { // zero means channel ok - const HWIdentifier chid=pParent->curr_chid; - const CaloGain::CaloGain gain=pParent->curr_gain; + const HWIdentifier chid=m_parent->curr_chid; + const CaloGain::CaloGain gain=m_parent->curr_gain; if (m_badChannelMask->cellShouldBeMasked(chid,gain)) { // inverse logic, true means building went ok. - helper->incrementErrorCount(1); + m_helper->incrementErrorCount(1); return true; } - helper->incrementErrorCount(0); + m_helper->incrementErrorCount(0); return false; } diff --git a/LArCalorimeter/LArROD/src/LArRawChannelBuilderToolBaseClass.cxx b/LArCalorimeter/LArROD/src/LArRawChannelBuilderToolBaseClass.cxx index c2f5481070a74d30e5cccdcfcb44c49022335b91..574d9f3ffd6ca5a42d9e18dc4e9d1acbf643e0ae 100755 --- a/LArCalorimeter/LArROD/src/LArRawChannelBuilderToolBaseClass.cxx +++ b/LArCalorimeter/LArROD/src/LArRawChannelBuilderToolBaseClass.cxx @@ -18,8 +18,8 @@ LArRawChannelBuilderToolBaseClass::LArRawChannelBuilderToolBaseClass(const std:: const std::string& name, const IInterface* parent): AthAlgTool(type,name,parent), - pParent(NULL), - helper(NULL), + m_parent(NULL), + m_helper(NULL), m_detStore(NULL), m_larCablingSvc(0) ,m_isSC(false) @@ -28,7 +28,7 @@ declareProperty("IsSuperCell", m_isSC = false); } LArRawChannelBuilderToolBaseClass::~LArRawChannelBuilderToolBaseClass() { - delete helper; + delete m_helper; } void @@ -36,8 +36,8 @@ LArRawChannelBuilderToolBaseClass::printSummary() { MsgStream log(msgSvc(), name()); ulonglong sum=0; - for( unsigned int i=0; i<helper->returnMaxErrors(); i++ ) - sum+=helper->returnErrorCount(i); + for( unsigned int i=0; i<m_helper->returnMaxErrors(); i++ ) + sum+=m_helper->returnErrorCount(i); log << MSG::INFO << "Printing Summary for tool " << name() << " :" << endreq; log << MSG::INFO @@ -47,26 +47,27 @@ LArRawChannelBuilderToolBaseClass::printSummary() << std::setw(12) << " per event " << std::setw(12) << " RMS " << endreq; - - for( unsigned int i=0; i<helper->returnMaxErrors(); i++ ) + + double inv_sum = sum > 0 ? 1./sum : 1; + for( unsigned int i=0; i<m_helper->returnMaxErrors(); i++ ) { double fraction = 0.0; double perEvent = 0.0; double rmsPerEv = 0.0; if(sum>0) - fraction=100 * double(helper->returnErrorCount(i)) / double(sum); - if(helper->returnEvents()>0) + fraction=100 * double(m_helper->returnErrorCount(i)) * inv_sum; + if(m_helper->returnEvents()>0) { - perEvent = double(helper->returnErrorCountPerEvent(i)) / double(helper->returnEvents()); - rmsPerEv = double(helper->returnErrorCountSqPerEvent(i)) / double(helper->returnEvents()); + perEvent = double(m_helper->returnErrorCountPerEvent(i)) / double(m_helper->returnEvents()); + rmsPerEv = double(m_helper->returnErrorCountSqPerEvent(i)) / double(m_helper->returnEvents()); rmsPerEv = sqrt(std::max(0.,rmsPerEv-perEvent*perEvent)); } log << MSG::INFO << std::setw(40) - << helper->returnErrorString(i) << " : " + << m_helper->returnErrorString(i) << " : " << std::setw(12) - << helper->returnErrorCount(i) + << m_helper->returnErrorCount(i) << std::setw(10) << std::fixed << std::setprecision(4) @@ -87,27 +88,27 @@ LArRawChannelBuilderToolBaseClass::printSummary() void LArRawChannelBuilderToolBaseClass::finalEventHidden() { - helper->resetErrorcountPerEvent(); + m_helper->resetErrorcountPerEvent(); finalEvent(); } Identifier LArRawChannelBuilderToolBaseClass::currentID( void ) { - if(pParent->curr_id==0) + if(m_parent->curr_id==0) { try { - pParent->curr_id = m_larCablingSvc->cnvToIdentifier(pParent->curr_chid); + m_parent->curr_id = m_larCablingSvc->cnvToIdentifier(m_parent->curr_chid); } catch ( LArID_Exception & except ) { MsgStream log(msgSvc(), name()); log << MSG::INFO << "A larCablingSvc exception was caught for channel 0x!" - << MSG::hex << pParent->curr_chid.get_compact() << MSG::dec << endreq; + << MSG::hex << m_parent->curr_chid.get_compact() << MSG::dec << endreq; // log << MSG::INFO<<m_onlineHelper->print_to_string(curr_chid)<<endreq; - pParent->curr_id=0; + m_parent->curr_id=0; } } - return pParent->curr_id; + return m_parent->curr_id; } diff --git a/LArCalorimeter/LArROD/src/LArRawChannelBuilderToolCubic.cxx b/LArCalorimeter/LArROD/src/LArRawChannelBuilderToolCubic.cxx index 5fe7ec14c642dedcb8c3c74cfefe4efc604ad1d3..82cdaea2d1879e853c4aac7e75f2c89015cd7e53 100755 --- a/LArCalorimeter/LArROD/src/LArRawChannelBuilderToolCubic.cxx +++ b/LArCalorimeter/LArROD/src/LArRawChannelBuilderToolCubic.cxx @@ -27,12 +27,12 @@ LArRawChannelBuilderToolCubic::LArRawChannelBuilderToolCubic(const std::string& LArRawChannelBuilderToolBase(type,name,parent), m_fcalId(NULL) { - helper = new LArRawChannelBuilderStatistics( 3, // number of possible errors + m_helper = new LArRawChannelBuilderStatistics( 3, // number of possible errors 0x04); // bit pattern special for this tool, // to be stored in "uint16_t provenance" - helper->setErrorString(0, "no errors"); - helper->setErrorString(1, "Fit failed"); - helper->setErrorString(2, "is FCAL"); + m_helper->setErrorString(0, "no errors"); + m_helper->setErrorString(1, "Fit failed"); + m_helper->setErrorString(2, "is FCAL"); declareProperty("UseMaxSample", m_useMaxSample = false); declareProperty("minADCforCubic", m_minADC=30); @@ -59,11 +59,11 @@ bool LArRawChannelBuilderToolCubic::buildRawChannel(const LArDigit* digit, float time=0; // use fixed sample - unsigned int maxSample = pParent->curr_shiftTimeSamples+2 ; + unsigned int maxSample = m_parent->curr_shiftTimeSamples+2 ; // use max Sample if(m_useMaxSample) - maxSample = pParent->curr_maxsample ; + maxSample = m_parent->curr_maxsample ; if( maxSample>= digit->samples().size() ) @@ -91,10 +91,10 @@ bool LArRawChannelBuilderToolCubic::buildRawChannel(const LArDigit* digit, if ( (maxSample) <= 1 ) { it0 = 1; - } else if ( (maxSample) >= (pParent->curr_nsamples) ) + } else if ( (maxSample) >= (m_parent->curr_nsamples) ) { // peak is late - it0 = (pParent->curr_nsamples) - 3; + it0 = (m_parent->curr_nsamples) - 3; } else { // peak in safe region it0 = (maxSample) - 1; @@ -132,9 +132,9 @@ bool LArRawChannelBuilderToolCubic::buildRawChannel(const LArDigit* digit, if ( (maxSample) <= 1 ) { it0 = 1; - } else if ( (maxSample) >= (pParent->curr_nsamples) - 2 ) + } else if ( (maxSample) >= (m_parent->curr_nsamples) - 2 ) { // peak is late - it0 = (pParent->curr_nsamples) - 4; + it0 = (m_parent->curr_nsamples) - 4; } else { // peak in safe region it0 = ( digit->samples()[(maxSample)-2] > digit->samples()[(maxSample)+2] ) ? (maxSample) - 2 @@ -153,9 +153,9 @@ bool LArRawChannelBuilderToolCubic::buildRawChannel(const LArDigit* digit, // fit parameters disc = A[2]*A[2] - 3*A[1]*A[3]; if ( ! ( CubicFailed = ( disc < 0 || A[3] == 0 ) ) ) { - dtmax = (-A[2]-sqrt(disc))/3/A[3]; + dtmax = (-A[2]-sqrt(disc))/(A[3]*3); if ( ! ( CubicFailed = ( dtmax < 0 || dtmax > 3 ) ) ) { - time = (float(it0) + dtmax) * 25.0 * nanosecond/picosecond; // nsec + time = (float(it0) + dtmax) * (25.0 * nanosecond/picosecond); // nsec for(int ia = 0; ia < 4; ia++) ADCPeak += A[ia] * pow(dtmax, ia); } @@ -163,7 +163,7 @@ bool LArRawChannelBuilderToolCubic::buildRawChannel(const LArDigit* digit, if(CubicFailed) { - helper->incrementErrorCount(1); + m_helper->incrementErrorCount(1); return false; } } @@ -180,8 +180,8 @@ bool LArRawChannelBuilderToolCubic::buildRawChannel(const LArDigit* digit, uint16_t iquality=0; uint16_t iprovenance=0; - iprovenance |= pParent->qualityBitPattern; - iprovenance |= helper->returnBitPattern(); + iprovenance |= m_parent->qualityBitPattern; + iprovenance |= m_helper->returnBitPattern(); iprovenance = iprovenance & 0x3FFF; if (time>MAXINT) time=MAXINT; @@ -192,7 +192,7 @@ bool LArRawChannelBuilderToolCubic::buildRawChannel(const LArDigit* digit, (this->*m_buildIt)((int)(floor(energy+0.5)),(int)floor(time+0.5),iquality,iprovenance,digit); - helper->incrementErrorCount(0); + m_helper->incrementErrorCount(0); return true; } diff --git a/LArCalorimeter/LArROD/src/LArRawChannelBuilderToolOFC.cxx b/LArCalorimeter/LArROD/src/LArRawChannelBuilderToolOFC.cxx index 52ba1d9dc51579a7ff87d54d806e53b9f2d54e56..7f5273d6900aef662c91d48d1793e510ac0e735d 100755 --- a/LArCalorimeter/LArROD/src/LArRawChannelBuilderToolOFC.cxx +++ b/LArCalorimeter/LArROD/src/LArRawChannelBuilderToolOFC.cxx @@ -13,6 +13,7 @@ #include "CLHEP/Units/SystemOfUnits.h" #include <math.h> +using CLHEP::nanosecond; using CLHEP::picosecond; #define MAXINT 2147483000 @@ -28,12 +29,12 @@ LArRawChannelBuilderToolOFC::LArRawChannelBuilderToolOFC(const std::string& type m_shapeMode(0), m_keyShape("LArShape") { - helper = new LArRawChannelBuilderStatistics( 3, // number of possible errors + m_helper = new LArRawChannelBuilderStatistics( 3, // number of possible errors 0x05); // bit pattern special for this tool, // to be stored in "uint16_t provenance" - helper->setErrorString(0, "no errors"); - helper->setErrorString(1, "channel saturated"); - helper->setErrorString(2, "OFC size zero"); + m_helper->setErrorString(0, "no errors"); + m_helper->setErrorString(1, "channel saturated"); + m_helper->setErrorString(2, "OFC size zero"); declareProperty("ADCMax", m_AdcMax=4095); declareProperty("Skip", m_skipSaturatedCells=true); @@ -65,12 +66,12 @@ bool LArRawChannelBuilderToolOFC::buildRawChannel(const LArDigit* digit, const std::vector<float>& ramps, MsgStream* pLog) { - HWIdentifier chid=pParent->curr_chid; + HWIdentifier chid=m_parent->curr_chid; if(bool(pLog)) (*pLog) << MSG::DEBUG << "Start " <<MSG::hex<< chid<<MSG::dec<< endreq; - CaloGain::CaloGain gain=pParent->curr_gain; + CaloGain::CaloGain gain=m_parent->curr_gain; - if ( pParent->curr_maximum > m_AdcMax ) + if ( m_parent->curr_maximum > m_AdcMax ) { if(bool(pLog)) (*pLog) << MSG::DEBUG << "Saturation on channel 0x" @@ -79,7 +80,7 @@ bool LArRawChannelBuilderToolOFC::buildRawChannel(const LArDigit* digit, { if(bool(pLog)) (*pLog) << "Skipping channel." << endreq; - helper->incrementErrorCount(1); + m_helper->incrementErrorCount(1); return false; } if(bool(pLog)) @@ -101,7 +102,7 @@ bool LArRawChannelBuilderToolOFC::buildRawChannel(const LArDigit* digit, << MSG::hex << chid.get_compact() << MSG::dec << " Time bin = " << OFCTimeBin << ", Gain = " << gain << ". Skipping channel." << endreq; - helper->incrementErrorCount(2); + m_helper->incrementErrorCount(2); return false; } @@ -110,7 +111,7 @@ bool LArRawChannelBuilderToolOFC::buildRawChannel(const LArDigit* digit, //Now apply Optimal Filtering to get ADC peak float ADCPeak=0; for (unsigned i=0;i<(ofc_a->size());i++) { - ADCPeak+=(digit->samples()[i+pParent->curr_shiftTimeSamples]- + ADCPeak+=(digit->samples()[i+m_parent->curr_shiftTimeSamples]- pedestal)*ofc_a->at(i); if(bool(pLog)) (*pLog) << MSG::DEBUG << "OFC i, a= " <<i<<" "<< ofc_a->at(i) << endreq; @@ -147,7 +148,7 @@ bool LArRawChannelBuilderToolOFC::buildRawChannel(const LArDigit* digit, } }else{ for (unsigned i=0;i<(ofc_b->size());i++) - time+=(digit->samples()[i+pParent->curr_shiftTimeSamples]-pedestal) + time+=(digit->samples()[i+m_parent->curr_shiftTimeSamples]-pedestal) *ofc_b->at(i); time/=ADCPeak; } @@ -199,18 +200,18 @@ bool LArRawChannelBuilderToolOFC::buildRawChannel(const LArDigit* digit, { //Calculate Q without time info for (unsigned i=0;i<(ofc_a->size());i++) - quality+=((digit->samples()[i+pParent->curr_shiftTimeSamples]- + quality+=((digit->samples()[i+m_parent->curr_shiftTimeSamples]- pedestal)-shape[i]*ADCPeak)* - ((digit->samples()[i+pParent->curr_shiftTimeSamples]- + ((digit->samples()[i+m_parent->curr_shiftTimeSamples]- pedestal)-shape[i]*ADCPeak); } else { //All input data ok, calculate Q with time info for (unsigned i=0;i<(ofc_a->size());i++) quality+= - ((digit->samples()[i+pParent->curr_shiftTimeSamples]- + ((digit->samples()[i+m_parent->curr_shiftTimeSamples]- pedestal)- ((shape[i]-shapeDer[i]*time)*ADCPeak))* - ((digit->samples()[i+pParent->curr_shiftTimeSamples]- + ((digit->samples()[i+m_parent->curr_shiftTimeSamples]- pedestal)- ((shape[i]-shapeDer[i]*time)*ADCPeak)); } @@ -231,11 +232,11 @@ bool LArRawChannelBuilderToolOFC::buildRawChannel(const LArDigit* digit, iprovenance = iprovenance | 0x2000; } - iprovenance |= pParent->qualityBitPattern; - iprovenance |= helper->returnBitPattern(); + iprovenance |= m_parent->qualityBitPattern; + iprovenance |= m_helper->returnBitPattern(); iprovenance = iprovenance & 0x3FFF; - time=time/picosecond; //Convert time to ps + time=time*(nanosecond/picosecond); //Convert time to ps if (time>MAXINT) time=MAXINT; if (time<MAXINT2) time=MAXINT2; @@ -244,7 +245,7 @@ bool LArRawChannelBuilderToolOFC::buildRawChannel(const LArDigit* digit, if (energy<MAXINT2) energy=MAXINT2; (this->*m_buildIt)((int)(floor(energy+0.5)),(int)floor(time+0.5),iquality,iprovenance,digit); - helper->incrementErrorCount(0); + m_helper->incrementErrorCount(0); return true; } @@ -253,7 +254,7 @@ const std::vector<float>& LArRawChannelBuilderToolOFC::OFC_a() { m_OFCtmp.clear(); - m_OFCtmp = m_OFCTool->OFC_a(pParent->curr_chid,pParent->curr_gain).asVector(); + m_OFCtmp = m_OFCTool->OFC_a(m_parent->curr_chid,m_parent->curr_gain).asVector(); return m_OFCtmp; } @@ -261,7 +262,7 @@ const std::vector<float>& LArRawChannelBuilderToolOFC::OFC_b() { m_OFCtmp.clear(); - m_OFCtmp = m_OFCTool->OFC_b(pParent->curr_chid,pParent->curr_gain).asVector(); + m_OFCtmp = m_OFCTool->OFC_b(m_parent->curr_chid,m_parent->curr_gain).asVector(); return m_OFCtmp; } diff --git a/LArCalorimeter/LArROD/src/LArRawChannelBuilderToolOFCIter.cxx b/LArCalorimeter/LArROD/src/LArRawChannelBuilderToolOFCIter.cxx index fdf566b4b026d7a8c3ec2251d602f1baafa415cd..fbb6cfd47d58fa30232e79dfd9ce5d2e1671a5c9 100755 --- a/LArCalorimeter/LArROD/src/LArRawChannelBuilderToolOFCIter.cxx +++ b/LArCalorimeter/LArROD/src/LArRawChannelBuilderToolOFCIter.cxx @@ -23,6 +23,7 @@ #include <math.h> using CLHEP::ns; +using CLHEP::nanosecond; using CLHEP::picosecond; #define MAXINT 2147483000 @@ -35,12 +36,12 @@ LArRawChannelBuilderToolOFCIter::LArRawChannelBuilderToolOFCIter(const std::stri m_larOFIterCont(NULL), m_storeGate("StoreGateSvc", name), m_peakReco("LArOFPeakRecoTool") { - helper = new LArRawChannelBuilderStatistics( 3, // number of possible errors + m_helper = new LArRawChannelBuilderStatistics( 3, // number of possible errors 0x05); // bit pattern special for this tool, // to be stored in "uint16_t provenance" - helper->setErrorString(0, "no errors"); - helper->setErrorString(1, "channel saturated"); - helper->setErrorString(2, "OFC not valid"); + m_helper->setErrorString(0, "no errors"); + m_helper->setErrorString(1, "channel saturated"); + m_helper->setErrorString(2, "OFC not valid"); declareProperty("ADCMax", m_AdcMax=4095); declareProperty("Skip", m_skipSaturatedCells=false); @@ -131,8 +132,8 @@ bool LArRawChannelBuilderToolOFCIter::buildRawChannel(const LArDigit* digit, const std::vector<float>& ramps, MsgStream* pLog ) { - const HWIdentifier chid=pParent->curr_chid; - const CaloGain::CaloGain gain=pParent->curr_gain; + const HWIdentifier chid=m_parent->curr_chid; + const CaloGain::CaloGain gain=m_parent->curr_gain; uint16_t iprovenance=0; @@ -160,7 +161,7 @@ bool LArRawChannelBuilderToolOFCIter::buildRawChannel(const LArDigit* digit, << " ADC=" << samples[ii]; if ( m_skipSaturatedCells ) { if(debugPrint) (*pLog) << " Skipping channel." << endreq; - helper->incrementErrorCount(1); + m_helper->incrementErrorCount(1); return false; } else @@ -200,7 +201,7 @@ bool LArRawChannelBuilderToolOFCIter::buildRawChannel(const LArDigit* digit, if (!doIter) {//No iteration, insufficient signal nIteration=1; - ipeak = pParent->curr_shiftTimeSamples + 2 ; + ipeak = m_parent->curr_shiftTimeSamples + 2 ; } @@ -229,7 +230,7 @@ bool LArRawChannelBuilderToolOFCIter::buildRawChannel(const LArDigit* digit, // this should be ~0 if the peak is at curr_shiftTimeSamples // FIXME: this time definition still misses the tstart from the OFC to be absolutely computed - time = (25.*((int)(results.getPeakSample_final())-2-pParent->curr_shiftTimeSamples)-(results.getDelay_final()-results.getTau())); + time = (25.*((int)(results.getPeakSample_final())-2-m_parent->curr_shiftTimeSamples)-(results.getDelay_final()-results.getTau())); //log << MSG::DEBUG << "Peak and time properly retrieved with OFPeakRecoTool:"; //log << MSG::DEBUG << "ADCPeak = " << ADCPeak <<", time = "<< time << endreq; } @@ -237,7 +238,7 @@ bool LArRawChannelBuilderToolOFCIter::buildRawChannel(const LArDigit* digit, // log << MSG::DEBUG << ". OFC iteration not valid for channel 0x" // << MSG::hex << chid.get_compact() << MSG::dec // << " Gain = " << gain << ". Skipping channel." << endreq; - helper->incrementErrorCount(2); + m_helper->incrementErrorCount(2); return false; } @@ -267,13 +268,13 @@ bool LArRawChannelBuilderToolOFCIter::buildRawChannel(const LArDigit* digit, //Reminder: Bit-pattern //ppcc bbbb sqqq qqqq qqqq - iprovenance |= (pParent->qualityBitPattern & 0x00FF); - iprovenance |= (helper->returnBitPattern() & 0x00FF); + iprovenance |= (m_parent->qualityBitPattern & 0x00FF); + iprovenance |= (m_helper->returnBitPattern() & 0x00FF); if (results.getConverged()) iprovenance |= 0x0100; iprovenance = iprovenance & 0x3FFF; - time=time/picosecond; //Convert time to ps + time=time*(nanosecond/picosecond); //Convert time to ps if (time>MAXINT) time=MAXINT; if (time<MAXINT2) time=MAXINT2; @@ -285,7 +286,7 @@ bool LArRawChannelBuilderToolOFCIter::buildRawChannel(const LArDigit* digit, (this->*m_buildIt)((int)(floor(energy+0.5)),(int)floor(time+0.5),iquality,iprovenance,digit); - helper->incrementErrorCount(0); + m_helper->incrementErrorCount(0); return true; diff --git a/LArCalorimeter/LArROD/src/LArRawChannelBuilderToolParabola.cxx b/LArCalorimeter/LArROD/src/LArRawChannelBuilderToolParabola.cxx index 0aa4e40111d502df6ea0779d644eebc18fa808a4..6aaabf354be6ddcd3fa2650f1f56a63bead1bd9b 100755 --- a/LArCalorimeter/LArROD/src/LArRawChannelBuilderToolParabola.cxx +++ b/LArCalorimeter/LArROD/src/LArRawChannelBuilderToolParabola.cxx @@ -24,12 +24,12 @@ LArRawChannelBuilderToolParabola::LArRawChannelBuilderToolParabola(const std::st m_parabolaRecoTool("LArOFPeakRecoTool"), m_emId(NULL) { - helper = new LArRawChannelBuilderStatistics( 3, // number of possible errors + m_helper = new LArRawChannelBuilderStatistics( 3, // number of possible errors 0x03); // bit pattern special for this tool, // to be stored in "uint16_t provenance" - helper->setErrorString(0, "no errors"); - helper->setErrorString(1, "Fit failed"); - helper->setErrorString(2, "is FCAL"); + m_helper->setErrorString(0, "no errors"); + m_helper->setErrorString(1, "Fit failed"); + m_helper->setErrorString(2, "is FCAL"); } StatusCode LArRawChannelBuilderToolParabola::initTool() @@ -79,8 +79,8 @@ bool LArRawChannelBuilderToolParabola::buildRawChannel(const LArDigit* digit, time = int(peak[2]); // store which tool created this channel - iprovenance |= pParent->qualityBitPattern; - iprovenance |= helper->returnBitPattern(); + iprovenance |= m_parent->qualityBitPattern; + iprovenance |= m_helper->returnBitPattern(); iprovenance = iprovenance & 0x3FFF; if (time>MAXINT) time=MAXINT; @@ -92,7 +92,7 @@ bool LArRawChannelBuilderToolParabola::buildRawChannel(const LArDigit* digit, (this->*m_buildIt)((int)(floor(energy+0.5)),time,iquality,iprovenance,digit); - helper->incrementErrorCount(0); + m_helper->incrementErrorCount(0); return true; } diff --git a/LArCalorimeter/LArROD/src/LArRawChannelBuilderToolTileInfo.cxx b/LArCalorimeter/LArROD/src/LArRawChannelBuilderToolTileInfo.cxx index 5ec5456c8fb76f7b28d160df21dd9acaa4c2640c..6f5795179c5f550f255ffa8d2f8e76b51d017ab2 100755 --- a/LArCalorimeter/LArROD/src/LArRawChannelBuilderToolTileInfo.cxx +++ b/LArCalorimeter/LArROD/src/LArRawChannelBuilderToolTileInfo.cxx @@ -24,6 +24,7 @@ using CLHEP::Hep3Vector; using CLHEP::c_light; +using CLHEP::nanosecond; using CLHEP::picosecond; #define MAXINT 2147483000 @@ -40,12 +41,12 @@ LArRawChannelBuilderToolTileInfo::LArRawChannelBuilderToolTileInfo(const std::st m_peakReco("LArOFPeakRecoTool"), m_delayTile(0) { - helper = new LArRawChannelBuilderStatistics( 3, // number of possible errors + m_helper = new LArRawChannelBuilderStatistics( 3, // number of possible errors 0x06); // bit pattern special for this tool, // to be stored in "uint16_t provenance" - helper->setErrorString(0, "no errors"); - helper->setErrorString(1, "channel saturated"); - helper->setErrorString(2, "OFC not valid"); + m_helper->setErrorString(0, "no errors"); + m_helper->setErrorString(1, "channel saturated"); + m_helper->setErrorString(2, "OFC not valid"); declareProperty("ComTimeKey",m_comTimeKey="ComTimeTileMuon"); declareProperty("GlobalTimeOffsetTop", m_globaltimeoffsettop=-23.7); @@ -104,12 +105,12 @@ bool LArRawChannelBuilderToolTileInfo::buildRawChannel(const LArDigit* digit, MsgStream* pLog) { - HWIdentifier chid=pParent->curr_chid; + HWIdentifier chid=m_parent->curr_chid; if(bool(pLog)) (*pLog) << MSG::DEBUG << "Start " <<MSG::hex<< chid<<MSG::dec<< endreq; - CaloGain::CaloGain gain=pParent->curr_gain; + CaloGain::CaloGain gain=m_parent->curr_gain; - if ( pParent->curr_maximum > m_AdcMax ) + if ( m_parent->curr_maximum > m_AdcMax ) { if(bool(pLog)) (*pLog) << MSG::DEBUG << "Saturation on channel 0x" @@ -118,7 +119,7 @@ bool LArRawChannelBuilderToolTileInfo::buildRawChannel(const LArDigit* digit, { if(bool(pLog)) (*pLog) << "Skipping channel." << endreq; - helper->incrementErrorCount(1); + m_helper->incrementErrorCount(1); return false; } if(bool(pLog)) @@ -127,23 +128,23 @@ bool LArRawChannelBuilderToolTileInfo::buildRawChannel(const LArDigit* digit, const std::vector < short >& samples = digit->samples(); unsigned int sampsize = (unsigned int) samples.size(); - float peakval = -999.; + //float peakval = -999.; unsigned int ipeak = 0; std::vector<float> signal ; float currval = 0.; for (unsigned int ii = 0; ii < sampsize; ii++) { currval = (float)(samples[ii] - pedestal); signal.push_back(currval); - if ((ii >= m_minSample)&&(ii <= m_maxSample)&&(currval > peakval)) { ipeak = ii; peakval = currval; } + //if ((ii >= m_minSample)&&(ii <= m_maxSample)&&(currval > peakval)) { ipeak = ii; peakval = currval; } } - ipeak = pParent->curr_shiftTimeSamples + 2; - pParent->curr_Phase = m_defaultPhase; + ipeak = m_parent->curr_shiftTimeSamples + 2; + m_parent->curr_Phase = m_defaultPhase; double globaltimeoffset = -25; //Retrieve TileMuonFitter ComTime object - const ComTime* m_comTime; - StatusCode sc = m_storeGate->retrieve(m_comTime, m_comTimeKey); + const ComTime* comTime; + StatusCode sc = m_storeGate->retrieve(comTime, m_comTimeKey); if (sc.isFailure()) { if(bool(pLog)) @@ -157,9 +158,9 @@ bool LArRawChannelBuilderToolTileInfo::buildRawChannel(const LArDigit* digit, Identifier id=currentID(); const CaloDetDescrElement* caloDDE = m_man->get_element(id); - double tileComTime = m_comTime->getTime(); - Hep3Vector muonpos = m_comTime->GetCounterPosition(); - Hep3Vector muondir = m_comTime->GetcosThetaDirection(); + double tileComTime = comTime->getTime(); + Hep3Vector muonpos = comTime->GetCounterPosition(); + Hep3Vector muondir = comTime->GetcosThetaDirection(); if(tileComTime!=0 || muonpos.x()!=0 || muonpos.z()!=0) { @@ -172,9 +173,10 @@ bool LArRawChannelBuilderToolTileInfo::buildRawChannel(const LArDigit* digit, double xpos=caloDDE->x(); double ypos=caloDDE->y(); double zpos=caloDDE->z(); - - timeTOF = (sqrt((muonpos.x()-xpos)*(muonpos.x()-xpos) + (muonpos.y()-ypos)*(muonpos.y()-ypos) + (muonpos.z()-zpos)*(muonpos.z()-zpos)))/c_light; - IPTOF = (sqrt(xpos*xpos+ypos*ypos+zpos*zpos))/c_light; + + const double inv_c_light = 1. / c_light; + timeTOF = (sqrt((muonpos.x()-xpos)*(muonpos.x()-xpos) + (muonpos.y()-ypos)*(muonpos.y()-ypos) + (muonpos.z()-zpos)*(muonpos.z()-zpos))) * inv_c_light; + IPTOF = (sqrt(xpos*xpos+ypos*ypos+zpos*zpos)) * inv_c_light; IPTOF = (-1)*IPTOF; if (ypos>0) {//top @@ -195,7 +197,7 @@ bool LArRawChannelBuilderToolTileInfo::buildRawChannel(const LArDigit* digit, // adapt to current OFC timing, such that delay is between 0 ns and 25 ns // assumes that larTimeOffset = 0 corresponds to peak exactly at the third sample (ipeak==2 and delay=0 ns) // (delay = 25 means that the peak is 1 sample before the sample used to center OFC) - double peakSampleTile = int( (larTimeOffset/25.) + 2.); + double peakSampleTile = int( (larTimeOffset*(1./25.)) + 2.); m_delayTile = 25.*(peakSampleTile-2) - larTimeOffset; // the following logic is suited to the regular case where OFC phases are between 0 and 25 ns // for dedicated OFC sets where phase<0 are produced this is not optimal @@ -204,10 +206,10 @@ bool LArRawChannelBuilderToolTileInfo::buildRawChannel(const LArDigit* digit, m_delayTile += 25.; } - pParent->curr_shiftTimeSamples = peakSampleTile; - pParent->curr_Phase = static_cast<int> (m_delayTile); + m_parent->curr_shiftTimeSamples = peakSampleTile; + m_parent->curr_Phase = static_cast<int> (m_delayTile); } - ipeak = pParent->curr_shiftTimeSamples; + ipeak = m_parent->curr_shiftTimeSamples; } @@ -238,7 +240,7 @@ bool LArRawChannelBuilderToolTileInfo::buildRawChannel(const LArDigit* digit, (*pLog) << MSG::DEBUG << ". OFC not valid for channel 0x" << MSG::hex << chid.get_compact() << MSG::dec << " Gain = " << gain << ". Skipping channel." << endreq; - helper->incrementErrorCount(2); + m_helper->incrementErrorCount(2); return false; } @@ -260,11 +262,11 @@ bool LArRawChannelBuilderToolTileInfo::buildRawChannel(const LArDigit* digit, iprovenance = iprovenance | 0x2000; } - iprovenance |= pParent->qualityBitPattern; - iprovenance |= helper->returnBitPattern(); + iprovenance |= m_parent->qualityBitPattern; + iprovenance |= m_helper->returnBitPattern(); iprovenance = iprovenance & 0x3FFF; - time=time/picosecond; //Convert time to ps + time=time*(nanosecond/picosecond); //Convert time to ps if (time>MAXINT) time=MAXINT; if (time<MAXINT2) time=MAXINT2; @@ -279,7 +281,7 @@ bool LArRawChannelBuilderToolTileInfo::buildRawChannel(const LArDigit* digit, iquality,iprovenance,digit->gain()); m_larRawChannelContainer->add(larRawChannel); - helper->incrementErrorCount(0); + m_helper->incrementErrorCount(0); return true; } diff --git a/LArCalorimeter/LArROD/src/LArRawChannelSimpleBuilder.cxx b/LArCalorimeter/LArROD/src/LArRawChannelSimpleBuilder.cxx index 34a005330886bda6a60b96a4d1e161ebbbe30630..70a70f5e9f91b398780e1b3bb09915e77176bc82 100755 --- a/LArCalorimeter/LArROD/src/LArRawChannelSimpleBuilder.cxx +++ b/LArCalorimeter/LArROD/src/LArRawChannelSimpleBuilder.cxx @@ -467,7 +467,7 @@ StatusCode LArRawChannelSimpleBuilder::execute() { // fit parameters disc = A[2]*A[2] - 3*A[1]*A[3]; if ( ! ( CubicFailed = ( disc < 0 || A[3] == 0 ) ) ) { - dtmax = (-A[2]-sqrt(disc))/3/A[3]; + dtmax = (-A[2]-sqrt(disc))/(A[3]*3); if ( ! ( CubicFailed = ( dtmax < 0 || dtmax > 3 ) ) ) { time = (float(it0) + dtmax) * 25.0 * nanosecond; // nsec for(int ia = 0; ia < 4; ia++) diff --git a/LArCalorimeter/LArROD/src/LArSuperCellBuilderDriver.cxx b/LArCalorimeter/LArROD/src/LArSuperCellBuilderDriver.cxx index eb5686f04ba0cda7d51076f18c321a229eb7b80a..68ab7ace2a8afb736b998b7d1ae6cd88dd5bc5bc 100755 --- a/LArCalorimeter/LArROD/src/LArSuperCellBuilderDriver.cxx +++ b/LArCalorimeter/LArROD/src/LArSuperCellBuilderDriver.cxx @@ -14,7 +14,7 @@ #include "LArRawEvent/LArRawChannelContainer.h" #include "CaloIdentifier/CaloIdManager.h" #include "Identifier/Identifier.h" -#include "LArTools/LArSuperCellCablingTool.h" +#include "LArCabling/LArSuperCellCablingTool.h" #include "CaloDetDescr/CaloDetDescrManager.h" #include "CaloEvent/CaloCellContainer.h" #include "CaloIdentifier/CaloCell_SuperCell_ID.h" @@ -59,8 +59,6 @@ LArSuperCellBuilderDriver::~LArSuperCellBuilderDriver() StatusCode LArSuperCellBuilderDriver::initialize() { - MsgStream m_log(msgSvc(), name()); - // initialize parameters m_params = new LArRawChannelBuilderParams; m_params->m_larRawChannelContainer = NULL; @@ -69,18 +67,18 @@ StatusCode LArSuperCellBuilderDriver::initialize() if (this->retrieveDetectorStore(m_onlineHelper, "LArOnline_SuperCellID").isFailure()) { - m_log << MSG::ERROR << "Could not get LArOnlineID helper !" << endreq; + ATH_MSG_ERROR( "Could not get LArOnlineID helper !" ); return StatusCode::FAILURE; } // if (m_roiMap.retrieve().isFailure()) // { -// m_log << MSG::ERROR << "Unable to find tool LArRoI_Map" << endreq; +// ATH_MSG_ERROR( "Unable to find tool LArRoI_Map" ); // return StatusCode::FAILURE; // } if(m_larCablingSvc.retrieve().isFailure()) { - m_log << MSG::ERROR << "Could not retrieve LArCablingService Tool" << endreq; + ATH_MSG_ERROR( "Could not retrieve LArCablingService Tool" ); return StatusCode::FAILURE; } @@ -89,51 +87,51 @@ StatusCode LArSuperCellBuilderDriver::initialize() if ( m_buildTools.retrieve().isFailure() ) { - m_log << MSG::ERROR << "Unable to find Builder Tools " << m_buildTools << endreq; + ATH_MSG_ERROR( "Unable to find Builder Tools " << m_buildTools ); return StatusCode::FAILURE; }else{ - m_log << MSG::INFO << "Successfully retrieved Builder Tools " << m_buildTools << endreq; + ATH_MSG_INFO( "Successfully retrieved Builder Tools " << m_buildTools ); } for( builderToolVector::iterator it = m_buildTools.begin(); it != m_buildTools.end(); it++ ) if( ( (*it)->initToolHidden(m_params) ).isFailure() ) - m_log << MSG::ERROR << "Unable to initialize Builder Tool " << (*it)->name() << endreq; + ATH_MSG_ERROR( "Unable to initialize Builder Tool " << (*it)->name() ); if ( m_adc2eTools.retrieve().isFailure() ) { - m_log << MSG::ERROR << "Unable to find ADC2E Tools " << m_buildTools << endreq; + ATH_MSG_ERROR( "Unable to find ADC2E Tools " << m_buildTools ); return StatusCode::FAILURE; }else{ - m_log << MSG::INFO << "Successfully retrieved ADC2E Tools " << m_buildTools << endreq; + ATH_MSG_INFO( "Successfully retrieved ADC2E Tools " << m_buildTools ); } for( adc2eToolVector::iterator it = m_adc2eTools.begin(); it != m_adc2eTools.end(); it++ ) if( ( (*it)->initToolHidden(m_params) ).isFailure() ) - m_log << MSG::ERROR << "Unable to initialize ADC2E Tool " << (*it)->name() << endreq; + ATH_MSG_ERROR( "Unable to initialize ADC2E Tool " << (*it)->name() ); if ( m_pedestalTools.retrieve().isFailure() ) { - m_log << MSG::ERROR << "Unable to find Pedestal Tools " << m_buildTools << endreq; + ATH_MSG_ERROR( "Unable to find Pedestal Tools " << m_buildTools ); return StatusCode::FAILURE; }else{ - m_log << MSG::INFO << "Successfully retrieved Pedestal Tools " << m_buildTools << endreq; + ATH_MSG_INFO( "Successfully retrieved Pedestal Tools " << m_buildTools ); } for( pedestalToolVector::iterator it = m_pedestalTools.begin(); it != m_pedestalTools.end(); it++ ) if( ( (*it)->initToolHidden(m_params) ).isFailure() ) - m_log << MSG::ERROR << "Unable to initialize Pedestal Tool " << (*it)->name() << endreq; + ATH_MSG_ERROR( "Unable to initialize Pedestal Tool " << (*it)->name() ); // check that we have tools to run the reconstruction ! if( m_buildTools.size() == 0 ) { - m_log << MSG::ERROR << "Didn't find any BuilderTools to do reconstruction !" << endreq; + ATH_MSG_ERROR( "Didn't find any BuilderTools to do reconstruction !" ); return(StatusCode::FAILURE); } if( m_adc2eTools.size() == 0 ) { - m_log << MSG::ERROR << "Didn't find and ADC2ETools to do reconstruction !" << endreq; + ATH_MSG_ERROR( "Didn't find and ADC2ETools to do reconstruction !" ); return(StatusCode::FAILURE); } if( m_pedestalTools.size() == 0 ) { - m_log << MSG::ERROR << "Didn't find and PedestalTools to do reconstruction !" << endreq; + ATH_MSG_ERROR( "Didn't find and PedestalTools to do reconstruction !" ); return(StatusCode::FAILURE); } return StatusCode::SUCCESS; @@ -153,41 +151,29 @@ void LArSuperCellBuilderDriver::initEventTools(){ StatusCode LArSuperCellBuilderDriver::execute() { - MsgStream msg(msgSvc(), name()); - - msg << MSG::DEBUG << "In execute" << endreq; - //Pointer to input data container const LArDigitContainer* digitContainer=0; //Retrieve Digit Container - msg << MSG::DEBUG << "About to retrieve LArDigitContainer with key " << m_DataLocation << endreq; + ATH_MSG_DEBUG( "About to retrieve LArDigitContainer with key " << m_DataLocation ); - StatusCode sc=evtStore()->retrieve(digitContainer,m_DataLocation); - if(sc.isFailure()) { - msg<< (MSG::WARNING) << "Can't retrieve LArDigitContainer with key " << m_DataLocation << "from StoreGate." << endreq; - return StatusCode::SUCCESS; - } + ATH_CHECK( evtStore()->retrieve(digitContainer,m_DataLocation) ); // Put this LArRawChannel container in the transient store CaloCellContainer* caloCell= new CaloCellContainer(); - sc = evtStore()->record(caloCell, "SCell"); - if(sc.isFailure()) { - msg<< (MSG::WARNING) << "Can't record LArRawChannelContainer in StoreGate" << endreq; - return StatusCode::FAILURE; - } + ATH_CHECK( evtStore()->record(caloCell, "SCell") ); - msg<<(MSG::VERBOSE) << "LArDigitContainer container size = " << digitContainer->size() << endreq; + ATH_MSG_VERBOSE( "LArDigitContainer container size = " << digitContainer->size() ); // if( digitContainer->size() < 1 ) { - msg<<(MSG::INFO) << "Empty LArDigitContainer container." << endreq; + ATH_MSG_INFO( "Empty LArDigitContainer container." ); return StatusCode::SUCCESS; } ToolHandle<LArSuperCellCablingTool> cabling; - const CaloSuperCellDetDescrManager* m_sem_mgr; + const CaloSuperCellDetDescrManager* sem_mgr; CHECK( cabling.retrieve() ); - CHECK( detStore()->retrieve (m_sem_mgr, "CaloSuperCellMgr") ); + CHECK( detStore()->retrieve (sem_mgr, "CaloSuperCellMgr") ); initEventTools(); @@ -199,11 +185,11 @@ StatusCode LArSuperCellBuilderDriver::execute() { int time=0; int prov=0; CaloGain::CaloGain gain; - if ( buildLArCell( (*cont_it), energy, time, gain, prov, &msg ) ){ + if ( buildLArCell( (*cont_it), energy, time, gain, prov, &msg() ) ){ ii++; Identifier id = cabling->cnvToIdentifier((*cont_it)->channelID()); - IdentifierHash idhash = m_sem_mgr->getCaloCell_ID()->calo_cell_hash(id); - const CaloDetDescrElement* dde = m_sem_mgr->get_element (idhash); + IdentifierHash idhash = sem_mgr->getCaloCell_ID()->calo_cell_hash(id); + const CaloDetDescrElement* dde = sem_mgr->get_element (idhash); CaloCell* cell = new CaloCell( dde, (float)energy, (float)time, (uint16_t)0, (uint16_t)prov, gain ); caloCell->push_back( cell ); } @@ -308,13 +294,13 @@ bool LArSuperCellBuilderDriver::buildLArCell(const LArDigit* digit, for(int bcid = 0 ; bcid <= m_bcs ; ++ bcid ) { if ( (bcid!=middle_point) && (energies[bcid]>energies[middle_point]) ) passBCIDmax=false; - if ( (bcid!=middle_point) && (times[bcid]!=0) && (fabsf(times[bcid])<13e3) ) // If within bad BC, bad + if ( (bcid!=middle_point) && (times[bcid]!=0) && (std::abs(times[bcid])<13e3) ) // If within bad BC, bad passBCIDTime=false; } energy=energies[middle_point]; - time =times[middle_point]/1e3; + time =times[middle_point]*1e-3; if ( passBCIDTime ) { - if ( fabsf(time)<25 ) passBCIDTime=true; + if ( std::abs(time)<25 ) passBCIDTime=true; else passBCIDTime=false; } @@ -395,18 +381,16 @@ void LArSuperCellBuilderDriver::ADC2energy(MsgStream* pLog) StatusCode LArSuperCellBuilderDriver::finalize() { - MsgStream m_log(msgSvc(), name()); - - m_log << MSG::INFO << "LArSuperCellBuilderdriver finalize." << endreq; - m_log << MSG::INFO << " Build Tools:" << endreq; + ATH_MSG_INFO( "LArSuperCellBuilderdriver finalize." ); + ATH_MSG_INFO( " Build Tools:" ); for( builderToolVector::iterator it = m_buildTools.begin(); it != m_buildTools.end(); it++ ) (*it)->printSummary(); - m_log << MSG::INFO << " ADC2Energy Tools:" << endreq; + ATH_MSG_INFO( " ADC2Energy Tools:" ); for( adc2eToolVector::iterator it = m_adc2eTools.begin(); it != m_adc2eTools.end(); it++ ) (*it)->printSummary(); - m_log << MSG::INFO << " Pedestal Tools:" << endreq; + ATH_MSG_INFO( " Pedestal Tools:" ); for( pedestalToolVector::iterator it = m_pedestalTools.begin(); it != m_pedestalTools.end(); it++ ) (*it)->printSummary(); diff --git a/LArCalorimeter/LArROD/src/ReadLArRaw.cxx b/LArCalorimeter/LArROD/src/ReadLArRaw.cxx index 9a5af8fbf9ef853416632553708f854aa73c8620..9dd4ae5f9ddcfa93cc73869324ddafad8441e99e 100755 --- a/LArCalorimeter/LArROD/src/ReadLArRaw.cxx +++ b/LArCalorimeter/LArROD/src/ReadLArRaw.cxx @@ -22,7 +22,7 @@ #include "GaudiKernel/MsgStream.h" #include "StoreGate/StoreGate.h" -#include "LArTools/LArCablingService.h" +#include "LArCabling/LArCablingService.h" #include "CaloIdentifier/LArID.h" #include "CaloIdentifier/LArID_Exception.h" #include "LArIdentifier/LArOnlineID.h" diff --git a/LArCalorimeter/LArROD/src/tests/SuperCellVsCaloCellTestAlg.cxx b/LArCalorimeter/LArROD/src/tests/SuperCellVsCaloCellTestAlg.cxx index c68c765d5fc587045b7cbbe76bab2c10ec05308e..83af2ff6b491be56095742ab09cfac586bcba9ae 100644 --- a/LArCalorimeter/LArROD/src/tests/SuperCellVsCaloCellTestAlg.cxx +++ b/LArCalorimeter/LArROD/src/tests/SuperCellVsCaloCellTestAlg.cxx @@ -8,14 +8,38 @@ #include "CaloEvent/CaloCellContainer.h" #include "TFile.h" -#include "TH1D.h" - -SuperCellVsCaloCellTestAlg::SuperCellVsCaloCellTestAlg( const std::string& name, ISvcLocator* pSvcLocator ) : AthAlgorithm( name, pSvcLocator ) - , m_sc2ccMappingTool("CaloSuperCellIDTool"), m_ccIdHelper(0) +#include "TProfile.h" +#include "TGraph.h" +#include "TH1F.h" +#include "TH2F.h" + +#include "TTree.h" +#include "GaudiKernel/ITHistSvc.h" + +#include "LArCabling/LArSuperCellCablingTool.h" +#include "LArRawEvent/LArDigitContainer.h" + +#include "EventInfo/EventInfo.h" +#include "EventInfo/EventID.h" + +//needed for linker ... +//constexpr double SuperCellVsCaloCellTestAlg::eBins[SuperCellVsCaloCellTestAlg::nBinsE+1]; +//constexpr double SuperCellVsCaloCellTestAlg::etaBins[SuperCellVsCaloCellTestAlg::nBinsEta+1]; + +SuperCellVsCaloCellTestAlg::SuperCellVsCaloCellTestAlg( const std::string& name, ISvcLocator* pSvcLocator ) : + AthAlgorithm( name, pSvcLocator ), + m_sc2ccMappingTool("CaloSuperCellIDTool"), + m_ccIdHelper(nullptr), + m_treeDigits(nullptr), + m_tree(nullptr) { declareProperty("SuperCellContainer",m_scKey="SCell"); declareProperty("CaloCellContainer",m_ccKey="AllCalo"); + declareProperty("TruthSuperCellContainer",m_tscKey="SCellTruth"); + declareProperty("DigitContainer",m_digitKey="LArDigitSCL1","Only used for supicious supercells"); + + declareProperty("OutputStream",m_stream="SUPERCELLTEST"); } @@ -30,41 +54,141 @@ StatusCode SuperCellVsCaloCellTestAlg::initialize() { //and the id helper (used for making id hashes) CHECK( detStore()->retrieve (m_ccIdHelper, "CaloCell_ID") ); - for(int i=0;i<CaloCell_ID::NSUBCALO;i++) { - m_eReso[i] = new TH1D(TString::Format("eReso%d",i),TString::Format("(SC_Energy - CC_Energy)/CC_Energy region %d",i),100,-10,10); + double etBins[11] = {0.1,0.25,0.5,0.75,1.,1.5,2.,3.,4.,5.,10.}; //in GeV + for(uint i=0;i<CaloSampling::getNumberOfSamplings();i++) { + if(!m_ccKey.empty()) { + m_etReso.push_back(new TProfile(TString::Format("%s_calocell",CaloSampling::getSamplingName(i).c_str()),TString::Format("%s;CaloCell E_{T} [GeV];SuperCell E_{T} / CaloCell E_{T}",CaloSampling::getSamplingName(i).c_str()),10,etBins,"s"/* standard deviation for error*/)); + m_etReso.back()->SetDirectory(0); + m_Reso_et.push_back(new TH1F(TString::Format("%s_SuperCellResolution",CaloSampling::getSamplingName(i).c_str()),TString::Format("%s;(SuperCell E_{T} - CaloCell E_{T}) / CaloCell E_{T} (%%)",CaloSampling::getSamplingName(i).c_str()),80,-40,40) ); + m_Reso_et_vs_et.push_back(new TH2F(TString::Format("%s_SuperCellResolution_versus_et",CaloSampling::getSamplingName(i).c_str()),TString::Format("%s; E_{T}[GeV] ; (SuperCell E_{T} - CaloCell E_{T}) / CaloCell E_{T} (%%)",CaloSampling::getSamplingName(i).c_str()),60,-10,50,80,-40,40) ); + m_Reso_et_vs_eta.push_back(new TH2F(TString::Format("%s_SuperCellResolution_versus_eta",CaloSampling::getSamplingName(i).c_str()),TString::Format("%s; #eta ; (SuperCell E_{T} - CaloCell E_{T}) / CaloCell E_{T} (%%)",CaloSampling::getSamplingName(i).c_str()),50,-2.5,2.5,80,-40,40) ); + m_Linear_SCet_vs_et.push_back(new TH2F(TString::Format("%s_Linearity",CaloSampling::getSamplingName(i).c_str()),TString::Format("%s; CaloCell Sum E_{T}[GeV] ; SuperCell E_{T}",CaloSampling::getSamplingName(i).c_str()),60,-10,50,60,-10,50) ); + } + if(!m_tscKey.empty()) { + m_etResoTruth.push_back(new TProfile(TString::Format("%s_truth",CaloSampling::getSamplingName(i).c_str()),TString::Format("%s;Truth SuperCell E_{T} [GeV];SuperCell E_{T} / Truth SuperCell E_{T}",CaloSampling::getSamplingName(i).c_str()),10,etBins,"s"/* standard deviation for error*/)); + m_etResoTruth.back()->SetDirectory(0); + } } + m_tree = new TTree("debug","debug"); + + m_treeDigits= new std::vector<short int>; + + m_tree->Branch("EventNumber",&m_eventNumber); + m_tree->Branch("Channel",&m_treeChannel); + m_tree->Branch("Sampling",&m_treeSampling); + m_tree->Branch("eta",&m_treeEta); + m_tree->Branch("scET",&m_treeSCET); + m_tree->Branch("truthET",&m_treeTruthET); + m_tree->Branch("digits",&m_treeDigits); + + ServiceHandle<ITHistSvc> histSvc("THistSvc",name()); + CHECK( histSvc->regTree(TString::Format("/%s/debug",m_stream.c_str()).Data(),m_tree) ); + + + + return StatusCode::SUCCESS; } StatusCode SuperCellVsCaloCellTestAlg::finalize() { - TFile f1("hist.root","recreate"); - for(int i=0;i<CaloCell_ID::NSUBCALO;i++) m_eReso[i]->Write(); - f1.Close(); + ServiceHandle<ITHistSvc> histSvc("THistSvc",name()); + + for(uint i=0;i<CaloSampling::getNumberOfSamplings();i++) { //don't bother writing empty hists + if(m_etReso[i]->GetEntries()) CHECK( histSvc->regHist(TString::Format("/%s/SuperCellValidation/%s",m_stream.c_str(),m_etReso[i]->GetName()).Data(),m_etReso[i]) ); + if(m_Reso_et[i]->GetEntries()) CHECK( histSvc->regHist(TString::Format("/%s/SuperCellValidation/%s",m_stream.c_str(),m_Reso_et[i]->GetName()).Data(), m_Reso_et[i]) ); + if(m_Reso_et_vs_eta[i]->GetEntries()) CHECK( histSvc->regHist(TString::Format("/%s/SuperCellValidation/%s",m_stream.c_str(),m_Reso_et_vs_eta[i]->GetName()).Data(), m_Reso_et_vs_eta[i]) ); + if(m_Reso_et_vs_et[i]->GetEntries()) CHECK( histSvc->regHist(TString::Format("/%s/SuperCellValidation/%s",m_stream.c_str(),m_Reso_et_vs_et[i]->GetName()).Data(), m_Reso_et_vs_et[i]) ); + if(m_Linear_SCet_vs_et[i]->GetEntries()) CHECK( histSvc->regHist(TString::Format("/%s/SuperCellValidation/%s",m_stream.c_str(),m_Linear_SCet_vs_et[i]->GetName()).Data(), m_Linear_SCet_vs_et[i]) ); + + + if(!m_tscKey.empty()) { + if(m_etResoTruth[i]->GetEntries())CHECK( histSvc->regHist(TString::Format("/%s/%s",m_stream.c_str(),m_etResoTruth[i]->GetName()).Data(),m_etResoTruth[i]) ); + } + } + + //also write any graphs + for(auto graphPointsX : m_graphsX) { + TGraph* g = new TGraph(graphPointsX.second.size(),&graphPointsX.second[0],&m_graphsY[graphPointsX.first][0]); + g->SetTitle(graphPointsX.first); + g->SetMarkerStyle(6); + CHECK( histSvc->regGraph(TString::Format("/%s/%s",m_stream.c_str(),graphPointsX.first.Data()).Data(),g) ); + } + return StatusCode::SUCCESS; } StatusCode SuperCellVsCaloCellTestAlg::execute() { //get the supercells, calocells - const CaloCellContainer* scells=0; - CHECK( evtStore()->retrieve(scells, m_scKey) ); - const CaloCellContainer* ccells=0; - CHECK( evtStore()->retrieve(ccells, m_ccKey) ); + const CaloCellContainer* scells=0;CHECK( evtStore()->retrieve(scells, m_scKey) ); + + const CaloCellContainer* ccells=0;if(!m_ccKey.empty()) CHECK( evtStore()->retrieve(ccells, m_ccKey) ); + + const CaloCellContainer* tscells=0;if(!m_tscKey.empty()) CHECK( evtStore()->retrieve(tscells,m_tscKey) ); + + + //iterate over supercells, and build up a histogram of the resolution for(auto scell : *scells) { - std::vector<Identifier> ccellIds = m_sc2ccMappingTool->superCellToOfflineID( scell->ID() ); + //bool passPeakFinder( (scell->provenance()&0x40) ); + //if(!passPeakFinder) continue; //skip non maxima? + + int samplingEnum = m_ccIdHelper->calo_sample(scell->ID()); + + double scellEt = scell->e()*scell->sinTh()*1e-3; + + if(ccells) { + std::vector<Identifier> ccellIds = m_sc2ccMappingTool->superCellToOfflineID( scell->ID() ); + double cellEt(0.); + //use findCell function of CaloCellContainer, which takes an identifier hash + for(auto& ccellId : ccellIds) { + const CaloCell* ccell = ccells->findCell(m_ccIdHelper->calo_cell_hash(ccellId)); + if(!ccell) { ATH_MSG_WARNING("Could not find cell"); continue; } + if(ccell->e()>0) cellEt += ccell->e()*ccell->sinTh(); + } + if(cellEt>0) m_etReso[samplingEnum]->Fill(cellEt*1e-3,scellEt*1000./cellEt); + float resolution = 0.0; + if ( TMath::Abs(cellEt)>1 ) resolution = 100*(scellEt - cellEt*1e-3 ) / (cellEt*1e-3); + if ( TMath::Abs(cellEt)>150 ) { + m_Reso_et[samplingEnum]->Fill( resolution ); + m_Reso_et_vs_et[samplingEnum]->Fill( cellEt*1e-3, resolution ); + m_Reso_et_vs_eta[samplingEnum]->Fill( scell->eta(), resolution ); + m_Linear_SCet_vs_et[samplingEnum]->Fill( cellEt*1e-3 , scellEt ); + } + } + + if(tscells) { + const CaloCell* tscell = tscells->findCell(scell->caloDDE()->calo_hash()); + double tscellEt = tscell->e()*tscell->sinTh()*1e-3; + if(tscellEt>0) m_etResoTruth[samplingEnum]->Fill(tscellEt,scellEt/tscellEt); + + //detect suspicious supercells .. where truth energy is greater than 1GeV and we measure less than 25% of it, or super cell ET is greater than 1GeV and truth ET < 25% of that + if( (tscellEt>1. && scellEt/tscellEt<0.25) || (scellEt>1. && tscellEt/scellEt<0.25) ) { + const EventInfo* evt = 0; CHECK( evtStore()->retrieve(evt) ); + m_eventNumber = evt->event_ID()->event_number(); + + ToolHandle<LArSuperCellCablingTool> larCablingTool; + HWIdentifier hwid = larCablingTool->createSignalChannelID(scell->ID()); + m_treeChannel = hwid.get_identifier32().get_compact(); + m_treeSampling = samplingEnum; + m_treeEta = scell->caloDDE()->eta(); + m_treeSCET = scellEt; + m_treeTruthET = tscellEt; + if(!m_digitKey.empty()) { + const LArDigitContainer* digits=0;CHECK( evtStore()->retrieve(digits, m_digitKey) ); + for(auto digit : *digits) { if(digit->hardwareID()==hwid) *m_treeDigits = digit->samples(); } + } + m_tree->Fill(); + } - double cellE(0.); - //use findCell function of CaloCellContainer, which takes an identifier hash - for(auto& ccellId : ccellIds) { - const CaloCell* ccell = ccells->findCell(m_ccIdHelper->calo_cell_hash(ccellId)); - cellE += ccell->e(); } - m_eReso[m_ccIdHelper->sub_calo(scell->ID())]->Fill( (scell->e()-cellE)/cellE ); + + + } diff --git a/LArCalorimeter/LArROD/src/tests/SuperCellVsCaloCellTestAlg.h b/LArCalorimeter/LArROD/src/tests/SuperCellVsCaloCellTestAlg.h index 613e1262ac2511e87f72ba9ffa4ecb3e3cd45074..8e71c5b6b2fab399d8d8d15b7d84c755b4b6d3ab 100644 --- a/LArCalorimeter/LArROD/src/tests/SuperCellVsCaloCellTestAlg.h +++ b/LArCalorimeter/LArROD/src/tests/SuperCellVsCaloCellTestAlg.h @@ -11,12 +11,17 @@ #include "AthenaBaseComps/AthAlgorithm.h" -#include "CaloTriggerTool/ICaloSuperCellIDTool.h" +#include "CaloDetDescr/ICaloSuperCellIDTool.h" #include "CaloIdentifier/CaloCell_ID.h" #include "GaudiKernel/ToolHandle.h" -class TH1D; +#include "TString.h" + +class TProfile; +class TTree; +class TH1F; +class TH2F; class SuperCellVsCaloCellTestAlg: public ::AthAlgorithm { public: @@ -27,14 +32,42 @@ class SuperCellVsCaloCellTestAlg: public ::AthAlgorithm { virtual StatusCode execute(); virtual StatusCode finalize(); + + private: ToolHandle<ICaloSuperCellIDTool> m_sc2ccMappingTool; const CaloCell_ID* m_ccIdHelper; - std::string m_scKey, m_ccKey; + std::string m_scKey, m_ccKey, m_tscKey, m_digitKey, m_stream; + +/* + static const int nBinsE=11; + static const int nBinsEta=34; + static constexpr double eBins[nBinsE+1] {0.00001,0.2,0.4,0.6,0.8,1,2,3,4,5,10,50}; + static constexpr double etaBins[nBinsEta+1] {0,0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1.0,1.1,1.2,1.3,1.4,1.5,1.6,1.7,1.8,1.9,2.0,2.1,2.2,2.3,2.4,2.5,2.7,2.9,3.1,3.2,3.5,3.8,4.1,4.5,4.9}; +*/ + + std::vector<TProfile*> m_etReso; + std::vector<TProfile*> m_etResoTruth; + + std::vector<TH1F*> m_Reso_et; + std::vector<TH2F*> m_Reso_et_vs_eta; + std::vector<TH2F*> m_Reso_et_vs_et; + std::vector<TH2F*> m_Linear_SCet_vs_et; + + std::map<TString,std::vector<float> > m_graphsX, m_graphsY; + + + int m_eventNumber=0; + int m_treeChannel=0; + int m_treeSampling=0; + float m_treeEta=0; + float m_treeSCET=0; + float m_treeTruthET=0; + std::vector<short int>* m_treeDigits; + TTree* m_tree; - TH1D* m_eReso[CaloCell_ID::NSUBCALO]; };