|
ATLAS Offline Software
|
Provides conversion from TileRawChannel, TileL2 and TMDB (digits,MF raw channel,decision) to ROD format.
More...
#include <TileROD_Encoder.h>
Provides conversion from TileRawChannel, TileL2 and TMDB (digits,MF raw channel,decision) to ROD format.
- Author
- A. Solodkov
- Version
- 0-0-1 , Oct 17, 2002
Modified, Jan 20, 2003 Split from TileROD_Decoder.
Definition at line 44 of file TileROD_Encoder.h.
◆ TileROD_Encoder()
TileROD_Encoder::TileROD_Encoder |
( |
| ) |
|
◆ ~TileROD_Encoder()
TileROD_Encoder::~TileROD_Encoder |
( |
| ) |
|
|
inline |
◆ add()
◆ addDigi()
◆ addL2()
◆ addTileMuRcvObj()
add TMBDs ROD sub-fragmens TileMuRcvObj (type3) to the current list
Definition at line 81 of file TileROD_Encoder.h.
◆ checkBit()
bool TileROD_Encoder::checkBit |
( |
const uint32_t * |
p, |
|
|
int |
chan |
|
) |
| |
|
private |
◆ dumpROD()
void TileROD_Encoder::dumpROD |
( |
const std::vector< uint32_t > & |
v | ) |
|
◆ fillROD()
void TileROD_Encoder::fillROD |
( |
std::vector< uint32_t > & |
v | ) |
|
convert all TileRawChannels in the current list to a vector of 32bit words
Definition at line 113 of file TileROD_Encoder.cxx.
◆ fillROD1()
void TileROD_Encoder::fillROD1 |
( |
std::vector< uint32_t > & |
v | ) |
|
convert all TileDigits in the current list to a vector of 32bit words
Definition at line 471 of file TileROD_Encoder.cxx.
475 int currentFrag = -1,
pos = 0,
size = 0;
480 if (frag != currentFrag) {
481 if (currentFrag != -1)
v[
pos] =
size;
484 v.push_back(0xFF1234FF);
494 if (currentFrag != -1)
v[
pos] =
size;
◆ fillROD10()
void TileROD_Encoder::fillROD10 |
( |
std::vector< uint32_t > & |
v | ) |
|
convert all TileL2s in the current list to a vector of 32bit words
Definition at line 145 of file TileROD_Encoder.cxx.
148 std::vector<uint32_t>::size_type
start = 0;
150 int NMuons1 = 0, NMuons2 = 0, frag = 0;
154 int ros = ((
l2->identify()) | 0xff) >> 8;
155 int drawer = (
l2->identify()) & 0xff;
159 if (frag != currentFrag) {
164 v.push_back(0xff1234ff);
176 for (
int i = 0;
i < 2; ++
i)
184 NMuons1 =
l2->NMuons();
185 for (
int i = 0;
i < 2 * NMuons1; ++
i)
186 v.push_back(
l2->val(
i));
192 v[
start + 1] = (
unsigned int) (wet + 9000);
195 NMuons2 =
l2->NMuons();
196 for (
int i = 0;
i < 2 * NMuons2; ++
i)
197 v.push_back(
l2->val(
i));
200 v[
start - 2] = 5 + 2 * NMuons1 + 2 * NMuons2;
◆ fillROD12()
void TileROD_Encoder::fillROD12 |
( |
std::vector< uint32_t > & |
v | ) |
|
Definition at line 209 of file TileROD_Encoder.cxx.
212 std::vector<uint32_t>::size_type
start = 0;
218 int ros = (
l2->identify()) >> 8;
219 int drawer = (
l2->identify()) & 0xff;
226 if (frag != currentFrag) {
231 v.push_back(0xff1234ff);
244 int Ndata =
l2->Ndata();
246 for (
int i = 0;
i < Ndata; ++
i)
247 v.push_back(
l2->val(
i));
◆ fillROD2()
void TileROD_Encoder::fillROD2 |
( |
std::vector< uint32_t > & |
v | ) |
|
◆ fillROD3()
void TileROD_Encoder::fillROD3 |
( |
std::vector< uint32_t > & |
v | ) |
|
Definition at line 301 of file TileROD_Encoder.cxx.
304 std::vector<short>* p16;
305 p16 = (std::vector<short>*) (&
v);
306 std::vector<short>& v16 = *p16;
313 std::vector<uint32_t>::size_type
head = 0;
314 std::vector<uint32_t>::size_type
count = 0;
323 if (frag != currentFrag) {
328 if ((v16.size() % 2) == 1) {
370 if ((v16.size() % 2) == 1) {
◆ fillROD4()
void TileROD_Encoder::fillROD4 |
( |
std::vector< uint32_t > & |
v | ) |
|
Definition at line 383 of file TileROD_Encoder.cxx.
387 std::vector<uint32_t>::size_type
start = 0;
393 if (frag != currentFrag) {
397 v.push_back(0xff1234ff);
◆ fillROD5()
void TileROD_Encoder::fillROD5 |
( |
std::vector< uint32_t > & |
v | ) |
|
◆ fillROD5D()
void TileROD_Encoder::fillROD5D |
( |
std::vector< uint32_t > & |
v | ) |
|
◆ fillRODL2()
void TileROD_Encoder::fillRODL2 |
( |
std::vector< uint32_t > & |
v | ) |
|
Definition at line 432 of file TileROD_Encoder.cxx.
434 std::map<int, const TileL2*> l2_map;
437 l2_map[
l2->identify()] =
l2;
441 std::vector<uint32_t>::size_type
start = 3;
443 while (
start <=
v.size()) {
446 int type = (fragtype >> 16) & 0xFF;
448 if ((
type == 4 &&
size > 53) || (
type == 5 && ((fragtype >> 27) & 7) > 2)) {
449 int frag = fragtype & 0xFFFF;
450 std::map<int, const TileL2*>::const_iterator l2_it = l2_map.find(frag);
451 if (l2_it != l2_map.end()) {
452 int unit = (fragtype >> 30);
◆ fillRODTileMuRcvDigi()
void TileROD_Encoder::fillRODTileMuRcvDigi |
( |
std::vector< uint32_t > & |
v | ) |
|
convert the TMDB objects into a vector of 32bit words: 8bit words/digit, 16bit words/RC, 16bit words/decision
Definition at line 510 of file TileROD_Encoder.cxx.
516 v.push_back(0xff1234ff);
523 uint savepos=
v.size()-1;
528 uint32_t type_version = (0x40 << 16) + verfrag;
529 v.push_back(type_version);
535 int word8bit_cnt = 0;
541 memset(word, 0,
sizeof(word));
546 ATH_MSG_WARNING(
"Too many channels per fragment for TMDB frag 0x40 - ignoring all the rest" );
552 std::vector<float> digits = digi->samples();
553 nsamp = digits.size();
555 ATH_MSG_WARNING(
"Too many samples in digits for TMDB frag 0x40, using first 7 instead of "<<nsamp );
557 digits.resize(nsamp);
569 int shift = word8bit_cnt * 8;
570 for (
uint i=0;
i<nsamp; ++
i ) {
571 word[
i] += ((
int) digits[
i]) << shift;
579 const char * strchannel[5] = {
" d5L ",
" d5R ",
" d6L ",
" d6R ",
" xxx "};
582 for (
uint i=0;
i<nsamp; ++
i ) {
584 <<
"\tSample "<<7-
i<<
" bits |" << std::setfill(
'0') << std::setw(2)
585 << shift <<
"-" << std::setw(2) << shift+7 << std::setfill(
'0')
586 <<
"| of 32-bit word "<<3 + nwc*
i + wc<<
" "<<digits[
i]
587 <<
" "<<MSG::hex<<word[
i]<<MSG::dec <<
endmsg;
603 if ( word8bit_cnt == 4 ) {
604 for (
uint i=0;
i<nsamp; ++
i ) {
605 v.at( 3 + nwc*
i + wc ) = word[
i];
609 memset(word, 0,
sizeof(word));
614 if ( word8bit_cnt != 0 && wc<nwc ) {
615 ATH_MSG_WARNING(
"Unexpected number of channels for TMDB frag 0x40" << wc*4 + word8bit_cnt );
616 for (
uint i=0;
i<nsamp; ++
i ) {
617 v.at( 3 + nwc*
i + wc ) = word[
i];
621 memset(word, 0 ,
sizeof(word));
624 v.at(savepos)=3+
size;
626 ATH_MSG_DEBUG(
"Check version and counters: "<<MSG::hex<< verfrag <<MSG::dec<<
" "<< chc <<
" "<< wc <<
" save in position: " << savepos );
631 msg(
MSG::VERBOSE) <<
"Check content of ROD fragment after including sub-fragment (0x40)... " <<
v.size() <<
endmsg;
632 for (
size_t i=0;
i<
v.size(); ++
i)
◆ fillRODTileMuRcvObj()
void TileROD_Encoder::fillRODTileMuRcvObj |
( |
std::vector< uint32_t > & |
v | ) |
|
Definition at line 765 of file TileROD_Encoder.cxx.
773 v.push_back(0xff1234ff);
778 uint savepos =
v.size()-1;
780 uint32_t type_version = (0x42 << 16) + verfrag;
781 v.push_back(type_version);
795 msg(MSG::INFO) <<
"Going trough RUN2 encoding procedure for TMDB data" <<
endmsg;
814 int modid = tmurcv->identify() & 0xff;
816 const std::vector<bool> & slin = tmurcv->GetDecision();
820 if (slin[
i]) word4b |= 1 << (3-
i);
824 std::stringstream
ss;
825 for (
const bool val : slin) {
826 ss<<std::setw(2)<<
val;
828 msg(MSG::INFO) <<
"Result for module: "<<modid<<
" in TMDB board "<<modid%8<<MSG::hex<<
": 0x"<<word4b<<MSG::dec<<
" from "<<
ss.str() <<
endmsg;
832 case 0: result1 |= word4b << 4 ;
break;
833 case 1: result1 |= word4b << 8 ;
break;
834 case 2: result1 |= word4b << 12 ; result2 |= word4b;
break;
835 case 3: result2 |= word4b << 4 ;
break;
836 case 4: result2 |= word4b << 8 ;
break;
837 case 5: result2 |= word4b << 12 ; result3 |= word4b;
break;
838 case 6: result3 |= word4b << 4 ;
break;
839 case 7: result3 |= word4b << 8 ;
break;
844 ATH_MSG_INFO(
"Summary : "<<MSG::hex<<
" Results 1: 0x"<<result1<<
" Results 2: 0x"<<result2<<
" Results 3: 0x"<<result3<< MSG::dec );
846 v.push_back( result1 | (result2 << 16) ); ++wc;
847 v.push_back( result3 ); ++wc;
854 msg(MSG::INFO) <<
"Going trough RUN3 encoding procedure for TMDB data" <<
endmsg;
882 int modid = tmurcv->identify() & 0xff;
883 const std::vector<bool> & slin = tmurcv->GetDecision();
890 if (slin[
i]) word3b |= 1 << (3-
i);
894 case 0: result1 |= word3b ;
break;
895 case 1: result1 |= word3b << 3 ;
break;
896 case 2: result1 |= word3b << 6 ; result2 |= word3b ;
break;
897 case 3: result1 |= word3b << 9 ; result2 |= word3b << 3 ;
break;
898 case 4: result2 |= word3b << 6 ; result3 |= word3b ;
break;
899 case 5: result2 |= word3b << 9 ; result3 |= word3b << 3 ;
break;
900 case 6: result3 |= word3b << 6 ;
break;
901 case 7: result3 |= word3b << 9 ;
break;
906 ATH_MSG_INFO(
"Summary : "<<MSG::hex<<
" Results 1: 0x"<<result1<<
" Results 2: 0x"<<result2<<
" Results 3: 0x"<<result3<< MSG::dec );
908 v.push_back( result1 | (result2 << 16) ); ++wc;
909 v.push_back( result3 ); ++wc;
910 v.at(savepos) = 3+wc;
915 ATH_MSG_INFO(
"Tile Muon Decision Board (TMDB) fragment versions are only available for RUN2 and RUN3");
919 msg(MSG::INFO) <<
"Check version and counters: "<<MSG::hex<<verfrag<<MSG::dec<<
" "<<chc<<
" "<<wc<<
" save in position: "<<savepos<<
endmsg;
920 msg(MSG::INFO) <<
"Check content of ROD fragment after including sub-fragment (0x42)... " <<
v.size() <<
endmsg;
921 for (
size_t i=0;
i<
v.size(); ++
i) {
922 msg(MSG::INFO) <<
i <<
"\t" <<
v.at(
i) << MSG::hex <<
" 0x" <<
v.at(
i) << MSG::dec <<
endmsg;
◆ fillRODTileMuRcvRawChannel()
void TileROD_Encoder::fillRODTileMuRcvRawChannel |
( |
std::vector< uint32_t > & |
v | ) |
|
Definition at line 641 of file TileROD_Encoder.cxx.
645 const float TMDB_AMPLITUDE_FACTOR = 1.0;
649 v.push_back(0xff1234ff);
654 uint savepos=
v.size()-1;
662 if (use_16bit_packing) verfrag += 2;
663 int32_t word16 = 0x0;
665 uint32_t type_version = (0x41 << 16) + verfrag;
666 v.push_back(type_version);
679 float f_amp =
rc -> amplitude();
680 int32_t i_amp = lround(f_amp*TMDB_AMPLITUDE_FACTOR) ;
701 if (i_amp>0x7FFF) word16 = 0x7FFF;
702 else if (i_amp<-0x8000) word16 = -0x8000;
706 word |= word16 << 16;
710 word = word16 & 0xFFFF;
726 int frag_id =
rc->frag();
727 int drawer = (frag_id&0xFF);
728 int ros = frag_id>>8;
730 const char * strchannel[5] = {
" d5L ",
" d5R ",
" d6L ",
" d6R ",
" xxx "};
734 <<
"\tAmp " << f_amp <<
" " << i_amp <<
" "
735 <<
" ch cnt " << chc <<
" word cnt " << wc
736 <<
" word 0x" <<MSG::hex<< word <<MSG::dec<<
endmsg;
744 if (verfrag==0x502 && wc*2 != chc) {
752 ATH_MSG_DEBUG(
"Check version and counters: "<<MSG::hex<< verfrag <<MSG::dec<<
" "<< chc <<
" "<< wc <<
" save in position: "<< savepos );
756 for (
size_t i=0;
i<
v.size(); ++
i) {
◆ initMessaging()
void AthMessaging::initMessaging |
( |
| ) |
const |
|
privateinherited |
Initialize our message level and MessageSvc.
This method should only be called once.
Definition at line 39 of file AthMessaging.cxx.
◆ msg() [1/2]
MsgStream & AthMessaging::msg |
( |
| ) |
const |
|
inlineinherited |
The standard message stream.
Returns a reference to the default message stream May not be invoked before sysInitialize() has been invoked.
Definition at line 164 of file AthMessaging.h.
◆ msg() [2/2]
MsgStream & AthMessaging::msg |
( |
const MSG::Level |
lvl | ) |
const |
|
inlineinherited |
The standard message stream.
Returns a reference to the default message stream May not be invoked before sysInitialize() has been invoked.
Definition at line 179 of file AthMessaging.h.
180 {
return msg() << lvl; }
◆ msgLvl()
bool AthMessaging::msgLvl |
( |
const MSG::Level |
lvl | ) |
const |
|
inlineinherited |
Test the output level.
- Parameters
-
lvl | The message level to test against |
- Returns
- boolean Indicating if messages at given level will be printed
- Return values
-
true | Messages at level "lvl" will be printed |
Definition at line 151 of file AthMessaging.h.
◆ setBit()
void TileROD_Encoder::setBit |
( |
uint32_t * |
p, |
|
|
int |
chan |
|
) |
| |
|
private |
◆ setLevel()
void AthMessaging::setLevel |
( |
MSG::Level |
lvl | ) |
|
|
inherited |
◆ setMaxChannels()
void TileROD_Encoder::setMaxChannels |
( |
int |
maxChannels | ) |
|
◆ setTileHWID() [1/2]
void TileROD_Encoder::setTileHWID |
( |
const TileHWID * |
tileHWID, |
|
|
bool |
verbose, |
|
|
unsigned int |
type = 4 |
|
) |
| |
◆ setTileHWID() [2/2]
void TileROD_Encoder::setTileHWID |
( |
const TileHWID * |
tileHWID, |
|
|
int |
m_runPeriod |
|
) |
| |
◆ setTypeAndUnit()
set OF algorigtm type and amplitude units for a drawer
Definition at line 65 of file TileROD_Encoder.cxx.
67 unsigned int OFType = (
unsigned int)
type;
71 <<
" using type=0 instead " );
78 <<
" assuming ADC counts (0) " );
91 m_unitType = (rChUnit << 30) | (3 << 28) | (0 << 27) | (OFType << 24) | (
m_type << 16);
◆ ATLAS_THREAD_SAFE
std::atomic_flag m_initialized AthMessaging::ATLAS_THREAD_SAFE = ATOMIC_FLAG_INIT |
|
mutableprivateinherited |
◆ m_Digi2bytes
◆ m_imsg
std::atomic<IMessageSvc*> AthMessaging::m_imsg { nullptr } |
|
mutableprivateinherited |
◆ m_lvl
std::atomic<MSG::Level> AthMessaging::m_lvl { MSG::NIL } |
|
mutableprivateinherited |
◆ m_maxChannels
int TileROD_Encoder::m_maxChannels |
|
private |
◆ m_msg_tls
boost::thread_specific_ptr<MsgStream> AthMessaging::m_msg_tls |
|
mutableprivateinherited |
MsgStream instance (a std::cout like with print-out levels)
Definition at line 132 of file AthMessaging.h.
◆ m_nm
std::string AthMessaging::m_nm |
|
privateinherited |
◆ m_order
◆ m_rc2bytes2
◆ m_rc2bytes3
◆ m_rc2bytes4
◆ m_rc2bytes5
◆ m_rChUnit
unsigned int TileROD_Encoder::m_rChUnit |
|
private |
◆ m_runPeriod
int TileROD_Encoder::m_runPeriod |
|
private |
◆ m_tileHWID
◆ m_type
unsigned int TileROD_Encoder::m_type |
|
private |
◆ m_unitType
unsigned int TileROD_Encoder::m_unitType |
|
private |
◆ m_verbose
bool TileROD_Encoder::m_verbose |
|
private |
◆ m_vTileDigi
◆ m_vTileL2
◆ m_vTileMuRcvObj
◆ m_vTileRC
The documentation for this class was generated from the following files:
TileRawDataOrdering m_order
std::atomic< MSG::Level > m_lvl
Current logging level.
char data[hepevt_bytes_allocation_ATLAS]
Extra patterns decribing particle interation process.
void fillROD3(std::vector< uint32_t > &v)
void setVerbose(bool verbose)
Sets verbose mode true or false.
void dumpROD(const std::vector< uint32_t > &v)
dump contents of the ROD fragment
float round(const float toRound, const unsigned int decimals)
void fillROD4(std::vector< uint32_t > &v)
void fillROD1(std::vector< uint32_t > &v)
convert all TileDigits in the current list to a vector of 32bit words
void setVerbose(bool)
Sets verbose mode true or false.
TileRawChannel2Bytes5 m_rc2bytes5
int frag(const HWIdentifier &id) const
extract frag field from HW identifier
void setBit(uint32_t *p, int chan)
set the bitmap for a channel
std::atomic< IMessageSvc * > m_imsg
MessageSvc pointer.
int getBytes(const TileDigits *digi, const TileHWID *tileHWID, std::vector< unsigned int > &v)
bool checkBit(const uint32_t *p, int chan)
check the bitmap for a channel
IMessageSvc * getMessageSvc(bool quiet=false)
int channel(const HWIdentifier &id) const
extract channel field from HW identifier
int ros(const HWIdentifier &id) const
extract ros field from HW identifier
unsigned int getWord(const TileFastRawChannel *rc, int gain)
Returns a single 32-bit word which encodes the TileRawChannel information (gain,amplitude,...
AthMessaging()
Default constructor:
void fillROD5(std::vector< uint32_t > &v)
bool msgLvl(const MSG::Level lvl) const
Test the output level.
void fillROD10(std::vector< uint32_t > &v)
convert all TileL2s in the current list to a vector of 32bit words
const TileHWID * m_tileHWID
TileRawChannel2Bytes2 m_rc2bytes2
MsgStream & msg() const
The standard message stream.
int getBytes(const TileFastRawChannel *rc, int gain, std::vector< short > &v)
Pack TileRawChannel information (gain, amplitude, phase and quality) in 3 16-bit words.
std::string head(std::string s, const std::string &pattern)
head of a string
std::vector< const TileFastRawChannel * > m_vTileRC
std::vector< const TileMuonReceiverObj * > m_vTileMuRcvObj
unsigned int getWord(const TileFastRawChannel &rc, unsigned int unit, int gain) const
Returns a single 32-bit word which encodes the TileRawChannel information (gain,amplitude,...
int drawer(const HWIdentifier &id) const
extract drawer field from HW identifier
void sort(typename std::reverse_iterator< DataModel_detail::iterator< DVL > > beg, typename std::reverse_iterator< DataModel_detail::iterator< DVL > > end, const Compare &comp)
Specialization of sort for DataVector/List.
#define ATH_MSG_WARNING(x)
void setVerbose(bool)
Sets verbose mode true or false.
const PlainObject unit() const
This is a plugin that makes Eigen look like CLHEP & defines some convenience methods.
TileDigits2Bytes m_Digi2bytes
std::string m_nm
Message source name.
std::vector< const TileDigits * > m_vTileDigi
const double AMPLITUDE_FACTOR5_HG[4]
void fillROD2(std::vector< uint32_t > &v)
TileRawChannel2Bytes m_rc2bytes3
void initMessaging() const
Initialize our message level and MessageSvc.
static const unsigned int MAX_CHAN
Number of channels in drawer.
boost::thread_specific_ptr< MsgStream > m_msg_tls
MsgStream instance (a std::cout like with print-out levels)
TileRawChannel2Bytes4 m_rc2bytes4
std::vector< const TileL2 * > m_vTileL2
void setVerbose(bool verbose)
Sets verbose mode true or false.
Class to store TileMuId and Et quantities computed at the TileCal ROD DSPs.
void fillROD12(std::vector< uint32_t > &v)