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