#include <mMuiRawUnpack.h>
Public Methods | |
mMuiRawUnpack () | |
Constructor. More... | |
~mMuiRawUnpack () | |
Destructor. More... | |
PHBoolean | event (PHCompositeNode *basenode) |
Fill the TMuiRawO table. More... | |
PHBoolean | event (Event *evt, PHCompositeNode *basenode) |
Private Methods | |
unsigned int | getbits (unsigned int word, int start, int length) |
Private Attributes | |
const mMuiRawUnpackPar * | _mod_par |
PHTimeServer::timer | _timer |
\
Definition at line 22 of file mMuiRawUnpack.h.
|
Constructor.
Definition at line 19 of file mMuiRawUnpack.cxx.
00019 : 00020 _timer( PHTimeServer::get()->insert_new( "mMuiRawUnpack" ) ) 00021 {} |
|
Destructor.
Definition at line 23 of file mMuiRawUnpack.cxx.
00023 {} |
|
Definition at line 48 of file mMuiRawUnpack.cxx. References _mod_par, mMuiRawUnpackPar::get_id_base, mMuiRawUnpackPar::get_module_id, getbits, TMuiHitMapO::insert_new, and MUIOO::TRACE.
00049 { 00050 if(evt == 0) 00051 { 00052 cout<<PHWHERE<<" Null event pointer.\n"; 00053 return False; 00054 } 00055 00056 // module runtime parameters 00057 _mod_par = TMutNode<mMuiRawUnpackPar>::find_node(baseNode,"mMuiRawUnpackPar"); 00058 00059 //Find or create the new TMuiHitO objects 00060 TMuiHitMapO* _muihitmap = 0; 00061 try{ 00062 _muihitmap = TMutNode<TMuiHitMapO>::find_node(baseNode,"TMuiHitMapO"); 00063 } catch(std::exception& e){ 00064 MUIOO::TRACE(e.what()); 00065 return False; 00066 } 00067 00068 TMuiAddressTable* pAddress = TMuiAddressTable::Table(); 00069 if (!pAddress) return False; 00070 00071 int packetdata[MUIOO::kWordsPerFEM]={0}; 00072 00073 unsigned int row = 0; 00074 //static const unsigned long dcm_words_max = 136; // size of DCM array 00075 // Assign module ID to associated packet ID, then get Module ID 00076 // according to current packet ID instead extract it from 00077 // DCM word. Warning!!!! If assigned packet ID for MuID DCMs are 00078 // changed, we need to modifiy assignment in par file. 00079 00080 for (int dcm=0; dcm<MUIOO::kFEMsTotal; dcm++) { 00081 00082 unsigned int packetid = _mod_par->get_id_base() + dcm; 00083 Packet* muipacket = evt->getPacket(packetid); 00084 int numwords = 0; //Number of words actually returned by packet accessor 00085 00086 //All muid packets are not necessarily present 00087 if(muipacket<=0) continue; 00088 00089 TMuiReadoutID idHard; 00090 TMuiChannelId idSoft; 00091 00092 unsigned int moduleID = _mod_par->get_module_id(dcm); 00093 00094 short Arm = pAddress->Arm(moduleID); 00095 short orient = pAddress->Orient(moduleID); 00096 00097 muipacket->fillIntArray(packetdata, 00098 MUIOO::kWordsPerFEM, 00099 &numwords, 00100 "SPARSE"); 00101 delete muipacket; 00102 00103 // Sanity check of the word count ... 00104 if (numwords > MUIOO::kWordsPerFEM) { 00105 cout << PHWHERE << packetid 00106 << " has " << numwords 00107 << " words, maximum allowed is " << MUIOO::kWordsPerFEM << endl; 00108 continue; 00109 } 00110 00111 for (unsigned int j=0; j<(unsigned int)numwords; j++) { 00112 unsigned int pattern = packetdata[j]; 00113 00114 short roc = getbits(pattern,30,7); 00115 short word = getbits(pattern,23,4); 00116 00117 if ( (roc < 0) || (roc >= TMuiReadoutID::kROCsPerFEM) 00118 || (word < 0) || (word >= TMuiReadoutID::kWordsPerROC) ) { 00119 cout << "mMuiDCMUnpack-E1 ROC id " << roc 00120 << " or word-in-ROC id " << word << " out of range" << endl; 00121 } 00122 else { 00123 00124 for (short bit=0; bit<16; bit++) { 00125 if (getbits(pattern,bit,1) == 1) { 00126 idHard.Set(moduleID,roc,word,bit); 00127 idSoft = pAddress->SoftwareAddress(idHard); 00128 00129 if ( (idSoft.Arm() != Arm) || (idSoft.Orient() != orient) ) { 00130 cout << "mMuiDCMUnpack-E3 DCM arm, orient = " 00131 << Arm << " " << orient 00132 << " Lookup arm, orient = " 00133 << idSoft.Arm() << " " << idSoft.Orient() << endl; 00134 } 00135 else { 00136 #ifdef MUIOO_DEBUG 00137 TMuiHitMapO::iterator hitIter = 00138 #endif 00139 _muihitmap->insert_new( 00140 idSoft.Arm(), 00141 idSoft.Plane(), 00142 idSoft.Panel(), 00143 idSoft.Orient(), 00144 idSoft.TwoPack() 00145 ); 00146 #ifdef MUIOO_DEBUG 00147 hitIter->get()->print(); 00148 #endif 00149 00150 row++; 00151 } 00152 } 00153 00154 } // for (bit=0 ...) 00155 } // if roc and word in range 00156 } // for (j=0 ...) 00157 } // for (dcm=0 ...) 00158 00159 return True; 00160 } |
|
Fill the TMuiRawO table.
Definition at line 27 of file mMuiRawUnpack.cxx. References _timer, and MUIOO::TRACE.
00028 { 00029 00030 _timer.get()->restart(); 00031 00032 Event* evt = 0; 00033 00034 // Find the prdf node. 00035 try{ 00036 evt = TMutNode<Event>::find_node(baseNode,"PRDF"); 00037 } catch(std::exception& e){ 00038 MUIOO::TRACE(e.what()); 00039 return False; 00040 } 00041 PHBoolean out = event(evt, baseNode); 00042 _timer.get()->stop(); 00043 00044 return out; 00045 } |
|
Definition at line 162 of file mMuiRawUnpack.cxx. Referenced by event.
00162 { 00163 return (word >> (start+1-length)) & ~(~0 << length); 00164 } |
|
Definition at line 39 of file mMuiRawUnpack.h. Referenced by event. |
|
Definition at line 41 of file mMuiRawUnpack.h. Referenced by event. |