From b48d25420de2e7a8b7e9430e8275807f7579e66f Mon Sep 17 00:00:00 2001 From: hristov Date: Thu, 8 Oct 2009 11:41:16 +0000 Subject: [PATCH] New module TRIGGER (Chiara, Annalisa) --- ALIROOT/CMake_binaliroot.txt | 2 +- ALIROOT/binaliroot.pkg | 5 +- HLT/pendolino/AliHLTPendolino.cxx | 9 + HLT/pendolino/AliHLTPendolino.h | 1 + Makefile | 4 +- SHUTTLE/AliShuttle.cxx | 49 +- SHUTTLE/AliShuttle.h | 1 + SHUTTLE/AliTestShuttle.cxx | 689 +++++++++++++++++++++ SHUTTLE/AliTestShuttle.h | 94 +++ STEER/AliPreprocessor.cxx | 16 + STEER/AliPreprocessor.h | 1 + STEER/AliShuttleInterface.cxx | 4 +- STEER/AliShuttleInterface.h | 3 +- TRIGGER/AliTRIPreprocessor.cxx | 225 +++++++ TRIGGER/AliTRIPreprocessor.h | 39 ++ TRIGGER/ShuttleInput/pit_dumpFileSep08.txt | 109 ++++ TRIGGER/TRIGGERLinkDef.h | 14 + TRIGGER/TestTRIGGERPreprocessor.C | 36 ++ TRIGGER/libTRIGGERbase.pkg | 16 + build/module.dep | 2 + 20 files changed, 1310 insertions(+), 9 deletions(-) create mode 100644 SHUTTLE/AliTestShuttle.cxx create mode 100644 SHUTTLE/AliTestShuttle.h create mode 100644 TRIGGER/AliTRIPreprocessor.cxx create mode 100644 TRIGGER/AliTRIPreprocessor.h create mode 100644 TRIGGER/ShuttleInput/pit_dumpFileSep08.txt create mode 100644 TRIGGER/TRIGGERLinkDef.h create mode 100644 TRIGGER/TestTRIGGERPreprocessor.C create mode 100644 TRIGGER/libTRIGGERbase.pkg diff --git a/ALIROOT/CMake_binaliroot.txt b/ALIROOT/CMake_binaliroot.txt index 52acc60c19f..89fa027be41 100644 --- a/ALIROOT/CMake_binaliroot.txt +++ b/ALIROOT/CMake_binaliroot.txt @@ -12,7 +12,7 @@ Set(LIBS MUONcore MUONgeometry MUONrec MUONsim MUONbase MUONtrigger MUONraw ACORDErec HMPIDbase HMPIDrec HMPIDsim ZDCbase ZDCsim ZDCrec VZERObase VZEROsim VZEROrec EMCALUtils EMCALbase EMCALsim EMCALrec BCM STRUCT T0base T0sim T0rec EVGEN STEERBase ESD AOD CDB STEER THijing hijing FASTSIM microcern - RAWDatabase RAWDatarec RAWDatasim MUONevaluation HLTbase ) + RAWDatabase RAWDatarec RAWDatasim MUONevaluation HLTbase TRIGGERbase) AddExecutable(aliroot "${SRCS}" "${LIBS}") diff --git a/ALIROOT/binaliroot.pkg b/ALIROOT/binaliroot.pkg index a53308f2f03..418ef3cee90 100644 --- a/ALIROOT/binaliroot.pkg +++ b/ALIROOT/binaliroot.pkg @@ -20,7 +20,7 @@ ELIBS:= MUONcore MUONgeometry MUONrec MUONsim MUONbase MUONtrigger MUONraw MUONc THijing hijing \ FASTSIM microcern \ RAWDatabase RAWDatarec RAWDatasim \ - HLTbase MUONevaluation \ + HLTbase MUONevaluation TRIGGERbase \ # THbtp TEPEMGEN \ # THerwig herwig TPHIC @@ -102,7 +102,8 @@ ARLIBS:= \ RAW/tgt_$(ALICE_TARGET)/G__RAWDatabase.o $(LIBPATH)/libRAWDatabase.a \ RAW/tgt_$(ALICE_TARGET)/G__RAWDatasim.o $(LIBPATH)/libRAWDatasim.a \ RAW/tgt_$(ALICE_TARGET)/G__RAWDatarec.o $(LIBPATH)/libRAWDatarec.a \ - RAW/tgt_$(ALICE_TARGET)/G__MDC.o $(LIBPATH)/libMDC.a + RAW/tgt_$(ALICE_TARGET)/G__MDC.o $(LIBPATH)/libMDC.a \ + TRIGGER/tgt_$(ALICE_TARGET)/G__TRIGGERbase.o $(LIBPATH)/libTRIGGERbase.a #SHLIBS:= $(BINLIBDIRS) -lEVGEN -lEGPythia6 -lPythia6 -lpythia6 -lAliPythia6 -llhapdf -lTHijing -lhijing -lTHbtp -lTHerwig -lherwig -lTEPEMGEN -lTPHIC -lFASTSIM -lmicrocern SHLIBS:= $(BINLIBDIRS) -lEVGEN -lEGPythia6 -lPythia6 -lpythia6 -lAliPythia6 -llhapdf -lTHijing -lhijing -lTHerwig -lherwig -lTPHIC -lFASTSIM -lmicrocern diff --git a/HLT/pendolino/AliHLTPendolino.cxx b/HLT/pendolino/AliHLTPendolino.cxx index 0a813a3274f..6cb5628fc9c 100644 --- a/HLT/pendolino/AliHLTPendolino.cxx +++ b/HLT/pendolino/AliHLTPendolino.cxx @@ -265,6 +265,15 @@ const char* AliHLTPendolino::GetTriggerConfiguration() { return NULL; } +const char* AliHLTPendolino::GetTriggerDetectorMask() { + // Disabled Function inherited from interface + TString msg; + msg = " ~~~ PredictProc tries to request Trigger configuration, this is disabled. Discarding call in Pendolino."; + Log(kHLTInterfaceModule, msg.Data()); + + return NULL; +} + TList* AliHLTPendolino::GetFileSources(Int_t system, const char* detector, const char* id) { diff --git a/HLT/pendolino/AliHLTPendolino.h b/HLT/pendolino/AliHLTPendolino.h index ce9362d15ef..6bdcdf74acb 100644 --- a/HLT/pendolino/AliHLTPendolino.h +++ b/HLT/pendolino/AliHLTPendolino.h @@ -447,6 +447,7 @@ class AliHLTPendolino : public AliShuttleInterface { * @return NULL pointer, since it should not be used. */ virtual const char* GetTriggerConfiguration(); + virtual const char* GetTriggerDetectorMask(); /** * Disable the default constructor. diff --git a/Makefile b/Makefile index 2ee4e52df93..91ee0e26efd 100644 --- a/Makefile +++ b/Makefile @@ -123,7 +123,7 @@ ALIROOTMODULES := STEER PHOS TRD TPC ZDC MUON PMD FMD TOF ITS \ THijing THbtp EMCAL \ THerwig TEPEMGEN FASTSIM TPHIC RAW MONITOR ANALYSIS \ JETAN HLT LHC ESDCheck STAT TTherminator CORRFW DPMJET TDPMjet \ - PWG0 PWG1 PWG2 PWG3 PWG4 + PWG0 PWG1 PWG2 PWG3 PWG4 TRIGGER # Additional generators ALIROOTMODULES += TUHKMgen @@ -181,7 +181,7 @@ DEPINC += $(GENINC) ALILIBS := -L$(LIBDIR) -lMUON -lTPC -lPMD -lTRD -lFMD -lTOF \ -lITS -lPHOS -lACORDE -lHMPID -lVZERO -lZDC -lSTRUCT \ - -lT0 -lEVGEN -lSTEER + -lT0 -lEVGEN -lSTEER -lTRIGGER LIBS := $(ROOTCLIBS) $(ROOTPLIBS) $(SYSLIBS) diff --git a/SHUTTLE/AliShuttle.cxx b/SHUTTLE/AliShuttle.cxx index e785adef429..151c12d9cff 100644 --- a/SHUTTLE/AliShuttle.cxx +++ b/SHUTTLE/AliShuttle.cxx @@ -1937,7 +1937,7 @@ Bool_t AliShuttle::QueryShuttleLogbook(const char* whereClause, } // TODO Check field count! - const UInt_t nCols = 26; + const UInt_t nCols = 25; if (aResult->GetFieldCount() != (Int_t) nCols) { Log("SHUTTLE", "Invalid SQL result field number!"); delete aResult; @@ -3476,6 +3476,53 @@ const char* AliShuttle::GetTriggerConfiguration() return triggerConfig; } +//______________________________________________________________________________________________ +const char* AliShuttle::GetTriggerDetectorMask() +{ + // Receives the trigger detector mask from DAQ logbook + + // check connection, if needed reconnect + if (!Connect(3)) + return 0; + + TString sqlQuery; + sqlQuery.Form("SELECT BIN(BIT_OR(inputDetectorMask)) from logbook_trigger_clusters WHERE run = %d;", GetCurrentRun()); + TSQLResult* result = fServer[3]->Query(sqlQuery); + if (!result) + { + Log("SHUTTLE", Form("ERROR: Can't execute query <%s>!", sqlQuery.Data())); + return 0; + } + + if (result->GetRowCount() == 0) + { + Log("SHUTTLE", "ERROR: Trigger Detector Mask not found in logbook_trigger_clusters"); + delete result; + return 0; + } + + TSQLRow* row = result->Next(); + if (!row) + { + Log("SHUTTLE", "ERROR: Could not receive logbook_trigger_clusters data"); + delete result; + return 0; + } + + // static, so that pointer remains valid when it is returned to the calling class + static TString triggerDetectorMask(row->GetField(0)); + + delete row; + row = 0; + + delete result; + result = 0; + + Log("SHUTTLE", Form("Found Trigger Detector Mask: %s", triggerConfig.Data())); + + return triggerDetectorMask; +} + //______________________________________________________________________________________________ void AliShuttle::SetShuttleTempDir(const char* tmpDir) { diff --git a/SHUTTLE/AliShuttle.h b/SHUTTLE/AliShuttle.h index 129b8f1f2f4..b03751ebb2a 100644 --- a/SHUTTLE/AliShuttle.h +++ b/SHUTTLE/AliShuttle.h @@ -71,6 +71,7 @@ public: virtual const char* GetRunType(); virtual Bool_t GetHLTStatus(); virtual const char* GetTriggerConfiguration(); + virtual const char* GetTriggerDetectorMask(); virtual void Log(const char* detector, const char* message); void SetLogbookEntry(AliShuttleLogbookEntry* entry) {fLogbookEntry=entry;} diff --git a/SHUTTLE/AliTestShuttle.cxx b/SHUTTLE/AliTestShuttle.cxx new file mode 100644 index 00000000000..138017096df --- /dev/null +++ b/SHUTTLE/AliTestShuttle.cxx @@ -0,0 +1,689 @@ +/************************************************************************** + * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * * + * Author: The ALICE Off-line Project. * + * Contributors are mentioned in the code where appropriate. * + * * + * Permission to use, copy, modify and distribute this software and its * + * documentation strictly for non-commercial purposes is hereby granted * + * without fee, provided that the above copyright notice appears in all * + * copies and that both the copyright notice and this permission notice * + * appear in the supporting documentation. The authors make no claims * + * about the suitability of this software for any purpose. It is * + * provided "as is" without express or implied warranty. * + **************************************************************************/ + +/* +$Log$ +Revision 1.14 2007/08/06 12:25:47 acolla +Function Bool_t GetHLTStatus added to preprocessor. It returns the status of HLT +read from the run logbook. +TestShuttle setup updated. +TRD data point configuration updated. + +Revision 1.13 2007/05/30 06:35:21 jgrosseo +Adding functionality to the Shuttle/TestShuttle: +o) Function to retrieve list of sources from a given system (GetFileSources with id=0) +o) Function to retrieve list of IDs for a given source (GetFileIDs) +These functions are needed for dealing with the tag files that are saved for the GRP preprocessor +Example code has been added to the TestProcessor in TestShuttle + +Revision 1.12 2007/04/27 07:06:48 jgrosseo +GetFileSources returns empty list in case of no files, but successful query +No mails sent in testmode + +Revision 1.11 2007/04/04 10:33:36 jgrosseo +1) Storing of files to the Grid is now done _after_ your preprocessors succeeded. This is transparent, which means that you can still use the same functions (Store, StoreReferenceData) to store files to the Grid. However, the Shuttle first stores them locally and transfers them after the preprocessor finished. The return code of these two functions has changed from UInt_t to Bool_t which gives you the success of the storing. +In case of an error with the Grid, the Shuttle will retry the storing later, the preprocessor does not need to be run again. + +2) The meaning of the return code of the preprocessor has changed. 0 is now success and any other value means failure. This value is stored in the log and you can use it to keep details about the error condition. + +3) New function StoreReferenceFile to _directly_ store a file (without opening it) to the reference storage. + +4) The memory usage of the preprocessor is monitored. If it exceeds 2 GB it is terminated. + +5) New function AliPreprocessor::ProcessDCS(). If you do not need to have DCS data in all cases, you can skip the processing by implemting this function and returning kFALSE under certain conditions. E.g. if there is a certain run type. +If you always need DCS data (like before), you do not need to implement it. + +6) The run type has been added to the monitoring page + +Revision 1.10 2007/02/28 10:41:01 acolla +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. + +Revision 1.8 2007/02/13 11:22:25 acolla +Shuttle getters and setters of main/local OCDB/Reference storages, temp and log +folders moved to AliShuttleInterface + +Revision 1.6 2006/11/06 14:22:47 jgrosseo +major update (Alberto) +o) reading of run parameters from the logbook +o) online offline naming conversion +o) standalone DCSclient package + +Revision 1.5 2006/10/02 12:58:52 jgrosseo +Small interface change in StoreReferenceData + +Revision 1.4 2006/08/08 14:19:07 jgrosseo +Update to shuttle classes (Alberto) + +- Possibility to set the full object's path in the Preprocessor's and +Shuttle's Store functions +- Possibility to extend the object's run validity in the same classes +("startValidity" and "validityInfinite" parameters) +- Implementation of the StoreReferenceData function to store reference +data in a dedicated CDB storage. + +Revision 1.3 2006/07/11 12:44:32 jgrosseo +adding parameters for extended validity range of data produced by preprocessor + +Revision 1.2 2006/06/06 14:20:05 jgrosseo +o) updated test preprocessor (alberto) +o) added comments to example macro +o) test shuttle implements new interface + +Revision 1.2 2006/03/07 07:52:34 hristov +New version (B.Yordanov) + +Revision 1.3 2005/11/17 17:47:34 byordano +TList changed to TObjArray + +Revision 1.2 2005/11/17 14:43:22 byordano +import to local CVS + +Revision 1.1.1.1 2005/10/28 07:33:58 hristov +Initial import as subdirectory in AliRoot + +Revision 1.1.1.1 2005/09/12 22:11:40 byordano +SHUTTLE package + +Revision 1.2 2005/08/29 21:15:47 byordano +some docs added + +*/ + +// +// test implementation of the AliShuttleInterface, to be used for local tests of preprocessors +// +// reads files from the local disk +// stores to local CDB +// logs to the screen +// + +#include "AliTestShuttle.h" +#include "AliLog.h" + +#include "AliCDBManager.h" +#include "AliCDBStorage.h" +#include "AliCDBMetaData.h" +#include "AliCDBPath.h" +#include "AliCDBId.h" +#include "AliPreprocessor.h" + +#include +#include +#include +#include +#include + +ClassImp(AliTestShuttle) + +//______________________________________________________________________________________________ +AliTestShuttle::AliTestShuttle(Int_t run, UInt_t startTime, UInt_t endTime) : + fRun(run), + fStartTime(startTime), + fEndTime(endTime), + fTimeCreated(startTime), + fDCSQueryOffset(0), + fInputFiles(0), + fRunParameters(0), + fRunType(), + fPreprocessors(0), + fDcsAliasMap(0) +{ + // constructor + + fInputFiles = new TMap; + fRunParameters = new TMap; + fPreprocessors = new TObjArray; + + fInputFiles->SetOwner(1); + fRunParameters->SetOwner(1); + fPreprocessors->SetOwner(1); +} + +//______________________________________________________________________________________________ +AliTestShuttle::~AliTestShuttle() +{ + // destructor + + delete fInputFiles; + fInputFiles = 0; + + delete fRunParameters; + fRunParameters = 0; + + delete fPreprocessors; + fPreprocessors = 0; + + delete fDcsAliasMap; + fDcsAliasMap = 0; +} + +//______________________________________________________________________________________________ +Bool_t AliTestShuttle::Store(const AliCDBPath& path, TObject* object, AliCDBMetaData* metaData, + Int_t validityStart, Bool_t validityInfinite) +{ + // Stores the CDB object + // This function should be called at the end of the preprocessor cycle + // + // This implementation just stores it on the local disk, the full AliShuttle + // puts it to the Grid FileCatalog + + Int_t startRun = fRun - validityStart; + if(startRun < 0) { + AliError("First valid run happens to be less than 0! Setting it to 0..."); + startRun=0; + } + + Int_t endRun = -1; + if(validityInfinite) { + endRun = AliCDBRunRange::Infinity(); + } else { + endRun = fRun; + } + + AliCDBId id(path, startRun, endRun); + + return AliCDBManager::Instance()->GetStorage(fgkMainCDB)->Put(object, id, metaData); +} + +//______________________________________________________________________________________________ +Bool_t AliTestShuttle::StoreReferenceData(const AliCDBPath& path, TObject* object, AliCDBMetaData* metaData) +{ + // Stores the object as reference data + // This function should be called at the end of the preprocessor cycle + // + // This implementation just stores it on the local disk, the full AliShuttle + // puts it to the Grid FileCatalog + + AliCDBId id(path, fRun, fRun); + + return AliCDBManager::Instance()->GetStorage(fgkMainRefStorage)->Put(object, id, metaData); +} + +//______________________________________________________________________________________________ +Bool_t AliTestShuttle::StoreReferenceFile(const char* detector, const char* localFile, const char* gridFileName) +{ + // + // Stores reference file directly (without opening it). + // + // This implementation just stores it on the local disk, the full AliShuttle + // puts it to the Grid FileCatalog + + AliCDBManager* man = AliCDBManager::Instance(); + AliCDBStorage* sto = man->GetStorage(fgkLocalRefStorage); + + TString localBaseFolder = sto->GetBaseFolder(); + + TString targetDir = GetRefFilePrefix(localBaseFolder.Data(), detector); + + return CopyFileLocally(targetDir, localFile, gridFileName); +} + +//______________________________________________________________________________________________ +Bool_t AliTestShuttle::StoreRunMetadataFile(const char* localFile, const char* gridFileName) +{ + // + // Stores Run metadata file to the Grid, in the run folder + // + // Only GRP can call this function. + + AliCDBManager* man = AliCDBManager::Instance(); + AliCDBStorage* sto = man->GetStorage(fgkLocalRefStorage); + + TString localBaseFolder = sto->GetBaseFolder(); + + // Build Run level folder + // folder = /alice/data/year/lhcPeriod/runNb/Raw + + TTimeStamp startTime(fStartTime); + + TString year = Form("%d",startTime.GetDate()); + year = year(0,4); + + TString lhcPeriod = GetRunParameter("LHCperiod"); + + if (lhcPeriod.Length() == 0) + { + Log("SHUTTLE","StoreRunMetaDataFile - LHCPeriod not found in logbook!"); + return 0; + } + + // TODO: currently SHUTTLE cannot write in /alice/data/ !!!!! + //TString targetDir = Form("%s/GRP/RunMetadata/alice/data/%s/%s/%d/Raw", + // localBaseFolder.Data(), year.Data(), + // lhcPeriod.Data(), fRun); + + TString targetDir = Form("%s/GRP/RunMetadata/alice/simulation/%s/%s/%d/Raw", + localBaseFolder.Data(), year.Data(), + lhcPeriod.Data(), fRun); + + return CopyFileLocally(targetDir, localFile, gridFileName); +} + +//______________________________________________________________________________________________ +Bool_t AliTestShuttle::CopyFileLocally(TString& targetDir, const char* localFile, const char* gridFileName) +{ + // + // Stores file locally. Called by StoreReferenceFile and StoreRunMetadataFile + // + + //try to open folder, if it does not exist + void* dir = gSystem->OpenDirectory(targetDir.Data()); + if (dir == NULL) { + if (gSystem->mkdir(targetDir.Data(), kTRUE)) { + Log("SHUTTLE", Form("StoreFileLocally - Can't open directory <%s>", targetDir.Data())); + return kFALSE; + } + + } else { + gSystem->FreeDirectory(dir); + } + + TString target = Form("%s/%s", targetDir.Data(), gridFileName); + + Int_t result = gSystem->GetPathInfo(localFile, 0, (Long64_t*) 0, 0, 0); + if (result) + { + Log("SHUTTLE", Form("StoreFileLocally - %s does not exist", localFile)); + return kFALSE; + } + + result = gSystem->CopyFile(localFile, target); + + if (result == 0) + { + Log("SHUTTLE", Form("StoreFileLocally - File %s stored locally to %s", localFile, target.Data())); + return kTRUE; + } + else + { + Log("SHUTTLE", Form("StoreFileLocally - Could not store file %s to %s!. Error code = %d", + localFile, target.Data(), result)); + return kFALSE; + } + + + +} + +//______________________________________________________________________________________________ +const char* AliTestShuttle::GetRefFilePrefix(const char* base, const char* detector) +{ + // + // Get folder name of reference files + // + + TString offDetStr(GetOfflineDetName(detector)); + static TString dir; + if (offDetStr == "ITS" || offDetStr == "MUON" || offDetStr == "PHOS") + { + dir.Form("%s/%s/%s", base, offDetStr.Data(), detector); + } else { + dir.Form("%s/%s", base, offDetStr.Data()); + } + + return dir.Data(); +} + +//______________________________________________________________________________________________ +const char* AliTestShuttle::GetFile(Int_t system, const char* detector, const char* id, const char* source) +{ + // This function retrieves a file 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. + // + // test implementation of GetFile + // takes files from the local disks, files are passen in a TMap in the constructor + + TString key; + key.Form("%s-%s-%s", fkSystemNames[system], detector, id); + TPair* sourceListPair = dynamic_cast (fInputFiles->FindObject(key.Data())); + TMap* sourceList = 0; + if (sourceListPair) + sourceList = dynamic_cast (sourceListPair->Value()); + if (!sourceList) + { + AliError(Form("Could not find any file in %s with id %s (%s)", fkSystemNames[system], id, key.Data())); + return 0; + } + + TObjString* fileName = 0; + TPair* fileNamePair = dynamic_cast (sourceList->FindObject(source)); + if (fileNamePair) + fileName = dynamic_cast (fileNamePair->Value()); + if (!fileName) + { + AliError(Form("Could not find files from source %s in %s with id %s", + source, fkSystemNames[system], id)); + return 0; + } + + return fileName->GetString().Data(); +} + +//______________________________________________________________________________________________ +TList* AliTestShuttle::GetFileSources(Int_t system, const char* detector, const char* id) +{ + // Returns a list of sources in a given system that saved a file with the given id + // + // test implementation of GetFileSources + // takes files from the local disks, files are passen in a TMap in the constructor + + TString key; + if (id) + key.Form("%s-%s-%s", fkSystemNames[system], detector, id); + else + key.Form("%s-%s", fkSystemNames[system], detector); + + TList* list = new TList; + + TIterator* iter = fInputFiles->MakeIterator(); + TObject* obj = 0; + while ((obj = iter->Next())) + { + TObjString* objStr = dynamic_cast (obj); + if (objStr) + { + Bool_t found = kFALSE; + if (id) + { + found = (objStr->String().CompareTo(key) == 0); + } + else + found = objStr->String().BeginsWith(key); + + if (found) + { + TPair* sourceListPair = dynamic_cast (fInputFiles->FindObject(objStr->String().Data())); + TMap* sourceList = dynamic_cast (sourceListPair->Value()); + + TIterator* iter2 = sourceList->GetTable()->MakeIterator(); + TObject* obj2 = 0; + while ((obj2 = iter2->Next())) + { + TPair* pair = dynamic_cast (obj2); + if (pair) + { + if (!list->FindObject(pair->Key())) + list->Add(new TObjString(pair->Key()->GetName())); + } + } + + delete iter2; + } + } + } + + if (list->GetEntries() == 0) + AliInfo(Form("Could not find any file in %s with id %s (%s)", fkSystemNames[system], id, key.Data())); + + return list; +} + +//______________________________________________________________________________________________ +TList* AliTestShuttle::GetFileIDs(Int_t system, const char* detector, const char* source) +{ + // Returns a list of ids in a given system that saved a file with the given source + // + // test implementation of GetFileSources + // takes files from the local disks, files are passen in a TMap in the constructor + + + TString key; + key.Form("%s-%s", fkSystemNames[system], detector); + + TList* list = new TList; + + TIterator* iter = fInputFiles->MakeIterator(); + TObject* obj = 0; + while ((obj = iter->Next())) + { + TObjString* objStr = dynamic_cast (obj); + if (objStr) + { + if (objStr->String().BeginsWith(key)) + { + Bool_t found = kFALSE; + + TPair* sourceListPair = dynamic_cast (fInputFiles->FindObject(objStr->String().Data())); + TMap* sourceList = dynamic_cast (sourceListPair->Value()); + + TIterator* iter2 = sourceList->GetTable()->MakeIterator(); + TObject* obj2 = 0; + while ((obj2 = iter2->Next())) + { + TPair* pair = dynamic_cast (obj2); + if (pair) + { + if (strcmp(pair->Key()->GetName(), source) == 0) + found = kTRUE; + } + } + + delete iter2; + + if (found) + { + TObjArray* tokens = objStr->String().Tokenize("-"); + if (tokens->GetEntries() == 3) + { + TObjString* id = dynamic_cast (tokens->At(2)); + if (id && !list->FindObject(id->String())) + list->Add(new TObjString(id->String())); + } + + delete tokens; + + } + } + } + } + + if (list->GetEntries() == 0) + AliInfo(Form("Could not find any file in %s with source %s (%s)", fkSystemNames[system], source, key.Data())); + + return list; +} + +//______________________________________________________________________________________________ +void AliTestShuttle::Log(const char* detector, const char* message) +{ + // test implementation of Log + // just prints to the screen + + AliInfo(Form("%s: %s", detector, message)); +} + +//______________________________________________________________________________________________ +void AliTestShuttle::AddInputFile(Int_t system, const char* detector, const char* id, const char* source, const char* fileName) +{ + // + // This function adds a file to the list of input files + // the list is stored in fInputFiles + // fInputFiles: TMap (key -> value) + // -- -> TMap (key -> value) + // -> + // + + TString key; + key.Form("%s-%s-%s", fkSystemNames[system], detector, id); + TPair* sourceListPair = dynamic_cast (fInputFiles->FindObject(key.Data())); + TMap* sourceList = 0; + if (sourceListPair) + sourceList = dynamic_cast (sourceListPair->Value()); + if (!sourceList) + { + sourceList = new TMap; + fInputFiles->Add(new TObjString(key), sourceList); + } + + sourceList->Add(new TObjString(source), new TObjString(fileName)); +} + +//______________________________________________________________________________________________ +Bool_t AliTestShuttle::AddInputCDBEntry(AliCDBEntry* entry) +{ + // This function adds an object in the OCDB to be later retrieved with GetFromOCDB + + AliCDBStorage *sto = AliCDBManager::Instance()->GetStorage(fgkMainCDB); + if (!sto) + { + Log("SHUTTLE", "GetFromOCDB - Cannot activate main OCDB for query!"); + return 0; + } + + return sto->Put(entry); +} + +//______________________________________________________________________________________________ +AliCDBEntry* AliTestShuttle::GetFromOCDB(const char* detector, const AliCDBPath& path) +{ +// returns obiect from OCDB valid for current run + + AliCDBStorage *sto = AliCDBManager::Instance()->GetStorage(fgkMainCDB); + if (!sto) + { + Log("SHUTTLE", "GetFromOCDB - Cannot activate main OCDB for query!"); + return 0; + } + + return (AliCDBEntry*) sto->Get(path, fRun); +} + +//______________________________________________________________________________________________ +void AliTestShuttle::Process() +{ + // This function tests all preprocessors that are registered to it + // All preprocessors get the same dcs alias map and have access to the same list of files. + + for (Int_t i=0; iGetEntries(); ++i) + { + AliPreprocessor* preprocessor = dynamic_cast (fPreprocessors->At(i)); + if (preprocessor) + { + if (preprocessor->ProcessRunType()) + { + preprocessor->Initialize(fRun, fStartTime, fEndTime); + preprocessor->Process(fDcsAliasMap); + } + + } + } +} + +//______________________________________________________________________________________________ +void AliTestShuttle::RegisterPreprocessor(AliPreprocessor* preprocessor) +{ + // registers a preprocessor + + const char* detName = preprocessor->GetName(); + if(strcmp("DET", detName) != 0) { + if(GetDetPos(detName) < 0) + AliFatal(Form("********** !!!!! Invalid detector name: %s !!!!! **********", detName)); + } + + fPreprocessors->Add(preprocessor); +} + +//______________________________________________________________________________________________ +void AliTestShuttle::AddInputRunParameter(const char* key, const char* value){ +// set a run parameter (in reality it will be read from the DAQ logbook) + + TObjString* keyObj = new TObjString(key); + if (fRunParameters->Contains(key)) { + AliWarning(Form("Parameter %s already existing and it will be replaced.", key)); + delete fRunParameters->Remove(keyObj); + + } + fRunParameters->Add(keyObj, new TObjString(value)); + AliDebug(2, Form("Number of parameters: %d", fRunParameters-> + GetEntries())); +} + +//______________________________________________________________________________________________ +const char* AliTestShuttle::GetRunType() +{ + // + // get a run parameter + // + + return fRunType.Data(); +} + +//______________________________________________________________________________________________ +const char* AliTestShuttle::GetRunParameter(const char* key){ +// get a run parameter + + TObjString* value = dynamic_cast (fRunParameters->GetValue(key)); + if(!value) { + AliError(Form("No such parameter: %s", key)); + return 0; + } + return value->GetName(); +} + +//______________________________________________________________________________________________ +void AliTestShuttle::SetShuttleTempDir(const char* tmpDir) +{ +// sets Shuttle temp directory + + fgkShuttleTempDir = gSystem->ExpandPathName(tmpDir); +} + +//______________________________________________________________________________________________ +void AliTestShuttle::SetShuttleLogDir(const char* logDir) +{ +// sets Shuttle log directory + + fgkShuttleLogDir = gSystem->ExpandPathName(logDir); +} + +//______________________________________________________________________________________________ +const char* AliTestShuttle::GetTriggerConfiguration() +{ + //returns trigger configuration + if (fTriggerConfiguration.Length()>0){ + return fTriggerConfiguration; + } + return NULL; +} +//______________________________________________________________________________________________ +const char* AliTestShuttle::GetTriggerDetectorMask() +{ + //returns trigger detector mask + if (fTriggerDetectorMask.Length()>0){ + return fTriggerDetectorMask; + } + return NULL; +} +//______________________________________________________________________________________________ +UInt_t AliTestShuttle::GetStartTimeDCSQuery() +{ + // Return Start Time for the DCS query + // + // The call is delegated to AliShuttleInterface + + return fTimeCreated-fDCSQueryOffset; +} +//______________________________________________________________________________________________ +UInt_t AliTestShuttle::GetEndTimeDCSQuery() +{ + // Return End Time for the DCS query + // + // The call is delegated to AliShuttleInterface + + return fEndTime+fDCSQueryOffset; +} diff --git a/SHUTTLE/AliTestShuttle.h b/SHUTTLE/AliTestShuttle.h new file mode 100644 index 00000000000..04b422089cc --- /dev/null +++ b/SHUTTLE/AliTestShuttle.h @@ -0,0 +1,94 @@ +#ifndef ALI_TEST_SHUTTLE_H +#define ALI_TEST_SHUTTLE_H + +/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * See cxx source for full Copyright notice */ + +/* $Id$ */ + +// +// test implementation of the AliShuttleInterface, to be used for local tests of preprocessors +// + +#include +#include + +class TMap; +class TList; +class AliCDBMetaData; +class AliCDBPath; +class AliCDBPath; + +class AliTestShuttle : public AliShuttleInterface +{ + public: + AliTestShuttle(Int_t run, UInt_t startTime, UInt_t endTime); + virtual ~AliTestShuttle(); + + 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 SetInputRunType(const char* runType) { fRunType = runType; } + void SetInputHLTStatus(Bool_t status) { fHLTStatus = status; } + void SetInputTriggerConfiguration(const char* configuration) { fTriggerConfiguration = configuration; } + void SetInputTriggerDetectorMask(const char* triggerDetectorMask) { fTriggerDetectorMask = triggerDetectorMask; } + Bool_t AddInputCDBEntry(AliCDBEntry* entry); + void SetTimeCreated(UInt_t timeCreated) { fTimeCreated = timeCreated;} + void SetDCSQueryOffset(UInt_t dcsQueryOffset) { fDCSQueryOffset = dcsQueryOffset;} + void Process(); + + // AliShuttleInterface functions + virtual Bool_t Store(const AliCDBPath& path, TObject* object, AliCDBMetaData* metaData, + Int_t validityStart = 0, Bool_t validityInfinite = kFALSE); + virtual Bool_t StoreReferenceData(const AliCDBPath& path, TObject* object, AliCDBMetaData* metaData); + virtual Bool_t StoreReferenceFile(const char* detector, const char* localFile, const char* gridFileName); + virtual Bool_t StoreRunMetadataFile(const char* localFile, const char* gridFileName); + virtual const char* GetFile(Int_t system, const char* detector, const char* id, const char* source); + virtual TList* GetFileSources(Int_t system, const char* detector, const char* id = 0); + virtual TList* GetFileIDs(Int_t system, const char* detector, const char* source); + virtual const char* GetRunParameter(const char* key); + virtual UInt_t GetStartTimeDCSQuery(); + virtual UInt_t GetEndTimeDCSQuery(); + virtual AliCDBEntry* GetFromOCDB(const char* detector, const AliCDBPath& path); + virtual const char* GetRunType(); + virtual Bool_t GetHLTStatus() {return fHLTStatus;} + virtual const char* GetTriggerConfiguration(); + virtual const char* GetTriggerDetectorMask(); + virtual void Log(const char* detector, const char* message); + + virtual void RegisterPreprocessor(AliPreprocessor* preprocessor); + + static void SetMainCDB (TString mainCDB) {fgkMainCDB = mainCDB;} + static void SetLocalCDB (TString localCDB) {fgkLocalCDB = localCDB;} + + static void SetMainRefStorage (TString mainRefStorage) {fgkMainRefStorage = mainRefStorage;} + static void SetLocalRefStorage (TString localRefStorage) {fgkLocalRefStorage = localRefStorage;} + + static void SetShuttleTempDir (const char* tmpDir); + static void SetShuttleLogDir (const char* logDir); + + protected: + + Int_t fRun; // run that is simulated with the AliTestShuttle + UInt_t fStartTime; // starttime that is simulated with the AliTestShuttle + UInt_t fEndTime; // endtime that is simulated with the AliTestShuttle + UInt_t fTimeCreated; // timecreated that is simulated with the AliTestShuttle + UInt_t fDCSQueryOffset; // DCS query offset + + TMap* fInputFiles; // files for GetFile, GetFileSources + TMap* fRunParameters; // run parameters + TString fRunType; // run type + Bool_t fHLTStatus; // HLT status for current run (on=1/off=0) + TObjArray* fPreprocessors; // list of preprocessors that are to be tested + TMap* fDcsAliasMap; // DCS data for testing + TString fTriggerConfiguration; // trigger configuration for testing + TString fTriggerDetectorMask; // trigger detector mask for testing + + private: + Bool_t CopyFileLocally(TString& targetDir, const char* localFile, const char* gridFileName); + const char* GetRefFilePrefix(const char* base, const char* detector); + + ClassDef(AliTestShuttle, 0); +}; + +#endif diff --git a/STEER/AliPreprocessor.cxx b/STEER/AliPreprocessor.cxx index c7f65bd7060..dcc6c4229be 100644 --- a/STEER/AliPreprocessor.cxx +++ b/STEER/AliPreprocessor.cxx @@ -373,6 +373,22 @@ const char* AliPreprocessor::GetTriggerConfiguration() return fShuttle->GetTriggerConfiguration(); } +//______________________________________________________________________________________________ +const char* AliPreprocessor::GetTriggerDetectorMask() +{ + // Returns the trigger detector mask which is read from a table in the DAQ logbook + // The call is delegated to AliShuttleInterface + // Only TRI can call this function. + + TString detName(GetName()); + if (detName != "TRI") + { + Log("GetTriggerDetectorMask - Only TRI can call this function."); + return 0; + } + + return fShuttle->GetTriggerDetectorMask(); +} //______________________________________________________________________________________________ void AliPreprocessor::AddRunType(const char* runType) diff --git a/STEER/AliPreprocessor.h b/STEER/AliPreprocessor.h index 230ae2156a8..a108544a84d 100644 --- a/STEER/AliPreprocessor.h +++ b/STEER/AliPreprocessor.h @@ -53,6 +53,7 @@ class AliPreprocessor : public TNamed const char* GetRunType(); Bool_t GetHLTStatus(); const char* GetTriggerConfiguration(); + const char* GetTriggerDetectorMask(); void Log(const char* message); UInt_t GetStartTimeDCSQuery(); UInt_t GetEndTimeDCSQuery(); diff --git a/STEER/AliShuttleInterface.cxx b/STEER/AliShuttleInterface.cxx index 527df5d1249..ba3ae1c1737 100644 --- a/STEER/AliShuttleInterface.cxx +++ b/STEER/AliShuttleInterface.cxx @@ -32,11 +32,11 @@ const char* AliShuttleInterface::fkSystemNames[3] = { "DAQ", "DCS", "HLT" }; // names of the detectors preprocessors const char* AliShuttleInterface::fgkDetName[kNDetectors] = {"SPD", "SDD", "SSD", "TPC", "TRD", "TOF", - "PHS", "CPV", "HMP", "EMC", "MCH", "MTR", "FMD", "ZDC", "PMD", "T00", "V00", "GRP", "HLT", "ACO"}; + "PHS", "CPV", "HMP", "EMC", "MCH", "MTR", "FMD", "ZDC", "PMD", "T00", "V00", "GRP", "HLT", "ACO", "TRI"}; // names of the detectors in OCDB const char* AliShuttleInterface::fgkOfflineDetName[kNDetectors] = {"ITS", "ITS", "ITS", "TPC", "TRD", "TOF", - "PHOS", "PHOS", "HMPID", "EMCAL", "MUON", "MUON", "FMD", "ZDC", "PMD", "T0", "VZERO", "GRP", "HLT", "ACORDE"}; + "PHOS", "PHOS", "HMPID", "EMCAL", "MUON", "MUON", "FMD", "ZDC", "PMD", "T0", "VZERO", "GRP", "HLT", "ACORDE", "TRIGGER"}; TString AliShuttleInterface::fgkMainCDB("alien://folder=ShuttleCDB"); TString AliShuttleInterface::fgkLocalCDB("local://LocalShuttleCDB"); diff --git a/STEER/AliShuttleInterface.h b/STEER/AliShuttleInterface.h index b4fff84a5ae..b7f8298632b 100644 --- a/STEER/AliShuttleInterface.h +++ b/STEER/AliShuttleInterface.h @@ -23,7 +23,7 @@ class AliShuttleInterface : public TObject { public: enum System { kDAQ = 0, kDCS, kHLT }; - enum { kNDetectors = 20 }; // number of subdetectors in ALICE + enum { kNDetectors = 21 }; // number of subdetectors in ALICE virtual Bool_t Store(const AliCDBPath& path, TObject* object, AliCDBMetaData* metaData, Int_t validityStart = 0, Bool_t validityInfinite = kFALSE) = 0; @@ -42,6 +42,7 @@ class AliShuttleInterface : public TObject virtual const char* GetRunType() = 0; virtual Bool_t GetHLTStatus() = 0; virtual const char* GetTriggerConfiguration() = 0; + virtual const char* GetTriggerDetectorMask() = 0; virtual AliCDBEntry* GetFromOCDB(const char* detector, const AliCDBPath& path) = 0; diff --git a/TRIGGER/AliTRIPreprocessor.cxx b/TRIGGER/AliTRIPreprocessor.cxx new file mode 100644 index 00000000000..30819a6d38b --- /dev/null +++ b/TRIGGER/AliTRIPreprocessor.cxx @@ -0,0 +1,225 @@ +/************************************************************************** + * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * * + * Author: The ALICE Off-line Project. * + * Contributors are mentioned in the code where appropriate. * + * * + * Permission to use, copy, modify and distribute this software and its * + * documentation strictly for non-commercial purposes is hereby granted * + * without fee, provided that the above copyright notice appears in all * + * copies and that both the copyright notice and this permission notice * + * appear in the supporting documentation. The authors make no claims * + * about the suitability of this software for any purpose. It is * + * provided "as is" without express or implied warranty. * + **************************************************************************/ + +/* $Id$*/ + +// Trigger preprocessor class. +// According to the TriggerDetectorMask read from the logbook_trigger_clusters +// DAQ table, the triggering detectors are identified, and the +// corresponding procedure is called. +// Data are stored in the OCDB, in /TRIGGER//, where +// correspond to the triggering detector, +// and is defined in the detector procedure + +#include "AliTRIPreprocessor.h" + +#include "AliCDBMetaData.h" +#include "AliCDBEntry.h" +#include "AliLog.h" +#include "AliITSTriggerConditions.h" + +#include +#include +#include +#include +#include + +ClassImp(AliTRIPreprocessor) + +// names of detectors/systems in the DETECTORS_MAP in /date/db/detCodes.h +const char* AliTRIPreprocessor::fgkDetectorsMapName[AliTRIPreprocessor::kNDetectorsMap] = {"SPD"/*0*/, "SDD"/*1*/, "SSD"/*2*/, "TPC"/*3*/, "TRD"/*4*/, + "TOF"/*5*/, "HMP"/*6*/, "PHS"/*7*/, "CPV"/*8*/, "PMD"/*9*/, + "MCH"/*10*/,"MTR"/*11*/,"FMD"/*12*/,"T00"/*13*/,"V00"/*14*/, + "ZDC"/*15*/,"ACO"/*16*/,"TRI"/*17*/,"EMC"/*18*/,"TST"/*19*/, + ""/*20*/, ""/*21*/, ""/*22*/, ""/*23*/, ""/*24*/, + ""/*25*/, ""/*26*/, ""/*27*/, ""/*28*/, "GRP"/*29*/, + "HLT"/*30*/}; + +//______________________________________________________________________________________________ +AliTRIPreprocessor::AliTRIPreprocessor(AliShuttleInterface* shuttle) : + AliPreprocessor("TRI", shuttle), + fShuttle(shuttle) + +{ + // + // constructor + // + + AddRunType("PHYSICS"); +} + +//______________________________________________________________________________________________ +AliTRIPreprocessor::~AliTRIPreprocessor() +{ + // + // destructor + // +} + +//______________________________________________________________________________________________ +void AliTRIPreprocessor::Initialize(Int_t run, UInt_t startTime, + UInt_t endTime) +{ + + // + // Initialize preprocessor + // + + AliPreprocessor::Initialize(run, startTime, endTime); + + Log(Form("\n\tRun %d \n\tStartTime %s \n\tEndTime %s", run, + TTimeStamp(startTime).AsString(), + TTimeStamp(endTime).AsString())); + +} + +//______________________________________________________________________________________________ +Bool_t AliTRIPreprocessor::ProcessDCS() +{ + // + // DCS data are never needed + // + + return kFALSE; +} + +//______________________________________________________________________________________________ +UInt_t AliTRIPreprocessor::Process(TMap* /*dcsAliasMap*/) +{ + + // Procees function: + // After reading the TriggerDetectorMask, the + // corresponding triggering detector procedures to + // process the trigger data are called. + + typedef Short_t (AliTRIPreprocessor::*AliProcessTriggerData)(); + const AliProcessTriggerData processTriggerDataArray[AliTRIPreprocessor::kNDetectorsMap]= { + &AliTRIPreprocessor::ProcessSPDTriggerData, + 0, + 0, + 0, + 0, + &AliTRIPreprocessor::ProcessTOFTriggerData,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; + + + // getting the list of triggering detectors from DAQ logbook + + TString triggerDetectorMask = (TString)GetTriggerDetectorMask(); + Int_t result=0; + if (!triggerDetectorMask.IsNull()){ + Int_t length = triggerDetectorMask.Length(); + Log(Form("mask = %s", triggerDetectorMask.Data())); + for (Int_t i = 0; i*processTriggerDataArray[i])(); + } + } + } + + // result should be 0 to end successfully + + return result; + +} +//______________________________________________________________________________________________ +Short_t AliTRIPreprocessor::ProcessSPDTriggerData() +{ + // + // Processing SPD Trigger Data + // + + Log("************** Processing SPD Trigger data... **************"); + + // Read new conditions from dcs fxs + AliITSTriggerConditions* newCond = new AliITSTriggerConditions(); + TString fxsID = "PITConditions"; + TList* list = GetFileSources(kDCS, fxsID.Data()); + if (!list) { + AliError("FXS file not found."); + return 1; + } + UInt_t nFiles = 0; + while (list->At(nFiles)!=NULL) { + TObjString* fileNameEntry = (TObjString*) list->At(nFiles); + TString fileName = GetFile(kDCS, fxsID.Data(), fileNameEntry->GetString().Data()); + if (fileName.IsNull()) { + Log(Form("GetFile failed to retrieve file %s.",fileNameEntry->GetString().Data())); + return 1; + } + if (nFiles==0) newCond->ReadFromTextFile(fileName.Data()); + nFiles++; + } + if (nFiles!=1) { + AliWarning(Form("Found %d files with id %s (expected exactly 1).",nFiles,fxsID.Data())); + } + + // Read old conditions from ocdb + AliITSTriggerConditions* oldCond = NULL; + AliCDBEntry* pitCond = GetFromOCDB("SPD", "PITConditions"); + if (pitCond) { + oldCond = (AliITSTriggerConditions*) pitCond->GetObject(); + if (!oldCond) { + AliError("AliCDBEntry::GetObject() returned NULL."); + return 1; + } + } + else { + Log("Old conditions not found in database."); + } + + // Do we need to update db? + Bool_t doUpdate = kTRUE; + if (oldCond) { + // compare to see if there were any changes... + if (newCond->IsEqualTo(oldCond)) { + Log("Old conditions equal to new conditions. Do nothing."); + doUpdate = kFALSE; + } + } + + if (doUpdate) { + // store new conditions in ocdb + AliCDBMetaData metaData; + metaData.SetResponsible("Henrik Tydesjo"); + metaData.SetComment("Created by Trigger PreProcessor"); + if (!Store("SPD", "PITConditions", newCond, &metaData, 0, kTRUE)) { + Log("Failed to store conditions data."); + return 1; + } + Log("Database updated."); + } + + delete newCond; + + Log("************************* ...done.*************************"); + + return 0; // 0 means success + +} +//______________________________________________________________________________________________ +Short_t AliTRIPreprocessor::ProcessTOFTriggerData() +{ + // + // Processing TOF Trigger Data + // + + Log("************** Processing TOF Trigger data... **************"); + Log("************************* ...done.*************************"); + return 0; +} + + diff --git a/TRIGGER/AliTRIPreprocessor.h b/TRIGGER/AliTRIPreprocessor.h new file mode 100644 index 00000000000..4ba85890bb6 --- /dev/null +++ b/TRIGGER/AliTRIPreprocessor.h @@ -0,0 +1,39 @@ +#ifndef ALI_TRI_PREPROCESSOR_H +#define ALI_TRI_PREPROCESSOR_H + +class TMap; +class AliShuttleInterface; + +#include "AliPreprocessor.h" + +// Preprocessor for triggering detectors +// Every Triggering detector should implement his own ProcessDETTriggerData +// function which will be called according to the TriggerDetectorMask +// found in the DAQ logbook_trigger_clusters table + +class AliTRIPreprocessor : public AliPreprocessor +{ + public: + enum { kNDetectorsMap = 31 }; // number of entries in detectors_map as in /date/db/detCodes.h. Adding empty strings when there's an "empty" index + + AliTRIPreprocessor(AliShuttleInterface* shuttle); + virtual ~AliTRIPreprocessor(); + + Short_t ProcessSPDTriggerData(); + Short_t ProcessTOFTriggerData(); + + protected: + virtual void Initialize(Int_t run, UInt_t startTime, UInt_t endTime); + virtual UInt_t Process(TMap* /*dcsAliasMap*/); + virtual Bool_t ProcessDCS(); + + private: + + static const char* fgkDetectorsMapName[kNDetectorsMap]; // names of detectors/systems in the DETECTORS_MAP in /date/db/detCodes.h + + AliShuttleInterface *fShuttle; + + ClassDef(AliTRIPreprocessor, 0); +}; + +#endif diff --git a/TRIGGER/ShuttleInput/pit_dumpFileSep08.txt b/TRIGGER/ShuttleInput/pit_dumpFileSep08.txt new file mode 100644 index 00000000000..c84d099d65a --- /dev/null +++ b/TRIGGER/ShuttleInput/pit_dumpFileSep08.txt @@ -0,0 +1,109 @@ +# This file was automatically generated. +# It describes the configuration of the Pixel Trigger active during a specified ALICE run +[Header] +RUN_NUMBER=0 +PROCESSING_FIRMWARE_VERSION =1 +INPUT_CONDITIONS_VERSION =0 +PARAMETERS_VERSION =0 +VERSION_REGISTER_VALUE =525 +GLOBAL_DESCRIPTION = 'Firmware implementing Pixel Trigger multiplicity algorithms' + +[Outputs] +# Lines describing the algorithms implemented on the Pixel Trigger outputs by the active firmware +0 = '0SMB','Minimum bias trigger. Ntot > total_threshold and Nin > inner_threshold and Nout > outer_threshold' +1 = '0SH1','High multiplicity. Nin > inner_threshold and Nout > outer_threshold' +2 = '0SH2','High multiplicity. Nin > inner_threshold and Nout > outer_threshold' +3 = '0SH3','High multiplicity. Nin > inner_threshold and Nout > outer_threshold' +4 = '0SH4','High multiplicity. Nin > inner_threshold and Nout > outer_threshold' +5 = '0SPF','Past future protection. Ntot > total_threshold and Nin > inner_threshold and Nout > outer_threshold' +6 = '0SX1','Spare background. Nin > Nout + background_offset_inner' +7 = '0SX2','Spare background. Nout > Nin + background_offset_outer' +8 = '0SBK','Background. Ntot > background_threshold_both' +9 = '0SCO','Programmable cosmic algorithm' + +[Output_parameters] +# Lines listing the numeric parameters for each of the 10 outputs +# Pairs of parameter name and value pairs are separated by semi-colon. There can be a avariable number of parameters +# Example: +# output number='parameterName0', value; 'parameterName1', value1; 'parameterNameN', valueN +0 = 'total_threshold',273;'inner_threshold',273;'outer_threshold',68; +1 = 'inner_threshold',273;'outer_threshold',68; +2 = 'inner_threshold',273;'outer_threshold',68; +3 = 'inner_threshold',273;'outer_threshold',68; +4 = 'inner_threshold',273;'outer_threshold',68; +5 = 'total_threshold',273;'inner_threshold',273;'outer_threshold',68; +6 = 'background_offset_inner',273; +7 = 'background_offset_outer',68; +8 = 'background_threshold_both',273; +9 = 'cosmic_mode',0; + +[Active_chips] +# This section lists the chips with their fastor actively used in the trigger logic +# There are as many lines as halfstaves with masked chips. +# If an halfstave is not listed by default all its chips are active +# The format of each line is: +# sector number(0-9), side(A|C), halfstave number(0-5) = fastor mask (string of '0' if masked, '1' if active; leftmost is chip 9, rightmost is chip 0) +# Example: 5, C, 5 = 0000000001 +0,A,0=1110111111 +0,A,4=1111111011 +1,A,2=1111110111 +1,A,5=1111111011 +2,A,1=0000000000 +2,A,2=0000000000 +2,C,0=0000000000 +2,C,1=1111011111 +3,A,0=0000000000 +3,A,1=0000000000 +3,A,2=0000000000 +3,A,3=0000000000 +3,A,4=1111111101 +3,A,5=1111111100 +3,C,1=0000000000 +3,C,2=0000000000 +3,C,3=0000000000 +3,C,5=0111111111 +4,A,1=0000000000 +4,C,3=1111111011 +4,C,5=1111110111 +5,A,0=0000000000 +5,A,1=0000000000 +5,A,2=0000000000 +5,A,3=0000000000 +5,C,0=1111110011 +5,C,1=0000000000 +5,C,2=0000000000 +5,C,3=0000000000 +5,C,4=1011111111 +5,C,5=0000000000 +6,A,0=1111111011 +6,A,2=0000000000 +6,A,3=0000000000 +6,A,4=1111111101 +6,A,5=0000000000 +6,C,0=0000000000 +6,C,1=0000000000 +6,C,2=0000000000 +6,C,3=0000000000 +6,C,5=1110110111 +7,A,0=0000000000 +7,A,1=0000000000 +7,A,3=0000000000 +7,A,4=0000000000 +7,A,5=0000000000 +7,C,0=0000000000 +7,C,1=0000000000 +7,C,5=1100011111 +8,A,1=1011111111 +8,A,2=1111111011 +8,A,3=1111110111 +8,C,0=1111011111 +8,C,2=1101111111 +9,A,0=0000000000 +9,A,1=1111111110 +9,A,2=1111011001 +9,A,3=0000000000 +9,A,4=1111110011 +9,A,5=0000000000 +9,C,0=0000000000 +9,C,3=0000000000 +9,C,5=0000011111 diff --git a/TRIGGER/TRIGGERLinkDef.h b/TRIGGER/TRIGGERLinkDef.h new file mode 100644 index 00000000000..5f0e790473f --- /dev/null +++ b/TRIGGER/TRIGGERLinkDef.h @@ -0,0 +1,14 @@ +#ifdef __CINT__ +/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * See cxx source for full Copyright notice */ + +/* $Id$ */ + + +#pragma link off all globals; +#pragma link off all classes; +#pragma link off all functions; + +#pragma link C++ class AliTRIPreprocessor+; + +#endif diff --git a/TRIGGER/TestTRIGGERPreprocessor.C b/TRIGGER/TestTRIGGERPreprocessor.C new file mode 100644 index 00000000000..53ed090f394 --- /dev/null +++ b/TRIGGER/TestTRIGGERPreprocessor.C @@ -0,0 +1,36 @@ +/* $Id $ */ + +// This class runs the test preprocessor +// It uses AliTestShuttle to simulate a full Shuttle process + +void TestTRIGGERPreprocessor() +{ + // load library + gSystem->Load("$ALICE_ROOT/SHUTTLE/TestShuttle/libTestShuttle.so"); + + // Defining shuttle instance (run number, start time, end time) + AliTestShuttle* shuttle = new AliTestShuttle(7, 0, 1); + + // Setting OCDB + AliTestShuttle::SetMainCDB("local://$ALICE_ROOT/OCDB/SHUTTLE/TestShuttle/TestCDB"); + AliTestShuttle::SetMainRefStorage("local://$ALICE_ROOT/OCDB/SHUTTLE/TestShuttle/TestReference"); + + // Adding test input files + shuttle->AddInputFile(AliTestShuttle::kDCS, "TRI", "PITConditions", "", "$ALICE_ROOT/TRIGGER/ShuttleInput/pit_dumpFileSep08.txt"); + + // Adding Trigger mask + shuttle->SetInputTriggerDetectorMask("0100001"); + printf("Test OCDB storage Uri: %s\n", AliShuttleInterface::GetMainCDB().Data()); + printf("Test Reference storage Uri: %s\n", AliShuttleInterface::GetMainRefStorage().Data()); + + // Setting RunType + shuttle->SetInputRunType("PHYSICS"); + + // Defining Preprocessor + AliPreprocessor* test = new AliTRIPreprocessor(shuttle); + + // Test the preprocessor + shuttle->Process(); + +} + diff --git a/TRIGGER/libTRIGGERbase.pkg b/TRIGGER/libTRIGGERbase.pkg new file mode 100644 index 00000000000..58b2120bccc --- /dev/null +++ b/TRIGGER/libTRIGGERbase.pkg @@ -0,0 +1,16 @@ +#-*- Mode: Makefile -*- +# $Id$ + +SRCS:= AliTRIPreprocessor.cxx +CINTHDRS:= $(SRCS:.cxx=.h) + +HDRS:= $(SRCS:.cxx=.h) + +DHDR:= TRIGGERLinkDef.h + +EINCLUDE:= ITS STEER + +ifeq (win32gcc,$(ALICE_TARGET)) +PACKSOFLAGS:= $(SOFLAGS) -L$(ALICE_ROOT)/lib/tgt_$(ALICE_TARGET) \ + -lCDB -lITSsim +endif diff --git a/build/module.dep b/build/module.dep index 7b6f41d1eb5..a3eefe14d2f 100644 --- a/build/module.dep +++ b/build/module.dep @@ -54,6 +54,7 @@ DPMJET/module.mk: DPMJET/libdpmjet.pkg TDPMjet/module.mk: TDPMjet/libTDPMjet.pkg TTherminator/module.mk: TTherminator/libTTherminator.pkg CORRFW/module.mk: CORRFW/libCORRFW.pkg +TRIGGER/module.mk: TRIGGER/libTRIGGERbase.pkg ifeq (win32gcc,$(ALICE_TARGET)) $(LIBPATH)/libAOD.$(SOEXT): $(LIBPATH)/libSTEERBase.$(SOEXT) @@ -185,5 +186,6 @@ $(LIBPATH)/libPWG4PartCorrBase.$(SOEXT): $(LIBPATH)/libSTEERBase.$(SOEXT) $(LIBP $(LIBPATH)/libPWG4PartCorrDep.$(SOEXT): $(LIBPATH)/libSTEERBase.$(SOEXT) $(LIBPATH)/libESD.$(SOEXT) $(LIBPATH)/libAOD.$(SOEXT) $(LIBPATH)/libANALYSIS.$(SOEXT) $(LIBPATH)/libANALYSISalice.$(SOEXT) $(LIBPATH)/libPWG4PartCorrBase.$(SOEXT) $(LIBPATH)/libPWG4JetTasks.$(SOEXT): $(LIBPATH)/libSTEERBase.$(SOEXT) $(LIBPATH)/libESD.$(SOEXT) $(LIBPATH)/libAOD.$(SOEXT) $(LIBPATH)/libANALYSIS.$(SOEXT) $(LIBPATH)/libANALYSISalice.$(SOEXT) $(LIBPATH)/libPWG4GammaConv.$(SOEXT): $(LIBPATH)/libSTEERBase.$(SOEXT) $(LIBPATH)/libESD.$(SOEXT) $(LIBPATH)/libAOD.$(SOEXT) $(LIBPATH)/libANALYSIS.$(SOEXT) $(LIBPATH)/libANALYSISalice.$(SOEXT) +$(LIBPATH)/libTRIGGER.$(SOEXT): $(LIBPATH)/libSTEER.$(SOEXT) $(LIBPATH)/libITSsim.$(SOEXT) endif -- 2.43.0