MicrorocOldLabviewReader Class Reference

#include <MicrorocOldLabviewReader.hh>

Inheritance diagram for MicrorocOldLabviewReader:

Inheritance graph
[legend]
Collaboration diagram for MicrorocOldLabviewReader:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 MicrorocOldLabviewReader (Run &aRun, FILE *aFile, ui32 lastEventId)
 ~MicrorocOldLabviewReader ()
int getScData ()
int getNextEvent (Event &eventToFill)
int getAcqData (Event &event, bool tempExist=false)
int getAnalogData (Event &event)

Static Public Member Functions

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

Private Attributes

std::map< ui16, std::map<
ui16, ui16 > > 
analogData
ui16 nbChipPerLine
bool analogDataActivate
bool analogDataActivatedLine [NBLINE]
ui32 hexTemperatureAsu1
ui32 hexTemperatureAsu2
ui16 hexTemperatureDif
bool forceAnalog

Detailed Description

CLASS DATAREADER //

Definition at line 32 of file MicrorocOldLabviewReader.hh.


Constructor & Destructor Documentation

MicrorocOldLabviewReader::MicrorocOldLabviewReader ( Run aRun,
FILE *  aFile,
ui32  lastEventId 
)

Definition at line 37 of file MicrorocOldLabviewReader.cpp.

00037                                                                                            : MicrorocReader(aRun, aFile, lastEventId), nbChipPerLine(0), analogDataActivate(false),  hexTemperatureAsu1(0), hexTemperatureAsu2(0), hexTemperatureDif(0)
00038 {
00039   FILE_LOG(logDEBUG1) << "--MicrorocOldLabviewReader constructor()"<< endl;
00040   FILE_LOG(logDEBUG) << "cwMixrorocLabview ReaderDifReader Constructeur  crc adr[" <<  crc << "]" << endl;
00041   
00042   for ( ui16 line = 0 ; line < NBLINE ; line++)
00043   {
00044     analogDataActivatedLine[line] = false;
00045   } 
00046 
00047   reset();
00048 
00049 }

MicrorocOldLabviewReader::~MicrorocOldLabviewReader (  ) 

Definition at line 52 of file MicrorocOldLabviewReader.cpp.

00053 {
00054   FILE_LOG(logDEBUG1)<< "----MicrorocOldLabviewReader destructor"<< endl;
00055 }


Member Function Documentation

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

Reimplemented from MicrorocReader.

Definition at line 36 of file MicrorocOldLabviewReader.hh.

Referenced by main().

00036 { return LABVIEWOLDMR; };

int MicrorocOldLabviewReader::getScData (  )  [virtual]

Implements MicrorocReader.

Definition at line 59 of file MicrorocOldLabviewReader.cpp.

Referenced by getNextEvent().

00059                                         {
00060   unsigned int data;
00061   display(+1);
00062   FILE_LOG(logDEBUG) << " Slow Control data header B1 found" << endl;
00063 
00064 
00065   int scHRNumber = 24;
00066 
00067   difId=1; // in case of dataFormat = 7 Difid is not in data file
00068         ui16 dataFormat = run.getDataFormat();
00069   if ( dataFormat == 11 || dataFormat == 12 )
00070   {
00071 
00072       nbChipPerLine = 12;  //DEBUG
00073       bool findA1 = false;
00074       difId = getData(1);
00075                   display(+1);
00076       FILE_LOG(logDEBUG) << "--- difId[" << difId << "] config ---" << endl;
00077 
00078                         Dif& dif = run.getDetector().getDifById(difId);
00079       FILE_LOG(logINFO) << "-------- dif Id[0x" << hex << dif.getId() << "]" << endl;
00080                         dif.setDifFirmware(getData(2));
00081                         display(+2);
00082       FILE_LOG(logINFO) << "-------- difFirmware[0x" << hex << dif.getDifFirmware() << "]" << endl;
00083 
00084                         dif.setDifConfig (getData(1));
00085                         display(+1);
00086       FILE_LOG(logINFO) << "-------- difConfig[0x" << hex <<  dif.getDifConfig() << "]" << endl;
00087 
00088                         dif.setAsicType(getData(1));
00089                         display(+1);
00090       FILE_LOG(logINFO) << "-------- asicType[0x" << dif.getAsicType() << "]" << endl;
00091       if ( dif.getAsicType() == 4 ) 
00092       {
00093         FILE_LOG(logINFO) << "------------------ [ Microroc ]" << endl;
00094       }
00095       dif.setConfigured(true);
00096     
00097       if ( dataFormat == 12)
00098       {
00099       // Test next Byte to decode analigic informations
00100         int foo = getData(1);
00101         if ( foo != 0x0 )
00102         {
00103           analogDataActivate = true;
00104           ui16 bitshift = 0x1;
00105           for ( ui16 line = 0 ; line < NBLINE; line++)
00106           {
00107             analogDataActivatedLine[line] = foo & bitshift; 
00108             bitshift = bitshift * 2;
00109             FILE_LOG(logDEBUG) << "line [" << line << "] analog activation["<< analogDataActivatedLine[line] <<"]" << endl; 
00110           }
00111           FILE_LOG(logINFO) << "-------- analog data enable. Mask to enable line [0x"  <<hex << foo <<"]" << endl; 
00112         }
00113         else 
00114         { 
00115           analogDataActivate = false; 
00116           FILE_LOG(logINFO) << "-------- analogData disable" << endl; 
00117         }
00118       }
00119 
00120                         dif.setAsu1Id(getData(1));
00121       FILE_LOG(logINFO) << "-------- ASU 1 Id[0x" << hex << dif.getAsu1Id() << "]" << endl;
00122                         display(+1);
00123 
00124       // Consistency verification beetween geometry base on XML file and data send by Labview
00125       // In XML when a dif contains 2 ASU, we considere the first one a the left one ( close to DIF ) with row = 0 
00126       // se second ASU is on right ( far away from Dif ) with row = 1
00127       // From Labview data, ASU1Id is always on left ( close to the Dif )
00128 
00129       ui16 boardColToCheck = 0;
00130       if ( dif.getAsu1Id() != 0)
00131       {
00132         if ( dif.getBoardByCol(boardColToCheck).getId() !=  dif.getAsu1Id() )
00133         {
00134           FILE_LOG(logINFO) << "Error data say ASU id =  "<<  dif.getAsu1Id() << " for ASU close to DIF ( left side ) while XML say ASU id = " << dif.getBoardByCol(boardColToCheck).getId() << endl;
00135           FILE_LOG(logINFO) << "Please consider modifying XML file" << endl;
00136           exit(-1);
00137         }
00138         boardColToCheck++;
00139       }
00140 
00141 
00142                         dif.setAsu2Id (getData(1));
00143       FILE_LOG(logINFO) << "-------- ASU 2 Id[0x" <<hex << dif.getAsu2Id() << "]" << endl;
00144                         display(+1);
00145       if (  dif.getAsu2Id() != 0)
00146       {
00147         if ( dif.getBoardByCol(boardColToCheck).getId() !=  dif.getAsu2Id() )
00148         {
00149           FILE_LOG(logINFO) << "Error data say ASU id =  "<<  dif.getAsu2Id() << " for ASU far away to DIF ( right side ) while XML say ASU id = " << dif.getBoardByCol(boardColToCheck).getId() << endl;
00150           FILE_LOG(logINFO) << "Please consider modifying XML file" << endl;
00151           exit(-1);
00152         }
00153       }
00154       scHRNumber = getData(1);
00155       FILE_LOG(logINFO) << "-------- Nombre de chip en Slow control[0x" << hex << scHRNumber << "]" << endl;
00156     
00157       // set all chip to byppassed = True.
00158       // then each chip prensent in Slow control will by set to bypassed = False 
00159       dif.setChipByPassed(true);
00160       for ( int nbChip = 0 ; (nbChip < scHRNumber) & findA1 == false   ; nbChip++)
00161       {
00162         const unsigned char *buf = initGetBits(74, false);
00163         vector<int> sc;
00164         for ( ui16 i = 0; i < 74 ; i++)
00165         {
00166           int foo = getBits(8);
00167           sc.push_back(foo);
00168         }
00169         finishGetBits();
00170         MicrorocSCReader scReader(run,sc,difId);
00171         scReader.parseSC(difId);
00172 
00173 
00174           
00175       } // end for nbChip
00176           if ( ! findA1) {
00177               unsigned char *buf = initGetBits(1, false);
00178               if ( !buf)
00179               {
00180                 FILE_LOG(logERROR) << "  malloc error while getting SC buffer" << endl;
00181                 exit ( -1);
00182               }
00183               // Verify A1 Header
00184               int foo = getBits(8);
00185               finishGetBits();
00186 
00187               FILE_LOG(logDEBUG) << "Header[" <<hex <<  foo <<"]" << endl;
00188               if ( foo != 0xa1)
00189               {
00190                   FILE_LOG(logERROR) << "  Header A1 not found" << endl;
00191                   exit (-1);
00192               }
00193               FILE_LOG(logDEBUG1) << "Header A1 found" << endl;
00194               
00195           }
00196     
00197     } //end if format == 11 OR 12
00198     if ( dataFormat == 13  )
00199     {
00200 
00201   FILE_LOG(logDEBUG) << "SC START" << endl;  
00202       difId = getData(1);
00203       display(+1);
00204       FILE_LOG(logDEBUG) << "--- difId[" << difId << "] ---" << endl;
00205       ui16 asicHeader = getData(1);
00206       display(+1);
00207       FILE_LOG(logDEBUG) << "--- asic header[" << asicHeader << "] ---" << endl;
00208       ui16 cyrilbug = getData(2);
00209       ui16 scsize = getData(1);
00210       display(+1);
00211       FILE_LOG(logDEBUG) << "--- sc size 74 or 109[" << dec << scsize << "] ---" << endl;
00212       scsize=74;
00213       const unsigned char *buf = initGetBits(74, false);
00214       vector<int> sc;
00215       for ( ui16 i = 0 ; i<scsize ; i++ )
00216       {
00217         ui16 scAsic = getBits(8) ;
00218         sc.push_back(scAsic);
00219       }
00220       finishGetBits();
00221       MicrorocSCReader scReader(run,sc,difId);
00222       scReader.parseSC(difId);
00223 
00224     
00225       ui16 foo2 = 0xff;
00226       while ( foo2 != 0xb0  && foo2 !=0 &&  fileError != EOF) 
00227       {
00228         ui16 foo = getData(1);
00229         while ( foo != 0xa1 )
00230         {
00231           foo = getData(1);
00232           FILE_LOG(logDEBUG) << "-- Wait foo 0xa1[" << hex << foo << "]" << endl;
00233         }
00234         foo2 = getData(1);
00235         FILE_LOG(logDEBUG) << "-- Wait foo 0xb0[" << hex << foo << "]" << endl;
00236 
00237      }
00238      FILE_LOG(logDEBUG) << "SC END" << endl;  
00239     }
00240 
00241     return(1);
00242 } // MicrorocOldLabviewReader.getScData

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

Implements MicrorocReader.

Definition at line 1012 of file MicrorocOldLabviewReader.cpp.

01012                                                        {
01013   // Start data reconstruction
01014   Level(0);
01015 
01016         ui16 dataFormat = run.getDataFormat();
01017 
01018   if (dataFormat == 0) {
01019     // first read of the file
01020     bcIdDifAbsOrgMap.clear();
01021     // read file header
01022     dataFormat = getData(1);
01023     FILE_LOG(logINFO) << " labview data format[" << hex << dataFormat << "] "<< endl;
01024     if ( dataFormat == 0x10  ) { dataFormat = 0xa; }
01025                 run.setDataFormat(dataFormat);
01026 
01027 
01028     if (fileError == EOF) {
01029       FILE_LOG(logERROR) << "parsing file[" << inputFile << "]  - error " << errno << ":" << strerror(errno) << endl;
01030       reset();
01031       return(LAST_FILE_EVENT);
01032     }
01033     display(+1);
01034     FILE_LOG(logINFO) << "  Microroc LABVIEW DATA FORMAT  : " << dataFormat << endl;
01035 
01036     if (! ( dataFormat == 11  ||  dataFormat == 12 ||  dataFormat == 13)  ){
01037       // unknown format
01038       FILE_LOG(logERROR) << " Microroc LABVIEW data format  " << dataFormat << " is not implemented" << endl;
01039       reset();
01040       return(LAST_FILE_EVENT);
01041     }
01042 
01043         if ( dataFormat == 11 ||  dataFormat == 12 )
01044         {
01045                 run.setDaqSoftware( getData(1));
01046                 display(+1);
01047                 FILE_LOG(logINFO) << "  DAQ software version  : " << run.getDaqSoftware() << endl;
01048 
01049                 run.setCccFirmware(getData(1));
01050                 display(+1);
01051     FILE_LOG(logINFO) << "  ccc firware  : " << run.getCccFirmware() << endl;
01052 
01053     globalTime = getData(4)    ; // labview time is second since 1 janv 1970 and globalTime milli second
01054     FILE_LOG(logDEBUG) << "globalTime in second:["  << hex << globalTime << "]" <<  endl;
01055     globalTime *= 1000;
01056     FILE_LOG(logDEBUG1) << "globalTime in millisecond:[" << globalTime << "]" <<  endl;
01057         }
01058 
01059         if ( dataFormat == 13 )
01060   {
01061 
01062                 run.setDaqSoftware(getData(2) );
01063                 display(+1);
01064                 FILE_LOG(logINFO) << hex << "  DAQ software version  : " << run.getDaqSoftware() <<endl;
01065 
01066    run.setSDccFirmware(getData(2));
01067    display(+1);
01068    FILE_LOG(logINFO) << hex << "  SDcc firware  : 0x" << run.getSDccFirmware() << endl;
01069 
01070    run.setDifFirmware(getData(2));
01071    display(+1);
01072    FILE_LOG(logINFO) << hex << "  Dif firware  : 0x" << run.getDifFirmware() << endl;
01073   
01074     globalTime = getData(4)    ; // labview time is second since 1 janv 1970 and globalTime milli second
01075     FILE_LOG(logDEBUG) << "globalTime in second:[0x"  << hex << globalTime << "] decimal[" << dec << globalTime << "]" <<   endl;
01076     globalTime *= 1000;
01077     FILE_LOG(logDEBUG) << "globalTime in millisecond:[" << globalTime << "]" <<  endl;
01078 
01079     globalTimeMilli = getData(4)    ; // labview time in millisecond
01080     FILE_LOG(logDEBUG) << "Plus globalTimeMilli in millisecond:[0x"  << hex << globalTimeMilli << "] decimal [" << dec <<  globalTimeMilli << "]" <<  endl;
01081   }
01082 
01083 
01084     if (fileError == EOF) {
01085       FILE_LOG(logDEBUG) << "  END OF DATA FILE" << endl;
01086       reset();
01087       return(LAST_FILE_EVENT);
01088     }
01089     //FILE_LOG(logDEBUG) << run.getDetector() << endl;
01090     display(-1);
01091     return NEW_CONFIG;
01092   }
01093 
01094 
01095   // loops until a non-empty event has been found
01096   //for (unsigned int nbHits = 0; !nbHits; ) {
01097         bool eventFound = false;
01098         while (! eventFound)
01099                 {
01100         // look for a global data header and process corresponding data
01101         unsigned int globalHeader = getData(1);
01102         if (fileError == EOF) {
01103            FILE_LOG(logDEBUG) << "  END OF DATA FILE" << endl;
01104           reset();
01105           return(LAST_FILE_EVENT);
01106         }
01107         FILE_LOG(logDEBUG) << "globalHeader:["<< hex  << globalHeader << "]" << endl;
01108         if (globalHeader == 0xB1) {
01109           // slow control data
01110           getScData();
01111         }
01112         else if (globalHeader == 0xC0) {
01113           // acquisition data
01114           getAnalogData(event);
01115         }
01116         else if (globalHeader == 0xB0) {
01117           // acquisition data
01118           getAcqData(event);
01119                       eventFound = true;
01120         }
01121         else if (globalHeader == 0xBB) {
01122           // acquisition data
01123           getAcqData(event,true);
01124                       eventFound = true;
01125         }
01126         else {
01127           display();
01128          FILE_LOG(logERROR) << "  parsing file error. global header error : " << hex << globalHeader << dec << endl;
01129         }
01130         }
01131   //} // for (nbHits)
01132 
01133   return EVENT_CORRECT;
01134 }

int MicrorocOldLabviewReader::getAcqData ( Event event,
bool  tempExist = false 
)

Definition at line 331 of file MicrorocOldLabviewReader.cpp.

Referenced by getNextEvent().

00331                                                                            {
00332 
00333   ui16 dataFormat = run.getDataFormat();
00334   if ( dataFormat == 11 || dataFormat == 12 )
00335   {
00336     ui32 nbanalogHit = 0;
00337     unsigned int nbHits = 0;
00338 
00339     display(+1);
00340     FILE_LOG(logDEBUG) << " global header B0 found" << endl;
00341 
00342 
00343     this->setComputeCrcFlag(true);
00344     //FILE_LOG(logDEBUG) << "MicrorocOldLabviewReader crc adr[" <<  crc << "]" << endl;
00345      FILE_LOG(logDEBUG) << "crc->compute(0xB0)[ "<< crc <<"]"   << endl;
00346 
00347     crc->compute(0xB0); 
00348     
00349     
00350 
00351     // reset the data for the block
00352   //  bcId_AbsOrg = -1;
00353     bcId_Abs = 0; // max. 48 bits
00354     bcId_Dif = 0;
00355     // the following data is repeated one time for each Dif which has sent data
00356     difId = getData(1); 
00357     
00358     difTriggerCounter = getData(4);
00359     usbBusyTrigger = getData(4);  // trigger counter version >= 4
00360     globalTriggerCounter = getData(4);
00361     ui64 bcIdHigh = getData(2);
00362     ui64 bcIdLow = getData(4);
00363     bcId_Abs = (bcIdHigh << 32) + bcIdLow;
00364     FILE_LOG(logDEBUG1) << "bcId_Abs[" <<bcId_Abs <<  endl;
00365     bcId_Dif = getData(3);
00366 
00367     bcId_AbsOrg =  getbcIdAbsOrg(difId, bcId_Abs);
00368    
00369     ui16 lineInfo =  getData(1);
00370     ui16 nbLine   = (lineInfo & 0xF0 ) >> 4;
00371     ui16 usedLine = lineInfo & 0x0F; //bit 3 (4eme ligne,)  bit 2 (3eme ligne)  bit 1 (2eme ligne)  bit 0 (1ere ligne)
00372     
00373     
00374     display();
00375 
00376     // the bcTime in milliseconds
00377     i64 bcTime = ((bcId_Abs - bcId_AbsOrg) * bcPeriod) / 1000;
00378     // the reading time in milliseconds
00379     i64 readTime = globalTime + bcTime;
00380 
00381     FILE_LOG(logDEBUG)   << "  START EVENT ------------- time " << readTime << " ms" << endl;
00382     FILE_LOG(logDEBUG)   << "    bc time               " << bcTime << " ms" << endl;
00383     FILE_LOG(logDEBUG)   << "    DIF Id                0x" << hex << (int)difId << dec << endl;
00384     FILE_LOG(logDEBUG)   << "    DIF trigger counter   " << difTriggerCounter << endl;
00385     FILE_LOG(logDEBUG)   << "    USB Busy trigger counter   " << usbBusyTrigger << endl;
00386     FILE_LOG(logDEBUG)   << "    total trigger counter " << globalTriggerCounter << endl;
00387     FILE_LOG(logDEBUG)   << "    absolute bcId         " << bcId_Abs - bcId_AbsOrg << endl;
00388     FILE_LOG(logDEBUG)   << "    nb line          " << dec <<nbLine << endl;
00389     FILE_LOG(logDEBUG)   << "    used line        " << hex << usedLine << dec <<endl;
00390     event.setDifTriggerCounter(difTriggerCounter);
00391     event.setGlobalTriggerCounter(globalTriggerCounter);
00392 
00393 
00394     Detector &detector = run.getDetector();
00395 
00396     if ( analogDataActivate )//&& orderInChipMemory == 0 )
00397     {
00398       for ( map<ui16,map<ui16,ui16> >::iterator iterAnal = analogData.begin(); iterAnal!= analogData.end(); iterAnal++)
00399       {
00400          map<ui16,ui16>& byChip = iterAnal->second;
00401          ui16 chipId = iterAnal->first;
00402         // When analog is anable, all channel of all chip enable for analogic respond
00403         for ( std::map<ui16,ui16>::iterator iterChip = byChip.begin(); iterChip != byChip.end();iterChip++)
00404         {
00405           ui16 analogValue =  iterChip->second;
00406           ui16 channelId = iterChip->first;
00407 
00408           nbHits += newHit(event, detector, 0, analogValue,channelId , chipId, difId);
00409           nbanalogHit++;
00410         }
00411       }
00412     }
00413     // end of global header
00414 
00415     bool difFound = false;
00416     { const ChamberMap_t &chambers = detector.getChambers();
00417       for (ChamberMap_t::const_iterator it = chambers.begin(); it != chambers.end(); ++it) {
00418         try {
00419           Chamber& chamber = *(it->second);
00420           const BoardMap_t& boards = chamber.getBoardsByDifId(difId);
00421         }
00422         catch (...) {
00423           // any error case - try next chamber
00424           continue;
00425         }
00426 
00427         // the DIF has been found in a chamber. Process all data and continue
00428         difFound = true;
00429         break;
00430       } // for
00431       if (!difFound) {
00432         FILE_LOG(logERROR) << "    No dif found with Id 0x" << hex << difId << dec << endl;
00433       }
00434     }
00435 
00436     for (bool finish = false; !finish; ) {
00437       int delimiter = 0;
00438 
00439       display();
00440       for (; delimiter != 0xA0 && delimiter != 0xB4; ) {
00441         // seek for first data frame header (0xB4)
00442         delimiter = getData(1);
00443         if (fileError == EOF) {
00444           delimiter = 0;
00445           break;
00446         }
00447         if (delimiter == 0xA3)
00448           FILE_LOG(logERROR) << "    frame trailer A3 found -- should not" << endl;
00449       }
00450       if (delimiter == 0x00) {
00451         FILE_LOG(logERROR) << "  end of file -- should not" << endl;
00452         break;
00453       }
00454       if (delimiter == 0xA0) {
00455          FILE_LOG(logDEBUG) << "    frame trailer A0 found" << endl;
00456         this->setComputeCrcFlag(false);
00457         unsigned short CRC_check = getData(2);
00458         FILE_LOG(logDEBUG) << hex << " Compute CRC[" << crc->getCrc() << "]" <<  endl;
00459         FILE_LOG(logDEBUG) << hex << " Received CRC[" << CRC_check << "]" <<  endl;
00460         if ( CRC_check != crc->getCrc() )
00461         {
00462           FILE_LOG(logERROR) << endl << " CRC Error for event id " <<  lastEventId << endl;
00463           event.setCrcIsCorrect(false);
00464   //        exit(-1);
00465         }
00466         else
00467         {
00468           event.setCrcIsCorrect(true);
00469         }
00470 
00471 
00472         display(-1);
00473         FILE_LOG(logDEBUG) << " global trailer A0 found" << endl;
00474         break;
00475       }
00476       display(+1);
00477       FILE_LOG(logDEBUG) << "   frame header B4 found" << endl;
00478 
00479 
00480       int chipId = -1;
00481       ui16 orderInChipMemory = 0;
00482       for (; ; )  // Read in chip memory for different BCId_HIT. 
00483       {
00484         chipId = getData(1);
00485         FILE_LOG(logDEBUG) << "8 bits read[" << chipId << "] [0x"  << hex << chipId << "]" << dec << endl;
00486         
00487         if (fileError == EOF) {
00488           finish = true;
00489           FILE_LOG(logINFO) << "    end of file found -- should not" << endl;
00490           break;
00491         }
00492         if (chipId == 0x00) {
00493           // dummy null bytes
00494           continue;
00495         }
00496         else if (chipId == 0xA3) {
00497           display(-1);
00498           FILE_LOG(logDEBUG) << "   frame trailer A3 found" << endl;
00499           break;
00500         }
00501         else if (chipId == 0xA0) {
00502           finish = true;
00503           display(-1);
00504           FILE_LOG(logERROR) << "    global trailer A0 found -- should not" << endl;
00505           int CRC_check = getData(1);
00506           break;
00507         }
00508         else if (chipId == 0xC3) {
00509           display(-1);
00510           FILE_LOG(logERROR) << "    frame trailer C3 found - error occured during data transfer" << endl;
00511           break;
00512         }
00513 
00514         // bcId from hardroc chip is counted as Gray code
00515         bcId_Hit = grayToBinary(getData(3));
00516         // event time in milliseconds
00517         eventTime = readTime + (((bcId_Dif - bcId_Hit) * bcPeriod) / 1000);
00518 
00519         orderInChipMemory++;
00520         // not on first line and bcId OK : get and check data
00521         if (difFound) 
00522         {
00523           FILE_LOG(logDEBUG) << "      chip Id               0x" << hex << (int)chipId << dec << endl;
00524           FILE_LOG(logDEBUG) << "      bcId Microroc          " << hex << (int)bcId_Hit << endl;
00525           FILE_LOG(logDEBUG) << "      event time            " << eventTime << endl;
00526 
00527           for (int chNum = 48; chNum >= 0; chNum -= 16)  // read data ( 128) for different channel Id with same BCID_HIT
00528           {
00529             unsigned int data4 = getData(4); // lit 4 bytes => 8 char => 16 canaux
00530             for (int index = 0; index < 16; index++) 
00531             {
00532                 // sur les 16 canaux, recupere les donnees canal par canal
00533               int trigger = (data4 >> ((15 - index) * 2)) & 0x03; // 2 bits
00534               // store new event data if any
00535               if (trigger)  // on elimine tous les hits dans la valeur est 0 
00536               {
00537   //        cout << " analogDataActivate[" <<analogDataActivate << "]  orderInChipMemory]" << orderInChipMemory <<  "]"  << endl;
00538                    if ( analogDataActivate && orderInChipMemory == 1 )
00539                    {
00540    //                 cout << " New Hit with ana;log value" <<endl;
00541                     i16 analogValue = analogData[chipId][index + chNum];
00542                     nbHits += newHit(event, detector, trigger, analogValue, index + chNum, chipId, difId,orderInChipMemory);
00543                    }
00544                    else
00545                    {
00546                     nbHits += newHit(event, detector, trigger, 0, index + chNum, chipId, difId,orderInChipMemory);
00547                    }
00548                 
00549                   //digital[index+chNum]=trigger;
00550                   FILE_LOG(logDEBUG) << "digital chipId[" << chipId << "] channelNum["<< index+chNum <<"]= " << trigger << endl;
00551               }
00552             } // for (index)
00553           } // End digital data. for (chNum)
00554         }
00555       display();
00556       } // for(;;)
00557 
00558     } // for (;;)
00559     display(-1);
00560 
00561    // CREATE EVENT for current Run
00562         
00563   // if ( nbHits > 0 )
00564   // {
00565     event.setTimeStamp(globalTime + ((bcId_AbsOrg /1000000 * bcPeriod) )  );  // globalTime -> millisecond and bcId_AbsOrg * bcPeriod -> nano second
00566     event.setId(++lastEventId);
00567     FILE_LOG(logDEBUG) << "  STORE EVENT " << lastEventId << ", " << nbHits << " hits" << endl;
00568   // }
00569   // else
00570   // {
00571   //  FILE_LOG(logDEBUG) << "  EMPTY EVENT " << lastEventId << ", " << nbHits << " hits" << endl;
00572   // }
00573 
00574 
00575     if (SkippedBcId) {
00576       FILE_LOG(logWARNING) << "    skipped " << SkippedBcId << " data because of bad bcId" << endl;
00577       SkippedBcId = 0;
00578     }
00579 
00580     return(nbHits);
00581   }
00582   else if ( dataFormat == 13)
00583   {
00584    
00585 
00586     ui32 nbanalogHit = 0;
00587     unsigned int nbHits = 0;
00588 
00589     display(+1);
00590 
00591 
00592     this->setComputeCrcFlag(true);
00593     //FILE_LOG(logDEBUG) << "MicrorocOldLabviewReader crc adr[" <<  crc << "]" << endl;
00594 
00595     if ( temperatureFill )
00596     {
00597       FILE_LOG(logDEBUG) << " global header BB found" << endl;
00598       FILE_LOG(logDEBUG) << "crc->compute(0xBB)[ "<< crc <<"]"   << endl;
00599       crc->compute(0xBB);
00600     }
00601     else 
00602     {
00603       FILE_LOG(logDEBUG) << " global header B0 found" << endl;
00604        FILE_LOG(logDEBUG) << "crc->compute(0xB0)[ "<< crc <<"]"   << endl;
00605       crc->compute(0xB0);
00606     }
00607 
00608 
00609 
00610     // reset the data for the block
00611     //  bcId_AbsOrg = -1;
00612     bcId_Abs = 0; // max. 48 bits
00613     bcId_Dif = 0;
00614     // the following data is repeated one time for each Dif which has sent data
00615     difId = getData(1);
00616 
00617     difTriggerCounter = getData(4);
00618     informationCounter = getData(4);  // trigger counter version >= 4
00619     globalTriggerCounter = getData(4);
00620 
00621     ui64 bcIdHigh = getData(2);
00622     ui64 bcIdLow = getData(4);
00623     bcId_Abs = (bcIdHigh << 32) + bcIdLow;
00624     //FILE_LOG(logDEBUG) << "bcId_Abs[" << hex << bcId_Abs <<  endl;
00625 
00626     bcId_Dif = getData(3);
00627 
00628     bcId_AbsOrg =  getbcIdAbsOrg(difId, bcId_Abs);
00629     display();
00630 
00631     ui16 lineInfo =  getData(1);
00632     FILE_LOG(logDEBUG)   << " lineInfo[0x" <<hex << lineInfo << "]"  << endl;
00633     ui16 nbLine   = (lineInfo & 0xF0 ) >> 4;
00634     FILE_LOG(logDEBUG)   << " nbline[0x" <<hex << nbLine << "]"  << endl;
00635     ui16 usedLine = lineInfo & 0x0F; //bit 3 (4eme ligne,)  bit 2 (3eme ligne)  bit 1 (2eme ligne)  bit 0 (1ere ligne)
00636     FILE_LOG(logDEBUG)   << " usedLine[0x" <<hex << usedLine << "]"  << endl;
00637     display();
00638 
00639 
00640     if ( temperatureFill )
00641     {
00642       hexTemperatureAsu1 = getData(4);
00643       hexTemperatureAsu2 = getData(4);
00644       hexTemperatureDif = getData(1) & 0xFF;
00645 
00646       
00647   /*
00648     Pour les temperature des ASU
00649   1) j'enleve les 16 bits de poids fort (bit31 a bit16). Le bit 15 signifie alors le bit de signe
00650       C'est a dire qu'il faut que tu mette(bit15 à bit0) dans un integer signé à 16 bits.
00651 
00652   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)
00653 
00654   3) il faut diviser le chiffre restant par 16 pour avoir le résultat en degré Celsius.
00655   Cyril.
00656   */
00657       i16 hex16tempAsu1 = hexTemperatureAsu1 & 0xFFFF; 
00658       float tempAsu1 = (float) ((hex16tempAsu1 / 16 ) / 8 );
00659 
00660       i16 hex16tempAsu2 = hexTemperatureAsu2 & 0xFFFF; 
00661       float tempAsu2 = (float) ((hex16tempAsu2 / 16 ) / 8 );
00662 
00663   /* 
00664   Pour la temperature de la Dif
00665   Vlsb est une constante = 20
00666   (ca veut dire qu'un lsb de l'adc de la DIF vaut 20mV)
00667 
00668   Nadc = les 8 bits que tu recois
00669 
00670   Temperature = la conversion en degré Celsius
00671   ================================================
00672 
00673   float V_adc ;
00674   float  V_lm20 ;
00675 
00676   conversion ADC 
00677   V_adc = ( Nadc * Vlsb ) ;
00678 
00679   ampli gain 33K/10K avec point milieu à 1,5V 
00680   V_lm20 = ( (6450 - V_adc) / 3.3 ) ;
00681 
00682   calcul du premier ordre du lm20 pour T entre -30°C et 100°C 
00683   Temperature = (  (V_lm20 - 1860.5) / (-11.77)  ) ;
00684   */
00685       float Vlsb = 20.0;
00686       float V_adc = hexTemperatureDif * Vlsb;
00687       float V_lm20 = ( (6450. - V_adc) / 3.3 ) ;
00688       float tempDif = (V_lm20 - 1860.5) / (-11.77);
00689 
00690   /*
00691       if ( tempDif != 0. )
00692       {
00693         cout << "hexTemperatureDif [0x" << hex << hexTemperatureDif << "]"  << endl;
00694         cout << "Vlsb [" <<  dec <<Vlsb << "]"  << endl;
00695         cout << "V_adc [" <<  dec <<V_adc << "]"  << endl;
00696         cout << "V_lm20 [" <<  dec <<V_lm20 << "]"  << endl;
00697         cout << "tempDif [" <<  dec <<tempDif << "]"  << endl;
00698       }
00699   */
00700       
00701       event.setTemperature(difId, tempAsu1,    tempAsu2 , tempDif);
00702       
00703     }
00704 
00705    // the bcTime in milliseconds
00706     i64 bcTime = ((bcId_Abs - bcId_AbsOrg) * bcPeriod) / 1000;
00707     // the reading time in milliseconds
00708     i64 readTime = globalTime + bcTime;
00709 
00710     FILE_LOG(logDEBUG)   << "  START EVENT ------------- time " << readTime << " ms" << endl;
00711     FILE_LOG(logDEBUG)   << "    bc time               " << bcTime << " ms" << endl;
00712     FILE_LOG(logDEBUG)   << "    DIF Id                0x" << hex << (int)difId << dec << endl;
00713     FILE_LOG(logDEBUG)   << "    DIF trigger counter   " << difTriggerCounter << endl;
00714     FILE_LOG(logDEBUG)   << "    Information counter   " << informationCounter << endl;
00715     FILE_LOG(logDEBUG)   << "    total trigger counter " << globalTriggerCounter << endl;
00716     FILE_LOG(logDEBUG)   << "    absolute bcId         " << bcId_Abs - bcId_AbsOrg << endl;
00717     FILE_LOG(logDEBUG)   << "    nb line          " << dec <<nbLine << endl;
00718     FILE_LOG(logDEBUG)   << "    used line        " << hex << usedLine << dec <<endl;
00719     event.setDifTriggerCounter(difTriggerCounter);
00720     event.setGlobalTriggerCounter(globalTriggerCounter);
00721 
00722 
00723     Detector &detector = run.getDetector();
00724 
00725     // end of global header
00726 
00727    bool difFound = false;
00728     { const ChamberMap_t &chambers = detector.getChambers();
00729       for (ChamberMap_t::const_iterator it = chambers.begin(); it != chambers.end(); ++it) {
00730         try {
00731           Chamber& chamber = *(it->second);
00732           const BoardMap_t& boards = chamber.getBoardsByDifId(difId);
00733         }
00734         catch (...) {
00735           // any error case - try next chamber
00736           continue;
00737         }
00738 
00739         // the DIF has been found in a chamber. Process all data and continue
00740         difFound = true;
00741         break;
00742       } // for
00743       if (detector.getMonitoringId() == difId)
00744       {
00745          difFound = true;
00746       }
00747       if (!difFound) {
00748         FILE_LOG(logERROR) << "    No dif found with Id 0x" << hex << difId << ", " << dec << difId << "                                     " <<endl;
00749         event.setValidFlag(BAD_DIF_ID,false);
00750 
00751       }
00752     }
00753 
00754     for (bool finish = false; !finish; ) {
00755       int delimiter = 0;
00756 
00757       display();
00758       for (; delimiter != 0xA0 && delimiter != 0xB4 && delimiter != 0xC4; ) {
00759         // seek for first data frame header (0xB4)
00760         delimiter = getData(1);
00761         if (fileError == EOF) {
00762           delimiter = 0;
00763           break;
00764         }
00765         if (delimiter == 0xA3)
00766         {
00767           FILE_LOG(logERROR) << "    frame trailer A3 found -- should not" << endl;
00768           event.setValidFlag(FRAME_HEADER_ERROR,false);
00769         }
00770       }
00771       if (delimiter == 0x00) {
00772         FILE_LOG(logERROR) << "  end of file -- should not" << endl;
00773         event.setValidFlag(END_OF_FILE_ERROR,false);
00774         break;
00775       }
00776       if (delimiter == 0xA0) 
00777       {
00778         FILE_LOG(logDEBUG) << "    frame trailer A0 found" << endl;
00779         this->setComputeCrcFlag(false);
00780         unsigned short CRC_check = getData(2);
00781         FILE_LOG(logDEBUG) << hex << " Compute CRC[" << crc->getCrc() << "]" <<  endl;
00782         FILE_LOG(logDEBUG) << hex << " Received CRC[" << CRC_check << "]" <<  endl;
00783         if ( CRC_check != crc->getCrc() )
00784         {
00785           FILE_LOG(logERROR)  << " CRC Error for event id " <<  lastEventId 
00786                               <<  " Compute CRC[" << crc->getCrc() 
00787                               << "] Received CRC[" << CRC_check << "]" <<  endl ;
00788           event.setCrcIsCorrect(false);
00789           event.setValidFlag(CRC_ERROR,false);
00790         }
00791         display(-1);
00792         FILE_LOG(logDEBUG) << " global trailer A0 found" << endl;
00793         break;
00794       }
00795       if (delimiter == 0xC4) 
00796       {
00797         //computeCrc = false;
00798         Dif& dif = run.getDetector().getDifById(difId);
00799         analogDataActivate = true;
00800         ui16 lineNum = 1;
00801         ui16 nbChipByBoard = dif.getBoards().begin()->second->getNbColumns();
00802         ui16 nbBoard =  dif.getBoards().size();
00803         FILE_LOG(logDEBUG) << "nbBoard[" << nbBoard << "]" <<endl;
00804         FILE_LOG(logDEBUG) << "nbChipByBoard[" << nbChipByBoard << "]" <<endl;
00805 
00806         for ( ui16 iLine = 0 ; iLine < nbLine ; iLine++)
00807         {
00808           if ( usedLine & lineNum ) // LINE 1
00809           {
00810             ui16 nbChips = getData(1);
00811             FILE_LOG(logDEBUG)  << endl << " Line " << lineNum << " nb Chip[" << dec <<  nbChips << "]"  << endl;
00812 
00813             for ( i32 col = nbBoard * nbChipByBoard -1  ; col >= 0; col--)
00814             {
00815               ui16 board = col/nbChipByBoard;
00816               FILE_LOG(logDEBUG)<< dec << "board [" << board << "] line[" << lineNum-1 << "] col[" <<  col << "]" << endl; 
00817               Chip& chip = dif.getChipByRowCol(board, lineNum-1,col % 6);   // board / row /column
00818               if( chip.getBypassed() == false )
00819               {
00820 
00821                 FILE_LOG(logDEBUG)<< dec << "chip Id[" << chip.getId() << "]" << endl;
00822                 map<ui16,ui16> channelsValues;
00823                 for ( ui16 iChannel = 0 ; iChannel < 64 ; iChannel++)
00824                 {
00825                   ui16 foo = getData(2);
00826                   channelsValues[iChannel] = foo; 
00827                   FILE_LOG(logDEBUG) << "difId["<< dif.getId() << "] ,chipId["<< chip.getId() <<"] analogData line["<< line <<
00828                                         "], col number["<< col << "] , channel[" << iChannel << "= " << hex <<foo << "]" << dec << endl;
00829                 } // end for iChannel
00830                 this->analogData[chip.getId()] = channelsValues;
00831               }
00832             } // end for iChip
00833           } // end if usedLine
00834           lineNum++;
00835         } // end for iLine
00836        //computeCrc = true;
00837       }
00838       if ( forceAnalog )
00839       {
00840         for ( map<ui16,map<ui16,ui16> >::iterator iterAnal = analogData.begin(); iterAnal!= analogData.end(); iterAnal++)
00841         {
00842           map<ui16,ui16>& byChip = iterAnal->second;
00843           ui16 chipId = iterAnal->first;
00844           // When analog is anable, all channel of all chip enable for analogic respond
00845           for ( std::map<ui16,ui16>::iterator iterChip = byChip.begin(); iterChip != byChip.end();iterChip++)
00846           {
00847             ui16 analogValue =  iterChip->second;
00848             ui16 channelId = iterChip->first;
00849             //if ( difList == NULL || difList->find(difId) != difList->end()  ) // No difid filter or difId in difList
00850             {
00851               nbHits += newHit(event, detector, 0, analogValue,channelId , chipId, difId);
00852               nbanalogHit++;
00853             }
00854           }
00855         }
00856       }
00857 
00858       if (delimiter == 0xB4) 
00859       {
00860         display(+1);
00861         FILE_LOG(logDEBUG) << "   frame header B4 found" << endl;
00862 
00863 
00864 
00865         int chipId = -1;
00866         ui16 orderInChipMemory = 0;
00867         for (; ; )  // Read in chip memory for different BCId_HIT. 
00868         {
00869           chipId = getData(1);
00870 
00871          // FILE_LOG(logDEBUG) << "8 bits read[" << chipId << "] [0x"  << hex << chipId << "]" << dec << endl;
00872 
00873           if (fileError == EOF) {
00874             finish = true;
00875             FILE_LOG(logINFO) << "    end of file found -- should not" << endl;
00876             break;
00877           }
00878           if (chipId == 0x00) {
00879             // dummy null bytes
00880             continue;
00881           }
00882           else if (chipId == 0xA3) {
00883             display(-1);
00884             FILE_LOG(logDEBUG) << "   frame trailer A3 found" << endl;
00885             break;
00886           }
00887           else if (chipId == 0xA0) {
00888             finish = true;
00889             display(-1);
00890             break;
00891           }
00892           else if (chipId == 0xC3) {
00893             display(-1);
00894             FILE_LOG(logERROR) << "    frame trailer C3 found - error occured during data transfer" << endl;
00895             event.setValidFlag(TRAILER_C3_FOUND,false);
00896             break;
00897           }
00898 
00899             bool supressionDeDonnee = 0;
00900             if ( supressionDeDonnee == 1 )
00901             {
00902               // Suppression de la combinaison "supressValue"
00903               ui16 supressValue = (chipId & 0xc0) >> 6;   // 2 bits de poinds fort
00904               FILE_LOG(logINFO) << "supressValue[" << hex << supressValue << "]" << endl;
00905 
00906               // Get chip Id
00907               chipId = chipId & 0x3F;         // 6 bits de poids faible
00908               FILE_LOG(logINFO) << "chip Id apres avoir enleve supressValue[" <<  hex <<chipId << "]" << endl;
00909   
00910               //get bcId_hit
00911               bcId_Hit = grayToBinary(getData(3));
00912               FILE_LOG(logDEBUG) << dec << "bcId_Hit[" << bcId_Hit << "]" << endl;
00913 
00914               ui16 dataSup = getData(1);
00915               display(1);
00916               FILE_LOG(logINFO) << "wait 1 for 0xA3 -> [" << hex << dataSup << "]" << endl;
00917               while ( dataSup != 0xa3 )
00918               {
00919                 ui16 voie = ( dataSup & 0xfc ) >> 6; // 6 bits de poids fort
00920                 ui16 seuil = dataSup & 0x3; //  2 bits de poids faible
00921                 FILE_LOG(logINFO) << "voie[" << hex << voie << "], seuil[" << seuil << "]" << endl;  
00922                 dataSup = getData(1);
00923                 display(1);
00924                 FILE_LOG(logINFO) << "      wait 2 for 0xA3 -> [" << hex << dataSup << "]" << endl;
00925               }
00926             }
00927 
00928           // bcId from hardroc chip is counted as Gray code
00929           bcId_Hit = grayToBinary(getData(3));
00930           FILE_LOG(logDEBUG) << dec << "bcId_Hit[" << bcId_Hit << "]" << endl;
00931           // event time in milliseconds
00932           eventTime = readTime + (((bcId_Dif - bcId_Hit) * bcPeriod) / 1000);
00933 
00934           orderInChipMemory++;
00935           // not on first line and bcId OK : get and check data
00936           if (difFound)
00937           {
00938             // on lit 4 * 32 bits (soit 4 octets soit 16 channels) pour les 64 channels du chip (2 bits par channel)
00939             for (int chNum = 48; chNum >= 0; chNum -= 16)  // read data ( 128) for different channel Id with same BCID_HIT
00940             {
00941               unsigned int data4 = getData(4); // lit 4 bytes => 8 char => 16 canaux
00942               if ( data4 == 0xffffffff )
00943               {
00944                 event.setValidFlag(ONLY_FFFF);
00945                 FILE_LOG(logDEBUG) << "event.setValidFlag(ONLY_FFFF)" << endl;
00946               }
00947               else if  ( data4 == 0xaaaaaaaa )
00948               {
00949                 event.setValidFlag(ONLY_AAAA);
00950                 FILE_LOG(logDEBUG) << "event.setValidFlag(ONLY_AAAA)" << endl;
00951               }
00952               else if  ( data4 == 0x55555555 )
00953               {
00954                 event.setValidFlag(ONLY_5555);
00955                 FILE_LOG(logDEBUG) << "event.setValidFlag(ONLY_5555)" << endl;
00956               }
00957               for (int index = 0; index < 16; index++)
00958               {
00959                 // sur les 16 canaux, recupere les donnees canal par canal
00960                 int trigger = (data4 >> ((15 - index) * 2)) & 0x03; // 2 bits
00961                 FILE_LOG(logDEBUG) << "trigger[" << trigger << "]"  << endl;
00962                 // store new event data if any
00963                 if (trigger)  // on elimine tous les hits dans la valeur est 0 
00964                 {
00965                   FILE_LOG(logDEBUG) << "difId[" << difId << "]"  << endl;
00966                   //if ( difList == NULL || difList->find(difId) != difList->end()  ) // No difid filter or difId in difList
00967                   { 
00968                      if ( analogDataActivate && orderInChipMemory == 1 )
00969                      {
00970                       i16 analogValue = analogData[chipId][index + chNum];
00971                       nbHits += newHit(event, detector, trigger, analogValue, index + chNum, chipId, difId,orderInChipMemory);
00972                      }
00973                      else
00974                      {
00975                       nbHits += newHit(event, detector, trigger, 0, index + chNum, chipId, difId,orderInChipMemory);
00976                      }
00977                   }
00978                 }
00979               } // for (index)
00980             }
00981           } // End digital data. for (chNum)
00982         display();
00983         } // for(;;)
00984       }  // end if delimiter = 0xB4
00985     } // for (;;)
00986     display(-1);
00987 
00988    // CREATE EVENT for current Run
00989 
00990     event.setTimeStamp(globalTime + ((bcId_AbsOrg /1000000 * bcPeriod) )  );  // globalTime -> millisecond and bcId_AbsOrg * bcPeriod -> nano second
00991     event.setId(++lastEventId);
00992     FILE_LOG(logDEBUG) << "Dif[" << dec << difId << "]  Number of created hit for event  EVENT " << lastEventId << ", " << nbHits << " total hits, within " << nbanalogHit << " analogic hits" << endl;
00993 
00994 
00995 
00996     if (SkippedBcId) {
00997       FILE_LOG(logWARNING) << "    skipped " << SkippedBcId << " data because of bad bcId" << endl;
00998       SkippedBcId = 0;
00999     }
01000 
01001     return(nbHits);
01002 
01003 
01004   } 
01005 } // MicrorocOldLabviewReader.getAcqData

int MicrorocOldLabviewReader::getAnalogData ( Event event  ) 

Definition at line 246 of file MicrorocOldLabviewReader.cpp.

Referenced by getNextEvent().

00246                                                         {
00247   FILE_LOG(logDEBUG) << " global header C0 found" << endl;
00248   this->setComputeCrcFlag(true);
00249   crc->compute(0xC0); 
00250 
00251   ui16 nbchannel  = 64;
00252   ui16 nbLine = 4;
00253   ui16 nbBitsPerLine = this->nbChipPerLine * nbchannel * 16;
00254   Dif& dif = run.getDetector().getDifById(difId);
00255   ui16 nbChipByBoard = dif.getBoards().begin()->second->getNbColumns();
00256   ui16 nbBoard =  dif.getBoards().size();
00257   FILE_LOG(logDEBUG) << "nbBoard[" << nbBoard << "]" <<endl;
00258   FILE_LOG(logDEBUG) << "nbChipByBoard[" << nbChipByBoard << "]" <<endl;
00259 
00260   this->analogData.clear();
00261   bool firstLine=true;
00262   for ( ui16 line = 0; line < nbLine  ; line++)
00263   {
00264     if (  analogDataActivatedLine[line] == true )
00265     {  
00266       FILE_LOG(logDEBUG) << " New Line[" << line << "]" <<  endl;
00267       if ( !firstLine  )
00268       {
00269         int foo = getData(1);  // read 8 bits
00270         FILE_LOG(logDEBUG) << " foo C0["<< hex <<  foo << "]" << endl;
00271         if ( foo != 0xC0 )
00272         {
00273           FILE_LOG(logERROR) << "C0 header not found[0x" << hex << foo << "]" << endl;
00274           exit(-1);
00275         }
00276       }
00277       if( firstLine == true) { firstLine = false; }
00278   
00279       for ( i32 col = nbBoard * nbChipByBoard -1  ; col >= 0; col--) 
00280       {
00281         FILE_LOG(logDEBUG)<< hex << "col index[0x" << col << "]board col["<< col/nbChipByBoard << "] line["<< line <<"], col["<< col%nbChipByBoard <<"] "<<endl;
00282         Chip& chip = dif.getChipByRowCol(col/nbChipByBoard, line,col%nbChipByBoard);
00283         FILE_LOG(logDEBUG) << "------------chipId["<< chip.getId() << "] chip bypassed[" << chip.getBypassed() << "]"  <<endl;
00284         if( chip.getBypassed() == false )
00285         {
00286           map<ui16,ui16> channelsValues;
00287           for ( ui16 channel = 0 ; channel < nbchannel ;channel++) 
00288           {
00289             int foo = getData(2); 
00290             //this->analogData[line][col][channel] = foo; 
00291             channelsValues[channel] = foo;
00292             FILE_LOG(logDEBUG) << "chipId["<< chip.getId() <<"] analogData line["<< line <<"], col number["<< col << "] , channel[" << channel << "= " << hex <<foo << dec << endl;
00293           }
00294           this->analogData[chip.getId()] = channelsValues;
00295         }
00296       }
00297       
00298       // Get D0
00299       int foo = getData(1); 
00300       if ( foo != 0xD0 )
00301       {
00302         FILE_LOG(logERROR) << "D0 header not found[0x" << hex << foo << "]" << endl;
00303         exit(-1);
00304       }
00305     }
00306     else
00307     {
00308       FILE_LOG(logDEBUG) << " line[ " <<  line +1<< "] is disable  ( starting number at  1 )" << endl;
00309     }
00310   }
00311 
00312 
00313   this->setComputeCrcFlag(false);
00314   unsigned short CRC_check = getData(2);
00315   if ( CRC_check != crc->getCrc() )
00316   {
00317     FILE_LOG(logERROR) << endl << " CRC Error event Id: " << lastEventId <<  endl;
00318     FILE_LOG(logERROR) << hex << " Compute CRC[" << crc->getCrc() << "]" <<  endl;
00319     FILE_LOG(logERROR) << hex << " Received CRC[" << CRC_check << "]" <<  endl;
00320     event.setCrcIsCorrect(false);
00321   }
00322   else
00323   {
00324     event.setCrcIsCorrect(true);
00325   }
00326 
00327   return 0;
00328   }


Member Data Documentation

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

Definition at line 49 of file MicrorocOldLabviewReader.hh.

Referenced by getAcqData(), and getAnalogData().

ui16 MicrorocOldLabviewReader::nbChipPerLine [private]

Definition at line 51 of file MicrorocOldLabviewReader.hh.

Referenced by getAnalogData(), and getScData().

bool MicrorocOldLabviewReader::analogDataActivate [private]

Definition at line 52 of file MicrorocOldLabviewReader.hh.

Referenced by getAcqData(), and getScData().

bool MicrorocOldLabviewReader::analogDataActivatedLine[NBLINE] [private]

Definition at line 53 of file MicrorocOldLabviewReader.hh.

Referenced by getAnalogData(), getScData(), and MicrorocOldLabviewReader().

ui32 MicrorocOldLabviewReader::hexTemperatureAsu1 [private]

Definition at line 55 of file MicrorocOldLabviewReader.hh.

Referenced by getAcqData().

ui32 MicrorocOldLabviewReader::hexTemperatureAsu2 [private]

Definition at line 56 of file MicrorocOldLabviewReader.hh.

Referenced by getAcqData().

ui16 MicrorocOldLabviewReader::hexTemperatureDif [private]

Definition at line 57 of file MicrorocOldLabviewReader.hh.

Referenced by getAcqData().

bool MicrorocOldLabviewReader::forceAnalog [private]

Definition at line 59 of file MicrorocOldLabviewReader.hh.

Referenced by getAcqData().


The documentation for this class was generated from the following files:
Generated on Mon Jan 7 13:18:46 2013 for MicromegasFramework by  doxygen 1.4.7