]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Updated classes
authorcoppedis <coppedis@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 20 Jul 2009 07:41:13 +0000 (07:41 +0000)
committercoppedis <coppedis@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 20 Jul 2009 07:41:13 +0000 (07:41 +0000)
ZDC/AliZDCDataDCS.cxx
ZDC/AliZDCDataDCS.h
ZDC/AliZDCPreprocessor.cxx
ZDC/AliZDCPreprocessor.h
ZDC/AliZDCReconstructor.cxx
ZDC/AliZDCv3.cxx
ZDC/TestZDCPreprocessor.C

index 4a22274b1e50d8b9f716d617ecda248d36e6ff35..19d9a88fbe74ee2f74823118f16fb9749db8a226 100644 (file)
@@ -26,31 +26,88 @@ AliZDCDataDCS::AliZDCDataDCS():
    fRun(0),
    fStartTime(0),
    fEndTime(0),
+   fStartTimeDCSQuery(0),
+   fEndTimeDCSQuery(0),
    fGraphs("TGraph",kNGraphs),
    fIsProcessed(kFALSE)
 {
   // Default constructor
+  for(Int_t i=0; i<kNAliases; i++){   
+     fAliasNames[i] = "";
+     fCalibData[i] = 0.; 
+     fTimeStamp[i] = 0.; 
+  }
 }
 
 //---------------------------------------------------------------
-AliZDCDataDCS::AliZDCDataDCS(Int_t nRun, UInt_t startTime, UInt_t endTime):
+AliZDCDataDCS::AliZDCDataDCS(Int_t nRun, UInt_t startTime, UInt_t endTime,
+                        UInt_t startTimeDCSQuery, UInt_t endTimeDCSQuery):
    TObject(),
    fRun(nRun),
    fStartTime(startTime),
    fEndTime(endTime),
+   fStartTimeDCSQuery(startTimeDCSQuery),
+   fEndTimeDCSQuery(endTimeDCSQuery),
    fGraphs("TGraph",kNGraphs),
    fIsProcessed(kFALSE)
 {
    // Standard constructor
    
-   AliDebug(2,Form("\n\tRun %d \n\tStartTime %s \n\tEndTime %s", nRun,
+   AliDebug(2,Form("\n\tRun %d \n\tStartTime %s \n\tEndTime %s \n\tStartTime DCS Query %s \n\tEndTime DCS Query %s", nRun,
    TTimeStamp(startTime).AsString(),
-   TTimeStamp(endTime).AsString()));
+   TTimeStamp(endTime).AsString(), 
+   TTimeStamp(startTimeDCSQuery).AsString(), 
+   TTimeStamp(endTimeDCSQuery).AsString()));
 
    Init();
 
 }
 
+//---------------------------------------------------------------
+AliZDCDataDCS::AliZDCDataDCS(const AliZDCDataDCS & data):
+  TObject(data), 
+  fRun(data.fRun),
+  fStartTime(data.fStartTime),
+  fEndTime(data.fEndTime),
+  fStartTimeDCSQuery(data.fStartTimeDCSQuery),
+  fEndTimeDCSQuery(data.fEndTimeDCSQuery),
+  fGraphs(data.fGraphs),
+  fIsProcessed(data.fIsProcessed)
+{
+
+  // copy constructor
+
+  for(int i=0;i<kNAliases;i++) {
+    fAliasNames[i]=data.fAliasNames[i];
+  }
+  
+    
+}
+
+//---------------------------------------------------------------
+AliZDCDataDCS& AliZDCDataDCS:: operator=(const AliZDCDataDCS & data) { 
+
+  // assignment operator
+
+  if (this == &data)
+    return *this;
+
+  TObject::operator=(data);
+  fRun = data.GetRun();
+  fStartTime = data.GetStartTime();
+  fEndTime = data.GetEndTime();
+  fStartTimeDCSQuery = data.GetStartTimeDCSQuery();
+  fEndTimeDCSQuery = data.GetEndTimeDCSQuery();
+
+  for(int i=0;i<kNAliases;i++) {
+    fAliasNames[i]=data.GetAliasName(i);
+    fCalibData[i]=data.GetCalibData(i);
+    fTimeStamp[i]=data.GetTimeStamp(i);
+  }
+
+  return *this;
+}
+
 //---------------------------------------------------------------
 AliZDCDataDCS::~AliZDCDataDCS() 
 {
@@ -59,17 +116,28 @@ AliZDCDataDCS::~AliZDCDataDCS()
 }
 
 //---------------------------------------------------------------
-void AliZDCDataDCS::ProcessData(TMap& aliasMap)
+Bool_t AliZDCDataDCS::ProcessData(TMap& aliasMap)
 {
    // Data processing
+
+   if (fEndTime==fStartTime){
+     AliError(Form(" Run with null time length: start time = %i = end time = %i",fStartTime,fEndTime));
+     return kFALSE;
+   }
+   
+   AliInfo(Form(" Start Time = %i",fStartTime));
+   AliInfo(Form(" End Time = %i",fEndTime));
+   AliInfo(Form(" Start Time DCS Query= %i",fStartTimeDCSQuery));
+   AliInfo(Form(" End Time DCS Query= %i",fEndTimeDCSQuery));
    
    TObjArray *aliasArr;
    AliDCSValue* aValue;
+  
    for(int j=0; j<kNAliases; j++){
       aliasArr = (TObjArray*) aliasMap.GetValue(fAliasNames[j].Data());
       if(!aliasArr){
        AliWarning(Form("Alias %s not found!", fAliasNames[j].Data()));
-       continue;
+       return kFALSE;
       }
       Introduce(j, aliasArr);
 
@@ -87,7 +155,7 @@ void AliZDCDataDCS::ProcessData(TMap& aliasMap)
       UInt_t ne=0;
       while((aValue = (AliDCSValue*) iterarray.Next())) {
        val[ne] = aValue->GetFloat();
-       time[ne] = (Double_t) (aValue->GetTimeStamp());
+       time[ne] = (Float_t) (aValue->GetTimeStamp());
        fCalibData[ne] = val[ne];
        fTimeStamp[ne] = time[ne];
        ne++;
@@ -100,7 +168,8 @@ void AliZDCDataDCS::ProcessData(TMap& aliasMap)
    }
    //
    fIsProcessed=kTRUE;
-
+   
+   return kTRUE;
 }
 
 //---------------------------------------------------------------
index 06bcfadf03acb75bc1eb552317119882ca7e1c72..bbf9c7079d38b5825d574d798d7719e8cb82dc71 100644 (file)
 
 class AliZDCDataDCS : public TObject {
 public:
-       enum {kNAliases=28, kNGraphs=24};
-
-       AliZDCDataDCS();
-       AliZDCDataDCS(Int_t nRun, UInt_t startTime, UInt_t endTime);
-       ~AliZDCDataDCS();
-
-       void SetRun(Int_t run) {fRun = run;}
-       void SetStartTime(Int_t startTime) {fStartTime = startTime;}
-       void SetEndTime(Int_t endTime) {fEndTime = endTime;}
-       void SetCalibData(Float_t *val) 
-            {for(Int_t i=0; i<kNAliases; i++) fCalibData[i] = val[i];}
-       void SetCalibData(Int_t i, Float_t val) {fCalibData[i] = val;} 
-       //
-       Int_t GetRun() {return fRun;}
-       Int_t GetStartTime() {return fStartTime;}
-       Int_t GetEndTime() {return fEndTime;}
-       Float_t GetCalibData() {return *fCalibData;}
-       Float_t GetCalibData(Int_t i) {return fCalibData[i];}
-
-       void ProcessData(TMap& aliasMap);
-
-       const char* GetAliasName(UInt_t pos)
-                       {return pos<kNAliases ? fAliasNames[pos].Data() : 0;}
-
-       const TGraph* GetGraph(UInt_t pos)
-                       {return pos<kNGraphs ? ((TGraph*) fGraphs.UncheckedAt(pos)) : 0;}
-
-       Double_t Eval(int pos, Double_t time)
-                       {return pos<kNGraphs ? ((TGraph*) fGraphs.UncheckedAt(pos))->Eval(time) : -1;}
-
-       void Draw(const Option_t* option);
+    enum {kNAliases=28, kNGraphs=24};
+
+    AliZDCDataDCS();
+    AliZDCDataDCS(Int_t nRun, UInt_t startTime, UInt_t endTime, 
+                  UInt_t startTimeDCSQuery, UInt_t endTimeDCSQuery);
+    AliZDCDataDCS(const AliZDCDataDCS & data);
+    AliZDCDataDCS& operator=(const AliZDCDataDCS & data);
+    ~AliZDCDataDCS();
+
+    void SetRun(Int_t run) {fRun = run;}
+    void SetStartTime(Int_t startTime) {fStartTime = startTime;}
+    void SetEndTime(Int_t endTime) {fEndTime = endTime;}
+    void SetStartTimeDCSQuery(Int_t startTimeDCSQuery) {fStartTimeDCSQuery = startTimeDCSQuery;}
+    void SetEndTimeDCSQuery(Int_t endTimeDCSQuery) {fEndTimeDCSQuery = endTimeDCSQuery;}
+    void SetCalibData(Float_t *val) {for(Int_t i=0; i<kNAliases; i++) fCalibData[i] = val[i];}
+    void SetCalibData(Int_t i, Float_t val) {fCalibData[i] = val;} 
+    //
+    Int_t GetRun() const {return fRun;}
+    Int_t GetStartTime() const {return fStartTime;}
+    Int_t GetEndTime() const {return fEndTime;}
+    Int_t GetStartTimeDCSQuery() const {return fStartTimeDCSQuery;}
+    Int_t GetEndTimeDCSQuery() const {return fEndTimeDCSQuery;}
+    Float_t GetCalibData() const {return *fCalibData;}
+    Float_t GetCalibData(Int_t i) const {return fCalibData[i];}
+    Float_t GetTimeStamp() const {return *fTimeStamp;}
+    Float_t GetTimeStamp(Int_t i) const {return fTimeStamp[i];}
+
+    Bool_t ProcessData(TMap& aliasMap);
+
+    const char* GetAliasName(UInt_t pos) const
+               {return pos<kNAliases ? fAliasNames[pos].Data() : 0;}
+
+    const TGraph* GetGraph(UInt_t pos) const
+                 {return pos<kNGraphs ? ((TGraph*) fGraphs.UncheckedAt(pos)) : 0;}
+
+    Double_t Eval(int pos, Double_t time)
+             {return pos<kNGraphs ? ((TGraph*) fGraphs.UncheckedAt(pos))->Eval(time) : -1;}
+
+    void Draw(const Option_t* /*option*/);
 
 
 private:
-       void Init();
-       void Introduce(UInt_t numAlias, const TObjArray* aliasArr);
-       void CreateGraph(int i, int dim, const Double_t *x, const Double_t *y);
+    void Init();
+    void Introduce(UInt_t numAlias, const TObjArray* aliasArr);
+    void CreateGraph(int i, int dim, const Double_t *x, const Double_t *y);
 
-       Int_t fRun;             // Run number
-       UInt_t fStartTime;      // Start of run time
-       UInt_t fEndTime;        // End of run time
+    Int_t  fRun;           // Run number
+    UInt_t fStartTime;      // Start of run time
+    UInt_t fEndTime;       // End of run time
+    Int_t  fStartTimeDCSQuery; // start time DCSQuery
+    Int_t  fEndTimeDCSQuery;   // end time DCSQuery
 
-       TString fAliasNames[kNAliases]; // Name of the aliases provided by the DCS
-       Double_t fCalibData[kNAliases]; // Array containing calibration data
-       Double_t fTimeStamp[kNAliases]; // Array containing time stamps
+    TString  fAliasNames[kNAliases];// Name of the aliases provided by the DCS
+    Double_t fCalibData[kNAliases]; // Array containing calibration data
+    Float_t  fTimeStamp[kNAliases]; // Array containing time stamps
 
-       TClonesArray fGraphs;           // Array containing PTM HV graphics
+    TClonesArray fGraphs;          // Array containing PTM HV graphics
 
-       Bool_t fIsProcessed;            // Flag set when data are processed
+    Bool_t fIsProcessed;           // Flag set when data are processed
 
-       ClassDef(AliZDCDataDCS, 3);
+    ClassDef(AliZDCDataDCS, 4);
 };
 
 #endif
index 543e1b3c2eec42aaab31e171d0b161ac0bee7857..fa8fea7f2a8a9025cd5a318081a55ec0669e2132 100644 (file)
 //                                                                //
 /////////////////////////////////////////////////////////////////////
 
+// ******************************************************************
+//    RETURN CODES:
+// return=0 : everything OK
+// return=1 : no DCS input data Map
+// return=2 : error when storing in RefData DCS processed data
+// return=3 : error in storing alignment object in OCDB
+// return=4 : error retrieving/reading data file from DAQ FXS
+// return=5 : error when storing ADC ch. mapping in OCDB
+// return=6 : error when storing energy calibration coefficients
+// return=7 : error when storing tower inter-calibration coefficients
+// return=8 : error when storing pedestal parameters in OCDB
+// return=9 : error when storing pedestal histos in RefData
+// return=10: error when storing laser coefficients in OCDB
+// return=11: error when storing laser histos in RefData
+// ******************************************************************
+
 ClassImp(AliZDCPreprocessor)
 
 //______________________________________________________________________________________________
@@ -65,33 +81,108 @@ void AliZDCPreprocessor::Initialize(Int_t run, UInt_t startTime,
 
   AliPreprocessor::Initialize(run, startTime, endTime);
 
-  Log(Form("\n\tRun %d \n\tStartTime %s \n\tEndTime %s", run,
-         TTimeStamp(startTime).AsString(),
-         TTimeStamp(endTime).AsString()));
+  AliInfo(Form("\n\tRun %d \n\tStartTime %s \n\tEndTime %s \n\tStartTime DCS Query %s \n\tEndTime DCS Query %s", run,
+               TTimeStamp(startTime).AsString(),
+               TTimeStamp(endTime).AsString(), ((TTimeStamp)GetStartTimeDCSQuery()).AsString(), ((TTimeStamp)GetEndTimeDCSQuery()).AsString()));
 
   fRun = run;
   fStartTime = startTime;
   fEndTime = endTime;
 
-  fData = new AliZDCDataDCS(fRun, fStartTime, fEndTime);
+  fData = new AliZDCDataDCS(fRun, fStartTime, fEndTime, GetStartTimeDCSQuery(), GetEndTimeDCSQuery());
+}
+
+//_____________________________________________________________________________
+Bool_t AliZDCPreprocessor::ProcessDCS(){
+
+  // tells whether DCS should be processed or not
+
+  TString runType = GetRunType();
+  Log(Form("RunType %s",runType.Data()));
+
+  if (runType=="STANDALONE_COSMIC" || runType=="STANDALONE_PEDESTAL"){
+    return kFALSE;
+  }
+
+  return kTRUE;
+}
+
+//______________________________________________________________________________________________
+UInt_t AliZDCPreprocessor::ProcessDCSData(TMap* dcsAliasMap)
+{
+  
+  // Fills data into a AliZDCDataDCS object
+  if(!dcsAliasMap) return 1;
+  Log(Form("Processing data from DCS"));
+  // The processing of the DCS input data is forwarded to AliZDCDataDCS
+  Float_t dcsValues[28]; // DCSAliases=28
+  fData->SetCalibData(dcsValues);
+  Bool_t resDCSProcess = fData->ProcessData(*dcsAliasMap);
+  //dcsAliasMap->Print(""); 
+  if(resDCSProcess==kFALSE) Log(" Problems in processing DCS DP");
+  
+  // Store DCS data for reference
+  AliCDBMetaData metadata;
+  metadata.SetResponsible("Chiara Oppedisano");
+  metadata.SetComment("DCS data for ZDC");
+  Bool_t resDCSRef = kTRUE;
+  resDCSRef = StoreReferenceData("DCS","Data",fData,&metadata);
+  
+  if(resDCSRef==kFALSE) return 2;
+
+  // --- Writing ZDC table positions into alignment object
+  TClonesArray *array = new TClonesArray("AliAlignObjParams",10);
+  TClonesArray &alobj = *array;
+  AliAlignObjParams a;
+  Double_t dx=0., dz=0., dpsi=0., dtheta=0., dphi=0.;
+  // Vertical table position in mm from DCS
+  Double_t dyZN1 = (Double_t) (dcsValues[0]/10.);
+  Double_t dyZP1 = (Double_t) (dcsValues[1]/10.);
+  Double_t dyZN2 = (Double_t) (dcsValues[2]/10.);
+  Double_t dyZP2 = (Double_t) (dcsValues[3]/10.);
+  //
+  const char *n1ZDC="ZDC/NeutronZDC_C";  
+  const char *p1ZDC="ZDC/ProtonZDC_C";
+  const char *n2ZDC="ZDC/NeutronZDC_A";
+  const char *p2ZDC="ZDC/ProtonZDC_A";
+  //
+  UShort_t iIndex=0;
+  AliGeomManager::ELayerID iLayer = AliGeomManager::kInvalidLayer;
+  UShort_t volid = AliGeomManager::LayerToVolUID(iLayer,iIndex);
+  //
+  new(alobj[0]) AliAlignObjParams(n1ZDC, volid, dx, dyZN1, dz, dpsi, dtheta, dphi, kTRUE);
+  new(alobj[1]) AliAlignObjParams(p1ZDC, volid, dx, dyZP1, dz, dpsi, dtheta, dphi, kTRUE);
+  new(alobj[2]) AliAlignObjParams(n2ZDC, volid, dx, dyZN2, dz, dpsi, dtheta, dphi, kTRUE);
+  new(alobj[3]) AliAlignObjParams(p2ZDC, volid, dx, dyZP2, dz, dpsi, dtheta, dphi, kTRUE);
+  // save in CDB storage
+  AliCDBMetaData mdDCS;
+  mdDCS.SetResponsible("Chiara Oppedisano");
+  mdDCS.SetComment("Alignment object for ZDC");
+  Bool_t resultAl = Store("Align","Data", array, &mdDCS, 0, 0);
+  if(resultAl==kFALSE)  return 3;
+  
+  return 0;
 }
 
 //______________________________________________________________________________________________
 UInt_t AliZDCPreprocessor::ProcessChMap(TString runType)
 { 
+  const int kNch = 48;
+  
   // Reading the file for mapping from FXS
   TList* daqSource = GetFileSources(kDAQ, runType.Data());
   if(!daqSource){
     AliError(Form("No sources run %d for run type %s!", fRun, runType.Data()));
-    return 1;
+    return 4;
   }
   Log("\t List of DAQ sources for mapping "); daqSource->Print();
   //
   TIter iter(daqSource);
   TObjString* source = 0;
   Int_t isou = 0;
-  Int_t res = 999;
-  Int_t readMap[48][6]; 
+  Int_t readMap[kNch][6]; 
   //
   while((source = dynamic_cast<TObjString*> (iter.Next()))){
      Log(Form("\n\t Getting file #%d\n",++isou));
@@ -99,7 +190,7 @@ UInt_t AliZDCPreprocessor::ProcessChMap(TString runType)
 
      if(fileName.Length() <= 0){
        Log(Form("No file from source %s!", source->GetName()));
-       return 1;
+       return 4;
      }
      // --- Reading file with calibration data
      //const char* fname = fileName.Data();
@@ -107,23 +198,21 @@ UInt_t AliZDCPreprocessor::ProcessChMap(TString runType)
        FILE *file;
        if((file = fopen(fileName,"r")) == NULL){
         printf("Cannot open file %s \n",fileName.Data());
-         return 1;
+         return 4;
        }
        Log(Form("File %s connected to process data for ADC mapping", fileName.Data()));
        //
-       for(Int_t j=0; j<48; j++){        
+       for(Int_t j=0; j<kNch; j++){      
            for(Int_t k=0; k<6; k++){
              int read = fscanf(file,"%d",&readMap[j][k]);
-            if(read == 0){
-              printf("\t WARNING! Failing in reading datum [%d][%d]\n",j,k);
-            }
+            if(read == 0) AliDebug(3," Failing in reading data from mapping file");
            }
        }
        fclose(file);
      }
      else{
        Log(Form("File %s not found", fileName.Data()));
-       return 1;
+       return 4;
      }
   }
   delete daqSource; daqSource=0;
@@ -139,7 +228,7 @@ UInt_t AliZDCPreprocessor::ProcessChMap(TString runType)
   }
   else{
     AliZDCChMap *chMap = (AliZDCChMap*) cdbEntry->GetObject();
-    for(Int_t i=0; i<48; i++){
+    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)) 
@@ -150,13 +239,14 @@ UInt_t AliZDCPreprocessor::ProcessChMap(TString runType)
     }
   }
   //
+  Bool_t resChMapStore = kTRUE;
   if(updateOCDB==kTRUE){
     Log(" A new entry ZDC/Calib/ChMap will be created");
     //
     // --- Initializing mapping calibration object
     AliZDCChMap *mapCalib = new AliZDCChMap("ZDC");
     // Writing channel map in the OCDB
-    for(Int_t k=0; k<48; k++){
+    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]);
@@ -169,92 +259,30 @@ UInt_t AliZDCPreprocessor::ProcessChMap(TString runType)
     metaData.SetResponsible("Chiara Oppedisano");
     metaData.SetComment("Filling AliZDCChMap object");  
     //
-    res = Store("Calib","ChMap",mapCalib, &metaData, 0, 1);
+    resChMapStore = Store("Calib","ChMap",mapCalib, &metaData, 0, 1);
   }
   else{
     Log(" ZDC/Calib/ChMap entry in OCDB is valid and won't be updated");
-    res = kTRUE;
+    resChMapStore = kTRUE;
   }
-
   
-  return res;
+  if(resChMapStore==kFALSE) return 5;
+  
+  return 0;
 
 }
 
 //______________________________________________________________________________________________
-UInt_t AliZDCPreprocessor::Process(TMap* dcsAliasMap)
+UInt_t AliZDCPreprocessor::ProcessppData()
 {
- // ********************************* From DCS ************************************
- // Fills data into a AliZDCDataDCS object
- if(!dcsAliasMap) return 1;
- Log(Form("Processing data from DCS"));
- // The processing of the DCS input data is forwarded to AliZDCDataDCS
- Float_t dcsValues[28]; // DCSAliases=28
- fData->SetCalibData(dcsValues);
- fData->ProcessData(*dcsAliasMap);
- // Store DCS data for reference
- AliCDBMetaData metadata;
- metadata.SetResponsible("Chiara Oppedisano");
- metadata.SetComment("DCS data for ZDC");
- Bool_t resDCSRef = kTRUE;
- resDCSRef = StoreReferenceData("DCS","Data",fData,&metadata);
- //dcsAliasMap->Print("");
-
- // --- Writing ZDC table positions into alignment object
- TClonesArray *array = new TClonesArray("AliAlignObjParams",10);
- TClonesArray &alobj = *array;
- AliAlignObjParams a;
- Double_t dx=0., dz=0., dpsi=0., dtheta=0., dphi=0.;
- // Vertical table position in mm from DCS
- Double_t dyZN1 = (Double_t) (dcsValues[0]/10.);
- Double_t dyZP1 = (Double_t) (dcsValues[1]/10.);
- Double_t dyZN2 = (Double_t) (dcsValues[2]/10.);
- Double_t dyZP2 = (Double_t) (dcsValues[3]/10.);
- //
- const char *n1ZDC="ZDC/NeutronZDC_C";  
- const char *p1ZDC="ZDC/ProtonZDC_C";
- const char *n2ZDC="ZDC/NeutronZDC_A";
- const char *p2ZDC="ZDC/ProtonZDC_A";
- //
- UShort_t iIndex=0;
- AliGeomManager::ELayerID iLayer = AliGeomManager::kInvalidLayer;
- UShort_t volid = AliGeomManager::LayerToVolUID(iLayer,iIndex);
- //
- new(alobj[0]) AliAlignObjParams(n1ZDC, volid, dx, dyZN1, dz, dpsi, dtheta, dphi, kTRUE);
- new(alobj[1]) AliAlignObjParams(p1ZDC, volid, dx, dyZP1, dz, dpsi, dtheta, dphi, kTRUE);
- new(alobj[2]) AliAlignObjParams(n2ZDC, volid, dx, dyZN2, dz, dpsi, dtheta, dphi, kTRUE);
- new(alobj[3]) AliAlignObjParams(p2ZDC, volid, dx, dyZP2, dz, dpsi, dtheta, dphi, kTRUE);
- // save in CDB storage
- AliCDBMetaData md;
- md.SetResponsible("Chiara Oppedisano");
- md.SetComment("Alignment object for ZDC");
- Bool_t resultAl = kTRUE;
- resultAl = Store("Align","Data", array, &md, 0, 0);
+   Bool_t resEnCal=kTRUE, resTowCal=kTRUE;
   
- // ********************************* From DAQ ************************************
- Bool_t resChMap=kTRUE, resPedCal=kTRUE, resPedHist=kTRUE;
- Bool_t resLaserCal=kTRUE, resLaserHist=kTRUE;
- Bool_t resEnCal=kTRUE, resTowCal=kTRUE;
- // 
- const char* beamType = GetRunParameter("beamType");
- TString runType = GetRunType();
- printf("\n\t AliZDCPreprocessor -> beamType %s\n",beamType);
- printf("\t AliZDCPreprocessor -> runType  %s\n\n",runType.Data());
- // -------------- p-p data -------------
- // NO ENERGY CALIBRATION -> coefficients set to 1.
- // Temp -> also inter-calibration coefficients are set to 1.
- if(strcmp(beamType,"p-p")==0){
    // *********** Energy calibration
    // --- Cheking if there is already the entry in the OCDB
    AliCDBEntry *cdbEnEntry = GetFromOCDB("Calib", "EnergyCalib");
    if(!cdbEnEntry){   
      Log(Form(" ZDC/Calib/EnergyCalib entry will be created"));
      // --- Initializing calibration object
-     // 
      AliCDBMetaData metaData;
      metaData.SetBeamPeriod(0);
      metaData.SetResponsible("Chiara Oppedisano");
@@ -270,6 +298,9 @@ UInt_t AliZDCPreprocessor::Process(TMap* dcsAliasMap)
      Log(Form(" Valid ZDC/Calib/EnergyCalib object already existing in OCDB!!!"));
      resEnCal = kTRUE;
    }
+   
+   if(resEnCal==kFALSE) return 6;
+
    //
    // *********** Tower inter-calibration
    // --- Cheking if there is already the entry in the OCDB
@@ -297,50 +328,144 @@ UInt_t AliZDCPreprocessor::Process(TMap* dcsAliasMap)
      resTowCal = kTRUE;
    }
    
-   // *********** Tower relative calibration
-   // --- Cheking if there is already the entry in the OCDB
-   AliCDBEntry *cdbSEntry = GetFromOCDB("Calib", "TowerCalib");
-   if(!cdbSEntry){   
-     Log(Form(" ZDC/Calib/TowerCalib entry will be created"));
-     // --- Initializing calibration object
-     AliZDCTowerCalib *towCalib = new AliZDCTowerCalib("ZDC");
-     //
-     for(Int_t j=0; j<5; j++){  
-        towCalib->SetZN1EqualCoeff(j, 1.);
-        towCalib->SetZP1EqualCoeff(j, 1.);
-        towCalib->SetZN2EqualCoeff(j, 1.);
-        towCalib->SetZP2EqualCoeff(j, 1.);  
-     }
-     //towCalib->Print("");
-     // 
-     AliCDBMetaData metaData;
-     metaData.SetBeamPeriod(0);
-     metaData.SetResponsible("Chiara Oppedisano");
-     metaData.SetComment("AliZDCTowerCalib object");  
-     //
-     resTowCal = Store("Calib", "TowerCalib", towCalib, &metaData, 0, 1);
-   }
-   else{ 
-     // if entry exists it is still valid (=1 for all runs!)
-     Log(Form(" Valid ZDC/Calib/TowerCalib object already existing in OCDB!!!"));
-     resEnCal = kTRUE;
-   }
- }
- // ******************************************
- //   ZDC ADC channel mapping
- // ******************************************
- resChMap = ProcessChMap(runType);
- // 
- // *****************************************************
- // [a] PEDESTALS -> Pedestal subtraction
- // *****************************************************
- // 
- if(runType=="STANDALONE_PEDESTAL"){
+   if(resTowCal==kFALSE) return 7;
+   
+   return 0;
+}
+
+//______________________________________________________________________________________________
+UInt_t AliZDCPreprocessor::ProcessCalibData()
+{
+  TList* daqSources = GetFileSources(kDAQ, "ENERGYCALIB");
+  if(!daqSources){
+    AliError(Form("No sources for CALIBRATION_EMD run %d !", fRun));
+    return 4;
+  }
+  Log("\t List of DAQ sources for CALIBRATION_EMD run");
+  daqSources->Print();
+  //
+  TIter iter2(daqSources);
+  TObjString* source = 0;
+  Int_t i=0;
+  Bool_t resEnCal=kTRUE;
+  while((source = dynamic_cast<TObjString*> (iter2.Next()))){
+    Log(Form("\n\t Getting file #%d\n",++i));
+    TString stringEMDFileName = GetFile(kDAQ, "ENERGYCALIB", source->GetName());
+    if(stringEMDFileName.Length() <= 0){
+      Log(Form("No file from source %s!", source->GetName()));
+      return 4;
+    }
+    // --- Initializing energy calibration object
+    AliZDCEnCalib *eCalib = new AliZDCEnCalib("ZDC");
+    // --- Reading file with pedestal calibration data
+    const char* emdFileName = stringEMDFileName.Data();
+    if(emdFileName){
+      FILE *file;
+      if((file = fopen(emdFileName,"r")) == NULL){
+       printf("Cannot open file %s \n",emdFileName);
+       return 4;
+      }
+      Log(Form("File %s connected to process data from EM dissociation events", emdFileName));
+      //
+      Float_t fitValEMD[6];
+      for(Int_t j=0; j<6; j++){        
+       if(j<6){
+         int iread = fscanf(file,"%f",&fitValEMD[j]);
+         if(iread==0) AliDebug(3," Failing reading daa from EMD calibration data file");
+         eCalib->SetEnCalib(j,fitValEMD[j]);
+       }
+      }
+      //
+      fclose(file);
+    }
+    else{
+      Log(Form("File %s not found", emdFileName));
+      return 4;
+    }
+    //eCalib->Print("");
+    // 
+    AliCDBMetaData metaData;
+    metaData.SetBeamPeriod(0);
+    metaData.SetResponsible("Chiara Oppedisano");
+    metaData.SetComment("Filling AliZDCEnCalib object");  
+    //
+    resEnCal = Store("Calib","EnergyCalib",eCalib, &metaData, 0, 1);
+    if(resEnCal==kFALSE) return 6;
+  }
+  delete daqSources; daqSources = 0;
+   
+
+  TList* daqSourcesH = GetFileSources(kDAQ, "TOWERCALIB");
+  if(!daqSourcesH){
+    AliError(Form("No sources for CALIBRATION_EMD run %d !", fRun));
+    return 4;
+  }
+  Log("\t List of DAQ sources for CALIBRATION_EMD run");
+  daqSourcesH->Print();
+  //
+  TIter iter2H(daqSourcesH);
+  TObjString* sourceH = 0;
+  Int_t iH=0;
+  Bool_t resTowCal=kTRUE;
+  while((sourceH = dynamic_cast<TObjString*> (iter2H.Next()))){
+    Log(Form("\n\t Getting file #%d\n",++iH));
+    TString stringEMDFileName = GetFile(kDAQ, "TOWERCALIB", sourceH->GetName());
+    if(stringEMDFileName.Length() <= 0){
+      Log(Form("No file from source %s!", sourceH->GetName()));
+      return 4;
+    }
+    // --- Initializing energy calibration object
+    AliZDCTowerCalib *towCalib = new AliZDCTowerCalib("ZDC");
+    // --- Reading file with pedestal calibration data
+    const char* emdFileName = stringEMDFileName.Data();
+    if(emdFileName){
+      FILE *file;
+      if((file = fopen(emdFileName,"r")) == NULL){
+       printf("Cannot open file %s \n",emdFileName);
+       return 4;
+      }
+      Log(Form("File %s connected to process data from EM dissociation events", emdFileName));
+      //
+      Float_t equalCoeff[4][5];
+      for(Int_t j=0; j<4; j++){        
+        for(Int_t k=0; k<5; k++){
+           int leggi = fscanf(file,"%f",&equalCoeff[j][k]);
+           if(leggi==0) AliDebug(3," Failing reading data from EMD calibration file");
+           if(j==0)      towCalib->SetZN1EqualCoeff(k, equalCoeff[j][k]);
+           else if(j==1) towCalib->SetZP1EqualCoeff(k, equalCoeff[j][k]);
+           else if(j==2) towCalib->SetZN2EqualCoeff(k, equalCoeff[j][k]);
+           else if(j==3) towCalib->SetZP2EqualCoeff(k, equalCoeff[j][k]);  
+        }
+      }
+      //
+      fclose(file);
+    }
+    else{
+      Log(Form("File %s not found", emdFileName));
+      return 4;
+    }
+    //towCalib->Print("");
+    // 
+    AliCDBMetaData metaData;
+    metaData.SetBeamPeriod(0);
+    metaData.SetResponsible("Chiara Oppedisano");
+    metaData.SetComment("Filling AliZDCTowerCalib object");  
+    //
+    resTowCal = Store("Calib","TowerCalib",towCalib, &metaData, 0, 1);
+    if(resTowCal==kFALSE) return 7;
+  }
+  delete daqSources; daqSources = 0;
+  
+  return 0;
+}
+
+//______________________________________________________________________________________________
+UInt_t AliZDCPreprocessor::ProcessPedestalData()
+{
   TList* daqSources = GetFileSources(kDAQ, "PEDESTALDATA");
   if(!daqSources){
     Log(Form("No source for STANDALONE_PEDESTAL run %d !", fRun));
-    return 1;
+    return 4;
   }
   Log("\t List of DAQ sources for STANDALONE_PEDESTAL run");
   daqSources->Print();
@@ -348,61 +473,66 @@ UInt_t AliZDCPreprocessor::Process(TMap* dcsAliasMap)
   TIter iter(daqSources);
   TObjString* source = 0;
   Int_t i=0;
+  Bool_t resPedCal=kTRUE;
   while((source = dynamic_cast<TObjString*> (iter.Next()))){
      Log(Form("\n\t Getting file #%d\n",++i));
      TString stringPedFileName = GetFile(kDAQ, "PEDESTALDATA", source->GetName());
      if(stringPedFileName.Length() <= 0){
        Log(Form("No PEDESTAL file from source %s!", source->GetName()));
-        return 1;
+        return 4;
      }
      // calibration data
-       // --- Initializing pedestal calibration object
-       AliZDCPedestals *pedCalib = new AliZDCPedestals("ZDC");
-       // --- Reading file with pedestal calibration data
-       const char* pedFileName = stringPedFileName.Data();
-       // no. ADCch = (22 signal ch. + 2 reference PMs) * 2 gain chain = 48
-       const Int_t knZDCch = 48;
+     // --- Initializing pedestal calibration object
+     AliZDCPedestals *pedCalib = new AliZDCPedestals("ZDC");
+     // --- Reading file with pedestal calibration data
+     const char* pedFileName = stringPedFileName.Data();
+     // no. ADCch = (22 signal ch. + 2 reference PMs) * 2 gain chain = 48
+     const Int_t knZDCch = 48;
 
-       FILE *file;
-       if((file = fopen(pedFileName,"r")) == NULL){
-         printf("Cannot open file %s \n",pedFileName);
-         return 1;
-       }
-       Log(Form("File %s connected to process pedestal data", pedFileName));
-       Float_t pedVal[(2*knZDCch)][2];
-       for(Int_t k=0; k<(2*knZDCch); k++){
-          for(Int_t j=0; j<2; j++){
-             fscanf(file,"%f",&pedVal[k][j]);
-             //if(j==1) printf("pedVal[%d] -> %f, %f \n",k,pedVal[k][0],pedVal[k][1]);
-          }
-          if(k<knZDCch){
-            pedCalib->SetMeanPed(k,pedVal[k][0]);
-            pedCalib->SetMeanPedWidth(k,pedVal[k][1]);
-          }
-          else if(k>=knZDCch && k<(2*knZDCch)){
-            pedCalib->SetOOTPed(k-knZDCch,pedVal[k][0]);
-            pedCalib->SetOOTPedWidth(k-knZDCch,pedVal[k][1]);
-          }
-          else if(k>=(2*knZDCch) && k<(3*knZDCch)){
-            pedCalib->SetPedCorrCoeff(k-(2*knZDCch),pedVal[k][0],pedVal[k][1]);
-          }
-       }
-       fclose(file);
-       //pedCalib->Print("");
-       // 
-       AliCDBMetaData metaData;
-       metaData.SetBeamPeriod(0);
-       metaData.SetResponsible("Chiara Oppedisano");
-       metaData.SetComment("Filling AliZDCPedestals object");  
-       //
-       resPedCal = Store("Calib","Pedestals",pedCalib, &metaData, 0, 1);
+     FILE *file;
+     if((file = fopen(pedFileName,"r")) == NULL){
+       printf("Cannot open file %s \n",pedFileName);
+       return 4;
+     }
+     Log(Form("File %s connected to process pedestal data", pedFileName));
+     Float_t pedVal[(2*knZDCch)][2];
+     for(Int_t k=0; k<(2*knZDCch); k++){
+       for(Int_t j=0; j<2; j++){
+          int aleggi = fscanf(file,"%f",&pedVal[k][j]);
+          if(aleggi==0) AliDebug(3," Failing reading data from pedestal file");
+          //if(j==1) printf("pedVal[%d] -> %f, %f \n",k,pedVal[k][0],pedVal[k][1]);
+       }
+       if(k<knZDCch){
+         pedCalib->SetMeanPed(k,pedVal[k][0]);
+         pedCalib->SetMeanPedWidth(k,pedVal[k][1]);
+       }
+       else if(k>=knZDCch && k<(2*knZDCch)){
+         pedCalib->SetOOTPed(k-knZDCch,pedVal[k][0]);
+         pedCalib->SetOOTPedWidth(k-knZDCch,pedVal[k][1]);
+       }
+       else if(k>=(2*knZDCch) && k<(3*knZDCch)){
+         pedCalib->SetPedCorrCoeff(k-(2*knZDCch),pedVal[k][0],pedVal[k][1]);
+       }
+     }
+     fclose(file);
+     //pedCalib->Print("");
+     // 
+     AliCDBMetaData metaData;
+     metaData.SetBeamPeriod(0);
+     metaData.SetResponsible("Chiara Oppedisano");
+     metaData.SetComment("Filling AliZDCPedestals object");  
+     //
+     resPedCal = Store("Calib","Pedestals",pedCalib, &metaData, 0, 1);
+     if(resPedCal==kFALSE) return 8;
   }
   delete daqSources; daqSources = 0;
+
   //
+  Bool_t resPedHist=kTRUE;
   TList* daqSourceH = GetFileSources(kDAQ, "PEDHISTOS");
   if(!daqSourceH){
     Log(Form("No source for STANDALONE_PEDESTAL run %d !", fRun));
-    return 1;
+    return 4;
   }
   Log("\t List of DAQ sources for STANDALONE_PEDESTAL run");
   daqSourceH->Print();
@@ -415,7 +545,7 @@ UInt_t AliZDCPreprocessor::Process(TMap* dcsAliasMap)
      TString stringPedFileName = GetFile(kDAQ, "PEDHISTOS", sourceH->GetName());
      if(stringPedFileName.Length() <= 0){
        Log(Form("No PEDESTAL file from source %s!", sourceH->GetName()));
-        return 1;
+        return 4;
      }
      TFile *histoFile = TFile::Open(stringPedFileName.Data());
      //
@@ -423,13 +553,17 @@ UInt_t AliZDCPreprocessor::Process(TMap* dcsAliasMap)
      metadata1.SetResponsible("Chiara Oppedisano");
      metadata1.SetComment("Pedestal histos");
      resPedHist = StoreReferenceData("Histos","Pedestal", histoFile, &metadata1);
+     if(resPedHist==kFALSE) return 9;
   }
   delete daqSourceH; daqSourceH = 0;
- }
- // *****************************************************
- // [b] STANDALONE_LASER EVENTS -> Signal stability
- // *****************************************************
- else if(runType=="STANDALONE_LASER"){
+  
+  
+  return 0;
+}
+
+//______________________________________________________________________________________________
+UInt_t AliZDCPreprocessor::ProcessLaserData()
+{
   TList* daqSources = GetFileSources(kDAQ, "LASERDATA");
   if(!daqSources){
     AliError(Form("No sources for STANDALONE_LASER run %d !", fRun));
@@ -441,6 +575,7 @@ UInt_t AliZDCPreprocessor::Process(TMap* dcsAliasMap)
   TIter iter2(daqSources);
   TObjString* source = 0;
   Int_t i=0;
+  Bool_t resLaserCal=kTRUE;
   while((source = dynamic_cast<TObjString*> (iter2.Next()))){
      Log(Form("\n\t Getting file #%d\n",++i));
      TString stringLASERFileName = GetFile(kDAQ, "LASERDATA", source->GetName());
@@ -463,7 +598,8 @@ UInt_t AliZDCPreprocessor::Process(TMap* dcsAliasMap)
        Float_t ivalRead[22][4]; 
        for(Int_t j=0; j<22; j++){
          for(Int_t k=0; k<4; k++){
-           fscanf(file,"%f",&ivalRead[j][k]);
+           int aleggi = fscanf(file,"%f",&ivalRead[j][k]);
+           if(aleggi==0) AliDebug(3," Failng reading data from laser file");
             //printf(" %d %1.0f  ",k, ivalRead[j][k]);
           }
           lCalib->SetDetector(j, (Int_t) ivalRead[j][0]);
@@ -485,9 +621,11 @@ UInt_t AliZDCPreprocessor::Process(TMap* dcsAliasMap)
      metaData.SetComment("Filling AliZDCLaserCalib object");  
      //
      resLaserCal = Store("Calib","LaserCalib",lCalib, &metaData, 0, 1);
+     if(resLaserCal==kFALSE) return 10;
   }
   delete daqSources; daqSources = 0;
-  //
+  
+  
   TList* daqSourceH = GetFileSources(kDAQ, "LASERHISTOS");
   if(!daqSourceH){
     AliError(Form("No sources for STANDALONE_LASER run %d !", fRun));
@@ -499,6 +637,7 @@ UInt_t AliZDCPreprocessor::Process(TMap* dcsAliasMap)
   TIter iter2H(daqSourceH);
   TObjString* sourceH = 0;
   Int_t iH=0;
+  Bool_t resPedHist = kTRUE;
   while((sourceH = dynamic_cast<TObjString*> (iter2H.Next()))){
      Log(Form("\n\t Getting file #%d\n",++iH));
      TString stringLASERFileName = GetFile(kDAQ, "LASERHISTOS", sourceH->GetName());
@@ -512,148 +651,65 @@ UInt_t AliZDCPreprocessor::Process(TMap* dcsAliasMap)
      metadata2.SetResponsible("Chiara Oppedisano");
      metadata2.SetComment("Laser run histos");
      resPedHist = StoreReferenceData("Histos", "Laser", histoFile, &metadata2);
+     //
+     if(resPedHist==kFALSE) return 11;
   }
   delete daqSourceH; daqSourceH = 0;
- }
+  
+  return 0;
+}
+
+//______________________________________________________________________________________________
+UInt_t AliZDCPreprocessor::Process(TMap* dcsAliasMap)
+{
+ UInt_t resDCS = 0;
+ UInt_t resChMap=0;
+ UInt_t resEnergyCalib=0, resPedestalCalib=0, resLaserCalib=0;
+
+ // ************************* Process DCS data ****************************
+ if(ProcessDCS()) resDCS = ProcessDCSData(dcsAliasMap);
+  
+ // ********************************* From DAQ ************************************
+
+ const char* beamType = GetRunParameter("beamType");
+ TString runType = GetRunType();
+ printf("\n\t AliZDCPreprocessor -> beamType %s, runType %s\n",beamType,runType.Data());
+
+ // ******************************************
+ //   ADC channel mapping
+ // ******************************************
+ resChMap = ProcessChMap(runType);
+ // ******************************************
+ //   Calibration param. for p-p data (all = 1)
+ // ******************************************
+ // NO ENERGY CALIBRATION -> coefficients set to 1.
+ // Temp -> also inter-calibration coefficients are set to 1.
+ if(strcmp(beamType,"P-P")==0) resEnergyCalib = ProcessppData();
  // *****************************************************
- // [c] EMD EVENTS -> Energy calibration and equalization
+ //  EMD EVENTS -> Energy calibration and equalization
  // *****************************************************
- else if(runType=="CALIBRATION_EMD" && strcmp(beamType,"Pb-Pb")==0){
-  TList* daqSources = GetFileSources(kDAQ, "ENERGYCALIB");
-  if(!daqSources){
-    AliError(Form("No sources for CALIBRATION_EMD run %d !", fRun));
-    return 1;
-  }
-  Log("\t List of DAQ sources for CALIBRATION_EMD run");
-  daqSources->Print();
-  //
-  TIter iter2(daqSources);
-  TObjString* source = 0;
-  Int_t i=0;
-  while((source = dynamic_cast<TObjString*> (iter2.Next()))){
-    Log(Form("\n\t Getting file #%d\n",++i));
-    TString stringEMDFileName = GetFile(kDAQ, "ENERGYCALIB", source->GetName());
-    if(stringEMDFileName.Length() <= 0){
-      Log(Form("No file from source %s!", source->GetName()));
-      return 1;
-    }
-    // --- Initializing energy calibration object
-    AliZDCEnCalib *eCalib = new AliZDCEnCalib("ZDC");
-    // --- Reading file with pedestal calibration data
-    const char* emdFileName = stringEMDFileName.Data();
-    if(emdFileName){
-      FILE *file;
-      if((file = fopen(emdFileName,"r")) == NULL){
-       printf("Cannot open file %s \n",emdFileName);
-       return 1;
-      }
-      Log(Form("File %s connected to process data from EM dissociation events", emdFileName));
-      //
-      Float_t fitValEMD[6];
-      for(Int_t j=0; j<6; j++){        
-       if(j<6){
-         fscanf(file,"%f",&fitValEMD[j]);
-         eCalib->SetEnCalib(j,fitValEMD[j]);
-       }
-      }
-      //
-      fclose(file);
-    }
-    else{
-      Log(Form("File %s not found", emdFileName));
-      return 1;
-    }
-    //eCalib->Print("");
-    // 
-    AliCDBMetaData metaData;
-    metaData.SetBeamPeriod(0);
-    metaData.SetResponsible("Chiara Oppedisano");
-    metaData.SetComment("Filling AliZDCEnCalib object");  
-    //
-    resEnCal = Store("Calib","EnergyCalib",eCalib, &metaData, 0, 1);
-  }
-  delete daqSources; daqSources = 0;
-  //
-  TList* daqSourcesH = GetFileSources(kDAQ, "TOWERCALIB");
-  if(!daqSourcesH){
-    AliError(Form("No sources for CALIBRATION_EMD run %d !", fRun));
-    return 1;
-  }
-  Log("\t List of DAQ sources for CALIBRATION_EMD run");
-  daqSourcesH->Print();
-  //
-  TIter iter2H(daqSourcesH);
-  TObjString* sourceH = 0;
-  Int_t iH=0;
-  while((sourceH = dynamic_cast<TObjString*> (iter2H.Next()))){
-    Log(Form("\n\t Getting file #%d\n",++iH));
-    TString stringEMDFileName = GetFile(kDAQ, "TOWERCALIB", sourceH->GetName());
-    if(stringEMDFileName.Length() <= 0){
-      Log(Form("No file from source %s!", sourceH->GetName()));
-      return 1;
-    }
-    // --- Initializing energy calibration object
-    AliZDCTowerCalib *towCalib = new AliZDCTowerCalib("ZDC");
-    // --- Reading file with pedestal calibration data
-    const char* emdFileName = stringEMDFileName.Data();
-    if(emdFileName){
-      FILE *file;
-      if((file = fopen(emdFileName,"r")) == NULL){
-       printf("Cannot open file %s \n",emdFileName);
-       return 1;
-      }
-      Log(Form("File %s connected to process data from EM dissociation events", emdFileName));
-      //
-      Float_t equalCoeff[4][5];
-      for(Int_t j=0; j<4; j++){        
-        for(Int_t k=0; k<5; k++){
-           fscanf(file,"%f",&equalCoeff[j][k]);
-           if(j==0)      towCalib->SetZN1EqualCoeff(k, equalCoeff[j][k]);
-           else if(j==1) towCalib->SetZP1EqualCoeff(k, equalCoeff[j][k]);
-           else if(j==2) towCalib->SetZN2EqualCoeff(k, equalCoeff[j][k]);
-           else if(j==3) towCalib->SetZP2EqualCoeff(k, equalCoeff[j][k]);  
-        }
-      }
-      //
-      fclose(file);
-    }
-    else{
-      Log(Form("File %s not found", emdFileName));
-      return 1;
-    }
-    //towCalib->Print("");
-    // 
-    AliCDBMetaData metaData;
-    metaData.SetBeamPeriod(0);
-    metaData.SetResponsible("Chiara Oppedisano");
-    metaData.SetComment("Filling AliZDCTowerCalib object");  
-    //
-    resTowCal = Store("Calib","TowerCalib",towCalib, &metaData, 0, 1);
-  }
-  delete daqSources; daqSources = 0;
- }//Pb-Pb if
-
+ if(runType=="CALIBRATION_EMD" && strcmp(beamType,"A-A")==0) 
+   resEnergyCalib =  ProcessCalibData();
+ // *****************************************************
+ // STANDALONE_PEDESTALS -> Pedestal subtraction 
+ // *****************************************************
+ if(runType=="STANDALONE_PEDESTAL") resPedestalCalib = ProcessPedestalData();
+ // *****************************************************
+ // STANDALONE_LASER -> Signal stability and ageing 
+ // *****************************************************
+ if(runType=="STANDALONE_LASER") resLaserCalib = ProcessLaserData();
 
-  // note that the parameters are returned as character strings!
-  const char* nEvents = GetRunParameter("totalEvents");
-  if(nEvents) Log(Form("Number of events for run %d: %s",fRun, nEvents));
-  else Log(Form("Number of events not put in logbook!"));
+ if(resDCS!=0)               return resDCS;
+ else if(resChMap!=0)        return resChMap;
+ else if(resEnergyCalib!=0)   return resEnergyCalib;
+ else if(resPedestalCalib!=0) return resPedestalCalib;
+ else if(resLaserCalib!=0)    return resLaserCalib;
  
-  UInt_t result = 0;
-  if(resDCSRef==kFALSE || resultAl==kFALSE || resPedCal==kFALSE || resPedHist==kFALSE ||
-     resLaserCal==kFALSE || resLaserHist==kFALSE || resEnCal==kFALSE || resTowCal || 
-     resChMap==kFALSE){
-      if(resDCSRef == kFALSE)         result = 1;
-      else if(resultAl == kFALSE)     result = 2;
-      else if(resChMap == kFALSE)     result = 3;
-      else if(resPedCal == kFALSE)    result = 4;
-      else if(resPedHist == kFALSE)   result = 5;
-      else if(resLaserCal == kFALSE)  result = 6;
-      else if(resLaserHist == kFALSE) result = 7;
-      else if(resEnCal == kFALSE)     result = 8;
-      else if(resTowCal == kFALSE)    result = 9;
-  }
-  
-  return result;
+ return 0;
   
 }
index bc12bfa08331bd6106fb6993280908784bc9a382..871a5b5bfea52d6b10ce57290b8c7b65ee5d41ec 100644 (file)
@@ -24,12 +24,19 @@ class AliZDCPreprocessor : public AliPreprocessor
   protected:
     virtual void Initialize(Int_t run, UInt_t startTime, UInt_t endTime);
     virtual UInt_t Process(TMap* dcsAliasMap);
-    virtual UInt_t ProcessChMap(TString runType);
+    virtual Bool_t ProcessDCS();
     AliZDCPreprocessor(const AliZDCPreprocessor&);
     AliZDCPreprocessor& operator=(const AliZDCPreprocessor&);
 
   private:
-    AliZDCDataDCS *fData;    // CDB class that stores the data
+    UInt_t ProcessDCSData(TMap* dcsAliasMap);
+    UInt_t ProcessChMap(TString runType);
+    UInt_t ProcessppData();
+    UInt_t ProcessCalibData();
+    UInt_t ProcessPedestalData();
+    UInt_t ProcessLaserData();
+
+    AliZDCDataDCS *fData;    // OCDB class that stores DCS data
 
     ClassDef(AliZDCPreprocessor, 0);
 };
index 7dfc4b1bed8715af65fa77deee06529e6f871fdf..cc68018568e77fa68f39c4468c00560c67cbff5f 100644 (file)
@@ -118,18 +118,10 @@ void AliZDCReconstructor::Init()
       AliError("\t ZDC does not reconstruct event 4 UNKNOWN beam type\n");
       return;
     }
-    if((beamType.CompareTo("P-P")) == 0){
-      fRecoMode=1;
-      fRecoParam = (AliZDCRecoParampp*) GetppRecoParamFromOCDB();
-      AliInfo(" Getting AliZDCRecoParampp object from OCDB \n");
-    }
+    if((beamType.CompareTo("P-P")) == 0) fRecoMode=1;
     else if((beamType.CompareTo("A-A")) == 0){
       fRecoMode=2;
-      if(fIsCalibrationMB == kFALSE){ 
-         fRecoParam = (AliZDCRecoParamPbPb*) GetPbPbRecoParamFromOCDB();
-         AliInfo(" Getting AliZDCRecoParamPbPb object from OCDB\n");
-      }
-      else{
+      if(fIsCalibrationMB == kTRUE){ 
         fRecoParam = new AliZDCRecoParamPbPb();
         //
         TH2F* hZDCvsZEM = new TH2F("hZDCvsZEM","hZDCvsZEM",100,0.,10.,100,0.,1000.);
index a60b879e53aff013b1763928dbf270fbae024757..2565e0e58c625be39631d707c4de183f92f76494 100644 (file)
@@ -2238,12 +2238,17 @@ void AliZDCv3::InitTables()
      return;
   }
   
+  int read=1;
   for(k=0; k<fNalfan; k++){
      for(j=0; j<fNben; j++){
-       fscanf(fp1,"%f",&fTablen[0][k][j]);
-       fscanf(fp2,"%f",&fTablen[1][k][j]);
-       fscanf(fp3,"%f",&fTablen[2][k][j]);
-       fscanf(fp4,"%f",&fTablen[3][k][j]);
+       read = fscanf(fp1,"%f",&fTablen[0][k][j]);
+       if(read==0) AliDebug(3, " Error in reading light table 1");
+       read = fscanf(fp2,"%f",&fTablen[1][k][j]);
+       if(read==0) AliDebug(3, " Error in reading light table 2");
+       read = fscanf(fp3,"%f",&fTablen[2][k][j]);
+       if(read==0) AliDebug(3, " Error in reading light table 3");
+       read = fscanf(fp4,"%f",&fTablen[3][k][j]);
+       if(read==0) AliDebug(3, " Error in reading light table 4");
      } 
   }
   fclose(fp1);
@@ -2275,10 +2280,14 @@ void AliZDCv3::InitTables()
   
   for(k=0; k<fNalfap; k++){
      for(j=0; j<fNbep; j++){
-       fscanf(fp5,"%f",&fTablep[0][k][j]);
-       fscanf(fp6,"%f",&fTablep[1][k][j]);
-       fscanf(fp7,"%f",&fTablep[2][k][j]);
-       fscanf(fp8,"%f",&fTablep[3][k][j]);
+       read = fscanf(fp5,"%f",&fTablep[0][k][j]);
+       if(read==0) AliDebug(3, " Error in reading light table 5");
+       read = fscanf(fp6,"%f",&fTablep[1][k][j]);
+       if(read==0) AliDebug(3, " Error in reading light table 6");
+       read = fscanf(fp7,"%f",&fTablep[2][k][j]);
+       if(read==0) AliDebug(3, " Error in reading light table 7");
+       read = fscanf(fp8,"%f",&fTablep[3][k][j]);
+       if(read==0) AliDebug(3, " Error in reading light table 8");
      } 
   }
   fclose(fp5);
index ca7d6bb812c0d33855af6fcac89c9624cab16ce1..5abccce3f1598f11baed848cd161aaea8c75c2a4 100644 (file)
@@ -19,8 +19,8 @@ void TestZDCPreprocessor(Int_t obj=0)
 
   // TODO if needed, change location of OCDB and Reference test folders
   // by default they are set to $ALICE_ROOT/SHUTTLE/TestShuttle/TestCDB and TestReference
-  AliTestShuttle::SetMainCDB("local://$ALICE_ROOT/OCDB/SHUTTLE/TestShuttle/TestCDB");
-  AliTestShuttle::SetMainRefStorage("local://$ALICE_ROOT/OCDB/SHUTTLE/TestShuttle/TestReference");
+  AliTestShuttle::SetMainCDB("local://$ALICE_ROOT/SHUTTLE/TestShuttle/TestCDB");
+  AliTestShuttle::SetMainRefStorage("local://$ALICE_ROOT/SHUTTLE/TestShuttle/TestReference");
 
   printf("Test OCDB storage Uri: %s\n", AliShuttleInterface::GetMainCDB().Data());
   printf("Test Reference storage Uri: %s\n", AliShuttleInterface::GetMainRefStorage().Data());
@@ -92,7 +92,7 @@ void TestZDCPreprocessor(Int_t obj=0)
   // To test it, we must provide the run parameters manually. They will be retrieved in the preprocessor
   // using GetRunParameter function.
   // In real life the parameters will be retrieved automatically from the run logbook;
-  //shuttle->AddInputRunParameter("beamType", "Pb-Pb");
+  //shuttle->AddInputRunParameter("beamType", "A-A");
   shuttle->AddInputRunParameter("beamType", "p-p");
   shuttle->AddInputRunParameter("totalEvents", "1000");
   shuttle->AddInputRunParameter("NumberOfGDCs", "1");