]>
Commit | Line | Data |
---|---|---|
1895a097 | 1 | void MakeTOFResMisAlignment(){ |
2 | // Create TClonesArray of residual misalignment objects for TOF | |
3 | // | |
90dbf5fb | 4 | TClonesArray *array = new TClonesArray("AliAlignObjParams",2000); |
1895a097 | 5 | TClonesArray &alobj = *array; |
6 | ||
6fce62af | 7 | const char* macroname = "MakeTOFResMisAlignment.C"; |
1895a097 | 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; | |
259b0bd4 | 15 | TString Storage; |
6fce62af | 16 | |
a24be56b | 17 | if( TString(gSystem->Getenv("TOCDB")) == TString("kTRUE") ){ |
259b0bd4 | 18 | Storage = gSystem->Getenv("STORAGE"); |
6fce62af | 19 | if(!Storage.BeginsWith("local://") && !Storage.BeginsWith("alien://")) { |
20 | Error(macroname,"STORAGE variable set to %s is not valid. Exiting\n",Storage.Data()); | |
21 | return; | |
22 | } | |
23 | storage = cdb->GetStorage(Storage.Data()); | |
24 | if(!storage){ | |
25 | Error(macroname,"Unable to open storage %s\n",Storage.Data()); | |
26 | return; | |
27 | } | |
28 | AliCDBPath path("GRP","Geometry","Data"); | |
29 | AliCDBEntry *entry = storage->Get(path.GetPath(),cdb->GetRun()); | |
30 | if(!entry) Fatal(macroname,"Could not get the specified CDB entry!"); | |
31 | entry->SetOwner(0); | |
32 | TGeoManager* geom = (TGeoManager*) entry->GetObject(); | |
33 | AliGeomManager::SetGeometry(geom); | |
34 | }else{ | |
35 | AliGeomManager::LoadGeometry(); //load geom from default CDB storage | |
6876838b | 36 | } |
1895a097 | 37 | |
ae079791 | 38 | AliGeomManager::ELayerID idTOF = AliGeomManager::kTOF; |
1895a097 | 39 | Int_t j=0; |
a24be56b | 40 | Int_t strId=-1; |
41 | Double_t dx=0., dy=0., dz=0., dpsi=0., dtheta=0., dphi=0.; | |
6ca978d7 | 42 | //TRandom *rnd = new TRandom(4357); |
6fce62af | 43 | Double_t sigmatr = 0.1; // sigma (in cm) for shift w.r.t. local ideal RS |
1895a097 | 44 | |
a24be56b | 45 | Int_t nstrA=15; |
46 | Int_t nstrB=19; | |
47 | Int_t nstrC=19; | |
48 | Int_t nSectors=18; | |
49 | Int_t nStrips=nstrA+2*nstrB+2*nstrC; | |
50 | ||
6876838b | 51 | Double_t cuty=0., cutz=0., cut=3*sigmatr; |
a24be56b | 52 | for (Int_t isect = 0; isect < nSectors; isect++) { |
53 | for (Int_t istr = 1; istr <= nStrips; istr++) { | |
6876838b | 54 | //dy = rnd->Gaus(0.,sigmatr); |
55 | //dz = rnd->Gaus(0.,sigmatr); | |
56 | //strId++; | |
57 | ||
58 | switch (istr) { | |
59 | case 25: | |
60 | case 29: | |
61 | case 63: | |
62 | case 67: | |
6ca978d7 | 63 | cuty = sigmatr*0.6; |
64 | dy = AliMathBase::TruncatedGaus(0., sigmatr, cut, cuty); | |
65 | dz = AliMathBase::TruncatedGaus(0., sigmatr, cut); | |
6876838b | 66 | strId++; |
67 | break; | |
68 | /* | |
69 | case 38: | |
70 | cuty = sigmatr*2.5; | |
71 | cutz = sigmatr*2.5; | |
6ca978d7 | 72 | dy = AliMathBase::TruncatedGaus(0., sigmatr, cut, cuty); |
73 | dz = AliMathBase::TruncatedGaus(0., sigmatr, cut, cutz); | |
6876838b | 74 | strId++; |
75 | break; | |
76 | case 54: | |
77 | cuty = sigmatr*2.5; | |
78 | cutz = sigmatr*2.5; | |
6ca978d7 | 79 | dy = AliMathBase::TruncatedGaus(0., sigmatr, cut, cuty); |
80 | dz = AliMathBase::TruncatedGaus(0., sigmatr, cutz, cut); | |
6876838b | 81 | strId++; |
82 | break; | |
83 | */ | |
84 | default: | |
6ca978d7 | 85 | dy = AliMathBase::TruncatedGaus(0., sigmatr, cut); |
86 | dz = AliMathBase::TruncatedGaus(0., sigmatr, cut); | |
6876838b | 87 | strId++; |
88 | break; | |
89 | } | |
90 | ||
85ce4b22 | 91 | if ((isect==13 || isect==14 || isect==15) && (istr >= 39 && istr <= 53)) continue; |
a24be56b | 92 | new(alobj[j++]) AliAlignObjParams(AliGeomManager::SymName(idTOF,strId),AliGeomManager::LayerToVolUID(idTOF,strId), dx, dy, dz, dpsi, dtheta, dphi, kFALSE); |
93 | } | |
1895a097 | 94 | } |
95 | ||
a24be56b | 96 | if( TString(gSystem->Getenv("TOCDB")) != TString("kTRUE") ){ |
1895a097 | 97 | // save on file |
dfe9c69d | 98 | const char* filename = "TOFresidualMisalignment.root"; |
99 | TFile f(filename,"RECREATE"); | |
100 | if(!f){ | |
101 | Error(macroname,"cannot open file for output\n"); | |
102 | return; | |
103 | } | |
104 | Info(macroname,"Saving alignment objects to the file %s", filename); | |
1895a097 | 105 | f.cd(); |
106 | f.WriteObject(array,"TOFAlignObjs","kSingleKey"); | |
107 | f.Close(); | |
108 | }else{ | |
109 | // save in CDB storage | |
1895a097 | 110 | AliCDBMetaData* md = new AliCDBMetaData(); |
111 | md->SetResponsible("Silvia Arcelli"); | |
112 | md->SetComment("Residual misalignment for TOF, sigmatr=1mm in the local RS"); | |
5bd470e1 | 113 | md->SetAliRootVersion(gSystem->Getenv("ARVERSION")); |
dfe9c69d | 114 | AliCDBId id("TOF/Align/Data",0,AliCDBRunRange::Infinity()); |
1895a097 | 115 | storage->Put(array,id,md); |
116 | } | |
117 | ||
118 | array->Delete(); | |
119 | ||
120 | } | |
121 | ||
6ca978d7 | 122 | /* |
6876838b | 123 | Double_t LocalTruncatedGaus(Double_t mean, Double_t sigma, Double_t cutatL, Double_t cutatR) |
124 | { | |
125 | // return number generated according to a gaussian distribution N(mean,sigma) truncated at cutat | |
126 | // | |
127 | Double_t value; | |
128 | do{ | |
129 | value=gRandom->Gaus(mean,sigma); | |
130 | }while(value-mean<-cutatL || value-mean>cutatR); | |
131 | return value; | |
132 | } | |
6ca978d7 | 133 | */ |