ATLAS Offline Software
Loading...
Searching...
No Matches
LArRodBlockPhysicsV3 Class Reference

#include <LArRodBlockPhysicsV3.h>

Inheritance diagram for LArRodBlockPhysicsV3:
Collaboration diagram for LArRodBlockPhysicsV3:

Public Member Functions

 LArRodBlockPhysicsV3 ()
std::string BlockType ()
virtual void initializeFragment (std::vector< uint32_t > &fragment)
virtual void initializeFEB (const uint32_t id)
virtual void setNumberOfSamples (const uint8_t n)
virtual void setNumberOfGains (const uint8_t n)
virtual void setNextEnergy (const int channel, const int32_t energy, const int32_t time, const int32_t quality, const uint32_t gain)
virtual void setRawData (const int channel, const std::vector< short > &samples, const uint32_t gain)
virtual void setEx (double Ex)
virtual void setEy (double Ey)
virtual void setEz (double Ez)
virtual void finalizeFEB ()
virtual void concatinateFEBs ()
virtual void sortDataVector (std::vector< const LArRawChannel * > &)
virtual void sortDataVector (std::vector< const LArDigit * > &)
virtual bool canSetEnergy ()
virtual bool canSetRawData ()
template<class RAWDATA>
bool operator() (const RAWDATA *ch1, const RAWDATA *ch2) const
virtual void setEThreshold (uint16_t thres)
virtual void setOffTimeCut (uint16_t TimeCut)
virtual int setGain (const int)
virtual bool setPointers ()
virtual int getNextEnergy (int &channelNumber, int32_t &energy, int32_t &time, int32_t &quality, uint32_t &gain)
virtual int getNextRawData (int &channelNumber, std::vector< short > &samples, uint32_t &gain)
virtual uint32_t getNumberOfSamples () const
virtual uint32_t getNumberOfGains () const
virtual uint32_t getRadd (uint32_t adc, uint32_t sample) const
virtual uint16_t getCtrl1 (uint32_t adc) const
virtual uint16_t getCtrl2 (uint32_t adc) const
virtual uint16_t getCtrl3 (uint32_t adc) const
virtual uint32_t getStatus () const
virtual uint16_t getNumberOfHotCells () const
virtual uint16_t getNumberOfHotCellsInTime () const
virtual uint16_t getHotCellThreshold () const
virtual uint16_t getOfftimeThreshold () const
virtual int32_t getEx () const
virtual int32_t getEy () const
virtual int32_t getEz () const
virtual uint16_t getHottestCellIndex ()
virtual uint32_t getHottestCellEnergy () const
virtual uint32_t hasPhysicsBlock () const
virtual uint32_t hasRawDataBlock () const
virtual uint32_t hasControlWordBlock () const
template<class RAWDATA>
bool operator() ()(const RAWDATA *ch1
virtual void sortDataVector (std::vector< const LArCalibDigit * > &)
virtual void sortDataVector (std::vector< const LArAccumulatedCalibDigit * > &)
virtual void sortDataVector (std::vector< const LArAccumulatedDigit * > &)
virtual void setTDCPhase (const uint8_t n)
virtual void setRawDataFixed (const int channel, const std::vector< short > &samples, const uint32_t gain)
virtual void setEtQ (const int channel, const int32_t energy, const int32_t time, const int32_t quality, const uint32_t gain)
virtual void setDAC (const uint16_t DACValue)
virtual void setDelay (const uint16_t DelayValue)
virtual void setPulsed (const unsigned channelNumber)
virtual void setNTrigger (const uint16_t NTrigger)
virtual void setSumE (double)
virtual bool canSetRawDataFixed ()
virtual bool canSetCalibration ()
virtual bool canSetNTrigger ()
virtual bool canIncludeRawData ()
bool setFragment (const uint32_t *p, uint32_t n)
bool nextFEB ()
uint32_t getNumberOfWords () const
uint32_t getFEBID () const
uint32_t getFEBSN () const
virtual int32_t getSumE () const
virtual uint32_t getVROBFebId ()
virtual int32_t getVROBEx () const
virtual int32_t getVROBEy () const
virtual int32_t getVROBEz () const
virtual int32_t getVROBSumE () const
virtual uint32_t hasCalibBlock () const
virtual uint32_t hasAccumBlock () const
virtual uint32_t hasControlWords () const
virtual int getNextAccumulatedCalibDigit (int &channelNumber, std::vector< uint64_t > &SamplesSum, std::vector< uint64_t > &Samples2Sum, uint32_t &nStepTriggers, uint32_t &gain)
virtual int getNextAccumulatedDigit (int &channelNumber, std::vector< uint64_t > &SamplesSum, std::vector< uint64_t > &corr2Sum, uint32_t &gain)
virtual bool getPulsed (unsigned channelNumber) const
virtual uint16_t getDAC () const
virtual uint16_t getDelay () const
virtual uint16_t getNTrigger () const
virtual uint16_t getStepIndex () const
virtual uint16_t getNStep () const
virtual uint8_t getTDCPhase () const
virtual uint16_t getResults1Size () const
virtual uint16_t getResults2Size () const
virtual uint16_t getRawDataSize () const
virtual uint16_t getNbSweetCells1 () const
virtual uint16_t getNbSweetCells2 () const
virtual uint32_t getDspCodeVersion () const
virtual int32_t getDspEventCounter () const
virtual uint32_t onlineCheckSum () const
virtual uint32_t offlineCheckSum () const
virtual int setFragmentVirtualROB (const uint32_t *p, uint32_t n)
virtual void dumpFragment ()
void setFirstSample (const int rearrangeFirstSample)
uint32_t RawToOfflineGain (const uint32_t gain) const
uint32_t OfflineToRawGain (const uint32_t gain) const
bool report_error (void) const

Protected Types

enum  {
  NWTot , NWTot_h , FEBID , FEBID_h ,
  FEB_SN , FEB_SN_h , NGainNSamples , SumBlkOffset ,
  CounterBlkOffset , EBlkOffset , GainBlkOffset , FebInfoBlkOffset ,
  TimeQualityBlkOffset , RawDataBlkOffset , Status2 , Status1 ,
  BCID , EventID , endtag
}
enum  {
  NWTot , NWTot_h , FEBID , FEBID_h ,
  FEBSN , FEBSN_h , endtag
}
typedef std::map< uint32_t, std::vector< uint32_t > > FEBMAPTYPE

Protected Member Functions

void setHeader16 (const unsigned n, const uint16_t w)
void setHeader32 (const unsigned n, const uint32_t w)
uint16_t getVectorHeader16 (const unsigned n) const
uint32_t getVectorHeader32 (const unsigned n) const
uint16_t getHeader16 (const unsigned n) const
uint32_t getHeader32 (const unsigned n) const
uint16_t LE_getHeader16 (const unsigned n) const
void LE_setHeader16 (const unsigned n, const uint16_t w)
uint16_t LE_getVectorHeader16 (const unsigned n) const
void setBit (uint32_t *const p, const unsigned chan)
int getBit (const uint32_t *const p, const unsigned chan) const

Protected Attributes

int32_t m_Ex
int32_t m_Ey
int32_t m_Ez
int32_t m_SumE
uint32_t m_numberOfEx
uint32_t m_numberOfEy
uint32_t m_numberOfEz
uint32_t m_numberOfSumE
unsigned short m_iHeadBlockSize
int m_channelsPerFEB
const uint32_t * m_FebBlock
const uint32_t * m_RodBlock
int32_t m_FebBlockSize
int32_t m_RodBlockSize
std::vector< uint32_t > * m_vFragment
std::vector< uint32_t > * m_pRODblock
FEBMAPTYPE m_mFebBlocks
int32_t m_MiddleHeaderSize
unsigned int m_rearrangeFirstSample
bool m_error_next_feb
uint32_t m_virtualROBJump
int32_t m_ROB_to_decode
const uint32_t * m_virtualROBPointer
const uint32_t * m_virtualROBPointerLocal

Static Protected Attributes

static const uint32_t m_RawToOfflineGainMap [4] ={0, 2, 1,0}
static const uint32_t m_OfflineToRawGainMap [3] ={3,2,1}

Private Member Functions

void clearBlocks ()
virtual void resetPointers ()
int FebToRodChannel (int ch) const
void setNextEnergy (const uint16_t energy, const int16_t time, const int16_t quality, const uint32_t gain)

Private Attributes

std::vector< uint32_t > m_SumBlkBlock
std::vector< uint32_t > m_CounterBlkBlock
std::vector< uint32_t > m_EnergyBlock
std::vector< uint32_t > m_GainBlock
std::vector< uint32_t > m_FebInfoBlock
std::vector< uint32_t > m_TimeQualityBlock
std::vector< uint32_t > m_RawDataBlock
int m_RawDataCounter = 0
int m_RawDataIndex = 0
int m_CounterIndex = 0
int m_EnergyIndex = 0
int m_FebInfoIndex = 0
int m_GainIndex = 0
int m_TimeQualityIndex = 0
int m_SumBlkIndex = 0
const uint32_t * m_SumBlkPtr
const uint16_t * m_CounterPtr
const uint16_t * m_EnergyPtr
const int16_t * m_TimeQualityPtr
const uint32_t * m_GainPtr
const int16_t * m_FebInfoDataPtr
const int16_t * m_RawDataPtr
const uint32_t * m_RawDataFlagsPtr
int m_NSumBlkWords
int m_NCounterBlkWords
int m_NEnergyBlkWords
int m_NGainBlkWords
int m_NFebInfoBlkWords
int m_NFlaggingWords
uint16_t m_numberHotCell = 0U
uint16_t m_numberHotCellOffTime = 0U
uint16_t m_EnergyThreshold
int16_t m_OffTimeCut
uint16_t m_HottestCellIndex
uint32_t m_HottestCellEnergy
const LArOnlineIDm_onlineHelper
MsgStream m_logstr

Static Private Attributes

static const uint32_t m_DummyBitMap [4] ={0,0,0,0}

Detailed Description

Definition at line 49 of file LArRodBlockPhysicsV3.h.

Member Typedef Documentation

◆ FEBMAPTYPE

typedef std::map<uint32_t, std::vector<uint32_t> > LArRodBlockStructure::FEBMAPTYPE
protectedinherited

Definition at line 233 of file LArRodBlockStructure.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
protectedinherited
Enumerator
NWTot 
NWTot_h 
FEBID 
FEBID_h 
FEBSN 
FEBSN_h 
endtag 

Definition at line 51 of file LArRodBlockStructure.h.

51 {
52 NWTot, // Number of words in DSP block
53 NWTot_h,
54 FEBID, // FEB ID
55 FEBID_h,
56 FEBSN, // FEB Serial Number
57 FEBSN_h,
58 endtag // This tag needs to be an odd number, see *) for constructor
59 };

◆ anonymous enum

anonymous enum
protected
Enumerator
NWTot 
NWTot_h 
FEBID 
FEBID_h 
FEB_SN 
FEB_SN_h 
NGainNSamples 
SumBlkOffset 
CounterBlkOffset 
EBlkOffset 
GainBlkOffset 
FebInfoBlkOffset 
TimeQualityBlkOffset 
RawDataBlkOffset 
Status2 
Status1 
BCID 
EventID 
endtag 

Definition at line 57 of file LArRodBlockPhysicsV3.h.

57 {
58 NWTot,
59 NWTot_h,
60 FEBID,
61 FEBID_h,
62 FEB_SN,
64 NGainNSamples, // number of samples sent by the FEB and used at the raw data level in the dsp to apply Optimal Filtering
65 SumBlkOffset, // summary block offset (fixed length)
66 CounterBlkOffset, // counter block offset (fixed length)
67 EBlkOffset, // Energy block offset (fixed length)
68 GainBlkOffset, // Gain block offset (fixed length)
69 FebInfoBlkOffset, // Technical FEB information usefull for offline correction
70 TimeQualityBlkOffset, // Time and quality variable length block
71 RawDataBlkOffset, // Raw data block offset
72 Status2, // This element and the ones below this are not used by the converter
73 Status1,
74 BCID,
75 EventID,
76 // endtag1, // remove if the number of words is even
77 endtag
78 };

Constructor & Destructor Documentation

◆ LArRodBlockPhysicsV3()

LArRodBlockPhysicsV3::LArRodBlockPhysicsV3 ( )

Definition at line 37 of file LArRodBlockPhysicsV3.cxx.

39{
40 // retrieve onlineHelper
41 const LArOnlineID* online_id;
42 SmartIF<StoreGateSvc> detStore{Gaudi::svcLocator()->service("DetectorStore")};
43 if (!detStore) {
44 m_logstr << MSG::ERROR << "Unable to locate DetectorStore" << endmsg;
45 std::abort();
46 }
47 StatusCode sc = detStore->retrieve(online_id, "LArOnlineID");
48 if (sc.isFailure()) {
49 m_logstr << MSG::FATAL << "Could not get LArOnlineID helper !" << endmsg;
50 std::abort();
51 }
52 else {
53 m_onlineHelper=online_id;
54 m_logstr << MSG::DEBUG << " Found the LArOnlineID helper. " << endmsg;
55 }
56
57 m_iHeadBlockSize=endtag/2; // The implicit cast rounds down to the right size
58 m_NSumBlkWords=4; // BL : words of 32 bits here
61 m_NEnergyBlkWords=128*16/32;
62 m_NGainBlkWords=128*2/32;
63
64 // Move this to properties of the algorithm but set default values.
65 m_EnergyThreshold = 100; // MeV
66 m_OffTimeCut = 30; // ns
67
69
71 m_vFragment=NULL;
72 m_FebBlock=NULL;
73 m_pRODblock=NULL;
74
75 m_Ex=0;
76 m_Ey=0;
77 m_Ez=0;
78 m_HottestCellIndex=255; // 255 is unphysical since cells index are between 0 and 127 per FEB.
80
81 m_CounterPtr=NULL;
82 m_EnergyPtr=NULL;
84 m_GainPtr=NULL;
86 m_RawDataPtr=NULL;
87 m_SumBlkPtr=NULL;
89}
#define endmsg
static Double_t sc
const int16_t * m_TimeQualityPtr
const LArOnlineID * m_onlineHelper
const uint16_t * m_CounterPtr
const int16_t * m_FebInfoDataPtr
const uint32_t * m_RawDataFlagsPtr
std::vector< uint32_t > * m_pRODblock
std::vector< uint32_t > * m_vFragment
IMessageSvc * getMessageSvc(bool quiet=false)
::StatusCode StatusCode
StatusCode definition for legacy code.

Member Function Documentation

◆ BlockType()

std::string LArRodBlockPhysicsV3::BlockType ( )
inline

Definition at line 81 of file LArRodBlockPhysicsV3.h.

81{ return std::string("RodBlockPhysicsV3");}

◆ canIncludeRawData()

virtual bool LArRodBlockStructure::canIncludeRawData ( )
inlinevirtualinherited

Reimplemented in LArRodBlockPhysicsV5, and LArRodBlockPhysicsV6.

Definition at line 101 of file LArRodBlockStructure.h.

101{return false;}

◆ canSetCalibration()

virtual bool LArRodBlockStructure::canSetCalibration ( )
inlinevirtualinherited

◆ canSetEnergy()

virtual bool LArRodBlockPhysicsV3::canSetEnergy ( )
inlinevirtual

Reimplemented from LArRodBlockStructure.

Definition at line 102 of file LArRodBlockPhysicsV3.h.

102{ return true;}

◆ canSetNTrigger()

virtual bool LArRodBlockStructure::canSetNTrigger ( )
inlinevirtualinherited

Definition at line 100 of file LArRodBlockStructure.h.

100{return false;}

◆ canSetRawData()

virtual bool LArRodBlockPhysicsV3::canSetRawData ( )
inlinevirtual

Reimplemented from LArRodBlockStructure.

Definition at line 103 of file LArRodBlockPhysicsV3.h.

103{return true;}

◆ canSetRawDataFixed()

virtual bool LArRodBlockStructure::canSetRawDataFixed ( )
inlinevirtualinherited

Reimplemented in LArRodBlockTransparentV0< DSPHEADER >.

Definition at line 98 of file LArRodBlockStructure.h.

98{return false;}

◆ clearBlocks()

void LArRodBlockPhysicsV3::clearBlocks ( )
private

Definition at line 92 of file LArRodBlockPhysicsV3.cxx.

93{
94 m_SumBlkBlock.clear();
95 m_CounterBlkBlock.clear();
96 m_EnergyBlock.clear();
97 m_GainBlock.clear();
98 m_TimeQualityBlock.clear();
99 m_RawDataBlock.clear();
100 m_FebInfoBlock.clear();
101}
std::vector< uint32_t > m_EnergyBlock
std::vector< uint32_t > m_RawDataBlock
std::vector< uint32_t > m_CounterBlkBlock
std::vector< uint32_t > m_SumBlkBlock
std::vector< uint32_t > m_TimeQualityBlock
std::vector< uint32_t > m_GainBlock
std::vector< uint32_t > m_FebInfoBlock

◆ concatinateFEBs()

void LArRodBlockPhysicsV3::concatinateFEBs ( )
virtual

Reimplemented from LArRodBlockStructure.

Definition at line 676 of file LArRodBlockPhysicsV3.cxx.

677{
678 //std::cout << "Concatinating FEBs. Have "<< m_mFebBlocks.size() <<" febs." << std::endl;
679 FEBMAPTYPE::const_iterator feb_it_b=m_mFebBlocks.begin();
680 FEBMAPTYPE::const_iterator feb_it_e=m_mFebBlocks.end();
681 FEBMAPTYPE::const_iterator feb_it;
682 for (feb_it=feb_it_b;feb_it!=feb_it_e;++feb_it) {
683 if (feb_it!=feb_it_b) //Not first Feb
684/*
685 if (fullHeader) {//Add middle header
686 m_pRODblock->push_back(fullHeader->version().full());//Format Version number
687 m_pRODblock->push_back(fullHeader->source_id()); //Source identifer
688 m_pRODblock->push_back(fullHeader->run_no());
689 m_pRODblock->push_back(fullHeader->lvl1_id()); //Level 1 identifer
690 m_pRODblock->push_back(fullHeader->bc_id()); //Bunch Crossing identifer
691 m_pRODblock->push_back(fullHeader->lvl1_type()); //Level 1 trigger type
692 m_pRODblock->push_back(fullHeader->detev_type()); //Detector event type
693 }
694 else //No ROD-Header
695*/
697
698 //Add feb data to rod data block
699 m_pRODblock->insert (m_pRODblock->end(),
700 feb_it->second.begin(), feb_it->second.end());
701 } //end for feb_it
702
703 m_mFebBlocks.clear();
704 return;
705}

◆ dumpFragment()

void LArRodBlockStructure::dumpFragment ( )
virtualinherited

Definition at line 175 of file LArRodBlockStructure.cxx.

176{
177 std::cout << "Error: Function dumpFragment() not implemented in this instance of LArRodBlockStructure!\n";
178 return;
179}

◆ FebToRodChannel()

int LArRodBlockPhysicsV3::FebToRodChannel ( int ch) const
inlineprivatevirtual

Reimplemented from LArRodBlockStructure.

Definition at line 211 of file LArRodBlockPhysicsV3.h.

213{return (ch>>3) + ((ch&0x7)<<4);
214// return ch;
215}

◆ finalizeFEB()

void LArRodBlockPhysicsV3::finalizeFEB ( )
virtual

Reimplemented from LArRodBlockStructure.

Definition at line 496 of file LArRodBlockPhysicsV3.cxx.

497{
498//Complete non-complete Energy block
500 setNextEnergy((uint16_t)0,(int16_t)32767,(int32_t)-32767,(uint32_t)0);//E=0,t=32767,q=-32767,G=0
501
502 uint16_t n;
503 uint16_t BlockOffset;
504
505 // Summary block....
506 n = m_SumBlkBlock.size();
508 //Check if Summary Block exists and is not yet part of the fragment
509 LARBSDBG("Checking for Summary Block n=" << n << "BlockOffset=" << BlockOffset);
510 if (n && !BlockOffset)
511 {
514 m_logstr << MSG::DEBUG << "In finalizeFEB-------------------->>>>> " << "Checking for Summary Block : length= " << n << " BlockOffset=" << BlockOffset << endmsg;
515 for (unsigned i=0;i<n;i++)
516 m_vFragment->push_back(m_SumBlkBlock[i]);
517 }
518
519 // Counter block....
520
521 // fill info from counters
522 ShortLong twoValues{};
523 twoValues.s[0]=(uint16_t)m_numberHotCell;
524 twoValues.s[1]=(uint16_t)m_numberHotCellOffTime;
525 m_CounterBlkBlock.push_back(twoValues.l);
526
527 twoValues.s[0]=(uint16_t)m_EnergyThreshold;
528 twoValues.s[1]=(uint16_t)m_OffTimeCut;
529 m_CounterBlkBlock.push_back(twoValues.l);
530
531 // Write the Energy threshold used to determine which cell is a hot cell in the first
532 // 32 bit word of the counters
533 // Write the Energy Ex of the ROD block in a 32 bits word
534 // Write the Energy Ey of the ROD block in a 32 bits word
535 // Ex and Ey have to be 32 bits words as they are sums of multiple 16 bits words
536
537
538
539
540/* uint32_t aux;
541 aux = abs(m_Ex);
542 if (m_Ex<0) aux|=0x80000000;
543 m_CounterBlkBlock.push_back(aux);
544 aux = abs(m_Ey);
545 if (m_Ey<0) aux|=0x80000000;
546 m_CounterBlkBlock.push_back(aux);
547*/
548
549 uint32_t* aux = (uint32_t*)&m_Ex;
550 m_CounterBlkBlock.push_back(*aux);
551 aux = (uint32_t*)&m_Ey;
552 m_CounterBlkBlock.push_back(*aux);
553
554 // write the hottest cell index for that FEB and its energy in MeV
555
556 twoValues.s[0]=(uint16_t)((m_HottestCellIndex<<9)|((uint16_t)((m_HottestCellEnergy>>16))&0x01FF));
557 twoValues.s[1]=(uint16_t)m_HottestCellEnergy;
558 m_CounterBlkBlock.push_back(twoValues.l);
559
560 aux = (uint32_t*)&m_Ez;
561 m_CounterBlkBlock.push_back(*aux);
562
563 n = m_CounterBlkBlock.size();
565 //Check if Counter Block exists and is not yet part of the fragment
566 LARBSDBG("Checking for Counter Block n=" << n << "BlockOffset=" << BlockOffset);
567 if (n && !BlockOffset)
568 {
571 m_logstr << MSG::INFO << "In finalyseFEB-------------------->>>>> " << "Checking for Counter Block : length= " << n << " BlockOffset=" << BlockOffset << endmsg;
572 for (unsigned i=0;i<n;i++)
573 m_vFragment->push_back(m_CounterBlkBlock[i]);
574 }
575
576 // Energy block...
577 n = m_EnergyBlock.size();
578 BlockOffset=LE_getVectorHeader16(EBlkOffset);
579 LARBSDBG("Checking Energy Block n=" << n << "BlockOffset=" << BlockOffset);
580 //Check if Energy-Block exists and is not yet part of the fragment
581 if (n && !BlockOffset)
582 {
584 BlockOffset=LE_getVectorHeader16(EBlkOffset);
585 m_logstr << MSG::DEBUG << "In finalyseFEB-------------------->>>>> " << "Checking for Energy Block : length= " << n << " BlockOffset=" << BlockOffset << endmsg;
586 //m_logstr << MSG::DEBUG << "In finalyseFEB-------------------->>>>> " << "Checking for Energy Block : m_EnergyIndex= " << m_EnergyIndex << endmsg;
587 for(unsigned int i=0;i<n;i++)
588 m_vFragment->push_back(m_EnergyBlock[i]);
589 }
590
591 // Gain block...
592 n = m_GainBlock.size();
594 LARBSDBG("Checking Gain Block n=" << n << "BlockOffset=" << BlockOffset);
595 //Check if Gain-Block exists and is not yet part of the fragment
596 if (n && !BlockOffset)
597 {
600 //m_logstr << MSG::DEBUG << "In finalyseFEB-------------------->>>>> " << "Checking for Gain Block : length= " << n << " BlockOffset=" << BlockOffset << endmsg;
601 for(unsigned int i=0;i<n;i++)
602 m_vFragment->push_back(m_GainBlock[i]);
603 }
604
605
606 // FeBInfo Block... // offline encoder just put dummy info there
607 for (int nword=0; nword<m_NFebInfoBlkWords ; nword++)
608 m_FebInfoBlock.push_back(0L);
609
610 n = m_FebInfoBlock.size();
612 LARBSDBG("Checking FebInfo Block n=" << n << "BlockOffset=" << BlockOffset);
613 //Check if Gain-Block exists and is not yet part of the fragment
614 if (n && !BlockOffset)
615 {
618 //m_logstr << MSG::DEBUG << "In finalyseFEB-------------------->>>>> " << "Checking for FEB Info Block : length= " << n << " BlockOffset=" << BlockOffset << endmsg;
619 for(unsigned int i=0;i<n;i++)
620 m_vFragment->push_back(m_FebInfoBlock[i]);
621 }
622
623 // Time and Quality block
624 n = m_TimeQualityBlock.size();
626 LARBSDBG("Checking Time and Quality Block n=" << n << "BlockOffset=" << BlockOffset);
627 //Check if Time and Quality Block exists and is not yet part of the fragment
628 if (n && !BlockOffset)
629 {
632 m_logstr << MSG::DEBUG << "In finalyseFEB-------------------->>>>> " << "Checking for Time and Quality Block : length= " << n << " BlockOffset=" << BlockOffset << endmsg;
633 for(unsigned int i=0;i<n;i++)
634 m_vFragment->push_back(m_TimeQualityBlock[i]);
635 }
636
637 // Raw data
638 LARBSDBG("Checking Raw Data Block");
639 n = m_RawDataBlock.size();
641 LARBSDBG("Checking Raw Data Block. n=" << n << "BlockOffset=" << BlockOffset);
642 //Check if Raw Data block exists and is not yet part of the fragment
643 if ((n>m_NFlaggingWords) && (!BlockOffset))
644 {
646 for(unsigned int i=0;i<n;i++)
647 m_vFragment->push_back(m_RawDataBlock[i]);
648 }
650
651 // m_logstr << MSG::DEBUG << "############################################################################>>>>> " << endmsg;
652 // m_logstr << MSG::DEBUG << "In finalyseFEB-------------------->>>>> Ofsets summary (en hexa) : " << endmsg;
653 // m_logstr << MSG::DEBUG << "Summary Block Offset : " << LE_getVectorHeader16(SumBlkOffset) << endmsg;
654 // m_logstr << MSG::DEBUG << "Counter Block Offset : " << LE_getVectorHeader16(CounterBlkOffset) << endmsg;
655 // m_logstr << MSG::DEBUG << "Energy Block Offset : " << LE_getVectorHeader16(EBlkOffset) << endmsg;
656 // m_logstr << MSG::DEBUG << "Gain Block Offset : " << LE_getVectorHeader16(GainBlkOffset) << endmsg;
657 // m_logstr << MSG::DEBUG << "Gain Block Offset : " << LE_getVectorHeader16(FebInfoBlkOffset) << endmsg;
658 // m_logstr << MSG::DEBUG << "Raw Data Block Offset: " << LE_getVectorHeader16(RawDataBlkOffset) << endmsg;
659 // m_logstr << MSG::DEBUG << "Number of hot cells : " << m_numberHotCell << endmsg;
660 // m_logstr << MSG::DEBUG << "############################################################################>>>>> " << endmsg;
661
662 m_logstr << MYLEVEL << "***********************************************************************"<< endmsg;
663 m_logstr << MYLEVEL << "m_HottestCellIndex : "<< m_HottestCellIndex << endmsg;
664 m_logstr << MYLEVEL << "m_HottestCellEnergy : "<< m_HottestCellEnergy << endmsg;
665 m_logstr << MYLEVEL << "***********************************************************************"<< endmsg;
666 m_logstr << MYLEVEL << "m_Ex : "<< m_Ex << endmsg;
667 m_logstr << MYLEVEL << "m_Ey : "<< m_Ey << endmsg;
668 m_logstr << MYLEVEL << "***********************************************************************"<< endmsg;
669
670
671 clearBlocks();
672 return;
673}
#define LARBSDBG(text)
This class provides decoding/encoding from/to ROD format.
#define MYLEVEL
virtual void setNextEnergy(const int channel, const int32_t energy, const int32_t time, const int32_t quality, const uint32_t gain)
void setHeader32(const unsigned n, const uint32_t w)
uint16_t LE_getVectorHeader16(const unsigned n) const
void LE_setHeader16(const unsigned n, const uint16_t w)
setWord1 uint16_t
setEventNumber uint32_t

◆ getBit()

int LArRodBlockStructure::getBit ( const uint32_t *const p,
const unsigned chan ) const
inlineprotectedinherited

Definition at line 433 of file LArRodBlockStructure.h.

434{// chan = (0,127)
435 // int a = chan/32;
436 // int r = chan%32;
437 int a = chan>>5;
438 int r = chan&0x1f;
439 // a = (0,3), r = ( 0, 31 )
440 return (*(p+a)>>r) & 0x1;
441}
static Double_t a
int r
Definition globals.cxx:22

◆ getCtrl1()

uint16_t LArRodBlockPhysicsV3::getCtrl1 ( uint32_t adc) const
virtual

Reimplemented from LArRodBlockStructure.

Definition at line 813 of file LArRodBlockPhysicsV3.cxx.

814{
817 x=x>>16;
818 uint16_t ctrl=x;
819 return ctrl;
820}
#define x
uint16_t LE_getHeader16(const unsigned n) const
str index
Definition DeMoScan.py:362

◆ getCtrl2()

uint16_t LArRodBlockPhysicsV3::getCtrl2 ( uint32_t adc) const
virtual

Reimplemented from LArRodBlockStructure.

Definition at line 822 of file LArRodBlockPhysicsV3.cxx.

823{
826 x=x&0xffff;
827 uint16_t ctrl=x;
828 return ctrl;
829}

◆ getCtrl3()

uint16_t LArRodBlockPhysicsV3::getCtrl3 ( uint32_t adc) const
virtual

Reimplemented from LArRodBlockStructure.

Definition at line 831 of file LArRodBlockPhysicsV3.cxx.

832{
835 x=x>>16;
836 uint16_t ctrl=x;
837 return ctrl;
838}

◆ getDAC()

uint16_t LArRodBlockStructure::getDAC ( ) const
inlinevirtualinherited

Reimplemented in LArRodBlockCalibrationV0< DSPHEADER >, LArRodBlockCalibrationV1, LArRodBlockCalibrationV2, and LArRodBlockCalibrationV3.

Definition at line 468 of file LArRodBlockStructure.h.

469{
470 std::cout << "Error: Function getDAC not implemented in this instance of LArRodBlockStructure!\n";
471 return 0;
472}

◆ getDelay()

uint16_t LArRodBlockStructure::getDelay ( ) const
inlinevirtualinherited

Reimplemented in LArRodBlockCalibrationV0< DSPHEADER >, LArRodBlockCalibrationV1, LArRodBlockCalibrationV2, and LArRodBlockCalibrationV3.

Definition at line 474 of file LArRodBlockStructure.h.

475{
476 std::cout << "Error: Function getDelay not implemented in this instance of LArRodBlockStructure!\n";
477 return 0;
478}

◆ getDspCodeVersion()

uint32_t LArRodBlockStructure::getDspCodeVersion ( ) const
virtualinherited

Definition at line 258 of file LArRodBlockStructure.cxx.

259{
260 int i=getNumberOfWords()-2;
261 return m_FebBlock[i];
262}
uint32_t getNumberOfWords() const

◆ getDspEventCounter()

int32_t LArRodBlockStructure::getDspEventCounter ( ) const
virtualinherited

Definition at line 264 of file LArRodBlockStructure.cxx.

265{
266 int i=getNumberOfWords()-1;
267 return m_FebBlock[i];
268}

◆ getEx()

int32_t LArRodBlockPhysicsV3::getEx ( ) const
inlinevirtual

Reimplemented from LArRodBlockStructure.

Definition at line 315 of file LArRodBlockPhysicsV3.h.

316{
317/* int32_t ex;
318 uint16_t aux;
319 aux = *(m_CounterPtr+4);
320 ex = (int32_t)((*(m_CounterPtr+5)<<16)|(aux & (~(1<<16))));
321 ex=(ex&0x01FFFFFF);
322 if ((*(m_CounterPtr+5))&(1<<15)) // number id negative
323 ex = -ex;
324 return ex;*/
325 const uint32_t* copy32u = reinterpret_cast<const uint32_t*>(m_CounterPtr+4);
326 return *copy32u;
327}

◆ getEy()

int32_t LArRodBlockPhysicsV3::getEy ( ) const
inlinevirtual

Reimplemented from LArRodBlockStructure.

Definition at line 329 of file LArRodBlockPhysicsV3.h.

330{
331/* int32_t ey;
332 uint16_t aux;
333 aux = *(m_CounterPtr+6);
334 ey = (int32_t)((*(m_CounterPtr+7)<<16)|(aux & (~(1<<16))));
335 ey=(ey&0x01FFFFFF);
336 if ((*(m_CounterPtr+7))&(1<<15)) // number id negative
337 ey = -ey;
338 return ey;*/
339 const uint32_t* copy32u = reinterpret_cast<const uint32_t*>(m_CounterPtr+6);
340 return *copy32u;
341}

◆ getEz()

int32_t LArRodBlockPhysicsV3::getEz ( ) const
inlinevirtual

Reimplemented from LArRodBlockStructure.

Definition at line 343 of file LArRodBlockPhysicsV3.h.

344{
345 const uint32_t* aux = reinterpret_cast<const uint32_t*>(m_CounterPtr+10);
346 return *aux;
347}

◆ getFEBID()

uint32_t LArRodBlockStructure::getFEBID ( ) const
inlineinherited

Definition at line 297 of file LArRodBlockStructure.h.

298{return getHeader32(FEBID);}
uint32_t getHeader32(const unsigned n) const

◆ getFEBSN()

uint32_t LArRodBlockStructure::getFEBSN ( ) const
inlineinherited

Definition at line 300 of file LArRodBlockStructure.h.

301{return getHeader32(FEBSN);}

◆ getHeader16()

uint16_t LArRodBlockStructure::getHeader16 ( const unsigned n) const
inlineprotectedinherited

Definition at line 355 of file LArRodBlockStructure.h.

356{
357 // std::cout << "getHeader16: " << m_FebBlock << " " << m_FebBlock[5] << " "
358 // << n << " " << (n>>1) << " " << (m_FebBlock[5]&0xffff) << std::endl;
359 if (n&0x1) //n is a odd number
360 return m_FebBlock[n>>1] & 0xffff; //1,3,5... are fetched from lower bits
361 else //n is a even number
362 return m_FebBlock[n>>1] >> 16; //0,2,4... are fetched from higher bits
363}

◆ getHeader32()

uint32_t LArRodBlockStructure::getHeader32 ( const unsigned n) const
inlineprotectedinherited

Definition at line 365 of file LArRodBlockStructure.h.

366{return m_FebBlock[n>>1];}

◆ getHotCellThreshold()

uint16_t LArRodBlockPhysicsV3::getHotCellThreshold ( ) const
inlinevirtual

Definition at line 306 of file LArRodBlockPhysicsV3.h.

307{
308 return (uint16_t) (*(m_CounterPtr+2));
309}

◆ getHottestCellEnergy()

uint32_t LArRodBlockPhysicsV3::getHottestCellEnergy ( ) const
inlinevirtual

Definition at line 354 of file LArRodBlockPhysicsV3.h.

355{
356
357 uint32_t aux;
358 aux = * reinterpret_cast<const uint32_t *>(m_CounterPtr+8);
359 return (aux&0x01FFFFFF);
360}

◆ getHottestCellIndex()

uint16_t LArRodBlockPhysicsV3::getHottestCellIndex ( )
inlinevirtual

Definition at line 349 of file LArRodBlockPhysicsV3.h.

350{
351 return ((uint16_t) (*(m_CounterPtr+8)>>9));
352}

◆ getNbSweetCells1()

uint16_t LArRodBlockStructure::getNbSweetCells1 ( ) const
virtualinherited

Reimplemented in LArRodBlockPhysicsV5, and LArRodBlockPhysicsV6.

Definition at line 255 of file LArRodBlockStructure.cxx.

255{ return 0; }

◆ getNbSweetCells2()

uint16_t LArRodBlockStructure::getNbSweetCells2 ( ) const
virtualinherited

Reimplemented in LArRodBlockPhysicsV5, and LArRodBlockPhysicsV6.

Definition at line 256 of file LArRodBlockStructure.cxx.

256{ return 0; }

◆ getNextAccumulatedCalibDigit()

int LArRodBlockStructure::getNextAccumulatedCalibDigit ( int & channelNumber,
std::vector< uint64_t > & SamplesSum,
std::vector< uint64_t > & Samples2Sum,
uint32_t & nStepTriggers,
uint32_t & gain )
virtualinherited

Reimplemented in LArRodBlockCalibrationV1, LArRodBlockCalibrationV2, and LArRodBlockCalibrationV3.

Definition at line 94 of file LArRodBlockStructure.cxx.

95{
96 std::cout << "Error: Function getNextAccumulatedCalibDigit not implemented in this instance of LArRodBlockStructure!\n";
97 return 0;
98}

◆ getNextAccumulatedDigit()

int LArRodBlockStructure::getNextAccumulatedDigit ( int & channelNumber,
std::vector< uint64_t > & SamplesSum,
std::vector< uint64_t > & corr2Sum,
uint32_t & gain )
virtualinherited

Reimplemented in LArRodBlockAccumulatedV3.

Definition at line 100 of file LArRodBlockStructure.cxx.

101{
102 std::cout << "Error: Function getNextAccumulatedDigit not implemented in this instance of LArRodBlockStructure!\n";
103 return 0;
104}

◆ getNextEnergy()

int LArRodBlockPhysicsV3::getNextEnergy ( int & channelNumber,
int32_t & energy,
int32_t & time,
int32_t & quality,
uint32_t & gain )
inlinevirtual

Reimplemented from LArRodBlockStructure.

Definition at line 217 of file LArRodBlockPhysicsV3.h.

218{
219 LARBSDBG("in LArRodBlockPhysicsV3::getNextEnergy.");
220 LARBSDBG("m_channelsPerFEB=" << m_channelsPerFEB);
221 if (m_EnergyIndex>=m_channelsPerFEB) //Already beyond maximal number of channels
222 return 0;
223 if (!m_EnergyPtr) //No data block present
224 return 0;
225 uint16_t tQ; // TimeQuality word
226
227 unsigned rodChannelNumber=m_EnergyIndex; // Index of Channel in ROD-Block
228 // channelNumber=rodChannelNumber; // Arno claims he is using FEB numbering
229 channelNumber=(rodChannelNumber>>4) + ((rodChannelNumber&0xf)<<3); //channel number of the FEB
230
231 // get information available for all cells
232 // Energy on a 16 bit word and decode ranges
233
234 uint16_t encodedEnergy; // 16 bits Encoded Energy word
235 int32_t aux;
236 uint16_t range; // 2 bits range
237 int32_t sign=1;
238
239 LARBSDBG("-------->>>> in LArRodBlockPhysicsV3::getNextEnergy : decode energy.....");
240 // decode energy
241 encodedEnergy = m_EnergyPtr[m_EnergyIndex];
243
244 if (encodedEnergy&0x8000) sign=-1;
245 range = ((encodedEnergy)>>13)&0x0003; // range is encoded in bits 14 and 13
246
247 aux = (int32_t) (encodedEnergy&0x1FFF);
248 if (range==1) aux=(aux<<3)+4; // shift left by 3 bits and add 4 MeV
249 else if (range==2) aux=(aux<<6)+32; // shift left by 6 bits and add 32 MeV
250 else if (range==3) aux=(aux<<9)+256; // shift left by 9 bits and add 256 MeV
251 energy = sign*aux;
252
253 // gain in 2 bits of a 32 bits word
254
255 gain=(uint32_t)((m_GainPtr[channelNumber/16] >> (channelNumber%16)*2) & 0x3);
256
257 // Decode Time and Quality if the information is present according to summary block
258
259 if (getBit(m_SumBlkPtr,rodChannelNumber)) // Data has Time and Quality information
260 {
262
263#ifdef LARBSDBGOUTPUT
264 m_logstr <<MSG::DEBUG<<"This cell has time and Quality information "<<endmsg;
265#endif
266
267 // Decode Time, Quality
268 // Q in bits 0-3
269 // t in bits 4-15
270
271 quality = (int32_t) (tQ & 0x003f);
272 tQ = tQ>>4;
273 time = (tQ<<4) + 8; // unit is 16 ps
275 }
276 else // Data has no Time and Quality information
277 {
278 time=0;
279 quality=-1;
280 }
281
282
283#ifdef LARBSDBGOUTPUT
284 m_logstr <<MSG::DEBUG<<"Range = "<<range<<endmsg;
285 m_logstr <<MSG::DEBUG<<"Sign = "<<sign<<endmsg;
286 m_logstr << MSG::DEBUG<<" Encoded Energy ="<< encodedEnergy << " E=" << energy
287 << " t=" << time
288 << " Q=" << quality
289 << " G=" << gain
290 << " channel Number=" << channelNumber
291 << endmsg;
292#endif
293
294 return 1;
295}
int sign(int a)
int getBit(const uint32_t *const p, const unsigned chan) const
time(flags, cells_name, *args, **kw)

◆ getNextRawData()

int LArRodBlockPhysicsV3::getNextRawData ( int & channelNumber,
std::vector< short > & samples,
uint32_t & gain )
virtual

Reimplemented from LArRodBlockStructure.

Definition at line 707 of file LArRodBlockPhysicsV3.cxx.

708{
709 LARBSDBG("in LArRodBlockPhysicsV3::getNextRawData.");
710 LARBSDBG("m_RawDataCounter=" << m_RawDataCounter << " m_RawDataIndex="<< m_RawDataIndex);
711 LARBSDBG("m_channelsPerFEB=" << m_channelsPerFEB);
712 if(m_FebBlockSize<=m_iHeadBlockSize) return 0;
714
716 if (!flags)
717 return 0; //Block not existing
718 if (m_RawDataCounter>=m_channelsPerFEB) //Already beyond maximal number of channels
719 return 0;
720
721 LARBSDBG("Flags="<<flags);
722
723 while (!getBit(m_RawDataFlagsPtr,m_RawDataCounter)) //Look for next filled channel
725 LARBSDBG("RawDataCounter ist now " << m_RawDataCounter);
726 if (m_RawDataCounter>=m_channelsPerFEB) //No more channel available
727 return 0;
728 }
729 LARBSDBG("Found filled channel at positon " << m_RawDataCounter);
730 //Found next filled channel
731 channelNumber=m_RawDataCounter;
732 //channelNumber=(m_RawDataCounter>>4) + ((m_RawDataCounter&0xf)<<3); //Convert ROD to FEB channel ordering
733 unsigned int nsamples = LE_getHeader16(NGainNSamples) & 0x00FF;
734 LARBSDBG("This run has " << nsamples << " samples");
736 LARBSDBG( "index="<<index);
738 LARBSDBG("In getnextRawData(). index= " << index);
739 gain=3-((m_GainPtr[channelNumber/16] >> (channelNumber%16)*2) & 0x3);
740 if(gain>=CaloGain::LARNGAIN) return 0;
741 for(unsigned int i=0;i<nsamples;i++) {
742 uint16_t x;
743 if((index+i)%2==0)
745 else
747 samples.push_back((short) (x & 0xfff));
748 }
750
751 if (m_rearrangeFirstSample && m_rearrangeFirstSample<samples.size()) //FIXME: Very ugly hack! See explanation in LArRodDecoder.h file
752 {//Change e.g. 3 0 1 2 4 to 0 1 2 3 4
753 short movedSample=samples[0];
754 for (unsigned i=1;i<=m_rearrangeFirstSample;i++)
755 samples[i-1]=samples[i];
756 samples[m_rearrangeFirstSample]=movedSample;
757 }
758
759 return 1;
760}
@ LARNGAIN
Definition CaloGain.h:19

◆ getNStep()

uint16_t LArRodBlockStructure::getNStep ( ) const
inlinevirtualinherited

Reimplemented in LArRodBlockAccumulatedV3, and LArRodBlockCalibrationV3.

Definition at line 491 of file LArRodBlockStructure.h.

492{
493 std::cout << "Error: Function getNStep not implemented in this instance of LArRodBlockStructure!\n";
494 return 0;
495}

◆ getNTrigger()

uint16_t LArRodBlockStructure::getNTrigger ( ) const
inlinevirtualinherited

Reimplemented in LArRodBlockAccumulatedV3, LArRodBlockCalibrationV1, LArRodBlockCalibrationV2, and LArRodBlockCalibrationV3.

Definition at line 480 of file LArRodBlockStructure.h.

481{
482 std::cout << "Error: Function getNTrigger not implemented in this instance of LArRodBlockStructure!\n";
483 return 0;
484}

◆ getNumberOfGains()

virtual uint32_t LArRodBlockPhysicsV3::getNumberOfGains ( ) const
virtual

Reimplemented from LArRodBlockStructure.

◆ getNumberOfHotCells()

uint16_t LArRodBlockPhysicsV3::getNumberOfHotCells ( ) const
inlinevirtual

Definition at line 297 of file LArRodBlockPhysicsV3.h.

298{
299 return (uint16_t) (*m_CounterPtr);
300}

◆ getNumberOfHotCellsInTime()

uint16_t LArRodBlockPhysicsV3::getNumberOfHotCellsInTime ( ) const
inlinevirtual

Definition at line 301 of file LArRodBlockPhysicsV3.h.

302{
303 return (uint16_t) *(m_CounterPtr+1);
304}

◆ getNumberOfSamples()

virtual uint32_t LArRodBlockPhysicsV3::getNumberOfSamples ( ) const
virtual

Reimplemented from LArRodBlockStructure.

◆ getNumberOfWords()

uint32_t LArRodBlockStructure::getNumberOfWords ( ) const
inlineinherited

Definition at line 428 of file LArRodBlockStructure.h.

429{
430 return getHeader32(NWTot);
431}

◆ getOfftimeThreshold()

uint16_t LArRodBlockPhysicsV3::getOfftimeThreshold ( ) const
inlinevirtual

Definition at line 310 of file LArRodBlockPhysicsV3.h.

311{
312 return (uint16_t) (*(m_CounterPtr+3));
313}

◆ getPulsed()

bool LArRodBlockStructure::getPulsed ( unsigned channelNumber) const
inlinevirtualinherited

Reimplemented in LArRodBlockCalibrationV0< DSPHEADER >, LArRodBlockCalibrationV1, LArRodBlockCalibrationV2, and LArRodBlockCalibrationV3.

Definition at line 462 of file LArRodBlockStructure.h.

463{
464 std::cout << "Error: Function getPulsed not implemented in this instance of LArRodBlockStructure!\n";
465 return 0;
466}

◆ getRadd()

uint32_t LArRodBlockPhysicsV3::getRadd ( uint32_t adc,
uint32_t sample ) const
virtual

Reimplemented from LArRodBlockStructure.

Definition at line 803 of file LArRodBlockPhysicsV3.cxx.

804{
807 //if(sample&0x1) x=x&0xffff;
808 //else
809 x=x&0xffff;
810 return x;
811}

◆ getRawDataSize()

uint16_t LArRodBlockStructure::getRawDataSize ( ) const
virtualinherited

◆ getResults1Size()

uint16_t LArRodBlockStructure::getResults1Size ( ) const
virtualinherited

◆ getResults2Size()

uint16_t LArRodBlockStructure::getResults2Size ( ) const
virtualinherited

◆ getStatus()

uint32_t LArRodBlockPhysicsV3::getStatus ( ) const
virtual

Reimplemented from LArRodBlockStructure.

Definition at line 840 of file LArRodBlockPhysicsV3.cxx.

841{
842 if(getNumberOfWords()<Status2/2) return 0;
844 return x;
845}

◆ getStepIndex()

uint16_t LArRodBlockStructure::getStepIndex ( ) const
inlinevirtualinherited

Reimplemented in LArRodBlockAccumulatedV3, and LArRodBlockCalibrationV3.

Definition at line 486 of file LArRodBlockStructure.h.

487{
488 std::cout << "Error: Function getStepIndex not implemented in this instance of LArRodBlockStructure!\n";
489 return 0;
490}

◆ getSumE()

int32_t LArRodBlockStructure::getSumE ( ) const
inlinevirtualinherited

Reimplemented in LArRodBlockPhysicsV6.

Definition at line 315 of file LArRodBlockStructure.h.

315 {
316 return 0;
317}

◆ getTDCPhase()

uint8_t LArRodBlockStructure::getTDCPhase ( ) const
virtualinherited

Reimplemented in LArRodBlockAccumulatedV3, LArRodBlockCalibrationV1, LArRodBlockCalibrationV2, LArRodBlockCalibrationV3, and LArRodBlockTransparentV0< DSPHEADER >.

Definition at line 149 of file LArRodBlockStructure.cxx.

150{
151 std::cout << "Error: Function getTDCPhase not implemented in this instance of LArRodBlockStructure!\n";
152 return 0;
153}

◆ getVectorHeader16()

uint16_t LArRodBlockStructure::getVectorHeader16 ( const unsigned n) const
inlineprotectedinherited

Definition at line 368 of file LArRodBlockStructure.h.

369{ if (n&0x1) //n is a odd number
370 return (std::as_const(*m_vFragment).at(n>>1) & 0xffff);
371 else //n is a even number
372 return (std::as_const(*m_vFragment).at(n>>1) >> 16);
373}

◆ getVectorHeader32()

uint32_t LArRodBlockStructure::getVectorHeader32 ( const unsigned n) const
inlineprotectedinherited

Definition at line 375 of file LArRodBlockStructure.h.

376{
377 return (*m_vFragment)[n>>1];
378}

◆ getVROBEx()

int32_t LArRodBlockStructure::getVROBEx ( ) const
inlinevirtualinherited

Reimplemented in LArRodBlockPhysicsV5, and LArRodBlockPhysicsV6.

Definition at line 323 of file LArRodBlockStructure.h.

323 {
324return 0;
325}

◆ getVROBEy()

int32_t LArRodBlockStructure::getVROBEy ( ) const
inlinevirtualinherited

Reimplemented in LArRodBlockPhysicsV5, and LArRodBlockPhysicsV6.

Definition at line 327 of file LArRodBlockStructure.h.

327 {
328return 0;
329}

◆ getVROBEz()

int32_t LArRodBlockStructure::getVROBEz ( ) const
inlinevirtualinherited

Reimplemented in LArRodBlockPhysicsV5, and LArRodBlockPhysicsV6.

Definition at line 331 of file LArRodBlockStructure.h.

331 {
332return 0;
333}

◆ getVROBFebId()

uint32_t LArRodBlockStructure::getVROBFebId ( )
inlinevirtualinherited

Reimplemented in LArRodBlockPhysicsV5, and LArRodBlockPhysicsV6.

Definition at line 319 of file LArRodBlockStructure.h.

319 {
320return 0;
321}

◆ getVROBSumE()

int32_t LArRodBlockStructure::getVROBSumE ( ) const
inlinevirtualinherited

Reimplemented in LArRodBlockPhysicsV6.

Definition at line 335 of file LArRodBlockStructure.h.

335 {
336return 0;
337}

◆ hasAccumBlock()

virtual uint32_t LArRodBlockStructure::hasAccumBlock ( ) const
inlinevirtualinherited

Reimplemented in LArRodBlockAccumulatedV3.

Definition at line 123 of file LArRodBlockStructure.h.

123{return 0;} ;

◆ hasCalibBlock()

virtual uint32_t LArRodBlockStructure::hasCalibBlock ( ) const
inlinevirtualinherited

◆ hasControlWordBlock()

virtual uint32_t LArRodBlockPhysicsV3::hasControlWordBlock ( ) const
inlinevirtual

Definition at line 143 of file LArRodBlockPhysicsV3.h.

◆ hasControlWords()

virtual uint32_t LArRodBlockStructure::hasControlWords ( ) const
inlinevirtualinherited

◆ hasPhysicsBlock()

virtual uint32_t LArRodBlockPhysicsV3::hasPhysicsBlock ( ) const
inlinevirtual

Reimplemented from LArRodBlockStructure.

Definition at line 141 of file LArRodBlockPhysicsV3.h.

141{return LE_getHeader16(EBlkOffset);} ;

◆ hasRawDataBlock()

virtual uint32_t LArRodBlockPhysicsV3::hasRawDataBlock ( ) const
inlinevirtual

Reimplemented from LArRodBlockStructure.

Definition at line 142 of file LArRodBlockPhysicsV3.h.

◆ initializeFEB()

void LArRodBlockPhysicsV3::initializeFEB ( const uint32_t id)
virtual

Reimplemented from LArRodBlockStructure.

Definition at line 476 of file LArRodBlockPhysicsV3.cxx.

477{
479 if (m_vFragment->size()<m_iHeadBlockSize) //Got empty or spoiled fragment
480 {
481 m_vFragment->resize(m_iHeadBlockSize,0); //Initialize FEB-Header
482 setHeader32(FEBID,id); //Set Feb ID
483 }
484
485 m_SumBlkBlock.resize(0);
486 m_CounterBlkBlock.resize(0);
487 m_EnergyBlock.resize(0);
488 m_GainBlock.resize(0);
489 m_FebInfoBlock.resize(0);
490 m_RawDataBlock.resize(0);
491
493
494}

◆ initializeFragment()

void LArRodBlockPhysicsV3::initializeFragment ( std::vector< uint32_t > & fragment)
virtual

Reimplemented from LArRodBlockStructure.

Definition at line 448 of file LArRodBlockPhysicsV3.cxx.

449{
450 m_pRODblock=&fragment; //remember pointer to fragment
451 if (fragment.size()>m_iHeadBlockSize) { //Got filled fragment
452 unsigned int sizeRead=0;
453 //Store existing data in the FEB-Map
454 while (sizeRead<fragment.size()) {
455 std::vector<uint32_t>::iterator FebIter;
456 FebIter=fragment.begin()+sizeRead; //Store pointer to current Feb-Header
457 m_FebBlock=&(*FebIter); //Set m_FebBlock in order to use getHeader-functions.
458 uint32_t currFEBid=getHeader32(FEBID); //Get this FEB-ID
459 uint16_t currFebSize=getNumberOfWords(); //Size of this FEB-Block
460 //std::cout << "FebID=" << currFEBid << " FEBSize=" << currFebSize << " Vector size=" << fragment.size() << std::endl;
461 if (FebIter+currFebSize>fragment.end()) {
462 fragment.clear(); //Clear existing vector
463 m_logstr << MSG::ERROR << "Got inconsistent ROD-Fragment!" << endmsg;
464 return;
465 }
466 m_mFebBlocks[currFEBid].assign(FebIter,FebIter+currFebSize); //Copy data from ROD-fragment into FEB-Block
467 sizeRead+=currFebSize+m_MiddleHeaderSize; //6 is the middle header size
468 LARBSDBG("Found FEB-id " << currFEBid << " in existing ROD-Fragment");
469 } // end while
470 }
471 fragment.clear(); //Clear existing vector
472 return;
473}

◆ LE_getHeader16()

uint16_t LArRodBlockStructure::LE_getHeader16 ( const unsigned n) const
inlineprotectedinherited

Definition at line 405 of file LArRodBlockStructure.h.

406{
407 return (reinterpret_cast<const uint16_t*>(m_FebBlock))[n];
408}

◆ LE_getVectorHeader16()

uint16_t LArRodBlockStructure::LE_getVectorHeader16 ( const unsigned n) const
inlineprotectedinherited

Definition at line 410 of file LArRodBlockStructure.h.

411{
412 const uint32_t* data32 = std::as_const(*m_vFragment).data();
413 const uint16_t* data16 = reinterpret_cast<const uint16_t*> (data32);
414 return data16[n];
415}

◆ LE_setHeader16()

void LArRodBlockStructure::LE_setHeader16 ( const unsigned n,
const uint16_t w )
inlineprotectedinherited

Definition at line 417 of file LArRodBlockStructure.h.

418{
419#ifdef LARBYTESTREAMRODBLOCK_CHCKBOUNDARIES
420 if ((unsigned)n>=m_vFragment->size()*2) {
421 std::cout << "LArRodBlockStructure::LE_setHeader16 Error: WRITE BEYOND ARRAY BONDARY!" << std::endl;
422 std::abort();
423 }
424#endif
425 reinterpret_cast<uint16_t*>(m_vFragment->data())[n] = w;
426}

◆ nextFEB()

bool LArRodBlockStructure::nextFEB ( )
inlineinherited

Definition at line 497 of file LArRodBlockStructure.h.

498{
500
501 const int32_t FebOffset = m_FebBlockSize+m_MiddleHeaderSize;
502 const int32_t LeftSize = m_RodBlockSize-FebOffset+m_RodBlock-m_FebBlock;
503 if ( LeftSize<=0 ) return false; //No next feb
504
505 m_FebBlock += FebOffset; //Jump to the next FEB fragment
506 const int32_t BlockSize = getNumberOfWords();
507 //std::cout << "LeftSize=" << LeftSize << " BlockSize=" << BlockSize << std::endl;
508 if (BlockSize>LeftSize) {
509 std::cout << "Error while decoding LArByteStream: Found FEB block of size " << BlockSize << " in a ROD block of size " << LeftSize << std::endl;
510 m_error_next_feb = true;
511 return false;
512 }
513 //std::cout << "Second FEB ok, size= " << LeftSize <<std::endl;
514
515 //m_FebBlockSize = LeftSize; //should be =BlockSize;
516 m_FebBlockSize=BlockSize;
517
518 //std::cout << "2: FEB found with size " << m_FebBlockSize << std::endl;
519 setPointers();
520 return true;
521}

◆ offlineCheckSum()

uint32_t LArRodBlockStructure::offlineCheckSum ( ) const
virtualinherited

Reimplemented in LArRodBlockPhysicsV4.

Definition at line 163 of file LArRodBlockStructure.cxx.

164{
165 int end = getNumberOfWords()-3;
166 int start = 1;
167 uint32_t sum = 0;
169 for(int i=start;i<end;i++) {
170 sum += m_FebBlock[i];
171 }
172 return sum & 0x7fffffff;
173}

◆ OfflineToRawGain()

uint32_t LArRodBlockStructure::OfflineToRawGain ( const uint32_t gain) const
inlineinherited

Definition at line 352 of file LArRodBlockStructure.h.

353{return m_OfflineToRawGainMap[gain];} //For efficency, don't check range
static const uint32_t m_OfflineToRawGainMap[3]

◆ onlineCheckSum()

uint32_t LArRodBlockStructure::onlineCheckSum ( ) const
virtualinherited

Reimplemented in LArRodBlockPhysicsV4.

Definition at line 155 of file LArRodBlockStructure.cxx.

156{
157 int offset = getNumberOfWords()-1;
158 if(offset>=m_FebBlockSize) return 0;
159 if(offset<0) return 0;
160 return m_FebBlock[offset];
161}

◆ operator()() [1/2]

template<class RAWDATA>
bool LArRodBlockPhysicsV3::operator() ( ) const

◆ operator()() [2/2]

template<class RAWDATA>
bool LArRodBlockPhysicsV3::operator() ( const RAWDATA * ch1,
const RAWDATA * ch2 ) const

◆ RawToOfflineGain()

uint32_t LArRodBlockStructure::RawToOfflineGain ( const uint32_t gain) const
inlineinherited

Definition at line 349 of file LArRodBlockStructure.h.

350{return m_RawToOfflineGainMap[gain];} //For efficency, don't check range
static const uint32_t m_RawToOfflineGainMap[4]

◆ report_error()

bool LArRodBlockStructure::report_error ( void ) const
inlineinherited

Definition at line 177 of file LArRodBlockStructure.h.

177{ return m_error_next_feb;}

◆ resetPointers()

void LArRodBlockPhysicsV3::resetPointers ( )
inlineprivatevirtual

Reimplemented from LArRodBlockStructure.

Definition at line 103 of file LArRodBlockPhysicsV3.cxx.

104{
109 m_GainIndex=0;
111 m_SumBlkIndex=0;
113
116 m_Ex=0;
117 m_Ey=0;
118 m_Ez=0;
119 m_HottestCellIndex=255; // 255 is unphysical since cells index are between 0 and 127 per FEB.
121}

◆ setBit()

void LArRodBlockStructure::setBit ( uint32_t *const p,
const unsigned chan )
inlineprotectedinherited

Definition at line 444 of file LArRodBlockStructure.h.

445{
446 // chan = (0,127)
447 // int a = chan/32;
448 // int r = chan%32;
449 int a = chan>>5;
450 int r = chan&0x1f;
451 // a = (0,3), r = ( 0, 31 )
452 *(p+a) |= (1<<r) ;
453 return;
454}

◆ setDAC()

void LArRodBlockStructure::setDAC ( const uint16_t DACValue)
virtualinherited

Reimplemented in LArRodBlockCalibrationV0< DSPHEADER >.

Definition at line 57 of file LArRodBlockStructure.cxx.

58{
59 std::cout << "Error: Function setDAC not implemented in this instance of LArRodBlockStructure!\n";
60 return;
61}

◆ setDelay()

void LArRodBlockStructure::setDelay ( const uint16_t DelayValue)
virtualinherited

Reimplemented in LArRodBlockCalibrationV0< DSPHEADER >.

Definition at line 63 of file LArRodBlockStructure.cxx.

64{
65 std::cout << "Error: Function setDelay not implemented in this instance of LArRodBlockStructure!\n";
66 return;
67}

◆ setEThreshold()

void LArRodBlockPhysicsV3::setEThreshold ( uint16_t thres)
virtual

Definition at line 848 of file LArRodBlockPhysicsV3.cxx.

849{
850 m_EnergyThreshold=thres;
851}

◆ setEtQ()

void LArRodBlockStructure::setEtQ ( const int channel,
const int32_t energy,
const int32_t time,
const int32_t quality,
const uint32_t gain )
virtualinherited

Definition at line 120 of file LArRodBlockStructure.cxx.

121{
122 std::cout << "Error: Function setEtQ not implemented in this instance of LArRodBlockStructure!\n";
123 return;
124}

◆ setEx()

void LArRodBlockPhysicsV3::setEx ( double Ex)
virtual

Reimplemented from LArRodBlockStructure.

Definition at line 858 of file LArRodBlockPhysicsV3.cxx.

859{
860 m_Ex=(int32_t)Ex;
861 return;
862}

◆ setEy()

void LArRodBlockPhysicsV3::setEy ( double Ey)
virtual

Reimplemented from LArRodBlockStructure.

Definition at line 863 of file LArRodBlockPhysicsV3.cxx.

864{
865 m_Ey=(int32_t)Ey;
866 return;
867}

◆ setEz()

void LArRodBlockPhysicsV3::setEz ( double Ez)
virtual

Reimplemented from LArRodBlockStructure.

Definition at line 869 of file LArRodBlockPhysicsV3.cxx.

870{
871 m_Ez=(int32_t)Ez;
872 return;
873}

◆ setFirstSample()

void LArRodBlockStructure::setFirstSample ( const int rearrangeFirstSample)
inlineinherited

Definition at line 168 of file LArRodBlockStructure.h.

169 {m_rearrangeFirstSample=rearrangeFirstSample;}

◆ setFragment()

bool LArRodBlockStructure::setFragment ( const uint32_t * p,
uint32_t n )
inlineinherited

Definition at line 252 of file LArRodBlockStructure.h.

253{
255 m_FebBlock = p;
258 uint32_t BlockSize = 0;
259
260 if (n==0) {
261 std::cout << "Error while decoding LArByteStream: Got Rod block size 0" << std::endl;
262 return false;
263 }
264
265 BlockSize = getNumberOfWords();
266 if (BlockSize>n) {
267 std::cout << "Error while decoding LArByteStream: Found FEB block of size " << BlockSize << " in a ROD block of size " << n << std::endl;
268 return false;
269 }
270 m_FebBlockSize = BlockSize;
271
272 m_error_next_feb = false;
273 //std::cout << "1: FEB found with size " << m_FebBlockSize << std::endl;
274
275 return setPointers();
276}

◆ setFragmentVirtualROB()

int LArRodBlockStructure::setFragmentVirtualROB ( const uint32_t * p,
uint32_t n )
inlinevirtualinherited

Definition at line 280 of file LArRodBlockStructure.h.

281 {
286 if ( n<2 ) { std::cout << "Error" << std::endl; return 0;}
287 m_virtualROBJump = ((*p)>>16)>>1; // Divide by two (two FEBs-1ROB)
288 m_ROB_to_decode = ( (*p) & 0xFFFF )<<1; // Multiply by two
289 if ( (n - m_virtualROBJump*m_ROB_to_decode-1) ){
290 std::cout << "Error AGAIN" << std::endl;
291 return 0;
292 }
294 return m_ROB_to_decode;
295}
const uint32_t * m_virtualROBPointerLocal
const uint32_t * m_virtualROBPointer

◆ setGain()

virtual int LArRodBlockPhysicsV3::setGain ( const int )
inlinevirtual

Reimplemented from LArRodBlockStructure.

Definition at line 115 of file LArRodBlockPhysicsV3.h.

115{ return 1; };

◆ setHeader16()

void LArRodBlockStructure::setHeader16 ( const unsigned n,
const uint16_t w )
inlineprotectedinherited

Definition at line 380 of file LArRodBlockStructure.h.

381{
382#ifdef LARBYTESTREAMRODBLOCK_CHCKBOUNDARIES
383 if ((unsigned)n>=m_vFragment->size()*2) {
384 std::cout << "Error WRITE BEYOND ARRAY BONDARY!" << std::endl;
385 std::abort();
386 }
387#endif
388 if (n&0x1) // n is a odd number
389 m_vFragment->at(n>>1)=((m_vFragment->at(n>>1) & 0xffff0000) | w);
390 else
391 m_vFragment->at(n>>1)=((m_vFragment->at(n>>1) & 0xffff) | (w << 16));
392}

◆ setHeader32()

void LArRodBlockStructure::setHeader32 ( const unsigned n,
const uint32_t w )
inlineprotectedinherited

Definition at line 394 of file LArRodBlockStructure.h.

395{
396#ifdef LARBYTESTREAMRODBLOCK_CHCKBOUNDARIES
397 if ((unsigned)n>=m_vFragment->size()*2) {
398 std::cout << "Error WRITE BEYOND ARRAY BONDARY!" << std::endl;
399 std::abort();
400 }
401#endif
402 m_vFragment->at(n>>1) = w;
403}

◆ setNextEnergy() [1/2]

void LArRodBlockPhysicsV3::setNextEnergy ( const int channel,
const int32_t energy,
const int32_t time,
const int32_t quality,
const uint32_t gain )
virtual

Reimplemented from LArRodBlockStructure.

Definition at line 221 of file LArRodBlockPhysicsV3.cxx.

223{
224 m_logstr << MYLEVEL << "setNextEnergy-------------------->>>>>********************** new format V3 ***********" << endmsg;
225 m_logstr << MYLEVEL << "Channel=" << channel << " energy =" << energy << endmsg;
226 int rcNb=FebToRodChannel(channel);
227 //rcNb ist supposed to equal or bigger than m_EIndex.
228 //In the latter case, we fill up the missing channels with zero
229 if (rcNb<m_EnergyIndex) {
230 m_logstr << MSG::ERROR << "LArRODBlockStructure Error: Internal error. Channels not ordered correctly. rcNb=" << rcNb
231 << " m_EnergyIndex=" << m_EnergyIndex << endmsg;
232 return;
233 }
234
235 //Fill up missing channels with zeros:
236 while (m_EnergyIndex<rcNb)
237 setNextEnergy((int16_t)0,(int16_t)32767,(int16_t)-32767,(uint32_t)0);
238
239
240 // update fi needed the hottest cell info
241 // m_logstr << MYLEVEL << "Before " << endmsg;
242 // m_logstr << MYLEVEL << "m_HottestCellIndex : "<< m_HottestCellIndex << endmsg;
243 // m_logstr << MYLEVEL << "m_HottestCellEnergy : "<< m_HottestCellEnergy << endmsg;
244
245 if ((energy>0)&&(energy>(int)m_HottestCellEnergy))
246 {
247 m_HottestCellEnergy = abs(energy);
249 }
250
251 // m_logstr << MYLEVEL << "After " << endmsg;
252 // m_logstr << MYLEVEL << "m_HottestCellIndex : "<< m_HottestCellIndex << endmsg;
253 // m_logstr << MYLEVEL << "m_HottestCellEnergy : "<< m_HottestCellEnergy << endmsg;
254
255
256 // transform 32 bits data into 16 bits data
257
258 uint16_t theenergy;
259 uint32_t abse,EncodedE;
260 int16_t thetime,thequality;
261 int32_t sign;
262
263 thetime = (int16_t) time >> 4;
264 thequality = (int16_t) quality;
265
266 sign=(energy>=0?1:-1); // get sign of energy
267 abse=(uint32_t)abs(energy);
268
269 EncodedE=abse; // range 0
270
271 if ((abse>8192)&&(abse<65536))
272 {
273 EncodedE=((abse>>3)|0x2000); // range 1 : drop last 3 bits and put range bits (bits 14 and 13 = 01)
274 }
275 else if ((abse>65535)&&(abse<524288))
276 {
277 EncodedE=((abse>>6)|0x4000); // range 2 : drop last 6 bits and put range bits (bits 14 and 13 = 10)
278 }
279 else if ((abse>524288))
280 {
281 EncodedE=((abse>>9)|0x6000); // range 3 : drop last 9 bits and put range bits (bits 14 and 13 = 11)
282 }
283
284 // treat sign now :
285
286 if (sign<0) EncodedE |= 0x8000;
287 theenergy = (uint16_t) EncodedE;
288
289
290 // Add data...
291
292 m_logstr << MYLEVEL << "setNextEnergy-------------------->>>>> Energy = "<< energy << " Encoded Energy =" << theenergy << endmsg;
293
294 if (abse> m_EnergyThreshold)
295 {
296 setNextEnergy(theenergy,thetime,thequality,gain);
297 }
298 else
299 {
300 setNextEnergy(theenergy,(int16_t)32767,(int16_t)-32767,gain);
301 }
302 return;
303}
int FebToRodChannel(int ch) const
setScaleOne setStatusOne setSaturated int16_t

◆ setNextEnergy() [2/2]

void LArRodBlockPhysicsV3::setNextEnergy ( const uint16_t energy,
const int16_t time,
const int16_t quality,
const uint32_t gain )
private

Definition at line 306 of file LArRodBlockPhysicsV3.cxx.

307{
308
309 if (m_EnergyIndex>=m_channelsPerFEB) //Use m_EIndex to count total number of channels
310 {m_logstr << MSG::ERROR << "LArRodBlockStructure Error: Attempt to write Energy for channel "
311 << m_EnergyIndex << " channels into a FEB!" <<endmsg;
312 return;
313 }
314 LARBSDBG("LArRodBlockStructure: Setting Energy for channel " << m_EnergyIndex << ". E=" << energy);
315
316 m_logstr << MYLEVEL << "In setNextEnergy-------------------->>>>> time = " << time << " quality=" << quality << endmsg;
317
318 // write for all cells energy and hardware gain
319
320 // Energy
321
322 m_EnergyIndex++; //Use m_EIndex to count the channels put in the Energy block
323
324 ShortLong twoValues{};
325 if (m_EnergyIndex%2) // m_EIndex-1 is even
326 {
327 twoValues.s[0]= energy;
328 twoValues.s[1]=0;
329 }
330 else
331 { //Even number: Merging with previous block
332 uint32_t oneValue=m_EnergyBlock[m_EnergyBlock.size()-1]; //Take last element of vector
333 m_EnergyBlock.pop_back();
334 uint16_t* valptr=reinterpret_cast<uint16_t*>(&oneValue);
335 twoValues.s[0]=valptr[0];
336 twoValues.s[1]=(uint16_t)energy;
337 }
338
339 //m_logstr << MSG::DEBUG << "In setNextEnergy-------------------->>>>> Length of m_EnergyBlock =" << m_EnergyBlock.size() << endmsg;
340
341 LARBSDBG("Writing words: val0= " << twoValues.s[0] << " val1= " << twoValues.s[1]);
342 m_EnergyBlock.push_back(twoValues.l);
343 LARBSDBG("Writing Raw data to E block. E=" << energy);
344
345 // update summary block
346 // Summary block is one bit per cell
347
348 int mylocalBitwiseIndex = (int) (m_EnergyIndex-1)%32; // 1 bits in SB per channel
349 // m_logstr << MYLEVEL << "In setNextEnergy-------------------->> Summary Block Construction " << endmsg;
350 // m_logstr << MYLEVEL << "In setNextEnergy-------------------->> mylocalBitwiseIndex= " << mylocalBitwiseIndex << endmsg;
351 if (mylocalBitwiseIndex==0) // need for a new 32 bits word to store SM info of that cell
352 {
353 // m_logstr << MYLEVEL << "In setNextEnergy-------------------->> Set new 32 bits word " << endmsg;
354 uint32_t SB;
355 SB = (quality==-32767?0x00000000:0x00000001);
356 m_SumBlkBlock.push_back(SB);
357 }
358 else
359 {
360 // m_logstr << MYLEVEL << "In setNextEnergy-------------------->> Use existing 32 bits word " << endmsg;
361 uint32_t SB=m_SumBlkBlock[m_GainBlock.size()-1]; //Take out last element of vector
362 m_SumBlkBlock.pop_back();
363 SB=(SB<<1)|(quality==-32767?0x00000000:0x00000001);
364 m_SumBlkBlock.push_back(SB);
365 }
366
367 // Hardware gain
368
369 mylocalBitwiseIndex = (m_EnergyIndex-1)%16; // 2 bits of gain per channel
370 if (mylocalBitwiseIndex==0) // need for a new 32 bits word to store the gain of that cell
371 {
372 m_GainBlock.push_back(gain&0x00000003);
373 }
374 else
375 {
376 uint32_t encodedgains=m_GainBlock[m_GainBlock.size()-1]; //Take out last element of vector
377 m_GainBlock.pop_back();
378 encodedgains=(encodedgains<<2)|(gain&0x00000003);
379 m_GainBlock.push_back(encodedgains);
380 }
381
382 // write Time and Chi2 for cells above HighEnergyCellCut threshold
383
384 // m_logstr << MYLEVEL << "In setNextEnergy-------------------->>>>> treat Time and Chi2" << endmsg;
385
386 if (quality!=-32767) // Do write Time and Chi2 information
387 {
388 // m_logstr << MSG::DEBUG << "In setNextEnergy-------------------->>>>> treat Time and Chi2 of that hot cell " << endmsg;
389 // count the number of hot cells
391 // count the number of cells offtime
392 if (abs(time)>m_OffTimeCut) m_numberHotCellOffTime++;
393
394 mylocalBitwiseIndex = (m_numberHotCell-1)%2; // 16 bits per channel
395 ShortLong twoValues{};
396 if (mylocalBitwiseIndex==0) // need for a new 32 bits word to store the time quality of that cell
397 {
398 twoValues.s[0]=0;
399 twoValues.s[1]=0;
400 twoValues.s[0]=(int16_t)(time)|((quality>>10)&0x003F); // Quality on the first 6 bits and Time on the last 10 bits;
401 }
402 else
403 { //Even number: Merging with previous block
404 uint32_t oneValue=m_TimeQualityBlock[m_TimeQualityBlock.size()-1]; //Take last element of vector
405 m_TimeQualityBlock.pop_back();
406 int16_t* valptr=reinterpret_cast<int16_t*>(&oneValue);
407 twoValues.s[0]=valptr[0];
408 twoValues.s[1]=(int16_t)(time)|((quality>>12)&0x003F); // Quality on the first 4 bits and Time on the last 12 bits;
409 }
410 m_TimeQualityBlock.push_back(twoValues.l);
411 }
412
413}

◆ setNTrigger()

void LArRodBlockStructure::setNTrigger ( const uint16_t NTrigger)
virtualinherited

Definition at line 75 of file LArRodBlockStructure.cxx.

76{
77 std::cout << "Error: Function setNTrigger not implemented in this instance of LArRodBlockStructure!\n";
78 return;
79}

◆ setNumberOfGains()

void LArRodBlockPhysicsV3::setNumberOfGains ( const uint8_t n)
virtual

Reimplemented from LArRodBlockStructure.

Definition at line 214 of file LArRodBlockPhysicsV3.cxx.

216 LE_setHeader16(NGainNSamples,(oldword & 0x00FF) | (n<<8));
217}

◆ setNumberOfSamples()

void LArRodBlockPhysicsV3::setNumberOfSamples ( const uint8_t n)
virtual

Reimplemented from LArRodBlockStructure.

Definition at line 209 of file LArRodBlockPhysicsV3.cxx.

211 LE_setHeader16(NGainNSamples,(oldword & 0xFF00) | n);
212}

◆ setOffTimeCut()

void LArRodBlockPhysicsV3::setOffTimeCut ( uint16_t TimeCut)
virtual

Definition at line 853 of file LArRodBlockPhysicsV3.cxx.

854{
855m_OffTimeCut=TimeCut;
856}

◆ setPointers()

bool LArRodBlockPhysicsV3::setPointers ( )
virtual

Reimplemented from LArRodBlockStructure.

Definition at line 124 of file LArRodBlockPhysicsV3.cxx.

125{//Set pointers to data blocks (pesuming, they exist)
127 {
129 m_SumBlkPtr=reinterpret_cast<const uint32_t*> (m_FebBlock+LE_getHeader16(SumBlkOffset));
130 else m_SumBlkPtr=reinterpret_cast<const uint32_t*>(m_DummyBitMap);
131
134 else m_CounterPtr=reinterpret_cast<const uint16_t*>(m_DummyBitMap);
135
137 m_EnergyPtr=reinterpret_cast<const uint16_t*>(m_FebBlock+LE_getHeader16(EBlkOffset));
138 else m_EnergyPtr=reinterpret_cast<const uint16_t*>(m_DummyBitMap);
139
141 m_GainPtr=reinterpret_cast<const uint32_t*>(m_FebBlock+LE_getHeader16(GainBlkOffset));
142 else m_GainPtr=reinterpret_cast<const uint32_t*>(m_DummyBitMap);
143
146 else m_TimeQualityPtr=reinterpret_cast<const int16_t*>(m_DummyBitMap);
147
150 else m_RawDataPtr=reinterpret_cast<const int16_t*>(m_DummyBitMap);
151
154 else m_FebInfoDataPtr=reinterpret_cast<const int16_t*>(m_DummyBitMap);
155
156#ifdef LARBSDBGOUTPUT
157 m_logstr << MYLEVEL << "***********************************************************************"<< endmsg;
158 m_logstr << MYLEVEL << "Energy Pointed values :"<< endmsg;
159 m_logstr << MYLEVEL << "************************************************************************"<< endmsg;
160 m_logstr << MYLEVEL << "LE_getHeader16(SumBlkOffset) = "<< MSG::hex << LE_getHeader16(SumBlkOffset) << endmsg;
161 m_logstr << MYLEVEL << "LE_getHeader16(CounterBlkOffset) = "<< MSG::hex << LE_getHeader16(CounterBlkOffset) << endmsg;
162 m_logstr << MYLEVEL << "LE_getHeader16(GainBlkOffset) = "<< MSG::hex << LE_getHeader16(GainBlkOffset) << endmsg;
163 m_logstr << MYLEVEL << "LE_getHeader16(EBlkOffset) = "<< MSG::hex << LE_getHeader16(EBlkOffset) << endmsg;
164 m_logstr << MYLEVEL << "LE_getHeader16(FebInfoBlkOffset) = "<< MSG::hex << LE_getHeader16(FebInfoBlkOffset) << endmsg;
165 m_logstr << MYLEVEL << "LE_getHeader16(TimeQualityBlkOffset) = "<< MSG::hex << LE_getHeader16(TimeQualityBlkOffset) << endmsg;
166 m_logstr << MYLEVEL << "************************************************************************"<< endmsg;
167
168 m_logstr << MYLEVEL << "********************* SumBlck ************************************"<< endmsg;
169 for(int toto=0;toto<4;toto++)
170 m_logstr << MYLEVEL << "hexa = 0x" << MSG::hex << m_SumBlkPtr[toto] << endmsg;
171 m_logstr << MYLEVEL << "************************************************************************"<< endmsg;
172
173 m_logstr << MYLEVEL << "********************* CounterBlck ************************************"<< endmsg;
174 for(int toto=0;toto<10;toto++) m_logstr << MYLEVEL << "hexa = 0x" << MSG::hex << m_CounterPtr[toto] << endmsg;
175 m_logstr << MYLEVEL << "************************************************************************"<< endmsg;
176
177 m_logstr << MYLEVEL << "********************* FebInfoBlck ************************************"<< endmsg;
178 for(int toto=0;toto<4;toto++) m_logstr << MYLEVEL << "hexa = 0x" << MSG::hex << m_FebInfoDataPtr[toto] << endmsg;
179 m_logstr << MYLEVEL << "************************************************************************"<< endmsg;
180
181
182 m_logstr << MYLEVEL << "********************* Energies ************************************"<< endmsg;
183 for(int toto=0;toto<128;toto++)
184 m_logstr << MYLEVEL << "hexa = 0x" << MSG::hex << m_EnergyPtr[toto] << endmsg;
185 m_logstr << MYLEVEL << "************************************************************************"<< endmsg;
186
187 m_logstr << MYLEVEL << "********************* Time & Quality ************************************"<< endmsg;
188 for(int toto=0;toto<10;toto++)
189 m_logstr << MYLEVEL << "hexa = 0x" << MSG::hex << m_TimeQualityPtr[toto] << endmsg;
190 m_logstr << MYLEVEL << "************************************************************************"<< endmsg;
191#endif
192
193 }
194 else
195 {
196 m_SumBlkPtr=NULL;
197 m_CounterPtr=NULL;
198 m_EnergyPtr=NULL;
199 m_TimeQualityPtr=NULL;
200 m_GainPtr=NULL;
201 m_FebInfoDataPtr=NULL;
202 m_RawDataPtr=NULL;
203 m_RawDataFlagsPtr=NULL;
204 }
205
206 return true;
207}
static const uint32_t m_DummyBitMap[4]

◆ setPulsed()

void LArRodBlockStructure::setPulsed ( const unsigned channelNumber)
virtualinherited

Reimplemented in LArRodBlockCalibrationV0< DSPHEADER >.

Definition at line 69 of file LArRodBlockStructure.cxx.

70{
71 std::cout << "Error: Function setPulsed not implemented in this instance of LArRodBlockStructure!\n";
72 return;
73}

◆ setRawData()

void LArRodBlockPhysicsV3::setRawData ( const int channel,
const std::vector< short > & samples,
const uint32_t gain )
virtual

Reimplemented from LArRodBlockStructure.

Definition at line 415 of file LArRodBlockPhysicsV3.cxx.

415 {
416 //Convert Feb to Rod Channel Number:
417 //int rcNb=(channel>>3) + ((channel&0x7)<<4);
418 int rcNb=FebToRodChannel(channel);
419 if (rcNb>=m_channelsPerFEB)
420 {m_logstr << MSG::ERROR << "Attempt to write Energy for channel " << rcNb << " channels into a FEB!" << endmsg;
421 return;
422 }
423 unsigned int nsamples = LE_getVectorHeader16(NGainNSamples) & 0x00FF;
424 if(samples.size() != nsamples) {
425 m_logstr << MSG::ERROR << "Number of samples mismatch!\n";
426 m_logstr << " nsamples =" << nsamples;
427 m_logstr << " samples.size() =" << samples.size() << endmsg;
428 std::abort();
429 }
430
431 setBit(&m_RawDataBlock[0],rcNb);
432 //Samples have 12 bit and are shifted to the left by 2 bits.
433 // odd samples in high bits, even samples in low bits
434 if((nsamples/2)*2!=nsamples) { //odd number of samples - gain is alone
435 m_RawDataBlock.push_back((gain<<30) | samples[0]<<2);
436 for (unsigned int i=1;i<nsamples;i+=2)
437 m_RawDataBlock.push_back((samples[i+1]<<18) | samples[i]<<2);
438 }
439 else { //even number of samples - gain is packed with sample 0
440 m_RawDataBlock.push_back((gain<<30) | (samples[1]<<18) | samples[0]<<2);
441 for (unsigned int i=2;i<nsamples;i+=2)
442 m_RawDataBlock.push_back((samples[i+1]<<18) | samples[i]<<2);
443 }
444}
void setBit(uint32_t *const p, const unsigned chan)

◆ setRawDataFixed()

void LArRodBlockStructure::setRawDataFixed ( const int channel,
const std::vector< short > & samples,
const uint32_t gain )
virtualinherited

Reimplemented in LArRodBlockTransparentV0< DSPHEADER >.

Definition at line 126 of file LArRodBlockStructure.cxx.

127{
128 std::cout << "Error: Function setRawDataFixed not implemented in this instance of LArRodBlockStructure!\n";
129 return;
130}

◆ setSumE()

void LArRodBlockStructure::setSumE ( double )
virtualinherited

Reimplemented in LArRodBlockPhysicsV6.

Definition at line 218 of file LArRodBlockStructure.cxx.

219{
220 // Do not set anything
221 return;
222}

◆ setTDCPhase()

void LArRodBlockStructure::setTDCPhase ( const uint8_t n)
virtualinherited

Reimplemented in LArRodBlockTransparentV0< DSPHEADER >.

Definition at line 144 of file LArRodBlockStructure.cxx.

145{
146 std::cout << "Error: Function setTDCPhase not implemented in this instance of LArRodBlockStructure!\n";
147 return;
148}

◆ sortDataVector() [1/5]

void LArRodBlockStructure::sortDataVector ( std::vector< const LArAccumulatedCalibDigit * > & )
virtual

Reimplemented from LArRodBlockStructure.

Definition at line 90 of file LArRodBlockStructure.cxx.

240{return;}

◆ sortDataVector() [2/5]

void LArRodBlockStructure::sortDataVector ( std::vector< const LArAccumulatedDigit * > & )
virtual

Reimplemented from LArRodBlockStructure.

Definition at line 91 of file LArRodBlockStructure.cxx.

243{return;}

◆ sortDataVector() [3/5]

void LArRodBlockStructure::sortDataVector ( std::vector< const LArCalibDigit * > & )
virtual

Reimplemented from LArRodBlockStructure.

Definition at line 89 of file LArRodBlockStructure.cxx.

237{return;}

◆ sortDataVector() [4/5]

virtual void LArRodBlockPhysicsV3::sortDataVector ( std::vector< const LArDigit * > & )
virtual

Reimplemented from LArRodBlockStructure.

◆ sortDataVector() [5/5]

virtual void LArRodBlockPhysicsV3::sortDataVector ( std::vector< const LArRawChannel * > & )
virtual

Reimplemented from LArRodBlockStructure.

Member Data Documentation

◆ m_channelsPerFEB

int LArRodBlockStructure::m_channelsPerFEB
protectedinherited

Definition at line 225 of file LArRodBlockStructure.h.

◆ m_CounterBlkBlock

std::vector<uint32_t> LArRodBlockPhysicsV3::m_CounterBlkBlock
private

Definition at line 157 of file LArRodBlockPhysicsV3.h.

◆ m_CounterIndex

int LArRodBlockPhysicsV3::m_CounterIndex = 0
private

Definition at line 168 of file LArRodBlockPhysicsV3.h.

◆ m_CounterPtr

const uint16_t* LArRodBlockPhysicsV3::m_CounterPtr
private

Definition at line 176 of file LArRodBlockPhysicsV3.h.

◆ m_DummyBitMap

const uint32_t LArRodBlockPhysicsV3::m_DummyBitMap ={0,0,0,0}
staticprivate

Definition at line 35 of file LArRodBlockPhysicsV3.h.

◆ m_EnergyBlock

std::vector<uint32_t> LArRodBlockPhysicsV3::m_EnergyBlock
private

Definition at line 158 of file LArRodBlockPhysicsV3.h.

◆ m_EnergyIndex

int LArRodBlockPhysicsV3::m_EnergyIndex = 0
private

Definition at line 169 of file LArRodBlockPhysicsV3.h.

◆ m_EnergyPtr

const uint16_t* LArRodBlockPhysicsV3::m_EnergyPtr
private

Definition at line 177 of file LArRodBlockPhysicsV3.h.

◆ m_EnergyThreshold

uint16_t LArRodBlockPhysicsV3::m_EnergyThreshold
private

Definition at line 194 of file LArRodBlockPhysicsV3.h.

◆ m_error_next_feb

bool LArRodBlockStructure::m_error_next_feb
protectedinherited

Definition at line 243 of file LArRodBlockStructure.h.

◆ m_Ex

int32_t LArRodBlockStructure::m_Ex
protectedinherited

Definition at line 207 of file LArRodBlockStructure.h.

◆ m_Ey

int32_t LArRodBlockStructure::m_Ey
protectedinherited

Definition at line 208 of file LArRodBlockStructure.h.

◆ m_Ez

int32_t LArRodBlockStructure::m_Ez
protectedinherited

Definition at line 209 of file LArRodBlockStructure.h.

◆ m_FebBlock

const uint32_t* LArRodBlockStructure::m_FebBlock
protectedinherited

Definition at line 227 of file LArRodBlockStructure.h.

◆ m_FebBlockSize

int32_t LArRodBlockStructure::m_FebBlockSize
protectedinherited

Definition at line 229 of file LArRodBlockStructure.h.

◆ m_FebInfoBlock

std::vector<uint32_t> LArRodBlockPhysicsV3::m_FebInfoBlock
private

Definition at line 160 of file LArRodBlockPhysicsV3.h.

◆ m_FebInfoDataPtr

const int16_t* LArRodBlockPhysicsV3::m_FebInfoDataPtr
private

Definition at line 180 of file LArRodBlockPhysicsV3.h.

◆ m_FebInfoIndex

int LArRodBlockPhysicsV3::m_FebInfoIndex = 0
private

Definition at line 170 of file LArRodBlockPhysicsV3.h.

◆ m_GainBlock

std::vector<uint32_t> LArRodBlockPhysicsV3::m_GainBlock
private

Definition at line 159 of file LArRodBlockPhysicsV3.h.

◆ m_GainIndex

int LArRodBlockPhysicsV3::m_GainIndex = 0
private

Definition at line 171 of file LArRodBlockPhysicsV3.h.

◆ m_GainPtr

const uint32_t* LArRodBlockPhysicsV3::m_GainPtr
private

Definition at line 179 of file LArRodBlockPhysicsV3.h.

◆ m_HottestCellEnergy

uint32_t LArRodBlockPhysicsV3::m_HottestCellEnergy
private

Definition at line 197 of file LArRodBlockPhysicsV3.h.

◆ m_HottestCellIndex

uint16_t LArRodBlockPhysicsV3::m_HottestCellIndex
private

Definition at line 196 of file LArRodBlockPhysicsV3.h.

◆ m_iHeadBlockSize

unsigned short LArRodBlockStructure::m_iHeadBlockSize
protectedinherited

Definition at line 221 of file LArRodBlockStructure.h.

◆ m_logstr

MsgStream LArRodBlockPhysicsV3::m_logstr
private

Definition at line 207 of file LArRodBlockPhysicsV3.h.

◆ m_mFebBlocks

FEBMAPTYPE LArRodBlockStructure::m_mFebBlocks
protectedinherited

Definition at line 234 of file LArRodBlockStructure.h.

◆ m_MiddleHeaderSize

int32_t LArRodBlockStructure::m_MiddleHeaderSize
protectedinherited

Definition at line 239 of file LArRodBlockStructure.h.

◆ m_NCounterBlkWords

int LArRodBlockPhysicsV3::m_NCounterBlkWords
private

Definition at line 185 of file LArRodBlockPhysicsV3.h.

◆ m_NEnergyBlkWords

int LArRodBlockPhysicsV3::m_NEnergyBlkWords
private

Definition at line 186 of file LArRodBlockPhysicsV3.h.

◆ m_NFebInfoBlkWords

int LArRodBlockPhysicsV3::m_NFebInfoBlkWords
private

Definition at line 188 of file LArRodBlockPhysicsV3.h.

◆ m_NFlaggingWords

int LArRodBlockPhysicsV3::m_NFlaggingWords
private

Definition at line 190 of file LArRodBlockPhysicsV3.h.

◆ m_NGainBlkWords

int LArRodBlockPhysicsV3::m_NGainBlkWords
private

Definition at line 187 of file LArRodBlockPhysicsV3.h.

◆ m_NSumBlkWords

int LArRodBlockPhysicsV3::m_NSumBlkWords
private

Definition at line 184 of file LArRodBlockPhysicsV3.h.

◆ m_numberHotCell

uint16_t LArRodBlockPhysicsV3::m_numberHotCell = 0U
private

Definition at line 192 of file LArRodBlockPhysicsV3.h.

◆ m_numberHotCellOffTime

uint16_t LArRodBlockPhysicsV3::m_numberHotCellOffTime = 0U
private

Definition at line 193 of file LArRodBlockPhysicsV3.h.

◆ m_numberOfEx

uint32_t LArRodBlockStructure::m_numberOfEx
protectedinherited

Definition at line 214 of file LArRodBlockStructure.h.

◆ m_numberOfEy

uint32_t LArRodBlockStructure::m_numberOfEy
protectedinherited

Definition at line 215 of file LArRodBlockStructure.h.

◆ m_numberOfEz

uint32_t LArRodBlockStructure::m_numberOfEz
protectedinherited

Definition at line 216 of file LArRodBlockStructure.h.

◆ m_numberOfSumE

uint32_t LArRodBlockStructure::m_numberOfSumE
protectedinherited

Definition at line 217 of file LArRodBlockStructure.h.

◆ m_OfflineToRawGainMap

const uint32_t LArRodBlockStructure::m_OfflineToRawGainMap ={3,2,1}
staticprotectedinherited

Definition at line 21 of file LArRodBlockStructure.h.

◆ m_OffTimeCut

int16_t LArRodBlockPhysicsV3::m_OffTimeCut
private

Definition at line 195 of file LArRodBlockPhysicsV3.h.

◆ m_onlineHelper

const LArOnlineID* LArRodBlockPhysicsV3::m_onlineHelper
private

Definition at line 200 of file LArRodBlockPhysicsV3.h.

◆ m_pRODblock

std::vector<uint32_t>* LArRodBlockStructure::m_pRODblock
protectedinherited

Definition at line 232 of file LArRodBlockStructure.h.

◆ m_RawDataBlock

std::vector<uint32_t> LArRodBlockPhysicsV3::m_RawDataBlock
private

Definition at line 162 of file LArRodBlockPhysicsV3.h.

◆ m_RawDataCounter

int LArRodBlockPhysicsV3::m_RawDataCounter = 0
private

Definition at line 166 of file LArRodBlockPhysicsV3.h.

◆ m_RawDataFlagsPtr

const uint32_t* LArRodBlockPhysicsV3::m_RawDataFlagsPtr
private

Definition at line 182 of file LArRodBlockPhysicsV3.h.

◆ m_RawDataIndex

int LArRodBlockPhysicsV3::m_RawDataIndex = 0
private

Definition at line 167 of file LArRodBlockPhysicsV3.h.

◆ m_RawDataPtr

const int16_t* LArRodBlockPhysicsV3::m_RawDataPtr
private

Definition at line 181 of file LArRodBlockPhysicsV3.h.

◆ m_RawToOfflineGainMap

const uint32_t LArRodBlockStructure::m_RawToOfflineGainMap ={0, 2, 1,0}
staticprotectedinherited

Definition at line 20 of file LArRodBlockStructure.h.

◆ m_rearrangeFirstSample

unsigned int LArRodBlockStructure::m_rearrangeFirstSample
protectedinherited

Definition at line 241 of file LArRodBlockStructure.h.

◆ m_ROB_to_decode

int32_t LArRodBlockStructure::m_ROB_to_decode
protectedinherited

Definition at line 246 of file LArRodBlockStructure.h.

◆ m_RodBlock

const uint32_t* LArRodBlockStructure::m_RodBlock
protectedinherited

Definition at line 228 of file LArRodBlockStructure.h.

◆ m_RodBlockSize

int32_t LArRodBlockStructure::m_RodBlockSize
protectedinherited

Definition at line 230 of file LArRodBlockStructure.h.

◆ m_SumBlkBlock

std::vector<uint32_t> LArRodBlockPhysicsV3::m_SumBlkBlock
private

Definition at line 156 of file LArRodBlockPhysicsV3.h.

◆ m_SumBlkIndex

int LArRodBlockPhysicsV3::m_SumBlkIndex = 0
private

Definition at line 173 of file LArRodBlockPhysicsV3.h.

◆ m_SumBlkPtr

const uint32_t* LArRodBlockPhysicsV3::m_SumBlkPtr
private

Definition at line 175 of file LArRodBlockPhysicsV3.h.

◆ m_SumE

int32_t LArRodBlockStructure::m_SumE
protectedinherited

Definition at line 210 of file LArRodBlockStructure.h.

◆ m_TimeQualityBlock

std::vector<uint32_t> LArRodBlockPhysicsV3::m_TimeQualityBlock
private

Definition at line 161 of file LArRodBlockPhysicsV3.h.

◆ m_TimeQualityIndex

int LArRodBlockPhysicsV3::m_TimeQualityIndex = 0
private

Definition at line 172 of file LArRodBlockPhysicsV3.h.

◆ m_TimeQualityPtr

const int16_t* LArRodBlockPhysicsV3::m_TimeQualityPtr
private

Definition at line 178 of file LArRodBlockPhysicsV3.h.

◆ m_vFragment

std::vector<uint32_t>* LArRodBlockStructure::m_vFragment
protectedinherited

Definition at line 231 of file LArRodBlockStructure.h.

◆ m_virtualROBJump

uint32_t LArRodBlockStructure::m_virtualROBJump
protectedinherited

Definition at line 245 of file LArRodBlockStructure.h.

◆ m_virtualROBPointer

const uint32_t* LArRodBlockStructure::m_virtualROBPointer
protectedinherited

Definition at line 247 of file LArRodBlockStructure.h.

◆ m_virtualROBPointerLocal

const uint32_t* LArRodBlockStructure::m_virtualROBPointerLocal
protectedinherited

Definition at line 248 of file LArRodBlockStructure.h.


The documentation for this class was generated from the following files: