]> git.uio.no Git - u/mrichter/AliRoot.git/blame - EMCAL/MakeEMCALFullMisAlignment.C
EMCAL geometry can be created independently form anything now
[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";
1895a097 20 TString pathstr;
21
22 Int_t iIndex=0; //let all modules have index=0 in a layer with no LUT
23 AliAlignObj::ELayerID iLayer = AliAlignObj::kInvalidLayer;
24 UShort_t volid = AliAlignObj::LayerToVolUID(iLayer,iIndex); //dummy volume identity
25 Int_t i;
26
27 for(i=0; i<10; i++){
28
29 dx = rnd->Gaus(0.,sigmatr);
30 dy = rnd->Gaus(0.,sigmatr);
31 dz = rnd->Gaus(0.,sigmatr);
32 dpsi = rnd->Gaus(0.,sigmarot);
33 dtheta = rnd->Gaus(0.,sigmarot);
34 dphi = rnd->Gaus(0.,sigmarot);
35 pathstr=basepath;
36 pathstr+=(i+1);
37 cout<<pathstr<<" "<<dx<<" "<<dy<<" "<<dz<<" "<<dpsi<<" "<<dtheta<<" "<<dphi<<"\n";
38 new(alobj[i]) AliAlignObjAngles(pathstr, volid, dx, dy, dz, dpsi, dtheta, dphi, kFALSE);
39 }
40
41 if(!gSystem->Getenv("$TOCDB")){
42 // save on file
43 TFile f("EMCALfullMisalignment.root","RECREATE");
44 if(!f) cerr<<"cannot open file for output\n";
45 f.cd();
46 f.WriteObject(array,"T0FullObjs ","kSingleKey");
47 f.Close();
48 }else{
49 // save in CDB storage
50 const char* Storage = gSystem->Getenv("$STORAGE");
51 AliCDBManager* cdb = AliCDBManager::Instance();
52 AliCDBStorage* storage = cdb->GetStorage(Storage);
53 AliCDBMetaData* md = new AliCDBMetaData();
54 md->SetResponsible("Jennifer Clay");
55 md->SetComment("Full misalignment for EMCAL");
56 md->SetAliRootVersion(gSystem->Getenv("$ARVERSION"));
57 AliCDBId id("EMCAL/Align/Data",0,9999999);
58 storage->Put(array,id,md);
59 }
60
61 array->Delete();
62
63}
64