From 441b0e9c63faf95f5c4a1593a80a937fa2d1280b Mon Sep 17 00:00:00 2001 From: acolla Date: Wed, 28 Feb 2007 10:41:56 +0000 Subject: [PATCH] Run type field added in SHUTTLE framework. Run type is read from "run type" logbook and retrieved by AliPreprocessor::GetRunType() function. Added some ldap definition files. --- SHUTTLE/AliShuttle.cxx | 60 ++++++- SHUTTLE/AliShuttle.h | 3 + SHUTTLE/AliShuttleConfig.cxx | 26 ++- SHUTTLE/AliShuttleConfig.h | 6 +- SHUTTLE/AliShuttleLogbookEntry.cxx | 82 ++++++++-- SHUTTLE/AliShuttleLogbookEntry.h | 14 +- SHUTTLE/Shuttle.C | 137 +++++++++++----- SHUTTLE/TestShuttle/AliTestPreprocessor.cxx | 18 +- SHUTTLE/TestShuttle/AliTestShuttle.cxx | 46 +++++- SHUTTLE/TestShuttle/AliTestShuttle.h | 5 +- SHUTTLE/TestShuttle/TestPreprocessor.C | 21 ++- SHUTTLE/schema/DAQ.ldif | 23 +++ SHUTTLE/schema/DCS.ldif | 21 +++ SHUTTLE/schema/Global.ldif | 24 +++ SHUTTLE/schema/HLT.ldif | 21 +++ SHUTTLE/schema/shuttle.schema | 9 +- SHUTTLE/test/TestHMPIDPreprocessor.cxx | 173 +++++++++++--------- 17 files changed, 530 insertions(+), 159 deletions(-) create mode 100644 SHUTTLE/schema/DAQ.ldif create mode 100644 SHUTTLE/schema/DCS.ldif create mode 100644 SHUTTLE/schema/Global.ldif create mode 100644 SHUTTLE/schema/HLT.ldif diff --git a/SHUTTLE/AliShuttle.cxx b/SHUTTLE/AliShuttle.cxx index fda9199accf..b83cd8338cf 100644 --- a/SHUTTLE/AliShuttle.cxx +++ b/SHUTTLE/AliShuttle.cxx @@ -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 (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) { diff --git a/SHUTTLE/AliShuttle.h b/SHUTTLE/AliShuttle.h index 1f6ace4d9c9..bd3c6746f3c 100644 --- a/SHUTTLE/AliShuttle.h +++ b/SHUTTLE/AliShuttle.h @@ -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 diff --git a/SHUTTLE/AliShuttleConfig.cxx b/SHUTTLE/AliShuttleConfig.cxx index 04c11ebb7ef..dccd4b60036 100644 --- a/SHUTTLE/AliShuttleConfig.cxx +++ b/SHUTTLE/AliShuttleConfig.cxx @@ -15,6 +15,11 @@ /* $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"; diff --git a/SHUTTLE/AliShuttleConfig.h b/SHUTTLE/AliShuttleConfig.h index af3b74eac56..eaa0afc04fc 100644 --- a/SHUTTLE/AliShuttleConfig.h +++ b/SHUTTLE/AliShuttleConfig.h @@ -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 diff --git a/SHUTTLE/AliShuttleLogbookEntry.cxx b/SHUTTLE/AliShuttleLogbookEntry.cxx index a5b049c19ee..0ae9d03bade 100644 --- a/SHUTTLE/AliShuttleLogbookEntry.cxx +++ b/SHUTTLE/AliShuttleLogbookEntry.cxx @@ -37,6 +37,10 @@ fRunParameters(0) const UInt_t nDet = AliShuttleInterface::NDetectors(); memset(fDetectorStatus, kUnprocessed, nDet*sizeof(Status)); + for (UInt_t i=0;iClone(), aValue->Clone()); } + for (UInt_t i=0;i= (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); diff --git a/SHUTTLE/AliShuttleLogbookEntry.h b/SHUTTLE/AliShuttleLogbookEntry.h index 8db47fd5e31..512ae274a93 100644 --- a/SHUTTLE/AliShuttleLogbookEntry.h +++ b/SHUTTLE/AliShuttleLogbookEntry.h @@ -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) }; diff --git a/SHUTTLE/Shuttle.C b/SHUTTLE/Shuttle.C index 1226c464ad5..f8ec03fcf4e 100644 --- a/SHUTTLE/Shuttle.C +++ b/SHUTTLE/Shuttle.C @@ -1,70 +1,121 @@ -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: "< - collect data for the given run"< - the same as 'listen'"<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: "< - collect data for the given run"< - the same as 'listen'"<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; diff --git a/SHUTTLE/TestShuttle/AliTestShuttle.cxx b/SHUTTLE/TestShuttle/AliTestShuttle.cxx index 8df8415489d..1459bb3ee43 100644 --- a/SHUTTLE/TestShuttle/AliTestShuttle.cxx +++ b/SHUTTLE/TestShuttle/AliTestShuttle.cxx @@ -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 (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 diff --git a/SHUTTLE/TestShuttle/AliTestShuttle.h b/SHUTTLE/TestShuttle/AliTestShuttle.h index 0c698818135..db6adba1f73 100644 --- a/SHUTTLE/TestShuttle/AliTestShuttle.h +++ b/SHUTTLE/TestShuttle/AliTestShuttle.h @@ -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 diff --git a/SHUTTLE/TestShuttle/TestPreprocessor.C b/SHUTTLE/TestShuttle/TestPreprocessor.C index 61c2b37063f..35384609f72 100644 --- a/SHUTTLE/TestShuttle/TestPreprocessor.C +++ b/SHUTTLE/TestShuttle/TestPreprocessor.C @@ -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//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 index 00000000000..a285eeef428 --- /dev/null +++ b/SHUTTLE/schema/DAQ.ldif @@ -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 index 00000000000..74ff69fc302 --- /dev/null +++ b/SHUTTLE/schema/DCS.ldif @@ -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 index 00000000000..31e610f4b65 --- /dev/null +++ b/SHUTTLE/schema/Global.ldif @@ -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 index 00000000000..ab5ced16f36 --- /dev/null +++ b/SHUTTLE/schema/HLT.ldif @@ -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 + diff --git a/SHUTTLE/schema/shuttle.schema b/SHUTTLE/schema/shuttle.schema index b3d1f9460d6..649504dc9e4 100644 --- a/SHUTTLE/schema/shuttle.schema +++ b/SHUTTLE/schema/shuttle.schema @@ -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 ) ) diff --git a/SHUTTLE/test/TestHMPIDPreprocessor.cxx b/SHUTTLE/test/TestHMPIDPreprocessor.cxx index 39bdf59fcc5..c75cdb2432b 100644 --- a/SHUTTLE/test/TestHMPIDPreprocessor.cxx +++ b/SHUTTLE/test/TestHMPIDPreprocessor.cxx @@ -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 (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 (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 (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 (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; } -- 2.43.0