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