]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PMD/MakePMDZeroMisAlignment.C
coverity fix
[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 */
6fce62af 36
37 const char* macroname = "MakePMDZeroMisAlignment.C";
d3a9c52a 38
39 //Create a TClonesArray of Align Object to store displacement Angles
90dbf5fb 40 TClonesArray *array = new TClonesArray("AliAlignObjParams",10);
d3a9c52a 41 TClonesArray &alobj = *array;
42
d3a9c52a 43 Int_t iIndex=0; // let all modules have index=0 in a layer with no LUT
ae079791 44 AliGeomManager::ELayerID iLayer = AliGeomManager::kInvalidLayer;
45 UShort_t volid = AliGeomManager::LayerToVolUID(iLayer,iIndex);
d3a9c52a 46 Double_t dx=0., dy=0., dz=0., dpsi=0., dtheta=0., dphi=0.;
47 Int_t i, j=0;
48
49 for(i=1; i<=4; i++){
50 TString snSector(Form("PMD/Sector%d",i));
90dbf5fb 51 new(alobj[j++]) AliAlignObjParams(snSector.Data(), volid, dx, dy, dz, dpsi, dtheta, dphi, kTRUE);
d3a9c52a 52 }
53
a24be56b 54 if( TString(gSystem->Getenv("TOCDB")) != TString("kTRUE") ){
d3a9c52a 55 // Create a File to store the alignment data
dfe9c69d 56 const char* filename = "PMDzeroMisalignment.root";
57 TFile f(filename,"RECREATE");
58 if(!f){
59 Error(macroname,"cannot open file for output\n");
60 return;
61 }
62 Info(macroname,"Saving alignment objects to the file %s", filename);
d3a9c52a 63 f.cd();
dfe9c69d 64 f.WriteObject(array,"PMDAlignObjs","kSingleKey");
d3a9c52a 65 f.Close();
66 }else{
67 // save in CDB storage
dfe9c69d 68 TString Storage = gSystem->Getenv("STORAGE");
69 if(!Storage.BeginsWith("local://") && !Storage.BeginsWith("alien://")) {
70 Error(macroname,"STORAGE variable set to %s is not valid. Exiting\n",Storage.Data());
71 return;
72 }
73 Info(macroname,"Saving alignment objects in CDB storage %s",
74 Storage.Data());
d3a9c52a 75 AliCDBManager* cdb = AliCDBManager::Instance();
dfe9c69d 76 AliCDBStorage* storage = cdb->GetStorage(Storage.Data());
77 if(!storage){
78 Error(macroname,"Unable to open storage %s\n",Storage.Data());
79 return;
80 }
d3a9c52a 81 AliCDBMetaData* md = new AliCDBMetaData();
82 md->SetResponsible("");
83 md->SetComment("Zero misalignment for PMD");
5bd470e1 84 md->SetAliRootVersion(gSystem->Getenv("ARVERSION"));
dfe9c69d 85 AliCDBId id("PMD/Align/Data",0,AliCDBRunRange::Infinity());
d3a9c52a 86 storage->Put(array,id,md);
87 }
88 array->Delete();
89
90}