]> git.uio.no Git - u/mrichter/AliRoot.git/blob - GRP/UpdateCDBCTPConfig.C
doxy: TPC/testMC converted
[u/mrichter/AliRoot.git] / GRP / UpdateCDBCTPConfig.C
1 void UpdateCDBCTPConfig(const char *CTPcfg, const char* cdbUri, const char* cfgFile){
2   // Produces a trigger configuration starting from a 'cfg' file in the
3   // GRP/CTP folder (CTPcfg argument). Stores the configuration in the specified CDB.
4   // The third argument allows to specify the config file against which
5   // the trigger confiuration is checked.
6
7   AliCDBManager* cdb = AliCDBManager::Instance();
8   // we set the default storage to the repository because some dets require
9   // already at the time of geometry creation to find calibration objects in the cdb
10   if(!cdb->IsDefaultStorageSet()) cdb->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
11   AliCDBStorage* storage = cdb->GetStorage(cdbUri);
12   cdb->SetRun(0);
13   AliCDBId id("GRP/CTP/Config",0,AliCDBRunRange::Infinity());
14   AliCDBMetaData *md= new AliCDBMetaData();
15
16   // Get root and AliRoot versions
17   const char* rootv = gROOT->GetVersion();
18   gROOT->ProcessLine(".L $ALICE_ROOT/macros/GetARversion.C");
19   TString av(GetARversion());
20
21   md->SetAliRootVersion(av.Data());
22   md->SetComment(Form("Default CTP configuration for p-p mode produced with root version %s and AliRoot version %s",rootv,av.Data()));
23   
24   // construct the CTP configuration starting from GRP/CTP/<CTPcfg>.cfg file
25   AliTriggerConfiguration *trconfig = AliTriggerConfiguration::LoadConfiguration(CTPcfg);
26   if (!trconfig) {
27     Printf("Invalid cfg file! Exiting...");
28     return;
29   }
30   if (!trconfig->CheckConfiguration(cfgFile)) {
31     Printf("CTP configuration is incompatible with the specified Config.C and AliRoot version! Exiting...");
32     return;
33   }
34   
35   Printf("Storing in CDB geometry produced with root version %s and AliRoot version %s",rootv,av.Data());
36   storage->Put(trconfig,id,md);
37   // This is to allow macros lauched after this one in the same session to find the
38   // newly produced geometry.
39   storage->QueryCDB(cdb->GetRun());
40
41 }
42
43