|
ATLAS Offline Software
|
Go to the documentation of this file.
6 #include "CLHEP/Units/SystemOfUnits.h"
17 m_sc2ccMappingTool(
"CaloSuperCellIDTool"),
18 m_onlineHelper(nullptr),
45 sc =
detStore()->retrieve(scid,
"LArOnline_SuperCellID");
47 ATH_MSG_ERROR(
"Could not get LArOnline_SuperCellID helper !" );
68 return StatusCode::SUCCESS;
92 return StatusCode::FAILURE;
103 return StatusCode::FAILURE;
107 cablingLeg = {*cablingHdlLeg};
110 return StatusCode::FAILURE;
127 sc=
detStore()->retrieve(calibParams,
"LArCalibParams");
129 {
ATH_MSG_ERROR(
"Cannot load LArCalibParams from DetStore." );
130 return StatusCode::FAILURE;
142 ATH_MSG_ERROR(
"Can't retrieve LArCalibDigitContainer with key " <<
key <<
"from StoreGate." );
143 return StatusCode::SUCCESS;
145 ATH_MSG_DEBUG(
"Retrieved LArCalibDigitContainer with key " <<
key <<
" from StoreGate." );
148 if(calibDigitContainer->
empty()) {
151 ATH_MSG_DEBUG(
"LArCalibDigitContainer with key=" <<
key <<
" has size = " << calibDigitContainer->
size() );
155 std::vector<unsigned int> ntrigger, nTriggerPerStep, nStepTrigger, iStepTrigger;
157 ntrigger.resize(calibDigitContainer->
size(),0);
179 std::vector<Identifier> ccellIds(0);
180 unsigned numPulsedLeg = 0;
185 bool hasInvalid=
false;
186 for(
auto s :
digit->samples()){
192 if(hasInvalid)
continue;
198 const std::vector<HWIdentifier>& calibLineLeg = clcabling->
calibSlotLine(cellLegHWID);
199 numCL += calibLineLeg.size();
201 if ( calibParams->
isPulsed(eventNb,calibLineHWID) ){
204 if (
digit->isPulsed() )
ATH_MSG_WARNING(
"SC "<< chid <<
" constituent cell "<< cellLegHWID <<
" calib line "<< calibLineHWID<<
" not pulsed");}
207 if (
digit->isPulsed() && numPulsedLeg != numCL ){
208 ATH_MSG_WARNING(
"Number of pulsed legacy cells does not equal number of calibration lines "<<chid<<
"!! LArParams counter = " << numPulsedLeg <<
", SC2CCMappingTool = " << ccellIds.size() <<
", num CLs = "<< numCL);
211 ATH_MSG_WARNING(
"Discarding this SC ("<<chid<<
") as it is not fully pulsed");
215 ATH_MSG_DEBUG(
"SC "<<chid<<
" pulsed cells "<< numPulsedLeg <<
" or "<< ccellIds.size()<<
", "<<numCL<<
" calibration lines");
222 const std::vector<HWIdentifier>& calibLineID=clcabling->
calibSlotLine(chid);
224 if(!calibLineID.empty()){
226 nTriggerPerStep[febhash] = calibParams->
NTrigger(calibModuleID);
227 ATH_MSG_DEBUG(
"Ntrigger per step = " << nTriggerPerStep[febhash] );
228 if(nTriggerPerStep[febhash] > 1000) nTriggerPerStep[febhash]=100;
231 nTriggerPerStep[febhash] = 100;
235 bool isPulsed =
digit->isPulsed();
244 ATH_MSG_DEBUG(
"Delay is changing to " <<
digit->delay() <<
" from " <<
m_delay <<
": book a new LArAccumulatedCalibDigitContainer" );
259 delete larAccuCalibDigitContainer;
260 return StatusCode::FAILURE;
272 unsigned int sizeSamples =
digit->samples().size();
273 ATH_MSG_DEBUG(
"sizeSteps = " << sizeSteps <<
", # of samples = " << sizeSamples );
276 cellAccumulated.
m_sum.clear();
277 cellAccumulated.
m_sum2.clear();
278 cellAccumulated.
m_sum.resize(sizeSamples,0);
279 cellAccumulated.
m_sum2.resize(sizeSamples,0);
283 for(
unsigned int j=0;j<sizeSamples;j++){
286 digis=
digit->samples()[sizeSamples-1];
287 cellAccumulated.
m_sum[j] += digis;
288 cellAccumulated.
m_sum2[j] += digis*digis;
291 digis=
digit->samples()[0];
292 cellAccumulated.
m_sum[j] += digis;
293 cellAccumulated.
m_sum2[j] += digis*digis;
296 cellAccumulated.
m_sum[j] += digis;
297 cellAccumulated.
m_sum2[j] += digis*digis;
302 unsigned int ntrigUsed = nTriggerPerStep[febhash];
309 ATH_MSG_DEBUG(
"chid = " << chid <<
", gain = " <<
gain <<
", DAC = " <<
digit->DAC() <<
", isPulsed = " << isPulsed <<
", delay = " <<
m_delay <<
", trigPerStep = " << nTriggerPerStep[febhash] <<
", istep = " << iStepTrigger[febhash] );
314 ATH_MSG_DEBUG(
"Channel "<<chid<<
" DAC "<<
digit->DAC()<<
" will multiply by "<<numPulsedLeg<<
" = "<<
digit->DAC()*numPulsedLeg<<
" is pulsed??? "<<isPulsed);
322 iStepTrigger[febhash]++;
324 std::vector<float>
mean = accuCalibDigit->
mean();
325 std::vector<float>
RMS = accuCalibDigit->
RMS();
327 for(
unsigned int i=0;
i<
mean.size();
i++){
332 larAccuCalibDigitContainer->
push_back(accuCalibDigit);
343 if (
sc!=StatusCode::SUCCESS)
344 {
ATH_MSG_WARNING(
"Unable to record LArAccumulatedCalibDigitContainer with key " <<
key <<
" from DetectorStore. " );
347 ATH_MSG_DEBUG(
"Recorded succesfully LArAccumulatedCalibDigitContainer with key " <<
key <<
" with size " << larAccuCalibDigitContainer->
size());
349 sc =
evtStore()->setConst(larAccuCalibDigitContainer);
350 if (
sc.isFailure()) {
351 ATH_MSG_ERROR(
" Cannot lock LArAccumulatedCalibDigitContainer " );
352 return(StatusCode::FAILURE);
357 return StatusCode::SUCCESS;
361 std::ostringstream
ss;
369 if ( !
m_isSC )
return StatusCode::SUCCESS;
373 for(
auto &
sc :
acc.second){
374 if(
sc.m_onlineId &&
sc.m_nused != ntrigUsed){
375 ATH_MSG_WARNING(
"Not enough triggers for pattern " <<
pattern <<
" channel OnlineID " <<
sc.m_onlineId <<
" ntriggers " <<
sc.m_ntrigger );
380 return StatusCode::SUCCESS;
def retrieve(aClass, aKey=None)
JetConstituentVector::iterator iterator
Data class for calibration ADC samples preprocessed by the DSP.
IdentifierHash channel_Hash(HWIdentifier channelId) const
Create channel_hash from channel_Id.
void mean(std::vector< double > &bins, std::vector< double > &values, const std::vector< std::string > &files, const std::string &histname, const std::string &tplotname, const std::string &label="")
void setDelayScale(const double scale)
set the delay Scale
size_type febHashMax(void) const
define feb hash tables max size
uint64_t eventNumber() const
The current event's event number.
unsigned int m_nStepTrigger
Number of intermediate accumulations (JO property)
unsigned NTrigger(const HWIdentifier calibModuleID) const
std::vector< std::string > m_keylist
list of key for input digit container (=gain)
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
double m_DropPercentTrig
Percentage of the used triggers that we will skip over at the end, in order ot ensure that the accumu...
bool m_keepPulsed
Tells you whether you keep only pulsed cells or all cells.
const std::vector< HWIdentifier > & calibSlotLine(const HWIdentifier id) const
int m_sampleShift
Samples to shift by, usually used in the case of SCs.
bool m_isSC
Tells you whether you run on SuperCells or Cells.
unsigned int m_event_counter
Event counter.
Identifier32 get_identifier32() const
Get the 32-bit version Identifier, will be invalid if >32 bits needed.
HWIdentifier calib_module_Id(int barrel_ec, int pos_neg, int feedthrough, int slot) const
Build calibration module identifier from fields.
static std::string getPatternName(const std::string &gain, bool isPulsed, int delay, int dac)
const std::string & key() const
Return the StoreGate ID for the referenced object.
value_type get_compact() const
Get the compact id.
std::vector< uint64_t > m_sum
const ServiceHandle< StoreGateSvc > & detStore() const
The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
std::map< std::string, std::vector< LArAccumulated > > m_Accumulated_map
Vector (index=hash ID) of accumulation quantities.
Container class for LArCalibDigit.
ServiceHandle< StoreGateSvc > & evtStore()
The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
double m_delayScale
Set delay scale.
::StatusCode StatusCode
StatusCode definition for legacy code.
std::vector< float > RMS() const
Calculates and returns the RMS value of each ADC sample.
bool isPulsed(const unsigned event, const HWIdentifier calibLineID) const
std::string m_calibAccuDigitContainerName
LArAccumulatedCalibDigitContainer name.
std::vector< uint64_t > m_sum2
double delay(std::size_t d)
HWIdentifier createSignalChannelID(const Identifier &id) const
create a HWIdentifier from an Identifier (not inline)
HWIdentifier feb_Id(int barrel_ec, int pos_neg, int feedthrough, int slot) const
Create feb_Id from fields.
SG::ReadCondHandleKey< LArCalibLineMapping > m_calibMapKey
std::vector< float > mean() const
Calculates and returns the Mean value of each ADC sample.
Helper for the Liquid Argon Calorimeter cell identifiers.
SG::ReadCondHandleKey< LArOnOffIdMapping > m_cablingKeySC
Base class for LArDigits taken during calibration runs.
size_type channelHashMax(void) const
Define channel hash tables max size.
LArCalibDigitsAccumulator(const std::string &name, ISvcLocator *pSvcLocator)
bool m_keepFullyPulsedSC
Tells you whether you keep only fully pulsed supercells or all supercells.
value_type push_back(value_type pElem)
Add an element to the end of the collection.
StatusCode initialize(bool used=true)
SG::ReadCondHandleKey< LArOnOffIdMapping > m_cablingKey
Class describing the basic event information.
Class of intermediate accumulations.
#define ATH_MSG_WARNING(x)
bool setAddSubStep(const std::vector< uint64_t > &sampleSum, const std::vector< uint64_t > &sample2Sum, const uint32_t nTriggerPerStep)
Sum up with another substep.
const LArOnlineID_Base * m_onlineHelper
This is a "hash" representation of an Identifier. This encodes a 32 bit index which can be used to lo...
SG::ReadCondHandleKey< LArCalibLineMapping > m_calibMapSCKey
Container class for LArAccumulatedCalibDigit.
size_type size() const noexcept
Returns the number of elements in the collection.
IdentifierHash feb_Hash(HWIdentifier febId) const
Create feb hash identifiers from feb identifiers.
bool empty() const noexcept
Returns true if the collection is empty.
ToolHandle< ICaloSuperCellIDTool > m_sc2ccMappingTool