Updated names of the environment variables (no dollar sign). Gaussian distribution...
[u/mrichter/AliRoot.git] / VZERO / MakeVZEROResMisAlignment.C
CommitLineData
1895a097 1void MakeVZEROResMisAlignment(){
2 // Create TClonesArray of residual misalignment objects for VZERO
3 //
4 if(!gGeoManager) TGeoManager::Import("geometry.root");
5 // needed for the constructors with local coordinates not to fail
6
7 TClonesArray *array = new TClonesArray("AliAlignObjAngles",10);
8 TClonesArray &alobj = *array;
9
10 AliAlignObjAngles a;
11
12 Double_t dx, dy, dz, dpsi, dtheta, dphi;
13 TRandom *rnd = new TRandom(4321);
14 Double_t sigmatr = 0.1; // max shift in cm
15 Double_t sigmarot = 0.5; // max rot in degrees
16
d3a9c52a 17 const char *V0right="VZERO/V0C";
18 const char *V0left="VZERO/V0A";
1895a097 19
20 Int_t iIndex=0;
21 AliAlignObj::ELayerID iLayer = AliAlignObj::kInvalidLayer;
22 UShort_t volid = AliAlignObj::LayerToVolUID(iLayer,iIndex);
23
24 dx = rnd->Gaus(0.,sigmatr);
25 dy = rnd->Gaus(0.,sigmatr);
26 dz = rnd->Gaus(0.,sigmatr);
27 dpsi = rnd->Gaus(0.,sigmarot);
28 dtheta = rnd->Gaus(0.,sigmarot);
29 dphi = rnd->Gaus(0.,sigmarot);
30 new(alobj[0]) AliAlignObjAngles(V0right, volid, dx, dy, dz, dpsi, dtheta, dphi, kFALSE);
31 dx = rnd->Gaus(0.,sigmatr);
32 dy = rnd->Gaus(0.,sigmatr);
33 dz = rnd->Gaus(0.,sigmatr);
34 dpsi = rnd->Gaus(0.,sigmarot);
35 dtheta = rnd->Gaus(0.,sigmarot);
36 dphi = rnd->Gaus(0.,sigmarot);
37 new(alobj[1]) AliAlignObjAngles(V0left, volid, dx, dy, dz, dpsi, dtheta, dphi,kFALSE);
38
5bd470e1 39 if( gSystem->Getenv("TOCDB") != TString("kTRUE") ){
1895a097 40 // save on file
41 TFile f("V0residualMisalignment.root","RECREATE");
42 if(!f) cerr<<"cannot open file for output\n";
43 f.cd();
44 f.WriteObject(array,"V0ResidualObjs ","kSingleKey");
45 f.Close();
46 }else{
47 // save in CDB storage
5bd470e1 48 const char* Storage = gSystem->Getenv("STORAGE");
1895a097 49 AliCDBManager* cdb = AliCDBManager::Instance();
50 AliCDBStorage* storage = cdb->GetStorage(Storage);
51 AliCDBMetaData* md = new AliCDBMetaData();
52 md->SetResponsible("Brigitte Cheynis");
53 md->SetComment("Alignment objects for V0 residual misalignment");
5bd470e1 54 md->SetAliRootVersion(gSystem->Getenv("ARVERSION"));
1895a097 55 AliCDBId id("VZERO/Align/Data",0,9999999);
56 storage->Put(array,id,md);
57 }
58
59 array->Delete();
60
61}
62