]> git.uio.no Git - u/mrichter/AliRoot.git/blame - MUON/UpdateCDBCTPConfig.C
In AliMUONVPainter:
[u/mrichter/AliRoot.git] / MUON / UpdateCDBCTPConfig.C
CommitLineData
cbb5526b 1/**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3 * *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
6 * *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
15
16/* $Id$ */
17
18/// \ingroup macros
19/// \file UpdateCDBCTPConfig.C
20/// \brief The macro writes a new GRP/CTP/Config trigger configuration file
21/// from the GRP/CTP/MUON.cfg trigger descriptor, corresponding to a
22/// run where only MUON is used as a trigger detector.
23///
24/// The macro writes a new GRP/CTP/Config trigger configuration file
25/// from the GRP/CTP/MUON.cfg trigger descriptor, corresponding to a
26/// run where only MUON is used as a trigger detector. The
27/// compatibility is check against the Config.C used in the simulation
28/// (which means that the MUON detector must be there). When "check"
29/// is "true", the macro only shows the last CTP configuration stored in
30/// the GRP.
31/// This is necessary because at the first step of the simulation (digits)
32/// the trigger configuration is guessed from the detectors defined in the
33/// Config.C, while the reconstruction is performed in a second separate
34/// step, having no more knowledge of the Config.C file.
35/// This has to be done before starting the simulations, only once after
36/// the installation of AliRoot:
37///
38/// <pre>
39///.L $ALICE_ROOT/MUON/UpdateCDBCTPConfig.C+
40/// UpdateCDBCTPConfig(1); // just checking
41/// UpdateCDBCTPConfig(); // update the GRP/CDB entry
42/// </pre>
43///
44/// AliRoot comes with a default entry corresponding to a pp trigger. In
45/// this case, at the reconstruction phase error messages will appear (without
46/// breaking the reconstruction): \n
47///
48/// E-AliCentralTrigger::CheckTriggeredDetectors: Wrong cluster mask from trigger
49/// classes (7ffff), expecting (20c00)! Loaded trigger configuration is possibly wrong!
50///
51/// \author B. Vulpescu, LPC Clermont-Ferrand
52
53#if !defined(__CINT__) || defined(__MAKECINT__)
54#include "ARVersion.h"
55#include "AliCDBManager.h"
56#include "AliCDBStorage.h"
57#include "AliCDBEntry.h"
58#include "AliCDBId.h"
59#include "AliCDBMetaData.h"
60#include "AliTriggerConfiguration.h"
04144b9a 61#include "AliSimulation.h"
cbb5526b 62#include <TROOT.h>
63#include <TString.h>
64#include <TSystem.h>
65#endif
66
67void UpdateCDBCTPConfig(Bool_t check = false) {
68
04144b9a 69 // AliSimulation object must exist, as it is used via AliMC
70 // which is used in AliTriggerConfiguration::CheckConfiguration()
71 AliSimulation sim;
72
cbb5526b 73 AliCDBManager* cdb = AliCDBManager::Instance();
162637e4 74 cdb->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
cbb5526b 75 cdb->SetRun(0);
76
77 if (check) {
78 // current entry in GRP/CTP/Config trigger configuration
79 AliCDBEntry *entry;
80 entry = cdb->Get("GRP/CTP/Config");
81 AliCDBMetaData *md = entry->GetMetaData();
82 Printf("AliRoot version: %s",md->GetAliRootVersion());
83 Printf("Comment: %s ",md->GetComment());
84 Printf("Responsible: %s ",md->GetResponsible());
85 return;
86 }
87
88 const Char_t* alice = gSystem->Getenv("ALICE_ROOT");
89
90 // construct the CTP configuration starting from GRP/CTP/<CTPcfg>.cfg file
91
92 // Config.C detector configuration
93 TString cfgFile(Form("%s/MUON/Config.C",alice));
94
95 // MUON.cfg trigger configuration
96 TString cfgCTP(Form("%s/GRP/CTP/MUON.cfg",alice));
97
98 AliTriggerConfiguration *trconfig = AliTriggerConfiguration::LoadConfiguration(cfgCTP);
99 if (!trconfig) {
100 Printf("Invalid cfg file! Exiting...");
101 return;
102 }
103
104 // check if Config.C is compatible with the trigger configuration requested
105 if (!trconfig->CheckConfiguration(cfgFile)) {
106 Printf("CTP configuration is incompatible with the specified Config.C and AliRoot version! Exiting...");
107 return;
108 }
109
110 // put the new trigger configuration "trconfig" in the GRP/CTP/Config
111
112 AliCDBId id("GRP/CTP/Config",0,AliCDBRunRange::Infinity());
113 AliCDBMetaData *md= new AliCDBMetaData();
114
115 // ROOT and AliRoot versions
116 const char* rootv = gROOT->GetVersion();
117 TString av(ALIROOT_SVN_BRANCH);
118 Int_t revnum = ALIROOT_SVN_REVISION;
119
120 Printf("root version: %s. AliRoot %s, revision number %d",rootv,av.Data(),revnum);
121
122 md->SetAliRootVersion(av.Data());
123 md->SetComment(Form("Default CTP configuration for MUON mode produced with root version %s and AliRoot version %s revision %d ",rootv,av.Data(),revnum));
124
162637e4 125 AliCDBStorage* storage = cdb->GetStorage("local://$ALICE_ROOT/OCDB");
cbb5526b 126 storage->Put(trconfig,id,md);
127
128}