]> git.uio.no Git - u/mrichter/AliRoot.git/blob - EMCAL/AliEMCALFastRecParticle.cxx
Compilation warnings fixed
[u/mrichter/AliRoot.git] / EMCAL / AliEMCALFastRecParticle.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 //  A  Particle modified by EMCAL response and produced by AliEMCALvFast
20 //  To become a general class of AliRoot ?    
21 //               
22 //*-- Author: Yves Schutz (SUBATECH)
23
24 // --- ROOT system ---
25
26 // --- Standard library ---
27
28 // --- AliRoot header files ---
29
30 #include "AliEMCALFastRecParticle.h"
31 #include "TPad.h"
32 #include "TPaveText.h"
33
34 ClassImp(AliEMCALFastRecParticle) ; 
35
36 //____________________________________________________________________________
37 AliEMCALFastRecParticle::AliEMCALFastRecParticle() : TParticle()
38 {
39   // ctor
40   fType = 0 ; 
41 }
42
43 //____________________________________________________________________________
44 AliEMCALFastRecParticle::AliEMCALFastRecParticle(const AliEMCALFastRecParticle & rp)
45   : TParticle(rp)
46 {
47   // copy ctor
48
49   fType        = rp.fType ;
50   fPdgCode     = rp.fPdgCode;
51   fStatusCode  = rp.fStatusCode;
52   fMother[0]   = rp.fMother[0];
53   fMother[1]   = rp.fMother[1];
54   fDaughter[0] = rp.fDaughter[0];
55   fDaughter[1] = rp.fDaughter[1];
56   fWeight      = rp.fWeight;
57   fCalcMass    = rp.fCalcMass;
58   fPx          = rp.fPx;
59   fPy          = rp.fPy;
60   fPz          = rp.fPz;
61   fE           = rp.fE;
62   fVx          = rp.fVx;
63   fVy          = rp.fVy;
64   fVz          = rp.fVz;
65   fVt          = rp.fVt;
66   fPolarTheta  = rp.fPolarTheta;
67   fPolarPhi    = rp.fPolarPhi;
68   fParticlePDG = rp.fParticlePDG; 
69 }
70
71 //____________________________________________________________________________
72  AliEMCALFastRecParticle::AliEMCALFastRecParticle(const TParticle & pp)
73 {
74   // ctor from a TParticle (crummy?!)
75  
76   TParticle & pnoconst = (TParticle &)(pp) ;
77   AliEMCALFastRecParticle & p = (AliEMCALFastRecParticle &)(pnoconst) ;
78   fType        = 0  ;
79   fPdgCode     = p.fPdgCode;
80   fStatusCode  = p.fStatusCode;
81   fMother[0]   = p.fMother[0];
82   fMother[1]   = p.fMother[1];
83   fDaughter[0] = p.fDaughter[0];
84   fDaughter[1] = p.fDaughter[1];
85   fWeight      = p.fWeight;
86   fCalcMass    = p.fCalcMass;
87   fPx          = p.fPx;
88   fPy          = p.fPy;
89   fPz          = p.fPz;
90   fE           = p.fE;
91   fVx          = p.fVx;
92   fVy          = p.fVy;
93   fVz          = p.fVz;
94   fVt          = p.fVt;
95   fPolarTheta  = p.fPolarTheta;
96   fPolarPhi    = p.fPolarPhi;
97   fParticlePDG = p.fParticlePDG; 
98
99 }
100
101 //____________________________________________________________________________
102 Int_t AliEMCALFastRecParticle::DistancetoPrimitive(Int_t px, Int_t py)
103 {
104   //  Compute distance from point px,py to a AliEMCALFastRecParticle considered as a Tmarker
105   //  Compute the closest distance of approach from point px,py to this marker.
106   //  The distance is computed in pixels units.
107
108   Double_t kRADDEG = 180. / TMath::Pi() ; 
109   Coord_t x = Phi() * kRADDEG     ;
110   Coord_t y = Theta() * kRADDEG     ;
111   const Int_t kMaxDiff = 10;
112   Int_t pxm  = gPad->XtoAbsPixel(x);
113   Int_t pym  = gPad->YtoAbsPixel(y);
114   Int_t dist = (px-pxm)*(px-pxm) + (py-pym)*(py-pym);
115   
116   if (dist > kMaxDiff) return 9999;
117   return dist;
118 }
119
120 //___________________________________________________________________________
121  void AliEMCALFastRecParticle::Draw(Option_t *option)
122  {
123    // Draw this AliEMCALFastRecParticle with its current attributes
124     
125    AppendPad(option);
126  }
127
128 //______________________________________________________________________________
129 void AliEMCALFastRecParticle::ExecuteEvent(Int_t event, Int_t /*px*/, Int_t /*py*/)
130 {
131   //  Execute action corresponding to one event
132   //  This member function is called when a AliEMCALFastRecParticle is clicked with the locator
133   
134   if (!gPad->IsEditable()) 
135     return ;
136   
137   static TPaveText * clustertext = 0 ; 
138   
139   switch (event) {
140     
141   case kButton1Down: {
142     Double_t kRADDEG = 180. / TMath::Pi() ; 
143     Coord_t x = Phi() * kRADDEG     ;
144     Coord_t y = Theta() * kRADDEG     ;
145     clustertext = new TPaveText(x-1, y+1, x+5, y+3, "") ;
146     Text_t  line1[40] ;
147     Text_t  line2[40] ;
148     sprintf( line1, "PID: %s ", (const char*)Name() ) ;
149     sprintf( line2, "ENERGY: %f ", Energy() ) ;
150     clustertext ->AddText(line1) ;
151     clustertext ->AddText(line2) ;
152     clustertext ->Draw("");   
153     gPad->Update() ; 
154     break ;
155   }
156   
157   case kButton1Up: {
158     delete clustertext ; 
159     clustertext = 0 ; 
160     gPad->Update() ; 
161     break ;
162   }
163   }
164   
165 }
166
167 //____________________________________________________________________________
168 TString AliEMCALFastRecParticle::Name()const
169 {
170   // Returns the name of the particle type (only valid if PIDv1 is employed)
171
172   TString  name ; 
173   
174   if(fType == 127)
175     name = "PHOTON_LOPU_HIEF" ;    //PCA = 001 TOF = 111 CPV = 111
176   
177   if(fType == 511)
178     name = "PHOTON_HIPU_LOEF" ;    //PCA = 011 TOF = 111 CPV = 111
179   
180   if(fType == 255)
181         name = "PHOTON_MED_PU_EF" ;    //PCA = 111 TOF = 111 CPV = 111
182   
183   if((fType == 383)||(fType == 447)) 
184     name = "PHOTON_STRANGE" ;      //PCA = 101 or 110 TOF = 111 CPV = 111
185   
186   if(fType == 63)
187     name = "NEUTRAL_FAST_HADRON" ; //PCA = 000 TOF = 111 CPV = 111
188   
189   if((fType == 504) || (fType == 505) ||(fType == 248)||(fType == 249)||(fType == 120)||(fType == 121))
190     name = "CHARGED_FAST_EM" ;     //PCA = 111, 011 or 001 TOF =111 CPV = 000 or 001  
191   
192   if((fType == 56)||(fType == 57))
193     name = "CHARGED_FAST_HADRON" ; //PCA = 000 TOF = 111 CPV = 000 or 001 
194   
195   if((fType < 8)&&(fType > 0))
196     name = "NEUTRAL_SLOW_HADRON" ; //PCA = 000 TOF = 000 CPV = 001 or 011 or 111
197   
198   if((fType == 0))
199     name = "CHARGED_SLOW_HADRON" ; //PCA = 000 TOF = 000 CPV = 000
200   
201   if((fType == 448) || (fType == 449) ||(fType == 192)||(fType == 193)||(fType == 64)||(fType == 64))
202     name = "CHARGED_SLOW_EM" ;    //PCA = 111, 011 or 001 TOF =000 CPV = 000 or 001  
203   
204   return name ; 
205 }
206
207
208 //______________________________________________________________________________
209 void AliEMCALFastRecParticle::SetType(Int_t type) { 
210   // sets the particle type 
211   fType = type ; 
212   
213   if((type == 127) || (fType == 511) || (fType == 255) ||(fType == 383)||(fType == 447)){
214     fPdgCode = 22 ; 
215     return ;
216   }
217   
218   if ((fType == 63)|| ((fType < 8)&&(fType > 0)) ){
219     fPdgCode = 2112 ; 
220     return ;
221   }
222   if ( ((fType == 504) || (fType == 505) ||(fType == 248)||(fType == 249)||(fType == 120)||(fType == 121)) ){
223     fPdgCode = 11 ; 
224     return ;
225   }
226   if ((fType == 448) || (fType == 449) ||(fType == 192)||(fType == 193)||(fType == 64)||(fType == 64)){
227     fPdgCode = 13 ; 
228     return ;
229   }
230   if((fType == 56)||(fType == 57)){
231     fPdgCode = 211 ; 
232     return ;
233   }
234   if (fType == 0){
235     fPdgCode = 2212 ; 
236     return ;
237   }
238
239 }           
240
241 //______________________________________________________________________________
242 void AliEMCALFastRecParticle::Paint(Option_t *)
243 {
244   // Paint this ALiRecParticle in theta,phi coordinate as a TMarker  with its current attributes
245
246   Double_t kRADDEG = 180. / TMath::Pi() ; 
247   Coord_t x = Phi() * kRADDEG     ;
248   Coord_t y = Theta() * kRADDEG     ;
249   Color_t markercolor = 1 ;
250   Size_t  markersize  = 1. ;
251   Style_t markerstyle = 5 ;
252   
253   if (!gPad->IsBatch()) {
254     gVirtualX->SetMarkerColor(markercolor) ;
255     gVirtualX->SetMarkerSize (markersize)  ;
256     gVirtualX->SetMarkerStyle(markerstyle) ;
257   }
258   gPad->SetAttMarkerPS(markercolor,markerstyle,markersize) ;
259   gPad->PaintPolyMarker(1,&x,&y,"") ;
260 }
261
262 //____________________________________________________________________________
263 void AliEMCALFastRecParticle::Print(Option_t * /*opt*/)const
264 {
265   // Print the type, energy and momentum of the reconstructed particle
266   
267   Info("Print", "Summary:") ; 
268   printf("AliEMCALFastRecParticle > type is  %s\n", Name().Data()) ; 
269   printf("                      Energy = %f\n", fE) ; 
270   printf("                         Px     = %f\n", fPx) ; 
271   printf("                         Py     = %f\n", fPy) ;
272   printf("                         Pz     = %f\n", fPz) ; 
273 }