new design: singleton to be used instead od AliPHOS object during analysis; contains...
[u/mrichter/AliRoot.git] / PHOS / AliPHOSPIDv1.cxx
CommitLineData
6ad0bfa0 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
b2a60966 16/* $Id$ */
17
6ad0bfa0 18//_________________________________________________________________________
b2a60966 19// Implementation version v1 of the PHOS particle identifier
20// Identification is based on information from PPSD and EMC
2f04ed65 21// Why should I put meaningless comments
22// just to satisfy
23// the code checker
b2a60966 24//
2aad621e 25//*-- Author: Yves Schutz (SUBATECH) & Gines Martinez (SUBATECH)
b2a60966 26
6ad0bfa0 27
28// --- ROOT system ---
29
30// --- Standard library ---
31
de9ec31b 32#include <iostream.h>
6ad0bfa0 33
34// --- AliRoot header files ---
35
26d4b141 36#include "AliPHOSPIDv1.h"
6ad0bfa0 37#include "AliPHOSTrackSegment.h"
38#include "AliPHOSRecParticle.h"
83974468 39#include "AliPHOSIndexToObject.h"
6ad0bfa0 40
26d4b141 41ClassImp( AliPHOSPIDv1)
6ad0bfa0 42
6ad0bfa0 43//____________________________________________________________________________
1cb7c1ee 44AliPHOSPIDv1::AliPHOSPIDv1():AliPHOSPID()
45{
46 fCutOnDispersion = 2.0;
47 fCutOnRelativeDistance = 3.0 ;
48}
49
50//____________________________________________________________________________
69183710 51Float_t AliPHOSPIDv1::GetDistanceInPHOSPlane(AliPHOSEmcRecPoint * emcclu,AliPHOSPpsdRecPoint * PpsdClu, Bool_t &toofar, Option_t * Axis)
52{
53 // Calculates the distance between the EMC RecPoint and the PPSD RecPoint
54
ed4205d8 55 Float_t r = 1.e+10;
69183710 56 TVector3 vecEmc ;
57 TVector3 vecPpsd ;
58
59 emcclu->GetLocalPosition(vecEmc) ;
60 PpsdClu->GetLocalPosition(vecPpsd) ;
61 if(emcclu->GetPHOSMod() == PpsdClu->GetPHOSMod())
62 {
63
64 // Correct to difference in CPV and EMC position due to different distance to center.
65 // we assume, that particle moves from center
66 Float_t dCPV = fGeom->GetIPtoOuterCoverDistance();
67 Float_t dEMC = fGeom->GetIPtoCrystalSurface() ;
68 dEMC = dEMC / dCPV ;
69 vecPpsd = dEMC * vecPpsd - vecEmc ;
70 r = vecPpsd.Mag() ;
71 if (Axis == "X") r = vecPpsd.X();
72 if (Axis == "Y") r = vecPpsd.Y();
73 if (Axis == "Z") r = vecPpsd.Z();
74 if (Axis == "R") r = vecPpsd.Mag();
75
76 }
77 else
78 {
79 toofar = kTRUE ;
80 }
81 return r ;
82}
83
69183710 84//____________________________________________________________________________
88714635 85void AliPHOSPIDv1::MakeParticles(AliPHOSTrackSegment::TrackSegmentsList * trsl,
86 AliPHOSRecParticle::RecParticlesList * rpl)
6ad0bfa0 87{
b2a60966 88 // Makes a RecParticle out of a TrackSegment
6ad0bfa0 89
90 TIter next(trsl) ;
91 AliPHOSTrackSegment * tracksegment ;
92 Int_t index = 0 ;
09fc14a0 93 AliPHOSRecParticle * rp ;
69183710 94 Bool_t tDistance;
0dd37dda 95 Int_t type ;
839ffcb3 96 Int_t showerprofile; // 0 narrow and 1 wide
1cb7c1ee 97 Int_t cpvdetector ; // 1 hit and 0 no hit
98 Int_t pcdetector ; // 1 hit and 0 no hit
0dd37dda 99
6ad0bfa0 100 while ( (tracksegment = (AliPHOSTrackSegment *)next()) ) {
09fc14a0 101 new( (*rpl)[index] ) AliPHOSRecParticle(tracksegment) ;
83974468 102 rp = (AliPHOSRecParticle *)rpl->At(index) ;
69183710 103 AliPHOSEmcRecPoint * recp = tracksegment->GetEmcRecPoint() ;
104 AliPHOSPpsdRecPoint * rpcpv = tracksegment->GetPpsdUpRecPoint() ;
105 AliPHOSPpsdRecPoint * rppc = tracksegment->GetPpsdLowRecPoint() ;
fad3e5b9 106
107 // Float_t * lambda = new Float_t[2];
108 // recp->GetElipsAxis(lambda) ;
109
110 // // Looking at the lateral development of the shower
111 // if ( ( lambda[0] > fLambda1m && lambda[0] < fLambda1M ) && // shower profile cut
112 // ( lambda[1] > fLambda2m && lambda[1] < fLambda2M ) )
113 // // Float_t R ;
114 // //R=(lambda[0]-1.386)*(lambda[0]-1.386)+1.707*1.707*(lambda[1]-1.008)*(lambda[1]-1.008) ;
115 // //if(R<0.35*0.35)
69183710 116
2f04ed65 117 Float_t dispersion;
118 dispersion = recp->GetDispersion();
119 if (dispersion < fCutOnDispersion)
839ffcb3 120 showerprofile = 0 ; // NARROW PROFILE
121 else
122 showerprofile = 1 ;// WIDE PROFILE
fad3e5b9 123
124
2aad621e 125 // Looking at the photon conversion detector
839ffcb3 126 if( tracksegment->GetPpsdLowRecPoint() == 0 )
127 pcdetector = 0 ; // No hit
1cb7c1ee 128 else{
129 if (GetDistanceInPHOSPlane(recp, rppc, tDistance, "R") < fCutOnRelativeDistance)
130 pcdetector = 1 ; // hit
131 else
132 pcdetector = 0 ;
133 }
fad3e5b9 134
2aad621e 135 // Looking at the photon conversion detector
839ffcb3 136 if( tracksegment->GetPpsdUpRecPoint() == 0 )
137 cpvdetector = 0 ; // No hit
1cb7c1ee 138 else{
139 if (GetDistanceInPHOSPlane(recp, rpcpv, tDistance, "R")< fCutOnRelativeDistance)
140 cpvdetector = 1 ; // Hit
141 else
142 cpvdetector = 0 ;
143 }
2aad621e 144
839ffcb3 145 type = showerprofile + 2 * pcdetector + 4 * cpvdetector ;
09fc14a0 146 rp->SetType(type) ;
6ad0bfa0 147 index++ ;
148 }
149
150}
151
09fc14a0 152//____________________________________________________________________________
0a6d52e3 153void AliPHOSPIDv1:: Print(const char * opt)
09fc14a0 154{
b2a60966 155 // Print the parameters used for the particle type identification
156
09fc14a0 157 cout << "AliPHOSPIDv1 : cuts for the particle idendification based on the shower profile " << endl
158 << fLambda1m << " < value1 < " << fLambda1M << endl
159 << fLambda2m << " < value2 < " << fLambda2M << endl ;
160
161}
162
163//____________________________________________________________________________
164void AliPHOSPIDv1::SetShowerProfileCuts(Float_t l1m, Float_t l1M, Float_t l2m, Float_t l2M)
165{
b2a60966 166 // Modifies the parameters used for the particle type identification
167
09fc14a0 168 fLambda1m = l1m ;
169 fLambda1M = l1M ;
170 fLambda2m = l2m ;
171 fLambda2M = l2M ;
172}
69183710 173
174//____________________________________________________________________________
175void AliPHOSPIDv1::SetRelativeDistanceCut(Float_t CutOnRelativeDistance)
176{
177 // Modifies the parameters used for the particle type identification
178
179 fCutOnRelativeDistance = CutOnRelativeDistance ;
180
181}
182