 |
ATLAS Offline Software
|
Go to the documentation of this file.
30 ShortVecAdapter (std::vector<uint32_t>&
v)
35 m_v.back() |= (
x << 16);
49 std::vector<uint32_t>& m_v;
50 bool m_offset =
false;
99 unsigned int OFType = (
unsigned int)
type;
103 <<
" using type=0 instead " );
110 <<
" assuming ADC counts (0) " );
123 m_unitType = (rChUnit << 30) | (3 << 28) | (0 << 27) | (OFType << 24) | (
m_type << 16);
180 std::vector<uint32_t>::size_type
start = 0;
182 int NMuons1 = 0, NMuons2 = 0, frag = 0;
186 int ros = ((
l2->identify()) | 0xff) >> 8;
187 int drawer = (
l2->identify()) & 0xff;
191 if (frag != currentFrag) {
196 v.push_back(0xff1234ff);
208 for (
int i = 0;
i < 2; ++
i)
216 NMuons1 =
l2->NMuons();
217 for (
int i = 0;
i < 2 * NMuons1; ++
i)
218 v.push_back(
l2->val(
i));
224 v[
start + 1] = (
unsigned int) (wet + 9000);
227 NMuons2 =
l2->NMuons();
228 for (
int i = 0;
i < 2 * NMuons2; ++
i)
229 v.push_back(
l2->val(
i));
232 v[
start - 2] = 5 + 2 * NMuons1 + 2 * NMuons2;
244 std::vector<uint32_t>::size_type
start = 0;
250 int ros = (
l2->identify()) >> 8;
251 int drawer = (
l2->identify()) & 0xff;
258 if (frag != currentFrag) {
263 v.push_back(0xff1234ff);
276 int Ndata =
l2->Ndata();
278 for (
int i = 0;
i < Ndata; ++
i)
279 v.push_back(
l2->val(
i));
293 std::vector<uint32_t>::size_type
start = 0;
299 if (frag != currentFrag) {
320 int chan = rc->channel();
321 int gain = rc->adc();
334 ShortVecAdapter v16 (
v);
340 std::vector<uint32_t>::size_type
head = 0;
341 std::vector<uint32_t>::size_type
count = 0;
343 std::vector<short> vshort;
349 int chan = rc->channel();
350 int gain = rc->adc();
352 if (frag != currentFrag) {
387 for (
short x : vshort)
411 std::vector<uint32_t>::size_type
start = 0;
417 if (frag != currentFrag) {
421 v.push_back(0xff1234ff);
443 int chan = rc->channel();
444 int gain = rc->adc();
458 std::map<int, const TileL2*> l2_map;
461 l2_map[
l2->identify()] =
l2;
465 std::vector<uint32_t>::size_type
start = 3;
467 while (
start <=
v.size()) {
470 int type = (fragtype >> 16) & 0xFF;
472 if ((
type == 4 &&
size > 53) || (
type == 5 && ((fragtype >> 27) & 7) > 2)) {
473 int frag = fragtype & 0xFFFF;
474 std::map<int, const TileL2*>::const_iterator l2_it = l2_map.find(frag);
475 if (l2_it != l2_map.end()) {
476 int unit = (fragtype >> 30);
499 int currentFrag = -1,
pos = 0,
size = 0;
504 if (frag != currentFrag) {
505 if (currentFrag != -1)
v[
pos] =
size;
508 v.push_back(0xFF1234FF);
518 if (currentFrag != -1)
v[
pos] =
size;
523 ATH_MSG_ERROR(
"fillROD5 -> store raw channels in frag5 - not yet implemented " );
527 ATH_MSG_ERROR(
"fillROD5D -> store digits in frag5 - not yet implemented " );
540 v.push_back(0xff1234ff);
547 uint savepos=
v.size()-1;
552 uint32_t type_version = (0x40 << 16) + verfrag;
553 v.push_back(type_version);
559 int word8bit_cnt = 0;
565 memset(word, 0,
sizeof(word));
570 ATH_MSG_WARNING(
"Too many channels per fragment for TMDB frag 0x40 - ignoring all the rest" );
576 std::vector<float> digits = digi->samples();
577 nsamp = digits.size();
579 ATH_MSG_WARNING(
"Too many samples in digits for TMDB frag 0x40, using first 7 instead of "<<nsamp );
581 digits.resize(nsamp);
593 int shift = word8bit_cnt * 8;
594 for (
uint i=0;
i<nsamp; ++
i ) {
595 word[
i] += ((
int) digits[
i]) << shift;
603 const char * strchannel[5] = {
" d5L ",
" d5R ",
" d6L ",
" d6R ",
" xxx "};
606 for (
uint i=0;
i<nsamp; ++
i ) {
608 <<
"\tSample "<<7-
i<<
" bits |" << std::setfill(
'0') << std::setw(2)
609 << shift <<
"-" << std::setw(2) << shift+7 << std::setfill(
'0')
610 <<
"| of 32-bit word "<<3 + nwc*
i + wc<<
" "<<digits[
i]
611 <<
" "<<MSG::hex<<word[
i]<<MSG::dec <<
endmsg;
627 if ( word8bit_cnt == 4 ) {
628 for (
uint i=0;
i<nsamp; ++
i ) {
629 v.at( 3 + nwc*
i + wc ) = word[
i];
633 memset(word, 0,
sizeof(word));
638 if ( word8bit_cnt != 0 && wc<nwc ) {
639 ATH_MSG_WARNING(
"Unexpected number of channels for TMDB frag 0x40" << wc*4 + word8bit_cnt );
640 for (
uint i=0;
i<nsamp; ++
i ) {
641 v.at( 3 + nwc*
i + wc ) = word[
i];
645 memset(word, 0 ,
sizeof(word));
648 v.at(savepos)=3+
size;
650 ATH_MSG_DEBUG(
"Check version and counters: "<<MSG::hex<< verfrag <<MSG::dec<<
" "<< chc <<
" "<< wc <<
" save in position: " << savepos );
655 msg(
MSG::VERBOSE) <<
"Check content of ROD fragment after including sub-fragment (0x40)... " <<
v.size() <<
endmsg;
656 for (
size_t i=0;
i<
v.size(); ++
i)
669 const float TMDB_AMPLITUDE_FACTOR = 1.0;
673 v.push_back(0xff1234ff);
678 uint savepos=
v.size()-1;
686 if (use_16bit_packing) verfrag += 2;
687 int32_t word16 = 0x0;
689 uint32_t type_version = (0x41 << 16) + verfrag;
690 v.push_back(type_version);
703 float f_amp = rc -> amplitude();
704 int32_t i_amp = lround(f_amp*TMDB_AMPLITUDE_FACTOR) ;
725 if (i_amp>0x7FFF) word16 = 0x7FFF;
726 else if (i_amp<-0x8000) word16 = -0x8000;
730 word |= word16 << 16;
734 word = word16 & 0xFFFF;
750 int frag_id = rc->frag();
751 int drawer = (frag_id&0xFF);
752 int ros = frag_id>>8;
754 const char * strchannel[5] = {
" d5L ",
" d5R ",
" d6L ",
" d6R ",
" xxx "};
758 <<
"\tAmp " << f_amp <<
" " << i_amp <<
" "
759 <<
" ch cnt " << chc <<
" word cnt " << wc
760 <<
" word 0x" <<MSG::hex<< word <<MSG::dec<<
endmsg;
768 if (verfrag==0x502 && wc*2 != chc) {
776 ATH_MSG_DEBUG(
"Check version and counters: "<<MSG::hex<< verfrag <<MSG::dec<<
" "<< chc <<
" "<< wc <<
" save in position: "<< savepos );
780 for (
size_t i=0;
i<
v.size(); ++
i) {
797 v.push_back(0xff1234ff);
802 uint savepos =
v.size()-1;
804 uint32_t type_version = (0x42 << 16) + verfrag;
805 v.push_back(type_version);
838 int modid = tmurcv->identify() & 0xff;
840 const std::vector<bool> & slin = tmurcv->GetDecision();
844 if (slin[
i]) word4b |= 1 << (3-
i);
848 std::stringstream
ss;
849 for (
const bool val : slin) {
850 ss<<std::setw(2)<<
val;
852 msg(
MSG::INFO) <<
"Result for module: "<<modid<<
" in TMDB board "<<modid%8<<MSG::hex<<
": 0x"<<word4b<<MSG::dec<<
" from "<<
ss.str() <<
endmsg;
856 case 0: result1 |= word4b << 4 ;
break;
857 case 1: result1 |= word4b << 8 ;
break;
858 case 2: result1 |= word4b << 12 ; result2 |= word4b;
break;
859 case 3: result2 |= word4b << 4 ;
break;
860 case 4: result2 |= word4b << 8 ;
break;
861 case 5: result2 |= word4b << 12 ; result3 |= word4b;
break;
862 case 6: result3 |= word4b << 4 ;
break;
863 case 7: result3 |= word4b << 8 ;
break;
868 ATH_MSG_INFO(
"Summary : "<<MSG::hex<<
" Results 1: 0x"<<result1<<
" Results 2: 0x"<<result2<<
" Results 3: 0x"<<result3<< MSG::dec );
870 v.push_back( result1 | (result2 << 16) ); ++wc;
871 v.push_back( result3 ); ++wc;
906 int modid = tmurcv->identify() & 0xff;
907 const std::vector<bool> & slin = tmurcv->GetDecision();
914 if (slin[
i]) word3b |= 1 << (3-
i);
918 case 0: result1 |= word3b ;
break;
919 case 1: result1 |= word3b << 3 ;
break;
920 case 2: result1 |= word3b << 6 ; result2 |= word3b ;
break;
921 case 3: result1 |= word3b << 9 ; result2 |= word3b << 3 ;
break;
922 case 4: result2 |= word3b << 6 ; result3 |= word3b ;
break;
923 case 5: result2 |= word3b << 9 ; result3 |= word3b << 3 ;
break;
924 case 6: result3 |= word3b << 6 ;
break;
925 case 7: result3 |= word3b << 9 ;
break;
930 ATH_MSG_INFO(
"Summary : "<<MSG::hex<<
" Results 1: 0x"<<result1<<
" Results 2: 0x"<<result2<<
" Results 3: 0x"<<result3<< MSG::dec );
932 v.push_back( result1 | (result2 << 16) ); ++wc;
933 v.push_back( result3 ); ++wc;
934 v.at(savepos) = 3+wc;
939 ATH_MSG_INFO(
"Tile Muon Decision Board (TMDB) fragment versions are only available for RUN2 and RUN3");
943 msg(
MSG::INFO) <<
"Check version and counters: "<<MSG::hex<<verfrag<<MSG::dec<<
" "<<chc<<
" "<<wc<<
" save in position: "<<savepos<<
endmsg;
944 msg(
MSG::INFO) <<
"Check content of ROD fragment after including sub-fragment (0x42)... " <<
v.size() <<
endmsg;
945 for (
size_t i=0;
i<
v.size(); ++
i) {
961 *(
p +
a) |= (1 <<
r);
971 return *(
p +
a) & (1 <<
r);
978 int count = 0, newCount = 3;
982 }
else if (
count == -1) {
985 }
else if (
count == -2) {
990 <<
data <<
" = 0x" << std::hex <<
data
TileRawDataOrdering m_order
char data[hepevt_bytes_allocation_ATLAS]
Extra patterns decribing particle interation process.
void fillROD3(std::vector< uint32_t > &v)
void fillRODTileMuRcvRawChannel(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
void setTileHWID(const TileHWID *tileHWID, bool verbose, unsigned int type=4)
set all necessary parameters for the encoder
Static class providing several utility functions and constants.
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
setScaleOne setStatusOne setSaturated int16_t
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
int channel(const HWIdentifier &id) const
extract channel field from HW identifier
void setTypeAndUnit(TileFragHash::TYPE type, TileRawChannelUnit::UNIT unit)
set OF algorigtm type and amplitude units for a drawer
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,...
Helper class for TileCal online (hardware) identifiers.
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
Class to provide easy MsgStream access and capabilities.
const TileHWID * m_tileHWID
void fillRODTileMuRcvObj(std::vector< uint32_t > &v)
TileRawChannel2Bytes2 m_rc2bytes2
MsgStream & msg() const
The standard message stream.
void setMaxChannels(int maxChannels)
set maximum number of channels in a drawer
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
void fillRODTileMuRcvDigi(std::vector< uint32_t > &v)
convert the TMDB objects into a vector of 32bit words: 8bit words/digit, 16bit words/RC,...
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
#define ATH_MSG_WARNING(x)
void setVerbose(bool)
Sets verbose mode true or false.
TileROD_Encoder()
constructor
void fillROD(std::vector< uint32_t > &v)
convert all TileRawChannels in the current list to a vector of 32bit words
void fillRODL2(std::vector< uint32_t > &v)
const PlainObject unit() const
This is a plugin that makes Eigen look like CLHEP & defines some convenience methods.
TileDigits2Bytes m_Digi2bytes
std::vector< const TileDigits * > m_vTileDigi
const double AMPLITUDE_FACTOR5_HG[4]
void fillROD2(std::vector< uint32_t > &v)
TileRawChannel2Bytes m_rc2bytes3
TileRawChannel2Bytes4 m_rc2bytes4
std::vector< const TileL2 * > m_vTileL2
void setVerbose(bool verbose)
Sets verbose mode true or false.
void fillROD5D(std::vector< uint32_t > &v)
Class to store TileMuId and Et quantities computed at the TileCal ROD DSPs.
void fillROD12(std::vector< uint32_t > &v)