]>
Commit | Line | Data |
---|---|---|
1895a097 | 1 | void MakeTRDResMisAlignment(){ |
2 | // Create TClonesArray of residual misalignment objects for TRD | |
3 | // | |
6fce62af | 4 | const char* macroname = "MakeTRDResMisAlignment.C"; |
90dbf5fb | 5 | TClonesArray *array = new TClonesArray("AliAlignObjParams",1000); |
1895a097 | 6 | TClonesArray &alobj = *array; |
7 | ||
6fce62af | 8 | // Activate CDB storage and load geometry from CDB |
9 | AliCDBManager* cdb = AliCDBManager::Instance(); | |
10 | if(!cdb->IsDefaultStorageSet()) cdb->SetDefaultStorage("local://$ALICE_ROOT"); | |
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 | |
1895a097 | 36 | // sigmas for the chambers |
d3a9c52a | 37 | Double_t chdx=0.002; // 20 microns |
38 | Double_t chdy=0.003; // 30 microns | |
39 | Double_t chdz=0.007; // 70 microns | |
1895a097 | 40 | Double_t chrx=0.3/1000/TMath::Pi()*180; // 0.3 mrad |
41 | Double_t chry=0.3/1000/TMath::Pi()*180; // 0.3 mrad | |
42 | Double_t chrz=0.1/1000/TMath::Pi()*180; // 0.1 mrad | |
43 | ||
a24be56b | 44 | Int_t sActive[18]={0,0,1,1,1,0,1,0,0,0,0,1,1,0,1,1,0,0}; |
6fce62af | 45 | Double_t dx=0.,dy=0.,dz=0.,rx=0.,ry=0.,rz=0.; |
1895a097 | 46 | |
47 | Int_t j=0; | |
48 | TRandom *ran = new TRandom(4357); | |
49 | UShort_t volid; | |
6fce62af | 50 | const char* symname; |
1895a097 | 51 | |
6fce62af | 52 | // create the supermodules' alignment objects |
a24be56b | 53 | for (Int_t iSect=0; iSect<18; iSect++) { |
54 | TString sm_symname(Form("TRD/sm%02d",iSect)); | |
55 | if( (TString(gSystem->Getenv("PARTGEOM")) == TString("kTRUE")) && !sActive[iSect] ) continue; | |
6fce62af | 56 | new((*array)[j++]) |
57 | AliAlignObjParams(sm_symname.Data(),0,dx,dy,dz,rx,ry,rz,kTRUE); | |
58 | } | |
59 | ||
1895a097 | 60 | // create the chambers' alignment objects |
a24be56b | 61 | Int_t chId; |
ae079791 | 62 | for (Int_t iLayer = AliGeomManager::kTRD1; iLayer <= AliGeomManager::kTRD6; iLayer++) { |
a24be56b | 63 | chId=-1; |
64 | for (Int_t iSect = 0; iSect < 18; iSect++){ | |
65 | for (Int_t iCh = 0; iCh < 5; iCh++) { | |
6fce62af | 66 | ran->Rannor(dx,rx); |
67 | ran->Rannor(dy,ry); | |
68 | ran->Rannor(dz,rz); | |
1895a097 | 69 | dx*=chdx; |
70 | dy*=chdy; | |
71 | dz*=chdz; | |
72 | rx*=chrx; | |
73 | ry*=chry; | |
74 | rz*=chrz; | |
259b0bd4 | 75 | chId++; |
76 | if ((iSect==13 || iSect==14 || iSect==15) && iCh==2) continue; | |
77 | volid = AliGeomManager::LayerToVolUID(iLayer,chId); | |
ae079791 | 78 | symname = AliGeomManager::SymName(volid); |
259b0bd4 | 79 | if( (TString(gSystem->Getenv("PARTGEOM")) == TString("kTRUE")) && !sActive[iSect] ) continue; |
90dbf5fb | 80 | new(alobj[j++]) AliAlignObjParams(symname,volid,dx,dy,dz,rx,ry,rz,kFALSE); |
1895a097 | 81 | } |
82 | } | |
a24be56b | 83 | } |
1895a097 | 84 | |
a24be56b | 85 | if( TString(gSystem->Getenv("TOCDB")) != TString("kTRUE") ){ |
1895a097 | 86 | // save on file |
dfe9c69d | 87 | const char* filename = "TRDresidualMisalignment.root"; |
88 | TFile f(filename,"RECREATE"); | |
89 | if(!f){ | |
90 | Error(macroname,"cannot open file for output\n"); | |
91 | return; | |
92 | } | |
93 | Info(macroname,"Saving alignment objects to the file %s", filename); | |
1895a097 | 94 | f.cd(); |
95 | f.WriteObject(array,"TRDAlignObjs","kSingleKey"); | |
96 | f.Close(); | |
97 | }else{ | |
98 | // save in CDB storage | |
1895a097 | 99 | AliCDBMetaData* md = new AliCDBMetaData(); |
100 | md->SetResponsible("Dariusz Miskowiec"); | |
101 | md->SetComment("Residual misalignment for TRD"); | |
5bd470e1 | 102 | md->SetAliRootVersion(gSystem->Getenv("ARVERSION")); |
dfe9c69d | 103 | AliCDBId id("TRD/Align/Data",0,AliCDBRunRange::Infinity()); |
1895a097 | 104 | storage->Put(array,id,md); |
105 | } | |
106 | ||
107 | array->Delete(); | |
108 | ||
109 | } | |
110 | ||
111 |