]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Updates for new ADD + ZDC modules
authorcoppedis <coppedis@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 12 Feb 2010 09:03:00 +0000 (09:03 +0000)
committercoppedis <coppedis@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 12 Feb 2010 09:03:00 +0000 (09:03 +0000)
ZDC/AliZDCChMap.cxx
ZDC/AliZDCChMap.h
ZDC/AliZDCPreprocessor.cxx
ZDC/AliZDCRawStream.cxx
ZDC/AliZDCRawStream.h
ZDC/ShuttleInput/ZDCChMapping.dat
ZDC/ZDCCALIBMBda.cxx
ZDC/ZDCEMDda.cxx
ZDC/ZDCLASERda.cxx
ZDC/ZDCMAPPINGda.cxx
ZDC/ZDCPEDESTALda.cxx

index 9080d0e2f7b2c5cf1a3faea442950aad33d19874..2cb327c98ce7c2e4add5d540436f625377739e20 100644 (file)
@@ -41,13 +41,19 @@ TNamed()
   SetName(namst.Data());
   SetTitle(namst.Data());
   Reset();
-  for(Int_t i=0; i<48; i++){
+  int const kNModules = 10;
+  int const kNChannels = 48;
+  int const kNScChannels = 32;
+  for(Int_t i=0; i<kNModules; i++){
+    for(Int_t j=0; j<3; j++) fModuleMap[i][j] = 0;
+  }
+  for(Int_t i=0; i<kNChannels; i++){
     fADCModule[i] = -1;
     fADCChannel[i] = -1;
     fDetector[i] = -1;
     fSector[i] = -1;
   }
-  for(Int_t i=0; i<32; i++){
+  for(Int_t i=0; i<kNScChannels; i++){
     fScalerChannel[i] = -1;
     fScDetector[i] = -1;
     fScSector[i] = -1;
@@ -64,12 +70,18 @@ AliZDCChMap::AliZDCChMap(const AliZDCChMap& calibda) :
   SetName(calibda.GetName());
   SetTitle(calibda.GetName());
   Reset();
-  for(int t=0; t<48; t++){
+  int const kNModules = 10;
+  int const kNChannels = 48;
+  int const kNScChannels = 32;
+  for(Int_t i=0; i<kNModules; i++){
+     for(Int_t j=0; j<3; j++) fModuleMap[i][j] = calibda.GetModuleMap(i,j);
+  }
+  for(int t=0; t<kNChannels; t++){
      fADCModule[t]  = calibda.GetADCModule(t);
      fADCChannel[t] = calibda.GetADCChannel(t);
      fDetector[t]   = calibda.GetDetector(t);
      fSector[t]     = calibda.GetSector(t);
-     if(t<32){
+     if(t<kNScChannels){
        fScalerChannel[t] = calibda.GetScChannel(t);
        fScDetector[t]    = calibda.GetScDetector(t);
        fScSector[t]      = calibda.GetScSector(t);
@@ -84,12 +96,18 @@ AliZDCChMap &AliZDCChMap::operator =(const AliZDCChMap& calibda)
   SetName(calibda.GetName());
   SetTitle(calibda.GetName());
   Reset();
-  for(int t=0; t<48; t++){
+  int const kNModules = 10;
+  int const kNChannels = 48;
+  int const kNScChannels = 32;
+  for(Int_t i=0; i<kNModules; i++){
+     for(Int_t j=0; j<3; j++) fModuleMap[i][j] = calibda.GetModuleMap(i,j);
+  }
+  for(int t=0; t<kNChannels; t++){
      fADCModule[t]  = calibda.GetADCModule(t);
      fADCChannel[t] = calibda.GetADCChannel(t);
      fDetector[t]   = calibda.GetDetector(t);
      fSector[t]     = calibda.GetSector(t);
-     if(t<32){
+     if(t<kNScChannels){
        fScalerChannel[t] = calibda.GetScChannel(t);
        fScDetector[t]    = calibda.GetScDetector(t);
        fScSector[t]      = calibda.GetScSector(t);
@@ -123,6 +141,10 @@ void  AliZDCChMap::Print(Option_t *) const
 {
    // Printing of calibration object
    printf("\n\n\t ******************* AliZDCChMap object *******************\n\n");
+   for(Int_t i=0; i<9; i++){
+     printf("  ******** GEO %d mod. type %d #ch. %d\n",
+      fModuleMap[i][0],fModuleMap[i][1],fModuleMap[i][2]);     
+   } 
    for(Int_t i=0; i<48; i++) 
      printf(" ADC - mod. %d ch. %d -> detector %d sector %d\n",
       fADCModule[i], fADCChannel[i],fDetector[i], fSector[i]);
index 4a77b2882c782461880be7c32035023eff918162..cf882899d0c622a4b851ec71fea4366c02fa51f3 100644 (file)
@@ -27,6 +27,9 @@ class AliZDCChMap: public TNamed {
   void Reset();
   virtual void  Print(Option_t *) const; 
   //
+  Int_t* GetModuleMap() const {return (int*)fModuleMap;}
+  Int_t GetModuleMap(Int_t iModType, Int_t iMapEntry) const {return fModuleMap[iModType][iMapEntry];}
+  //
   Int_t GetADCModule(Int_t i)  const {return fADCModule[i];}
   Int_t GetADCChannel(Int_t i) const {return fADCChannel[i];}
   Int_t GetDetector(Int_t i)   const {return fDetector[i];}
@@ -35,7 +38,12 @@ class AliZDCChMap: public TNamed {
   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  SetModuleMap(Int_t iEntry, Int_t iGeoAdd, Int_t iModType, Int_t iNCh)
+        {fModuleMap[iEntry][0] = iGeoAdd;
+        fModuleMap[iEntry][1] = iModType;
+        fModuleMap[iEntry][2] = iNCh;}
+  
   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;}
@@ -46,6 +54,7 @@ class AliZDCChMap: public TNamed {
   void  SetScSector(Int_t i, Int_t ival)   {fScSector[i] = ival;}
   
  protected:
+  Int_t  fModuleMap[10][3]; // 10 module maps: GEO, mod. type, no. ch.
   // ************ ADC ************
   // 22 signal ch. + 2 reference ch.
   // in-time + out-of-time signals
@@ -60,7 +69,7 @@ class AliZDCChMap: public TNamed {
   Int_t  fScDetector[32];    // detector
   Int_t  fScSector[32];             // sector
   
-  ClassDef(AliZDCChMap,2)    // ZDC pedestal calibration data
+  ClassDef(AliZDCChMap,3)    // ZDC pedestal calibration data
 };
 
 #endif
index 9ef09c65eb87474ba1cb201d67816ea750e40ace..1eb39163619d22354d68248a64b3ae206bebad92 100644 (file)
@@ -190,7 +190,7 @@ UInt_t AliZDCPreprocessor::ProcessDCSData(TMap* dcsAliasMap)
 //______________________________________________________________________________________________
 UInt_t AliZDCPreprocessor::ProcessChMap()
 { 
-  const int kNch=48, kNScch=32;
+  const int kNModules=10, kNch=48, kNScch=32;
   
   // Reading the file for mapping from FXS
   TList* daqSource = GetFileSources(kDAQ, "MAPPING");
@@ -204,7 +204,7 @@ UInt_t AliZDCPreprocessor::ProcessChMap()
   TIter iter(daqSource);
   TObjString* source = 0;
   Int_t isou = 0;
-  Int_t readMap[kNch][6]; 
+  Int_t modMap[kNModules][3], adcMap[kNch][6], scMap[kNScch][6]; 
   //
   while((source = dynamic_cast<TObjString*> (iter.Next()))){
      TString fileName = GetFile(kDAQ, "MAPPING", source->GetName());
@@ -224,9 +224,21 @@ UInt_t AliZDCPreprocessor::ProcessChMap()
        }
        Log(Form("File %s connected to process data for ADC mapping", fileName.Data()));
        //
-       for(Int_t j=0; j<kNch; j++){      
+       for(Int_t j=0; j<kNModules; j++){         
+           for(Int_t k=0; k<3; k++){
+             int read = fscanf(file,"%d",&modMap[j][k]);
+            if(read == 0) AliDebug(3," Failing in reading data from mapping file");
+           }
+       }
+       for(Int_t j=kNModules; j<kNModules+kNch; j++){    
+           for(Int_t k=0; k<6; k++){
+             int read = fscanf(file,"%d",&adcMap[j-kNModules][k]);
+            if(read == 0) AliDebug(3," Failing in reading data from mapping file");
+           }
+       }
+       for(Int_t j=kNModules+kNch; j<kNModules+kNch+kNScch; j++){        
            for(Int_t k=0; k<6; k++){
-             int read = fscanf(file,"%d",&readMap[j][k]);
+             int read = fscanf(file,"%d",&scMap[j-kNModules-kNch][k]);
             if(read == 0) AliDebug(3," Failing in reading data from mapping file");
            }
        }
@@ -240,6 +252,7 @@ UInt_t AliZDCPreprocessor::ProcessChMap()
   
   // Store the currently read map ONLY IF it is different
   // from the entry in the OCDB
+  Bool_t adcMapUpdated=kFALSE, scMapUpdated=kFALSE;
   Bool_t updateOCDB = kFALSE;
   
   AliCDBEntry *cdbEntry = GetFromOCDB("Calib","ChMap");
@@ -250,15 +263,24 @@ UInt_t AliZDCPreprocessor::ProcessChMap()
   else{
     AliZDCChMap *chMap = (AliZDCChMap*) cdbEntry->GetObject();
     for(Int_t i=0; i<kNch; i++){
-      if(  (readMap[i][1] == chMap->GetADCModule(i)) 
-        && (readMap[i][2] == chMap->GetADCChannel(i)) 
-       && (readMap[i][4] == chMap->GetDetector(i)) 
-       && (readMap[i][5] == chMap->GetSector(i))){
-        updateOCDB = kFALSE;
+      if(  (adcMap[i][1] == chMap->GetADCModule(i)) 
+        && (adcMap[i][2] == chMap->GetADCChannel(i)) 
+       && (adcMap[i][4] == chMap->GetDetector(i)) 
+       && (adcMap[i][5] == chMap->GetSector(i))){
+        adcMapUpdated = kFALSE;
       }
-      else updateOCDB = kTRUE;
+      else adcMapUpdated = kTRUE;
+    }
+    for(Int_t i=0; i<kNScch; i++){
+      if(  (scMap[i][2] == chMap->GetScChannel(i)) 
+       && (scMap[i][4] == chMap->GetScDetector(i)) 
+       && (scMap[i][5] == chMap->GetScSector(i))){
+        scMapUpdated = kFALSE;
+      }
+      else scMapUpdated = kTRUE;
     }
   }
+  if(adcMapUpdated || scMapUpdated) updateOCDB = kTRUE;
   //
   Bool_t resChMapStore = kTRUE;
   if(updateOCDB==kTRUE){
@@ -267,23 +289,26 @@ UInt_t AliZDCPreprocessor::ProcessChMap()
     // --- Initializing mapping calibration object
     AliZDCChMap *mapCalib = new AliZDCChMap("ZDC");
     // Writing channel map in the OCDB
+    for(Int_t k=0; k<kNModules; k++){
+      mapCalib->SetModuleMap(k, modMap[k][0], modMap[k][1], modMap[k][2]);
+    }
     for(Int_t k=0; k<kNch; k++){
-      mapCalib->SetADCModule(k,readMap[k][1]);
-      mapCalib->SetADCChannel(k,readMap[k][2]);
-      mapCalib->SetDetector(k,readMap[k][4]);
-      mapCalib->SetSector(k,readMap[k][5]);
-      // TEMPORARY!!!! Until no mapping from scaler is provided!!!!!!!
-      if(k<kNScch){
-         mapCalib->SetScChannel(k, 0);
-        mapCalib->SetScDetector(k, 0);
-        mapCalib->SetScSector(k, 0);
-      }
+      mapCalib->SetADCModule(k,adcMap[k][1]);
+      mapCalib->SetADCChannel(k,adcMap[k][2]);
+      mapCalib->SetDetector(k,adcMap[k][4]);
+      mapCalib->SetSector(k,adcMap[k][5]);
     }
+    for(Int_t k=0; k<kNScch; k++){
+       mapCalib->SetScChannel(k, scMap[k][0]);
+       mapCalib->SetScDetector(k, scMap[k][1]);
+       mapCalib->SetScSector(k, scMap[k][2]);
+    }
+    //
     mapCalib->Print("");
     // 
     AliCDBMetaData metaData;
     metaData.SetBeamPeriod(0);
-    //metaData.SetResponsible("Chiara Oppedisano");
+    metaData.SetResponsible("Chiara Oppedisano");
     metaData.SetComment("Filling AliZDCChMap object");  
     //
     resChMapStore = Store("Calib","ChMap",mapCalib, &metaData, 0, kTRUE);
index a8c7ebe624fbc2fed61787fd0992cd36f02b7408..dc18a997f3f1d256fca94b8e82bd9ee293bda67c 100644 (file)
@@ -102,7 +102,13 @@ AliZDCRawStream::AliZDCRawStream(AliRawReader* rawReader) :
   fCurrScCh(-1),
   fIsADCEventGood(kTRUE),
   fIsL0BitSet(kTRUE),
-  fIsPileUpEvent(kFALSE)
+  fIsPileUpEvent(kFALSE),
+  fIsZDCTDCHeader(kFALSE),
+  fIsTDCHeaderRead(kFALSE),
+  fTDCStartCounter(0),
+  fIsADDChannel(kFALSE),
+  fIsADDTDCHeader(kFALSE),
+  fIsADDTDCdatum(kFALSE)
 {
   // Create an object to read ZDC raw digits
   fRawReader->Reset();
@@ -187,7 +193,13 @@ AliZDCRawStream::AliZDCRawStream(const AliZDCRawStream& stream) :
   fCurrScCh(stream.fCurrScCh),
   fIsADCEventGood(stream.fIsADCEventGood),
   fIsL0BitSet(stream.fIsL0BitSet),
-  fIsPileUpEvent(stream.fIsPileUpEvent)
+  fIsPileUpEvent(stream.fIsPileUpEvent),
+  fIsZDCTDCHeader(stream.fIsZDCTDCHeader),
+  fIsTDCHeaderRead(stream.fIsTDCHeaderRead),
+  fTDCStartCounter(stream.fTDCStartCounter),
+  fIsADDChannel(stream.fIsADDChannel),
+  fIsADDTDCHeader(stream.fIsADDTDCHeader),
+  fIsADDTDCdatum(stream.fIsADDTDCdatum)
 
 {
   // Copy constructor
@@ -282,11 +294,11 @@ void AliZDCRawStream::ReadCDHHeader()
     if((message & 0x08) == 0){  // ** DARC card
        fReadOutCard = 0;
        fIsDARCHeader = kTRUE;
-       AliInfo("\t ZDC readout card used: DARC");
+       //AliInfo("\t ZDC readout card used: DARC");
     }
     else if((message & 0x08) == 0x08){  // ** ZRC card
        fReadOutCard = 1;
-       AliInfo("\t ZDC readout card used: ZRC");
+       //AliInfo("\t ZDC readout card used: ZRC");
     }
 
     if(header->GetL1TriggerMessage() & 0x1){ // Calibration bit set in CDH
@@ -297,7 +309,7 @@ void AliZDCRawStream::ReadCDHHeader()
     
     UInt_t status = header->GetStatus();
     //printf("\t AliZDCRawStream::ReadCDHHeader -> status = %d\n",status);
-    if((status & 0x000f) == 0x0001){
+/*    if((status & 0x000f) == 0x0001){
       AliDebug(2,"CDH -> DARC trg0 overlap error");
       fRawReader->AddMajorErrorLog(kDARCError);
     }
@@ -340,6 +352,7 @@ void AliZDCRawStream::ReadCDHHeader()
       AliDebug(2,"CDH -> DARC other error");
       fRawReader->AddMajorErrorLog(kDARCError);
     }
+    */
   }
   
 }
@@ -352,13 +365,16 @@ Bool_t AliZDCRawStream::Next()
 
   if(!fRawReader->ReadNextInt((UInt_t&) fBuffer)) return kFALSE;
   const int kNch = 48;
-  Int_t kFirstADCGeo=0, kLastADCGeo=3, kAddADCGeo=4;
-  Int_t kScalerGeo=8, kPUGeo=29, kTrigScales=30, kTrigHistory=31;
+  Int_t kFirstADCGeo=0, kLastADCGeo=3;
+  Int_t kADDADCGeo=5, kADDTDCGeo=6;
+  Int_t kZDCTDCGeo=8, kScalerGeo=16;
+  Int_t kPUGeo=29, kTrigScales=30, kTrigHistory=31;
+  //
   fIsHeaderMapping = kFALSE; fIsChMapping = kFALSE; 
   fIsADCHeader = kFALSE; fIsADCDataWord = kFALSE; fIsADCEOB = kFALSE;
+  fIsADDChannel = kFALSE; fIsADDTDCHeader= kFALSE; fIsADDTDCdatum=kFALSE;
   fIsUnderflow = kFALSE; fIsOverflow = kFALSE; fIsScalerWord = kFALSE;
   fSector[0] = fSector[1] = -1;
-//  fTrigCountNWords = 9; fTrigHistNWords = 2;
   for(Int_t kl=0; kl<4; kl++) fCPTInput[kl] = 0;
 
   fEvType = fRawReader->GetType();
@@ -658,12 +674,8 @@ Bool_t AliZDCRawStream::Next()
     }
      
     // Get geo address of current word
-    // - ADC GEO = 0, 1, 2, 3
-    // - VME scaler GEO = 8
-    // - PU GEO = 29
-    // - Trigger card scales GEO = 30
-    // - Trigger card history GEO = 31
     fADCModule = (Int_t) ((fBuffer & 0xf8000000)>>27);
+    if(fIsTDCHeaderRead)fADCModule = kZDCTDCGeo;
     
     // ************************************ ADC MODULES ************************************
     if(fADCModule>=kFirstADCGeo && fADCModule<=kLastADCGeo){
@@ -742,12 +754,12 @@ Bool_t AliZDCRawStream::Next()
       }
     }//ADC module
     // ********************************* ADD ADC *********************************
-    else if(fADCModule == kAddADCGeo){
+    else if(fADCModule == kADDADCGeo){
       // *** ADC header
       if((fBuffer & 0x07000000) == 0x02000000){
         fIsADCHeader = kTRUE;
        fADCNChannels = ((fBuffer & 0x00003f00)>>8);
-       //printf("  AliZDCRawStream -> ADC HEADER: mod.%d has %d ch. \n",fADCModule,fADCNChannels);
+       //printf("  AliZDCRawStream -> ADD ADC HEADER: mod.%d has %d ch. \n",fADCModule,fADCNChannels);
       }
       // *** ADC data word
       else if((fBuffer & 0x07000000) == 0x00000000){
@@ -759,7 +771,38 @@ Bool_t AliZDCRawStream::Next()
        //printf("  ADD ADC DATUM -> mod. %d ch. %d gain %d value %d\n",
        //  fADCModule,fADCChannel,fADCGain,fADCValue);
       }
+      // *** ADC EOB
+      else if((fBuffer & 0x07000000) == 0x04000000){
+        fIsADCEOB = kTRUE;
+       //printf("  AliZDCRawStream -> EOB --------------------------\n");
+      }
     }
+    // ********************************* ZDC TDC *********************************
+    else if(fADCModule==kZDCTDCGeo && fIsTDCHeaderRead==kFALSE){
+      fIsZDCTDCHeader = kTRUE;
+      fIsTDCHeaderRead = kTRUE;
+      fTDCStartCounter = fPosition;
+      //Ch. debug
+      //printf("  AliZDCRawStream -> ZDC TDC: mod.%d\n",fADCModule);
+    }
+    // ********************************* ADD TDC *********************************
+    else if(fADCModule == kADDTDCGeo){
+      // *** TDC header
+      if((fBuffer & 0x07000000) == 0x02000000){
+        fIsADDTDCHeader = kTRUE;
+       fADCNChannels = ((fBuffer & 0x00003f00)>>8);
+        //printf("  AliZDCRawStream -> ADD TDC: mod.%d has %d ch. \n",fADCModule,fADCNChannels);
+      }
+      // *** TDC  word
+      else if((fBuffer & 0x07000000) == 0x00000000){
+        fIsADDTDCdatum = kTRUE;
+      }
+      // *** TDC  EOB
+      if((fBuffer & 0x07000000) == 0x04000000){
+        fIsADCEOB = kTRUE;
+       //printf("  AliZDCRawStream -> ADD TDC EOB\n");
+      }
+   }
     // ********************************* VME SCALER HEADER *********************************
     else if(fADCModule == kScalerGeo){
       if(fBuffer & 0x04000000 && fIsScHeaderRead==kFALSE){ // *** Scaler header
@@ -816,6 +859,18 @@ Bool_t AliZDCRawStream::Next()
       //Ch. debug
       //printf("  AliZDCRawStream -> scaler datum %d", fScEvCounter);
     }
+    // ********************************** ZDC TDC DATA **********************************
+    //  ZDC TDC data
+    if(fIsTDCHeaderRead && fPosition>=fTDCStartCounter+1){ 
+      fIsADCDataWord=kFALSE; fIsScalerWord=kFALSE;
+      //printf("  AliZDCRawStream -> ...skipping ZDC TDC datum\n");
+      // For the moment we skip the TDC data
+      if(((fBuffer & 0xf0000000) == 0x80000000) && ((fBuffer & 0x08000000) >> 27) == 0){
+       fIsTDCHeaderRead = kFALSE;
+        // Ch. debug
+        //printf("  AliZDCRawStream -> ZDC TDC trailer\n");
+      }
+    }
     // ******************************** TRIGGER SCALER DATA ********************************
     //  Reading trigger scaler data 
     if(fIsTriggerScaler && fPosition>=fTrigCountStart+1){
index 58bc6abd7830c61925aab5ff7b583bc159636961..fa82a737c715581eb955a669e26c8f8dc0086b88 100644 (file)
@@ -25,13 +25,14 @@ class AliZDCRawStream: public TObject {
   public :
     
     // Module type codes
-    enum{kV965=1, kV830=2, kTRG=3, kTRGI=4, kPU=5}; 
+    enum{kV965=1, kV830=2, kTRG=3, kTRGI=4, kPU=5, KV1290=6, kV775N=7}; 
     
     // 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,
+    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,
@@ -54,13 +55,13 @@ class AliZDCRawStream: public TObject {
         kZEM1D=81, kZEM2D=82,
         kZDCAMonD=83, kZDCCMonD=84,
         kZNAD=85, kZPAD=86, kZNCD=87, kZPCD=88, kZEMD=89,
-         kZNA0D=90, kZPA0D=91, kZNC0D=92, kZPC0D=93, k1kHzD=94, 
-        kGate=95, kAD=96, kCD=97, kAorCD=98, kAandCD=99
-        kZEMORD=100, kAorCorZEMORD=101, kAorCorZEMD=102, kADD0=103, kADD1=104
-        kADD2=105, kADD3=106, kLogical17=107, kLogical18=108, kLogical19=109, 
-        kLogical20=110, kLogical21=111, kLogical22=112, kLogical23=113, kLogical24=114, 
-        kLogical25=115, kLogical26=116, kLogical27=117, kLogical28=118, kLogical29=119, 
-        kLogical30=120, kLogical31=121};
+         kZNA0D=90, kZPA0D=91, kZNC0D=92, kZPC0D=93, k1kHzD=94, kGate=95, kAD=96, kCD=97, 
+        kAorCD=98, kAandCD=99, kZEMORD=100, kAorCorZEMORD=101, kAorCorZEMD=102, kAD0=103, kAD1=104, kAD2=105
+        kAD3=106, kAD4=107, kAD5=108, kAD6=109, kAD7=110, kAD8=111, kAD9=112, kAD10=113
+        kAD11=114, kAD12=115, kAD13=116, kAD14=117, kAD15=118, kAD0D=119, kAD1D=120, kAD2D=121,
+        kAD3D=122, kAD4D=123, kAD5D=124, kAD6D=125, kAD7D=126, kAD8D=127, kAD9D=128, kAD10D=129,
+        kAD11D=130, kAD12D=131, kAD13D=132, kAD14D=133, kAD15D=134
+        };
     
     // Error codes in raw data streaming
     enum EZDCRawStreamError{
@@ -77,8 +78,11 @@ class AliZDCRawStream: public TObject {
     virtual void ReadChMap();
 
     virtual void ReadCDHHeader();
+
+    Bool_t IsZDCTDCHeader() const {return fIsZDCTDCHeader;}
     
-    Bool_t IsAddChannel() const {return fIsADDChannel;}
+    Bool_t IsAddChannel()  const {return fIsADDChannel;}
+    Bool_t IsAddTDCdatum() const {return fIsADDTDCdatum;}
 
     UInt_t GetRawBuffer()      const {return fBuffer;}
     Int_t  GetReadOutCard()    const {return fReadOutCard;}
@@ -253,10 +257,17 @@ class AliZDCRawStream: public TObject {
     Bool_t fIsL0BitSet;     // true if L0 bit in history words = 1 
     Bool_t fIsPileUpEvent;  // true if pile up bits in history words = 0
     
+    // ZDC TDC
+    Bool_t fIsZDCTDCHeader;  // true if datum is a ZDC TDC header
+    Bool_t fIsTDCHeaderRead; // true when streaming TDC data
+    Int_t  fTDCStartCounter; // counts after TDC header
+    
     // ADD part
     Bool_t fIsADDChannel;   // true if datum is an ADD ADC channel
-    
-    ClassDef(AliZDCRawStream, 17)    // class for reading ZDC raw data
+    Bool_t fIsADDTDCHeader; // true if datum is an ADD TDC channel
+    Bool_t fIsADDTDCdatum;  // true if datum is an ADD TDC channel
+   
+    ClassDef(AliZDCRawStream, 18)    // class for reading ZDC raw data
 };
 
 #endif
index 42e92c1289909de6d7a4ccd8ba894070ce644989..9e7d77458125723b41ef615b0fbe77e4bb42abee 100644 (file)
@@ -1,3 +1,12 @@
+       0       1       24
+       1       1       24
+       2       1       24
+       3       1       24
+       4       1       8
+       5       6       24
+       16      2       24
+       30      3       9
+       31      4       2
        0       0       0       12      1       0
        1       0       1       13      1       1
        2       0       2       14      1       2
        45      3       11      34      5       3
        46      3       12      35      5       4
        47      3       13      48      4       5
-       0       8       0       71      -1      -1
-       1       8       1       92      -1      -1
-       2       8       2       50      -1      -1
-       3       8       3       94      -1      -1
-       4       8       9       66      -1      -1
-       5       8       12      81      -1      -1
-       6       8       13      82      -1      -1
+       0       16      0       92      -1      -1
+       1       16      1       71      1       0
+       2       16      2       93      -1      -1
+       3       16      3       76      2       0
+       4       16      4       90      -1      -1
+       5       16      5       61      4       0
+       6       16      6       91      -1      -1
+       7       16      7       66      5       0
+       8       16      8       81      3       1
+       9       16      9       82      3       2
+       10      16      10      87      -1      -1
+       11      16      11      88      -1      -1
+       12      16      12      85      -1      -1
+       13      16      13      86      -1      -1
+       14      16      14      94      -1      -1
+       15      16      15      95      -1      -1
+       16      16      16      97      -1      -1
+       17      16      17      96      -1      -1
+       18      16      18      98      -1      -1
+       19      16      19      99      -1      -1
+       20      16      20      100     -1      -1
+       21      16      21      89      -1      -1
+       22      16      22      101     -1      -1
+       23      16      23      102     -1      -1
+       24      0       0       0       0       0
+       25      0       0       0       0       0
+       26      0       0       0       0       0
+       27      0       0       0       0       0
+       28      0       0       0       0       0
+       29      0       0       0       0       0
+       30      0       0       0       0       0
+       31      0       0       0       0       0
index d4ee67cf8e39a7501f401efd568e98e30ca02009..6056c05ca0902fc80b148f8767fe4e07cfc4e736 100644 (file)
@@ -70,10 +70,30 @@ int main(int argc, char **argv) {
   TVirtualFitter::SetDefaultFitter("Minuit");
 
   int status = 0;
-  // No. of ZDC cabled ch.
+  int const kNModules = 10;
   int const kNChannels = 24;
   int const kNScChannels = 32;
   Int_t kFirstADCGeo=0, kLastADCGeo=3;
+      
+  Int_t iMod=-1;
+  Int_t modGeo[kNModules], modType[kNModules],modNCh[kNModules];
+  for(Int_t kl=0; kl<kNModules; kl++){
+     modGeo[kl]=modType[kl]=modNCh[kl]=0;
+  }
+  
+  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;
+  }
 
   /* log start of process */
   printf("ZDC EMD program started\n");  
@@ -199,24 +219,8 @@ 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){
-               
+                       
        rawStreamZDC->SetSODReading(kTRUE);
        
        // --------------------------------------------------------
@@ -226,42 +230,50 @@ int main(int argc, char **argv) {
         else{
          while((rawStreamZDC->Next())){
             if(rawStreamZDC->IsHeaderMapping()){ // mapping header
-              modNum = rawStreamZDC->GetADCModule();
-              modType = rawStreamZDC->GetModType();
+              iMod++;
+              modGeo[iMod]  = rawStreamZDC->GetADCModule();
+              modType[iMod] = rawStreamZDC->GetModType();
+              modNCh[iMod]  = rawStreamZDC->GetADCNChannels();
            }
             if(rawStreamZDC->IsChMapping()){ 
-             if(modType==1){ // ADC mapping ----------------------
+             if(modType[iMod]==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 --------------------
+             else if(modType[iMod]==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]);
-               //
+               scSec[iScCh]     = rawStreamZDC->GetScTowerFromMap(iScCh);
                iScCh++;
              }
            }
+         }
+         // Writing data on output FXS file
+         for(Int_t is=0; is<kNModules; is++){
+            fprintf(mapFile4Shuttle,"\t%d\t%d\t%d\n",
+            modGeo[is],modType[is],modNCh[is]);
+            //printf("  CalibMB DA -> Module mapping: geo %d type %d #ch %d\n",
+            //  modGeo[is],modType[is],modNCh[is]);
          }
+         for(Int_t is=0; is<2*kNChannels; is++){
+            fprintf(mapFile4Shuttle,"\t%d\t%d\t%d\t%d\t%d\t%d\n",
+              is,adcMod[is],adcCh[is],sigCode[is],det[is],sec[is]);
+            //printf("  CalibMB DA -> %d ADC: mod %d ch %d, code %d det %d, sec %d\n",
+            //  is,adcMod[is],adcCh[is],sigCode[is],det[is],sec[is]);
+         }
+         for(Int_t is=0; is<kNScChannels; is++){
+            fprintf(mapFile4Shuttle,"\t%d\t%d\t%d\t%d\t%d\t%d\n",
+              is,scMod[is],scCh[is],scSigCode[is],scDet[is],scSec[is]);
+            //printf("  CalibMB DA -> %d Scaler: mod %d ch %d, code %d det %d, sec %d\n",
+            //  is,scMod[is],scCh[is],scSigCode[is],scDet[is],scSec[is]);
+         }
+         
        }
         fclose(mapFile4Shuttle);
       }// SOD event
index 1f1a5fca86d1a95921b68c1fcd8c29c64d3f500e..afe3f8def21f5d9bc3d330664d64c01ecd05374b 100644 (file)
@@ -72,16 +72,30 @@ int main(int argc, char **argv) {
 
   int status = 0;
   // No. of ZDC cabled ch.
+  int const kNModules = 10;
   int const kNChannels = 24;
   int const kNScChannels = 32;
   Int_t kFirstADCGeo=0, kLastADCGeo=3;
-      
+            
+  Int_t iMod=-1;
+  Int_t modGeo[kNModules], modType[kNModules],modNCh[kNModules];
+  for(Int_t kl=0; kl<kNModules; kl++){
+     modGeo[kl]=modType[kl]=modNCh[kl]=0;
+  }
+  
   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;
+  }
 
   /* log start of process */
   printf("ZDC EMD program started\n");  
@@ -243,17 +257,8 @@ int main(int argc, char **argv) {
       /* use event - here, just write event id to result file */
       eventT=event->eventType;
       
-      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);
        
        // --------------------------------------------------------
@@ -263,42 +268,50 @@ int main(int argc, char **argv) {
         else{
          while((rawStreamZDC->Next())){
             if(rawStreamZDC->IsHeaderMapping()){ // mapping header
-              modNum = rawStreamZDC->GetADCModule();
-              modType = rawStreamZDC->GetModType();
+              iMod++;
+              modGeo[iMod]  = rawStreamZDC->GetADCModule();
+              modType[iMod] = rawStreamZDC->GetModType();
+              modNCh[iMod]  = rawStreamZDC->GetADCNChannels();
            }
             if(rawStreamZDC->IsChMapping()){ 
-             if(modType==1){ // ADC mapping ----------------------
+             if(modType[iMod]==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 --------------------
+             else if(modType[iMod]==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]);
-               //
+               scSec[iScCh]     = rawStreamZDC->GetScTowerFromMap(iScCh);
                iScCh++;
              }
            }
+         }
+         // Writing data on output FXS file
+         for(Int_t is=0; is<kNModules; is++){
+            fprintf(mapFile4Shuttle,"\t%d\t%d\t%d\n",
+            modGeo[is],modType[is],modNCh[is]);
+            //printf("  EMD DA -> Module mapping: geo %d type %d #ch %d\n",
+            //  modGeo[is],modType[is],modNCh[is]);
+         }
+         for(Int_t is=0; is<2*kNChannels; is++){
+            fprintf(mapFile4Shuttle,"\t%d\t%d\t%d\t%d\t%d\t%d\n",
+              is,adcMod[is],adcCh[is],sigCode[is],det[is],sec[is]);
+            //printf("  EMD DA -> %d ADC: mod %d ch %d, code %d det %d, sec %d\n",
+            //  is,adcMod[is],adcCh[is],sigCode[is],det[is],sec[is]);
          }
+         for(Int_t is=0; is<kNScChannels; is++){
+            fprintf(mapFile4Shuttle,"\t%d\t%d\t%d\t%d\t%d\t%d\n",
+              is,scMod[is],scCh[is],scSigCode[is],scDet[is],scSec[is]);
+            //printf("  EMD DA -> %d Scaler: mod %d ch %d, code %d det %d, sec %d\n",
+            //  is,scMod[is],scCh[is],scSigCode[is],scDet[is],scSec[is]);
+         }
+         
        }
         fclose(mapFile4Shuttle);
       }// SOD event
index 8f2e801153df323255aa24e3f75c8304a3f424ec..2914ecb53fefb348a2026bee95466a10b9e1de5a 100644 (file)
@@ -63,10 +63,18 @@ int main(int argc, char **argv) {
       "Minuit", "TMinuitMinimizer(const char *)");
   TVirtualFitter::SetDefaultFitter("Minuit");
 
+  
   int status = 0;
+  int const kNModules = 10;
   int const kNChannels = 24;
   int const kNScChannels = 32;
   Int_t kFirstADCGeo=0, kLastADCGeo=3;
+      
+  Int_t iMod=-1;
+  Int_t modGeo[kNModules], modType[kNModules],modNCh[kNModules];
+  for(Int_t kl=0; kl<kNModules; kl++){
+     modGeo[kl]=modType[kl]=modNCh[kl]=0;
+  }
   
   Int_t ich=0;
   Int_t adcMod[2*kNChannels], adcCh[2*kNChannels], sigCode[2*kNChannels];
@@ -74,6 +82,13 @@ int main(int argc, char **argv) {
   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;
+  }
 
   /* log start of process */
   printf("\n ZDC LASER program started\n");  
@@ -240,18 +255,11 @@ int main(int argc, char **argv) {
 
       /* use event - here, just write event id to result file */
       eventT=event->eventType;
-            
-      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){
-               
+       
+       iMod=-1; ich=0; iScCh=0;
+       
        rawStreamZDC->SetSODReading(kTRUE);
        
        // --------------------------------------------------------
@@ -261,42 +269,50 @@ int main(int argc, char **argv) {
         else{
          while((rawStreamZDC->Next())){
             if(rawStreamZDC->IsHeaderMapping()){ // mapping header
-              modNum = rawStreamZDC->GetADCModule();
-              modType = rawStreamZDC->GetModType();
+              iMod++;
+              modGeo[iMod]  = rawStreamZDC->GetADCModule();
+              modType[iMod] = rawStreamZDC->GetModType();
+              modNCh[iMod]  = rawStreamZDC->GetADCNChannels();
            }
             if(rawStreamZDC->IsChMapping()){ 
-             if(modType==1){ // ADC mapping ----------------------
+             if(modType[iMod]==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 --------------------
+             else if(modType[iMod]==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]);
-               //
+               scSec[iScCh]     = rawStreamZDC->GetScTowerFromMap(iScCh);
                iScCh++;
              }
            }
+         }
+         // Writing data on output FXS file
+         for(Int_t is=0; is<kNModules; is++){
+            fprintf(mapFile4Shuttle,"\t%d\t%d\t%d\n",
+            modGeo[is],modType[is],modNCh[is]);
+            //printf("  Laser DA -> Module mapping: geo %d type %d #ch %d\n",
+            //  modGeo[is],modType[is],modNCh[is]);
          }
+         for(Int_t is=0; is<2*kNChannels; is++){
+            fprintf(mapFile4Shuttle,"\t%d\t%d\t%d\t%d\t%d\t%d\n",
+              is,adcMod[is],adcCh[is],sigCode[is],det[is],sec[is]);
+            //printf("  Laser DA -> %d ADC: mod %d ch %d, code %d det %d, sec %d\n",
+            //  is,adcMod[is],adcCh[is],sigCode[is],det[is],sec[is]);
+         }
+         for(Int_t is=0; is<kNScChannels; is++){
+            fprintf(mapFile4Shuttle,"\t%d\t%d\t%d\t%d\t%d\t%d\n",
+              is,scMod[is],scCh[is],scSigCode[is],scDet[is],scSec[is]);
+            //printf("  Laser DA -> %d Scaler: mod %d ch %d, code %d det %d, sec %d\n",
+            //  is,scMod[is],scCh[is],scSigCode[is],scDet[is],scSec[is]);
+         }
+         
        }
         fclose(mapFile4Shuttle);
       }// SOD event
index 257ac9417f8e5c72bd6394321255c86a7c3163a8..8fdc1d543ce5fcfffcf9e56d0f643c91c7c2747c 100644 (file)
@@ -45,11 +45,12 @@ int main(int argc, char **argv) {
   monitorDeclareTable(const_cast<char**>(tableSOD));
   
   int status = 0;
+  int const kNModules = 10;
   int const kNChannels = 24;
   int const kNScChannels = 32;
 
   /* log start of process */
-  printf("\nZDC MAPPING program started\n");  
+  printf("\n ZDC MAPPING program started\n");  
 
   /* check that we got some arguments = list of files */
   if (argc<2) {
@@ -115,6 +116,14 @@ int main(int argc, char **argv) {
       /* use event - here, just write event id to result file */
       eventT=event->eventType;
       
+      if(eventT==START_OF_DATA){
+               
+      
+      Int_t iMod=-1;
+      Int_t modGeo[kNModules], modType[kNModules],modNCh[kNModules];
+      for(Int_t kl=0; kl<kNModules; kl++){
+         modGeo[kl]=modType[kl]=modNCh[kl]=0;
+      }
   
       Int_t ich=0;
       Int_t adcMod[2*kNChannels], adcCh[2*kNChannels], sigCode[2*kNChannels];
@@ -129,11 +138,7 @@ int main(int argc, char **argv) {
       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);
        
        // --------------------------------------------------------
@@ -143,42 +148,50 @@ int main(int argc, char **argv) {
         else{
          while((rawStreamZDC->Next())){
             if(rawStreamZDC->IsHeaderMapping()){ // mapping header
-              modNum = rawStreamZDC->GetADCModule();
-              modType = rawStreamZDC->GetModType();
+              iMod++;
+              modGeo[iMod]  = rawStreamZDC->GetADCModule();
+              modType[iMod] = rawStreamZDC->GetModType();
+              modNCh[iMod]  = rawStreamZDC->GetADCNChannels();
            }
             if(rawStreamZDC->IsChMapping()){ 
-             if(modType==1){ // ADC mapping ----------------------
+             if(modType[iMod]==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 --------------------
+             else if(modType[iMod]==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++;
              }
            }
+         }
+         // Writing data on output FXS file
+         for(Int_t is=0; is<kNModules; is++){
+            fprintf(mapFile4Shuttle,"\t%d\t%d\t%d\n",
+            modGeo[is],modType[is],modNCh[is]);
+            //printf("  Mapping DA -> Module mapping: geo %d type %d #ch %d\n",
+            //  modGeo[is],modType[is],modNCh[is]);
+         }
+         for(Int_t is=0; is<2*kNChannels; is++){
+            fprintf(mapFile4Shuttle,"\t%d\t%d\t%d\t%d\t%d\t%d\n",
+              is,adcMod[is],adcCh[is],sigCode[is],det[is],sec[is]);
+            //printf("  Mapping DA -> %d ADC: mod %d ch %d, code %d det %d, sec %d\n",
+            //  is,adcMod[is],adcCh[is],sigCode[is],det[is],sec[is]);
+         }
+         for(Int_t is=0; is<kNScChannels; is++){
+            fprintf(mapFile4Shuttle,"\t%d\t%d\t%d\t%d\t%d\t%d\n",
+              is,scMod[is],scCh[is],scSigCode[is],scDet[is],scSec[is]);
+            //if(scMod[is]!=0) printf("  Mapping DA -> %d Scaler: mod %d ch %d, code %d det %d, sec %d\n",
+            //  is,scMod[is],scCh[is],scSigCode[is],scDet[is],scSec[is]);
          }
+         
        }
         fclose(mapFile4Shuttle);
       }// SOD event
index 3f34c077bff48dd6322028ea7d70c86a77182d57..2a0ab007b7c4df3176f17620998e17d34cfdf2db 100644 (file)
@@ -66,9 +66,16 @@ int main(int argc, char **argv) {
   TVirtualFitter::SetDefaultFitter("Minuit");
 
   int status = 0;
+  int const kNModules = 10;
   int const kNChannels = 24;
   int const kNScChannels = 32;
   Int_t kFirstADCGeo=0, kLastADCGeo=3;
+      
+  Int_t iMod=-1;
+  Int_t modGeo[kNModules], modType[kNModules],modNCh[kNModules];
+  for(Int_t kl=0; kl<kNModules; kl++){
+     modGeo[kl]=modType[kl]=modNCh[kl]=0;
+  }
   
   Int_t ich=0;
   Int_t adcMod[2*kNChannels], adcCh[2*kNChannels], sigCode[2*kNChannels];
@@ -76,6 +83,13 @@ int main(int argc, char **argv) {
   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;
+  }
 
   /* log start of process */
   printf("\n ZDC PEDESTAL program started\n");  
@@ -229,17 +243,10 @@ int main(int argc, char **argv) {
       /* use event - here, just write event id to result file */
       eventT=event->eventType;
       
-      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){
-               
+       
+       iMod=-1; ich=0; iScCh=0;
+                       
        rawStreamZDC->SetSODReading(kTRUE);
        
        // --------------------------------------------------------
@@ -249,42 +256,50 @@ int main(int argc, char **argv) {
         else{
          while((rawStreamZDC->Next())){
             if(rawStreamZDC->IsHeaderMapping()){ // mapping header
-              modNum = rawStreamZDC->GetADCModule();
-              modType = rawStreamZDC->GetModType();
+              iMod++;
+              modGeo[iMod]  = rawStreamZDC->GetADCModule();
+              modType[iMod] = rawStreamZDC->GetModType();
+              modNCh[iMod]  = rawStreamZDC->GetADCNChannels();
            }
             if(rawStreamZDC->IsChMapping()){ 
-             if(modType==1){ // ADC mapping ----------------------
+             if(modType[iMod]==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 --------------------
+             else if(modType[iMod]==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]);
-               //
+               scSec[iScCh]     = rawStreamZDC->GetScTowerFromMap(iScCh);
                iScCh++;
              }
            }
+         }
+         // Writing data on output FXS file
+         for(Int_t is=0; is<kNModules; is++){
+            fprintf(mapFile4Shuttle,"\t%d\t%d\t%d\n",
+            modGeo[is],modType[is],modNCh[is]);
+            //printf("  Pedestal DA -> Module mapping: geo %d type %d #ch %d\n",
+            //  modGeo[is],modType[is],modNCh[is]);
+         }
+         for(Int_t is=0; is<2*kNChannels; is++){
+            fprintf(mapFile4Shuttle,"\t%d\t%d\t%d\t%d\t%d\t%d\n",
+              is,adcMod[is],adcCh[is],sigCode[is],det[is],sec[is]);
+            //printf("  Pedestal DA -> %d ADC: mod %d ch %d, code %d det %d, sec %d\n",
+            //  is,adcMod[is],adcCh[is],sigCode[is],det[is],sec[is]);
          }
+         for(Int_t is=0; is<kNScChannels; is++){
+            fprintf(mapFile4Shuttle,"\t%d\t%d\t%d\t%d\t%d\t%d\n",
+              is,scMod[is],scCh[is],scSigCode[is],scDet[is],scSec[is]);
+            //printf("  Pedestal DA -> %d Scaler: mod %d ch %d, code %d det %d, sec %d\n",
+            //  is,scMod[is],scCh[is],scSigCode[is],scDet[is],scSec[is]);
+         }
+         
        }
         fclose(mapFile4Shuttle);
       }// SOD event