Temporary disable the raw version, it will be taken from FEE
[u/mrichter/AliRoot.git] / TOF / MakeTOFResMisAlignment.C
CommitLineData
1895a097 1void MakeTOFResMisAlignment(){
2 // Create TClonesArray of residual misalignment objects for TOF
3 //
4 TClonesArray *array = new TClonesArray("AliAlignObjAngles",2000);
5 TClonesArray &alobj = *array;
6
d3a9c52a 7 if(!gGeoManager) TGeoManager::Import("/home/rgrosso/Prove/AliRoot/geometry.root");
1895a097 8 // needed for the constructors with local coordinates not to fail
9
10 AliAlignObjAngles a;
11
ae079791 12 AliGeomManager::ELayerID idTOF = AliGeomManager::kTOF;
1895a097 13 Int_t i;
14 Int_t j=0;
15 Double_t dx=0.;
16 Double_t dy=0.;
17 Double_t dz=0.;
18 Double_t dpsi, dtheta, dphi;
19 TRandom *rnd = new TRandom(4357);
20 Double_t sigmatr = 0.1; // max shift in cm w.r.t. local ideal RS
21
ae079791 22 for(i=0; i<AliGeomManager::LayerSize(idTOF); i++) {
1895a097 23 dx = 0;
24 dy = rnd->Gaus(0.,sigmatr);
25 dz = rnd->Gaus(0.,sigmatr);
26 dpsi = 0.;
27 dtheta = 0.;
28 dphi = 0.;
ae079791 29 new(alobj[j]) AliAlignObjAngles(AliGeomManager::SymName(idTOF,i), AliGeomManager::LayerToVolUID(idTOF,i), dx, dy, dz, dpsi, dtheta, dphi, kFALSE);
1895a097 30 j++;
31 }
32
5bd470e1 33 if( gSystem->Getenv("TOCDB") != TString("kTRUE") ){
1895a097 34 // save on file
35 TFile f("TOFresidualMisalignment.root","RECREATE");
36 if(!f) cerr<<"cannot open file for output\n";
37 f.cd();
38 f.WriteObject(array,"TOFAlignObjs","kSingleKey");
39 f.Close();
40 }else{
41 // save in CDB storage
5bd470e1 42 const char* Storage = gSystem->Getenv("STORAGE");
1895a097 43 AliCDBManager* cdb = AliCDBManager::Instance();
44 AliCDBStorage* storage = cdb->GetStorage(Storage);
45 AliCDBMetaData* md = new AliCDBMetaData();
46 md->SetResponsible("Silvia Arcelli");
47 md->SetComment("Residual misalignment for TOF, sigmatr=1mm in the local RS");
5bd470e1 48 md->SetAliRootVersion(gSystem->Getenv("ARVERSION"));
1895a097 49 AliCDBId id("TOF/Align/Data",0,9999999);
50 storage->Put(array,id,md);
51 }
52
53 array->Delete();
54
55}
56
57