Adding statistical function (Marian)
[u/mrichter/AliRoot.git] / PHOS / MakePHOSResMisAlignment.C
CommitLineData
1895a097 1void MakePHOSResMisAlignment(){
2 // Create TClonesArray of residual misalignment objects for PHOS
3 //
4 TClonesArray *array = new TClonesArray("AliAlignObjAngles",11);
5 TClonesArray &alobj = *array;
6
7 AliAlignObjAngles a;
8
9 Double_t dpsi=0., dtheta=0., dphi=0.;
10 Double_t displacement = 0.2;
11
12 Int_t iIndex=0; // let all modules have index=0 in a layer with no LUT
13 AliAlignObj::ELayerID iLayer = AliAlignObj::kInvalidLayer;
14 UShort_t volid = AliAlignObj::LayerToVolUID(iLayer,iIndex);
a45bb6dc 15
16 Int_t i=0 ;
1895a097 17 // Alignment for 5 PHOS modules
a45bb6dc 18 new(alobj[i++]) AliAlignObjAngles("PHOS/Module1",
1895a097 19 volid, -0.20, -0.1, +0.0, dpsi, dtheta, 0.2, kTRUE);
a45bb6dc 20 new(alobj[i++]) AliAlignObjAngles("PHOS/Module2",
1895a097 21 volid, -0.10, +0.0, -0.2, dpsi, dtheta, 0.2, kTRUE);
a45bb6dc 22 new(alobj[i++]) AliAlignObjAngles("PHOS/Module3",
1895a097 23 volid, 0.05, -0.1, 0.2, dpsi, dtheta, 0.0, kTRUE);
a45bb6dc 24 new(alobj[i++]) AliAlignObjAngles("PHOS/Module4",
1895a097 25 volid, +0.10, -0.0, -0.1, dpsi, dtheta, 0.1, kTRUE);
a45bb6dc 26 new(alobj[i++]) AliAlignObjAngles("PHOS/Module5",
1895a097 27 volid, +0.20, -0.1, 0.1, dpsi, dtheta, 0.2, kTRUE);
a45bb6dc 28
29 Double_t dx=0., dy=0., dz=0. ;
30 // Alignment of CPV modules
31 new(alobj[i++]) AliAlignObjAngles("PHOS/Module1/CPV",
32 volid, dx, dy, dz, dpsi, dtheta, dphi, kTRUE);
33 new(alobj[i++]) AliAlignObjAngles("PHOS/Module2/CPV",
34 volid, dx, dy, dz, dpsi, dtheta, dphi, kTRUE);
35 new(alobj[i++]) AliAlignObjAngles("PHOS/Module3/CPV",
36 volid, dx, dy, dz, dpsi, dtheta, dphi, kTRUE);
37 new(alobj[i++]) AliAlignObjAngles("PHOS/Module4/CPV",
38 volid, dx, dy, dz, dpsi, dtheta, dphi, kTRUE);
39 new(alobj[i++]) AliAlignObjAngles("PHOS/Module5/CPV",
40 volid, dx, dy, dz, dpsi, dtheta, dphi, kTRUE);
41
1895a097 42
43 // Alignment for PHOS cradle
a45bb6dc 44 new(alobj[i++]) AliAlignObjAngles("PHOS/Cradle0",
1895a097 45 volid, 0., 0., -displacement, dpsi, dtheta, dphi, kTRUE);
a45bb6dc 46 new(alobj[i++]) AliAlignObjAngles("PHOS/Cradle1",
1895a097 47 volid, 0., 0., +displacement, dpsi, dtheta, dphi, kTRUE);
48
49 // Alignment for cradle wheels
a45bb6dc 50 new(alobj[i++]) AliAlignObjAngles("PHOS/Wheel0",
1895a097 51 volid, 0., 0., -displacement, dpsi, dtheta, dphi, kTRUE);
a45bb6dc 52 new(alobj[i++]) AliAlignObjAngles("PHOS/Wheel1",
1895a097 53 volid, 0., 0., -displacement, dpsi, dtheta, dphi, kTRUE);
a45bb6dc 54 new(alobj[i++]) AliAlignObjAngles("PHOS/Wheel2",
1895a097 55 volid, 0., 0., +displacement, dpsi, dtheta, dphi, kTRUE);
a45bb6dc 56 new(alobj[i++]) AliAlignObjAngles("PHOS/Wheel3",
1895a097 57 volid, 0., 0., +displacement, dpsi, dtheta, dphi, kTRUE);
58
59
a45bb6dc 60 if(!gSystem->Getenv("$TOCDB")){
1895a097 61 // save on file
62 TFile f("PHOSresidualMisalignment.root","RECREATE");
63 if(!f) cerr<<"cannot open file for output\n";
64 f.cd();
65 f.WriteObject(array,"PHOSResidualObjs ","kSingleKey");
66 f.Close();
67 }else{
68 // save in CDB storage
a45bb6dc 69 const char* Storage = gSystem->Getenv("$STORAGE");
1895a097 70 AliCDBManager *CDB = AliCDBManager::Instance();
71 AliCDBStorage* storage = CDB->GetStorage(Storage);
72 AliCDBMetaData *md= new AliCDBMetaData();
73 md->SetResponsible("Yuri Kharlov");
74 md->SetComment("Alignment objects for slightly misaligned geometry (residual misalignment");
a45bb6dc 75 md->SetAliRootVersion(gSystem->Getenv("$ARVERSION"));
1895a097 76 AliCDBId id("PHOS/Align/Data",0,9999999);
77 storage->Put(array,id, md);
78 }
79
80 array->Delete();
81
82}