]> git.uio.no Git - u/mrichter/AliRoot.git/blame - GRP/MakeCosmicTriggersEntry.C
New OCDB entry containing the list of cosmic triggers defined by the trigger coordina...
[u/mrichter/AliRoot.git] / GRP / MakeCosmicTriggersEntry.C
CommitLineData
cdb216d3 1Bool_t MakeCosmicTriggersEntry(const char *fileName)
2{
3 const char* macroname = "MakeCosmicTriggersEntry.C";
4
5 if (gSystem->AccessPathName(fileName)) {
6 Error(macroname,Form("file (%s) not found", fileName));
7 return kFALSE;
8 }
9
10 ifstream *file = new ifstream(fileName);
11 if (!*file) {
12 Error(macroname,Form("Error opening file (%s) !",fileName));
13 file->close();
14 delete file;
15 return kFALSE;
16 }
17
18 THashTable *table = new THashTable();
19 table->SetName("List of defined cosmic triggers");
20
21 TString strLine;
22 while (strLine.ReadLine(*file)) {
23
24 if (strLine.BeginsWith("#")) continue;
25
26 strLine.ReplaceAll(" ","");
27 strLine.ReplaceAll("\t","");
28 if (strLine.IsNull()) continue;
29
30 TObjString *obj = new TObjString(strLine.Data());
31 table->Add(obj);
32 }
33
34 file->close();
35 delete file;
36
37
38 // save in CDB storage
39 TString Storage = gSystem->Getenv("STORAGE");
40 if(!Storage.BeginsWith("local://") && !Storage.BeginsWith("alien://")) {
41 Error(macroname,"STORAGE variable set to %s is not valid. Exiting\n",Storage.Data());
42 return;
43 }
44 Info(macroname,"Saving alignment objects in CDB storage %s",Storage.Data());
45 AliCDBManager* cdb = AliCDBManager::Instance();
46 AliCDBStorage* storage = cdb->GetStorage(Storage.Data());
47 if(!storage){
48 Error(macroname,"Unable to open storage %s\n",Storage.Data());
49 return;
50 }
51 AliCDBMetaData* md = new AliCDBMetaData();
52 md->SetResponsible("Federico Antinori");
53 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.");
54 md->SetAliRootVersion(gSystem->Getenv("ARVERSION"));
55 AliCDBId id("GRP/Calib/CosmicTriggers",0,AliCDBRunRange::Infinity());
56 storage->Put(table,id,md);
57
58 table->Delete();
59 delete table;
60
61 return kTRUE;
62}