- Implementing functions for the GRP preprocessor to retrieve DA output files from...
authorzampolli <zampolli@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 8 Jan 2010 08:17:32 +0000 (08:17 +0000)
committerzampolli <zampolli@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 8 Jan 2010 08:17:32 +0000 (08:17 +0000)
different from GRP --> for MeanVertex DAs

- Modifications and additional file to test SPD Mean Vertex part in the GRP preprocessor

- Implementing possibility to define Log level (Info, Warning, Error...) in the Log
preprocessor function; default = kInfo.

GRP/ShuttleInput/run000104892_SPD_mon-DA-SPD-0_VertexDiamond [new file with mode: 0644]
GRP/TestGRPPreprocessor.C
SHUTTLE/AliShuttle.cxx
SHUTTLE/AliShuttle.h
SHUTTLE/TestShuttle/AliTestShuttle.cxx
SHUTTLE/TestShuttle/AliTestShuttle.h
STEER/AliGRPPreprocessor.cxx
STEER/AliGRPPreprocessor.h
STEER/AliPreprocessor.cxx
STEER/AliPreprocessor.h
STEER/AliShuttleInterface.h

diff --git a/GRP/ShuttleInput/run000104892_SPD_mon-DA-SPD-0_VertexDiamond b/GRP/ShuttleInput/run000104892_SPD_mon-DA-SPD-0_VertexDiamond
new file mode 100644 (file)
index 0000000..f4a2393
Binary files /dev/null and b/GRP/ShuttleInput/run000104892_SPD_mon-DA-SPD-0_VertexDiamond differ
index a42d719..5f251f9 100644 (file)
@@ -56,12 +56,15 @@ void TestGRPPreprocessor(const char* runtype="PHYSICS", TString partition="ALICE
          shuttle->AddInputFile(AliShuttleInterface::kDAQ, "GRP", "Period_LHC09c_TPC.Seq_0.tag.root", "GDC36", "$ALICE_ROOT/GRP/ShuttleInput/run000080740_GRP_gdc-aldaqpc036_Period_LHC09c.Seq_0.tag.root");
          shuttle->AddInputFile(AliShuttleInterface::kDAQ, "GRP", "Period_LHC09c_TPC.Seq_0.tag.root", "GDC44", "$ALICE_ROOT/GRP/ShuttleInput/run000080740_GRP_gdc-aldaqpc044_Period_LHC09c.Seq_0.tag.root");
          shuttle->AddInputFile(AliShuttleInterface::kDAQ, "GRP", "Period_LHC09c_TPC.Seq_0.tag.root", "GDC45", "$ALICE_ROOT/GRP/ShuttleInput/run000080740_GRP_gdc-aldaqpc045_Period_LHC09c.Seq_0.tag.root");
+         shuttle->AddInputFile(AliShuttleInterface::kDAQ, "SPD", "VertexDiamond", "gdc-GLOBAL-01", "$ALICE_ROOT/GRP/ShuttleInput/run000104892_SPD_mon-DA-SPD-0_VertexDiamond");
+         /*
          // for example:
-         //shuttle->AddInputFile(AliShuttleInterface::kDAQ, "GRP", "Period_LHC09c_TPC.Seq_0.tag.root", "GDC35", "/home/zampolli/SOFT/AliRoot/AliRoot_Trunk/GRP/ShuttleInput/run000080740_GRP_gdc-aldaqpc035_Period_LHC09c.Seq_0.tag.root");
-         //shuttle->AddInputFile(AliShuttleInterface::kDAQ, "GRP", "Period_LHC09c_TPC.Seq_0.tag.root", "GDC36", "/home/zampolli/SOFT/AliRoot/AliRoot_Trunk/GRP/ShuttleInput/run000080740_GRP_gdc-aldaqpc036_Period_LHC09c.Seq_0.tag.root");
-         //shuttle->AddInputFile(AliShuttleInterface::kDAQ, "GRP", "Period_LHC09c_TPC.Seq_0.tag.root", "GDC44", "/home/zampolli/SOFT/AliRoot/AliRoot_Trunk/GRP/ShuttleInput/run000080740_GRP_gdc-aldaqpc044_Period_LHC09c.Seq_0.tag.root");
-         //shuttle->AddInputFile(AliShuttleInterface::kDAQ, "GRP", "Period_LHC09c_TPC.Seq_0.tag.root", "GDC45", "/home/zampolli/SOFT/AliRoot/AliRoot_Trunk/GRP/ShuttleInput/run000080740_GRP_gdc-aldaqpc045_Period_LHC09c.Seq_0.tag.root");
-         
+         shuttle->AddInputFile(AliShuttleInterface::kDAQ, "GRP", "Period_LHC09c_TPC.Seq_0.tag.root", "GDC35", "/home/zampolli/SOFT/AliRoot/AliRoot_Trunk/GRP/ShuttleInput/run000080740_GRP_gdc-aldaqpc035_Period_LHC09c.Seq_0.tag.root");
+         shuttle->AddInputFile(AliShuttleInterface::kDAQ, "GRP", "Period_LHC09c_TPC.Seq_0.tag.root", "GDC36", "/home/zampolli/SOFT/AliRoot/AliRoot_Trunk/GRP/ShuttleInput/run000080740_GRP_gdc-aldaqpc036_Period_LHC09c.Seq_0.tag.root");
+         shuttle->AddInputFile(AliShuttleInterface::kDAQ, "GRP", "Period_LHC09c_TPC.Seq_0.tag.root", "GDC44", "/home/zampolli/SOFT/AliRoot/AliRoot_Trunk/GRP/ShuttleInput/run000080740_GRP_gdc-aldaqpc044_Period_LHC09c.Seq_0.tag.root");
+         shuttle->AddInputFile(AliShuttleInterface::kDAQ, "GRP", "Period_LHC09c_TPC.Seq_0.tag.root", "GDC45", "/home/zampolli/SOFT/AliRoot/AliRoot_Trunk/GRP/ShuttleInput/run000080740_GRP_gdc-aldaqpc045_Period_LHC09c.Seq_0.tag.root");
+         shuttle->AddInputFile(AliShuttleInterface::kDAQ, "SPD", "VertexDiamond", "gdc-GLOBAL-01", "/home/zampolli/SOFT/AliRoot/AliRoot_Trunk/GRP/ShuttleInput/run000104892_SPD_mon-DA-SPD-0_VertexDiamond");
+         */
   }
 
   // simulating input from DCS FXS
index a804d77..a9ead41 100644 (file)
@@ -2938,7 +2938,7 @@ const char* AliShuttle::GetLHCPeriod() const
 }
 
 //______________________________________________________________________________________________
-void AliShuttle::Log(const char* detector, const char* message)
+void AliShuttle::Log(const char* detector, const char* message, UInt_t level)
 {
        //
        // Fill log string with a message
@@ -2965,7 +2965,7 @@ void AliShuttle::Log(const char* detector, const char* message)
                toLog += Form("run %d - ", GetCurrentRun());
        toLog += Form("%s", message);
 
-       AliInfo(toLog.Data());
+       AliLog::Message(level, toLog, MODULENAME(), ClassName(), FUNCTIONNAME(), __FILE__, __LINE__);
        
        // if we redirect the log output already to the file, leave here
        if (fOutputRedirected && strcmp(detector, "SHUTTLE") != 0)
index dda3df7..e304d6a 100644 (file)
@@ -73,7 +73,7 @@ public:
        virtual const char* GetTriggerConfiguration(); 
        virtual const char* GetCTPTimeParams(); 
        virtual const char* GetTriggerDetectorMask(); 
-       virtual void Log(const char* detector, const char* message);
+       virtual void Log(const char* detector, const char* message, UInt_t level=3);
 
        void SetLogbookEntry(AliShuttleLogbookEntry* entry) {fLogbookEntry=entry;}
        
index dec0be9..7718f95 100644 (file)
@@ -502,12 +502,14 @@ TList* AliTestShuttle::GetFileIDs(Int_t system, const char* detector, const char
 }
 
 //______________________________________________________________________________________________
-void AliTestShuttle::Log(const char* detector, const char* message)
+void AliTestShuttle::Log(const char* detector, const char* message, UInt_t level)
 {
   // test implementation of Log
   // just prints to the screen
 
-  AliInfo(Form("%s: %s", detector, message));
+  TString fullMessage = detector;
+  fullMessage.Append(Form(": %s",message));
+  AliLog::Message(level, fullMessage, MODULENAME(), ClassName(), FUNCTIONNAME(), __FILE__, __LINE__);
 }
 
 //______________________________________________________________________________________________
index 48175a8..53e8ffb 100644 (file)
@@ -56,7 +56,7 @@ class AliTestShuttle : public AliShuttleInterface
     virtual const char* GetTriggerConfiguration();
     virtual const char* GetCTPTimeParams();
     virtual const char* GetTriggerDetectorMask(); 
-    virtual void Log(const char* detector, const char* message);
+    virtual void Log(const char* detector, const char* message, UInt_t level=3);
 
     virtual void RegisterPreprocessor(AliPreprocessor* preprocessor);
 
index b74190b..0bf8292 100644 (file)
@@ -30,6 +30,7 @@
 #include <TObjArray.h>
 #include <TGraph.h>
 #include <TString.h>
+#include <TFile.h>
 
 #include <float.h>
 
@@ -45,6 +46,7 @@
 
 #include "AliCDBMetaData.h"
 #include "AliLog.h"
+#include "AliESDVertex.h"
 
 class AliDCSValue;
 class AliShuttleInterface;
@@ -192,7 +194,8 @@ ClassImp(AliGRPPreprocessor)
                    "(DCS data points ERROR)",
                    "(Trigger Configuration ERROR)",
                    "(DAQ logbook ERROR determining partition of the run)",
-                   "(CTP timing ERROR)"
+                   "(CTP timing ERROR)",
+                  "(SPD Mean Vertex ERROR)"
   };
 
 //_______________________________________________________________
@@ -507,18 +510,30 @@ UInt_t AliGRPPreprocessor::Process(TMap* valueMap)
        result = Store("GRP", "Data", grpobj, &md); 
        delete grpobj;
        
+       //==================//
+       // SPD Mean Vertex  //
+       //==================//
+       UInt_t iSPDMeanVertex = ProcessSPDMeanVertex();
+       if( iSPDMeanVertex == 1 ) {
+               Log(Form("SPD Mean Vertex, successful!"));
+       } else {
+               Log(Form("SPD Mean Vertex failed!!!"));
+               error |= 128; 
+       }
+       
        if (result && !error ) {
                Log("GRP Preprocessor Success");
                return 0;
        } else {
-               Log( Form("GRP Preprocessor FAILS!!! %s%s%s%s%s%s%s",
+               Log( Form("GRP Preprocessor FAILS!!! %s%s%s%s%s%s%s%s",
                          kppError[(error&1)?1:0],
                          kppError[(error&2)?2:0],
                          kppError[(error&4)?3:0],
                          kppError[(error&8)?4:0],
                          kppError[(error&16)?5:0],
                          kppError[(error&32)?6:0],
-                         kppError[(error&64)?7:0]
+                         kppError[(error&64)?7:0],
+                         kppError[(error&128)?8:0]
                          ));
                return error;
        }
@@ -526,6 +541,58 @@ UInt_t AliGRPPreprocessor::Process(TMap* valueMap)
 
 //_______________________________________________________________
 
+UInt_t AliGRPPreprocessor::ProcessSPDMeanVertex()
+{
+       //Getting the SPD Mean Vertex
+       TList* list = GetForeignFileSources("SPD", kDAQ, "VertexDiamond");
+       Bool_t storeResult = kTRUE;
+       if (list !=0x0 && list->GetEntries()!=0)
+               {
+                       AliInfo("The following sources produced files with the id VertexDiamond from SPD");
+                       list->Print();
+                       for (Int_t jj=0;jj<list->GetEntries();jj++){
+                               TObjString * str = dynamic_cast<TObjString*> (list->At(jj));
+                               AliInfo(Form("found source %s", str->String().Data()));
+                               TString fileNameRun = GetForeignFile("SPD", kDAQ, "VertexDiamond", str->GetName());
+                               if (fileNameRun.Length()>0){
+                                       AliInfo(Form("Got the file %s", fileNameRun.Data()));
+                                       TFile daqFile(fileNameRun.Data(),"READ");
+                                       if (daqFile.IsOpen()) {
+                                               AliESDVertex* meanVtx = dynamic_cast<AliESDVertex*>(daqFile.Get("MeanVertexPos"));
+                                               if (meanVtx){
+                                                       meanVtx->Print();       
+                                                       // storing in the OCDB 
+                                                       AliCDBMetaData md;
+                                                       md.SetResponsible("Cvetan Cheshkov");
+                                                       md.SetComment("SPD Mean Vertex");                                       
+                                                       storeResult = Store("GRP", "MeanVertexSPD", meanVtx, &md); 
+                                               }
+                                               else{
+                                                       AliWarning("No SPD Mean Vertex object found in file");
+                                               } 
+                                       }
+                                       else {
+                                               AliError("Can't open file");
+                                               storeResult = kFALSE;
+                                       }
+                               }
+                               else{
+                                       AliWarning("No file found for current source for SPD Mean Vertex");
+                               }
+                       }
+               }
+       else {
+               AliWarning("No list found for SPD Mean Vertex");
+       }
+
+       if (list) delete list;
+
+       return storeResult;
+}
+
+
+//_______________________________________________________________
+
 Int_t AliGRPPreprocessor::ProcessDaqLB(AliGRPObject* grpObj)
 {
        //Getting the DAQ lb information
index 1d494b3..d3b2355 100644 (file)
@@ -82,6 +82,7 @@ class AliGRPPreprocessor: public AliPreprocessor {
 
                Int_t   ProcessDaqLB(AliGRPObject* grpobj);
               UInt_t   ProcessDaqFxs();
+              UInt_t   ProcessSPDMeanVertex();
               UInt_t   ProcessDcsFxs(TString partition="", TString detector="");
                Int_t   ProcessDcsDPs(TMap* valueSet, AliGRPObject* grpobj);
                Int_t   ProcessLHCDPs(const TMap* valueSet, AliGRPObject* grpobj);
index 0e60d2c..0fd756b 100644 (file)
@@ -303,13 +303,13 @@ TList* AliPreprocessor::GetFileIDs(Int_t system, const char* source)
 }
 
 //______________________________________________________________________________________________
-void AliPreprocessor::Log(const char* message)
+void AliPreprocessor::Log(const char* message, UInt_t level)
 {
   // Adds a log message to the Shuttle log of this preprocessor
   //
   // The call is delegated to AliShuttleInterface
 
-  fShuttle->Log(GetName(), message);
+  fShuttle->Log(GetName(), message, level);
 }
 
 //______________________________________________________________________________________________
@@ -459,3 +459,42 @@ UInt_t AliPreprocessor::GetEndTimeDCSQuery()
        return fShuttle->GetEndTimeDCSQuery();
 }
 
+//______________________________________________________________________________________________
+const char* AliPreprocessor::GetForeignFile(const char* detector, Int_t system, const char* id, const char* source)
+{
+       // This function retrieves a file produced from the given detector (different from the 
+       // current one) from the given system (kDAQ, kDCS, kHLT) 
+       // with the given file id
+       // and from the given source in the system.
+       // The function returnes the path to the local file.
+       //
+       // The call is delegated to AliShuttleInterface
+       // The function can be called only from the GRP preprocessor
+       
+       TString detName(GetName());
+       if (detName != "GRP") 
+       {
+               Log("GetForeignFile - Only GRP can call this function.");
+               return 0;
+       }
+       return fShuttle->GetFile(system, detector, id, source);
+}
+
+//______________________________________________________________________________________________
+TList* AliPreprocessor::GetForeignFileSources(const char* detector, Int_t system, const char* id)
+{
+       // Returns the list of sources in a given system that produced the file 
+       // with the given id for the foreign detector specified
+       //
+       // The call is delegated to AliShuttleInterface
+       // The function can be called only from the GRP preprocessor
+
+       TString detName(GetName());
+       if (detName != "GRP") 
+       {
+               Log("GetForeignFileSources - Only GRP can call this function.");
+               return 0;
+       }
+       return fShuttle->GetFileSources(system, detector, id);
+}
+
index ff7d9d3..f8bcbf9 100644 (file)
@@ -47,6 +47,8 @@ class AliPreprocessor : public TNamed
     
     const char* GetFile(Int_t system, const char* id, const char* source);
     TList* GetFileSources(Int_t system, const char* id = 0);
+    const char* GetForeignFile(const char* detector, Int_t system, const char* id, const char* source);
+    TList* GetForeignFileSources(const char* detector, Int_t system, const char* id);
     TList* GetFileIDs(Int_t system, const char* source);
     const char* GetRunParameter(const char* param);
     AliCDBEntry* GetFromOCDB(const char* pathLevel2, const char* pathLevel3);
@@ -55,7 +57,7 @@ class AliPreprocessor : public TNamed
     const char* GetTriggerConfiguration();
     const char* GetCTPTimeParams();
     const char* GetTriggerDetectorMask();
-    void Log(const char* message);
+    void Log(const char* message, UInt_t level=3);
     UInt_t GetStartTimeDCSQuery();
     UInt_t GetEndTimeDCSQuery();
     
index 94f12ec..ddb298d 100644 (file)
@@ -47,7 +47,7 @@ class AliShuttleInterface : public TObject
 
     virtual AliCDBEntry* GetFromOCDB(const char* detector, const AliCDBPath& path) = 0;
     
-    virtual void Log(const char* detector, const char* message) = 0;
+    virtual void Log(const char* detector, const char* message, UInt_t level=3) = 0;
 
     virtual void RegisterPreprocessor(AliPreprocessor* preprocessor) = 0;