]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - ZDC/AliZDCPreprocessor.cxx
Fixes in order to write correct raw-data on big-endian platforms (Marco)
[u/mrichter/AliRoot.git] / ZDC / AliZDCPreprocessor.cxx
index 19fb791184e9275df008da21cdebf046e0f4d8fc..53a8888af4b0d1fc52d98405418ed1263fd2d851 100644 (file)
@@ -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
@@ -63,11 +63,17 @@ UInt_t AliZDCPreprocessor::Process(TMap* dcsAliasMap)
 {
   // *************** From DCS ******************
   // Fills data into a AliZDCDataDCS object
-  if(!dcsAliasMap) return 0;
+  if(!dcsAliasMap) return 1;
 
   // The processing of the DCS input data is forwarded to AliZDCDataDCS
   Float_t DCSValues[26];
   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
@@ -85,8 +91,8 @@ UInt_t AliZDCPreprocessor::Process(TMap* dcsAliasMap)
   const char *ZDCn2="ZDC/NeutronZDC2";
   const char *ZDCp2="ZDC/ProtonZDC2";
   UShort_t iIndex=0;
-  AliAlignObj::ELayerID iLayer = AliAlignObj::kInvalidLayer;
-  UShort_t volid = AliAlignObj::LayerToVolUID(iLayer,iIndex);
+  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);
@@ -96,7 +102,7 @@ UInt_t AliZDCPreprocessor::Process(TMap* dcsAliasMap)
   AliCDBMetaData md;
   md.SetResponsible("Chiara Oppedisano");
   md.SetComment("Alignment object for ZDC");
-  UInt_t resultAl = 0;
+  Bool_t resultAl = kFALSE;
   resultAl = Store("Align","Data", array, &md, 0, 0);
   
   // --- Writing ZDC PTMs HV values into calibration object
@@ -108,10 +114,11 @@ UInt_t AliZDCPreprocessor::Process(TMap* dcsAliasMap)
   // *************** 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();
@@ -124,7 +131,7 @@ 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;
@@ -132,7 +139,7 @@ TString runType = GetRunType();
          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];
@@ -156,20 +163,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);
@@ -177,17 +185,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];
@@ -198,11 +206,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));
@@ -214,16 +226,15 @@ if (runType != "PEDESTALS") {
   metaData.SetResponsible("Chiara");
   metaData.SetComment("Filling AliZDCCalibData object");
 
-  UInt_t resultCal = 0;
+  Bool_t resultCal = kFALSE;
   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;
   }
   
   return result;
   
 }
-