Macro to create GRP reco-param object in OCDB.
[u/mrichter/AliRoot.git] / GRP / MakeGRPRecoParam.C
CommitLineData
6ca15f89 1void MakeGRPRecoParam(AliRecoParam::EventSpecie_t default=AliRecoParam::kLowMult) {
2//========================================================================
3//
4// Steering macro for GRP reconstruction parameters
5//
6//
7//========================================================================
8
9
10 const char* macroname = "MakeGRPRecoParam.C";
11
12 // Activate CDB storage and load geometry from CDB
13 AliCDBManager* cdb = AliCDBManager::Instance();
14 if(!cdb->IsDefaultStorageSet()) cdb->SetDefaultStorage("local://OCDB");
15
16 TObjArray *recoParamArray = new TObjArray();
17
18 {
19 AliGRPRecoParam * param = AliGRPRecoParam::GetCosmicTestParam();
20 param->SetEventSpecie(AliRecoParam::kCosmic);
21 recoParamArray->AddLast(param);
22 }
23 {
24 AliGRPRecoParam * param = AliGRPRecoParam::GetLowFluxParam();
25 param->SetEventSpecie(AliRecoParam::kLowMult);
26 recoParamArray->AddLast(param);
27 }
28 {
29 AliGRPRecoParam * param = AliGRPRecoParam::GetHighFluxParam();
30 param->SetEventSpecie(AliRecoParam::kHighMult);
31 recoParamArray->AddLast(param);
32 }
33
34 // Set the default
35 Bool_t defaultIsSet = kFALSE;
36 for(Int_t i =0; i < recoParamArray->GetEntriesFast(); i++) {
37 AliDetectorRecoParam *par = (AliDetectorRecoParam *)recoParamArray->UncheckedAt(i);
38 if (!par) continue;
39 if (default & par->GetEventSpecie()) {
40 par->SetAsDefault();
41 defaultIsSet = kTRUE;
42 }
43 }
44
45 if (!defaultIsSet) {
46 Error(macroname,"The default reconstruction parameters are not set! Exiting...");
47 return;
48 }
49
50 // save in CDB storage
51 AliCDBMetaData *md= new AliCDBMetaData();
52 md->SetResponsible("Cvetan Cheshkov");
53 md->SetComment("GRP reconstruction parameters");
54 md->SetAliRootVersion(gSystem->Getenv("ARVERSION"));
55 md->SetBeamPeriod(0);
56 AliCDBId id("GRP/Calib/RecoParam",0,AliCDBRunRange::Infinity());
57 cdb->GetDefaultStorage()->Put(recoParamArray,id, md);
58
59 return;
60}