diff --git a/LArCalorimeter/LArCafJobs/CMakeLists.txt b/LArCalorimeter/LArCafJobs/CMakeLists.txt index e1ff9c7dc3edd4df4e00c3bd77217808a0504474..5253165880658a8390b67b780b898f96507a7aa5 100644 --- a/LArCalorimeter/LArCafJobs/CMakeLists.txt +++ b/LArCalorimeter/LArCafJobs/CMakeLists.txt @@ -12,30 +12,45 @@ atlas_depends_on_subdirs( PUBLIC Control/CLIDSvc Control/SGTools Control/StoreGate + Calorimeter/CaloDetDescr + Calorimeter/CaloInterface + DetectorDescription/Identifier + External/AtlasCLHEP + External/AtlasHepMC GaudiKernel LArCalorimeter/LArIdentifier LArCalorimeter/LArRawConditions LArCalorimeter/LArRawEvent LArCalorimeter/LArRecUtils + LArCalorimeter/LArRecConditions LArCalorimeter/LArTools + LArCalorimeter/LArCabling + PhysicsAnalysis/AnalysisCommon/AnalysisTools + PhysicsAnalysis/TruthParticleID/McParticleEvent + Reconstruction/egamma/egammaEvent Tools/PyJobTransformsCore + Trigger/TrigAnalysis/TrigAnalysisInterfaces Trigger/TrigAnalysis/TrigDecisionTool Trigger/TrigConfiguration/TrigConfInterfaces Trigger/TrigEvent/TrigSteeringEvent PRIVATE - Calorimeter/CaloDetDescr - Calorimeter/CaloInterface + Calorimeter/CaloEvent + Database/AthenaPOOL/AthenaPoolUtilities DataQuality/DataQualityUtils - DetectorDescription/Identifier Event/xAOD/xAODEventInfo + Event/NavFourMom LArCalorimeter/LArElecCalib - LArCalorimeter/LArRecConditions + LArCalorimeter/LArCondUtils + LArCalorimeter/LArRecEvent + LArCalorimeter/LArGeoModel/LArHV + LArCalorimeter/LArGeoModel/LArReadoutGeometry Trigger/TrigConfiguration/TrigConfHLTData Trigger/TrigT1/TrigT1Result ) # External dependencies: find_package( Boost COMPONENTS filesystem thread system ) find_package( ROOT COMPONENTS Matrix Core Tree MathCore Hist RIO pthread MathMore Minuit Minuit2 Physics HistPainter Rint Graf Graf3d Gpad Html Postscript Gui GX11TTF GX11 ) +find_package( HepMC ) # tag ROOTBasicLibs was not recognized in automatic conversion in cmt2cmake @@ -58,20 +73,22 @@ atlas_add_library( LArCafJobsLib src/RunData.cxx src/ShapeInfo.cxx src/SimpleShape.cxx + src/LArNoiseBursts.cxx + src/LArHECNoise.cxx PUBLIC_HEADERS LArCafJobs - PRIVATE_INCLUDE_DIRS ${Boost_INCLUDE_DIRS} ${ROOT_INCLUDE_DIRS} - LINK_LIBRARIES CaloIdentifier AthenaBaseComps SGTools GaudiKernel LArIdentifier LArRawConditions LArRawEvent TrigSteeringEvent StoreGateLib SGtests LArRecUtilsLib LArToolsLib TrigDecisionToolLib CaloDetDescrLib - PRIVATE_LINK_LIBRARIES ${Boost_LIBRARIES} ${ROOT_LIBRARIES} DataQualityUtils Identifier xAODEventInfo LArRecConditions TrigConfHLTData TrigT1Result ) + PRIVATE_INCLUDE_DIRS ${Boost_INCLUDE_DIRS} ${ROOT_INCLUDE_DIRS} ${HEPMC_INCLUDE_DIRS} + LINK_LIBRARIES CaloIdentifier AthenaBaseComps SGTools GaudiKernel LArIdentifier LArRawConditions LArRawEvent egammaEvent TrigSteeringEvent McParticleEvent StoreGateLib SGtests LArRecUtilsLib LArToolsLib TrigDecisionToolLib CaloDetDescrLib + PRIVATE_LINK_LIBRARIES ${Boost_LIBRARIES} ${ROOT_LIBRARIES} DataQualityUtils Identifier xAODEventInfo LArRecConditions TrigConfHLTData TrigT1Result ${HEPMC_LIBRARIES} ) atlas_add_component( LArCafJobs src/components/*.cxx - INCLUDE_DIRS ${Boost_INCLUDE_DIRS} ${ROOT_INCLUDE_DIRS} - LINK_LIBRARIES ${Boost_LIBRARIES} ${ROOT_LIBRARIES} CaloIdentifier AthenaBaseComps SGTools StoreGateLib SGtests GaudiKernel LArIdentifier LArRawConditions LArRawEvent LArRecUtilsLib LArToolsLib TrigDecisionToolLib TrigSteeringEvent CaloDetDescrLib DataQualityUtils Identifier xAODEventInfo LArRecConditions TrigConfHLTData TrigT1Result LArCafJobsLib ) + INCLUDE_DIRS ${Boost_INCLUDE_DIRS} ${ROOT_INCLUDE_DIRS} ${HEPMC_INCLUDE_DIRS} + LINK_LIBRARIES ${Boost_LIBRARIES} ${ROOT_LIBRARIES} CaloIdentifier AthenaBaseComps SGTools StoreGateLib SGtests GaudiKernel LArIdentifier LArRawConditions LArRawEvent egammaEvent LArRecUtilsLib LArToolsLib TrigDecisionToolLib TrigSteeringEvent CaloDetDescrLib DataQualityUtils Identifier xAODEventInfo LArRecConditions TrigConfHLTData TrigT1Result LArCafJobsLib ) atlas_add_dictionary( LArCafJobsDict LArCafJobs/LArCafJobsDict.h LArCafJobs/selection.xml - INCLUDE_DIRS ${Boost_INCLUDE_DIRS} ${ROOT_INCLUDE_DIRS} + INCLUDE_DIRS ${Boost_INCLUDE_DIRS} ${ROOT_INCLUDE_DIRS} ${HEPMC_INCLUDE_DIRS} LINK_LIBRARIES ${Boost_LIBRARIES} ${ROOT_LIBRARIES} CaloIdentifier AthenaBaseComps SGTools StoreGateLib SGtests GaudiKernel LArIdentifier LArRawConditions LArRawEvent LArRecUtilsLib LArToolsLib TrigDecisionToolLib TrigSteeringEvent CaloDetDescrLib DataQualityUtils Identifier xAODEventInfo LArRecConditions TrigConfHLTData TrigT1Result LArCafJobsLib ) atlas_add_executable( LArQuickHistMerge @@ -87,5 +104,5 @@ atlas_add_executable( LArSamplesMerge # Install files from the package: atlas_install_python_modules( python/*.py ) atlas_install_joboptions( share/*.py ) -atlas_install_scripts( share/LArHistMerge_trf.py ) +atlas_install_scripts( share/LArHistMerge_trf.py share/LArCAF_tf.py share/LArNoiseBursts_tf.py ) diff --git a/LArCalorimeter/LArCafJobs/LArCafJobs/LArHECNoise.h b/LArCalorimeter/LArCafJobs/LArCafJobs/LArHECNoise.h new file mode 100755 index 0000000000000000000000000000000000000000..2cdfbb9b5b2d92616fd3526956a66414aae51869 --- /dev/null +++ b/LArCalorimeter/LArCafJobs/LArCafJobs/LArHECNoise.h @@ -0,0 +1,123 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef LArHECNoise_H +#define LArHECNoise_H + +#include "GaudiKernel/ToolHandle.h" +#include "AthenaBaseComps/AthAlgorithm.h" +#include "GaudiKernel/ObjectVector.h" +#include "GaudiKernel/AlgTool.h" + +#include "CLHEP/Units/SystemOfUnits.h" +#include "StoreGate/StoreGateSvc.h" +#include "GaudiKernel/ITHistSvc.h" +#include "AnalysisTools/AnalysisTools.h" + +//LAr services: +#include "Identifier/Range.h" +#include "Identifier/IdentifierHash.h" +#include "LArRecConditions/ILArBadChannelMasker.h" +#include "CaloInterface/ICaloNoiseTool.h" +#include "CaloInterface/ICalorimeterNoiseTool.h" +#include "TrigAnalysisInterfaces/IBunchCrossingTool.h" +#include "LArTools/LArCablingService.h" +#include "LArCabling/LArHVCablingTool.h" +#include "LArIdentifier/LArOnlineID.h" +#include "LArIdentifier/LArElectrodeID.h" +#include "CaloDetDescr/CaloDetDescrManager.h" +#include "CaloIdentifier/CaloIdManager.h" + +#include "LArElecCalib/ILArPedestal.h" + +// Trigger +#include "TrigDecisionTool/TrigDecisionTool.h" + +//STL: +#include <string> +#include <bitset> + + +class LArOnlineID; +class LArElectrodeID; +class HWIdentifier; +class LArCablingService; +class LArEM_ID; +class LArHEC_ID; +class LArFCAL_ID; + +class TTree; + +class LArHECNoise : public AthAlgorithm { + + public: + + LArHECNoise(const std::string& name, ISvcLocator* pSvcLocator); + ~LArHECNoise(); + + virtual StatusCode initialize(); + virtual StatusCode finalize(); + virtual StatusCode execute(); + + private: + + ITHistSvc * m_thistSvc; + + TTree* m_tree; + + /*Tools*/ + ToolHandle<LArCablingService> m_LArCablingService; + ToolHandle<ICaloNoiseTool> m_calo_noise_tool; + ToolHandle<Trig::IBunchCrossingTool> m_bc_tool; + + ToolHandle< Trig::TrigDecisionTool > m_trigDec; + + /*services*/ + const LArOnlineID* m_LArOnlineIDHelper; + const CaloIdManager* m_caloIdMgr; + const CaloDetDescrManager* m_calodetdescrmgr; + const CaloCell_ID* m_calocell_id; + + /*declaration of branches*/ + int m_nt_run ; + int m_nt_evtId; + int m_nt_evtCount; + int m_nt_evtTime; + int m_nt_evtTime_ns; + int m_nt_lb; + int m_nt_bcid; + int m_nt_gain; + int m_nt_side; + int m_nt_samp; + int m_nt_reg; + int m_nt_ieta; + int m_nt_iphi; + int m_nt_quality; + short m_nt_digi[32]; + int m_nt_max; + int m_nt_min; + long m_nt_OID; + float m_nt_avgMu; + float m_nt_actMu; + float m_nt_e; + float m_nt_t; + float m_nt_eta; + float m_nt_phi; + float m_nt_z; + float m_nt_r; + float m_nt_ped; + float m_nt_pedRMS; + float *m_nt_prescale; + bool *m_nt_trigger; + + // other members + std::vector<std::string> m_TriggerLines; + int m_MinDigitADC; + int m_MaxDeltaT; + const DataHandle<ILArPedestal> m_ped; + +}; + +#endif // LArHECNoise_H + diff --git a/LArCalorimeter/LArCafJobs/LArCafJobs/LArNoiseBursts.h b/LArCalorimeter/LArCafJobs/LArCafJobs/LArNoiseBursts.h new file mode 100755 index 0000000000000000000000000000000000000000..4218b6bebdcb9c9f51a7fec0cc73cacb699dcb5c --- /dev/null +++ b/LArCalorimeter/LArCafJobs/LArCafJobs/LArNoiseBursts.h @@ -0,0 +1,262 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef LArNoiseBursts_H +#define LArNoiseBursts_H + +#include "GaudiKernel/ToolHandle.h" +#include "AthenaBaseComps/AthAlgorithm.h" +#include "GaudiKernel/ObjectVector.h" +#include "GaudiKernel/AlgTool.h" + +#include "CLHEP/Units/SystemOfUnits.h" +#include "StoreGate/StoreGateSvc.h" +#include "GaudiKernel/ITHistSvc.h" +#include "AnalysisTools/AnalysisTools.h" + +//LAr services: +#include "Identifier/Range.h" +#include "Identifier/IdentifierHash.h" +//#include "Identifier/HWIdentifier.h" +//#include "LArElecCalib/ILArPedestal.h" +#include "LArRecConditions/ILArBadChannelMasker.h" +#include "CaloInterface/ICaloNoiseTool.h" +#include "CaloInterface/ICalorimeterNoiseTool.h" +#include "TrigAnalysisInterfaces/IBunchCrossingTool.h" +#include "LArTools/LArCablingService.h" +#include "LArCabling/LArHVCablingTool.h" +#include "LArIdentifier/LArOnlineID.h" +#include "LArIdentifier/LArElectrodeID.h" +#include "CaloDetDescr/CaloDetDescrManager.h" +#include "CaloIdentifier/CaloIdManager.h" +//#include "LArCondUtils/LArHVToolDB.h" +//#include "LArElecCalib/ILArHVTool.h" + +// Trigger +#include "TrigDecisionTool/TrigDecisionTool.h" + +// Electrons +#include "egammaEvent/ElectronContainer.h" + +//CBNT_UTILS +//#include "CBNT_Utils/CBNT_AthenaAwareBase.h" +//#include "AthenaBaseComps/AthAlgorithm.h" + +//STL: +#include <string> +#include <bitset> + + +class LArOnlineID; +class LArElectrodeID; +class HWIdentifier; +class LArOnlineIDStrHelper; +class LArCablingService; +class LArEM_ID; +class LArHEC_ID; +class LArFCAL_ID; +//class CaloIdManager; +//class CaloDetDescrManager; + +class TileTBID; +class TgcIdHelper; + +class TTree; + +class LArHVLineID; + +class LArNoiseBursts : public AthAlgorithm { + + public: + + LArNoiseBursts(const std::string& name, ISvcLocator* pSvcLocator); + ~LArNoiseBursts(); + + //virtual StatusCode initializeBeforeEventLoop(); + virtual StatusCode initialize(); + virtual StatusCode finalize(); + virtual StatusCode execute(); + virtual StatusCode clear(); + + private: + + /** methods called by execute() */ + StatusCode doTrigger(); + StatusCode doEventProperties(); + StatusCode doLArNoiseBursts(); + StatusCode doPhysicsObjects(); + + //functions + int GetPartitionLayerIndex(const Identifier& id); + std::vector<int>* GetHVLines(const Identifier& id); + + + private: + + ITHistSvc * m_thistSvc; + + TTree* m_tree; + + /*Tools*/ + ToolHandle<LArCablingService> m_LArCablingService; + ToolHandle<LArHVCablingTool> m_LArHVCablingTool; + ToolHandle<ICaloNoiseTool> m_calo_noise_tool; + ToolHandle<Trig::IBunchCrossingTool> m_bc_tool; + + ToolHandle< Trig::TrigDecisionTool > m_trigDec; + + /*services*/ + const LArOnlineID* m_LArOnlineIDHelper; + const LArHVLineID* m_LArHVLineIDHelper; + const LArElectrodeID* m_LArElectrodeIDHelper; + const LArEM_ID* m_LArEM_IDHelper; + const LArFCAL_ID* m_LArFCAL_IDHelper; + const LArHEC_ID* m_LArHEC_IDHelper; + const CaloIdManager* m_caloIdMgr; + const CaloDetDescrManager* m_calodetdescrmgr; + + // Electrons + std::string m_elecContainerName; + + /*event cuts */ + double m_sigmacut; + bool m_CosmicCaloStream; + int m_frontbunches; + bool m_keepOnlyCellID; + + /*declaration of branches*/ + int m_nb_sat; + int m_lowqfactor; + int m_medqfactor; + int m_hiqfactor; + long n_noisycell; + int m_nt_larcellsize; + int m_nt_cellsize; + int m_nt_run ; + int m_nt_evtId; + int m_nt_evtTime; + int m_nt_evtTime_ns; + int m_nt_lb; + int m_nt_bcid; + int m_nt_ntracks; + int m_nt_isbcidFilled; + int m_nt_isbcidInTrain; + std::vector<int> m_nt_isBunchesInFront; + int m_nt_bunchtype; + float m_nt_bunchtime; + unsigned int m_nt_atlasready; + unsigned int m_nt_stablebeams; + std::vector<std::string> m_nt_streamTagName; + std::vector<std::string> m_nt_streamTagType; + short m_nt_larnoisyro; + short m_nt_larnoisyro_opt; + short m_nt_larnoisyro_satTwo; + + //event info veto variables +// short m_nt_veto_mbts; +// //short m_nt_veto_indet; +// short m_nt_veto_bcm; +// short m_nt_veto_lucid; +// short m_nt_veto_pixel; +// short m_nt_veto_sct; +// short m_nt_veto_mbtstdHalo; +// short m_nt_veto_mbtstdCol; +// short m_nt_veto_lartdHalo; +// short m_nt_veto_lartdCol; +// short m_nt_veto_csctdHalo; +// short m_nt_veto_csctdCol; +// short m_nt_veto_bcmtHalo; +// short m_nt_veto_bcmtCol; +// short m_nt_veto_muontCol; +// short m_nt_veto_muontCosmic; + + // LAr event bit info + bool m_nt_larflag_badFEBs; + bool m_nt_larflag_mediumSaturatedDQ; + bool m_nt_larflag_tightSaturatedDQ; + bool m_nt_larflag_noiseBurstVeto; + bool m_nt_larflag_dataCorrupted; + bool m_nt_larflag_dataCorruptedVeto; + + // NoiseBurst trigger + bool m_nt_L1_J75; + bool m_nt_L1_J10_EMPTY; + bool m_nt_L1_J30_FIRSTEMPTY; + bool m_nt_L1_J30_EMPTY; + bool m_nt_L1_XE40; + bool m_nt_L1_XE50; + bool m_nt_L1_XE50_BGRP7; + bool m_nt_L1_XE70; + + bool m_nt_EF_j165_u0uchad_LArNoiseBurst; + bool m_nt_EF_j30_u0uchad_empty_LArNoiseBurst; + bool m_nt_EF_j55_u0uchad_firstempty_LArNoiseBurst; + bool m_nt_EF_j55_u0uchad_empty_LArNoiseBurst; + bool m_nt_EF_xe45_LArNoiseBurst; + bool m_nt_EF_xe55_LArNoiseBurst; + bool m_nt_EF_xe60_LArNoiseBurst; + bool m_nt_EF_j55_u0uchad_firstempty_LArNoiseBurstT; + bool m_nt_EF_j100_u0uchad_LArNoiseBurstT; + bool m_nt_EF_j165_u0uchad_LArNoiseBurstT; + bool m_nt_EF_j130_u0uchad_LArNoiseBurstT; + bool m_nt_EF_j35_u0uchad_empty_LArNoiseBurst; + bool m_nt_EF_j35_u0uchad_firstempty_LArNoiseBurst; + bool m_nt_EF_j80_u0uchad_LArNoiseBurstT; + + //LAr Time variables + float m_nt_ECTimeDiff; + float m_nt_ECTimeAvg; + int m_nt_nCellA; + int m_nt_nCellC; + + + //Quantites for noisy cells + std::vector<float> m_nt_energycell; + std::vector<float> m_nt_qfactorcell; + std::vector<float> m_nt_phicell; + std::vector<float> m_nt_etacell; + std::vector<float> m_nt_signifcell; + float m_nt_noisycellpercent; + std::vector<short> m_nt_ft_noisy; + std::vector<short> m_nt_slot_noisy; + std::vector<short> m_nt_channel_noisy; + std::vector<short> m_nt_cellpartlayerindex; + std::vector< unsigned int > m_nt_cellIdentifier; + std::vector<float> m_nt_noisycellpart; + std::vector<int> m_nt_nominalhv; + std::vector<int> m_nt_maximalhv; + std::vector<int> m_nt_noisycellHVphi; + std::vector<int> m_nt_noisycellHVeta; + std::vector<std::vector<short> > m_nt_samples; + std::vector<int> m_nt_gain; + std::vector<int> m_nt_isbadcell; + + /* + std::vector<int> m_nt_isbarrel; + std::vector<int> m_nt_isendcap; + std::vector<int> m_nt_isfcal; + std::vector<int> m_nt_ishec; + */ + + std::vector<int> m_nt_partition; + std::vector<int> m_nt_layer; + + //Quanties for the saturated cells + std::vector<int> m_nt_isbadcell_sat; + std::vector<int> m_nt_barrelec_sat; + std::vector<int> m_nt_posneg_sat; + std::vector<short> m_nt_ft_sat; + std::vector<short> m_nt_slot_sat; + std::vector<short> m_nt_channel_sat; + std::vector<int> m_nt_partition_sat; + std::vector<float> m_nt_energy_sat; + std::vector<float> m_nt_phicell_sat; + std::vector<float> m_nt_etacell_sat; + std::vector<int> m_nt_layer_sat; + std::vector<unsigned int> m_nt_cellIdentifier_sat; + +}; + +#endif // LArNoiseBursts_H + diff --git a/LArCalorimeter/LArCafJobs/LArCafJobs/LArShapeDumper.h b/LArCalorimeter/LArCafJobs/LArCafJobs/LArShapeDumper.h index 2e200d345cfa73019ed2756afd4973ca73d59aa1..6a07415ac6772469de6967e772c0a5df1c2834d7 100755 --- a/LArCalorimeter/LArCafJobs/LArCafJobs/LArShapeDumper.h +++ b/LArCalorimeter/LArCafJobs/LArCafJobs/LArShapeDumper.h @@ -33,6 +33,7 @@ #include "TTree.h" #include "TRandom.h" #include "TrigConfInterfaces/ITrigConfigSvc.h" +#include "TrigAnalysisInterfaces/IBunchCrossingTool.h" #include "LArCafJobs/ILArShapeDumperTool.h" class MsgStream; @@ -79,8 +80,14 @@ class LArShapeDumper : public AthAlgorithm std::string m_fileName; int m_prescale; - int m_count; - int m_maxChannels; + unsigned m_count; + unsigned m_maxChannels; + unsigned m_nWrongBunchGroup; + unsigned m_nPrescaledAway; + unsigned m_nLArError; + unsigned m_nNoDigits; + + std::string m_digitsKey, m_channelsKey; std::string m_caloType; // EM, HEC, FCAL double m_energyCut, m_noiseSignifCut; @@ -97,8 +104,11 @@ class LArShapeDumper : public AthAlgorithm ToolHandle<ILArADC2MeVTool> m_adc2mevTool; ToolHandle<LArOFPeakRecoTool> m_peakReco; ToolHandle<Trig::TrigDecisionTool> m_trigDec; - + + ServiceHandle<TrigConf::ITrigConfigSvc> m_configSvc; // for tests... + + ToolHandle<Trig::IBunchCrossingTool> m_bcidTool; const ILArPedestal* m_larPedestal; const CaloDetDescrManager* m_caloDetDescrMgr; @@ -111,6 +121,8 @@ class LArShapeDumper : public AthAlgorithm bool m_doEM, m_doHEC, m_doFCAL; bool m_gains[CaloGain::LARNGAIN]; + bool m_onlyEmptyBC; + LArSamples::DataStore* m_samples; LArSamples::RunData* m_runData; std::vector<const Trig::ChainGroup*> m_triggerGroups; diff --git a/LArCalorimeter/LArCafJobs/cmt/requirements b/LArCalorimeter/LArCafJobs/cmt/requirements index 1319a52ed6878ff4222e59de4c66391e79b2b6df..7d2fd9c090e0c0c9edd40ce732452801671b0926 100644 --- a/LArCalorimeter/LArCafJobs/cmt/requirements +++ b/LArCalorimeter/LArCafJobs/cmt/requirements @@ -13,6 +13,7 @@ use LArRawEvent LArRawEvent-* LArCalorimeter use LArRawConditions LArRawConditions-* LArCalorimeter use LArRecUtils LArRecUtils-* LArCalorimeter use LArTools LArTools-* LArCalorimeter +use LArCabling LArCabling-* LArCalorimeter use PyJobTransformsCore PyJobTransformsCore-* Tools use StoreGate StoreGate-* Control use TrigDecisionTool TrigDecisionTool-* Trigger/TrigAnalysis @@ -20,6 +21,17 @@ use TrigSteeringEvent TrigSteeringEvent-* Trigger/TrigEvent use TrigConfInterfaces TrigConfInterfaces-* Trigger/TrigConfiguration use LArElecCalib LArElecCalib-* LArCalorimeter use LArIdentifier LArIdentifier-* LArCalorimeter +use TrigAnalysisInterfaces TrigAnalysisInterfaces-* Trigger/TrigAnalysis + +use CaloDetDescr CaloDetDescr-* Calorimeter +use CaloInterface CaloInterface-* Calorimeter +use Identifier Identifier-* DetectorDescription +use LArRecConditions LArRecConditions-* LArCalorimeter + +use AnalysisTools AnalysisTools-* PhysicsAnalysis/AnalysisCommon +use AtlasCLHEP AtlasCLHEP-* External +use egammaEvent egammaEvent-* Reconstruction/egamma +use AtlasHepMC AtlasHepMC-* External apply_tag ROOTBasicLibs apply_tag ROOTGraphicsLibs @@ -28,7 +40,7 @@ apply_tag ROOTMathLibs # Specify the required ROOT components for cmake (transparent to CMT) apply_pattern cmake_add_command command="find_package(ROOT COMPONENTS Matrix)" -apply_pattern dual_use_library files="AbsShape.cxx CaloId.cxx CellInfo.cxx ClassCounts.cxx DataContainer.cxx DataStore.cxx Definitions.cxx EventData.cxx Geometry.cxx HistoryContainer.cxx LArShapeDumper.cxx LArShapeDumperTool.cxx LArSimpleShapeDumper.cxx PersistentAccessor.cxx RunData.cxx ShapeInfo.cxx SimpleShape.cxx " +apply_pattern dual_use_library files="AbsShape.cxx CaloId.cxx CellInfo.cxx ClassCounts.cxx DataContainer.cxx DataStore.cxx Definitions.cxx EventData.cxx Geometry.cxx HistoryContainer.cxx LArShapeDumper.cxx LArShapeDumperTool.cxx LArSimpleShapeDumper.cxx PersistentAccessor.cxx RunData.cxx ShapeInfo.cxx SimpleShape.cxx LArNoiseBursts.cxx LArHECNoise.cxx" @@ -41,18 +53,22 @@ apply_pattern declare_scripts files="LArHistMerge_trf.py" private use AtlasReflex AtlasReflex-* External -no_auto_imports -use CaloDetDescr CaloDetDescr-* Calorimeter use DataQualityUtils DataQualityUtils-* DataQuality -use Identifier Identifier-* DetectorDescription -use LArRecConditions LArRecConditions-* LArCalorimeter use TrigT1Result TrigT1Result-* Trigger/TrigT1 use AtlasBoost AtlasBoost-* External -use CaloInterface CaloInterface-* Calorimeter use xAODEventInfo xAODEventInfo-* Event/xAOD use LArElecCalib LArElecCalib-* LArCalorimeter use TrigConfHLTData TrigConfHLTData-* Trigger/TrigConfiguration +use LArCondUtils LArCondUtils-* LArCalorimeter +use CaloEvent CaloEvent-* Calorimeter +use AthenaPoolUtilities AthenaPoolUtilities-* Database/AthenaPOOL +use LArHV LArHV-* LArCalorimeter/LArGeoModel +use LArReadoutGeometry LArReadoutGeometry-* LArCalorimeter/LArGeoModel +use LArRecEvent LArRecEvent-* LArCalorimeter/LArRecEvent +use NavFourMom NavFourMom-* Event + # for dbg #private #macro cppdebugflags '$(cppdebugflags_s)' @@ -67,5 +83,5 @@ macro_append LArQuickHistMerge_dependencies " LArCafJobsLib" application LArSamplesMerge ../src/LArSamplesMerge.cxx macro_append LArSamplesMerge_dependencies " LArCafJobsLib" -apply_pattern declare_jobtransforms trfs='../share/LArCAF_tf.py ../share/LArMerge_trf.py' jo='skeleton.LArCAF.py' +apply_pattern declare_jobtransforms trfs='../share/LArNoiseBursts_tf.py ../share/LArCAF_tf.py ../share/LArMerge_trf.py' jo='skeleton.LArCAF.py' diff --git a/LArCalorimeter/LArCafJobs/python/GetLBsToIgnore.py b/LArCalorimeter/LArCafJobs/python/GetLBsToIgnore.py index afcec799b022e3c296560adc8ac208c1acf17d13..d5216ef4195445e6fc9d1d5401447eaec33faf2e 100644 --- a/LArCalorimeter/LArCafJobs/python/GetLBsToIgnore.py +++ b/LArCalorimeter/LArCafJobs/python/GetLBsToIgnore.py @@ -110,7 +110,7 @@ def getLBsToIgnore(runnum,burstsFromCosmic=True,bulkProcessing=False, dropNonRea multicall = xmlrpclib.MultiCall(server) run_spec = {'source': source, 'high_run': runnum, 'stream': stream, 'proc_ver': proc, 'low_run': runnum} - multicall.get_dqmf_all_results(run_spec,'LAr/LAR_GLOBAL/Collisions/LArCollTimeLumiBlockTimeCut') + multicall.get_dqmf_all_results(run_spec,'LAr/LAR_GLOBAL/Collisions-Bkg/LArCollTimeLumiBlockTimeCut') results = multicall() RE = re.compile(r'\((?P<lb>\S+)\.0*\)') @@ -134,12 +134,14 @@ def getLBsToIgnore(runnum,burstsFromCosmic=True,bulkProcessing=False, dropNonRea histoName = {'EMBC':'BarrelC','EMBA':'BarrelA','EMECC':'EMECC','EMECA':'EMECA'} for iPart in histoName.keys(): multicall = xmlrpclib.MultiCall(server) - multicall.get_dqmf_all_results(run_spec,'LAr/%s/Noise/Partition/NoisyEvent_TimeVeto_%s'%(iPart,histoName[iPart])) + #multicall.get_dqmf_all_results(run_spec,'LAr/%s/Noise/Partition/NoisyEvent_TimeVeto_%s'%(iPart,histoName[iPart])) + multicall.get_dqmf_all_results(run_spec,'/LAr/%s/Occupancy-Noise/Noise_Burst/NoisyEvent_TimeVeto_%s'%(iPart,iPart)) + results = multicall() try: - list = results[0][str(runnum)] + resultlist = results[0][str(runnum)] #print "Got %i items for NoisyEvent_TimeVeto_%s" % (len(list),histoName[iPart]) - for item in list: + for item in resultlist: if 'NBins' in item: continue m = RE.search(item).groupdict() lb=int(m['lb']) diff --git a/LArCalorimeter/LArCafJobs/python/LArCafJobsConfig.py b/LArCalorimeter/LArCafJobs/python/LArCafJobsConfig.py index b0a5ea5e0b03cb5f8331d5b4aa63bfddf929507d..ae9548c90ef64bed4aa4483cdc01c288e0cf7ddf 100644 --- a/LArCalorimeter/LArCafJobs/python/LArCafJobsConfig.py +++ b/LArCalorimeter/LArCafJobs/python/LArCafJobsConfig.py @@ -27,8 +27,8 @@ class DefaultShapeDumperTool(LArShapeDumperTool) : #Run 1 version: #conddb.addFolder('LAR_OFL', '/LAR/ElecCalibOfl/Shape/RTM/5samples3bins17phases<tag>LARElecCalibOflShapeRTM5samples3bins17phases-RUN2-UPD3-00</tag><key>LArShape5samples3bins17phases</key>') - if (nSamples==5): - conddb.addFolder('LAR_OFL', '/LAR/ElecCalibOfl/Shape/RTM/5samples3bins17phases<tag>LARElecCalibOflShapeRTM5samples3bins17phases-UPD3-00</tag><key>LArShape17phases</key>') + if (nSamples>=5): + conddb.addFolder('LAR_OFL', '/LAR/ElecCalibOfl/Shape/RTM/5samples3bins17phases<tag>LARElecCalibOflShapeRTM5samples3bins17phases-RUN2-UPD3-00</tag><key>LArShape17phases</key>') elif (nSamples==4): conddb.addFolder('LAR_OFL', '/LAR/ElecCalibOfl/Shape/RTM/4samples3bins17phases<tag>LARElecCalibOflShapeRTM4samples3bins17phases-RUN2-UPD3-00</tag><key>LArShape17phases</key>') else: diff --git a/LArCalorimeter/LArCafJobs/python/LArCafJobsFlags.py b/LArCalorimeter/LArCafJobs/python/LArCafJobsFlags.py new file mode 100644 index 0000000000000000000000000000000000000000..9157c32e26a0b9c14aa1de44ce8c403bc3864676 --- /dev/null +++ b/LArCalorimeter/LArCafJobs/python/LArCafJobsFlags.py @@ -0,0 +1,20 @@ +# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + +from AthenaCommon.JobProperties import JobProperty, JobPropertyContainer +from AthenaCommon.JobProperties import jobproperties + +class outputFile(JobProperty): + statusOn = False + allowedTypes = ['str'] + StoredValue = "LArNoiseBurst.root" + pass + + +class LArNoiseBurstFlags(JobPropertyContainer): + pass + +jobproperties.add_Container(LArNoiseBurstFlags) + +jobproperties.LArNoiseBurstFlags.add_JobProperty(outputFile) + +larNoiseBurstFlags=jobproperties.LArNoiseBurstFlags diff --git a/LArCalorimeter/LArCafJobs/share/LArCAF_tf.py b/LArCalorimeter/LArCafJobs/share/LArCAF_tf.py index 219c2326e525a8e5573d500ec04936397b0d79f0..932ae66b57e727e8ab7a2ae98089cc2e9c93f59d 100755 --- a/LArCalorimeter/LArCafJobs/share/LArCAF_tf.py +++ b/LArCalorimeter/LArCafJobs/share/LArCAF_tf.py @@ -12,7 +12,7 @@ if __name__ == '__main__': executorSet = set() executorSet.add(athenaExecutor(name = 'LArCAFcalib', skeletonFile = 'LArCafJobs/skeleton.LArCAF.py', - substep = 'r2e', inData = ['BS',], outData = ['NTUP_SAMPLESMON'])) + substep = 'r2e', inData = ['BS',], outData = ['NTUP_SAMPLESMON','NTUP_HECNOISE'])) trf = transform(executor = executorSet) addAthenaArguments(trf.parser) @@ -25,6 +25,10 @@ if __name__ == '__main__': type=trfArgClasses.argFactory(trfArgClasses.argNTUPFile, io='output', treeNames="events"), help='Output LAr Samples Mon file', group='Ntuple Files') + trf.parser.add_argument('--outputNTUP_HECNOISEFile', nargs='+', + type=trfArgClasses.argFactory(trfArgClasses.argNTUPFile, io='output'), + help='Output HECNoise file', group='Ntuple Files') + trf.parseCmdLineArgs(sys.argv[1:]) trf.execute() trf.generateReport() diff --git a/LArCalorimeter/LArCafJobs/share/LArMerge_trf.py b/LArCalorimeter/LArCafJobs/share/LArMerge_trf.py index a9aca13a25b7f8db03607f7e6d00002cac2760da..1d129592bce57e94198797198a5b5eefe96f3ff2 100755 --- a/LArCalorimeter/LArCafJobs/share/LArMerge_trf.py +++ b/LArCalorimeter/LArCafJobs/share/LArMerge_trf.py @@ -2,15 +2,16 @@ ######################################################################### ## -## Tier-0 TAG file merging transformation +## Tier-0 LAr SamplesMon file merging transformation +## Adapted from TAG merging one ## ## - input parameter: file containing a pickled dictionary consisting of the key/value pairs -## 1) 'inputTagFiles': python list ['datasetname#filename1','datasetname#filename2',...] +## 1) 'inputLArFiles': python list ['datasetname#filename1','datasetname#filename2',...] ## (input dataset + file names) -## 2) 'outputTagFile': string 'datasetname#filename' +## 2) 'outputLArFile': string 'datasetname#filename' ## (output dataset name + file) ## -## - generates merged TAG output file +## - generates merged NTUP_SAMPLESMON output file ## ## (C) Jack Cranshaw, Luc Goossens, David Malon, Armin Nairz, Nicolas Berger ## (July 2008, April 2009, July 2010, May 2011) @@ -154,47 +155,6 @@ def larMerge(dataMap) : if __name__ == "__main__": - #inputs = { - #'inputLArFiles': ['data11_hi.00193558.calibration_LArCellsEmpty.recon.NTUP_SAMPLESMON.c784#data11_hi.00193558.calibration_LArCellsEmpty.recon.NTUP_SAMPLESMON.c784._lb0000._SFO-10._0001.1', - #'data11_hi.00193558.calibration_LArCellsEmpty.recon.NTUP_SAMPLESMON.c784#data11_hi.00193558.calibration_LArCellsEmpty.recon.NTUP_SAMPLESMON.c784._lb0000._SFO-10._0002.1', - #'data11_hi.00193558.calibration_LArCellsEmpty.recon.NTUP_SAMPLESMON.c784#data11_hi.00193558.calibration_LArCellsEmpty.recon.NTUP_SAMPLESMON.c784._lb0000._SFO-10._0003.1', - #'data11_hi.00193558.calibration_LArCellsEmpty.recon.NTUP_SAMPLESMON.c784#data11_hi.00193558.calibration_LArCellsEmpty.recon.NTUP_SAMPLESMON.c784._lb0000._SFO-10._0004.1', - #'data11_hi.00193558.calibration_LArCellsEmpty.recon.NTUP_SAMPLESMON.c784#data11_hi.00193558.calibration_LArCellsEmpty.recon.NTUP_SAMPLESMON.c784._lb0000._SFO-10._0005.1', - #'data11_hi.00193558.calibration_LArCellsEmpty.recon.NTUP_SAMPLESMON.c784#data11_hi.00193558.calibration_LArCellsEmpty.recon.NTUP_SAMPLESMON.c784._lb0000._SFO-10._0006.1', - #'data11_hi.00193558.calibration_LArCellsEmpty.recon.NTUP_SAMPLESMON.c784#data11_hi.00193558.calibration_LArCellsEmpty.recon.NTUP_SAMPLESMON.c784._lb0000._SFO-10._0007.1', - #'data11_hi.00193558.calibration_LArCellsEmpty.recon.NTUP_SAMPLESMON.c784#data11_hi.00193558.calibration_LArCellsEmpty.recon.NTUP_SAMPLESMON.c784._lb0000._SFO-11._0001.1', - #'data11_hi.00193558.calibration_LArCellsEmpty.recon.NTUP_SAMPLESMON.c784#data11_hi.00193558.calibration_LArCellsEmpty.recon.NTUP_SAMPLESMON.c784._lb0000._SFO-11._0002.1', - #'data11_hi.00193558.calibration_LArCellsEmpty.recon.NTUP_SAMPLESMON.c784#data11_hi.00193558.calibration_LArCellsEmpty.recon.NTUP_SAMPLESMON.c784._lb0000._SFO-11._0003.1', - #'data11_hi.00193558.calibration_LArCellsEmpty.recon.NTUP_SAMPLESMON.c784#data11_hi.00193558.calibration_LArCellsEmpty.recon.NTUP_SAMPLESMON.c784._lb0000._SFO-11._0004.1', - #'data11_hi.00193558.calibration_LArCellsEmpty.recon.NTUP_SAMPLESMON.c784#data11_hi.00193558.calibration_LArCellsEmpty.recon.NTUP_SAMPLESMON.c784._lb0000._SFO-11._0005.1', - #'data11_hi.00193558.calibration_LArCellsEmpty.recon.NTUP_SAMPLESMON.c784#data11_hi.00193558.calibration_LArCellsEmpty.recon.NTUP_SAMPLESMON.c784._lb0000._SFO-11._0006.1', - #'data11_hi.00193558.calibration_LArCellsEmpty.recon.NTUP_SAMPLESMON.c784#data11_hi.00193558.calibration_LArCellsEmpty.recon.NTUP_SAMPLESMON.c784._lb0000._SFO-11._0007.1', - #'data11_hi.00193558.calibration_LArCellsEmpty.recon.NTUP_SAMPLESMON.c784#data11_hi.00193558.calibration_LArCellsEmpty.recon.NTUP_SAMPLESMON.c784._lb0000._SFO-12._0001.1', - #'data11_hi.00193558.calibration_LArCellsEmpty.recon.NTUP_SAMPLESMON.c784#data11_hi.00193558.calibration_LArCellsEmpty.recon.NTUP_SAMPLESMON.c784._lb0000._SFO-12._0002.1', - #'data11_hi.00193558.calibration_LArCellsEmpty.recon.NTUP_SAMPLESMON.c784#data11_hi.00193558.calibration_LArCellsEmpty.recon.NTUP_SAMPLESMON.c784._lb0000._SFO-12._0003.1', - #'data11_hi.00193558.calibration_LArCellsEmpty.recon.NTUP_SAMPLESMON.c784#data11_hi.00193558.calibration_LArCellsEmpty.recon.NTUP_SAMPLESMON.c784._lb0000._SFO-12._0004.1', - #'data11_hi.00193558.calibration_LArCellsEmpty.recon.NTUP_SAMPLESMON.c784#data11_hi.00193558.calibration_LArCellsEmpty.recon.NTUP_SAMPLESMON.c784._lb0000._SFO-12._0005.1', - #'data11_hi.00193558.calibration_LArCellsEmpty.recon.NTUP_SAMPLESMON.c784#data11_hi.00193558.calibration_LArCellsEmpty.recon.NTUP_SAMPLESMON.c784._lb0000._SFO-12._0006.1', - #'data11_hi.00193558.calibration_LArCellsEmpty.recon.NTUP_SAMPLESMON.c784#data11_hi.00193558.calibration_LArCellsEmpty.recon.NTUP_SAMPLESMON.c784._lb0000._SFO-12._0007.1', - #'data11_hi.00193558.calibration_LArCellsEmpty.recon.NTUP_SAMPLESMON.c784#data11_hi.00193558.calibration_LArCellsEmpty.recon.NTUP_SAMPLESMON.c784._lb0000._SFO-4._0001.1', - #'data11_hi.00193558.calibration_LArCellsEmpty.recon.NTUP_SAMPLESMON.c784#data11_hi.00193558.calibration_LArCellsEmpty.recon.NTUP_SAMPLESMON.c784._lb0000._SFO-4._0002.1', - #'data11_hi.00193558.calibration_LArCellsEmpty.recon.NTUP_SAMPLESMON.c784#data11_hi.00193558.calibration_LArCellsEmpty.recon.NTUP_SAMPLESMON.c784._lb0000._SFO-4._0003.1', - #'data11_hi.00193558.calibration_LArCellsEmpty.recon.NTUP_SAMPLESMON.c784#data11_hi.00193558.calibration_LArCellsEmpty.recon.NTUP_SAMPLESMON.c784._lb0000._SFO-4._0004.1', - #'data11_hi.00193558.calibration_LArCellsEmpty.recon.NTUP_SAMPLESMON.c784#data11_hi.00193558.calibration_LArCellsEmpty.recon.NTUP_SAMPLESMON.c784._lb0000._SFO-4._0005.1', - #'data11_hi.00193558.calibration_LArCellsEmpty.recon.NTUP_SAMPLESMON.c784#data11_hi.00193558.calibration_LArCellsEmpty.recon.NTUP_SAMPLESMON.c784._lb0000._SFO-4._0006.1', - #'data11_hi.00193558.calibration_LArCellsEmpty.recon.NTUP_SAMPLESMON.c784#data11_hi.00193558.calibration_LArCellsEmpty.recon.NTUP_SAMPLESMON.c784._lb0000._SFO-4._0007.1', - #'data11_hi.00193558.calibration_LArCellsEmpty.recon.NTUP_SAMPLESMON.c784#data11_hi.00193558.calibration_LArCellsEmpty.recon.NTUP_SAMPLESMON.c784._lb0000._SFO-9._0001.1', - #'data11_hi.00193558.calibration_LArCellsEmpty.recon.NTUP_SAMPLESMON.c784#data11_hi.00193558.calibration_LArCellsEmpty.recon.NTUP_SAMPLESMON.c784._lb0000._SFO-9._0002.1', - #'data11_hi.00193558.calibration_LArCellsEmpty.recon.NTUP_SAMPLESMON.c784#data11_hi.00193558.calibration_LArCellsEmpty.recon.NTUP_SAMPLESMON.c784._lb0000._SFO-9._0003.1', - #'data11_hi.00193558.calibration_LArCellsEmpty.recon.NTUP_SAMPLESMON.c784#data11_hi.00193558.calibration_LArCellsEmpty.recon.NTUP_SAMPLESMON.c784._lb0000._SFO-9._0004.1', - #'data11_hi.00193558.calibration_LArCellsEmpty.recon.NTUP_SAMPLESMON.c784#data11_hi.00193558.calibration_LArCellsEmpty.recon.NTUP_SAMPLESMON.c784._lb0000._SFO-9._0005.1', - #'data11_hi.00193558.calibration_LArCellsEmpty.recon.NTUP_SAMPLESMON.c784#data11_hi.00193558.calibration_LArCellsEmpty.recon.NTUP_SAMPLESMON.c784._lb0000._SFO-9._0006.1', - #'data11_hi.00193558.calibration_LArCellsEmpty.recon.NTUP_SAMPLESMON.c784#data11_hi.00193558.calibration_LArCellsEmpty.recon.NTUP_SAMPLESMON.c784._lb0000._SFO-9._0007.1'], - #'outputLArFile': 'data11_hi.00193558.calibration_LArCellsEmpty.merge.NTUP_SAMPLESMON.c784_c785#data11_hi.00193558.calibration_LArCellsEmpty.merge.NTUP_SAMPLESMON.c784_c785._0001'} - - #larMerge(inputs) - #exit(0) - if len(sys.argv) == 2 and sys.argv[1].startswith('--argdict=') : picklefile = sys.argv[1][len('--argdict='):] # extract parameters from pickle file diff --git a/LArCalorimeter/LArCafJobs/share/LArNoiseBursts_prodJO.py b/LArCalorimeter/LArCafJobs/share/LArNoiseBursts_prodJO.py new file mode 100644 index 0000000000000000000000000000000000000000..1e4a9996ea2a2fd0371be973929c5d7fb548fce9 --- /dev/null +++ b/LArCalorimeter/LArCafJobs/share/LArNoiseBursts_prodJO.py @@ -0,0 +1,133 @@ +import os + +from AthenaCommon.AthenaCommonFlags import athenaCommonFlags + +# etse a handle on the ServiceManager which holds all the services +from AthenaCommon.AppMgr import (theApp, ServiceMgr as svcMgr,ToolSvc) + +# Event selector +import AthenaPoolCnvSvc.ReadAthenaPool + +# Particle Properties +from PartPropSvc.PartPropSvcConf import PartPropSvc + +from AthenaServices.AthenaServicesConf import AthenaEventLoopMgr +AthenaEventLoopMgr.OutputLevel = WARNING + +from RecExConfig.RecFlags import rec +rec.readRDO.set_Value_and_Lock(False) +rec.readTAG.set_Value_and_Lock(False) +rec.readESD.set_Value_and_Lock(True) +rec.readAOD.set_Value_and_Lock(False) +rec.doWriteESD.set_Value_and_Lock(False) +rec.doWriteAOD.set_Value_and_Lock(False) +rec.doWriteTAG.set_Value_and_Lock(False) +rec.doHist.set_Value_and_Lock(False) +rec.doCBNT.set_Value_and_Lock(False) +rec.doAOD.set_Value_and_Lock(False) +rec.doTrigger.set_Value_and_Lock(False) +rec.doPerfMon.set_Value_and_Lock(False) +rec.doDPD.set_Value_and_Lock(False) + +include ("RecExCommon/RecExCommon_topOptions.py") + +from LArCellRec.LArNoisyROSummaryGetter import LArNoisyROSummaryGetter +LArNoisyROSummaryGetter.ignoreExistingDataObject = lambda x: True +LArNoisyROSummaryGetter() +#topSequence.LArNoisyROAlg.BadFEBCut = 2000 +#topSequence.LArNoisyROAlg.SaturatedCellQualityCut = 111165535 + +from AthenaCommon.AppMgr import (theApp, ServiceMgr as svcMgr,ToolSvc) + +#Necessary DLL's +theApp.Dlls += [ "LArRawUtils","LArROD", "LArTools"] +theApp.Dlls += [ "LArByteStream"] + +# set up trigger configuration service +from TriggerJobOpts.TriggerConfigGetter import TriggerConfigGetter +cfg = TriggerConfigGetter("ReadPool") + +## set up trigger decision tool +from TrigDecisionTool.TrigDecisionToolConf import Trig__TrigDecisionTool +ToolSvc += Trig__TrigDecisionTool( "TrigDecisionTool" ) + +# --- CaloNoiseTool configuration --- +from CaloTools.CaloNoiseToolDefault import CaloNoiseToolDefault +theCaloNoiseTool = CaloNoiseToolDefault() +ToolSvc += theCaloNoiseTool + +# --- BunchCrossing Tool configuration --- +from TrigBunchCrossingTool.BunchCrossingTool import BunchCrossingTool +theBCTool = BunchCrossingTool() +ToolSvc += theBCTool + +# --- SCTClusteringTool configuration --- +from SiClusterizationTool.SiClusterizationToolConf import InDet__SCT_ClusteringTool +InDetSCT_ClusteringTool = InDet__SCT_ClusteringTool() +ToolSvc += InDetSCT_ClusteringTool + + +include ( "ParticleBuilderOptions/ESD_PoolCnv_jobOptions.py" ) +include ( "ParticleBuilderOptions/AOD_PoolCnv_jobOptions.py" ) +include ( "ParticleBuilderOptions/McAOD_PoolCnv_jobOptions.py" ) +include ( "EventAthenaPool/EventAthenaPool_joboptions.py" ) + +# Athena-Aware NTuple making Tools +CBNTAthenaAware = False + +################################ LArTimeAlg########################################### +#David Cote: added include block to avoid duplication ERROR when TAG_COMM and DESDs are executed in the same job (both including this fragment). +include.block("LArCellRec/LArCollisionTime_jobOptions.py") + +from LArCellRec.LArCellRecConf import LArCollisionTimeAlg +topSequence += LArCollisionTimeAlg("LArCollisionTimeAlg") +topSequence.LArCollisionTimeAlg.NoiseTool = theCaloNoiseTool + +from AthenaCommon.GlobalFlags import globalflags +if globalflags.DataSource()=='data' : + topSequence.LArCollisionTimeAlg.isMC = False +else : + topSequence.LArCollisionTimeAlg.isMC = True + +# dont require anymore explicitely that the time iteration converges +topSequence.LArCollisionTimeAlg.cutIteration = False +topSequence.LArCollisionTimeAlg.OutputLevel = INFO +################################################################### + +if not 'IS_SIMULATION' in inputFileSummary['evt_type']: + + from IOVDbSvc.CondDB import conddb + + if not conddb.folderRequested('/TDAQ/RunCtrl/DataTakingMode'): + conddb.addFolder('TDAQ', '/TDAQ/RunCtrl/DataTakingMode') + if not conddb.folderRequested('/TDAQ/OLC/LHC/FILLPARAMS'): + conddb.addFolder('TDAQ', '/TDAQ/OLC/LHC/FILLPARAMS') + if not conddb.folderRequested('/LHC/DCS/FILLSTATE'): + conddb.addFolder('DCS_OFL', '/LHC/DCS/FILLSTATE') + + +from SiSpacePointTool.SiSpacePointToolConf import InDet__SiSpacePointMakerTool +InDetSiSpacePointMakerTool = InDet__SiSpacePointMakerTool(name = "InDetSiSpacePointMakerTool") +ToolSvc+=InDetSiSpacePointMakerTool + +from SiSpacePointFormation.SiSpacePointFormationConf import InDet__SiTrackerSpacePointFinder +InDetSiTrackerSpacePointFinder = InDet__SiTrackerSpacePointFinder(name = "InDetSiTrackerSpacePointFinder") +topSequence += InDetSiTrackerSpacePointFinder + + +from LArCafJobs.LArCafJobsConf import LArNoiseBursts +topSequence += LArNoiseBursts( "LArNoiseBursts" ) +topSequence.LArNoiseBursts.ICaloNoiseTool = theCaloNoiseTool +topSequence.LArNoiseBursts.BCTool = theBCTool +topSequence.LArNoiseBursts.SCTClusteringTool = InDetSCT_ClusteringTool +topSequence.LArNoiseBursts.SigmaCut = 3.0 +topSequence.LArNoiseBursts.MBTSCellChargeThreshold = 44./222. +topSequence.LArNoiseBursts.NumberOfBunchesInFront = 30 +topSequence.LArNoiseBursts.OutputLevel = DEBUG + +prodFlags = jobproperties.LArNoiseBurstFlags + +from GaudiSvc.GaudiSvcConf import THistSvc +svcMgr += THistSvc() +svcMgr.THistSvc.Output = ["TTREE DATAFILE='"+prodFlags.outputFile()+"' OPT='RECREATE'"] + diff --git a/LArCalorimeter/LArCafJobs/share/LArNoiseBursts_tf.py b/LArCalorimeter/LArCafJobs/share/LArNoiseBursts_tf.py new file mode 100755 index 0000000000000000000000000000000000000000..087b224bbb32f55d211a5eb2b657e5479ed46b6f --- /dev/null +++ b/LArCalorimeter/LArCafJobs/share/LArNoiseBursts_tf.py @@ -0,0 +1,40 @@ +#!/usr/bin/env python +__doc__ = """JobTransform to run LAr Noise Burst jobs""" + + +import sys +from PyJobTransforms.transform import transform +from PyJobTransforms.trfExe import athenaExecutor +from PyJobTransforms.trfArgs import addAthenaArguments, addDetectorArguments +import PyJobTransforms.trfArgClasses as trfArgClasses + +if __name__ == '__main__': + + executorSet = set() + executorSet.add(athenaExecutor(name = 'LArNoiseBursts', skeletonFile = 'LArCafJobs/skeleton.LArNoise.py', + substep = 'e2a', inData = ['ESD',], outData = ['NTUP_LARNOISE','NTUP_HECNOISE'])) + + trf = transform(executor = executorSet) + addAthenaArguments(trf.parser) + addDetectorArguments(trf.parser) + trf.parser.add_argument('--inputESDFile', nargs='+', + type=trfArgClasses.argFactory(trfArgClasses.argPOOLFile, io='input'), + help='Input pool file', group='Reco Files') + + trf.parser.add_argument('--outputNTUP_LARNOISEFile', nargs='+', + type=trfArgClasses.argFactory(trfArgClasses.argNTUPFile, io='output'), + help='Output LAr Noise Burst file', group='Ntuple Files') + + trf.parser.add_argument('--outputNTUP_HECNOISEFile', nargs='+', + type=trfArgClasses.argFactory(trfArgClasses.argNTUPFile, io='output'), + help='Output HECNoise file', group='Ntuple Files') + + trf.parseCmdLineArgs(sys.argv[1:]) + + + trf.execute() + print "DataDict:" + print trf.dataDictionary + + + trf.generateReport() diff --git a/LArCalorimeter/LArCafJobs/share/LArNoiseBursts_topOptions.py b/LArCalorimeter/LArCafJobs/share/LArNoiseBursts_topOptions.py new file mode 100644 index 0000000000000000000000000000000000000000..af9ec45bb8bebc39ae51f1f91ae11f90141d0c85 --- /dev/null +++ b/LArCalorimeter/LArCafJobs/share/LArNoiseBursts_topOptions.py @@ -0,0 +1,132 @@ +import os + +from AthenaCommon.AthenaCommonFlags import athenaCommonFlags + +# etse a handle on the ServiceManager which holds all the services +from AthenaCommon.AppMgr import (theApp, ServiceMgr as svcMgr,ToolSvc) + +# Event selector +import AthenaPoolCnvSvc.ReadAthenaPool + +# Particle Properties +from PartPropSvc.PartPropSvcConf import PartPropSvc + +from AthenaServices.AthenaServicesConf import AthenaEventLoopMgr +AthenaEventLoopMgr.OutputLevel = WARNING + +from PyJobTransformsCore.runargs import RunArguments +runArgs = RunArguments() +runArgs.inputESDFile = [ +"rfio:/castor/cern.ch/grid/atlas/tzero/prod1/perm/data14_cos/physics_CosmicCalo/00247390/data14_cos.00247390.physics_CosmicCalo.recon.ESD.x289/data14_cos.00247390.physics_CosmicCalo.recon.ESD.x289._lb0084._SFO-ALL._0001.1" +] + +athenaCommonFlags.FilesInput.set_Value_and_Lock( runArgs.inputESDFile ) + +athenaCommonFlags.EvtMax.set_Value_and_Lock(-1) + +from RecExConfig.RecFlags import rec +rec.readRDO.set_Value_and_Lock(False) +rec.readTAG.set_Value_and_Lock(False) +rec.readESD.set_Value_and_Lock(True) +rec.readAOD.set_Value_and_Lock(False) +rec.doWriteESD.set_Value_and_Lock(False) +rec.doWriteAOD.set_Value_and_Lock(False) +rec.doWriteTAG.set_Value_and_Lock(False) +rec.doHist.set_Value_and_Lock(False) +rec.doCBNT.set_Value_and_Lock(False) +rec.doAOD.set_Value_and_Lock(False) +rec.doTrigger.set_Value_and_Lock(False) +rec.doPerfMon.set_Value_and_Lock(False) +rec.doDPD.set_Value_and_Lock(False) + +include ("RecExCommon/RecExCommon_topOptions.py") + +# 11/2014 : 3 lines below commented by B.Trocme to avoid crash with 19.1.3.7 +# ("duplicated object"). Not sure if LArNoisyRO_Std/SatTight are properly +# computed in a different place. +#from LArCellRec.LArNoisyROSummaryGetter import LArNoisyROSummaryGetter +#LArNoisyROSummaryGetter.ignoreExistingDataObject = lambda x: True +#LArNoisyROSummaryGetter() +# End of B.Trocme 11/2014 modification +#topSequence.LArNoisyROAlg.BadFEBCut = 2000 +#topSequence.LArNoisyROAlg.SaturatedCellQualityCut = 111165535 + +from AthenaCommon.AppMgr import (theApp, ServiceMgr as svcMgr,ToolSvc) + +#Necessary DLL's +theApp.Dlls += [ "LArRawUtils","LArROD", "LArTools"] +theApp.Dlls += [ "LArByteStream"] + +# set up trigger configuration service +from TriggerJobOpts.TriggerConfigGetter import TriggerConfigGetter +cfg = TriggerConfigGetter("ReadPool") + +## set up trigger decision tool +from TrigDecisionTool.TrigDecisionToolConf import Trig__TrigDecisionTool +ToolSvc += Trig__TrigDecisionTool( "TrigDecisionTool" ) + +# --- CaloNoiseTool configuration --- +from CaloTools.CaloNoiseToolDefault import CaloNoiseToolDefault +theCaloNoiseTool = CaloNoiseToolDefault() +ToolSvc += theCaloNoiseTool + +# --- BunchCrossing Tool configuration --- +from TrigBunchCrossingTool.BunchCrossingTool import BunchCrossingTool +theBCTool = BunchCrossingTool() +ToolSvc += theBCTool + +include ( "ParticleBuilderOptions/ESD_PoolCnv_jobOptions.py" ) +include ( "ParticleBuilderOptions/AOD_PoolCnv_jobOptions.py" ) +include ( "ParticleBuilderOptions/McAOD_PoolCnv_jobOptions.py" ) +include ( "EventAthenaPool/EventAthenaPool_joboptions.py" ) + +# Athena-Aware NTuple making Tools +CBNTAthenaAware = False + +################################ LArTimeAlg########################################### +#David Cote: added include block to avoid duplication ERROR when TAG_COMM and DESDs are executed in the same job (both including this fragment). +include.block("LArCellRec/LArCollisionTime_jobOptions.py") + +from LArCellRec.LArCellRecConf import LArCollisionTimeAlg +topSequence += LArCollisionTimeAlg("LArCollisionTimeAlg") +topSequence.LArCollisionTimeAlg.NoiseTool = theCaloNoiseTool + +from AthenaCommon.GlobalFlags import globalflags +if globalflags.DataSource()=='data' : + topSequence.LArCollisionTimeAlg.isMC = False +else : + topSequence.LArCollisionTimeAlg.isMC = True + +# dont require anymore explicitely that the time iteration converges +topSequence.LArCollisionTimeAlg.cutIteration = False +topSequence.LArCollisionTimeAlg.OutputLevel = INFO +################################################################### + +if not 'IS_SIMULATION' in inputFileSummary['evt_type']: + + from IOVDbSvc.CondDB import conddb + +# 11/2014 : 6 lines below commented by B.Trocme to avoid crash when +# running on cosmic (w/o LHC beam). One should implement a more clever +# way to test if LHC parameters are available of not. +# if not conddb.folderRequested('/TDAQ/RunCtrl/DataTakingMode'): +# conddb.addFolder('TDAQ', '/TDAQ/RunCtrl/DataTakingMode') +# if not conddb.folderRequested('/TDAQ/OLC/LHC/FILLPARAMS'): +# conddb.addFolder('TDAQ', '/TDAQ/OLC/LHC/FILLPARAMS') +# if not conddb.folderRequested('/LHC/DCS/FILLSTATE'): +# conddb.addFolder('DCS_OFL', '/LHC/DCS/FILLSTATE') +# End of B.Trocme 11/2014 modification + + +from LArCafJobs.LArCafJobsConf import LArNoiseBursts +topSequence += LArNoiseBursts( "LArNoiseBursts" ) +topSequence.LArNoiseBursts.ICaloNoiseTool = theCaloNoiseTool +topSequence.LArNoiseBursts.BCTool = theBCTool +topSequence.LArNoiseBursts.SigmaCut = 3.0 +topSequence.LArNoiseBursts.NumberOfBunchesInFront = 30 +topSequence.LArNoiseBursts.OutputLevel = INFO + +from GaudiSvc.GaudiSvcConf import THistSvc +svcMgr += THistSvc() +svcMgr.THistSvc.Output = ["TTREE DATAFILE='LArNoiseBursts_TTree.root' OPT='RECREATE'"] + diff --git a/LArCalorimeter/LArCafJobs/share/UploadAMITag.larcaf.py b/LArCalorimeter/LArCafJobs/share/UploadAMITag.larcaf.py index 09609610037fa3cccc527c8a063f16dd27379a58..a3025bad7519d3149c4534ee4b854f172b4f648e 100755 --- a/LArCalorimeter/LArCafJobs/share/UploadAMITag.larcaf.py +++ b/LArCalorimeter/LArCafJobs/share/UploadAMITag.larcaf.py @@ -1,4 +1,8 @@ #!/usr/bin/env python + +#Exampel command: UploadAMITag.larcaf.py wlampl xxx create_c909 AtlasProduction_20.1.5.6 noisebursts + + import sys,pickle patcharea='/afs/cern.ch/user/l/larcomm/w0/digitMon/LArCAF' @@ -7,6 +11,25 @@ specialT0Setup='/afs/cern.ch/atlas/tzero/software/setup/specialsetup_tier0.sh' trfsetuppath='/afs/cern.ch/atlas/tzero/software/setup/' processConfigs = {} +processConfigs['noisebursts'] = { + 'inputs': { 'inputESDFile': {} }, + 'outputs': { 'outputNTUP_LARNOISEFile': {'dstype': 'NTUP_LARNOISE'}, }, + 'tasktransinfo': { 'trfpath': 'LArNoiseBursts_tf.py', + 'trfsetupcmd': setupScript+ ' '+patcharea+' RELEASE ' + specialT0Setup}, + 'phconfig': {}, + 'description': 'Produced LAr noise burst ntuple from ESD files. Uses RELEASE' + } + +processConfigs['noiseburstsmerge'] = { + 'inputs': { 'inputNTUP_LARNOISEFile': {} }, + 'outputs': { 'outputNTUP_LARNOISE_MRGFile': {'dstype': 'NTUP_LARNOISE_MRG'}, }, + 'tasktransinfo': { 'trfpath': 'NTUPMerge_tf.py', + 'trfsetupcmd': setupScript+ ' '+patcharea+' RELEASE ' + specialT0Setup}, + 'phconfig': {}, + 'description': 'Merge LAr noise burst ntuple files. Uses RELEASE' + } + + processConfigs['reco'] = { 'inputs': { 'inputBSFile': {} }, 'outputs': { 'outputNTUP_SAMPLESMONFile': {'dstype': 'NTUP_SAMPLESMON'}, }, @@ -104,7 +127,8 @@ if __name__ == '__main__': #------------------------ #Build final AMI tag info s={} #stable values - s['configTag']=amiTag + s['amiTag']=amiTag + s['tagType']=amiTag[0] s['AMIUser']=login s['AMIPass']=password @@ -112,7 +136,7 @@ if __name__ == '__main__': c['inputs']=str(processConfigs[process]['inputs'].__str__()) c['outputs']=str(processConfigs[process]['outputs'].__str__()) c['SWReleaseCache']=str(release) - if process=='reco': + if process=='reco' or process=='noisebursts': c['Geometry']='ATLAS-R2-2015-02-00-00' c['ConditionsTag']='CURRENT' else: #merging case @@ -127,7 +151,7 @@ if __name__ == '__main__': #Upload info to AMI if doWhat=="create": - l=['AddConfigurationTag'] + l=['AddAMITag'] for k in s.keys(): l.append(k+"=\""+s[k]+"\"") for k in c.keys(): @@ -145,7 +169,7 @@ if __name__ == '__main__': elif doWhat=="update": - l=['UpdateConfigurationTag'] + l=['UpdateAMITag'] for k in s.keys(): l.append(k+'='+s[k]) diff --git a/LArCalorimeter/LArCafJobs/share/skeleton.LArCAF.py b/LArCalorimeter/LArCafJobs/share/skeleton.LArCAF.py index 4eb860858206f146ea168d1104e4bb693412491d..0cd592815443493f7eac29d92541bb9454fc233f 100644 --- a/LArCalorimeter/LArCafJobs/share/skeleton.LArCAF.py +++ b/LArCalorimeter/LArCafJobs/share/skeleton.LArCAF.py @@ -29,11 +29,14 @@ globalflags.InputFormat.set_Value_and_Lock('bytestream') athenaCommonFlags.BSRDOInput.set_Value_and_Lock(runArgs.inputBSFile) from RecExConfig.RecFlags import rec -from RecExConfig.AutoConfiguration import GetProjectName +from RecExConfig.AutoConfiguration import GetProjectName,ConfigureTriggerStream rec.projectName=GetProjectName() rec.doWriteESD=False rec.doWriteAOD=False +ConfigureTriggerStream() +#print rec.triggerStream() + from AthenaCommon.JobProperties import jobproperties if hasattr(runArgs,'geometryVersion'): jobproperties.Global.DetDescrVersion = runArgs.geometryVersion @@ -52,7 +55,16 @@ DetFlags.LVL1_setOff() DetFlags.digitize.all_setOff() DetFlags.Print() - +if hasattr(runArgs,"preExec"): + recoLog.info("transform pre-exec") + for cmd in runArgs.preExec: + recoLog.info(cmd) + exec(cmd) + + ## Pre-include +if hasattr(runArgs,"preInclude"): + for fragment in runArgs.preInclude: + include(fragment) #from RecExConfig.RecFlags import rec @@ -103,6 +115,9 @@ theByteStreamAddressProviderSvc = svcMgr.ByteStreamAddressProviderSvc theByteStreamAddressProviderSvc.TypeNames += ["LArDigitContainer/FREE"] theByteStreamAddressProviderSvc.TypeNames += ["LArFebHeaderContainer/LArFebHeader"] +from xAODEventInfoCnv.xAODEventInfoCreator import xAODMaker__EventInfoCnvAlg +topSequence+=xAODMaker__EventInfoCnvAlg() + include("LArROD/LArFebErrorSummaryMaker_jobOptions.py") febSummaryMaker.CheckAllFEB=False @@ -149,7 +164,7 @@ theLArRawChannelBuilder.PedestalTools = [theLArRawChannelBuilderPedestalDataBas ToolSvc += theLArRawChannelBuilderPedestalDataBase from LArRecUtils.LArADC2MeVToolDefault import LArADC2MeVToolDefault -theLArADC2MeVTool=LArADC2MeVToolDefault() +theLArADC2MeVTool=LArADC2MeVToolDefault("LArADC2MeVTool") ToolSvc+=theLArADC2MeVTool from LArROD.LArRODConf import LArRawChannelBuilderADC2EDataBase @@ -163,6 +178,10 @@ theLArOFPeakRecoTool=LArOFPeakRecoTool() theLArOFPeakRecoTool.UseShape=True ToolSvc += theLArOFPeakRecoTool + +include("LArCellRec/LArTimeVetoAlg_jobOptions.py") + + #################### from TriggerJobOpts.TriggerFlags import TriggerFlags as tf tf.readBS=True @@ -203,11 +222,21 @@ from CaloTools.CaloNoiseToolDefault import CaloNoiseToolDefault theCaloNoiseTool = CaloNoiseToolDefault() ToolSvc+=theCaloNoiseTool +from TrigBunchCrossingTool.BunchCrossingTool import BunchCrossingTool + + from LArCafJobs.LArCafJobsConfig import DefaultShapeDumper DefaultShapeDumper('LArShapeDumper', 'FREE', noiseSignifCut = 5, doShape = True, doTrigger = True, caloType = 'EMHECFCAL') topSequence.LArShapeDumper.CaloNoiseTool=theCaloNoiseTool topSequence.LArShapeDumper.TrigDecisionTool=tdt topSequence.LArShapeDumper.FileName=runArgs.outputNTUP_SAMPLESMONFile +topSequence.LArShapeDumper.OutputLevel=DEBUG +topSequence.LArShapeDumper.BunchCrossingTool=BunchCrossingTool() + +if ("Empty" in rec.triggerStream()): + print "LArCellsEmpty: Process only empty bunch crossings" + topSequence.LArShapeDumper.onlyEmptyBC=True + svcMgr.ByteStreamAddressProviderSvc.TypeNames += [ "ROIB::RoIBResult/RoIBResult", @@ -224,6 +253,11 @@ svcMgr += THistSvc() if hasattr(runArgs,"outputNTUP_SAMPLESMONFile"): svcMgr.THistSvc.Output += ["AANT DATAFILE='"+runArgs.outputNTUP_SAMPLESMONFile+"' OPT='RECREATE'"] +if hasattr(runArgs,"outputNTUP_HECNOISEFile"): + from LArCafJobs.LArCafJobsConf import LArHECNoise + topSequence += LArHECNoise('LArHECNoise') + #topSequence.LArHECNoise.OutputLevel=DEBUG + svcMgr.THistSvc.Output += ["HEC DATAFILE='"+runArgs.outputNTUP_HECNOISEFile+"' OPT='RECREATE'"] from AthenaServices.AthenaServicesConf import AthenaEventLoopMgr svcMgr += AthenaEventLoopMgr() @@ -246,17 +280,27 @@ svcMgr.ChronoStatSvc.PrintEllapsedTime = True theApp.AuditAlgorithms = True -#Hack to load the right dict to write vector< vector < X > > to TTRee -#import AthenaPython.PyAthena as PyAthena -#PyAthena.load_library('AtlasSTLAddReflexDict') -#svcMgr.ToolSvc.OutputLevel=DEBUG svcMgr.MessageSvc.Format = "% F%50W%S%7W%R%T %0W%M" -svcMgr.MessageSvc.defaultLimit = 9999999 # all messages -svcMgr.MessageSvc.useColors = False -svcMgr.MessageSvc.defaultLimit=1000000 +#svcMgr.MessageSvc.defaultLimit = 9999999 # all messages +#svcMgr.MessageSvc.useColors = False #svcMgr.MessageSvc.OutputLevel=DEBUG #svcMgr.StoreGateSvc.Dump=True +#svcMgr.ToolSvc.OutputLevel=DEBUG + +## Post-include +if hasattr(runArgs,"postInclude"): + for fragment in runArgs.postInclude: + include(fragment) + +## Post-exec +if hasattr(runArgs,"postExec"): + print "transform post-exec" + for cmd in runArgs.postExec: + print cmd + exec(cmd) + + diff --git a/LArCalorimeter/LArCafJobs/share/skeleton.LArNoise.py b/LArCalorimeter/LArCafJobs/share/skeleton.LArNoise.py new file mode 100644 index 0000000000000000000000000000000000000000..5a8cd6fa5219f54557b1b5edec38209bf0db53b3 --- /dev/null +++ b/LArCalorimeter/LArCafJobs/share/skeleton.LArNoise.py @@ -0,0 +1,210 @@ +from AthenaCommon.AppMgr import (theApp, ServiceMgr as svcMgr,ToolSvc) +from AthenaCommon.AlgSequence import AlgSequence +topSequence = AlgSequence() + +#############################################################33 +#include("LArConditionsCommon/LArMinimalSetup.py") + +from AthenaCommon.AthenaCommonFlags import athenaCommonFlags +from AthenaCommon.GlobalFlags import globalflags +globalflags.DetGeo.set_Value_and_Lock('atlas') +#globalflags.Luminosity.set_Value_and_Lock('zero') +globalflags.DataSource.set_Value_and_Lock('data') +globalflags.InputFormat.set_Value_and_Lock('pool') +#globalflags.DatabaseInstance.set_Value_and_Lock('CONDBR2') +# Not sure that this is correct +# In LArCAF, BSRDOInput was used but here; ESDInput does not work... +athenaCommonFlags.FilesInput.set_Value_and_Lock(runArgs.inputESDFile) +#athenaCommonFlags.PoolESDInput.set_Value_and_Lock(runArgs.inputESDFile) + +from RecExConfig.RecFlags import rec +from RecExConfig.RecAlgsFlags import recAlgs +from RecExConfig.AutoConfiguration import GetProjectName,ConfigureGeo +rec.projectName=GetProjectName() + +ConfigureGeo() + +rec.readRDO.set_Value_and_Lock(False) +rec.readTAG.set_Value_and_Lock(False) +rec.readESD.set_Value_and_Lock(True) +rec.readAOD.set_Value_and_Lock(False) +rec.doWriteESD.set_Value_and_Lock(False) +rec.doWriteAOD.set_Value_and_Lock(False) +rec.doWriteTAG.set_Value_and_Lock(False) +rec.doHist.set_Value_and_Lock(False) +rec.doCBNT.set_Value_and_Lock(False) +rec.doAOD.set_Value_and_Lock(False) +rec.doTrigger.set_Value_and_Lock(True) +recAlgs.doTrigger.set_Value_and_Lock(False) + +rec.doPerfMon.set_Value_and_Lock(False) +rec.doDPD.set_Value_and_Lock(False) +rec.doWriteAOD=False + + + + +from AthenaCommon.JobProperties import jobproperties +#if hasattr(runArgs,'geometryVersion'): +# jobproperties.Global.DetDescrVersion = runArgs.geometryVersion +# print "I found the geometryVersion of",defaultGeoVersion +#else: +# defaultGeoVersion="ATLAS-GEO-18-00-01" +# print "No geometryVersion given, use default value of",defaultGeoVersion +# jobproperties.Global.DetDescrVersion = defaultGeoVersion + +from AthenaCommon.DetFlags import DetFlags +DetFlags.Calo_setOn() +DetFlags.ID_setOff() +DetFlags.Muon_setOff() +DetFlags.Truth_setOff() +DetFlags.LVL1_setOff() +DetFlags.digitize.all_setOff() +DetFlags.Print() + + +#from AtlasGeoModel import SetGeometryVersion +from AtlasGeoModel import GeoModelInit +from AtlasGeoModel import SetupRecoGeometry + +svcMgr.GeoModelSvc.AtlasVersion=globalflags.DetDescrVersion() + +if hasattr(runArgs,"outputNTUP_HECNOISEFile"): + from LArConditionsCommon.LArCondFlags import larCondFlags + larCondFlags.LoadElecCalib.set_Value_and_Lock(True) + +#Get identifier mapping +include( "LArConditionsCommon/LArIdMap_comm_jobOptions.py" ) +include( "LArIdCnv/LArIdCnv_joboptions.py" ) + +# Event selector +import AthenaPoolCnvSvc.ReadAthenaPool + +############################################################### + + +from LArConditionsCommon.LArCondFlags import larCondFlags +include("LArConditionsCommon/LArConditionsCommon_comm_jobOptions.py") + +if not hasattr(runArgs,"conditionsTag") or runArgs.conditionsTag=="CURRENT": + print "Resolving 'CURRENT' express conditions tag ..." + sys.path.append('/afs/cern.ch/user/a/atlcond/utils/python/') + from AtlCoolBKLib import resolveAlias + resolver=resolveAlias() + currentGlobalES=resolver.getCurrentES().replace("*","ST") + print "Found ",currentGlobalES + svcMgr.IOVDbSvc.GlobalTag=currentGlobalES +else: + svcMgr.IOVDbSvc.GlobalTag=runArgs.conditionsTag +#"COMCOND-BLKP-005-05" + +if hasattr(runArgs,"skipEvents"): + svcMgr.EventSelector.SkipEvents=runArgs.skipEvents + +if hasattr(runArgs,"maxEvents"): + theApp.EvtMax=runArgs.maxEvents + + +# +##################### +from RecExConfig.InputFilePeeker import inputFileSummary +from RecExConfig.ObjKeyStore import objKeyStore, CfgKeyStore +objKeyStore.addManyTypesInputFile(inputFileSummary['eventdata_itemsList']) + +from TriggerJobOpts.TriggerFlags import TriggerFlags as tf +tf.readBS=False +tf.doID=False + + +from TriggerJobOpts.TriggerGetter import TriggerGetter +triggerGetter = TriggerGetter() + +# trigger configuration +#from TriggerJobOpts.TriggerConfigGetter import TriggerConfigGetter +#cfg = TriggerConfigGetter("ReadPool") + +#from TriggerJobOpts.Lvl1ResultBuilderGetter import Lvl1ResultBuilderGetter +#lvl1 = Lvl1ResultBuilderGetter() + +# TDT +#from AthenaCommon.AppMgr import ToolSvc +#from TrigDecisionTool.TrigDecisionToolConf import Trig__TrigDecisionTool +#tdt = Trig__TrigDecisionTool("TrigDecisionTool") +#ToolSvc += tdt + +#from TrigDecisionMaker.TrigDecisionMakerConfig import WriteTrigDecision +#trigDecWriter = WriteTrigDecision() + +from CaloTools.CaloNoiseToolDefault import CaloNoiseToolDefault +theCaloNoiseTool = CaloNoiseToolDefault() +ToolSvc+=theCaloNoiseTool +# --- BunchCrossing Tool configuration --- +from TrigBunchCrossingTool.BunchCrossingTool import BunchCrossingTool +theBCTool = BunchCrossingTool() +ToolSvc += theBCTool + +svcMgr.EventSelector.InputCollections = athenaCommonFlags.FilesInput() + + +include("LArCellRec//LArCollisionTime_jobOptions.py") + + +from LArCafJobs.LArCafJobsConf import LArNoiseBursts +topSequence += LArNoiseBursts( "LArNoiseBursts" ) +topSequence.LArNoiseBursts.ICaloNoiseTool = theCaloNoiseTool +topSequence.LArNoiseBursts.BCTool = theBCTool +topSequence.LArNoiseBursts.SigmaCut = 3.0 +topSequence.LArNoiseBursts.NumberOfBunchesInFront = 30 + +conddb.addFolder("TDAQ","/TDAQ/RunCtrl/DataTakingMode") + +theApp.HistogramPersistency = "ROOT" +from GaudiSvc.GaudiSvcConf import THistSvc +svcMgr += THistSvc() + +if hasattr(runArgs,"outputNTUP_LARNOISEFile"): + svcMgr.THistSvc.Output += ["TTREE DATAFILE='"+runArgs.outputNTUP_LARNOISEFile+"' OPT='RECREATE'"] + +if hasattr(runArgs,"outputNTUP_HECNOISEFile"): + from LArCafJobs.LArCafJobsConf import LArHECNoise + topSequence += LArHECNoise('LArHECNoise') + svcMgr.THistSvc.Output += ["HEC DATAFILE='"+runArgs.outputNTUP_HECNOISEFile+"' OPT='RECREATE'"] + #little hack while autoConfiguration=everything is still not the default... + if hasattr(runArgs,"inputESDFile") and not hasattr(runArgs,"inputFile"): + athenaCommonFlags.FilesInput.set_Value_and_Lock( runArgs.inputESDFile ) + +from AthenaServices.AthenaServicesConf import AthenaEventLoopMgr +svcMgr += AthenaEventLoopMgr() +svcMgr.AthenaEventLoopMgr.EventPrintoutInterval = 100 + + +theAuditorSvc = svcMgr.AuditorSvc +theAuditorSvc.Auditors += [ "ChronoAuditor"] + +#svcMgr.ChronoStatSvc.ChronoDestinationCout = True + +svcMgr.ChronoStatSvc.PrintUserTime = True +svcMgr.ChronoStatSvc.PrintSystemTime = True +svcMgr.ChronoStatSvc.PrintEllapsedTime = True +#svcMgr.ChronoStatSvc.NumberOfSkippedEventsForMemStat = 1 + +#svcMgr.ChronoStatSvc.AsciiStatsOutputFile = "chronoStats.ascii" + +#svcMgr.AthenaPoolCnvSvc.UseDetailChronoStat = True + +theApp.AuditAlgorithms = True + +#Hack to load the right dict to write vector< vector < X > > to TTRee +#import AthenaPython.PyAthena as PyAthena +#PyAthena.load_library('AtlasSTLAddReflexDict') + + +#svcMgr.ToolSvc.OutputLevel=DEBUG + +svcMgr.MessageSvc.Format = "% F%50W%S%7W%R%T %0W%M" +svcMgr.MessageSvc.defaultLimit = 9999999 # all messages +svcMgr.MessageSvc.useColors = False +svcMgr.MessageSvc.defaultLimit=1000000 +#svcMgr.MessageSvc.OutputLevel=DEBUG + +#svcMgr.StoreGateSvc.Dump=True diff --git a/LArCalorimeter/LArCafJobs/src/LArHECNoise.cxx b/LArCalorimeter/LArCafJobs/src/LArHECNoise.cxx new file mode 100644 index 0000000000000000000000000000000000000000..30ada0bcdc7797ba2fad0c9ed1b05f116617be14 --- /dev/null +++ b/LArCalorimeter/LArCafJobs/src/LArHECNoise.cxx @@ -0,0 +1,302 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "GaudiKernel/MsgStream.h" +#include "GaudiKernel/AlgFactory.h" +#include "GaudiKernel/IToolSvc.h" + +#include "StoreGate/StoreGateSvc.h" + +#include "CaloIdentifier/CaloIdManager.h" +#include "CaloIdentifier/CaloCell_ID.h" +#include "CaloIdentifier/CaloDM_ID.h" +#include "CaloIdentifier/CaloLVL1_ID.h" +#include "CaloIdentifier/LArEM_ID.h" +#include "CaloIdentifier/LArHEC_ID.h" +#include "CaloIdentifier/LArFCAL_ID.h" +#include "CaloIdentifier/LArID_Exception.h" + +#include "AthenaPoolUtilities/AthenaAttributeList.h" + +#include "Identifier/Range.h" +#include "Identifier/IdentifierHash.h" +#include "Identifier/HWIdentifier.h" + +#include "LArIdentifier/LArOnlineID.h" + +#include "LArRecEvent/LArEventBitInfo.h" +#include "LArRawEvent/LArDigit.h" +#include "LArRawEvent/LArDigitContainer.h" +#include "LArRawEvent/LArRawChannelContainer.h" + +#include "NavFourMom/IParticleContainer.h" +#include "NavFourMom/INavigable4MomentumCollection.h" + +#include "StoreGate/DataHandle.h" +#include "CaloDetDescr/CaloDetDescrManager.h" +#include "CaloDetDescr/CaloDetectorElements.h" +#include "AthenaPoolUtilities/CondAttrListCollection.h" + +#include "GaudiKernel/ITHistSvc.h" +#include "TTree.h" + +#include "xAODEventInfo/EventInfo.h" + +#include "CaloEvent/CaloCellContainer.h" + +#include "LArCafJobs/LArHECNoise.h" + +#include <algorithm> +#include <math.h> +#include <functional> +#include <iostream> + +using namespace std; +using xAOD::EventInfo; + +////////////////////////////////////////////////////////////////////////////////////// +/// Constructor + + +LArHECNoise::LArHECNoise(const std::string& name, + ISvcLocator* pSvcLocator) + : AthAlgorithm(name, pSvcLocator), + m_thistSvc(0), + m_tree(0), + m_LArCablingService("LArCablingService"), + m_trigDec( "Trig::TrigDecisionTool/TrigDecisionTool" ), + m_LArOnlineIDHelper(0), + m_caloIdMgr(0), + m_calodetdescrmgr(0), + m_nt_run(0), + m_nt_evtId(0), + m_nt_evtCount(0), + m_nt_evtTime(0), + m_nt_evtTime_ns(0), + m_nt_lb(0), + m_nt_bcid(0) + { + + // Trigger + declareProperty( "TrigDecisionTool", m_trigDec ); + + /** switches to control the analysis through job options */ + declareProperty("LArCablingService", m_LArCablingService); + + declareProperty("TriggerLines",m_TriggerLines={"L1_J5", "L1_J10", "L1_J12", "L1_J30", "L1_TAU5", "L1_TAU8", "L1_J5_EMPTY", "L1_J10_EMPTY", "L1_J12_EMPTY", "L1_J30_EMPTY", "L1_TAU5_EMPTY", "L1_TAU8_EMPTY", "L1_J5_FIRSTEMPTY", "L1_J10_FIRSTEMPTY", "L1_J12_FIRSTEMPTY", "L1_J30_FIRSTEMPTY", "L1_TAU5_FIRSTEMPTY", "L1_TAU8_FIRSTEMPTY"}); + + declareProperty("MinDigitADC",m_MinDigitADC=20); + declareProperty("MaxDeltaT",m_MaxDeltaT=5); + + m_nt_prescale = new float(m_TriggerLines.size()); + m_nt_trigger = new bool(m_TriggerLines.size()); + } + + +LArHECNoise::~LArHECNoise() {} + + +StatusCode LArHECNoise::initialize() { + + ATH_MSG_DEBUG ( "Initializing LArHECNoise" ); + + // Trigger Decision Tool + ATH_CHECK(m_trigDec.retrieve()); + + ATH_CHECK( m_LArCablingService.retrieve() ); + + // Retrieve online ID helper + const DataHandle<LArOnlineID> LArOnlineIDHelper; + ATH_CHECK( detStore()->retrieve(LArOnlineIDHelper, "LArOnlineID") ); + m_LArOnlineIDHelper = LArOnlineIDHelper; + ATH_MSG_DEBUG( " Found LArOnline Helper"); + + // Retrieve ID helpers + ATH_CHECK( detStore()->retrieve(m_caloIdMgr) ); + m_calocell_id = m_caloIdMgr->getCaloCell_ID(); + + m_calodetdescrmgr = CaloDetDescrManager::instance(); + /** get a handle on the NTuple and histogramming service */ + ATH_CHECK( service("THistSvc", m_thistSvc) ); + + /** Prepare TTree **/ + m_tree = new TTree( "HECNoise", "HECNoise" ); + + // General properties of events + m_tree->Branch("iRun",&m_nt_run,"iRun/I");// Event ID + m_tree->Branch("iEvent",&m_nt_evtId,"iEvent/I");// Event ID + m_tree->Branch("iEventCount",&m_nt_evtCount,"iEventCount/I"); + m_tree->Branch("iTime",&m_nt_evtTime,"iTime/I");// Event time + m_tree->Branch("iTime_ns",&m_nt_evtTime_ns,"iTime_ns/I");// Event time in nanosecond + m_tree->Branch("iLB",&m_nt_lb,"iLB/I"); // LB + m_tree->Branch("iBCID",&m_nt_bcid,"iBCID/I"); // BCID + // prescale and trigger here + //const std::vector<float> &tp = m_nt_prescale; + //const std::vector<bool> &tt = m_nt_trigger; + for(unsigned i=0; i<m_TriggerLines.size(); ++i) { + //m_tree->Branch((m_TriggerLines[i]+"_Prescale").c_str(),&(tp[i]),(m_TriggerLines[i]+"_Prescale/F").c_str()); + //m_tree->Branch((m_TriggerLines[i]+"_Trigger").c_str(),tt[i],(m_TriggerLines[i]+"_Trigger/O").c_str()); + m_tree->Branch((m_TriggerLines[i]+"_Prescale").c_str(),&(m_nt_prescale[i]),(m_TriggerLines[i]+"_Prescale/F").c_str()); + m_tree->Branch((m_TriggerLines[i]+"_Trigger").c_str(),&(m_nt_trigger[i]),(m_TriggerLines[i]+"_Trigger/I").c_str()); + } + m_tree->Branch("avgMu",&m_nt_avgMu,"avgMu/F"); + m_tree->Branch("actMu",&m_nt_actMu,"actMu/F"); + m_tree->Branch("iGain",&m_nt_gain,"iGain/I"); + m_tree->Branch("iOID",&m_nt_OID,"iOID/L"); + m_tree->Branch("iSide",&m_nt_side,"iSide/I"); + m_tree->Branch("iSamp",&m_nt_samp,"iSamp/I"); + m_tree->Branch("iReg",&m_nt_reg,"iReg/I"); + m_tree->Branch("iEta",&m_nt_ieta,"iEta/I"); + m_tree->Branch("iPhi",&m_nt_iphi,"iPhi/I"); + m_tree->Branch("iQuality",&m_nt_quality,"iQuality/I"); + m_tree->Branch("e",&m_nt_e,"e/F"); + m_tree->Branch("t",&m_nt_t,"t/F"); + m_tree->Branch("eta",&m_nt_eta,"eta/F"); + m_tree->Branch("phi",&m_nt_phi,"phi/F"); + m_tree->Branch("z",&m_nt_z,"z/F"); + m_tree->Branch("r",&m_nt_r,"r/F"); + m_tree->Branch("Ped",&m_nt_ped,"Ped/F"); + m_tree->Branch("PedRMS",&m_nt_pedRMS,"PedRMS/F"); + m_tree->Branch("iDigi",m_nt_digi,"iDigi[32]/S"); + m_tree->Branch("iMax",&m_nt_max,"iMax/I"); + m_tree->Branch("iMin",&m_nt_min,"iMin/I"); + + std::string treeName = "/HEC/HECNoise" ; + ATH_CHECK( m_thistSvc->regTree(treeName, m_tree) ); + + + ATH_MSG_DEBUG ( "End of Initializing LArHECNoise" ); + + return StatusCode::SUCCESS; +} + +StatusCode LArHECNoise::finalize() { + ATH_MSG_DEBUG ( "in finalize()" ); + return StatusCode::SUCCESS; +} + + +StatusCode LArHECNoise::execute() { + + ATH_MSG_DEBUG ( "in execute()" ); + + for(unsigned i=0; i<m_TriggerLines.size(); ++i){ + m_nt_prescale[i] = m_trigDec->getPrescale(m_TriggerLines[i]); + if (m_trigDec->isPassed(m_TriggerLines[i])){ + m_nt_trigger[i] = true; + } else { + m_nt_trigger[i] = false; + } + } + + const EventInfo* eventInfo = 0; + ATH_CHECK( evtStore()->retrieve(eventInfo) ); + + m_nt_evtCount = 0; + const CaloCellContainer* cc = 0; + const LArRawChannelContainer* lraw = 0; + if (evtStore()->contains<CaloCellContainer>("AllCalo")) { + ATH_CHECK(evtStore()->retrieve(cc, "AllCalo")); + } else if (evtStore()->contains<LArRawChannelContainer>("LArRawChannels")){ + ATH_CHECK(evtStore()->retrieve(lraw, "LArRawChannels")); + } + + // retrieve pedestals + ATH_CHECK( detStore()->retrieve(m_ped,"Pedestal") ); + + const LArDigitContainer* ld = 0; + if (evtStore()->contains<LArDigitContainer>("LArDigitContainer")) { + ATH_CHECK(evtStore()->retrieve(ld, "LArDigitContainer")); + } else if (evtStore()->contains<LArDigitContainer>("LArDigitContainer_Thinned")) { + ATH_CHECK(evtStore()->retrieve(ld, "LArDigitContainer_Thinned")); + } else if (evtStore()->contains<LArDigitContainer>("FREE")) { + ATH_CHECK(evtStore()->retrieve(ld, "FREE")); + } else { + msg(MSG::WARNING) << "Neither LArDigitContainer nor LArDigitContainer_Thinned nor FREE present, not filling anything "<<endreq; + return StatusCode::SUCCESS; + } + /** Define iterators to loop over Digits containers*/ + LArDigitContainer::const_iterator itDig = ld->begin(); + LArDigitContainer::const_iterator itDig_e= ld->end(); + const LArDigit* pLArDigit; + + for ( ; itDig!=itDig_e;++itDig) { + pLArDigit = *itDig; + HWIdentifier hid = pLArDigit->hardwareID(); + if(! m_LArOnlineIDHelper->isHECchannel(hid)) continue; //and ld.gain() == 2: + int sigmax=0; + int sigmin=0; + int imax=0; + int imin=0; + short samp0= pLArDigit->samples()[0]; + for(unsigned i=0; i<(pLArDigit->samples()).size(); ++i){ + short samp=pLArDigit->samples()[i]; + if( i < 32) m_nt_digi[i] = samp; + if(samp-samp0 > sigmax) { + sigmax = samp-samp0; + imax=i; + } + if( samp-samp0 < sigmin) { + sigmin = samp-samp0; + imin=i; + } + } + if( sigmax > m_MinDigitADC && sigmin < -m_MinDigitADC && ( (imin-imax) < m_MaxDeltaT || imin < imax)) { + m_nt_run = eventInfo->runNumber(); + m_nt_evtId = eventInfo->eventNumber(); + m_nt_evtTime = eventInfo->timeStamp(); + m_nt_evtTime_ns = eventInfo->timeStampNSOffset(); + m_nt_lb = eventInfo->lumiBlock(); + m_nt_bcid = eventInfo->bcid(); + m_nt_avgMu = eventInfo->averageInteractionsPerCrossing(); + m_nt_actMu = eventInfo->actualInteractionsPerCrossing(); + + m_nt_evtCount += 1; + m_nt_gain = pLArDigit->gain(); + Identifier oid = m_LArCablingService->cnvToIdentifier(hid); + m_nt_OID = pLArDigit->channelID().get_compact(); + m_nt_ped = m_ped->pedestal(pLArDigit->channelID(),pLArDigit->gain()); + m_nt_pedRMS = m_ped->pedestalRMS(pLArDigit->channelID(),pLArDigit->gain()); + m_nt_side = m_calocell_id->pos_neg(oid); + m_nt_samp = m_calocell_id->sampling(oid); + m_nt_reg = m_calocell_id->region(oid); + m_nt_ieta = m_calocell_id->eta(oid); + m_nt_iphi = m_calocell_id->phi(oid); + m_nt_max = imax; + m_nt_min = imin; + IdentifierHash ihash = m_calocell_id->calo_cell_hash(oid); + m_nt_e = 0.0; + m_nt_t = 0.0; + m_nt_quality = 0; + if(cc) { + const CaloCell *rcell = cc->findCell(ihash); + if(rcell->ID() != oid) { + msg(MSG::WARNING) <<"Cell iHash does not match ..."<<endreq; + }else{ + m_nt_e = rcell->e(); + m_nt_t = rcell->time(); + m_nt_quality = rcell->quality(); + } + } else if(lraw) { + for(unsigned l=0; l<lraw->size(); ++l) { + if((*lraw)[l].identify() == hid) { + m_nt_e = (*lraw)[l].energy(); + m_nt_t = (*lraw)[l].time()*1e-3;; + m_nt_quality = (*lraw)[l].quality(); + break; + } + } + } + CaloDetDescrElement *cdde = m_calodetdescrmgr->get_element(oid); + m_nt_eta = cdde->eta(); + m_nt_phi = cdde->phi(); + m_nt_z = cdde->z(); + m_nt_r = cdde->r(); + m_tree->Fill(); + }//found our digit + }//over digits + + return StatusCode::SUCCESS; +} + diff --git a/LArCalorimeter/LArCafJobs/src/LArNoiseBursts.cxx b/LArCalorimeter/LArCafJobs/src/LArNoiseBursts.cxx new file mode 100644 index 0000000000000000000000000000000000000000..25b1772ea875c8e907c612a91ec85c7821bdbfa5 --- /dev/null +++ b/LArCalorimeter/LArCafJobs/src/LArNoiseBursts.cxx @@ -0,0 +1,1418 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +/// LArNoiseBursts +/// Author: Josu Cantero +/// UAM, November, 2010 +/// Modified by Hideki Okawa +/// BNL, June, 2012 + +#include "GaudiKernel/MsgStream.h" +#include "GaudiKernel/AlgFactory.h" +#include "GaudiKernel/IToolSvc.h" + +#include "StoreGate/StoreGateSvc.h" + +#include "CaloIdentifier/CaloIdManager.h" +#include "CaloIdentifier/CaloCell_ID.h" +#include "CaloIdentifier/CaloDM_ID.h" +#include "CaloIdentifier/CaloLVL1_ID.h" +#include "CaloIdentifier/LArEM_ID.h" +#include "CaloIdentifier/LArHEC_ID.h" +#include "CaloIdentifier/LArFCAL_ID.h" +#include "CaloIdentifier/LArMiniFCAL_ID.h" +#include "CaloIdentifier/LArID_Exception.h" + + +#include "CaloInterface/ICaloNoiseTool.h" +#include "CaloInterface/ICalorimeterNoiseTool.h" + +#include "AthenaPoolUtilities/AthenaAttributeList.h" + +#include "Identifier/Range.h" +#include "Identifier/IdentifierHash.h" +#include "Identifier/HWIdentifier.h" + +#include "LArIdentifier/LArOnlineID.h" +#include "LArIdentifier/LArHVLineID.h" +#include "LArIdentifier/LArElectrodeID.h" + +#include "LArRecEvent/LArEventBitInfo.h" +#include "LArRawEvent/LArDigit.h" +#include "LArRawEvent/LArDigitContainer.h" +#include "LArRecEvent/LArNoisyROSummary.h" +#include "LArRecEvent/LArCollisionTime.h" + +#include "NavFourMom/IParticleContainer.h" +#include "NavFourMom/INavigable4MomentumCollection.h" + +// Lar HV +#include "LArElecCalib/ILArHVTool.h" +#include "StoreGate/DataHandle.h" +#include "CaloDetDescr/CaloDetDescrManager.h" +#include "CaloDetDescr/CaloDetectorElements.h" +#include "LArReadoutGeometry/EMBCell.h" +#include "LArHV/EMBHVElectrodeConstLink.h" +#include "LArHV/EMBHVElectrode.h" +#include "LArHV/EMBPresamplerHVModuleConstLink.h" +#include "LArHV/EMBPresamplerHVModule.h" +#include "LArReadoutGeometry/EMECCell.h" +#include "LArHV/EMECHVElectrodeConstLink.h" +#include "LArHV/EMECHVElectrode.h" +#include "LArHV/EMECPresamplerHVModuleConstLink.h" +#include "LArHV/EMECPresamplerHVModule.h" +#include "LArReadoutGeometry/HECCell.h" +#include "LArHV/HECHVSubgapConstLink.h" +#include "LArHV/HECHVSubgap.h" +#include "LArReadoutGeometry/FCALTile.h" +#include "LArHV/FCALHVLineConstLink.h" +#include "LArHV/FCALHVLine.h" +#include "LArHV/LArHVManager.h" +#include "AthenaPoolUtilities/CondAttrListCollection.h" + +#include "LArCondUtils/LArHVToolDB.h" +/////////////////////////////////////////////////////////////////// + +#include "GaudiKernel/ITHistSvc.h" +#include "TTree.h" +#include "CLHEP/Vector/LorentzVector.h" + +/* +#include "EventInfo/EventIncident.h" +#include "EventInfo/EventInfo.h" +#include "EventInfo/EventID.h" +#include "EventInfo/EventType.h" +#include "EventInfo/TriggerInfo.h" +*/ + +#include "xAODEventInfo/EventInfo.h" + +#include "CaloEvent/CaloCellContainer.h" + +#include "LArCafJobs/LArNoiseBursts.h" + +#include <algorithm> +#include <math.h> +#include <functional> +#include <iostream> + +using namespace std; +using xAOD::EventInfo; + +////////////////////////////////////////////////////////////////////////////////////// +/// Constructor + + +LArNoiseBursts::LArNoiseBursts(const std::string& name, + ISvcLocator* pSvcLocator) + : AthAlgorithm(name, pSvcLocator), + m_thistSvc(0), + m_tree(0), + m_LArCablingService("LArCablingService"), + m_LArHVCablingTool("LArHVCablingTool"), + m_calo_noise_tool("CaloNoiseTool/CaloNoiseToolDefault"), + m_bc_tool("Trig::TrigConfBunchCrossingTool/BunchCrossingTool"), + m_trigDec( "Trig::TrigDecisionTool/TrigDecisionTool" ), + m_LArOnlineIDHelper(0), + m_LArHVLineIDHelper(0), + m_LArElectrodeIDHelper(0), + m_LArEM_IDHelper(0), + m_LArFCAL_IDHelper(0), + m_LArHEC_IDHelper(0), + m_caloIdMgr(0), + m_calodetdescrmgr(0), + m_CosmicCaloStream(false), + m_nb_sat(0), + m_lowqfactor(0), + m_medqfactor(0), + m_hiqfactor(0), + n_noisycell(0), + m_nt_larcellsize(0), + m_nt_cellsize(0), + m_nt_run(0), + m_nt_evtId(0), + m_nt_evtTime(0), + m_nt_evtTime_ns(0), + m_nt_lb(0), + m_nt_bcid(0), + m_nt_ntracks(0), + m_nt_isbcidFilled(0), + m_nt_isbcidInTrain(0), + m_nt_isBunchesInFront(0), + m_nt_bunchtype(0), + m_nt_bunchtime(0), + m_nt_atlasready(0), + m_nt_stablebeams(0), + m_nt_streamTagName(0), + m_nt_streamTagType(0), + m_nt_larnoisyro(0), + m_nt_larnoisyro_opt(0), + m_nt_larnoisyro_satTwo(0), +// m_nt_veto_mbts(0), +// //m_nt_veto_indet(0), +// m_nt_veto_bcm(0), +// m_nt_veto_lucid(0), +// m_nt_veto_pixel(0), +// m_nt_veto_sct(0), +// m_nt_veto_mbtstdHalo(0), +// m_nt_veto_mbtstdCol(0), +// m_nt_veto_lartdHalo(0), +// m_nt_veto_lartdCol(0), +// m_nt_veto_csctdHalo(0), +// m_nt_veto_csctdCol(0), +// m_nt_veto_bcmtHalo(0), +// m_nt_veto_bcmtCol(0), +// m_nt_veto_muontCol(0), +// m_nt_veto_muontCosmic(0), + m_nt_larflag_badFEBs(false), + m_nt_larflag_mediumSaturatedDQ(false), + m_nt_larflag_tightSaturatedDQ(false), + m_nt_larflag_noiseBurstVeto(false), + m_nt_larflag_dataCorrupted(false), + m_nt_larflag_dataCorruptedVeto(false), + m_nt_L1_J75(false), + m_nt_L1_J10_EMPTY(false), + m_nt_L1_J30_FIRSTEMPTY(false), + m_nt_L1_J30_EMPTY(false), + m_nt_L1_XE40(false), + m_nt_L1_XE50(false), + m_nt_L1_XE50_BGRP7(false), + m_nt_L1_XE70(false), + m_nt_EF_j165_u0uchad_LArNoiseBurst(false), + m_nt_EF_j30_u0uchad_empty_LArNoiseBurst(false), + m_nt_EF_j55_u0uchad_firstempty_LArNoiseBurst(false), + m_nt_EF_j55_u0uchad_empty_LArNoiseBurst(false), + m_nt_EF_xe45_LArNoiseBurst(false), + m_nt_EF_xe55_LArNoiseBurst(false), + m_nt_EF_xe60_LArNoiseBurst(false), + m_nt_EF_j55_u0uchad_firstempty_LArNoiseBurstT(false), + m_nt_EF_j100_u0uchad_LArNoiseBurstT(false), + m_nt_EF_j165_u0uchad_LArNoiseBurstT(false), + m_nt_EF_j130_u0uchad_LArNoiseBurstT(false), + m_nt_EF_j35_u0uchad_empty_LArNoiseBurst(false), + m_nt_EF_j35_u0uchad_firstempty_LArNoiseBurst(false), + m_nt_EF_j80_u0uchad_LArNoiseBurstT(false), + m_nt_ECTimeDiff(0), + m_nt_ECTimeAvg(0), + m_nt_nCellA(0), + m_nt_nCellC(0), + m_nt_energycell(0), + m_nt_qfactorcell(0), + m_nt_phicell(0), + m_nt_etacell(0), + m_nt_signifcell(0), + m_nt_noisycellpercent(0), + m_nt_ft_noisy(0), + m_nt_slot_noisy(0), + m_nt_channel_noisy(0), + m_nt_cellpartlayerindex(0), + m_nt_cellIdentifier(0), + m_nt_noisycellpart(0), + m_nt_nominalhv(0), + m_nt_maximalhv(0), + m_nt_noisycellHVphi(0), + m_nt_noisycellHVeta(0), + m_nt_samples(0), + m_nt_gain(0), + m_nt_isbadcell(0), + m_nt_partition(0), + m_nt_layer(0), + m_nt_isbadcell_sat(0), + m_nt_barrelec_sat(0), + m_nt_posneg_sat(0), + m_nt_ft_sat(0), + m_nt_slot_sat(0), + m_nt_channel_sat(0), + m_nt_partition_sat(0), + m_nt_energy_sat(0), + m_nt_phicell_sat(0), + m_nt_etacell_sat(0), + m_nt_layer_sat(0), + m_nt_cellIdentifier_sat(0) + { + + // Trigger + declareProperty( "TrigDecisionTool", m_trigDec ); + + /** switches to control the analysis through job options */ + declareProperty("LArCablingService", m_LArCablingService); + declareProperty("LArHVCablingTool", m_LArHVCablingTool); + + // NEW + declareProperty( "ICaloNoiseTool", m_calo_noise_tool ); + declareProperty( "BCTool", m_bc_tool ); + // declareProperty( "SCTClusteringTool",m_sctclustering_tool); + + //event cuts + declareProperty("SigmaCut", m_sigmacut = 3.0); + declareProperty("NumberOfBunchesInFront",m_frontbunches = 36); + + // Keep cell properties + declareProperty("KeepOnlyCellID", m_keepOnlyCellID = false); + + } + +///////////////////////////////////////////////////////////////////////////////////// +/// Destructor - check up memory allocation +/// delete any memory allocation on the heap + +LArNoiseBursts::~LArNoiseBursts() {} + +//////////////////////////////////////////////////////////////////////////////////// +/// Initialize +/// initialize StoreGate +/// get a handle on the analysis tools +/// book histograms +/* +StatusCode LArNoiseBursts::initializeBeforeEventLoop() { + MsgStream mLog( messageService(), name() ); + + ATH_MSG_DEBUG ( "Initializing LArNoiseBursts (before eventloop)" ); + + // NEW + + + // retrieve trigger decision tool + // needs to be done before the first run/event since a number of + // BeginRun/BeginEvents are registered by dependent services + StatusCode sc = StatusCode::SUCCESS; + + return sc; +} */ +////////////////////////////////////////////////////////////////////////////////////// +/////////////////// INITIALIZE /////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////////////// + +StatusCode LArNoiseBursts::initialize() { + + ATH_MSG_DEBUG ( "Initializing LArNoiseBursts" ); + + // Trigger Decision Tool + if(!m_trigDec.empty()){ + if(m_trigDec.retrieve().isFailure()){ + ATH_MSG_WARNING ( "Failed to retrieve trigger decision tool " << m_trigDec ); + }else{ + ATH_MSG_INFO ( "Retrieved tool " << m_trigDec ); + } + } + + ATH_CHECK( m_LArCablingService.retrieve() ); + + // Retrieve online ID helper + const DataHandle<LArOnlineID> LArOnlineIDHelper; + ATH_CHECK( detStore()->retrieve(LArOnlineIDHelper, "LArOnlineID") ); + m_LArOnlineIDHelper = LArOnlineIDHelper; + ATH_MSG_DEBUG( " Found LArOnline Helper"); + + // Retrieve HV line ID helper + const DataHandle<LArHVLineID> LArHVLineIDHelper; + ATH_CHECK( detStore()->retrieve(LArHVLineIDHelper, "LArHVLineID") ); + m_LArHVLineIDHelper = LArHVLineIDHelper; + ATH_MSG_DEBUG( " Found LArOnlineIDHelper Helper"); + + // Retrieve HV electrode ID helper + const DataHandle<LArElectrodeID> LArElectrodeIDHelper; + ATH_CHECK( detStore()->retrieve(LArElectrodeIDHelper, "LArElectrodeID") ); + m_LArElectrodeIDHelper = LArElectrodeIDHelper; + ATH_MSG_DEBUG( " Found LArElectrodeIDHelper Helper"); + + // Retrieve ID helpers + ATH_CHECK( detStore()->retrieve(m_caloIdMgr) ); + m_LArEM_IDHelper = m_caloIdMgr->getEM_ID(); + m_LArHEC_IDHelper = m_caloIdMgr->getHEC_ID(); + m_LArFCAL_IDHelper = m_caloIdMgr->getFCAL_ID(); + + if ( m_calo_noise_tool.retrieve().isFailure() ) { + ATH_MSG_WARNING ( "Failed to retrieve tool " << m_calo_noise_tool ); + }else{ + ATH_MSG_INFO ( "Retrieved tool " << m_calo_noise_tool ); + } + + if(m_bc_tool.retrieve().isFailure()){ + ATH_MSG_WARNING ( "Failed to retrieve tool " << m_bc_tool ); + }else{ + ATH_MSG_INFO ( "Retrieved tool " << m_bc_tool ); + } + + /** get a handle on the NTuple and histogramming service */ + ATH_CHECK( service("THistSvc", m_thistSvc) ); + + /*const AthenaAttributeList* fillparams(0); + sc = evtStore()->retrieve(fillparams, "/TDAQ/OLC/LHC/FILLPARAMS"); + if (sc.isFailure()) { + ATH_MSG_WARNING ("Unable to retrieve fillparams information; falling back to" ); + return StatusCode::SUCCESS; + } + + if (fillparams != 0) { + ATH_MSG_DEBUG ("beam 1 #bunches are: " << (*fillparams)["Beam1Bunches"].data<uint32_t>() ); + ATH_MSG_DEBUG ("beam 2 #bunches are: " << (*fillparams)["Beam2Bunches"].data<uint32_t>() ); + } +*/ + + /** Prepare TTree **/ + m_tree = new TTree( "CollectionTree", "CollectionTree" ); + std::string treeName = "/TTREE/CollectionTree" ; + ATH_CHECK( m_thistSvc->regTree(treeName, m_tree) ); + + // General properties of events + m_tree->Branch("Run",&m_nt_run,"Run/I");// Event ID + m_tree->Branch("EventId",&m_nt_evtId,"EventId/I");// Event ID + m_tree->Branch("EventTime",&m_nt_evtTime,"EventTime/I");// Event time + m_tree->Branch("EventTime_ns",&m_nt_evtTime_ns,"EventTime_ns/I");// Event time in nanosecond + m_tree->Branch("LumiBlock",&m_nt_lb,"LumiBlock/I"); // LB + m_tree->Branch("BCID",&m_nt_bcid,"BCID/I"); // BCID + m_tree->Branch("StreamTagName",&m_nt_streamTagName);// stream tag name + m_tree->Branch("StreamTagType",&m_nt_streamTagType); // stream tag type + m_tree->Branch("IsBCIDFilled", &m_nt_isbcidFilled,"IsBCIDFilled/I"); // check if bunch is filled + m_tree->Branch("IsBCIDInTrain",&m_nt_isbcidInTrain,"ISBCIDInTrain/I"); // check if bunch belong to a train + m_tree->Branch("BunchesInFront",&m_nt_isBunchesInFront); // check front bunches + m_tree->Branch("BunchType",&m_nt_bunchtype,"BunchType/I");// Empty = 0, FirstEmpty=1,&middleEmpty=2, Single=100,Front=200,&middle=201,Tail=202 + m_tree->Branch("TimeAfterBunch",&m_nt_bunchtime,"TimeAfterBunch/F"); //time "distance" between the colliding bunch and the nearest one. + m_tree->Branch("ATLASIsReady",&m_nt_atlasready,"AtlasIsReady/I"); //check if atlas is ready for physics + m_tree->Branch("StableBeams",&m_nt_stablebeams,"StableBeams/I");//check stablebeams + + // Background bits in EventInfo +// m_tree->Branch("vetoMBTS",&m_nt_veto_mbts,"vetoMBST/S"); //Beam/collision veto based on mbts +// m_tree->Branch("vetoPixel",&m_nt_veto_pixel,"vetoPixel/S"); //Beam/collision veto based on indet +// m_tree->Branch("vetoSCT",&m_nt_veto_sct,"vetoSCT/S"); //Beam/collision veto based on indet +// m_tree->Branch("vetoBcm",&m_nt_veto_bcm,"vetoBcm/S"); //Beam/collision veto based on bcm +// m_tree->Branch("vetoLucid",&m_nt_veto_lucid,"vetoLucid/S"); //Beam/collision veto based on lucid +// m_tree->Branch("vetoMBTSDtHalo",&m_nt_veto_mbtstdHalo,"vetoMBTSDtHalo/S"); +// m_tree->Branch("vetoMBTSDtCol",&m_nt_veto_mbtstdCol,"vetoMBTSDtCol/S"); +// m_tree->Branch("vetoLArDtHalo",&m_nt_veto_lartdHalo,"vetoLArDtHalo/S"); +// m_tree->Branch("vetoLArDtCol",&m_nt_veto_lartdCol,"vetoLArDtCol/S"); +// m_tree->Branch("vetoCSCDtHalo",&m_nt_veto_csctdHalo,"vetoCSCDtHalo/S"); +// m_tree->Branch("vetoCSCDtCol",&m_nt_veto_csctdCol,"vetoCSCDtCol/S"); +// m_tree->Branch("vetoBCMDtHalo",&m_nt_veto_bcmtHalo,"vetoBCMDtHalo/S"); +// m_tree->Branch("vetoBCMDtCol",&m_nt_veto_bcmtCol,"vetoBCMDtCol/S"); +// m_tree->Branch("vetoMuonTimmingCol", &m_nt_veto_muontCol,"vetoMuonTimmingCol/S"); +// m_tree->Branch("vetoMuonTimmingCosmic",&m_nt_veto_muontCosmic,"vetoMuonTimmingCosmic/S"); + + // LAr event bit info + m_tree->Branch("larflag_badFEBs",&m_nt_larflag_badFEBs,"larflag_badFEBs/O"); + m_tree->Branch("larflag_mediumSaturatedDQ",&m_nt_larflag_mediumSaturatedDQ,"larflag_mediumSaturatedDQ/O"); + m_tree->Branch("larflag_tightSaturatedDQ",&m_nt_larflag_tightSaturatedDQ,"larflag_tightSaturatedDQ/O"); + m_tree->Branch("larflag_noiseBurstVeto",&m_nt_larflag_noiseBurstVeto,"larflag_noiseBurstVeto/O"); + m_tree->Branch("larflag_dataCorrupted",&m_nt_larflag_dataCorrupted,"larflag_dataCorrupted/O"); + m_tree->Branch("larflag_dataCorruptedVeto",&m_nt_larflag_dataCorruptedVeto,"larflag_dataCorruptedVeto/O"); + + // trigger flags + m_tree->Branch("L1_J75",&m_nt_L1_J75,"L1_J75/O"); + m_tree->Branch("L1_J10_EMPTY",&m_nt_L1_J10_EMPTY,"L1_J10_EMPTY/O"); + m_tree->Branch("L1_J30_FIRSTEMPTY",&m_nt_L1_J30_FIRSTEMPTY,"L1_J30_FIRSTEMPTY/O"); + m_tree->Branch("L1_J30_EMPTY",&m_nt_L1_J30_EMPTY,"L1_J30_EMPTY/O"); + m_tree->Branch("L1_XE40",&m_nt_L1_XE40,"L1_XE40/O"); + m_tree->Branch("L1_XE50",&m_nt_L1_XE50,"L1_XE50/O"); + m_tree->Branch("L1_XE50_BGRP7",&m_nt_L1_XE50_BGRP7,"L1_XE50_BGRP7/O"); + m_tree->Branch("L1_XE70",&m_nt_L1_XE70,"L1_XE70/O"); + + m_tree->Branch("EF_j165_u0uchad_LArNoiseBurst",&m_nt_EF_j165_u0uchad_LArNoiseBurst,"EF_j165_u0uchad_LArNoiseBurst/O"); + m_tree->Branch("EF_j30_u0uchad_empty_LArNoiseBurst",&m_nt_EF_j30_u0uchad_empty_LArNoiseBurst,"EF_j30_u0uchad_empty_LArNoiseBurst/O"); + m_tree->Branch("EF_j55_u0uchad_firstempty_LArNoiseBurst",&m_nt_EF_j55_u0uchad_firstempty_LArNoiseBurst,"EF_j55_u0uchad_firstempty_LArNoiseBurst/O"); + m_tree->Branch("EF_j55_u0uchad_empty_LArNoiseBurst",&m_nt_EF_j55_u0uchad_empty_LArNoiseBurst,"EF_j55_u0uchad_empty_LArNoiseBurst/O"); + m_tree->Branch("EF_xe45_LArNoiseBurst",&m_nt_EF_xe45_LArNoiseBurst,"EF_xe45_LArNoiseBurst/O"); + m_tree->Branch("EF_xe55_LArNoiseBurst",&m_nt_EF_xe55_LArNoiseBurst,"EF_xe55_LArNoiseBurst/O"); + m_tree->Branch("EF_xe60_LArNoiseBurst",&m_nt_EF_xe60_LArNoiseBurst,"EF_xe60_LArNoiseBurst/O"); + m_tree->Branch("EF_j55_u0uchad_firstempty_LArNoiseBurstT",&m_nt_EF_j55_u0uchad_firstempty_LArNoiseBurstT,"EF_j55_u0uchad_firstempty_LArNoiseBurstT/O"); + m_tree->Branch("EF_j100_u0uchad_LArNoiseBurstT",&m_nt_EF_j100_u0uchad_LArNoiseBurstT,"EF_j100_u0uchad_LArNoiseBurstT/O"); + m_tree->Branch("EF_j165_u0uchad_LArNoiseBurstT",&m_nt_EF_j165_u0uchad_LArNoiseBurstT,"EF_j165_u0uchad_LArNoiseBurstT/O"); + m_tree->Branch("EF_j130_u0uchad_LArNoiseBurstT",&m_nt_EF_j130_u0uchad_LArNoiseBurstT,"EF_j130_u0uchad_LArNoiseBurstT/O"); + m_tree->Branch("EF_j35_u0uchad_empty_LArNoiseBurst",&m_nt_EF_j35_u0uchad_empty_LArNoiseBurst,"EF_j35_u0uchad_empty_LArNoiseBurst/O"); + m_tree->Branch("EF_j35_u0uchad_firstempty_LArNoiseBurst",&m_nt_EF_j35_u0uchad_firstempty_LArNoiseBurst,"EF_j35_u0uchad_firstempty_LArNoiseBurst/O"); + m_tree->Branch("EF_j80_u0uchad_LArNoiseBurstT",&m_nt_EF_j80_u0uchad_LArNoiseBurstT,"EF_j80_u0uchad_LArNoiseBurstT/O"); + + // + m_tree->Branch("LArCellSize", &m_nt_larcellsize,"LArCellSize/I"); // NEW number of online conected LAr cells + m_tree->Branch("CaloCellSize",&m_nt_cellsize,"CaloCellSize/I");// NEW number of total cells. + // LAr time difference as computed by LArCollisionTime info + m_tree->Branch("LArTime_Diff",&m_nt_ECTimeDiff,"LArTime_Diff/F"); // time diff between 2 endcaps + m_tree->Branch("LArTime_Avg",&m_nt_ECTimeAvg,"LArTime_Avg/F"); // time average of 2 endcaps + m_tree->Branch("LArTime_nCellA",&m_nt_nCellA,"LArTime_nCellA/I"); // nb of cells used to compute endcap A time + m_tree->Branch("LArTime_nCellC",&m_nt_nCellC,"LArTime_nCellC/I"); // nb of cells used to compute endcap C time + + // Event properties related to yield of channels in 3 sigma tails + m_tree->Branch("PerCentNoisyCell",&m_nt_noisycellpercent,"PerCentNoisyCell/F"); // Yield of channels in 3sigma tails in whole LAr + m_tree->Branch("PerCentNoisyCellPartition",&m_nt_noisycellpart); // Yield in each partition:0:embc 1:emba 2:emecc 3:emeca 4:fcalc 5:fcala 6:hecc 7:heca + + // LArNoisyRO output + m_tree->Branch("LArNoisyRO_Std", &m_nt_larnoisyro,"LArNoisyRO_Std/S"); // standard flag (>5 FEB with more than 30 cells with q factor > 4000) + m_tree->Branch("LArNoisyRO_Std_optimized", &m_nt_larnoisyro_opt,"LArNoisyRO_Std_optimized/S"); // standard flag with a double weight for critical FEB (>5 FEB with more than 30 cells with q factor > 4000) + m_tree->Branch("LArNoisyRO_SatTight",&m_nt_larnoisyro_satTwo,"LArNoisyRO_SatTight/S"); // tight flag (> 20 cells with E>1000MeV and saturated q factor) + + // Properties of cells with fabs(energy/noise)>3 + m_tree->Branch("NoisyCellPartitionLayerIndex",&m_nt_cellpartlayerindex); /// NEW Identifier of the cell + m_tree->Branch("NoisyCellOnlineIdentifier",&m_nt_cellIdentifier); // Identifier of the noisy cell + m_tree->Branch("NoisyCellPartition",&m_nt_partition); // Partition in 1 integer: 0:embc 1:emba 2:emecc 3:emeca 4:fcalc 5:fcala 6:hecc 7:heca + m_tree->Branch("NoisyCellFT",&m_nt_ft_noisy); // FT + m_tree->Branch("NoisyCellSlot",&m_nt_slot_noisy); // Slot + m_tree->Branch("NoisyCellChannel",&m_nt_channel_noisy); // Channel + m_tree->Branch("NoisyCellADCvalues", &m_nt_samples); // ADC values + m_tree->Branch("NoisyCellGain",&m_nt_gain); // Gain + m_tree->Branch("NoisyCellPhi",&m_nt_phicell); // Phi + m_tree->Branch("NoisyCellEta",&m_nt_etacell); // Eta + m_tree->Branch("NoisyCellLayer", &m_nt_layer); // layer + m_tree->Branch("NoisyCellHVphi", &m_nt_noisycellHVphi); // Phi of HV + m_tree->Branch("NoisyCellHVeta", &m_nt_noisycellHVeta); // Eta of HV + m_tree->Branch("NoisyCellEnergy",&m_nt_energycell); // Energy + m_tree->Branch("NoisyCellSignificance",&m_nt_signifcell); // Significance (energy/noise) + m_tree->Branch("NoisyCellQFactor",&m_nt_qfactorcell); // Q factor + m_tree->Branch("NoisyCellIsBad",&m_nt_isbadcell); // Bad channel status + // Event properties related to q factor + m_tree->Branch("nbLowQFactor", &m_lowqfactor,"m_lowqfactor/i"); // Nb of cells per event with q factor<1000 + m_tree->Branch("nbMedQFactor", &m_medqfactor,"m_medqfactor/i"); // Nb of cells per event with 1000<q factor<10000 + m_tree->Branch("nbHighQFactor", &m_hiqfactor,"m_hiqfactor/i"); // Nb of cells per event with q 10000<factor<65535 + m_tree->Branch("nbSatQFactor",&m_nb_sat,"nbSat/i"); // Nb of cells per event with saturated q factor (65535) + // Properties of cells with q factor saturated + m_tree->Branch("SatCellPartition",&m_nt_partition_sat); + m_tree->Branch("SatCellBarrelEc",&m_nt_barrelec_sat); + m_tree->Branch("SatCellPosNeg",&m_nt_posneg_sat); + m_tree->Branch("SatCellFT",&m_nt_ft_sat); + m_tree->Branch("SatCellSlot",&m_nt_slot_sat); + m_tree->Branch("SatCellChannel",&m_nt_channel_sat); + m_tree->Branch("SatCellEnergy",&m_nt_energy_sat); + m_tree->Branch("SatCellPhi", &m_nt_phicell_sat); + m_tree->Branch("SatCellEta",&m_nt_etacell_sat); + m_tree->Branch("SatCellLayer",&m_nt_layer_sat); + m_tree->Branch("SatCellIsBad", &m_nt_isbadcell_sat); + m_tree->Branch("SatCellOnlineIdentifier",&m_nt_cellIdentifier_sat); + + //HV information + m_tree->Branch("HV_Nominal", &m_nt_nominalhv); //Not yet filled + m_tree->Branch("HV_Maximal",&m_nt_maximalhv); // Not yet filled + + ATH_MSG_DEBUG ( "End of Initializing LArNoiseBursts" ); + + return StatusCode::SUCCESS; +} + +/////////////////////////////////////////////////////////////////////////////////// +/// Finalize - delete any memory allocation from the heap + +StatusCode LArNoiseBursts::finalize() { + ATH_MSG_DEBUG ( "in finalize()" ); + return StatusCode::SUCCESS; +} + +/////////////////////////////////////////////////////////////////////////////////// +/// Clear - clear CBNT members +StatusCode LArNoiseBursts::clear() { + /// For Athena-Aware NTuple + + ATH_MSG_DEBUG ( "start clearing variables " ); + + m_nb_sat = 0; + n_noisycell = 0; + m_lowqfactor = 0; + m_medqfactor = 0; + m_hiqfactor = 0; + + m_nt_run = 0; + m_nt_evtId = 0; + m_nt_evtTime = 0; + m_nt_evtTime_ns = 0; + m_nt_lb = 0; + m_nt_bcid = -1; + + m_nt_streamTagName.clear(); + m_nt_streamTagType.clear(); + m_nt_isbcidFilled = -1; + m_nt_isbcidInTrain = -1; + m_nt_isBunchesInFront.clear(); + m_nt_bunchtype = -1; + m_nt_bunchtime = -1.0; + m_nt_atlasready = -1; + m_nt_stablebeams = -1; + m_nt_larnoisyro = -1; + m_nt_larnoisyro_opt = -1; + m_nt_larnoisyro_satTwo= -1; + + ATH_MSG_DEBUG ( "clearing event info veto variables " ); + + //clearing event info veto variables +// m_nt_veto_mbts = -1; +// m_nt_veto_pixel = -1; +// m_nt_veto_sct = -1; +// m_nt_veto_bcm = -1; +// m_nt_veto_lucid = -1; +// m_nt_veto_mbtstdHalo = -1; +// m_nt_veto_mbtstdCol = -1; +// m_nt_veto_lartdHalo = -1; +// m_nt_veto_lartdCol = -1; +// m_nt_veto_csctdHalo = -1; +// m_nt_veto_csctdCol = -1; +// m_nt_veto_bcmtHalo = -1; +// m_nt_veto_bcmtCol = -1; +// m_nt_veto_muontCol = -1; +// m_nt_veto_muontCosmic = -1; +// +// mLog << MSG::DEBUG << "clearing LAr event flags " << endreq; + + ATH_MSG_DEBUG ( "clearing LAr event flags " ); + + // lar bit event info + m_nt_larflag_badFEBs = false; + m_nt_larflag_mediumSaturatedDQ = false; + m_nt_larflag_tightSaturatedDQ = false; + m_nt_larflag_noiseBurstVeto = false; + m_nt_larflag_dataCorrupted = false; + m_nt_larflag_dataCorruptedVeto = false; + + ATH_MSG_DEBUG ( "clearing Pixel variables " ); + + // Trigger flags + m_nt_L1_J75 = true; // turned on for tests + m_nt_L1_J10_EMPTY = false; + m_nt_L1_J30_FIRSTEMPTY = false; + m_nt_L1_J30_EMPTY = false; + m_nt_L1_XE40 = false; + m_nt_L1_XE50 = false; + m_nt_L1_XE50_BGRP7 = false; + m_nt_L1_XE70 = false; + + m_nt_EF_j165_u0uchad_LArNoiseBurst = false; + m_nt_EF_j30_u0uchad_empty_LArNoiseBurst = false; + m_nt_EF_j55_u0uchad_firstempty_LArNoiseBurst = false; + m_nt_EF_j55_u0uchad_empty_LArNoiseBurst = false; + m_nt_EF_xe45_LArNoiseBurst = false; + m_nt_EF_xe55_LArNoiseBurst = false; + m_nt_EF_xe60_LArNoiseBurst = false; + m_nt_EF_j55_u0uchad_firstempty_LArNoiseBurstT = false; + m_nt_EF_j100_u0uchad_LArNoiseBurstT = false; + m_nt_EF_j165_u0uchad_LArNoiseBurstT = false; + m_nt_EF_j130_u0uchad_LArNoiseBurstT = false; + m_nt_EF_j35_u0uchad_empty_LArNoiseBurst = false; + m_nt_EF_j35_u0uchad_firstempty_LArNoiseBurst = false; + m_nt_EF_j80_u0uchad_LArNoiseBurstT = false; + + ATH_MSG_DEBUG ( "clearing trigger flags " ); + + ATH_MSG_DEBUG ( "clearing noisy cells variables " ); + + //Quantities for noisy cells + m_nt_energycell.clear(); + m_nt_qfactorcell.clear(); + m_nt_phicell.clear(); + m_nt_etacell.clear(); + m_nt_signifcell.clear(); + m_nt_isbadcell.clear(); + m_nt_partition.clear(); + m_nt_layer.clear(); + m_nt_noisycellpercent = -1; + m_nt_ft_noisy.clear(); + m_nt_slot_noisy.clear(); + m_nt_channel_noisy.clear(); + m_nt_larcellsize = -1; + m_nt_cellsize = -1; + m_nt_cellpartlayerindex.clear(); + m_nt_cellIdentifier.clear(); + m_nt_noisycellpart.clear(); + m_nt_samples.clear(); + m_nt_gain.clear(); + + ///HV branches + m_nt_nominalhv.clear(); + m_nt_maximalhv.clear(); + m_nt_noisycellHVphi.clear(); + m_nt_noisycellHVeta.clear(); + + ATH_MSG_DEBUG ( "clearing saturated cell variables " ); + + //clearing quantities for sat cells + m_nt_barrelec_sat.clear(); + m_nt_posneg_sat.clear(); + m_nt_ft_sat.clear(); + m_nt_slot_sat.clear(); + m_nt_channel_sat.clear(); + m_nt_partition_sat.clear(); + m_nt_energy_sat.clear(); + m_nt_phicell_sat.clear(); + m_nt_etacell_sat.clear(); + m_nt_layer_sat.clear(); + m_nt_cellIdentifier_sat.clear(); + m_nt_isbadcell_sat.clear(); + + ATH_MSG_DEBUG ( "clearing LArTimeDiff variables " ); + + //DiffTime computed with LAR + m_nt_ECTimeDiff = 9999; + m_nt_ECTimeAvg = 9999; + m_nt_nCellA = -1; + m_nt_nCellC = -1; + + return StatusCode::SUCCESS; +} + +////////////////////////////////////////////////////////////////////////////////// +/// Execute - on event by event + +StatusCode LArNoiseBursts::execute() { + ATH_MSG_DEBUG ( "in execute()" ); + StatusCode sc = clear(); + if(sc.isFailure()) { + ATH_MSG_WARNING ( "The method clear() failed" ); + return StatusCode::SUCCESS; + } + + if(!m_trigDec.empty()){ + + sc = doTrigger(); + if(sc.isFailure()) { + ATH_MSG_WARNING ( "The method doTrigger() failed" ); + return StatusCode::SUCCESS; + } + } + + sc = doEventProperties(); + if(sc.isFailure()) { + ATH_MSG_WARNING ( "The method doEventProperties() failed" ); + return StatusCode::SUCCESS; + } + + sc = doLArNoiseBursts(); + if (sc.isFailure()) { + ATH_MSG_WARNING ( "The method doLArNoiseBursts() failed" ); + return StatusCode::SUCCESS; + } + +// sc = doPhysicsObjects(); +// if (sc.isFailure()) { +// ATH_MSG_WARNING ( "The method doPhysicsObjects() failed" ); +// return StatusCode::SUCCESS; +// } + + m_tree->Fill(); + + return StatusCode::SUCCESS; +} + +////////////////////////////////////////////////////////////////////////////////////// +/////////////////// doTrigger //////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////////////// +StatusCode LArNoiseBursts::doTrigger(){ + ATH_MSG_DEBUG ("in doTrigger "); + + std::string mychain( "L1_J75" ); + if( ! m_trigDec->getListOfTriggers(mychain).empty() ){ + m_nt_L1_J75 = m_trigDec->isPassed( mychain ); + } + mychain = "L1_J10_EMPTY"; + if( ! m_trigDec->getListOfTriggers(mychain).empty()){ + m_nt_L1_J10_EMPTY = m_trigDec->isPassed( mychain ); + } + mychain = "L1_J30_FIRSTEMPTY"; + if( ! m_trigDec->getListOfTriggers(mychain).empty()){ + m_nt_L1_J30_FIRSTEMPTY = m_trigDec->isPassed( mychain ); + } + mychain = "L1_J30_EMPTY"; + if( ! m_trigDec->getListOfTriggers(mychain).empty()){ + m_nt_L1_J30_EMPTY = m_trigDec->isPassed( mychain ); + } + mychain = "L1_XE40"; + if( ! m_trigDec->getListOfTriggers(mychain).empty()){ + m_nt_L1_XE40 = m_trigDec->isPassed( mychain ); + } + mychain = "L1_XE50"; + if( ! m_trigDec->getListOfTriggers(mychain).empty()){ + m_nt_L1_XE50 = m_trigDec->isPassed( mychain ); + } + mychain = "L1_XE50_BGRP7"; + if( ! m_trigDec->getListOfTriggers(mychain).empty()){ + m_nt_L1_XE50_BGRP7 = m_trigDec->isPassed( mychain ); + } + mychain = "L1_XE70"; + if( ! m_trigDec->getListOfTriggers(mychain).empty()){ + m_nt_L1_XE70 = m_trigDec->isPassed( mychain ); + } + + // EF + mychain = "EF_j165_u0uchad_LArNoiseBurst"; + if( ! m_trigDec->getListOfTriggers(mychain).empty()){ + m_nt_EF_j165_u0uchad_LArNoiseBurst = m_trigDec->isPassed( mychain ); + } + mychain = "EF_j30_u0uchad_empty_LArNoiseBurst"; + if( ! m_trigDec->getListOfTriggers(mychain).empty()){ + m_nt_EF_j30_u0uchad_empty_LArNoiseBurst = m_trigDec->isPassed( mychain ); + } + mychain = "EF_j55_u0uchad_firstempty_LArNoiseBurst"; + if( ! m_trigDec->getListOfTriggers(mychain).empty()){ + m_nt_EF_j55_u0uchad_firstempty_LArNoiseBurst = m_trigDec->isPassed( mychain ); + } + mychain = "EF_j55_u0uchad_empty_LArNoiseBurst"; + if( ! m_trigDec->getListOfTriggers(mychain).empty()){ + m_nt_EF_j55_u0uchad_empty_LArNoiseBurst = m_trigDec->isPassed( mychain ); + } + mychain = "EF_xe45_LArNoiseBurst"; + if( ! m_trigDec->getListOfTriggers(mychain).empty()){ + m_nt_EF_xe45_LArNoiseBurst = m_trigDec->isPassed( mychain ); + } + mychain = "EF_xe55_LArNoiseBurst"; + if( ! m_trigDec->getListOfTriggers(mychain).empty()){ + m_nt_EF_xe55_LArNoiseBurst = m_trigDec->isPassed( mychain ); + } + mychain = "EF_xe60_LArNoiseBurst"; + if( ! m_trigDec->getListOfTriggers(mychain).empty()){ + m_nt_EF_xe60_LArNoiseBurst = m_trigDec->isPassed( mychain ); + } + mychain = "EF_j55_u0uchad_firstempty_LArNoiseBurstT"; + if( ! m_trigDec->getListOfTriggers(mychain).empty()){ + m_nt_EF_j55_u0uchad_firstempty_LArNoiseBurstT = m_trigDec->isPassed( mychain ); + } + mychain = "EF_j100_u0uchad_LArNoiseBurstT"; + if( ! m_trigDec->getListOfTriggers(mychain).empty()){ + m_nt_EF_j100_u0uchad_LArNoiseBurstT = m_trigDec->isPassed( mychain ); + } + mychain = "EF_j165_u0uchad_LArNoiseBurstT"; + if( ! m_trigDec->getListOfTriggers(mychain).empty()){ + m_nt_EF_j165_u0uchad_LArNoiseBurstT = m_trigDec->isPassed( mychain ); + } + mychain = "EF_j130_u0uchad_LArNoiseBurstT"; + if( ! m_trigDec->getListOfTriggers(mychain).empty()){ + m_nt_EF_j130_u0uchad_LArNoiseBurstT = m_trigDec->isPassed( mychain ); + } + mychain = "EF_j35_u0uchad_empty_LArNoiseBurst"; + if( ! m_trigDec->getListOfTriggers(mychain).empty()){ + m_nt_EF_j35_u0uchad_empty_LArNoiseBurst = m_trigDec->isPassed( mychain ); + } + mychain = "EF_j35_u0uchad_firstempty_LArNoiseBurst"; + if( ! m_trigDec->getListOfTriggers(mychain).empty()){ + m_nt_EF_j35_u0uchad_firstempty_LArNoiseBurst = m_trigDec->isPassed( mychain ); + } + mychain = "EF_j80_u0uchad_LArNoiseBurstT"; + if( ! m_trigDec->getListOfTriggers(mychain).empty()){ + m_nt_EF_j80_u0uchad_LArNoiseBurstT = m_trigDec->isPassed( mychain ); + } + + return StatusCode::SUCCESS; +} + +////////////////////////////////////////////////////////////////////////////////////// +/////////////////// doEventProperties ////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////// +StatusCode LArNoiseBursts::doEventProperties(){ + ATH_MSG_DEBUG ("in doEventProperties "); + + + //////////////////////////////// EventInfo variables ///////////////////////////////////////////////// + // Retrieve event info + const EventInfo* eventInfo = nullptr; + ATH_CHECK( evtStore()->retrieve(eventInfo) ); + + int run = eventInfo->runNumber(); + m_nt_run = eventInfo->runNumber(); + m_nt_evtId = eventInfo->eventNumber(); + m_nt_evtTime = eventInfo->timeStamp(); + m_nt_evtTime_ns = eventInfo->timeStampNSOffset(); + m_nt_lb = eventInfo->lumiBlock(); + m_nt_bcid = eventInfo->bcid(); + + ATH_MSG_DEBUG("Run Number: "<<run<<", event Id "<<m_nt_evtId<<", bcid = "<<m_nt_bcid); + + + m_nt_isbcidFilled = m_bc_tool->isFilled(m_nt_bcid); + m_nt_isbcidInTrain = m_bc_tool->isInTrain(m_nt_bcid); + m_nt_bunchtype = m_bc_tool->bcType(m_nt_bcid); + ATH_MSG_DEBUG("BCID is Filled: "<<m_nt_isbcidFilled); + ATH_MSG_DEBUG("BCID is in Train: "<<m_nt_isbcidInTrain); + ATH_MSG_DEBUG("bunch type "<<m_nt_bunchtype); + + std::vector<bool> isBunchesInFront = m_bc_tool->bunchesInFront(m_nt_bcid,m_frontbunches); + bool checkfirstbunch = true; + for(unsigned int i=0;i<isBunchesInFront.size();i++){ + ATH_MSG_DEBUG("bunch "<<i<<" is Filled "<<isBunchesInFront[i]); + m_nt_isBunchesInFront.push_back(isBunchesInFront[i]); + if(isBunchesInFront[i]==1){ + if(i!=0){ + if(checkfirstbunch){ + float time = 25.0*i; + m_nt_bunchtime = time; + ATH_MSG_DEBUG("next bunch time: "<<time<<" ns "); + checkfirstbunch = false; + } + } + } + } + + m_CosmicCaloStream = false; + //std::vector<TriggerInfo::StreamTag>::const_iterator streamInfoIt=myTriggerInfo->streamTags().begin(); + //std::vector<TriggerInfo::StreamTag>::const_iterator streamInfoIt_e=myTriggerInfo->streamTags().end(); + //for (;streamInfoIt!=streamInfoIt_e;streamInfoIt++) { + for (const auto& streamInfo : eventInfo->streamTags()) { + const std::string& stream_name = streamInfo.name(); + const std::string& stream_type = streamInfo.type(); + m_nt_streamTagName.push_back(stream_name); + m_nt_streamTagType.push_back(stream_type); + ATH_MSG_DEBUG("event stream tag name "<<streamInfo.name()); + ATH_MSG_DEBUG("event stream tag type "<<streamInfo.type()); + if(streamInfo.name()=="CosmicCalo" && streamInfo.type()=="physics"){ + m_CosmicCaloStream = true; + } + } + + + ATH_MSG_DEBUG("CosmicCalo stream value: "<<m_CosmicCaloStream); + + // Retrieve output of LArNoisyRO + bool larnoisyro = eventInfo->isEventFlagBitSet(EventInfo::LAr,LArEventBitInfo::BADFEBS); + bool larnoisyro_opt =eventInfo->isEventFlagBitSet(EventInfo::LAr,LArEventBitInfo::BADFEBS_W); + bool larnoisyro_satTwo = eventInfo->isEventFlagBitSet(EventInfo::LAr,LArEventBitInfo::TIGHTSATURATEDQ); + m_nt_larnoisyro = larnoisyro ? 1 : 0; + m_nt_larnoisyro_opt = larnoisyro_opt ? 1 : 0; + m_nt_larnoisyro_satTwo = larnoisyro_satTwo ? 1 : 0; + + // Retrieve output of EventInfo veto - COMMENTED NOW TO MAKE IT COMPLIANT WITH xAOD::EventInfo +// mLog << MSG::DEBUG <<"Background: MBTSBeamVeto "<<eventInfo->isEventFlagBitSet(EventInfo::Background,EventInfo::MBTSBeamVeto)<<endreq; +// mLog << MSG::DEBUG <<"Background: PixSPNonEmpty "<<eventInfo->isEventFlagBitSet(EventInfo::Background,EventInfo::PixSPNonEmpty)<<endreq; +// mLog << MSG::DEBUG <<"Background: SCTSPNonEmpty "<<eventInfo->isEventFlagBitSet(EventInfo::Background,EventInfo::SCTSPNonEmpty)<<endreq; +// mLog << MSG::DEBUG <<"Background: BCMBeamVeto "<<eventInfo->isEventFlagBitSet(EventInfo::Background,EventInfo::BCMBeamVeto)<<endreq; +// mLog << MSG::DEBUG <<"Background: LUCIDBeamVeto "<<eventInfo->isEventFlagBitSet(EventInfo::Background,EventInfo::LUCIDBeamVeto)<<endreq; +// mLog << MSG::DEBUG <<"Background: MBTSTimeDiffHalo "<<eventInfo->isEventFlagBitSet(EventInfo::Background,EventInfo::MBTSTimeDiffHalo)<<endreq; +// mLog << MSG::DEBUG <<"Background: MBTSTimeDiffCol "<<eventInfo->isEventFlagBitSet(EventInfo::Background,EventInfo::MBTSTimeDiffCol)<<endreq; +// mLog << MSG::DEBUG <<"Background: LArECTimeDiffHalo "<<eventInfo->isEventFlagBitSet(EventInfo::Background,EventInfo::LArECTimeDiffHalo)<<endreq; +// mLog << MSG::DEBUG <<"Background: LArECTimeDiffCol "<<eventInfo->isEventFlagBitSet(EventInfo::Background,EventInfo::LArECTimeDiffCol)<<endreq; +// mLog << MSG::DEBUG <<"Background: CSCTimeDiffHalo "<<eventInfo->isEventFlagBitSet(EventInfo::Background,EventInfo::CSCTimeDiffHalo)<<endreq; +// mLog << MSG::DEBUG <<"Background: CSCTimeDiffCol "<<eventInfo->isEventFlagBitSet(EventInfo::Background,EventInfo::CSCTimeDiffCol)<<endreq; +// mLog << MSG::DEBUG <<"Background: BCMTimeDiffHalo "<<eventInfo->isEventFlagBitSet(EventInfo::Background,EventInfo::BCMTimeDiffHalo)<<endreq; +// mLog << MSG::DEBUG <<"Background: BCMTimeDiffCol "<<eventInfo->isEventFlagBitSet(EventInfo::Background,EventInfo::BCMTimeDiffCol)<<endreq; +// mLog << MSG::DEBUG <<"Background: MuonTimmingCol "<<eventInfo->isEventFlagBitSet(EventInfo::Background,EventInfo::MuonTimingCol)<<endreq; +// mLog << MSG::DEBUG <<"Background: MuonTimmingCosmic "<<eventInfo->isEventFlagBitSet(EventInfo::Background,EventInfo::MuonTimingCosmic)<<endreq; +// +// m_nt_veto_mbts = eventInfo->isEventFlagBitSet(EventInfo::Background,EventInfo::MBTSBeamVeto); +// m_nt_veto_pixel = eventInfo->isEventFlagBitSet(EventInfo::Background,EventInfo::PixSPNonEmpty); +// m_nt_veto_sct = eventInfo->isEventFlagBitSet(EventInfo::Background,EventInfo::SCTSPNonEmpty); +// m_nt_veto_bcm = eventInfo->isEventFlagBitSet(EventInfo::Background,EventInfo::BCMBeamVeto); +// m_nt_veto_lucid = eventInfo->isEventFlagBitSet(EventInfo::Background,EventInfo::LUCIDBeamVeto); +// +// //more variables +// m_nt_veto_mbtstdHalo = eventInfo->isEventFlagBitSet(EventInfo::Background,EventInfo::MBTSTimeDiffHalo); +// m_nt_veto_mbtstdCol = eventInfo->isEventFlagBitSet(EventInfo::Background,EventInfo::MBTSTimeDiffCol); +// m_nt_veto_lartdHalo = eventInfo->isEventFlagBitSet(EventInfo::Background,EventInfo::LArECTimeDiffHalo); +// m_nt_veto_lartdCol = eventInfo->isEventFlagBitSet(EventInfo::Background,EventInfo::LArECTimeDiffCol); +// m_nt_veto_csctdHalo = eventInfo->isEventFlagBitSet(EventInfo::Background,EventInfo::CSCTimeDiffHalo); +// m_nt_veto_csctdCol = eventInfo->isEventFlagBitSet(EventInfo::Background,EventInfo::CSCTimeDiffCol); +// m_nt_veto_bcmtHalo = eventInfo->isEventFlagBitSet(EventInfo::Background,EventInfo::BCMTimeDiffHalo); +// m_nt_veto_bcmtCol = eventInfo->isEventFlagBitSet(EventInfo::Background,EventInfo::BCMTimeDiffCol); +// m_nt_veto_muontCol = eventInfo->isEventFlagBitSet(EventInfo::Background,EventInfo::MuonTimingCol); +// m_nt_veto_muontCosmic= eventInfo->isEventFlagBitSet(EventInfo::Background,EventInfo::MuonTimingCosmic); + + // LArEventInfo + + ATH_MSG_DEBUG ("NOISEBURSTVETO bit " << eventInfo->isEventFlagBitSet(EventInfo::LAr,LArEventBitInfo::NOISEBURSTVETO) ); + ATH_MSG_DEBUG ("BADFEBS bit " << eventInfo->isEventFlagBitSet(EventInfo::LAr,LArEventBitInfo::BADFEBS)); + ATH_MSG_DEBUG ("TIGHTSATURATEDQ bit " << eventInfo->isEventFlagBitSet(EventInfo::LAr,LArEventBitInfo::TIGHTSATURATEDQ)); + + m_nt_larflag_badFEBs = eventInfo->isEventFlagBitSet(EventInfo::LAr,LArEventBitInfo::BADFEBS); + m_nt_larflag_mediumSaturatedDQ = eventInfo->isEventFlagBitSet(EventInfo::LAr,LArEventBitInfo::MEDIUMSATURATEDQ); + m_nt_larflag_tightSaturatedDQ = eventInfo->isEventFlagBitSet(EventInfo::LAr,LArEventBitInfo::TIGHTSATURATEDQ); + m_nt_larflag_noiseBurstVeto = eventInfo->isEventFlagBitSet(EventInfo::LAr,LArEventBitInfo::NOISEBURSTVETO); + m_nt_larflag_dataCorrupted = eventInfo->isEventFlagBitSet(EventInfo::LAr,LArEventBitInfo::DATACORRUPTED); + m_nt_larflag_dataCorruptedVeto = eventInfo->isEventFlagBitSet(EventInfo::LAr,LArEventBitInfo::DATACORRUPTEDVETO); + + ///////////////////////////////////////end EventInfo variables///////////////////////////////////////////////////////////////////////// + + //const AthenaAttributeList* attrList(0); + //ATH_CHECK( evtStore()->retrieve(attrList, "/TDAQ/RunCtrl/DataTakingMode") ); + //if (attrList != 0) { + // ATH_MSG_DEBUG ("ReadyForPhysics is: " << (*attrList)["ReadyForPhysics"].data<uint32_t>()); + // //m_valueCache = ((*attrList)["ReadyForPhysics"].data<uint32_t>() != 0); + // m_nt_atlasready = (*attrList)["ReadyForPhysics"].data<uint32_t>(); + // } + + /*const AthenaAttributeList* fillstate(0); + sc = evtStore()->retrieve(fillstate, "/LHC/DCS/FILLSTATE"); + if (sc.isFailure()) { + ATH_MSG_WARNING ("Unable to retrieve fillstate information; falling back to" ); + return StatusCode::SUCCESS; + } + if (fillstate != 0) { + ATH_MSG_DEBUG ("Stable beams is: " << (*fillstate)["StableBeams"].data<uint32_t>()); + //m_valueCache = ((*attrList)["ReadyForPhysics"].data<uint32_t>() != 0); + m_nt_stablebeams.push_back((*fillstate)["StableBeams"].data<uint32_t>()); + }*/ + + + // 29/11/10 : Debug messages removed by BT + // mLog << MSG::INFO << "Event LAr flags " << std::hex + // << eventInfo->errorState(EventInfo::LAr) << " " + // << std::hex << eventInfo->eventFlags(EventInfo::LAr) + // << ", bit 0: " << eventInfo->isEventFlagBitSet(EventInfo::LAr,0) + // << ", bit 1: " << eventInfo->isEventFlagBitSet(EventInfo::LAr,1) + // << ", bit 2: " << eventInfo->isEventFlagBitSet(EventInfo::LAr,2) + // << endreq; + + // Retrieve LArCollision Timing information + const LArCollisionTime * larTime; + StatusCode sc = evtStore()->retrieve(larTime,"LArCollisionTime"); + if( sc.isFailure()){ + ATH_MSG_WARNING ( "Unable to retrieve LArCollisionTime event store" ); + //return StatusCode::SUCCESS; // Check if failure shd be returned. VB + }else { + ATH_MSG_DEBUG ( "LArCollisionTime successfully retrieved from event store" ); + } + + if (larTime) { + m_nt_nCellA = larTime->ncellA(); + m_nt_nCellC = larTime->ncellC(); + if(m_nt_nCellA>0 && m_nt_nCellC>0){ + // Calculate the time diff between ECC and ECA + m_nt_ECTimeDiff = larTime->timeC() - larTime->timeA(); + m_nt_ECTimeAvg = (larTime->timeC() + larTime->timeA()) * 0.5; + ATH_MSG_DEBUG ( "LAr: Calculated time difference of " << m_nt_ECTimeDiff << " ns" ); + } + } + + return StatusCode::SUCCESS; +} + +////////////////////////////////////////////////////////////////////////////////////// +/////////////////// doLArNoiseBursts /////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////////////// +StatusCode LArNoiseBursts::doLArNoiseBursts(){ + ATH_MSG_DEBUG ( "in doLarCellInfo " ); + + + // Retrieve LAr calocells container + const CaloCellContainer* caloTES; + StatusCode sc = evtStore()->retrieve( caloTES, "AllCalo"); + if (sc.isFailure()) { + ATH_MSG_WARNING ( "CaloCell Container not found!" ); + return StatusCode::SUCCESS; + } + + m_nb_sat = 0; + n_noisycell =0; + int nlarcell = 0; + CaloCellContainer::const_iterator caloItr; + int n_noisy_cell_part[8] = {0,0,0,0,0,0,0,0}; + int n_cell_part[8] = {0,0,0,0,0,0,0,0}; + std::vector<short> m_ft_noisy, m_slot_noisy, m_channel_noisy; + std::vector<bool> m_isbarrel, m_isendcap, m_isfcal, m_ishec; + std::vector<short> m_layer; + std::vector<int> m_partition,m_noisycellHVphi,m_noisycellHVeta; + std::vector<float> m_energycell, m_qfactorcell, m_signifcell; + std::vector<float> m_phicell, m_etacell; + std::vector<bool> m_isbadcell; + std::vector<IdentifierHash> m_IdHash; + std::vector<int> m_cellpartlayerindex; + std::vector<Identifier> m_cellIdentifier; + + m_ft_noisy.clear();m_slot_noisy.clear();m_channel_noisy.clear(); + m_isbarrel.clear();m_isendcap.clear();m_isfcal.clear();m_ishec.clear(); + m_layer.clear();m_partition.clear();m_energycell.clear();m_qfactorcell.clear(); + m_phicell.clear();m_etacell.clear();m_signifcell.clear();m_isbadcell.clear(); + m_IdHash.clear();m_noisycellHVeta.clear();m_noisycellHVphi.clear(); + m_cellpartlayerindex.clear();m_cellIdentifier.clear(); + + for(caloItr=caloTES->begin();caloItr!=caloTES->end();caloItr++){ + const CaloDetDescrElement* caloDDE = (*caloItr)->caloDDE(); + if (caloDDE->is_tile())continue; + HWIdentifier onlID; + try {onlID = m_LArCablingService->createSignalChannelID((*caloItr)->ID());} + catch(LArID_Exception& except) { + ATH_MSG_ERROR ( "LArID_Exception " << m_LArEM_IDHelper->show_to_string((*caloItr)->ID()) << " " << (std::string) except ); + ATH_MSG_ERROR ( "LArID_Exception " << m_LArHEC_IDHelper->show_to_string((*caloItr)->ID()) ); + ATH_MSG_ERROR ( "LArID_Exception " << m_LArFCAL_IDHelper->show_to_string((*caloItr)->ID()) ); + continue; + } + bool connected = m_LArCablingService->isOnlineConnected(onlID); + if(!connected) continue; + const Identifier idd = m_LArCablingService->cnvToIdentifier(onlID); + nlarcell++; + IdentifierHash channelHash = m_LArOnlineIDHelper->channel_Hash(onlID); + int layer = caloDDE->getLayer(); + // CaloCell_ID::CaloSample sampling = (*caloItr)->caloDDE()->getSampling(); + float eCalo = (*caloItr)->energy(); + float qfactor = (*caloItr)->quality(); + float phi = (*caloItr)->phi(); + //float noise = m_calo_noise_tool->getNoise( (*caloItr), ICaloNoiseTool::TOTALNOISE ); + float noise = m_calo_noise_tool->totalNoiseRMS( (*caloItr), (*caloItr)->gain()); + //float noise = m_calo_noise_tool->elecNoiseRMS( (*caloItr), (*caloItr)->gain(),-1); + float significance = eCalo / noise ; + float eta = (*caloItr)->eta(); + bool badcell = (*caloItr)->badcell(); + unsigned int partition = 0; + bool is_lar_em_barrel = caloDDE->is_lar_em_barrel(); + if(is_lar_em_barrel){ + if(eta<0){ + partition = 0; + }else{ + partition = 1; + } + }//barrel + bool is_lar_em_endcap = caloDDE->is_lar_em_endcap(); + if(is_lar_em_endcap){ + if(eta<0){ + partition = 2; + }else{ + partition = 3; + } + }//endcap + bool is_lar_fcal = caloDDE->is_lar_fcal(); + if(is_lar_fcal){ + if(eta<0){ + partition = 4; + }else{ + partition = 5; + } + }//fcal + bool is_lar_hec = caloDDE->is_lar_hec(); + if(is_lar_hec){ + if(eta<0){ + partition = 6; + }else{ + partition = 7; + } + }//hec + for(unsigned int k=0;k<8;k++){ + if(partition==k){ + n_cell_part[k]++; + } + } + if(qfactor <1000) {m_lowqfactor++;} + if(qfactor>=1000 && qfactor<10000) {m_medqfactor++;} + if(qfactor>=10000 && qfactor<65535){m_hiqfactor++;} + if(qfactor==65535){ + ATH_MSG_DEBUG ("Satured cell at eta: "<<eta<<", phi: "<<phi<<", partition: "<<partition); + m_nb_sat = m_nb_sat +1; + m_nt_partition_sat.push_back(partition); + m_nt_energy_sat.push_back(eCalo); + m_nt_cellIdentifier_sat.push_back((m_LArCablingService->cnvToIdentifier(onlID)).get_identifier32().get_compact()); + if(!m_keepOnlyCellID){ + m_nt_barrelec_sat.push_back(m_LArOnlineIDHelper->barrel_ec(onlID)); + m_nt_posneg_sat.push_back(m_LArOnlineIDHelper->pos_neg(onlID)); + m_nt_ft_sat.push_back(m_LArOnlineIDHelper->feedthrough(onlID)); + m_nt_slot_sat.push_back(m_LArOnlineIDHelper->slot(onlID)); + m_nt_channel_sat.push_back(m_LArOnlineIDHelper->channel(onlID)); + m_nt_phicell_sat.push_back(phi); + m_nt_etacell_sat.push_back(eta); + m_nt_layer_sat.push_back(layer); + m_nt_isbadcell_sat.push_back(badcell); + } + } + // Store all cells in positive and negative 3 sigma tails... + if(significance > m_sigmacut || qfactor > 4000){ + m_ft_noisy.push_back(m_LArOnlineIDHelper->feedthrough(onlID)); + m_slot_noisy.push_back(m_LArOnlineIDHelper->slot(onlID)); + m_channel_noisy.push_back(m_LArOnlineIDHelper->channel(onlID)); + + /* + m_isbarrel.push_back(is_lar_em_barrel); + m_isendcap.push_back(is_lar_em_endcap); + m_isfcal.push_back(is_lar_fcal); + m_ishec.push_back(is_lar_hec); + */ + + m_layer.push_back(layer); + m_energycell.push_back(eCalo); + m_qfactorcell.push_back(qfactor); + m_phicell.push_back(phi); + m_etacell.push_back(eta); + m_signifcell.push_back(significance); + m_isbadcell.push_back(badcell); + m_partition.push_back(partition); + m_IdHash.push_back(channelHash); + m_cellIdentifier.push_back(m_LArCablingService->cnvToIdentifier(onlID)); + // ...but count only cells in positive 3 sigma tails! + if (significance > m_sigmacut){ + n_noisycell++; + for(unsigned int k=0;k<8;k++){ + if(partition==k){ + n_noisy_cell_part[k]++; + } + } + } + int caloindex = GetPartitionLayerIndex(idd); + m_cellpartlayerindex.push_back(caloindex); + //store HV information + /*std::vector<int> * hvid = new std::vector<int>; + hvid.clear(); + //hvid = GetHVLines(idd); + std::vector<std::pair<LArHVCellID, int> > hv_vector; + hv_vector.clear(); + m_LArHVCablingTool->getLArHVCellID(idd,hv_vector); + if(hv_vector.size()>0){ + for(unsigned int i=0;i<hv_vector.size();i++){ + int nominal_HV = m_LArHVCablingTool->getNominalHV(hv_vector[i].first);//fill the branch but produces lots of warnings. + int maximal_HV = m_LArHVCablingTool->getMaximalHV(hv_vector[i].first);//fill the branch but produces lots of warnings. + m_nt_nominalhv.push_back(nominal_HV); + m_nt_maximalhv.push_back(maximal_HV); + } + }*/ + m_noisycellHVphi.push_back(m_LArElectrodeIDHelper->hv_phi(onlID)); + m_noisycellHVeta.push_back(m_LArElectrodeIDHelper->hv_eta(onlID)); + + } + + }//loop over cells + + m_nt_larcellsize = nlarcell; + m_nt_cellsize = caloTES->size(); + ATH_MSG_DEBUG ("lar cell size = "<<int(nlarcell)); + ATH_MSG_DEBUG ("all cell size = "<<int(caloTES->size())); + + if (nlarcell > 0) + m_nt_noisycellpercent = 100.0*double(n_noisycell)/double(nlarcell); + else + m_nt_noisycellpercent = 0; + + bool checknoise = false; + //ratio of noisy cells per partition + for(unsigned int i=0;i<8;i++){ + float noise = 100.0*(double(n_noisy_cell_part[i])/double(n_cell_part[i])); + m_nt_noisycellpart.push_back(noise); + if(noise> 1.0){ + checknoise = true; + ATH_MSG_DEBUG ("noise burst in this event "); + } + } + + const LArDigitContainer* LArDigitCont; + sc = evtStore()->retrieve(LArDigitCont, "LArDigitContainer_Thinned"); + if (sc.isFailure()) { + ATH_MSG_WARNING ( "LArDigitContainer Container not found!" ); + return StatusCode::SUCCESS; + } + + LArDigitContainer::const_iterator it=LArDigitCont->begin(); + LArDigitContainer::const_iterator it_end=LArDigitCont->end(); + const LArDigit* pLArDigit; + + bool store_condition = false; + // CosmicCalo stream : Store detailed infos of cells only if Y3Sigma>1% or burst found by LArNoisyRO + if(m_CosmicCaloStream){ + if(checknoise==true || m_nt_larnoisyro==1 || m_nt_larnoisyro_satTwo==1){ + store_condition = true; + } + } + // Not cosmicCalo stream : Store detailed infos of cells only if burst found by LArNoisyRO + if(!m_CosmicCaloStream){ + if(m_nt_larnoisyro==1 || m_nt_larnoisyro_satTwo==1){ + store_condition = true; + } + } + + //store the information of the noisy cell only when %noisycells > 1%. + if(store_condition){ + std::vector<short> samples; + samples.clear(); + for(unsigned int k=0;k<m_etacell.size();k++){ + m_nt_samples.push_back(samples); + m_nt_gain.push_back(0); + } + for (;it!=it_end;it++) { + pLArDigit = *it; + HWIdentifier id2 = pLArDigit->hardwareID(); + IdentifierHash hashid2 = m_LArOnlineIDHelper->channel_Hash(id2); + for(unsigned int j=0;j<m_IdHash.size();j++){ + if (hashid2 == m_IdHash[j] ){ + ATH_MSG_DEBUG ( "find a IdentifierHash of the noisy cell in LArDigit container " ); + samples = pLArDigit->samples(); + int gain=-1; + if (pLArDigit->gain() == CaloGain::LARHIGHGAIN) gain = 0; + if (pLArDigit->gain() == CaloGain::LARMEDIUMGAIN) gain = 1; + if (pLArDigit->gain() == CaloGain::LARLOWGAIN) gain = 2; + m_nt_gain.at(j)= gain; + m_nt_samples.at(j) = samples; + ATH_MSG_DEBUG ( "I got the samples!" ); + break; + } + } + } + for(unsigned int i=0;i<m_etacell.size();i++){ + m_nt_energycell.push_back( m_energycell[i]); + m_nt_qfactorcell.push_back( m_qfactorcell[i]); + m_nt_signifcell.push_back( m_signifcell[i]); + m_nt_partition.push_back( m_partition[i]); + m_nt_cellIdentifier.push_back(m_cellIdentifier[i].get_identifier32().get_compact()); + if(!m_keepOnlyCellID){ + m_nt_ft_noisy.push_back( m_ft_noisy[i]); + m_nt_slot_noisy.push_back( m_slot_noisy[i]); + m_nt_channel_noisy.push_back( m_channel_noisy[i]); + + /* + m_nt_isbarrel.push_back( m_isbarrel[i]); + m_nt_isendcap.push_back( m_isendcap[i]); + m_nt_isfcal.push_back( m_isfcal[i]); + m_nt_ishec.push_back( m_ishec[i]); + */ + + m_nt_layer.push_back( m_layer[i]); + m_nt_phicell.push_back( m_phicell[i]); + m_nt_etacell.push_back( m_etacell[i]); + m_nt_isbadcell.push_back( m_isbadcell[i]); + m_nt_noisycellHVphi.push_back(m_noisycellHVphi[i]); + m_nt_noisycellHVeta.push_back(m_noisycellHVeta[i]); + m_nt_cellpartlayerindex.push_back(m_cellpartlayerindex[i]); + } + } + ATH_MSG_DEBUG ("leaving if checknoise and larnoisyro"); + + }//if(checknoisy==true ..) + + return StatusCode::SUCCESS; + +} + +////////////////////////////////////////////////////////////////////////////////////// +/////////////////// doPhysicsObjects //////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////////////// +StatusCode LArNoiseBursts::doPhysicsObjects(){ + ATH_MSG_DEBUG ("in doPhysicsObjects "); + +// const ElectronContainer* elecTES = 0; +// StatusCode sc=evtStore()->retrieve( elecTES, m_elecContainerName); +// if( sc.isFailure() || !elecTES ) { +// ATH_MSG_WARNING ( "No ESD electron container found in StoreGate" ); +// return StatusCode::SUCCESS; +// } +// ATH_MSG_DEBUG ( "ElectronContainer successfully retrieved. Size = " << elecTES->size() ); + + return StatusCode::SUCCESS; +} + + +// + +int LArNoiseBursts::GetPartitionLayerIndex(const Identifier& id) +{ + // O.Simard -- GetPartitionLayer index [0,32]: + // Returns a single integer code that corresponds to the + // mapping of CaloCells in CaloMonitoring histogram frames. + + int caloindex = -1; + int bc = 0; + int sampling = 0; + + if(m_LArEM_IDHelper->is_lar_em(id)){ // EMB + bc = m_LArEM_IDHelper->barrel_ec(id); + sampling = m_LArEM_IDHelper->sampling(id); + if(abs(bc)==1){ + if(bc<0) caloindex = sampling+4; + else caloindex = sampling; + } else { // EMEC + if(bc<0) caloindex = sampling+12; + else caloindex = sampling+8; + } + } else if(m_LArHEC_IDHelper->is_lar_hec(id)) { // LAr HEC + bc = m_LArHEC_IDHelper->pos_neg(id); + sampling = m_LArHEC_IDHelper->sampling(id); + if(bc<0) caloindex = sampling+20; + else caloindex = sampling+16; + } else if(m_LArFCAL_IDHelper->is_lar_fcal(id)) { // LAr FCAL + bc = m_LArFCAL_IDHelper->pos_neg(id); + sampling = (int)m_LArFCAL_IDHelper->module(id); // module instead of sampling + if(bc<0) caloindex = sampling+26; + else caloindex = sampling+23; + } + + return caloindex; +} + +std::vector<int>* LArNoiseBursts::GetHVLines(const Identifier& id) +{ + ATH_MSG_DEBUG ( "in GetHVLines function " ); + + std::vector<int> tmplines; + unsigned int nelec = 0; + //unsigned int ngap = 0; + unsigned int nsubgaps = 0; + unsigned int nlines = 0; + unsigned int i=0,j=0,igap=0; + + // LAr EMB + if(m_LArEM_IDHelper->is_lar_em(id) && m_LArEM_IDHelper->sampling(id)>0){ + ATH_MSG_DEBUG ( "LAr EMB"); + if(abs(m_LArEM_IDHelper->barrel_ec(id))==1) { + const EMBDetectorElement* embElement = dynamic_cast<const EMBDetectorElement*>(m_calodetdescrmgr->get_element(id)); + if (!embElement) + return 0; + const EMBCellConstLink cell = embElement->getEMBCell(); + nelec = cell->getNumElectrodes(); + //ngap = 2*nelec; + for(i=0;i<nelec;i++) { + const EMBHVElectrodeConstLink electrode = cell->getElectrode(i); + for(igap=0;igap<2;igap++) tmplines.push_back(electrode->hvLineNo(igap)); + } + } else { // LAr EMEC + ATH_MSG_DEBUG ( "LAr EMEC"); + const EMECDetectorElement* emecElement = dynamic_cast<const EMECDetectorElement*>(m_calodetdescrmgr->get_element(id)); + if (!emecElement) + return 0; + const EMECCellConstLink cell = emecElement->getEMECCell(); + nelec = cell->getNumElectrodes(); + //ngap = 2*nelec; + for(i=0;i<nelec;i++) { + const EMECHVElectrodeConstLink electrode = cell->getElectrode(i); + for(igap=0;igap<2;igap++) tmplines.push_back(electrode->hvLineNo(igap)); + } + } + } else if(m_LArHEC_IDHelper->is_lar_hec(id)) { // LAr HEC + ATH_MSG_DEBUG ( "LAr HEC"); + const HECDetectorElement* hecElement = dynamic_cast<const HECDetectorElement*>(m_calodetdescrmgr->get_element(id)); + if (!hecElement) + return 0; + const HECCellConstLink cell = hecElement->getHECCell(); + nsubgaps = cell->getNumSubgaps(); + for(i=0;i<nsubgaps;i++) { + const HECHVSubgapConstLink subgap = cell->getSubgap(i); + tmplines.push_back(subgap->hvLineNo()); + } + } else if(m_LArFCAL_IDHelper->is_lar_fcal(id)) { // LAr FCAL + ATH_MSG_DEBUG ( "LAr HEC"); + const FCALDetectorElement* fcalElement = dynamic_cast<const FCALDetectorElement*>(m_calodetdescrmgr->get_element(id)); + if (!fcalElement) + return 0; + const FCALTile* tile = fcalElement->getFCALTile(); + nlines = tile->getNumHVLines(); + for(i=0;i<nlines;i++) { + const FCALHVLineConstLink line = tile->getHVLine(i); + if(line) tmplines.push_back(line->hvLineNo()); + } + } else if(m_LArEM_IDHelper->is_lar_em(id) && m_LArEM_IDHelper->sampling(id)==0) { // Presamplers + ATH_MSG_DEBUG ( "LAr PRESAMPLES"); + + if(abs(m_LArEM_IDHelper->barrel_ec(id))==1){ + + const EMBDetectorElement* embElement = dynamic_cast<const EMBDetectorElement*>(m_calodetdescrmgr->get_element(id)); + if (!embElement) { + return 0; + } + const EMBCellConstLink cell = embElement->getEMBCell(); + const EMBPresamplerHVModuleConstLink hvmodule = cell->getPresamplerHVModule(); + for(igap=0;igap<2;igap++) tmplines.push_back(hvmodule->hvLineNo(igap)); + + } else { + + const EMECDetectorElement* emecElement = dynamic_cast<const EMECDetectorElement*>(m_calodetdescrmgr->get_element(id)); + if (!emecElement) + return 0; + const EMECCellConstLink cell = emecElement->getEMECCell(); + const EMECPresamplerHVModuleConstLink hvmodule = cell->getPresamplerHVModule(); + for(igap=0;igap<2;igap++) tmplines.push_back(hvmodule->hvLineNo(igap)); + + } + } else { + ATH_MSG_WARNING ( " cell neither in EM nor HEC nor FCAL !!!!! return empty HV " ); + return (vector<int>*)0; + } + + // optimization of storage: replace by std:set + std::vector<int>* hvlines = new std::vector<int>; + bool found = 0; + for(i=0;i<tmplines.size();i++){ + found = 0; + for(j=0;j<hvlines->size();j++){ + if(hvlines->at(j)==tmplines.at(i)){ + found=1; + break; + } + } + if(!found) hvlines->push_back(tmplines.at(i)); + } + + return hvlines; +} + + + diff --git a/LArCalorimeter/LArCafJobs/src/LArShapeDumper.cxx b/LArCalorimeter/LArCafJobs/src/LArShapeDumper.cxx index ad6772f7bd9fa2c23303c62eaf458be33938df71..fa367e4dec07225580451d6aa4938aa76a4e19ad 100755 --- a/LArCalorimeter/LArCafJobs/src/LArShapeDumper.cxx +++ b/LArCalorimeter/LArCafJobs/src/LArShapeDumper.cxx @@ -63,6 +63,10 @@ using namespace LArSamples; LArShapeDumper::LArShapeDumper(const std::string & name, ISvcLocator * pSvcLocator) : AthAlgorithm(name, pSvcLocator), m_count(0), + m_nWrongBunchGroup(0), + m_nPrescaledAway(0), + m_nLArError(0), + m_nNoDigits(0), m_dumperTool("LArShapeDumperTool"), m_larCablingSvc("LArCablingService"), m_caloNoiseTool("CaloNoiseToolDefault"), @@ -71,6 +75,7 @@ LArShapeDumper::LArShapeDumper(const std::string & name, ISvcLocator * pSvcLocat m_adc2mevTool("LArADC2MeVTool"), m_trigDec("Trig::TrigDecisionTool/TrigDecisionTool"), m_configSvc("TrigConf::TrigConfigSvc/TrigConfigSvc", name), + m_bcidTool("BunchCrossingTool"), m_larPedestal(nullptr), m_caloDetDescrMgr(nullptr), m_onlineHelper(nullptr), @@ -95,6 +100,7 @@ LArShapeDumper::LArShapeDumper(const std::string & name, ISvcLocator * pSvcLocat declareProperty("BadChannelTool", m_badChannelTool), declareProperty("BadChannelMasker", m_badChannelMasker); declareProperty("ADC2MeVTool", m_adc2mevTool); + declareProperty("BunchCrossingTool",m_bcidTool); declareProperty("DoStream", m_doStream = false); declareProperty("DoTrigger", m_doTrigger = true); declareProperty("DoOFCIter", m_doOFCIter = true); @@ -104,6 +110,7 @@ LArShapeDumper::LArShapeDumper(const std::string & name, ISvcLocator * pSvcLocat declareProperty("TrigDecisionTool", m_trigDec, "The tool to access TrigDecision"); declareProperty("TriggerNames", m_triggerNames); declareProperty("DoAllLvl1", m_doAllLvl1 = true); + declareProperty("onlyEmptyBC",m_onlyEmptyBC=false); } @@ -134,7 +141,6 @@ StatusCode LArShapeDumper::initialize() ATH_CHECK( m_dumperTool.retrieve() ); if (m_dumperTool->doShape()) { - if (m_count == 1) ATH_MSG_INFO ( "Reading LArAutoCorr handle" ); ATH_CHECK( detStore()->regHandle(m_autoCorr, "LArAutoCorr") ); } @@ -148,6 +154,9 @@ StatusCode LArShapeDumper::initialize() m_gains[CaloGain::LARMEDIUMGAIN] = (m_gainSpec.find("MEDIUM") != std::string::npos); m_gains[CaloGain::LARLOWGAIN] = (m_gainSpec.find("LOW") != std::string::npos); + if (m_onlyEmptyBC) + ATH_CHECK(m_bcidTool.retrieve()); + return StatusCode::SUCCESS; } @@ -241,13 +250,14 @@ StatusCode LArShapeDumper::beginRun() StatusCode LArShapeDumper::execute() { + m_count++; + if ((m_prescale > 1 && m_random.Rndm() > 1.0/m_prescale) || m_prescale <= 0) { ATH_MSG_VERBOSE ( "======== prescaling event "<< m_count << " ========" ); + m_nPrescaledAway++; return StatusCode::SUCCESS; } - m_count++; - ATH_MSG_VERBOSE ( "======== executing event "<< m_count << " ========" ); const xAOD::EventInfo* eventInfo = 0; @@ -258,6 +268,22 @@ StatusCode LArShapeDumper::execute() int lumiBlock = eventInfo->lumiBlock(); int bunchId = eventInfo->bcid(); + + if (m_onlyEmptyBC) { + const Trig::IBunchCrossingTool::BunchCrossingType bcType=m_bcidTool->bcType(bunchId); + if (bcType!=Trig::IBunchCrossingTool::BunchCrossingType::Empty) { + ATH_MSG_DEBUG("Ignoring Event with bunch crossing type " << bcType); + m_nWrongBunchGroup++; + return StatusCode::SUCCESS; + } + } + + if (eventInfo->errorState(xAOD::EventInfo::LAr)==xAOD::EventInfo::Error) { + ATH_MSG_DEBUG("Ignoring Event b/c of LAr ERROR"); + m_nLArError++; + return StatusCode::SUCCESS; + } + EventData* eventData = 0; int eventIndex = -1; if (m_doAllEvents) { @@ -273,22 +299,20 @@ StatusCode LArShapeDumper::execute() if (larDigitContainer->size() == 0) { ATH_MSG_WARNING ( "LArDigitContainer with key=" << m_digitsKey << " is empty!" ); + m_nNoDigits++; return StatusCode::SUCCESS; } const LArRawChannelContainer* rawChannelContainer = 0; ATH_CHECK( evtStore()->retrieve(rawChannelContainer, m_channelsKey) ); - if (m_count == 1) ATH_MSG_INFO ( "Reading pedestal" ); ATH_CHECK( detStore()->retrieve(m_larPedestal) ); const LArOFIterResultsContainer* ofIterResult = 0; if (m_doOFCIter) { - if (m_count == 1) ATH_MSG_INFO ( "Reading LArOFIterResult" ); ATH_CHECK( evtStore()->retrieve(ofIterResult, "LArOFIterResult") ); } - if (m_count == 1) ATH_MSG_INFO ( "Reading LArFebErrorSummary" ); const LArFebErrorSummary* larFebErrorSummary = 0; ATH_CHECK( evtStore()->retrieve(larFebErrorSummary, "LArFebErrorSummary") ); const std::map<unsigned int,uint16_t>& febErrorMap = larFebErrorSummary->get_all_febs(); @@ -458,6 +482,11 @@ StatusCode LArShapeDumper::finalize() { ATH_MSG_DEBUG ("in finalize() "); + if (m_prescale>1) ATH_MSG_INFO("Prescale dropped " << m_nPrescaledAway << "/" << m_count << " events"); + if (m_onlyEmptyBC) ATH_MSG_INFO("Dropped " << m_nWrongBunchGroup << "/" << m_count << " events b/c of wrong bunch group"); + ATH_MSG_INFO("Dropped " << m_nLArError << "/" << m_count << " Events b/c of LAr Veto (Noise burst or corruption)"); + + int n = 0; for (unsigned int i = 0; i < m_samples->nChannels(); i++) if (m_samples->historyContainer(i)) { diff --git a/LArCalorimeter/LArCafJobs/src/LArShapeDumperTool.cxx b/LArCalorimeter/LArCafJobs/src/LArShapeDumperTool.cxx index a4a5b5edbb4481f7a5cc23d24c9666ab0def9576..1ce66e048baa4f101f3dda7ebf069fbd12e9ae5d 100644 --- a/LArCalorimeter/LArCafJobs/src/LArShapeDumperTool.cxx +++ b/LArCalorimeter/LArCafJobs/src/LArShapeDumperTool.cxx @@ -25,6 +25,7 @@ using namespace LArSamples; LArShapeDumperTool::LArShapeDumperTool(const std::string& type, const std::string& name, const IInterface* parent) : AthAlgTool(type, name, parent), + m_caloDetDescrMgr(0), m_onlineHelper(0), m_emId(0), m_hecId(0), m_fcalId(0) { declareInterface<ILArShapeDumperTool>(this); diff --git a/LArCalorimeter/LArCafJobs/src/components/LArCafJobs_entries.cxx b/LArCalorimeter/LArCafJobs/src/components/LArCafJobs_entries.cxx index cd78237d3dfdd783b5694c4a2cdd7a19fb64d6e1..6492aa3975ca7de94f199bf9b8878c6ca0342ae1 100755 --- a/LArCalorimeter/LArCafJobs/src/components/LArCafJobs_entries.cxx +++ b/LArCalorimeter/LArCafJobs/src/components/LArCafJobs_entries.cxx @@ -2,14 +2,20 @@ #include "LArCafJobs/LArShapeDumperTool.h" #include "LArCafJobs/LArShapeDumper.h" #include "LArCafJobs/LArSimpleShapeDumper.h" +#include "LArCafJobs/LArNoiseBursts.h" +#include "LArCafJobs/LArHECNoise.h" DECLARE_ALGORITHM_FACTORY(LArShapeDumper) DECLARE_ALGORITHM_FACTORY(LArSimpleShapeDumper) +DECLARE_ALGORITHM_FACTORY(LArNoiseBursts) +DECLARE_ALGORITHM_FACTORY(LArHECNoise) DECLARE_TOOL_FACTORY(LArShapeDumperTool) DECLARE_FACTORY_ENTRIES(LArCafJobs) { DECLARE_ALGORITHM(LArShapeDumper) DECLARE_ALGORITHM(LArSimpleShapeDumper) + DECLARE_ALGORITHM(LArNoiseBursts) + DECLARE_ALGORITHM(LArHECNoise) DECLARE_TOOL(LArShapeDumperTool) }