Scaler mapping deoding from SOD event
authorcoppedis <coppedis@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 16 Sep 2009 13:45:04 +0000 (13:45 +0000)
committercoppedis <coppedis@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 16 Sep 2009 13:45:04 +0000 (13:45 +0000)
ZDC/AliZDCChMap.cxx
ZDC/AliZDCChMap.h
ZDC/AliZDCRawStream.cxx
ZDC/AliZDCRawStream.h
ZDC/ZDCEMDda.cxx
ZDC/ZDCLASERda.cxx
ZDC/ZDCMAPPINGda.cxx
ZDC/ZDCPEDESTALda.cxx

index ba708f9..f3f6412 100644 (file)
@@ -46,6 +46,9 @@ TNamed()
     fADCChannel[i] = 0;
     fDetector[i] = 0;
     fSector[i] = 0;
+    fScalerChannel[i] = 0;
+    fScDetector[i] = 0;
+    fScSector[i] = 0;
   }
   
   
@@ -64,6 +67,11 @@ AliZDCChMap::AliZDCChMap(const AliZDCChMap& calibda) :
      fADCChannel[t] = calibda.GetADCChannel(t);
      fDetector[t]   = calibda.GetDetector(t);
      fSector[t]     = calibda.GetSector(t);
+     if(t<32){
+       fScalerChannel[t] = calibda.GetScChannel(t);
+       fScDetector[t]    = calibda.GetScDetector(t);
+       fScSector[t]      = calibda.GetScSector(t);
+     }
   }
 }
 
@@ -79,6 +87,11 @@ AliZDCChMap &AliZDCChMap::operator =(const AliZDCChMap& calibda)
      fADCChannel[t] = calibda.GetADCChannel(t);
      fDetector[t]   = calibda.GetDetector(t);
      fSector[t]     = calibda.GetSector(t);
+     if(t<32){
+       fScalerChannel[t] = calibda.GetScChannel(t);
+       fScDetector[t]    = calibda.GetScDetector(t);
+       fScSector[t]      = calibda.GetScSector(t);
+     }
   }
 
   return *this;
@@ -97,6 +110,9 @@ void AliZDCChMap::Reset()
   memset(fADCChannel,0,48*sizeof(Int_t));
   memset(fDetector,0,48*sizeof(Int_t));
   memset(fSector,0,48*sizeof(Int_t));
+  memset(fScalerChannel,0,32*sizeof(Int_t));
+  memset(fScDetector,0,32*sizeof(Int_t));
+  memset(fScSector,0,32*sizeof(Int_t));
 }                                                                                       
 
 
@@ -106,8 +122,11 @@ void  AliZDCChMap::Print(Option_t *) const
    // Printing of calibration object
    printf("\n\n\t ******************* AliZDCChMap object *******************\n\n");
    for(Int_t i=0; i<48; i++) 
-     printf(" ADCmod. %d ch. %d -> detector %d sector %d\n",
-     fADCModule[i], fADCChannel[i],fDetector[i], fSector[i]);
+     printf(" ADC - mod. %d ch. %d -> detector %d sector %d\n",
+      fADCModule[i], fADCChannel[i],fDetector[i], fSector[i]);
+   for(Int_t i=0; i<32; i++) 
+     printf(" SCALER - ch. %d -> detector %d sector %d\n",
+      fScalerChannel[i],fScDetector[i], fScSector[i]);
    printf("\n\n\t **********************************************************\n\n");
  
 } 
index 276a700..4a77b28 100644 (file)
@@ -7,6 +7,7 @@
 ////////////////////////////////////////////////
 //  Class for ZDC calibration containing      //
 //    the map ADC ch. <-> physics signal      //
+//    the scaler map <-> counted signal       //
 //       needed for reconstruction            //
 ////////////////////////////////////////////////
 
@@ -30,22 +31,36 @@ class AliZDCChMap: public TNamed {
   Int_t GetADCChannel(Int_t i) const {return fADCChannel[i];}
   Int_t GetDetector(Int_t i)   const {return fDetector[i];}
   Int_t GetSector(Int_t i)     const {return fSector[i];}
+  //
+  Int_t GetScChannel(Int_t i)  const {return fScalerChannel[i];}
+  Int_t GetScDetector(Int_t i) const {return fScDetector[i];}
+  Int_t GetScSector(Int_t i)   const {return fScSector[i];}
 
   void  SetADCModule(Int_t i, Int_t mod)  {fADCModule[i] = mod;}
   void  SetADCChannel(Int_t i, Int_t ich) {fADCChannel[i] = ich;}
   void  SetDetector(Int_t i, Int_t ival)  {fDetector[i] = ival;}
   void  SetSector(Int_t i, Int_t ival)    {fSector[i] = ival;}
+  //
+  void  SetScChannel(Int_t i, Int_t ich)   {fScalerChannel[i] = ich;}
+  void  SetScDetector(Int_t i, Int_t ival) {fScDetector[i] = ival;}
+  void  SetScSector(Int_t i, Int_t ival)   {fScSector[i] = ival;}
   
  protected:
+  // ************ ADC ************
   // 22 signal ch. + 2 reference ch.
   // in-time + out-of-time signals
   // -> 48 channels to be mapped
-  Int_t  fADCModule[48];  // ADC module
-  Int_t  fADCChannel[48]; // ADC channel
-  Int_t  fDetector[48];   // detector
-  Int_t  fSector[48];     // sector
+  Int_t  fADCModule[48];     // ADC module
+  Int_t  fADCChannel[48];    // ADC channel
+  Int_t  fDetector[48];      // detector
+  Int_t  fSector[48];        // sector
   //
-  ClassDef(AliZDCChMap,1)    // ZDC pedestal calibration data
+  // ************ VME scaler ************
+  Int_t  fScalerChannel[32]; // Scaler channel
+  Int_t  fScDetector[32];    // detector
+  Int_t  fScSector[32];             // sector
+  
+  ClassDef(AliZDCChMap,2)    // ZDC pedestal calibration data
 };
 
 #endif
index 8b958f2..10f7f01 100644 (file)
@@ -222,7 +222,7 @@ void AliZDCRawStream::ReadChMap()
 {
   // Reading channel map
   const int kNch = 48;
-  //printf("\t Reading ZDC ADC mapping from OCDB\n");
+  AliDebug(2,"\t Reading ZDC ADC mapping from OCDB\n");
   AliZDCChMap * chMap = GetChMap();
   //chMap->Print("");
   for(Int_t i=0; i<kNch; i++){
@@ -246,10 +246,10 @@ void AliZDCRawStream::ReadCDHHeader()
       return;
   }
   else{
-    printf("\t AliZDCRawStream::ReadCDHHeader -> Data Size = %x\n",fRawReader->GetDataSize());
+    //printf("\t AliZDCRawStream::ReadCDHHeader -> Data Size = %x\n",fRawReader->GetDataSize());
 
     UChar_t message = header->GetAttributes();
-    printf("\t AliZDCRawStream::ReadCDHHeader -> Attributes %x\n",message);
+    //printf("\t AliZDCRawStream::ReadCDHHeader -> Attributes %x\n",message);
     
     if(message == 0x0){ // PHYSICS RUN
        //printf("\t PHYSICS RUN raw data found\n");
@@ -280,16 +280,18 @@ void AliZDCRawStream::ReadCDHHeader()
     if((message & 0x08) == 0){  // ** DARC card
        fReadOutCard = 0;
        fIsDARCHeader = kTRUE;
+       AliInfo("\t ZDC readout card used: DARC");
     }
     else if((message & 0x08) == 1){  // ** ZRC card
        fReadOutCard = 1;
+       AliInfo("\t ZDC readout card used: ZRC");
     }
 
     if(header->GetL1TriggerMessage() & 0x1){ // Calibration bit set in CDH
       fIsCalib = kTRUE;
     }
-    printf("\t AliZDCRawStream::ReadCDHHeader -> L1TriggerMessage %x\n",header->GetL1TriggerMessage());
-    printf("\t AliZDCRawStream::ReadCDHHeader -> Calibration bit = %d\n",fIsCalib);    
+    //printf("\t AliZDCRawStream::ReadCDHHeader -> L1TriggerMessage %x\n",header->GetL1TriggerMessage());
+    //printf("\t AliZDCRawStream::ReadCDHHeader -> Calibration bit = %d\n",fIsCalib);    
     
     UInt_t status = header->GetStatus();
     //printf("\t AliZDCRawStream::ReadCDHHeader -> status = %d\n",status);
@@ -359,7 +361,6 @@ Bool_t AliZDCRawStream::Next()
   fEvType = fRawReader->GetType();
   if(fPosition==0){
     //if(fEvType==7 || fEvType ==8){ //Physics or calibration event
-      //ReadEventHeader();
       ReadCDHHeader();
     //}
     fCurrentCh=0; fCurrScCh=0; fNChannelsOn=0;
@@ -372,7 +373,7 @@ Bool_t AliZDCRawStream::Next()
   
   // *** End of ZDC event
   if(fBuffer == 0xcafefade){
-    //printf("\n-> AliZDCRawStream::Next() ***** End of ZDC event *****\n\n");
+    //printf("\n  AliZDCRawStream::Next() ***** End of ZDC event *****\n\n");
     return kFALSE;
   }
   
@@ -418,7 +419,7 @@ Bool_t AliZDCRawStream::Next()
       }
       else if((fBuffer&0xff000002) == 0xff000002){ // ************** Threshold settings
         fPosition++;
-       return kFALSE;
+       return kFALSE; // !!!!!!!!!!!!!!!!!!!!!  For the moment thresholds are not read
       }
       else if((fBuffer&0x80000000)>>31 == 1){ // --- Mapping header
         fIsHeaderMapping = kTRUE;
@@ -432,7 +433,7 @@ Bool_t AliZDCRawStream::Next()
        fADCChannel = ((fBuffer & 0x3fff0000)>>16);
        fCabledSignal = (fBuffer&0xffff);
         //
-       if(fModType==1){ // ******** ADCs ********************************
+       if(fModType == kV965){ // ******** ADCs ********************************
            // Channel signal
          if((fBuffer&0x40000000)>>30==0){ // high range chain ADC
             fIsChMapping = kTRUE;
@@ -451,7 +452,7 @@ Bool_t AliZDCRawStream::Next()
              || fCabledSignal==24 || fCabledSignal==48){
              fMapADC[fCurrentCh][3] = 4; //ZNA
              //
-             if(fCabledSignal==2 || fCabledSignal==26)       fMapADC[fCurrentCh][4]=0;
+             if(fCabledSignal==kZNAC || fCabledSignal==kZNACoot)   fMapADC[fCurrentCh][4]=0;
              else if(fCabledSignal==3 || fCabledSignal==27)  fMapADC[fCurrentCh][4]=1;
              else if(fCabledSignal==4 || fCabledSignal==28)  fMapADC[fCurrentCh][4]=2;
              else if(fCabledSignal==5 || fCabledSignal==29)  fMapADC[fCurrentCh][4]=3;
@@ -501,7 +502,7 @@ Bool_t AliZDCRawStream::Next()
            //
          } // high range channels
         }// ModType=1 (ADC mapping)
-        else if(fModType==2){  // ******** VME scaler **************************
+        else if(fModType == kV830){  // ******** VME scaler **************************
           fIsChMapping = kTRUE;
          fScalerMap[fCurrScCh][0] = fADCModule;
          fScalerMap[fCurrScCh][1] = fADCChannel;
@@ -562,15 +563,15 @@ Bool_t AliZDCRawStream::Next()
          
           fCurrScCh++;
         }
-       else if(fModType==3){ // **** scalers from trigger card
+       /*else if(fModType == kTRG){ // **** scalers from trigger card
          //printf("\t Trigger scaler mod. %d ch. %d, signal %d\n",fADCModule,fADCChannel,fCabledSignal);         
         }
-       else if(fModType==4){ // **** trigger history from trigger card
+       else if(fModType == kTRGI){ // **** trigger history from trigger card
          //printf("\t Trigger card ch. %d, signal %d\n",fADCChannel,fCabledSignal);
         }
-       else if(fModType==5){ // **** pattern unit
+       else if(fModType == kPU){ // **** pattern unit
          //printf("\t P.U. mod. %d ch. %d, signal %d\n",fADCModule,fADCChannel,fCabledSignal);
-        }
+        }*/
       }//reading channel mapping
     }
     fPosition++;
index 777faeb..99c7808 100644 (file)
@@ -23,6 +23,46 @@ class AliRawDataHeader;
 
 class AliZDCRawStream: public TObject {
   public :
+    
+    // Module type codes
+    enum{kV965=1, kV830=2, kTRG=3, kTRGI=4, kPU=5}; 
+    
+    // Signal codes for ZDC 
+    // Same codes used in DAQ configuration file
+    // To be changed ONLY IF this file is changed!!! 
+    // **** DO NOT CHANGE THE FOLLOWING LINES!!! ****
+    enum ZDCSignal{kNotConnected=0, kVoid=1,
+        kZNAC=2, kZNA1=3, kZNA2=4, kZNA3=5, kZNA4=6,
+        kZPAC=7, kZPA1=8, kZPA2=9, kZPA3=10, kZPA4=11,
+        kZNCC=12, kZNC1=13, kZNC2=14, kZNC3=15, kZNC4=16,
+        kZPCC=17, kZPC1=18, kZPC2=19, kZPC3=20, kZPC4=21,
+        kZEM1=22, kZEM2=23,
+        kZDCAMon=24, kZDCCMon=25,
+        kZNACoot=26, kZNA1oot=27, kZNA2oot=28, kZNA3oot=29, kZNA4oot=30,
+        kZPACoot=31, kZPA1oot=32, kZPA2oot=33, kZPA3oot=34, kZPA4oot=35,
+        kZNCCoot=36, kZNC1oot=37, kZNC2oot=38, kZNC3oot=39, kZNC4oot=40,
+        kZPCCoot=41, kZPC1oot=42, kZPC2oot=43, kZPC3oot=44, kZPC4oot=45,
+        kZEM1oot=46, kZEM2oot=47,
+        kZDCAMonoot=48, kZDCCMonoot=49,
+        kL1MBI=50, kL1CNI=51, kL1SCI=52, kL1EMDI=53, kL0I=54, 
+        kL1MBO=55, kL1CNO=56, kL1SCO=57, kL1EMDO=58, 
+        kHMBCN=59, kHSCEMD=60,
+        kZNACD=61, kZNA1CD=62, kZNA2D=63, kZNA3D=64, kZNA4D=65,
+        kZPACD=66, kZPA1CD=67, kZPA2D=68, kZPA3D=69, kZPA4D=70,
+        kZNCCD=71, kZNC1CD=72, kZNC2D=73, kZNC3D=74, kZNC4D=75,
+        kZPCCD=76, kZPC1CD=77, kZPC2D=78, kZPC3D=79, kZPC4D=80,
+        kZEM1D=81, kZEM2D=82,
+        kZDCAMonD=83, kZDCCMonD=84,
+        kZNAD=85, kZPAD=86, kZNCD=87, kZPCD=88, kZEMD=89};
+    
+    // Error codes in raw data streaming
+    enum EZDCRawStreamError{
+       kCDHError = 1,
+       kDARCError = 2,
+       kZDCDataError = 3,
+       kInvalidADCModule = 4,
+       kInvalidSector = 5};
+        
     AliZDCRawStream(AliRawReader* rawReader); 
     virtual ~AliZDCRawStream();
     virtual Bool_t   Next();
@@ -107,39 +147,7 @@ class AliZDCRawStream: public TObject {
     void SetMapTow(Int_t iraw, Int_t itow)    {fMapADC[iraw][4]=itow;}
     
     void SetSODReading(Bool_t iset) {fSODReading = iset;}
-    
-    // Error codes in raw data streaming
-    enum EZDCRawStreamError{
-       kCDHError = 1,
-       kDARCError = 2,
-       kZDCDataError = 3,
-       kInvalidADCModule = 4,
-       kInvalidSector = 5};
-    
-    // Module type codes
-    enum{kV965=1, kV830=2, kTRG=3, kTRGI=4, kPU=5}; 
-    
-    // Signal codes for ZDC 
-    // Same codes used in DAQ configuration file
-    // To be changed ONLY IF this file is changed!!! 
-    // **** DO NOT CHANGE THE FOLLOWING LINES!!! ****
-    enum ZDCSignal{kNotConnected=0, kVoid=1,
-        kZNAC=2, kZNA1=3, kZNA2=4, kZNA3=5, kZNA4=6,
-        kZPAC=7, kZPA1=8, kZPA2=9, kZPA3=10, kZPA4=11,
-        kZNCC=12, kZNC1=13, kZNC2=14, kZNC3=15, kZNC4=16,
-        kZPCC=17, kZPC1=18, kZPC2=19, kZPC3=20, kZPC4=21,
-        kZEM1=22, kZEM2=23,
-        kZDCAMon=24, kZDCCMon=25,
-        kZNACoot=26, kZNA1oot=27, kZNA2oot=28, kZNA3oot=29, kZNA4oot=30,
-        kZPACoot=31, kZPA1oot=32, kZPA2oot=33, kZPA3oot=34, kZPA4oot=35,
-        kZNCCoot=36, kZNC1oot=37, kZNC2oot=38, kZNC3oot=39, kZNC4oot=40,
-        kZPCCoot=41, kZPC1oot=42, kZPC2oot=43, kZPC3oot=44, kZPC4oot=45,
-        kZEM1oot=46, kZEM2oot=47,
-        kZDCAMonoot=48, kZDCCMonoot=49,
-        kL1MBI=50, kL1CNI=51, kL1SCI=52, kL1EMDI=53, kL0I=54, 
-        kL1MBO=55, kL1CNO=56, kL1SCO=57, kL1EMDO=58, 
-        kHMBCN=59, kHSCEMD=60};
-    
+     
   private :
     AliZDCRawStream(const AliZDCRawStream& stream);
     AliZDCRawStream& operator = (const AliZDCRawStream& stream);
index b221d59..1fd5274 100644 (file)
@@ -73,6 +73,7 @@ int main(int argc, char **argv) {
   int status = 0;
   // No. of ZDC cabled ch.
   int const kNChannels = 24;
+  int const kNScChannels = 32;
 
   /* log start of process */
   printf("ZDC EMD program started\n");  
@@ -216,38 +217,71 @@ int main(int argc, char **argv) {
       eventT=event->eventType;
       
       Int_t ich=0;
-      Int_t adcMod[2*kNChannels], adcCh[2*kNChannels];
-      Int_t sigCode[2*kNChannels], det[2*kNChannels], sec[2*kNChannels];
+      Int_t adcMod[2*kNChannels], adcCh[2*kNChannels], sigCode[2*kNChannels];
+      Int_t det[2*kNChannels], sec[2*kNChannels];
+      for(Int_t y=0; y<2*kNChannels; y++){
+        adcMod[y]=adcCh[y]=sigCode[y]=det[y]=sec[y]=0;
+      }
+      
+      Int_t iScCh=0;
+      Int_t scMod[kNScChannels], scCh[kNScChannels], scSigCode[kNScChannels];
+      Int_t scDet[kNScChannels], scSec[kNScChannels];
+      for(Int_t y=0; y<kNScChannels; y++){
+        scMod[y]=scCh[y]=scSigCode[y]=scDet[y]=scSec[y]=0;
+      }
+      //
+      Int_t modNum=-1, modType=-1;
       
       if(eventT==START_OF_DATA){
-
-       rawStreamZDC->SetSODReading(kTRUE);
                
+       rawStreamZDC->SetSODReading(kTRUE);
+       
        // --------------------------------------------------------
        // --- Writing ascii data file for the Shuttle preprocessor
         mapFile4Shuttle = fopen(MAPDATA_FILE,"w");
        if(!rawStreamZDC->Next()) printf(" \t No raw data found!! \n");
         else{
-         while(rawStreamZDC->Next()){
-            if(rawStreamZDC->IsChMapping()){
-             adcMod[ich] = rawStreamZDC->GetADCModFromMap(ich);
-             adcCh[ich] = rawStreamZDC->GetADCChFromMap(ich);
-             sigCode[ich] = rawStreamZDC->GetADCSignFromMap(ich);
-             det[ich] = rawStreamZDC->GetDetectorFromMap(ich);
-             sec[ich] = rawStreamZDC->GetTowerFromMap(ich);
-             //
-             fprintf(mapFile4Shuttle,"\t%d\t%d\t%d\t%d\t%d\t%d\n",
-               ich,adcMod[ich],adcCh[ich],sigCode[ich],det[ich],sec[ich]);
-             //
-             //printf("ZDCEMDDA.cxx ->  ch.%d mod %d, ch %d, code %d det %d, sec %d\n",
-             //           ich,adcMod[ich],adcCh[ich],sigCode[ich],det[ich],sec[ich]);
-             ich++;
+         while((rawStreamZDC->Next())){
+            if(rawStreamZDC->IsHeaderMapping()){ // mapping header
+              modNum = rawStreamZDC->GetADCModule();
+              modType = rawStreamZDC->GetModType();
+           }
+            if(rawStreamZDC->IsChMapping()){ 
+             if(modType==1){ // ADC mapping ----------------------
+               adcMod[ich]  = rawStreamZDC->GetADCModFromMap(ich);
+               adcCh[ich]   = rawStreamZDC->GetADCChFromMap(ich);
+               sigCode[ich] = rawStreamZDC->GetADCSignFromMap(ich);
+               det[ich]     = rawStreamZDC->GetDetectorFromMap(ich);
+               sec[ich]     = rawStreamZDC->GetTowerFromMap(ich);
+               //
+               fprintf(mapFile4Shuttle,"\t%d\t%d\t%d\t%d\t%d\t%d\n",
+                 ich,adcMod[ich],adcCh[ich],sigCode[ich],det[ich],sec[ich]);
+               //
+               //printf("  Mapping in DA -> %d ADC: mod %d ch %d, code %d det %d, sec %d\n",
+               //  ich,adcMod[ich],adcCh[ich],sigCode[ich],det[ich],sec[ich]);
+               //
+               ich++;
+             }
+             else if(modType==2){ //VME scaler mapping --------------------
+               scMod[iScCh]     = rawStreamZDC->GetScalerModFromMap(iScCh);
+               scCh[iScCh]      = rawStreamZDC->GetScalerChFromMap(iScCh);
+               scSigCode[iScCh] = rawStreamZDC->GetScalerSignFromMap(iScCh);
+               scDet[iScCh]     = rawStreamZDC->GetScDetectorFromMap(iScCh);
+               scSec[iScCh]    = rawStreamZDC->GetScTowerFromMap(iScCh);
+               //
+               fprintf(mapFile4Shuttle,"\t%d\t%d\t%d\t%d\t%d\t%d\n",
+                 iScCh,scMod[iScCh],scCh[iScCh],scSigCode[iScCh],scDet[iScCh],scSec[iScCh]);
+               //
+               //printf("  Mapping in DA -> %d Scaler: mod %d ch %d, code %d det %d, sec %d\n",
+               //  iScCh,scMod[iScCh],scCh[iScCh],scSigCode[iScCh],scDet[iScCh],scSec[iScCh]);
+               //
+               iScCh++;
+             }
            }
          }
        }
         fclose(mapFile4Shuttle);
-      }//SOD event
-      
+      }// SOD event
     
     if(eventT==PHYSICS_EVENT){
       // --- Reading data header
index d501e58..f6819c4 100644 (file)
@@ -68,6 +68,7 @@ int main(int argc, char **argv) {
 
   int status = 0;
   int const kNChannels = 24;
+  int const kNScChannels = 32;
 
   /* log start of process */
   printf("\n ZDC LASER program started\n");  
@@ -234,34 +235,68 @@ int main(int argc, char **argv) {
       /* use event - here, just write event id to result file */
       eventT=event->eventType;
       
+  
       Int_t ich=0;
-      Int_t adcMod[2*kNChannels], adcCh[2*kNChannels];
-      Int_t sigCode[2*kNChannels], det[2*kNChannels], sec[2*kNChannels];
-
+      Int_t adcMod[2*kNChannels], adcCh[2*kNChannels], sigCode[2*kNChannels];
+      Int_t det[2*kNChannels], sec[2*kNChannels];
+      for(Int_t y=0; y<2*kNChannels; y++){
+        adcMod[y]=adcCh[y]=sigCode[y]=det[y]=sec[y]=0;
+      }
+      
+      Int_t iScCh=0;
+      Int_t scMod[kNScChannels], scCh[kNScChannels], scSigCode[kNScChannels];
+      Int_t scDet[kNScChannels], scSec[kNScChannels];
+      for(Int_t y=0; y<kNScChannels; y++){
+        scMod[y]=scCh[y]=scSigCode[y]=scDet[y]=scSec[y]=0;
+      }
+      //
+      Int_t modNum=-1, modType=-1;
+      
       if(eventT==START_OF_DATA){
-
-       rawStreamZDC->SetSODReading(kTRUE);
                
+       rawStreamZDC->SetSODReading(kTRUE);
+       
        // --------------------------------------------------------
        // --- Writing ascii data file for the Shuttle preprocessor
         mapFile4Shuttle = fopen(MAPDATA_FILE,"w");
        if(!rawStreamZDC->Next()) printf(" \t No raw data found!! \n");
         else{
-         while((rawStreamZDC->Next()) && (ich<2*kNChannels)){
-            if(rawStreamZDC->IsChMapping()){
-             adcMod[ich] = rawStreamZDC->GetADCModFromMap(ich);
-             adcCh[ich] = rawStreamZDC->GetADCChFromMap(ich);
-             sigCode[ich] = rawStreamZDC->GetADCSignFromMap(ich);
-             det[ich] = rawStreamZDC->GetDetectorFromMap(ich);
-             sec[ich] = rawStreamZDC->GetTowerFromMap(ich);
-             //
-             fprintf(mapFile4Shuttle,"\t%d\t%d\t%d\t%d\t%d\t%d\n",
-               ich,adcMod[ich],adcCh[ich],sigCode[ich],det[ich],sec[ich]);
-             //
-             //printf("ZDCPEDESTALda.cxx -> %d mod %d ch %d, code %d det %d, sec %d\n",
-             //   ich,adcMod[ich],adcCh[ich],sigCode[ich],det[ich],sec[ich]);
-             //
-             ich++;
+         while((rawStreamZDC->Next())){
+            if(rawStreamZDC->IsHeaderMapping()){ // mapping header
+              modNum = rawStreamZDC->GetADCModule();
+              modType = rawStreamZDC->GetModType();
+           }
+            if(rawStreamZDC->IsChMapping()){ 
+             if(modType==1){ // ADC mapping ----------------------
+               adcMod[ich]  = rawStreamZDC->GetADCModFromMap(ich);
+               adcCh[ich]   = rawStreamZDC->GetADCChFromMap(ich);
+               sigCode[ich] = rawStreamZDC->GetADCSignFromMap(ich);
+               det[ich]     = rawStreamZDC->GetDetectorFromMap(ich);
+               sec[ich]     = rawStreamZDC->GetTowerFromMap(ich);
+               //
+               fprintf(mapFile4Shuttle,"\t%d\t%d\t%d\t%d\t%d\t%d\n",
+                 ich,adcMod[ich],adcCh[ich],sigCode[ich],det[ich],sec[ich]);
+               //
+               //printf("  Mapping in DA -> %d ADC: mod %d ch %d, code %d det %d, sec %d\n",
+               //  ich,adcMod[ich],adcCh[ich],sigCode[ich],det[ich],sec[ich]);
+               //
+               ich++;
+             }
+             else if(modType==2){ //VME scaler mapping --------------------
+               scMod[iScCh]     = rawStreamZDC->GetScalerModFromMap(iScCh);
+               scCh[iScCh]      = rawStreamZDC->GetScalerChFromMap(iScCh);
+               scSigCode[iScCh] = rawStreamZDC->GetScalerSignFromMap(iScCh);
+               scDet[iScCh]     = rawStreamZDC->GetScDetectorFromMap(iScCh);
+               scSec[iScCh]    = rawStreamZDC->GetScTowerFromMap(iScCh);
+               //
+               fprintf(mapFile4Shuttle,"\t%d\t%d\t%d\t%d\t%d\t%d\n",
+                 iScCh,scMod[iScCh],scCh[iScCh],scSigCode[iScCh],scDet[iScCh],scSec[iScCh]);
+               //
+               //printf("  Mapping in DA -> %d Scaler: mod %d ch %d, code %d det %d, sec %d\n",
+               //  iScCh,scMod[iScCh],scCh[iScCh],scSigCode[iScCh],scDet[iScCh],scSec[iScCh]);
+               //
+               iScCh++;
+             }
            }
          }
        }
index 5c9bda3..e140bf6 100644 (file)
@@ -2,14 +2,11 @@
 
 This program reads the DAQ data files passed as argument using the monitoring library.
 
-It computes the average event size and populates local "./result.txt" file with the 
-result.
-
 The program reports about its processing progress.
 
 Messages on stdout are exported to DAQ log system.
 
-DA to write mapping for the ZDC ADCs
+DA to write mapping for ADC modules and VME scaler
 
 Contact: Chiara.Oppedisano@to.infn.it
 Link: 
@@ -49,6 +46,7 @@ int main(int argc, char **argv) {
   
   int status = 0;
   int const kNChannels = 24;
+  int const kNScChannels = 32;
 
   /* log start of process */
   printf("\nZDC MAPPING program started\n");  
@@ -106,6 +104,7 @@ int main(int argc, char **argv) {
       
       // Initalize raw-data reading and decoding
       AliRawReader *reader = new AliRawReaderDate((void*)event);
+      reader->Select("ZDC");
       // --- Reading event header
       //UInt_t evtype = reader->GetType();
       //printf("\t ZDCMAPPINGda -> run # %d\n",reader->GetRunNumber());
@@ -116,12 +115,25 @@ int main(int argc, char **argv) {
       /* use event - here, just write event id to result file */
       eventT=event->eventType;
       
+  
       Int_t ich=0;
       Int_t adcMod[2*kNChannels], adcCh[2*kNChannels], sigCode[2*kNChannels];
       Int_t det[2*kNChannels], sec[2*kNChannels];
+      for(Int_t y=0; y<2*kNChannels; y++){
+        adcMod[y]=adcCh[y]=sigCode[y]=det[y]=sec[y]=0;
+      }
+      
+      Int_t iScCh=0;
+      Int_t scMod[kNScChannels], scCh[kNScChannels], scSigCode[kNScChannels];
+      Int_t scDet[kNScChannels], scSec[kNScChannels];
+      for(Int_t y=0; y<kNScChannels; y++){
+        scMod[y]=scCh[y]=scSigCode[y]=scDet[y]=scSec[y]=0;
+      }
+      //
+      Int_t modNum=-1, modType=-1;
       
       if(eventT==START_OF_DATA){
-       sodRead = kTRUE;
+               
        rawStreamZDC->SetSODReading(kTRUE);
        
        // --------------------------------------------------------
@@ -129,26 +141,47 @@ int main(int argc, char **argv) {
         mapFile4Shuttle = fopen(MAPDATA_FILE,"w");
        if(!rawStreamZDC->Next()) printf(" \t No raw data found!! \n");
         else{
-         while((rawStreamZDC->Next()) && (ich<2*kNChannels)){
-            if(rawStreamZDC->IsChMapping()){
-             adcMod[ich] = rawStreamZDC->GetADCModFromMap(ich);
-             adcCh[ich] = rawStreamZDC->GetADCChFromMap(ich);
-             sigCode[ich] = rawStreamZDC->GetADCSignFromMap(ich);
-             det[ich] = rawStreamZDC->GetDetectorFromMap(ich);
-             sec[ich] = rawStreamZDC->GetTowerFromMap(ich);
-             //
-             fprintf(mapFile4Shuttle,"\t%d\t%d\t%d\t%d\t%d\t%d\n",
-               ich,adcMod[ich],adcCh[ich],sigCode[ich],det[ich],sec[ich]);
-             //
-             //printf("ZDCMAPPINGda.cxx -> %d mod %d ch %d code %d det %d sec %d\n",
-             //   ich,adcMod[ich],adcCh[ich],sigCode[ich],det[ich],sec[ich]);
-             //
-             ich++;
+         while((rawStreamZDC->Next())){
+            if(rawStreamZDC->IsHeaderMapping()){ // mapping header
+              modNum = rawStreamZDC->GetADCModule();
+              modType = rawStreamZDC->GetModType();
+           }
+            if(rawStreamZDC->IsChMapping()){ 
+             if(modType==1){ // ADC mapping ----------------------
+               adcMod[ich]  = rawStreamZDC->GetADCModFromMap(ich);
+               adcCh[ich]   = rawStreamZDC->GetADCChFromMap(ich);
+               sigCode[ich] = rawStreamZDC->GetADCSignFromMap(ich);
+               det[ich]     = rawStreamZDC->GetDetectorFromMap(ich);
+               sec[ich]     = rawStreamZDC->GetTowerFromMap(ich);
+               //
+               fprintf(mapFile4Shuttle,"\t%d\t%d\t%d\t%d\t%d\t%d\n",
+                 ich,adcMod[ich],adcCh[ich],sigCode[ich],det[ich],sec[ich]);
+               //
+               //printf("  Mapping DA -> %d ADC: mod %d ch %d, code %d det %d, sec %d\n",
+               //  ich,adcMod[ich],adcCh[ich],sigCode[ich],det[ich],sec[ich]);
+               //
+               ich++;
+             }
+             else if(modType==2){ //VME scaler mapping --------------------
+               scMod[iScCh]     = rawStreamZDC->GetScalerModFromMap(iScCh);
+               scCh[iScCh]      = rawStreamZDC->GetScalerChFromMap(iScCh);
+               scSigCode[iScCh] = rawStreamZDC->GetScalerSignFromMap(iScCh);
+               scDet[iScCh]     = rawStreamZDC->GetScDetectorFromMap(iScCh);
+               scSec[iScCh]     = rawStreamZDC->GetScTowerFromMap(iScCh);
+               //
+               fprintf(mapFile4Shuttle,"\t%d\t%d\t%d\t%d\t%d\t%d\n",
+                 iScCh,scMod[iScCh],scCh[iScCh],scSigCode[iScCh],scDet[iScCh],scSec[iScCh]);
+               //
+               //printf("  Mapping DA -> %d Scaler: mod %d ch %d, code %d det %d, sec %d\n",
+               //  iScCh,scMod[iScCh],scCh[iScCh],scSigCode[iScCh],scDet[iScCh],scSec[iScCh]);
+               //
+               iScCh++;
+             }
            }
          }
        }
         fclose(mapFile4Shuttle);
-      } // SOD event
+      }// SOD event
       else{ 
         if(sodRead){
          printf("\t SOR read -> exiting from DA\n");
index 01def3d..0f66ddd 100644 (file)
@@ -2,7 +2,6 @@
 
 This program reads the DAQ data files passed as argument using the monitoring library.
 
-
 The program reports about its processing progress.
 
 Messages on stdout are exported to DAQ log system.
@@ -14,7 +13,7 @@ Link:
 Run Type: STANDALONE_PEDESTAL_RUN
 DA Type: LDC
 Number of events needed: no constraint (tipically ~10^3)
-Input Files:  
+Input Files: none
 Output Files: ZDCPedestal.dat, ZDCChMapping.dat
 Trigger Types Used: Standalone Trigger
 
@@ -182,6 +181,9 @@ int main(int argc, char **argv) {
   int nevents_physics=0;
   int nevents_total=0;
 
+  struct eventHeaderStruct *event;
+  eventTypeType eventT;
+
   /* read the data files */
   int n;
   for(n=1;n<argc;n++){
@@ -198,8 +200,6 @@ int main(int argc, char **argv) {
 
     /* read the file */
     for(;;) {
-      struct eventHeaderStruct *event;
-      eventTypeType eventT;
 
       /* get next event */
       status=monitorGetEventDynamic((void **)&event);
@@ -229,9 +229,9 @@ int main(int argc, char **argv) {
       eventT=event->eventType;
       
       Int_t iScCh=0;
-      Int_t scMod[2*kNScChannels], scCh[2*kNScChannels], scSigCode[2*kNScChannels];
-      Int_t scDet[2*kNScChannels], scSec[2*kNScChannels];
-      for(Int_t y=0; y<2*kNScChannels; y++){
+      Int_t scMod[kNScChannels], scCh[kNScChannels], scSigCode[kNScChannels];
+      Int_t scDet[kNScChannels], scSec[kNScChannels];
+      for(Int_t y=0; y<kNScChannels; y++){
         scMod[y]=scCh[y]=scSigCode[y]=scDet[y]=scSec[y]=0;
       }
       //
@@ -299,8 +299,8 @@ int main(int argc, char **argv) {
             //printf("\t STANDALONE_PEDESTAL RUN raw data found\n");
          }
          else{
-            //printf("ZDCPEDESTALda.cxx -> NO STANDALONE_PEDESTAL RUN raw data found\n");
-            //return -1;
+            printf("ZDCPEDESTALda.cxx -> NO STANDALONE_PEDESTAL RUN raw data found\n");
+            return -1;
          }
         }
         else{
@@ -400,7 +400,7 @@ int main(int argc, char **argv) {
       nevents_total++;
 
       /* free resources */
-      free(event);
+//      free(event);
     
     }
   }  
@@ -461,7 +461,7 @@ int main(int argc, char **argv) {
   
   // --- Correlations
 
-/*  Float_t CorrCoeff0[2*kNChannels], CorrCoeff1[2*kNChannels];
+  Float_t CorrCoeff0[2*kNChannels], CorrCoeff1[2*kNChannels];
   TProfile *hPedCorrProfhg[kNChannels], *hPedCorrProflg[kNChannels];
   TF1 *ffunchg[kNChannels], *ffunclg[kNChannels];
   char namhist4[50];
@@ -488,7 +488,7 @@ int main(int argc, char **argv) {
      //printf("\t CorrCoeff0[%d] = %f, CorrCoeff1[%d] = %f\n",
      //                i+kNChannels, CorrCoeff0[i+kNChannels], i+kNChannels, CorrCoeff1[i+kNChannels]);
   }    
-*/
+
   //                                                  
   fclose(fileShuttle);
   //