]> git.uio.no Git - u/mrichter/AliRoot.git/blame - VZERO/MakeVZEROResMisAlignment.C
Getting the trigger descriptors from CDB
[u/mrichter/AliRoot.git] / VZERO / MakeVZEROResMisAlignment.C
CommitLineData
1895a097 1void MakeVZEROResMisAlignment(){
2 // Create TClonesArray of residual misalignment objects for VZERO
3 //
dfe9c69d 4 if(!AliGeomManager::GetGeometry()){
5 if(!(AliCDBManager::Instance())->IsDefaultStorageSet())
6 AliCDBManager::Instance()->SetDefaultStorage("local://$ALICE_ROOT");
7 AliCDBManager::Instance()->SetRun(0);
8 AliGeomManager::LoadGeometry();
9 }
1895a097 10 // needed for the constructors with local coordinates not to fail
11
12 TClonesArray *array = new TClonesArray("AliAlignObjAngles",10);
13 TClonesArray &alobj = *array;
14
15 AliAlignObjAngles a;
16
17 Double_t dx, dy, dz, dpsi, dtheta, dphi;
18 TRandom *rnd = new TRandom(4321);
19 Double_t sigmatr = 0.1; // max shift in cm
20 Double_t sigmarot = 0.5; // max rot in degrees
21
d3a9c52a 22 const char *V0right="VZERO/V0C";
23 const char *V0left="VZERO/V0A";
1895a097 24
25 Int_t iIndex=0;
ae079791 26 AliGeomManager::ELayerID iLayer = AliGeomManager::kInvalidLayer;
27 UShort_t volid = AliGeomManager::LayerToVolUID(iLayer,iIndex);
1895a097 28
29 dx = rnd->Gaus(0.,sigmatr);
30 dy = rnd->Gaus(0.,sigmatr);
31 dz = rnd->Gaus(0.,sigmatr);
32 dpsi = rnd->Gaus(0.,sigmarot);
33 dtheta = rnd->Gaus(0.,sigmarot);
34 dphi = rnd->Gaus(0.,sigmarot);
35 new(alobj[0]) AliAlignObjAngles(V0right, volid, dx, dy, dz, dpsi, dtheta, dphi, kFALSE);
36 dx = rnd->Gaus(0.,sigmatr);
37 dy = rnd->Gaus(0.,sigmatr);
38 dz = rnd->Gaus(0.,sigmatr);
39 dpsi = rnd->Gaus(0.,sigmarot);
40 dtheta = rnd->Gaus(0.,sigmarot);
41 dphi = rnd->Gaus(0.,sigmarot);
42 new(alobj[1]) AliAlignObjAngles(V0left, volid, dx, dy, dz, dpsi, dtheta, dphi,kFALSE);
43
dfe9c69d 44 const char* macroname = "MakeVZEROResMisAlignment.C";
5bd470e1 45 if( gSystem->Getenv("TOCDB") != TString("kTRUE") ){
1895a097 46 // save on file
dfe9c69d 47 const char* filename = "VZEROresidualMisalignment.root";
48 TFile f(filename,"RECREATE");
49 if(!f){
50 Error(macroname,"cannot open file for output\n");
51 return;
52 }
53 Info(macroname,"Saving alignment objects to the file %s", filename);
1895a097 54 f.cd();
dfe9c69d 55 f.WriteObject(array,"VZEROAlignObjs","kSingleKey");
1895a097 56 f.Close();
57 }else{
58 // save in CDB storage
dfe9c69d 59 TString Storage = gSystem->Getenv("STORAGE");
60 if(!Storage.BeginsWith("local://") && !Storage.BeginsWith("alien://")) {
61 Error(macroname,"STORAGE variable set to %s is not valid. Exiting\n",Storage.Data());
62 return;
63 }
64 Info(macroname,"Saving alignment objects in CDB storage %s",
65 Storage.Data());
1895a097 66 AliCDBManager* cdb = AliCDBManager::Instance();
dfe9c69d 67 AliCDBStorage* storage = cdb->GetStorage(Storage.Data());
68 if(!storage){
69 Error(macroname,"Unable to open storage %s\n",Storage.Data());
70 return;
71 }
1895a097 72 AliCDBMetaData* md = new AliCDBMetaData();
73 md->SetResponsible("Brigitte Cheynis");
74 md->SetComment("Alignment objects for V0 residual misalignment");
5bd470e1 75 md->SetAliRootVersion(gSystem->Getenv("ARVERSION"));
dfe9c69d 76 AliCDBId id("VZERO/Align/Data",0,AliCDBRunRange::Infinity());
1895a097 77 storage->Put(array,id,md);
78 }
79
80 array->Delete();
81
82}
83