ATLAS Offline Software
Public Member Functions | Protected Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
LArDuplicateConstants Class Reference

#include <LArDuplicateConstants.h>

Inheritance diagram for LArDuplicateConstants:
Collaboration diagram for LArDuplicateConstants:

Public Member Functions

 LArDuplicateConstants (const std::string &name, ISvcLocator *pSvcLocator)
 
 ~LArDuplicateConstants ()
 
StatusCode initialize ()
 
StatusCode execute ()
 
StatusCode stop ()
 
StatusCode finalize ()
 
virtual StatusCode sysInitialize () override
 Override sysInitialize. More...
 
virtual const DataObjIDColl & extraOutputDeps () const override
 Return the list of extra output dependencies. More...
 
ServiceHandle< StoreGateSvc > & evtStore ()
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc. More...
 
const ServiceHandle< StoreGateSvc > & evtStore () const
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc. More...
 
const ServiceHandle< StoreGateSvc > & detStore () const
 The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc. More...
 
virtual StatusCode sysStart () override
 Handle START transition. More...
 
virtual std::vector< Gaudi::DataHandle * > inputHandles () const override
 Return this algorithm's input handles. More...
 
virtual std::vector< Gaudi::DataHandle * > outputHandles () const override
 Return this algorithm's output handles. More...
 
Gaudi::Details::PropertyBase & declareProperty (Gaudi::Property< T > &t)
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, SG::VarHandleKey &hndl, const std::string &doc, const SG::VarHandleKeyType &)
 Declare a new Gaudi property. More...
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, SG::VarHandleBase &hndl, const std::string &doc, const SG::VarHandleType &)
 Declare a new Gaudi property. More...
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, SG::VarHandleKeyArray &hndArr, const std::string &doc, const SG::VarHandleKeyArrayType &)
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, T &property, const std::string &doc, const SG::NotHandleType &)
 Declare a new Gaudi property. More...
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, T &property, const std::string &doc="none")
 Declare a new Gaudi property. More...
 
void updateVHKA (Gaudi::Details::PropertyBase &)
 
MsgStream & msg () const
 
MsgStream & msg (const MSG::Level lvl) const
 
bool msgLvl (const MSG::Level lvl) const
 

Protected Member Functions

void renounceArray (SG::VarHandleKeyArray &handlesArray)
 remove all handles from I/O resolution More...
 
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce (T &h)
 
void extraDeps_update_handler (Gaudi::Details::PropertyBase &ExtraDeps)
 Add StoreName to extra input/output deps as needed. More...
 

Private Types

typedef ServiceHandle< StoreGateSvcStoreGateSvc_t
 

Private Member Functions

Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey> More...
 
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T > &hndl, const SG::VarHandleKeyArrayType &)
 specialization for handling Gaudi::Property<SG::VarHandleKeyArray> More...
 
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T > &hndl, const SG::VarHandleType &)
 specialization for handling Gaudi::Property<SG::VarHandleBase> More...
 
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T > &t, const SG::NotHandleType &)
 specialization for handling everything that's not a Gaudi::Property<SG::VarHandleKey> or a <SG::VarHandleKeyArray> More...
 

Private Attributes

const LArOnlineIDm_onlineHelper
 
unsigned int m_gainIN
 
unsigned int m_gainOUT
 
std::string m_keyPed
 
std::string m_keyRamp
 
std::string m_keyMPMC
 
std::string m_keyOFC
 
std::string m_keyShape
 
DataObjIDColl m_extendedExtraObjects
 
StoreGateSvc_t m_evtStore
 Pointer to StoreGate (event store by default) More...
 
StoreGateSvc_t m_detStore
 Pointer to StoreGate (detector store by default) More...
 
std::vector< SG::VarHandleKeyArray * > m_vhka
 
bool m_varHandleArraysDeclared
 

Detailed Description

Definition at line 27 of file LArDuplicateConstants.h.

Member Typedef Documentation

◆ StoreGateSvc_t

typedef ServiceHandle<StoreGateSvc> AthCommonDataStore< AthCommonMsg< Algorithm > >::StoreGateSvc_t
privateinherited

Definition at line 388 of file AthCommonDataStore.h.

Constructor & Destructor Documentation

◆ LArDuplicateConstants()

LArDuplicateConstants::LArDuplicateConstants ( const std::string &  name,
ISvcLocator *  pSvcLocator 
)

Definition at line 21 of file LArDuplicateConstants.cxx.

22  : AthAlgorithm(name,pSvcLocator),
23  m_onlineHelper(nullptr)
24 {
25  declareProperty("SourceGain" , m_gainIN = 1);
26  declareProperty("TargetGain" , m_gainOUT = 2);
27  declareProperty("KeyPedestal" , m_keyPed = "" ); //"LArPedestal");
28  declareProperty("KeyRamp" , m_keyRamp = "" ); //"LArRamp");
29  declareProperty("KeyMphysMcali" , m_keyMPMC = "" ); //"LArMphysOverMcal");
30  declareProperty("KeyOFC" , m_keyOFC = "" ); //"LArOFC");
31  declareProperty("KeyShape" , m_keyShape = "" ); //"LArShape");
32 }

◆ ~LArDuplicateConstants()

LArDuplicateConstants::~LArDuplicateConstants ( )
default

Member Function Documentation

◆ declareGaudiProperty() [1/4]

Gaudi::Details::PropertyBase& AthCommonDataStore< AthCommonMsg< Algorithm > >::declareGaudiProperty ( Gaudi::Property< T > &  hndl,
const SG::VarHandleKeyArrayType  
)
inlineprivateinherited

specialization for handling Gaudi::Property<SG::VarHandleKeyArray>

Definition at line 170 of file AthCommonDataStore.h.

172  {
173  return *AthCommonDataStore<PBASE>::declareProperty(hndl.name(),
174  hndl.value(),
175  hndl.documentation());
176 
177  }

◆ declareGaudiProperty() [2/4]

Gaudi::Details::PropertyBase& AthCommonDataStore< AthCommonMsg< Algorithm > >::declareGaudiProperty ( Gaudi::Property< T > &  hndl,
const SG::VarHandleKeyType  
)
inlineprivateinherited

specialization for handling Gaudi::Property<SG::VarHandleKey>

Definition at line 156 of file AthCommonDataStore.h.

158  {
159  return *AthCommonDataStore<PBASE>::declareProperty(hndl.name(),
160  hndl.value(),
161  hndl.documentation());
162 
163  }

◆ declareGaudiProperty() [3/4]

Gaudi::Details::PropertyBase& AthCommonDataStore< AthCommonMsg< Algorithm > >::declareGaudiProperty ( Gaudi::Property< T > &  hndl,
const SG::VarHandleType  
)
inlineprivateinherited

specialization for handling Gaudi::Property<SG::VarHandleBase>

Definition at line 184 of file AthCommonDataStore.h.

186  {
187  return *AthCommonDataStore<PBASE>::declareProperty(hndl.name(),
188  hndl.value(),
189  hndl.documentation());
190  }

◆ declareGaudiProperty() [4/4]

Gaudi::Details::PropertyBase& AthCommonDataStore< AthCommonMsg< Algorithm > >::declareGaudiProperty ( Gaudi::Property< T > &  t,
const SG::NotHandleType  
)
inlineprivateinherited

specialization for handling everything that's not a Gaudi::Property<SG::VarHandleKey> or a <SG::VarHandleKeyArray>

Definition at line 199 of file AthCommonDataStore.h.

200  {
201  return PBASE::declareProperty(t);
202  }

◆ declareProperty() [1/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< Algorithm > >::declareProperty ( const std::string &  name,
SG::VarHandleBase hndl,
const std::string &  doc,
const SG::VarHandleType  
)
inlineinherited

Declare a new Gaudi property.

Parameters
nameName of the property.
hndlObject holding the property value.
docDocumentation string for the property.

This is the version for types that derive from SG::VarHandleBase. The property value object is put on the input and output lists as appropriate; then we forward to the base class.

Definition at line 245 of file AthCommonDataStore.h.

249  {
250  this->declare(hndl.vhKey());
251  hndl.vhKey().setOwner(this);
252 
253  return PBASE::declareProperty(name,hndl,doc);
254  }

◆ declareProperty() [2/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< Algorithm > >::declareProperty ( const std::string &  name,
SG::VarHandleKey hndl,
const std::string &  doc,
const SG::VarHandleKeyType  
)
inlineinherited

Declare a new Gaudi property.

Parameters
nameName of the property.
hndlObject holding the property value.
docDocumentation string for the property.

This is the version for types that derive from SG::VarHandleKey. The property value object is put on the input and output lists as appropriate; then we forward to the base class.

Definition at line 221 of file AthCommonDataStore.h.

225  {
226  this->declare(hndl);
227  hndl.setOwner(this);
228 
229  return PBASE::declareProperty(name,hndl,doc);
230  }

◆ declareProperty() [3/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< Algorithm > >::declareProperty ( const std::string &  name,
SG::VarHandleKeyArray hndArr,
const std::string &  doc,
const SG::VarHandleKeyArrayType  
)
inlineinherited

Definition at line 259 of file AthCommonDataStore.h.

263  {
264 
265  // std::ostringstream ost;
266  // ost << Algorithm::name() << " VHKA declareProp: " << name
267  // << " size: " << hndArr.keys().size()
268  // << " mode: " << hndArr.mode()
269  // << " vhka size: " << m_vhka.size()
270  // << "\n";
271  // debug() << ost.str() << endmsg;
272 
273  hndArr.setOwner(this);
274  m_vhka.push_back(&hndArr);
275 
276  Gaudi::Details::PropertyBase* p = PBASE::declareProperty(name, hndArr, doc);
277  if (p != 0) {
278  p->declareUpdateHandler(&AthCommonDataStore<PBASE>::updateVHKA, this);
279  } else {
280  ATH_MSG_ERROR("unable to call declareProperty on VarHandleKeyArray "
281  << name);
282  }
283 
284  return p;
285 
286  }

◆ declareProperty() [4/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< Algorithm > >::declareProperty ( const std::string &  name,
T &  property,
const std::string &  doc,
const SG::NotHandleType  
)
inlineinherited

Declare a new Gaudi property.

Parameters
nameName of the property.
propertyObject holding the property value.
docDocumentation string for the property.

This is the generic version, for types that do not derive from SG::VarHandleKey. It just forwards to the base class version of declareProperty.

Definition at line 333 of file AthCommonDataStore.h.

337  {
338  return PBASE::declareProperty(name, property, doc);
339  }

◆ declareProperty() [5/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< Algorithm > >::declareProperty ( const std::string &  name,
T &  property,
const std::string &  doc = "none" 
)
inlineinherited

Declare a new Gaudi property.

Parameters
nameName of the property.
propertyObject holding the property value.
docDocumentation string for the property.

This dispatches to either the generic declareProperty or the one for VarHandle/Key/KeyArray.

Definition at line 352 of file AthCommonDataStore.h.

355  {
356  typedef typename SG::HandleClassifier<T>::type htype;
357  return declareProperty (name, property, doc, htype());
358  }

◆ declareProperty() [6/6]

Gaudi::Details::PropertyBase& AthCommonDataStore< AthCommonMsg< Algorithm > >::declareProperty ( Gaudi::Property< T > &  t)
inlineinherited

Definition at line 145 of file AthCommonDataStore.h.

145  {
146  typedef typename SG::HandleClassifier<T>::type htype;
148  }

◆ detStore()

const ServiceHandle<StoreGateSvc>& AthCommonDataStore< AthCommonMsg< Algorithm > >::detStore ( ) const
inlineinherited

The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 95 of file AthCommonDataStore.h.

95 { return m_detStore; }

◆ evtStore() [1/2]

ServiceHandle<StoreGateSvc>& AthCommonDataStore< AthCommonMsg< Algorithm > >::evtStore ( )
inlineinherited

The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 85 of file AthCommonDataStore.h.

85 { return m_evtStore; }

◆ evtStore() [2/2]

const ServiceHandle<StoreGateSvc>& AthCommonDataStore< AthCommonMsg< Algorithm > >::evtStore ( ) const
inlineinherited

The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 90 of file AthCommonDataStore.h.

90 { return m_evtStore; }

◆ execute()

StatusCode LArDuplicateConstants::execute ( )
inline

Definition at line 34 of file LArDuplicateConstants.h.

34 {return StatusCode::SUCCESS;}

◆ extraDeps_update_handler()

void AthCommonDataStore< AthCommonMsg< Algorithm > >::extraDeps_update_handler ( Gaudi::Details::PropertyBase &  ExtraDeps)
protectedinherited

Add StoreName to extra input/output deps as needed.

use the logic of the VarHandleKey to parse the DataObjID keys supplied via the ExtraInputs and ExtraOuputs Properties to add the StoreName if it's not explicitly given

◆ extraOutputDeps()

const DataObjIDColl & AthAlgorithm::extraOutputDeps ( ) const
overridevirtualinherited

Return the list of extra output dependencies.

This list is extended to include symlinks implied by inheritance relations.

Definition at line 50 of file AthAlgorithm.cxx.

51 {
52  // If we didn't find any symlinks to add, just return the collection
53  // from the base class. Otherwise, return the extended collection.
54  if (!m_extendedExtraObjects.empty()) {
56  }
57  return Algorithm::extraOutputDeps();
58 }

◆ finalize()

StatusCode LArDuplicateConstants::finalize ( )
inline

Definition at line 36 of file LArDuplicateConstants.h.

36 {return StatusCode::SUCCESS;}

◆ initialize()

StatusCode LArDuplicateConstants::initialize ( )

Definition at line 39 of file LArDuplicateConstants.cxx.

40 {
41  ATH_MSG_INFO ( "Initialing " << name() );
42  ATH_MSG_INFO ( "INPUT gain = " << m_gainIN );
43  ATH_MSG_INFO ( "OUTPUT gain = " << m_gainOUT );
44  return StatusCode::SUCCESS;
45 }

◆ inputHandles()

virtual std::vector<Gaudi::DataHandle*> AthCommonDataStore< AthCommonMsg< Algorithm > >::inputHandles ( ) const
overridevirtualinherited

Return this algorithm's input handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ msg() [1/2]

MsgStream& AthCommonMsg< Algorithm >::msg ( ) const
inlineinherited

Definition at line 24 of file AthCommonMsg.h.

24  {
25  return this->msgStream();
26  }

◆ msg() [2/2]

MsgStream& AthCommonMsg< Algorithm >::msg ( const MSG::Level  lvl) const
inlineinherited

Definition at line 27 of file AthCommonMsg.h.

27  {
28  return this->msgStream(lvl);
29  }

◆ msgLvl()

bool AthCommonMsg< Algorithm >::msgLvl ( const MSG::Level  lvl) const
inlineinherited

Definition at line 30 of file AthCommonMsg.h.

30  {
31  return this->msgLevel(lvl);
32  }

◆ outputHandles()

virtual std::vector<Gaudi::DataHandle*> AthCommonDataStore< AthCommonMsg< Algorithm > >::outputHandles ( ) const
overridevirtualinherited

Return this algorithm's output handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ renounce()

std::enable_if_t<std::is_void_v<std::result_of_t<decltype(&T::renounce)(T)> > && !std::is_base_of_v<SG::VarHandleKeyArray, T> && std::is_base_of_v<Gaudi::DataHandle, T>, void> AthCommonDataStore< AthCommonMsg< Algorithm > >::renounce ( T &  h)
inlineprotectedinherited

Definition at line 380 of file AthCommonDataStore.h.

381  {
382  h.renounce();
383  PBASE::renounce (h);
384  }

◆ renounceArray()

void AthCommonDataStore< AthCommonMsg< Algorithm > >::renounceArray ( SG::VarHandleKeyArray handlesArray)
inlineprotectedinherited

remove all handles from I/O resolution

Definition at line 364 of file AthCommonDataStore.h.

364  {
365  handlesArray.renounce();
366  }

◆ stop()

StatusCode LArDuplicateConstants::stop ( )

Definition at line 48 of file LArDuplicateConstants.cxx.

49 {
50  ATH_MSG_INFO ( "Entering LArDuplicateConstants" );
51 
52  ATH_CHECK( detStore()->retrieve(m_onlineHelper, "LArOnlineID") );
53 
54  // PEDESTAL
55 
56  if (!m_keyPed.empty()) {
57 
58  const LArPedestalComplete* PedestalIN;
59  LArPedestalComplete* PedestalOUT;
60  ATH_CHECK( detStore()->retrieve(PedestalIN,m_keyPed) );
61  PedestalOUT=const_cast<LArPedestalComplete*>(PedestalIN); // cast to non-const the same container
62 
63  unsigned int n_tot_ped = 0;
64  unsigned int n_dup_ped = 0;
65 
66  PedestalIt ped_it = PedestalIN->begin(m_gainIN);
67  PedestalIt ped_it_e = PedestalIN->end(m_gainIN);
68  if ( ped_it == ped_it_e ) {
69  ATH_MSG_WARNING ( "LArPedestalComplete (key = " << m_keyPed << ") has no pedestals with gain = " << m_gainIN );
70  }
71  for ( ; ped_it!=ped_it_e; ped_it++) {
72  const HWIdentifier chid = ped_it.channelId();
73  if (m_onlineHelper->isEMBPS(chid)) { // duplicate constants for EMB PS only
74  n_tot_ped++;
75  const LArPedestalP1& ped_t = PedestalOUT->get(chid,m_gainOUT);
76  if (ped_t.isEmpty()) {
77  n_dup_ped++;
78  const LArPedestalP1& ped = PedestalIN->get(chid,m_gainIN);
79  PedestalOUT->setPdata(chid,ped,m_gainOUT);
80  ATH_MSG_VERBOSE ( "Pedestal for channel 0x" << MSG::hex << chid.get_compact() << MSG::dec
81  << " duplicated from gain " << m_gainIN << " to gain " << m_gainOUT );
82  } else {
83  ATH_MSG_VERBOSE ( "Pedestal for channel 0x" << MSG::hex << chid.get_compact() << MSG::dec
84  << " in gain " << m_gainOUT << " exists! Not duplicating..." );
85  }
86  }
87  }
88  ATH_MSG_INFO ( "LArPedestalComplete (key = " << m_keyPed << ") content duplicated from gain "
89  << m_gainIN << " to gain " << m_gainOUT
90  << " (" << n_dup_ped << "/" << n_tot_ped << " PS channels)" );
91  }
92 
93  // RAMP
94 
95  if (!m_keyRamp.empty()) {
96 
97  const LArRampComplete* RampIN = nullptr;
98  LArRampComplete* RampOUT = nullptr;
99  ATH_CHECK( detStore()->retrieve(RampIN,m_keyRamp) );
100  RampOUT=const_cast<LArRampComplete*>(RampIN); // cast to non-const the same container
101 
102  bool undoCorr=false;
103 
104  if (!RampOUT->correctionsApplied()) {
105  ATH_CHECK( RampOUT->applyCorrections() );
106  undoCorr=true;
107  ATH_MSG_INFO ( "Applied corrections for Ramp" );
108  }
109  unsigned deltaGain = (m_gainOUT-m_gainIN); // Ex: 2-1 = 1
110  float scaleRamp = pow(10.,deltaGain); // Ex: 10^1 = 10
111  ATH_MSG_INFO ( "Ramp scale factor = " << scaleRamp );
112 
113  unsigned int n_tot_ramp = 0;
114  unsigned int n_dup_ramp = 0;
115  unsigned nCorrChans=0;
116 
117  RampIt ramp_it = RampIN->begin(m_gainIN);
118  RampIt ramp_it_e = RampIN->end(m_gainIN);
119  if ( ramp_it == ramp_it_e ) {
120  ATH_MSG_WARNING ( "LArRampComplete (key = " << m_keyRamp << ") has no ramps with gain = " << m_gainIN );
121  }
122  for ( ; ramp_it!=ramp_it_e; ramp_it++) {
123  const HWIdentifier chid = ramp_it.channelId();
124  if (m_onlineHelper->isEMBPS(chid)) { // duplicate constants for EMB PS only
125  n_tot_ramp++;
126  const LArRampP1& ramp_t = RampOUT->get(chid,m_gainOUT);
127  if (ramp_t.isEmpty()) {
128  n_dup_ramp++;
129  const LArRampP1& ramp = RampIN->get(chid,m_gainIN);
130  // scale ramp according to gain difference
131  unsigned s = ramp.m_vRamp.size();
132  LArRampP1 newramp;
133  newramp.m_vRamp.clear();
134  newramp.m_vRamp.resize(s);
135  for (unsigned i=0;i<s;i++) {
136  newramp.m_vRamp[i] = ramp.m_vRamp[i] * scaleRamp;
137  }
138  RampOUT->setPdata(chid,newramp,m_gainOUT);
139  ATH_MSG_VERBOSE ( "Ramp for channel 0x" << MSG::hex << chid.get_compact() << MSG::dec
140  << " duplicated from gain " << m_gainIN << " to gain " << m_gainOUT );
141  } else {
142  ATH_MSG_VERBOSE ( "Ramp for channel 0x" << MSG::hex << chid.get_compact() << MSG::dec
143  << " in gain " << m_gainOUT << " exists! Not duplicating..." );
144  }
145  }
146  }
147  if (undoCorr) {
148  ATH_CHECK( RampOUT->undoCorrections() );
149  ATH_MSG_INFO ( "Undo corrections for Ramp" );
150  }
151  else {
152  //Now work on correction channels
155  for (;cit!=cit_e;cit++) {
156  const HWIdentifier chid(cit->first);
157  if (m_onlineHelper->isEMBPS(chid)) { // duplicate constants for EMB PS only
158  const LArRampP1& ramp=cit->second;
159  const unsigned s = ramp.m_vRamp.size();
160  LArRampP1 newramp;
161  newramp.m_vRamp.clear();
162  newramp.m_vRamp.resize(s);
163  for (unsigned i=0;i<s;i++) {
164  newramp.m_vRamp[i] = ramp.m_vRamp[i] * scaleRamp;
165  }
166  ATH_CHECK( RampOUT->insertCorrection(chid,newramp,m_gainOUT,false) );
167  ++nCorrChans;
168  }//end if isEMBPS
169  } // end loop over correction channels
170  }
171  ATH_MSG_INFO ( "LArRampComplete (key = " << m_keyRamp << ") content duplicated from gain "
172  << m_gainIN << " to gain " << m_gainOUT
173  << " (" << n_dup_ramp << "/" << n_tot_ramp << " + " << nCorrChans << " PS channels)" );
174  }
175 
176  // MPHYSOVERMCALI
177 
178  if (!m_keyMPMC.empty()) {
179 
180  const LArMphysOverMcalComplete* MphysMcaliIN = nullptr;
181  LArMphysOverMcalComplete* MphysMcaliOUT = nullptr;
182  ATH_CHECK( detStore()->retrieve(MphysMcaliIN,m_keyMPMC) );
183  MphysMcaliOUT=const_cast<LArMphysOverMcalComplete*>(MphysMcaliIN); // cast to non-const the same container
184 
185  unsigned int n_tot_mpmc = 0;
186  unsigned int n_dup_mpmc = 0;
187 
188  MpMcIt mpmc_it = MphysMcaliIN->begin(m_gainIN);
189  MpMcIt mpmc_it_e = MphysMcaliIN->end(m_gainIN);
190  if ( mpmc_it == mpmc_it_e ) {
191  ATH_MSG_WARNING ( "LArMphysOverMcaliComplete (key = " << m_keyMPMC << ") has no Mphys/Mcali with gain = " << m_gainIN );
192  }
193  for ( ; mpmc_it!=mpmc_it_e; mpmc_it++) {
194  const HWIdentifier chid = mpmc_it.channelId();
195  if (m_onlineHelper->isEMBPS(chid)) { // duplicate constants for EMB PS only
196  n_tot_mpmc++;
197  const LArSingleFloatP& mpmc_t = MphysMcaliOUT->get(chid,m_gainOUT);
198  if (mpmc_t.isEmpty()) {
199  n_dup_mpmc++;
200  const LArSingleFloatP& mpmc = MphysMcaliIN->get(chid,m_gainIN);
201  MphysMcaliOUT->setPdata(chid,mpmc,m_gainOUT);
202  ATH_MSG_VERBOSE ( "MpMc for channel 0x" << MSG::hex << chid.get_compact() << MSG::dec
203  << " duplicated from gain " << m_gainIN << " to gain " << m_gainOUT );
204  } else {
205  ATH_MSG_VERBOSE ( "MpMc for channel 0x" << MSG::hex << chid.get_compact() << MSG::dec
206  << " in gain " << m_gainOUT << " exists! Not duplicating..." );
207  }
208  }
209  }
210  ATH_MSG_INFO ( "LArMphysOverMcaliComplete (key = " << m_keyMPMC << ") content duplicated from gain "
211  << m_gainIN << " to gain " << m_gainOUT
212  << " (" << n_dup_mpmc << "/" << n_tot_mpmc << " PS channels)" );
213  }
214 
215  // OFC
216 
217  if (!m_keyOFC.empty()) {
218 
219  const LArOFCComplete* OFCIN = nullptr;
220  LArOFCComplete* OFCOUT = nullptr;
221  ATH_CHECK( detStore()->retrieve(OFCIN,m_keyOFC) );
222  OFCOUT=const_cast<LArOFCComplete*>(OFCIN); // cast to non-const the same container
223 
224  unsigned int n_tot_ofc = 0;
225  unsigned int n_dup_ofc = 0;
226 
227  OFCIt ofc_it = OFCIN->begin(m_gainIN);
228  OFCIt ofc_it_e = OFCIN->end(m_gainIN);
229  if ( ofc_it == ofc_it_e ) {
230  ATH_MSG_WARNING ( "LArOFCComplete (key = " << m_keyOFC << ") has no OFCs with gain = " << m_gainIN );
231  }
232  for ( ; ofc_it!=ofc_it_e; ofc_it++) {
233  const HWIdentifier chid = ofc_it.channelId();
234  if (m_onlineHelper->isEMBPS(chid)) { // duplicate constants for EMB PS only
235  n_tot_ofc++;
236 
237  //const LArOFCP1& ofc_t = OFCOUT->get(chid,m_gainOUT); // gives a segmentation fault from LAr2DWaveBase::LAr2DWaveBase(LArCompactSubsetChannelProxy const&) ()
238  // LArOFCP1 ofc_t = OFCOUT->get(chid,m_gainOUT); // make a copy instead? Nope, still segfaulting.
239  // if (ofc_t.isEmpty()) { } // cannot use this :-(
240 
241  // directly get one data member :-(
242  ILArOFC::OFCRef_t vOFCa_t = OFCOUT->OFC_a(chid,m_gainOUT);
243  if (!vOFCa_t.size()) { // emulate isEmpty() behavior
244 
245  n_dup_ofc++;
246  const LArOFCP1& ofc = OFCIN->get(chid,m_gainIN); // why is this working here? Because it;s not empty?
247  OFCOUT->setPdata(chid,ofc,m_gainOUT);
248  ATH_MSG_VERBOSE ( "OFC for channel 0x" << MSG::hex << chid.get_compact() << MSG::dec
249  << " duplicated from gain " << m_gainIN << " to gain " << m_gainOUT );
250  } else {
251  ATH_MSG_VERBOSE ( "OFC for channel 0x" << MSG::hex << chid.get_compact() << MSG::dec
252  << " in gain " << m_gainOUT << " exists! Not duplicating..." );
253 
254  }
255  }
256  }
257  ATH_MSG_INFO ( "LArOFCComplete (key = " << m_keyOFC << ") content duplicated from gain "
258  << m_gainIN << " to gain " << m_gainOUT
259  << " (" << n_dup_ofc << "/" << n_tot_ofc << " PS channels)" );
260  }
261 
262  // SHAPE
263 
264  if (!m_keyShape.empty()) {
265 
266  const LArShapeComplete* ShapeIN = nullptr;
267  LArShapeComplete* ShapeOUT = nullptr;
268  ATH_CHECK( detStore()->retrieve(ShapeIN,m_keyShape) );
269  ShapeOUT=const_cast<LArShapeComplete*>(ShapeIN); // cast to non-const the same container
270 
271  unsigned int n_tot_shape = 0;
272  unsigned int n_dup_shape = 0;
273 
274  ShapeIt shape_it = ShapeIN->begin(m_gainIN);
275  ShapeIt shape_it_e = ShapeIN->end(m_gainIN);
276  if ( shape_it == shape_it_e ) {
277  ATH_MSG_WARNING ( "LArShapeComplete (key = " << m_keyShape << ") has no Shapes with gain = " << m_gainIN );
278  }
279  for ( ; shape_it!=shape_it_e; shape_it++) {
280  const HWIdentifier chid = shape_it.channelId();
281  if (m_onlineHelper->isEMBPS(chid)) { // duplicate constants for EMB PS only
282  n_tot_shape++;
283 
284  //const LArShapeP2& shape_t = ShapeOUT->get(chid,m_gainOUT);
285  //if (shape_t.isEmpty()) {
286 
287  ILArShape::ShapeRef_t vShape_t = ShapeOUT->Shape(chid,m_gainOUT);
288  if (!vShape_t.size()) {
289 
290  n_dup_shape++;
291  const LArShapeP2& shape = ShapeIN->get(chid,m_gainIN);
292  ShapeOUT->setPdata(chid,shape,m_gainOUT);
293  ATH_MSG_VERBOSE ( "Shape for channel 0x" << MSG::hex << chid.get_compact() << MSG::dec
294  << " duplicated from gain " << m_gainIN << " to gain " << m_gainOUT );
295  } else {
296  ATH_MSG_VERBOSE ( "Shape for channel 0x" << MSG::hex << chid.get_compact() << MSG::dec
297  << " in gain " << m_gainOUT << " exists! Not duplicating..." );
298  }
299  }
300  }
301  ATH_MSG_INFO ( "LArShapeComplete (key = " << m_keyShape << ") content duplicated from gain "
302  << m_gainIN << " to gain " << m_gainOUT
303  << " (" << n_dup_shape << "/" << n_tot_shape << " PS channels)" );
304 
305  }
306 
307  ATH_MSG_INFO ( "Done with LArDuplicateConstants" );
308  return StatusCode::SUCCESS;
309 }

◆ sysInitialize()

StatusCode AthAlgorithm::sysInitialize ( )
overridevirtualinherited

Override sysInitialize.

Override sysInitialize from the base class.

Loop through all output handles, and if they're WriteCondHandles, automatically register them and this Algorithm with the CondSvc

Scan through all outputHandles, and if they're WriteCondHandles, register them with the CondSvc

Reimplemented from AthCommonDataStore< AthCommonMsg< Algorithm > >.

Reimplemented in AthAnalysisAlgorithm, AthFilterAlgorithm, PyAthena::Alg, and AthHistogramAlgorithm.

Definition at line 66 of file AthAlgorithm.cxx.

66  {
68 
69  if (sc.isFailure()) {
70  return sc;
71  }
72  ServiceHandle<ICondSvc> cs("CondSvc",name());
73  for (auto h : outputHandles()) {
74  if (h->isCondition() && h->mode() == Gaudi::DataHandle::Writer) {
75  // do this inside the loop so we don't create the CondSvc until needed
76  if ( cs.retrieve().isFailure() ) {
77  ATH_MSG_WARNING("no CondSvc found: won't autoreg WriteCondHandles");
78  return StatusCode::SUCCESS;
79  }
80  if (cs->regHandle(this,*h).isFailure()) {
81  sc = StatusCode::FAILURE;
82  ATH_MSG_ERROR("unable to register WriteCondHandle " << h->fullKey()
83  << " with CondSvc");
84  }
85  }
86  }
87  return sc;
88 }

◆ sysStart()

virtual StatusCode AthCommonDataStore< AthCommonMsg< Algorithm > >::sysStart ( )
overridevirtualinherited

Handle START transition.

We override this in order to make sure that conditions handle keys can cache a pointer to the conditions container.

◆ updateVHKA()

void AthCommonDataStore< AthCommonMsg< Algorithm > >::updateVHKA ( Gaudi::Details::PropertyBase &  )
inlineinherited

Definition at line 308 of file AthCommonDataStore.h.

308  {
309  // debug() << "updateVHKA for property " << p.name() << " " << p.toString()
310  // << " size: " << m_vhka.size() << endmsg;
311  for (auto &a : m_vhka) {
312  std::vector<SG::VarHandleKey*> keys = a->keys();
313  for (auto k : keys) {
314  k->setOwner(this);
315  }
316  }
317  }

Member Data Documentation

◆ m_detStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< Algorithm > >::m_detStore
privateinherited

Pointer to StoreGate (detector store by default)

Definition at line 393 of file AthCommonDataStore.h.

◆ m_evtStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< Algorithm > >::m_evtStore
privateinherited

Pointer to StoreGate (event store by default)

Definition at line 390 of file AthCommonDataStore.h.

◆ m_extendedExtraObjects

DataObjIDColl AthAlgorithm::m_extendedExtraObjects
privateinherited

Definition at line 79 of file AthAlgorithm.h.

◆ m_gainIN

unsigned int LArDuplicateConstants::m_gainIN
private

Definition at line 41 of file LArDuplicateConstants.h.

◆ m_gainOUT

unsigned int LArDuplicateConstants::m_gainOUT
private

Definition at line 42 of file LArDuplicateConstants.h.

◆ m_keyMPMC

std::string LArDuplicateConstants::m_keyMPMC
private

Definition at line 46 of file LArDuplicateConstants.h.

◆ m_keyOFC

std::string LArDuplicateConstants::m_keyOFC
private

Definition at line 47 of file LArDuplicateConstants.h.

◆ m_keyPed

std::string LArDuplicateConstants::m_keyPed
private

Definition at line 44 of file LArDuplicateConstants.h.

◆ m_keyRamp

std::string LArDuplicateConstants::m_keyRamp
private

Definition at line 45 of file LArDuplicateConstants.h.

◆ m_keyShape

std::string LArDuplicateConstants::m_keyShape
private

Definition at line 48 of file LArDuplicateConstants.h.

◆ m_onlineHelper

const LArOnlineID* LArDuplicateConstants::m_onlineHelper
private

Definition at line 39 of file LArDuplicateConstants.h.

◆ m_varHandleArraysDeclared

bool AthCommonDataStore< AthCommonMsg< Algorithm > >::m_varHandleArraysDeclared
privateinherited

Definition at line 399 of file AthCommonDataStore.h.

◆ m_vhka

std::vector<SG::VarHandleKeyArray*> AthCommonDataStore< AthCommonMsg< Algorithm > >::m_vhka
privateinherited

Definition at line 398 of file AthCommonDataStore.h.


The documentation for this class was generated from the following files:
python.PyKernel.retrieve
def retrieve(aClass, aKey=None)
Definition: PyKernel.py:110
LArDuplicateConstants::m_gainIN
unsigned int m_gainIN
Definition: LArDuplicateConstants.h:41
LArOFCP1
c-struct reproducing the structure of the persistent data
Definition: LArOFCP1.h:22
LArConditionsContainer::applyCorrections
StatusCode applyCorrections()
apply correction set
LArConditionsContainer::setPdata
void setPdata(const HWIdentifier id, const T &payload, unsigned int gain=0)
put payload in persistent data
LArRampP1::isEmpty
bool isEmpty() const
Definition: LArRampP1.h:29
LArConditionsContainerDB::iteratorT::channelId
HWIdentifier channelId() const
python.SystemOfUnits.s
int s
Definition: SystemOfUnits.py:131
python.PerfMonSerializer.p
def p
Definition: PerfMonSerializer.py:743
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
LArRampComplete
Definition: LArRampComplete.h:50
LArDuplicateConstants::m_keyMPMC
std::string m_keyMPMC
Definition: LArDuplicateConstants.h:46
LArConditionsContainer::undoCorrections
StatusCode undoCorrections()
undo corrections that have been already applied
AthCommonDataStore< AthCommonMsg< Algorithm > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
LArSingleFloatP
Definition: LArSingleFloatP.h:11
LArConditionsContainerDB::iteratorT
Declaration of const iterator.
Definition: LArConditionsContainerDB.h:72
LArRampP1
Persistent data for LArRamp Copied from LAr.
Definition: LArRampP1.h:24
LArConditionsContainer::insertCorrection
StatusCode insertCorrection(HWIdentifier id, const T &cond, unsigned int gain, bool corrChannel=true)
access to corrections -
LArPedestalP1
Definition: LArPedestalP1.h:12
LArPedestalComplete
This class implements the ILArPedestal interface.
Definition: LArPedestalComplete.h:26
conifer::pow
constexpr int pow(int x)
Definition: conifer.h:20
LArDuplicateConstants::m_keyShape
std::string m_keyShape
Definition: LArDuplicateConstants.h:48
LArShapeComplete
This class implements the ILArShape interface.
Definition: LArShapeComplete.h:26
AthCommonDataStore< AthCommonMsg< Algorithm > >::m_evtStore
StoreGateSvc_t m_evtStore
Pointer to StoreGate (event store by default)
Definition: AthCommonDataStore.h:390
AthCommonDataStore< AthCommonMsg< Algorithm > >::m_vhka
std::vector< SG::VarHandleKeyArray * > m_vhka
Definition: AthCommonDataStore.h:398
LArOFCComplete::OFC_a
virtual OFCRef_t OFC_a(const HWIdentifier &CellID, int gain, int tbin=0) const override
access to OFCs by online ID, gain, and tbin (!=0 for testbeam)
Definition: LArOFCComplete.cxx:29
LArConditionsContainer::undoCorrEnd
ConstCorrectionIt undoCorrEnd(unsigned int gain) const
LArDuplicateConstants::m_onlineHelper
const LArOnlineID * m_onlineHelper
Definition: LArDuplicateConstants.h:39
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
HWIdentifier
Definition: HWIdentifier.h:13
LArDuplicateConstants::m_keyPed
std::string m_keyPed
Definition: LArDuplicateConstants.h:44
AthenaPoolTestRead.sc
sc
Definition: AthenaPoolTestRead.py:27
AthCommonDataStore< AthCommonMsg< Algorithm > >::detStore
const ServiceHandle< StoreGateSvc > & detStore() const
The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
Definition: AthCommonDataStore.h:95
LArRampP1::m_vRamp
std::vector< float > m_vRamp
Definition: LArRampP1.h:30
SG::VarHandleKeyArray::setOwner
virtual void setOwner(IDataHandleHolder *o)=0
LArConditionsContainer< LArRampP1 >::ConstCorrectionIt
Subset::ConstCorrectionVecIt ConstCorrectionIt
Definition: LArConditionsContainer.h:78
AthCommonDataStore
Definition: AthCommonDataStore.h:52
AthAlgorithm::sysInitialize
virtual StatusCode sysInitialize() override
Override sysInitialize.
Definition: AthAlgorithm.cxx:66
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
LArMphysOverMcalComplete
This class implements the ILArMphysOverMcal interface.
Definition: LArMphysOverMcalComplete.h:29
AthCommonDataStore< AthCommonMsg< Algorithm > >::outputHandles
virtual std::vector< Gaudi::DataHandle * > outputHandles() const override
Return this algorithm's output handles.
LArConditionsContainer::end
ConstConditionsMapIterator end(unsigned int gain) const
end of all channels for this gain
lumiFormat.i
int i
Definition: lumiFormat.py:92
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
LArConditionsContainer::get
ConstReference get(const HWIdentifier id, unsigned int gain=0) const
get data with online identifier
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
AthCommonDataStore< AthCommonMsg< Algorithm > >::m_detStore
StoreGateSvc_t m_detStore
Pointer to StoreGate (detector store by default)
Definition: AthCommonDataStore.h:393
LArSingleFloatP::isEmpty
bool isEmpty() const
Definition: LArSingleFloatP.h:16
SG::VarHandleKeyArray::renounce
virtual void renounce()=0
SG::HandleClassifier::type
std::conditional< std::is_base_of< SG::VarHandleKeyArray, T >::value, VarHandleKeyArrayType, type2 >::type type
Definition: HandleClassifier.h:54
merge_scale_histograms.doc
string doc
Definition: merge_scale_histograms.py:9
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
LArPedestalP1::isEmpty
bool isEmpty() const
Definition: LArPedestalP1.h:26
LArConditionsContainer::undoCorrBegin
ConstCorrectionIt undoCorrBegin(unsigned int gain) const
get iterator over the Undo-Vector for a certain gain
LArShapeP2
c-struct reproducing the structure of the persistent data
Definition: LArShapeP2.h:21
LArDuplicateConstants::m_keyRamp
std::string m_keyRamp
Definition: LArDuplicateConstants.h:45
Example_ReadSampleNoise.ped
ped
Definition: Example_ReadSampleNoise.py:45
AthAlgorithm::m_extendedExtraObjects
DataObjIDColl m_extendedExtraObjects
Definition: AthAlgorithm.h:79
a
TList * a
Definition: liststreamerinfos.cxx:10
h
Identifier::get_compact
value_type get_compact(void) const
Get the compact id.
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
LArOnlineID_Base::isEMBPS
bool isEMBPS(const HWIdentifier id) const
Definition: LArOnlineID_Base.cxx:1665
LArConditionsContainer::begin
ConstConditionsMapIterator begin(unsigned int gain) const
get iterator for all channels for a gain
SG::VarHandleBase::vhKey
SG::VarHandleKey & vhKey()
Return a non-const reference to the HandleKey.
Definition: StoreGate/src/VarHandleBase.cxx:616
declareProperty
#define declareProperty(n, p, h)
Definition: BaseFakeBkgTool.cxx:15
AthAlgorithm::AthAlgorithm
AthAlgorithm()
Default constructor:
python.Bindings.keys
keys
Definition: Control/AthenaPython/python/Bindings.py:790
LHEF::Writer
Pythia8::Writer Writer
Definition: Prophecy4fMerger.cxx:12
LArShapeComplete::Shape
virtual ShapeRef_t Shape(const HWIdentifier &CellID, int gain, int tbin=0, int mode=0) const override
Definition: LArShapeComplete.cxx:29
ReadOfcFromCool.ofc
ofc
Definition: ReadOfcFromCool.py:110
AthCommonDataStore::declareGaudiProperty
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>
Definition: AthCommonDataStore.h:156
LArOFCComplete
This class implements the ILArOFC interface.
Definition: LArOFCComplete.h:25
LArDuplicateConstants::m_keyOFC
std::string m_keyOFC
Definition: LArDuplicateConstants.h:47
LArDuplicateConstants::m_gainOUT
unsigned int m_gainOUT
Definition: LArDuplicateConstants.h:42
fitman.k
k
Definition: fitman.py:528
LArVectorProxy
Proxy for accessing a range of float values like a vector.
Definition: LArVectorProxy.h:38
LArConditionsContainer::correctionsApplied
bool correctionsApplied() const
Have corrections been applied?
ServiceHandle< ICondSvc >