]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Updates
authorcoppedis <coppedis@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 3 Jul 2009 09:41:24 +0000 (09:41 +0000)
committercoppedis <coppedis@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 3 Jul 2009 09:41:24 +0000 (09:41 +0000)
ZDC/AliZDCRawStream.cxx
ZDC/AliZDCRawStream.h
ZDC/AliZDCReconstructor.cxx
ZDC/AliZDCReconstructor.h

index 047bd6029a3db4a41a6a7c4926e905c805be81a9..b785855a2dae07edf2e5a5187fe2154d2d0f605c 100644 (file)
@@ -68,7 +68,7 @@ AliZDCRawStream::AliZDCRawStream(AliRawReader* rawReader) :
   fScTS(0),      
   fScTriggerNumber(0),
   fIsScEventGood(kFALSE),
-  fNChannelsOn(48),
+  fNChannelsOn(0),
   fNConnCh(-1),
   fCabledSignal(-1)
 {
@@ -76,7 +76,8 @@ AliZDCRawStream::AliZDCRawStream(AliRawReader* rawReader) :
   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;
   }
 
@@ -120,8 +121,9 @@ AliZDCRawStream::AliZDCRawStream(const AliZDCRawStream& stream) :
   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];
   }
 }
@@ -146,10 +148,11 @@ AliZDCRawStream::~AliZDCRawStream()
 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;
@@ -178,7 +181,10 @@ void AliZDCRawStream::ReadCDHHeader()
     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
@@ -187,6 +193,18 @@ void AliZDCRawStream::ReadCDHHeader()
     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;
@@ -251,13 +269,16 @@ Bool_t AliZDCRawStream::Next()
   // 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);
   
@@ -285,6 +306,7 @@ Bool_t AliZDCRawStream::Next()
     if(fIsCalib){
       fDeadfaceOffset = 9;
       fDeadbeefOffset = 25;
+      readScaler = kTRUE;
     }
     else{
       fDeadfaceOffset = 1;
@@ -310,7 +332,7 @@ Bool_t AliZDCRawStream::Next()
           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;
        }
@@ -387,20 +409,20 @@ Bool_t AliZDCRawStream::Next()
            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;
@@ -455,11 +477,13 @@ Bool_t AliZDCRawStream::Next()
     // 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
@@ -471,20 +495,22 @@ Bool_t AliZDCRawStream::Next()
       }
     }
      
-    // 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){
@@ -502,14 +528,14 @@ Bool_t AliZDCRawStream::Next()
          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];
index c1cdebb8f8bed92adf8eb9ff30698f4c8e185df2..ba8a73e00a14e9368cbe507066509e6060274c24 100644 (file)
@@ -57,7 +57,8 @@ class AliZDCRawStream: public TObject {
     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;}
index 49fbc724a61c85488c96c0eba108438af915fcc5..a7095f32d91e9725d5c7025db3c3601ba06d6a84 100644 (file)
@@ -61,7 +61,8 @@ AliZDCReconstructor:: AliZDCReconstructor() :
   fNRun(0),
   fIsCalibrationMB(kFALSE),
   fPedSubMode(0),
-  fRecoFlag(0x0)
+  fRecoFlag(0x0),
+  fSignalThreshold(0)
 {
   // **** Default constructor
 
@@ -162,7 +163,7 @@ void AliZDCReconstructor::Init()
 }
 
 //_____________________________________________________________________________
-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
@@ -310,6 +311,21 @@ void AliZDCReconstructor::Reconstruct(TTree* digitsTree, TTree* clustersTree) co
    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){
@@ -338,6 +354,8 @@ void AliZDCReconstructor::Reconstruct(AliRawReader* rawReader, TTree* clustersTr
   // *** ZDC raw data reconstruction
   // Works on the current event
   
+  Bool_t storeADC = kTRUE;
+  
   // Retrieving calibration data  
   // Parameters for pedestal subtraction
   int const kNch = 24;
@@ -379,30 +397,30 @@ void AliZDCReconstructor::Reconstruct(AliRawReader* rawReader, TTree* clustersTr
   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;
        //
@@ -456,9 +474,9 @@ void AliZDCReconstructor::Reconstruct(AliRawReader* rawReader, TTree* clustersTr
        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
@@ -517,11 +535,14 @@ void AliZDCReconstructor::Reconstruct(AliRawReader* rawReader, TTree* clustersTr
             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){
@@ -588,12 +609,12 @@ void AliZDCReconstructor::Reconstruct(AliRawReader* rawReader, TTree* clustersTr
     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){
index 804e419b3c4c838fb1dc01bcca01619734b7eb1d..efb41cfe0edc9ee50868143bf649ec5fff163495 100644 (file)
@@ -5,11 +5,11 @@
 
 /* $Id$ */
 
-///////////////////////////////////////////////////////////////////////////////
-//                                                                           //
-// class for ZDC reconstruction                                              //
-//                                                                           //
-///////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////
+//                                        //
+//       class for ZDC reconstruction      //
+//                                        //
+/////////////////////////////////////////////
 
 #include "AliReconstructor.h"
 #include "AliCDBManager.h"
@@ -32,7 +32,7 @@ public:
   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 
@@ -53,6 +53,9 @@ public:
   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; 
@@ -91,8 +94,9 @@ private:
   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