]> git.uio.no Git - u/mrichter/AliRoot.git/blame - TPC/MakeTPCResMisAlignment.C
AliAlignObjAngles becomes AliAlignObjParams (Raffaele)
[u/mrichter/AliRoot.git] / TPC / MakeTPCResMisAlignment.C
CommitLineData
1895a097 1void MakeTPCResMisAlignment(){
2 // Create TClonesArray of residual misalignment objects for TPC
3 //
dfe9c69d 4 if(!AliGeomManager::GetGeometry()){
5 if(!(AliCDBManager::Instance())->IsDefaultStorageSet())
6 AliCDBManager::Instance()->SetDefaultStorage("local://$ALICE_ROOT");
7 AliCDBManager::Instance()->SetRun(0);
8 AliGeomManager::LoadGeometry();
9 }
1895a097 10 // needed for the constructors with local coordinates not to fail
11
90dbf5fb 12 TClonesArray *array = new TClonesArray("AliAlignObjParams",100);
1895a097 13 TClonesArray &alobj = *array;
14
15 TRandom *rnd = new TRandom(4357);
90dbf5fb 16 AliAlignObjParams o;
1895a097 17 Double_t dx, dy, dz, dpsi, dtheta, dphi;
18 Int_t j = 0;
19
20 // RS = local
d3a9c52a 21 // sigma translation = 0.1 mm
22 // sigma rotation = 0.1 mrad
1895a097 23 Float_t sigmatr=0.01;
d3a9c52a 24 Float_t sigmarot = 0.006;
ae079791 25 for (Int_t iLayer = AliGeomManager::kTPC1; iLayer <= AliGeomManager::kTPC2; iLayer++) {
26 for (Int_t iModule = 0; iModule < AliGeomManager::LayerSize(iLayer); iModule++) {
1895a097 27
5bd470e1 28 dx = rnd->Gaus(0,sigmatr);
29 dy = rnd->Gaus(0,sigmatr);
30 dz = rnd->Gaus(0,sigmatr);
31 dpsi = rnd->Gaus(0,sigmarot);
32 dtheta = rnd->Gaus(0,sigmarot);
33 dphi = rnd->Gaus(0,sigmarot);
1895a097 34
ae079791 35 UShort_t volid = AliGeomManager::LayerToVolUID(iLayer,iModule);
36 const char *symname = AliGeomManager::SymName(volid);
90dbf5fb 37 new(alobj[j]) AliAlignObjParams(symname, volid, dx, dy, dz, dpsi, dtheta, dphi, kFALSE);
1895a097 38 j++;
39 }
40 }
41
42
dfe9c69d 43 const char* macroname = "MakeTPCResMisAlignment.C";
5bd470e1 44 if( gSystem->Getenv("TOCDB") != TString("kTRUE") ){
1895a097 45 // save on file
dfe9c69d 46 const char* filename = "TPCresidualMisalignment.root";
47 TFile f(filename,"RECREATE");
48 if(!f){
49 Error(macroname,"cannot open file for output\n");
50 return;
51 }
52 Info(macroname,"Saving alignment objects to the file %s", filename);
1895a097 53 f.cd();
54 f.WriteObject(array,"TPCAlignObjs","kSingleKey");
55 f.Close();
56 }else{
57 // save in CDB storage
dfe9c69d 58 TString Storage = gSystem->Getenv("STORAGE");
59 if(!Storage.BeginsWith("local://") && !Storage.BeginsWith("alien://")) {
60 Error(macroname,"STORAGE variable set to %s is not valid. Exiting\n",Storage.Data());
61 return;
62 }
63 Info(macroname,"Saving alignment objects in CDB storage %s",
64 Storage.Data());
1895a097 65 AliCDBManager* cdb = AliCDBManager::Instance();
dfe9c69d 66 AliCDBStorage* storage = cdb->GetStorage(Storage.Data());
67 if(!storage){
68 Error(macroname,"Unable to open storage %s\n",Storage.Data());
69 return;
70 }
1895a097 71 AliCDBMetaData* md = new AliCDBMetaData();
72 md->SetResponsible("Marian Ivanov");
73 md->SetComment("Residual misalignment for TPC, sigmatr=0.01 and sigmarot=0.6 in the local RS");
5bd470e1 74 md->SetAliRootVersion(gSystem->Getenv("ARVERSION"));
dfe9c69d 75 AliCDBId id("TPC/Align/Data",0,AliCDBRunRange::Infinity());
1895a097 76 storage->Put(array,id,md);
77 }
78
79 array->Delete();
80
81}
82