]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PMD/ocdbmacro/MakePMDZeroMisAlignment.C
Do not include from subdirectories
[u/mrichter/AliRoot.git] / PMD / ocdbmacro / MakePMDZeroMisAlignment.C
1 /**************************************************************************
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   // Now specify the path of the module to be misaligned
17   // as followed in the PMD geant
18    
19      _____________
20     |    |        |
21     | 1  |   3    |
22     |    |________|
23     |____|___|    |
24     |        | 2  |
25     |   4    |    |
26     |________|____|
27     
28     // Misalignment Matrix is expected to be
29     // same for sectors 1 and 4 
30     // and for the sectors 2 and 3
31     // As these will be mounted on the same
32     // Steel plate 
33  * sjena@cern.ch
34  * Mon Nov 22 19:54:27 CET 2010
35  *         
36
37 OCDB/PMD/Align/Data
38             
39  **************************************************************************/
40
41 void MakePMDZeroMisAlignment(){
42   const char* macroname = "MakePMDZeroMisAlignment.C";
43
44   //Create a TClonesArray of Align Object to store displacement Angles
45   TClonesArray *array = new TClonesArray("AliAlignObjParams",10);
46   TClonesArray &alobj = *array;
47   
48   Int_t iIndex=0; //  let all modules have index=0 in a layer with no LUT
49   AliGeomManager::ELayerID iLayer = AliGeomManager::kInvalidLayer;
50   UShort_t volid = AliGeomManager::LayerToVolUID(iLayer,iIndex);
51   Double_t dx=0., dy=0., dz=0., dpsi=0., dtheta=0., dphi=0.;
52   Int_t i, j=0;
53
54   for(i=1; i<=4; i++){
55     TString snSector(Form("PMD/Sector%d",i));
56     new(alobj[j++]) AliAlignObjParams(snSector.Data(), volid, dx, dy, dz, dpsi, dtheta, dphi, kTRUE);
57   }
58
59   if( TString(gSystem->Getenv("TOCDB")) != TString("kTRUE") ){
60     // Create a File to store the alignment data
61     const char* filename = "PMDzeroMisalignment.root";
62     TFile f(filename,"RECREATE");
63     if(!f){
64       Error(macroname,"cannot open file for output\n");
65       return;
66     }
67     Info(macroname,"Saving alignment objects to the file %s", filename);
68     f.cd();
69     f.WriteObject(array,"PMDAlignObjs","kSingleKey");
70     f.Close();
71   }else{
72   // save in CDB storage
73     TString Storage = gSystem->Getenv("STORAGE");
74     if(!Storage.BeginsWith("local://") && !Storage.BeginsWith("alien://")) {
75       Error(macroname,"STORAGE variable set to %s is not valid. Exiting\n",Storage.Data());
76       return;
77     }
78     Info(macroname,"Saving alignment objects in CDB storage %s",
79          Storage.Data());
80     AliCDBManager* cdb = AliCDBManager::Instance();
81     AliCDBStorage* storage = cdb->GetStorage(Storage.Data());
82     if(!storage){
83       Error(macroname,"Unable to open storage %s\n",Storage.Data());
84       return;
85     }
86     AliCDBMetaData* md = new AliCDBMetaData();
87     md->SetResponsible("Satyajit Jena");
88     md->SetComment("Zero misalignment for PMD");
89     md->SetAliRootVersion(gSystem->Getenv("ARVERSION"));
90     AliCDBId id("PMD/Align/Data",0,AliCDBRunRange::Infinity());
91     storage->Put(array,id,md);
92   }
93   array->Delete();
94
95 }