ATLAS Offline Software
Loading...
Searching...
No Matches
LArAccumulatedCalibDigitContSplitter.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3*/
4
6
7#include "GaudiKernel/MsgStream.h"
8
11
14
17
18#include <fstream>
19
20LArAccumulatedCalibDigitContSplitter::LArAccumulatedCalibDigitContSplitter(const std::string& name, ISvcLocator* pSvcLocator)
21 : AthAlgorithm(name, pSvcLocator),m_recAll(false), m_numLine(4),
23{
24 declareProperty("KeyList", m_keylist);
25 declareProperty("RecAllCells", m_recAll);
26 declareProperty("NumberSplitted", m_numLine);
27
28 declareProperty("KeyOutputList", m_OutputList);
29}
30
32= default;
33
35{
36 // Default list
37 if (m_keylist.empty()){ // Not key list given
38 m_keylist.emplace_back("HIGH");
39 m_keylist.emplace_back("MEDIUM");
40 m_keylist.emplace_back("LOW");
41 }
42
44
45 return StatusCode::SUCCESS;
46}
47
48
50{
51 if ( m_event_counter < 100 || ( m_event_counter < 1000 && m_event_counter%100==0 ) || m_event_counter%1000==0 )
52 ATH_MSG_INFO ( "Processing event " << m_event_counter );
54
55 if (m_keylist.empty()) {
56 ATH_MSG_ERROR ( "Key list is empty! No containers to process!" );
57 return StatusCode::FAILURE;
58 }
59
60 // execute() method...
62 return StatusCode::SUCCESS;
63
64}
65
67{
69 const LArAccumulatedCalibDigitContainer* larAccumulatedCalibDigitContainer;
70
71 // First loop over containers to get delayScale.
72 float delayScale = 1*CLHEP::ns;
73 for (const std::string& key : m_keylist) {
74 if (evtStore()->retrieve(larAccumulatedCalibDigitContainer,key).isSuccess()) {
75 if (!larAccumulatedCalibDigitContainer->empty()) {
76 delayScale = larAccumulatedCalibDigitContainer->getDelayScale();
77 }
78 }
79 }
80
81 std::vector<std::unique_ptr<ConstAccumContainer> > calibDigitCont (m_numLine);
82 for (unsigned int i=0;i<m_numLine;++i) {
83 calibDigitCont[i]= std::make_unique<ConstAccumContainer>(SG::VIEW_ELEMENTS,
84 delayScale);
85 }
86
87 //Loop over all containers that are to be processed (e.g. different gains)
88 for (const std::string& key : m_keylist) {
89 StatusCode sc = evtStore()->retrieve(larAccumulatedCalibDigitContainer,key);
90 if (sc.isFailure()) {
91 ATH_MSG_WARNING ( "Cannot read LArAccumulatedCalibDigitContainer from StoreGate! key=" << key );
92 continue; // Try next container
93 }
94
95 if (larAccumulatedCalibDigitContainer->empty()) {
96 ATH_MSG_DEBUG ( "LArAccumulatedCalibDigitContainer with key=" << key << " is empty " );
97 continue; // at this event LArAccumulatedCalibDigitContainer is empty, do not even try to loop on it...
98 }
99
100 for (const LArAccumulatedCalibDigit* digit : *larAccumulatedCalibDigitContainer) {
101 //HWIdentifier chid=digit->hardwareID();
102 CaloGain::CaloGain gain=digit->gain();
103
104 if (gain<0 || gain>CaloGain::LARNGAIN) {
105 ATH_MSG_ERROR ( "Found not-matching gain number ("<< (int)gain <<")" );
106 return StatusCode::FAILURE;
107 }
108
109 if ( (!m_recAll) && (!digit->isPulsed()) ) continue ; // If not all cells and not pulsed, skip cell
110
111 for(unsigned int iLine=1;iLine<=m_numLine;++iLine){
112 if(digit->isPulsed(iLine)){
113 calibDigitCont[iLine-1]->push_back(digit);
114 }
115 }
116 } //End loop over all cells
117
118 } //End loop over all containers
119
120 // Record splitted containers
121 for (unsigned int i=0;i<m_OutputList.size();++i) {
122 std::string key = m_OutputList[i];
123 ATH_CHECK( evtStore()->record(std::move(calibDigitCont[i]),key) );
124 }
125
126 return StatusCode::SUCCESS;
127}
128
129
130
132{
133// MsgStream log(msgSvc(), name());
134// log << MSG::INFO << " finished." << endmsg;
135 return StatusCode::SUCCESS;
136}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x)
#define ATH_MSG_INFO(x)
#define ATH_MSG_WARNING(x)
#define ATH_MSG_DEBUG(x)
DataVector adapter that acts like it holds const pointers.
static Double_t sc
AthAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Constructor with parameters:
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
DataVector adapter that acts like it holds const pointers.
bool empty() const noexcept
Returns true if the collection is empty.
LArAccumulatedCalibDigitContSplitter(const std::string &name, ISvcLocator *pSvcLocator)
Container class for LArAccumulatedCalibDigit.
double getDelayScale() const
get the delay Scale
Data class for calibration ADC samples preprocessed by the DSP.
@ LARNGAIN
Definition CaloGain.h:19
@ VIEW_ELEMENTS
this data object is a view, it does not own its elmts