#include <DiracLabview.hh>
Inheritance diagram for DiracLabview:
Public Member Functions | |
DiracLabview (Run &aRun, FILE *aFile, ui32 firstEventId) | |
virtual | ~DiracLabview () |
int | getNextEvent (Event &eventToFill) |
Static Public Member Functions | |
static const char * | type (const int subtype=0) |
Private Attributes | |
bool | newConfig |
Definition at line 31 of file DiracLabview.hh.
DiracLabview::DiracLabview | ( | Run & | aRun, | |
FILE * | aFile, | |||
ui32 | firstEventId | |||
) |
Definition at line 30 of file DiracLabview.cpp.
00030 : DifReader(aRun, aFile, _firstEventId) 00031 { 00032 //FILE_LOG(logDEBUG) << "--DiracLabview constructor()"<< endl; 00033 }
DiracLabview::~DiracLabview | ( | ) | [virtual] |
static const char* DiracLabview::type | ( | const int | subtype = 0 |
) | [inline, static] |
int DiracLabview::getNextEvent | ( | Event & | eventToFill | ) | [virtual] |
Implements AcquisitionParser.
Definition at line 42 of file DiracLabview.cpp.
00043 { 00044 ui16 dataFormat = run.getDataFormat(); 00045 if (dataFormat == 0) 00046 { 00047 dataFormat = 0; 00048 run.setDataFormat(dataFormat); 00049 return NEW_CONFIG; 00050 } 00051 char strReadLine[256]; 00052 static short iNbEventInMemory = 0; 00053 static unsigned char fChannelValues[NB_EVENT_DUMP][NB_CHANNELS], fStimChannel; 00054 static short fDacLoA,fDacMidA,fDacHiA,fDacLoB,fDacMidB,fDacHiB; 00055 static int fNbDump, fBcid[NB_EVENT_DUMP]; 00056 static double fCharge; 00057 // Int_t fEventId=0; 00058 unsigned short fNbChannelHit; 00059 bool bFlagRun = true; 00060 bool bFlagReadEventHeader = true; 00061 Detector& aDet = run.getDetector(); 00062 00063 if (iNbEventInMemory==0){ 00064 while((feof(inputFile)==0) && bFlagRun){ 00065 fgets(strReadLine,256,inputFile) ; 00066 if (!strncmp(strReadLine,"voie 0 = ",10)){ 00067 bFlagReadEventHeader=0; 00068 } 00069 if (!strncmp(strReadLine,"voie 63 = ",10)){ 00070 bFlagRun=0; 00071 } 00072 // Read Chip Identifier 00073 if (bFlagReadEventHeader){ 00074 if (!strncmp(strReadLine,"Fin de run",10)){ 00075 return LAST_FILE_EVENT; 00076 } 00077 if (!strncmp(strReadLine,"Channel = ",10)){ 00078 sscanf(&strReadLine[10],"%hhd",&fStimChannel); 00079 } 00080 if (!strncmp(strReadLine,"DAC_A (L-M-H) = ",16)){ 00081 sscanf(&strReadLine[16],"%hd %hd %hd",&fDacLoA,&fDacMidA,&fDacHiA); 00082 } 00083 if (!strncmp(strReadLine,"DAC_B (L-M-H) = ",16)){ 00084 sscanf(&strReadLine[16],"%hd %hd %hd",&fDacLoB,&fDacMidB,&fDacHiB); 00085 } 00086 if (!strncmp(strReadLine,"acquisition = ",14)){ 00087 sscanf(&strReadLine[14],"%d",&fNbDump); 00088 } 00089 if (!strncmp(strReadLine,"Charge = ",9)){ 00090 sscanf(&strReadLine[9],"%lE",&fCharge); 00091 } 00092 if (!strncmp(strReadLine,"BCID = ",7)){ 00093 sscanf(&strReadLine[7],"%d %d %d %d %d %d %d %d",&fBcid[0],&fBcid[1],&fBcid[2],&fBcid[3],&fBcid[4],&fBcid[5],&fBcid[6],&fBcid[7]); 00094 } 00095 } 00096 if (!bFlagReadEventHeader){ 00097 //if (!strncmp(strReadLine,"voie ",5)){ 00098 short iChannel; 00099 sscanf(&strReadLine[5],"%hd",&iChannel); 00100 for (unsigned short iIndex=0;iIndex < NB_EVENT_DUMP;iIndex++){ 00101 fChannelValues[iIndex][iChannel]=0; 00102 if (strReadLine[10+iIndex]=='1') fChannelValues[iIndex][iChannel]+=2; 00103 if (strReadLine[19+iIndex]=='1') fChannelValues[iIndex][iChannel]+=1; 00104 } 00105 //} 00106 } 00107 } 00108 iNbEventInMemory=8; 00109 } 00110 00111 if (iNbEventInMemory!=0){ 00112 // if (lastEventId<17){ 00113 FILE_LOG(logDEBUG1) << endl; 00114 FILE_LOG(logDEBUG1) << "_________________________________________________________" << endl; 00115 FILE_LOG(logDEBUG1) << "Event ID : " << lastEventId << " - N° acq. : " << fNbDump << " - Stim' Channel : " << static_cast<int>(fStimChannel) << endl; 00116 FILE_LOG(logDEBUG1) << "Chip BCID : " << fBcid[8-iNbEventInMemory] << " - Dif BCID : " << "??" << endl; 00117 FILE_LOG(logDEBUG1) << "Hits :"; 00118 for(unsigned char iIndex=0;iIndex<NB_CHANNELS;iIndex++){ 00119 if (fChannelValues[8-iNbEventInMemory][iIndex]!=0){ 00120 FILE_LOG(logDEBUG1) << " Ch"<<static_cast<int>(iIndex)<<"=>'"<<static_cast<int>(fChannelValues[8-iNbEventInMemory][iIndex])<<"'" << endl; 00121 fNbChannelHit++; 00122 } 00123 } 00124 00125 run.setInjectedCharge(fCharge); 00126 FILE_LOG(logDEBUG1) << "fCharge[" << fCharge << "]" << endl; 00127 try { 00128 Dif& dif = aDet.getDifById(1); 00129 DiracChip& diracChip = dynamic_cast<DiracChip &> (dif.getChipById(1)); 00130 00131 FILE_LOG(logDEBUG1) << " Dirac slow control for chip configuration set: " << endl; 00132 diracChip.setBLoThreshold(fDacLoB); 00133 diracChip.setBMidThreshold(fDacMidB); 00134 diracChip.setBHiThreshold(fDacHiB); 00135 00136 diracChip.setALoThreshold(fDacLoA); 00137 diracChip.setAMidThreshold(fDacMidA); 00138 diracChip.setAHiThreshold(fDacHiA); 00139 diracChip.setConfigured(true); 00140 00141 FILE_LOG(logDEBUG1) << endl; 00142 FILE_LOG(logDEBUG1) << "Dac A : " << fDacLoA << " / " << fDacMidA << " / " << fDacHiA << endl; 00143 FILE_LOG(logDEBUG1) << "Dac B : " << fDacLoB << " / " << fDacMidB << " / " << fDacHiB << endl; 00144 FILE_LOG(logDEBUG1) << "Charge: " << fCharge << endl; 00145 } 00146 catch(...) { 00147 FILE_LOG(logDEBUG1) << "Ouh la la tu va avoir des gros problemes toi.: " << endl; 00148 } 00149 00150 //event.Build(fEventId,1,123,123,123); 00151 //event.setQin(fCharge); 00152 //event.SetNbDump(fNbDump); 00153 //event.SetChipBcid(fBcid[8-iNbEventInMemory]); 00154 //event.SetDifBcid(1234); // !!!!! 00155 00156 fNbChannelHit=0; 00157 //event.SetNchannel(fNbChannelHit); 00158 const ChamberMap_t &chambers = aDet.getChambers(); 00159 for (ChamberMap_t::const_iterator iter=chambers.begin(); iter!=chambers.end(); iter++) 00160 { 00161 Chamber& chamber = *(*iter).second; 00162 FILE_LOG(logDEBUG1)<< "Chamber->id="<< chamber.getId() << " , descrition:" << chamber.getDescription() << endl; 00163 //if (chamber.getId()==0){ 00164 for(unsigned char iIndex=0;iIndex<NB_CHANNELS;iIndex++){ 00165 if (fChannelValues[8-iNbEventInMemory][iIndex]!=0){ 00166 try{ 00167 00168 const Channel& channel = chamber.getChannelById(iIndex,1,1); 00169 i16 analogValue = 0; 00170 FILE_LOG(logDEBUG1)<< "insertHit" << endl; 00171 event.insertHit(chamber,new ChannelHit(channel,fChannelValues[8-iNbEventInMemory][iIndex],analogValue)); 00172 } 00173 catch ( MicroException &e){ 00174 FILE_LOG(logERROR) << e.getMessage() << endl; 00175 } 00176 //event.AddChannel(iIndex+1,fChannelValues[8-iNbEventInMemory][iIndex]); 00177 fNbChannelHit++; 00178 } 00179 } 00180 //} 00181 } 00182 //event.SetNchannel(fNbChannelHit); 00183 event.setId(++lastEventId); 00184 event.setTimeStamp(fBcid[8-iNbEventInMemory]); 00185 iNbEventInMemory--; 00186 } 00187 FILE_LOG(logDEBUG1)<< "event correct" << endl; 00188 return EVENT_CORRECT; 00189 }
bool DiracLabview::newConfig [private] |
Definition at line 46 of file DiracLabview.hh.