FindFASTJET
[u/mrichter/AliRoot.git] / HLT / exa / changeRunValidity.C
CommitLineData
e74d595e 1// $Id$
2/**
3 * @file changeRunValidity.C
4 * @brief Change the run validity for OCDB entries. It increments the version of the input by 1,
5 * in case there exists another object in the same folder with the same run validity.
6 * Please BE CAREFUL where you run it and where you copy the result. Check that the version of the
7 * produced file is correct to enable its loading during the reconstruction.
8 *
9 * THIS IS A TEMPORARY SOLUTION UNTIL THE PENDOLINO STARTS RUNNING. WE SHOULD NOT RELY ON THIS MACRO.
10 *
11 * <pre>
12 * Usage: aliroot -b -q -l changeRunValidity.C'("RunXXX_YYY_v?_s?.root",runmin,runmax)'
13 * Default runmin = 0, runmax = 999999999
14 *
15 * Used for OCDB objects whose run validity is restrictic (run specific),
16 * e.g. TPC/Calib/AltroConfig
17 * TPC/Calib/Temperature
18 * TPC/Calib/HighVoltage
19 * GRP/CTP/CTPtiming
20 *
21 *
22 * @author Kalliopi.Kanaki@ift.uib.no
23 * @ingroup alihlt_tutorial
24 */
25
26 void changeRunValidity(const char* file, int runmin=0, int runmax=999999999){
27
28 TFile *f_in = TFile::Open(file);
29 AliCDBEntry* entry = AliCDBEntry;
30
31 AliCDBId id = entry->GetId();
32 printf("existing runmin: %d, runmax: %d, version: %d, subversion: %d\n", id.GetFirstRun(), id.GetLastRun(), id.GetVersion(), id.GetSubVersion() );
33
34 id.SetFirstRun(runmin);
35 id.SetLastRun(runmax);
36 //id.SetRunRange(nnn,mmm);
37 //id.SetLastRun(AliCDBRunRange::Infinity());
38
39 id.SetVersion(id.GetVersion()+1);
40 entry->SetId(id);
41
42 printf("change to runmin: %d, runmax: %d, version: %d, subversion: %d\n", id.GetFirstRun(), id.GetLastRun(), id.GetVersion(), id.GetSubVersion() );
43
44
45 TString out;
46 out.Form("Run%i_%i_v%i_s%i.root",runmin, runmax, id.GetVersion(), id.GetSubVersion());
47
48 TFile f_out(out, "RECREATE");
49 entry->Write();
50 f_out.Close();
51
52}