Fix for FMD DA
[u/mrichter/AliRoot.git] / T0 / MakeT0ResMisAlignment.C
CommitLineData
dc7ca31d 1void MakeT0ResMisAlignment(){
2 // Create TClonesArray of residual misalignment objects for T0
3 //
68ad88ad 4 TClonesArray *array = new TClonesArray("AliAlignObjParams",4);
dc7ca31d 5 TClonesArray &alobj = *array;
6
dc7ca31d 7 Double_t dx, dy, dz, dpsi, dtheta, dphi;
7d90beb6 8 TRandom3 *rnd = new TRandom3(4321);
99c5bc75 9 Double_t sigmatr = 0.006; // max shift in cm
10 Double_t sigmarot = 0.001; // max rot in degrees
dc7ca31d 11
68ad88ad 12 TString symName;
dc7ca31d 13
14 Int_t iIndex=0;
ae079791 15 AliGeomManager::ELayerID iLayer = AliGeomManager::kInvalidLayer;
16 UShort_t volid = AliGeomManager::LayerToVolUID(iLayer,iIndex);
dc7ca31d 17
68ad88ad 18 for (Int_t imod=0; imod<2; imod++)
19 {
20 symName="/ALIC_1/0STR_1";
21 if(imod==1) symName="/ALIC_1/0STL_1";
d3a9c52a 22 dx = rnd->Gaus(0.,sigmatr);
23 dy = rnd->Gaus(0.,sigmatr);
24 dz = rnd->Gaus(0.,sigmatr);
25 dpsi = rnd->Gaus(0.,sigmarot);
26 dtheta = rnd->Gaus(0.,sigmarot);
27 dphi = rnd->Gaus(0.,sigmarot);
68ad88ad 28 new(alobj[imod]) AliAlignObjParams(symName.Data(), volid, dx, dy, dz, dpsi, dtheta, dphi, kTRUE);
d3a9c52a 29 }
30
dfe9c69d 31 const char* macroname = "MakeT0ResMisAlignment.C";
32 if( TString(gSystem->Getenv("TOCDB")) != TString("kTRUE") ){
dc7ca31d 33 // save on file
dfe9c69d 34 const char* filename = "T0residualMisalignment.root";
35 TFile f(filename,"RECREATE");
36 if(!f){
37 Error(macroname,"cannot open file for output\n");
38 return;
39 }
40 Info(macroname,"Saving alignment objects to the file %s", filename);
dc7ca31d 41 f.cd();
dfe9c69d 42 f.WriteObject(array,"T0AlignObjs","kSingleKey");
dc7ca31d 43 f.Close();
44 }else{
45 // save in CDB storage
dfe9c69d 46 TString Storage = gSystem->Getenv("STORAGE");
47 if(!Storage.BeginsWith("local://") && !Storage.BeginsWith("alien://")) {
48 Error(macroname,"STORAGE variable set to %s is not valid. Exiting\n",Storage.Data());
49 return;
50 }
51 Info(macroname,"Saving alignment objects in CDB storage %s",
52 Storage.Data());
dc7ca31d 53 AliCDBManager* cdb = AliCDBManager::Instance();
dfe9c69d 54 AliCDBStorage* storage = cdb->GetStorage(Storage.Data());
55 if(!storage){
56 Error(macroname,"Unable to open storage %s\n",Storage.Data());
57 return;
58 }
dc7ca31d 59 AliCDBMetaData* md = new AliCDBMetaData();
60 md->SetResponsible("Tomasz Malkiewicz");
61 md->SetComment("Residual misalignment for T0, produced with sigmatr=0.05 and sigmarot=0.3 in the local RS");
8d0a15a4 62 md->SetAliRootVersion(gSystem->Getenv("$ARVERSION"));
dfe9c69d 63 AliCDBId id("T0/Align/Data",0,AliCDBRunRange::Infinity());
dc7ca31d 64 storage->Put(array,id,md);
65 }
66
67 array->Delete();
68
69}
70