Added class to read reconstruction parameters from OCDB (Yuri)
[u/mrichter/AliRoot.git] / EMCAL / MakeEMCALFullMisAlignment.C
CommitLineData
1895a097 1void MakeEMCALFullMisAlignment(){
2 // Create TClonesArray of full misalignment objects for EMCAL
3 //
4 TClonesArray *array = new TClonesArray("AliAlignObjAngles",10);
5 TClonesArray &alobj = *array;
6
7 if(!gGeoManager) TGeoManager::Import("geometry.root");
8 // needed for the constructors with local coordinates not to fail
9
10 AliAlignObjAngles a;
11
12 Double_t dx, dy, dz, dpsi, dtheta, dphi;
13 TRandom *rnd = new TRandom(4321);
14 Double_t sigmatr = 0.1; // max shift in cm w.r.t. local RS
15 Double_t sigmarot = 0.1; // max rot in degrees w.r.t. local RS
16
17 // null shifts and rotations
18
7e154d52 19 const TString basepath = "EMCAL/FullSupermodule";
d3a9c52a 20 const TString hbasepath = "EMCAL/HalfSupermodule";
1895a097 21 TString pathstr;
22
23 Int_t iIndex=0; //let all modules have index=0 in a layer with no LUT
ae079791 24 AliGeomManager::ELayerID iLayer = AliGeomManager::kInvalidLayer;
25 UShort_t volid = AliGeomManager::LayerToVolUID(iLayer,iIndex); //dummy volume identity
1895a097 26 Int_t i;
d3a9c52a 27 Int_t j=0;
1895a097 28
29 for(i=0; i<10; i++){
1895a097 30 dx = rnd->Gaus(0.,sigmatr);
31 dy = rnd->Gaus(0.,sigmatr);
32 dz = rnd->Gaus(0.,sigmatr);
33 dpsi = rnd->Gaus(0.,sigmarot);
34 dtheta = rnd->Gaus(0.,sigmarot);
35 dphi = rnd->Gaus(0.,sigmarot);
36 pathstr=basepath;
37 pathstr+=(i+1);
38 cout<<pathstr<<" "<<dx<<" "<<dy<<" "<<dz<<" "<<dpsi<<" "<<dtheta<<" "<<dphi<<"\n";
d3a9c52a 39 new(alobj[j++]) AliAlignObjAngles(pathstr, volid, dx, dy, dz, dpsi, dtheta, dphi, kFALSE);
40 }
41
42 for(i=0; i<2; i++){
43 dx = rnd->Gaus(0.,sigmatr);
44 dy = rnd->Gaus(0.,sigmatr);
45 dz = rnd->Gaus(0.,sigmatr);
46 dpsi = rnd->Gaus(0.,sigmarot);
47 dtheta = rnd->Gaus(0.,sigmarot);
48 dphi = rnd->Gaus(0.,sigmarot);
49 pathstr=hbasepath;
50 pathstr+=(i+1);
51 new(alobj[j++]) AliAlignObjAngles(pathstr, volid, dx, dy, dz, dpsi, dtheta, dphi, kTRUE);
1895a097 52 }
53
5bd470e1 54 if( gSystem->Getenv("TOCDB") != TString("kTRUE") ){
1895a097 55 // save on file
56 TFile f("EMCALfullMisalignment.root","RECREATE");
57 if(!f) cerr<<"cannot open file for output\n";
58 f.cd();
59 f.WriteObject(array,"T0FullObjs ","kSingleKey");
60 f.Close();
61 }else{
62 // save in CDB storage
5bd470e1 63 const char* Storage = gSystem->Getenv("STORAGE");
1895a097 64 AliCDBManager* cdb = AliCDBManager::Instance();
65 AliCDBStorage* storage = cdb->GetStorage(Storage);
66 AliCDBMetaData* md = new AliCDBMetaData();
67 md->SetResponsible("Jennifer Clay");
68 md->SetComment("Full misalignment for EMCAL");
5bd470e1 69 md->SetAliRootVersion(gSystem->Getenv("ARVERSION"));
1895a097 70 AliCDBId id("EMCAL/Align/Data",0,9999999);
71 storage->Put(array,id,md);
72 }
73
74 array->Delete();
75
76}
77