ATLAS Offline Software
TBByteStreamCnvTool.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 #include "GaudiKernel/MsgStream.h"
7 #include "Gaudi/Property.h"
9 
10 #include "eformat/Status.h"
11 
12 #include "GaudiKernel/TypeNameString.h"
13 
18 #include "GaudiKernel/ThreadLocalContext.h"
19 
20 #include <list>
21 
22 #include <iostream>
23 #include <fstream>
24 #include <sstream>
25 #include <string>
26 
27 const eformat::SubDetector TBByteStreamCnvTool::m_DontCheckRodSubDetID=(eformat::SubDetector)0xff;
28 
29 
30 const InterfaceID& TBByteStreamCnvTool::interfaceID( )
31 {
32  static const InterfaceID IID_ITBByteStreamCnvTool
33  ("TBByteStreamCnvTool", 1, 0);
34  return IID_ITBByteStreamCnvTool;
35 }
36 
37 // default contructor
38 
40 ( const std::string& type, const std::string& name,const IInterface* parent )
42  m_ByteStreamEventAccess("ByteStreamCnvSvc", name),
43  m_rdpSvc("ROBDataProviderSvc", name),
44  m_lastEventID(0, UINT_MAX), m_subdet_id(eformat::TDAQ_BEAM_CRATE),
45  m_theRodBlock(0), m_theROB(0)
46 {
47  declareInterface< TBByteStreamCnvTool >( this );
48  m_tbtdc=0;
49  declareProperty("ForceHchoice",m_force_Hchoice=false);
50  declareProperty("Dump",m_dump=false);
51  declareProperty("isH6Run",m_H6run=true);
52  declareProperty("isH8Run",m_H8run=false);
53  declareProperty("Keys",m_keys);
54  declareProperty("SubDetID",m_subdet_key);
55  declareProperty("SummaryPath",m_summary_path);
56 
57 }
58 
61  if (sc!=StatusCode::SUCCESS)
62  return sc;
63  MsgStream logstr(msgSvc(), name());
64  logstr << MSG::DEBUG << "Initialize" << endmsg;
65 
66  const LArOnlineID* online_id;
67  sc = detStore()->retrieve(online_id, "LArOnlineID");
68  if (sc.isFailure()) {
69  logstr << MSG::FATAL << "Could not get LArOnlineID helper !" << endmsg;
70  return StatusCode::FAILURE;
71  }
72  else {
73  m_onlineHelper=online_id;
74  logstr << MSG::DEBUG << " Found the LArOnlineID helper. " << endmsg;
75  }
76 
77  ATH_CHECK( m_ByteStreamEventAccess.retrieve() );
78  ATH_CHECK( m_rdpSvc.retrieve() );
79 
80  std::vector<std::string>::const_iterator it = m_keys.begin();
81  std::vector<std::string>::const_iterator it_e = m_keys.end();
82  std::vector<std::string> keys;
83  keys.resize(24);
84  for(; it!=it_e;++it) {
85  const Gaudi::Utils::TypeNameString &item(*it);
86  const std::string &t = item.type();
87  const std::string &nm = item.name();
88  logstr << MSG::DEBUG << " type "<<t<<" name="<<nm<<endmsg;
89  if(t=="TBTDC") keys[0]=nm;
90  if(t=="TBTriggerPatternUnit") keys[1]=nm;
91  if(t=="TBTDCRawCont") keys[2]=nm;
92  if(t=="TBADCRawCont") keys[3]=nm;
93  if(t=="TBTailCatcherRaw") keys[4]=nm;
94  if(t=="TBBPCRawCont") keys[5]=nm;
95  if(t=="TBScintillatorRawCont") keys[6]=nm;
96  if(t=="TBMWPCRawCont") keys[7]=nm;
97  }
98  // Fixed name.
99  keys[10]="FREE";
100  keys[11]="LOW";
101  keys[12]="MEDIUM";
102  keys[13]="HIGH";
103  // name for Calib Digits
104  keys[20]="FREE";
105  keys[21]="LOW";
106  keys[22]="MEDIUM";
107  keys[23]="HIGH";
108 
109 
110  m_keys=std::move(keys);
111  m_subdet_id=(eformat::SubDetector)m_subdet_key;
112 
113  m_isCalib = false;
114 
115  m_febgain.clear();
116 
118 
119  return StatusCode::SUCCESS;
120 }
121 
123 {
124  return StatusCode::SUCCESS;
125 }
126 
127 /* ----------------------------------------------------------------------
128 
129  Write ByteStream Methods
130 
131 ------------------------------------------------------------------------*/
132 
134 {
138  MsgStream logstr(msgSvc(), name());
139  logstr << MSG::DEBUG << "WriteFragment" << endmsg;
140  //Check if Fragment is already written
141  const EventInfo* thisEventInfo;
142  StatusCode sc=evtStore()->retrieve(thisEventInfo);
143  if (sc!=StatusCode::SUCCESS)
144  {logstr << MSG::WARNING << "No EventInfo object found!" << endmsg;
145  return sc;
146  }
147  const EventID* thisEvent=thisEventInfo->event_ID();
148  if (m_lastEventID==*thisEvent)
149  {logstr << MSG::WARNING << "LArByteStrem persistency representation for Event #"<<thisEvent->event_number()
150  << " already created!" << endmsg;
151  return StatusCode::SUCCESS;
152  }
153  else //New event ID
154  m_lastEventID=*thisEvent;
155 
156  // Get the already existing part of the RawEvent
157  RawEventWrite* re = m_ByteStreamEventAccess->getRawEvent();
158 
159  // delete previous fragments
160  if (m_theRodBlock) delete m_theRodBlock;
161  if (m_theROB) delete m_theROB;
162 
163  //Make a new ROD-Fragment
164  m_theRodBlock=new std::vector<uint32_t>;
165 
167 
168  if (sc!=StatusCode::SUCCESS)
169  return sc;
170 
171  //Header elements for new Fragments
172  const uint8_t module_id=0;
173  const uint32_t lvl1_id=re->lvl1_id();
174  const uint32_t bc_id=0;
175  const uint32_t lvl1_type = 0;
176  const uint32_t detev_type=0;
177  const bool status_place=eformat::STATUS_BACK;
178  const uint32_t run_no=re->run_no();
179 
180  //Make a new ROB-Fragment...
181  eformat::helper::SourceIdentifier robsid(m_subdet_id, module_id);
183  (robsid.code(),run_no,lvl1_id,bc_id,lvl1_type,detev_type,m_theRodBlock->size(),
184  &(*m_theRodBlock)[0],status_place);
185 
186  re->append(m_theROB); //Append the newly created Subdetector-Fragment to the full event
187  logstr << MSG::DEBUG << "Appended TestBeam fragment to ByteStream" << endmsg;
188  return StatusCode::SUCCESS;
189 }
190 
191 StatusCode TBByteStreamCnvTool::BuildRODBlock(std::vector<uint32_t> *theRodBlock)
192 {
196  MsgStream logstr(msgSvc(), name());
197  //Get necessary Data objects
198  StatusCode sc;
199 
200  // TBTDCRaw part of the block :
201  const TBTDC* tbtdc = nullptr;
202  std::string tbtdc_Key("TBTDC");
203  sc=evtStore()->retrieve(tbtdc,tbtdc_Key);
204  if (sc!=StatusCode::SUCCESS)
205  {logstr << MSG::ERROR << "Can't retrieve TBTDC with key "<< tbtdc_Key << " from StoreGate" << endmsg;
206  return sc;
207  }
208  else {
209  theRodBlock->push_back(4); // TIME_SIZE
210  theRodBlock->push_back(0x03); // TIME_ID
211  theRodBlock->push_back(tbtdc->tdc());
212  theRodBlock->push_back(tbtdc->tdcmin());
213  }
214 
215 
216  // TBBPCRaw :
217 // TBBPCRawCont * bpcrawCont;
218 // sc = m_storeGate->retrieve(bpcrawCont, "BPCRawCont");
219 // if (sc.isFailure()){
220 // logstr << MSG::DEBUG << "BeamDetectorMonitoring: Retrieval of BPCRaw failed" << endmsg;
221 // }else {
222 // TBBPCRawCont::const_iterator it_bc = bpcrawCont->begin();
223 // TBBPCRawCont::const_iterator last_bc = bpcrawCont->end();
224 // // theRodBlock->push_back(2+bpcrawCont->size()*6); // BPC_SIZE
225 // // theRodBlock->push_back(0x05); // BPC_ID (BPCRaw)
226 
227 // for(it_bc= bpcrawCont->begin();it_bc!=last_bc;it_bc++){
228 // // theRodBlock->push_back((*it_bc)->getSignal((int) TBBPCRaw::tdcLeft));
229 // // theRodBlock->push_back((*it_bc)->getSignal((int) TBBPCRaw::tdcRight));
230 // // theRodBlock->push_back((*it_bc)->getSignal((int) TBBPCRaw::tdcUp));
231 // // theRodBlock->push_back((*it_bc)->getSignal((int) TBBPCRaw::tdcDown));
232 // // theRodBlock->push_back((*it_bc)->getSignal((int) TBBPCRaw::adcHorizontal));
233 // // theRodBlock->push_back((*it_bc)->getSignal((int) TBBPCRaw::adcVertical));
234 // }
235 // }
236 
237  // Trigger Pattern :
238 // TBTriggerPatternUnit *trigpat;
239 // sc = m_storeGate->retrieve(trigpat, "TBTrigPat");
240 // if (sc.isFailure()){
241 // logstr << MSG::DEBUG << "BeamDetectorMonitoring: Retrieval of TrigPat failed" << endmsg;
242 
243 // }else {
244 // theRodBlock->push_back(3); // TrigPat_SIZE
245 // theRodBlock->push_back(0x01); // TrigPat_ID (TrigPatRaw)
246 // theRodBlock->push_back(trigpat->getTriggerWord());
247 // }
248 
249 
250  return StatusCode::SUCCESS;
251 }
252 
253 
254 
255 
256 /* ----------------------------------------------------------------------
257 
258  Read ByteStream Methods
259 
260 ------------------------------------------------------------------------*/
261 
263 
264  StatusCode sc;
265  if(m_H6run) sc=H6BuildObjects(unrec_code); // build all objects, do not record object unrec_code
266  if(m_H8run) sc=H8BuildObjects(unrec_code); // build all objects, do not record object unrec_code
267  return sc;
268 }
269 
271 {
273  MsgStream logstr(msgSvc(), name());
274  logstr << MSG::DEBUG <<" in ReadFragment (TBTDC) key="<<key<<endmsg;
275  StatusCode sc=GetRODBlock(m_subdet_id); //Possible improvement: Check if vector is already valid.
276  if (sc!=StatusCode::SUCCESS)
277  return sc;
278  if (m_rodBlock.size()<2)
279  {
280  logstr << "ReadRodBlock: RodBlock too small!" << endmsg;
281  return StatusCode::FAILURE;
282  }
283  int tdc=m_rodBlock[0];
284  int tdcmin=m_rodBlock[1];
285  logstr << MSG::DEBUG <<" tdc = "<< tdc <<endmsg;
286  logstr << MSG::DEBUG <<" tdcmin = "<< tdcmin <<endmsg;
287  tbtdc=new TBTDC(tdc,tdcmin);
288  return StatusCode::SUCCESS;
289  // return sc;
290 }
291 
293 {MsgStream logstr(msgSvc(), name());
294  logstr << MSG::DEBUG <<" in ReadFragment (TBBPCRawCont) key="<<key<<endmsg;
296  if(sc) bpcrawCont = m_bpcrawCont;
297  logstr << MSG::DEBUG <<" End ReadFragment (TBBPCRawCont) key="<<key<<endmsg;
298  return sc;
299 }
300 
302 {MsgStream logstr(msgSvc(), name());
303  logstr << MSG::DEBUG <<" in ReadFragment (TBMWPCRawCont) key="<<key<<endmsg;
305  if(sc) mwpcrawCont = m_mwpcrawCont;
306  return sc;
307 }
308 
310 {MsgStream logstr(msgSvc(), name());
311  logstr << MSG::DEBUG <<" in ReadFragment (TBADCRawCont) key="<<key<<endmsg;
313  if(sc) adcrawCont = m_adcrawCont;
314  return sc;
315 }
317 {MsgStream logstr(msgSvc(), name());
318  logstr << MSG::DEBUG <<" in ReadFragment (TBTDCRawCont) key="<<key<<endmsg;
320  if(sc) tdcrawCont = m_tdcrawCont;
321  return sc;
322 }
323 
325 {MsgStream logstr(msgSvc(), name());
326  logstr << MSG::DEBUG <<" in ReadFragment (TBTriggerPatternUnit) key="<<key<<endmsg;
328  if(sc) trigpat = m_trigpat;
329  return sc;
330 }
331 
333 {MsgStream logstr(msgSvc(), name());
334  logstr << MSG::DEBUG <<" in ReadFragment (TBScintrawcont) key="<<key<<endmsg;
336  if(sc) scintrawCont = m_scintrawCont;
337  return sc;
338 }
339 
341 {MsgStream logstr(msgSvc(), name());
342  logstr << MSG::DEBUG <<" in ReadFragment (TBTailCatcherRaw) key="<<key<<endmsg;
344  if(sc) tailcatchraw = m_tailcatchraw;
345  return sc;
346 }
348 {MsgStream logstr(msgSvc(), name());
349  logstr << MSG::DEBUG <<" in ReadFragment (TBEventInfo) key="<<key<<endmsg;
351  if(sc) tbeventinfo = m_eventinfo;
352  return sc;
353 }
354 
356 {MsgStream logstr(msgSvc(), name());
357  logstr << MSG::DEBUG <<" in ReadFragment (TBLArDigitContainer) key="<<key<<endmsg;
358  int code=0;
359  if(key=="FREE") code = 10;
360  if(key=="LOW") code = 11;
361  if(key=="HIGH") code = 12;
362  if(key=="MEDIUM") code = 13;
363  if(code){
365  if(sc) tblardigitcont = m_tblardigitcont[code-10];
366  return sc;
367  }else{
368  logstr << MSG::ERROR <<" Can not create a LArDigitContainer with key="<<key<<endmsg;
369  tblardigitcont =0;
370  return StatusCode::FAILURE;
371  }
372 }
373 
375 {MsgStream logstr(msgSvc(), name());
376  logstr << MSG::DEBUG <<" in ReadFragment (TBLArCalibDigitContainer) key="<<key<<endmsg;
377  int code=0;
378  if(key=="FREE") code = 20;
379  if(key=="LOW") code = 21;
380  if(key=="HIGH") code = 22;
381  if(key=="MEDIUM") code = 23;
382  if(code){
384  if(sc) tblarcalibdigitcont = m_tblarcalibdigitcont[code-20];
385  return sc;
386  }else{
387  logstr << MSG::ERROR <<" Can not create a LArCalibDigitContainer with key="<<key<<endmsg;
388  tblarcalibdigitcont =0;
389  return StatusCode::FAILURE;
390  }
391 }
392 
393 
394 
395 StatusCode TBByteStreamCnvTool::GetRODBlock(eformat::SubDetector subdet_id,
396  eformat::SubDetector subdet_rod_id)//=m_DontCheckRodSubDetID)
397 
398 {MsgStream logstr(msgSvc(), name());
399  logstr << MSG::DEBUG << "GetRODBlock" << endmsg;
400  if (!m_rdpSvc)
401  {logstr << MSG::ERROR << "ROBDataProviderSvc not loaded. Can't read ByteStream" << endmsg;
402  return StatusCode::FAILURE;
403  }
404 
405  const RawEvent* re = m_rdpSvc->getEvent(Gaudi::Hive::currentContext());
406 
407  if (!re)
408  {logstr <<MSG::FATAL << "Can't get RawEvent!" << endmsg;
409  return StatusCode::FAILURE;
410  }
411 
412  const size_t MAX_ROBFRAGMENTS = 2048*1024;
413  std::vector<OFFLINE_FRAGMENTS_NAMESPACE::PointerType> robF(MAX_ROBFRAGMENTS);
414  size_t robcount = re->children(robF.data(),MAX_ROBFRAGMENTS);
415  // re->start(robF);
416  if (robcount == MAX_ROBFRAGMENTS)
417  {
418  logstr <<MSG::FATAL << "ROB buffer overflow" << endmsg;
419  return StatusCode::FAILURE;
420  }
421 
422  for (size_t irob=0; irob<robcount; ++irob) //Loop over all ROB-Fragments
423  {
425 
426  logstr << MSG::DEBUG << "ROB Frag *****************************" << endmsg;
427  MSG::hex(logstr) << MSG::DEBUG <<"Marker : " << rob.marker() << endmsg;
428  MSG::hex(logstr) << MSG::DEBUG <<"Frag Size : " << rob.fragment_size_word() << endmsg;
429  MSG::hex(logstr) << MSG::DEBUG <<"Header Size: " << rob.header_size_word() << endmsg;
430  MSG::hex(logstr) << MSG::DEBUG <<"Source ID : " << rob.source_id() << endmsg;
431  MSG::hex(logstr) << MSG::DEBUG <<"Version : " << rob.version() << endmsg;
432  try
433  {
434  rob.check();
435  }
436  catch (...)
437  {
438  logstr << MSG::ERROR << "Got invalid ROB fragment!" << endmsg;
439  return StatusCode::FAILURE;
440  }
441 
442  logstr << MSG::DEBUG << "ROD Frag *****************************" << endmsg;
443  MSG::hex(logstr) << MSG::DEBUG <<"Frag Size : " << rob.rod_fragment_size_word() << endmsg;
444  MSG::hex(logstr) << MSG::DEBUG <<"Header Size: " << rob.rod_header_size_word() << endmsg;
445  MSG::hex(logstr) << MSG::DEBUG <<"Source ID : " << rob.rod_source_id() << endmsg;
446  MSG::hex(logstr) << MSG::DEBUG <<"Run num : " << rob.rod_run_no() << endmsg;
447  MSG::hex(logstr) << MSG::DEBUG <<"Version : " << rob.rod_version() << endmsg;
448 
449  eformat::helper::SourceIdentifier rod_sid(rob.rod_source_id());
450  if (subdet_rod_id==m_DontCheckRodSubDetID || rod_sid.subdetector_id()==subdet_rod_id)
451  {
452  MSG::hex(logstr) << MSG::DEBUG << "Found requested ROD (id="
453  << rod_sid.subdetector_id() << ")" << endmsg;
454  // Set H6 or H8 mode :
455  if (!m_force_Hchoice)
456  {
457  logstr<< MSG::INFO << "Guessing from ROD header -> " ;
458  if (rob.rod_detev_type()&1)
459  {
460  logstr<< " H6 !" << endmsg;
461  m_H6run = true;
462  m_H8run = false;
463  }
464  else
465  {
466  logstr<< " H8 !" << endmsg;
467  m_H6run = false;
468  m_H8run = true;
469  }
470  }
471  m_h8_triggword = rob.rod_lvl1_trigger_type();
472  // Event number ?
473  m_ev_number = rob.rod_lvl1_id();
474  if(m_dump) MSG::dec(logstr) << MSG::INFO << " Ev. number(header)=" << m_ev_number <<endmsg;
475 
477  rob.rod_data(rodPointer);
478  m_rodBlock.clear();
479  for(size_t i=0; i<rob.rod_ndata(); ++i)
480  {
481  m_rodBlock.push_back(*rodPointer);
482  ++rodPointer;
483  }
484 
485  if (m_rodBlock.size()==0)
486  {
487  logstr << MSG::FATAL << "Error reading bytestream event: "
488  << "Empty ROD block" << endmsg;
489  return StatusCode::FAILURE;
490  }
491  logstr << MSG::DEBUG << "Got Rod Block for Test Beam Instrumentation data from ByteStream" << endmsg;
492  return StatusCode::SUCCESS;
493  }// end if requested ROD
494  }//end loop over ROBs
495 
496  MSG::hex(logstr) << MSG::WARNING << " Didn't find SubDet ID for Beam Instruments. Should be "<< subdet_id<<endmsg;
497  return StatusCode::FAILURE;
498 }
499 
500 /*---------------------------------------------------------------------------*/
501 
503 
504 /*---------------------------------------------------------------------------*/
505 {
513  MsgStream logstr(msgSvc(), name());
514  logstr << MSG::DEBUG << "H6BuildObject called for " << unrec_code<< endmsg;
515 
516  const EventContext& ctx = Gaudi::Hive::currentContext();
517 
518  StatusCode sc=StatusCode::FAILURE;
519  //bool gotobject=false;
520  //bool recordfailure=false;
521 
522  // for string conversion
523  std::ostringstream os;
524 
525  // Get ROD block.
526  sc=GetRODBlock(m_subdet_id); //Possible improvement: Check if vector is already valid.
527  if (sc!=StatusCode::SUCCESS)
528  return sc;
529  if (m_rodBlock.size()<2)
530  {MsgStream logstr(msgSvc(), name());
531  logstr << MSG::ERROR << "ReadRodBlock: RodBlock too small!" << endmsg;
532  return StatusCode::FAILURE;
533  }
534 
535 
536 
537 
539  m_tailcatchraw = 0;
540  m_bpcrawCont = new TBBPCRawCont();
543 
544  for(int i=0;i<4;i++) m_tblardigitcont[i] = new TBLArDigitContainer();
545  for(int i=0;i<4;i++) m_tblarcalibdigitcont[i] = new TBLArCalibDigitContainer();
546 
547  std::string name1,name2;
548  m_tdcrawCont = new TBTDCRawCont();
549  TBTDCRaw* dummytdc = new TBTDCRaw("dummy",true,0,true);
550  m_tdcrawCont->push_back(dummytdc);
551 
552  m_adcrawCont = new TBADCRawCont();
553  TBADCRaw* dummyadc = new TBADCRaw("dummy",true,0);
554  m_adcrawCont->push_back(dummyadc);
555 
557 
558 
559  // with this initialisation, first call of NextSubFrag will initialise correctly the index :
560  m_subfrag_id=0;
561  m_subfrag_size=2;
563  while(NextSubFrag()){
564  MSG::dec(logstr) << MSG::DEBUG << "size "<<m_subfrag_size<<endmsg;
565  MSG::hex(logstr) << MSG::DEBUG << "ID "<< m_subfrag_id<<endmsg;
566  switch(m_subfrag_id){
567  case 0x01: // HEADER_ID -----------------------------------------
568  {
569  logstr << MSG::DEBUG << "H6BuildObject : HEADER_ID "<< m_subfrag_size << endmsg;
570  //m_trigpat = new TBTriggerPatternUnit();
572  MSG::hex(logstr) << MSG::DEBUG << "Header "<<m_rodBlock[m_subfrag_firstdata];
573  MSG::hex(logstr) <<" "<<m_rodBlock[m_subfrag_firstdata+1];
574  MSG::hex(logstr) <<" "<<m_rodBlock[m_subfrag_firstdata+2];
575  MSG::hex(logstr) <<" "<<m_rodBlock[m_subfrag_firstdata+3]<<endmsg;
576  // if(unrec_code == 30 ) gotobject=true;
577  if(m_dump) MSG::dec(logstr) << MSG::INFO << " Ev. number(0x01)="<< m_rodBlock[m_subfrag_firstdata] <<endmsg;
581  m_run_num,
583  m_beam_part,
584  m_cryoX,
585  m_cryoAngle,
586  m_tableY);
587  }
588  break;
589 
590  case 0x02: // MINI-ROD Data Fragment ... oh what fun ... ------------
591  {
592  logstr << MSG::DEBUG << " Found mini-ROD data in beam crate fragment, size " << m_subfrag_size << endmsg;
593 
594  // bool calibdigit_requested = (unrec_code==20)||(unrec_code==21)||(unrec_code==22)||(unrec_code==23);
595  //
596  short m_feedthrough[8] = {0,0,0,0,1,1,1,1};
597  int m_sampleOrder[32] = {
598  0,1,2,3,4,5,6,7,8,9,10,
599  11,12,13,14,15,16,17,18,19,20,
600  21,22,23,24,25,26,27,28,29,30,
601  31};
602  int m_sort[64] = { 55, 39, 23, 7, 119, 103, 87, 71,
603  54, 38, 22, 6, 118, 102, 86, 70,
604  53, 37, 21, 5, 117, 101, 85, 69,
605  52, 36, 20, 4, 116, 100, 84, 68,
606  51, 35, 19, 3, 115, 99, 83, 67,
607  50, 34, 18, 2, 114, 98, 82, 66,
608  49, 33, 17, 1, 113, 97, 81, 65,
609  48, 32, 16, 0, 112, 96, 80, 64
610  } ;
611 
612 
613  constexpr short m_slot[8]={5,7,9,11,3,4,5,6};
614 
615  constexpr int NWREC = 8;
617  for(unsigned int nfeb=0;nfeb<m_boards.size();nfeb++){ // FEB loop ----------------------------------
618  pos += NWREC*3; // skip FEB header
619  if(m_dump) logstr << MSG::DEBUG << " Board "<< nfeb << endmsg;
620  for(int s=0;s<m_samples[0];s++){ // sample loop ----------------------------------
621  pos +=NWREC;
622  int samp;
623  for(unsigned int g=0;g<m_gains.size();g++){ // gain loop ----------------------------------
624  int gainmode;
625 
626  // According to 'FebAuto' keys, sort sample (cf Petr G. doc)
627  if(m_febgain[nfeb]==0){ // Default behavior
628  gainmode=m_gains[g];
629  if((gainmode==0)&&((m_sampleOrder[0]=m_firstsamples[0])!=0))
630  {
631  for(int j=0;j<m_firstsamples[0];j++) {m_sampleOrder[j+1]=j;}
632  }
633  }
634  else { // this FEB is AutoGain and first sample given in m_febgain
635  gainmode=0;
636  if((m_sampleOrder[0]=m_febgain[nfeb])!=0){
637  for(int j=0;j<m_febgain[nfeb];j++) {m_sampleOrder[j+1]=j;}
638  }
639  }
640  samp=m_sampleOrder[s];
641 
642  if(m_dump&&(gainmode==2)) logstr << MSG::DEBUG << " channels ";
643  for( int i= 0 ;i<64; i++){ // channel loop ----------------------------------
644  int chan= m_sort[i];
645 
646  unsigned short tmp1 = firstword(m_rodBlock[pos]);
647  unsigned short gain1 = ((tmp1>>12)&3) - 1;
648  m_arrayofsample[chan+8][gainmode][samp]=firstnbit(12,tmp1);
649 
650  unsigned short tmp2 = secondword(m_rodBlock[pos]);
651  unsigned short gain2 = ((tmp2>>12)&3) - 1;
652  m_arrayofsample[chan][gainmode][samp]=firstnbit(12,tmp2);
653 
654  m_arrayofgain[chan+8][gainmode] = getCaloGain(gain1);
655  m_arrayofgain[chan][gainmode] = getCaloGain(gain2);
656 
657 
658  // if(m_dump&(gainmode==2)) logstr << MSG::INFO << " " <<firstnbit(12,tmp1);
659  if(m_dump&&(gainmode==2)) logstr << MSG::DEBUG << " (," << chan << ","<< gainmode <<"," << samp <<","<< m_arrayofsample[chan+8][gainmode][samp]<<")";
660  pos++;
661  } // end channel loop
662 
663  if(m_dump&&(gainmode==2)) logstr << MSG::DEBUG <<endmsg;
664  } // end gain loop
665  }// end sample loop
666  pos+= NWREC*2;
667  logstr << MSG::DEBUG << " Creating LArDigit for board "<< nfeb << ". m_febgain=" << m_febgain[nfeb] <<endmsg;
668  // create and store LArDigit.
669  for(unsigned int g=0;g<m_gains.size();g++){ // loop on reqested gains
670  int gainmode;
671  if(m_febgain[nfeb]==0){ // Default behavior
672  gainmode= m_gains[g];
673  } else { // this FEB is AutoGain and first sample given in m_febgain
674  gainmode=0;
675  }
676 
677  logstr << MSG::DEBUG << "Gain mode="<< gainmode <<endmsg;
678  for(int i=0;i<128;i++) { // loop on channels
679 
680  std::vector<short> samplevec(m_arrayofsample[i][gainmode]);
681  samplevec.resize(m_samples[0]);
683  HWIdentifier hwid=m_onlineHelper->channel_Id(1,1,m_feedthrough[m_boards[nfeb]-1],m_slot[m_boards[nfeb]-1],i);
684  LArDigit * lardig= new LArDigit(hwid,gain,samplevec);
685  m_tblardigitcont[gainmode]->push_back(lardig);
686  if(m_isCalib) {
687  bool isPulsed=false;
688  const std::vector<HWIdentifier>& calibChannelIDs=calibLine->calibSlotLine(hwid);
689  if (calibChannelIDs.size() != 0) {
690  // Now figure out if any calibration line connected to this channel is pulsed.
691  // I'm going to cheat and use the fact that we only pulsed one board at a time
692  // and only wrote the corresponding digits (EMEC/HEC/FCAL)
693  for (HWIdentifier calChan : calibChannelIDs) {
694  int chan = m_onlineHelper->channel(calChan);
695  int bit = chan%8;
696  int byte = chan/8;
697  // if( 1<<bit & m_calib_pattern[byte] ) {
698  if( 128>>bit & m_calib_pattern[byte] ) {
699  isPulsed = true;
700  }
701  }
702  }
703  LArCalibDigit * larcalibdig= new LArCalibDigit(hwid,gain,samplevec,m_calib_dac,m_calib_delay,isPulsed);
704  m_tblarcalibdigitcont[gainmode]->push_back(larcalibdig);
705  }
706  }
707  if(m_febgain[nfeb]!=0){ // this FEB is AutoGain ignore every gain in FebGain
708  break;
709  }
710  }
711  }// FEB loop
712 
713  }
714  break;
715 
716  case 0x03: // TIME_ID -----------------------------------------
717  {
718  logstr << MSG::DEBUG << "H6BuildObject : TIME_ID "<< m_subfrag_size << endmsg;
719  name1="word1frag0x03chan";
720  name2="word2frag0x03chan";
721 
722 
723  if(m_subfrag_size!=5) {
724  logstr<<MSG::ERROR<< "Beam counter subfrag (0x03) has not expected size" <<endmsg;
725  sc=StatusCode::FAILURE;
726  break;
727  }
729  int tmp1,tmp2;
730 
731  tmp1 = firstword(m_rodBlock[pos]);
733 
734  if(m_dump) logstr << MSG::INFO << " sub frag 0x03 : word1="<<tmp1<<" word2="<< tmp2 <<endmsg;
735 
736  TBTDCRaw * clocktdc = new TBTDCRaw(name1+'0',false,tmp1,false);
737  TBTDCRaw * clock_deltdc = new TBTDCRaw(name2+'0',false,tmp2,false);
738  m_tdcrawCont->push_back(clocktdc);
739  m_tdcrawCont->push_back(clock_deltdc);
740 
741  tmp1 = firstword(m_rodBlock[pos+1]);
743 
744  if(m_dump) logstr << MSG::INFO << " sub frag 0x03 : word1="<<tmp1<<" word2="<< tmp2 <<endmsg;
745 
746  TBTDCRaw * scale1 = new TBTDCRaw(name1+'1',false,tmp1,false);
747  TBTDCRaw * scale1bis = new TBTDCRaw(name2+'1',false,tmp2,false);
749  m_tdcrawCont->push_back(scale1bis);
750 
751  tmp1 = firstword(m_rodBlock[pos+2]);
753 
754  if(m_dump) logstr << MSG::INFO << " sub frag 0x03 : word1="<<tmp1<<" word2="<< tmp2 <<endmsg;
755 
756  TBTDCRaw * scale2 = new TBTDCRaw(name1+'2',false,tmp1,false);
757  TBTDCRaw * scale2bis = new TBTDCRaw(name2+'2',false,tmp2,false);
759  m_tdcrawCont->push_back(scale2bis);
760 
761  }
762  break;
763  case 0x04: // TAIL_ID -----------------------------------------
764  {
765  name1="word1frag0x06chan";
766  name2="word2frag0x06chan";
767  std::string tcname="tc";
768  std::vector<TBScintillatorRaw *> theScints;
769  if(m_subfrag_size!=26) {
770  logstr<<MSG::ERROR<< "Beam counter subfrag (0x04) has not expected size" <<endmsg;
771  sc=StatusCode::FAILURE;
772  break;
773  }
774  logstr << MSG::DEBUG << "H6BuildObject : building tailcatcher " << endmsg;
775  for(unsigned int i=0;i<24;i++){
776  int tmp1,tmp2;
778  unsigned short word1=firstword(m_rodBlock[pos]);
779  unsigned short word2=secondword(m_rodBlock[pos]);
780 
781  tmp1 = firstnbit(10,word1);
782  tmp2 = firstnbit(10,word2);
783 
784  os.str("");
785  os << name1 << i;
786  TBADCRaw* adc1 = new TBADCRaw(os.str(),false,abs(tmp1));
787  os.str("");
788  os << name2 << i;
789  TBADCRaw* adc2 = new TBADCRaw(os.str(),false,abs(tmp2));
790  if(testbit(10,word1)) adc1->setOverflow(); // if bit10=0 -> Overflow
791  if(testbit(10,word2)) adc2->setOverflow(); // if bit10=0 -> Overflow
792  m_adcrawCont->push_back(adc1);
793  m_adcrawCont->push_back(adc2);
794  os.str("");
795  os << tcname << 2*i;
797  os.str("");
798  os << tcname << 2*i+1;
800  theScints.push_back(s1);
801  theScints.push_back(s2);
802  }
803 
804  m_tailcatchraw = new TBTailCatcherRaw("TailCatherRaw",false,theScints);
805  //if(unrec_code == 4 ) gotobject=true;
806  }
807  break;
808 
809  case 0x05: // BPC_ID -----------------------------------------
810  {
811  name1="word1frag0x05chan";
812  name2="word2frag0x05chan";
813  //m_bpcrawCont = new TBBPCRawCont();
814  int bpcnum = (m_subfrag_size - 2) / 3; // cause we store 6 tdc/adc in 16bits word
815  logstr << MSG::DEBUG << "H6BuildObject : number of BPCRaw "<< bpcnum << endmsg;
816  // get bpc raw information for each chamber:
817  for(int i=0;i<bpcnum;i++){
818  std::string bpcname = "BPC";
819  os.str("");
820  os << bpcname << i;
821  bpcname= os.str();
822  std::vector<const TBTDCRaw*> theTDCs;
823  std::vector<const TBADCRaw*> theADCs;
825 
826  unsigned int tmp1,tmp2;
827  tmp1=firstword(m_rodBlock[pos+i*3]);
829  os.str("");
830  os << name1 << (i*3);
831  TBADCRaw* tbadcH = new TBADCRaw(os.str(),(tmp1>1023),tmp1);
832  os.str("");
833  os << name2 << (i*3);
834  TBADCRaw* tbadcV = new TBADCRaw(os.str(),(tmp1>1023),tmp2);
835  m_adcrawCont->push_back(tbadcH);
836  m_adcrawCont->push_back(tbadcV);
837 
838  // first word is right :
839  tmp1=firstword(m_rodBlock[pos+i*3+1]);
841  os.str("");
842  os << name2 << (i*3+1);
843  TBTDCRaw * tbtdcL = new TBTDCRaw(os.str(),(tmp2>2047),tmp2,0);
844  os.str("");
845  os << name1 << (i*3+1);
846  TBTDCRaw * tbtdcR = new TBTDCRaw(os.str(),(tmp1>2047),tmp1,0);
847  // no under threshold ??
848  m_tdcrawCont->push_back(tbtdcR);
849  m_tdcrawCont->push_back(tbtdcL);
850  MSG::hex(logstr) << MSG::DEBUG << bpcname<< " "<< tmp1;
851  MSG::hex(logstr) << " "<< tmp2<<" ";
852 
853  tmp1=firstword(m_rodBlock[pos+i*3+2]);
855  os.str("");
856  os << name1 << (i*3+2);
857  TBTDCRaw * tbtdcU = new TBTDCRaw(os.str(),(tmp1>2047),tmp1,0);
858  os.str("");
859  os << name2 << (i*3+2);
860  TBTDCRaw * tbtdcD = new TBTDCRaw(os.str(),(tmp2>2047),tmp2,0);
861  // no under threshold ??
862  m_tdcrawCont->push_back(tbtdcU);
863  m_tdcrawCont->push_back(tbtdcD);
864  MSG::hex(logstr) << MSG::DEBUG << bpcname<< " "<< tmp1;
865  MSG::hex(logstr) << " "<< tmp2<<endmsg;
866 
867 
868  theTDCs.push_back(tbtdcL);
869  theTDCs.push_back(tbtdcR); // Fill the tdc/adc list
870  theTDCs.push_back(tbtdcU); // for this BPC
871  theTDCs.push_back(tbtdcD); // !! THE ORDER MATTERS !!
872  theADCs.push_back(tbadcH);
873  theADCs.push_back(tbadcV);
874  TBBPCRaw *bpcraw = new TBBPCRaw(bpcname,m_tdcrawCont,theTDCs,m_adcrawCont,theADCs);
875  m_bpcrawCont->push_back(bpcraw);
876  }
877  //if( unrec_code == 5 ) gotobject=true;
878 
879  }
880  break;
881 
882  case 0x06: // SCINTILLATOR_ID -----------------------------------------
883  {
884  name1="word1frag0x06chan";
885  name2="word2frag0x06chan";
886  if(m_subfrag_size!=11) {
887  logstr<<MSG::ERROR<< "Beam counter subfrag (0x06) has not expected size" <<endmsg;
888  sc=StatusCode::FAILURE;
889  break;
890  }
891 
892  logstr << MSG::DEBUG << " Building TBScintillatorRawCont with key " << m_keys[6] << endmsg;
893 
894  TBScintillatorRaw * S1 = new TBScintillatorRaw("S1");
895  TBScintillatorRaw * S2 = new TBScintillatorRaw("S2");
896  TBScintillatorRaw * S3 = new TBScintillatorRaw("S3");
898  TBScintillatorRaw * Veto = new TBScintillatorRaw("Veto");
899  TBScintillatorRaw * Halo = new TBScintillatorRaw("Halo");
900  TBScintillatorRaw * muon[8];
901 
902  logstr << MSG::DEBUG << " building muon counters:";
903  for(int i=0;i<8;i++) {
904  std::string scintname="muon";
905  os.str("");
906  os << scintname << (i+1);
907  scintname=os.str();
908  logstr << MSG::DEBUG << " " << scintname;
909  muon[i] = new TBScintillatorRaw(scintname);
910  }
911  logstr << endmsg;
912 
913  int tmp1,tmp2;
915  unsigned short word1=firstword(m_rodBlock[pos]);
916  unsigned short word2=secondword(m_rodBlock[pos]);
917 
918  tmp1 = firstnbit(10,word1);
919  tmp2 = firstnbit(10,word2);
920 
921  TBADCRaw* Badc = new TBADCRaw(name1+'0',false,abs(tmp1));
922  TBADCRaw* Haloadc = new TBADCRaw(name2+'0',false,abs(tmp2));
923  if(testbit(10,word1)) Badc->setOverflow(); // if bit10=0 -> Overflow
924  if(testbit(10,word2)) Haloadc->setOverflow(); // if bit10=0 -> Overflow
925  m_adcrawCont->push_back(Badc);
926  m_adcrawCont->push_back(Haloadc);
927 
928  tmp1 = firstnbit(10,firstword(m_rodBlock[pos+1]));
930  TBADCRaw* S3adc = new TBADCRaw(name1+'1',false,abs(tmp1));
931  TBADCRaw* S2adc = new TBADCRaw(name2+'1',false,abs(tmp2));
932  if(testbit(10,word1)) S3adc->setOverflow(); // if bit10=0 -> Overflow
933  if(testbit(10,word2)) S2adc->setOverflow(); // if bit10=0 -> Overflow
934  m_adcrawCont->push_back(S3adc);
935  m_adcrawCont->push_back(S2adc);
936 
937  tmp1 = firstnbit(10,firstword(m_rodBlock[pos+2]));
938  TBADCRaw* S1adc = new TBADCRaw(name1+'2',false,abs(tmp1));
939  if(testbit(10,word1)) S1adc->setOverflow(); // if bit10=0 -> Overflow
940  m_adcrawCont->push_back(S1adc);
941 
942  for(int i=0;i<4;i++) {
943  tmp1 = firstnbit(10,secondword(m_rodBlock[pos+2+i]));
945  os.str("");
946  os << name1 << (0+2+i);
947  TBADCRaw* adc1 = new TBADCRaw(os.str(),false,abs(tmp1));
948  os.str("");
949  os << name2 << (0+3+i);
950  TBADCRaw* adc2 = new TBADCRaw(os.str(),false,abs(tmp2));
951  // muon[i]
952  // muon[i+1]->setSignal(abs(tmp2));
953  if(testbit(10,word1)) adc1->setOverflow(); // if bit10=0 -> Overflow
954  if(testbit(10,word2)) adc2->setOverflow(); // if bit10=0 -> Overflow
955  m_adcrawCont->push_back(adc1);
956  m_adcrawCont->push_back(adc2);
957  muon[2*i]->setSignals(m_tdcrawCont,dummytdc,m_adcrawCont,adc1);
958  muon[2*i+1]->setSignals(m_tdcrawCont,dummytdc,m_adcrawCont,adc2);
959  }
960 
961 
962  tmp1 = firstnbit(11,secondword(m_rodBlock[pos+6]));
963  TBTDCRaw* S2tdc = new TBTDCRaw(name2+'6',false,abs(tmp1),0);
964  m_tdcrawCont->push_back(S2tdc);
965 
966  // Overflows ?? underthreshold ??
967  tmp1 = firstnbit(11,firstword(m_rodBlock[pos+7]));
969  TBTDCRaw* S3tdc = new TBTDCRaw(name1+'7',false,abs(tmp1),0);
970  TBTDCRaw* Btdc = new TBTDCRaw(name2+'7',false,abs(tmp2),0);
971  m_tdcrawCont->push_back(S3tdc);
972  m_tdcrawCont->push_back(Btdc);
973 
974  tmp1 = firstnbit(11,firstword(m_rodBlock[pos+8]));
976  TBTDCRaw* Halotdc = new TBTDCRaw(name1+'8',false,abs(tmp1),0);
977  TBTDCRaw* VetoORtdc = new TBTDCRaw(name2+'8',false,abs(tmp2),0);
978  m_tdcrawCont->push_back(Halotdc);
979  m_tdcrawCont->push_back(VetoORtdc);
980 
981 
982  // Fill container
983  S1->setSignals(m_tdcrawCont,dummytdc,m_adcrawCont,S1adc);
984  S2->setSignals(m_tdcrawCont,S2tdc,m_adcrawCont,S2adc);
985 
986 
987  // logstr << MSG::INFO << "S1 adc ovf = "<< S1->isADCOverflow() << " // S1adc = "<< S1adc->isOverflow() <<endmsg;
988  // logstr << MSG::INFO << "S2 adc ovf = "<< S2->isADCOverflow() << " // S2adc = "<< S2adc->isOverflow() <<endmsg;
989 
990  S3->setSignals(m_tdcrawCont,S3tdc,m_adcrawCont,S3adc);
991  Veto->setSignals(m_tdcrawCont,VetoORtdc,m_adcrawCont,dummyadc);
992  Halo->setSignals(m_tdcrawCont,Halotdc,m_adcrawCont,Haloadc);
993  B->setSignals(m_tdcrawCont,Btdc,m_adcrawCont,Badc);
994 
999  m_scintrawCont->push_back(Halo);
1001  for(int i=0;i<8;i++) {
1003  }
1004 
1005  logstr << MSG::DEBUG << " Should I record TBScintillatorRawCont with key " << m_keys[6] << " ? " << endmsg;
1006  //if(unrec_code == 6 ) gotobject=true;
1007  }
1008  break;
1009 
1010  case 0x07: // MWPC_ID -----------------------------------------
1011  {
1013  int nword = m_subfrag_size - 2;
1014  logstr << MSG::DEBUG << " Found MWPC subfragment. Nword= "<<nword << endmsg;
1015 
1016  std::string mwpcnames[8]= {"X2","Y2","X3","Y3","X4","Y4","X5","Y5"};
1017  bool isX[9]={true,false,true,false,true,false,true,false};
1018  TBMWPCRaw * mwpcraw[8];
1019  for( int i=0;i<8;i++){
1020  mwpcraw[i] = new TBMWPCRaw(mwpcnames[i]);
1021  }
1022 
1023  unsigned short status= secondword(m_rodBlock[pos+nword-1]);
1024  //bool error = false ;
1025  if(status==0) status= firstword(m_rodBlock[pos+nword-1]);
1026  else { // first 16 bit word is data
1027  unsigned short word1=firstword(m_rodBlock[pos+nword-1]);
1028  int w; // cluster width
1029  int c; // the starting channel of a cluster (0<start<4096)
1030  int chamber; // 0=X2, 1=Y2, 2=X3, 3=Y3, 4=X4, 5=Y4, 6=X5, 7=Y5
1031  int wire; // wire number
1032 
1033  w = (int) (word1>>12); c = (int) ((0xfff & word1) - w/2 + !(w&1));
1034  if( c < 768 ) {chamber = c/128; wire=c-chamber*128;}
1035  else {chamber=6+(c-768)/64; wire=c-768-(chamber-6)*64;}
1036 
1037  if(chamber>7){logstr << MSG::DEBUG << "Wrong MWPC chamber number : "<< chamber <<endmsg;}
1038  else{
1039  mwpcraw[chamber]->addCwireno(wire);
1040  mwpcraw[chamber]->addNwires(w);
1041  mwpcraw[chamber]->setXchambers(isX[chamber]);
1042  logstr << MSG::DEBUG << " MWPC chamber="<< chamber<< " wire=" << wire << " (w="<<w<<")" << " c="<<c<< endmsg;
1043  }
1044  }
1045 
1046  if(status != 0x1000) {MSG::hex(logstr)<< MSG::DEBUG << "MWPC status word error =" << status <<endmsg; /*error=true;*/}
1047 
1048  for( int i=0;i<m_subfrag_size-2;i++){ // "-2" because last full word contains status word (see above)
1049  unsigned short word1=firstword(m_rodBlock[pos+i]);
1050  unsigned short word2=secondword(m_rodBlock[pos+i]);
1051  int w; // cluster width
1052  int c; // the starting channel of a cluster (0<start<4096)
1053  int chamber; // 0=X2, 1=Y2, 2=X3, 3=Y3, 4=X4, 5=Y4, 6=X5, 7=Y5
1054  int wire; // wire number
1055 
1056  w = (int) (word1>>12); c = (int) ((0xfff & word1) - w/2 + !(w&1));
1057  if( c < 768 ) {chamber = c/128; wire=c-chamber*128;}
1058  else {chamber=6+(c-768)/64; wire=c-768-(chamber-6)*64;}
1059 
1060  if(chamber>7){logstr << MSG::DEBUG << "Wrong MWPC chamber number : "<< chamber <<endmsg;}
1061  else{
1062  mwpcraw[chamber]->addCwireno(wire);
1063  mwpcraw[chamber]->addNwires(w);
1064  mwpcraw[chamber]->setXchambers(isX[chamber]);
1065  logstr << MSG::DEBUG << " MWPC chamber="<< chamber<< " wire=" << wire << " (w="<<w<<")" << " c="<<c<< endmsg;
1066  }
1067 
1068  w = (int) (word2>>12); c = (int) ((0xfff & word2) - w/2 + !(w&1));
1069  if( c < 768 ) {chamber = c/128; wire=c-chamber*128;}
1070  else {chamber=6+(c-768)/64; wire=c-768-(chamber-6)*64;}
1071 
1072 
1073  if(chamber>7){logstr << MSG::INFO << "Wrong MWPC chamber number : "<< chamber <<endmsg;}
1074  else{
1075  mwpcraw[chamber]->addCwireno(wire);
1076  mwpcraw[chamber]->addNwires(w);
1077  mwpcraw[chamber]->setXchambers(isX[chamber]);
1078  logstr << MSG::DEBUG << " MWPC chamber="<< chamber<< " wire=" << wire << " (w="<<w<<")" << " c="<<c<< endmsg;
1079  }
1080 
1081  }
1082 
1083  for( int i=0;i<8;i++){
1084  m_mwpcrawCont->push_back(mwpcraw[i]);
1085  }
1086 
1087  logstr << MSG::DEBUG << " End of MWPC subfragment " << endmsg;
1088  //if(unrec_code == 7 ) gotobject=true;
1089 
1090  }
1091  break;
1092  case 0xf1: // Run header -----------------------------------------
1093  {
1095  char *strw;
1096  int nword = m_subfrag_size - 2;
1097  if(nword%16){
1098  logstr << MSG::ERROR << "bad number of lines. nwords=" << nword <<endmsg;
1099  break;
1100  }
1101  int nline= nword / 16;
1102  strw = reinterpret_cast<char*>(&m_rodBlock[pos]);
1103  for(int i=0;i<nline;i++){
1104  // strw = (char*) &m_rodBlock[pos+i*64];
1105  std::string sline="";
1106  std::string skey="";
1107  for(int j=0;j<63;j++) {
1108  if(strw[i*64+j]==0) break;
1109  sline+=strw[i*64+j];
1110  }
1111  //logstr << MSG::INFO << sline << endmsg;
1112  std::istringstream iss (sline);
1113  iss >> skey;
1114  if(skey=="RunNumber") {
1115  MSG::dec(logstr) << MSG::DEBUG << sline << endmsg;
1116  iss >> m_run_num;
1117  }
1118  if(skey=="BeamMomentum") {
1119  MSG::dec(logstr) << MSG::DEBUG << sline << endmsg;
1120  iss >> m_beam_moment;
1121  }
1122  if(skey=="BeamParticle") {
1123  MSG::dec(logstr) << MSG::DEBUG << sline << endmsg;
1124  iss >> m_beam_part;
1125  }
1126  if(skey=="CryoX") {
1127  MSG::dec(logstr) << MSG::DEBUG << sline << endmsg;
1128  iss >> m_cryoX;
1129  }
1130  if(skey=="CryoAngle") {
1131  MSG::dec(logstr) << MSG::DEBUG << sline << endmsg;
1132  iss >> m_cryoAngle;
1133  }
1134  if(skey=="TableY") {
1135  MSG::dec(logstr) << MSG::DEBUG << sline << endmsg;
1136  iss >> m_tableY;
1137  }
1138  if(skey=="miniROD") {
1139  logstr << MSG::DEBUG << sline << endmsg;
1140  m_boards.clear();
1141  int board;
1142  // iss>>board;
1143  while(iss.good()) {iss>>board;m_boards.push_back(board);}
1144  logstr << MSG::DEBUG << "Found nboards="<< m_boards.size() << endmsg;
1145  for(unsigned i=0;i<m_boards.size();i++)logstr << MSG::DEBUG << m_boards[i]<<" ";
1146  logstr << MSG::DEBUG<<endmsg;
1147  }
1148  if(skey=="FebSamples") {
1149  MSG::dec(logstr) << MSG::DEBUG << sline << endmsg;
1150  m_samples.clear();
1151  int sample;
1152  // iss>>sample;
1153  while(iss.good()) {iss>>sample;m_samples.push_back(sample);}
1154  MSG::dec(logstr) << MSG::DEBUG << "nsample="<< m_samples.size() << endmsg;
1155  for(unsigned i=0;i<m_samples.size();i++)logstr << MSG::DEBUG << m_samples[i]<<" ";
1156  logstr << MSG::DEBUG<<endmsg;
1157  }
1158  if(skey=="FebGains") {
1159  MSG::dec(logstr) << MSG::DEBUG << sline << endmsg;
1160  m_gains.clear();
1161  int gain;
1162  // iss>>gain;
1163  while(iss.good()) {iss>>gain;m_gains.push_back(gain);}
1164  int gs=m_gains.size() ;
1165  if(gs>1) if(m_gains[gs-1]==m_gains[gs-2])m_gains.resize(gs-1);
1166  MSG::dec(logstr) << MSG::DEBUG << "numb of gains="<< m_gains.size() << endmsg;
1167  for(unsigned i=0;i<m_gains.size();i++)logstr << MSG::DEBUG << m_gains[i]<<" ";
1168  logstr << MSG::DEBUG<<endmsg;
1169  }
1170  if(skey=="FebAuto") {
1171  MSG::dec(logstr) << MSG::DEBUG << sline << endmsg;
1172  m_febgain.clear();
1173  int gain;
1174  // iss>>gain;
1175  while(iss.good()) {iss>>gain;m_febgain.push_back(gain);}
1176  MSG::dec(logstr) << MSG::DEBUG << "n febauto="<< m_febgain.size() << " " << endmsg;
1177  for(unsigned i=0;i<m_febgain.size();i++)logstr << MSG::DEBUG << m_febgain[i]<<" ";
1178  logstr << MSG::DEBUG<<endmsg;
1179  }
1180  if(skey=="FebFirstSample") {
1181  MSG::dec(logstr) << MSG::DEBUG << sline << endmsg;
1182  m_firstsamples.clear();
1183  int firstsample;
1184  // iss>>firstsample;
1185  while(iss.good()) {iss>>firstsample;m_firstsamples.push_back(firstsample);}
1186  MSG::dec(logstr) << MSG::DEBUG << "firstsample="<< m_firstsamples.size() << endmsg;
1187  }
1188  }
1189 
1190  // If there was no febgain initialise to 0 :
1191  if(m_febgain.size()==0) m_febgain.resize(8,0);
1192  // now initialize every vector :
1193  for(int i=0;i<128;i++) {for(int j=0;j<4;j++) {m_arrayofsample[i][j].clear();m_arrayofsample[i][j].resize(32,0);}}
1194 
1195  // m_summary_path = m_summary_path+"/run";
1196 // m_summary_path = m_summary_path+m_run_num;
1197 // m_summary_path = m_summary_path+".summary";
1198  std::ofstream outfile(m_summary_path.c_str());
1199 
1200  outfile << "Run number " << m_run_num << std::endl;
1201  outfile << std::endl;
1202  outfile << "Beam Type \t " << m_beam_part << std::endl;
1203  outfile << "Beam Momentum \t " << m_beam_moment << std::endl;
1204  outfile << std::endl;
1205  outfile << "Cryostat X pos \t " << m_cryoX << std::endl;
1206  outfile << "Cryostat Angle \t " << m_cryoAngle << std::endl;
1207  outfile << "Table Y pos \t " << m_tableY << std::endl;
1208 
1209 
1210 
1211  }
1212  break;
1213  case 0xff : // Calib_ID ------------------------------------
1214  {
1216  int nword = m_subfrag_size - 2;
1217  logstr << MSG::DEBUG << " Found Calib_ID subfragment. Nword= "<<nword << endmsg;
1218  if(nword!=6) { // expect 6 words (to hold 22 bytes)
1219  logstr<<MSG::ERROR<< "Calibration subfrag (0xff) has not expected size" <<endmsg;
1220  sc=StatusCode::FAILURE;
1221  break;
1222  }
1223 
1224  m_isCalib = true;
1225 
1226  for(int i=0;i<4;i++){ // get channel pattern
1227  int first16 = firstword(m_rodBlock[pos+i]);
1228  int second16 = secondword(m_rodBlock[pos+i]);
1229 
1230  m_calib_pattern[4*i] = 255 & first16;
1231  m_calib_pattern[4*i+1] = first16 >> 8;
1232  m_calib_pattern[4*i+2] = 255 & second16;
1233  m_calib_pattern[4*i+3] = second16 >> 8;
1234  }
1235 
1236  logstr << MSG::DEBUG << "Found calibration header information " << endmsg;
1237  logstr << MSG::DEBUG << " Calib pattern: " << endmsg;
1238  for(int byte=0; byte<16; byte++) {
1239  logstr << MSG::DEBUG << " byte " << byte << " : " ;
1240  for(int bit=0; bit<8; bit++) {
1241  // bool onoff = 1<<bit & m_calib_pattern[byte];
1242  bool onoff = 128>>bit & m_calib_pattern[byte];
1243  logstr << MSG::DEBUG << onoff << "/" ;
1244  }
1245  logstr << MSG::DEBUG << endmsg;
1246  }
1247 
1248  // See http://cern.ch/atlas-fcaltb/Memos/DAQ/DataFormat.general.pdf
1249  // http://cern.ch/atlas-fcaltb/Data-taking/CBT2/Beam_fragment_format.sxw.pdf
1250  // (Petr Gorbunov H6 FCAL documentation.)
1252 
1253  unsigned first16 = firstword(m_rodBlock[pos+5]);
1254  m_calib_delay = 255 & first16;
1255  m_calib_error = ((first16 >> 8) != 0);
1256 
1257  // logstr << MSG::DEBUG << " Pattern 0/1/2/3 = " << m_calib_pattern[0]
1258  // << "/" << m_calib_pattern[1]
1259  // << "/" << m_calib_pattern[2]
1260  // << "/" << m_calib_pattern[3] << endmsg;
1261  logstr << MSG::DEBUG << " DAC = " << m_calib_dac << endmsg;
1262  logstr << MSG::DEBUG << " DELAY = " << m_calib_delay << endmsg;
1263  }
1264  break;
1265  default : // -----------------------------------------
1266  logstr << MSG::DEBUG << "Found undefined subfragment id= "<< m_subfrag_id << endmsg;
1267  break;
1268  }
1269  }
1270 
1271  sc = H6RecordObjects(unrec_code);
1272  return sc;
1273 
1274 
1275 }
1276 
1277 /*---------------------------------------------------------------------------*/
1278 
1280 
1281 /*---------------------------------------------------------------------------*/
1282 {
1291  MsgStream logstr(msgSvc(), name());
1292  logstr << MSG::DEBUG << "H8BuildObject invoked for code " << unrec_code<< endmsg;
1293 
1294  StatusCode sc=StatusCode::FAILURE;
1295  bool gotobject=false;
1296  bool recordfailure=false;
1297 
1298  bool goodRodBlock=true; // This is a hack to avoid runtime exceptions
1299 
1300  std::string name;
1301 
1302 
1303  // Get ROD block.
1304  sc=GetRODBlock(m_subdet_id,eformat::TDAQ_BEAM_CRATE); //Possible improvement: Check if vector is already valid.
1305  //sc=GetRODBlock(EventFormat::TDAQ_BEAM_CRATE);
1306 
1307  if (sc!=StatusCode::SUCCESS) {
1308  // return sc;
1309  logstr << MSG::ERROR << "ReadRodBlock: RodBlock error! Will try to fill SG with empty objects." << endmsg;
1310  goodRodBlock=false;
1311  }
1312  if (m_rodBlock.size()<2) {
1313  logstr << MSG::ERROR << "ReadRodBlock: RodBlock too small! Will try to fill SG with empty objects." << endmsg;
1314  // return StatusCode::FAILURE;
1315  goodRodBlock=false;
1316  }
1317 
1318  m_tdcrawCont = new TBTDCRawCont();
1319  m_adcrawCont = new TBADCRawCont();
1320 
1321  // Define some dummy ADC & TDC :
1322  TBADCRaw* dummyadc = new TBADCRaw("dummy",true,0);
1323  TBTDCRaw* dummytdc = new TBTDCRaw("dummy",true,0,true);
1324  m_tdcrawCont->push_back(dummytdc);
1325  m_adcrawCont->push_back(dummyadc);
1326 
1327 
1328  // Scintillator init :
1329  TBScintillatorRaw * S0 = new TBScintillatorRaw("S0");
1330  TBScintillatorRaw * S1 = new TBScintillatorRaw("S1");
1331  TBScintillatorRaw * S2up = new TBScintillatorRaw("S2-Up");
1332  TBScintillatorRaw * S2down = new TBScintillatorRaw("S2-Down");
1333  TBScintillatorRaw * S3left = new TBScintillatorRaw("S3-Left");
1334  TBScintillatorRaw * S3right = new TBScintillatorRaw("S3-Right");
1335  TBScintillatorRaw * C1 = new TBScintillatorRaw("C1");
1336  TBScintillatorRaw * C2 = new TBScintillatorRaw("C2");
1337  TBScintillatorRaw * muTag = new TBScintillatorRaw("muTag");
1338  TBScintillatorRaw * muHalo = new TBScintillatorRaw("muHalo");
1339  TBScintillatorRaw * muVeto = new TBScintillatorRaw("muVeto");
1340  TBScintillatorRaw * sTRT = new TBScintillatorRaw("TRTSci");
1341 
1342  // S0 has only TDC
1343  TBTDCRaw* S0tdc =dummytdc;
1344  // S1,S2,S3 have 1 TDC +1 ADC
1345  TBADCRaw * S1adc=dummyadc;
1346  TBTDCRaw * S1tdc=dummytdc;
1347 
1348  TBADCRaw * S2upadc=dummyadc;
1349  TBTDCRaw * S2uptdc=dummytdc;
1350  TBADCRaw * S2downadc=dummyadc;
1351  TBTDCRaw * S2downtdc=dummytdc;
1352 
1353  TBADCRaw * S3leftadc=dummyadc;
1354  TBTDCRaw * S3lefttdc=dummytdc;
1355  TBADCRaw * S3rightadc=dummyadc;
1356  TBTDCRaw * S3righttdc=dummytdc;
1357  //Clock phase
1358  TBTDCRaw * ClockPhasetdc=dummytdc;
1359 
1360  //The following Scintillators have only ADC
1361  TBADCRaw * muTagadc=dummyadc;
1362  TBADCRaw * C1adc=dummyadc;
1363  TBADCRaw * C2adc=dummyadc;
1364  TBADCRaw * muHaloadc=dummyadc;
1365  TBADCRaw * muVetoadc=dummyadc;
1366  TBADCRaw * sTRTadc=dummyadc;
1367 
1368  // Define BPCs
1369  // Some data words for tdc channels may be absent and if not they arrive in a
1370  // different order than the one we need to store in TBBPCRaw. So we need all this stuff to get
1371  // everything done :
1372  int BPCNum=5;
1373  TBBPCRaw* bpcraw[5];
1374  TBTDCRaw * BPCtdc[5][4];
1375  short tdc_order[4] = {2,3,0,1}; // bytestream : udlr - TBBPCRaw lrud
1376  for(int i=0;i<BPCNum;i++){
1377  bpcraw[i] = new TBBPCRaw("BPC");
1378  for(int j=0;j<4;j++) BPCtdc[i][j]=0;
1379  }
1380  bpcraw[0]->setDetectorName("BPC-2");
1381  bpcraw[1]->setDetectorName("BPC-1");
1382  bpcraw[2]->setDetectorName("BPC0");
1383  bpcraw[3]->setDetectorName("BPC1");
1384  bpcraw[4]->setDetectorName("BPC2");
1385 
1386  // for string conversion
1387  std::ostringstream os;
1388 
1389  // Now loop through fragment
1390 
1391  // with this initialisation, first call of NextSubFrag will initialise correctly the index :
1392  m_subfrag_id=0;
1393  m_subfrag_size=2;
1395  // while(NextSubFrag()){
1396  while(NextSubFrag() and goodRodBlock){ // Hack for bad ROD block
1397  switch(m_subfrag_id){
1398  case 0x10: // ADC1 block --------------------------------------
1399  {
1400  name="frag0x10chan";
1401  logstr << MSG::DEBUG << "Got SubFragment " << MSG::hex << m_subfrag_id << " name=" << name
1402  << " Data words = " << MSG::dec << m_subfrag_size-2<<endmsg;
1403 
1405 
1406  // Overflows ??
1407 
1408  S1adc = new TBADCRaw(name+"0",false,m_rodBlock[pos] & 0xfff);
1409  // do not set signal here cause we also need TDC (in 0x11)
1410  logstr << MSG::DEBUG << "S1adc: 0x" << MSG::hex << (int)(m_rodBlock[pos] & 0xfff) << " [0x" << m_rodBlock[pos] << "]"
1411  << MSG::dec << endmsg;
1412  m_adcrawCont->push_back(S1adc);
1413 
1414  pos++; // 2
1415  S2upadc = new TBADCRaw(name+"1",false,m_rodBlock[pos] & 0xfff);
1416  logstr << MSG::DEBUG << "S2 :" << MSG::hex << (m_rodBlock[pos] & 0xfff) << " [0x" << m_rodBlock[pos] << "]"
1417  << MSG::dec << endmsg;
1418  m_adcrawCont->push_back(S2upadc);
1419 
1420 
1421  pos++; // 2
1422  S3rightadc = new TBADCRaw(name+"2",false,m_rodBlock[pos] & 0xfff);
1423  logstr << MSG::DEBUG << "S3 :" << MSG::hex << (m_rodBlock[pos] & 0xfff) << " [0x" << m_rodBlock[pos] << "]"
1424  << MSG::dec << endmsg;
1425  m_adcrawCont->push_back(S3rightadc);
1426 
1427 
1428  pos++; // 2
1429  muTagadc = new TBADCRaw(name+"3",false,m_rodBlock[pos] & 0xfff);
1430  logstr << MSG::DEBUG << "muTag :" << MSG::hex << (m_rodBlock[pos] & 0xfff) << " [0x" << m_rodBlock[pos] << "]"
1431  << MSG::dec << endmsg;
1432  m_adcrawCont->push_back(muTagadc);
1433  //muTag->setSignals(m_tdcrawCont,dummytdc,m_adcrawCont,muTagadc);
1434 
1435  pos++; // 2
1436  C1adc = new TBADCRaw(name+"4",false,m_rodBlock[pos] & 0xfff);
1437  logstr << MSG::DEBUG << "C1 :" << MSG::hex << (m_rodBlock[pos] & 0xfff) << " [0x" << m_rodBlock[pos] << "]"
1438  << MSG::dec << endmsg;
1439  m_adcrawCont->push_back(C1adc);
1440  //C1->setSignals(m_tdcrawCont,dummytdc,m_adcrawCont,C1adc);
1441 
1442  pos++; // 2
1443  C2adc = new TBADCRaw(name+"5",false,m_rodBlock[pos] & 0xfff);
1444  logstr << MSG::DEBUG << "C2 :" << MSG::hex << (m_rodBlock[pos] & 0xfff) << " [0x" << m_rodBlock[pos] << "]"
1445  << MSG::dec << endmsg;
1446  m_adcrawCont->push_back(C2adc);
1447  //C2->setSignals(m_tdcrawCont,dummytdc,m_adcrawCont,C2adc);
1448 
1449 
1450  pos++; // 2
1451  muHaloadc = new TBADCRaw(name+"6",false,m_rodBlock[pos] & 0xfff);
1452  logstr << MSG::DEBUG << "muHalo :" << MSG::hex << (m_rodBlock[pos] & 0xfff) << " [0x" << m_rodBlock[pos] << "]"
1453  << MSG::dec << endmsg;
1454  m_adcrawCont->push_back(muHaloadc);
1455  //muHalo->setSignals(m_tdcrawCont,dummytdc,m_adcrawCont,muHaloadc);
1456 
1457  pos++; // 2
1458  muVetoadc = new TBADCRaw(name+"7",false,m_rodBlock[pos] & 0xfff);
1459  logstr << MSG::DEBUG << "muVeto :" << MSG::hex << (m_rodBlock[pos] & 0xfff) << " [0x" << m_rodBlock[pos] << "]"
1460  << MSG::dec << endmsg;
1461  m_adcrawCont->push_back(muVetoadc);
1462  //muVeto->setSignals(m_tdcrawCont,dummytdc,m_adcrawCont,muVetoadc);
1463 
1464  if(m_dump){
1465  logstr << MSG::INFO << " DUMP : ";
1466  logstr << name << " "<< m_subfrag_size-2 <<" words - " << S1adc->getADC() << " " << S2upadc->getADC();
1467  logstr << " " << S3rightadc->getADC()<< " " << muTagadc->getADC() << " " << C1adc->getADC();
1468  logstr << " " << C2adc->getADC() << " " << muHaloadc->getADC() << " "<< muVetoadc->getADC() <<endmsg ;
1469 
1470  }
1471 
1472  }
1473  break;
1474  case 0x11: // ADC2 segment ----------------------------------
1475  {
1476  name="frag0x11chan";
1477  logstr << MSG::DEBUG << "Got SubFragment " << MSG::hex << m_subfrag_id << " name=" << name
1478  << " Data words = " << MSG::dec << m_subfrag_size-2<<endmsg;
1479 
1481 
1482  // channel 0 not used
1483  // Modification: 2005/01/27 W.L. channel 0 used by TRT Scintillator
1484  sTRTadc = new TBADCRaw(name+"0",false,m_rodBlock[pos] & 0xfff);
1485  logstr << MSG::DEBUG << "sTRT:" << MSG::hex << (m_rodBlock[pos] & 0xfff) << " [0x" << m_rodBlock[pos] << "]"
1486  << MSG::dec << endmsg;
1487  m_adcrawCont->push_back(sTRTadc);
1488  pos++; //1
1489  S2downadc = new TBADCRaw(name+"1",false,m_rodBlock[pos] & 0xfff);
1490  logstr << MSG::DEBUG << "S2 :" << MSG::hex << (m_rodBlock[pos] & 0xfff) << " [0x" << m_rodBlock[pos] << "]"
1491  << MSG::dec << endmsg;
1492  m_adcrawCont->push_back(S2downadc);
1493 
1494  pos++; // 2
1495  S3leftadc = new TBADCRaw(name+"2",false,m_rodBlock[pos] & 0xfff);
1496  logstr << MSG::DEBUG << "S3 :" << MSG::hex << (m_rodBlock[pos] & 0xfff) << " [0x" << m_rodBlock[pos] << "]"
1497  << MSG::dec << endmsg;
1498  m_adcrawCont->push_back(S3leftadc);
1499 
1500  if(m_dump){
1501  logstr << MSG::INFO << " DUMP : ";
1502  logstr << name << " "<< m_subfrag_size-2 <<" words - " << S2downadc->getADC() << " " << S3leftadc->getADC()<<endmsg;
1503  }
1504 
1505  }
1506  break;
1507  case 0x12: // ps TDC --------------------------------------
1508  {
1509  name="frag0x12chan";
1510  logstr << MSG::DEBUG << "Got SubFragment " << MSG::hex << m_subfrag_id << " name=" << name
1511  << " Data words = " << MSG::dec << m_subfrag_size-2<<endmsg;
1513  if(m_dump) logstr << MSG::INFO << " DUMP : "<< name<< " "<< m_subfrag_size-2 <<" words - " ;
1514 
1515  for( int i=0;i<m_subfrag_size-2;i++){
1517  // get channel number
1518  const int chan= (m_rodBlock[pos] >> 16) & 0x1F;
1519  const unsigned int tdc = m_rodBlock[pos] & 0xfff; // 12 first bits (0-11)
1520  const int corrup = (m_rodBlock[pos]>>21)&0x3f; // test bits 21-26
1521  const bool endofdata=(((m_rodBlock[pos] >> 24)&0x7)==0x4);
1522  // from doc it appears that endofdata <=> corrup==32
1523  const bool overflow=(m_rodBlock[pos]>>12)&1;
1524  const bool underthresh=(m_rodBlock[pos]>>13)&1;
1525  logstr << MSG::DEBUG << MSG::dec << "Pos=" << pos <<" Chan "<< chan << "=" << tdc << ", OV=" << overflow
1526  << ", UN=" <<underthresh << " EOD="<< endofdata << ", corrupt=" << corrup
1527  << " [0x" << MSG::hex << m_rodBlock[pos] << "]" << MSG::dec <<endmsg;
1528  if(m_dump)
1529  MSG::dec(logstr) << " "<< (m_rodBlock[pos] & 0xfff);
1530 
1531 
1532  if (!endofdata && !corrup) {
1533  os.str("");
1534  os << name << chan;
1535  switch(chan){
1536  case 0:
1537  ClockPhasetdc = new TBTDCRaw(os.str(),overflow,tdc,underthresh);
1538  m_tdcrawCont->push_back(ClockPhasetdc);
1539  break;
1540  case 1:
1541  S1tdc = new TBTDCRaw(os.str(),overflow,tdc,underthresh);
1542  m_tdcrawCont->push_back(S1tdc);
1543  break;
1544  case 2:
1545  S2downtdc = new TBTDCRaw(os.str(),overflow,tdc,underthresh);
1546  m_tdcrawCont->push_back(S2downtdc);
1547  break;
1548  case 3:
1549  S3lefttdc = new TBTDCRaw(os.str(),overflow,tdc,underthresh);
1550  m_tdcrawCont->push_back(S3lefttdc);
1551  break;
1552  case 4:
1553  S2uptdc = new TBTDCRaw(os.str(),overflow,tdc,underthresh);
1554  m_tdcrawCont->push_back(S2uptdc);
1555  break;
1556  case 5:
1557  S3righttdc = new TBTDCRaw(os.str(),overflow,tdc,underthresh);
1558  m_tdcrawCont->push_back(S3righttdc);
1559  break;
1560  case 6:
1561  S0tdc = new TBTDCRaw(os.str(),overflow,tdc,underthresh);
1562  m_tdcrawCont->push_back(S0tdc);
1563  break;
1564  default:
1565  break;
1566  } // end switch
1567  }//end if not corrupted and not end of data
1568  else
1569 
1570  if (endofdata) {
1571  if (i==m_subfrag_size-3)
1572  logstr << MSG::DEBUG << " End of data word found at pos " << pos <<endmsg;
1573  else
1574  logstr << MSG::ERROR << " Unexpected end-of-data word found at pos " << pos <<endmsg;
1575  }
1576  else // corrupt
1577  logstr<< MSG::ERROR << "Corrupted data in SubFragment 0x12 pos=" << pos << "channel=" <<chan << " [0x" <<
1578  MSG::hex << m_rodBlock[pos] << "]" << MSG::dec<<endmsg;
1579  } //end loop over subfrags
1580  if(m_dump) logstr << endmsg;
1581  }
1582  break;
1583  case 0x13: // ns TDC (for BPC) --------------------------------------
1584  {
1585  name="frag0x13chan";
1586  logstr << MSG::DEBUG << "Got SubFragment " << MSG::hex << m_subfrag_id << " name=" << name
1587  << " Data words = " << MSG::dec << m_subfrag_size-2<<endmsg;
1588  if(m_dump) logstr << MSG::INFO << " DUMP : "<< name<< " "<< m_subfrag_size-2 <<" words - " << endmsg;
1589  for( int i=0;i<m_subfrag_size-2;i++){
1591  // get channel number
1592  const int chan= (m_rodBlock[pos] >> 17) & 0xF; // bits 17-20
1593  const unsigned int tdc = m_rodBlock[pos] & 0xffff; // 16 first bits (0-15)
1594  const bool corrup = (m_rodBlock[pos]>>21)&0x1; // test bit 21
1595  const bool endofdata=!((m_rodBlock[pos] >> 23)&0x1); // test bit 23
1596  logstr << MSG::DEBUG << MSG::dec <<"Pos=" << pos << " Chan "<< chan << "=" << tdc
1597  << " EOD="<< endofdata << ", corrupt=" << corrup
1598  << " [0x" << MSG::hex << m_rodBlock[pos] << "]" << MSG::dec <<endmsg;
1599  if (!endofdata && !corrup) {
1600  os.str("");
1601  os << name << chan;
1602  TBTDCRaw * tbtdc = new TBTDCRaw(os.str(),false,tdc,false);
1603  m_tdcrawCont->push_back(tbtdc);
1604  const short bpc_ind = chan / 4 ;
1605  if(bpc_ind>4) {
1606  logstr<< MSG::DEBUG << "Error in 0x13 : found chan="<<chan<<" corresponding to bpc "<<bpc_ind<<endmsg;
1607  continue;
1608  }
1609  const short signaltype = tdc_order[chan % 4];
1610  if (BPCtdc[bpc_ind][signaltype]==NULL)
1611  BPCtdc[bpc_ind][signaltype] = tbtdc;
1612  }
1613  else
1614  if (endofdata) {
1615  if (i==m_subfrag_size-3)
1616  logstr << MSG::DEBUG << " End of data word found at pos " << pos <<endmsg;
1617  else
1618  logstr << MSG::ERROR << " Unexpected end-of-data word found at pos " << pos <<endmsg;
1619  }
1620  else // corrupt
1621  logstr<< MSG::ERROR << "Corrupted data in SubFragment 0x13 pos=" << pos << "channel=" <<chan << " [0x" <<
1622  MSG::hex << m_rodBlock[pos] << "]" << MSG::dec<<endmsg;
1623  } // end for loop
1624 
1625  }
1626  break;
1627  case 0x14: // ns TDC (for BPC) --------------------------------------
1628  {
1629  name="frag0x14chan";
1630  logstr << MSG::DEBUG << "Got SubFragment " << MSG::hex << m_subfrag_id << " name=" << name
1631  << " Data words = " << MSG::dec << m_subfrag_size-2<<endmsg;
1632 
1633 
1634  if(m_dump) logstr << MSG::INFO << " DUMP : "<< name<< " "<< m_subfrag_size-2 <<" words - " << endmsg;
1635 
1636 
1637  for( int i=0;i<m_subfrag_size-2;i++){
1639 
1640  // get channel number
1641  const int chan= (m_rodBlock[pos] >> 17) & 0xF; // bits 17-20
1642  const unsigned int tdc = m_rodBlock[pos] & 0xffff; // 16 first bits (0-15)
1643  const bool corrup = (m_rodBlock[pos]>>21)&0x1; // test bit 21
1644  const bool endofdata=!((m_rodBlock[pos] >> 23)&0x1); // test bit 23
1645  //const bool overflow=(m_rodBlock[pos]>>12)&1;
1646  //const bool underthresh=(m_rodBlock[pos]>>13)&1;
1647  logstr << MSG::DEBUG << MSG::dec << "Pos=" << pos << " Chan "<< chan << "=" << tdc
1648  << " EOD="<< endofdata << ", corrupt=" << corrup
1649  << " [0x" << MSG::hex << m_rodBlock[pos] << "]" << MSG::dec <<endmsg;
1650 
1651  if (!endofdata && !corrup) {
1652  os.str("");
1653  os << name << chan;
1654  TBTDCRaw * tbtdc = new TBTDCRaw(os.str(),false,tdc,false);
1655  m_tdcrawCont->push_back(tbtdc);
1656  const short bpc_ind = chan / 4 + 3;
1657  if(bpc_ind>4) { logstr<< MSG::DEBUG << "Error in 0x14 : found chan="<<chan<<" corresponding to bpc "<<bpc_ind<<endmsg;continue;}
1658  const short signaltype = tdc_order[chan % 4];
1659  if (BPCtdc[bpc_ind][signaltype]==NULL)
1660  BPCtdc[bpc_ind][signaltype] = tbtdc;
1661  }
1662  else
1663  if (endofdata) {
1664  if (i==m_subfrag_size-3)
1665  logstr << MSG::DEBUG << " End of data word found at pos " << pos <<endmsg;
1666  else
1667  logstr << MSG::ERROR << " Unexpected end-of-data word found at pos " << pos <<endmsg;
1668  }
1669  else // corrupt
1670  logstr<< MSG::ERROR << "Corrupted data in SubFragment 0x14 pos=" << pos << "channel=" <<chan << " [0x" <<
1671  MSG::hex << m_rodBlock[pos] << "]" << MSG::dec<<endmsg;
1672  } // end for loop
1673  }
1674  break;
1675  case 0x15: // trigger word --------------------------------------
1676  {
1677  logstr << MSG::INFO << "Found trigger word fragment" << endmsg;
1678  }
1679  break;
1680  default :
1681  logstr << MSG::DEBUG << "Found undefined subfragment id= "<< m_subfrag_id << endmsg;
1682  break;
1683 
1684  }
1685  }
1686 
1687 
1688 
1689  logstr << MSG::DEBUG << "Filling Scint" << endmsg;
1690 
1691  // fill scint container
1693  //m_scintrawCont->push_back(S0);
1694  //logstr << MSG::DEBUG << "S1 " << endmsg
1695 
1696  // Here some tdc maybe missing, so test for them :
1697  if(S0tdc) S0->setSignals(m_tdcrawCont,S0tdc,m_adcrawCont,dummyadc); //Scintillator 0 has only TDC
1698  else S0->setSignals(m_tdcrawCont,dummytdc,m_adcrawCont,dummyadc);
1700 
1701  if(S1tdc && S1adc) S1->setSignals(m_tdcrawCont,S1tdc,m_adcrawCont,S1adc);
1702  else S1->setSignals(m_tdcrawCont,dummytdc,m_adcrawCont,S1adc);
1704 
1705  if(S2uptdc) S2up->setSignals(m_tdcrawCont,S2uptdc,m_adcrawCont,S2upadc);
1706  else S2up->setSignals(m_tdcrawCont,dummytdc,m_adcrawCont,S2upadc);
1707  m_scintrawCont->push_back(S2up);
1708 
1709  if(S2downtdc) S2down->setSignals(m_tdcrawCont,S2downtdc,m_adcrawCont,S2downadc);
1710  else S2down->setSignals(m_tdcrawCont,dummytdc,m_adcrawCont,S2downadc);
1711  m_scintrawCont->push_back(S2down);
1712 
1713  if(S3lefttdc) S3left->setSignals(m_tdcrawCont,S3lefttdc,m_adcrawCont,S3leftadc);
1714  else S3left->setSignals(m_tdcrawCont,dummytdc,m_adcrawCont,S3leftadc);
1715  m_scintrawCont->push_back(S3left);
1716 
1717  if(S3righttdc) S3right->setSignals(m_tdcrawCont,S3righttdc,m_adcrawCont,S3rightadc);
1718  else S3right->setSignals(m_tdcrawCont,dummytdc,m_adcrawCont,S3rightadc);
1719  m_scintrawCont->push_back(S3right);
1720 
1721  C1->setSignals(m_tdcrawCont,dummytdc,m_adcrawCont,C1adc);
1722  m_scintrawCont->push_back(C1);
1723  C2->setSignals(m_tdcrawCont,dummytdc,m_adcrawCont,C2adc);
1725  muTag->setSignals(m_tdcrawCont,dummytdc,m_adcrawCont,muTagadc);
1726  m_scintrawCont->push_back(muTag);
1727  muHalo->setSignals(m_tdcrawCont,dummytdc,m_adcrawCont,muHaloadc);
1728  m_scintrawCont->push_back(muHalo);
1729  muVeto->setSignals(m_tdcrawCont,dummytdc,m_adcrawCont,muVetoadc);
1730  m_scintrawCont->push_back(muVeto);
1731  sTRT->setSignals(m_tdcrawCont,dummytdc,m_adcrawCont,sTRTadc);
1732  m_scintrawCont->push_back(sTRT);
1733 
1734 
1735  // fill bpc container
1736  logstr << MSG::DEBUG << "Filling BPC" << endmsg;
1737  m_bpcrawCont = new TBBPCRawCont();
1738 
1739  for(int i=0;i<BPCNum;i++){
1740  std::vector<const TBTDCRaw*> listtdc;
1741  std::vector<const TBADCRaw*> listadc;
1742  for(int j=0;j<4;j++){
1743  if(BPCtdc[i][j]==0) listtdc.push_back(dummytdc);
1744  else listtdc.push_back(BPCtdc[i][j]);
1745  }
1746  listadc.push_back(dummyadc); listadc.push_back(dummyadc);
1747  bpcraw[i]->setSignals(m_tdcrawCont,listtdc,m_adcrawCont,listadc);
1748  m_bpcrawCont->push_back(bpcraw[i]);
1749  }
1750 
1751 
1752 
1753  // -----------------------------------------------------------------------------------------------
1754 
1755  // Now Get info from TileAux RodBlock subdet ID = 0x70
1756  //sc=GetRODBlock((EventFormat::SubDetector) 0x70); //Possible improvement: Check if vector is already valid.
1757  sc=GetRODBlock(m_subdet_id,eformat::TILECAL_LASER_CRATE);
1758  if (sc!=StatusCode::SUCCESS) {
1759  // return sc;
1760  goodRodBlock = false;
1761  logstr << MSG::ERROR << "Tile laser crate ROD block error! Nothing valid in SG." << endmsg;
1762  }
1763  if (m_rodBlock.size()<2) {
1764  logstr << MSG::ERROR << "Tile laser crate ROD block too small! Nothing valid in SG" << endmsg;
1765  // return StatusCode::FAILURE;
1766  goodRodBlock = false;
1767  }
1768 
1769  // with this initialisation, first call of NextSubFrag will initialise correctly the index :
1770  m_subfrag_id=0;
1771  m_subfrag_size=2;
1773  // while(NextSubFrag()){
1774  while(NextSubFrag() and goodRodBlock ){
1775  switch(m_subfrag_id){
1776  case 0x1: // ADC1 block --------------------------------------
1777  {
1778  name="frag0x1chan";
1780  TBScintillatorRaw * SC1 = new TBScintillatorRaw("SC1");
1781  TBADCRaw* SC1adc = new TBADCRaw(name+"0",false,m_rodBlock[pos] & 0xfff);
1782  m_adcrawCont->push_back(SC1adc);
1783  SC1->setSignals(m_tdcrawCont,dummytdc,m_adcrawCont,SC1adc);
1784  m_scintrawCont->push_back(SC1);
1785 
1786  pos++;
1787  TBScintillatorRaw * SC2 = new TBScintillatorRaw("SC2");
1788  TBADCRaw* SC2adc = new TBADCRaw(name+"1",false,m_rodBlock[pos] & 0xfff);
1789  m_adcrawCont->push_back(SC2adc);
1790  SC2->setSignals(m_tdcrawCont,dummytdc,m_adcrawCont,SC2adc);
1791  m_scintrawCont->push_back(SC2);
1792  logstr << MSG::DEBUG << "Found Scintillator SC1 and SC2" << endmsg;
1793  break;
1794  }
1795  case 0x2: // ADC2 block --------------------------------------
1796  {
1797 
1799  for(int i=0;i<8;i++){
1800  pos=pos+i;
1801  std::stringstream RawName;
1802  RawName << "frag0x1chan"<<i;
1803  TBADCRaw* MuWalladc = new TBADCRaw(RawName.str(),false,m_rodBlock[pos] & 0xfff);
1804  m_adcrawCont->push_back(MuWalladc);
1805 
1806  std::stringstream MuWallName;
1807  MuWallName << "MuWall"<<i;
1808  TBScintillatorRaw* MuWallScint = new TBScintillatorRaw(MuWallName.str());
1809  MuWallScint->setSignals(m_tdcrawCont,dummytdc,m_adcrawCont,MuWalladc);
1810  m_scintrawCont->push_back(MuWallScint);
1811  }
1812  logstr << MSG::DEBUG << "Found first muWall block" << endmsg;
1813  break;
1814  }
1815  case 0x3: // ADC3 block --------------------------------------
1816  {
1817 
1819 
1820  for(int i=0;i<4;i++){
1821  pos=pos+i;
1822  std::stringstream RawName;
1823  RawName << "frag0x1chan"<<(i+8);
1824  TBADCRaw* MuWalladc = new TBADCRaw(name,false,m_rodBlock[pos] & 0xfff);
1825  m_adcrawCont->push_back(MuWalladc);
1826 
1827  std::stringstream MuWallName;
1828  MuWallName << "MuWall"<<i+8;
1829  TBScintillatorRaw* MuWallScint = new TBScintillatorRaw(MuWallName.str());
1830  MuWallScint->setSignals(m_tdcrawCont,dummytdc,m_adcrawCont,MuWalladc);
1831  m_scintrawCont->push_back(MuWallScint);
1832  }
1833  logstr << MSG::DEBUG << "Found second muWall block" << endmsg;
1834  break;
1835  }
1836  default :
1837  if (m_subfrag_id!=3 && m_subfrag_id!=5 && m_subfrag_id!=7)
1838  logstr << MSG::DEBUG << "Found undefined subfragment id= "<< m_subfrag_id << endmsg;
1839  break;
1840 
1841  }
1842  }
1843 
1844 
1845 
1846 
1847  // -----------------------------------------------------------------------------------------------
1848 
1849  // Now record object if they have not been invoked from converter
1850 
1851 // if(unrec_code!=1){ // If object was not requested by the converter, store it in SG
1852 // sc = m_storeGate->record(m_trigpat,m_keys[1]);
1853 // if ( sc.isFailure( ) ) {recordfailure=true;
1854 // logstr << MSG::FATAL << "Cannot record TBTrigPat " << endmsg;
1855 // }
1856 // }else {sc=StatusCode::SUCCESS; gotobject=true;} // else return success to converter
1857 
1858 
1859  if(unrec_code!=5){ // If object was not requested by the converter, store it in SG
1860  sc = evtStore()->record(m_bpcrawCont,m_keys[5]);
1861  if ( sc.isFailure( ) ) {recordfailure=true;
1862  logstr << MSG::FATAL << "Cannot record BPCRawCont" << endmsg;
1863  }
1864  }else {sc=StatusCode::SUCCESS; gotobject=true;} // else return success to converter
1865 
1866 
1867  if(unrec_code!=6){ // If object was not requested by the converter, store it in SG
1868  sc = evtStore()->record(m_scintrawCont,m_keys[6]);
1869  if ( sc.isFailure( ) ) {recordfailure=true;
1870  logstr << MSG::FATAL << "Cannot record ScintRawCont " << endmsg;
1871  }
1872  } else {sc=StatusCode::SUCCESS; gotobject=true;} // else return success to converter
1873 
1874 
1875  if(unrec_code!=2){ // If object was not requested by the converter, store it in SG
1876  sc = evtStore()->record(m_tdcrawCont,m_keys[2]);
1877  if ( sc.isFailure( ) ) {recordfailure=true;
1878  logstr << MSG::FATAL << "Cannot record TDCCont " << endmsg;
1879  }
1880  }else {sc=StatusCode::SUCCESS; gotobject=true;} // else return success to converter
1881 
1882  if(unrec_code!=3){ // If object was not requested by the converter, store it in SG
1883  sc = evtStore()->record(m_adcrawCont,m_keys[3]);
1884  if ( sc.isFailure( ) ) {recordfailure=true;
1885  logstr << MSG::FATAL << "Cannot record ADCCont " << endmsg;
1886  }
1887  }else {sc=StatusCode::SUCCESS; gotobject=true;} // else return success to converter
1888 
1889 
1892  if(unrec_code!=1) { // If object was not requested by the converter, store it in SG
1893  logstr << MSG::DEBUG << "Recording TBTriggerPatternUnit with key " << m_keys[1] << endmsg;
1894  // if(! evtStore()->contains<TBTriggerPatternUnit>(m_keys[1])) {
1895  sc = evtStore()->record(m_trigpat,m_keys[1]);
1896  if ( sc.isFailure( ) ) {
1897  logstr << MSG::ERROR << "Cannot record TBTrigPat " << endmsg;
1898  }
1899  } else {
1900  sc=StatusCode::SUCCESS;
1901  gotobject=true;
1902  } // else return success to converter
1903 
1904 
1905  logstr << MSG::DEBUG << " End of H8 Build " << endmsg;
1906  if(!gotobject) {logstr<< MSG::ERROR<< " Could not find object of type "<<unrec_code << endmsg; sc=StatusCode::FAILURE;}
1907  if(recordfailure) {logstr<< MSG::ERROR<< " One object could not be recorded "<< endmsg; sc=StatusCode::FAILURE;}
1908 
1909 
1910  return sc;
1911 }
1912 
1914 {
1915 
1916  StatusCode sc;
1917  MsgStream logstr(msgSvc(), name());
1918  logstr << MSG::DEBUG << "About to try recording. unrec_code = " << unrec_code << endmsg;
1919 
1920  if( !m_tailcatchraw) {
1921  logstr << MSG::DEBUG << " WARNING! Did not find TailCatcher. Returning an empty one : this may crash every attempt to use it" << endmsg;
1923  }
1924 
1925  if(unrec_code!=1) { // If object was not requested by the converter, store it in SG
1926  logstr << MSG::DEBUG << "Recording TBTriggerPatternUnit with key " << m_keys[1] << endmsg;
1927  sc = evtStore()->record(m_trigpat,m_keys[1]);
1928  if ( sc.isFailure( ) ) {
1929  logstr << MSG::ERROR << "Cannot record TBTrigPat " << endmsg;
1930  }
1931  }
1932 
1933  if(unrec_code!=4){ // If object was not requested by the converter, store it in SG
1934  logstr << MSG::DEBUG << "Recording TBTailCatcherRaw with key " << m_keys[4] << endmsg;
1935  sc = evtStore()->record(m_tailcatchraw,m_keys[4]);
1936  if ( sc.isFailure( ) ) {
1937  logstr << MSG::ERROR << "Cannot record TailCatcherRaw " << endmsg;
1938  }
1939  }
1940 
1941  if(unrec_code!=5) { // If object was not requested by the converter, store it in SG
1942  logstr << MSG::DEBUG << "Recording TBBPCRawCont with key " << m_keys[5] << endmsg;
1943  // if(! evtStore()->contains<TBBPCRawCont>(m_keys[5])) {
1944  sc = evtStore()->record(m_bpcrawCont,m_keys[5]);
1945  if ( sc.isFailure( ) ) {
1946  logstr << MSG::ERROR << "Cannot record BPCRawCont" << endmsg;
1947  }
1948  // } else {
1949  // logstr << MSG::ERROR << " Object TBBPCRawCont already in SG (memory leak!)" << endmsg;
1950  // }
1951  }
1952 
1953  if(unrec_code!=6){ // If object was not requested by the converter, store it in SG
1954  logstr << MSG::DEBUG << "Recording TBScintillatorRawCont with key " << m_keys[6] << endmsg;
1955  // if(! evtStore()->contains<TBScintillatorRawCont>(m_keys[6])) {
1956  sc = evtStore()->record(m_scintrawCont,m_keys[6]);
1957  if ( sc.isFailure( ) ) {
1958  logstr << MSG::ERROR << "Cannot record ScintRawCont " << endmsg;
1959  }
1960  // } else {
1961  // logstr << MSG::ERROR << " Object TBScintillatorRawCont already in SG (memory leak!)" << endmsg;
1962  // }
1963  }
1964 
1965  if(unrec_code!=7){ // If object was not requested by the converter, store it in SG
1966  // if(! evtStore()->contains<TBMWPCRawCont>(m_keys[7])) {
1967  logstr << MSG::DEBUG << "record TBMWPCRawCont with key " << m_keys[7] <<endmsg;
1968  sc = evtStore()->record(m_mwpcrawCont,m_keys[7]);
1969  if ( sc.isFailure( ) ) {
1970  logstr << MSG::ERROR << "Cannot record MWPCRawCont " << endmsg;
1971  }
1972  // } else {
1973  // logstr << MSG::ERROR << " Object TBMWPCRawCont already in SG (memory leak!)" << endmsg;
1974  // }
1975  }
1976 
1977  // TDCRaw and ADCRaw are special since they are build from all
1978  // subfragments in H6. Record them slightly differently.
1979 
1980  if(unrec_code!=2){ // If object was not requested by the converter, store it in SG
1981  logstr << MSG::DEBUG << "record TDC cont with key " << m_keys[2] << endmsg;
1982  // if(! evtStore()->contains<TBTDCRawCont>(m_keys[2])) {
1983  sc = evtStore()->record(m_tdcrawCont,m_keys[2]);
1984  if ( sc.isFailure( ) ) {
1985  logstr << MSG::ERROR << "Cannot record TDCCont " << endmsg;
1986  }
1987  }
1988  // } else {
1989  // logstr << MSG::ERROR << " Object TBTDCRawCont already in SG (memory leak!)" << endmsg;
1990  // }
1991 
1992 
1993  if(unrec_code!=3){ // If object was not requested by the converter, store it in SG
1994  logstr << MSG::DEBUG << "record ADC cont with key " << m_keys[3] << endmsg;
1995  // if(! evtStore()->contains<TBADCRawCont>(m_keys[3])) {
1996  sc = evtStore()->record(m_adcrawCont,m_keys[3]);
1997  if ( sc.isFailure( ) ) {
1998  logstr << MSG::FATAL << "Cannot record ADCCont " << endmsg;
1999  }
2000  }
2001  // } else {
2002  // logstr << MSG::ERROR << " Object TBADCRawCont already in SG (memory leak!)" << endmsg;
2003  // }
2004 
2005  for(int c=10;c<14;c++){
2006  if(unrec_code!=c){ // If object was not requested by the converter, store it in SG
2007 
2008  logstr << MSG::DEBUG << "record TBLArDigitContainer with key " << m_keys[c] << " and size " << m_tblardigitcont[c-10]->size() << endmsg;
2009  sc = evtStore()->record(m_tblardigitcont[c-10],m_keys[c]);
2010  if ( sc.isFailure( ) ) {
2011  logstr << MSG::FATAL << "Cannot record " <<m_keys[c-10]<< endmsg;
2012  }
2013  }
2014  }
2015 
2016  for(int c=10;c<14;c++){
2017  if(unrec_code!=c){ // If object was not requested by the converter, store it in SG
2018 
2019  logstr << MSG::DEBUG << "record TBLArCalibDigitContainer with key " << m_keys[c] << " and size " << m_tblarcalibdigitcont[c-10]->size() << endmsg;
2020  sc = evtStore()->record(m_tblarcalibdigitcont[c-10],m_keys[c]);
2021  if ( sc.isFailure( ) ) {
2022  logstr << MSG::FATAL << "Cannot record " <<m_keys[c-10]<< endmsg;
2023  }
2024  }
2025  }
2026 
2027  if(unrec_code!=30){ // If object was not requested by the converter, store it in SG
2028  sc = evtStore()->record(m_eventinfo,"TBEventInfo");
2029  if ( sc.isFailure( ) ) {
2030  logstr << MSG::FATAL << "Cannot record TBEventInfo "<< endmsg;
2031  }
2032  }
2033  // } else {
2034  // logstr << MSG::ERROR << " Object TBADCRawCont already in SG (memory leak!)" << endmsg;
2035  // }
2036 
2037  logstr << MSG::DEBUG << " End of H6 Record " << endmsg;
2038 
2039  // Print run summary in text file
2040 
2041  return sc;
2042 
2043 }
TBByteStreamCnvTool::m_tableY
float m_tableY
Definition: TBByteStreamCnvTool.h:181
eformat
Definition: L1CaloBsDecoderUtil.h:11
TBTDCRaw
Definition: TBTDCRaw.h:21
plotBeamSpotCompare.x1
x1
Definition: plotBeamSpotCompare.py:215
xAOD::muon
@ muon
Definition: TrackingPrimitives.h:196
OFFLINE_FRAGMENTS_NAMESPACE::PointerType
const DataType * PointerType
Definition: RawEvent.h:25
TBByteStreamCnvTool::m_h8_triggword
unsigned int m_h8_triggword
Definition: TBByteStreamCnvTool.h:187
ReadCellNoiseFromCoolCompare.s1
s1
Definition: ReadCellNoiseFromCoolCompare.py:378
TBByteStreamCnvTool::m_boards
std::vector< int > m_boards
Definition: TBByteStreamCnvTool.h:141
S1
struct TBPatternUnitContext S1
TBByteStreamCnvTool::m_tailcatchraw
TBTailCatcherRaw * m_tailcatchraw
Definition: TBByteStreamCnvTool.h:134
scale2
#define scale2
Definition: JetAttributeHisto.cxx:42
TBByteStreamCnvTool::m_cryoX
float m_cryoX
Definition: TBByteStreamCnvTool.h:179
ReadCellNoiseFromCool.name1
name1
Definition: ReadCellNoiseFromCool.py:233
DeMoUpdate.tmp2
string tmp2
Definition: DeMoUpdate.py:1168
xAOD::word1
word1
Definition: eFexEMRoI_v1.cxx:87
TBBPCRaw
raw data class for BPC measurement
Definition: TBBPCRaw.h:33
TBByteStreamCnvTool::m_summary_path
std::string m_summary_path
Definition: TBByteStreamCnvTool.h:182
TBADCRaw
Definition: TBADCRaw.h:21
python.Constants.FATAL
int FATAL
Definition: Control/AthenaCommon/python/Constants.py:18
SG::ReadCondHandle
Definition: ReadCondHandle.h:40
xAOD::uint8_t
uint8_t
Definition: Muon_v1.cxx:553
TBByteStreamCnvTool::m_H8run
bool m_H8run
Definition: TBByteStreamCnvTool.h:103
TBMWPCRaw::addNwires
void addNwires(int nwire)
Definition: TBMWPCRaw.h:67
TBByteStreamCnvTool::m_firstsamples
std::vector< int > m_firstsamples
Definition: TBByteStreamCnvTool.h:145
TBByteStreamCnvTool::m_calib_error
bool m_calib_error
Definition: TBByteStreamCnvTool.h:170
xAOD::uint32_t
setEventNumber uint32_t
Definition: EventInfo_v1.cxx:127
Veto
struct TBPatternUnitContext Veto
TBByteStreamCnvTool::m_tbtdc
TBTDC * m_tbtdc
Definition: TBByteStreamCnvTool.h:127
calibdata.chamber
chamber
Definition: calibdata.py:31
initialize
void initialize()
Definition: run_EoverP.cxx:894
LArCalibLineMapping::calibSlotLine
const std::vector< HWIdentifier > & calibSlotLine(const HWIdentifier id) const
Definition: LArCalibLineMapping.cxx:15
TBByteStreamCnvTool::m_ByteStreamEventAccess
ServiceHandle< IByteStreamEventAccess > m_ByteStreamEventAccess
Definition: TBByteStreamCnvTool.h:91
S3
struct TBPatternUnitContext S3
TBH6ByteStream-Monitor-EventStorage.tdcmin
tdcmin
Definition: TBH6ByteStream-Monitor-EventStorage.py:143
CaloCondBlobAlgs_fillNoiseFromASCII.gain
gain
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:109
CaloTime_fillDB.gain2
gain2
Definition: CaloTime_fillDB.py:355
TBMWPCRawCont
Definition: TBMWPCRawCont.h:18
skel.it
it
Definition: skel.GENtoEVGEN.py:407
TBByteStreamCnvTool::m_keys
std::vector< std::string > m_keys
Definition: TBByteStreamCnvTool.h:106
TBByteStreamCnvTool.h
TBByteStreamCnvTool::m_lastEventID
EventID m_lastEventID
Definition: TBByteStreamCnvTool.h:93
TBByteStreamCnvTool::m_H6run
bool m_H6run
Definition: TBByteStreamCnvTool.h:102
TBMWPCRaw
Definition: TBMWPCRaw.h:23
TBByteStreamCnvTool::m_arrayofgain
CaloGain::CaloGain m_arrayofgain[128][4]
Definition: TBByteStreamCnvTool.h:147
TBByteStreamCnvTool::getCaloGain
CaloGain::CaloGain getCaloGain(int gain)
Definition: TBByteStreamCnvTool.h:150
RawEventWrite
OFFLINE_FRAGMENTS_NAMESPACE_WRITE::FullEventFragment RawEventWrite
data type for writing raw event
Definition: RawEvent.h:39
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
HWIdentifier
Definition: HWIdentifier.h:13
TBByteStreamCnvTool::interfaceID
static const InterfaceID & interfaceID()
Definition: TBByteStreamCnvTool.cxx:30
TBByteStreamCnvTool::m_theROB
OFFLINE_FRAGMENTS_NAMESPACE_WRITE::ROBFragment * m_theROB
Definition: TBByteStreamCnvTool.h:100
python.CaloAddPedShiftConfig.type
type
Definition: CaloAddPedShiftConfig.py:42
ReadCondHandle.h
AthenaPoolTestRead.sc
sc
Definition: AthenaPoolTestRead.py:27
RawEvent
OFFLINE_FRAGMENTS_NAMESPACE::FullEventFragment RawEvent
data type for reading raw event
Definition: RawEvent.h:37
TBByteStreamCnvTool::m_CLKey
SG::ReadCondHandleKey< LArCalibLineMapping > m_CLKey
Definition: TBByteStreamCnvTool.h:124
AthCommonDataStore< AthCommonMsg< AlgTool > >::detStore
const ServiceHandle< StoreGateSvc > & detStore() const
The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
Definition: AthCommonDataStore.h:95
TBByteStreamCnvTool::m_beam_moment
float m_beam_moment
Definition: TBByteStreamCnvTool.h:177
TBByteStreamCnvTool::m_rodBlock
std::vector< uint32_t > m_rodBlock
Definition: TBByteStreamCnvTool.h:95
TBByteStreamCnvTool::m_theRodBlock
std::vector< uint32_t > * m_theRodBlock
Definition: TBByteStreamCnvTool.h:99
TBByteStreamCnvTool::m_febgain
std::vector< int > m_febgain
Definition: TBByteStreamCnvTool.h:144
TBBeamDetector::setOverflow
virtual void setOverflow()
Definition: TBBeamDetector.h:51
PyPoolBrowser.item
item
Definition: PyPoolBrowser.py:129
TBByteStreamCnvTool::m_eventinfo
TBEventInfo * m_eventinfo
Definition: TBByteStreamCnvTool.h:135
TBByteStreamCnvTool::m_calib_pattern
unsigned char m_calib_pattern[16]
Definition: TBByteStreamCnvTool.h:167
AthCommonDataStore< AthCommonMsg< AlgTool > >::evtStore
ServiceHandle< StoreGateSvc > & evtStore()
The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
Definition: AthCommonDataStore.h:85
TBLArCalibDigitContainer
Liquid Argon Calibration Digit Container
Definition: TBLArCalibDigitContainer.h:26
TBByteStreamCnvTool::GetRODBlock
StatusCode GetRODBlock(eformat::SubDetector subdet_id, eformat::SubDetector subdet_rod_id=m_DontCheckRodSubDetID)
Definition: TBByteStreamCnvTool.cxx:395
histSizes.code
code
Definition: histSizes.py:129
TBByteStreamCnvTool::firstnbit
unsigned short firstnbit(int n, unsigned short w)
Definition: TBByteStreamCnvTool.h:197
LArOnlineID_Base::channel
int channel(const HWIdentifier id) const
Return the channel number of a hardware cell identifier channel = [0,127] in all FEB.
Definition: LArOnlineID_Base.cxx:1967
TBBeamDetector::setDetectorName
virtual void setDetectorName(const std::string &tbBeamDetectorName)
Definition: TBBeamDetector.h:48
FullCPAlgorithmsTest_eljob.sample
sample
Definition: FullCPAlgorithmsTest_eljob.py:116
StdJOSetup.msgSvc
msgSvc
Provide convenience handles for various services.
Definition: StdJOSetup.py:36
LArDigit
Liquid Argon digit base class.
Definition: LArDigit.h:25
TBByteStreamCnvTool::H6RecordObjects
StatusCode H6RecordObjects(int unrec_code)
Definition: TBByteStreamCnvTool.cxx:1913
TBByteStreamCnvTool::m_gains
std::vector< int > m_gains
Definition: TBByteStreamCnvTool.h:143
eformat::ROBFragment
Definition: L1CaloBsDecoderUtil.h:12
lumiFormat.i
int i
Definition: lumiFormat.py:85
ReadCellNoiseFromCool.chan
chan
Definition: ReadCellNoiseFromCool.py:52
TBByteStreamCnvTool::m_samples
std::vector< int > m_samples
Definition: TBByteStreamCnvTool.h:142
python.CaloCondTools.g
g
Definition: CaloCondTools.py:15
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
Definition: AthCommonDataStore.h:145
EventInfo::event_ID
EventID * event_ID()
the unique identification of the event.
Definition: EventInfo/EventInfo/EventInfo.h:224
TBByteStreamCnvTool::m_mwpcrawCont
TBMWPCRawCont * m_mwpcrawCont
Definition: TBByteStreamCnvTool.h:131
TBByteStreamCnvTool::m_tdcrawCont
TBTDCRawCont * m_tdcrawCont
Definition: TBByteStreamCnvTool.h:128
LArOnlineID_Base::channel_Id
HWIdentifier channel_Id(int barrel_ec, int pos_neg, int feedthrough, int slot, int channel) const
create channel identifier from fields
Definition: LArOnlineID_Base.cxx:1569
TBScintillatorRaw
Definition: TBScintillatorRaw.h:26
TBByteStreamCnvTool::WriteFragment
StatusCode WriteFragment()
Definition: TBByteStreamCnvTool.cxx:133
TBByteStreamCnvTool::m_isCalib
bool m_isCalib
Definition: TBByteStreamCnvTool.h:166
test_pyathena.parent
parent
Definition: test_pyathena.py:15
TBByteStreamCnvTool::secondword
unsigned short secondword(unsigned int w)
Definition: TBByteStreamCnvTool.h:193
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
TBByteStreamCnvTool::m_subdet_key
int m_subdet_key
Definition: TBByteStreamCnvTool.h:107
TBTDC::tdc
int tdc() const
Definition: TBTDC.h:28
TBTDCRawCont
Definition: TBTDCRawCont.h:21
TBByteStreamCnvTool::m_ev_number
int m_ev_number
Definition: TBByteStreamCnvTool.h:175
ReadFromCoolCompare.os
os
Definition: ReadFromCoolCompare.py:226
TBByteStreamCnvTool::ReadFragment
StatusCode ReadFragment(int unrec_code)
Definition: TBByteStreamCnvTool.cxx:262
TBTDC
Definition: TBTDC.h:17
TBTriggerPatternUnit::setTriggerWord
void setTriggerWord(unsigned int word)
Definition: TBTriggerPatternUnit.cxx:26
CaloTime_fillDB.gain1
gain1
Definition: CaloTime_fillDB.py:354
TBByteStreamCnvTool::NextSubFrag
bool NextSubFrag()
Definition: TBByteStreamCnvTool.h:114
TBByteStreamCnvTool::m_subfrag_firstdata
int m_subfrag_firstdata
Definition: TBByteStreamCnvTool.h:112
TBByteStreamCnvTool::H6BuildObjects
StatusCode H6BuildObjects(int unrec_code)
Definition: TBByteStreamCnvTool.cxx:502
OFFLINE_FRAGMENTS_NAMESPACE_WRITE::ROBFragment
eformat::write::ROBFragment ROBFragment
Definition: RawEvent.h:33
TBByteStreamCnvTool::initialize
virtual StatusCode initialize()
Definition: TBByteStreamCnvTool.cxx:59
TBByteStreamCnvTool::m_subfrag_id
int m_subfrag_id
Definition: TBByteStreamCnvTool.h:110
HWIdentifier.h
TBByteStreamCnvTool::m_trigpat
TBTriggerPatternUnit * m_trigpat
Definition: TBByteStreamCnvTool.h:132
TBByteStreamCnvTool::m_beam_part
std::string m_beam_part
Definition: TBByteStreamCnvTool.h:178
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:240
LArCalibDigit
Base class for LArDigits taken during calibration runs.
Definition: LArCalibDigit.h:29
TBByteStreamCnvTool::m_rdpSvc
ServiceHandle< IROBDataProviderSvc > m_rdpSvc
Definition: TBByteStreamCnvTool.h:92
TBByteStreamCnvTool::m_run_num
unsigned int m_run_num
Definition: TBByteStreamCnvTool.h:176
DataVector::push_back
value_type push_back(value_type pElem)
Add an element to the end of the collection.
SG::CondHandleKey::initialize
StatusCode initialize(bool used=true)
dqt_zlumi_alleff_HIST.B
B
Definition: dqt_zlumi_alleff_HIST.py:110
LArOnlineID
Definition: LArOnlineID.h:21
TBByteStreamCnvTool::m_force_Hchoice
bool m_force_Hchoice
Definition: TBByteStreamCnvTool.h:104
TBByteStreamCnvTool::BuildRODBlock
StatusCode BuildRODBlock(std::vector< uint32_t > *theRODBlock)
Definition: TBByteStreamCnvTool.cxx:191
TBByteStreamCnvTool::TBByteStreamCnvTool
TBByteStreamCnvTool(const std::string &type, const std::string &name, const IInterface *parent)
constructor
Definition: TBByteStreamCnvTool.cxx:40
TBByteStreamCnvTool::m_cryoAngle
float m_cryoAngle
Definition: TBByteStreamCnvTool.h:180
python.LumiBlobConversion.pos
pos
Definition: LumiBlobConversion.py:16
CaloGain::CaloGain
CaloGain
Definition: CaloGain.h:11
TBByteStreamCnvTool::m_onlineHelper
const LArOnlineID * m_onlineHelper
Definition: TBByteStreamCnvTool.h:96
TBMWPCRaw::addCwireno
void addCwireno(int cwire)
Definition: TBMWPCRaw.h:59
TBByteStreamCnvTool::m_tblarcalibdigitcont
TBLArCalibDigitContainer * m_tblarcalibdigitcont[4]
Definition: TBByteStreamCnvTool.h:137
python.CaloAddPedShiftConfig.default
default
Definition: CaloAddPedShiftConfig.py:43
CalibCoolCompareRT.nm
nm
Definition: CalibCoolCompareRT.py:109
python.CaloAddPedShiftConfig.int
int
Definition: CaloAddPedShiftConfig.py:45
TBEventInfo
Definition: TBEventInfo.h:27
TBTDC::tdcmin
int tdcmin() const
Definition: TBTDC.h:31
TBByteStreamCnvTool::m_calib_dac
uint16_t m_calib_dac
Definition: TBByteStreamCnvTool.h:168
python.Constants.INFO
int INFO
Definition: Control/AthenaCommon/python/Constants.py:15
TBByteStreamCnvTool::m_scintrawCont
TBScintillatorRawCont * m_scintrawCont
Definition: TBByteStreamCnvTool.h:133
TBByteStreamCnvTool::m_bpcrawCont
TBBPCRawCont * m_bpcrawCont
Definition: TBByteStreamCnvTool.h:130
re
const boost::regex re(r_e)
DEBUG
#define DEBUG
Definition: page_access.h:11
ReadCellNoiseFromCoolCompare.s2
s2
Definition: ReadCellNoiseFromCoolCompare.py:379
TBByteStreamCnvTool::m_calib_delay
uint16_t m_calib_delay
Definition: TBByteStreamCnvTool.h:169
S2
struct TBPatternUnitContext S2
EventID
This class provides a unique identification for each event, in terms of run/event number and/or a tim...
Definition: EventID.h:35
TBByteStreamCnvTool::H8BuildObjects
StatusCode H8BuildObjects(int unrec_code)
Definition: TBByteStreamCnvTool.cxx:1279
python.SystemOfUnits.s
float s
Definition: SystemOfUnits.py:147
TBByteStreamCnvTool::m_DontCheckRodSubDetID
static const eformat::SubDetector m_DontCheckRodSubDetID
Definition: TBByteStreamCnvTool.h:89
TBADCRaw::getADC
signal_type getADC() const
Definition: TBADCRaw.h:35
TBByteStreamCnvTool::finalize
virtual StatusCode finalize()
Definition: TBByteStreamCnvTool.cxx:122
python.Bindings.keys
keys
Definition: Control/AthenaPython/python/Bindings.py:801
merge.status
status
Definition: merge.py:16
TBTriggerPatternUnit
Definition: TBTriggerPatternUnit.h:27
scale1
#define scale1
Definition: JetAttributeHisto.cxx:41
TBByteStreamCnvTool::testbit
bool testbit(int n, unsigned short w)
Definition: TBByteStreamCnvTool.h:203
TBLArDigitContainer
Gaudi Class ID.
Definition: TBLArDigitContainer.h:40
TBByteStreamCnvTool::firstword
unsigned short firstword(unsigned int w)
Definition: TBByteStreamCnvTool.h:190
AthAlgTool
Definition: AthAlgTool.h:26
TBTailCatcherRaw
Definition: TBTailCatcherRaw.h:25
python.IoTestsLib.w
def w
Definition: IoTestsLib.py:198
TBMWPCRaw::setXchambers
void setXchambers(bool isX)
Definition: TBMWPCRaw.h:72
TBByteStreamCnvTool::m_subfrag_size
int m_subfrag_size
Definition: TBByteStreamCnvTool.h:111
CaloGain.h
TBByteStreamCnvTool::m_subdet_id
eformat::SubDetector m_subdet_id
Definition: TBByteStreamCnvTool.h:94
TBADCRawCont
Definition: TBADCRawCont.h:20
PrepareReferenceFile.outfile
outfile
Definition: PrepareReferenceFile.py:42
EventInfo
Definition: EventInfo.py:1
TBScintillatorRawCont
Definition: TBScintillatorRawCont.h:18
python.compressB64.c
def c
Definition: compressB64.py:93
DataVector::size
size_type size() const noexcept
Returns the number of elements in the collection.
TBScintillatorRaw::setSignals
void setSignals(const TBTDCRawCont *tdcCont, TBTDCRaw *tbtdc, const TBADCRawCont *adcCont, TBADCRaw *tbadc)
Definition: TBScintillatorRaw.cxx:20
TBBPCRaw::setSignals
void setSignals(const TBTDCRawCont *theTDCCont, const std::vector< const TBTDCRaw * > &theTDCs, const TBADCRawCont *theADCCont, const std::vector< const TBADCRaw * > &theADCs)
Definition: TBBPCRaw.cxx:35
TBByteStreamCnvTool::m_tblardigitcont
TBLArDigitContainer * m_tblardigitcont[4]
Definition: TBByteStreamCnvTool.h:136
TBByteStreamCnvTool::m_arrayofsample
std::vector< short > m_arrayofsample[128][4]
Definition: TBByteStreamCnvTool.h:146
IROBDataProviderSvc.h
LArOnlineID.h
TBBPCRawCont
Definition: TBBPCRawCont.h:17
TBByteStreamCnvTool::m_dump
bool m_dump
Definition: TBByteStreamCnvTool.h:105
TBByteStreamCnvTool::m_adcrawCont
TBADCRawCont * m_adcrawCont
Definition: TBByteStreamCnvTool.h:129
mapkey::key
key
Definition: TElectronEfficiencyCorrectionTool.cxx:37