// *** ADC data
// Scan of the map to assign the correct ADC module-channel
for(Int_t k=0; k<nCh; k++){
+ if(iDigit<knADCData1+knADCData2){
if(digit.GetSector(0)==mapADC[k][2] && digit.GetSector(1)==mapADC[k][3]){
lADCDataGEO = (UInt_t) mapADC[k][0];
lADCDataChannel = (UInt_t) mapADC[k][1];
break;
}
+ }
+ else{
+ if(digit.GetSector(0)==mapADC[k][2] && digit.GetSector(1)==mapADC[k][3]){
+ lADCDataGEO = (UInt_t) mapADC[k][0];
+ lADCDataChannel = (UInt_t) mapADC[k][1];
+ if(k>knADCData1+knADCData2) break;
+ }
+ }
}
// Ch. debug
//printf(" det %d sec %d -> lADCDataGEO %d lADCDataChannel %d\n",
// digit.GetSector(0),digit.GetSector(1),lADCDataGEO,lADCDataChannel);
if(lADCDataGEO==0){
- if(iDigit<knADCData1){ // *** In-time signals - 1st ADC module
- Int_t indHG = iDigit;
- Int_t indLG = indHG+knADCData1;
+ Int_t indHG = iDigit;
+ Int_t indLG = indHG+knADCData1;
+ // High gain ADC ch.
+ if(digit.GetADCValue(0) > 2047) lADCDataOvFlwHG = 1;
+ lADCDataValue1[indHG] = digit.GetADCValue(0);
+ lADCData1[indHG] = lADCDataGEO << 27 | lADCDataChannel << 17 |
+ lADCDataOvFlwHG << 12 | (lADCDataValue1[indHG] & 0xfff);
+ // Low gain ADC ch.
+ if(digit.GetADCValue(1) > 2047) lADCDataOvFlwLG = 1;
+ lADCDataValue1[indLG] = digit.GetADCValue(1);
+ lADCData1[indLG] = lADCDataGEO << 27 | lADCDataChannel << 17 | 0x1 << 16 |
+ lADCDataOvFlwLG << 12 | (lADCDataValue1[indLG] & 0xfff);
+ // Ch. debug
+ //printf(" lADCDataGEO %d lADCDataValue1[%d] = %d lADCDataValue1[%d] = %d\n",
+ // lADCDataGEO,iDigit,lADCDataValue1[indLG],indLG,lADCDataValue1[indLG]);
+ }
+ else if(lADCDataGEO==1){
+ Int_t indHG = iDigit-knADCData1;
+ Int_t indLG = indHG+knADCData2;
// High gain ADC ch.
if(digit.GetADCValue(0) > 2047) lADCDataOvFlwHG = 1;
- lADCDataValue1[indHG] = digit.GetADCValue(0);
- lADCData1[indHG] = lADCDataGEO << 27 | lADCDataChannel << 17 |
- lADCDataOvFlwHG << 12 | (lADCDataValue1[indHG] & 0xfff);
+ lADCDataValue2[indHG] = digit.GetADCValue(0);
+ lADCData2[indHG] = lADCDataGEO << 27 | lADCDataChannel << 17 |
+ lADCDataOvFlwHG << 12 | (lADCDataValue2[indHG] & 0xfff);
// Low gain ADC ch.
if(digit.GetADCValue(1) > 2047) lADCDataOvFlwLG = 1;
- lADCDataValue1[indLG] = digit.GetADCValue(1);
- lADCData1[indLG] = lADCDataGEO << 27 | lADCDataChannel << 17 | 0x1 << 16 |
- lADCDataOvFlwLG << 12 | (lADCDataValue1[indLG] & 0xfff);
- // Ch. debug
- //printf(" lADCDataGEO %d lADCDataValue1[%d] = %d lADCDataValue1[%d] = %d\n",
- // lADCDataGEO,iDigit,lADCDataValue1[indLG],indLG,lADCDataValue1[indLG]);
- }
- else{ // *** Out-of-time signals - 3rd ADC module
- lADCDataGEO=2;
+ lADCDataValue2[indLG] = digit.GetADCValue(1);
+ lADCData2[indLG] = lADCDataGEO << 27 | lADCDataChannel << 17 | 0x1 << 16 |
+ lADCDataOvFlwLG << 12 | (lADCDataValue2[indLG] & 0xfff);
+ //Ch. debug
+ //printf(" lADCDataGEO %d lADCDataValue2[%d] = %d lADCDataValue2[%d] = %d\n",
+ // lADCDataGEO,indHG,lADCDataValue2[indHG],indLG,lADCDataValue2[indLG]);
+ }
+ else if(lADCDataGEO==2){
Int_t indHG = iDigit-knADCData1-knADCData2;
Int_t indLG = indHG+knADCData3;
// High gain ADC ch.
//Ch. debug
//printf(" lADCDataGEO %d lADCDataValue3[%d] = %d lADCDataValue3[%d] = %d\n",
// lADCDataGEO,indHG,lADCDataValue3[indHG],indLG,lADCDataValue3[indLG]);
- }
}
- else if(lADCDataGEO==1){
- if(iDigit<knADCData1+knADCData2){// *** In-time signals - 2nd ADC module
- Int_t indHG = iDigit-knADCData1;
- Int_t indLG = indHG+knADCData2;
- // High gain ADC ch.
- if(digit.GetADCValue(0) > 2047) lADCDataOvFlwHG = 1;
- lADCDataValue2[indHG] = digit.GetADCValue(0);
- lADCData2[indHG] = lADCDataGEO << 27 | lADCDataChannel << 17 |
- lADCDataOvFlwHG << 12 | (lADCDataValue2[indHG] & 0xfff);
- // Low gain ADC ch.
- if(digit.GetADCValue(1) > 2047) lADCDataOvFlwLG = 1;
- lADCDataValue2[indLG] = digit.GetADCValue(1);
- lADCData2[indLG] = lADCDataGEO << 27 | lADCDataChannel << 17 | 0x1 << 16 |
- lADCDataOvFlwLG << 12 | (lADCDataValue2[indLG] & 0xfff);
- //Ch. debug
- //printf(" lADCDataGEO %d lADCDataValue2[%d] = %d lADCDataValue2[%d] = %d\n",
- // lADCDataGEO,indHG,lADCDataValue2[indHG],indLG,lADCDataValue2[indLG]);
- }
- else{ // *** Out-of-time signals - 4rth ADC
- lADCDataGEO=3;
+ else if(lADCDataGEO==3){
Int_t indHG = iDigit-knADCData1-knADCData2-knADCData3;
Int_t indLG = indHG+knADCData4;
// High gain ADC ch.
// Ch. debug
//printf(" lADCDataGEO %d lADCDataValue4[%d] = %d lADCDataValue4[%d] = %d\n",
// lADCDataGEO,indHG,lADCDataValue4[indHG],indLG,lADCDataValue4[indLG]);
- }
}
}
sizeof(lADCHeader3) + sizeof(lADCData3) + sizeof(lADCEndBlock) +
sizeof(lADCHeader4) + sizeof(lADCData4) + sizeof(lADCEndBlock);
//
- printf("sizeof header = %d, ADCHeader1 = %d, ADCData1 = %d, ADCEndBlock = %d\n",
+ /*printf("sizeof header = %d, ADCHeader1 = %d, ADCData1 = %d, ADCEndBlock = %d\n",
sizeof(header),sizeof(lADCHeader1),sizeof(lADCData1),sizeof(lADCEndBlock));
printf("sizeof header = %d, ADCHeader2 = %d, ADCData2 = %d, ADCEndBlock = %d\n",
sizeof(header),sizeof(lADCHeader2),sizeof(lADCData2),sizeof(lADCEndBlock));
printf("sizeof header = %d, ADCHeader3 = %d, ADCData3 = %d, ADCEndBlock = %d\n",
sizeof(header),sizeof(lADCHeader1),sizeof(lADCData1),sizeof(lADCEndBlock));
printf("sizeof header = %d, ADCHeader4 = %d, ADCData4 = %d, ADCEndBlock = %d\n",
- sizeof(header),sizeof(lADCHeader2),sizeof(lADCData2),sizeof(lADCEndBlock));
+ sizeof(header),sizeof(lADCHeader2),sizeof(lADCData2),sizeof(lADCEndBlock));*/
header.SetAttribute(0); // valid data
file->WriteBuffer((char*)(&header), sizeof(header));
return kFALSE;
}
-// // Event loop
- Int_t iEvent = 0;
- while(rawReader->NextEvent()){
- (AliRunLoader::Instance())->GetEvent(iEvent++);
- // Create the output digit tree
- TTree* treeS = loader->TreeS();
- if(!treeS){
- loader->MakeTree("S");
- treeS = loader->TreeS();
- }
- //
- AliZDCSDigit sdigit;
- AliZDCSDigit* psdigit = &sdigit;
- const Int_t kBufferSize = 4000;
- treeS->Branch("ZDC", "AliZDCSDigit", &psdigit, kBufferSize);
- //
- AliZDCRawStream rawStream(rawReader);
- Int_t sector[2], resADC, rawADC, corrADC, nPheVal;
- Int_t jcount = 0;
- while(rawStream.Next()){
- if(rawStream.IsADCDataWord()){
- //For the moment only in-time SDigits are foreseen (1st 48 raw values)
- if(jcount < kNch){
- for(Int_t j=0; j<2; j++) sector[j] = rawStream.GetSector(j);
- rawADC = rawStream.GetADCValue();
- resADC = rawStream.GetADCGain();
- //printf("\t RAw2SDigits raw%d -> RawADC[%d, %d, %d] read\n",
- // jcount, sector[0], sector[1], rawADC);
- //
- corrADC = rawADC - Pedestal(sector[0], sector[1], resADC);
- if(corrADC<0) corrADC=0;
- nPheVal = ADCch2Phe(sector[0], sector[1], corrADC, resADC);
- //
- //printf("\t \t -> SDigit[%d, %d, %d] created\n",
- // sector[0], sector[1], nPheVal);
- //
- new(psdigit) AliZDCSDigit(sector, (Float_t) nPheVal, 0.);
- treeS->Fill();
- jcount++;
- }
- }//IsADCDataWord
- }//rawStream.Next
- // write the output tree
- fLoader->WriteSDigits("OVERWRITE");
- fLoader->UnloadSDigits();
- }//Event loop
+ // Create the output digit tree
+ TTree* treeS = loader->TreeS();
+ if(!treeS){
+ loader->MakeTree("S");
+ treeS = loader->TreeS();
+ }
+ //
+ AliZDCSDigit sdigit;
+ AliZDCSDigit* psdigit = &sdigit;
+ const Int_t kBufferSize = 4000;
+ treeS->Branch("ZDC", "AliZDCSDigit", &psdigit, kBufferSize);
+ //
+ AliZDCRawStream rawStream(rawReader);
+ Int_t sector[2], resADC, rawADC, corrADC, nPheVal;
+ Int_t jcount = 0;
+ while(rawStream.Next()){
+ if(rawStream.IsADCDataWord()){
+ //For the moment only in-time SDigits are foreseen (1st 48 raw values)
+ if(jcount < kNch){
+ for(Int_t j=0; j<2; j++) sector[j] = rawStream.GetSector(j);
+ rawADC = rawStream.GetADCValue();
+ resADC = rawStream.GetADCGain();
+ //printf("\t RAw2SDigits raw%d -> RawADC[%d, %d, %d] read\n",
+ // jcount, sector[0], sector[1], rawADC);
+ //
+ corrADC = rawADC - Pedestal(sector[0], sector[1], resADC);
+ if(corrADC<0) corrADC=0;
+ nPheVal = ADCch2Phe(sector[0], sector[1], corrADC, resADC);
+ //
+ //printf("\t \t -> SDigit[%d, %d, %d] created\n",
+ // sector[0], sector[1], nPheVal);
+ //
+ new(psdigit) AliZDCSDigit(sector, (Float_t) nPheVal, 0.);
+ treeS->Fill();
+ jcount++;
+ }
+ }//IsADCDataWord
+ }//rawStream.Next
+ // write the output tree
+ fLoader->WriteSDigits("OVERWRITE");
+ fLoader->UnloadSDigits();
return kTRUE;
}
resADC[0] = 0.0000008; // ADC Resolution high gain: 200 fC/adcCh
resADC[1] = 0.0000064; // ADC Resolution low gain: 25 fC/adcCh
//
- Int_t nPhe = (Int_t) (ADCVal * pmGain[Det-1][Quad] * resADC[Res]);
+ Int_t nPhe = (Int_t) (ADCVal / (pmGain[Det-1][Quad] * resADC[Res]));
//
//printf("\t AliZDC::ADCch2Phe -> det(%d, %d) - ADC %d phe %d\n",Det,Quad,ADCVal,nPhe);