]>
Commit | Line | Data |
---|---|---|
1895a097 | 1 | void MakeVZEROFullMisAlignment(){ |
2 | // Create TClonesArray of full misalignment objects for VZERO | |
3 | // | |
6fce62af | 4 | const char* macroname = "MakeVZEROFullMisAlignment.C"; |
1895a097 | 5 | |
90dbf5fb | 6 | TClonesArray *array = new TClonesArray("AliAlignObjParams",10); |
1895a097 | 7 | TClonesArray &alobj = *array; |
8 | ||
6fce62af | 9 | // Activate CDB storage and load geometry from CDB |
10 | AliCDBManager* cdb = AliCDBManager::Instance(); | |
11 | if(!cdb->IsDefaultStorageSet()) cdb->SetDefaultStorage("local://$ALICE_ROOT"); | |
12 | cdb->SetRun(0); | |
13 | ||
14 | AliCDBStorage* storage; | |
15 | ||
a24be56b | 16 | if( TString(gSystem->Getenv("TOCDB")) == TString("kTRUE") ){ |
6fce62af | 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(); //load geom from default CDB storage | |
35 | } | |
1895a097 | 36 | |
37 | Double_t dx, dy, dz, dpsi, dtheta, dphi; | |
38 | TRandom *rnd = new TRandom(4321); | |
d3a9c52a | 39 | Double_t sigmatr = 0.1; // max shift in cm |
40 | Double_t sigmarot = 0.5; // max rot in degrees | |
1895a097 | 41 | |
d3a9c52a | 42 | const char *V0right="VZERO/V0C"; |
43 | const char *V0left="VZERO/V0A"; | |
1895a097 | 44 | |
45 | Int_t iIndex=0; //let all modules have index=0 in a layer with no LUT | |
ae079791 | 46 | AliGeomManager::ELayerID iLayer = AliGeomManager::kInvalidLayer; |
47 | UShort_t volid = AliGeomManager::LayerToVolUID(iLayer,iIndex); | |
1895a097 | 48 | |
49 | dx = rnd->Gaus(0.,sigmatr); | |
50 | dy = rnd->Gaus(0.,sigmatr); | |
51 | dz = rnd->Gaus(0.,sigmatr); | |
52 | dpsi = rnd->Gaus(0.,sigmarot); | |
53 | dtheta = rnd->Gaus(0.,sigmarot); | |
54 | dphi = rnd->Gaus(0.,sigmarot); | |
90dbf5fb | 55 | new(alobj[0]) AliAlignObjParams(V0right, volid, dx, dy, dz, dpsi, dtheta, |
1895a097 | 56 | dphi, kFALSE); |
57 | dx = rnd->Gaus(0.,sigmatr); | |
58 | dy = rnd->Gaus(0.,sigmatr); | |
59 | dz = rnd->Gaus(0.,sigmatr); | |
60 | dpsi = rnd->Gaus(0.,sigmarot); | |
61 | dtheta = rnd->Gaus(0.,sigmarot); | |
62 | dphi = rnd->Gaus(0.,sigmarot); | |
90dbf5fb | 63 | new(alobj[1]) AliAlignObjParams(V0left, volid, dx, dy, dz, dpsi, dtheta, |
1895a097 | 64 | dphi,kFALSE); |
65 | ||
a24be56b | 66 | if( TString(gSystem->Getenv("TOCDB")) != TString("kTRUE") ){ |
1895a097 | 67 | // save on file |
dfe9c69d | 68 | const char* filename = "VZEROfullMisalignment.root"; |
69 | TFile f(filename,"RECREATE"); | |
70 | if(!f){ | |
71 | Error(macroname,"cannot open file for output\n"); | |
72 | return; | |
73 | } | |
74 | Info(macroname,"Saving alignment objects to the file %s", filename); | |
1895a097 | 75 | f.cd(); |
dfe9c69d | 76 | f.WriteObject(array,"VZEROAlignObjs","kSingleKey"); |
1895a097 | 77 | f.Close(); |
78 | }else{ | |
79 | // save in CDB storage | |
1895a097 | 80 | AliCDBMetaData* md = new AliCDBMetaData(); |
81 | md->SetResponsible("Brigitte Cheynis"); | |
82 | md->SetComment("Alignment objects for V0 full misalignment"); | |
5bd470e1 | 83 | md->SetAliRootVersion(gSystem->Getenv("ARVERSION")); |
dfe9c69d | 84 | AliCDBId id("VZERO/Align/Data",0,AliCDBRunRange::Infinity()); |
1895a097 | 85 | storage->Put(array,id,md); |
86 | } | |
87 | ||
88 | array->Delete(); | |
89 | ||
90 | } | |
91 |