]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PMD/MakePMDResMisAlignment.C
parity bit is introduced
[u/mrichter/AliRoot.git] / PMD / MakePMDResMisAlignment.C
CommitLineData
1895a097 1void MakePMDResMisAlignment(){
2 // Create TClonesArray of residual misalignment objects for PMD
3 //
4 // Macro to randomly displace the 4 sectors of the PMD
5 // in each plane. Each sector (to be misaligned)
6 // of PMD houses the following :
7 // (a) 6 modules of preshower plane
8 // (b) 6 modules of veto plane
9 // (c) The FEE boards on back plane of each module
10 // (d) 6 modules of convertor plates
11 // The clustering is done module-wise
12 // The actual amount displacement will be provided
13 // by the survey data and has to be converted into
14 // displacement in x,y,z,theta, phi and psi
15
16
17 // Now specify the path of the module to be misaligned
18 // as followed in the PMD geant
19
20 /*
21 _____________
22 | | |
23 | 1 | 3 |
24 | |________|
25 |____|___| |
26 | | 2 |
27 | 4 | |
28 |________|____|
29
30 // Misalignment Matrix is expected to be
31 // same for sectors 1 and 4
32 // and for the sectors 2 and 3
33 // As these will be mounted on the same
34 // Steel plate
35 */
36
37 if(!gGeoManager) TGeoManager::Import("geometry.root");
38 // needed for the constructors with local coordinates not to fail
39
40 Float_t max_trans=0.1;
41 Float_t max_rot=0.1;
42
43 TString path;
d3a9c52a 44 const char *Sector1="PMD/Sector1";
45 const char *Sector2="PMD/Sector2";
46 const char *Sector3="PMD/Sector3";
47 const char *Sector4="PMD/Sector4";
1895a097 48
49
50 //Sectors 1 and 4
51 Double_t dx14, dy14, dz14; // Misalignment in X,Y and Z
52 Double_t dpsi14, dtheta14, dphi14; // Angular displacements
53 //Sectors 2 and 3
54 Double_t dx23, dy23, dz23; // Misalignment in X,Y and Z
55 Double_t dpsi23, dtheta23, dphi23; // Angular displacements
56
57
58
59 // At present give some random shifts
60 // generated by random numbers
61 // max_trans : Maximun shifts in X,Y,Z in centimeters
62 // max_rot : Maximum shifts in angles in degrees
63 // Double_t max_trans, max_rot;
64
65
66 TRandom *rnd = new TRandom(4357);
67
68 // For sectors 1 and 4
69 // Translation displacement
70 dx14 = (rnd->Uniform()-0.5)*max_trans;
71 dy14 = (rnd->Uniform()-0.5)*max_trans;
72 dz14 = (rnd->Uniform()-0.5)*max_trans;
73 //Rotation angles
74 dpsi14 = (rnd->Uniform()-0.5)*max_rot;
75 dtheta14 = (rnd->Uniform()-0.5)*max_rot;
76 dphi14 = (rnd->Uniform()-0.5)*max_rot;
77
78 // For sectors 2 and 3
79 // Translation displacement
80 dx23 = (rnd->Uniform()-0.5)*max_trans;
81 dy23 = (rnd->Uniform()-0.5)*max_trans;
82 dz23 = (rnd->Uniform()-0.5)*max_trans;
83 //Rotation angles
84 dpsi23 = (rnd->Uniform()-0.5)*max_rot;
85 dtheta23 = (rnd->Uniform()-0.5)*max_rot;
86 dphi23 = (rnd->Uniform()-0.5)*max_rot;
87
88
89 //Create a TClonesArray of Align Object to store displacement Angles
90 TClonesArray *array = new TClonesArray("AliAlignObjAngles",10);
91 TClonesArray &alobj = *array;
92
93 AliAlignObjAngles o;
94
95 Int_t iIndex=0; // let all modules have index=0 in a layer with no LUT
96 AliAlignObj::ELayerID iLayer = AliAlignObj::kInvalidLayer;
97 UShort_t volid = AliAlignObj::LayerToVolUID(iLayer,iIndex);
98
99 new(alobj[0]) AliAlignObjAngles(Sector1, volid, dx14, dy14, dz14, dpsi14, dtheta14, dphi14, kFALSE);
100 new(alobj[1]) AliAlignObjAngles(Sector2, volid, dx14, dy14, dz14, dpsi14, dtheta14, dphi14, kFALSE);
101 new(alobj[2]) AliAlignObjAngles(Sector3, volid, dx23, dy23, dz23, dpsi23, dtheta23, dphi23, kFALSE);
102 new(alobj[3]) AliAlignObjAngles(Sector4, volid, dx23, dy23, dz23, dpsi23, dtheta23, dphi23, kFALSE);
103
104 if(!gSystem->Getenv("$TOCDB")){
105 // Create a File to store the alignment data
106 TFile f("PMDresidualMisalignment.root","RECREATE");
107 if(!f) {cerr<<"cannot open file for output\n";}
108
109 f.cd();
110 f.WriteObject(array,"PMDAlignObjs ","kSingleKey");
111 f.Close();
112 }else{
113 // save in CDB storage
114 const char* Storage = gSystem->Getenv("$STORAGE");
115 AliCDBManager* cdb = AliCDBManager::Instance();
116 AliCDBStorage* storage = cdb->GetStorage(Storage);
117 AliCDBMetaData* md = new AliCDBMetaData();
118 md->SetResponsible("");
119 md->SetComment("Residual misalignment for PMD, produced with sigmatr=0.1 and sigmarot=0.1 in the local RS");
120 md->SetAliRootVersion(gSystem->Getenv("$ARVERSION"));
121 AliCDBId id("PMD/Align/Data",0,9999999);
122 storage->Put(array,id,md);
123 }
124 array->Delete();
125
126}