]>
Commit | Line | Data |
---|---|---|
d3da6dc4 | 1 | // ************************************************************************** |
2 | // * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * | |
3 | // * * | |
4 | // * Author: The ALICE Off-line Project. * | |
5 | // * Contributors are mentioned in the code where appropriate. * | |
6 | // * * | |
7 | // * Permission to use, copy, modify and distribute this software and its * | |
8 | // * documentation strictly for non-commercial purposes is hereby granted * | |
9 | // * without fee, provided that the above copyright notice appears in all * | |
10 | // * copies and that both the copyright notice and this permission notice * | |
11 | // * appear in the supporting documentation. The authors make no claims * | |
12 | // * about the suitability of this software for any purpose. It is * | |
13 | // * provided "as is" without express or implied warranty. * | |
14 | // ************************************************************************** | |
15 | #include "AliHMPIDParam.h" //class header | |
16 | #include "AliHMPIDDigit.h" //ctor | |
a8ff381e | 17 | #include "AliLog.h" //general |
18 | #include <AliRunLoader.h> //Stack() | |
19 | #include <AliStack.h> //Stack() | |
20 | #include <TLatex.h> //TestTrans() | |
21 | #include <TView.h> //TestTrans() | |
22 | #include <TPolyMarker3D.h> //TestTrans() | |
d3da6dc4 | 23 | #include <TRotation.h> |
a8ff381e | 24 | #include <TParticle.h> //Stack() |
97eadc2b | 25 | #include <TGeoPhysicalNode.h> //ctor |
ae5a42aa | 26 | #include <TGeoBBox.h> |
d3da6dc4 | 27 | ClassImp(AliHMPIDParam) |
28 | ||
ae5a42aa | 29 | |
30 | Float_t AliHMPIDParam::fgkMinPcX[]={0.,0.,0.,0.,0.,0.}; | |
31 | Float_t AliHMPIDParam::fgkMaxPcX[]={0.,0.,0.,0.,0.,0.}; | |
32 | Float_t AliHMPIDParam::fgkMinPcY[]={0.,0.,0.,0.,0.,0.}; | |
33 | Float_t AliHMPIDParam::fgkMaxPcY[]={0.,0.,0.,0.,0.,0.}; | |
34 | ||
35 | Float_t AliHMPIDParam::fgCellX=0.; | |
36 | Float_t AliHMPIDParam::fgCellY=0.; | |
37 | ||
38 | Float_t AliHMPIDParam::fgPcX=0; | |
39 | Float_t AliHMPIDParam::fgPcY=0; | |
40 | ||
41 | Float_t AliHMPIDParam::fgAllX=0; | |
42 | Float_t AliHMPIDParam::fgAllY=0; | |
43 | ||
44 | Int_t AliHMPIDParam::fgSigmas=4; | |
b87365d5 | 45 | Bool_t AliHMPIDParam::fgInstanceType=kTRUE; |
ae5a42aa | 46 | |
d3da6dc4 | 47 | AliHMPIDParam* AliHMPIDParam::fgInstance=0x0; //singleton pointer |
48 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
58fc9564 | 49 | AliHMPIDParam::AliHMPIDParam(Bool_t noGeo=kFALSE):TNamed("HmpidParam","default version") |
d3da6dc4 | 50 | { |
51 | // Here all the intitializition is taken place when AliHMPIDParam::Instance() is invoked for the first time. | |
58fc9564 | 52 | // In particular, matrices to be used for LORS<->MARS trasnformations are initialized from TGeo structure. |
d3da6dc4 | 53 | // Note that TGeoManager should be already initialized from geometry.root file |
ae5a42aa | 54 | |
a8ff381e | 55 | fRadNmean = MeanIdxRad(); //initialization of the running ref. index of freon |
56 | ||
8e2a911a | 57 | Float_t dead=2.6;// cm of the dead zones between PCs-> See 2CRC2099P1 |
b87365d5 | 58 | |
59 | ||
60 | if(noGeo==kTRUE) fgInstanceType=kFALSE; //instance from ideal geometry, no actual geom is present | |
61 | ||
58fc9564 | 62 | if(noGeo==kFALSE && !gGeoManager) |
63 | { | |
64 | TGeoManager::Import("geometry.root"); | |
65 | if(!gGeoManager) AliFatal("!!!!!!No geometry loaded!!!!!!!"); | |
66 | } | |
67 | ||
8e2a911a | 68 | fgCellX=0.8;fgCellY=0.84; |
58fc9564 | 69 | |
8e2a911a | 70 | if(!noGeo==kTRUE){ |
71 | TGeoVolume *pCellVol = gGeoManager->GetVolume("Hcel"); | |
72 | if(pCellVol) { | |
73 | TGeoBBox *bcell = (TGeoBBox *)pCellVol->GetShape(); | |
74 | fgCellX=2.*bcell->GetDX(); fgCellY = 2.*bcell->GetDY(); // overwrite the values with the read ones | |
75 | } | |
76 | } | |
58fc9564 | 77 | fgPcX=80.*fgCellX; fgPcY = 48.*fgCellY; |
78 | fgAllX=2.*fgPcX+dead; | |
79 | fgAllY=3.*fgPcY+2.*dead; | |
ae5a42aa | 80 | |
58fc9564 | 81 | fgkMinPcX[1]=fgPcX+dead; fgkMinPcX[3]=fgkMinPcX[1]; fgkMinPcX[5]=fgkMinPcX[3]; |
82 | fgkMaxPcX[0]=fgPcX; fgkMaxPcX[2]=fgkMaxPcX[0]; fgkMaxPcX[4]=fgkMaxPcX[2]; | |
83 | fgkMaxPcX[1]=fgAllX; fgkMaxPcX[3]=fgkMaxPcX[1]; fgkMaxPcX[5]=fgkMaxPcX[3]; | |
ae5a42aa | 84 | |
58fc9564 | 85 | fgkMinPcY[2]=fgPcY+dead; fgkMinPcY[3]=fgkMinPcY[2]; |
86 | fgkMinPcY[4]=2.*fgPcY+2.*dead; fgkMinPcY[5]=fgkMinPcY[4]; | |
87 | fgkMaxPcY[0]=fgPcY; fgkMaxPcY[1]=fgkMaxPcY[0]; | |
88 | fgkMaxPcY[2]=2.*fgPcY+dead; fgkMaxPcY[3]=fgkMaxPcY[2]; | |
89 | fgkMaxPcY[4]=fgAllY; fgkMaxPcY[5]=fgkMaxPcY[4]; | |
ae5a42aa | 90 | |
91 | fX=0.5*SizeAllX(); | |
92 | fY=0.5*SizeAllY(); | |
58fc9564 | 93 | |
ae5a42aa | 94 | for(Int_t i=kMinCh;i<=kMaxCh;i++) |
97eadc2b | 95 | if(gGeoManager && gGeoManager->IsClosed()) { |
2df6b16e | 96 | TGeoPNEntry* pne = gGeoManager->GetAlignableEntry(Form("/HMPID/Chamber%i",i)); |
97eadc2b | 97 | if (!pne) { |
98 | AliErrorClass(Form("The symbolic volume %s does not correspond to any physical entry!",Form("HMPID_%i",i))); | |
99 | fM[i]=new TGeoHMatrix; | |
100 | IdealPosition(i,fM[i]); | |
101 | } else { | |
102 | TGeoPhysicalNode *pnode = pne->GetPhysicalNode(); | |
f80e1da4 | 103 | if(pnode) fM[i]=pnode->GetMatrix(); |
104 | else { | |
105 | fM[i]=new TGeoHMatrix; | |
106 | IdealPosition(i,fM[i]); | |
107 | } | |
97eadc2b | 108 | } |
109 | } else{ | |
1d4857c5 | 110 | fM[i]=new TGeoHMatrix; |
111 | IdealPosition(i,fM[i]); | |
112 | } | |
d3da6dc4 | 113 | fgInstance=this; |
114 | }//ctor | |
115 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
116 | void AliHMPIDParam::Print(Option_t* opt) const | |
117 | { | |
118 | // print some usefull (hopefully) info on some internal guts of HMPID parametrisation | |
119 | ||
120 | for(Int_t i=0;i<7;i++) fM[i]->Print(opt); | |
121 | }//Print() | |
122 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
1d4857c5 | 123 | void AliHMPIDParam::IdealPosition(Int_t iCh, TGeoHMatrix *pMatrix) |
124 | { | |
125 | // Construct ideal position matrix for a given chamber | |
126 | // Arguments: iCh- chamber ID; pMatrix- pointer to precreated unity matrix where to store the results | |
127 | // Returns: none | |
423554a3 | 128 | const Double_t kAngHor=19.5; // horizontal angle between chambers 19.5 grad |
129 | const Double_t kAngVer=20; // vertical angle between chambers 20 grad | |
130 | const Double_t kAngCom=30; // common HMPID rotation with respect to x axis 30 grad | |
131 | const Double_t kTrans[3]={490,0,0}; // center of the chamber is on window-gap surface | |
132 | pMatrix->RotateY(90); // rotate around y since initial position is in XY plane -> now in YZ plane | |
133 | pMatrix->SetTranslation(kTrans); // now plane in YZ is shifted along x | |
1d4857c5 | 134 | switch(iCh){ |
135 | case 0: pMatrix->RotateY(kAngHor); pMatrix->RotateZ(-kAngVer); break; //right and down | |
136 | case 1: pMatrix->RotateZ(-kAngVer); break; //down | |
137 | case 2: pMatrix->RotateY(kAngHor); break; //right | |
138 | case 3: break; //no rotation | |
139 | case 4: pMatrix->RotateY(-kAngHor); break; //left | |
140 | case 5: pMatrix->RotateZ(kAngVer); break; //up | |
141 | case 6: pMatrix->RotateY(-kAngHor); pMatrix->RotateZ(kAngVer); break; //left and up | |
142 | } | |
143 | pMatrix->RotateZ(kAngCom); //apply common rotation in XY plane | |
144 | ||
145 | } | |
146 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
d3da6dc4 | 147 | Int_t AliHMPIDParam::Stack(Int_t evt,Int_t tid) |
148 | { | |
d1bf51e1 | 149 | // Prints some useful info from stack |
d3da6dc4 | 150 | // Arguments: evt - event number. if not -1 print info only for that event |
151 | // tid - track id. if not -1 then print it and all it's mothers if any | |
152 | // Returns: mother tid of the given tid if any | |
153 | AliRunLoader *pAL=AliRunLoader::Open(); | |
154 | if(pAL->LoadHeader()) return -1; | |
155 | if(pAL->LoadKinematics()) return -1; | |
156 | ||
157 | Int_t mtid=-1; | |
cf7e313e | 158 | Int_t iNevt=pAL->GetNumberOfEvents(); |
d3da6dc4 | 159 | |
160 | for(Int_t iEvt=0;iEvt<iNevt;iEvt++){//events loop | |
161 | if(evt!=-1 && evt!=iEvt) continue; //in case one needs to print the requested event, ignore all others | |
162 | pAL->GetEvent(iEvt); | |
163 | AliStack *pStack=pAL->Stack(); | |
164 | if(tid==-1){ //print all tids for this event | |
165 | for(Int_t i=0;i<pStack->GetNtrack();i++) pStack->Particle(i)->Print(); | |
a8ff381e | 166 | Printf("totally %i tracks including %i primaries for event %i out of %i event(s)", |
167 | pStack->GetNtrack(),pStack->GetNprimary(),iEvt,iNevt); | |
d3da6dc4 | 168 | }else{ //print only this tid and it;s mothers |
169 | if(tid<0 || tid>pStack->GetNtrack()) {Printf("Wrong tid, valid tid range for event %i is 0-%i",iEvt,pStack->GetNtrack());break;} | |
170 | TParticle *pTrack=pStack->Particle(tid); mtid=pTrack->GetFirstMother(); | |
171 | TString str=pTrack->GetName(); | |
172 | while((tid=pTrack->GetFirstMother()) >= 0){ | |
173 | pTrack=pStack->Particle(tid); | |
174 | str+=" from ";str+=pTrack->GetName(); | |
175 | } | |
d3da6dc4 | 176 | }//if(tid==-1) |
177 | }//events loop | |
178 | pAL->UnloadHeader(); pAL->UnloadKinematics(); | |
179 | return mtid; | |
180 | } | |
181 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
182 | Int_t AliHMPIDParam::StackCount(Int_t pid,Int_t evt) | |
183 | { | |
184 | // Counts total number of particles of given sort (including secondary) for a given event | |
185 | AliRunLoader *pAL=AliRunLoader::Open(); | |
186 | pAL->GetEvent(evt); | |
187 | if(pAL->LoadHeader()) return 0; | |
188 | if(pAL->LoadKinematics()) return 0; | |
189 | AliStack *pStack=pAL->Stack(); | |
190 | ||
191 | Int_t iCnt=0; | |
192 | for(Int_t i=0;i<pStack->GetNtrack();i++) if(pStack->Particle(i)->GetPdgCode()==pid) iCnt++; | |
193 | ||
194 | pAL->UnloadHeader(); pAL->UnloadKinematics(); | |
195 | return iCnt; | |
196 | } | |
197 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
3278403b | 198 | Double_t AliHMPIDParam::Sigma2(Double_t trkTheta,Double_t trkPhi,Double_t ckovTh, Double_t ckovPh) |
199 | { | |
200 | // Analithical calculation of total error (as a sum of localization, geometrical and chromatic errors) on Cerenkov angle for a given Cerenkov photon | |
201 | // created by a given MIP. Fromulae according to CERN-EP-2000-058 | |
202 | // Arguments: Cerenkov and azimuthal angles for Cerenkov photon, [radians] | |
203 | // dip and azimuthal angles for MIP taken at the entrance to radiator, [radians] | |
204 | // MIP beta | |
205 | // Returns: absolute error on Cerenkov angle, [radians] | |
206 | ||
207 | TVector3 v(-999,-999,-999); | |
208 | Double_t trkBeta = 1./(TMath::Cos(ckovTh)*GetRefIdx()); | |
209 | ||
210 | if(trkBeta > 1) trkBeta = 1; //protection against bad measured thetaCer | |
211 | if(trkBeta < 0) trkBeta = 0.0001; // | |
212 | ||
213 | v.SetX(SigLoc (trkTheta,trkPhi,ckovTh,ckovPh,trkBeta)); | |
214 | v.SetY(SigGeom(trkTheta,trkPhi,ckovTh,ckovPh,trkBeta)); | |
215 | v.SetZ(SigCrom(trkTheta,trkPhi,ckovTh,ckovPh,trkBeta)); | |
216 | ||
217 | return v.Mag2(); | |
218 | } | |
219 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
220 | Double_t AliHMPIDParam::SigLoc(Double_t trkTheta,Double_t trkPhi,Double_t thetaC, Double_t phiC,Double_t betaM) | |
221 | { | |
222 | // Analitical calculation of localization error (due to finite segmentation of PC) on Cerenkov angle for a given Cerenkov photon | |
223 | // created by a given MIP. Fromulae according to CERN-EP-2000-058 | |
224 | // Arguments: Cerenkov and azimuthal angles for Cerenkov photon, [radians] | |
225 | // dip and azimuthal angles for MIP taken at the entrance to radiator, [radians] | |
226 | // MIP beta | |
227 | // Returns: absolute error on Cerenkov angle, [radians] | |
228 | ||
229 | Double_t phiDelta = phiC - trkPhi; | |
230 | ||
231 | Double_t sint = TMath::Sin(trkTheta); | |
232 | Double_t cost = TMath::Cos(trkTheta); | |
233 | Double_t sinf = TMath::Sin(trkPhi); | |
234 | Double_t cosf = TMath::Cos(trkPhi); | |
235 | Double_t sinfd = TMath::Sin(phiDelta); | |
236 | Double_t cosfd = TMath::Cos(phiDelta); | |
237 | Double_t tantheta = TMath::Tan(thetaC); | |
238 | ||
239 | Double_t alpha =cost-tantheta*cosfd*sint; // formula (11) | |
240 | Double_t k = 1.-GetRefIdx()*GetRefIdx()+alpha*alpha/(betaM*betaM); // formula (after 8 in the text) | |
241 | if (k<0) return 1e10; | |
242 | Double_t mu =sint*sinf+tantheta*(cost*cosfd*sinf+sinfd*cosf); // formula (10) | |
243 | Double_t e =sint*cosf+tantheta*(cost*cosfd*cosf-sinfd*sinf); // formula (9) | |
244 | ||
245 | Double_t kk = betaM*TMath::Sqrt(k)/(GapThick()*alpha); // formula (6) and (7) | |
246 | Double_t dtdxc = kk*(k*(cosfd*cosf-cost*sinfd*sinf)-(alpha*mu/(betaM*betaM))*sint*sinfd); // formula (6) | |
247 | Double_t dtdyc = kk*(k*(cosfd*sinf+cost*sinfd*cosf)+(alpha* e/(betaM*betaM))*sint*sinfd); // formula (7) pag.4 | |
248 | ||
249 | Double_t errX = 0.2,errY=0.25; //end of page 7 | |
250 | return TMath::Sqrt(errX*errX*dtdxc*dtdxc + errY*errY*dtdyc*dtdyc); | |
251 | } | |
252 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
253 | Double_t AliHMPIDParam::SigCrom(Double_t trkTheta,Double_t trkPhi,Double_t thetaC, Double_t phiC,Double_t betaM) | |
254 | { | |
255 | // Analitical calculation of chromatic error (due to lack of knowledge of Cerenkov photon energy) on Cerenkov angle for a given Cerenkov photon | |
256 | // created by a given MIP. Fromulae according to CERN-EP-2000-058 | |
257 | // Arguments: Cerenkov and azimuthal angles for Cerenkov photon, [radians] | |
258 | // dip and azimuthal angles for MIP taken at the entrance to radiator, [radians] | |
259 | // MIP beta | |
260 | // Returns: absolute error on Cerenkov angle, [radians] | |
261 | ||
262 | Double_t phiDelta = phiC - trkPhi; | |
263 | ||
264 | Double_t sint = TMath::Sin(trkTheta); | |
265 | Double_t cost = TMath::Cos(trkTheta); | |
266 | Double_t cosfd = TMath::Cos(phiDelta); | |
267 | Double_t tantheta = TMath::Tan(thetaC); | |
268 | ||
269 | Double_t alpha =cost-tantheta*cosfd*sint; // formula (11) | |
270 | Double_t dtdn = cost*GetRefIdx()*betaM*betaM/(alpha*tantheta); // formula (12) | |
271 | ||
272 | // Double_t f = 0.00928*(7.75-5.635)/TMath::Sqrt(12.); | |
273 | Double_t f = 0.0172*(7.75-5.635)/TMath::Sqrt(24.); | |
274 | ||
275 | return f*dtdn; | |
276 | }//SigCrom() | |
277 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
278 | Double_t AliHMPIDParam::SigGeom(Double_t trkTheta,Double_t trkPhi,Double_t thetaC, Double_t phiC,Double_t betaM) | |
279 | { | |
280 | // Analitical calculation of geometric error (due to lack of knowledge of creation point in radiator) on Cerenkov angle for a given Cerenkov photon | |
281 | // created by a given MIP. Formulae according to CERN-EP-2000-058 | |
282 | // Arguments: Cerenkov and azimuthal angles for Cerenkov photon, [radians] | |
283 | // dip and azimuthal angles for MIP taken at the entrance to radiator, [radians] | |
284 | // MIP beta | |
285 | // Returns: absolute error on Cerenkov angle, [radians] | |
286 | ||
287 | Double_t phiDelta = phiC - trkPhi; | |
288 | ||
289 | Double_t sint = TMath::Sin(trkTheta); | |
290 | Double_t cost = TMath::Cos(trkTheta); | |
291 | Double_t sinf = TMath::Sin(trkPhi); | |
292 | Double_t cosfd = TMath::Cos(phiDelta); | |
293 | Double_t costheta = TMath::Cos(thetaC); | |
294 | Double_t tantheta = TMath::Tan(thetaC); | |
295 | ||
296 | Double_t alpha =cost-tantheta*cosfd*sint; // formula (11) | |
297 | ||
298 | Double_t k = 1.-GetRefIdx()*GetRefIdx()+alpha*alpha/(betaM*betaM); // formula (after 8 in the text) | |
299 | if (k<0) return 1e10; | |
300 | ||
301 | Double_t eTr = 0.5*RadThick()*betaM*TMath::Sqrt(k)/(GapThick()*alpha); // formula (14) | |
302 | Double_t lambda = 1.-sint*sint*sinf*sinf; // formula (15) | |
303 | ||
304 | Double_t c1 = 1./(1.+ eTr*k/(alpha*alpha*costheta*costheta)); // formula (13.a) | |
305 | Double_t c2 = betaM*TMath::Power(k,1.5)*tantheta*lambda/(GapThick()*alpha*alpha); // formula (13.b) | |
306 | Double_t c3 = (1.+eTr*k*betaM*betaM)/((1+eTr)*alpha*alpha); // formula (13.c) | |
307 | Double_t c4 = TMath::Sqrt(k)*tantheta*(1-lambda)/(GapThick()*betaM); // formula (13.d) | |
308 | Double_t dtdT = c1 * (c2+c3*c4); | |
309 | Double_t trErr = RadThick()/(TMath::Sqrt(12.)*cost); | |
310 | ||
311 | return trErr*dtdT; | |
312 | }//SigGeom() | |
313 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |