]> git.uio.no Git - u/mrichter/AliRoot.git/blame - EMCAL/MakeEMCALResMisAlignment.C
Loaders removed from the reconstruction code (C.Cheshkov)
[u/mrichter/AliRoot.git] / EMCAL / MakeEMCALResMisAlignment.C
CommitLineData
1895a097 1void MakeEMCALResMisAlignment(){
2 // Create TClonesArray of residual misalignment objects for EMCAL
3 //
4 TClonesArray *array = new TClonesArray("AliAlignObjAngles",10);
5 TClonesArray &alobj = *array;
6
dfe9c69d 7 if(!AliGeomManager::GetGeometry()){
8 if(!(AliCDBManager::Instance())->IsDefaultStorageSet())
9 AliCDBManager::Instance()->SetDefaultStorage("local://$ALICE_ROOT");
10 AliCDBManager::Instance()->SetRun(0);
11 AliGeomManager::LoadGeometry();
12 }
1895a097 13 AliAlignObjAngles a;
14
15 Double_t dx, dy, dz, dpsi, dtheta, dphi;
16
7e154d52 17 const TString basepath = "EMCAL/FullSupermodule";
d3a9c52a 18 const TString hbasepath = "EMCAL/HalfSupermodule";
1895a097 19 TString pathstr;
20
21 Int_t iIndex=0; // let all modules have index=0 in a layer with no LUT
ae079791 22 AliGeomManager::ELayerID iLayer = AliGeomManager::kInvalidLayer;
23 UShort_t volid = AliGeomManager::LayerToVolUID(iLayer,iIndex);
1895a097 24
25 Int_t i;
d3a9c52a 26 Int_t j=0;
1895a097 27
28 // RS = local
29 // sigma translation = 1mm
30 // sigma rotation = 0.1 degree
31 TRandom *rnd = new TRandom(4321);
32 Double_t sigmatr = 0.1; // max shift in cm w.r.t. local RS
33 Double_t sigmarot = 0.1; // max rot in degrees w.r.t. local RS
d3a9c52a 34
1895a097 35 for(i=0; i<10; i++){
36 dx = rnd->Gaus(0.,sigmatr);
37 dy = rnd->Gaus(0.,sigmatr);
38 dz = rnd->Gaus(0.,sigmatr);
39 dpsi = rnd->Gaus(0.,sigmarot);
40 dtheta = rnd->Gaus(0.,sigmarot);
41 dphi = rnd->Gaus(0.,sigmarot);
42 pathstr=basepath;
43 pathstr+=(i+1);
d3a9c52a 44 new(alobj[j++]) AliAlignObjAngles(pathstr, volid, dx, dy, dz, dpsi, dtheta, dphi, kFALSE);
45 }
46
47 for(i=0; i<2; i++){
48 dx = rnd->Gaus(0.,sigmatr);
49 dy = rnd->Gaus(0.,sigmatr);
50 dz = rnd->Gaus(0.,sigmatr);
51 dpsi = rnd->Gaus(0.,sigmarot);
52 dtheta = rnd->Gaus(0.,sigmarot);
53 dphi = rnd->Gaus(0.,sigmarot);
54 pathstr=hbasepath;
55 pathstr+=(i+1);
56 new(alobj[j++]) AliAlignObjAngles(pathstr, volid, dx, dy, dz, dpsi, dtheta, dphi, kTRUE);
1895a097 57 }
58
dfe9c69d 59 const char* macroname = "MakeEMCALResMisAlignment.C";
5bd470e1 60 if( gSystem->Getenv("TOCDB") != TString("kTRUE") ){
1895a097 61 // save on file
dfe9c69d 62 const char* filename = "EMCALresidualMisalignment.root";
63 TFile f(filename,"RECREATE");
64 if(!f){
65 Error(macroname,"cannot open file for output\n");
66 return;
67 }
68 Info(macroname,"Saving alignment objects to the file %s", filename);
1895a097 69 f.cd();
dfe9c69d 70 f.WriteObject(array,"EMCALAlignObjs","kSingleKey");
1895a097 71 f.Close();
72 }else{
73 // save in CDB storage
dfe9c69d 74 TString Storage = gSystem->Getenv("STORAGE");
75 if(!Storage.BeginsWith("local://") && !Storage.BeginsWith("alien://")) {
76 Error(macroname,"STORAGE variable set to %s is not valid. Exiting\n",Storage.Data());
77 return;
78 }
79 Info(macroname,"Saving alignment objects in CDB storage %s",
80 Storage.Data());
1895a097 81 AliCDBManager* cdb = AliCDBManager::Instance();
dfe9c69d 82 AliCDBStorage* storage = cdb->GetStorage(Storage.Data());
83 if(!storage){
84 Error(macroname,"Unable to open storage %s\n",Storage.Data());
85 return;
86 }
1895a097 87 AliCDBMetaData* md = new AliCDBMetaData();
88 md->SetResponsible("Jennifer Clay");
89 md->SetComment("Residual misalignment for EMCAL, produced with sigmatr=0.05 and sigmarot=0.3 in the local RS");
5bd470e1 90 md->SetAliRootVersion(gSystem->Getenv("ARVERSION"));
dfe9c69d 91 AliCDBId id("EMCAL/Align/Data",0,AliCDBRunRange::Infinity());
1895a097 92 storage->Put(array,id,md);
93 }
94
95 array->Delete();
96
97}
98