macro for reading RAWDDL data
[u/mrichter/AliRoot.git] / T0 / MakeT0FullMisAlignment.C
CommitLineData
dc7ca31d 1void MakeT0FullMisAlignment(){
2 // Create TClonesArray of full misalignment objects for T0
3 //
4 TClonesArray *array = new TClonesArray("AliAlignObjAngles",10);
5 TClonesArray &alobj = *array;
6
7 if(!gGeoManager) TGeoManager::Import("geometry.root");
8
9 AliAlignObjAngles a;
10
11 Double_t dx, dy, dz, dpsi, dtheta, dphi;
12 TRandom *rnd = new TRandom(4321);
13 Double_t sigmatr = 0.05; // max shift in cm w.r.t. RS
14 Double_t sigmarot = 0.3; // max rot in degrees w.r.t. RS
15
16 // null shifts and rotations
17
18 const char *T0right="/ALIC_1/0STR_1";
19 const char *T0left="/ALIC_1/0STL_1";
20
21 Int_t iIndex=0; //let all modules have index=0 in a layer with no LUT
22 AliAlignObj::ELayerID iLayer = AliAlignObj::kInvalidLayer;
23 UShort_t volid = AliAlignObj::LayerToVolUID(iLayer,iIndex);
24
25 dx = rnd->Gaus(0.,sigmatr);
26 dy = rnd->Gaus(0.,sigmatr);
27 dz = rnd->Gaus(0.,sigmatr);
28 dpsi = rnd->Gaus(0.,sigmarot);
29 dtheta = rnd->Gaus(0.,sigmarot);
30 dphi = rnd->Gaus(0.,sigmarot);
31 cout<<dx<<" "<<dy<<" "<<dz<<" "<<dpsi<<" "<<dtheta<<" "<<dphi<<"\n";
32 new(alobj[0]) AliAlignObjAngles(T0right, volid, dx, dy, dz, dpsi, dtheta, dphi, kFALSE);
33 dx = rnd->Gaus(0.,sigmatr);
34 dy = rnd->Gaus(0.,sigmatr);
35 dz = rnd->Gaus(0.,sigmatr);
36 dpsi = rnd->Gaus(0.,sigmarot);
37 dtheta = rnd->Gaus(0.,sigmarot);
38 dphi = rnd->Gaus(0.,sigmarot);
39 cout<<dx<<" "<<dy<<" "<<dz<<" "<<dpsi<<" "<<dtheta<<" "<<dphi<<"\n";
40 new(alobj[1]) AliAlignObjAngles(T0left, volid, dx, dy, dz, dpsi, dtheta, dphi, kFALSE);
41
42 // just save in a file you will send me
43 // or you will put in your afs public dir ...
44
45 if(!gSystem->Getenv("$TOCDB")){
46 // save on file
47 TFile f("T0fullMisalignment.root","RECREATE");
48 if(!f) cerr<<"cannot open file for output\n";
49 f.cd();
50 f.WriteObject(array,"T0FullObjs ","kSingleKey");
51 f.Close();
52 }else{
53 // save in CDB storage
54 const char* Storage = gSystem->Getenv("$STORAGE");
55 // save in CDB storage
56 AliCDBManager* cdb = AliCDBManager::Instance();
57 AliCDBStorage* storage = cdb->GetStorage(Storage);
58 AliCDBMetaData* md = new AliCDBMetaData();
59 md->SetResponsible("Tomasz Malkiewicz");
60 md->SetComment("Full misalignment for T0, produced with sigmatr=0.05 and sigmarot=0.3 in the local RS");
61 md->SetAliRootVersion(gSystem->Getenv("$ARVERSION"));
62 AliCDBId id("T0/Align/Data",0,9999999);
63 storage->Put(array,id,md);
64 }
65
66 array->Delete();
67
68}
69