]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG4/JCORRAN/AliPhJPiZero.cxx
add method to get centrality of the event for a given centrality class, use it in...
[u/mrichter/AliRoot.git] / PWG4 / JCORRAN / AliPhJPiZero.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 notifce   *
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: AliPhJPiZero.cxx,v 1.3 2008/05/08 13:44:45 djkim Exp $
17
18 ////////////////////////////////////////////////////
19 //
20 //  \file AliPhJPiZero.cxx
21 //  \brief
22 //  \author J. Rak, D.J.Kim, R.Diaz (University of Jyvaskyla)
23 //  \email: djkim@jyu.fi
24 //  \version $Revision: 1.3 $
25 //  \date $Date: 2008/05/08 13:44:45 $
26 //
27 //  Class encapsulates basic properties of  pi0
28 ////////////////////////////////////////////////////
29 #include <iostream>
30 #include <fstream>
31 #include <stdlib.h>
32 #include <math.h>
33 #include <stdio.h>
34 #include <TVector3.h>
35 #include <TLorentzVector.h>
36
37 #include  "AliPhJBaseTrack.h"
38 #include  "AliPhJPhoton.h"
39
40 #include "AliPhJPiZero.h"
41
42 ClassImp(AliPhJPiZero)
43
44 //___________________________________________________________
45 AliPhJPiZero::AliPhJPiZero():
46   fV1(-999,-999,-999), 
47   fV2(-999,-999,-999),
48   fPi0P(-999,-999,-999),
49   fPhotSum(0,0,0,0),
50   fPhoton1(0,0,0,0),
51   fPhoton2(0,0,0,0),
52   fAsymm(-999),
53   fPizM(-999),
54   fMassBin(-999)
55 {
56   //constructor
57 }
58 //______________________________________________________________________________
59 AliPhJPiZero::AliPhJPiZero(const AliPhJPiZero& a):
60   AliPhJBaseTrack(a),
61   fV1(a.fV1),
62   fV2(a.fV2),
63   fPi0P(a.fPi0P),
64   fPhotSum(a.fPhotSum),
65   fPhoton1(a.fPhoton1),
66   fPhoton2(a.fPhoton2),
67   fAsymm(a.fAsymm),
68   fPizM(a.fPizM),
69   fMassBin(a.fMassBin)
70 {
71   //copy constructor
72 }
73
74 //______________________________________________________________________________
75
76 bool AliPhJPiZero::SetMass(const AliPhJPhoton *g1, const AliPhJPhoton *g2){
77   //set pi0 four-momentum, assymetry, inv. mass, pT, phi, theta, energy
78   fV1.SetXYZ(g1->GetX(), g1->GetY(), g1->GetZ() );  //Z is corrected in main  for vertex Z
79   fPhoton1.SetPxPyPzE(g1->GetE()*sin(fV1.Theta())*cos(fV1.Phi()),
80                      g1->GetE()*sin(fV1.Theta())*sin(fV1.Phi()),
81                      g1->GetE()*cos(fV1.Theta()),
82                      g1->GetE());
83  
84   fV2.SetXYZ(g2->GetX(), g2->GetY(), g2->GetZ() ); 
85   fPhoton2.SetPxPyPzE(g2->GetE()*sin(fV2.Theta())*cos(fV2.Phi()),
86                      g2->GetE()*sin(fV2.Theta())*sin(fV2.Phi()),
87                      g2->GetE()*cos(fV2.Theta()),
88                      g2->GetE());
89   fPhotSum  = fPhoton1 + fPhoton2;
90   fPi0P     = fPhotSum.Vect();
91   fAsymm    = fabs((g1->GetE()-g2->GetE())/(g1->GetE()+g2->GetE()));
92   fPizM     = fPhotSum.M();
93   fBasePt   = fPhotSum.Pt();
94   fBasePhi  = fPhotSum.Phi();
95   fBaseTheta= fPhotSum.Theta();
96   fBaseE    = fPhotSum.E();
97   return true;
98   
99 }
100
101 //______________________________________________________________________________
102
103 double AliPhJPiZero::operator- (const AliPhJPiZero &pi0){
104   
105     //========================================
106     // retruns the closest distance between
107     // photon hits bolonging to two pi0
108     //========================================
109
110   TVector3  v;
111   double d = 1e3;
112   v = fV1-pi0.fV1;
113   if(v.Mag() < d) d = v.Mag();
114   v = fV2-pi0.fV1;
115   if(v.Mag() < d) d = v.Mag();
116   v = fV1-pi0.fV2;
117   if(v.Mag() < d) d = v.Mag();
118   v = fV2-pi0.fV2;
119   if(v.Mag() < d) d = v.Mag();
120   return d;
121 }
122
123
124 //______________________________________________________________________________
125
126 AliPhJPiZero& AliPhJPiZero::operator= (const AliPhJPiZero& piz){
127   //operator=
128   if (this != &piz){
129     AliPhJBaseTrack::operator=(piz);
130     fV1      = piz.fV1;
131     fV2      = piz.fV2;
132     fPi0P    = piz.fPi0P;
133     fPhotSum = piz.fPhotSum;
134     fPhoton1 = piz.fPhoton1;
135     fPhoton2 = piz.fPhoton2;
136     fAsymm   = piz.fAsymm;
137     fPizM    = piz.fPizM;
138     fMassBin = piz.fMassBin;
139   }
140
141   return *this;
142 }
143
144