]> git.uio.no Git - u/mrichter/AliRoot.git/blob - RICH/AliRICHRecon.cxx
MAJOR UPGRADE: 1. all objects are counted from 0 2. new AliRICHRecon 3. calib off...
[u/mrichter/AliRoot.git] / RICH / AliRICHRecon.cxx
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
16 //////////////////////////////////////////////////////////////////////////
17 //                                                                      //
18 // AliRICHRecon                                                         //
19 //                                                                      //
20 // RICH class to perfom pattern recognition based on Hough transfrom    //
21 // for single chamber                                                   //
22 //////////////////////////////////////////////////////////////////////////
23
24 #include "AliRICHRecon.h"  //class header
25 #include "AliRICHCluster.h" //CkovAngle()
26 #include <AliLog.h>        //AliInfo()
27 #include <TMath.h>         //many 
28 #include <TRotation.h>      //
29 #include <TH1D.h>          //HoughResponse()
30 #include <TClonesArray.h>  //CkovAngle()
31
32 const Double_t AliRICHRecon::fkRadThick=1.5;
33 const Double_t AliRICHRecon::fkWinThick=0.5;
34 const Double_t AliRICHRecon::fkGapThick=8.0;
35 const Double_t AliRICHRecon::fkRadIdx  =1.292;
36 const Double_t AliRICHRecon::fkWinIdx  =1.5787;
37 const Double_t AliRICHRecon::fkGapIdx  =1.0005;
38
39
40 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
41 AliRICHRecon::AliRICHRecon():TTask("RichRec","RichPat"),
42   fPhotCnt(-1),
43   fCkovSigma2(0),
44   fIsWEIGHT(kFALSE),
45   fDTheta(0.001),
46   fWindowWidth(0.045),
47   fTrkDir(TVector3(0,0,1)),fTrkPos(TVector2(30,40))  
48 {
49 // main ctor
50   for (Int_t i=0; i<3000; i++) {
51     fPhotFlag[i] =  0;
52     fPhotCkov[i] = -1;
53     fPhotPhi [i] = -1;
54     fPhotWei [i] =  0;
55   }
56 }
57 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
58 Double_t AliRICHRecon::CkovAngle(TClonesArray *pCluLst,Int_t &iNaccepted)
59 {
60 // Pattern recognition method based on Hough transform
61 // Arguments: pCluLst  - list of clusters for this chamber   
62 //   Returns:          - track ckov angle, [rad], 
63   
64   if(pCluLst->GetEntries()>200) fIsWEIGHT = kTRUE; // offset to take into account bkg in reconstruction
65   else                          fIsWEIGHT = kFALSE;
66
67   // Photon Flag:  Flag = 0 initial set; Flag = 1 good candidate (charge compatible with photon); Flag = 2 photon used for the ring;
68
69   fPhotCnt=0;                                                      
70   for (Int_t iClu=0; iClu<pCluLst->GetEntriesFast();iClu++){//clusters loop
71     AliRICHCluster *pClu=(AliRICHCluster*)pCluLst->UncheckedAt(iClu);                       //get pointer to current cluster    
72     if(pClu->Q()>100) continue;                                                             //avoid MIP clusters from bkg
73     
74     fPhotCkov[fPhotCnt]=FindPhotCkov(pClu->X(),pClu->Y());                                  //find ckov angle for this  photon candidate
75     fPhotCnt++;         //increment counter of photon candidates
76   }//clusters loop
77
78   iNaccepted=FlagPhot(HoughResponse()); //flag photons according to individual theta ckov with respect to most probable track theta ckov
79   if(iNaccepted<1) return -11; 
80   else             return FindRingCkov(pCluLst->GetEntries());  //find best Theta ckov for ring i.e. track
81 }//ThetaCerenkov()
82 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
83 Double_t AliRICHRecon::FindPhotCkov(Double_t cluX,Double_t cluY)
84 {
85 // Finds Cerenkov angle  for this photon candidate
86 // Arguments: cluX,cluY - position of cadidate's cluster  
87 //   Returns: Cerenkov angle 
88
89   TVector2 pos(cluX,cluY); Double_t cluR=(pos-fTrkPos).Mod();  Double_t phi=FindPhotPhi(cluX,cluY);      
90   Printf("new dist %f phi %f",cluR,phi);
91   Double_t ckov1=0,ckov2=0.75;
92   const Double_t kTol=0.05; 
93   Int_t iIterCnt = 0;
94   while(1){
95     if(iIterCnt>=50) return -1;
96     Double_t ckov=0.5*(ckov1+ckov2);
97     Double_t dist=cluR-TracePhoton(ckov,phi,pos); iIterCnt++; //get distance between trial point and cluster position
98     Printf("New: phi %f ckov %f dist %f",phi,ckov,dist);
99     if     (dist> kTol) ckov1=ckov;                           //cluster @ larger ckov 
100     else if(dist<-kTol) ckov2=ckov;                           //cluster @ smaller ckov
101     else                return ckov;                          //precision achived         
102   }
103 }//FindPhotTheta()
104 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
105 Double_t AliRICHRecon::FindPhotPhi(Double_t cluX,Double_t cluY)
106 {
107 // Finds phi angle og photon candidate by considering the cluster's position  of this candudate w.r.t track position
108   
109   Double_t emiss=0; 
110   return fPhotPhi[fPhotCnt]=TMath::ATan2(cluY-fTrkPos.Y()-emiss*TMath::Tan(fTrkDir.Theta())*TMath::Sin(fTrkDir.Phi()),
111                                          cluX-fTrkPos.X()-emiss*TMath::Tan(fTrkDir.Theta())*TMath::Cos(fTrkDir.Phi()));
112 }
113 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
114 Double_t AliRICHRecon::FindRingArea(Double_t ckovAng)const
115 {
116 // Find area inside the cerenkov ring which lays inside PCs
117 // Arguments: ckovThe - cernkov    
118 //   Returns: area of the ring in cm^2 for given theta ckov
119    
120   
121   TVector2 pos1,pos2;
122   
123   const Int_t kN=100;
124   Double_t area=0;
125   for(Int_t i=0;i<kN;i++){
126     TracePhoton(ckovAng,Double_t(TMath::TwoPi()*i    /kN),pos1);//trace this photon 
127     TracePhoton(ckovAng,Double_t(TMath::TwoPi()*(i+1)/kN),pos2);//trace this photon 
128     area+=(pos1-fTrkPos)*(pos2-fTrkPos);
129       
130   }
131   return area;
132 }//RingArea()
133 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
134 Double_t AliRICHRecon::TracePhoton(Double_t ckovThe,Double_t ckovPhi,TVector2 &pos)const
135 {
136 // Trace a single Ckov photon from emission point somewhere in radiator up to photocathode taking into account ref indexes of materials it travereses
137 // Arguments: ckovThe,ckovPhi- photon ckov angles, [rad]  (warning: not photon theta and phi)     
138 //   Returns: distance between photon point on PC and track projection  
139   TRotation mtheta;   mtheta.RotateY(fTrkDir.Theta());
140   TRotation mphi;       mphi.RotateZ(fTrkDir.Phi());  
141   TRotation mrot=mphi*mtheta;
142   
143   TVector3  posCkov(fTrkPos.X(),fTrkPos.Y(),-0.5*fkRadThick-fkWinThick-fkGapThick);   //RAD: photon position is track position @ middle of RAD 
144   TVector3  dirCkov;   dirCkov.SetMagThetaPhi(1,ckovThe,ckovPhi);                     //initially photon is directed according to requested ckov angle
145                                                dirCkov=mrot*dirCkov;                  //now we know photon direction in LORS
146                        dirCkov.SetPhi(ckovPhi);   
147   if(dirCkov.Theta() > TMath::ASin(1./fkRadIdx)) return -999;//total refraction on WIN-GAP boundary
148   
149   Propagate(dirCkov,posCkov,-fkWinThick-fkGapThick); //go to RAD-WIN boundary  remeber that z=0 is PC plane
150   Refract  (dirCkov,         fkRadIdx,fkWinIdx    ); //RAD-WIN refraction
151   Propagate(dirCkov,posCkov,-fkGapThick           ); //go to WIN-GAP boundary
152   Refract  (dirCkov,         fkWinIdx,fkGapIdx    ); //WIN-GAP refraction
153   Propagate(dirCkov,posCkov,0                     ); //go to PC
154   
155   pos.Set(posCkov.X(),posCkov.Y());
156   return (pos-fTrkPos).Mod();
157 }//TracePhoton()
158 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
159 void AliRICHRecon::Propagate(const TVector3 &dir,TVector3 &pos,Double_t z)const
160 {
161 // Finds an intersection point between a line and XY plane shifted along Z.
162 // Arguments:  dir,pos   - vector along the line and any point of the line
163 //             z         - z coordinate of plain 
164 //   Returns:  none
165 //   On exit:  pos is the position if this intesection if any
166   static TVector3 nrm(0,0,1); 
167          TVector3 pnt(0,0,z);
168   
169   TVector3 diff=pnt-pos;
170   Double_t sint=(nrm*diff)/(nrm*dir);
171   pos+=sint*dir;
172 }//Propagate()
173 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
174 void AliRICHRecon::Refract(TVector3 &dir,Double_t n1,Double_t n2)const
175 {
176 // Refract direction vector according to Snell law
177 // Arguments: 
178 //            n1 - ref idx of first substance
179 //            n2 - ref idx of second substance
180 //   Returns: none
181 //   On exit: dir is new direction
182   Double_t sinref=(n1/n2)*TMath::Sin(dir.Theta());
183   if(sinref>1.)    dir.SetXYZ(-999,-999,-999);
184   else             dir.SetTheta(TMath::ASin(sinref));
185 }//Refract()
186 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
187 Double_t AliRICHRecon::HoughResponse()
188 {
189 //
190 //
191 //       
192   Double_t kThetaMax=0.75;
193   Int_t nChannels = (Int_t)(kThetaMax/fDTheta+0.5);
194   TH1D *phots   = new TH1D("Rphot"  ,"phots"         ,nChannels,0,kThetaMax);
195   TH1D *photsw  = new TH1D("RphotWeighted" ,"photsw" ,nChannels,0,kThetaMax);
196   TH1D *resultw = new TH1D("resultw","resultw"       ,nChannels,0,kThetaMax);
197   Int_t nBin = (Int_t)(kThetaMax/fDTheta);
198   Int_t nCorrBand = (Int_t)(fWindowWidth/(2*fDTheta));
199   
200   for (Int_t i=0; i< fPhotCnt; i++){//photon cadidates loop
201     Double_t angle = fPhotCkov[i];  if(angle<0||angle>kThetaMax) continue;
202     phots->Fill(angle);
203     Int_t bin = (Int_t)(0.5+angle/(fDTheta));
204     Double_t weight=1.;
205     if(fIsWEIGHT){
206       Double_t lowerlimit = ((Double_t)bin)*fDTheta - 0.5*fDTheta;  Double_t upperlimit = ((Double_t)bin)*fDTheta + 0.5*fDTheta;   
207       Double_t diffArea = FindRingArea(upperlimit)-FindRingArea(lowerlimit);
208       if(diffArea>0) weight = 1./diffArea;
209     }
210     photsw->Fill(angle,weight);
211     fPhotWei[i]=weight;
212   }//photon candidates loop 
213    
214   for (Int_t i=1; i<=nBin;i++){
215     Int_t bin1= i-nCorrBand;
216     Int_t bin2= i+nCorrBand;
217     if(bin1<1) bin1=1;
218     if(bin2>nBin)bin2=nBin;
219     Double_t sumPhots=phots->Integral(bin1,bin2);
220     if(sumPhots<3) continue;                            // if less then 3 photons don't trust to this ring
221     Double_t sumPhotsw=photsw->Integral(bin1,bin2);
222     resultw->Fill((Double_t)((i+0.5)*fDTheta),sumPhotsw);
223   } 
224 // evaluate the "BEST" theta ckov as the maximum value of histogramm
225   Double_t *pVec = resultw->GetArray();
226   Int_t locMax = TMath::LocMax(nBin,pVec);
227   phots->Delete();photsw->Delete();resultw->Delete(); // Reset and delete objects
228   
229   return (Double_t)(locMax*fDTheta+0.5*fDTheta); //final most probable track theta ckov   
230 }//HoughResponse()
231 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
232 Double_t AliRICHRecon::FindRingCkov(Int_t)
233 {
234 // Loops on all Ckov candidates and estimates the best Theta Ckov for a ring formed by those candidates. Also estimates an error for that Theat Ckov
235 // collecting errors for all single Ckov candidates thetas. (Assuming they are independent)  
236 // Arguments: iNclus- total number of clusters in chamber for background estimation
237 //    Return: best estimation of track Theta ckov
238
239   Double_t wei = 0.;
240   Double_t weightThetaCerenkov = 0.;
241
242   Double_t ckovMin=9999.,ckovMax=0.;
243   Double_t sigma2 = 0;   //to collect error squared for this ring
244   
245   for(Int_t i=0;i<fPhotCnt;i++){//candidates loop
246     if(fPhotFlag[i] == 2){
247       if(fPhotCkov[i]<ckovMin) ckovMin=fPhotCkov[i];  //find max and min Theta ckov from all candidates within probable window
248       if(fPhotCkov[i]>ckovMax) ckovMax=fPhotCkov[i]; 
249       weightThetaCerenkov += fPhotCkov[i]*fPhotWei[i];   wei += fPhotWei[i];                 //collect weight as sum of all candidate weghts   
250       
251      //Double_t phiref=(GetPhiPoint()-GetTrackPhi());
252        if(fPhotCkov[i]<=0) continue;//?????????????????Flag photos = 2 may imply CkovEta = 0?????????????? 
253                                      
254       sigma2 += 1./Sigma2(fPhotCkov[i],fPhotPhi[i],fTrkDir.Theta(),fTrkDir.Phi());
255     }
256   }//candidates loop
257   
258   if(sigma2>0) fCkovSigma2=1./sigma2;
259   else         fCkovSigma2=1e10;  
260   
261
262   if(wei != 0.) weightThetaCerenkov /= wei; else weightThetaCerenkov = 0.;  
263   return weightThetaCerenkov;
264 }//FindCkovRing()
265 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
266 Int_t AliRICHRecon::FlagPhot(Double_t ckov)
267 {
268 // Flag photon candidates if their individual ckov angle is inside the window around ckov angle returned by  HoughResponse()
269 // Arguments: ckov- value of most probable ckov angle for track as returned by HoughResponse()
270 //   Returns: number of photon candidates happened to be inside the window
271
272   
273   Int_t steps = (Int_t)((ckov )/ fDTheta); //how many times we need to have fDTheta to fill the distance between 0  and thetaCkovHough
274
275   Double_t tmin = (Double_t)(steps - 1)*fDTheta;
276   Double_t tmax = (Double_t)(steps)*fDTheta;
277   Double_t tavg = 0.5*(tmin+tmax);
278
279   tmin = tavg - 0.5*fWindowWidth;  tmax = tavg + 0.5*fWindowWidth;
280
281   Int_t iInsideCnt = 0; //count photons which Theta ckov inside the window
282   for(Int_t i=0;i<fPhotCnt;i++){//photon candidates loop
283     if(fPhotCkov[i] >= tmin && fPhotCkov[i] <= tmax)    { 
284       fPhotFlag[i]=2;     
285       iInsideCnt++;
286     }
287   }
288   return iInsideCnt;
289 }//FlagPhotons()
290 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
291 Double_t AliRICHRecon::Sigma2(Double_t ckovTh, Double_t ckovPh, Double_t trkTh, Double_t trkPh)const
292 {
293 // Analithical calculation of total error (as a sum of localization, geometrical and chromatic errors) on Cerenkov angle for a given Cerenkov photon 
294 // created by a given MIP. Fromulae according to CERN-EP-2000-058 
295 // Arguments: Cerenkov and azimuthal angles for Cerenkov photon, [radians]
296 //            dip and azimuthal angles for MIP taken at the entrance to radiator, [radians]        
297 //            MIP beta
298 //   Returns: absolute error on Cerenkov angle, [radians]    
299   
300   TVector3 v(-999,-999,-999);
301   Double_t trkBeta = 1./(TMath::Cos(ckovTh)*fkRadIdx);
302
303   v.SetX(SigLoc (ckovTh,ckovPh,trkTh,trkPh,trkBeta));
304   v.SetY(SigGeom(ckovTh,ckovPh,trkTh,trkPh,trkBeta));
305   v.SetZ(SigCrom(ckovTh,ckovPh,trkTh,trkPh,trkBeta));
306
307   return v.Mag2();
308 }
309 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
310 Double_t AliRICHRecon::SigLoc(Double_t thetaC, Double_t phiC, Double_t thetaM, Double_t phiM, Double_t betaM)const
311 {
312 // Analithical calculation of localization error (due to finite segmentation of PC) on Cerenkov angle for a given Cerenkov photon 
313 // created by a given MIP. Fromulae according to CERN-EP-2000-058 
314 // Arguments: Cerenkov and azimuthal angles for Cerenkov photon, [radians]
315 //            dip and azimuthal angles for MIP taken at the entrance to radiator, [radians]        
316 //            MIP beta
317 //   Returns: absolute error on Cerenkov angle, [radians]    
318   Double_t phiDelta = phiC - phiM;
319
320   Double_t alpha =TMath::Cos(thetaM)-TMath::Tan(thetaC)*TMath::Cos(phiDelta)*TMath::Sin(thetaM);
321   Double_t k = 1.-fkRadIdx*fkRadIdx+alpha*alpha/(betaM*betaM);
322   if (k<0) return 1e10;
323
324   Double_t mu =TMath::Sin(thetaM)*TMath::Sin(phiM)+TMath::Tan(thetaC)*(TMath::Cos(thetaM)*TMath::Cos(phiDelta)*TMath::Sin(phiM)+TMath::Sin(phiDelta)*TMath::Cos(phiM));
325   Double_t e  =TMath::Sin(thetaM)*TMath::Cos(phiM)+TMath::Tan(thetaC)*(TMath::Cos(thetaM)*TMath::Cos(phiDelta)*TMath::Cos(phiM)-TMath::Sin(phiDelta)*TMath::Sin(phiM));
326
327   Double_t kk = betaM*TMath::Sqrt(k)/(8*alpha);
328   Double_t dtdxc = kk*(k*(TMath::Cos(phiDelta)*TMath::Cos(phiM)-TMath::Cos(thetaM)*TMath::Sin(phiDelta)*TMath::Sin(phiM))-(alpha*mu/(betaM*betaM))*TMath::Sin(thetaM)*TMath::Sin(phiDelta));
329   Double_t dtdyc = kk*(k*(TMath::Cos(phiDelta)*TMath::Sin(phiM)+TMath::Cos(thetaM)*TMath::Sin(phiDelta)*TMath::Cos(phiM))+(alpha* e/(betaM*betaM))*TMath::Sin(thetaM)*TMath::Sin(phiDelta));
330
331   return  TMath::Sqrt(0.2*0.2*dtdxc*dtdxc + 0.25*0.25*dtdyc*dtdyc);
332 }
333 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
334 Double_t AliRICHRecon::SigCrom(Double_t thetaC, Double_t phiC, Double_t thetaM, Double_t phiM, Double_t betaM)const
335 {
336 // Analithical calculation of chromatic error (due to lack of knowledge of Cerenkov photon energy) on Cerenkov angle for a given Cerenkov photon 
337 // created by a given MIP. Fromulae according to CERN-EP-2000-058 
338 // Arguments: Cerenkov and azimuthal angles for Cerenkov photon, [radians]
339 //            dip and azimuthal angles for MIP taken at the entrance to radiator, [radians]        
340 //            MIP beta
341 //   Returns: absolute error on Cerenkov angle, [radians]    
342   Double_t phiDelta = phiC - phiM;
343   Double_t alpha =TMath::Cos(thetaM)-TMath::Tan(thetaC)*TMath::Cos(phiDelta)*TMath::Sin(thetaM);
344
345   Double_t dtdn = TMath::Cos(thetaM)*fkRadIdx*betaM*betaM/(alpha*TMath::Tan(thetaC));
346             
347   Double_t f = 0.00928*(7.75-5.635)/TMath::Sqrt(12.);
348
349   return f*dtdn;
350 }//SigCrom()
351 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
352 Double_t AliRICHRecon::SigGeom(Double_t thetaC, Double_t phiC, Double_t thetaM, Double_t phiM, Double_t betaM)const
353 {
354 // Analithical calculation of geometric error (due to lack of knowledge of creation point in radiator) on Cerenkov angle for a given Cerenkov photon 
355 // created by a given MIP. Formulae according to CERN-EP-2000-058 
356 // Arguments: Cerenkov and azimuthal angles for Cerenkov photon, [radians]
357 //            dip and azimuthal angles for MIP taken at the entrance to radiator, [radians]        
358 //            MIP beta
359 //   Returns: absolute error on Cerenkov angle, [radians]    
360
361   Double_t phiDelta = phiC - phiM;
362   Double_t alpha =TMath::Cos(thetaM)-TMath::Tan(thetaC)*TMath::Cos(phiDelta)*TMath::Sin(thetaM);
363
364   Double_t k = 1.-fkRadIdx*fkRadIdx+alpha*alpha/(betaM*betaM);
365   if (k<0) return 1e10;
366
367   Double_t eTr = 0.5*1.5*betaM*TMath::Sqrt(k)/(8*alpha);
368   Double_t lambda = 1.-TMath::Sin(thetaM)*TMath::Sin(thetaM)*TMath::Sin(phiC)*TMath::Sin(phiC);
369
370   Double_t c = 1./(1.+ eTr*k/(alpha*alpha*TMath::Cos(thetaC)*TMath::Cos(thetaC)));
371   Double_t i = betaM*TMath::Tan(thetaC)*lambda*TMath::Power(k,1.5);
372   Double_t ii = 1.+eTr*betaM*i;
373
374   Double_t err = c * (i/(alpha*alpha*8) +  ii*(1.-lambda) / ( alpha*alpha*8*betaM*(1.+eTr)) );
375   Double_t trErr = 1.5/(TMath::Sqrt(12.)*TMath::Cos(thetaM));
376
377   return trErr*err;
378 }//SigGeom()
379 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++