new shifter histogram implemented HeaderBCID vs TRM BC ID
[u/mrichter/AliRoot.git] / T0 / MakeT0FullMisAlignment.C
CommitLineData
dc7ca31d 1void MakeT0FullMisAlignment(){
2 // Create TClonesArray of full 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; // sigma for shifts in cm
10 Double_t sigmarot = 0.001; // sigma for tilts in degrees
dc7ca31d 11
d3a9c52a 12 TString symName, sn;
dc7ca31d 13
d3a9c52a 14 Int_t iIndex=0;
ae079791 15 AliGeomManager::ELayerID iLayer = AliGeomManager::kInvalidLayer;
32236ea7 16 UShort_t volid = AliGeomManager::LayerToVolUID(iLayer,iIndex);
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";
32236ea7 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);
32236ea7 29 }
68ad88ad 30
32236ea7 31 const char* macroname = "MakeT0FullMisAlignment.C";
32 if( TString(gSystem->Getenv("TOCDB")) != TString("kTRUE") ){
33 // save on file
34 const char* filename = "T0fullMisalignment.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);
41 f.cd();
42 f.WriteObject(array,"T0AlignObjs","kSingleKey");
43 f.Close();
44 }else{
dc7ca31d 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",
0f7caad0 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("Full 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