Full set of updated misalignment macros (Raffaele)
[u/mrichter/AliRoot.git] / T0 / MakeT0FullMisAlignment.C
CommitLineData
dc7ca31d 1void MakeT0FullMisAlignment(){
2 // Create TClonesArray of full misalignment objects for T0
3 //
d3a9c52a 4 TClonesArray *array = new TClonesArray("AliAlignObjAngles",30);
dc7ca31d 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);
d3a9c52a 13 Double_t sigmatr = 0.05; // sigma for shifts in cm
14 Double_t sigmarot = 0.3; // sigma for tilts in degrees
dc7ca31d 15
d3a9c52a 16 TString symName, sn;
dc7ca31d 17
d3a9c52a 18 Int_t iIndex=0;
dc7ca31d 19 AliAlignObj::ELayerID iLayer = AliAlignObj::kInvalidLayer;
20 UShort_t volid = AliAlignObj::LayerToVolUID(iLayer,iIndex);
21
d3a9c52a 22 Int_t j=0;
23 for (Int_t imod=0; imod<24; imod++){
24 if (imod < 12){
25 sn="T0/C/PMT";
26 }else{
27 sn="T0/A/PMT";
28 }
29 symName = sn;
30 symName += imod+1;
31
32 dx = rnd->Gaus(0.,sigmatr);
33 dy = rnd->Gaus(0.,sigmatr);
34 dz = rnd->Gaus(0.,sigmatr);
35 dpsi = rnd->Gaus(0.,sigmarot);
36 dtheta = rnd->Gaus(0.,sigmarot);
37 dphi = rnd->Gaus(0.,sigmarot);
38
39 new(alobj[j++]) AliAlignObjAngles(symName.Data(), volid, dx, dy, dz, dpsi, dtheta, dphi, kTRUE);
40 }
41
dc7ca31d 42 if(!gSystem->Getenv("$TOCDB")){
43 // save on file
44 TFile f("T0fullMisalignment.root","RECREATE");
45 if(!f) cerr<<"cannot open file for output\n";
46 f.cd();
47 f.WriteObject(array,"T0FullObjs ","kSingleKey");
48 f.Close();
49 }else{
50 // save in CDB storage
51 const char* Storage = gSystem->Getenv("$STORAGE");
dc7ca31d 52 AliCDBManager* cdb = AliCDBManager::Instance();
53 AliCDBStorage* storage = cdb->GetStorage(Storage);
54 AliCDBMetaData* md = new AliCDBMetaData();
55 md->SetResponsible("Tomasz Malkiewicz");
56 md->SetComment("Full misalignment for T0, produced with sigmatr=0.05 and sigmarot=0.3 in the local RS");
57 md->SetAliRootVersion(gSystem->Getenv("$ARVERSION"));
58 AliCDBId id("T0/Align/Data",0,9999999);
59 storage->Put(array,id,md);
60 }
61
62 array->Delete();
63
64}
65