{
// Convert ZDC digits to raw data
- // Format: 22 interger values -> ZN1 (C+Q1-4), ZP1 (C+Q1-4), ZEM1, 2, ZN (C+Q1-4), ZP2 (C+Q1-4))
- // + 22 interger values for the out of time channels
+ // Format: 24 int values -> ZN1(C+Q1-4), ZP1(C+Q1-4), ZEM1, ZEM2, ZN(C+Q1-4), ZP2(C+Q1-4), 2 Ref PMs
+ // + 24 int values for the corresponding out of time channels
// For the CAEN module V965 we have an Header, the Data Words and an End Of Block
// 12 channels x 2 gain chains read from 1st ADC module
- // 10 channels x 2 gain chains read from 2nd ADC module
+ // 12 channels x 2 gain chains read from 2nd ADC module
// 12 channels x 2 gain chains read from 3rd ADC module (o.o.t.)
- // 10 channels x 2 gain chains read from 4rth ADC module (o.o.t.)
+ // 12 channels x 2 gain chains read from 4rth ADC module (o.o.t.)
//
- const int knADCData1=24, knADCData2=20;
+ const int knADCData1=24, knADCData2=24; // In principle the 2 numbers can be different!
UInt_t lADCHeader1;
- UInt_t lADCData1[knADCData1];
- //
UInt_t lADCHeader2;
+ UInt_t lADCData1[knADCData1];
UInt_t lADCData2[knADCData2];
- //
- UInt_t lADCHeader3;
UInt_t lADCData3[knADCData1];
- //
- UInt_t lADCHeader4;
UInt_t lADCData4[knADCData2];
//
UInt_t lADCEndBlock;
TTree* treeD = fLoader->TreeD();
if(!treeD) return;
treeD->SetBranchAddress("ZDC", &pdigit);
- //printf("\t AliZDC::Digits2raw -> TreeD has %d entries\n",(Int_t) treeD->GetEntries());
+ //printf("\t AliZDC::Digits2Raw -> TreeD has %d entries\n",(Int_t) treeD->GetEntries());
// Fill data array
// ADC header
lADCHeader1 = lADCHeaderGEO << 27 | 0x1 << 25 | lADCHeaderCRATE << 16 |
lADCHeaderCNT1 << 8 ;
- //
lADCHeader2 = lADCHeaderGEO << 27 | 0x1 << 25 | lADCHeaderCRATE << 16 |
lADCHeaderCNT2 << 8 ;
- //
- lADCHeader3 = lADCHeaderGEO << 27 | 0x1 << 25 | lADCHeaderCRATE << 16 |
- lADCHeaderCNT1 << 8 ;
- //
- lADCHeader4 = lADCHeaderGEO << 27 | 0x1 << 25 | lADCHeaderCRATE << 16 |
- lADCHeaderCNT2 << 8 ;
- //printf("\t lADCHeader1 = %x, lADCHeader2 = %x\n",lADCHeader1, lADCHeader2);
// ADC data word
UInt_t lADCDataGEO = lADCHeaderGEO;
+ //
UInt_t lADCDataValue1[knADCData1];
UInt_t lADCDataValue2[knADCData2];
UInt_t lADCDataValue3[knADCData1];
UInt_t lADCDataValue4[knADCData2];
+ //
UInt_t lADCDataOvFlw1[knADCData1];
UInt_t lADCDataOvFlw2[knADCData2];
UInt_t lADCDataOvFlw3[knADCData1];
UInt_t lADCDataOvFlw4[knADCData2];
+ //
for(Int_t i=0; i<knADCData1 ; i++){
lADCDataValue1[i] = 0;
lADCDataOvFlw1[i] = 0;
lADCDataValue4[i] = 0;
lADCDataOvFlw4[i] = 0;
}
+ //
UInt_t lADCDataChannel = 0;
// loop over digits
//digit.Print("");
// *** ADC data
- Int_t index1=0, index2=0;
- // *** ADC1 (ZN1, ZP1, ZEM1,2) o ADC3 (ZN1, ZP1, ZEM1,2 o.o.t.)
- if(digit.GetSector(0)==1 || digit.GetSector(0)==2 || digit.GetSector(0)==3){
- if(digit.GetSector(0)==1 || digit.GetSector(0)==2){
- index1 = (digit.GetSector(0)-1) + digit.GetSector(1)*4; // ZN1 or ZP1
- lADCDataChannel = (digit.GetSector(0)-1)*8 + digit.GetSector(1);
- }
- else if(digit.GetSector(0)==3){ // ZEM 1,2
- index1 = 20 + (digit.GetSector(1)-1);
- lADCDataChannel = 5 + (digit.GetSector(1)-1)*8;
+ Int_t index=0;
+ if(digit.GetSector(1)!=5){ // ZDC signal channels
+ // *** ADC1 (ZN1, ZP1, ZEM1,2) or ADC3 (ZN1, ZP1, ZEM1,2 o.o.t.)
+ if(digit.GetSector(0)==1 || digit.GetSector(0)==2 || digit.GetSector(0)==3){
+ if(digit.GetSector(0)==1 || digit.GetSector(0)==2){
+ index = (digit.GetSector(0)-1) + 4*digit.GetSector(1); // ZN1 or ZP1
+ lADCDataChannel = 8*(digit.GetSector(0)-1) + digit.GetSector(1);
+ }
+ else if(digit.GetSector(0)==3){ // ZEM 1,2
+ index = 20 + (digit.GetSector(1)-1);
+ lADCDataChannel = 5 + 8*(digit.GetSector(1)-1);
+ }
+ //
+ /*printf("\t AliZDC::Digits2Raw -> idig%d det %d quad %d index %d, ADCch %d ADCVal[%d, %d]\n",
+ iDigit,digit.GetSector(0),digit.GetSector(1),index,lADCDataChannel,
+ digit.GetADCValue(0),digit.GetADCValue(1));// Ch. debug
+ */
+ //
+ if(iDigit<knADCData1){ // *** In-time signals
+ lADCDataValue1[index] = digit.GetADCValue(0); // High gain ADC ch.
+ if(lADCDataValue1[index] > 2047) lADCDataOvFlw1[index] = 1;
+ lADCDataValue1[index+2] = digit.GetADCValue(1); // Low gain ADC ch.
+ if(lADCDataValue1[index+2] > 2047) lADCDataOvFlw1[index+2] = 1;
+
+ lADCData1[index] = lADCDataGEO << 27 | 0x1 << 24 | lADCDataChannel << 17 |
+ lADCDataOvFlw1[index] << 12 | (lADCDataValue1[index] & 0xfff);
+ lADCData1[index+2] = lADCDataGEO << 27 | 0x1 << 24 | lADCDataChannel << 17 | 0x1 << 16 |
+ lADCDataOvFlw1[index+2] << 12 | (lADCDataValue1[index+2] & 0xfff);
+ }
+ else{ // *** Out-of-time signals
+ lADCDataValue3[index] = digit.GetADCValue(0); // High gain ADC ch.
+ if(lADCDataValue3[index] > 2047) lADCDataOvFlw3[index] = 1;
+ lADCDataValue3[index+2] = digit.GetADCValue(1); // Low gain ADC ch.
+ if(lADCDataValue3[index+2] > 2047) lADCDataOvFlw3[index+2] = 1;
+
+ lADCData3[index] = lADCDataGEO << 27 | lADCDataChannel << 17 |
+ lADCDataOvFlw3[index] << 12 | (lADCDataValue3[index] & 0xfff);
+ lADCData3[index+2] = lADCDataGEO << 27 | lADCDataChannel << 17 | 0x1 << 16 |
+ lADCDataOvFlw3[index+2] << 12 | (lADCDataValue3[index+2] & 0xfff);
+ }
}
- //
- /*printf("\t AliZDC::Digits2raw -> det %d, quad %d, index = %d, ADCch = %d\n",
- digit.GetSector(0),digit.GetSector(1),index1,lADCDataChannel);// Ch. debug
- */
- //
- if(iDigit<22){
- lADCDataValue1[index1] = digit.GetADCValue(0); // High gain ADC ch.
- if(lADCDataValue1[index1] > 2047) lADCDataOvFlw1[index1] = 1;
- lADCDataValue1[index1+2] = digit.GetADCValue(1); // Low gain ADC ch.
- if(lADCDataValue1[index1+2] > 2047) lADCDataOvFlw1[index1+2] = 1;
-
- lADCData1[index1] = lADCDataGEO << 27 | lADCDataChannel << 17 |
- lADCDataOvFlw1[index1] << 12 | (lADCDataValue1[index1] & 0xfff);
- lADCData1[index1+2] = lADCDataGEO << 27 | lADCDataChannel << 17 | 0x1 << 16 |
- lADCDataOvFlw1[index1+2] << 12 | (lADCDataValue1[index1+2] & 0xfff);
+ // *** ADC2 (ZN2, ZP2) or ADC4 (ZN2, ZP2 o.o.t.)
+ else if(digit.GetSector(0)==4 || digit.GetSector(0)==5){
+ index = (digit.GetSector(0)-4) + 4*digit.GetSector(1); // ZN2 or ZP2
+ lADCDataChannel = 8*(digit.GetSector(0)-4) + digit.GetSector(1);
+ //
+ /*printf("\t AliZDC::Digits2Raw -> idig%d det %d quad %d index %d, ADCch %d ADCVal[%d, %d]\n",
+ iDigit,digit.GetSector(0),digit.GetSector(1),index,lADCDataChannel,
+ digit.GetADCValue(0),digit.GetADCValue(1));// Ch. debug
+ */
+ //
+ if(iDigit<knADCData2){ // *** In-time signals
+ lADCDataValue2[index] = digit.GetADCValue(0);
+ if(lADCDataValue2[index] > 2047) lADCDataOvFlw2[index] = 1;
+ lADCDataValue2[index+2] = digit.GetADCValue(1);
+ if(lADCDataValue2[index+2] > 2047) lADCDataOvFlw2[index+2] = 1;
+ //
+ lADCData2[index] = lADCDataGEO << 27 | lADCDataChannel << 17 |
+ lADCDataOvFlw2[index] << 12 | (lADCDataValue2[index] & 0xfff);
+ lADCData2[index+2] = lADCDataGEO << 27 | lADCDataChannel << 17 | 0x1 << 16 |
+ lADCDataOvFlw2[index+2] << 12 | (lADCDataValue2[index+2] & 0xfff);
+ }
+ else{ // *** Out-of-time signals
+ lADCDataValue4[index] = digit.GetADCValue(0);
+ if(lADCDataValue4[index] > 2047) lADCDataOvFlw4[index] = 1;
+ lADCDataValue4[index+2] = digit.GetADCValue(1);
+ if(lADCDataValue4[index+2] > 2047) lADCDataOvFlw4[index+2] = 1;
+ //
+ lADCData4[index] = lADCDataGEO << 27 | lADCDataChannel << 17 |
+ lADCDataOvFlw4[index] << 12 | (lADCDataValue4[index] & 0xfff);
+ lADCData4[index+2] = lADCDataGEO << 27 | lADCDataChannel << 17 | 0x1 << 16 |
+ lADCDataOvFlw4[index+2] << 12 | (lADCDataValue4[index+2] & 0xfff);
+ }
}
- else{
- lADCDataValue3[index1] = digit.GetADCValue(0); // High gain ADC ch.
- if(lADCDataValue3[index1] > 2047) lADCDataOvFlw3[index1] = 1;
- lADCDataValue3[index1+2] = digit.GetADCValue(1); // Low gain ADC ch.
- if(lADCDataValue3[index1+2] > 2047) lADCDataOvFlw3[index1+2] = 1;
-
- lADCData3[index1] = lADCDataGEO << 27 | lADCDataChannel << 17 |
- lADCDataOvFlw3[index1] << 12 | (lADCDataValue3[index1] & 0xfff);
- lADCData3[index1+2] = lADCDataGEO << 27 | lADCDataChannel << 17 | 0x1 << 16 |
- lADCDataOvFlw3[index1+2] << 12 | (lADCDataValue3[index1+2] & 0xfff);
- }
}
- // *** ADC2 (ZN2, ZP2) o ADC4 (ZN2, ZP2 o.o.t.)
- else if(digit.GetSector(0)==4 || digit.GetSector(0)==5){
- index2 = (digit.GetSector(0)-4) + digit.GetSector(1)*4; // ZN2 or ZP2
- lADCDataChannel = (digit.GetSector(0)-4)*8 + digit.GetSector(1);
+ // *** ADC2 (Reference PTMs) or ADC4 (Reference PTMs o.o.t.)
+ else if(digit.GetSector(1)==5){
+ index = 20 + (digit.GetSector(0)-1)*1/3;
+ lADCDataChannel = 5 + (digit.GetSector(0)-1)*8/3;
//
- /*printf("\t AliZDC::Digits2raw -> det %d, quad %d, index = %d, ADCch = %d\n",
- digit.GetSector(0),digit.GetSector(1),index1,lADCDataChannel); // Ch. debug
+ /*printf("\t AliZDC::Digits2Raw -> idig%d det %d quad %d index %d, ADCch %d ADCVal[%d, %d]\n",
+ iDigit,digit.GetSector(0),digit.GetSector(1),index,lADCDataChannel,
+ digit.GetADCValue(0),digit.GetADCValue(1));// Ch. debug
*/
//
- if(iDigit<22){
- lADCDataValue2[index2] = digit.GetADCValue(0);
- if(lADCDataValue2[index2] > 2047) lADCDataOvFlw2[index2] = 1;
- lADCDataValue2[index2+2] = digit.GetADCValue(1);
- if(lADCDataValue2[index2+2] > 2047) lADCDataOvFlw2[index2+2] = 1;
+ if(iDigit<knADCData2){ // *** In-time signals
+ lADCDataValue2[index] = digit.GetADCValue(0);
+ if(lADCDataValue2[index] > 2047) lADCDataOvFlw2[index] = 1;
+ lADCDataValue2[index+2] = digit.GetADCValue(1);
+ if(lADCDataValue2[index+2] > 2047) lADCDataOvFlw2[index+2] = 1;
//
- lADCData2[index2] = lADCDataGEO << 27 | lADCDataChannel << 17 |
- lADCDataOvFlw2[index2] << 12 | (lADCDataValue2[index2] & 0xfff);
- lADCData2[index2+2] = lADCDataGEO << 27 | lADCDataChannel << 17 | 0x1 << 16 |
- lADCDataOvFlw2[index2+2] << 12 | (lADCDataValue2[index2+2] & 0xfff);
- }
- else{
- lADCDataValue4[index2] = digit.GetADCValue(0);
- if(lADCDataValue4[index2] > 2047) lADCDataOvFlw4[index2] = 1;
- lADCDataValue4[index2+2] = digit.GetADCValue(1);
- if(lADCDataValue4[index2+2] > 2047) lADCDataOvFlw4[index2+2] = 1;
+ lADCData2[index] = lADCDataGEO << 27 | lADCDataChannel << 17 |
+ lADCDataOvFlw2[index] << 12 | (lADCDataValue2[index] & 0xfff);
+ lADCData2[index+2] = lADCDataGEO << 27 | lADCDataChannel << 17 | 0x1 << 16 |
+ lADCDataOvFlw2[index+2] << 12 | (lADCDataValue2[index+2] & 0xfff);
+ }
+ else{ // *** Out-of-time signals
+ lADCDataValue4[index] = digit.GetADCValue(0);
+ if(lADCDataValue4[index] > 2047) lADCDataOvFlw4[index] = 1;
+ lADCDataValue4[index+2] = digit.GetADCValue(1);
+ if(lADCDataValue4[index+2] > 2047) lADCDataOvFlw4[index+2] = 1;
//
- lADCData4[index2] = lADCDataGEO << 27 | lADCDataChannel << 17 |
- lADCDataOvFlw4[index2] << 12 | (lADCDataValue4[index2] & 0xfff);
- lADCData4[index2+2] = lADCDataGEO << 27 | lADCDataChannel << 17 | 0x1 << 16 |
- lADCDataOvFlw4[index2+2] << 12 | (lADCDataValue4[index2+2] & 0xfff);
- }
- }
- if((index1<0) || (index1>23)) {
- Error("Digits2Raw", "sector[0] = %d, sector[1] = %d",
- digit.GetSector(0), digit.GetSector(1));
- continue;
+ lADCData4[index] = lADCDataGEO << 27 | lADCDataChannel << 17 |
+ lADCDataOvFlw4[index] << 12 | (lADCDataValue4[index] & 0xfff);
+ lADCData4[index+2] = lADCDataGEO << 27 | lADCDataChannel << 17 | 0x1 << 16 |
+ lADCDataOvFlw4[index+2] << 12 | (lADCDataValue4[index+2] & 0xfff);
+ }
+
}
- if((index2<0) || (index2>19)) {
+ if((index<0) || (index>23)) {
Error("Digits2Raw", "sector[0] = %d, sector[1] = %d",
digit.GetSector(0), digit.GetSector(1));
continue;
}
- /* for(Int_t i=0;i<24;i++) printf("\t ADCData1[%d] = %x\n",i,lADCData1[i]);
+ //
+ /*
+ for(Int_t i=0;i<24;i++) printf("\t ADCData1[%d] = %x\n",i,lADCData1[i]);
for(Int_t i=0;i<20;i++) printf("\t ADCData2[%d] = %x\n",i,lADCData2[i]);
for(Int_t i=0;i<24;i++) printf("\t ADCData3[%d] = %x\n",i,lADCData3[i]);
for(Int_t i=0;i<20;i++) printf("\t ADCData4[%d] = %x\n",i,lADCData4[i]);
// End of Block
UInt_t lADCEndBlockGEO = lADCHeaderGEO;
UInt_t lADCEndBlockEvCount = gAlice->GetEventNrInRun();
-
+ //
lADCEndBlock = lADCEndBlockGEO << 27 | 0x1 << 26 | lADCEndBlockEvCount;
-
- //printf("\t ADCEndBlock = %d\n",lADCEndBlock);
+ printf("\t AliZDC::Digits2Raw -> ADCEndBlock = %d\n",lADCEndBlock);
// open the output file
header.fSize = sizeof(header) +
sizeof(lADCHeader1) + sizeof(lADCData1) + sizeof(lADCEndBlock) +
sizeof(lADCHeader2) + sizeof(lADCData2) + sizeof(lADCEndBlock) +
- sizeof(lADCHeader3) + sizeof(lADCData3) + sizeof(lADCEndBlock) +
- sizeof(lADCHeader4) + sizeof(lADCData4) + sizeof(lADCEndBlock);
+ sizeof(lADCHeader1) + sizeof(lADCData3) + sizeof(lADCEndBlock) +
+ sizeof(lADCHeader2) + sizeof(lADCData4) + sizeof(lADCEndBlock);
+ //
/*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));*/
+ sizeof(header),sizeof(lADCHeader2),sizeof(lADCData2),sizeof(lADCEndBlock));
+ */
+ //
header.SetAttribute(0); // valid data
file->WriteBuffer((char*)(&header), sizeof(header));
file->WriteBuffer((char*) &lADCHeader2, sizeof (lADCHeader2));
file->WriteBuffer((char*)(lADCData2), sizeof(lADCData2));
file->WriteBuffer((char*) &lADCEndBlock, sizeof(lADCEndBlock));
- file->WriteBuffer((char*) &lADCHeader3, sizeof (lADCHeader3));
+ file->WriteBuffer((char*) &lADCHeader1, sizeof (lADCHeader1));
file->WriteBuffer((char*)(lADCData3), sizeof(lADCData3));
file->WriteBuffer((char*) &lADCEndBlock, sizeof(lADCEndBlock));
- file->WriteBuffer((char*) &lADCHeader4, sizeof (lADCHeader4));
+ file->WriteBuffer((char*) &lADCHeader2, sizeof (lADCHeader2));
file->WriteBuffer((char*)(lADCData4), sizeof(lADCData4));
file->WriteBuffer((char*) &lADCEndBlock, sizeof(lADCEndBlock));
delete file;
Int_t jcount = 0;
while(rawStream.Next()){
if(rawStream.IsADCDataWord()){
- //For the moment only in-time SDigits are foreseen (1st 44 raw values)
- if(jcount < 44){
+ //For the moment only in-time SDigits are foreseen (1st 48 raw values)
+ if(jcount < 48){
for(Int_t j=0; j<2; j++) sector[j] = rawStream.GetSector(j);
ADCRaw = rawStream.GetADCValue();
ADCRes = rawStream.GetADCGain();
Float_t PedValue;
Float_t meanPed, Pedwidth;
Int_t index=0;
- if(Det==1|| Det==2) index = 10*(Det-1)+Quad+5*Res; // ZN1, ZP1
- else if(Det==3) index = 10*(Det-1)+(Quad-1)+Res; // ZEM
- else if(Det==4|| Det==5) index = 10*(Det-2)+Quad+5*Res+4; // ZN2, ZP2
+ if(Quad!=5){
+ if(Det==1 || Det==2) index = 10*(Det-1)+Quad+5*Res; // ZN1, ZP1
+ else if(Det==3) index = 10*(Det-1)+(Quad-1)+Res; // ZEM
+ else if(Det==4 || Det==5) index = 10*(Det-2)+Quad+5*Res+4; // ZN2, ZP2
+ }
+ else index = 10*(Quad-1)+(Det-1)*1/3+2*Res+4; // Reference PMs
//
//
meanPed = CalibData->GetMeanPed(index);
SetName(calibda.GetName());
SetTitle(calibda.GetName());
Reset();
- for(int t=0; t<47; t++){
+ for(int t=0; t<48; t++){
fMeanPedestal[t] = calibda.GetMeanPed(t);
fMeanPedWidth[t] = calibda.GetMeanPedWidth(t);
fOOTPedestal[t] = calibda.GetOOTPed(t);
SetName(calibda.GetName());
SetTitle(calibda.GetName());
Reset();
- for(int t=0; t<47; t++){
+ for(int t=0; t<48; t++){
fMeanPedestal[t] = calibda.GetMeanPed(t);
fMeanPedWidth[t] = calibda.GetMeanPedWidth(t);
fOOTPedestal[t] = calibda.GetOOTPed(t);
void AliZDCCalibData::Reset()
{
// Reset
- memset(fMeanPedestal,0,47*sizeof(Float_t));
- memset(fMeanPedWidth,0,47*sizeof(Float_t));
- memset(fOOTPedestal,0,47*sizeof(Float_t));
- memset(fOOTPedWidth,0,47*sizeof(Float_t));
+ memset(fMeanPedestal,0,48*sizeof(Float_t));
+ memset(fMeanPedWidth,0,48*sizeof(Float_t));
+ memset(fOOTPedestal,0,48*sizeof(Float_t));
+ memset(fOOTPedWidth,0,48*sizeof(Float_t));
memset(fEnCalibration,0,6*sizeof(Float_t));
}
{
// Printing of calibration object
printf("\n ####### In-time pedestal values (mean value, sigma) ####### \n");
- for(int t=0; t<47; t++){
+ for(int t=0; t<48; t++){
if(t==0 || t==24) printf("\n-------- ZN1 HighRes -------- \n");
else if(t==5 || t==29) printf("\n-------- ZN1 LowRes -------- \n");
else if(t==10 || t==34) printf("\n-------- ZP1 HighRes -------- \n");
}
//
printf("\n\n ####### Out-of-time pedestal values (mean value, sigma) ####### \n");
- for(int t=0; t<47; t++){
+ for(int t=0; t<48; t++){
if(t==0 || t==24) printf("\n-------- ZN1 HighRes -------- \n");
else if(t==5 || t==29) printf("\n-------- ZN1 LowRes -------- \n");
else if(t==10 || t==34) printf("\n-------- ZP1 HighRes -------- \n");
//________________________________________________________________
void AliZDCCalibData::SetMeanPed(Float_t* MeanPed)
{
- if(MeanPed) for(int t=0; t<47; t++) fMeanPedestal[t] = MeanPed[t];
- else for(int t=0; t<47; t++) fMeanPedestal[t] = 0.;
+ if(MeanPed) for(int t=0; t<48; t++) fMeanPedestal[t] = MeanPed[t];
+ else for(int t=0; t<48; t++) fMeanPedestal[t] = 0.;
}
//________________________________________________________________
void AliZDCCalibData::SetMeanPedWidth(Float_t* MeanPedWidth)
{
- if(MeanPedWidth) for(int t=0; t<47; t++) fMeanPedWidth[t] = MeanPedWidth[t];
- else for(int t=0; t<47; t++) fMeanPedWidth[t] = 0.;
+ if(MeanPedWidth) for(int t=0; t<48; t++) fMeanPedWidth[t] = MeanPedWidth[t];
+ else for(int t=0; t<48; t++) fMeanPedWidth[t] = 0.;
}
//________________________________________________________________
void AliZDCCalibData::SetOOTPed(Float_t* OOTPed)
{
- if(OOTPed) for(int t=0; t<47; t++) fOOTPedestal[t] = OOTPed[t];
- else for(int t=0; t<47; t++) fOOTPedestal[t] = 0.;
+ if(OOTPed) for(int t=0; t<48; t++) fOOTPedestal[t] = OOTPed[t];
+ else for(int t=0; t<48; t++) fOOTPedestal[t] = 0.;
}
//________________________________________________________________
void AliZDCCalibData::SetOOTPedWidth(Float_t* OOTPedWidth)
{
- if(OOTPedWidth) for(int t=0; t<47; t++) fOOTPedWidth[t] = OOTPedWidth[t];
- else for(int t=0; t<47; t++) fOOTPedWidth[t] = 0.;
+ if(OOTPedWidth) for(int t=0; t<48; t++) fOOTPedWidth[t] = OOTPedWidth[t];
+ else for(int t=0; t<48; t++) fOOTPedWidth[t] = 0.;
}
//________________________________________________________________
// Set coefficients for pedestal correlations
if(PedCorrCoeff){
for(Int_t j=0; j<2; j++){
- for(int t=0; t<47; t++)
+ for(int t=0; t<48; t++)
fPedCorrCoeff[j][t] = PedCorrCoeff[t];
}
}
else{
for(Int_t j=0; j<2; j++){
- for(int t=0; t<47; t++)
+ for(int t=0; t<48; t++)
fPedCorrCoeff[j][t] = 0.;
}
}
{
// Set coefficients for pedestal correlations
if(PedCorrCoeff0 && PedCorrCoeff1){
- for(int t=0; t<47; t++){
+ for(int t=0; t<48; t++){
fPedCorrCoeff[0][t] = PedCorrCoeff0[t];
fPedCorrCoeff[0][t] = PedCorrCoeff1[t];
}
}
else{
- for(int t=0; t<47; t++){
+ for(int t=0; t<48; t++){
fPedCorrCoeff[0][t] = 0.;
fPedCorrCoeff[1][t] = 0.;
}
// Execute digitization
// ------------------------------------------------------------
- // !!! 2nd ZDC set added (needed for trigger purposes!)
+ // !!! 2nd ZDC set added
// *** 1st 3 arrays are digits from REAL (simulated) hits
// *** last 2 are copied from simulated digits
// --- pm[0][...] = light in ZN right [C, Q1, Q2, Q3, Q4]
new(pdigit) AliZDCDigit(sectorL, digiL);
treeD->Fill();
}
- //
- //printf("\t AliZDCDigitizer -> TreeD has %d entries\n",(Int_t) treeD->GetEntries());
}
+ } // Loop over detector
+ // Adding in-time digits for 2 reference PTM signals (after signal ch.)
+ // (for the moment the ref. signal is completely invented assuming a PMgain of 5*10^4!)
+ Int_t sectorRef[2];
+ sectorRef[1] = 5;
+ Int_t sigRef[2] = {100, 800};
+ for(Int_t iref=0; iref<2; iref++){
+ sectorRef[0] = 3*iref+1;
+ for(Int_t res=0; res<2; res++){
+ sigRef[res] += Pedestal(sectorRef[0], sectorRef[1], res);
+ }
+ /*printf("\t RefDigit added -> det = %d, quad = %d - digi[0,1] = [%d, %d]\n",
+ sectorRef[0], sectorRef[1], sigRef[0], sigRef[1]); // Chiara debugging!
+ */
+ new(pdigit) AliZDCDigit(sectorRef, sigRef);
+ treeD->Fill();
}
//
// --- Adding digits for out-of-time channels after signal digits
treeD->Fill();
}
//
- //printf("\t AliZDCDigitizer -> TreeD has %d entries\n",(Int_t) treeD->GetEntries());
}
}
+ // Adding out-of-time digits for 2 reference PTM signals (after out-of-time ch.)
+ Int_t sigRefoot[2];
+ for(Int_t iref=0; iref<2; iref++){
+ sectorRef[0] = 3*iref+1;
+ for(Int_t res=0; res<2; res++){
+ sigRefoot[res] = Pedestal(sectorRef[0], sectorRef[1], res);
+ }
+ /*printf("\t RefDigitoot added -> det = %d, quad = %d - digi[0,1] = [%d, %d]\n",
+ sectorRef[0], sectorRef[1], sigRefoot[0], sigRefoot[1]); // Chiara debugging!
+ */
+ new(pdigit) AliZDCDigit(sectorRef, sigRefoot);
+ treeD->Fill();
+
+ }
+ //printf("\t AliZDCDigitizer -> TreeD has %d entries\n",(Int_t) treeD->GetEntries());
+
// write the output tree
loader->WriteDigits("OVERWRITE");
loader->UnloadDigits();
if(fIsCalibration == 0){
Float_t meanPed, Pedwidth;
Int_t index=0;
- if(Det==1|| Det==2) index = 10*(Det-1)+Quad+5*Res; // ZN1, ZP1
- else if(Det==3) index = 10*(Det-1)+(Quad-1)+Res; // ZEM
- else if(Det==4|| Det==5) index = 10*(Det-2)+Quad+5*Res+4; // ZN2, ZP2
+ if(Quad!=5){
+ if(Det==1 || Det==2) index = 10*(Det-1)+Quad+5*Res; // ZN1, ZP1
+ else if(Det==3) index = 10*(Det-1)+(Quad-1)+Res; // ZEM
+ else if(Det==4 || Det==5) index = 10*(Det-2)+Quad+5*Res+4; // ZN2, ZP2
+ }
+ else index = 10*(Quad-1)+(Det-1)*1/3+2*Res+4; // Reference PMs
+ //
meanPed = fCalibData->GetMeanPed(index);
Pedwidth = fCalibData->GetMeanPedWidth(index);
PedValue = gRandom->Gaus(meanPed,Pedwidth);
//
/*printf("\t Pedestal -> det = %d, quad = %d, res = %d - Ped[%d] = %d\n",
- Det, Quad, index,(Int_t) PedValue); // Chiara debugging!
+ Det, Quad, Res, index,(Int_t) PedValue); // Chiara debugging!
*/
}
-
// To create calibration object
- else PedValue = gRandom->Gaus((40.+10.*gRandom->Rndm()),5.);
-
+ else{
+ if(Res == 0) PedValue = gRandom->Gaus((35.+10.*gRandom->Rndm()),(0.5+0.2*gRandom->Rndm())); //High gain
+ else PedValue = gRandom->Gaus((250.+100.*gRandom->Rndm()),(3.5+2.*gRandom->Rndm())); //Low gain
+ }
return (Int_t) PedValue;
}
/* $Id$ */
///////////////////////////////////////////////////////////////////////////////
-///
-/// This class provides access to ZDC digits in raw data.
-///
-/// It loops over all ZDC digits in the raw data given by the AliRawReader.
-/// The Next method goes to the next digit. If there are no digits left
-/// it returns kFALSE.
-/// Getters provide information about the current digit.
-///
+// //
+// This class provides access to ZDC digits in raw data. //
+// //
+// It loops over all ZDC digits in the raw data given by the AliRawReader. //
+// The Next method goes to the next digit. If there are no digits left //
+// it returns kFALSE. //
+// Getters provide information about the current digit. //
+// //
///////////////////////////////////////////////////////////////////////////////
#include "AliZDCRawStream.h"
AliZDCRawStream::AliZDCRawStream(AliRawReader* rawReader) :
fRawReader(rawReader),
fRawADC(0),
- fADCModule(-1),
+ fADCModule(0),
fADCValue(-1),
fADCGain(0)
{
if(!fRawReader->ReadNextInt((UInt_t&) fRawADC)) return kFALSE;
fIsADCDataWord = kFALSE;
- //ADC Header
- if(fRawADC & 0x2000000){
- if(((fRawADC & 0x3f00) >> 8) == 24) fADCModule=1; //fRawADC=2001800 -> 24 words -> 1st ADC module
- else if(((fRawADC & 0x3f00) >> 8) == 20) fADCModule=2; //fRawADC=2001400 -> 20 words -> 2nd ADC module
- //
- //printf(" **** This is the ADC Header - %d data words will follow \n",((fRawADC & 0x3f00) >> 8));
- //printf(" fRawADC = %x, fADCModule = %d\n",fRawADC, fADCModule);
+ if(fRawADC & 0x2000000){//ADC Header
+ fADCModule++;
+ //printf(" \t AliZDCRawStream -> Header ADC %d -> ADC datum contains %d data words \n",fADCModule,((fRawADC & 0x3f00) >> 8));
}
- else if((fRawADC & 0x4000000) || (fRawADC & 0x3000000)){
- fSector[0] = 0;
- //ADC EOB
- /*if(fRawADC & 0x4000000){
- printf(" **** This is the ADC End Of Block - event number %d\n",(fRawADC & 0xffffff));
- }*/
+ else if((fRawADC & 0x4000000)){//ADC EOB
+ //printf(" \t AliZDCRawStream -> ADC %d End Of Block - event number %d\n\n",fADCModule, (fRawADC & 0xffffff));
+ fSector[0] = fSector[1] = 99;
}
- //ADC Data Words
- else{
- /*printf("This is an ADC Data Word -> channel %d range %d\n",(fRawADC & 0x1e0000) >> 17, (fRawADC & 0x10000) >> 16);
- if(fRawADC & 0x1000) printf("ZDCRawStream -> ADC overflow\n");
- if(fRawADC & 0x2000) printf("ZDCRawStream -> ADC underflow\n");*/
- //
- fADCGain = (fRawADC & 0x10000) >> 16;
- fADCValue = (fRawADC & 0xfff);
+ else if((fRawADC & 0x6000000)){//Not valid datum
+ printf(" \t AliZDCRawStream -> Not valid datum in ADC module %d\n",fADCModule);
+ }
+ else{//ADC data word
fIsADCDataWord = kTRUE;
- //
- Int_t vADCChannel = (fRawADC & 0x1e0000) >> 17;
- if(fADCModule==1){ //1st ADC module
- if(vADCChannel >= 0 && vADCChannel <= 4){
- fSector[0] = 1;
- fSector[1] = vADCChannel;
- }
- else if(vADCChannel >= 8 && vADCChannel <= 12){
- fSector[0] = 2;
- fSector[1] = vADCChannel-8;
- }
- else if(vADCChannel == 5 || vADCChannel == 13){
- fSector[0] = 3;
- fSector[1] = ((vADCChannel-5)/8)+1;
+ //printf(" \t \t ADC Data Word");
+ if(!(fRawADC & 0x1000) && !(fRawADC & 0x2000)){ // Valid ADC data
+ fADCGain = (fRawADC & 0x10000) >> 16;
+ fADCValue = (fRawADC & 0xfff);
+ //
+ Int_t vADCChannel = (fRawADC & 0x1e0000) >> 17;
+ if(fADCModule==1 || fADCModule==3){ //1st & 3rd ADC modules
+ if(vADCChannel >= 0 && vADCChannel <= 4){
+ fSector[0] = 1; // ZN1
+ fSector[1] = vADCChannel;
+ }
+ else if(vADCChannel >= 8 && vADCChannel <= 12){
+ fSector[0] = 2; // ZP1
+ fSector[1] = vADCChannel-8;
+ }
+ else if(vADCChannel == 5 || vADCChannel == 13){
+ fSector[0] = 3; // ZEM 1,2
+ fSector[1] = ((vADCChannel-5)/8)+1;
+ }
}
+ else if(fADCModule==2 || fADCModule==4){ //2nd & 4rth ADC modules
+ if(vADCChannel >= 0 && vADCChannel <= 4){
+ fSector[0] = 4; // ZN2
+ fSector[1] = vADCChannel;
+ }
+ else if(vADCChannel >= 8 && vADCChannel <= 12){
+ fSector[0] = 5; // ZP2
+ fSector[1] = vADCChannel-8;
+ }
+ else if(vADCChannel == 5 || vADCChannel == 13){
+ fSector[0] = (vADCChannel-5)/8+1; // PM Ref 1,2
+ fSector[1] = 5;
+ }
+ }
+ else{
+ AliWarning(" \t AliZDCRawStream -> No valid ADC module!");
+ printf(" ADCmod = %d\n", fADCModule);
+ fRawReader->AddMajorErrorLog(kInvalidADCModule);
+ }
+ /*printf(" \t \tADC %d ch %d range %d -> det %d quad %d value %x\n",
+ fADCModule, vADCChannel, fADCGain, fSector[0], fSector[1], fADCValue);//Chiara debugging
+ */
}
- else if(fADCModule==2){ //2nd ADC module
- if(vADCChannel >= 0 && vADCChannel <= 4){
- fSector[0] = 4;
- fSector[1] = vADCChannel;
- }
- else if(vADCChannel >= 8 && vADCChannel <= 12){
- fSector[0] = 5;
- fSector[1] = vADCChannel-8;
- }
- }
- else {
- AliWarning("No valid ADC module!");
- fRawReader->AddMajorErrorLog(kInvalidADCModule);
- }
-
+ else if(fRawADC & 0x1000)
+ printf(" \t \tADC %d ch %d range %d overflow\n",fADCModule, (fRawADC & 0x1e0000) >> 17, fADCGain); // Overflow
+ else if(fRawADC & 0x2000)
+ printf(" \t \tADC %d ch %d range %d underflow\n",fADCModule, (fRawADC & 0x1e0000) >> 17, fADCGain); // Underflow
}
+
return kTRUE;
}