]> git.uio.no Git - u/mrichter/AliRoot.git/blame - GRP/UpdateCDBVertexDiamond.C
Merge branch 'master' of https://git.cern.ch/reps/AliRoot
[u/mrichter/AliRoot.git] / GRP / UpdateCDBVertexDiamond.C
CommitLineData
e83a0426 1#include "ARVersion.h"
2#if !defined(__CINT__) || defined(__MAKECINT__)
3#include "AliCDBManager.h"
4#include "AliCDBStorage.h"
5#include "AliCDBId.h"
6#include "AliCDBMetaData.h"
7#include "AliESDVertex.h"
8#include <TROOT.h>
9#include "AliRun.h"
10#include <TString.h>
11#include "AliLog.h"
12#endif
13
ae4a5206 14void UpdateCDBVertexDiamond(const char* objName, Double_t xmed, Double_t ymed, Double_t zmed, Double_t sigx, Double_t sigy, Double_t sigz) {
15 // produce the mean vertex with the current AliRoot and store it in the
16 // CDB
17 // andrea.dainese@pd.infn.it
18
19 AliCDBManager* man = AliCDBManager::Instance();
20 if(!gSystem->Getenv("STORAGE")){
21 man->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
22 }else{
23 man->SetDefaultStorage(gSystem->Getenv("STORAGE"));
24 }
25
26 Int_t firstRun=0;
27 if(gSystem->Getenv("FIRSTRUN")) firstRun=TString(gSystem->Getenv("FIRSTRUN")).Atoi();
28 Int_t lastRun=AliCDBRunRange::Infinity();
29 if(gSystem->Getenv("LASTRUN")) lastRun=TString(gSystem->Getenv("LASTRUN")).Atoi();
12d002d8 30 TString objFullName="GRP/Calib/";
ae4a5206 31
32 if(objName=="MeanVertex" || objName=="MeanVertexSPD" || objName=="MeanVertexTPC"){
33 objFullName += objName;
34 }else{
35 Printf("\"%s\" is not a valid calibration object. Exiting!",objName);
36 return;
37 }
38 AliCDBId id(objFullName.Data(),firstRun,lastRun);
39 AliCDBMetaData *metadata= new AliCDBMetaData();
40
41 // Get root and AliRoot versions
42 const char* rootv = gROOT->GetVersion();
0492edf5
A
43 TString av(ALIROOT_BRANCH);
44 TString revnum(ALIROOT_REVISION);
ae4a5206 45
46 metadata->SetResponsible("prino@to.infn.it");
47 metadata->SetComment("Default mean vertex position");
48 metadata->SetAliRootVersion(av.Data());
0492edf5 49 metadata->SetComment(Form("Default mean vertex produced with root version %s and AliRoot %s, revision number %s",rootv,av.Data(),revnum));
ae4a5206 50
51
52 Printf(Form("Storing in CDB the default mean vertex produced with root version %s and"
0492edf5 53 "AliRoot version %s, revision number %s", rootv, av.Data(), revnum));
ae4a5206 54
55 Double_t sigma[3],position[3];
56 position[0]=xmed;
57 position[1]=ymed;
58 position[2]=zmed;
59 sigma[0]=sigx;
60 sigma[1]=sigy;
61 sigma[2]=sigz;
62
63 AliESDVertex *vertex = new AliESDVertex(position,sigma,"vtxmean");
64 vertex->PrintStatus();
65
66 man->Put(vertex,id,metadata);
67
68}
69
70
71void UpdateCDBVertexDiamondOld(Double_t xmed = 0., Double_t ymed = 0., Double_t sigx = 0.0060, Double_t sigy = 0.0060, Double_t sigz = 3.8) {
e83a0426 72 // produce the mean vertex with the current AliRoot and store it in the
b2eb2c8f 73 // CDB
74
75 AliCDBManager* man = AliCDBManager::Instance();
162637e4 76 man->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
b2eb2c8f 77 man->SetRun(0);
12d002d8 78 AliCDBId id("GRP/Calib/MeanVertex",0,AliCDBRunRange::Infinity());
79 AliCDBId idTPC("GRP/Calib/MeanVertexTPC",0,AliCDBRunRange::Infinity());
80 AliCDBId idSPD("GRP/Calib/MeanVertexSPD",0,AliCDBRunRange::Infinity());
b2eb2c8f 81 AliCDBMetaData *metadata= new AliCDBMetaData();
82
e83a0426 83 // Get root and AliRoot versions
b2eb2c8f 84 const char* rootv = gROOT->GetVersion();
0492edf5
A
85 TString av(ALIROOT_BRANCH);
86 TString revnum(ALIROOT_REVISION);
e83a0426 87
88 metadata->SetResponsible("prino@to.infn.it");
89 metadata->SetComment("Default mean vertex position");
90 metadata->SetAliRootVersion(av.Data());
0492edf5 91 metadata->SetComment(Form("Default mean vertex produced with root version %s and AliRoot %s, revision number %s",rootv,av.Data(),revnum));
e83a0426 92
b2eb2c8f 93
e83a0426 94 Printf(Form("Storing in CDB the default mean vertex produced with root version %s and"
0492edf5 95 "AliRoot version %s, revision number %s", rootv, av.Data(), revnum));
b2eb2c8f 96
00cb53f4 97 Double_t resolx=5./10000.; // this is error on the weighted mean (5 micron)
98 Double_t resoly=5./10000.; // this is error on the weighted mean (5 micron)
6920cd28 99 Double_t sigma[3],position[3];
100 position[0]=xmed;
101 position[1]=ymed;
102 position[2]=0.;
103 sigma[0]=TMath::Sqrt(sigx*sigx+resolx*resolx);
104 sigma[1]=TMath::Sqrt(sigy*sigy+resoly*resoly);
105 sigma[2]=sigz;
106
107 AliESDVertex *vertex = new AliESDVertex(position,sigma,"vtxmean");
108 vertex->PrintStatus();
b2eb2c8f 109
110 man->Put(vertex,id,metadata);
e83a0426 111
112 position[0]=xmed;
113 position[1]=ymed;
114 position[2]=0.;
115 sigma[0]=TMath::Sqrt(sigx*sigx+resolx*resolx);
116 sigma[1]=TMath::Sqrt(sigy*sigy+resoly*resoly);
117 sigma[2]=sigz;
118
119 AliESDVertex *vertexTPC = new AliESDVertex(position,sigma,"vtxmean");
120 vertexTPC->PrintStatus();
121
122 man->Put(vertexTPC,idTPC,metadata);
123
f2a195c1 124 position[0]=xmed;
125 position[1]=ymed;
126 position[2]=0.;
127 sigma[0]=TMath::Sqrt(sigx*sigx+resolx*resolx);
128 sigma[1]=TMath::Sqrt(sigy*sigy+resoly*resoly);
129 sigma[2]=sigz;
130
131 AliESDVertex *vertexSPD = new AliESDVertex(position,sigma,"vtxmean");
132 vertexSPD->PrintStatus();
133
134 man->Put(vertexSPD,idSPD,metadata);
135
e83a0426 136
137
b2eb2c8f 138}
139
e83a0426 140
141