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