MicrorocXDaqReader Class Reference

#include <MicrorocXDaqReader.hh>

Inheritance diagram for MicrorocXDaqReader:

Inheritance graph
[legend]
Collaboration diagram for MicrorocXDaqReader:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 MicrorocXDaqReader (Run &aRun, std::string aFilefullPath, ui32 lastEventId, bool forceAnalog, std::set< unsigned int > *=NULL)
 ~MicrorocXDaqReader ()
int getScData ()
int getNextEvent (Event &eventToFill)
int getAcqData (Event &event, unsigned char *bufChar, bool tempExist=false)
int getAnalogData (Event &event)
unsigned int getData (const unsigned int nBytes)

Static Public Member Functions

static const char * type (const int subtype=0)

Private Member Functions

void localReset ()

Private Attributes

std::map< ui16, std::map<
ui16, ui16 > > 
analogData
ui16 nbChipPerLine
bool analogDataActivate
bool analogDataActivatedLine [NBLINE]
std::list< unsigned char > rawdataList
std::list< unsigned char
>::const_iterator 
itRawdata
std::set< unsigned int > * difList
IO::LCReader * lcReader
bool firstEvent
ui32 debugEventId
bool slowControlSet
ui32 hexTemperatureAsu1
ui32 hexTemperatureAsu2
ui16 hexTemperatureDif
bool forceAnalog

Detailed Description

CLASS DATAREADER //

Definition at line 38 of file MicrorocXDaqReader.hh.


Constructor & Destructor Documentation

MicrorocXDaqReader::MicrorocXDaqReader ( Run aRun,
std::string  aFilefullPath,
ui32  lastEventId,
bool  forceAnalog,
std::set< unsigned int > *  = NULL 
)

MicrorocXDaqReader::~MicrorocXDaqReader (  ) 

Definition at line 92 of file f12MicrorocXDaqReader.cpp.

00093 {
00094   lcReader->close();
00095   delete lcReader;
00096   FILE_LOG(logDEBUG1)<< "----MicrorocXDaqReader destructor"<< endl;
00097 }


Member Function Documentation

static const char* MicrorocXDaqReader::type ( const int  subtype = 0  )  [inline, static]

Reimplemented from MicrorocReader.

Definition at line 42 of file MicrorocXDaqReader.hh.

Referenced by main().

00042 { return XDAQMR; };

int MicrorocXDaqReader::getScData (  )  [virtual]

Implements MicrorocReader.

Definition at line 107 of file f12MicrorocXDaqReader.cpp.

Referenced by getNextEvent().

00108 {
00109 return 0;
00110 }

int MicrorocXDaqReader::getNextEvent ( Event eventToFill  )  [virtual]

Implements MicrorocReader.

Definition at line 112 of file f12MicrorocXDaqReader.cpp.

00113 {
00114   Level(0);
00115   ui16 dataFormat = run.getDataFormat();
00116 
00117   if (dataFormat == 0) {
00118     // first read of the file
00119     bcIdDifAbsOrgMap.clear();
00120     // read file header
00121     dataFormat = 1;
00122     run.setDataFormat(dataFormat);
00123     //FILE_LOG(logINFO) << " labview data format[" << hex << dataFormat << "] "<< endl;
00124     //run.setDaqSoftware(333);
00125     //run.setCccFirmware(333);
00126     //globalTime = 333;
00127     
00128     return NEW_CONFIG;
00129   } // end dataFormat == 0
00130 
00131   // loops until a non-empty event has been found
00132   bool eventFound = false;
00133   while (! eventFound)
00134   {
00135     LCEvent* lcioEvt(0) ;
00136     lcioEvt = lcReader->readNextEvent() ;
00137     if ( lcioEvt == NULL ) // EOF reach
00138     {
00139       return LAST_FILE_EVENT;
00140     }
00141 
00142 
00143     // There is one more LCEvent
00144     //LCTOOLS::dumpEvent( lcioEvt ) ;
00145     if ( ! slowControlSet )
00146     {
00147       // Read Slow control from database
00148       if ( event.getRun().getId() == 0 )
00149       {  // try to find run Id in lcioEvt
00150         run.setId(lcioEvt->getRunNumber());
00151         FILE_LOG(logINFO) << "Set run Id from lcioEvent information[" << run.getId() << "]" << endl;
00152       }
00153       globalTime = lcioEvt->getTimeStamp();
00154 
00155       run.setDaqSoftware(0);
00156       run.setCccFirmware(0);
00157 
00158       IlcConfDb *ilcconf = IlcConfDb::getInstance();
00159       if ( ilcconf != NULL )
00160       {
00161         MicrorocSCReader scReader(run);
00162         scReader.parseSCFromDb(*ilcconf);
00163         slowControlSet = true;
00164       }
00165 
00166     }
00167     
00168     if ( firstEvent )
00169     {
00170       FILE_LOG(logINFO) << "firstEvent  skip"  << endl;
00171       firstEvent = false;
00172       // skip first event because of its corruption ???
00173     }
00174     else
00175     {
00176       // vnames to store lcioEvt collections name
00177       std::vector<std::string >* vnames;
00178       try
00179       {
00180         vnames= (std::vector<std::string >*)lcioEvt->getCollectionNames();
00181         /*
00182         cout << "run number: " << lcioEvt->getRunNumber()<< endl;
00183         cout << "event number: " << lcioEvt->getEventNumber()<< endl;
00184         cout << "timestamp: " << lcioEvt->getTimeStamp()<< endl;
00185         cout << "detectorName: " << lcioEvt->getDetectorName()<< endl;
00186         cout << "weight: " << lcioEvt->getWeight()<< endl;
00187         */
00188         for ( vector<std::string >::iterator it = vnames->begin();  it!= vnames->end(); it++)
00189         {
00190           if ((*it).compare("RU_XDAQ")==0)
00191           {
00192             EVENT::LCCollection* col= lcioEvt->getCollection(*it);
00193     //        cout << "collection name:["<< *it << "]"  << endl;
00194 
00195             for (int difRawDataIndex=0;difRawDataIndex<col->getNumberOfElements(); difRawDataIndex++)
00196             {
00197               IMPL::LCGenericObjectImpl* go= (IMPL::LCGenericObjectImpl*) col->getElementAt(difRawDataIndex);
00198               int rusize =go->getNInt();
00199      //         std::cout<<" New RU found with "<<rusize<<" int stored" <<std::endl;
00200               if ( rusize == 56 ) continue; // skip first RU_XDAQ si tsille est 56 int
00201 
00202               int shift=-1;
00203               ui16 nbInt = go->getNInt();
00204       //        cout << "DEBUG ---nbInt [" << dec << nbInt << "]-----------------" <<endl;
00205 
00206               
00207               unsigned int buf[go->getNInt()];
00208 
00209               for (int k=0; k < (go->getNInt() );k++) { buf[k] = go->getIntVal(k); }
00210               // skip first NBBYTETOSKIP ( 94 ) bytes 
00211               // then fill rawdataList with unsigned char
00212               unsigned char* bufChar = ( unsigned char* ) &(buf); 
00213               ui16 rapport = (ui16) (sizeof(unsigned int ) / sizeof ( unsigned char) );
00214 
00215               rawdataList.clear();
00216               for ( ui32 j = NBBYTETOSKIP ; j < go->getNInt()*rapport ; j++ )
00217               {
00218                 rawdataList.push_back(*(bufChar+j));
00219               }
00220               
00221               itRawdata = rawdataList.begin();
00222               unsigned int globalHeader = getData(1);
00223        //       cout << "globalHeader[" << hex << globalHeader <<  "]" << endl;
00224 
00225               if (globalHeader == 0xB1) {
00226                 // slow control data
00227                 getScData();
00228                 exit(-1); // Conf in Oracle DB not in raw data
00229               }
00230               else if (globalHeader == 0xC0) {
00231                 // acquisition data
00232                 getAnalogData(event);
00233               }
00234               else if (globalHeader == 0xB0) {
00235                 // acquisition data
00236                 getAcqData(event,bufChar);
00237                 //eventFound = true;
00238               }
00239               else {
00240                 FILE_LOG(logERROR) << "  parsing file error. global header error : " << hex << globalHeader << dec << endl;
00241               }
00242             } // end for data for dif
00243             eventFound = true ;
00244             event.setId(++lastEventId);
00245           } // ed if collection = XU_XDAQ
00246           /*
00247           else  if ((*it).compare("DHCALRawHits")==0)  
00248           {
00249             std::cout << "--- Found Collection DHCALRawHits" << endl;
00250             EVENT::LCCollection* col= lcioEvt->getCollection("DHCALRawHits");
00251             std::cout << "--- col lcioEvt->getCollection(\"DHCALRawHits\") " << col << endl;
00252           }
00253           */
00254         } // end for collection in event
00255       }
00256       catch (IOException& e)
00257       {
00258         std::cout << e.what() << std::endl ;
00259         std::string s=e.what();s+=__PRETTY_FUNCTION__;
00260         exit(-1);
00261       }
00262       catch (...)
00263       {
00264         std::cout<<" unknow io exeption "<<std::endl;
00265         exit(-1);
00266       }
00267       /*DEBUG */  unsigned int globalHeader = 0XB0;
00268     } // end else not first event
00269 
00270     
00271   }// end while event not found
00272 
00273   return EVENT_CORRECT;
00274 
00275 
00276 
00277 
00278 
00279 return 0;
00280 }

int MicrorocXDaqReader::getAcqData ( Event event,
unsigned char *  bufChar,
bool  tempExist = false 
)

Definition at line 291 of file MicrorocXDaqReader.cpp.

Referenced by getNextEvent().

00292 {
00293 
00294   ui32 nbanalogHit = 0;
00295   unsigned int nbHits = 0;
00296 
00297   display(+1);
00298 
00299 
00300   this->setComputeCrcFlag(true);
00301   //FILE_LOG(logDEBUG) << "MicrorocLabviewReader crc adr[" <<  crc << "]" << endl;
00302 
00303   if ( temperatureFill )
00304   {
00305     FILE_LOG(logDEBUG) << " global header BB found" << endl;
00306     FILE_LOG(logDEBUG) << "crc->compute(0xBB)[ "<< crc <<"]"   << endl;
00307     crc->compute(0xBB);
00308   }
00309   else 
00310   {
00311     FILE_LOG(logDEBUG) << " global header B0 found" << endl;
00312      FILE_LOG(logDEBUG) << "crc->compute(0xB0)[ "<< crc <<"]"   << endl;
00313     crc->compute(0xB0);
00314   }
00315 
00316 
00317 
00318   // reset the data for the block
00319   //  bcId_AbsOrg = -1;
00320   bcId_Abs = 0; // max. 48 bits
00321   bcId_Dif = 0;
00322   // the following data is repeated one time for each Dif which has sent data
00323   difId = getData(1);
00324 
00325   difTriggerCounter = getData(4);
00326   informationCounter = getData(4);  // trigger counter version >= 4
00327   globalTriggerCounter = getData(4);
00328 
00329   ui64 bcIdHigh = getData(2);
00330   ui64 bcIdLow = getData(4);
00331   bcId_Abs = (bcIdHigh << 32) + bcIdLow;
00332   //FILE_LOG(logDEBUG) << "bcId_Abs[" << hex << bcId_Abs <<  endl;
00333 
00334   bcId_Dif = getData(3);
00335 
00336   bcId_AbsOrg =  getbcIdAbsOrg(difId, bcId_Abs);
00337   display();
00338 
00339   ui16 lineInfo =  getData(1);
00340   FILE_LOG(logDEBUG)   << " lineInfo[0x" <<hex << lineInfo << "]"  << endl;
00341   ui16 nbLine   = (lineInfo & 0xF0 ) >> 4;
00342   FILE_LOG(logDEBUG)   << " nbline[0x" <<hex << nbLine << "]"  << endl;
00343   ui16 usedLine = lineInfo & 0x0F; //bit 3 (4eme ligne,)  bit 2 (3eme ligne)  bit 1 (2eme ligne)  bit 0 (1ere ligne)
00344   FILE_LOG(logDEBUG)   << " usedLine[0x" <<hex << usedLine << "]"  << endl;
00345   display();
00346 
00347 
00348   if ( temperatureFill )
00349   {
00350     hexTemperatureAsu1 = getData(4);
00351     hexTemperatureAsu2 = getData(4);
00352     hexTemperatureDif = getData(1) & 0xFF;
00353 
00354     
00355 /*
00356   Pour les temperature des ASU
00357 1) j'enleve les 16 bits de poids fort (bit31 a bit16). Le bit 15 signifie alors le bit de signe
00358     C'est a dire qu'il faut que tu mette(bit15 à bit0) dans un integer signé à 16 bits.
00359 
00360 2) il faut supprimer les 3  bits de poids faible (bit2 à bit0). moi, je l'ai fait par une division entiere par 8 (pour garder le signe). Autrement, si tu préfères, tu pourrais faire une décalage de 3 bits des (bits14 à bits0)
00361 
00362 3) il faut diviser le chiffre restant par 16 pour avoir le résultat en degré Celsius.
00363 Cyril.
00364 */
00365     i16 hex16tempAsu1 = hexTemperatureAsu1 & 0xFFFF; 
00366     float tempAsu1 = (float) ((hex16tempAsu1 / 16 ) / 8 );
00367 
00368     i16 hex16tempAsu2 = hexTemperatureAsu2 & 0xFFFF; 
00369     float tempAsu2 = (float) ((hex16tempAsu2 / 16 ) / 8 );
00370 
00371 /* 
00372 Pour la temperature de la Dif
00373 Vlsb est une constante = 20
00374 (ca veut dire qu'un lsb de l'adc de la DIF vaut 20mV)
00375 
00376 Nadc = les 8 bits que tu recois
00377 
00378 Temperature = la conversion en degré Celsius
00379 ================================================
00380 
00381 float V_adc ;
00382 float  V_lm20 ;
00383 
00384 conversion ADC 
00385 V_adc = ( Nadc * Vlsb ) ;
00386 
00387 ampli gain 33K/10K avec point milieu à 1,5V 
00388 V_lm20 = ( (6450 - V_adc) / 3.3 ) ;
00389 
00390 calcul du premier ordre du lm20 pour T entre -30°C et 100°C 
00391 Temperature = (  (V_lm20 - 1860.5) / (-11.77)  ) ;
00392 */
00393     float Vlsb = 20.0;
00394     float V_adc = hexTemperatureDif * Vlsb;
00395     float V_lm20 = ( (6450. - V_adc) / 3.3 ) ;
00396     float tempDif = (V_lm20 - 1860.5) / (-11.77);
00397 
00398 /*
00399     if ( tempDif != 0. )
00400     {
00401       cout << "hexTemperatureDif [0x" << hex << hexTemperatureDif << "]"  << endl;
00402       cout << "Vlsb [" <<  dec <<Vlsb << "]"  << endl;
00403       cout << "V_adc [" <<  dec <<V_adc << "]"  << endl;
00404       cout << "V_lm20 [" <<  dec <<V_lm20 << "]"  << endl;
00405       cout << "tempDif [" <<  dec <<tempDif << "]"  << endl;
00406     }
00407 */
00408     
00409     event.setTemperature(difId, tempAsu1,    tempAsu2 , tempDif);
00410     
00411   }
00412 
00413  // the bcTime in milliseconds
00414   i64 bcTime = ((bcId_Abs - bcId_AbsOrg) * bcPeriod) / 1000;
00415   // the reading time in milliseconds
00416   i64 readTime = globalTime + bcTime;
00417 
00418   FILE_LOG(logDEBUG)   << "  START EVENT ------------- time " << readTime << " ms" << endl;
00419   FILE_LOG(logDEBUG)   << "    bc time               " << bcTime << " ms" << endl;
00420   FILE_LOG(logDEBUG)   << "    DIF Id                0x" << hex << (int)difId << dec << endl;
00421   FILE_LOG(logDEBUG)   << "    DIF trigger counter   " << difTriggerCounter << endl;
00422   FILE_LOG(logDEBUG)   << "    Information counter   " << informationCounter << endl;
00423   FILE_LOG(logDEBUG)   << "    total trigger counter " << globalTriggerCounter << endl;
00424   FILE_LOG(logDEBUG)   << "    absolute bcId         " << bcId_Abs - bcId_AbsOrg << endl;
00425   FILE_LOG(logDEBUG)   << "    nb line          " << dec <<nbLine << endl;
00426   FILE_LOG(logDEBUG)   << "    used line        " << hex << usedLine << dec <<endl;
00427   event.setDifTriggerCounter(difTriggerCounter);
00428   event.setGlobalTriggerCounter(globalTriggerCounter);
00429 
00430 
00431   Detector &detector = run.getDetector();
00432 
00433   // end of global header
00434 
00435  bool difFound = false;
00436   { const ChamberMap_t &chambers = detector.getChambers();
00437     for (ChamberMap_t::const_iterator it = chambers.begin(); it != chambers.end(); ++it) {
00438       try {
00439         Chamber& chamber = *(it->second);
00440         const BoardMap_t& boards = chamber.getBoardsByDifId(difId);
00441       }
00442       catch (...) {
00443         // any error case - try next chamber
00444         continue;
00445       }
00446 
00447       // the DIF has been found in a chamber. Process all data and continue
00448       difFound = true;
00449       break;
00450     } // for
00451     if (detector.getMonitoringId() == difId)
00452     {
00453        difFound = true;
00454     }
00455     if (!difFound) {
00456       FILE_LOG(logERROR) << "    No dif found with Id 0x" << hex << difId << ", " << dec << difId << "                                     " <<endl;
00457       event.setValidFlag(UNKNOW_NOT_VALID);
00458 
00459     }
00460   }
00461 
00462   for (bool finish = false; !finish; ) {
00463     int delimiter = 0;
00464 
00465     display();
00466     for (; delimiter != 0xA0 && delimiter != 0xB4 && delimiter != 0xC4; ) {
00467       // seek for first data frame header (0xB4)
00468       delimiter = getData(1);
00469       if (fileError == EOF) {
00470         delimiter = 0;
00471         break;
00472       }
00473       if (delimiter == 0xA3)
00474       {
00475         FILE_LOG(logERROR) << "    frame trailer A3 found -- should not" << endl;
00476         event.setValidFlag(UNKNOW_NOT_VALID);
00477       }
00478     }
00479     if (delimiter == 0x00) {
00480       FILE_LOG(logERROR) << "  end of file -- should not" << endl;
00481       event.setValidFlag(UNKNOW_NOT_VALID);
00482       break;
00483     }
00484     if (delimiter == 0xA0) 
00485     {
00486       FILE_LOG(logDEBUG) << "    frame trailer A0 found" << endl;
00487       this->setComputeCrcFlag(false);
00488       unsigned short CRC_check = getData(2);
00489       FILE_LOG(logDEBUG) << hex << " Compute CRC[" << crc->getCrc() << "]" <<  endl;
00490       FILE_LOG(logDEBUG) << hex << " Received CRC[" << CRC_check << "]" <<  endl;
00491       if ( CRC_check != crc->getCrc() )
00492       {
00493         FILE_LOG(logERROR)  << " CRC Error for event id " <<  lastEventId 
00494                             <<  " Compute CRC[" << crc->getCrc() 
00495                             << "] Received CRC[" << CRC_check << "]" <<  endl ;
00496         event.setCrcIsCorrect(false);
00497         event.setValidFlag(CRC_ERROR);
00498       }
00499       display(-1);
00500       FILE_LOG(logDEBUG) << " global trailer A0 found" << endl;
00501       break;
00502     }
00503     if (delimiter == 0xC4) 
00504     {
00505       //computeCrc = false;
00506       Dif& dif = run.getDetector().getDifById(difId);
00507       analogDataActivate = true;
00508       ui16 lineNum = 1;
00509       ui16 nbChipByBoard = dif.getBoards().begin()->second->getNbColumns();
00510       ui16 nbBoard =  dif.getBoards().size();
00511       FILE_LOG(logDEBUG) << "nbBoard[" << nbBoard << "]" <<endl;
00512       FILE_LOG(logDEBUG) << "nbChipByBoard[" << nbChipByBoard << "]" <<endl;
00513 
00514       for ( ui16 iLine = 0 ; iLine < nbLine ; iLine++)
00515       {
00516         if ( usedLine & lineNum ) // LINE 1
00517         {
00518           ui16 nbChips = getData(1);
00519           FILE_LOG(logDEBUG)  << endl << " Line " << lineNum << " nb Chip[" << dec <<  nbChips << "]"  << endl;
00520 
00521           for ( i32 col = nbBoard * nbChipByBoard -1  ; col >= 0; col--)
00522           {
00523             ui16 board = col/nbChipByBoard;
00524             FILE_LOG(logDEBUG)<< dec << "board [" << board << "] line[" << lineNum-1 << "] col[" <<  col << "]" << endl; 
00525             Chip& chip = dif.getChipByRowCol(board, lineNum-1,col % 6);   // board / row /column
00526             if( chip.getBypassed() == false )
00527             {
00528 
00529               FILE_LOG(logDEBUG)<< dec << "chip Id[" << chip.getId() << "]" << endl;
00530               map<ui16,ui16> channelsValues;
00531               for ( ui16 iChannel = 0 ; iChannel < 64 ; iChannel++)
00532               {
00533                 ui16 foo = getData(2);
00534                 channelsValues[iChannel] = foo; 
00535                 FILE_LOG(logDEBUG) << "difId["<< dif.getId() << "] ,chipId["<< chip.getId() <<"] analogData line["<< line <<
00536                                       "], col number["<< col << "] , channel[" << iChannel << "= " << hex <<foo << "]" << dec << endl;
00537               } // end for iChannel
00538               this->analogData[chip.getId()] = channelsValues;
00539             }
00540           } // end for iChip
00541         } // end if usedLine
00542         lineNum++;
00543       } // end for iLine
00544      //computeCrc = true;
00545     }
00546     if ( forceAnalog )
00547     {
00548       for ( map<ui16,map<ui16,ui16> >::iterator iterAnal = analogData.begin(); iterAnal!= analogData.end(); iterAnal++)
00549       {
00550         map<ui16,ui16>& byChip = iterAnal->second;
00551         ui16 chipId = iterAnal->first;
00552         // When analog is anable, all channel of all chip enable for analogic respond
00553         for ( std::map<ui16,ui16>::iterator iterChip = byChip.begin(); iterChip != byChip.end();iterChip++)
00554         {
00555           ui16 analogValue =  iterChip->second;
00556           ui16 channelId = iterChip->first;
00557           if ( difList == NULL || difList->find(difId) != difList->end()  ) // No difid filter or difId in difList
00558           {
00559             nbHits += newHit(event, detector, 0, analogValue,channelId , chipId, difId);
00560             nbanalogHit++;
00561           }
00562         }
00563       }
00564     }
00565 
00566     if (delimiter == 0xB4) 
00567     {
00568       display(+1);
00569       FILE_LOG(logDEBUG) << "   frame header B4 found" << endl;
00570 
00571 
00572 
00573       int chipId = -1;
00574       ui16 orderInChipMemory = 0;
00575       for (; ; )  // Read in chip memory for different BCId_HIT. 
00576       {
00577         chipId = getData(1);
00578        // FILE_LOG(logDEBUG) << "8 bits read[" << chipId << "] [0x"  << hex << chipId << "]" << dec << endl;
00579 
00580         if (fileError == EOF) {
00581           finish = true;
00582           FILE_LOG(logINFO) << "    end of file found -- should not" << endl;
00583           break;
00584         }
00585         if (chipId == 0x00) {
00586           // dummy null bytes
00587           continue;
00588         }
00589     else if (chipId == 0xA3) {
00590           display(-1);
00591           FILE_LOG(logDEBUG) << "   frame trailer A3 found" << endl;
00592           break;
00593         }
00594         else if (chipId == 0xA0) {
00595           finish = true;
00596           display(-1);
00597           break;
00598         }
00599         else if (chipId == 0xC3) {
00600           display(-1);
00601           FILE_LOG(logERROR) << "    frame trailer C3 found - error occured during data transfer" << endl;
00602           event.setValidFlag(UNKNOW_NOT_VALID);
00603           break;
00604         }
00605 
00606         // bcId from hardroc chip is counted as Gray code
00607         bcId_Hit = grayToBinary(getData(3));
00608         FILE_LOG(logDEBUG) << dec << "bcId_Hit[" << bcId_Hit << "]" << endl;
00609         // event time in milliseconds
00610         eventTime = readTime + (((bcId_Dif - bcId_Hit) * bcPeriod) / 1000);
00611 
00612         orderInChipMemory++;
00613         // not on first line and bcId OK : get and check data
00614         if (difFound)
00615         {
00616           for (int chNum = 48; chNum >= 0; chNum -= 16)  // read data ( 128) for different channel Id with same BCID_HIT
00617           {
00618             unsigned int data4 = getData(4); // lit 4 bytes => 8 char => 16 canaux
00619             for (int index = 0; index < 16; index++)
00620             {
00621                 // sur les 16 canaux, recupere les donnees canal par canal
00622               int trigger = (data4 >> ((15 - index) * 2)) & 0x03; // 2 bits
00623               // store new event data if any
00624               if (trigger)  // on elimine tous les hits dans la valeur est 0 
00625               {
00626                 if ( difList == NULL || difList->find(difId) != difList->end()  ) // No difid filter or difId in difList
00627                 { 
00628                    if ( analogDataActivate && orderInChipMemory == 1 )
00629                    {
00630                     i16 analogValue = analogData[chipId][index + chNum];
00631                     nbHits += newHit(event, detector, trigger, analogValue, index + chNum, chipId, difId,orderInChipMemory);
00632                    }
00633                    else
00634                    {
00635                     nbHits += newHit(event, detector, trigger, 0, index + chNum, chipId, difId,orderInChipMemory);
00636                    }
00637                 }
00638 
00639                   //digital[index+chNum]=trigger;
00640             //      FILE_LOG(logDEBUG) << "digital chipId[" << chipId << "] channelNum["<< index+chNum <<"]= " << trigger << endl;
00641               }
00642             } // for (index)
00643           } // End digital data. for (chNum)
00644         }
00645       display();
00646       } // for(;;)
00647     }  // end if delimiter = 0xB4
00648   } // for (;;)
00649   display(-1);
00650 
00651  // CREATE EVENT for current Run
00652 
00653   event.setTimeStamp(globalTime + ((bcId_AbsOrg /1000000 * bcPeriod) )  );  // globalTime -> millisecond and bcId_AbsOrg * bcPeriod -> nano second
00654   FILE_LOG(logDEBUG) << "Dif[" << dec << difId << "]  Number of created hit for event  EVENT " << lastEventId << ", " << nbHits << " total hits, within " << nbanalogHit << " analogic hits" << endl;
00655 
00656 
00657 
00658   if (SkippedBcId) {
00659     FILE_LOG(logWARNING) << "    skipped " << SkippedBcId << " data because of bad bcId" << endl;
00660     SkippedBcId = 0;
00661   }
00662 
00663   return(nbHits);
00664 
00665 
00666 }

int MicrorocXDaqReader::getAnalogData ( Event event  ) 

Definition at line 546 of file f12MicrorocXDaqReader.cpp.

Referenced by getNextEvent().

00547 {
00548 return 0;
00549 }

unsigned int MicrorocXDaqReader::getData ( const unsigned int  nBytes  ) 

Definition at line 552 of file f12MicrorocXDaqReader.cpp.

Referenced by getAcqData(), and getNextEvent().

00553 {
00554 unsigned int result = 0;
00555 
00556   fileError = 0;
00557   for (unsigned int byte = 0; byte < nBytes; ++byte) 
00558   {
00559     unsigned int data = *itRawdata;
00560     itRawdata++;
00561     if ( computeCrc ) 
00562     {
00563       crc->compute(data) ;
00564     }
00565     result = (result << 8) + data;
00566   }
00567 
00568 putData(result, nBytes);
00569 
00570 return result;
00571 }

void MicrorocXDaqReader::localReset (  )  [private]

Definition at line 100 of file f12MicrorocXDaqReader.cpp.

00101 {
00102   reset(); // appel MicrorocReader::reset();
00103   slowControlSet = false;
00104   rawdataList.clear();
00105 }


Member Data Documentation

std::map<ui16,std::map<ui16,ui16> > MicrorocXDaqReader::analogData [private]

Definition at line 58 of file MicrorocXDaqReader.hh.

Referenced by getAcqData().

ui16 MicrorocXDaqReader::nbChipPerLine [private]

Definition at line 59 of file MicrorocXDaqReader.hh.

bool MicrorocXDaqReader::analogDataActivate [private]

Definition at line 60 of file MicrorocXDaqReader.hh.

Referenced by getAcqData().

bool MicrorocXDaqReader::analogDataActivatedLine[NBLINE] [private]

Definition at line 61 of file MicrorocXDaqReader.hh.

std::list<unsigned char> MicrorocXDaqReader::rawdataList [private]

Definition at line 62 of file MicrorocXDaqReader.hh.

Referenced by getNextEvent(), and localReset().

std::list<unsigned char>::const_iterator MicrorocXDaqReader::itRawdata [private]

Definition at line 63 of file MicrorocXDaqReader.hh.

Referenced by getData(), and getNextEvent().

std::set<unsigned int>* MicrorocXDaqReader::difList [private]

Definition at line 64 of file MicrorocXDaqReader.hh.

Referenced by getAcqData().

IO::LCReader* MicrorocXDaqReader::lcReader [private]

Definition at line 66 of file MicrorocXDaqReader.hh.

Referenced by getNextEvent(), and ~MicrorocXDaqReader().

bool MicrorocXDaqReader::firstEvent [private]

Definition at line 67 of file MicrorocXDaqReader.hh.

Referenced by getNextEvent().

ui32 MicrorocXDaqReader::debugEventId [private]

Definition at line 68 of file MicrorocXDaqReader.hh.

bool MicrorocXDaqReader::slowControlSet [private]

Definition at line 69 of file MicrorocXDaqReader.hh.

Referenced by getNextEvent(), and localReset().

ui32 MicrorocXDaqReader::hexTemperatureAsu1 [private]

Definition at line 71 of file MicrorocXDaqReader.hh.

Referenced by getAcqData().

ui32 MicrorocXDaqReader::hexTemperatureAsu2 [private]

Definition at line 72 of file MicrorocXDaqReader.hh.

Referenced by getAcqData().

ui16 MicrorocXDaqReader::hexTemperatureDif [private]

Definition at line 73 of file MicrorocXDaqReader.hh.

Referenced by getAcqData().

bool MicrorocXDaqReader::forceAnalog [private]

Definition at line 76 of file MicrorocXDaqReader.hh.

Referenced by getAcqData().


The documentation for this class was generated from the following files:
Generated on Mon Jun 11 16:58:50 2012 for MicromegasFramework by  doxygen 1.4.7