]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - ZDC/AliZDCPreprocessor.cxx
Updated classes to cope with new digits/raw data
[u/mrichter/AliRoot.git] / ZDC / AliZDCPreprocessor.cxx
index 9be87f3ee726d57eec95b46d0c8906d806c2b503..72430e856bec9b90f9e67f9163c5f860cec1d537 100644 (file)
@@ -11,7 +11,7 @@
 #include "AliCDBMetaData.h"
 #include "AliDCSValue.h"
 #include "AliAlignObj.h"
-#include "AliAlignObjAngles.h"
+#include "AliAlignObjParams.h"
 #include "AliLog.h"
 #include "AliZDCDataDCS.h"
 #include "AliZDCCalibData.h"
@@ -25,8 +25,8 @@
 ClassImp(AliZDCPreprocessor)
 
 //______________________________________________________________________________________________
-AliZDCPreprocessor::AliZDCPreprocessor(const char* detector, AliShuttleInterface* shuttle) :
-  AliPreprocessor(detector, shuttle),
+AliZDCPreprocessor::AliZDCPreprocessor(AliShuttleInterface* shuttle) :
+  AliPreprocessor("ZDC", shuttle),
   fData(0)
 {
   // constructor
@@ -66,20 +66,14 @@ UInt_t AliZDCPreprocessor::Process(TMap* dcsAliasMap)
   if(!dcsAliasMap) return 1;
 
   // The processing of the DCS input data is forwarded to AliZDCDataDCS
-  Float_t DCSValues[26];
+  Float_t DCSValues[28]; // DCSAliases=28
   fData->ProcessData(*dcsAliasMap, DCSValues);
-  // Store DCS data for reference
-  AliCDBMetaData metadata;
-  metadata.SetResponsible("Chiara Oppedisano");
-  metadata.SetComment("DCS data for ZDC");
-  Bool_t resStore = kFALSE;
-  resStore = StoreReferenceData("DCS","Data",fData,&metadata);
   //dcsAliasMap->Print("");
   //
   // --- Writing ZDC table positions into alignment object
-  TClonesArray *array = new TClonesArray("AliAlignObjAngles",10);
+  TClonesArray *array = new TClonesArray("AliAlignObjParams",10);
   TClonesArray &alobj = *array;
-  AliAlignObjAngles a;
+  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.);
@@ -94,10 +88,10 @@ UInt_t AliZDCPreprocessor::Process(TMap* dcsAliasMap)
   AliGeomManager::ELayerID iLayer = AliGeomManager::kInvalidLayer;
   UShort_t volid = AliGeomManager::LayerToVolUID(iLayer,iIndex);
   //
-  new(alobj[0]) AliAlignObjAngles(ZDCn1, volid, dx, dyZN1, dz, dpsi, dtheta, dphi, kTRUE);
-  new(alobj[1]) AliAlignObjAngles(ZDCp1, volid, dx, dyZP1, dz, dpsi, dtheta, dphi, kTRUE);
-  new(alobj[2]) AliAlignObjAngles(ZDCn2, volid, dx, dyZN2, dz, dpsi, dtheta, dphi, kTRUE);
-  new(alobj[3]) AliAlignObjAngles(ZDCp2, volid, dx, dyZP2, dz, dpsi, dtheta, dphi, kTRUE);
+  new(alobj[0]) AliAlignObjParams(ZDCn1, volid, dx, dyZN1, dz, dpsi, dtheta, dphi, kTRUE);
+  new(alobj[1]) AliAlignObjParams(ZDCp1, volid, dx, dyZP1, dz, dpsi, dtheta, dphi, kTRUE);
+  new(alobj[2]) AliAlignObjParams(ZDCn2, volid, dx, dyZN2, dz, dpsi, dtheta, dphi, kTRUE);
+  new(alobj[3]) AliAlignObjParams(ZDCp2, volid, dx, dyZP2, dz, dpsi, dtheta, dphi, kTRUE);
   // save in CDB storage
   AliCDBMetaData md;
   md.SetResponsible("Chiara Oppedisano");
@@ -105,19 +99,16 @@ UInt_t AliZDCPreprocessor::Process(TMap* dcsAliasMap)
   Bool_t resultAl = kFALSE;
   resultAl = Store("Align","Data", array, &md, 0, 0);
   
-  // --- Writing ZDC PTMs HV values into calibration object
   AliZDCCalibData *calibdata = new AliZDCCalibData("ZDC");
-  for(Int_t j=0; j<22; j++)
-     calibdata->SetPMTHVVal(j,DCSValues[j+4]);
-
   
   // *************** From DAQ ******************
   // [a] PEDESTALS
 TString runType = GetRunType();
+if (runType = "PEDESTAL_RUN") {
   TList* daqSources = GetFileSources(kDAQ, "PEDESTALS");
   if(!daqSources){
     Log(Form("No source for PEDESTALS run %d !", fRun));
-    return 0;
+    return 1;
   }
   Log("\t List of sources for PEDESTALS");
   daqSources->Print();
@@ -130,15 +121,16 @@ TString runType = GetRunType();
        TString stringPedFileName = GetFile(kDAQ, "PEDESTALS", source->GetName());
        if(stringPedFileName.Length() <= 0){
           Log(Form("No PEDESTAL file from source %s!", source->GetName()));
-         return 0;
+         return 1;
        }
        const char* PedFileName = stringPedFileName.Data();
-       const Int_t NZDCch = 44;
+       // no. ADCch = (22 signal ch. + 2 reference PMs) * 2 gain chain = 48
+       const Int_t NZDCch = 48;
        if(PedFileName){
          FILE *file;
          if((file = fopen(PedFileName,"r")) == NULL){
            printf("Cannot open file %s \n",PedFileName);
-          return 0;
+          return 1;
          }
          Log(Form("File %s connected to analyze pedestal events", PedFileName));
          Float_t PedVal[(3*NZDCch)][2];
@@ -162,20 +154,21 @@ TString runType = GetRunType();
        }
        else{
           Log(Form("File %s not found", PedFileName));
-          return 0;
+          return 1;
        }
        //
       //calibdata->Print("");
   }
   delete daqSources; daqSources = 0;
-  // [a] EMD EVENTS
-if (runType != "PEDESTALS") {
-  TList* daqSources = GetFileSources(kDAQ, "EMDCALIB");
+}
+  // [b] EMD EVENTS
+else if (runType == "PHYSICS") {
+  TList* daqSources = GetFileSources(kDAQ, "PHYSICS");
   if(!daqSources){
-    AliError(Form("No sources for EMDCALIB run %d !", fRun));
-    return 0;
+    AliError(Form("No sources for PHYSICS run %d !", fRun));
+    return 1;
   }
-  Log("\t List of sources for EMDCALIB");
+  Log("\t List of sources for PHYSICS");
   daqSources->Print();
   //
   TIter iter2(daqSources);
@@ -183,17 +176,17 @@ if (runType != "PEDESTALS") {
   Int_t j=0;
   while((source = dynamic_cast<TObjString*> (iter2.Next()))){
        Log(Form("\n\t Getting file #%d\n",++j));
-       TString stringEMDFileName = GetFile(kDAQ, "EMDCALIB", source->GetName());
+       TString stringEMDFileName = GetFile(kDAQ, "PHYSICS", source->GetName());
        if(stringEMDFileName.Length() <= 0){
-         Log(Form("No EMDCALIB file from source %s!", source->GetName()));
-        return 0;
+         Log(Form("No PHYSICS file from source %s!", source->GetName()));
+        return 1;
        }
        const char* EMDFileName = stringEMDFileName.Data();
        if(EMDFileName){
         FILE *file;
         if((file = fopen(EMDFileName,"r")) == NULL){
           printf("Cannot open file %s \n",EMDFileName);
-          return 0;
+          return 1;
         }
         Log(Form("File %s connected to analyze EM dissociation events", EMDFileName));
         Float_t EMDFitVal[2];
@@ -204,11 +197,15 @@ if (runType != "PEDESTALS") {
        }
        else{
          Log(Form("File %s not found", EMDFileName));
-         return 0;
+         return 1;
        }
        //calibdata->Print("");
   }
-}  
+} 
+else {
+  Log(Form("Nothing to do: run type is %s", runType.Data()));
+  return 0;
+} 
   // 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));
@@ -224,8 +221,8 @@ if (runType != "PEDESTALS") {
   resultCal = Store("Calib","Data",calibdata, &metaData, 0, 1);
  
   UInt_t result = 0;
-  if(resultAl!=0 && resultCal!=0){
-    if(resultAl==1 && resultCal==1) result = 1;
+  if(resultAl == kFALSE || resultCal == kFALSE){
+    if(resultAl == kFALSE  && resultCal == kFALSE ) result = 3;
     else result = 2;
   }