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