Full set of updated misalignment macros (Raffaele)
[u/mrichter/AliRoot.git] / VZERO / MakeVZEROFullMisAlignment.C
CommitLineData
1895a097 1void MakeVZEROFullMisAlignment(){
2 // Create TClonesArray of full 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);
d3a9c52a 14 Double_t sigmatr = 0.1; // max shift in cm
15 Double_t sigmarot = 0.5; // max rot in degrees
1895a097 16
17 // null shifts and rotations
18
d3a9c52a 19 const char *V0right="VZERO/V0C";
20 const char *V0left="VZERO/V0A";
1895a097 21
22 Int_t iIndex=0; //let all modules have index=0 in a layer with no LUT
23 AliAlignObj::ELayerID iLayer = AliAlignObj::kInvalidLayer;
24 UShort_t volid = AliAlignObj::LayerToVolUID(iLayer,iIndex);
25
26 dx = rnd->Gaus(0.,sigmatr);
27 dy = rnd->Gaus(0.,sigmatr);
28 dz = rnd->Gaus(0.,sigmatr);
29 dpsi = rnd->Gaus(0.,sigmarot);
30 dtheta = rnd->Gaus(0.,sigmarot);
31 dphi = rnd->Gaus(0.,sigmarot);
32 new(alobj[0]) AliAlignObjAngles(V0right, volid, dx, dy, dz, dpsi, dtheta,
33 dphi, kFALSE);
34 dx = rnd->Gaus(0.,sigmatr);
35 dy = rnd->Gaus(0.,sigmatr);
36 dz = rnd->Gaus(0.,sigmatr);
37 dpsi = rnd->Gaus(0.,sigmarot);
38 dtheta = rnd->Gaus(0.,sigmarot);
39 dphi = rnd->Gaus(0.,sigmarot);
40 new(alobj[1]) AliAlignObjAngles(V0left, volid, dx, dy, dz, dpsi, dtheta,
41 dphi,kFALSE);
42
43 if(!gSystem->Getenv("$TOCDB")){
44 // save on file
45 TFile f("V0fullMisalignment.root","RECREATE");
46 if(!f) cerr<<"cannot open file for output\n";
47 f.cd();
48 f.WriteObject(array,"V0FullObjs ","kSingleKey");
49 f.Close();
50 }else{
51 // save in CDB storage
52 const char* Storage = gSystem->Getenv("$STORAGE");
53 AliCDBManager* cdb = AliCDBManager::Instance();
54 AliCDBStorage* storage = cdb->GetStorage(Storage);
55 AliCDBMetaData* md = new AliCDBMetaData();
56 md->SetResponsible("Brigitte Cheynis");
57 md->SetComment("Alignment objects for V0 full misalignment");
58 md->SetAliRootVersion(gSystem->Getenv("$ARVERSION"));
59 AliCDBId id("VZERO/Align/Data",0,9999999);
60 storage->Put(array,id,md);
61 }
62
63 array->Delete();
64
65}
66