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