ATLAS Offline Software
Classes | Public Types | Public Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
MatrixReadOut Class Reference

#include <MatrixReadOut.h>

Inheritance diagram for MatrixReadOut:
Collaboration diagram for MatrixReadOut:

Classes

struct  CMROData
 

Public Types

enum  DataVersion { Simulation, Atlas }
 

Public Member Functions

 MatrixReadOut (Matrix *p, ubit16 FEevent, uint NOBXS, DataVersion=MatrixReadOut::Atlas)
 
 MatrixReadOut (ubit16 FEevent=0, uint NOBXS=8, DataVersion=MatrixReadOut::Atlas)
 
 MatrixReadOut (ubit16 *v, ubit16 numWords, uint NOBXS, DataVersion=MatrixReadOut::Atlas)
 
 MatrixReadOut (const MatrixReadOut &MROOrig)
 
MatrixReadOutoperator= (const MatrixReadOut &MROOrig)=delete
 
 ~MatrixReadOut ()
 
MatrixReadOutStructure getCMAHit (int index)
 
MatrixReadOutStructure getHeader ()
 
MatrixReadOutStructure getSubHeader ()
 
MatrixReadOutStructure getFooter ()
 
void deleteCMABody ()
 
void reset (uint NOBXS)
 
void writeHeader (ubit16 CMcode)
 
void writeSubHeader ()
 
void writeCMABody (ubit16 _BC, ubit16 _TIME, ubit16 IJK, ubit16 _STRIP)
 
void writeFooter ()
 
void writeRecord (ubit16 thisRecord, bool last)
 
void overwriteHeader (ubit16 thisRecord)
 
void overwriteSubHeader (ubit16 thisRecord)
 
void reComputeFooter ()
 
ubit16 numberOfBodyWords ()
 
ubit16 numberOfFragmentWords ()
 
ubit16 readHeader ()
 
ubit16 readSubHeader ()
 
ubit16 readCMABodyCurrent ()
 
void readCMABody (ubit16 *Body)
 
ubit16 readFooter ()
 
ubit16 readCMAWord ()
 
ubit16 checkCRC8 (ubit16 foot)
 
void topCMABody ()
 
void display (std::ostream &stream)
 
void displayHeader (std::ostream &stream)
 
void displaySubHeader (std::ostream &stream)
 
void displayBody (std::ostream &stream)
 
void displayFooter (std::ostream &stream)
 
void bytestream (std::ostream &stream)
 
ubit16 checkBodyOrder (bool debugPrint=false)
 
ubit16 checkFragment ()
 
void doMatrix (Matrix *CMpointer)
 
void makeTestPattern (ubit16 mode, ubit16 ktimes, int eventNum)
 
ObjectType tag () const
 
std::string name () const
 
virtual void Print (std::ostream &, bool) const
 

Private Member Functions

void setManager (ReadOutManager *boss)
 
void makeFragment ()
 
void initialize (uint NOBXS)
 
void makeHeader ()
 
void makeSubHeader ()
 
void makeCMABody ()
 
void makeFooter ()
 
ubit16 makeCMABodyHit ()
 
ubit16 makeCMABodyTrg ()
 
void makeNewHit (ubit16 newHit)
 
void makeNewHit (ubit16 newHit, CMROData *previous, CMROData *next)
 
void sortAndMakeNewHit (ubit16 newHit)
 
ubit16 computeCR ()
 

Private Attributes

ReadOutManagerm_myBoss {}
 
MatrixReadOut::DataVersion m_data_version
 
MatrixReadOutStructure m_MROS {}
 
ubit16 m_BunchFrom {}
 
ubit16 m_BunchTo {}
 
ubit16 m_FEL1ID {}
 
ubit16 m_ROOffset {}
 
ubit16 m_NDLLCYC {}
 
ubit16 m_NBunch {}
 
ubit16 m_nclock {}
 
ubit16 m_nchan [2] {}
 
ubit16 m_timeSeparation {}
 
Matrixm_CM {}
 
ubit16m_BS {}
 
ubit16 m_Header {}
 
ubit16 m_Footer {}
 
ubit16 m_SubHeader {}
 
CMRODatam_Body {}
 
ubit16 m_addressOfWordScanned {}
 
CMRODatam_BodyLast {}
 
CMRODatam_BodyCurr {}
 
ubit16 m_first8bitsON {}
 
ubit16 m_numberOfWordsInFrag {}
 
ubit16 m_numberOfWordsInBody {}
 
ubit16 m_checkHeaderPos {}
 
ubit16 m_checkHeaderNum {}
 
ubit16 m_checkSubHeaderPos {}
 
ubit16 m_checkSubHeaderNum {}
 
ubit16 m_checkFooterPos {}
 
ubit16 m_checkFooterNum {}
 
ubit16 m_checkCR {}
 
ubit16 m_checkUnkown {}
 
ObjectType m_tag
 
std::string m_name
 

Friends

class ReadOutManager
 
std::ostream & operator<< (std::ostream &stream, MatrixReadOut *p)
 
std::ostream & operator<< (std::ostream &stream, MatrixReadOut &p)
 

Detailed Description

Definition at line 18 of file MatrixReadOut.h.

Member Enumeration Documentation

◆ DataVersion

Enumerator
Simulation 
Atlas 

Definition at line 20 of file MatrixReadOut.h.

20 { Simulation, Atlas };

Constructor & Destructor Documentation

◆ MatrixReadOut() [1/4]

MatrixReadOut::MatrixReadOut ( Matrix p,
ubit16  FEevent,
uint  NOBXS,
DataVersion  ver = MatrixReadOut::Atlas 
)

Definition at line 15 of file MatrixReadOut.cxx.

15  : BaseObject(Hardware, "MatrixReadOut") {
16  //
17  // Constructor used by the simulation program
18  //
19  // m the pointer to the object "Matrix"
20  // FEevent FrontEnd Event identifier
21  //
23  initialize(NOBXS);
24  FEevent = FEevent % 512;
25  m_FEL1ID = FEevent;
26  m_CM = m;
27  makeFragment();
28  m_BS = 0;
29 } // end-of-MatrixReadOut::MatrixReadOut

◆ MatrixReadOut() [2/4]

MatrixReadOut::MatrixReadOut ( ubit16  FEevent = 0,
uint  NOBXS = 8,
DataVersion  ver = MatrixReadOut::Atlas 
)

Definition at line 31 of file MatrixReadOut.cxx.

31  : BaseObject(Hardware, "MatrixReadOut") {
32  //
33  // Constructor used by an external user
34  // the readout words are supplied by the methods:
35  // "writeHeader" , "writeSubHeader" , "writeCMABody" and "writ".
36  //
37  // FEevent FrontEnd Event identifier
38  //
40  initialize(NOBXS);
41  m_MROS.setInit();
42  FEevent = FEevent % 512;
43  m_FEL1ID = FEevent;
44  m_CM = 0;
45  m_BS = 0;
46  m_myBoss = 0;
48 } // end-of-MatrixReadOut::MatrixReadOut

◆ MatrixReadOut() [3/4]

MatrixReadOut::MatrixReadOut ( ubit16 v,
ubit16  numWords,
uint  NOBXS,
DataVersion  ver = MatrixReadOut::Atlas 
)

Definition at line 50 of file MatrixReadOut.cxx.

50  : BaseObject(Hardware, "MatrixReadOut") {
51  //
52  // Constructor used by an external user
53  //
54  // v pointer to the CM readout fragment (16-bit words)
55  // numWords number of words in the readout fragment
56  //
58  initialize(NOBXS);
59  char field;
60  m_CM = 0;
61  m_BS = v;
62  m_myBoss = 0;
64 
65  //
66  m_numberOfWordsInFrag = numWords;
67  ubit16 nWordsMax = 100;
68  //
69  ubit16 nWord = 0;
70  while (nWord < nWordsMax && !m_checkFooterNum) {
71  m_MROS.decodeFragment(*(m_BS + nWord), field);
72  //
73  // Fragment Scanning ...
74  //
75  // cout<<" field= "<<field<<endl;
76  if (field == 'B') {
77  //
78  // this is a Body word
79  //
80  makeNewHit(*(m_BS + nWord));
81  } else {
82  //
83  // this is a control word
84  //
85  if (field == 'H') {
86  //
87  // Header
88  //
89  m_Header = *(m_BS + nWord);
91  m_checkHeaderPos = nWord + 1;
92  } else if (field == 'S') {
93  //
94  // Subheader
95  //
96  m_SubHeader = *(m_BS + nWord);
98  m_checkSubHeaderPos = nWord + 1;
99  } else if (field == 'F') {
100  //
101  // Footer
102  //
103  m_Footer = *(m_BS + nWord);
105  m_checkFooterPos = nWord + 1;
106  m_checkCR = checkCRC8(*(m_BS + nWord));
107  } else {
108  //
109  // Word code unknown
110  //
111  m_checkUnkown++;
112  } // end-if
113  } // end-if
114  nWord++;
115  } // end-of-while
116 } // end-of-MatrixReadOut::MatrixReadOut

◆ MatrixReadOut() [4/4]

MatrixReadOut::MatrixReadOut ( const MatrixReadOut MROOrig)

Definition at line 118 of file MatrixReadOut.cxx.

118  : BaseObject(Hardware, "MatrixReadOut") {
119  //
120  // Copy Constructor
121  //
122  m_data_version = MROOrig.m_data_version;
123 
124  m_BunchFrom = MROOrig.m_BunchFrom;
125  m_BunchTo = MROOrig.m_BunchTo;
126  m_FEL1ID = MROOrig.m_FEL1ID;
127  m_Header = MROOrig.m_Header;
128  m_Footer = MROOrig.m_Footer;
129  m_SubHeader = MROOrig.m_SubHeader;
130  m_Body = 0;
132  m_first8bitsON = MROOrig.m_first8bitsON;
133  m_BodyLast = 0;
134  m_BodyCurr = 0;
143  m_checkCR = MROOrig.m_checkCR;
144  m_checkUnkown = MROOrig.m_checkUnkown;
145  m_myBoss = 0;
146  m_ROOffset = 2;
147  m_NDLLCYC = 8;
148  m_NBunch = MROOrig.m_NBunch;
150  m_timeSeparation = 8;
151  m_CM = 0;
152  m_BS = 0;
153  //
154  // copy m_CM hit structure
155  //
156  CMROData *q = 0;
157  CMROData *r = 0;
158  CMROData *p = MROOrig.m_Body;
159  ubit16 cnter = 0;
160  while (p) {
161  q = new CMROData;
162  q->hit = p->hit;
163  q->next = 0;
164  if (!cnter)
165  m_Body = q;
166  else
167  r->next = q;
168  cnter++;
169  r = q;
170  p = p->next;
171  } // end-of-while
172  m_BodyLast = r;
173 } // end-of-MatrixReadOut::MatrixReadOut(const MatrixReadOut &MRCopy)

◆ ~MatrixReadOut()

MatrixReadOut::~MatrixReadOut ( )

Definition at line 175 of file MatrixReadOut.cxx.

175  {
176  //
177  // delete the CMROData dynamic structure used to describe Body part
178  // of the event fragment.
179  //
180  deleteCMABody();
181 } // end-of-MatrixReadOut::~MatrixReadOut

Member Function Documentation

◆ bytestream()

void MatrixReadOut::bytestream ( std::ostream &  stream)

Definition at line 795 of file MatrixReadOut.cxx.

795  {
796  CMROData *p;
797  stream << hex << m_Header << dec << endl; // header
798  stream << hex << m_SubHeader << dec << endl; // subheader
799  p = m_Body;
800  while (p) {
801  stream << hex << p->hit << dec << endl; // body
802  p = p->next;
803  } // end-of-while
804  stream << hex << m_Footer << dec << endl; // footer
805 } // end-of-MatrixReadOut::bytestream

◆ checkBodyOrder()

ubit16 MatrixReadOut::checkBodyOrder ( bool  debugPrint = false)

Definition at line 837 of file MatrixReadOut.cxx.

837  {
838  CMROData *p, *pnext;
839  char field;
840  ubit16 currIJK, currBCID, currTIME, currCHANNEL;
841  ubit16 nextIJK, nextBCID, nextTIME, nextCHANNEL;
842  ubit16 prevIJK; //, prevBCID, prevTIME, prevCHANNEL;
843  ubit16 output = 0;
844  ubit16 outTemp = 0;
845  p = m_Body;
846 
847  prevIJK = 8; // use a non-sense initializer
848  // prevBCID=0;
849  // prevTIME=0;
850  // prevCHANNEL=0;
851 
852  while (p) {
853  m_MROS.decodeFragment(p->hit, field);
854  currIJK = m_MROS.ijk();
855  currBCID = m_MROS.bcid();
856  currTIME = m_MROS.time();
857  currCHANNEL = m_MROS.channel();
858  pnext = p->next;
859  if (pnext) {
860  // output=0;
861  m_MROS.decodeFragment(pnext->hit, field);
862  nextIJK = m_MROS.ijk();
863  nextBCID = m_MROS.bcid();
864  nextTIME = m_MROS.time();
865  nextCHANNEL = m_MROS.channel();
866  //
867 
868  if (currIJK < 6) { // analyze first IJK=0,1,2,3,4,5 ...
869 
870  if (nextIJK < currIJK) {
871  output += 1;
872  outTemp = 1;
873  } else if (nextIJK == currIJK) {
874  if (nextBCID < currBCID) {
875  output += 2;
876  outTemp = 2;
877  } else if (nextBCID == currBCID) {
878  if (nextTIME < currTIME) {
879  output += 4;
880  outTemp = 4;
881  } else if (nextTIME == currTIME) {
882  if (nextCHANNEL <= currCHANNEL) {
883  output += 8;
884  outTemp = 8;
885  }
886  }
887  }
888  }
889 
890  } else if (currIJK == 6) { // ... then first IJK=6 ...
891 
892  if (nextIJK == currIJK) {
893  if (nextBCID != currBCID || nextTIME != currTIME) {
894  output += 16;
895  outTemp = 16;
896  } else {
897  if (nextCHANNEL <= currCHANNEL) {
898  output += 32;
899  outTemp = 32;
900  }
901  } // end-of-if(nextBCID!=currBCID || nextTIME!=currTIME)
902  } else if (nextIJK == 7) {
903  } // end-of-if(nextIJK==currIJK)
904 
905  } else if (currIJK == 7) { // finally IJK=7.
906 
907  if (prevIJK != 6) { // if this m_CM hit has IJK=7 then the previous on must have IJK=6
908  output += 64;
909  outTemp = 64;
910  }
911 
912  } else {
913  } // end-of-if(currIJK
914 
915  if (outTemp > 0 && debugPrint) {
916  cout << "checkBodyOrder output= " << output << " with " << hex << pnext->hit << dec << endl;
917  } // end-of-if(outTemp
918  outTemp = 0;
919 
920  } else { // else of if(p->next
921 
922  if (currIJK == 6) {
923  output += 64;
924  if (debugPrint) cout << " CheckBodyOrder; IJK 6 exists but the related IJK 7 has been found " << endl;
925  } else if (currIJK == 7 && prevIJK != 6) { // we are at the last m_CM hit; if this has IJK=7
926  output += 128; // then the previous m_CM hit must have IJK=6
927  if (debugPrint) cout << " CheckBodyOrder; IJK 7 exists but the related IJK 6 has been found " << endl;
928  }
929 
930  } // end-of-if(p->next
931 
932  prevIJK = currIJK;
933  // prevBCID =currBCID; // not used in this version
934  // prevTIME =currTIME; // not used in this version
935  // prevCHANNEL=currCHANNEL; // not used in this version
936  p = p->next;
937 
938  } // end-of-while(p)
939 
940  return output;
941 } // end-of-checkBodyOrder

◆ checkCRC8()

ubit16 MatrixReadOut::checkCRC8 ( ubit16  foot)

Definition at line 831 of file MatrixReadOut.cxx.

831  {
832  ubit16 output = 0;
833  if ((computeCR() & m_first8bitsON) != (foot & m_first8bitsON)) output = 1;
834  return output;
835 } // end-of-MatrixReadOut::checkCRC8()

◆ checkFragment()

ubit16 MatrixReadOut::checkFragment ( )

Definition at line 807 of file MatrixReadOut.cxx.

807  {
808  // cout<<" MatrixReadOut(ubit16 *pointer, ubit16 num) ";
809  // cout<<endl
810  // cout<<" check dump "<<endl
811  // std::cout<<" m_checkHeaderNum = "<<m_checkHeaderNum
812  // <<" CheckHeaderPos = "<<m_checkHeaderPos<<std::endl;
813  // cout<<" m_checkSubHeaderNum = "<<m_checkSubHeaderNum
814  // <<" CheckSubHeaderPos = "<<m_checkSubHeaderPos<<endl
815  // cout<<" m_checkFooterNum = "<<m_checkFooterNum
816  // <<" CheckFooterPos = "<<m_checkFooterPos<<endl
817  // cout<<" CheckUnkown = "<<m_checkUnkown<<endl
818  // cout<<" Number of Words In Fragment = "<<m_numberOfWordsInFrag<<endl;
819  ubit16 output = 0;
820  if (m_checkHeaderNum != 1 && !(output & 0x00000001)) output += 1; //=1
821  if (m_checkHeaderPos > 1 && !(output & 0x00000002)) output += 2; //=1
822  if (m_checkSubHeaderNum != 1 && !(output & 0x00000004)) output += 4; //=1
823  if (m_checkSubHeaderPos != 2 && !(output & 0x00000008)) output += 8; //=2
824  if (m_checkFooterPos != m_numberOfWordsInFrag && !(output & 0x00000010)) output += 16;
825  if (m_checkCR && !(output & 0x00000020)) output += 32;
826  if (m_checkUnkown && !(output & 0x00000040)) output += 64;
827  if (checkBodyOrder() && !(output & 0x00000080)) output += 128;
828  return output;
829 } // end-of-MatrixReadOut::checkFragment

◆ computeCR()

ubit16 MatrixReadOut::computeCR ( )
private

Definition at line 317 of file MatrixReadOut.cxx.

317  {
318  //
319  // compute the CR value of the event fragment stored in
320  // the words "m_Header" , "m_SubHeader" , "m_Body" .
321  //
322  // The value computed is then returned.
323  //
324  crc8 CR;
325  CMROData *p;
326  CR.calc(m_Header);
327  CR.calc(m_SubHeader);
328  p = m_Body;
329  while (p) {
330  CR.calc(p->hit);
331  p = p->next;
332  } // end-of-while
333  return CR.current();
334 } // end-of-MatrixReadOut::computeCR()

◆ deleteCMABody()

void MatrixReadOut::deleteCMABody ( )

Definition at line 246 of file MatrixReadOut.cxx.

246  {
247  CMROData *p, *q;
248  p = m_Body;
249  while (p) {
250  q = p;
251  p = p->next;
252  delete q;
253  } // end-of-while
254  p = 0;
255  q = 0;
256  m_Body = 0;
257  m_BodyLast = 0;
258  m_BodyCurr = 0;
260 } // end-of-deleteCMABody

◆ display()

void MatrixReadOut::display ( std::ostream &  stream)

Definition at line 723 of file MatrixReadOut.cxx.

723  {
728 } // end-of-MatrixReadOut::display

◆ displayBody()

void MatrixReadOut::displayBody ( std::ostream &  stream)

Definition at line 756 of file MatrixReadOut.cxx.

756  {
757  CMROData *p;
758  char field;
759  p = m_Body;
760  //
761  while (p) {
762  stream << hex << p->hit << dec;
763  ubit16 errorDecode = m_MROS.decodeFragment(p->hit, field);
764  if (!errorDecode && field == 'B') {
765  stream << " -- BC " << m_MROS.bcid();
766  stream << " TIME " << m_MROS.time();
767  if (m_MROS.ijk() < 7) {
768  stream << " IJK " << m_MROS.ijk();
769  stream << " STRIP " << m_MROS.channel();
770  } else {
771  stream << " OVL " << m_MROS.overlap();
772  stream << " THR " << m_MROS.threshold();
773  } // end-of-if
774  } else {
775  stream << " ERROR IN BODY DECODING ";
776  } // end-of-if(!errorDecode
777  stream << endl;
778  p = p->next;
779  } // end-of-while
780 } // end-of-MatrixReadOut::displayBody

◆ displayFooter()

void MatrixReadOut::displayFooter ( std::ostream &  stream)

Definition at line 782 of file MatrixReadOut.cxx.

782  {
783  char field;
784  stream << hex << m_Footer << dec;
785  stream << " -- CODE " << 1;
786  ubit16 errorDecode = m_MROS.decodeFragment(m_Footer, field);
787  if (!errorDecode && field == 'F') {
788  stream << " CRC " << hex << m_MROS.crc() << dec;
789  } else {
790  stream << " ERROR IN FOOTER DECODING ";
791  } // end-of-if(!errorDecode
792  stream << endl;
793 } // end-of-MatrixReadOut::displayFooter

◆ displayHeader()

void MatrixReadOut::displayHeader ( std::ostream &  stream)

Definition at line 730 of file MatrixReadOut.cxx.

730  {
731  char field;
732  stream << endl;
733  stream << hex << m_Header << dec;
734  ubit16 errorDecode = m_MROS.decodeFragment(m_Header, field);
735  if (!errorDecode && field == 'H') {
736  stream << " -- CMID " << m_MROS.cmid();
737  stream << " FEL1ID " << m_MROS.fel1id();
738  } else {
739  stream << " ERROR IN HEADER DECODING ";
740  } // end-of-if
741  stream << endl;
742 } // end-of-MatrixReadOut::displayHeader

◆ displaySubHeader()

void MatrixReadOut::displaySubHeader ( std::ostream &  stream)

Definition at line 744 of file MatrixReadOut.cxx.

744  {
745  char field;
746  stream << hex << m_SubHeader << dec;
747  ubit16 errorDecode = m_MROS.decodeFragment(m_SubHeader, field);
748  if (!errorDecode && field == 'S') {
749  stream << " -- FEBCID " << m_MROS.febcid();
750  } else {
751  stream << " ERROR IN SUBHEADER DECODING ";
752  } // end-of-if
753  stream << endl;
754 } // end-of-MatrixReadOut::displaySubHeader

◆ doMatrix()

void MatrixReadOut::doMatrix ( Matrix CMpointer)

Definition at line 963 of file MatrixReadOut.cxx.

963  {
964  //
965  // copy the pointer to CMA "CMpointer" in "m_CM" member
966  //
967  m_CM = CMpointer;
968  m_CM->reset();
969  ubit16 sidemat = 0;
970  ubit16 layer = 0;
971  ubit16 stripaddress = 0;
972  const ubit16 ROOffset = 2;
973 
974  for (ubit16 n = 0; n < m_numberOfWordsInBody; n++) {
976  ubit16 IJK = locMRO.ijk();
977  ubit16 CHANNEL = locMRO.global_channel();
978  ubit16 BCID = locMRO.bcid();
979  ubit16 TIME = locMRO.time();
980  float absTime = 0.;
981 
982  //
983  // select CMA strip data (IJK from 0 to 5; 6 and 7 are for trigger data
984  //
985  if (IJK < 6) {
986  switch (IJK) {
987  case 0:
988  sidemat = 0;
989  layer = 0;
990  stripaddress = CHANNEL;
991  break;
992  case 1:
993  sidemat = 0;
994  layer = 1;
995  stripaddress = CHANNEL;
996  break;
997  case 2:
998  sidemat = 1;
999  layer = 0;
1000  stripaddress = CHANNEL;
1001  break;
1002  case 3:
1003  sidemat = 1;
1004  layer = 0;
1005  stripaddress = CHANNEL;
1006  break;
1007  case 4:
1008  sidemat = 1;
1009  layer = 1;
1010  stripaddress = CHANNEL;
1011  break;
1012  case 5:
1013  sidemat = 1;
1014  layer = 1;
1015  stripaddress = CHANNEL;
1016  break;
1017  default: throw std::runtime_error("MatrixReadOut::doMatrix: IJK= " + std::to_string(IJK) + " out of RANGE");
1018  } // end-of-switch
1019  //
1020  // estimate absolute time from CMA time
1021  //
1022  absTime = 25. * ((float)BCID + ((float)(TIME - ROOffset)) / 8.);
1023  m_CM->putData(sidemat, layer, stripaddress, absTime);
1024  } // end-of-if(IJK<6
1025  } // end-of-for(ubit16 n
1026  //
1027  // use the Matrix data buffer from the the first available location and not
1028  // at the center as it is done by default
1029  //
1030  m_CM->setBCzero(0);
1031  //
1032  // run the CMA logic
1033  //
1034  m_CM->execute();
1035 } // end-of-MatrixReadOut::doMatrix()

◆ getCMAHit()

MatrixReadOutStructure MatrixReadOut::getCMAHit ( int  index)

Definition at line 699 of file MatrixReadOut.cxx.

699  {
700  MatrixReadOutStructure theStruct;
701  ubit16 theHit;
703  // cout<<" getCMAHit: Wrong index given;"
704  //<<" numberOfWordsInBody= "<<m_numberOfWordsInBody
705  //<<" index = "<<index<<endl;
706  } else {
707  CMROData *p;
708  p = m_Body;
709  for (int i = 0; i < m_numberOfWordsInBody; i++) {
710  theHit = p->hit;
711  if (index == i) { theStruct = MatrixReadOutStructure(theHit); }
712  p = p->next;
713  }
714  }
715  return theStruct;
716 } // end-of-MatrixReadOut::getCMAHit(int index)

◆ getFooter()

MatrixReadOutStructure MatrixReadOut::getFooter ( )

Definition at line 958 of file MatrixReadOut.cxx.

958  {
959  MatrixReadOutStructure theStruct(m_Footer);
960  return theStruct;
961 } // end-of-MatrixReadOut::getFooter()

◆ getHeader()

MatrixReadOutStructure MatrixReadOut::getHeader ( )

Definition at line 948 of file MatrixReadOut.cxx.

948  {
949  MatrixReadOutStructure theStruct(m_Header);
950  return theStruct;
951 } // end-of-MatrixReadOut::getHeader()

◆ getSubHeader()

MatrixReadOutStructure MatrixReadOut::getSubHeader ( )

Definition at line 953 of file MatrixReadOut.cxx.

953  {
955  return theStruct;
956 } // end-of-MatrixReadOut::getSubHeader()

◆ initialize()

void MatrixReadOut::initialize ( uint  NOBXS)
private

Definition at line 203 of file MatrixReadOut.cxx.

203  {
204  m_BunchFrom = 0;
205  m_BunchTo = 7;
206  m_Header = 0;
207  m_Footer = 0;
208  m_SubHeader = 0;
209  m_Body = 0;
210  m_BodyLast = 0;
211  m_BodyCurr = 0;
212  //
213  m_FEL1ID = 0;
214  // m_ROOffset = 1; // use this for comparison with hardware (VHDL) output
215  // m_ROOffset = 0; // use this for MC
216  m_ROOffset = 2;
217  m_NBunch = NOBXS;
218  m_NDLLCYC = 8;
219  m_nchan[0] = 32;
220  m_nchan[1] = 64;
222  m_timeSeparation = 8;
223  //
224  m_first8bitsON = 0x00ff;
225  //
226  // initialize check flags
227  //
230  m_checkHeaderPos = 0;
231  m_checkHeaderNum = 0;
234  m_checkFooterPos = 0;
235  m_checkFooterNum = 0;
236  m_checkCR = 0;
237  m_checkUnkown = 0;
238 } // end-of-initialize

◆ makeCMABody()

void MatrixReadOut::makeCMABody ( )
private

Definition at line 299 of file MatrixReadOut.cxx.

299  {
300  if (m_CM) {
301  // cout<<"number of hits in matrixReadOut:"<<makeCMABodyHit()<<endl;
302  makeCMABodyHit();
303  makeCMABodyTrg();
304  } else {
305  throw std::runtime_error("MatrixReadOut::makeCMABody: m_CM object does not exist");
306  } // end-of-if
307 } // end-of-MatrixReadOut::makeCMABody

◆ makeCMABodyHit()

ubit16 MatrixReadOut::makeCMABodyHit ( )
private

Definition at line 336 of file MatrixReadOut.cxx.

336  {
337  //
338  // set up the Body section of the event fragment.
339  //
340  // CMA_BODY --> |0|0| BCID | TIME | IJK | STRIP |
341  //
342  // This section is organized storing following the increasing value
343  // of IJK, BCID, TIME, STRIP.
344  //
345 
346  ubit16 i, j, k, l, ijk, lijk;
347  ubit16 CMABodyval[5];
348  ubit16 numberOfHits = 0;
349  if (m_CM) {
350  for (ijk = 0; ijk < 6; ijk++) { // ijk values
351  //
352  // define the CMA side "i" as a fucntion of ijk value
353  //
354  if (ijk <= 1)
355  i = 0;
356  else
357  i = 1;
358  //
359  // define the layer address as a function of the ijk value
360  //
361  if (ijk == 0 || ijk == 2 || ijk == 3)
362  j = 0;
363  else
364  j = 1;
365  //
366  for (k = 0; k < m_nclock; k++) { // clock
367  //
368  // loop up to 32 "channels" (lijk)
369  //
370  for (lijk = 0; lijk < 32; lijk++) { // channel
371  //
372  // define the absolute channel address as a function of lijk
373  //
374  l = lijk;
375  if (ijk == 3 || ijk == 5) l = lijk + 32;
376  //
377  //
378  // Decoding map for CMA_BODY:
379  // #1 BCID filled with BC
380  // #2 TIME filled with TIME in DLL steps
381  // #3 IJK filled with:
382  //
383  // Side Layer #Channel IJK
384  // x 0 // 0
385  // x 1 // 1
386  // y 0 < 32 2
387  // y 0 > 32 3
388  // y 1 < 32 4
389  // y 1 > 32 5
390  // TRIGGER 6
391  //
392  // more info (Trigger case)
393  // 5 bit-word for IJK = 7
394  // |__|__|__|__|__| _____>Threshold(1="0" threshold
395  // | |***| |***| | 2="1" threshold
396  // | | |______| 3="2" threshold)
397  // | |
398  // 0 <-| |___overlap(2 bit)(0=no overlap,
399  // 1=overlap low chan
400  // 2=overlap high chann,
401  // 3 overlap low+high)
402  //
403  // #4 STRIP filled with: CHANNEL or k-readout
404  //
405  // cout<<"rodat="<<m_CM->rodat[i][j][k][l/32]<<" boh="<<(1<<(l%32))<<endl;
406  if ((m_CM->rodat[i][j][k][l / 32] & (1 << (l % 32)))) {
407  ubit16 SIDE = i;
408  ubit16 TIME = (k + m_ROOffset) % m_NDLLCYC; // from struct rpcdata in Matrix
409  ubit16 CHANNEL = l % 32; // from struct rpcdata
410  ubit16 IJK = 0;
411  ubit16 BC = (k + m_ROOffset) / m_NDLLCYC; // fill BCID word
412  //
413  if (SIDE == 0) {
414  IJK = j; // Fill the IJK-word(3-bit word for CMA_BODY)
415  } else {
416  IJK = 2 * j + l / 32 + 2;
417  } // end-of-if
418  //
419  // WARNING !!! BC>=0 ?? TIME >=0??
420  // Per riprodurre l'output di stefano si deve imporre
421  // BC>0 and BC<=7 and time>0
422  //
423  if (BC >= m_BunchFrom && BC <= m_BunchTo) {
424  // cout<<"Now store CM_hit with: BCID= "<<BC<<" TIME = "<<TIME
425  // <<" SIDE = "<<SIDE<<" layer = "<<j
426  // <<" IJK = " <<IJK<< " CHANNEL = "<<CHANNEL<<endl;
427  CMABodyval[0] = 0;
428  CMABodyval[1] = BC - m_BunchFrom;
429  CMABodyval[2] = TIME;
430  CMABodyval[3] = IJK;
431  CMABodyval[4] = CHANNEL;
432  makeNewHit(m_MROS.makeBody(CMABodyval));
433  numberOfHits++;
434  } // end of if(BC
435  } // end-of-if(input[....
436  } // end-of-for(lijk
437  } // end-of-for(k
438  } // end-of-for(ijk
439 
440  //
441  } else {
442  throw std::runtime_error("MatrixReadOut::makeCMABodyHit: m_CM object does not exist");
443  } // end-of-if
444  return numberOfHits;
445 } // end-of-MatrixReadOut::makeCMABodyHit

◆ makeCMABodyTrg()

ubit16 MatrixReadOut::makeCMABodyTrg ( )
private

Definition at line 447 of file MatrixReadOut.cxx.

447  {
448  ubit16 CMABodyval[5];
449  ubit16 channel = 0;
450  ubit16 BC, TIME, IJK, CHANNEL;
451  // int set_latenza;
452  // Removed h_last because it is not used
453  // int h_last[32]; // only pivot plane
454  //
455  // initialize h_last with large values
456  //
457  // for(ubit16 i=0; i<m_nchan[0]; i++) {h_last[i]=0xffff;}
458  //
459  ubit16 numberOfHits = 0;
460  bool triggerRO; // flag that indicates a trigger hit recorded in the ReadOut
461  if (m_CM) {
462  CMAword one = 1;
463  //
464  for (int h = 0; h < m_nclock; h++) { // loop on time clock
465  triggerRO = false; // initialize triggeRO
466  for (channel = 0; channel < m_nchan[0]; channel++) {
467  if (m_CM->k_readout[h] & (one << channel)) { // check K-readout register for
468  // set_latenza=abs(h-h_last[channel]);
469  // if (set_latenza >= m_timeSeparation) {
470  // a real-trigger data!
471  BC = (h + m_ROOffset) / m_NDLLCYC; // fill BCID word
472  TIME = (h + m_ROOffset) % m_NDLLCYC; // from struct rpcdata in Matrix
473  IJK = 6; // Trigger flag for IJK
474  CHANNEL = channel;
475  // h_last[channel]=h;
476 
477  // cout<<"MatrixReadOut: Now store Trigger_hit with: BCID= "<<BC
478  //<<" TIME = "<<TIME<<" IJK = "<<IJK<<" CHANNEL = "<<CHANNEL<<endl;
479  //
480  if (BC >= m_BunchFrom && BC <= m_BunchTo) {
481  triggerRO = true; // there is a trigger hit in the ReadOut
482  CMABodyval[0] = 0;
483  CMABodyval[1] = BC - m_BunchFrom;
484  CMABodyval[2] = TIME;
485  CMABodyval[3] = IJK;
486  CMABodyval[4] = CHANNEL;
487  makeNewHit(m_MROS.makeBody(CMABodyval));
488  numberOfHits++;
489  } // end-of-if(BC
490  // }//end of if set_latenza
491  } // end of if k_readout
492  } // end of for(channel
493  //
494  // insert here the Threshold and overlap word
495  //
496  if (m_CM->highestthRO[h]) {
497  if (triggerRO) { // if there is a trigger in the RO add IJK=7 record
498  ubit16 thresh_h = m_CM->highestthRO[h];
499  ubit16 over_h = m_CM->overlapRO[h];
500  over_h = over_h << 2;
501  BC = (h + m_ROOffset) / m_NDLLCYC; // fill BCID word
502  TIME = (h + m_ROOffset) % m_NDLLCYC;
503  CHANNEL = (over_h | thresh_h);
504  IJK = 7;
505  //
506  // cout<<"MatrixReadOut: Now store Trigger_hit with: BCID= "
507  // <<BC<<" TIME = "<<TIME
508  // <<" IJK = "<<IJK<<" CHANNEL = "<<CHANNEL<<endl;
509  //
510  CMABodyval[0] = 0;
511  CMABodyval[1] = BC - m_BunchFrom;
512  CMABodyval[2] = TIME;
513  CMABodyval[3] = IJK;
514  CMABodyval[4] = CHANNEL;
515  makeNewHit(m_MROS.makeBody(CMABodyval));
516  numberOfHits++;
517  } // end-of-if(triggerRO
518  } // end-of-if(highestthRO
519  } // end of for(int h
520  //
521  // cout<<" ** Exit from makeCMABodyTrg method **"<<endl<<endl;
522  //
523  } else {
524  throw std::runtime_error("MatrixReadOut::makeHeader: m_CM object does not exist");
525  } // end-of-if(m_CM
526  return numberOfHits;
527 } // end-of-MatrixReadOut::makeCMABodyTrg

◆ makeFooter()

void MatrixReadOut::makeFooter ( )
private

Definition at line 309 of file MatrixReadOut.cxx.

309  {
310  if (m_CM) {
311  writeFooter();
312  } else {
313  throw std::runtime_error("MatrixReadOut::makeFooter: m_CM object does not exist");
314  } // end-of-if(m_CM
315 } // end-of-makeFooter

◆ makeFragment()

void MatrixReadOut::makeFragment ( )
private

Definition at line 262 of file MatrixReadOut.cxx.

262  {
263  //
264  // method executed in conjunction with the simulation program
265  //
266  makeHeader();
267  makeSubHeader();
268  makeCMABody();
269  makeFooter();
270  m_checkUnkown = 0;
272 } // end-of-MatrixReadOut::makeFragment

◆ makeHeader()

void MatrixReadOut::makeHeader ( )
private

Definition at line 274 of file MatrixReadOut.cxx.

274  {
275  // ubit16 headerval[3];
276  if (m_CM) {
277  ubit16 CMcode;
279  // storical CMcode defintion (till 30/July/2007)
280  CMcode = 4 * m_CM->getLowHigh() + 2 * m_CM->getProjection() + m_CM->getLocalAdd();
281  } else {
282  // new CMcode defintion, used in the hardware
283  CMcode = 4 * m_CM->getLowHigh() + 2 * abs(m_CM->getProjection() - 1) + m_CM->getLocalAdd();
284  }
285  writeHeader(CMcode);
286  } else {
287  throw std::runtime_error("MatrixReadOut::makeHeader: m_CM object does not exist");
288  } // end-of-if
289 } // end-of-MatrixReadOut::makeHeader

◆ makeNewHit() [1/2]

void MatrixReadOut::makeNewHit ( ubit16  newHit)
private

Definition at line 565 of file MatrixReadOut.cxx.

565  {
566  CMROData *p;
567  p = new CMROData;
568  p->hit = newHit;
569  p->next = 0;
570  if (!m_Body) {
571  m_Body = p;
572  } else {
573  m_BodyLast->next = p;
574  } // end-of-if
575  m_BodyLast = p;
577 } // end-of-MatrixReadOut::makeNewHit

◆ makeNewHit() [2/2]

void MatrixReadOut::makeNewHit ( ubit16  newHit,
CMROData previous,
CMROData next 
)
private

Definition at line 579 of file MatrixReadOut.cxx.

579  {
580  CMROData *newElement;
581  newElement = new CMROData;
582  newElement->hit = newHit;
583  newElement->next = next;
584  if (next == m_Body)
585  m_Body = newElement;
586  else
587  previous->next = newElement;
589 } // end-of-MatrixReadOut::makeNewHit

◆ makeSubHeader()

void MatrixReadOut::makeSubHeader ( )
private

Definition at line 291 of file MatrixReadOut.cxx.

291  {
292  if (m_CM) {
293  writeSubHeader();
294  } else {
295  throw std::runtime_error("MatrixReadOut::makeSubHeader: m_CM object does not exist");
296  } // end-of-if
297 } // end-of-MatrixReadOut::makeSubHeader

◆ makeTestPattern()

void MatrixReadOut::makeTestPattern ( ubit16  mode,
ubit16  ktimes,
int  eventNum 
)

Definition at line 1037 of file MatrixReadOut.cxx.

1037  {
1038  std::cout << " makeTestPattern " << std::endl;
1039  MatrixReadOutStructure MRS = getHeader(); // get the m_CM Header
1040  ubit16 cmid = MRS.cmid(); // m_CM Address (or identifier)
1041  //
1042  ofstream vhdlinput;
1043  vhdlinput.open("vhdl.input", ios::app);
1044  if (!vhdlinput) { cout << " File for vhdl analysis not opened. " << endl << " ==================================" << endl << endl; };
1045  //
1046  const ubit16 maxchan = 100;
1047  const ubit16 maxtimes = 200;
1048  ubit16 IJ[maxtimes][4], channels[maxtimes][4][maxchan];
1049  float times[maxtimes] = {0};
1050  char plane[4][3];
1051  strcpy(plane[0], "I0");
1052  strcpy(plane[1], "I1");
1053  strcpy(plane[2], "J0");
1054  strcpy(plane[3], "J1");
1055  ubit16 ntimes = 0;
1056  for (ubit16 l = 0; l < maxtimes; l++) {
1057  for (ubit16 i = 0; i < 4; i++) { IJ[l][i] = 0; }
1058  }
1059 
1060  float timeover = 999999.;
1061  bool completed = false;
1062  float timelast = -timeover;
1063 
1064  std::cout << this << std::endl;
1065 
1066  while (!completed) {
1067  float timemin = timeover;
1068  for (int iCMhit = 0; iCMhit < m_numberOfWordsInBody; iCMhit++) {
1069  MatrixReadOutStructure MRS = getCMAHit(iCMhit);
1070  int ijk = MRS.ijk();
1071  if (ijk < 6) {
1072  float time = ((float)(MRS.bcid() * 8 + MRS.time()) - 0.5) * 3.125;
1073  // int channel=MRS.global_channel(); // m_CM channel
1074  // std::cout<<"time "<<time<<" IJK= "<<ijk<<" channel "<<channel<<std::endl;
1075  if (time > timelast && time < timemin) timemin = time;
1076  } // end-of-if(
1077  } // end-of-for(
1078 
1079  if (timemin == timeover) {
1080  completed = true;
1081  } else {
1082  ubit16 this_time_counter = 0;
1083  for (int iCMhit = 0; iCMhit < m_numberOfWordsInBody; iCMhit++) {
1084  MatrixReadOutStructure MRS = getCMAHit(iCMhit);
1085  int ijk = MRS.ijk();
1086  if (ijk < 6) {
1087  int channel = MRS.global_channel(); // m_CM channel
1088  float time = ((float)(MRS.bcid() * 8 + MRS.time()) - 0.5) * 3.125;
1089  if (time == timemin && ntimes < maxtimes) {
1090  if (!this_time_counter) ntimes++;
1091  this_time_counter++;
1092  ubit16 ijk_index = 0;
1093  if (ijk == 0)
1094  ijk_index = 0;
1095  else if (ijk == 1)
1096  ijk_index = 1;
1097  else if (ijk == 2 || ijk == 3)
1098  ijk_index = 2;
1099  else if (ijk == 4 || ijk == 5)
1100  ijk_index = 3;
1101  times[ntimes - 1] = time;
1102  if (IJ[ntimes - 1][ijk_index] < maxchan) {
1103  IJ[ntimes - 1][ijk_index]++;
1104  channels[ntimes - 1][ijk_index][IJ[ntimes - 1][ijk_index] - 1] = channel;
1105  } // end-of-if
1106  } // end-of-if(time==timemin
1107  } // end-of-if(
1108  } // end-of-for(
1109  timelast = timemin;
1110  // std::cout<<" time min found: "<<timelast<<std::endl;
1111  }
1112  } // end-of-while
1113 
1114  if (mode) {
1115  int NBunch = 0;
1116  int run = 0;
1117  vhdlinput << " RUN " << run << " EVENT " << eventNum << " CMID " << cmid << " WINDOW " << NBunch;
1118  vhdlinput << " LINES " << (ntimes + ktimes) << std::endl;
1119  } // end-of-if(mode
1120  for (ubit16 l = 0; l < ntimes; l++) {
1121  vhdlinput << " TIME " << times[l] << " ";
1122  for (ubit16 i = 0; i < 4; i++) {
1123  vhdlinput << plane[i][0] << plane[i][1] << " " << IJ[l][i] << " ";
1124  for (ubit16 j = 0; j < IJ[l][i]; j++) { vhdlinput << channels[l][i][j] << " "; } // end-of-for(j
1125  } // end-of-for(i
1126  vhdlinput << std::endl;
1127  } // end-of-for(l
1128  //
1129  vhdlinput.close();
1130 } // end-of-MatrixReadOut::makeTestPattern

◆ name()

std::string BaseObject::name ( ) const
inlineinherited

Definition at line 23 of file BaseObject.h.

23 { return m_name; }

◆ numberOfBodyWords()

ubit16 MatrixReadOut::numberOfBodyWords ( )
inline

Definition at line 49 of file MatrixReadOut.h.

49 { return m_numberOfWordsInBody; };

◆ numberOfFragmentWords()

ubit16 MatrixReadOut::numberOfFragmentWords ( )
inline

Definition at line 50 of file MatrixReadOut.h.

50 { return m_numberOfWordsInFrag; };

◆ operator=()

MatrixReadOut& MatrixReadOut::operator= ( const MatrixReadOut MROOrig)
delete

◆ overwriteHeader()

void MatrixReadOut::overwriteHeader ( ubit16  thisRecord)
inline

Definition at line 43 of file MatrixReadOut.h.

43 { m_Header = thisRecord; }; // new method

◆ overwriteSubHeader()

void MatrixReadOut::overwriteSubHeader ( ubit16  thisRecord)
inline

Definition at line 44 of file MatrixReadOut.h.

44 { m_SubHeader = thisRecord; }; // new method

◆ Print()

virtual void BaseObject::Print ( std::ostream &  ,
bool   
) const
inlinevirtualinherited

◆ readCMABody()

void MatrixReadOut::readCMABody ( ubit16 Body)

Definition at line 673 of file MatrixReadOut.cxx.

673  {
674  ubit16 i = 0;
675  CMROData *p;
676  if (m_numberOfWordsInBody) {
677  p = m_Body;
678  for (i = 0; i < m_numberOfWordsInBody; i++) {
679  *(Body + i) = p->hit;
680  p = p->next;
681  } // end-of-for
682  } // end-of-if
683 } // end-of-MatrixReadout::readCMABody

◆ readCMABodyCurrent()

ubit16 MatrixReadOut::readCMABodyCurrent ( )

Definition at line 663 of file MatrixReadOut.cxx.

663  {
664  if (m_BodyCurr) {
665  ubit16 hit = m_BodyCurr->hit;
667  return hit;
668  } else {
669  return 0xffff;
670  }
671 } // end-of-MatrixReadout::readCMABodyCurrent

◆ readCMAWord()

ubit16 MatrixReadOut::readCMAWord ( )

Definition at line 685 of file MatrixReadOut.cxx.

685  {
686  ubit16 output = 0xffff;
687  if (m_addressOfWordScanned == 0)
688  output = readHeader();
689  else if (m_addressOfWordScanned == 1)
690  output = readSubHeader();
691  else if (m_addressOfWordScanned == (numberOfFragmentWords() - 1))
692  output = readFooter();
693  else
696  return output;
697 } // end-of-MatrixReadout::readCMAWord

◆ readFooter()

ubit16 MatrixReadOut::readFooter ( )

Definition at line 661 of file MatrixReadOut.cxx.

661 { return m_Footer; }

◆ readHeader()

ubit16 MatrixReadOut::readHeader ( )

Definition at line 657 of file MatrixReadOut.cxx.

657 { return m_Header; }

◆ readSubHeader()

ubit16 MatrixReadOut::readSubHeader ( )

Definition at line 659 of file MatrixReadOut.cxx.

659 { return m_SubHeader; }

◆ reComputeFooter()

void MatrixReadOut::reComputeFooter ( )
inline

Definition at line 45 of file MatrixReadOut.h.

45  {
46  writeFooter();
48  }; // new method

◆ reset()

void MatrixReadOut::reset ( uint  NOBXS)

Definition at line 240 of file MatrixReadOut.cxx.

240  {
241  deleteCMABody();
242  initialize(NOBXS);
243  m_MROS.setInit();
244 } // end-of-reset

◆ setManager()

void MatrixReadOut::setManager ( ReadOutManager boss)
private

Definition at line 943 of file MatrixReadOut.cxx.

943  {
944  m_myBoss = boss;
945  return;
946 } // end-of-MatrixReadOut::setManager( ReadOutManager* boss )

◆ sortAndMakeNewHit()

void MatrixReadOut::sortAndMakeNewHit ( ubit16  newHit)
private

Definition at line 591 of file MatrixReadOut.cxx.

591  {
592  CMROData *p, *previous; //, *newElement;
593  char field;
594  // cout<<" new Hit is "<<hex<<newHit<<dec<<endl;
595  p = m_Body;
596  previous = m_Body;
597  // newElement = 0;
598  m_MROS.decodeFragment(newHit, field);
599  // cout<<" IELD= "<<field<<endl;
600  const ubit16 hitBCID = m_MROS.bcid();
601  const ubit16 hitTIME = m_MROS.time();
602  const ubit16 hitIJK = m_MROS.ijk();
603  const ubit16 hitCHANNEL = m_MROS.channel();
604  // cout<<" decode HIT "<<hitBCID<<" "<<hitTIME<<" "<<hitIJK<<" "<<hitCHANNEL<<endl;
605  //
606  do {
607  if (p) {
608  m_MROS.decodeFragment(p->hit, field);
609 
610  if (hitIJK > m_MROS.ijk()) {
611  previous = p;
612  p = p->next;
613  } else if (hitIJK < m_MROS.ijk()) {
614  makeNewHit(newHit, previous, p);
615  break;
616  } else if (hitIJK == m_MROS.ijk()) {
617  if (hitBCID > m_MROS.bcid()) {
618  previous = p;
619  p = p->next;
620  } else if (hitBCID < m_MROS.bcid()) {
621  makeNewHit(newHit, previous, p);
622  break;
623  } else if (hitBCID == m_MROS.bcid()) {
624  if (hitTIME > m_MROS.time()) {
625  previous = p;
626  p = p->next;
627  } else if (hitTIME < m_MROS.time()) {
628  makeNewHit(newHit, previous, p);
629  break;
630  } else if (hitTIME == m_MROS.time()) {
631  if (hitCHANNEL > m_MROS.channel()) {
632  previous = p;
633  p = p->next;
634  } else if (hitCHANNEL < m_MROS.channel()) {
635  makeNewHit(newHit, previous, p);
636  break;
637  } else {
638  throw std::runtime_error("duplicazione di hit???");
639  break;
640  } // end-of-if(hitCHANNEL
641  } // end-of-if(hitTIME
642  } // end-of-if(hitBCID
643  } // end-of-if(hitIJK
644 
645  } // if(p
646 
647  if (!p) {
648  if (!m_Body) { // structure empty
649  makeNewHit(newHit);
650  } else { // we are in the end of the structure
651  makeNewHit(newHit, previous, p);
652  } // end-of-if(!m_Body
653  } // end-of-if(p
654  } while (p);
655 } // end-of-MatrixReadOut::sortAndMakeNewHit

◆ tag()

ObjectType BaseObject::tag ( ) const
inlineinherited

Definition at line 22 of file BaseObject.h.

22 { return m_tag; }

◆ topCMABody()

void MatrixReadOut::topCMABody ( )

Definition at line 718 of file MatrixReadOut.cxx.

718  {
720  m_BodyCurr = m_Body;
721 } // MatrixReadOut::end-of-topCMABody

◆ writeCMABody()

void MatrixReadOut::writeCMABody ( ubit16  _BC,
ubit16  _TIME,
ubit16  IJK,
ubit16  _STRIP 
)

Definition at line 546 of file MatrixReadOut.cxx.

546  {
547  ubit16 CMABodyval[5];
548  CMABodyval[0] = 0;
549  CMABodyval[1] = BC;
550  CMABodyval[2] = TIME;
551  CMABodyval[3] = IJK;
552  CMABodyval[4] = CHANNEL;
553  sortAndMakeNewHit(m_MROS.makeBody(CMABodyval));
554 } // end-of-MatrixReadOut::writeCMABody

◆ writeFooter()

void MatrixReadOut::writeFooter ( )

Definition at line 556 of file MatrixReadOut.cxx.

556  {
557  ubit16 footerval;
558  footerval = computeCR() & m_first8bitsON;
559  m_Footer = m_MROS.makeFooter(footerval);
560  m_checkCR = 0;
563 } // end-of-MatrixReadOut::writeFooter

◆ writeHeader()

void MatrixReadOut::writeHeader ( ubit16  CMcode)

Definition at line 529 of file MatrixReadOut.cxx.

529  {
530  ubit16 headerval[3];
531  headerval[0] = 0;
532  headerval[1] = CMcode;
533  headerval[2] = m_FEL1ID;
534  m_Header = m_MROS.makeHeader(headerval);
535  m_checkHeaderNum++; //=1
536  m_checkHeaderPos = 1; //=1
537 } // end-of-writeHeader

◆ writeRecord()

void MatrixReadOut::writeRecord ( ubit16  thisRecord,
bool  last 
)

Definition at line 183 of file MatrixReadOut.cxx.

183  {
184  if (m_numberOfWordsInFrag == 0) {
185  m_Header = thisRecord;
188  } else if (m_numberOfWordsInFrag == 1) {
189  m_SubHeader = thisRecord;
192  } else if (m_numberOfWordsInFrag > 1 && !last) {
193  makeNewHit(thisRecord);
194  } else {
195  m_Footer = thisRecord;
198  m_checkCR = checkCRC8(thisRecord);
199  } //
201 } // end-of-MatrixReadOut::writeRecord

◆ writeSubHeader()

void MatrixReadOut::writeSubHeader ( )

Definition at line 539 of file MatrixReadOut.cxx.

539  {
541  m_checkSubHeaderNum++; //=1
543 
544 } // end-of-MatrixReadOut::writeSubHeader

Friends And Related Function Documentation

◆ operator<< [1/2]

std::ostream& operator<< ( std::ostream &  stream,
MatrixReadOut p 
)
friend

Definition at line 83 of file MatrixReadOut.h.

83  {
84  p.display(stream);
85  return stream;
86  }

◆ operator<< [2/2]

std::ostream& operator<< ( std::ostream &  stream,
MatrixReadOut p 
)
friend

Definition at line 79 of file MatrixReadOut.h.

79  {
80  p->display(stream);
81  return stream;
82  }

◆ ReadOutManager

friend class ReadOutManager
friend

Definition at line 94 of file MatrixReadOut.h.

Member Data Documentation

◆ m_addressOfWordScanned

ubit16 MatrixReadOut::m_addressOfWordScanned {}
private

Definition at line 127 of file MatrixReadOut.h.

◆ m_Body

CMROData* MatrixReadOut::m_Body {}
private

Definition at line 125 of file MatrixReadOut.h.

◆ m_BodyCurr

CMROData* MatrixReadOut::m_BodyCurr {}
private

Definition at line 129 of file MatrixReadOut.h.

◆ m_BodyLast

CMROData* MatrixReadOut::m_BodyLast {}
private

Definition at line 128 of file MatrixReadOut.h.

◆ m_BS

ubit16* MatrixReadOut::m_BS {}
private

Definition at line 112 of file MatrixReadOut.h.

◆ m_BunchFrom

ubit16 MatrixReadOut::m_BunchFrom {}
private

Definition at line 102 of file MatrixReadOut.h.

◆ m_BunchTo

ubit16 MatrixReadOut::m_BunchTo {}
private

Definition at line 103 of file MatrixReadOut.h.

◆ m_checkCR

ubit16 MatrixReadOut::m_checkCR {}
private

Definition at line 140 of file MatrixReadOut.h.

◆ m_checkFooterNum

ubit16 MatrixReadOut::m_checkFooterNum {}
private

Definition at line 139 of file MatrixReadOut.h.

◆ m_checkFooterPos

ubit16 MatrixReadOut::m_checkFooterPos {}
private

Definition at line 138 of file MatrixReadOut.h.

◆ m_checkHeaderNum

ubit16 MatrixReadOut::m_checkHeaderNum {}
private

Definition at line 135 of file MatrixReadOut.h.

◆ m_checkHeaderPos

ubit16 MatrixReadOut::m_checkHeaderPos {}
private

Definition at line 134 of file MatrixReadOut.h.

◆ m_checkSubHeaderNum

ubit16 MatrixReadOut::m_checkSubHeaderNum {}
private

Definition at line 137 of file MatrixReadOut.h.

◆ m_checkSubHeaderPos

ubit16 MatrixReadOut::m_checkSubHeaderPos {}
private

Definition at line 136 of file MatrixReadOut.h.

◆ m_checkUnkown

ubit16 MatrixReadOut::m_checkUnkown {}
private

Definition at line 141 of file MatrixReadOut.h.

◆ m_CM

Matrix* MatrixReadOut::m_CM {}
private

Definition at line 111 of file MatrixReadOut.h.

◆ m_data_version

MatrixReadOut::DataVersion MatrixReadOut::m_data_version
private

Definition at line 99 of file MatrixReadOut.h.

◆ m_FEL1ID

ubit16 MatrixReadOut::m_FEL1ID {}
private

Definition at line 104 of file MatrixReadOut.h.

◆ m_first8bitsON

ubit16 MatrixReadOut::m_first8bitsON {}
private

Definition at line 131 of file MatrixReadOut.h.

◆ m_Footer

ubit16 MatrixReadOut::m_Footer {}
private

Definition at line 123 of file MatrixReadOut.h.

◆ m_Header

ubit16 MatrixReadOut::m_Header {}
private

Definition at line 122 of file MatrixReadOut.h.

◆ m_MROS

MatrixReadOutStructure MatrixReadOut::m_MROS {}
private

Definition at line 101 of file MatrixReadOut.h.

◆ m_myBoss

ReadOutManager* MatrixReadOut::m_myBoss {}
private

Definition at line 95 of file MatrixReadOut.h.

◆ m_name

std::string BaseObject::m_name
privateinherited

Definition at line 16 of file BaseObject.h.

◆ m_NBunch

ubit16 MatrixReadOut::m_NBunch {}
private

Definition at line 107 of file MatrixReadOut.h.

◆ m_nchan

ubit16 MatrixReadOut::m_nchan[2] {}
private

Definition at line 109 of file MatrixReadOut.h.

◆ m_nclock

ubit16 MatrixReadOut::m_nclock {}
private

Definition at line 108 of file MatrixReadOut.h.

◆ m_NDLLCYC

ubit16 MatrixReadOut::m_NDLLCYC {}
private

Definition at line 106 of file MatrixReadOut.h.

◆ m_numberOfWordsInBody

ubit16 MatrixReadOut::m_numberOfWordsInBody {}
private

Definition at line 133 of file MatrixReadOut.h.

◆ m_numberOfWordsInFrag

ubit16 MatrixReadOut::m_numberOfWordsInFrag {}
private

Definition at line 132 of file MatrixReadOut.h.

◆ m_ROOffset

ubit16 MatrixReadOut::m_ROOffset {}
private

Definition at line 105 of file MatrixReadOut.h.

◆ m_SubHeader

ubit16 MatrixReadOut::m_SubHeader {}
private

Definition at line 124 of file MatrixReadOut.h.

◆ m_tag

ObjectType BaseObject::m_tag
privateinherited

Definition at line 15 of file BaseObject.h.

◆ m_timeSeparation

ubit16 MatrixReadOut::m_timeSeparation {}
private

Definition at line 110 of file MatrixReadOut.h.


The documentation for this class was generated from the following files:
MatrixReadOut::readFooter
ubit16 readFooter()
Definition: MatrixReadOut.cxx:661
MatrixReadOutStructure::makeBody
ubit16 makeBody(ubit16 *inputData)
Definition: MatrixReadOutStructure.cxx:83
Matrix::putData
void putData(int sidemat, int layer, int stripaddress, float time)
Definition: Trigger/TrigT1/TrigT1RPChardware/src/Matrix.cxx:434
beamspotman.r
def r
Definition: beamspotman.py:676
MatrixReadOut::m_SubHeader
ubit16 m_SubHeader
Definition: MatrixReadOut.h:124
MatrixReadOut::initialize
void initialize(uint NOBXS)
Definition: MatrixReadOut.cxx:203
MatrixReadOut::m_checkUnkown
ubit16 m_checkUnkown
Definition: MatrixReadOut.h:141
MatrixReadOutStructure::febcid
ubit16 febcid()
Definition: MatrixReadOutStructure.h:32
MatrixReadOut::m_checkSubHeaderNum
ubit16 m_checkSubHeaderNum
Definition: MatrixReadOut.h:137
Matrix::getLowHigh
int getLowHigh() const
Definition: Trigger/TrigT1/TrigT1RPChardware/src/Matrix.cxx:1754
MatrixReadOut::CMROData::next
CMROData * next
Definition: MatrixReadOut.h:120
MatrixReadOut::m_Footer
ubit16 m_Footer
Definition: MatrixReadOut.h:123
MatrixReadOutStructure::channel
ubit16 channel()
Definition: MatrixReadOutStructure.h:36
MatrixReadOutStructure::ijk
ubit16 ijk()
Definition: MatrixReadOutStructure.h:35
python.SystemOfUnits.m
int m
Definition: SystemOfUnits.py:91
python.PerfMonSerializer.p
def p
Definition: PerfMonSerializer.py:743
MatrixReadOutStructure::decodeFragment
ubit16 decodeFragment(ubit16 inputWord, char &field)
Definition: MatrixReadOutStructure.cxx:111
MatrixReadOut::m_data_version
MatrixReadOut::DataVersion m_data_version
Definition: MatrixReadOut.h:99
plotting.yearwise_efficiency.channel
channel
Definition: yearwise_efficiency.py:28
MatrixReadOut::m_checkHeaderNum
ubit16 m_checkHeaderNum
Definition: MatrixReadOut.h:135
MatrixReadOut::numberOfFragmentWords
ubit16 numberOfFragmentWords()
Definition: MatrixReadOut.h:50
MatrixReadOutStructure::makeSubHeader
ubit16 makeSubHeader()
Definition: MatrixReadOutStructure.cxx:76
MatrixReadOut::readSubHeader
ubit16 readSubHeader()
Definition: MatrixReadOut.cxx:659
BaseObject::m_name
std::string m_name
Definition: BaseObject.h:16
MatrixReadOutStructure::global_channel
ubit16 global_channel()
Definition: MatrixReadOutStructure.cxx:198
MatrixReadOut::makeSubHeader
void makeSubHeader()
Definition: MatrixReadOut.cxx:291
MatrixReadOutStructure::crc
ubit16 crc()
Definition: MatrixReadOutStructure.h:40
index
Definition: index.py:1
Matrix::reset
void reset()
Definition: Trigger/TrigT1/TrigT1RPChardware/src/Matrix.cxx:153
MatrixReadOut::m_first8bitsON
ubit16 m_first8bitsON
Definition: MatrixReadOut.h:131
Matrix::overlapRO
ubit16 overlapRO[64]
Definition: Trigger/TrigT1/TrigT1RPChardware/TrigT1RPChardware/Matrix.h:41
MatrixReadOut::m_checkCR
ubit16 m_checkCR
Definition: MatrixReadOut.h:140
MatrixReadOut::getHeader
MatrixReadOutStructure getHeader()
Definition: MatrixReadOut.cxx:948
MatrixReadOut::m_ROOffset
ubit16 m_ROOffset
Definition: MatrixReadOut.h:105
MatrixReadOut::CMROData::hit
ubit16 hit
Definition: MatrixReadOut.h:119
MatrixReadOut::m_checkFooterPos
ubit16 m_checkFooterPos
Definition: MatrixReadOut.h:138
Trk::one
@ one
Definition: TrkDetDescr/TrkSurfaces/TrkSurfaces/RealQuadraticEquation.h:22
MatrixReadOut::readHeader
ubit16 readHeader()
Definition: MatrixReadOut.cxx:657
MatrixReadOut::displaySubHeader
void displaySubHeader(std::ostream &stream)
Definition: MatrixReadOut.cxx:744
MatrixReadOut::m_CM
Matrix * m_CM
Definition: MatrixReadOut.h:111
Matrix::getLocalAdd
int getLocalAdd() const
Definition: Trigger/TrigT1/TrigT1RPChardware/src/Matrix.cxx:1760
UploadAMITag.l
list l
Definition: UploadAMITag.larcaf.py:158
MatrixReadOutStructure::overlap
ubit16 overlap()
Definition: MatrixReadOutStructure.h:38
MatrixReadOutStructure::fel1id
ubit16 fel1id()
Definition: MatrixReadOutStructure.h:31
ReadOfcFromCool.field
field
Definition: ReadOfcFromCool.py:48
MatrixReadOutStructure::cmid
ubit16 cmid()
Definition: MatrixReadOutStructure.h:30
MatrixReadOut::m_BunchFrom
ubit16 m_BunchFrom
Definition: MatrixReadOut.h:102
MatrixReadOut::m_BunchTo
ubit16 m_BunchTo
Definition: MatrixReadOut.h:103
MatrixReadOut::m_checkFooterNum
ubit16 m_checkFooterNum
Definition: MatrixReadOut.h:139
Matrix::getProjection
int getProjection() const
Definition: Trigger/TrigT1/TrigT1RPChardware/src/Matrix.cxx:1748
AthenaPoolTestWrite.stream
string stream
Definition: AthenaPoolTestWrite.py:12
MatrixReadOut::m_addressOfWordScanned
ubit16 m_addressOfWordScanned
Definition: MatrixReadOut.h:127
MatrixReadOut::makeFragment
void makeFragment()
Definition: MatrixReadOut.cxx:262
MatrixReadOut::m_NBunch
ubit16 m_NBunch
Definition: MatrixReadOut.h:107
dq_defect_copy_defect_database.channels
def channels
Definition: dq_defect_copy_defect_database.py:56
crc8
Definition: crc8.h:8
MatrixReadOut::m_BodyCurr
CMROData * m_BodyCurr
Definition: MatrixReadOut.h:129
MatrixReadOut::m_Header
ubit16 m_Header
Definition: MatrixReadOut.h:122
MatrixReadOut::writeSubHeader
void writeSubHeader()
Definition: MatrixReadOut.cxx:539
PixelByteStreamErrors::BCID
@ BCID
Definition: PixelByteStreamErrors.h:13
MatrixReadOut::m_numberOfWordsInFrag
ubit16 m_numberOfWordsInFrag
Definition: MatrixReadOut.h:132
MatrixReadOut::m_checkSubHeaderPos
ubit16 m_checkSubHeaderPos
Definition: MatrixReadOut.h:136
Pythia8_A14_NNPDF23LO_Var1Down_Common.ver
ver
Definition: Pythia8_A14_NNPDF23LO_Var1Down_Common.py:26
MatrixReadOut::displayFooter
void displayFooter(std::ostream &stream)
Definition: MatrixReadOut.cxx:782
MatrixReadOut::checkBodyOrder
ubit16 checkBodyOrder(bool debugPrint=false)
Definition: MatrixReadOut.cxx:837
Matrix::setBCzero
void setBCzero(ubit16 offset)
Definition: Trigger/TrigT1/TrigT1RPChardware/src/Matrix.cxx:545
MatrixReadOut::writeFooter
void writeFooter()
Definition: MatrixReadOut.cxx:556
MatrixReadOut::m_BodyLast
CMROData * m_BodyLast
Definition: MatrixReadOut.h:128
fillPileUpNoiseLumi.next
next
Definition: fillPileUpNoiseLumi.py:52
MatrixReadOut::makeHeader
void makeHeader()
Definition: MatrixReadOut.cxx:274
MatrixReadOut::m_numberOfWordsInBody
ubit16 m_numberOfWordsInBody
Definition: MatrixReadOut.h:133
lumiFormat.i
int i
Definition: lumiFormat.py:92
Matrix::highestthRO
ubit16 highestthRO[64]
Definition: Trigger/TrigT1/TrigT1RPChardware/TrigT1RPChardware/Matrix.h:37
h
beamspotman.n
n
Definition: beamspotman.py:731
extractSporadic.h
list h
Definition: extractSporadic.py:97
TRT::Hit::layer
@ layer
Definition: HitInfo.h:79
MatrixReadOut::m_nclock
ubit16 m_nclock
Definition: MatrixReadOut.h:108
MatrixReadOutStructure::makeFooter
ubit16 makeFooter(ubit16 inputData)
Definition: MatrixReadOutStructure.cxx:100
Preparation.mode
mode
Definition: Preparation.py:95
MatrixReadOut::m_FEL1ID
ubit16 m_FEL1ID
Definition: MatrixReadOut.h:104
Matrix::execute
void execute()
Definition: Trigger/TrigT1/TrigT1RPChardware/src/Matrix.cxx:856
run
Definition: run.py:1
MatrixReadOut::m_Body
CMROData * m_Body
Definition: MatrixReadOut.h:125
crc8::calc
int calc(int dato)
Definition: crc8.cxx:29
MatrixReadOut::displayHeader
void displayHeader(std::ostream &stream)
Definition: MatrixReadOut.cxx:730
MatrixReadOut::readCMABodyCurrent
ubit16 readCMABodyCurrent()
Definition: MatrixReadOut.cxx:663
MatrixReadOut::m_BS
ubit16 * m_BS
Definition: MatrixReadOut.h:112
merge.output
output
Definition: merge.py:17
MatrixReadOut::m_timeSeparation
ubit16 m_timeSeparation
Definition: MatrixReadOut.h:110
MatrixReadOut::makeFooter
void makeFooter()
Definition: MatrixReadOut.cxx:309
Hardware
@ Hardware
Definition: BaseObject.h:11
MatrixReadOut::m_nchan
ubit16 m_nchan[2]
Definition: MatrixReadOut.h:109
MatrixReadOutStructure::makeHeader
ubit16 makeHeader(ubit16 *inputData)
Definition: MatrixReadOutStructure.cxx:68
MatrixReadOut::displayBody
void displayBody(std::ostream &stream)
Definition: MatrixReadOut.cxx:756
ActsTrk::to_string
std::string to_string(const DetectorType &type)
Definition: GeometryDefs.h:34
MatrixReadOut::getCMAHit
MatrixReadOutStructure getCMAHit(int index)
Definition: MatrixReadOut.cxx:699
crc8::current
int current()
Definition: crc8.cxx:23
MatrixReadOutStructure
Definition: MatrixReadOutStructure.h:13
TIME
#define TIME(name)
Definition: FPGATrackSimLogicalHitsProcessAlg.cxx:36
MatrixReadOut::makeCMABody
void makeCMABody()
Definition: MatrixReadOut.cxx:299
BaseObject::BaseObject
BaseObject(ObjectType, const std::string &)
Definition: BaseObject.cxx:7
CMAword
uint32_t CMAword
Definition: Lvl1Def.h:17
MatrixReadOut::m_checkHeaderPos
ubit16 m_checkHeaderPos
Definition: MatrixReadOut.h:134
Matrix::k_readout
CMAword k_readout[64]
Definition: Trigger/TrigT1/TrigT1RPChardware/TrigT1RPChardware/Matrix.h:33
MatrixReadOut::makeCMABodyHit
ubit16 makeCMABodyHit()
Definition: MatrixReadOut.cxx:336
MatrixReadOutStructure::time
ubit16 time()
Definition: MatrixReadOutStructure.h:34
Muon::EnumDefs::BC
@ BC
Definition: MuonEnumDefs.h:13
MatrixReadOut::makeCMABodyTrg
ubit16 makeCMABodyTrg()
Definition: MatrixReadOut.cxx:447
python.PyAthena.v
v
Definition: PyAthena.py:157
MatrixReadOut::deleteCMABody
void deleteCMABody()
Definition: MatrixReadOut.cxx:246
CaloSwCorrections.time
def time(flags, cells_name, *args, **kw)
Definition: CaloSwCorrections.py:242
MatrixReadOut::sortAndMakeNewHit
void sortAndMakeNewHit(ubit16 newHit)
Definition: MatrixReadOut.cxx:591
MatrixReadOut::writeHeader
void writeHeader(ubit16 CMcode)
Definition: MatrixReadOut.cxx:529
BaseObject::m_tag
ObjectType m_tag
Definition: BaseObject.h:15
MatrixReadOutStructure::setInit
void setInit()
Definition: MatrixReadOutStructure.cxx:51
MatrixReadOut::computeCR
ubit16 computeCR()
Definition: MatrixReadOut.cxx:317
MatrixReadOut::Simulation
@ Simulation
Definition: MatrixReadOut.h:20
extractSporadic.q
list q
Definition: extractSporadic.py:98
MatrixReadOutStructure::threshold
ubit16 threshold()
Definition: MatrixReadOutStructure.h:37
MatrixReadOut::makeNewHit
void makeNewHit(ubit16 newHit)
Definition: MatrixReadOut.cxx:565
MatrixReadOut::m_MROS
MatrixReadOutStructure m_MROS
Definition: MatrixReadOut.h:101
SIDE
SIDE
Definition: CellClusterLinkTool.h:52
ubit16
unsigned short int ubit16
Definition: RpcByteStreamEncoder.h:20
checkJobs.completed
completed
Definition: checkJobs.py:24
Overlay::debugPrint
std::string debugPrint(const IDC_Container *container, unsigned numprint=25)
Diagnostic output of Identifiable Containers.
Matrix::rodat
CMAword rodat[2][2][64][2]
Note array lengths using hardcoded values rather than to depend on NOBXS as they were in the past (as...
Definition: Trigger/TrigT1/TrigT1RPChardware/TrigT1RPChardware/Matrix.h:29
MatrixReadOut::m_NDLLCYC
ubit16 m_NDLLCYC
Definition: MatrixReadOut.h:106
MatrixReadOut::checkCRC8
ubit16 checkCRC8(ubit16 foot)
Definition: MatrixReadOut.cxx:831
readCCLHist.float
float
Definition: readCCLHist.py:83
MatrixReadOut::m_myBoss
ReadOutManager * m_myBoss
Definition: MatrixReadOut.h:95
plot_times.times
def times(fn)
Definition: plot_times.py:11
MatrixReadOutStructure::bcid
ubit16 bcid()
Definition: MatrixReadOutStructure.h:33
fitman.k
k
Definition: fitman.py:528
Trk::previous
@ previous
Definition: BinningData.h:32
Atlas
Definition: Atlas.UnixStandardJob.py:1