Run type field added in SHUTTLE framework. Run type is read from "run type" logbook...
authoracolla <acolla@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 28 Feb 2007 10:41:56 +0000 (10:41 +0000)
committeracolla <acolla@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 28 Feb 2007 10:41:56 +0000 (10:41 +0000)
AliPreprocessor::GetRunType() function.
Added some ldap definition files.

17 files changed:
SHUTTLE/AliShuttle.cxx
SHUTTLE/AliShuttle.h
SHUTTLE/AliShuttleConfig.cxx
SHUTTLE/AliShuttleConfig.h
SHUTTLE/AliShuttleLogbookEntry.cxx
SHUTTLE/AliShuttleLogbookEntry.h
SHUTTLE/Shuttle.C
SHUTTLE/TestShuttle/AliTestPreprocessor.cxx
SHUTTLE/TestShuttle/AliTestShuttle.cxx
SHUTTLE/TestShuttle/AliTestShuttle.h
SHUTTLE/TestShuttle/TestPreprocessor.C
SHUTTLE/schema/DAQ.ldif [new file with mode: 0644]
SHUTTLE/schema/DCS.ldif [new file with mode: 0644]
SHUTTLE/schema/Global.ldif [new file with mode: 0644]
SHUTTLE/schema/HLT.ldif [new file with mode: 0644]
SHUTTLE/schema/shuttle.schema
SHUTTLE/test/TestHMPIDPreprocessor.cxx

index fda9199accf293c3e1590b89a7856444e270c867..b83cd8338cf97d9fe6d09e622aea157f9a6ce5b7 100644 (file)
@@ -613,6 +613,8 @@ Bool_t AliShuttle::Process(AliShuttleLogbookEntry* entry)
        AliInfo(Form("\n\n \t\t\t^*^*^*^*^*^*^*^*^*^*^*^* run %d: START ^*^*^*^*^*^*^*^*^*^*^*^* \n",
                                        GetCurrentRun()));
 
+       // Set run type from run type logbook into current fLogbookEntry
+       SetRunType();
 
        // Send the information to ML
        TMonaLisaText  mlStatus("SHUTTLE_status", "Processing");
@@ -918,7 +920,7 @@ Bool_t AliShuttle::QueryShuttleLogbook(const char* whereClause,
        if(!Connect(3)) return kFALSE;
 
        TString sqlQuery;
-       sqlQuery = Form("select * from logbook_shuttle %s order by run", whereClause);
+       sqlQuery = Form("select * from %s %s order by run", fConfig->GetShuttlelbTable(), whereClause);
 
        TSQLResult* aResult = fServer[3]->Query(sqlQuery);
        if (!aResult) {
@@ -1672,8 +1674,8 @@ Bool_t AliShuttle::UpdateShuttleLogbook(const char* detector, const char* status
 
        TString whereClause = Form("where run=%d", GetCurrentRun());
 
-       TString sqlQuery = Form("update logbook_shuttle %s %s",
-                                       setClause.Data(), whereClause.Data());
+       TString sqlQuery = Form("update %s %s %s",
+                                       fConfig->GetShuttlelbTable(), setClause.Data(), whereClause.Data());
 
        AliDebug(2, Form("SQL query: \n%s",sqlQuery.Data()));
 
@@ -2028,6 +2030,58 @@ Bool_t AliShuttle::SendMail()
        return result == 0;
 }
 
+//______________________________________________________________________________________________
+void AliShuttle::SetRunType()
+{
+// Gets run type from logbook and fills current Shuttle logbook entry
+
+       // check connection, in case connect
+       if(!Connect(3)){
+               Log("SHUTTLE", "GetRunType - Couldn't connect to DAQ Logbook.");
+               return;
+       }
+
+       TString sqlQuery = Form("select detector,run_type from %s where run_number=%d",
+                                       fConfig->GetRunTypelbTable(), GetCurrentRun());
+
+       AliDebug(2, Form("SQL query: \n%s",sqlQuery.Data()));
+
+       // Query execution
+       TSQLResult* aResult;
+       aResult = dynamic_cast<TSQLResult*> (fServer[3]->Query(sqlQuery));
+       if (!aResult) {
+               Log("SHUTTLE", Form("GetRunType - Can't execute query <%s>", sqlQuery.Data()));
+               return;
+       }
+
+       TSQLRow* aRow;
+       while ((aRow = aResult->Next())) {
+               TString det(aRow->GetField(0), aRow->GetFieldLength(0));
+               TString runType(aRow->GetField(1), aRow->GetFieldLength(1));
+
+               fLogbookEntry->SetRunType(det, runType);
+               delete aRow;
+       }
+
+       delete aResult;
+
+       return;
+
+}
+
+//______________________________________________________________________________________________
+const char* AliShuttle::GetRunType(const char* detCode)
+{
+// returns run type read from "run type" logbook
+
+       if(!fLogbookEntry) {
+               AliError("No logbook entry!");
+               return 0;
+       }
+
+       return fLogbookEntry->GetRunType(detCode);
+}
+
 //______________________________________________________________________________________________
 void AliShuttle::SetShuttleTempDir(const char* tmpDir)
 {
index 1f6ace4d9c9a35c1255a30bac8521c7aca7c5ab3..bd3c6746f3c698e4aff9da6d047013f6c6dc091e 100644 (file)
@@ -58,6 +58,7 @@ public:
        virtual TList* GetFileSources(Int_t system, const char* detector, const char* id);
        virtual const char* GetRunParameter(const char* lbEntry);
        virtual AliCDBEntry* GetFromOCDB(const AliCDBPath& path);
+       virtual const char* GetRunType(const char* detCode);
        virtual void Log(const char* detector, const char* message);
 
        //TODO Test only, remove later !
@@ -110,6 +111,8 @@ private:
        
        void SendMLInfo();
 
+       void SetRunType();
+
        const AliShuttleConfig* fConfig;        // pointer to configuration object
 
        UInt_t fTimeout;        // DCS server connection timeout parameter
index 04c11ebb7efb80da1807663b4cc7e0bd0f42ecde..dccd4b60036e75c8ff55a98366ec5c805ea3e308 100644 (file)
 
 /*
 $Log$
+Revision 1.18  2007/01/23 19:20:03  acolla
+Removed old ldif files, added TOF, MCH ldif files. Added some options in
+AliShuttleConfig::Print. Added in Ali Shuttle: SetShuttleTempDir and
+SetShuttleLogDir
+
 Revision 1.17  2007/01/18 11:17:47  jgrosseo
 changing spaces to tabs ;-)
 
@@ -309,7 +314,7 @@ AliShuttleConfig::AliShuttleConfig(const char* host, Int_t port,
        const char* binddn, const char* password, const char* basedn):
        fIsValid(kFALSE), fConfigHost(host),
        fDAQlbHost(""), fDAQlbPort(), fDAQlbUser(""), fDAQlbPass(""),
-       fDAQlbDB(""), fDAQlbTable(""),
+       fDAQlbDB(""), fDAQlbTable(""), fShuttlelbTable(""), fRunTypelbTable(""),
        fMaxRetries(0), fPPTimeOut(0), fDetectorMap(), fDetectorList(),
        fShuttleInstanceHost(""), fProcessedDetectors(), fProcessAll(kFALSE)
 {
@@ -475,6 +480,21 @@ AliShuttleConfig::AliShuttleConfig(const char* host, Int_t port,
        }
        fDAQlbTable = anAttribute->GetValue();
 
+       anAttribute = anEntry->GetAttribute("ShuttleLogbookTable");
+       if (!anAttribute) {
+               AliError("Can't find ShuttleLogbookTable attribute!");
+               delete aResult; delete anEntry;
+               return;
+       }
+       fShuttlelbTable = anAttribute->GetValue();
+
+       anAttribute = anEntry->GetAttribute("RunTypeLogbookTable");
+       if (!anAttribute) {
+               AliError("Can't find RunTypeLogbookTable attribute!");
+               delete aResult; delete anEntry;
+               return;
+       }
+       fRunTypelbTable = anAttribute->GetValue();
 
        anAttribute = anEntry->GetAttribute("MaxRetries");
        if (!anAttribute) {
@@ -789,8 +809,8 @@ void AliShuttleConfig::Print(Option_t* option) const
 
 //     result += "Password: ";
 //     result.Append('*', fDAQlbPass.Length());
-       result += Form("\tDB: %s; \tTable: %s",
-               fDAQlbDB.Data(), fDAQlbTable.Data());
+       result += Form("\tDB: %s; \tTables: %s, %s, %s",
+               fDAQlbDB.Data(), fDAQlbTable.Data(), fShuttlelbTable.Data(), fRunTypelbTable.Data());
 
        result += "\n\n";
 
index af3b74eac56b8ba859e6fdded2da51949fb220a5..eaa0afc04fcad1602f9e22ae8467c8bcaa032023 100644 (file)
@@ -35,6 +35,8 @@ public:
        const char* GetDAQlbPass() const {return fDAQlbPass.Data();}
        const char* GetDAQlbDB() const {return fDAQlbDB.Data();}
        const char* GetDAQlbTable() const {return fDAQlbTable.Data();}
+       const char* GetShuttlelbTable() const {return fShuttlelbTable.Data();}
+       const char* GetRunTypelbTable() const {return fRunTypelbTable.Data();}
 
        const char* GetFXSHost(Int_t system) const {return fFXSHost[system].Data();}
        UInt_t      GetFXSPort(Int_t system) const {return fFXSPort[system];}
@@ -120,7 +122,9 @@ private:
        TString fDAQlbUser;             //! username of the DAQ logbook MySQL Server
        TString fDAQlbPass;             //! password of the DAQ logbook MySQL Server
        TString fDAQlbDB;               //! DB name of the DAQ logbook MySQL Server
-       TString fDAQlbTable;            //! Table name of the DAQ logbook MySQL Server
+       TString fDAQlbTable;            //! Table name of the DAQ logbook 
+       TString fShuttlelbTable;        //! Table name of the Shuttle logbook
+       TString fRunTypelbTable;        //! Table name of the Run typr logbook
 
        TString fFXSHost[3];            //! Host of the [DAQ, DCS, HLT] File eXchange Server
        UInt_t  fFXSPort[3];            //! Port of the [DAQ, DCS, HLT] File eXchange Server
index a5b049c19ee7ac921da2f0d42dbe444e00044f97..0ae9d03badec69c2ccfee64923ad6619621682ef 100644 (file)
@@ -37,6 +37,10 @@ fRunParameters(0)
 
        const UInt_t nDet = AliShuttleInterface::NDetectors();
        memset(fDetectorStatus, kUnprocessed, nDet*sizeof(Status));
+        for (UInt_t i=0;i<nDet;i++)
+       {
+               fRunType[i]="";
+       }
        fRunParameters.SetOwner(1);
 }
 
@@ -51,6 +55,10 @@ fRunParameters(0)
        const UInt_t nDet = AliShuttleInterface::NDetectors();
        memset(fDetectorStatus, kUnprocessed, nDet*sizeof(Status));
        if(status) SetDetectorStatus(status);
+        for (UInt_t i=0;i<nDet;i++)
+       {
+               fRunType[i]="";
+       }
        fRunParameters.SetOwner(1);
 }
 
@@ -78,6 +86,10 @@ fRunParameters(0)
                fRunParameters.Add(aKey->Clone(), aValue->Clone());
        }
 
+       for (UInt_t i=0;i<AliShuttleInterface::NDetectors();i++)
+       {
+               fRunType[i]=c.GetRunType(i);
+       }
 }
 
 //______________________________________________________________________________________________
@@ -108,14 +120,10 @@ void AliShuttleLogbookEntry::Copy(TObject& c) const
        }
 
        target.SetDetectorStatus(GetDetectorStatus());
-}
-
-//______________________________________________________________________________________________
-AliShuttleLogbookEntry::Status AliShuttleLogbookEntry::GetDetectorStatus(const char* detName) const
-{
-// get detector status from detector code
-
-       return GetDetectorStatus(AliShuttleInterface::GetDetPos(detName));
+       for (UInt_t i=0;i<AliShuttleInterface::NDetectors();i++)
+       {
+               target.SetRunType(i, fRunType[i]);
+       }
 }
 
 //______________________________________________________________________________________________
@@ -195,6 +203,52 @@ void AliShuttleLogbookEntry::SetDetectorStatus(UInt_t detPos, const char* status
        }
 }
 
+
+
+//______________________________________________________________________________________________
+const char* AliShuttleLogbookEntry::GetRunType(Int_t detPos) const
+{
+// get detector status from detector code
+
+       if(detPos < 0 || detPos >= (Int_t) AliShuttleInterface::NDetectors()) {
+               AliError(Form("Invalid parameter: %d", detPos));
+               return 0;
+       }
+       return (fRunType[detPos].Length() > 0) ? fRunType[detPos].Data() : 0;
+}
+
+//______________________________________________________________________________________________
+void AliShuttleLogbookEntry::SetRunType(const char* detName, const char* runType)
+{
+// set detector status from detector code
+
+       Int_t detPos = AliShuttleInterface::GetDetPos(detName);
+       if(detPos<0) return;
+       SetRunType(detPos, runType);
+}
+
+//______________________________________________________________________________________________
+void AliShuttleLogbookEntry::SetRunType(const TString* runType)
+{
+// set detector status from detector code
+
+       for (UInt_t i=0; i < AliShuttleInterface::NDetectors(); i++) {
+               fRunType[i] = runType[i];
+       }
+}
+
+//______________________________________________________________________________________________
+void AliShuttleLogbookEntry::SetRunType(UInt_t detPos, const char* runType)
+{
+// set detector status from detector code
+
+       if(detPos >= AliShuttleInterface::NDetectors()) {
+               AliError(Form("Shuttle has only %d subdetectors!", AliShuttleInterface::NDetectors()));
+               return;
+       }
+       fRunType[detPos] = runType;
+}
+
 //______________________________________________________________________________________________
 Bool_t AliShuttleLogbookEntry::IsDone() const{
 // return TRUE if all subdetectors are in status DONE, FAILED or INACTIVE
@@ -233,9 +287,17 @@ void AliShuttleLogbookEntry::Print(Option_t* option) const
        message += Form("\tFinished \t%s\n", endTimeStamp.AsString("s"));
        message += "\n*** Detector status ***\n";
 
-       for(UInt_t i=0; i < AliShuttleInterface::NDetectors(); i++)
-               message += Form("\t%2d - %s: %s\n", i, AliShuttleInterface::GetDetName(i),
+       for (UInt_t i=0; i < AliShuttleInterface::NDetectors(); i++)
+       {
+               message += Form("\t%2d - %s: %s ", i, AliShuttleInterface::GetDetName(i),
                                        GetDetectorStatusName(fDetectorStatus[i]));
+               if (fDetectorStatus[i] == kUnprocessed && fRunType[i].Length()>0)
+               {
+                       message += Form("\t Run type: %s \n", GetRunType(i));
+               } else {
+                       message += "\n";
+               }
+       }
 
        AliInfo(Form("option: %s",option));
        TString optionStr(option);
index 8db47fd5e31314bee3bbcde2b962e6e522111490..512ae274a938a22db880ebbd2d972bfe5dfc40ca 100644 (file)
@@ -44,7 +44,8 @@ public:
        void SetRunParameter(const char* key, const char* value);
        const char* GetRunParameter(const char* key) const;
 
-       Status GetDetectorStatus(const char* detCode) const;
+       Status GetDetectorStatus(const char* detCode) const
+                       {return GetDetectorStatus(AliShuttleInterface::GetDetPos(detCode));}
        Status GetDetectorStatus(Int_t detPos) const;
        Status* GetDetectorStatus() const {return (Status*) fDetectorStatus;}
 
@@ -54,6 +55,16 @@ public:
        void SetDetectorStatus(const char* detCode, const char* statusName);
        void SetDetectorStatus(UInt_t detPos, const char* statusName);
 
+       const char*     GetRunType(const char* detCode) const
+                               {return GetRunType(AliShuttleInterface::GetDetPos(detCode));}
+       const char*     GetRunType(Int_t detPos) const;
+       TString*        GetRunType() const {return (TString*) fRunType;}
+
+       void SetRunType(const char* detCode, const char* runType);
+       void SetRunType(UInt_t detPos, const char* runType);
+       void SetRunType(const TString* runType);
+
+
        Bool_t IsDone() const;
 
        static const char* GetDetectorStatusName(Status status);
@@ -64,6 +75,7 @@ private:
        Int_t fRun;                     // Run number
        TMap fRunParameters;            // run parameters written in DAQ logbook
        Status fDetectorStatus[AliShuttleInterface::kNDetectors];       // Detector status array
+       TString fRunType[AliShuttleInterface::kNDetectors];             // Run type array
 
        ClassDef(AliShuttleLogbookEntry, 0)
 };
index 1226c464ad5a6e0cc051758031cefb640abdd940..f8ec03fcf4e34a7859803ca7c113a1de5438214c 100644 (file)
-Bool_t Shuttle(const char* param = "listen") {
+Bool_t Shuttle(const char* param = "listen", const char* dets=0) {
 
        // WARNING: if ldap is built with ssl support it may cause confilcts with the 
        // AliEn interface. If this happens, grid storage activation must be done BEFORE 
        // loading LDAP libraries!!!
 
+       gSystem->Load("libRAliEn.so");
        gSystem->Load("libRLDAP.so");
        gSystem->Load("libMonaLisa");
        gSystem->Load("libSHUTTLE");
-       gSystem->Load("$ROOTSYS/lib/libThread");
-       gSystem->Load("$ALICE_ROOT/SHUTTLE/test/libTest.so");
-       
-       // libRalien complains otherwise, weird...
-       //gSystem->Load("libNetx");
-
-
-//     AliLog::SetGlobalDebugLevel(1);
-
-       // Setting local CDB and reference storage locations
-       AliShuttle::SetMainCDB("alien://user=aliprod?folder=colla/GridShuttleCDB");
-       AliShuttle::SetMainRefStorage("alien://user=aliprod?folder=colla/GridShuttleRefStorage");
+       gSystem->Load("libThread");
+//     gSystem->Load("$ALICE_ROOT/SHUTTLE/test/libTest.so");
 
-//     AliShuttle::SetMainCDB("local://testLeakCDB");
-//     AliShuttle::SetMainRefStorage("local://testLeakRef");
+       AliLog::SetGlobalDebugLevel(2);
 
-       AliShuttle::SetLocalCDB("local://LocalShuttleCDB");
-       AliShuttle::SetLocalRefStorage("local://LocalShuttleRefStorage");
+//     Setting local CDB and reference storage locations
+         AliShuttle::SetMainCDB("alien://user=aliprod?folder=testShuttle/OCDB");
+         AliShuttle::SetMainRefStorage("alien://user=aliprod?folder=testShuttle/Reference");
 
-       AliShuttle::SetProcessDCS(kFALSE);
+//        AliShuttle::SetMainCDB("local://$SHUTTLE_DIR/LocalShuttleCDB");
+//        AliShuttle::SetMainRefStorage("local://$SHUTTLE_DIR/LocalShuttleRefStorage");
 
+       AliShuttle::SetLocalCDB("local://$SHUTTLE_DIR/LocalShuttleCDB");
+       AliShuttle::SetLocalRefStorage("local://$SHUTTLE_DIR/LocalShuttleRefStorage");
 
-//     AliCDBManager *man = AliCDBManager::Instance();
-//     man->SetDefaultStorage("local://MainCDB");
-//     man->SetDefaultStorage("alien://DBFolder=ShuttleMainCDB");
-
+//     Setting Shuttle log and temp folders
+       AliShuttle::SetShuttleLogDir("$SHUTTLE_DIR/log");
+       AliShuttle::SetShuttleTempDir("$SHUTTLE_DIR/temp");
+       
+       
+       
+       AliShuttle::SetProcessDCS(kTRUE);
 
-       AliShuttleConfig config("pcalice290.cern.ch", 389, "o=alice,dc=cern,dc=ch");
+//     AliShuttleConfig config("pcalice290.cern.ch", 389, "o=alice,dc=cern,dc=ch");
+       AliShuttleConfig config("pcalishuttle01.cern.ch", 389, "", "", "o=alice,dc=cern,dc=ch");
        config.SetProcessAll(kTRUE);
         config.Print();
 
-       AliShuttleTrigger trigger(&config);
+       AliShuttleTrigger trigger(&config, 100000);
 
        AliShuttle* shuttle = trigger.GetShuttle();
 
        // Add here detectors preprocessor ...
-       TestTPCPreprocessor *tpcPrep = new TestTPCPreprocessor(shuttle);
-       TestITSPreprocessorSPD *spdPrep = new TestITSPreprocessorSPD(shuttle);
-       TestHMPIDPreprocessor *richPrep = new TestHMPIDPreprocessor(shuttle);
-       TestZDCPreprocessor *zdcPrep = new TestZDCPreprocessor(shuttle);
 
-       TString paramStr(param);
+       TString detector = dets;
        
-       if (paramStr.IsDigit() || paramStr == "-1") {
-               Int_t run = paramStr.Atoi();
-               trigger.Collect(run);
-       } else if (paramStr == "new") {
-               Bool_t result = trigger.Collect();
-       } else if (paramStr == "listen") {
-               trigger.Run();
-       } else {
-               cout<<"Bad parameter: "<<param<<endl;
-               cout<<"Parameter options: "<<endl;
-               cout<<"<run> - collect data for the given run"<<endl;
-               cout<<"new - collect data only for the new runs"<<endl;
-               cout<<"listen - start listening for DAQ notification"<<endl;
-               cout<<"<empty parameter> - the same as 'listen'"<<endl;
+       printf ("Processing detectors: %s \n", detector.Data());
+
+       if (detector.Contains("SPD")) 
+               new AliITSPreprocessorSPD(shuttle);
+       if (detector.Contains("SDD")) 
+               new AliITSPreprocessorSDD(shuttle);
+       if (detector.Contains("SSD")) 
+               new AliITSPreprocessorSSD(shuttle);
+       if (detector.Contains("TPC")) 
+               new AliTPCPreprocessor(shuttle);
+       if (detector.Contains("TRD")) 
+               new AliTRDPreprocessor(shuttle);
+       if (detector.Contains("TOF")) 
+               new AliTOFPreprocessor(shuttle);
+       if (detector.Contains("PHS")) 
+       {
+               gSystem->Load("libPHOSshuttle");
+               new AliPHOSPreprocessor(shuttle);
+       }
+       if (detector.Contains("CPV")) 
+               new AliCPVPreprocessor(shuttle);
+       if (detector.Contains("HMP")) 
+               new AliHMPIDPreprocessor(shuttle);
+       if (detector.Contains("EMC")) 
+               new AliEMCALPreprocessor(shuttle);
+       if (detector.Contains("MCH")) 
+               new AliMUONPreprocessor(shuttle);
+       if (detector.Contains("MTR")) 
+               new AliMTRPreprocessor(shuttle);
+       if (detector.Contains("FMD")) 
+               new AliFMDPreprocessor(shuttle);
+       if (detector.Contains("ZDC")) 
+               new AliZDCPreprocessor(shuttle);
+       if (detector.Contains("PMD")) 
+               new AliPMDPreprocessor("PMD", shuttle);
+       if (detector.Contains("T00")) 
+       {
+               gSystem->Load("libT0shuttle");
+               new AliT0Preprocessor("T00", shuttle);
        }
+       if (detector.Contains("V00")) 
+               new AliVZEROPreprocessor(shuttle);
+       if (detector.Contains("GRP")) 
+               new AliGRPPreprocessor(shuttle);
+
+//     AliTOFPreprocessor *tofPrep = new AliTOFPreprocessor(shuttle);
+//     AliTRDPreprocessor *trdPrep = new AliTRDPreprocessor(shuttle);
+//     AliGRPPreprocessor *grpPrep = new AliGRPPreprocessor(shuttle);
+       
+       TString paramStr(param);
+       
+       TStopwatch stopwatch;
+       stopwatch.Start();
+
+      if (paramStr.IsDigit() || paramStr == "-1") {
+             Int_t run = paramStr.Atoi();
+             trigger.Collect(run);
+      } else if (paramStr == "new") {
+             Bool_t result = trigger.Collect();
+      } else if (paramStr == "listen") {
+             trigger.Run();
+      } else {
+             cout<<"Bad parameter: "<<param<<endl;
+             cout<<"Parameter options: "<<endl;
+             cout<<"<run> - collect data for the given run"<<endl;
+             cout<<"new - collect data only for the new runs"<<endl;
+             cout<<"listen - start listening for DAQ notification"<<endl;
+             cout<<"<empty parameter> - the same as 'listen'"<<endl;
+      }
+
+       printf("Execution time: R:%.2fs C:%.2fs \n",
+              stopwatch.RealTime(),stopwatch.CpuTime());
 
        AliCDBManager::Destroy();
 }
index 8135ce21243bb6c915983f292c3763af2dd5e349..162fbba582a0961c854f4c3f056e3b259900f2e3 100644 (file)
@@ -55,11 +55,17 @@ UInt_t AliTestPreprocessor::Process(TMap* dcsAliasMap)
     return 0;
 
   // The processing of the DCS input data is forwarded to AliTestDataDCS
-       fData->ProcessData(*dcsAliasMap);
+  fData->ProcessData(*dcsAliasMap);
 
-  const char* fileName = GetFile(kDAQ, "PEDESTALS", "GDC");
-  if (fileName)
-    AliInfo(Form("Got the file %s, now we can extract some values.", fileName));
+  // Example of how to retrieve the run type from the Shuttle, using GetRunType() function
+  // TODO Here the run type for the "DET" detector must be set manually with SetInputRunType function,
+  // in reality it will be read from the "run type" logbook!
+  TString runType = GetRunType();
+  AliInfo(Form("Run type for run %d: %s", fRun, runType.Data()));
+
+  TString fileName = GetFile(kDAQ, "PEDESTALS", "GDC");
+  if (fileName.Length() > 0)
+    AliInfo(Form("Got the file %s, now we can extract some values.", fileName.Data()));
   //TODO here the file could be opened, some values extracted and  written to e.g. fData
 
   TList* list = GetFileSources(kDAQ, "DRIFTVELOCITY");
@@ -98,10 +104,10 @@ UInt_t AliTestPreprocessor::Process(TMap* dcsAliasMap)
   //Now we have to store the final CDB file
   AliCDBMetaData metaData;
        metaData.SetBeamPeriod(0);
-       metaData.SetResponsible("Alberto Colla");
+       metaData.SetResponsible("TPC expert");
        metaData.SetComment("This preprocessor fills an AliTestDataDCS object.");
 
-       UInt_t result = Store("SHUTTLE", "Data", fData, &metaData, 0, 0);
+       UInt_t result = Store("Calib", "Data", fData, &metaData, 0, 0);
        delete fData;
        fData = 0;
 
index 8df8415489d6c878b5b071749b385b5ddc1ac515..1459bb3ee437c4699b88ba33aa1b623c010a608c 100644 (file)
@@ -98,6 +98,7 @@ AliTestShuttle::AliTestShuttle(Int_t run, UInt_t startTime, UInt_t endTime) :
   fEndTime(endTime),
   fInputFiles(0),
   fRunParameters(0),
+  fRunTypeMap(0),
   fPreprocessors(0),
   fDcsAliasMap(0)
 {
@@ -105,7 +106,13 @@ AliTestShuttle::AliTestShuttle(Int_t run, UInt_t startTime, UInt_t endTime) :
 
   fInputFiles = new TMap;
   fRunParameters = new TMap;
+  fRunTypeMap = new TMap;
   fPreprocessors = new TObjArray;
+
+  fInputFiles->SetOwner(1);
+  fRunParameters->SetOwner(1);
+  fRunTypeMap->SetOwner(1);
+  fPreprocessors->SetOwner(1);
 }
 
 //______________________________________________________________________________________________
@@ -119,6 +126,9 @@ AliTestShuttle::~AliTestShuttle()
   delete fRunParameters;
   fRunParameters = 0;
 
+  delete fRunTypeMap;
+  fRunTypeMap = 0;
+
   delete fPreprocessors;
   fPreprocessors = 0;
 
@@ -322,7 +332,7 @@ void AliTestShuttle::RegisterPreprocessor(AliPreprocessor* preprocessor)
        if(strcmp("DET", detName) != 0) {
                if(GetDetPos(detName) < 0)
                        AliFatal(Form("********** !!!!! Invalid detector name: %s !!!!! **********", detName));
-               }
+       }
 
        fPreprocessors->Add(preprocessor);
 }
@@ -342,6 +352,40 @@ void AliTestShuttle::AddInputRunParameter(const char* key, const char* value){
        GetEntries()));
 }
 
+//______________________________________________________________________________________________
+void AliTestShuttle::AddInputRunType(const char* detCode, const char* runType){
+// set a run type (in reality it will be read from the "run type" logbook)
+
+       if (strcmp("DET", detCode) != 0)
+       {
+               if (GetDetPos(detCode) < 0)
+               {
+                       AliError(Form("Invalid detector name: %s", detCode));
+                       return;
+               }
+       }
+       TObjString* detObj = new TObjString(detCode);
+       if (fRunTypeMap->Contains(detCode)) {
+               AliWarning(Form("Detector %s already inserted: it will be replaced.", detCode));
+               delete fRunTypeMap->Remove(detObj);
+
+       }
+       fRunTypeMap->Add(detObj, new TObjString(runType));
+       AliDebug(2, Form("Number of detectors: %d", fRunTypeMap->GetEntries()));
+}
+
+//______________________________________________________________________________________________
+const char* AliTestShuttle::GetRunType(const char* detCode){
+// get a run parameter
+
+       TObjString* value = dynamic_cast<TObjString*> (fRunTypeMap->GetValue(detCode));
+       if(!value) {
+               AliError(Form("Input run type not set for detector %s!", detCode));
+               return 0;
+       }
+       return value->GetName();
+}
+
 //______________________________________________________________________________________________
 const char* AliTestShuttle::GetRunParameter(const char* key){
 // get a run parameter
index 0c6988181356934c5a4b75001224f1c44dff319d..db6adba1f734bbcb27ebc8caaaeb3d29fe61210c 100644 (file)
@@ -28,6 +28,7 @@ class AliTestShuttle : public AliShuttleInterface
     void AddInputFile(Int_t system, const char* detector, const char* id, const char* source, const char* fileName);
     void SetDCSInput(TMap* dcsAliasMap) { fDcsAliasMap = dcsAliasMap; }
     void AddInputRunParameter(const char* key, const char* value);
+    void AddInputRunType(const char* detCode, const char* runType);
     Bool_t AddInputCDBEntry(AliCDBEntry* entry);
 
     void Process();
@@ -40,6 +41,7 @@ class AliTestShuttle : public AliShuttleInterface
     virtual TList* GetFileSources(Int_t system, const char* detector, const char* id);
     virtual const char* GetRunParameter(const char* key);
     virtual AliCDBEntry* GetFromOCDB(const AliCDBPath& path);
+    virtual const char* GetRunType(const char* detCode);
     virtual void Log(const char* detector, const char* message);
 
     virtual void RegisterPreprocessor(AliPreprocessor* preprocessor);
@@ -60,7 +62,8 @@ class AliTestShuttle : public AliShuttleInterface
     UInt_t fEndTime;    // endtime that is simulated with the AliTestShuttle
 
     TMap* fInputFiles;      // files for GetFile, GetFileSources
-    TMap* fRunParameters;    // run parameters
+    TMap* fRunParameters;   // run parameters
+    TMap* fRunTypeMap;             // run type
     TObjArray* fPreprocessors; // list of preprocessors that are to be tested
     TMap* fDcsAliasMap; // DCS data for testing
 
index 61c2b37063fb7b3d252ba83278d8cf684f37fcd0..35384609f72ee2bfefa2f62d6a58a524b00e860e 100644 (file)
@@ -22,8 +22,8 @@ void TestPreprocessor()
 
   // TODO if needed, change location of OCDB and Reference test folders
   // by default they are set to $ALICE_ROOT/SHUTTLE/TestShuttle/TestCDB and TestReference
-  AliTestShuttle::SetTestShuttleCDB("local://$ALICE_ROOT/SHUTTLE/TestShuttle/TestCDB");
-  AliTestShuttle::SetTestShuttleRefStorage("local://$ALICE_ROOT/SHUTTLE/TestShuttle/TestReference");
+  AliTestShuttle::SetMainCDB("local://$ALICE_ROOT/SHUTTLE/TestShuttle/TestCDB");
+  AliTestShuttle::SetMainRefStorage("local://$ALICE_ROOT/SHUTTLE/TestShuttle/TestReference");
 
   printf("Test OCDB storage Uri: %s\n", AliShuttleInterface::GetMainCDB().Data());
   printf("Test Reference storage Uri: %s\n", AliShuttleInterface::GetMainRefStorage().Data());
@@ -70,14 +70,21 @@ void TestPreprocessor()
 
   // TODO(3)
   //
+  // The shuttle can read run type for each detector stored in the "run type" logbook.
+  // To test it, we must provide the run type manually. They will be retrieved in the preprocessor
+  // using GetRunType function.
+  shuttle->AddInputRunType("TPC", "PHYSICS");
+  shuttle->AddInputRunType("PHS", "PEDESTALS");
+
+  // TODO(4)
+  //
   // The shuttle can read run parameters stored in the DAQ run logbook.
   // To test it, we must provide the run parameters manually. They will be retrieved in the preprocessor
   // using GetRunParameter function.
-  // In real life the parameters will be retrieved automatically from the run logbook;
   shuttle->AddInputRunParameter("totalEvents", "30000");
   shuttle->AddInputRunParameter("NumberOfGDCs", "15");
 
-  // TODO(4)
+  // TODO(5)
   //
   // The shuttle can query condition parameters valid from the current run from the OCDB
   // To test it, we must first store the object into the OCDB. It will be retrieved in the preprocessor
@@ -91,21 +98,21 @@ void TestPreprocessor()
   shuttle->AddInputCDBEntry(&entry);
 
 
-  // TODO(5)
+  // TODO(6)
   // Create the preprocessor that should be tested, it registers itself automatically to the shuttle
   AliPreprocessor* test = new AliTestPreprocessor(shuttle);
 
   // Test the preprocessor
   shuttle->Process();
 
-  // TODO(6)
+  // TODO(7)
   // In the preprocessor AliShuttleInterface::Store should be called to put the final
   // data to the CDB. To check if all went fine have a look at the files produced in
   // $ALICE_ROOT/SHUTTLE/TestShuttle/TestCDB/<detector>/SHUTTLE/Data
   //
   // Check the file which should have been created
   AliCDBEntry* chkEntry = AliCDBManager::Instance()->GetStorage(AliShuttleInterface::GetMainCDB())
-                       ->Get("TPC/SHUTTLE/Data", 7);
+                       ->Get("TPC/Calib/Data", 7);
   if (!chkEntry)
   {
     printf("The file is not there. Something went wrong.\n");
diff --git a/SHUTTLE/schema/DAQ.ldif b/SHUTTLE/schema/DAQ.ldif
new file mode 100644 (file)
index 0000000..a285eee
--- /dev/null
@@ -0,0 +1,23 @@
+#
+# This file was generated by gq 1.0beta1   (http://biot.com/gq/)
+# run by colla Wed Feb 28 11:34:50 2007
+#
+# subtree search on server: ldap://pcalishuttle01.cern.ch:389/
+#                   binddn: cn=manager,dc=cern,dc=ch
+#          searching below: system=DAQ,o=alice,dc=cern,dc=ch
+# version: 1
+#
+dn: system=DAQ,o=alice,dc=cern,dc=ch
+objectClass: top
+objectClass: AliShuttleSYSConfig
+system: DAQ
+DBPassword: alice
+DBHost: aldaqgw01-gpn.cern.ch
+DBUser: shuttle
+DBName: SHUTTLE_TEST
+DBTable: daqFES_files
+FSHost: aldaqgw01-gpn.cern.ch
+FSUser: shuttle
+DBPort: 1434
+FSPort: 1433
+
diff --git a/SHUTTLE/schema/DCS.ldif b/SHUTTLE/schema/DCS.ldif
new file mode 100644 (file)
index 0000000..74ff69f
--- /dev/null
@@ -0,0 +1,21 @@
+#
+# This file was generated by gq 1.0beta1   (http://biot.com/gq/)
+# run by colla Wed Feb 28 11:34:56 2007
+#
+# subtree search on server: ldap://pcalishuttle01.cern.ch:389/
+#                   binddn: cn=manager,dc=cern,dc=ch
+#          searching below: system=DCS,o=alice,dc=cern,dc=ch
+# version: 1
+#
+dn: system=DCS,o=alice,dc=cern,dc=ch
+objectClass: top
+objectClass: AliShuttleSYSConfig
+system: DCS
+DBHost: aldcs030.cern.ch
+DBUser: shuttle
+DBPassword: DCS4Offline
+DBName: dcsfileserver
+DBTable: dcsfes
+FSHost: aldcs030.cern.ch
+FSUser: sshd
+
diff --git a/SHUTTLE/schema/Global.ldif b/SHUTTLE/schema/Global.ldif
new file mode 100644 (file)
index 0000000..31e610f
--- /dev/null
@@ -0,0 +1,24 @@
+#
+# This file was generated by gq 1.0beta1   (http://biot.com/gq/)
+# run by colla Wed Feb 28 11:34:07 2007
+#
+# subtree search on server: ldap://pcalishuttle01.cern.ch:389/
+#                   binddn: cn=manager,dc=cern,dc=ch
+#          searching below: name=GlobalConfig,o=alice,dc=cern,dc=ch
+# version: 1
+#
+dn: name=GlobalConfig,o=alice,dc=cern,dc=ch
+objectClass: top
+objectClass: AliShuttleGlobalConfig
+name: GlobalConfig
+DAQLogbookPassword: alice
+DAQLogbookHost: aldaqgw01-gpn.cern.ch
+DAQLogbookUser: shuttle
+DAQLogbookDB: SHUTTLE_TEST
+DAQLogbookPort: 1434
+DAQLogbookTable: logbook
+ShuttleLogbookTable: logbook_shuttle
+RunTypeLogbookTable: logbook_detectors
+PPTimeOut: 30
+MaxRetries: 30
+
diff --git a/SHUTTLE/schema/HLT.ldif b/SHUTTLE/schema/HLT.ldif
new file mode 100644 (file)
index 0000000..ab5ced1
--- /dev/null
@@ -0,0 +1,21 @@
+#
+# This file was generated by gq 1.0beta1   (http://biot.com/gq/)
+# run by colla Wed Feb 28 11:35:03 2007
+#
+# subtree search on server: ldap://pcalishuttle01.cern.ch:389/
+#                   binddn: cn=manager,dc=cern,dc=ch
+#          searching below: system=HLT,o=alice,dc=cern,dc=ch
+# version: 1
+#
+dn: system=HLT,o=alice,dc=cern,dc=ch
+objectClass: top
+objectClass: AliShuttleSYSConfig
+system: HLT
+DBUser: shuttle
+DBPassword: 0ffl1n3-5huttl3
+DBName: hlt_logbook
+DBTable: calib_data
+FSUser: fes
+DBHost: alihlt-shuttle1.cern.ch
+FSHost: alihlt-shuttle1.cern.ch
+
index b3d1f9460d697d97c0cfe988576c3026d372eeb0..649504dc9e4577156247db3c8457ced7c5b3af78 100644 (file)
@@ -48,14 +48,17 @@ attributetype ( GLOBAL_CONFIG:3 NAME 'DAQLogbookUser'      DESC ''    EQUALITY c
 attributetype ( GLOBAL_CONFIG:4 NAME 'DAQLogbookPassword'  DESC ''    EQUALITY caseIgnoreMatch    SUP name )
 attributetype ( GLOBAL_CONFIG:5 NAME 'DAQLogbookDB'        DESC ''    EQUALITY caseIgnoreMatch    SUP name )
 attributetype ( GLOBAL_CONFIG:6 NAME 'DAQLogbookTable'     DESC ''    EQUALITY caseIgnoreMatch    SUP name )
-attributetype ( GLOBAL_CONFIG:7 NAME 'MaxRetries'          DESC 'number of retries for failures of a preprocessor'    EQUALITY caseIgnoreMatch    SUP name )
-attributetype ( GLOBAL_CONFIG:8 NAME 'PPTimeOut'           DESC 'number of seconds until preprocessor is aborted'    EQUALITY caseIgnoreMatch    SUP name )
+attributetype ( GLOBAL_CONFIG:7 NAME 'ShuttleLogbookTable'     DESC ''    EQUALITY caseIgnoreMatch    SUP name )
+attributetype ( GLOBAL_CONFIG:8 NAME 'RunTypeLogbookTable'     DESC ''    EQUALITY caseIgnoreMatch    SUP name )
+attributetype ( GLOBAL_CONFIG:9 NAME 'MaxRetries'          DESC 'number of retries for failures of a preprocessor'    EQUALITY caseIgnoreMatch    SUP name )
+attributetype ( GLOBAL_CONFIG:10 NAME 'PPTimeOut'           DESC 'number of seconds until preprocessor is aborted'    EQUALITY caseIgnoreMatch    SUP name )
 
 objectclass ( GLOBAL_CONFIG
         NAME 'AliShuttleGlobalConfig'
         DESC 'ALICE: Access to DAQ logbook settings'
         SUP top
-        MUST (name $ DAQLogbookHost $ DAQLogbookUser $ DAQLogbookPassword $ DAQLogbookDB $ DAQLogbookTable $ MaxRetries $ PPTimeOut)
+        MUST (name $ DAQLogbookHost $ DAQLogbookUser $ DAQLogbookPassword $ DAQLogbookDB $ DAQLogbookTable $
+       ShuttleLogbookTable $ RunTypeLogbookTable $ MaxRetries $ PPTimeOut)
         MAY ( DAQLogbookPort ) )
 
 
index 39bdf59fcc52220bb5c80c9fee1739e996b7aa2c..c75cdb2432b98cd0f9dcfd3cfccda841fd744017 100644 (file)
@@ -66,101 +66,114 @@ UInt_t TestHMPIDPreprocessor::Process(TMap* /*valueMap*/)
 {
 // process data retrieved by the Shuttle
 
-       //TIter iter(valueMap);
-       //TPair* aPair;
-       //while ((aPair = (TPair*) iter.Next())) {
-               //aPair->Print();
-       //}
-       //AliCDBMetaData metaData;
-       //metaData.SetComment("This is a test!");
+       UInt_t result = kFALSE;
 
-       // return Store(valueMap, &metaData);
-
-       // DAQ
-       TList* filesources = GetFileSources(AliShuttleInterface::kDAQ, "DAQFile");
-
-       if(!filesources) {
-               AliError(Form("No sources found for thresholds.txt for run %d !", fRun));
+       // Get run type and start the processing algorithm accordingly
+       TString runType = GetRunType();
+       if (runType.Length()==0)
+       {
+               Log("Undefined run type!");
                return 0;
        }
 
-       AliInfo("Here's the list of sources for thresholds.txt");
-       filesources->Print();
-
-       TIter iter(filesources);
-       TObjString* source;
-       int i=0;
-       UInt_t result = 0;
-       while((source=dynamic_cast<TObjString*> (iter.Next()))){
-               printf("\n\n Getting file #%d\n",++i);
-               //if(i==1) continue;
-               TString filename = GetFile(AliShuttleInterface::kDAQ, "DAQFile", source->GetName());
+       Log(Form("Run type: %s", runType.Data()));
+
+       if (runType == "PHYSICS")
+       {
+               // DAQ
+               TList* filesources = GetFileSources(AliShuttleInterface::kDAQ, "DAQFile");
+
+               if(!filesources) {
+                       AliError(Form("No sources found for thresholds.txt for run %d !", fRun));
+                       return 0;
+               }
+
+               AliInfo("Here's the list of sources for thresholds.txt");
+               filesources->Print();
+
+               TIter iter(filesources);
+               TObjString* source;
+               int i=0;
+               while((source=dynamic_cast<TObjString*> (iter.Next()))){
+                       printf("\n\n Getting file #%d\n",++i);
+                       //if(i==1) continue;
+                       TString filename = GetFile(AliShuttleInterface::kDAQ, "DAQFile", source->GetName());
+                       if(!filename.Length()) {
+                               AliError(Form("Error: retrieval of file from source %s failed!", source->GetName()));
+                               delete filesources;
+                               return 0;
+                       }
+                       TString command = Form("more %s",filename.Data());
+                       gSystem->Exec(command.Data());
+
+                       // STORAGE! The First file name will be stored into CDB, the second into reference storage
+                       TObjString filenameObj(filename);
+                       AliCDBMetaData metaData;
+                       if(i==1) result = Store("Calib", "DAQData", &filenameObj, &metaData);
+                       if(i==2) result = StoreReferenceData("Calib", "RefData", &filenameObj, &metaData);
+
+               }
+               delete filesources;
+
+       } else if (runType == "PEDESTALS")
+       {
+
+               // DCS
+               TString filename = GetFile(AliShuttleInterface::kDCS, "DCSFile", 0);
                if(!filename.Length()) {
-                       AliError(Form("Error: retrieval of file from source %s failed!", source->GetName()));
-                       delete filesources;
+                       AliError(Form("Error: retrieval of file from DCS failed!"));
                        return 0;
                }
-               TString command = Form("more %s",filename.Data());
+               TString command = Form("more %s", filename.Data());
                gSystem->Exec(command.Data());
 
                // STORAGE! The First file name will be stored into CDB, the second into reference storage
                TObjString filenameObj(filename);
                AliCDBMetaData metaData;
-               if(i==1) result = Store("Calib", "DAQData", &filenameObj, &metaData);
-               if(i==2) result = StoreReferenceData("Calib", "RefData", &filenameObj, &metaData);
+               result = Store("Calib", "DCSData", &filenameObj, &metaData);
+
+       } else if (runType == "GAINS")
+       {
 
+               // HLT
+               TList* filesources = GetFileSources(AliShuttleInterface::kHLT, "HLTFile");
+
+               if(!filesources) {
+                       Log(Form("No sources found for HLTFile for run %d !", fRun));
+                       return 0;
+               }
+
+               AliInfo("Here's the list of sources for HLTFile");
+               filesources->Print();
+
+               TIter iter(filesources);
+               int i = 0;
+               TObjString* source;
+               while((source=dynamic_cast<TObjString*> (iter.Next()))){
+                       printf("\n\n Getting file #%d\n",++i);
+                       //if(i==1) continue;
+                       TString filename = GetFile(AliShuttleInterface::kHLT, "HLTFile", source->GetName());
+                       if(!filename.Length()) {
+                               AliError(Form("Error: retrieval of file from source %s failed!", source->GetName()));
+                               delete filesources;
+                               return 0;
+                       }
+                       TString command = Form("more %s",filename.Data());
+                       gSystem->Exec(command.Data());
+
+                       // STORAGE! The First file name will be stored into CDB, the second into reference storage
+                       TObjString filenameObj(filename);
+                       AliCDBMetaData metaData;
+                       if(i==1) result = Store("Calib", "HLTData", &filenameObj, &metaData);
+                       if(i==2) result = StoreReferenceData("Calib", "RefHLTData", &filenameObj, &metaData);
+
+               }
+               delete filesources;
+       } else {
+               Log(Form("Unknown run type: %s", runType.Data()));
        }
-       delete filesources;
-       
-//     // DCS
-//     TString filename = GetFile(AliShuttleInterface::kDCS, "DCSFile", 0);
-//     if(!filename.Length()) {
-//             AliError(Form("Error: retrieval of file from DCS failed!"));
-//             return 0;
-//     }
-//     TString command = Form("more %s", filename.Data());
-//     gSystem->Exec(command.Data());
-// 
-//     // STORAGE! The First file name will be stored into CDB, the second into reference storage
-//     TObjString filenameObj(filename);
-//     AliCDBMetaData metaData;
-//     result = Store("Calib", "DCSData", &filenameObj, &metaData);
-
-      // HLT
-      filesources = GetFileSources(AliShuttleInterface::kHLT, "HLTFile");
-      if(!filesources) {
-             Log(Form("No sources found for HLTFile for run %d !", fRun));
-             return 0;
-      }
-      AliInfo("Here's the list of sources for HLTFile");
-      filesources->Print();
-      TIter iter2(filesources);
-      i = 0;
-      while((source=dynamic_cast<TObjString*> (iter2.Next()))){
-             printf("\n\n Getting file #%d\n",++i);
-             //if(i==1) continue;
-             TString filename = GetFile(AliShuttleInterface::kHLT, "HLTFile", source->GetName());
-             if(!filename.Length()) {
-                     AliError(Form("Error: retrieval of file from source %s failed!", source->GetName()));
-                     delete filesources;
-                     return 0;
-             }
-             TString command = Form("more %s",filename.Data());
-             gSystem->Exec(command.Data());
-             // STORAGE! The First file name will be stored into CDB, the second into reference storage
-             TObjString filenameObj(filename);
-             AliCDBMetaData metaData;
-             if(i==1) result = Store("Calib", "HLTData", &filenameObj, &metaData);
-             if(i==2) result = StoreReferenceData("Calib", "RefHLTData", &filenameObj, &metaData);
-      }
-      delete filesources;
-       
 
+       AliInfo(Form("result = %d",result));
        return result;
 }