]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TPC/macros/ModifyRecoParamHLTUsage.C
Update master to aliroot
[u/mrichter/AliRoot.git] / TPC / macros / ModifyRecoParamHLTUsage.C
1 /// \file ModifyRecoParamHLTUsage.C
2 /// 
3 /// ModifyRecoParamHLTUsage
4 ///  Changes the Input for Reconstruction ( TPC RAW data or HLT TPC clusters ) 
5 ///    1 -> only TPC raw/sim data
6 ///    2 -> if present TPC raw/sim data, otherwise HLT clusters
7 ///    3 -> only HLT clusters
8 ///    4 -> if present HLT clusters, otherwise TPC raw/sim data
9 /// 
10 /// Usage:
11 /// ~~~
12 /// aliroot -b -q ModifyRecoParamHLTUsage.C'("/lustre/alice/alien/alice/data/2011/OCDB/TPC/Calib/RecoParam/Run136844_999999999_v2_s0.root",3,"local:///tmp/ocdb/")'
13 /// ~~~
14
15 void ModifyRecoParamHLTUsage( const Char_t* lastOCDBEntry, 
16                               Int_t iHLTusage,
17                               const Char_t* newStoragePath = "local:///tmp/ocdb", 
18                               const Char_t* author = "Jochen Thaeder", 
19                               const Char_t* alirootVersion = "05-01-Release" ) {
20   
21   // -- Get RecoParam
22   // -------------------------------------------------------------------
23   TFile inFile(lastOCDBEntry);
24   if (!inFile) {
25     printf("File %s could not be found!\n", lastOCDBEntry);
26     return -1;
27   }
28
29   AliCDBEntry * entry = ( AliCDBEntry *) inFile.Get("AliCDBEntry");
30   if (!entry) {
31     printf("File %s does not contain AliCDBEntry object!\n", lastOCDBEntry);
32     return -2;
33   }
34
35   TObjArray * arr = entry->GetObject();
36
37   AliTPCRecoParam * parHighFlux = NULL;
38   AliTPCRecoParam * parLowFlux  = NULL;
39   AliTPCRecoParam * parLaserFlux  = NULL;
40   AliTPCRecoParam * parCosmicFlux  = NULL;
41
42   for (Int_t idx = 0 ; idx < arr->GetEntries() ; ++idx) {
43     AliTPCRecoParam *param = (AliTPCRecoParam*) arr->At(idx);
44
45     TString name(param->GetName());
46
47     if ( name.Contains("Low") )
48       parLowFlux = param;
49     else if ( name.Contains("High") )
50       parHighFlux = param;
51     else if ( name.Contains("Laser") )
52       parLaserFlux = param;
53     else if ( name.Contains("Cosmic") )
54       parCosmicFlux = param;
55   }
56
57   // -- Set TPC RecoParam : UseHLTClusters
58   // -------------------------------------------------------------------
59   parLaserFlux->SetUseHLTClusters(1); // LASER use always raw data
60
61   parHighFlux->SetUseHLTClusters(iHLTusage);
62   parLowFlux->SetUseHLTClusters(iHLTusage);
63   parCosmicFlux->SetUseHLTClusters(iHLTusage);
64
65   // -- Write out
66   // -------------------------------------------------------------------
67   const Char_t *comment = "Modified RecoParam with HLT clusters usage";
68   // -------------------------------------------------------------------
69   
70   AliCDBMetaData *metaData= new AliCDBMetaData();
71   metaData->SetObjectClassName("TObjArray");
72   metaData->SetResponsible(author);
73   metaData->SetBeamPeriod(1);
74   metaData->SetAliRootVersion(alirootVersion); 
75   metaData->SetComment(comment);
76
77   AliCDBId id("TPC/Calib/RecoParam", 0, AliCDBRunRange::Infinity());
78
79   AliCDBStorage * gStorage = AliCDBManager::Instance()->GetStorage(newStoragePath);
80   gStorage->Put(arr, id, metaData);    
81
82   return;
83 }
84