33T square(T
x) {
return x*
x; }
50 declareInterface<ITileCalibTool>(
this );
126 return StatusCode::SUCCESS;
131 ATH_MSG_INFO (
"initialize(" << runNumber <<
"," << runType <<
"," << rootFile <<
")" );
132 return StatusCode::SUCCESS;
139 const EventContext& ctx = Gaudi::Hive::currentContext();
150 memset(chanIds, 0,
sizeof(chanIds));
153 const uint32_t *cispar = dqStatus->
cispar();
156 int chan_bar[54] = {4 ,1 ,2 ,3 ,0 ,-1 ,
166 int chan_ext[36] = {4, 5 ,2 ,3 ,16,-1 ,
173 ATH_MSG_DEBUG (
"cispar[16] " << cispar[16] <<
", cispas[17] " << cispar[17] <<
", cispar[18] " << cispar[18] );
174 if (cispar[16] == 0x07){
184 else if (cispar[16] == 0x107){
188 return StatusCode::SUCCESS;
193 return StatusCode::SUCCESS;
215 for(; itColl != itCollEnd; ++itColl) {
218 it = (*itColl)->begin();
219 itEnd = (*itColl)->end();
221 for(; it != itEnd; ++it) {
238 int pos_neg_z =
m_TT_ID->pos_neg_z(tt_id);
239 int ieta =
m_TT_ID->eta(tt_id);
240 int iphi =
m_TT_ID->phi(tt_id);
243 if (ieta < 0 || ieta > 8)
continue;
245 if (ieta < 9 || ieta > 14)
continue;
248 if((ros==1) || (ros==2)){
250 if (chan != chan_bar[(ieta*6) +
m_ipmt])
continue;
252 else if ((ros==3) || (ros==4)){
253 if ((chan != chan_ext[((ieta-9)*6) +
m_ipmt]) || (chan == 0))
continue;
258 float amp = (*it)->amplitude();
265 m_rmsTile[ros][drawer][chan] += square(amp_pC);
273 if (pos_neg_z < 0) pos_neg_z = 0;
274 chanIds[pos_neg_z][ieta][iphi][
m_ipmt] = hwid;
289 if (!triggerTower->sampling())
continue;
291 double eta = triggerTower->eta();
292 double phi = triggerTower->phi();
313 const std::vector<uint16_t>& adc = triggerTower->adc();
314 uint16_t
max = *(std::max_element(adc.begin(), adc.end()));
315 uint16_t ped = adc.front();
316 tt_ene = (
max - ped) * 0.25;
317 if (tt_ene < 0.) tt_ene = 0.;
320 if ((ieta < 0) || (ieta > 14))
continue;
322 if (pos_neg_z < 0) pos_neg_z = 0;
325 if(ros >= 5 || ros <=0){
continue;}
330 double tt_ene_pC = tt_ene / pC2GeV;
333 if (triggerTower->e() == 0)
335 <<
", drawer "<< drawer
336 <<
", chan: " << chan
339 <<
", amplitude : " << tt_ene
340 <<
", old " << triggerTower->e()
341 <<
", ratio old/new " << (tt_ene == 0 ? 0 : triggerTower->e() / tt_ene ));
343 if ((ros==1) || (ros==2)){
344 if (chan != chan_bar[(ieta*6)-1 +
m_ipmt+1])
continue;
346 else if ((ros==3) || (ros==4)) {
347 if ((chan != chan_ext[((ieta-9)*6)-1 +
m_ipmt+1]) || (chan == 0))
continue;
352 m_rmsL1Calo[ros][drawer][chan] += square(tt_ene_pC);
364 for (
int ros=0;ros<5;ros++) {
365 for (
int drawer=0;drawer<64;drawer++) {
366 for (
int chan=0;chan<48;chan++) {
373 return StatusCode::SUCCESS;
381 for (
int ros=0;ros<5;ros++) {
382 for (
int drawer=0;drawer<64;drawer++) {
383 for (
int chan=0;chan<48;chan++) {
427 return StatusCode::SUCCESS;
432 ATH_MSG_INFO (
"writeNtuple(" << runNumber <<
"," << runType <<
"," << rootFile <<
")" );
434 TTree *t =
new TTree(
m_ntupleID.c_str(),
"TileCalib-Ntuple");
437 t->Branch(
"meanTile",
m_meanTile,ind.Format(
"meanTile%s/F",(
const char *)ind));
438 t->Branch(
"rmsTile",
m_rmsTile,ind.Format(
"rmsTile%s/F",(
const char *)ind));
439 t->Branch(
"meanTileDAC",
m_meanTileDAC,ind.Format(
"meanTileDAC%s/F",(
const char *)ind));
440 t->Branch(
"rmsTileDAC",
m_rmsTileDAC,ind.Format(
"rmsTileDAC%s/F",(
const char *)ind));
441 t->Branch(
"ietaTile",
m_ietaTile,ind.Format(
"ietaTile%s/I",(
const char *)ind));
442 t->Branch(
"iphiTile",
m_iphiTile,ind.Format(
"iphiTile%s/I",(
const char *)ind));
443 t->Branch(
"ipmtTile",
m_ipmtTile,ind.Format(
"ipmtTile%s/I",(
const char *)ind));
444 t->Branch(
"nEvtTile",
m_nEvtTile,ind.Format(
"nEvtTile%s/I",(
const char *)ind));
445 t->Branch(
"meanL1Calo",
m_meanL1Calo,ind.Format(
"meanL1Calo%s/F",(
const char *)ind));
446 t->Branch(
"rmsL1Calo",
m_rmsL1Calo,ind.Format(
"rmsL1Calo%s/F",(
const char *)ind));
447 t->Branch(
"meanL1CaloDAC",
m_meanL1CaloDAC,ind.Format(
"meanL1CaloDAC%s/F",(
const char *)ind));
448 t->Branch(
"rmsL1CaloDAC",
m_rmsL1CaloDAC,ind.Format(
"rmsL1CaloDAC%s/F",(
const char *)ind));
449 t->Branch(
"ietaL1Calo",
m_ietaL1Calo,ind.Format(
"ietaL1Calo%s/I",(
const char *)ind));
450 t->Branch(
"iphiL1Calo",
m_iphiL1Calo,ind.Format(
"iphiL1Calo%s/I",(
const char *)ind));
451 t->Branch(
"ipmtL1Calo",
m_ipmtL1Calo,ind.Format(
"ipmtL1Calo%s/I",(
const char *)ind));
452 t->Branch(
"nEvtL1Calo",
m_nEvtL1Calo,ind.Format(
"nEvtL1Calo%s/I",(
const char *)ind));
453 t->Branch(
"meanTileL1Calo",
m_meanTileL1Calo,ind.Format(
"meanTileL1Calo%s/F",(
const char *)ind));
454 t->Branch(
"rmsTileL1Calo",
m_rmsTileL1Calo,ind.Format(
"rmsTileL1Calo%s/F",(
const char *)ind));
456 t->Branch(
"DACvalue",&
m_DACvalue,
"DACvalue/F");
462 return StatusCode::SUCCESS;
468 return StatusCode::SUCCESS;
Scalar eta() const
pseudorapidity method
Scalar phi() const
phi method
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_WARNING(x)
#define CHECK(...)
Evaluate an expression and check for errors.
Handle class for reading from StoreGate.
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
const ServiceHandle< StoreGateSvc > & detStore() const
DataModel_detail::const_iterator< DataVector > const_iterator
Standard const_iterator.
bool is_valid() const
Check if id is in a valid state.
virtual bool isValid() override final
Can the handle be successfully dereferenced?
static const TileCablingService * getInstance()
get pointer to service instance
static const unsigned int MAX_ROS
Number of ROSs.
static const unsigned int MAX_DRAWER
Number of drawers in ROS 1-4.
static unsigned int getDrawerIdx(unsigned int ros, unsigned int drawer)
Returns a drawer hash.
static const unsigned int MAX_CHAN
Number of channels in drawer.
Class that holds Data Quality fragment information and provides functions to extract the data quality...
const uint32_t * cispar() const
CIS parameters.
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())
TriggerTower_v2 TriggerTower
Define the latest version of the TriggerTower class.