fScTS(0),
fScTriggerNumber(0),
fIsScEventGood(kFALSE),
- fNChannelsOn(48),
+ fNChannelsOn(0),
fNConnCh(-1),
fCabledSignal(-1)
{
fRawReader->Reset();
fRawReader->Select("ZDC");
//
- for(Int_t i=0; i<fNChannelsOn; i++){
+ const int kNch = 48;
+ for(Int_t i=0; i<kNch; i++){
for(Int_t j=0; j<5; j++) fMapADC[i][j]=-1;
}
fCabledSignal(stream.GetCabledSignal())
{
// Copy constructor
+ const int kNch = 48;
for(Int_t j=0; j<2; j++) fSector[j] = stream.GetSector(j);
- for(Int_t i=0; i<fNChannelsOn; i++){
+ for(Int_t i=0; i<kNch; i++){
for(Int_t j=0; j<5; j++) fMapADC[i][j] = stream.fMapADC[i][j];
}
}
void AliZDCRawStream::ReadChMap()
{
// Reading channel map
- printf("\n\t Reading ADC mapping from OCDB\n");
+ const int kNch = 48;
+ printf("\n\t Reading ZDC ADC mapping from OCDB\n");
AliZDCChMap * chMap = GetChMap();
//chMap->Print("");
- for(Int_t i=0; i<fNChannelsOn; i++){
+ for(Int_t i=0; i<kNch; i++){
fMapADC[i][0] = chMap->GetADCModule(i);
fMapADC[i][1] = chMap->GetADCChannel(i);
fMapADC[i][2] = -1;
UChar_t message = header->GetAttributes();
//printf("\t AliZDCRawStream::ReadCDHHeader -> Attributes %x\n",message);
- if(message & 0x10){ // COSMIC RUN
+ if(message & 0x0){ // PHYSICS RUN
+ //printf("\t PHYSICS RUN raw data found\n");
+ }
+ else if(message & 0x10){ // COSMIC RUN
//printf("\t STANDALONE_COSMIC RUN raw data found\n");
}
else if(message & 0x20){ // PEDESTAL RUN
else if(message & 0x30){ // LASER RUN
//printf("\t STANDALONE_LASER RUN raw data found\n");
}
+ else if(message & 0x40){ // CALIBRATION_CENTRAL RUN
+ //printf("\t CALIBRATION_CENTRAL RUN raw data found\n");
+ }
+ else if(message & 0x50){ // CALIBRATION_SEMICENTRAL
+ //printf("\t CALIBRATION_SEMICENTRAL RUN raw data found\n");
+ }
+ else if(message & 0x60){ // CALIBRATION_MB
+ //printf("\t CALIBRATION_MB RUN raw data found\n");
+ }
+ else if(message & 0x70){ // CALIBRATION_EMD
+ //printf("\t CALIBRATION_EMD RUN raw data found\n");
+ }
if(header->GetL1TriggerMessage() & 0x1){ // Calibration bit set in CDH
fIsCalib = kTRUE;
// Returns kFALSE if there is no digit left
if(!fRawReader->ReadNextInt((UInt_t&) fBuffer)) return kFALSE;
+ const int kNch = 48;
+ Bool_t readScaler = kFALSE;
fIsChMapping = kFALSE; fIsADCHeader = kFALSE;
fIsADCDataWord = kFALSE; fIsADCEOB = kFALSE;
fIsUnderflow = kFALSE;
fIsOverflow = kFALSE;
- fSector[0]=fSector[1] = -1;
+ fSector[0] = fSector[1] = -1;
fEvType = fRawReader->GetType();
+ // CH. debug
//printf("\n\t AliZDCRawStream::Next() -> ev. type %d\n",fEvType);
//printf("\n AliZDCRawStream::Next() - fBuffer[%d] = %x\n",fPosition, fBuffer);
if(fIsCalib){
fDeadfaceOffset = 9;
fDeadbeefOffset = 25;
+ readScaler = kTRUE;
}
else{
fDeadfaceOffset = 1;
fNConnCh=0;
}
else{
- printf("\n\t AliZDCRawStream -> End of ZDC StartOfData event\n\n");
+ //printf("\n\t AliZDCRawStream -> End of ZDC StartOfData event\n\n");
//printf("AliZDCRawStream: fSODReading after SOD reading set to %d\n", fSODReading);
return kFALSE;
}
else if(fCabledSignal==23 || fCabledSignal==47) fMapADC[fNConnCh][4]=2;
}
//
- //if(fNConnCh<fNChannelsOn) printf(" %d mod %d ch %d code %d det %d sec %d\n",
- // fNConnCh,fADCModule,fADCChannel,fBuffer&0xffff,fMapADC[fNConnCh][3],fMapADC[fNConnCh][4]);
- //
fNConnCh++;
- if(fNConnCh>=fNChannelsOn){
- // Protection manually set since it returns:
+ if(fNConnCh>=kNch){
+ // Protection manually set since it returned:
// RawData48 mod. 3 ch. 2048 signal 515
// to be checked with Pietro!!!!!!!!!!!!!!!!!!!!!!!
- //AliDebug(2," No. of cabled channels > fNChannelsOn!!!");
+ AliDebug(2," No. of cabled channels > kNch !!!");
fPosition++;
return kTRUE;
}
}
}// ModType=1 (ADC mapping)
+ //else if(fModType!=1){
+
+ //}
}
fPosition++;
return kTRUE;
// there MUST be a NOT valid datum before the event!!!
if(fPosition==fDataOffset){
//printf("\t **** ZDC data begin ****\n");
- if((fBuffer & 0x07000000) == 0x06000000){
+ if((fBuffer & 0x07000000) != 0x06000000){
+ fRawReader->AddMajorErrorLog(kZDCDataError);
+ }
+ /*else{
//printf(" AliZDCRawStream -> Not valid datum in ADC %d,"
// "position %d in word data buffer\n",fADCModule,fPosition);
- }
- else fRawReader->AddMajorErrorLog(kZDCDataError);
+ }*/
}
// If the not valid datum isn't followed by the 1st ADC header
}
}
- // Get geo address of current word to determine
- // if it is a scaler word (geo address == kScalerAddress)
- // if it is an ADC word (geo address != 8)
+ // Get geo address of current word to determine if:
+ // - it is a scaler word (geo address == kScalerAddress)
+ // - it is an ADC word (geo address <= 3)
Int_t kScalerAddress=8;
fADCModule = ((fBuffer & 0xf8000000)>>27);
if(fADCModule == kScalerAddress){
DecodeScaler();
}
- else{//ADC module
+ else if(fADCModule>=0 && fADCModule<=3){//ADC modules (0,1,2,3)
// *** ADC header
if((fBuffer & 0x07000000) == 0x02000000){
fIsADCHeader = kTRUE;
fADCNChannels = ((fBuffer & 0x00003f00)>>8);
- //printf(" AliZDCRawStream -> HEADER: ADC mod.%d has %d ch. \n",fADCModule,fADCNChannels);
+ if(fADCModule==0) fNChannelsOn = fADCNChannels;
+ else fNChannelsOn += fADCNChannels;
+ //printf(" AliZDCRawStream -> ADC HEADER: mod.%d has %d ch. \n",fADCModule,fADCNChannels);
}
// *** ADC data word
else if((fBuffer & 0x07000000) == 0x00000000){
return kFALSE;
}
//
- /*for(Int_t ci=0; ci<fNChannelsOn; ci++){
+ /*for(Int_t ci=0; ci<kNch; ci++){
printf(" %d mod %d ch %d det %d sec %d\n",ci,fMapADC[ci][0],
fMapADC[ci][1], fMapADC[ci][3], fMapADC[ci][4]);
}*/
// Scan of the map to assign the correct volumes
Int_t foundMapEntry = kFALSE;
- for(Int_t k=0; k<fNChannelsOn; k++){
+ for(Int_t k=0; k<kNch; k++){
if(fADCModule==fMapADC[k][0] && fADCChannel==fMapADC[k][1]){
fSector[0] = fMapADC[k][3];
fSector[1] = fMapADC[k][4];
Int_t GetADCSignFromMap(Int_t i) const {return fMapADC[i][2];}
Int_t GetDetectorFromMap(Int_t i) const {return fMapADC[i][3];}
Int_t GetTowerFromMap(Int_t i) const {return fMapADC[i][4];}
-
+
+ Bool_t IsCalibration() const {return fIsCalib;}
Bool_t IsDARCHeader() const {return fIsDARCHeader;}
Bool_t IsChMapping() const {return fIsChMapping;}
Bool_t IsADCDataWord() const {return fIsADCDataWord;}
fNRun(0),
fIsCalibrationMB(kFALSE),
fPedSubMode(0),
- fRecoFlag(0x0)
+ fRecoFlag(0x0),
+ fSignalThreshold(0)
{
// **** Default constructor
}
//_____________________________________________________________________________
-void AliZDCReconstructor::Reconstruct(TTree* digitsTree, TTree* clustersTree) const
+void AliZDCReconstructor::Reconstruct(TTree* digitsTree, TTree* clustersTree)
{
// *** Local ZDC reconstruction for digits
// Works on the current event
printf(" LGChain -> RawDig %d DigCorr %1.2f\n", digit.GetADCValue(1), digit.GetADCValue(1)-ped2SubLg);
*/
}//digits loop
+
+ // Setting reco flags (part II)
+ Float_t sumZNAhg=0, sumZPAhg=0, sumZNChg=0, sumZPChg=0;
+ for(Int_t jj=0; jj<5; jj++){
+ sumZNAhg += tZN2Corr[jj];
+ sumZPAhg += tZP2Corr[jj];
+ sumZNChg += tZN1Corr[jj];
+ sumZPChg += tZP1Corr[jj];
+ }
+ if(sumZNAhg>fSignalThreshold) fRecoFlag = 0x1;
+ if(sumZPAhg>fSignalThreshold) fRecoFlag = 0x1 << 1;
+ if(dZEM1Corr[0]>fSignalThreshold) fRecoFlag = 0x1 << 2;
+ if(dZEM2Corr[0]>fSignalThreshold) fRecoFlag = 0x1 << 3;
+ if(sumZNChg>fSignalThreshold) fRecoFlag = 0x1 << 4;
+ if(sumZPChg>fSignalThreshold) fRecoFlag = 0x1 << 5;
// If CALIBRATION_MB run build the RecoParam object
if(fIsCalibrationMB){
// *** ZDC raw data reconstruction
// Works on the current event
+ Bool_t storeADC = kTRUE;
+
// Retrieving calibration data
// Parameters for pedestal subtraction
int const kNch = 24;
fNRun = (Int_t) rawReader->GetRunNumber();
AliZDCRawStream rawData(rawReader);
while(rawData.Next()){
- // Do
- Bool_t ch2process = kTRUE;
- //
- // Setting reco flags (part I)
- if((rawData.IsADCDataWord()) && (rawData.IsUnderflow() == kTRUE)){
- fRecoFlag = 0x1<< 8;
- ch2process = kFALSE;
- }
- if((rawData.IsADCDataWord()) && (rawData.IsOverflow() == kTRUE)){
- fRecoFlag = 0x1 << 7;
- ch2process = kFALSE;
- }
- if(rawData.GetNChannelsOn() < 48 ) fRecoFlag = 0x1 << 6;
-
- if((rawData.IsADCDataWord()) && (ch2process == kTRUE)){
+ if(rawData.IsCalibration() == kFALSE){ // Reading scalers
+ Bool_t ch2process = kTRUE;
+ //
+ // Setting reco flags (part I)
+ if((rawData.IsADCDataWord()) && (rawData.IsUnderflow() == kTRUE)){
+ fRecoFlag = 0x1<< 8;
+ ch2process = kFALSE;
+ }
+ if((rawData.IsADCDataWord()) && (rawData.IsOverflow() == kTRUE)){
+ fRecoFlag = 0x1 << 7;
+ ch2process = kFALSE;
+ }
+ if(rawData.GetNChannelsOn() < 48 ) fRecoFlag = 0x1 << 6;
+
+ if((rawData.IsADCDataWord()) && (ch2process == kTRUE)){
- Int_t adcMod = rawData.GetADCModule();
- Int_t det = rawData.GetSector(0);
- Int_t quad = rawData.GetSector(1);
- Int_t gain = rawData.GetADCGain();
- Int_t pedindex=0;
- //
- // Mean pedestal value subtraction -------------------------------------------------------
- if(fPedSubMode == 0){
+ Int_t adcMod = rawData.GetADCModule();
+ Int_t det = rawData.GetSector(0);
+ Int_t quad = rawData.GetSector(1);
+ Int_t gain = rawData.GetADCGain();
+ Int_t pedindex=0;
+ //
+ // Mean pedestal value subtraction -------------------------------------------------------
+ if(fPedSubMode == 0){
// Not interested in o.o.t. signals (ADC modules 2, 3)
if(adcMod == 2 || adcMod == 3) return;
//
printf(" -> AliZDCReconstructor: RawADC %1.0f ADCCorr %1.0f\n",
rawData.GetADCValue(), rawData.GetADCValue()-meanPed[pedindex]);*/
- }// mean pedestal subtraction
- // Pedestal subtraction from correlation ------------------------------------------------
- else if(fPedSubMode == 1){
+ }// mean pedestal subtraction
+ // Pedestal subtraction from correlation ------------------------------------------------
+ else if(fPedSubMode == 1){
// In time signals
if(adcMod==0 || adcMod==1){
if(quad != 5){ // signals from ZDCs
else pmRefootlg[quad-1] = rawData.GetADCValue();
}
}
- } // pedestal subtraction from correlation
- // Ch. debug
- //printf("\t AliZDCReconstructor - det %d quad %d res %d -> Ped[%d] = %1.0f\n",
- // det,quad,gain, pedindex, meanPed[pedindex]);
- }//IsADCDataWord
+ } // pedestal subtraction from correlation
+ // Ch. debug
+ //printf("\t AliZDCReconstructor - det %d quad %d res %d -> Ped[%d] = %1.0f\n",
+ // det,quad,gain, pedindex, meanPed[pedindex]);
+ }//IsADCDataWord
+ }// Not raw data from calibration run!
+ else{
+ }
}//loop on raw data
if(fPedSubMode==1){
sumZNChg += tZN1Corr[jj];
sumZPChg += tZP1Corr[jj];
}
- if(sumZNAhg>0.) fRecoFlag = 0x1;
- if(sumZPAhg>0.) fRecoFlag = 0x1 << 1;
- if(dZEM1Corr[0]>0.) fRecoFlag = 0x1 << 2;
- if(dZEM2Corr[0]>0.) fRecoFlag = 0x1 << 3;
- if(sumZNChg>0.) fRecoFlag = 0x1 << 4;
- if(sumZPChg>0.) fRecoFlag = 0x1 << 5;
+ if(sumZNAhg>fSignalThreshold) fRecoFlag = 0x1;
+ if(sumZPAhg>fSignalThreshold) fRecoFlag = 0x1 << 1;
+ if(dZEM1Corr[0]>fSignalThreshold) fRecoFlag = 0x1 << 2;
+ if(dZEM2Corr[0]>fSignalThreshold) fRecoFlag = 0x1 << 3;
+ if(sumZNChg>fSignalThreshold) fRecoFlag = 0x1 << 4;
+ if(sumZPChg>fSignalThreshold) fRecoFlag = 0x1 << 5;
// If CALIBRATION_MB run build the RecoParam object
if(fIsCalibrationMB){
/* $Id$ */
-///////////////////////////////////////////////////////////////////////////////
-// //
-// class for ZDC reconstruction //
-// //
-///////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////
+// //
+// class for ZDC reconstruction //
+// //
+/////////////////////////////////////////////
#include "AliReconstructor.h"
#include "AliCDBManager.h"
virtual void Init();
virtual Bool_t HasDigitConversion() const {return kFALSE;};
- virtual void Reconstruct(TTree* digitsTree, TTree* clustersTree) const;
+ virtual void Reconstruct(TTree* digitsTree, TTree* clustersTree);
virtual void Reconstruct(AliRawReader* rawReader, TTree* clustersTree);
virtual void FillESD(TTree* /*digitsTree*/, TTree* clustersTree, AliESDEvent* esd) const
void SetPedSubMode(Int_t pedsubMode) {fPedSubMode=pedsubMode;}
Int_t GetPedSubMode() {return fPedSubMode;}
+ void SetSignalThreshold(Float_t val) {fSignalThreshold=val;}
+ Float_t GetSignalThreshold() {return fSignalThreshold;}
+
// OCDB objects for reconstruction
AliCDBStorage *SetStorage(const char* uri);
AliZDCPedestals *GetPedData() const;
Bool_t fIsCalibrationMB; // true if run type = "CALIBRATION_MB"
Int_t fPedSubMode; // =0->mean values, =1->from correlations
UInt_t fRecoFlag; // flag indicating problems in reco
+ Float_t fSignalThreshold; // Threshold value for "triggering" in p-p
- ClassDef(AliZDCReconstructor, 7) // class for the ZDC reconstruction
+ ClassDef(AliZDCReconstructor, 8) // class for the ZDC reconstruction
};
#endif