4 #if !defined(__CINT__) || defined(__MAKECINT__)
5 #include "AliCDBManager.h"
6 #include "AliCDBStorage.h"
8 #include "AliCDBMetaData.h"
11 #include <THashTable.h>
14 #include <TObjString.h>
17 Bool_t MakeCosmicTriggersEntry(const char *fileName, const char* cdbUri)
19 const char* macroname = "MakeCosmicTriggersEntry.C";
21 if (gSystem->AccessPathName(fileName)) {
22 Error(macroname,Form("file (%s) not found", fileName));
26 ifstream *file = new ifstream(fileName);
28 Error(macroname,Form("Error opening file (%s) !",fileName));
34 THashTable *table = new THashTable();
35 table->SetName("List of defined cosmic triggers");
38 while (strLine.ReadLine(*file)) {
40 if (strLine.BeginsWith("#")) continue;
42 strLine.ReplaceAll(" ","");
43 strLine.ReplaceAll("\t","");
44 if (strLine.IsNull()) continue;
46 TObjString *obj = new TObjString(strLine.Data());
54 // create OCDB storage
55 TString Storage(cdbUri);
56 if(!Storage.BeginsWith("local://") && !Storage.BeginsWith("alien://")) {
57 Error(macroname,"STORAGE variable set to %s is not valid. Exiting\n",Storage.Data());
60 AliCDBManager* cdb = AliCDBManager::Instance();
61 AliCDBStorage* storage = cdb->GetStorage(Storage.Data());
63 Error(macroname,"Unable to open storage %s\n",Storage.Data());
67 AliCDBMetaData* md = new AliCDBMetaData();
68 md->SetResponsible("Federico Antinori");
69 md->SetComment("List of the defined cosmic triggers. It is used in order to steer the reconstruction, namely in the selection of the proper event specie. It is maintained and updated by the trigger coordinator.");
70 // Get root and AliRoot versions and set them in the metadata
71 const char* rootv = gROOT->GetVersion();
72 TString av(ALIROOT_BRANCH);
73 TString revnum(ALIROOT_REVISION);
76 md->SetAliRootVersion(av.Data());
78 AliCDBId id("GRP/Calib/CosmicTriggers",0,AliCDBRunRange::Infinity());
79 Info(macroname,"Saving the list of defined cosmic triggers in the OCDB storage \"%s\"",Storage.Data());
80 storage->Put(table,id,md);