Line data Source code
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 : /* $Id: AliAODpidUtil.cxx 38329 2010-01-17 19:17:24Z hristov $ */
17 :
18 : //-----------------------------------------------------------------
19 : // Implementation of the combined PID class
20 : // For the AOD Class
21 : // containing information on the particle identification
22 : // Origin: Rosa Romita, GSI, r.romita@gsi.de
23 : //-----------------------------------------------------------------
24 :
25 : #include "AliLog.h"
26 : #include "AliAODpidUtil.h"
27 : #include "AliAODEvent.h"
28 : #include "AliAODTrack.h"
29 : #include "AliAODPid.h"
30 :
31 170 : ClassImp(AliAODpidUtil)
32 :
33 :
34 : //_________________________________________________________________________
35 : Float_t AliAODpidUtil::GetSignalDeltaTOFold(const AliVParticle *vtrack, AliPID::EParticleType type, Bool_t ratio/*=kFALSE*/) const
36 : {
37 : //
38 : // Number of sigma implementation for the TOF
39 : //
40 :
41 0 : AliAODTrack *track=(AliAODTrack*)vtrack;
42 0 : AliAODPid *pidObj = track->GetDetPid();
43 0 : if (!pidObj) return -9999.;
44 : Double_t tofTime = 99999;
45 0 : if (fTuneMConData && ((fTuneMConDataMask & kDetTOF) == kDetTOF) ) tofTime = (Double_t)this->GetTOFsignalTunedOnData((AliVTrack*)vtrack);
46 0 : else tofTime=pidObj->GetTOFsignal();
47 0 : const Double_t expTime=fTOFResponse.GetExpectedSignal((AliVTrack*)vtrack,type);
48 0 : Double_t sigmaTOFPid[AliPID::kSPECIES];
49 0 : pidObj->GetTOFpidResolution(sigmaTOFPid);
50 0 : AliAODEvent *event=(AliAODEvent*)track->GetAODEvent();
51 0 : if (event) { // protection if the user didn't call GetTrack, which sets the internal pointer
52 0 : AliTOFHeader* tofH=(AliTOFHeader*)event->GetTOFHeader();
53 0 : if (tofH && (TMath::Abs(sigmaTOFPid[0]) <= 1.E-16) ) { // new AOD
54 0 : tofTime -= fTOFResponse.GetStartTime(vtrack->P());
55 0 : }
56 : } else {
57 0 : AliError("pointer to AliAODEvent not found, please call GetTrack to set it");
58 0 : return -9999.;
59 : }
60 :
61 : Double_t delta=-9999.;
62 :
63 0 : if (!ratio) delta=tofTime-expTime;
64 0 : else if (expTime>1.e-20) delta=tofTime/expTime;
65 :
66 0 : return delta;
67 0 : }
68 :
69 : //_________________________________________________________________________
70 : Float_t AliAODpidUtil::GetNumberOfSigmasTOFold(const AliVParticle *vtrack, AliPID::EParticleType type) const
71 : {
72 : //
73 : // Number of sigma implementation for the TOF
74 : //
75 :
76 0 : AliAODTrack *track=(AliAODTrack*)vtrack;
77 :
78 : Bool_t oldAod=kTRUE;
79 : Double_t sigTOF=0.;
80 0 : AliAODPid *pidObj = track->GetDetPid();
81 0 : if (!pidObj) return -999.;
82 : Double_t tofTime = 99999;
83 0 : if (fTuneMConData && ((fTuneMConDataMask & kDetTOF) == kDetTOF) ) tofTime = (Double_t)this->GetTOFsignalTunedOnData((AliVTrack*)vtrack);
84 0 : else tofTime=pidObj->GetTOFsignal();
85 0 : Double_t expTime=fTOFResponse.GetExpectedSignal((AliVTrack*)vtrack,type);
86 0 : Double_t sigmaTOFPid[AliPID::kSPECIES];
87 0 : pidObj->GetTOFpidResolution(sigmaTOFPid);
88 0 : AliAODEvent *event=(AliAODEvent*)track->GetAODEvent();
89 0 : if (event) { // protection if the user didn't call GetTrack, which sets the internal pointer
90 0 : AliTOFHeader* tofH=(AliTOFHeader*)event->GetTOFHeader();
91 0 : if (tofH && (TMath::Abs(sigmaTOFPid[0]) <= 1.E-16) ) { // new AOD
92 0 : sigTOF=fTOFResponse.GetExpectedSigma(track->P(),expTime,AliPID::ParticleMassZ(type)); //fTOFResponse is set in InitialiseEvent
93 0 : tofTime -= fTOFResponse.GetStartTime(vtrack->P());
94 : oldAod=kFALSE;
95 0 : }
96 : } else {
97 0 : AliError("pointer to AliAODEvent not found, please call GetTrack to set it");
98 0 : return -996.;
99 : }
100 0 : if (oldAod) { // old AOD
101 0 : if (type <= AliPID::kProton) {
102 0 : sigTOF=sigmaTOFPid[type];
103 0 : } else return -998.; // light nuclei cannot be supported on old AOD because we don't have timeZero resolution
104 0 : }
105 0 : if (sigTOF>0) return (tofTime - expTime)/sigTOF;
106 0 : else return -997.;
107 0 : }
|