]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TPC/macros/MakeClusterParam.C
Extacting the OCDB in a separate module. The detectors have write permission in the...
[u/mrichter/AliRoot.git] / TPC / macros / MakeClusterParam.C
1 /*  
2   Example macro to build AliTPCClusterParam
3   postprocessing the output of the calibration using tracks
4   In the future this macro will be part of the Preprocesor
5   ..
6
7 */
8 void StoreObject(AliTPCClusterParam *param);
9
10 void MakeClusterParam(const char *fnresolc="Output.root", const char *fnresolg="Output.root"){
11   gSystem->Load("libTPCcalib.so");
12   TFile fresolc(fnresolc);
13   TFile fresolg(fnresolg);
14   AliTPCcalibTracks *calibtracks = (AliTPCcalibTracks*)fresolc.Get("calibTracks");
15   AliTPCcalibTracksGain *calibtracksGain = (AliTPCcalibTracksGain*)fresolg.Get("calibTracksGain");
16
17   AliTPCClusterParam clParam;
18   //
19   // Make a resolution tree
20   //
21   calibtracks->MakeResPlotsQTree(200,"plots");  
22   TFile fres("plots/resol.root");
23   TTree *treeres = (TTree*)fres.Get("Resol");
24   // Fit the resolution parameterization
25   clParam.FitResol(treeres);
26   clParam.FitRMS(treeres);
27   clParam.SetInstance(&clParam);
28   TF1 f1z_z("f1z_z","AliTPCClusterParam::SGetError0Par(1,0,x,0)",0,250);
29   //
30   // angular effect calibration - usable only with the 
31   // cosmic tracks 
32   //
33   calibtracksGain->UpdateClusterParam(&clParam);
34   //
35   //
36   //
37   TFile fclparam("TPCClusterParam.root","recreate");
38   clParam->Write("Param");
39   fclparam.Close();
40   StoreObject(clParam);
41   AliTPCClusterParam::SetInstance(&clParam);
42 }
43  
44 void StoreObject(AliTPCClusterParam *clParam)
45
46   //
47   //
48   //
49   Int_t gkDummyRun = 0;
50   char *gCDBpath   = "local://$ALICE_ROOT/OCDB";
51   AliCDBMetaData *md1= new AliCDBMetaData(); 
52   AliCDBId id1("TPC/Calib/ClusterParam", gkDummyRun, gkDummyRun); 
53   AliCDBStorage* gStorLoc = 0;
54   AliCDBManager *man = AliCDBManager::Instance();
55   gStorLoc = man->GetStorage(gCDBpath);
56
57   md1->SetObjectClassName("AliTPCClusterParam");
58   md1->SetResponsible("Marian Ivanov");
59   md1->SetBeamPeriod(1);
60   md1->SetAliRootVersion("v5-08-Release"); //root version
61   md1->SetComment("Calibration data using the MC cosmic");
62   gStorLoc->Put(&clParam, id1, md1); 
63 }
64
65