|
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;
86 return StatusCode::FAILURE;
97 return StatusCode::FAILURE;
101 cablingLeg = {*cablingHdlLeg};
104 return StatusCode::FAILURE;
121 sc=
detStore()->retrieve(calibParams,
"LArCalibParams");
123 {
ATH_MSG_ERROR(
"Cannot load LArCalibParams from DetStore." );
124 return StatusCode::FAILURE;
136 ATH_MSG_ERROR(
"Can't retrieve LArCalibDigitContainer with key " <<
key <<
"from StoreGate." );
137 return StatusCode::SUCCESS;
139 ATH_MSG_DEBUG(
"Retrieved LArCalibDigitContainer with key " <<
key <<
" from StoreGate." );
142 if(calibDigitContainer->
empty()) {
145 ATH_MSG_DEBUG(
"LArCalibDigitContainer with key=" <<
key <<
" has size = " << calibDigitContainer->
size() );
149 std::vector<unsigned int> ntrigger, nTriggerPerStep, nStepTrigger, iStepTrigger;
151 ntrigger.resize(calibDigitContainer->
size(),0);
173 std::vector<Identifier> ccellIds(0);
174 unsigned numPulsedLeg = 0;
179 bool hasInvalid=
false;
180 for(
auto s :
digit->samples()){
186 if(hasInvalid)
continue;
192 const std::vector<HWIdentifier>& calibLineLeg = clcabling->calibSlotLine(cellLegHWID);
193 numCL += calibLineLeg.size();
195 if ( calibParams->
isPulsed(eventNb,calibLineHWID) ){
198 if (
digit->isPulsed() )
ATH_MSG_WARNING(
"SC "<< chid <<
" constituent cell "<< cellLegHWID <<
" calib line "<< calibLineHWID<<
" not pulsed");}
201 if (
digit->isPulsed() && numPulsedLeg != numCL ){
202 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);
205 ATH_MSG_WARNING(
"Discarding this SC ("<<chid<<
") as it is not fully pulsed");
209 ATH_MSG_DEBUG(
"SC "<<chid<<
" pulsed cells "<< numPulsedLeg <<
" or "<< ccellIds.size()<<
", "<<numCL<<
" calibration lines");
216 const std::vector<HWIdentifier>& calibLineID=clcabling->calibSlotLine(chid);
218 if(!calibLineID.empty()){
220 nTriggerPerStep[febhash] = calibParams->
NTrigger(calibModuleID);
221 ATH_MSG_DEBUG(
"Ntrigger per step = " << nTriggerPerStep[febhash] );
222 if(nTriggerPerStep[febhash] > 1000) nTriggerPerStep[febhash]=100;
225 nTriggerPerStep[febhash] = 100;
229 bool isPulsed =
digit->isPulsed();
238 ATH_MSG_DEBUG(
"Delay is changing to " <<
digit->delay() <<
" from " <<
m_delay <<
": book a new LArAccumulatedCalibDigitContainer" );
253 delete larAccuCalibDigitContainer;
254 return StatusCode::FAILURE;
266 unsigned int sizeSamples =
digit->samples().size();
267 ATH_MSG_DEBUG(
"sizeSteps = " << sizeSteps <<
", # of samples = " << sizeSamples );
270 cellAccumulated.
m_sum.clear();
271 cellAccumulated.
m_sum2.clear();
272 cellAccumulated.
m_sum.resize(sizeSamples,0);
273 cellAccumulated.
m_sum2.resize(sizeSamples,0);
277 for(
unsigned int j=0;j<sizeSamples;j++){
280 digis=
digit->samples()[sizeSamples-1];
281 cellAccumulated.
m_sum[j] += digis;
282 cellAccumulated.
m_sum2[j] += digis*digis;
285 digis=
digit->samples()[0];
286 cellAccumulated.
m_sum[j] += digis;
287 cellAccumulated.
m_sum2[j] += digis*digis;
290 cellAccumulated.
m_sum[j] += digis;
291 cellAccumulated.
m_sum2[j] += digis*digis;
296 unsigned int ntrigUsed = nTriggerPerStep[febhash];
303 ATH_MSG_DEBUG(
"chid = " << chid <<
", gain = " <<
gain <<
", DAC = " <<
digit->DAC() <<
", isPulsed = " << isPulsed <<
", delay = " <<
m_delay <<
", trigPerStep = " << nTriggerPerStep[febhash] <<
", istep = " << iStepTrigger[febhash] );
308 ATH_MSG_DEBUG(
"Channel "<<chid<<
" DAC "<<
digit->DAC()<<
" will multiply by "<<numPulsedLeg<<
" = "<<
digit->DAC()*numPulsedLeg<<
" is pulsed??? "<<isPulsed);
316 iStepTrigger[febhash]++;
318 std::vector<float>
mean = accuCalibDigit->
mean();
319 std::vector<float>
RMS = accuCalibDigit->
RMS();
321 for(
unsigned int i=0;
i<
mean.size();
i++){
326 larAccuCalibDigitContainer->
push_back(accuCalibDigit);
337 if (
sc!=StatusCode::SUCCESS)
338 {
ATH_MSG_WARNING(
"Unable to record LArAccumulatedCalibDigitContainer with key " <<
key <<
" from DetectorStore. " );
341 ATH_MSG_DEBUG(
"Recorded succesfully LArAccumulatedCalibDigitContainer with key " <<
key <<
" with size " << larAccuCalibDigitContainer->
size());
343 sc =
evtStore()->setConst(larAccuCalibDigitContainer);
344 if (
sc.isFailure()) {
345 ATH_MSG_ERROR(
" Cannot lock LArAccumulatedCalibDigitContainer " );
346 return(StatusCode::FAILURE);
351 return StatusCode::SUCCESS;
355 std::ostringstream
ss;
363 if ( !
m_isSC )
return StatusCode::SUCCESS;
367 for(
auto &
sc :
acc.second){
368 if(
sc.m_onlineId &&
sc.m_nused != ntrigUsed){
369 ATH_MSG_WARNING(
"Not enough triggers for pattern " <<
pattern <<
" channel OnlineID " <<
sc.m_onlineId <<
" ntriggers " <<
sc.m_ntrigger );
374 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.
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