]> git.uio.no Git - u/mrichter/AliRoot.git/blob - EMCAL/MakeEMCALFullMisAlignment.C
Record changes.
[u/mrichter/AliRoot.git] / EMCAL / MakeEMCALFullMisAlignment.C
1 void 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
19   const TString basepath = "EMCAL/FullSupermodule";
20   const TString hbasepath = "EMCAL/HalfSupermodule";
21   TString pathstr;
22
23   Int_t iIndex=0; //let all modules have index=0 in a layer with no LUT
24   AliAlignObj::ELayerID iLayer = AliAlignObj::kInvalidLayer;
25   UShort_t volid = AliAlignObj::LayerToVolUID(iLayer,iIndex); //dummy volume identity
26   Int_t i;
27   Int_t j=0;
28
29   for(i=0; i<10; i++){
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";
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);
52   }
53
54   if( gSystem->Getenv("TOCDB") != TString("kTRUE") ){
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
63     const char* Storage = gSystem->Getenv("STORAGE");
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");
69     md->SetAliRootVersion(gSystem->Getenv("ARVERSION"));
70     AliCDBId id("EMCAL/Align/Data",0,9999999);
71     storage->Put(array,id,md);
72   }
73
74   array->Delete();
75
76 }
77