Adding the macro to create the GRP CDB default object
[u/mrichter/AliRoot.git] / GRP / UpdateCDBGRPEntry.C
CommitLineData
99479691 1void UpdateCDBGRPEntry() {
2 // produce the GRP default entry in CDB
3
4 AliCDBManager* man = AliCDBManager::Instance();
5 man->SetDefaultStorage("local://$ALICE_ROOT");
6 man->SetRun(0);
7 AliCDBId id("GRP/GRP/Data",0,AliCDBRunRange::Infinity());
8 AliCDBMetaData *metadata= new AliCDBMetaData();
9
10 // Get root version
11 const char* rootv = gROOT->GetVersion();
12
13 // Get AliRoot version from file to set it in the metadata of the entry
14 TFile *fv= TFile::Open("$ALICE_ROOT/CVS/Repository?filetype=raw","READ");
15 Int_t size = fv->GetSize();
16 char *buf = new Char_t[size];
17 memset(buf, '\0', size);
18 fv->Seek(0);
19 char* alirootv;
20 if ( fv->ReadBuffer(buf, size) ) {
21 Printf("Error reading AliRoot version from file to buffer!");
22 alirootv = "";
23 }
24 if(buf=="AliRoot"){
25 alirootv="HEAD";
26 }else{
27 alirootv = buf;
28 metadata->SetResponsible("Panos.Christakoglou@cern.ch");
29 metadata->SetComment("Default values for the GRP monitored parameters");
30 metadata->SetAliRootVersion(alirootv);
31 }
32
33 TList *list = GetGRPList();
34 Printf("Storing in CDB the default values for the GRP %d parameters produced with root %s and AliRoot version %s",list->GetEntries(),rootv,alirootv);
35
36 man->Put(list,id,metadata);
37}
38
39//_______________________________________//
40TList *GetGRPList() {
41 TList *list = new TList();
42
43 TMap *mapDAQ1 = new TMap();
44 mapDAQ1->Add(new TObjString("fAliceStartTime"),new TObjString("0"));
45 list->Add(mapDAQ1);
46 TMap *mapDAQ2 = new TMap();
47 mapDAQ2->Add(new TObjString("fAliceStopTime"),new TObjString("9999"));
48 list->Add(mapDAQ2);
49 TMap *mapDAQ3 = new TMap();
50 mapDAQ3->Add(new TObjString("fAliceBeamEnergy"),new TObjString("14"));
51 list->Add(mapDAQ3);
52 TMap *mapDAQ4 = new TMap();
53 mapDAQ4->Add(new TObjString("fAliceBeamType"),new TObjString("pp"));
54 list->Add(mapDAQ4);
55 TMap *mapDAQ5 = new TMap();
56 mapDAQ5->Add(new TObjString("fNumberOfDetectors"),new TObjString(""));
57 list->Add(mapDAQ5);
58 TMap *mapDAQ6 = new TMap();
59 mapDAQ6->Add(new TObjString("fDetectorMask"),new TObjString(""));
60 list->Add(mapDAQ6);
61 TMap *mapDAQ7 = new TMap();
62 mapDAQ7->Add(new TObjString("fLHCPeriod"),new TObjString("LHC07a"));
63 list->Add(mapDAQ7);
64
65 TMap *mapDCS1 = new TMap();
66 mapDCS1->Add(new TObjString("fLHCState"),new TObjString("test"));
67 list->Add(mapDCS1);
68 TMap *mapDCS2 = new TMap();
69 mapDCS2->Add(new TObjString("fLHCCondition"),new TObjString("test"));
70 list->Add(mapDCS2);
71 TMap *mapDCS3 = new TMap();
72 mapDCS3->Add(new TObjString("fLHCLuminosity"),new TObjString("0"));
73 list->Add(mapDCS3);
74 TMap *mapDCS4 = new TMap();
75 mapDCS4->Add(new TObjString("fBeamIntensity"),new TObjString("0"));
76 list->Add(mapDCS4);
77 TMap *mapDCS5 = new TMap();
78 mapDCS5->Add(new TObjString("fL3Current"),new TObjString("0"));
79 list->Add(mapDCS5);
80 TMap *mapDCS6 = new TMap();
81 mapDCS6->Add(new TObjString("fL3Polarity"),new TObjString("0"));
82 list->Add(mapDCS6);
83 TMap *mapDCS7 = new TMap();
84 mapDCS7->Add(new TObjString("fDipoleCurrent"),new TObjString("0"));
85 list->Add(mapDCS7);
86 TMap *mapDCS8 = new TMap();
87 mapDCS8->Add(new TObjString("fDipolePolarity"),new TObjString("0"));
88 list->Add(mapDCS8);
89 TMap *mapDCS9 = new TMap();
90 mapDCS9->Add(new TObjString("fCavernTemperature"),new TObjString("0"));
91 list->Add(mapDCS9);
92 TMap *mapDCS10 = new TMap();
93 mapDCS10->Add(new TObjString("fCavernPressure"),new TObjString("0"));
94 list->Add(mapDCS10);
95
96 return list;
97}