fixing minor bug in printing latex table
[u/mrichter/AliRoot.git] / STEER / AliHMPIDPIDResponse.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 // AliHMPIDPid                                                          //
19 //                                                                      //
20 // HMPID class to perfom particle identification                        //
21 //                                                                      //
22 //////////////////////////////////////////////////////////////////////////
23
24 #include "AliHMPIDPid.h"       //class header
25 #include "AliHMPIDParam.h"     //class header
26 #include "AliHMPIDRecon.h"     //class header
27 #include <AliESDtrack.h>       //FindPid()
28 #include <TRandom.h>           //Resolution()
29
30 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
31 AliHMPIDPid::AliHMPIDPid():TNamed("HMPIDrec","HMPIDPid")
32 {
33 //..
34 //init of data members
35 //..
36 }
37 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
38 Double_t AliHMPIDPIDResponse::CosTheta(Float_t mom, Int_t species) {
39   Double_t mass = AliPID::ParticleMass(species); 
40   TMath::Sqrt(mass*mass+pmod*pmod)/(AliHMPIDParam::Instance()->MeanIdxRad()*pmod);                   //  evaluate the theor. Theta Cherenkov
41 }
42 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
43 Double_t AliHMPIDPIDResponse::Resolution(Double_t thetaCerTh, AliESDtrack *pTrk)
44 {
45   AliHMPIDParam *pParam = AliHMPIDParam::Instance();
46       
47   AliHMPIDRecon rec;
48   Float_t xRa,yRa,thRa,phRa;
49   pTrk->GetHMPIDtrk(xRa,yRa,thRa,phRa);
50   rec.SetTrack(xRa,yRa,thRa,phRa);
51   Double_t thetaMax = TMath::ACos(1./pParam->MeanIdxRad());
52   Int_t nPhots = (Int_t)(21.*TMath::Sin(thetaCerTh)*TMath::Sin(thetaCerTh)/(TMath::Sin(thetaMax)*TMath::Sin(thetaMax))+0.01);
53
54   Double_t sigmatot = 0;
55   Int_t nTrks = 20;
56   for(Int_t iTrk=0;iTrk<nTrks;iTrk++) {
57     Double_t invSigma = 0;
58     Int_t nPhotsAcc = 0;
59     for(Int_t j=0;j<nPhots;j++){
60       Double_t phi = gRandom->Rndm()*TMath::TwoPi();
61       TVector2 pos; pos=rec.TracePhot(thetaCerTh,phi);
62       if(!pParam->IsInside(pos.X(),pos.Y())) continue;
63       if(pParam->IsInDead(pos.X(),pos.Y())) continue;
64       Double_t sigma2 = pParam->Sigma2(thRa,phRa,thetaCerTh,phi);//photon candidate sigma^2
65       if(sigma2!=0) {
66         invSigma += 1./sigma2;
67         nPhotsAcc++;
68       }
69     }      
70     if(invSigma!=0) sigmatot += 1./TMath::Sqrt(invSigma);  
71   }
72   return sigmatot/nTrks;
73 }