to be read from the GRP preprocessor, and stored in the OCDB in /GRP/CTP/LTUConfig.
The validity of the object is [current_run, current_run], even if the entry committed
in AliRoot has infinite validity.
Only runs taken in global partitions will now be considered to fill the entry (a dummy
entry should be implemented as for the other CTP entries).
--- /dev/null
+void MakeCTPLTUConfigEntry(const char *cdbStorage = "local://$ALICE_ROOT/OCDB"){
+
+ // Example macro to put in OCDB an LTU Config entry
+ // Since it is just an example macro, the AliLTUConfig members will be set as
+ // follows for all the detectors:
+ // fFineDelay1 = 0;
+ // fFineDelay2 = 0;
+ // fBCDelaysAdd = 0;
+
+ AliCDBManager *man = AliCDBManager::Instance();
+ man->SetDefaultStorage(cdbStorage);
+
+ TObjArray* ltuarray = new TObjArray();
+ ltuarray->SetOwner(1);
+ AliLTUConfig* ltu;
+ for(Int_t i = 0; i<AliDAQ::kNDetectors-2; i++){
+ const char* name = AliDAQ::DetectorName(i);
+ ltu = new AliLTUConfig((UChar_t)AliDAQ::DetectorID(name),0.,0.,0.);
+ ltuarray->AddAtAndExpand(ltu,i);
+ }
+
+ AliCDBMetaData* md = new AliCDBMetaData();
+ md->SetResponsible("Roman Lietava");
+ md->SetComment("Example of (dummy -> everything set to 0) entry for the detectors' LTU config");
+ AliCDBId id("GRP/CTP/LTUConfig",0,AliCDBRunRange::Infinity());
+ man->Put(ltuarray,id, md);
+
+ return;
+}
// setting runtype
shuttle->SetInputRunType(runtype);
+ Int_t detectorMask = 1074200319;
+ TString detectorMask_Str(Form("%d",detectorMask));
+ shuttle->AddInputRunParameter("detectorMask", detectorMask_Str.Data());
+
+ TString* ltu = new TString[3];
+ ltu[0] = "2000";
+ ltu[1] = "6000";
+ ltu[2] = "8000";
+ for (Int_t i = 0; i<AliDAQ::kNDetectors-2; i++){
+ if ((detectorMask >> i) & 0x1) {
+ TString detOnlineName = AliDAQ::DetectorName(i);
+ if (detOnlineName == "VZERO"){
+ ltu[0] = "3000";
+ ltu[1] = "7000";
+ ltu[2] = "9000";
+ }
+ shuttle->SetLTUConfig(ltu,detOnlineName.Data());
+ }
+ }
+
// simulating DCS DPs
TMap* dcsAliasMap = CreateDCSAliasMap(errorLevel);
shuttle->SetDCSInput(dcsAliasMap);
// simulating input from DAQ FXS
if (errorLevel != 2){
+
//$ALICE_ROOT to be expanded manually by the user for this test macro
shuttle->AddInputFile(AliShuttleInterface::kDAQ, "GRP", "Period_LHC09c_TPC.Seq_0.tag.root", "GDC35", "$ALICE_ROOT/GRP/ShuttleInput/run000080740_GRP_gdc-aldaqpc035_Period_LHC09c.Seq_0.tag.root");
shuttle->AddInputFile(AliShuttleInterface::kDAQ, "GRP", "Period_LHC09c_TPC.Seq_0.tag.root", "GDC36", "$ALICE_ROOT/GRP/ShuttleInput/run000080740_GRP_gdc-aldaqpc036_Period_LHC09c.Seq_0.tag.root");
shuttle->AddInputFile(AliShuttleInterface::kDAQ, "GRP", "Period_LHC09c_TPC.Seq_0.tag.root", "GDC45", "$ALICE_ROOT/GRP/ShuttleInput/run000080740_GRP_gdc-aldaqpc045_Period_LHC09c.Seq_0.tag.root");
shuttle->AddInputFile(AliShuttleInterface::kDAQ, "SPD", "VertexDiamond", "gdc-GLOBAL-01", "$ALICE_ROOT/GRP/ShuttleInput/run000104892_SPD_mon-DA-SPD-0_VertexDiamond");
shuttle->AddInputFile(AliShuttleInterface::kDCS, "GRP", "LHCData", "", "$ALICE_ROOT/GRP/ShuttleInput/testRun_GRP_run_number_testRun_data.txt");
- /*
+
// for example:
- shuttle->AddInputFile(AliShuttleInterface::kDAQ, "GRP", "Period_LHC09c_TPC.Seq_0.tag.root", "GDC35", "/home/zampolli/SOFT/AliRoot/AliRoot_Trunk_OCDB/GRP/ShuttleInput/run000080740_GRP_gdc-aldaqpc035_Period_LHC09c.Seq_0.tag.root");
- shuttle->AddInputFile(AliShuttleInterface::kDAQ, "GRP", "Period_LHC09c_TPC.Seq_0.tag.root", "GDC36", "/home/zampolli/SOFT/AliRoot/AliRoot_Trunk_OCDB/GRP/ShuttleInput/run000080740_GRP_gdc-aldaqpc036_Period_LHC09c.Seq_0.tag.root");
- shuttle->AddInputFile(AliShuttleInterface::kDAQ, "GRP", "Period_LHC09c_TPC.Seq_0.tag.root", "GDC44", "/home/zampolli/SOFT/AliRoot/AliRoot_Trunk_OCDB/GRP/ShuttleInput/run000080740_GRP_gdc-aldaqpc044_Period_LHC09c.Seq_0.tag.root");
- shuttle->AddInputFile(AliShuttleInterface::kDAQ, "GRP", "Period_LHC09c_TPC.Seq_0.tag.root", "GDC45", "/home/zampolli/SOFT/AliRoot/AliRoot_Trunk_OCDB/GRP/ShuttleInput/run000080740_GRP_gdc-aldaqpc045_Period_LHC09c.Seq_0.tag.root");
- shuttle->AddInputFile(AliShuttleInterface::kDAQ, "SPD", "VertexDiamond", "gdc-GLOBAL-01", "/home/zampolli/SOFT/AliRoot/AliRoot_Trunk_OCDB/GRP/ShuttleInput/run000104892_SPD_mon-DA-SPD-0_VertexDiamond");
- shuttle->AddInputFile(AliShuttleInterface::kDCS, "GRP", "LHCData", "", "/home/zampolli/SOFT/AliRoot/AliRoot_Trunk_OCDB/GRP/ShuttleInput/testRun_GRP_run_number_testRun_data.txt");
- */
+ /*
+ shuttle->AddInputFile(AliShuttleInterface::kDAQ, "GRP", "Period_LHC09c_TPC.Seq_0.tag.root", "GDC35", "/home/zampolli/SOFT/AliRoot/AliRoot_Trunk/GRP/ShuttleInput/run000080740_GRP_gdc-aldaqpc035_Period_LHC09c.Seq_0.tag.root");
+ shuttle->AddInputFile(AliShuttleInterface::kDAQ, "GRP", "Period_LHC09c_TPC.Seq_0.tag.root", "GDC36", "/home/zampolli/SOFT/AliRoot/AliRoot_Trunk/GRP/ShuttleInput/run000080740_GRP_gdc-aldaqpc036_Period_LHC09c.Seq_0.tag.root");
+ shuttle->AddInputFile(AliShuttleInterface::kDAQ, "GRP", "Period_LHC09c_TPC.Seq_0.tag.root", "GDC44", "/home/zampolli/SOFT/AliRoot/AliRoot_Trunk/GRP/ShuttleInput/run000080740_GRP_gdc-aldaqpc044_Period_LHC09c.Seq_0.tag.root");
+ shuttle->AddInputFile(AliShuttleInterface::kDAQ, "GRP", "Period_LHC09c_TPC.Seq_0.tag.root", "GDC45", "/home/zampolli/SOFT/AliRoot/AliRoot_Trunk/GRP/ShuttleInput/run000080740_GRP_gdc-aldaqpc045_Period_LHC09c.Seq_0.tag.root");
+ shuttle->AddInputFile(AliShuttleInterface::kDAQ, "SPD", "VertexDiamond", "gdc-GLOBAL-01", "/home/zampolli/SOFT/AliRoot/AliRoot_Trunk/GRP/ShuttleInput/run000104892_SPD_mon-DA-SPD-0_VertexDiamond");
+ shuttle->AddInputFile(AliShuttleInterface::kDCS, "GRP", "LHCData", "", "/home/zampolli/SOFT/AliRoot/AliRoot_Trunk/GRP/ShuttleInput/testRun_GRP_run_number_testRun_data.txt");
+ */
}
// simulating input from DCS FXS
shuttle->AddInputRunParameter("DAQ_time_start", "1020");
}
if (errorLevel != 6){
- shuttle->AddInputRunParameter("beamEnergy", "1400.");
+ shuttle->AddInputRunParameter("beamEnergy", "123");
}
shuttle->AddInputRunParameter("DAQ_time_end", "1980");
- shuttle->AddInputRunParameter("beamType", beamType);
+ shuttle->AddInputRunParameter("beamType", beamType);
shuttle->AddInputRunParameter("numberOfDetectors", "5");
- shuttle->AddInputRunParameter("detectorMask", "34555");
shuttle->AddInputRunParameter("LHCperiod", "LHC08b");
shuttle->AddInputRunParameter("partition",partition);
shuttle->AddInputRunParameter("detector",detector);
return;
}
+//______________________________________________________________________________________________
+TString* AliShuttle::GetLTUConfig(const char* det)
+{
+ //
+ // Getting ltuFineDelay1, ltuFineDelay2, ltuBCDelay for detector det from logbook_detectors table in logbook
+ //
+
+ if (!Connect(3))
+ return 0;
+
+ TString sqlQuery;
+ sqlQuery.Form("select LTUFineDelay1, LTUFineDelay2, LTUBCDelayAdd from logbook_detectors WHERE run_number = %d and detector = \"%s\";", GetCurrentRun(),det);
+
+ TSQLResult* result = fServer[3]->Query(sqlQuery);
+ if (!result){
+ Log("SHUTTLE","ERROR: No result found for the LTU configuration query");
+ return 0x0;
+ }
+ if (result->GetRowCount() == 0){
+ Log("SHUTTLE",Form("ERROR: LTU configuration not found in logbook_detectors for detector %s, returning null pointer",det));
+ delete result;
+ return 0x0;
+ }
+ if (result->GetFieldCount() != 3){
+ Log("SHUTTLE",Form("ERROR: not all the required fields are there for the LTU configuration for detector %s (only %d found), returning a null pointer",det, result->GetFieldCount()));
+ delete result;
+ return 0x0;
+ }
+ TSQLRow* row = result->Next();
+ if (!row){
+ Printf("ERROR: Could not receive logbook_detectors data, returning null pointer");
+ delete result;
+ return 0x0;
+ }
+ TString* ltuConfigString = new TString[3];
+
+ ltuConfigString[0] = row->GetField(0);
+ ltuConfigString[1] = row->GetField(1);
+ ltuConfigString[2] = row->GetField(2);
+ return ltuConfigString;
+
+}
static void SetShuttleLogDir (const char* logDir);
virtual void SendMLFromDet(const char* value);
+ virtual TString* GetLTUConfig(const char* det);
private:
AliShuttle(const AliShuttle& other);
#include "AliCDBPath.h"
#include "AliCDBId.h"
#include "AliPreprocessor.h"
+#include "AliLTUConfig.h"
+#include "AliDAQ.h"
+#include "AliTriggerInput.h"
#include <TMap.h>
#include <TList.h>
#include <TObjString.h>
#include <TSystem.h>
#include <TTimeStamp.h>
+#include <TObjArray.h>
ClassImp(AliTestShuttle)
fDcsAliasMap(0),
fTriggerConfiguration(""),
fTriggerDetectorMask(""),
- fCTPtiming("")
+ fCTPtiming(""),
+ fltuConfig(0x0)
{
// constructor
fInputFiles->SetOwner(1);
fRunParameters->SetOwner(1);
fPreprocessors->SetOwner(1);
+
+ fltuConfig = new TObjArray();
+ fltuConfig->SetOwner(1);
}
//______________________________________________________________________________________________
delete fDcsAliasMap;
fDcsAliasMap = 0;
+
+ delete fltuConfig;
+ fltuConfig = 0;
}
//______________________________________________________________________________________________
Printf("%s will be sent to monalisa in the $currentdetector_RunCondition tag",value);
return;
}
+//______________________________________________________________________________________________
+void AliTestShuttle::SetLTUConfig(TString* ltuConfig, const char* det){
+
+ //
+ // Setting LTU configuration for detector det
+ //
+
+ AliInfo(Form("LTU Config will be added for detector %s",det));
+ AliInfo(Form("First element of the array of strings will correspond to LTUFineDelay1 --> %s",ltuConfig[0].Data()));
+ AliInfo(Form("Second element of the array of strings will correspond to LTUFineDelay2 --> %s",ltuConfig[1].Data()));
+ AliInfo(Form("Third element of the array of strings will correspond to LTUBCDelayAdd --> %s",ltuConfig[2].Data()));
+ Float_t ltuFineDelay1 = ltuConfig[0].Atof();
+ Float_t ltuFineDelay2 = ltuConfig[1].Atof();
+ Float_t ltuBCDelayAdd = ltuConfig[2].Atof();
+ AliLTUConfig* ltu = new AliLTUConfig((UChar_t)AliDAQ::DetectorID(det),ltuFineDelay1,ltuFineDelay2,ltuBCDelayAdd);
+ Int_t idet = AliDAQ::DetectorID(det);
+ fltuConfig->AddAtAndExpand(ltu,idet);
+ return;
+}
+//______________________________________________________________________________________________
+TString* AliTestShuttle::GetLTUConfig(const char* det){
+
+ //
+ // Getting LTU configuration for detector det
+ //
+
+ TString* ltuConfigString = new TString[3];
+ Int_t idet = -1;
+ for (Int_t index = 0; index < AliDAQ::kNDetectors; index++){
+ AliDebug(3,Form("index = %d, det = %s, CTP name = %s",index,det,AliTriggerInput::fgkCTPDetectorName[index]));
+ if (strcmp(det,AliTriggerInput::fgkCTPDetectorName[index]) == 0){
+ AliInfo(Form("Getting LTU configuration for detector %s",AliTriggerInput::fgkCTPDetectorName[index]));
+ idet = index;
+ break;
+ }
+ }
+ if (idet != -1){
+ AliLTUConfig* ltu = (AliLTUConfig*)fltuConfig->At(idet);
+ if (!ltu){
+ AliInfo(Form("ltu for detector %s not added in the simulated run, returning a null pointer",det));
+ return 0x0;
+ }
+ else{
+ ltuConfigString[0]=Form("%f",ltu->GetFineDelay1());
+ ltuConfigString[1]=Form("%f",ltu->GetFineDelay2());
+ ltuConfigString[0]=Form("%f",ltu->GetBCDelayAdd());
+ }
+ }
+ else{
+ AliError(Form("Detector %s not found in the list of CTP detector names",det));
+ }
+ return ltuConfigString;
+
+}
+
void SetTimeCreated(UInt_t timeCreated) { fTimeCreated = timeCreated;}
void SetDCSQueryOffset(UInt_t dcsQueryOffset) { fDCSQueryOffset = dcsQueryOffset;}
void Process();
+ void SetLTUConfig(TString* ltuConfig, const char* det);
// AliShuttleInterface functions
virtual Bool_t Store(const AliCDBPath& path, TObject* object, AliCDBMetaData* metaData,
static void SetShuttleLogDir (const char* logDir);
virtual void SendMLFromDet(const char* value);
+ virtual TString* GetLTUConfig(const char* det);
protected:
TString fTriggerConfiguration; // trigger configuration for testing
TString fTriggerDetectorMask; // trigger detector mask for testing
TString fCTPtiming; // CTP time paramters for testing
-
+ TObjArray *fltuConfig; // LTU config TObjArray
+
private:
Bool_t CopyFileLocally(TString& targetDir, const char* localFile, const char* gridFileName);
const char* GetRefFilePrefix(const char* base, const char* detector);
#include "AliTriggerConfiguration.h"
#include "AliTriggerRunScalers.h"
+#include "AliTriggerInput.h"
#include "AliCDBMetaData.h"
#include "AliESDVertex.h"
#include "AliLHCReader.h"
#include "AliLHCData.h"
#include "AliDCSArray.h"
+#include "AliDAQ.h"
+#include "AliLTUConfig.h"
class AliLog;
class AliDCSValue;
"(SPD Mean Vertex ERROR)",
"(DCS FXS Error for LHC Data)",
"(LHC Data Error)",
- "(LHC Clock Phase Error (from LHC Data))"
+ "(LHC Clock Phase Error (from LHC Data))",
+ "(LTU Configuration Error)"
};
//_______________________________________________________________
error |= 32;
}
+ //===========================//
+ // LTU Configuration //
+ //===========================//
+
+ Log("*************** Processing LTU Configuration");
+
+ if (partition.IsNull() && !detector.IsNull()){ // standalone partition
+ Log("STANDALONE partition for current run, not retrieving LTU configuration");
+ /*
+ Log("STANDALONE partition for current run, using LTU configuration dummy value");
+ AliCDBEntry *cdbEntry = GetFromOCDB("CTP","DummyLTUConfig");
+ if (!cdbEntry) {
+ Log(Form("No dummy LTU Config entry found, going into error..."));
+ error |= 2048;
+ }
+ else{
+ TObjArray *ltuConfig = (TObjArray*)cdbEntry->GetObject();
+ if (!ltuConfig){
+ Log(Form("dummy LTU Config not found in OCDB entry, going into error..."));
+ error |= 2048;
+ }
+ else {
+ AliCDBMetaData metadata;
+ metadata.SetResponsible("Roman Lietava");
+ metadata.SetComment("LTU Config from dummy entry in OCDB");
+ if (!Store("CTP","LTUConfig", ltuConfig, &metadata, 0, 0)) {
+ Log("Unable to store the dummy LTU Config object to OCDB!");
+ error |= 2048;
+ }
+ }
+ }
+ */
+ }
+
+ else if (!partition.IsNull() && detector.IsNull()){ // global partition
+
+ Log("GLOBAL partition for current run, getting LTU Config from DAQ Logbook (logbook_detectors table)");
+ UInt_t detectorMask = (UInt_t)(((TString)GetRunParameter("detectorMask")).Atoi());
+ Printf ("detectormask = %d",detectorMask);
+ TObjArray * ltuarray = new TObjArray();
+ ltuarray->SetOwner(1);
+ Bool_t isLTUok = kTRUE;
+ for(Int_t i = 0; i<AliDAQ::kNDetectors-2; i++){
+ if ((detectorMask >> i) & 0x1) {
+ TString det = AliDAQ::OfflineModuleName(i);
+ TString detCTPName = AliTriggerInput::fgkCTPDetectorName[i];
+ if (detCTPName == "CTP") detCTPName="TRG"; // converting according to what is found in DAQ logbook_detectors
+ Printf("Processing detector %s (CTP Detector name %s)",det.Data(),detCTPName.Data());
+ TString* ltu = GetLTUConfig(detCTPName.Data());
+ if (!ltu){
+ Log(Form("No LTU Configuration from DAQ logbook for detector %s (BUT it was expected)! The corresponding CDB entry will not be filled!",detCTPName.Data()));
+ error |= 2048;
+ isLTUok = kFALSE;
+ break;
+ }
+ else{
+ Float_t ltuFineDelay1 = ltu[0].Atof();
+ Float_t ltuFineDelay2 = ltu[1].Atof();
+ Float_t ltuBCDelayAdd = ltu[2].Atof();
+ const char* name = AliDAQ::DetectorName(i);
+ AliLTUConfig* ltuConfig = new AliLTUConfig((UChar_t)AliDAQ::DetectorID(name),ltuFineDelay1,ltuFineDelay2,ltuBCDelayAdd);
+ ltuarray->AddAtAndExpand(ltuConfig,i);
+ }
+ }
+ }
+ if (isLTUok){
+ AliCDBMetaData metadata;
+ metadata.SetBeamPeriod(0);
+ metadata.SetResponsible("Roman Lietava");
+ metadata.SetComment("LTU Configuration for current run");
+ if (!Store("CTP","LTUConfig", ltuarray, &metadata, 0, 0)) {
+ Log("Unable to store the LTU Config object to OCDB!");
+ error |= 2048;
+ }
+ }
+ if (ltuarray) delete ltuarray;
+ }
+
+ else {
+ Log(Form("Incorrect field in DAQ logbook for partition = %s and detector = %s, going into error without trigger timing parameters...",partition.Data(),detector.Data()));
+ error |= 32;
+ }
+
//=================//
// LHC Data //
Log("GRP Preprocessor Success");
return 0;
} else {
- Log( Form("GRP Preprocessor FAILS!!! %s%s%s%s%s%s%s%s%s%s%s",
+ Log( Form("GRP Preprocessor FAILS!!! %s%s%s%s%s%s%s%s%s%s%s%s",
kppError[(error&1)?1:0],
kppError[(error&2)?2:0],
kppError[(error&4)?3:0],
kppError[(error&128)?8:0],
kppError[(error&256)?9:0],
kppError[(error&512)?10:0],
- kppError[(error&1024)?11:0]
+ kppError[(error&1024)?11:0],
+ kppError[(error&2048)?12:0]
));
return error;
}
return fShuttle->SendMLFromDet(value);
}
+//______________________________________________________________________________________________
+TString* AliPreprocessor::GetLTUConfig(const char* det)
+{
+ // LTU config from logbook_detector table from DAQ logbook for detector det
+ //
+ // The call is delegated to AliShuttleInterface
+
+ return fShuttle->GetLTUConfig(det);
+}
void AddRunType(const char* runType);
void SendToML(const char*);
+ TString* GetLTUConfig(const char* det);
Int_t fRun; // current run
UInt_t fStartTime; // starttime of current run
static const char* GetShuttleTempDir() {return fgkShuttleTempDir.Data();}
virtual void SendMLFromDet(const char* value) = 0;
+ virtual TString* GetLTUConfig(const char* det) =0;
protected: