Completely reengineered version of CMake build system (Johny)
[u/mrichter/AliRoot.git] / PMD / AliPMDAlObjRnd.C
CommitLineData
cab6f896 1void AliPMDAlObjRnd(Float_t max_trans=1.0, Float_t max_rot=0.1)
2{
3 // Macro to randomly displace the 4 sectors of the PMD
4 // in each plane. Each sector (to be misaligned)
5 // of PMD houses the following :
6 // (a) 6 modules of preshower plane
7 // (b) 6 modules of veto plane
8 // (c) The FEE boards on back plane of each module
9 // (d) 6 modules of convertor plates
10 // The clustering is done module-wise
11 // The actual amount displacement will be provided
12 // by the survey data and has to be converted into
13 // displacement in x,y,z,theta, phi and psi
14
15
16 // Now specify the path of the module to be misaligned
17 // as followed in the PMD geant
18
19 /*
20 _____________
21 | | |
22 | 1 | 3 |
23 | |________|
24 |____|___| |
25 | | 2 |
26 | 4 | |
27 |________|____|
28
29 // Misalignment Matrix is expected to be
30 // same for sectors 1 and 4
31 // and for the sectors 2 and 3
32 // As these will be mounted on the same
33 // Steel plate
34 */
35
36 TString path;
37 const char *Sector1="/ALIC_1/EPM1_1";
38 const char *Sector2="/ALIC_1/EPM2_1";
39 const char *Sector3="/ALIC_1/EPM3_1";
40 const char *Sector4="/ALIC_1/EPM4_1";
41
42
43 //Sectors 1 and 4
44 Double_t dx14, dy14, dz14; // Misalignment in X,Y and Z
45 Double_t dpsi14, dtheta14, dphi14; // Angular displacements
46 //Sectors 2 and 3
47 Double_t dx23, dy23, dz23; // Misalignment in X,Y and Z
48 Double_t dpsi23, dtheta23, dphi23; // Angular displacements
49
50
51
52 // At present give some random shifts
53 // generated by random numbers
54 // max_trans : Maximun shifts in X,Y,Z in centimeters
55 // max_rot : Maximum shifts in angles in degrees
56 // Double_t max_trans, max_rot;
57
58
59 TRandom *rnd = new TRandom(4357);
60
61 // For sectors 1 and 4
62 // Translation displacement
63 dx14 = (rnd->Uniform()-0.5)*max_trans;
64 dy14 = (rnd->Uniform()-0.5)*max_trans;
65 dz14 = (rnd->Uniform()-0.5)*max_trans;
66 //Rotation angles
67 dpsi14 = (rnd->Uniform()-0.5)*max_rot;
68 dtheta14 = (rnd->Uniform()-0.5)*max_rot;
69 dphi14 = (rnd->Uniform()-0.5)*max_rot;
70
71 // For sectors 2 and 3
72 // Translation displacement
73 dx23 = (rnd->Uniform()-0.5)*max_trans;
74 dy23 = (rnd->Uniform()-0.5)*max_trans;
75 dz23 = (rnd->Uniform()-0.5)*max_trans;
76 //Rotation angles
77 dpsi23 = (rnd->Uniform()-0.5)*max_rot;
78 dtheta23 = (rnd->Uniform()-0.5)*max_rot;
79 dphi23 = (rnd->Uniform()-0.5)*max_rot;
80
81
82 //Create a TClonesArray of Align Object to store displacement Angles
90dbf5fb 83 TClonesArray *array = new TClonesArray("AliAlignObjParams",10000);
cab6f896 84 TClonesArray &alobj = *array;
85
86 // Create a File to store the alignment data
87 // the translations and rotations
88
89 TFile f("PMD_rnd_alobj.root","RECREATE");
90 if(!f) {cerr<<"cannot open file for output\n";}
91
90dbf5fb 92 AliAlignObjParams o;
cab6f896 93
94 UShort_t iIndex=0;
ae079791 95// AliGeomManager::ELayerID iLayer = AliGeomManager::kTOF;
cab6f896 96
ae079791 97// UShort_t dvoluid = AliGeomManager::LayerToVolUID(iLayer,iIndex); //dummy volume identity
cab6f896 98
90dbf5fb 99 new(alobj[0]) AliAlignObjParams(Sector1, iIndex, dx14, dy14, dz14, dpsi14, dtheta14, dphi14);
100 new(alobj[1]) AliAlignObjParams(Sector2, iIndex, dx14, dy14, dz14, dpsi14, dtheta14, dphi14);
101 new(alobj[2]) AliAlignObjParams(Sector3, iIndex, dx23, dy23, dz23, dpsi23, dtheta23, dphi23);
102 new(alobj[3]) AliAlignObjParams(Sector4, iIndex, dx23, dy23, dz23, dpsi23, dtheta23, dphi23);
cab6f896 103
104 // This part needs to be understood
105 f.cd();
106 f.WriteObject(array,"PMDAlignObjs","kSingleKey");
107 f.Close();
108 array->Delete();
109}