]> git.uio.no Git - u/mrichter/AliRoot.git/blob - GRP/UpdateCDBVertexDiamond.C
Bug fix
[u/mrichter/AliRoot.git] / GRP / UpdateCDBVertexDiamond.C
1 void UpdateCDBVertexDiamond(Double_t xmed = 0., Double_t ymed = 0., Double_t sigx = 0.005, Double_t sigy = 0.005, Double_t sigz = 5.3) {
2   // produce the trigger descriptorwith the current AliRoot and store it in the
3   // CDB
4   
5   AliCDBManager* man = AliCDBManager::Instance();
6   man->SetDefaultStorage("local://$ALICE_ROOT");
7   man->SetRun(0);
8   AliCDBId id("GRP/Calib/MeanVertex",0,AliCDBRunRange::Infinity());
9   AliCDBMetaData *metadata= new AliCDBMetaData();
10
11   // Get root version
12   const char* rootv = gROOT->GetVersion();
13
14   // Get AliRoot version from file to set it in the metadata of the entry
15   TFile *fv= TFile::Open("$ALICE_ROOT/CVS/Repository?filetype=raw","READ");
16   Int_t size = fv->GetSize();
17   char *buf = new Char_t[size];
18   memset(buf, '\0', size);
19   fv->Seek(0);
20   char* alirootv;
21   if ( fv->ReadBuffer(buf, size) ) {
22     Printf("Error reading AliRoot version from file to buffer!");
23     alirootv = "";
24   }
25   if(buf=="AliRoot"){
26     alirootv="HEAD";
27   }else{
28     alirootv = buf;
29     metadata->SetResponsible("prino@to.infn.it");
30     metadata->SetComment("Default mean vertex position");
31     metadata->SetAliRootVersion(alirootv);
32     metadata->SetComment(Form("Default trigger description produced with root version %s and AliRoot version %s",rootv,alirootv));
33   }
34
35   Printf("Storing in CDB the default trigger description produced with root version %s and AliRoot version %s",rootv,alirootv);
36
37   Double_t resolx=35./10000.;
38   Double_t resoly=35./10000.;
39   Double_t sigma[3],position[3];
40   position[0]=xmed;
41   position[1]=ymed;
42   position[2]=0.;
43   sigma[0]=TMath::Sqrt(sigx*sigx+resolx*resolx);
44   sigma[1]=TMath::Sqrt(sigy*sigy+resoly*resoly);
45   sigma[2]=sigz;
46
47   AliESDVertex *vertex = new AliESDVertex(position,sigma,"vtxmean");
48   vertex->PrintStatus();
49
50   man->Put(vertex,id,metadata);
51 }
52