]> git.uio.no Git - u/mrichter/AliRoot.git/blob - EMCAL/MakeEMCALResMisAlignment.C
Track matched index added to ESDs
[u/mrichter/AliRoot.git] / EMCAL / MakeEMCALResMisAlignment.C
1 void MakeEMCALResMisAlignment(){
2   // Create TClonesArray of residual 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
14   const TString basepath = "EMCAL/FullSupermodule";
15   const TString hbasepath = "EMCAL/HalfSupermodule";
16   TString pathstr;
17
18   Int_t iIndex=0; // let all modules have index=0 in a layer with no LUT
19   AliAlignObj::ELayerID iLayer = AliAlignObj::kInvalidLayer;
20   UShort_t volid = AliAlignObj::LayerToVolUID(iLayer,iIndex);
21
22   Int_t i;
23   Int_t j=0;
24
25   // RS = local
26   // sigma translation = 1mm
27   // sigma rotation = 0.1 degree
28   TRandom *rnd   = new TRandom(4321);
29   Double_t sigmatr = 0.1; // max shift in cm w.r.t. local RS
30   Double_t sigmarot = 0.1; // max rot in degrees w.r.t. local RS
31
32   for(i=0; i<10; i++){
33     dx = rnd->Gaus(0.,sigmatr);
34     dy = rnd->Gaus(0.,sigmatr);
35     dz = rnd->Gaus(0.,sigmatr);
36     dpsi = rnd->Gaus(0.,sigmarot);
37     dtheta = rnd->Gaus(0.,sigmarot);
38     dphi = rnd->Gaus(0.,sigmarot);
39     pathstr=basepath;
40     pathstr+=(i+1);
41     new(alobj[j++]) AliAlignObjAngles(pathstr, volid, dx, dy, dz, dpsi, dtheta, dphi, kFALSE);
42   }
43
44   for(i=0; i<2; i++){
45     dx = rnd->Gaus(0.,sigmatr);
46     dy = rnd->Gaus(0.,sigmatr);
47     dz = rnd->Gaus(0.,sigmatr);
48     dpsi = rnd->Gaus(0.,sigmarot);
49     dtheta = rnd->Gaus(0.,sigmarot);
50     dphi = rnd->Gaus(0.,sigmarot);
51     pathstr=hbasepath;
52     pathstr+=(i+1);
53     new(alobj[j++]) AliAlignObjAngles(pathstr, volid, dx, dy, dz, dpsi, dtheta, dphi, kTRUE);
54   }
55
56   if( gSystem->Getenv("TOCDB") != TString("kTRUE") ){
57     // save on file
58     TFile f("EMCALresidualMisalignment.root","RECREATE");
59     if(!f) cerr<<"cannot open file for output\n";
60     f.cd();
61     f.WriteObject(array,"T0ResidualObjs ","kSingleKey");
62     f.Close();
63   }else{
64     // save in CDB storage
65     const char* Storage = gSystem->Getenv("STORAGE");
66     AliCDBManager* cdb = AliCDBManager::Instance();
67     AliCDBStorage* storage = cdb->GetStorage(Storage);
68     AliCDBMetaData* md = new AliCDBMetaData();
69     md->SetResponsible("Jennifer Clay");
70     md->SetComment("Residual misalignment for EMCAL, produced with sigmatr=0.05 and sigmarot=0.3 in the local RS");
71     md->SetAliRootVersion(gSystem->Getenv("ARVERSION"));
72     AliCDBId id("EMCAL/Align/Data",0,9999999);
73     storage->Put(array,id,md);
74   }
75
76   array->Delete();
77
78 }
79