Full set of updated misalignment macros (Raffaele)
[u/mrichter/AliRoot.git] / PMD / MakePMDZeroMisAlignment.C
CommitLineData
d3a9c52a 1void MakePMDZeroMisAlignment(){
2 // Create TClonesArray of zero 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 //Create a TClonesArray of Align Object to store displacement Angles
41 TClonesArray *array = new TClonesArray("AliAlignObjAngles",10);
42 TClonesArray &alobj = *array;
43
44 AliAlignObjAngles o;
45
46 Int_t iIndex=0; // let all modules have index=0 in a layer with no LUT
47 AliAlignObj::ELayerID iLayer = AliAlignObj::kInvalidLayer;
48 UShort_t volid = AliAlignObj::LayerToVolUID(iLayer,iIndex);
49 Double_t dx=0., dy=0., dz=0., dpsi=0., dtheta=0., dphi=0.;
50 Int_t i, j=0;
51
52 for(i=1; i<=4; i++){
53 TString snSector(Form("PMD/Sector%d",i));
54 new(alobj[j++]) AliAlignObjAngles(snSector.Data(), volid, dx, dy, dz, dpsi, dtheta, dphi, kTRUE);
55 }
56
57 if(!gSystem->Getenv("$TOCDB")){
58 // Create a File to store the alignment data
59 TFile f("PMDzeroMisalignment.root","RECREATE");
60 if(!f) {cerr<<"cannot open file for output\n";}
61
62 f.cd();
63 f.WriteObject(array,"PMDAlignObjs ","kSingleKey");
64 f.Close();
65 }else{
66 // save in CDB storage
67 const char* Storage = gSystem->Getenv("$STORAGE");
68 AliCDBManager* cdb = AliCDBManager::Instance();
69 AliCDBStorage* storage = cdb->GetStorage(Storage);
70 AliCDBMetaData* md = new AliCDBMetaData();
71 md->SetResponsible("");
72 md->SetComment("Zero misalignment for PMD");
73 md->SetAliRootVersion(gSystem->Getenv("$ARVERSION"));
74 AliCDBId id("PMD/Align/Data",0,9999999);
75 storage->Put(array,id,md);
76 }
77 array->Delete();
78
79}