ATLAS Offline Software
Loading...
Searching...
No Matches
TileAANtuple.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3*/
4
5//*****************************************************************************
6// Filename : TileAANtuple.cxx
7// Author : Alexander Solodkov
8// Created : April, 2010
9//
10// DESCRIPTION:
11// Algorithm which puts in ntuple all raw data (digits) and results of Opt filter
12//
13// HISTORY:
14// 29-Apr-2010 First version - simplified version of TileTBAANtuple
15//
16// BUGS:
17//
18//*****************************************************************************
19
20//Tile includes
37
38// Calo includes
39#include "CaloDetDescr/CaloDetDescrElement.h"
43
44//Atlas include
49
50#include "eformat/ROBFragment.h"
51#include "eformat/FullEventFragment.h"
52
53// Gaudi includes
54#include "GaudiKernel/ITHistSvc.h"
55
56#include "TTree.h"
57#include "TFile.h"
58#include <iomanip>
59#include "boost/date_time/local_time/local_time.hpp"
60#include "boost/date_time/posix_time/posix_time.hpp"
61#include <iostream>
62#include <sstream>
63
64#define CLEAR(array) \
65memset(array,0,sizeof(array))
66
67#define CLEAR1(array) \
68memset(array,-1,sizeof(array))
69
70#define CLEAR2(array,size) \
71 memset(array,0,sizeof(array)/size)
72
73#define CLEAR3(array,size) \
74 memset(array,-1,sizeof(array)/size)
75
76// clear for MF arrays with two gains
77#define CLEAR4(array,size) \
78memset(array,0,sizeof(*array)*N_ROS2*N_MODULES*N_CHANS*m_nSamples/size)
79
80// clear for sample arrays with two gains
81#define CLEAR5(array,size) \
82memset(array,-1,sizeof(*array)*N_ROS2*N_MODULES*N_CHANS*m_nSamples/size)
83
84// clear for TMDB sample arrays with one gain
85#define CLEAR6(array) \
86memset(array,0,sizeof(*array)*N_ROS*N_MODULES*N_TMDBCHANS*m_nSamples)
87
88#define NAME1(s1) \
89s1.c_str()
90
91#define NAME2(s1,s2) \
92(s1+s2).c_str()
93
94#define NAME3(s1,s2,s3) \
95(s1+s2+s3).c_str()
96
97#define NAME5(s1,s2,s3,s4,s5) \
98(s1+s2+s3+s4+s5).c_str()
99
100#define sample_ind(r,m,c,i) (((r*N_MODULES + m)*N_CHANS + c)*m_nSamples) + i
101
102#define sample_ind_TMDB(r,m,c,i) (((r*N_MODULES + m)*N_TMDBCHANS + c)*m_nSamples) + i
103
104// Constructor & deconstructor
108
109
110TileAANtuple::TileAANtuple(const std::string& name, ISvcLocator* pSvcLocator)
111: AthAlgorithm(name, pSvcLocator)
112, m_evTime(0)
113, m_run(0)
114, m_evt(0)
115, m_lumiBlock(0)
116, m_HHMMSS(0)
117, m_dateTime()
118, m_trigType(0)
119, m_dspFlags(0)
120, m_l1ID()
121, m_l1Type()
122, m_evBCID()
123, m_evType()
124, m_cispar()
125, m_las_version(0)
126, m_las_BCID(0)
127, m_las_Filt(0)
128, m_las_ReqAmp(0)
129, m_las_MeasAmp(0)
131, m_arrays (std::make_unique<Arrays>())
132, m_qdctimeout(0)
133, m_tdctimeout(0)
134, m_daqtype(0)
135, m_nBadDr(0)
136, m_nBadHV(0)
137, m_nBadDCS(0)
138, m_nBadDB(0)
139, m_nBadTotal(0)
140, m_rchUnit(TileRawChannelUnit::MegaElectronVolts)
141, m_dspUnit(TileRawChannelUnit::ADCcounts)
142, m_ntuplePtr(0)
144, m_thistSvc("THistSvc", name)
145, m_tileID(0)
146, m_tileHWID(0)
147, m_cabling(0)
148, m_tileMgr(0)
149, m_tileBadChanTool("TileBadChanTool")
150, m_tileToolEmscale("TileCondToolEmscale")
151, m_l2Builder()
152, m_sumEt_xx()
153, m_sumEz_xx()
154, m_sumE_xx()
155, m_sumEt_yy()
156, m_sumEz_yy()
157, m_sumE_yy()
158, m_sumEt_zz()
159, m_sumEz_zz()
160, m_sumE_zz()
161, m_bad()
162{
163 declareProperty("TileCondToolEmscale", m_tileToolEmscale);
164 declareProperty("TileDigitsContainer", m_digitsContainerKey = "TileDigitsCnt");
165 declareProperty("TileDigitsContainerFlt", m_fltDigitsContainerKey = "" /* "TileDigitsFlt" */);
166 declareProperty("TileBeamElemContainer", m_beamElemContainerKey = "TileBeamElemCnt");
167 declareProperty("TileRawChannelContainer", m_rawChannelContainerKey = "TileRawChannelCnt");
168 declareProperty("TileRawChannelContainerFit", m_fitRawChannelContainerKey = ""); //
169 declareProperty("TileRawChannelContainerFitCool", m_fitcRawChannelContainerKey = ""); // don't create
170 declareProperty("TileRawChannelContainerOpt", m_optRawChannelContainerKey = ""); // by default
171 declareProperty("TileRawChannelContainerQIE", m_qieRawChannelContainerKey = ""); // processed QIE data
172 declareProperty("TileRawChannelContainerOF1", m_of1RawChannelContainerKey = ""); //
173 declareProperty("TileRawChannelContainerDsp", m_dspRawChannelContainerKey = ""); //
174 declareProperty("TileRawChannelContainerMF", m_mfRawChannelContainerKey = ""); //
175 declareProperty("TileRawChannelContainerWiener", m_wienerRawChannelContainerKey = "");//
176 declareProperty("TileMuRcvRawChannelContainer", m_tileMuRcvRawChannelContainerKey = "MuRcvRawChCnt");// TMDB
177 declareProperty("TileMuRcvDigitsContainer", m_tileMuRcvDigitsContainerKey = "MuRcvDigitsCnt");// TMDB
178 declareProperty("TileMuRcvContainer", m_tileMuRcvContainerKey = "TileMuRcvCnt");// TMDB
179 declareProperty("TileLaserObject", m_laserObjectKey = "" /* "TileLaserObj" */); //
180 declareProperty("TileL2Cnt", m_l2CntKey = "TileL2Cnt");
181 declareProperty("CalibrateEnergy", m_calibrateEnergy = true);
182 declareProperty("UseDspUnits", m_useDspUnits = false);
184 declareProperty("CalibMode", m_calibMode = false);
185 declareProperty("CompareMode", m_compareMode = false);
186 declareProperty("BSInput", m_bsInput = true);
187 declareProperty("PMTOrder", m_pmtOrder = false);
188
189 declareProperty("StreamName", m_streamName = "AANT");
190 declareProperty("NTupleID", m_ntupleID = "h2000");
191 declareProperty("TreeSize", m_treeSize = 16000000000LL);
192
193 declareProperty("CheckDCS",m_checkDCS = false);
194 declareProperty("DCSBranches",m_DCSBranches = 111111111);
195
196 declareProperty("SkipEvents", m_skipEvents = 0);
197 declareProperty("NSamples", m_nSamples=7);
198 declareProperty("Reduced", m_reduced=false);
199 declareProperty("CompressionSettings", m_compressSettings = -1);
200
201 m_evtNr = -1;
202}
203
206
209 ATH_MSG_INFO( "Initialization started");
210
211 //=== get TileCablingSvc
212 ATH_CHECK( m_cablingSvc.retrieve() );
213
214 // find TileCablingService
216
217 // retrieve TileDetDescr Manager det store
218 ATH_CHECK( detStore()->retrieve(m_tileMgr) );
219
220 // retrieve TileID helper from det store
221 ATH_CHECK( detStore()->retrieve(m_tileID) );
222 ATH_CHECK( detStore()->retrieve(m_tileHWID) );
223
224 //=== get TileDCSTool
225 if (m_checkDCS) {
226 ATH_CHECK( m_tileDCS.retrieve() );
227 } else {
228 m_tileDCS.disable();
229 }
230
231 //=== get TileBadChanTool
232 ATH_CHECK( m_tileBadChanTool.retrieve() );
233
234 //=== get TileCondToolEmscale
235 ATH_CHECK( m_tileToolEmscale.retrieve() );
236
237 //=== get TileL2Builder
238 if (m_compareMode) {
239 ATH_CHECK( m_l2Builder.retrieve() );
240 }
241
242 ATH_CHECK( m_DQstatusKey.initialize() );
243
244 int sample_size = N_ROS2*N_MODULES*N_CHANS*m_nSamples;
245 int sample_TMDB_size = N_ROS*N_MODULES*N_TMDBCHANS*m_nSamples;
246 m_arrays->m_sample = (short *) malloc(sample_size*sizeof(short));
247 m_arrays->m_sampleFlt = (short *) malloc(sample_size*sizeof(short));
248 m_arrays->m_sampleTMDB = (unsigned char *) malloc(sample_TMDB_size*sizeof(unsigned char));
249
266 ATH_CHECK( m_l2CntKey.initialize(m_compareMode) );
267 ATH_CHECK( m_hid2RESrcIDKey.initialize(m_bsInput) );
268
269 ATH_MSG_INFO( "initialization completed" ) ;
270 return StatusCode::SUCCESS;
271}
272
273
274StatusCode TileAANtuple::ntuple_initialize(const EventContext& ctx,
275 const TileDQstatus& DQstatus)
276{
277 if (m_bsInput) {
278 ATH_CHECK( m_robSvc.retrieve() );
280 ATH_CHECK(hid2re.isValid());
281 m_ROBID.push_back( hid2re->getRobFromFragID(DIGI_PAR_FRAG) );
282 m_ROBID.push_back( hid2re->getRobFromFragID(LASER_OBJ_FRAG) );
283 }
284
285 uint32_t calib = DQstatus.calibMode();
286 bool calibMode = (calib == 1);
287 if ( calibMode != m_calibMode && calib!=0xFFFFFFFF ) {
288 ATH_MSG_INFO( "Calib mode from data is " << calibMode );
289 ATH_MSG_INFO( " Overwriting calib mode " );
290 m_calibMode = calibMode;
291 }
292
295
296 m_finalUnit = -1;
298 m_useDspUnits = true;
299 ATH_MSG_INFO( "Final offline units are not set, will use DSP units" );
300 }
301 }
302
304 ATH_MSG_INFO( "calibrateEnergy is disabled, don't want to use DSP units" );
305 m_useDspUnits = false;
306 }
307
308 ATH_MSG_INFO( "calibMode " << m_calibMode );
309 ATH_MSG_INFO( "calibrateEnergy " << m_calibrateEnergy );
310 ATH_MSG_INFO( "offlineUnits " << m_finalUnit );
311 ATH_MSG_INFO( "useDspUnits " << m_useDspUnits );
312
313 // set event number to 0 before first event
314 m_evtNr = 0;
315
316 ATH_CHECK( m_thistSvc.retrieve() );
317
318 if (m_compressSettings >= 0) {
319 ATH_CHECK( m_fileMgr.retrieve() );
320 }
321
322 if(initNTuple(ctx).isFailure()) {
323 ATH_MSG_ERROR( " Error during ntuple initialization" );
324 }
325
326 ATH_MSG_INFO( "ntuple initialization completed" );
327 return StatusCode::SUCCESS;
328}
329
330
331StatusCode TileAANtuple::execute(const EventContext& ctx) {
332 const TileDQstatus* DQstatus = SG::makeHandle (m_DQstatusKey, ctx).get();
333
334 if (m_evtNr < 0) {
335 if (ntuple_initialize(ctx, *DQstatus).isFailure()) {
336 ATH_MSG_ERROR( "ntuple_initialize failed" );
337 }
338 }
339
340 if (m_evtNr%1000 == 0) {
341 ATH_MSG_INFO( m_evtNr << " events processed so far" );
342 }
343
344 if (ntuple_clear().isFailure()) {
345 ATH_MSG_ERROR( "ntuple_clear failed" );
346 }
347
348 bool empty = true;
349
350 // store BeamElements
351 if (!m_beamElemContainerKey.key().empty()) {
352 empty &= storeBeamElements(*DQstatus).isFailure();
353 }
354
355 //store Laser Object
356 if (!m_laserObjectKey.empty()) {
357 empty &= storeLaser(ctx).isFailure();
358 }
359
360 // store TileDigits
361 empty &= storeDigits(ctx, m_fltDigitsContainerKey,m_arrays->m_sampleFlt,m_arrays->m_gainFlt,false).isFailure();
362 empty &= storeDigits(ctx, m_digitsContainerKey, m_arrays->m_sample, m_arrays->m_gain, true ).isFailure();
363
364 // store TileRawChannels
365 // start from DSP channels - so we can find out what is the DSP units
366 empty &= storeRawChannels(ctx, m_dspRawChannelContainerKey, m_arrays->m_eDsp, m_arrays->m_tDsp, m_arrays->m_chi2Dsp, m_arrays->m_pedDsp, true ).isFailure();
367 empty &= storeRawChannels(ctx, m_rawChannelContainerKey, m_arrays->m_ene, m_arrays->m_time, m_arrays->m_chi2, m_arrays->m_ped, false).isFailure();
368 empty &= storeMFRawChannels(ctx, m_mfRawChannelContainerKey, m_arrays->m_eMF, m_arrays->m_tMF, m_arrays->m_chi2MF, m_arrays->m_pedMF, false).isFailure();
369 empty &= storeRawChannels(ctx, m_fitRawChannelContainerKey, m_arrays->m_eFit, m_arrays->m_tFit, m_arrays->m_chi2Fit, m_arrays->m_pedFit, false).isFailure();
370 empty &= storeRawChannels(ctx, m_fitcRawChannelContainerKey, m_arrays->m_eFitc, m_arrays->m_tFitc, m_arrays->m_chi2Fitc, m_arrays->m_pedFitc, false).isFailure();
371 empty &= storeRawChannels(ctx, m_optRawChannelContainerKey, m_arrays->m_eOpt, m_arrays->m_tOpt, m_arrays->m_chi2Opt, m_arrays->m_pedOpt, false).isFailure();
372 empty &= storeRawChannels(ctx, m_qieRawChannelContainerKey, m_arrays->m_eQIE, m_arrays->m_tQIE, m_arrays->m_chi2QIE, m_arrays->m_pedQIE, false).isFailure();
373 empty &= storeRawChannels(ctx, m_of1RawChannelContainerKey, m_arrays->m_eOF1, m_arrays->m_tOF1, m_arrays->m_chi2OF1, m_arrays->m_pedOF1, false).isFailure();
374 empty &= storeRawChannels(ctx, m_wienerRawChannelContainerKey, m_arrays->m_eWiener, m_arrays->m_tWiener, m_arrays->m_chi2Wiener, m_arrays->m_pedWiener, false).isFailure();
375
376 // store TMDB data
377 //
378 empty &= storeTMDBDecision(ctx).isFailure();
379 empty &= storeTMDBDigits(ctx).isFailure();
380 empty &= storeTMDBRawChannel(ctx).isFailure();
381
382 m_evTime = 0;
383
384 if (m_bsInput) {
385 const eformat::FullEventFragment<const uint32_t*>* event = nullptr;
386 const eformat::ROBFragment<const uint32_t*>* robFrag = nullptr;
387 event = m_robSvc->getEvent(ctx);
388 std::vector<const ROBDataProviderSvc::ROBF*> robf;
389 // keep pointer to whole event and to CIS PAR frag internally
390 m_robSvc->getROBData(ctx, m_ROBID, robf);
391 robFrag = (robf.size() > 0 ) ? robf[0] : nullptr;
392 if (event) {
393 m_evTime = event->bc_time_seconds();
394 if ( robFrag ) {
395 // Store ROD header info from collection
396 int rod = N_RODS-1;
397 m_l1ID[rod] = robFrag->rod_lvl1_id();
398 m_l1Type[rod] = robFrag->rod_lvl1_trigger_type();
399 m_evType[rod] = robFrag->rod_detev_type();
400 m_evBCID[rod] = robFrag->rod_bc_id();
401 if (m_trigType == 0) m_trigType = -m_l1Type[rod]; // make negative to distinguish from TileCal internal trig types
402 }
403 }
404 }
405
406 m_lumiBlock = -1; // placeholder
407
408 //Get run and event numbers
409 m_run = ctx.eventID().run_number();
410 m_evt = ctx.eventID().event_number();
411
412 if ( ctx.eventID().lumi_block() ){
413 m_lumiBlock = ctx.eventID().lumi_block();
414 }
415
416 //Get timestamp of the event
417 if (ctx.eventID().time_stamp() > 0) {
418 m_evTime = ctx.eventID().time_stamp();
419 }
420
421 if (m_evTime>0) {
422 using namespace boost::local_time;
423 using namespace boost::posix_time;
424
425 /*
426 // just an example how to read file with time zones
427 tz_database tz_db;
428 try {
429 tz_db.load_from_file("../data/date_time_zonespec.csv");
430 time_zone_ptr gva_tz = tz_db.time_zone_from_region("Europe/Zurich");
431 }catch(data_not_accessible dna) {
432 std::cerr << "Error with time zone data file: " << dna.what() << std::endl;
433 //exit(EXIT_FAILURE);
434 }catch(bad_field_count bfc) {
435 std::cerr << "Error with time zone data file: " << bfc.what() << std::endl;
436 //exit(EXIT_FAILURE);
437 }
438 */
439 //"Europe/Zurich","CET","CET","CEST","CEST","+01:00:00","+01:00:00","-1;0;3","+02:00:00","-1;0;10","+03:00:00"
440 static const time_zone_ptr gva_tz(new posix_time_zone((std::string)"CET+01CEST01:00:00,M3.5.0/02:00:00,M10.5.0/03:00:00"));
441 local_date_time gva_time(from_time_t(m_evTime),gva_tz);
442
443 //std::ostringstream otime;
444 //otime << gva_time; // time in the format YYYY-MMM-DD HH:MM:SS TZ
445 //strncpy(m_dateTime,otime.str().c_str(),31);
446
447 //time_duration hms(gva_time.time_of_day()); - will give time of the day in GMT
448 //m_HHMMSS = hms.hours()*10000+hms.minutes()*100+hms.seconds();
449
450 struct tm gva_tm(to_tm(gva_time));
451 strftime(m_dateTime, 32, "%Y-%b-%d %H:%M:%S %Z", &gva_tm);
452 m_HHMMSS = gva_tm.tm_hour*10000+gva_tm.tm_min*100+gva_tm.tm_sec;
453
454 // the code below is only valid when running at CERN (in Geneva time zone)
455 //struct tm *time = localtime((time_t*)(&m_evTime));
456 //m_HHMMSS = time->tm_hour*10000+time->tm_min*100+time->tm_sec;
457 //strftime(m_dateTime, 32, "%Y-%m-%d %H:%M:%S %Z", time);
458
459 } else {
460 m_HHMMSS = -1;
461 m_dateTime[0] = '\0'; // empty string
462 }
463
464 // store DCS data
465 if (m_checkDCS) {
466 empty &= storeDCS().isFailure();
467 }
468
469 if (empty) {
470 ATH_MSG_WARNING( "Some problems in execute - ntuple was not filled at all" );
471 }
472
473 // FIRST 4 EVENTS ARE SKIPPED TO RETRIEVE LASER PEDESTALS
475 m_ntuplePtr->Fill();
476 } // IF
477
478 ++m_evtNr;
479
480 // Execution completed.
481
482 ATH_MSG_DEBUG( "execute() completed successfully" );
483 return StatusCode::SUCCESS;
484}
485
486
487//
488// Here the LASER object is opened and corresponding variable are stored
489//
490StatusCode TileAANtuple::storeLaser (const EventContext& ctx) {
491
492 ATH_MSG_DEBUG("TileAANtuple::storeLaser()");
493 const char* gainnames[2] = {"LG","HG"};
494
495 const TileLaserObject* laserObj = SG::makeHandle(m_laserObjectKey, ctx).get();
496
497 m_las_BCID = laserObj->getBCID();
498
499 m_las_Filt = laserObj->getFiltNumber();
500 m_las_ReqAmp = laserObj->getDiodeCurrOrd();
501 m_las_MeasAmp = laserObj->getDiodeCurrMeas();
503 ATH_MSG_VERBOSE( "Laser BCID " << m_las_BCID
504 << " Filt " << m_las_Filt
505 << " ReqAmp " << m_las_ReqAmp
506 << " MeasAmp " << m_las_MeasAmp
507 << " Temp " << m_las_Temperature );
508
509 ATH_MSG_DEBUG("LASER"<<(laserObj->isLASERII()?"II":"I")<<" VERSION IS " << laserObj->getVersion());
510
511 if(laserObj->isLASERII()){
512 m_qdctimeout = laserObj->getQDCTimeout();
513 m_tdctimeout = laserObj->getTDCTimeout();
514 m_daqtype = laserObj->getDaqType();
515 if (msgLvl(MSG::DEBUG)) {
516 msg(MSG::DEBUG) << "DAQ Type " << m_daqtype << endmsg;
517 msg(MSG::DEBUG) << "QDC TimeOut " << m_qdctimeout << endmsg;
518 msg(MSG::DEBUG) << "TDC TimeOut " << m_tdctimeout << endmsg;
519 }
520
521 // RETRIEVE SIGNAL IN ADC COUNTS
522 for(int chan=0;chan<28;++chan){
523 int ch=chan>>1;
524 int gn=chan&1;
525 // MONITORING DIODES
526 m_arrays->m_chan[chan] = laserObj->getDiodeADC(ch,gn);
527 ATH_MSG_DEBUG("LASERII CHANNEL " << ch << " ("<<gainnames[gn]<<") " << m_arrays->m_chan[chan]);
528 } // FOR
529
530 for(int chan=28;chan<32;++chan){
531 int ch=(chan-28)>>1;
532 int gn=chan&1;
533 // MONITORING PMTS
534 m_arrays->m_chan[chan] = laserObj->getPMADC(ch,gn);
535 ATH_MSG_DEBUG("LASERII PMT " << ch << " ("<<gainnames[gn]<<") " << m_arrays->m_chan[chan]);
536 } // FOR
537
538 // RETRIEVE PEDESTALS IF NOT ALREADY SET
539 for(int chan=0;chan<32;++chan){
540 int ch=chan>>1;
541 int gn=chan&1;
542 if(laserObj->isSet(ch, gn, 0) && laserObj->getMean (ch,gn,0)>0) m_arrays->m_chan_Ped[chan] = laserObj->getMean (ch,gn,0);
543 if(laserObj->isSet(ch, gn, 2) && laserObj->getMean (ch,gn,2)>0) m_arrays->m_chan_Led[chan] = laserObj->getMean (ch,gn,2);
544 if(laserObj->isSet(ch, gn, 3) && laserObj->getMean (ch,gn,3)>0) m_arrays->m_chan_Alpha[chan] = laserObj->getMean (ch,gn,3);
545 if(laserObj->isSet(ch, gn, 1) && laserObj->getMean (ch,gn,1)>0) m_arrays->m_chan_Lin[chan] = laserObj->getMean (ch,gn,1);
546 if(laserObj->isSet(ch, gn, 0) && laserObj->getSigma(ch,gn,0)>0) m_arrays->m_chan_SPed[chan] = laserObj->getSigma(ch,gn,0);
547 if(laserObj->isSet(ch, gn, 2) && laserObj->getSigma(ch,gn,2)>0) m_arrays->m_chan_SLed[chan] = laserObj->getSigma(ch,gn,2);
548 if(laserObj->isSet(ch, gn, 3) && laserObj->getSigma(ch,gn,3)>0) m_arrays->m_chan_SAlpha[chan] = laserObj->getSigma(ch,gn,3);
549 if(laserObj->isSet(ch, gn, 1) && laserObj->getSigma(ch,gn,1)>0) m_arrays->m_chan_SLin[chan] = laserObj->getSigma(ch,gn,1);
550
551 // DEBUG OUTPUT
552 if (msgLvl(MSG::DEBUG)) {
553 msg(MSG::DEBUG) << gainnames[gn] << " CHAN " << ch << " SIG= " << m_arrays->m_chan[chan] << endmsg;
554 msg(MSG::DEBUG) << gainnames[gn] << " CHAN " << ch << " PED= " << m_arrays->m_chan_Ped[chan] << "+/-" << m_arrays->m_chan_SPed[chan] << " ( " << laserObj->isSet(ch, gn, 0) << " ) " << endmsg;
555 msg(MSG::DEBUG) << gainnames[gn] << " CHAN " << ch << " PED= " << m_arrays->m_chan_Lin[chan] << "+/-" << m_arrays->m_chan_SLin[chan] << " ( " << laserObj->isSet(ch, gn, 1) << " ) " << endmsg;
556 msg(MSG::DEBUG) << gainnames[gn] << " CHAN " << ch << " LED= " << m_arrays->m_chan_Led[chan] << "+/-" << m_arrays->m_chan_SLed[chan] << " ( " << laserObj->isSet(ch, gn, 2) << " ) " << endmsg;
557 msg(MSG::DEBUG) << gainnames[gn] << " CHAN " << ch << " ALP= " << m_arrays->m_chan_Alpha[chan] << "+/-" << m_arrays->m_chan_SAlpha[chan] << " ( " << laserObj->isSet(ch, gn, 3) << " ) " << endmsg;
558 } // IF
559 } // FOR
560 } // IF
561 else{
562 for (unsigned int gn=0; gn<TileLaserObject::nbGains; ++gn) {
563 for (unsigned int i=0; i<TileLaserObject::nbPmts; ++i) {
564 m_arrays->m_las_PMT_ADC[gn][i] = laserObj->getPMADC(i,gn);
565 m_arrays->m_las_PMT_TDC[gn][i] = laserObj->getTDC(i,gn);
566 m_arrays->m_las_PMT_Ped[gn][i] = laserObj->getPMPedestal(i,gn);
567 m_arrays->m_las_PMT_Ped_RMS[gn][i] = laserObj->getPMSigmaPedestal(i,gn);
568 ATH_MSG_VERBOSE( "LasPMT" << i << " g " << gn
569 << " adc " << m_arrays->m_las_PMT_ADC[gn][i]
570 << " ped " << m_arrays->m_las_PMT_Ped[gn][i]
571 << " rms " << m_arrays->m_las_PMT_Ped_RMS[gn][i]
572 << " tdc " << m_arrays->m_las_PMT_TDC[gn][i] );
573 } // FOR
574
575 for (unsigned int i=0; i<14; ++i) {
576 m_arrays->m_las_D_ADC[gn][i] = laserObj->getDiodeADC(i,gn);
577 m_arrays->m_las_D_Ped[gn][i] = laserObj->getDiodePedestal(i,gn);
578 m_arrays->m_las_D_Ped_RMS[gn][i] = laserObj->getDiodeSigmaPedestal(i,gn);
579 m_arrays->m_las_D_Alpha[gn][i] = laserObj->getAlpha(i,gn);
580 m_arrays->m_las_D_Alpha_RMS[gn][i] = laserObj->getSigmaAlpha(i,gn);
581 m_arrays->m_las_D_AlphaPed[gn][i] = laserObj->getPedestalAlpha(i,gn);
582 m_arrays->m_las_D_AlphaPed_RMS[gn][i] = laserObj->getSigmaPedAlpha(i,gn);
583
584 ATH_MSG_VERBOSE( "LasD" << i << " g " << gn
585 << " adc " << m_arrays->m_las_D_ADC[gn][i]
586 << " ped " << m_arrays->m_las_D_Ped[gn][i]
587 << " rms " << m_arrays->m_las_D_Ped_RMS[gn][i]
588 << " alp " << m_arrays->m_las_D_Alpha[gn][i]
589 << " rms " << m_arrays->m_las_D_Alpha_RMS[gn][i]
590 << " ape " << m_arrays->m_las_D_AlphaPed[gn][i]
591 << " rms " << m_arrays->m_las_D_AlphaPed_RMS[gn][i] );
592 } // FOR
593 } // FOR
594 } // ELSE
595
596 return StatusCode::SUCCESS;
597}
598
600
601 const uint32_t* cispar = DQstatus.cispar();
602
603 uint32_t oldval = 0;
604 int last = 0;
605 for(int i = 0; i< N_CISPAR; ++i) {
606 m_cispar[i] = cispar[i];
607 if (msgLvl(MSG::VERBOSE)) {
608 if (oldval != cispar[i]) {
609 if (last < i-1) {
610 ATH_MSG_VERBOSE( "cispar[" << last << ".." << i-1 << "] = "
611 << oldval );
612 } else if (last == i-1) {
613 ATH_MSG_VERBOSE( "cispar[" << last << "] = " << oldval );
614 }
615 last = i;
616 oldval = cispar[i];
617 }
618 }
619 }
620
621 if (msgLvl(MSG::VERBOSE)) {
622 if (last < N_CISPAR-1) {
623 ATH_MSG_VERBOSE( "cispar[" << last << ".." << N_CISPAR-1 << "] = "
624 << oldval );
625 } else {
626 ATH_MSG_VERBOSE( "cispar[" << last << "] = "<< oldval );
627 }
628 }
629
630 m_trigType = cispar[12];
631
632 return StatusCode::SUCCESS;
633}
634
635
638 */
639StatusCode
640TileAANtuple::storeRawChannels(const EventContext& ctx
642 , float ene[N_ROS2][N_MODULES][N_CHANS]
643 , float time[N_ROS2][N_MODULES][N_CHANS]
644 , float chi2[N_ROS2][N_MODULES][N_CHANS]
645 , float ped[N_ROS2][N_MODULES][N_CHANS]
646 , bool fillAll)
647{
648 if (containerKey.empty()) {// empty name, nothing to do
649 return StatusCode::FAILURE;
650 }
651
652 // get named container
653 const TileRawChannelContainer* rcCnt =
654 SG::makeHandle (containerKey, ctx).get();
655 ATH_MSG_VERBOSE( "Container ID " << containerKey.key() );
656
657 TileRawChannelUnit::UNIT rChUnit = rcCnt->get_unit();
658 ATH_MSG_VERBOSE( "RawChannel unit is " << rChUnit );
659
660 bool dspCont = ( rChUnit >= TileRawChannelUnit::OnlineADCcounts );
661 if (dspCont) { // this is container with DSP results
662 m_dspUnit = rChUnit;
663 m_dspFlags = rcCnt->get_bsflags() >> 16;
664 ATH_MSG_VERBOSE( "DSP flag is 0x" << MSG::hex << m_dspFlags << MSG::dec
665 << " DSP unit is " << m_dspUnit);
666
668 && rChUnit != TileRawChannelUnit::ADCcounts) {
669 ATH_MSG_ERROR( "RawChannel units are not ADC counts, can't apply DSP-like calibration" );
670 return StatusCode::FAILURE;
671 }
672
673 if (m_calibrateEnergy) {
674 if (m_useDspUnits) { // calibrate a-la online
676 } else { // convert to final units
678 }
679 } else {
680 m_rchUnit = rChUnit;
681 }
682 ATH_MSG_VERBOSE( "Final RawChannel unit is " << m_rchUnit );
683
684 std::vector<float> sumE(3);
685 float E[48];
686 int gain[48];
687 if (m_compareMode && dspCont) memset(m_bad,0,sizeof(m_bad));
688
689 // Get iterator for all TRCColl in TRCCont
690 TileRawChannelContainer::const_iterator itColl = (*rcCnt).begin();
691 TileRawChannelContainer::const_iterator itCollEnd = (*rcCnt).end();
692
694
695 // Go through all TileRawChannelCollections
696 for(; itColl != itCollEnd; ++itColl) {
697 int fragId = (*itColl)->identify();
698 int drawerIdx = TileCalibUtils::getDrawerIdxFromFragId(fragId);
699 int drawer = fragId & 0x3F;
700 int ROS = (fragId>>8);
701 int rosI = ROS-1;
702 int rosL = rosI;
703 int rosH = rosI + N_ROS;
704
705 ATH_MSG_VERBOSE( "TRC ("<< containerKey.key()
706 <<") Event# "<< m_evtNr
707 << " Frag id 0x" << MSG::hex << fragId << MSG::dec
708 << " ROS " << ROS
709 << " drawer " << drawer );
710
711 // go through all TileRawChannels in collection
712 it = (*itColl)->begin();
713 itEnd = (*itColl)->end();
714
715 int cmpCounter = 0;
716 if (m_compareMode) {
717 memset(E, 0, sizeof(E));
718 memset(gain, 0, sizeof(gain));
719 }
720
721 for(; it != itEnd; ++it) {
722 const TileRawChannel* rch = (*it);
723
724 HWIdentifier hwid = rch->adc_HWID();
725
726 // determine channel
727 int channel = m_tileHWID->channel(hwid);
728 // convert channel number to PMT number if needed
729 if (m_pmtOrder) channel = digiChannel2PMT(ROS,channel);
730
731 // determine gain and set ros index accordingly
732 int adc = m_tileHWID->adc(hwid);
733 if (m_calibMode) {
734 if (m_compareMode) {
735 ++cmpCounter;
736 if(cmpCounter>48) rosI = rosH;
737 else rosI = rosL;
738 } else {
739 if(adc == 1) rosI = rosH;
740 else rosI = rosL;
741 }
742 }
743
745 float energy = rch->amplitude();
746 if (m_rchUnit != rChUnit) {
748 energy = m_tileToolEmscale->channelCalib(drawerIdx, channel, adc, energy, rChUnit, m_rchUnit);
749 else
750 energy = m_tileToolEmscale->channelCalibOnl(drawerIdx, channel, adc, energy, m_rchUnit);
751 }
752
753 ene[rosI][drawer][channel] = energy;
754 time[rosI][drawer][channel] = rch->time();
755 chi2[rosI][drawer][channel] = rch->quality();
756 ped[rosI][drawer][channel] = rch->pedestal();
757 if (m_arrays->m_gain[rosI][drawer][channel] < 0)
758 m_arrays->m_gain[rosI][drawer][channel] = adc;
759
760 if (m_compareMode) { // filling array for SumEt calculations
761 E[channel] = energy;
762 gain[channel] = adc;
763 if (dspCont) { // use bad flag from DSP container only
764 m_bad[rosL][drawer][channel] = (rch->quality()>15.99);
765 //} else {
766 //m_bad[rosL][drawer][channel] = m_tileBadChanTool->getAdcStatus(drawerIdx, channel, adc).isBad();
767 }
768 }
769
770 if (msgLvl(MSG::VERBOSE)) {
771 int index,pmt;
772 rch->cell_ID_index(index,pmt);
773 ATH_MSG_VERBOSE( "TRC ch " << channel
774 << " gain " << adc
775 << " type " << std::min(index,0)
776 << " ene=" << energy
777 << " time=" << rch->time()
778 << " chi2=" << rch->quality()
779 << " ped=" << rch->pedestal() );
780 }
781 }
782
783 if (fillAll) {
784
785 m_arrays->m_ROD_GlobalCRC[rosL][drawer] = (*itColl)->getFragGlobalCRC() & 1;
786 m_arrays->m_ROD_BCID[rosL][drawer] = (*itColl)->getFragDSPBCID();
787 m_arrays->m_ROD_DMUMask[rosL][drawer][0] = (*itColl)->getFragRODChipMask();
788 m_arrays->m_ROD_DMUMask[rosL][drawer][1] = (*itColl)->getFragFEChipMask();
789
790 for(unsigned int dmu=0;dmu<N_DMUS;dmu++) {
791
792 m_arrays->m_ROD_DMUBCIDErr[rosL][drawer][dmu] = ((*itColl)->getFragBCID() >> dmu) & 1;
793 m_arrays->m_ROD_DMUmemoryErr[rosL][drawer][dmu] = ((*itColl)->getFragMemoryPar() >> dmu) & 1;
794 m_arrays->m_ROD_DMUSstrobeErr[rosL][drawer][dmu] = ((*itColl)->getFragSstrobe() >> dmu) & 1;
795 m_arrays->m_ROD_DMUDstrobeErr[rosL][drawer][dmu] = ((*itColl)->getFragDstrobe() >> dmu) & 1;
796 m_arrays->m_ROD_DMUHeadformatErr[rosL][drawer][dmu] = ((*itColl)->getFragHeaderBit() >> dmu) & 1;
797 m_arrays->m_ROD_DMUHeadparityErr[rosL][drawer][dmu] = ((*itColl)->getFragHeaderPar() >> dmu) & 1;
798 m_arrays->m_ROD_DMUDataformatErr[rosL][drawer][dmu] = ((*itColl)->getFragSampleBit() >> dmu) & 1;
799 m_arrays->m_ROD_DMUDataparityErr[rosL][drawer][dmu] = ((*itColl)->getFragSamplePar() >> dmu) & 1;
800 m_arrays->m_ROD_DMUfeCRC[rosL][drawer][dmu] = ((*itColl)->getFragFEChipMask() >> dmu) & 1;
801 m_arrays->m_ROD_DMUrodCRC[rosL][drawer][dmu] = ((*itColl)->getFragRODChipMask() >> dmu) & 1;
802 }
803 }
804
805 if (m_compareMode) {
806 m_l2Builder->SumE(ROS,drawer,m_rchUnit,E,gain,m_bad[rosL][drawer],sumE);
807 if (dspCont) {
808 m_sumEt_xx[m_l2Builder->idToIndex(fragId)] = sumE[0];
809 m_sumEz_xx[m_l2Builder->idToIndex(fragId)] = sumE[1];
810 m_sumE_xx[m_l2Builder->idToIndex(fragId)] = sumE[2];
811 }
812 else {
813 m_sumEt_zz[m_l2Builder->idToIndex(fragId)] = sumE[0];
814 m_sumEz_zz[m_l2Builder->idToIndex(fragId)] = sumE[1];
815 m_sumE_zz[m_l2Builder->idToIndex(fragId)] = sumE[2];
816 }
817 }
818 }
819
820 if (m_compareMode && dspCont) {
821
822 const TileL2Container* l2Cnt = SG::makeHandle(m_l2CntKey, ctx).get();
823
826 int i=0;
827 for(; it != end; ++it) {
828 m_sumEt_yy[i++] = (*it)->sumEt();
829 m_sumEz_yy[i++] = (*it)->sumEz();
830 m_sumE_yy[i++] = (*it)->sumE();
831 }
832 }
833
834 return StatusCode::SUCCESS;
835}
836
837StatusCode
838TileAANtuple::storeMFRawChannels(const EventContext& ctx
840 , float * ene
841 , float * time
842 , float chi2[N_ROS2][N_MODULES][N_CHANS]
843 , float ped[N_ROS2][N_MODULES][N_CHANS]
844 , bool fillAll)
845{
846 if (containerKey.empty()) {// empty name, nothing to do
847 return StatusCode::FAILURE;
848 }
849
850 // get named container
851 const TileRawChannelContainer* rcCnt = \
852 SG::makeHandle (containerKey, ctx).get();
853
854 TileRawChannelUnit::UNIT rChUnit = rcCnt->get_unit();
855 ATH_MSG_VERBOSE( "RawChannel unit is " << rChUnit );
856
857 bool dspCont = ( rChUnit >= TileRawChannelUnit::OnlineADCcounts );
858 if (dspCont) { // this is container with DSP results
859 m_dspUnit = rChUnit;
860 m_dspFlags = rcCnt->get_bsflags() >> 16;
861 ATH_MSG_VERBOSE( "DSP flag is 0x" << MSG::hex << m_dspFlags << MSG::dec
862 << " DSP unit is " << m_dspUnit);
863
865 && rChUnit != TileRawChannelUnit::ADCcounts) {
866 ATH_MSG_ERROR( "RawChannel units are not ADC counts, can't apply DSP-like calibration" );
867 return StatusCode::FAILURE;
868 }
869
870 if (m_calibrateEnergy) {
871 if (m_useDspUnits) { // calibrate a-la online
873 } else { // convert to final units
875 }
876 } else {
877 m_rchUnit = rChUnit;
878 }
879 ATH_MSG_VERBOSE( "Final RawChannel unit is " << m_rchUnit );
880
881 std::vector<float> sumE(3);
882 float E[48];
883 int gain[48];
884 if (m_compareMode && dspCont) memset(m_bad, 0, sizeof(m_bad));
885
886 // Get iterator for all TRCColl in TRCCont
887 TileRawChannelContainer::const_iterator itColl = (*rcCnt).begin();
888 TileRawChannelContainer::const_iterator itCollEnd = (*rcCnt).end();
889
891
892 // Go through all TileRawChannelCollections
893 for (; itColl != itCollEnd; ++itColl) {
894 int fragId = (*itColl)->identify();
895 int drawerIdx = TileCalibUtils::getDrawerIdxFromFragId(fragId);
896 int drawer = fragId & 0x3F;
897 int ROS = (fragId >> 8);
898 int rosI = ROS - 1;
899 int rosL = rosI;
900 int rosH = rosI + N_ROS;
901
902 ATH_MSG_VERBOSE( "TRC ("<< containerKey.key()
903 <<") Event# "<< m_evtNr
904 << " Frag id 0x" << MSG::hex << fragId << MSG::dec
905 << " ROS " << ROS
906 << " drawer " << drawer );
907
908 // go through all TileRawChannels in collection
909 it = (*itColl)->begin();
910 itEnd = (*itColl)->end();
911
912 int cmpCounter = 0;
913 if (m_compareMode) {
914 memset(E, 0, sizeof(E));
915 memset(gain, 0, sizeof(gain));
916 }
917 for(; it != itEnd; ++it) {
918 const TileRawChannel* rch = (*it);
919
920 HWIdentifier hwid=rch->adc_HWID();
921
922 // determine channel
923 int channel = m_tileHWID->channel(hwid);
924 // convert channel number to PMT number if needed
925 if (m_pmtOrder) channel = digiChannel2PMT(ROS,channel);
926
927 // determine gain and set ros index accordingly
928 int adc = m_tileHWID->adc(hwid);
929 if (m_calibMode) {
930 if (m_compareMode) {
931 ++cmpCounter;
932 if(cmpCounter>48) rosI = rosH;
933 else rosI = rosL;
934 } else {
935 if(adc == 1) rosI = rosH;
936 else rosI = rosL;
937 }
938 }
939
941 float energy = 0.;
942 for (int i = 0; i < 7; ++i) {
943 energy = rch->amplitude(i);
944 if (m_rchUnit != rChUnit) {
946 energy = m_tileToolEmscale->channelCalib(drawerIdx, channel, adc, energy, rChUnit, m_rchUnit);
947 else
948 energy = m_tileToolEmscale->channelCalibOnl(drawerIdx, channel, adc, energy, m_rchUnit);
949 }
950
951 ene[sample_ind(rosI,drawer,channel,i)] = energy;
952 time[sample_ind(rosI,drawer,channel,i)] = rch->time(i);
953 }
954 chi2[rosI][drawer][channel] = rch->quality();
955 ped[rosI][drawer][channel] = rch->pedestal();
956
957 if (m_arrays->m_gain[rosI][drawer][channel] < 0)
958 m_arrays->m_gain[rosI][drawer][channel] = adc;
959
960 if (m_compareMode) { // filling array for SumEt calculations
961 E[channel] = ene[sample_ind(rosI,drawer,channel,0)];
962 gain[channel] = adc;
963 if (dspCont) { // use bad flag from DSP container only
964 m_bad[rosL][drawer][channel] = (rch->quality() > 15.99);
965 //} else {
966 //m_bad[rosL][drawer][channel] = m_tileBadChanTool->getAdcStatus(drawerIdx, channel, adc).isBad();
967 }
968 }
969
970 if (msgLvl(MSG::VERBOSE)) {
971 int index,pmt;
972 rch->cell_ID_index(index,pmt);
973 ATH_MSG_VERBOSE( "TRC ch " << channel
974 << " gain " << adc
975 << " type " << std::min(index,0)
976 << " ene=" << ene[sample_ind(rosI,drawer,channel,0)]
977 << " time=" << rch->time()
978 << " chi2=" << rch->quality()
979 << " ped=" << rch->pedestal() );
980 }
981 }
982
983 if (fillAll) {
984
985 m_arrays->m_ROD_GlobalCRC[rosL][drawer] = (*itColl)->getFragGlobalCRC() & 1;
986 m_arrays->m_ROD_BCID[rosL][drawer] = (*itColl)->getFragDSPBCID();
987 m_arrays->m_ROD_DMUMask[rosL][drawer][0] = (*itColl)->getFragRODChipMask();
988 m_arrays->m_ROD_DMUMask[rosL][drawer][1] = (*itColl)->getFragFEChipMask();
989
990 for(unsigned int dmu=0;dmu<N_DMUS;dmu++) {
991
992 m_arrays->m_ROD_DMUBCIDErr[rosL][drawer][dmu] = ((*itColl)->getFragBCID() >> dmu) & 1;
993 m_arrays->m_ROD_DMUmemoryErr[rosL][drawer][dmu] = ((*itColl)->getFragMemoryPar() >> dmu) & 1;
994 m_arrays->m_ROD_DMUSstrobeErr[rosL][drawer][dmu] = ((*itColl)->getFragSstrobe() >> dmu) & 1;
995 m_arrays->m_ROD_DMUDstrobeErr[rosL][drawer][dmu] = ((*itColl)->getFragDstrobe() >> dmu) & 1;
996 m_arrays->m_ROD_DMUHeadformatErr[rosL][drawer][dmu] = ((*itColl)->getFragHeaderBit() >> dmu) & 1;
997 m_arrays->m_ROD_DMUHeadparityErr[rosL][drawer][dmu] = ((*itColl)->getFragHeaderPar() >> dmu) & 1;
998 m_arrays->m_ROD_DMUDataformatErr[rosL][drawer][dmu] = ((*itColl)->getFragSampleBit() >> dmu) & 1;
999 m_arrays->m_ROD_DMUDataparityErr[rosL][drawer][dmu] = ((*itColl)->getFragSamplePar() >> dmu) & 1;
1000 m_arrays->m_ROD_DMUfeCRC[rosL][drawer][dmu] = ((*itColl)->getFragFEChipMask() >> dmu) & 1;
1001 m_arrays->m_ROD_DMUrodCRC[rosL][drawer][dmu] = ((*itColl)->getFragRODChipMask() >> dmu) & 1;
1002 }
1003 }
1004
1005 if (m_compareMode) {
1006 m_l2Builder->SumE(ROS, drawer, m_rchUnit, E, gain, m_bad[rosL][drawer], sumE);
1007 if (dspCont) {
1008 m_sumEt_xx[m_l2Builder->idToIndex(fragId)] = sumE[0];
1009 m_sumEz_xx[m_l2Builder->idToIndex(fragId)] = sumE[1];
1010 m_sumE_xx[m_l2Builder->idToIndex(fragId)] = sumE[2];
1011 }
1012 else {
1013 m_sumEt_zz[m_l2Builder->idToIndex(fragId)] = sumE[0];
1014 m_sumEz_zz[m_l2Builder->idToIndex(fragId)] = sumE[1];
1015 m_sumE_zz[m_l2Builder->idToIndex(fragId)] = sumE[2];
1016 }
1017 }
1018 }
1019
1020 if (m_compareMode && dspCont) {
1021
1022 const TileL2Container* l2Cnt = SG::makeHandle(m_l2CntKey, ctx).get();
1023
1026 int i=0;
1027 for(; it != end; ++it) {
1028 m_sumEt_yy[i++] = (*it)->sumEt();
1029 m_sumEz_yy[i++] = (*it)->sumEz();
1030 m_sumE_yy[i++] = (*it)->sumE();
1031 }
1032 }
1033
1034 return StatusCode::SUCCESS;
1035}
1036
1040 */
1041StatusCode
1042TileAANtuple::storeDigits(const EventContext& ctx
1043 , const SG::ReadHandleKey<TileDigitsContainer>& containerKey
1044 , short *a_sample
1045 , short a_gain[N_ROS2][N_MODULES][N_CHANS]
1046 , bool fillAll)
1047{
1048 if (containerKey.empty()) // empty name, nothing to do
1049 return StatusCode::FAILURE;
1050
1051 // Read Digits from TES
1052 const TileDigitsContainer* digitsCnt =
1053 SG::makeHandle (containerKey, ctx).get();
1054
1055 bool emptyColl = true;
1056
1057 // Get iterator for all TDColl in TDCont
1058 TileDigitsContainer::const_iterator itColl = (*digitsCnt).begin();
1059 TileDigitsContainer::const_iterator itCollEnd = (*digitsCnt).end();
1060
1061 // Go through all TileDigitsCollections
1062 for(; itColl != itCollEnd; ++itColl) {
1063 int fragId = (*itColl)->identify();
1064 int drawer = fragId & 0x3F;
1065 int ROS = (fragId>>8);
1066 int rosI = ROS-1;
1067 int rosL = rosI;
1068 int rosH = rosI + N_ROS;
1069
1070 if (msgLvl(MSG::VERBOSE)) {
1071 ATH_MSG_VERBOSE( "Event# " << m_evtNr
1072 << " Frag id 0x" << MSG::hex << fragId << MSG::dec
1073 << " ROS " << ROS
1074 << " drawer " << drawer );
1075
1076 if (fillAll) {
1077 ATH_MSG_VERBOSE( " Size=" << (*itColl)->getFragSize()
1078 << " BCID=" << (*itColl)->getFragBCID() << MSG::hex
1079 << " CRC=0x" << ((*itColl)->getFragCRC()&0xffff)
1080 << " DMUMask=0x" << ((*itColl)->getFragDMUMask()&0xffff) << MSG::dec );
1081
1082 ATH_MSG_VERBOSE( " Lvl1ID=" << (*itColl)->getLvl1Id()
1083 << " Lvl1Type=" << (*itColl)->getLvl1Type()
1084 << " EvBCID=" << (*itColl)->getRODBCID()
1085 << " EvType=" << (*itColl)->getDetEvType() );
1086
1087 ATH_MSG_VERBOSE(" Header=" << (*itColl)->getFragChipHeaderWords() );
1088 }
1089 }
1090
1093 int rod = (rosL*N_MODULES + drawer);
1094 if (N_RODS<128) {
1095 rod >>= 2;
1096 } else if (N_RODS<256) {
1097 rod = (((rod>>2)<<1) | (rod&1));
1098 }
1099
1100 m_l1ID[rod] = (*itColl)->getLvl1Id();
1101 m_l1Type[rod] = (*itColl)->getLvl1Type();
1102 m_evType[rod] = (*itColl)->getDetEvType();
1103 m_evBCID[rod] = (*itColl)->getRODBCID();
1104 if (m_trigType == 0) m_trigType = -m_l1Type[rod]; // make negative to distinguish from TileCal internal trig types
1105
1106 TileDigitsCollection::const_iterator it = (*itColl)->begin();
1107 TileDigitsCollection::const_iterator itEnd = (*itColl)->end();
1108
1109 // non empty collection
1110 if(it != itEnd) {
1111 emptyColl = false;
1112
1113 if (fillAll) {
1114
1115 // store evtnr, bcid,crc, size
1116 // Same for lo and hi, because they come from the same fragment
1117
1118 m_arrays->m_rodBCID[rosL][drawer] = (*itColl)->getRODBCID();
1119 m_arrays->m_fragSize[rosL][drawer]=(*itColl)->getFragSize();
1120
1121 m_arrays->m_slinkCRC[rosL][drawer][0] = ((*itColl)->getFragCRC()>>16) & 0xffff;
1122 m_arrays->m_dmuMask[rosL][drawer][0] = ((*itColl)->getFragDMUMask()>>16) & 0xffff;
1123 m_arrays->m_slinkCRC[rosL][drawer][1] = (*itColl)->getFragCRC() & 0xffff;
1124 m_arrays->m_dmuMask[rosL][drawer][1] = (*itColl)->getFragDMUMask() & 0xffff;
1125
1126 uint32_t CRCmask = (*itColl)->getFragDMUMask(); //mask of FE+ROD DMU crc check (16bit+16bit) 0xffffffff == All ok
1127 uint32_t fe_crc = CRCmask & 0xFFFF;
1128 uint32_t rod_crc = CRCmask >> 16;
1129
1130 const std::vector<uint32_t> & headerVec = (*itColl)->getFragChipHeaderWords();
1131 unsigned int headsize = std::min(16U, static_cast<unsigned int>(headerVec.size()));
1132
1133 for (unsigned int ih = 0; ih < headsize; ++ih) {
1134
1135 m_arrays->m_DMUheader[rosL][drawer][ih] = headerVec[ih];
1136 m_arrays->m_DMUbcid[rosL][drawer][ih] = (headerVec[ih] & 0xFFF);
1137 m_arrays->m_DMUformatErr[rosL][drawer][ih] = CheckDMUFormat(headerVec[ih]);
1138 m_arrays->m_DMUparityErr[rosL][drawer][ih] = CheckDMUParity(headerVec[ih]);
1139 m_arrays->m_DMUmemoryErr[rosL][drawer][ih] = (headerVec[ih] >> 25 & 0x1);
1140 m_arrays->m_DMUSstrobeErr[rosL][drawer][ih] = (headerVec[ih] >> 24 & 0x1);
1141 m_arrays->m_DMUDstrobeErr[rosL][drawer][ih] = (headerVec[ih] >> 23 & 0x1);
1142
1143 m_arrays->m_feCRC[rosL][drawer][ih] = (fe_crc >> ih & 0x1);
1144 m_arrays->m_rodCRC[rosL][drawer][ih] = (rod_crc >> ih & 0x1);
1145 }
1146
1147 if (m_calibMode) {
1148 const std::vector<uint32_t> & headerVecHi = (*itColl)->getFragChipHeaderWordsHigh();
1149 unsigned int headsizehi = std::min(16U, static_cast<unsigned int>(headerVecHi.size()));
1150
1151 for (unsigned int ih = 0; ih < headsizehi; ++ih) {
1152
1153 m_arrays->m_DMUheader[rosH][drawer][ih] = headerVecHi[ih];
1154 m_arrays->m_DMUbcid[rosH][drawer][ih] = (headerVecHi[ih] & 0xFFF);
1155 m_arrays->m_DMUformatErr[rosH][drawer][ih] = CheckDMUFormat(headerVecHi[ih]);
1156 m_arrays->m_DMUparityErr[rosH][drawer][ih] = CheckDMUParity(headerVecHi[ih]);
1157 m_arrays->m_DMUmemoryErr[rosH][drawer][ih] = (headerVecHi[ih] >> 25 & 0x1);
1158 m_arrays->m_DMUSstrobeErr[rosH][drawer][ih] = (headerVecHi[ih] >> 24 & 0x1);
1159 m_arrays->m_DMUDstrobeErr[rosH][drawer][ih] = (headerVecHi[ih] >> 23 & 0x1);
1160
1161 m_arrays->m_feCRC[rosH][drawer][ih] = -1 ; //Variables must be filled anyway, empty variables are not allowed
1162 m_arrays->m_rodCRC[rosH][drawer][ih] = -1; //Variables must be filled anyway, empty variables are not allowed
1163 }
1164 }
1165 }
1166
1167
1168 int cmpCounter = 0;
1169 // go through all TileDigits in collection
1170 for (; it != itEnd; ++it) {
1171 const TileDigits* digit = (*it);
1172
1173 HWIdentifier hwid = digit->adc_HWID();
1174
1175 // determine channel
1176 int channel = m_tileHWID->channel(hwid);
1177 // convert channel number to PMT number if needed
1178 if (m_pmtOrder) channel = digiChannel2PMT(ROS,channel);
1179
1180 // determine gain and set ros index accordingly
1181 int gain = m_tileHWID->adc(hwid);
1182 if (m_calibMode) {
1183 if (m_compareMode) {
1184 ++cmpCounter;
1185 if (cmpCounter > 48) rosI = rosH;
1186 else rosI = rosL;
1187 } else {
1188 if (gain == 1) rosI = rosH;
1189 else rosI = rosL;
1190 }
1191 }
1192
1193 a_gain[rosI][drawer][channel] = gain;
1194
1195 // get digits
1196 const std::vector<float> & sampleVec = digit->samples();
1197 int siz = sampleVec.size();
1198 if (msgLvl(MSG::VERBOSE)) {
1199 int index,pmt;
1200 digit->cell_ID_index(index,pmt);
1201 msg(MSG::VERBOSE) << "TD ch " << channel
1202 << " gain "<< gain
1203 << " type " << std::min(index,0) << " {";
1204 for(int i=0;i<siz;i++) {
1205 msg(MSG::VERBOSE) <<(int)sampleVec[i] << " ";
1206 }
1207 }
1208 // changed N_SAMPLES to number of samples from tile configurator
1209 if (siz > m_nSamples) {
1210 siz = m_nSamples;
1211 if (msgLvl(MSG::VERBOSE))
1212 ATH_MSG_VERBOSE( "} ONLY " << siz << " digits saved to ntuple" );
1213 } else {
1214 if (msgLvl(MSG::VERBOSE))
1215 ATH_MSG_VERBOSE( "}" );
1216 }
1217 for (int n = 0; n < siz; ++n) {
1218 a_sample[sample_ind(rosI,drawer,channel,n)] = (short) sampleVec[n];
1219 }
1220 }
1221 }
1222 }
1223
1224 if (emptyColl) return StatusCode::FAILURE;
1225 else return StatusCode::SUCCESS;
1226}
1227
1228StatusCode TileAANtuple::storeTMDBDecision(const EventContext& ctx) {
1229
1230 const char * part[4] = {"LBA","LBC","EBA","EBC"};
1231
1232 // Read Decision from TES
1233 //
1234 if (!m_tileMuRcvContainerKey.empty()){
1235
1236 ATH_MSG_VERBOSE( "reading TMDB decision from " << m_tileMuRcvContainerKey.key() );
1237
1238 const TileMuonReceiverContainer *decisionCnt =
1240
1242 TileMuonReceiverContainer::const_iterator itLast = decisionCnt->end();
1243
1244 // Go through all decisions
1245 //
1246 int bcid[3]={0};
1247
1248 for(; it != itLast; ++it) {
1249
1250 const TileMuonReceiverObj * obj = (*it);
1251
1252 const std::vector<bool> & decision = obj->GetDecision();
1253 int siz = decision.size();
1254
1255 if (siz>0) {
1256
1257 int fragId = (*it)->identify();
1258 int drawer = fragId & 0x3F;
1259 int ros = ((fragId>>8) & 0xF) - 1;
1260 bcid[2] = ((fragId>>24) & 0xF);
1261 bcid[1] = ((fragId>>20) & 0xF);
1262 bcid[0] = ((fragId>>16) & 0XF);
1263
1264 if (siz > N_TMDBDECISIONS) {
1265 ATH_MSG_VERBOSE( "TMDB ONLY " << N_TMDBDECISIONS << " decisions saved to ntuple instead of " << siz);
1266 siz = N_TMDBDECISIONS;
1267 }
1268
1269 for (int n = 0; n < siz; ++n) {
1270 m_arrays->m_decisionTMDB[ros][drawer][n] = (unsigned char) decision[n];
1271 }
1272
1273 for (int n = 0; n < 3; ++n) {
1274 m_arrays->m_bcidTMDB[ros][drawer][n] = (unsigned char) bcid[n];
1275 }
1276
1277 if (msgLvl(MSG::VERBOSE)) {
1278 std::stringstream ss;
1279 for (int n = 0; n < siz; ++n) {
1280 ss<<std::setw(5)<<(int)m_arrays->m_decisionTMDB[ros][drawer][n];
1281 }
1282 ATH_MSG_VERBOSE( "TMDB 0x" <<MSG::hex<< fragId <<MSG::dec<<" "<< part[ros]
1283 << std::setfill('0') << std::setw(2)
1284 << drawer+1 << std::setfill(' ')
1285 << " BCID check " << bcid[0] <<"/"<< bcid[1] <<"/"<< bcid[2] << " decision: " << ss.str() );
1286 }
1287 }
1288 }
1289 }
1290
1291 return StatusCode::SUCCESS;
1292}
1293
1294StatusCode TileAANtuple::storeTMDBDigits(const EventContext& ctx) {
1295
1296 const char * part[4] = {"LBA","LBC","EBA","EBC"};
1297
1298 // Read Digits from TES
1299 //
1300 if (!m_tileMuRcvDigitsContainerKey.empty()){
1301
1302 ATH_MSG_VERBOSE( "reading TMDB digits from " << m_tileMuRcvDigitsContainerKey.key() );
1303
1304 const TileDigitsContainer* digitsCnt =
1306
1307 TileDigitsContainer::const_iterator itColl1 = (*digitsCnt).begin();
1308 TileDigitsContainer::const_iterator itCollEnd1 = (*digitsCnt).end();
1309
1310 // Go through all TileDigitsCollections
1311 for(; itColl1 != itCollEnd1; ++itColl1) {
1312
1313 TileDigitsCollection::const_iterator it1 = (*itColl1)->begin();
1314 TileDigitsCollection::const_iterator itEnd1 = (*itColl1)->end();
1315
1316 if (it1!=itEnd1) {
1317
1318 int fragId = (*itColl1)->identify();
1319 int drawer = fragId & 0x3F;
1320 int ros = (fragId>>8) - 1;
1321 int ichannel = 0;
1322
1323 ATH_MSG_VERBOSE( "TMDB 0x" <<MSG::hex<< fragId <<MSG::dec<<" "<< part[ros]
1324 << std::setfill('0') << std::setw(2)
1325 << drawer+1 << std::setfill(' ') );
1326
1327 for (; it1 != itEnd1; ++it1) {
1328
1329 if (ichannel>=N_TMDBCHANS) {
1330 ATH_MSG_WARNING("Too many channels in TMDB Digi container for frag 0x" <<MSG::hex<< fragId <<MSG::dec <<" keeping only first " << N_TMDBCHANS << " channels in ntuple ");
1331 break;
1332 }
1333
1334 const TileDigits* digit = (*it1);
1335
1336 // get digits
1337 const std::vector<float> & sampleVec = digit->samples();
1338 int siz = sampleVec.size();
1339
1340 if (siz > m_nSamples) {
1341 ATH_MSG_VERBOSE( "TMDB ONLY " << m_nSamples << " digits saved to ntuple instead of " << siz);
1342 siz = m_nSamples;
1343 }
1344
1345 for (int n = 0; n < siz; ++n) {
1346 m_arrays->m_sampleTMDB[sample_ind_TMDB(ros,drawer,ichannel,n)] = (unsigned char) sampleVec[n];
1347 }
1348
1349 if (msgLvl(MSG::VERBOSE)) {
1350 std::stringstream ss;
1351 for (int n = 0; n < siz; ++n) {
1352 ss<<std::setw(5)<<(int)m_arrays->m_sampleTMDB[sample_ind_TMDB(ros,drawer,ichannel,n)];
1353 }
1354 ATH_MSG_VERBOSE( "TMDB dig: " <<ros+1<<"/"<<drawer<<"/"<<m_tileHWID->channel(digit->adc_HWID())<<": "<<ss.str() );
1355 }
1356
1357 ++ichannel;
1358 }
1359 }
1360 }
1361 }
1362
1363 return StatusCode::SUCCESS;
1364}
1365
1366StatusCode TileAANtuple::storeTMDBRawChannel(const EventContext& ctx) {
1367
1368 const char * part[4] = {"LBA","LBC","EBA","EBC"};
1369
1370 // Read Raw Channels from TDS
1371 //
1373
1374 ATH_MSG_VERBOSE( "reading TMDB energies from " << m_tileMuRcvRawChannelContainerKey.key() );
1375
1376 const TileRawChannelContainer* rcCnt =
1378
1379 TileRawChannelContainer::const_iterator itColl2 = (*rcCnt).begin();
1380 TileRawChannelContainer::const_iterator itCollEnd2 = (*rcCnt).end();
1381
1382 // Go through all TileDigitsCollections
1383 for(; itColl2 != itCollEnd2; ++itColl2) {
1384
1385 TileRawChannelCollection::const_iterator it2 = (*itColl2)->begin();
1386 TileRawChannelCollection::const_iterator itEnd2 = (*itColl2)->end();
1387
1388 if (it2!=itEnd2) {
1389
1390 int fragId = (*itColl2)->identify();
1391 int drawer = fragId & 0x3F;
1392 int ros = (fragId>>8) - 1;
1393 int ichannel = 0;
1394
1395 ATH_MSG_VERBOSE( "TMDB 0x" <<MSG::hex<< fragId <<MSG::dec<<" "<< part[ros]
1396 << std::setfill('0') << std::setw(2)
1397 << drawer+1 << std::setfill(' ') );
1398
1399 for (; it2 != itEnd2; ++it2) {
1400
1401 if (ichannel>=N_TMDBCHANS) {
1402 ATH_MSG_WARNING("Too many channels in TMDB RCh container for frag 0x" <<MSG::hex<< fragId <<MSG::dec <<" keeping only first " << N_TMDBCHANS << " channels in ntuple ");
1403 break;
1404 }
1405
1406 const TileRawChannel* rc = (*it2);
1407
1408 m_arrays->m_eTMDB[ros][drawer][ichannel] = rc -> amplitude();
1409
1410 ATH_MSG_VERBOSE( "TMDB rc: " <<ros+1<<"/"<<drawer<<"/"<<m_tileHWID->channel(rc->adc_HWID())<< ": " << m_arrays->m_eTMDB[ros][drawer][ichannel] );
1411
1412 ++ichannel;
1413 }
1414 }
1415 }
1416 }
1417
1418 return StatusCode::SUCCESS;
1419}
1420
1421StatusCode
1423
1424 if (m_arrays->m_sample) free(m_arrays->m_sample);
1425 if (m_arrays->m_sampleFlt) free(m_arrays->m_sampleFlt);
1426 if (m_arrays->m_sampleTMDB) free(m_arrays->m_sampleTMDB);
1427 if (m_arrays->m_eMF) free(m_arrays->m_eMF);
1428 if (m_arrays->m_tMF) free(m_arrays->m_tMF);
1429
1430 ATH_MSG_INFO( "finalize() successfully" );
1431 return StatusCode::SUCCESS;
1432}
1433
1434StatusCode
1436
1442
1443 return StatusCode::SUCCESS;
1444}
1445
1446StatusCode
1447TileAANtuple::initNTuple(const EventContext& ctx) {
1448 //Aux Ntuple creation
1449
1450 if (m_compressSettings >= 0) {
1451 std::vector<std::string> files;
1452 m_fileMgr->getFiles(Io::ROOT, ( Io::WRITE | Io::CREATE ), files);
1453 for (std::string& file : files) {
1454 TFile* outFile = (TFile*) m_fileMgr->fptr(file);
1455 if (outFile) {
1456 ATH_MSG_INFO("Changing compressing settings to " << m_compressSettings << " for file: " << file);
1457 outFile->SetCompressionSettings(m_compressSettings);
1458 }
1459 }
1460 }
1461
1462 if (m_ntupleID.size() > 0) {
1463
1464 std::string ntupleID = m_ntupleID + "_map";
1465
1466 TTree* ntuplePtr = new TTree(ntupleID.c_str(), "TileCal-CellMap");
1467 if(m_thistSvc->regTree("/" + m_streamName + "/" + ntupleID, ntuplePtr).isFailure()) {
1468 ATH_MSG_ERROR( "Problem registering TileRec CellMap Tree" );
1469 }
1470
1471 fillCellMap(ntuplePtr);
1472
1473 //Ntuple creation
1474 m_ntuplePtr = new TTree(m_ntupleID.c_str(), "TileCal-Ntuple");
1475 m_ntuplePtr->SetMaxTreeSize(m_treeSize);
1476 if (m_thistSvc->regTree("/" + m_streamName + "/" + m_ntupleID, m_ntuplePtr).isFailure()) {
1477 ATH_MSG_ERROR( "Problem registering TileRec Tree");
1478 }
1479
1482 if (!m_laserObjectKey.empty()) {
1483 const TileLaserObject* laserObj =
1484 SG::makeHandle(m_laserObjectKey, ctx).get();
1485 m_las_version = laserObj->getVersion();
1487 }
1490 }
1491
1492 //DCS Ntuple creation
1493 if (m_checkDCS) {
1494 std::string ntupleDCS = "Tile_DCS";
1495 m_DCSntuplePtr = new TTree(ntupleDCS.c_str(), "TileCal-DCS data");
1496 if (m_thistSvc->regTree("/" + m_streamName + "/" + ntupleDCS, m_DCSntuplePtr).isFailure()) {
1497 ATH_MSG_ERROR( "Problem registering TileRec DCS Tree");
1498 }
1499 DCS_addBranch();
1500 }
1501
1502 return StatusCode::SUCCESS;
1503}
1504
1505
1508 //
1523 //
1524 */
1525
1529 //
1531 */
1532void TileAANtuple::fillCellMap(TTree* ntuplePtr) {
1533
1534 float eta[4][64][48];
1535 float phi[4][64][48];
1536 short tower[4][64][48];
1537 short sample[4][64][48];
1538 short ind[4][64][48];
1539 short pmt[4][64][48];
1540 short bad[4][64][48][2];
1541
1542 CLEAR(eta);
1543 CLEAR(phi);
1544 CLEAR1(tower);
1545 CLEAR1(sample);
1546 CLEAR1(ind);
1547 CLEAR(pmt);
1548 CLEAR1(bad);
1549
1550 ntuplePtr->Branch("eta", eta, "eta[4][64][48]/F");
1551 ntuplePtr->Branch("phi", phi, "phi[4][64][48]/F");
1552 ntuplePtr->Branch("tower", tower, "tower[4][64][48]/S");
1553 ntuplePtr->Branch("sample", sample, "sample[4][64][48]/S");
1554 ntuplePtr->Branch("ind", ind, "ind[4][64][48]/S");
1555 ntuplePtr->Branch("pmt", pmt, "pmt[4][64][48]/S");
1556 ntuplePtr->Branch("bad", bad, "bad[4][64][48][2]/S");
1557
1560
1561 for (; itr != end; ++itr) {
1562 const CaloDetDescrElement * caloDDE = (*itr);
1563 Identifier cell_id = caloDDE->identify();
1564 IdentifierHash hash[2] = { caloDDE->onl1(), caloDDE->onl2() };
1565 for (int i = 0; i < 2; ++i) {
1566 if (hash[i] != TileHWID::NOT_VALID_HASH) {
1567 HWIdentifier adc_id = m_tileHWID->adc_id(hash[i], 0);
1568 int ROS = m_tileHWID->ros(adc_id);
1569 int drawer = m_tileHWID->drawer(adc_id);
1570 int chan = m_tileHWID->channel(adc_id);
1571 int index, pm;
1572 m_cabling->h2s_cell_id_index(adc_id, index, pm); // index=-2 for MBTS or -1 for all disconnected channels
1573 if (index > -1) index = i; // just put back 0 or 1 for all connected channels
1574 pm = m_cabling->channel2hole(ROS, chan); // convert channel to PMT number, ignoring difference between drawers
1575 if ((ROS == 3 && drawer == 14) || (ROS == 4 && drawer == 17)) {
1576 if (pm < 0) pm = -pm; // crack scin in EBA15 EBC18 in non-standard place - recover positive pmt number
1577 if (chan == 2 || chan == 3) pm = -pm; // no D4 in special EBA15 EBC18 - put negative sign
1578 }
1579 if (m_pmtOrder) chan = digiChannel2PMT(ROS,chan); // convert channel to PMT-1
1580 int rosI = ROS-1; // make ros index from 0 to 3
1581 eta[rosI][drawer][chan] = caloDDE->eta();
1582 phi[rosI][drawer][chan] = caloDDE->phi();
1583 tower[rosI][drawer][chan] = m_tileID->tower(cell_id);
1584 sample[rosI][drawer][chan] = m_tileID->sample(cell_id);
1585 ind[rosI][drawer][chan] = index;
1586 pmt[rosI][drawer][chan] = pm;
1587 }
1588 }
1589 }
1590
1591 const MbtsDetDescrManager* mbtsMgr = nullptr;
1592 if ( detStore()->retrieve(mbtsMgr).isFailure() ) {
1593 ATH_MSG_WARNING( "Unable to retrieve MbtsDetDescrManager from DetectorStore" );
1594 mbtsMgr = nullptr;
1595 }
1596 for (int ROS = 1; ROS < 5; ++ROS) {
1597 int rosI = ROS - 1;
1598 for (int drawer = 0; drawer < 64; ++drawer) {
1599 for (int chan = 0; chan < 48; ++chan) {
1600 for (int adc = 0; adc < 2; ++adc) {
1601 HWIdentifier adc_id = m_tileHWID->adc_id(ROS, drawer, chan, adc);
1602 bad[rosI][drawer][chan][adc] = (short) m_tileBadChanTool->encodeStatus(m_tileBadChanTool->getAdcStatus(adc_id));
1603 int index, pm;
1604 Identifier cell_id = m_cabling->h2s_cell_id_index(adc_id, index, pm);
1605 if (index == -2) { // MBTS
1606 ind[rosI][drawer][chan] = index;
1607 pmt[rosI][drawer][chan] = 1; // we know that all MBTS are in PMT 1
1608 if (mbtsMgr) {
1609 const CaloDetDescrElement * caloDDE = mbtsMgr->get_element(cell_id);
1610 if (caloDDE) {
1611 if (caloDDE->z() > 0.0)
1612 eta[rosI][drawer][chan] = fabs(caloDDE->eta());
1613 else
1614 eta[rosI][drawer][chan] = -fabs(caloDDE->eta());
1615 phi[rosI][drawer][chan] = caloDDE->phi();
1616 }
1617 }
1618 }
1619 }
1620 }
1621 }
1622 }
1623
1624 ntuplePtr->Fill();
1625}
1626
1627
1631 //
1633 */
1635 m_ntuplePtr->Branch("EvTime",&m_evTime,"EvTime/I");
1636 m_ntuplePtr->Branch("Run",&m_run,"Run/I");
1637 m_ntuplePtr->Branch("LumiBlock",&m_lumiBlock,"LumiBlock/I");
1638 m_ntuplePtr->Branch("Evt",&m_evt,"Evt/I");
1639 m_ntuplePtr->Branch("EvtNr",&m_evtNr,"EvtNr/I");
1640 m_ntuplePtr->Branch("Trig",&m_trigType,"Trig/I");
1641 m_ntuplePtr->Branch("DSPflags",&m_dspFlags,"DSPflags/i");
1642 m_ntuplePtr->Branch("DSPunits",&m_dspUnit,"DSPunits/S");
1643 m_ntuplePtr->Branch("OFLunits",&m_rchUnit,"OFLunits/S");
1644
1645 if (m_bsInput) {
1646 std::string dim = "[" + std::to_string(N_RODS) + "]/I";
1647 m_ntuplePtr->Branch("L1ID", m_l1ID, NAME2("L1ID", dim));
1648 m_ntuplePtr->Branch("L1Type", m_l1Type, NAME2("L1Type",dim));
1649 m_ntuplePtr->Branch("EvType", m_evType, NAME2("EvType",dim));
1650 m_ntuplePtr->Branch("EvBCID", m_evBCID, NAME2("EvBCID",dim));
1651 }
1652}
1653
1654
1657 //Clear Tree TRIGGER variables
1658 //
1660 */
1662 m_evTime=0;
1663 m_run=0;
1664 m_evt=0;
1665 m_trigType=0;
1666 m_dspFlags=0;
1667
1668 CLEAR1(m_l1ID);
1672}
1673
1674
1678 //
1680 */
1682 if (!m_beamElemContainerKey.key().empty()) {
1683 m_ntuplePtr->Branch("cispar",m_cispar,"cispar[110]/i");
1684 }
1685}
1686
1687
1690 //Clear Tree CISPAR variables
1691 //
1693 */
1695 if (!m_beamElemContainerKey.key().empty()) {
1696 CLEAR(m_cispar);
1697 }
1698}
1699
1700
1704 //
1706 */
1708
1709 if (!m_laserObjectKey.empty()) {
1710
1711 const char* gainnames[2] = {"LG","HG"};
1712 const char* channames[16] = {"Diode0","Diode1","Diode2","Diode3","Diode4","Diode5","Diode6","Diode7",
1713 "Diode8","Diode9","ExtCIS0","IntCIS","DiodePhocal","ExtCIS1","PMT1","PMT2"};
1714
1715 m_ntuplePtr->Branch("LASER_BCID", &m_las_BCID, "LASER_BCID/I");
1716
1717 m_ntuplePtr->Branch("LASER_FILTER", &m_las_Filt, "LASER_FILTER/I");
1718 m_ntuplePtr->Branch("LASER_REQAMP", &m_las_ReqAmp, "LASER_REQAMP/F");
1719 m_ntuplePtr->Branch("LASER_MEASAMP", &m_las_MeasAmp, "LASER_MEASAMP/F");
1720
1721 if(m_las_version==2) {
1722
1723 ATH_MSG_DEBUG("LASERII BRANCHING..");
1724
1725 m_ntuplePtr->Branch(Form("LASER_QDCTIMEOUT"),&(m_qdctimeout),Form("LASER_QDCTIMEOUT/O"));
1726 m_ntuplePtr->Branch(Form("LASER_TDCTIMEOUT"),&(m_tdctimeout),Form("LASER_TDCTIMEOUT/O"));
1727 m_ntuplePtr->Branch(Form("LASER_DAQTYPE"),&(m_daqtype),Form("LASER_DAQTYPE/I"));
1728 for(int chan=0;chan<32;++chan){
1729 int ch=chan>>1;
1730 int gn=chan&1;
1731 m_ntuplePtr->Branch(Form("LASER_%s_%s_ADC",gainnames[gn],channames[ch]),&(m_arrays->m_chan[chan]),Form("LASER_%s_%s_ADC/I",gainnames[gn],channames[ch]));
1732 m_ntuplePtr->Branch(Form("LASER_%s_%s_Ped",gainnames[gn],channames[ch]),&(m_arrays->m_chan_Ped[chan]),Form("LASER_%s_%s_Ped/F",gainnames[gn],channames[ch]));
1733 m_ntuplePtr->Branch(Form("LASER_%s_%s_Led",gainnames[gn],channames[ch]),&(m_arrays->m_chan_Led[chan]),Form("LASER_%s_%s_Led/F",gainnames[gn],channames[ch]));
1734 m_ntuplePtr->Branch(Form("LASER_%s_%s_Ped1",gainnames[gn],channames[ch]),&(m_arrays->m_chan_Lin[chan]),Form("LASER_%s_%s_Ped1/F",gainnames[gn],channames[ch]));
1735 m_ntuplePtr->Branch(Form("LASER_%s_%s_Alpha",gainnames[gn],channames[ch]),&(m_arrays->m_chan_Alpha[chan]),Form("LASER_%s_%s_Alpha/F",gainnames[gn],channames[ch]));
1736 m_ntuplePtr->Branch(Form("LASER_%s_%s_Sigma_Ped",gainnames[gn],channames[ch]),&(m_arrays->m_chan_SPed[chan]),Form("LASER_%s_%s_Sigma_Ped/F",gainnames[gn],channames[ch]));
1737 m_ntuplePtr->Branch(Form("LASER_%s_%s_Sigma_Led",gainnames[gn],channames[ch]),&(m_arrays->m_chan_SLed[chan]),Form("LASER_%s_%s_Sigma_Led/F",gainnames[gn],channames[ch]));
1738 m_ntuplePtr->Branch(Form("LASER_%s_%s_Sigma_Ped1",gainnames[gn],channames[ch]),&(m_arrays->m_chan_SLin[chan]),Form("LASER_%s_%s_Sigma_Ped1/F",gainnames[gn],channames[ch]));
1739 m_ntuplePtr->Branch(Form("LASER_%s_%s_Sigma_Alpha",gainnames[gn],channames[ch]),&(m_arrays->m_chan_SAlpha[chan]),Form("LASER_%s_%s_Sigma_Alpha/F",gainnames[gn],channames[ch]));
1740 } // FOR
1741
1742 } else {
1743
1744 ATH_MSG_DEBUG("LASERI BRANCHING..");
1745
1746 m_ntuplePtr->Branch("LASER_Diode_1_ADC", &(m_arrays->m_las_D_ADC[0][0]), "LASER_Diode_1_ADC/I");
1747 m_ntuplePtr->Branch("LASER_Diode_2_ADC", &(m_arrays->m_las_D_ADC[0][1]), "LASER_Diode_2_ADC/I");
1748 m_ntuplePtr->Branch("LASER_Diode_3_ADC", &(m_arrays->m_las_D_ADC[0][2]), "LASER_Diode_3_ADC/I");
1749 m_ntuplePtr->Branch("LASER_Diode_4_ADC", &(m_arrays->m_las_D_ADC[0][3]), "LASER_Diode_4_ADC/I");
1750
1751 m_ntuplePtr->Branch("LASER_Diode_1_Ped", &(m_arrays->m_las_D_Ped[0][0]), "LASER_Diode_1_Ped/F");
1752 m_ntuplePtr->Branch("LASER_Diode_2_Ped", &(m_arrays->m_las_D_Ped[0][1]), "LASER_Diode_2_Ped/F");
1753 m_ntuplePtr->Branch("LASER_Diode_3_Ped", &(m_arrays->m_las_D_Ped[0][2]), "LASER_Diode_3_Ped/F");
1754 m_ntuplePtr->Branch("LASER_Diode_4_Ped", &(m_arrays->m_las_D_Ped[0][3]), "LASER_Diode_4_Ped/F");
1755
1756 m_ntuplePtr->Branch("LASER_Diode_1_Ped_RMS", &(m_arrays->m_las_D_Ped_RMS[0][0]), "LASER_Diode_1_Ped_RMS/F");
1757 m_ntuplePtr->Branch("LASER_Diode_2_Ped_RMS", &(m_arrays->m_las_D_Ped_RMS[0][1]), "LASER_Diode_2_Ped_RMS/F");
1758 m_ntuplePtr->Branch("LASER_Diode_3_Ped_RMS", &(m_arrays->m_las_D_Ped_RMS[0][2]), "LASER_Diode_3_Ped_RMS/F");
1759 m_ntuplePtr->Branch("LASER_Diode_4_Ped_RMS", &(m_arrays->m_las_D_Ped_RMS[0][3]), "LASER_Diode_4_Ped_RMS/F");
1760
1761 m_ntuplePtr->Branch("LASER_Diode_1_Alpha", &(m_arrays->m_las_D_Alpha[0][0]), "LASER_Diode_1_Alpha/F");
1762 m_ntuplePtr->Branch("LASER_Diode_2_Alpha", &(m_arrays->m_las_D_Alpha[0][1]), "LASER_Diode_2_Alpha/F");
1763 m_ntuplePtr->Branch("LASER_Diode_3_Alpha", &(m_arrays->m_las_D_Alpha[0][2]), "LASER_Diode_3_Alpha/F");
1764 m_ntuplePtr->Branch("LASER_Diode_4_Alpha", &(m_arrays->m_las_D_Alpha[0][3]), "LASER_Diode_4_Alpha/F");
1765
1766 m_ntuplePtr->Branch("LASER_Diode_1_Alpha_RMS", &(m_arrays->m_las_D_Alpha_RMS[0][0]), "LASER_Diode_1_Alpha_RMS/F");
1767 m_ntuplePtr->Branch("LASER_Diode_2_Alpha_RMS", &(m_arrays->m_las_D_Alpha_RMS[0][1]), "LASER_Diode_2_Alpha_RMS/F");
1768 m_ntuplePtr->Branch("LASER_Diode_3_Alpha_RMS", &(m_arrays->m_las_D_Alpha_RMS[0][2]), "LASER_Diode_3_Alpha_RMS/F");
1769 m_ntuplePtr->Branch("LASER_Diode_4_Alpha_RMS", &(m_arrays->m_las_D_Alpha_RMS[0][3]), "LASER_Diode_4_Alpha_RMS/F");
1770
1771 m_ntuplePtr->Branch("LASER_Diode_1_AlphaPed", &(m_arrays->m_las_D_AlphaPed[0][0]), "LASER_Diode_1_AlphaPed/F");
1772 m_ntuplePtr->Branch("LASER_Diode_2_AlphaPed", &(m_arrays->m_las_D_AlphaPed[0][1]), "LASER_Diode_2_AlphaPed/F");
1773 m_ntuplePtr->Branch("LASER_Diode_3_AlphaPed", &(m_arrays->m_las_D_AlphaPed[0][2]), "LASER_Diode_3_AlphaPed/F");
1774 m_ntuplePtr->Branch("LASER_Diode_4_AlphaPed", &(m_arrays->m_las_D_AlphaPed[0][3]), "LASER_Diode_4_AlphaPed/F");
1775
1776 m_ntuplePtr->Branch("LASER_Diode_1_AlphaPed_RMS", &(m_arrays->m_las_D_AlphaPed_RMS[0][0]), "LASER_Diode_1_AlphaPed_RMS/F");
1777 m_ntuplePtr->Branch("LASER_Diode_2_AlphaPed_RMS", &(m_arrays->m_las_D_AlphaPed_RMS[0][1]), "LASER_Diode_2_AlphaPed_RMS/F");
1778 m_ntuplePtr->Branch("LASER_Diode_3_AlphaPed_RMS", &(m_arrays->m_las_D_AlphaPed_RMS[0][2]), "LASER_Diode_3_AlphaPed_RMS/F");
1779 m_ntuplePtr->Branch("LASER_Diode_4_AlphaPed_RMS", &(m_arrays->m_las_D_AlphaPed_RMS[0][3]), "LASER_Diode_4_AlphaPed_RMS/F");
1780
1781 m_ntuplePtr->Branch("LASER_PMT_1_ADC", &(m_arrays->m_las_PMT_ADC[0][0]), "LASER_PMT_1_ADC/I");
1782 m_ntuplePtr->Branch("LASER_PMT_2_ADC", &(m_arrays->m_las_PMT_ADC[0][1]), "LASER_PMT_2_ADC/I");
1783
1784 m_ntuplePtr->Branch("LASER_PMT_1_TDC", &(m_arrays->m_las_PMT_TDC[0][0]), "LASER_PMT_1_TDC/I");
1785 m_ntuplePtr->Branch("LASER_PMT_2_TDC", &(m_arrays->m_las_PMT_TDC[0][1]), "LASER_PMT_2_TDC/I");
1786
1787 m_ntuplePtr->Branch("LASER_PMT_1_Ped", &(m_arrays->m_las_PMT_Ped[0][0]), "LASER_PMT_1_Ped/F");
1788 m_ntuplePtr->Branch("LASER_PMT_2_Ped", &(m_arrays->m_las_PMT_Ped[0][1]), "LASER_PMT_2_Ped/F");
1789
1790 m_ntuplePtr->Branch("LASER_PMT_1_Ped_RMS", &(m_arrays->m_las_PMT_Ped_RMS[0][0]), "LASER_PMT_1_Ped_RMS/F");
1791 m_ntuplePtr->Branch("LASER_PMT_2_Ped_RMS", &(m_arrays->m_las_PMT_Ped_RMS[0][1]), "LASER_PMT_2_Ped_RMS/F");
1792
1793 }
1794
1795 m_ntuplePtr->Branch("LASER_HEAD_Temp", &m_las_Temperature, "LASER_HEAD_Temp/F");
1796 }
1797}
1798
1799
1802 //Clear Tree LASER variables
1803 //
1805 */
1807
1808 if (!m_laserObjectKey.empty()) {
1809
1810 m_las_BCID = 0;
1811
1812 m_las_Filt = 0;
1813 m_las_ReqAmp = 0.0;
1814 m_las_MeasAmp = 0.0;
1815 m_las_Temperature = 0.0;
1816
1817 // LASERII
1818 // memset(m_arrays->m_chan, 0, sizeof(m_arrays->m_chan));
1819 // memset(m_arrays->m_chan_Ped, 0, sizeof(m_arrays->m_chan_Ped));
1820 // memset(m_arrays->m_chan_Led, 0, sizeof(m_arrays->m_chan_Led));
1821 // memset(m_arrays->m_chan_Lin, 0, sizeof(m_arrays->m_chan_Lin));
1822 // memset(m_arrays->m_chan_Alpha, 0, sizeof(m_arrays->m_chan_Alpha));
1823 // memset(m_arrays->m_chan_SPed, 0, sizeof(m_arrays->m_chan_SPed));
1824 // memset(m_arrays->m_chan_SLed, 0, sizeof(m_arrays->m_chan_SLed));
1825 // memset(m_arrays->m_chan_SLin, 0, sizeof(m_arrays->m_chan_SLin));
1826 // memset(m_arrays->m_chan_SAlpha, 0, sizeof(m_arrays->m_chan_SAlpha));
1827
1828 // LASERI
1829 memset(m_arrays->m_las_D_ADC, 0, sizeof(m_arrays->m_las_D_ADC));
1830 memset(m_arrays->m_las_D_Ped, 0, sizeof(m_arrays->m_las_D_Ped));
1831 memset(m_arrays->m_las_D_Ped_RMS, 0, sizeof(m_arrays->m_las_D_Ped_RMS));
1832 memset(m_arrays->m_las_D_Alpha, 0, sizeof(m_arrays->m_las_D_Alpha));
1833 memset(m_arrays->m_las_D_Alpha_RMS, 0, sizeof(m_arrays->m_las_D_Alpha_RMS));
1834 memset(m_arrays->m_las_D_AlphaPed, 0, sizeof(m_arrays->m_las_D_AlphaPed));
1835 memset(m_arrays->m_las_D_AlphaPed_RMS, 0, sizeof(m_arrays->m_las_D_AlphaPed_RMS));
1836
1837 memset(m_arrays->m_las_PMT_ADC, 0, sizeof(m_arrays->m_las_PMT_ADC));
1838 memset(m_arrays->m_las_PMT_TDC, 0, sizeof(m_arrays->m_las_PMT_TDC));
1839 memset(m_arrays->m_las_PMT_Ped, 0, sizeof(m_arrays->m_las_PMT_Ped));
1840 memset(m_arrays->m_las_PMT_Ped_RMS, 0, sizeof(m_arrays->m_las_PMT_Ped_RMS));
1841
1842 }
1843}
1844
1845
1849 //
1851 */
1853{
1854 std::string suf[3] = {"_lo","_hi",""};
1855 if (m_compareMode) {
1856 suf[0] = "_xx";
1857 suf[1] = "_yy";
1858 suf[2] = "_zz";
1859 m_ntuplePtr->Branch(NAME2("sumEt",suf[0]), m_sumEt_xx, NAME3("sumEt", suf[0],"[4][64]/F")); // float
1860 m_ntuplePtr->Branch(NAME2("sumEz",suf[0]), m_sumEz_xx, NAME3("sumEz", suf[0],"[4][64]/F")); // float
1861 m_ntuplePtr->Branch(NAME2("sumE", suf[0]), m_sumE_xx, NAME3("sumE", suf[0],"[4][64]/F")); // float
1862 m_ntuplePtr->Branch(NAME2("sumEt",suf[1]), m_sumEt_yy, NAME3("sumEt", suf[1],"[4][64]/F")); // float
1863 m_ntuplePtr->Branch(NAME2("sumEz",suf[1]), m_sumEz_yy, NAME3("sumEz", suf[1],"[4][64]/F")); // float
1864 m_ntuplePtr->Branch(NAME2("sumE", suf[1]), m_sumE_yy, NAME3("sumE", suf[1],"[4][64]/F")); // float
1865 m_ntuplePtr->Branch(NAME2("sumEt",suf[2]), m_sumEt_zz, NAME3("sumEt", suf[2],"[4][64]/F")); // float
1866 m_ntuplePtr->Branch(NAME2("sumEz",suf[2]), m_sumEz_zz, NAME3("sumEz", suf[2],"[4][64]/F")); // float
1867 m_ntuplePtr->Branch(NAME2("sumE", suf[2]), m_sumE_zz, NAME3("sumE", suf[2],"[4][64]/F")); // float
1868 }
1869
1870 int sample_size = N_ROS*N_MODULES*N_CHANS*m_nSamples;
1871
1872 int imin = 2, imax = 3, ir = 0, is = 0;
1873
1874 if (m_calibMode) {
1875 imin = 0;
1876 imax = 2;
1877 }
1878
1879 if (!m_mfRawChannelContainerKey.empty()) {
1880 int size = sample_size * (imax-imin);
1881 m_arrays->m_eMF = (float *) malloc(size*sizeof(float));
1882 m_arrays->m_tMF = (float *) malloc(size*sizeof(float));
1883 }
1884
1885 for (int i = imin; i < imax; ++i) {
1886
1887 std::string f_suf(suf[i]);
1888
1889 if (m_fltDigitsContainerKey.empty() && m_digitsContainerKey.empty()
1890 && (!m_rawChannelContainerKey.empty()
1891 || !m_fitRawChannelContainerKey.empty()
1893 || !m_optRawChannelContainerKey.empty()
1894 || !m_qieRawChannelContainerKey.empty()
1895 || !m_dspRawChannelContainerKey.empty()
1896 || !m_mfRawChannelContainerKey.empty()
1897 || !m_of1RawChannelContainerKey.empty()
1899 || !m_bsInput) ) {
1900
1901 m_ntuplePtr->Branch(NAME2("gain",f_suf), m_arrays->m_gain[ir], NAME3("gain", f_suf,"[4][64][48]/S")); // short
1902
1903 } else {
1904
1905 std::string samples = "[4][64][48][" + std::to_string(m_nSamples) + "]/S";
1906
1907 if (!m_fltDigitsContainerKey.empty()) {
1908 if (!m_digitsContainerKey.empty()) { // should use different names for two containers
1909
1910 m_ntuplePtr->Branch(NAME2("sampleFlt",f_suf), &(m_arrays->m_sample[is]), NAME3("sampleFlt", f_suf, samples)); // short
1911 m_ntuplePtr->Branch(NAME2("gainFlt",f_suf), m_arrays->m_gainFlt[ir], NAME3("gainFlt", f_suf,"[4][64][48]/S")); // short
1912 } else {
1913 m_ntuplePtr->Branch(NAME2("sample",f_suf), &(m_arrays->m_sampleFlt[is]), NAME3("sampleFlt", f_suf, samples)); // short
1914 if (!m_rawChannelContainerKey.empty()
1915 || !m_fitRawChannelContainerKey.empty()
1917 || !m_optRawChannelContainerKey.empty()
1918 || !m_qieRawChannelContainerKey.empty()
1919 || !m_of1RawChannelContainerKey.empty()
1920 || !m_dspRawChannelContainerKey.empty()
1922 || m_bsInput) {
1923
1924 m_ntuplePtr->Branch(NAME2("gain",f_suf), m_arrays->m_gain[ir], NAME3("gain", f_suf,"[4][64][48]/S")); // short
1925 } else {
1926 m_ntuplePtr->Branch(NAME2("gain",f_suf), m_arrays->m_gainFlt[ir], NAME3("gainFlt", f_suf,"[4][64][48]/S")); // short
1927 }
1928 }
1929 }
1930
1931 if (!m_digitsContainerKey.empty()) {
1932 m_ntuplePtr->Branch(NAME2("sample",f_suf), &(m_arrays->m_sample[is]), NAME3("sample", f_suf, samples)); // short
1933 m_ntuplePtr->Branch(NAME2("gain",f_suf), m_arrays->m_gain[ir], NAME3("gain", f_suf,"[4][64][48]/S")); // short
1934
1935 if (m_bsInput) {
1936 m_ntuplePtr->Branch(NAME2("DMUheader",f_suf), m_arrays->m_DMUheader[ir], NAME3("DMUheader", f_suf,"[4][64][16]/i")); // uint32
1937 m_ntuplePtr->Branch(NAME2("DMUBCID",f_suf), m_arrays->m_DMUbcid[ir], NAME3("DMUBCID", f_suf,"[4][64][16]/S")); // short
1938 m_ntuplePtr->Branch(NAME2("DMUmemoryErr",f_suf), m_arrays->m_DMUmemoryErr[ir], NAME3("DMUmemoryErr", f_suf,"[4][64][16]/S")); // short
1939 m_ntuplePtr->Branch(NAME2("DMUSstrobeErr",f_suf), m_arrays->m_DMUSstrobeErr[ir], NAME3("DMUSstrobeErr", f_suf,"[4][64][16]/S")); // short
1940 m_ntuplePtr->Branch(NAME2("DMUDstrobeErr",f_suf), m_arrays->m_DMUDstrobeErr[ir], NAME3("DMUDstrobeErr", f_suf,"[4][64][16]/S")); // short
1941 m_ntuplePtr->Branch(NAME2("DMUheadformatErr",f_suf),m_arrays->m_DMUformatErr[ir], NAME3("DMUheadformatErr", f_suf,"[4][64][16]/S")); // short
1942 m_ntuplePtr->Branch(NAME2("DMUheadparityErr",f_suf),m_arrays->m_DMUparityErr[ir], NAME3("DMUheadparityErr", f_suf,"[4][64][16]/S")); // short
1943
1944 m_ntuplePtr->Branch(NAME2("feCRC",f_suf), m_arrays->m_feCRC[ir], NAME3("feCRC", f_suf,"[4][64][16]/S")); // short
1945 m_ntuplePtr->Branch(NAME2("rodCRC",f_suf), m_arrays->m_rodCRC[ir], NAME3("rodCRC", f_suf,"[4][64][16]/S")); // short
1946
1947 if (i == imin) { // common for low and high gain
1948 m_ntuplePtr->Branch("rodBCID", m_arrays->m_rodBCID, "rodBCID[4][64]/S"); // short
1949 m_ntuplePtr->Branch("fragSize", m_arrays->m_fragSize,"fragSize[4][64]/S"); // short
1950 m_ntuplePtr->Branch("DMUmask", m_arrays->m_dmuMask, "DMUmask[4][64][2]/s"); // unsigned short
1951 m_ntuplePtr->Branch("slinkCRC", m_arrays->m_slinkCRC,"slinkCRC[4][64][2]/s"); // unsigned short
1952 }
1953 }
1954 }
1955 }
1956
1957 if (!m_rawChannelContainerKey.empty()) {
1958 m_ntuplePtr->Branch(NAME2("ene",f_suf), m_arrays->m_ene[ir], NAME3("ene",f_suf,"[4][64][48]/F")); // float
1959 m_ntuplePtr->Branch(NAME2("time",f_suf), m_arrays->m_time[ir], NAME3("time",f_suf,"[4][64][48]/F")); // float
1960 m_ntuplePtr->Branch(NAME2("ped",f_suf), m_arrays->m_ped[ir], NAME3("ped",f_suf,"[4][64][48]/F")); // float
1961 m_ntuplePtr->Branch(NAME2("chi2",f_suf), m_arrays->m_chi2[ir], NAME3("chi2",f_suf,"[4][64][48]/F")); // float
1962 }
1963
1964 if (!m_fitRawChannelContainerKey.empty()) {
1965 m_ntuplePtr->Branch(NAME2("eFit",f_suf), m_arrays->m_eFit[ir], NAME3("eFit",f_suf,"[4][64][48]/F")); // float
1966 m_ntuplePtr->Branch(NAME2("tFit",f_suf), m_arrays->m_tFit[ir], NAME3("tFit",f_suf,"[4][64][48]/F")); // float
1967 m_ntuplePtr->Branch(NAME2("pedFit",f_suf), m_arrays->m_pedFit[ir], NAME3("pedFit",f_suf,"[4][64][48]/F")); // float
1968 m_ntuplePtr->Branch(NAME2("chi2Fit",f_suf), m_arrays->m_chi2Fit[ir], NAME3("chi2Fit",f_suf,"[4][64][48]/F")); // float
1969 }
1970
1971 if (!m_fitcRawChannelContainerKey.empty()) {
1972 m_ntuplePtr->Branch(NAME2("eFitc",f_suf), m_arrays->m_eFitc[ir], NAME3("eFitc",f_suf,"[4][64][48]/F")); // float
1973 m_ntuplePtr->Branch(NAME2("tFitc",f_suf), m_arrays->m_tFitc[ir], NAME3("tFitc",f_suf,"[4][64][48]/F")); // float
1974 m_ntuplePtr->Branch(NAME2("pedFitc",f_suf), m_arrays->m_pedFitc[ir], NAME3("pedFitc",f_suf,"[4][64][48]/F")); // float
1975 m_ntuplePtr->Branch(NAME2("chi2Fitc",f_suf),m_arrays->m_chi2Fitc[ir],NAME3("chi2Fitc",f_suf,"[4][64][48]/F")); // float
1976 }
1977
1978 if (!m_optRawChannelContainerKey.empty()) {
1979 m_ntuplePtr->Branch(NAME2("eOpt",f_suf), m_arrays->m_eOpt[ir], NAME3("eOpt",f_suf,"[4][64][48]/F")); // float
1980 m_ntuplePtr->Branch(NAME2("tOpt",f_suf), m_arrays->m_tOpt[ir], NAME3("tOpt",f_suf,"[4][64][48]/F")); // float
1981 m_ntuplePtr->Branch(NAME2("pedOpt",f_suf), m_arrays->m_pedOpt[ir], NAME3("pedOpt",f_suf,"[4][64][48]/F")); // float
1982 m_ntuplePtr->Branch(NAME2("chi2Opt",f_suf), m_arrays->m_chi2Opt[ir], NAME3("chi2Opt",f_suf,"[4][64][48]/F")); // float
1983 }
1984
1985 if (!m_qieRawChannelContainerKey.empty()) {
1986 m_ntuplePtr->Branch(NAME2("eQIE",f_suf), m_arrays->m_eQIE[ir], NAME3("eQIE",f_suf,"[4][64][48]/F")); // float
1987 m_ntuplePtr->Branch(NAME2("tQIE",f_suf), m_arrays->m_tQIE[ir], NAME3("tQIE",f_suf,"[4][64][48]/F")); // float
1988 m_ntuplePtr->Branch(NAME2("pedQIE",f_suf), m_arrays->m_pedQIE[ir], NAME3("pedQIE",f_suf,"[4][64][48]/F")); // float
1989 m_ntuplePtr->Branch(NAME2("chi2QIE",f_suf), m_arrays->m_chi2QIE[ir], NAME3("chi2QIE",f_suf,"[4][64][48]/F")); // float
1990 }
1991
1992 if (!m_of1RawChannelContainerKey.empty()) {
1993 m_ntuplePtr->Branch(NAME2("eOF1",f_suf), m_arrays->m_eOF1[ir], NAME3("eOF1",f_suf,"[4][64][48]/F")); // float
1994 m_ntuplePtr->Branch(NAME2("tOF1",f_suf), m_arrays->m_tOF1[ir], NAME3("tOF1",f_suf,"[4][64][48]/F")); // float
1995 m_ntuplePtr->Branch(NAME2("pedOF1",f_suf), m_arrays->m_pedOF1[ir], NAME3("pedOF1",f_suf,"[4][64][48]/F")); // float
1996 m_ntuplePtr->Branch(NAME2("chi2OF1",f_suf), m_arrays->m_chi2OF1[ir], NAME3("chi2OF1",f_suf,"[4][64][48]/F")); // float
1997 }
1998
1999 if (!m_dspRawChannelContainerKey.empty() && !m_reduced) {
2000 m_ntuplePtr->Branch(NAME2("eDsp",f_suf), m_arrays->m_eDsp[ir], NAME3("eDsp",f_suf,"[4][64][48]/F")); // float
2001 m_ntuplePtr->Branch(NAME2("tDsp",f_suf), m_arrays->m_tDsp[ir], NAME3("tDsp",f_suf,"[4][64][48]/F")); // float
2002 m_ntuplePtr->Branch(NAME2("pedDsp",f_suf), m_arrays->m_pedDsp[ir], NAME3("pedDsp",f_suf,"[4][64][48]/F")); // float
2003 m_ntuplePtr->Branch(NAME2("chi2Dsp",f_suf), m_arrays->m_chi2Dsp[ir], NAME3("chi2Dsp",f_suf,"[4][64][48]/F")); // float
2004 }
2005
2006 if (!m_wienerRawChannelContainerKey.empty()) {
2007 m_ntuplePtr->Branch(NAME2("eWiener",f_suf), m_arrays->m_eWiener[ir], NAME3("eWiener",f_suf,"[4][64][48]/F")); // float
2008 m_ntuplePtr->Branch(NAME2("tWiener",f_suf), m_arrays->m_tWiener[ir], NAME3("tWiener",f_suf,"[4][64][48]/F")); // float
2009 m_ntuplePtr->Branch(NAME2("pedWiener",f_suf), m_arrays->m_pedWiener[ir], NAME3("pedWiener",f_suf,"[4][64][48]/F")); // float
2010 m_ntuplePtr->Branch(NAME2("chi2Wiener",f_suf), m_arrays->m_chi2Wiener[ir], NAME3("chi2Wiener",f_suf,"[4][64][48]/F")); // float
2011 }
2012
2013 if (!m_mfRawChannelContainerKey.empty()) {
2014 std::string f_samples = "[4][64][48][" + std::to_string(m_nSamples) + "]/F";
2015 m_ntuplePtr->Branch(NAME2("eMF",f_suf), &(m_arrays->m_eMF[is]), NAME3("eMF",f_suf,f_samples)); // float
2016 m_ntuplePtr->Branch(NAME2("tMF",f_suf), &(m_arrays->m_tMF[is]), NAME3("tMF",f_suf,f_samples)); // float
2017 m_ntuplePtr->Branch(NAME2("chi2MF",f_suf), m_arrays->m_chi2MF[ir], NAME3("chi2MF",f_suf,"[4][64][48]/F")); // float
2018 m_ntuplePtr->Branch(NAME2("pedMF",f_suf), m_arrays->m_pedMF[ir], NAME3("pedMF",f_suf,"[4][64][48]/F")); // float
2019 }
2020
2021 if (m_bsInput) {
2022 if (i == imin) { // common for low and high gain
2023 m_ntuplePtr->Branch("ROD_GlobalCRC", m_arrays->m_ROD_GlobalCRC, "ROD_GlobalCRC[4][64]/S"); // short
2024 m_ntuplePtr->Branch("ROD_BCID", m_arrays->m_ROD_BCID, "ROD_BCID[4][64]/S"); // short
2025 m_ntuplePtr->Branch("ROD_DMUBCIDErr", m_arrays->m_ROD_DMUBCIDErr, "ROD_DMUBCIDErr[4][64][16]/S"); // short
2026 m_ntuplePtr->Branch("ROD_DMUmemoryErr", m_arrays->m_ROD_DMUmemoryErr, "ROD_DMUmemoryErr[4][64][16]/S"); // short
2027 m_ntuplePtr->Branch("ROD_DMUSstrobeErr", m_arrays->m_ROD_DMUSstrobeErr, "ROD_DMUSstrobeErr[4][64][16]/S"); // short
2028 m_ntuplePtr->Branch("ROD_DMUDstrobeErr", m_arrays->m_ROD_DMUDstrobeErr, "ROD_DMUDstrobeErr[4][64][16]/S"); // short
2029 m_ntuplePtr->Branch("ROD_DMUheadformatErr",m_arrays->m_ROD_DMUHeadformatErr, "ROD_DMUheadformatErr[4][64][16]/S"); // short
2030 m_ntuplePtr->Branch("ROD_DMUheadparityErr",m_arrays->m_ROD_DMUHeadparityErr, "ROD_DMUheadparityErr[4][64][16]/S"); // short
2031 m_ntuplePtr->Branch("ROD_DMUdataformatErr",m_arrays->m_ROD_DMUDataformatErr, "ROD_DMUdataformatErr[4][64][16]/S"); // short
2032 m_ntuplePtr->Branch("ROD_DMUdataparityErr",m_arrays->m_ROD_DMUDataparityErr, "ROD_DMUdataparityErr[4][64][16]/S"); // short
2033
2034 m_ntuplePtr->Branch("ROD_feCRC", m_arrays->m_ROD_DMUfeCRC, "ROD_feCRC[4][64][16]/S"); // short
2035 m_ntuplePtr->Branch("ROD_rodCRC", m_arrays->m_ROD_DMUrodCRC, "ROD_rodCRC[4][64][16]/S"); // short
2036 m_ntuplePtr->Branch("ROD_DMUmask", m_arrays->m_ROD_DMUMask, "ROD_DMUmask[4][64][2]/s"); // unsigned short
2037 }
2038 }
2039 ir += N_ROS;
2040 is += sample_size;
2041 }
2042}
2043
2048 */
2050 unsigned int size = (m_calibMode) ? 1 : 2;
2051
2052 if (m_compareMode) {
2062 }
2063
2064 CLEAR3(m_arrays->m_gain, size);
2065
2066 if (!m_fltDigitsContainerKey.empty()) {
2067 CLEAR5(m_arrays->m_sampleFlt, size);
2068 CLEAR3(m_arrays->m_gainFlt, size);
2069 }
2070
2071 if (!m_digitsContainerKey.empty()) {
2072
2073 CLEAR5(m_arrays->m_sample,size);
2074
2075 if (m_bsInput) {
2076 CLEAR2(m_arrays->m_DMUheader, size);
2077 CLEAR3(m_arrays->m_DMUbcid, size);
2078 CLEAR3(m_arrays->m_DMUformatErr, size);
2079 CLEAR3(m_arrays->m_DMUparityErr, size);
2080 CLEAR3(m_arrays->m_DMUmemoryErr, size);
2081 CLEAR3(m_arrays->m_DMUSstrobeErr, size);
2082 CLEAR3(m_arrays->m_DMUDstrobeErr, size);
2083
2084 CLEAR3(m_arrays->m_feCRC, size);
2085 CLEAR3(m_arrays->m_rodCRC, size);
2086
2087 CLEAR1(m_arrays->m_rodBCID);
2088 CLEAR1(m_arrays->m_fragSize);
2089 CLEAR(m_arrays->m_dmuMask);
2090 CLEAR(m_arrays->m_slinkCRC);
2091 }
2092
2093 }
2094
2095 if (!m_rawChannelContainerKey.empty()) {
2096 CLEAR2(m_arrays->m_ene, size);
2097 CLEAR2(m_arrays->m_time, size);
2098 CLEAR2(m_arrays->m_ped, size);
2099 CLEAR2(m_arrays->m_chi2, size);
2100 }
2101
2102 if (!m_fitRawChannelContainerKey.empty()) {
2103 CLEAR2(m_arrays->m_eFit, size);
2104 CLEAR2(m_arrays->m_tFit, size);
2105 CLEAR2(m_arrays->m_pedFit, size);
2106 CLEAR2(m_arrays->m_chi2Fit, size);
2107 }
2108
2109 if (!m_fitcRawChannelContainerKey.empty()) {
2110 CLEAR2(m_arrays->m_eFitc, size);
2111 CLEAR2(m_arrays->m_tFitc, size);
2112 CLEAR2(m_arrays->m_pedFitc, size);
2113 CLEAR2(m_arrays->m_chi2Fitc, size);
2114 }
2115
2116 if (!m_optRawChannelContainerKey.empty()) {
2117 CLEAR2(m_arrays->m_eOpt, size);
2118 CLEAR2(m_arrays->m_tOpt, size);
2119 CLEAR2(m_arrays->m_pedOpt, size);
2120 CLEAR2(m_arrays->m_chi2Opt, size);
2121 }
2122
2123
2124 if (!m_qieRawChannelContainerKey.empty()) {
2125 CLEAR2(m_arrays->m_eQIE, size);
2126 CLEAR2(m_arrays->m_tQIE, size);
2127 CLEAR2(m_arrays->m_pedQIE, size);
2128 CLEAR2(m_arrays->m_chi2QIE, size);
2129 }
2130
2131 if (!m_of1RawChannelContainerKey.empty()) {
2132 CLEAR2(m_arrays->m_eOF1, size);
2133 CLEAR2(m_arrays->m_tOF1, size);
2134 CLEAR2(m_arrays->m_pedOF1, size);
2135 CLEAR2(m_arrays->m_chi2OF1, size);
2136 }
2137
2138 if (!m_dspRawChannelContainerKey.empty()) {
2139 CLEAR2(m_arrays->m_eDsp, size);
2140 CLEAR2(m_arrays->m_tDsp, size);
2141 CLEAR2(m_arrays->m_pedDsp, size);
2142 CLEAR2(m_arrays->m_chi2Dsp, size);
2143 }
2144
2145 if (!m_mfRawChannelContainerKey.empty()) {
2146 CLEAR4(m_arrays->m_eMF, size);
2147 CLEAR4(m_arrays->m_tMF, size);
2148 CLEAR2(m_arrays->m_chi2MF, size);
2149 CLEAR2(m_arrays->m_pedMF, size);
2150 }
2151
2152 if (!m_wienerRawChannelContainerKey.empty()) {
2153 CLEAR2(m_arrays->m_eWiener, size);
2154 CLEAR2(m_arrays->m_tWiener, size);
2155 CLEAR2(m_arrays->m_pedWiener, size);
2156 CLEAR2(m_arrays->m_chi2Wiener, size);
2157 }
2158
2159 if (m_bsInput) {
2160 CLEAR1(m_arrays->m_ROD_GlobalCRC);
2161 CLEAR1(m_arrays->m_ROD_BCID);
2162 CLEAR1(m_arrays->m_ROD_DMUBCIDErr);
2163 CLEAR1(m_arrays->m_ROD_DMUmemoryErr);
2164 CLEAR1(m_arrays->m_ROD_DMUSstrobeErr);
2165 CLEAR1(m_arrays->m_ROD_DMUDstrobeErr);
2166 CLEAR1(m_arrays->m_ROD_DMUHeadformatErr);
2167 CLEAR1(m_arrays->m_ROD_DMUHeadparityErr);
2168 CLEAR1(m_arrays->m_ROD_DMUDataformatErr);
2169 CLEAR1(m_arrays->m_ROD_DMUDataparityErr);
2170 CLEAR1(m_arrays->m_ROD_DMUfeCRC);
2171 CLEAR1(m_arrays->m_ROD_DMUrodCRC);
2172 CLEAR(m_arrays->m_ROD_DMUMask);
2173 }
2174
2175}
2176
2177/*//////////////////////////////////////////////////////////////////////////////
2178 // TMDB variables
2180 */
2181
2183{
2184
2185 if (!m_tileMuRcvRawChannelContainerKey.empty()) {
2186 m_ntuplePtr->Branch("eTMDB", m_arrays->m_eTMDB, "eTMDB[4][64][8]/F"); // float m_arrays->m_eTMDB[N_ROS][N_MODULES][N_TMDBCHANS]
2187 }
2188
2189 if (!m_tileMuRcvDigitsContainerKey.empty()) {
2190 m_ntuplePtr->Branch("sampleTMDB", &(m_arrays->m_sampleTMDB[0]), NAME3("sampleTMDB[4][64][8][",std::to_string(m_nSamples),"]/b")); // unsigned char m_arrays->m_sampleTMDB[N_ROS][N_MODULES][N_TMDBCHANS][N_SAMPLES]
2191 }
2192
2193 if (!m_tileMuRcvContainerKey.empty()) {
2194 m_ntuplePtr->Branch("decisionTMDB", m_arrays->m_decisionTMDB, "decisionTMDB[4][64][4]/b"); // unsigned char m_arrays->m_decisionTMDB[N_ROS][N_MODULES][N_TMDBDECISIONS]
2195 }
2196
2197 if (!m_tileMuRcvContainerKey.empty()) {
2198 m_ntuplePtr->Branch("bcidTMDB", m_arrays->m_bcidTMDB, "bcidTMDB[4][64][3]/b"); // unsigned char m_arrays->m_bcidTMDB[N_ROS][N_MODULES][N_TMDBBCIDWORDS]
2199 }
2200
2201}
2202
2204{
2205 if (!m_tileMuRcvRawChannelContainerKey.empty()) CLEAR(m_arrays->m_eTMDB);
2206 if (!m_tileMuRcvDigitsContainerKey.empty()) CLEAR6(m_arrays->m_sampleTMDB);
2207 if (!m_tileMuRcvContainerKey.empty()) CLEAR(m_arrays->m_decisionTMDB);
2208 if (!m_tileMuRcvContainerKey.empty()) CLEAR(m_arrays->m_bcidTMDB);
2209}
2210
2211/*/////////////////////////////////////////////////////////////////////////////
2212 // DCS variables
2214 */
2215
2217 bool br[9];
2218 int mask = m_DCSBranches;
2219
2220 for (int i = 0; i < 9; ++i) {
2221 br[i] = (mask % 10);
2222 mask /= 10;
2223 }
2224
2225 if (br[0]) {
2226 m_DCSntuplePtr->Branch("EvTime", &m_evTime, "EvTime/I");
2227 m_DCSntuplePtr->Branch("Run", &m_run, "Run/I");
2228 m_DCSntuplePtr->Branch("LumiBlock",&m_lumiBlock,"LumiBlock/I");
2229 m_DCSntuplePtr->Branch("HHMMSS", &m_HHMMSS, "HHMMSS/I");
2230 m_DCSntuplePtr->Branch("Evt", &m_evt, "Evt/I");
2231 m_DCSntuplePtr->Branch("EvtNr", &m_evtNr, "EvtNr/I");
2232 }
2233
2234 if (br[1]) m_DCSntuplePtr->Branch("TEMP", m_arrays->m_TEMP, "TEMP[4][64][7]/F");
2235 if (br[2]) m_DCSntuplePtr->Branch("HV", m_arrays->m_HV, "HV[4][64][48]/F");
2236 if (br[3]) m_DCSntuplePtr->Branch("HVSET", m_arrays->m_HVSET, "HVSET[4][64][48]/F");
2237 if (br[4]) m_DCSntuplePtr->Branch("DRSTATES",m_arrays->m_DRSTATES,"DRSTATES[4][64]/I");
2238 if (br[5]) m_DCSntuplePtr->Branch("HVSTATUS",m_arrays->m_HVSTATUS,"HVSTATUS[4][64][48]/S");
2239 if (br[6]) m_DCSntuplePtr->Branch("DRSTATUS",m_arrays->m_DRSTATUS,"DRSTATUS[4][64]/S");
2240 if (br[7]) m_DCSntuplePtr->Branch("CHSTATUS",m_arrays->m_CHSTATUS,"CHSTATUS[4][64][48]/S");
2241 if (br[8]) {
2242 m_DCSntuplePtr->Branch("nBadDr", &m_nBadDr, "nBadDr/I");
2243 m_DCSntuplePtr->Branch("nBadHV", &m_nBadHV, "nBadHV/I");
2244 m_DCSntuplePtr->Branch("nBadDCS", &m_nBadDCS, "nBadDCS/I");
2245 m_DCSntuplePtr->Branch("nBadDB", &m_nBadDB, "nBadDB/I");
2246 m_DCSntuplePtr->Branch("nBadTotal", &m_nBadTotal, "nBadTotal/I");
2247 }
2248}
2249
2251
2252 ATH_MSG_DEBUG( "Filling DCS ntuple:"
2253 <<" evtCnt=" << m_evtNr
2254 << " evt=" << m_evt
2255 << " lumi=" << m_lumiBlock << " " << m_dateTime );
2256
2257 CLEAR(m_arrays->m_TEMP);
2258 CLEAR(m_arrays->m_HV);
2259 CLEAR(m_arrays->m_HVSET);
2260 CLEAR(m_arrays->m_DRSTATES);
2261 CLEAR(m_arrays->m_HVSTATUS);
2262 CLEAR(m_arrays->m_DRSTATUS);
2263 CLEAR(m_arrays->m_CHSTATUS);
2264
2265 m_nBadDr = 0;
2266 m_nBadHV = 0;
2267 m_nBadDCS = 0;
2268 m_nBadDB = 0;
2269 m_nBadTotal = 0;
2270 for (int ROS = 1; ROS < 5; ++ROS) {
2271 int rosI = ROS - 1;
2272
2273 for (int drawer = 0; drawer < 64; ++drawer) {
2274 m_arrays->m_DRSTATES[rosI][drawer] = m_tileDCS->getDrawerStates(ROS, drawer);
2275 m_arrays->m_DRSTATUS[rosI][drawer] = m_tileDCS->getDCSStatus(ROS, drawer);
2276 bool drbad = m_tileDCS->isStatusBad(ROS, drawer);
2277
2278 if (drbad) {
2279 ++m_nBadDr;
2280 }
2281
2282 if (msgLvl(MSG::VERBOSE) || m_arrays->m_DRSTATUS[rosI][drawer] != TileDCSState::OK_DRAWER) {
2283 ATH_MSG_VERBOSE( "Module=" << TileCalibUtils::getDrawerString(ROS, drawer)
2284 << " DRSTATES=" << m_arrays->m_DRSTATES[rosI][drawer]
2285 << " DRSTATUS=" << m_arrays->m_DRSTATUS[rosI][drawer]
2286 << " => " << ((drbad) ? "bad" : "good") );
2287 }
2288
2289 unsigned int drawerIdx = TileCalibUtils::getDrawerIdx(ROS,drawer);
2290 for (int channel=0; channel<48; ++channel){
2291 TileBchStatus chStat = m_tileBadChanTool->getChannelStatus(drawerIdx,channel);
2292 m_arrays->m_HV[rosI][drawer][channel] = m_tileDCS->getChannelHV(ROS, drawer, channel);
2293 m_arrays->m_HVSET[rosI][drawer][channel] = m_tileDCS->getChannelHVSet(ROS, drawer, channel);
2294 m_arrays->m_HVSTATUS[rosI][drawer][channel] = m_tileDCS->getDCSHVStatus(ROS, drawer, channel);
2295 m_arrays->m_CHSTATUS[rosI][drawer][channel] = m_tileDCS->getDCSStatus(ROS, drawer, channel)
2296 + 100 * m_tileBadChanTool->encodeStatus(chStat);
2297 bool chbad = m_tileDCS->isStatusBad(ROS, drawer, channel);
2298
2299 if (chbad || chStat.isBad()) {
2300 ++m_nBadTotal;
2301 if (chbad) ++m_nBadDCS;
2302 if (chStat.isBad()) ++m_nBadDB;
2303 }
2304
2305 if (m_tileDCS->isStatusHVBad(ROS, drawer, channel)) {
2306 ++m_nBadHV;
2307 }
2308
2309 if (msgLvl(MSG::VERBOSE) || (chbad && !drbad)) {
2310 int pmt=abs(m_cabling->channel2hole(ROS,channel));
2311 ATH_MSG_VERBOSE( "Module=" << TileCalibUtils::getDrawerString(ROS, drawer)
2312 << " channel=" << channel << " pmt=" << pmt
2313 << " HV=" << m_arrays->m_HV[rosI][drawer][channel]
2314 << " HVSET=" << m_arrays->m_HVSET[rosI][drawer][channel]
2315 << " HVSTATUS=" << m_arrays->m_HVSTATUS[rosI][drawer][channel]
2316 << " CHSTATUS=" << m_arrays->m_CHSTATUS[rosI][drawer][channel]
2317 << " => " << ((chbad) ? "bad" : "good") );
2318 }
2319 }
2320
2321 for (int ind=0; ind<7; ++ind){
2322 m_arrays->m_TEMP[rosI][drawer][ind] = m_tileDCS->getChannelHV(ROS, drawer, ind+48);
2323 ATH_MSG_VERBOSE( "Module=" << TileCalibUtils::getDrawerString(ROS, drawer)
2324 << " TEMP" << ind+1 << "=" << m_arrays->m_TEMP[rosI][drawer][ind] );
2325
2326 }
2327 }
2328 }
2329
2330 ATH_MSG_DEBUG( "BAD status in DCS: nBadDr=" << m_nBadDr
2331 << " nBadHV=" << m_nBadHV
2332 << " nBadDCS=" << m_nBadDCS
2333 << " nBadDB=" << m_nBadDB
2334 << " nBadTotal=" << m_nBadTotal );
2335
2336 m_DCSntuplePtr->Fill();
2337
2338
2339 return StatusCode::SUCCESS;
2340}
Scalar eta() const
pseudorapidity method
Scalar phi() const
phi method
#define endmsg
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x)
#define ATH_MSG_INFO(x)
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_WARNING(x)
#define ATH_MSG_DEBUG(x)
Helpers for checking error return status codes and reporting errors.
static Double_t ss
static Double_t rc
Property holding a SG store/key/clid from which a ReadHandle is made.
size_t size() const
Number of registered mappings.
#define CLEAR5(array, size)
#define CLEAR6(array)
#define CLEAR4(array, size)
#define sample_ind_TMDB(r, m, c, i)
#define CLEAR2(array, size)
#define CLEAR(array)
#define CLEAR1(array)
#define sample_ind(r, m, c, i)
#define NAME3(s1, s2, s3)
#define CLEAR3(array, size)
#define NAME2(s1, s2)
#define N_CISPAR
#define N_ROS
Filename : TileAANtuple.h Author : Alexander Solodkov (based on TileTBAANtuple) Created : April,...
#define N_MODULES
#define N_ROS2
#define N_DMUS
#define N_RODS
#define N_CHANS
#define N_TMDBDECISIONS
#define N_TMDBCHANS
TileContainer< TileMuonReceiverObj > TileMuonReceiverContainer
TileContainer< TileL2 > TileL2Container
int imax(int i, int j)
#define LASER_OBJ_FRAG
Definition TileTBFrag.h:49
#define DIGI_PAR_FRAG
Definition TileTBFrag.h:41
static const Attributes_t empty
AthAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Constructor with parameters:
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
const ServiceHandle< StoreGateSvc > & detStore() const
bool msgLvl(const MSG::Level lvl) const
This class groups all DetDescr information related to a CaloCell.
Identifier identify() const override final
cell identifier
IdentifierHash onl2() const
cell online identifier 2
IdentifierHash onl1() const
cell online identifier 1
DataModel_detail::const_iterator< DataVector > const_iterator
Standard const_iterator.
Definition DataVector.h:838
const_iterator end() const noexcept
const_iterator begin() const noexcept
This is a "hash" representation of an Identifier.
CaloDetDescrElement * get_element(const Identifier &elementId) const
Property holding a SG store/key/clid from which a ReadHandle is made.
const std::string & key() const
Return the StoreGate ID for the referenced object.
bool empty() const
Test if the key is blank.
int m_l1ID[N_RODS]
Level1 ID from ROD header.
float m_sumEt_yy[N_DRAWERS]
Sum Et calcualted inside DSP.
StatusCode storeTMDBDigits(const EventContext &ctx)
float m_sumEt_zz[N_DRAWERS]
Sum Et recalculated offline using offline OF.
StatusCode execute(const EventContext &ctx)
Execute method.
bool m_pmtOrder
change channel ordering to pmt ordering in ntuple
StatusCode storeRawChannels(const EventContext &ctx, const SG::ReadHandleKey< TileRawChannelContainer > &containerKey, float ene[N_ROS2][N_MODULES][N_CHANS], float time[N_ROS2][N_MODULES][N_CHANS], float chi2[N_ROS2][N_MODULES][N_CHANS], float ped[N_ROS2][N_MODULES][N_CHANS], bool fillAll)
/ Fill ntuple with data from TRC.
StatusCode storeBeamElements(const TileDQstatus &DQstatus)
StatusCode finalize()
ServiceHandle< TileCablingSvc > m_cablingSvc
Name of Tile cabling service.
void TRIGGER_addBranch(void)
//////////////////////////////////////////////////////////////////////////// /Add TRIGGER variables t...
SG::ReadHandleKey< TileBeamElemContainer > m_beamElemContainerKey
bool m_calibMode
If data should be put in calib mode.
int m_finalUnit
calibrate everything to this level
virtual ~TileAANtuple()
void DIGI_addBranch(void)
//////////////////////////////////////////////////////////////////////////// /Add Tree DIGI variables...
SG::ReadHandleKey< TileLaserObject > m_laserObjectKey
bool m_useDspUnits
true if energy should be converted to units used in DSP
std::unique_ptr< Arrays > m_arrays
StatusCode initNTuple(const EventContext &ctx)
StatusCode storeTMDBRawChannel(const EventContext &ctxx)
uint32_t m_cispar[N_CISPAR]
StatusCode storeLaser(const EventContext &ctx)
float m_sumE_xx[N_DRAWERS]
Sum E recalculated offline using DSP raw channels.
float m_las_MeasAmp
ToolHandle< ITileDCSTool > m_tileDCS
float m_sumEz_xx[N_DRAWERS]
Sum Ez recalculated offline using DSP raw channels.
float m_sumEz_yy[N_DRAWERS]
Sum Ez calcualted inside DSP.
void DCS_addBranch(void)
StatusCode initialize()
Alg standard interface function.
TileRawChannelUnit::UNIT m_rchUnit
Unit for TileRawChannels (ADC, pCb, MeV).
SG::ReadHandleKey< TileDigitsContainer > m_tileMuRcvDigitsContainerKey
StatusCode storeMFRawChannels(const EventContext &ctx, const SG::ReadHandleKey< TileRawChannelContainer > &containerKey, float *ene, float *time, float chi2[N_ROS2][N_MODULES][N_CHANS], float ped[N_ROS2][N_MODULES][N_CHANS], bool fillAll)
void LASER_clearBranch(void)
//////////////////////////////////////////////////////////////////////////// Clear Tree LASER variabl...
int m_run
run number
SG::ReadHandleKey< TileL2Container > m_l2CntKey
void CISPAR_addBranch(void)
//////////////////////////////////////////////////////////////////////////// /Add Tree CISPAR variabl...
ServiceHandle< IFileMgr > m_fileMgr
bool m_bad[N_ROS][N_MODULES][N_CHANS]
TileRawChannelUnit::UNIT m_dspUnit
Unit for TileRawChannels in DSP.
void TMDB_addBranch(void)
const TileID * m_tileID
SG::ReadHandleKey< TileDQstatus > m_DQstatusKey
SG::ReadHandleKey< TileRawChannelContainer > m_of1RawChannelContainerKey
std::vector< uint32_t > m_ROBID
TTree * m_DCSntuplePtr
ToolHandle< TileCondToolEmscale > m_tileToolEmscale
main Tile Calibration tool
void fillCellMap(TTree *ntuplePtr)
///////////////////////////////////////////////////////////////////////////
int64_t m_treeSize
ServiceHandle< IROBDataProviderSvc > m_robSvc
bool m_compareMode
If two sets of data should be compared (e.g.
std::string m_streamName
float m_sumEt_xx[N_DRAWERS]
Sum Et recalculated offline using DSP raw channels.
int digiChannel2PMT(int fragType, int chan)
StatusCode storeDigits(const EventContext &ctx, const SG::ReadHandleKey< TileDigitsContainer > &containerKey, short *sample, short gain[N_ROS2][N_MODULES][N_CHANS], bool fillAll)
/ Fill Ntuple with info from TileDigits / Return true if the collection is empty
TTree * m_ntuplePtr
SG::ReadHandleKey< TileRawChannelContainer > m_dspRawChannelContainerKey
int m_evt
event number in a run
void TMDB_clearBranch(void)
SG::ReadHandleKey< TileDigitsContainer > m_fltDigitsContainerKey
StatusCode storeTMDBDecision(const EventContext &ctx)
int m_nSamples
number of samples
ToolHandle< TileL2Builder > m_l2Builder
ServiceHandle< ITHistSvc > m_thistSvc
TileAANtuple(const std::string &name, ISvcLocator *pSvcLocator)
SG::ReadHandleKey< TileRawChannelContainer > m_wienerRawChannelContainerKey
int m_evtNr
event counter
short CheckDMUFormat(uint32_t header)
bit_31 of the DMU header must be 1 and bit_17 of the DMU header must be 0
short CheckDMUParity(uint32_t header)
Parity of the DMU header should be odd.
SG::ReadHandleKey< TileRawChannelContainer > m_qieRawChannelContainerKey
int m_l1Type[N_RODS]
Level1 Type from ROD header.
int m_evTime
event time
float m_sumEz_zz[N_DRAWERS]
Sum Ez recalculated offline using offline OF.
bool m_calibrateEnergy
convert energy to new units or use amplitude from RawChannel directly
int m_lumiBlock
lumiblock number in a run
StatusCode storeDCS()
SG::ReadHandleKey< TileDigitsContainer > m_digitsContainerKey
uint32_t m_dspFlags
DSP flags from BS.
int m_trigType
trigger type (1=Phys, 2=Laser, 4=Ped, 8=CIS)
void CISPAR_clearBranch(void)
//////////////////////////////////////////////////////////////////////////// Clear Tree CISPAR variab...
SG::ReadHandleKey< TileRawChannelContainer > m_fitcRawChannelContainerKey
bool m_checkDCS
if false, do not use TileDCS at all
void DIGI_clearBranch(void)
//////////////////////////////////////////////////////////////////////////// /Clear Tree DIGI variabl...
float m_sumE_zz[N_DRAWERS]
Sum E recalculated offline using offline OF.
void LASER_addBranch(void)
//////////////////////////////////////////////////////////////////////////// /Add Tree LASER variable...
int m_HHMMSS
event time in HH:MM:SS
SG::ReadHandleKey< TileRawChannelContainer > m_rawChannelContainerKey
SG::ReadCondHandleKey< TileHid2RESrcID > m_hid2RESrcIDKey
float m_sumE_yy[N_DRAWERS]
Sum E calcualted inside DSP.
const TileCablingService * m_cabling
cabling tool
SG::ReadHandleKey< TileRawChannelContainer > m_fitRawChannelContainerKey
bool m_bsInput
true if bytestream file is used
SG::ReadHandleKey< TileRawChannelContainer > m_mfRawChannelContainerKey
void TRIGGER_clearBranch(void)
//////////////////////////////////////////////////////////////////////////// Clear Tree TRIGGER varia...
SG::ReadHandleKey< TileMuonReceiverContainer > m_tileMuRcvContainerKey
int m_evType[N_RODS]
Event Type from ROD header.
SG::ReadHandleKey< TileRawChannelContainer > m_optRawChannelContainerKey
SG::ReadHandleKey< TileRawChannelContainer > m_tileMuRcvRawChannelContainerKey
int m_DCSBranches
mask like 110101 - which DCS branches to fill
ToolHandle< ITileBadChanTool > m_tileBadChanTool
Tile Bad Channel tool.
const TileDetDescrManager * m_tileMgr
Pointer to TileDetDescrManager.
std::string m_ntupleID
int m_evBCID[N_RODS]
Event BCID from ROD header.
char m_dateTime[32]
event date and time
StatusCode ntuple_clear()
const TileHWID * m_tileHWID
float m_las_Temperature
StatusCode ntuple_initialize(const EventContext &ctx, const TileDQstatus &DQstatus)
Class holding bad channel problems.
bool isBad() const
static const TileCablingService * getInstance()
get pointer to service instance
static std::string getDrawerString(unsigned int ros, unsigned int drawer)
Return the drawer name, e.g.
static unsigned int getDrawerIdxFromFragId(unsigned int fragId)
Returns a drawer hash from fragId This function assumes drawer context (i.e.
static unsigned int getDrawerIdx(unsigned int ros, unsigned int drawer)
Returns a drawer hash.
Class that holds Data Quality fragment information and provides functions to extract the data quality...
uint32_t calibMode() const
Calibration mode.
const uint32_t * cispar() const
CIS parameters.
calo_element_vec::const_iterator calo_element_const_iterator
@ NOT_VALID_HASH
Definition TileHWID.h:314
int getFiltNumber() const
double getSigmaPedAlpha(const unsigned int i, const unsigned int gain=0) const
double getSigmaAlpha(const unsigned int i, const unsigned int gain=0) const
double getPedestalAlpha(const unsigned int i, const unsigned int gain=0) const
double getMean(int chan, int gain, int type) const
double getPumpDiodeTemp() const
int getPMADC(const unsigned int j, const unsigned int gain=0) const
int getDaqType() const
double getPMSigmaPedestal(const unsigned int j, const unsigned int gain=0) const
double getAlpha(const unsigned int i, const unsigned int gain=0) const
double getDiodeCurrOrd() const
int getDiodeADC(const unsigned int i, const unsigned int gain=0) const
bool getQDCTimeout() const
bool isLASERII() const
double getDiodeSigmaPedestal(const unsigned int i, const unsigned int gain=0) const
int getBCID() const
double getDiodePedestal(const unsigned int i, const unsigned int gain=0) const
bool isSet(int chan, int gain, int type) const
int getVersion() const
int getTDC(const unsigned int j, const unsigned int gain=0) const
double getDiodeCurrMeas() const
bool getTDCTimeout() const
double getSigma(int chan, int gain, int type) const
double getPMPedestal(const unsigned int j, const unsigned int gain=0) const
float pedestal(void) const
float time(int ind=0) const
float quality(int ind=0) const
float amplitude(int ind=0) const
uint32_t get_bsflags() const
Identifier cell_ID_index(int &index, int &pmt) const
HWIdentifier adc_HWID(void) const
Definition TileRawData.h:53
double chi2(TH1 *h0, TH1 *h1)
int ir
counter of the current depth
Definition fastadd.cxx:49
std::vector< std::string > files
file names and file pointers
Definition hcg.cxx:52
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())
Definition index.py:1
STL namespace.
TFile * file