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