|
ATLAS Offline Software
|
Go to the documentation of this file.
16 #include "GaudiKernel/ServiceHandle.h"
17 #include "GaudiKernel/ThreadLocalContext.h"
38 #include "TGraphErrors.h"
39 #include "TClonesArray.h"
47 , m_tileOFCorrelation(nullptr)
126 return StatusCode::SUCCESS;
158 if (
sc.isFailure()) {
160 return StatusCode::FAILURE;
175 if (cnvSvc.retrieve().isFailure()) {
181 ATH_MSG_ERROR(
" Can't get TileBeamElemContByteStreamCnv " );
191 return StatusCode::SUCCESS;
197 const EventContext& ctx = Gaudi::Hive::currentContext();
209 bool calibMode = (dqStatus->
calibMode() == 1);
232 return StatusCode::SUCCESS;
242 std::ostringstream sStr;
243 std::string trig_str;
253 sStr <<
m_file <<
"_" <<
m_run <<
"_" << trig_str <<
".root";
259 TFile*
fout =
new TFile(
m_file.c_str(),
"recreate");
262 TTree*
t =
new TTree(
m_ntupleID.c_str(),
"TileCalib-Ntuple");
264 t->Branch(
"RunNumber", &
m_run,
"RunNumber/I");
266 t->Branch(
"Time", &
m_time,
"Time/I");
267 t->Branch(
"Year", &
m_year,
"Year/I");
268 t->Branch(
"Month", &
m_month,
"Month/I");
269 t->Branch(
"Day", &
m_day,
"Day/I");
270 t->Branch(
"YDay", &
m_yday,
"YDay/I");
271 t->Branch(
"Hour", &
m_hour,
"Hour/I");
272 t->Branch(
"Min", &
m_min,
"Min/I");
274 t->Branch(
"nEvt", &
m_evtNr,
"nEvt/I");
275 t->Branch(
"ros", *
m_ros,
"ros[5][64][48][2]/b");
276 t->Branch(
"drawer", *
m_drawer,
"drawer[5][64][48][2]/b");
277 t->Branch(
"channel", *
m_channel,
"channel[5][64][48][2]/b");
278 t->Branch(
"gain", *
m_gain,
"gain[5][64][48][2]/O");
279 t->Branch(
"EvtGood", *
m_evt,
"Evt[5][64][48][2]/I");
280 t->Branch(
"ped", *
m_ped,
"ped[5][64][48][2]/F");
281 t->Branch(
"lfn", *
m_lfn,
"lfn[5][64][48][2]/F");
282 t->Branch(
"hfn", *
m_hfn,
"hfn[5][64][48][2]/F");
283 t->Branch(
"noise_cov", *
m_noise_cov,
"noise_cov[5][64][2]/F");
285 t->Branch(
"auto_corr", *
m_auto_corr,
"auto_corr[5][64][48][2][36]/F");
294 return StatusCode::SUCCESS;
308 ATH_MSG_WARNING(
"TileDigiNoiseCalibAlg::StoreRunInfo : dqStatus pointer is null" );
340 ATH_MSG_ERROR(
"No EventInfo object found! Can't read run number!" );
358 localtime_r(&t_time, &
t);
387 for (; collItr != lastColl; ++collItr) {
392 if (digitsItr != lastDigits) {
401 double mean_tmp[48][16][2] = {};
404 for (; digitsItr != lastDigits; ++digitsItr) {
406 adc_id = (*digitsItr)->adc_HWID();
415 std::vector<float> vdigits = (*digitsItr)->samples();
432 <<
" channel: " <<
chan
434 <<
" due to DQ error found." );
441 <<
" channel: " <<
chan
442 <<
" due to DQ error found." );
447 double meansamp = 0.0;
448 double rmssamp = 0.0;
449 unsigned int dsize = vdigits.size();
452 ATH_MSG_ERROR(
"length of digits vector " << dsize <<
" - greater than 16 !" );
456 for (
unsigned int i = 0;
i < dsize; ++
i) {
457 double dig = vdigits[
i];
459 rmssamp += dig * dig;
469 rmssamp = rmssamp / dsize - meansamp * meansamp;
470 rmssamp = (rmssamp > 0.0) ? sqrt(rmssamp * dsize / (dsize - 1)) : 0.0;
497 return StatusCode::SUCCESS;
516 float tmpCorr[9][9] = {};
538 PedRMS = (PedRMS > 0.0) ? sqrt(PedRMS *
nev / (
nev - 1)) : 0.0;
580 double covar[48][48];
581 double mean_cov_ii = 0.;
582 double mean_cov_ij = 0.;
588 if (chan_j < chan_i) {
589 mean_cov_ij += covar[chan_i][chan_j];
592 mean_cov_ii += covar[chan_i][chan_i];
595 if (mean_cov_ii != 0.) {
bool validBeamFrag() const
def retrieve(aClass, aKey=None)
Const iterator class for DataVector/DataList.
void SetCorrelationZero(MsgStream &log, int dignum)
void CalcRunningCorrelation(MsgStream &log, int dignum, int chthres, bool flag_7to9)
static const TileCablingService * getInstance()
get pointer to service instance
bool isChanDQgood(int partition, int drawer, int ch) const
returns status of single channel (if bigain, returns AND of ADCs' status
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
double(* m_sumRms2)[Tile::MAX_DRAWER][Tile::MAX_CHAN][Tile::MAX_GAIN]
virtual StatusCode execute() override
Main method.
uint32_t calibMode() const
Calibration mode.
ToolHandle< TileRawChannelBuilderFlatFilter > m_adderFilterAlgTool
@ IS_CALIBRATION
true: calibration, false: physics
void GetCorrelation(int dignum, float tmpCorr[][9], int ros, int drawer, int chan, int gain)
const eformat::ROBFragment< const uint32_t * > * robFragment() const
void CalcCorrelation(MsgStream &log, int dignum, bool flag_7to9, bool doRobustCov)
SG::ReadHandleKey< xAOD::EventInfo > m_eventInfoKey
void RunningCorrelation(std::vector< float > &digits, int ros, int drawer, int channel, int gain, MsgStream &log, bool debug, int &dignum, int chthres)
const uint32_t * m_cispar
float(* m_ped)[Tile::MAX_DRAWER][Tile::MAX_CHAN][Tile::MAX_GAIN]
int digiChannel2PMT(int ros, int chan)
const std::string & key() const
Return the StoreGate ID for the referenced object.
virtual ~TileDigiNoiseCalibAlg()
uint32_t runNumber() const
The current event's run number.
int channel(const HWIdentifier &id) const
extract channel field from HW identifier
int(* m_evt)[Tile::MAX_DRAWER][Tile::MAX_CHAN][Tile::MAX_GAIN]
const ServiceHandle< StoreGateSvc > & detStore() const
The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
static const unsigned int MAX_DRAWER
Number of drawers in ROS 1-4.
void StoreRunInfo(const TileDQstatus *dqStatus)
StoreRunInfo is called only during the first event.
int ros(const HWIdentifier &id) const
extract ros field from HW identifier
void finalDigits()
finalDigits is called during finalize Here the average Ped, m_lfn, m_hfn and covariance are calculate...
bool(* m_gain)[Tile::MAX_DRAWER][Tile::MAX_CHAN][Tile::MAX_GAIN]
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())
Class that holds Data Quality fragment information and provides functions to extract the data quality...
int adc(const HWIdentifier &id) const
extract adc field from HW identifier
uint8_t(* m_ros)[Tile::MAX_DRAWER][Tile::MAX_CHAN][Tile::MAX_GAIN]
::StatusCode StatusCode
StatusCode definition for legacy code.
std::string m_beamElemContainer
Default, invalid implementation of ClassID_traits.
TileDigiNoiseCalibAlg(const std::string &name, ISvcLocator *pSvcLocator)
const TileHWID * m_tileHWID
float(* m_lfn)[Tile::MAX_DRAWER][Tile::MAX_CHAN][Tile::MAX_GAIN]
const_iterator end() const
return const_iterator for end of container
#define CHECK(...)
Evaluate an expression and check for errors.
const TileCablingService * m_cabling
const_iterator begin() const
return const_iterator for first entry
StatusCode FirstEvt_initialize()
Initialization done at the first event.
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
static const unsigned int MAX_ROS
Number of ROSs
This AthConstConverter class provides conversion from ByteStream to TileBeamElemContainer.
virtual bool isValid() override final
Can the handle be successfully dereferenced?
bool isAdcDQgood(int partition, int drawer, int ch, int gain) const
returns status of single ADC returns False if there are any errors
virtual StatusCode finalize() override
The output ntuple is created in finalize method.
double(* m_meanAmp_ij)[Tile::MAX_DRAWER][Tile::MAX_CHAN][Tile::MAX_CHAN][Tile::MAX_GAIN]
Helpers for checking error return status codes and reporting errors.
double(* m_sumPed2)[Tile::MAX_DRAWER][Tile::MAX_CHAN][Tile::MAX_GAIN]
const uint32_t * cispar() const
CIS parameters.
float(* m_noise_cov)[Tile::MAX_DRAWER][Tile::MAX_GAIN]
SG::ReadHandleKey< TileDQstatus > m_dqStatusKey
TileOFCorrelation * m_tileOFCorrelation
float(* m_auto_corr)[Tile::MAX_DRAWER][Tile::MAX_CHAN][Tile::MAX_GAIN][NVALS]
static std::string getDrawerString(unsigned int ros, unsigned int drawer)
Return the drawer name, e.g.
StatusCode fillDigits(const TileDQstatus *theDQstatus)
fillDigits is called at every events.
int drawer(const HWIdentifier &id) const
extract drawer field from HW identifier
#define ATH_MSG_WARNING(x)
uint32_t timeStamp() const
POSIX time in seconds from 1970. January 1st.
double(* m_meanAmp)[Tile::MAX_DRAWER][Tile::MAX_CHAN][Tile::MAX_GAIN]
uint8_t(* m_channel)[Tile::MAX_DRAWER][Tile::MAX_CHAN][Tile::MAX_GAIN]
TileBeamElemContByteStreamCnv * m_beamCnv
SG::ReadHandleKey< TileDigitsContainer > m_digitsContainerKey
std::string m_dspRawChannelContainer
float(* m_hfn)[Tile::MAX_DRAWER][Tile::MAX_CHAN][Tile::MAX_GAIN]
Handle class for reading from StoreGate.
static const unsigned int MAX_CHAN
Number of channels in drawer.
uint8_t(* m_drawer)[Tile::MAX_DRAWER][Tile::MAX_CHAN][Tile::MAX_GAIN]
void Sum(std::vector< float > &digits, int ros, int drawer, int channel, int gain, MsgStream &log, bool debug, int &dignum, bool doRobustCov)
bool eventType(EventType type) const
Check for one particular bitmask value.
virtual StatusCode initialize() override
Only array initialization is done here All the helpers initialization is done at the first event.
static const unsigned int MAX_GAIN
Number of gains per channel