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