]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - T0/AliT0Preprocessor.cxx
working version of preprocessor
[u/mrichter/AliRoot.git] / T0 / AliT0Preprocessor.cxx
index ace6b789b574be270c3dda321e0fedd3c7547a34..283682aa7b1c4d3c87d5bdac1cfc70ed2bc5405c 100644 (file)
  **************************************************************************/
 
 /*
-$Log$
+$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
+
+Revision 1.5  2007/11/23 19:28:52  alla
+bug fixed
+
 Version 2.1  2007/11/21 
 Preprocessor storing data to OCDB (T.Malkiewicz)
 
 Version 1.1  2006/10   
 Preliminary test version (T.Malkiewicz)
 */   
-
 // T0 preprocessor:
-// 1) takes data from DCS and passes it to the class AliTOFDataDCS for processing and writes the result to the Reference DB.
-// 2) takes data form DAQ (both from Laser Calibration and Physics runs), processes it, and stores either to OCDB or to Reference DB.
+// 1) takes data from DCS and passes it to the class AliTOFDataDCS 
+// for processing and writes the result to the Reference DB.
+// 2) takes data form DAQ (both from Laser Calibration and Physics runs), 
+// processes it, and stores either to OCDB or to Reference DB.
+
 
 #include "AliT0Preprocessor.h"
 #include "AliT0DataDCS.h"
@@ -45,8 +56,9 @@ Preliminary test version (T.Malkiewicz)
 ClassImp(AliT0Preprocessor)
 
 //____________________________________________________
-AliT0Preprocessor::AliT0Preprocessor(AliShuttleInterface* shuttle) : AliPreprocessor("T00", shuttle),
-fData(0)
+AliT0Preprocessor::AliT0Preprocessor(AliShuttleInterface* shuttle) : 
+  AliPreprocessor("T00", shuttle), 
+  fData(0)
 {
   //constructor
 }
@@ -54,6 +66,7 @@ fData(0)
 
 AliT0Preprocessor::~AliT0Preprocessor()
 {
+  //destructor
   delete fData;
   fData = 0;
 }
@@ -61,6 +74,7 @@ AliT0Preprocessor::~AliT0Preprocessor()
 
 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);
@@ -83,20 +97,19 @@ UInt_t AliT0Preprocessor::Process(TMap* dcsAliasMap )
        Bool_t resultDCSStore=kFALSE;
        Bool_t resultLaser=kFALSE;
        Bool_t resultOnline=kFALSE;  
-
-       // processing DCS
-       
-       if(!dcsAliasMap) 
-       {
-         Log("No DCS input data");     
-         return 1;
-       }
-       else
-       { 
-         resultDCSMap=fData->ProcessData(*dcsAliasMap);
-         if(!resultDCSMap)
-         {
-           Log("Error when processing DCS data");
+     
+        if(!dcsAliasMap)
+        {
+          Log("No DCS input data");
+          return 1;
+        }
+        else
+        {
+        /* 
+          resultDCSMap=fData->ProcessData(*dcsAliasMap);
+          if(!resultDCSMap)
+          {
+            Log("Error when processing DCS data");
             return 2;// return error Code for processed DCS data not stored
           }
           else
@@ -108,121 +121,95 @@ UInt_t AliT0Preprocessor::Process(TMap* dcsAliasMap )
             AliInfo("Storing DCS Data");
             resultDCSStore = Store("Calib","DCSData",fData, &metaDataDCS);
             if (!resultDCSStore)
-           {
+            {
               Log("Some problems occurred while storing DCS data results in ReferenceDB");
               return 2;// return error Code for processed DCS data not stored
             }
-         }     
-       }
 
-       // processing DAQ
+          }
+         */
+        }
+
+        // processing DAQ
 
-       TString runType = GetRunType();
+        TString runType = GetRunType();
 
-       if(runType == "T0_STANDALONE_LASER") 
-       {
-         TList* list = GetFileSources(kDAQ, "LASER");
+        if(runType == "STANDALONE")
+        {
+          TList* list = GetFileSources(kDAQ, "LASER");
           if (list)
           {
             TIter iter(list);
             TObjString *source;
-           while ((source = dynamic_cast<TObjString *> (iter.Next())))
+            while ((source = dynamic_cast<TObjString *> (iter.Next())))
             {
               const char *laserFile = GetFile(kDAQ, "LASER", source->GetName());
               if (laserFile)
               {
-                Log(Form("File with Id TIME found in source %s!", source->GetName()));
-               AliT0CalibWalk *laser = new AliT0CalibWalk();
-               // laser->Reset();
-               laser->MakeWalkCorrGraph(laserFile);
-               AliCDBMetaData metaData;
+                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","Data", laser, &metaData);
+               resultLaser=Store("Calib","Slewing_Walk", laser, &metaData, 0, 1);
                 delete laser;
-              } 
+              }
               else
               {
-                Log(Form("Could not find file with Id TIME in source %s!", source->GetName()));
+                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 if(runType == "PHYSICS") 
-       {
-           AliT0CalibTimeEq *online = new AliT0CalibTimeEq();
-            online->Reset();
-           online->ComputeOnlineParams("CFD13-CFD","", "c1", 20, 1.);
-           AliCDBMetaData metaData;
-            metaData.SetBeamPeriod(0);
-            metaData.SetResponsible("Tomek&Michal");
-            metaData.SetComment("Time equalizing result.");
-
-            resultOnline = Store("Calib","Data", online, &metaData);
-            delete online;
-           if (!resultOnline)
+          } else {
+               Log("No sources found for id LASER!");
+               return 1;
+         }
+        }
+        else if(runType == "PHYSICS")
+        {
+          TList* listPhys = GetFileSources(kDAQ, "PHYSICS");
+          if (listPhys)
+          {
+            TIter iter(listPhys);
+            TObjString *sourcePhys;
+            while ((sourcePhys = dynamic_cast<TObjString *> (iter.Next())))
+            {
+              const char *filePhys = GetFile(kDAQ, "PHYSICS", sourcePhys->GetName());
+              if (filePhys)
+              {
+                AliT0CalibTimeEq *online = new AliT0CalibTimeEq();
+                online->Reset();
+                online->ComputeOnlineParams(filePhys);
+                AliCDBMetaData metaData;
+                metaData.SetBeamPeriod(0);
+                metaData.SetResponsible("Tomek&Michal");
+                metaData.SetComment("Time equalizing result.");
+                resultOnline = Store("Calib","TimeDelay", online, &metaData, 0, 1);
+                delete online;
+              }
+              else
+              {
+                Log(Form("Could not find file with Id PHYSICS in source %s!", sourcePhys->GetName()));
+                return 1;
+              }
+            }
+            if (!resultOnline)
             {
               Log("No Laser Data stored");
               return 4;//return error code for failure in storing OCDB Data
             }
-       
-       }
-       
-
-/* commented for testing, TM 22.11.2007
-         
-       while ((source = dynamic_cast<TObjString *> (iter.Next()))) 
-         {
-           const char* TimefileName = GetFile(kDAQ, "TIME", source->GetName());
-           if (TimefileName)
-           {
-             Log(Form("File with Id TIME found in source %s!", source->GetName()));
-             TFile *file = TFile::Open(TimefileName);
-             if(!file || !file->IsOpen()) 
-             {
-               Log(Form("Error opening file with Id TIME from source %s!", source->GetName()));
+          } else {
+               Log("No sources found for id PHYSICS!");
                return 1;
-             } 
-             AliT0Dqclass *tempdata = dynamic_cast<AliT0Dqclass*> (file->Get("Time"));
-             if (!tempdata) 
-             {
-               Log("Could not find key \"Time\" in DAQ file!");
-               return 1;
-             }
-             for(Int_t i=0;i<24;i++)
-             {
-               numbers[i] = tempdata->GetTime(i);
-                                       //      printf("\nnumbers: %f\n",numbers[i]);
-             }
-             file->Close();
-             delete tempdata;
-           } 
-            else 
-           {
-             Log(Form("Could not find file with Id TIME in source %s!", source->GetName()));
-             return 1;
-           }
-       //              calibdata->SetTime(numbers, hv);
-       //              calibdata->Print();
-       //              calibdata->FitGauss();
-         } 
-       } 
-        else 
-       {
-         Log("No sources for Id TIME found!");
-       }        
-
-*/
+         }
+        }
 
   return 0;
 }
-
-