]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - T0/AliT0Preprocessor.cxx
few mistyping fixed
[u/mrichter/AliRoot.git] / T0 / AliT0Preprocessor.cxx
index 61cda66a5831b85acce5cd2c2149574fd8fed072..0f1626b27f72c586a6e4da1791dc948fad8b9ee2 100644 (file)
@@ -17,7 +17,7 @@
 $Log: AliT0Preprocessor.cxx,v $
 Revision 1.8  2007/12/07 15:22:51  alla
 bug fixed by Alberto
-
 Revision 1.7  2007/12/06 16:35:24  alla
 new bugs fixed by Tomek
 
@@ -44,6 +44,7 @@ Preliminary test version (T.Malkiewicz)
 
 #include "AliCDBMetaData.h"
 #include "AliDCSValue.h"
+#include "AliCDBEntry.h"
 #include "AliLog.h"
 
 #include <TTimeStamp.h>
@@ -51,6 +52,7 @@ Preliminary test version (T.Malkiewicz)
 #include <TObjString.h>
 #include <TNamed.h>
 #include "AliT0Dqclass.h"
+#include "TClass.h"
 
 
 ClassImp(AliT0Preprocessor)
@@ -61,6 +63,9 @@ AliT0Preprocessor::AliT0Preprocessor(AliShuttleInterface* shuttle) :
   fData(0)
 {
   //constructor
+  AddRunType("PHYSICS");
+  AddRunType("STANDALONE");
+  AddRunType("AMPLITUDE_CALIBRATION");
 }
 //____________________________________________________
 
@@ -77,7 +82,7 @@ void AliT0Preprocessor::Initialize(Int_t run, UInt_t startTime, UInt_t endTime)
   // Creates AliT0DataDCS object
   AliPreprocessor::Initialize(run, startTime, endTime);
   AliInfo(Form("\n\tRun %d \n\tStartTime %s \n\tEndTime %s", run, TTimeStamp(startTime).AsString(), TTimeStamp(endTime).AsString()));
-  fData = new AliT0DataDCS(fRun, fStartTime, fEndTime);
+  fData = new AliT0DataDCS(fRun, fStartTime, fEndTime, GetStartTimeDCSQuery(), GetEndTimeDCSQuery());
 }
 //____________________________________________________
 
@@ -86,8 +91,11 @@ Bool_t AliT0Preprocessor::ProcessDCS(){
        TString runType = GetRunType();
        Log(Form("ProcessDCS - RunType: %s",runType.Data()));
 
-       if((runType == "STANDALONE")||(runType == "PHYSICS")){
-               return kFALSE;
+       if((runType == "STANDALONE")||
+          (runType == "PHYSICS") ){
+
+         //      return kFALSE;
+               return kTRUE;
        }else{
        return kFALSE;
        }
@@ -120,7 +128,7 @@ UInt_t AliT0Preprocessor::ProcessDCSDataPoints(TMap* dcsAliasMap){
             metaDataDCS.SetResponsible("Tomasz Malkiewicz");
             metaDataDCS.SetComment("This preprocessor fills an AliTODataDCS object.");
             AliInfo("Storing DCS Data");
-            resultDCSStore = Store("Calib","DCSData",fData, &metaDataDCS);
+            resultDCSStore = StoreReferenceData("Calib","DCSData",fData, &metaDataDCS);
             if (!resultDCSStore)
             {
               Log("Some problems occurred while storing DCS data results in ReferenceDB");
@@ -132,56 +140,63 @@ UInt_t AliT0Preprocessor::ProcessDCSDataPoints(TMap* dcsAliasMap){
 }
 //____________________________________________________
 
-UInt_t AliT0Preprocessor::ProcessLaser(){
-       // Processing data from DAQ Standalone run
-       Log("Processing Laser calibration");
-       
-       Bool_t resultLaser=kFALSE;
-       //processing DAQ
-        TList* list = GetFileSources(kDAQ, "LASER");
-        if (list)
-        {
-            TIter iter(list);
-            TObjString *source;
-            while ((source = dynamic_cast<TObjString *> (iter.Next())))
-            {
-              const char *laserFile = GetFile(kDAQ, "LASER", source->GetName());
-              if (laserFile)
-              {
-                Log(Form("File with Id LASER found in source %s!", source->GetName()));
-                AliT0CalibWalk *laser = new AliT0CalibWalk();
-                laser->MakeWalkCorrGraph(laserFile);
-                AliCDBMetaData metaData;
-                metaData.SetBeamPeriod(0);
-                metaData.SetResponsible("Tomek&Michal");
-                metaData.SetComment("Walk correction from laser runs.");
-               resultLaser=Store("Calib","Slewing_Walk", laser, &metaData, 0, 1);
-                delete laser;
-              }
-              else
-              {
-                Log(Form("Could not find file with Id LASER in source %s!", source->GetName()));
-                return 1;
-              }
-            }
-            if (!resultLaser)
-            {
-              Log("No Laser Data stored");
-              return 3;//return error code for failure in storing Laser Data
-            }
-          } else {
-               Log("No sources found for id LASER!");
-               return 1;
-         }
+UInt_t AliT0Preprocessor::ProcessLaser()
+{
+  // Processing data from DAQ Standalone run
+  Log("Processing Laser calibration - Walk Correction");
+  Bool_t resultLaser = kFALSE;
+  Bool_t writeok = kFALSE;
+  //processing DAQ
+  TList* list = GetFileSources(kDAQ, "AMPLITUDE_CALIBRATION");
+  AliT0CalibWalk *laser = new AliT0CalibWalk();
+  TObjString *source;
+  if (list)
+    {
+      TIter iter(list);
+      while ((source = dynamic_cast<TObjString *> (iter.Next())))
+       {
+         const char *laserFile = GetFile(kDAQ, "AMPLITUDE_CALIBRATION", source->GetName());
+         if (laserFile)
+           {
+             Log(Form("File with Id AMPLITUDE_CALIBRAION found in source %s!", source->GetName()));
+            writeok = laser->MakeWalkCorrGraph(laserFile);
+             
+           }
+       }
+      
+      AliCDBMetaData metaData;
+      metaData.SetBeamPeriod(0);
+      metaData.SetResponsible("Tomek&Michal");
+      metaData.SetComment("Walk correction from laser runs.");
+      if (writeok) resultLaser=Store("Calib","Slewing_Walk", laser, &metaData, 0, 1);
+      else {
+       
+       Log(Form("writeok = %d no peaks in CFD spectra",writeok));
        return 0;
+      }                  
+      Log(Form("resultLaser = %d",resultLaser));
+      if (!resultLaser)
+       {
+         Log("No Laser Data stored");
+         return 3;//return error code for failure in storing Laser Data
+       }
+    }
+  else
+    {
+      Log(Form("Could not find file with Id  AMPLITUDE_CALIBRAION "));
+      return 1;
+    }
+  
+   return 0;
 }
+
 //____________________________________________________
 
 UInt_t AliT0Preprocessor::ProcessPhysics(){
        //Processing data from DAQ Physics run
        Log("Processing Physics");
-
-       Bool_t resultOnline=kFALSE;  
+       
+       Bool_t resultOnline=kFALSE; 
        //processing DAQ
        TList* listPhys = GetFileSources(kDAQ, "PHYSICS");
         if (listPhys)
@@ -195,23 +210,31 @@ UInt_t AliT0Preprocessor::ProcessPhysics(){
               {
                 AliT0CalibTimeEq *online = new AliT0CalibTimeEq();
                 online->Reset();
-                online->ComputeOnlineParams(filePhys);
+                Bool_t writeok = online->ComputeOnlineParams(filePhys);
                 AliCDBMetaData metaData;
                 metaData.SetBeamPeriod(0);
-                metaData.SetResponsible("Tomek&Michal");
+                metaData.SetResponsible("Alla Maevskaya");
                 metaData.SetComment("Time equalizing result.");
-                resultOnline = Store("Calib","TimeDelay", online, &metaData, 0, 1);
+
+                if (writeok) resultOnline = Store("Calib","TimeDelay", online, &metaData, 0, 1);
+               else {
+                 
+                 Log(Form("writeok = %d not enough data for equalizing",resultOnline));
+                 return 0;
+               }                 
+               Log(Form("resultOnline = %d",resultOnline));
                 delete online;
               }
-              else
+               else
               {
                 Log(Form("Could not find file with Id PHYSICS in source %s!", sourcePhys->GetName()));
                 return 1;
               }
+              
             }
             if (!resultOnline)
             {
-              Log("No Laser Data stored");
+              Log("No Data stored");
               return 4;//return error code for failure in storing OCDB Data
             }
           } else {
@@ -233,27 +256,41 @@ UInt_t AliT0Preprocessor::Process(TMap* dcsAliasMap )
   // return=5 : no DAQ input for OCDB
   // return=6 : failed to retrieve DAQ data from OCDB
   // return=7 : failed to store T0 OCDB data
-       Bool_t dcsDP = ProcessDCS();
-       Log(Form("dcsDP = %d",dcsDP));  
-        TString runType = GetRunType();
-       Log(Form("RunType: %s",runType.Data()));
-       //processing
-       if(runType == "STANDALONE"){
-               Int_t iresultLaser = ProcessLaser();
-                       if(dcsDP==1){
-                       Int_t iresultDCS = ProcessDCSDataPoints(dcsAliasMap);
-                       return iresultDCS;
-               }
-               return iresultLaser;
-       }
-       else if(runType == "PHYSICS"){
-               Int_t iresultPhysics = ProcessPhysics();
-               if(dcsDP==1){
-                       Int_t iresultDCS = ProcessDCSDataPoints(dcsAliasMap);
-                       return iresultDCS;
-               }
-               return iresultPhysics; 
-       }       
-
-  return 0;
+  // return=8 : not enough data for equalizing
+  Bool_t dcsDP = ProcessDCS();
+  Log(Form("dcsDP = %d",dcsDP));       
+  TString runType = GetRunType();
+  Log(Form("RunType: %s",runType.Data()));
+  //processing
+  if(runType == "STANDALONE"){
+    if(dcsDP==1){
+      Int_t iresultDCS = ProcessDCSDataPoints(dcsAliasMap);
+      return iresultDCS;
+    }
+  }
+  
+  if(runType == "AMPLITUDE_CALIBRATION"){
+    Int_t iresultLaser = ProcessLaser();
+    if(dcsDP==1){
+      Int_t iresultDCS = ProcessDCSDataPoints(dcsAliasMap);
+      return iresultDCS;
+    }
+    
+    Log(Form("iresultLaser = %d",iresultLaser));
+    return iresultLaser;
+  }
+  
+  else if(runType == "PHYSICS"){
+    Int_t iresultPhysics = ProcessPhysics();
+    if(dcsDP==1){
+      Int_t iresultDCS = ProcessDCSDataPoints(dcsAliasMap);
+      return iresultDCS;
+    }
+    Log(Form("iresultPhysics = %d",iresultPhysics));
+         return iresultPhysics; 
+      }
+  
+       
+       
+       return 0;
 }