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