]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWG4/JetCorrel/CorrelRecoParent.cxx
bugfix: implementing function SendMLFromDet added as pure virtual in r43691
[u/mrichter/AliRoot.git] / PWG4 / JetCorrel / CorrelRecoParent.cxx
CommitLineData
c97d2ae1 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/* $Id: $ */
16
17//______________________________________________________________________________
18// Container class for reconstructed parents. Reconstruction method uses
e1b97289 19// AliKFParticle or TLorentzVector as indicated by kUseAliKF
c97d2ae1 20//-- Author: Paul Constantin
21
22#include "CorrelRecoParent.h"
23
24using namespace std;
c97d2ae1 25
26CorrelRecoParent_t::CorrelRecoParent_t() :
7488b3de 27 CorrelParticle_t(), fAssym(-999.), fOpenAng(-999.), fjcESD(NULL){
c97d2ae1 28 // default constructor
29}
30
e1b97289 31CorrelRecoParent_t& CorrelRecoParent_t::operator=(const CorrelRecoParent_t& rhs){
c97d2ae1 32 fPt = rhs.Pt()*rhs.Q();
33 fPhi = rhs.Phi();
34 fEta = rhs.Eta();
35 fMass = rhs.M();
36 fID = rhs.ID();
37 fAssym = rhs.Assym();
38 fOpenAng = rhs.OpenAng();
7488b3de 39 fjcESD = rhs.Evt();
e1b97289 40 return *this;
c97d2ae1 41}
42
43CorrelRecoParent_t* CorrelRecoParent_t::Copy(){
44 // creates and returns deep object copy
45 CorrelRecoParent_t *copy = new CorrelRecoParent_t;
46 copy->fPt = this->Pt()*this->Q();
47 copy->fPhi = this->Phi();
48 copy->fEta = this->Eta();
49 copy->fMass = this->M();
50 copy->fID = this->ID();
51 copy->fAssym = this->Assym();
52 copy->fOpenAng = this->OpenAng();
7488b3de 53 copy->fjcESD = this->Evt();
c97d2ae1 54 return copy;
55}
56
e1b97289 57Bool_t CorrelRecoParent_t::Reconstruct(CorrelParticle_t *p1, CorrelParticle_t *p2, Bool_t kUseAliKF){
c97d2ae1 58 // main method for parent reconstruction
59
11ad5089 60 if(p1->ID()==t_photon && p2->ID()==t_photon) fID = t_diphoton;
61 else if(p1->ID()==t_electron && p2->ID()==t_electron) fID = t_dielectron;
62 else if(p1->ID()==t_jet && p2->ID()==t_jet) fID = t_dijet;
63 else fID = t_dihadron;
c97d2ae1 64
11ad5089 65 if(fID==t_dielectron && kUseAliKF){
c97d2ae1 66 // code for parent reconstruction based on AliKFParticle:
7488b3de 67 if(!fjcESD)
c97d2ae1 68 {std::cerr<<"CorrelRecoParent_t::Reconstruct - undefined event"<<std::endl; exit(-1);}
c97d2ae1 69 CorrelKFTrack_t* e1 = dynamic_cast<CorrelKFTrack_t*>(p1);
70 CorrelKFTrack_t* e2 = dynamic_cast<CorrelKFTrack_t*>(p2);
71 if(!e1 || !e2)
72 {std::cerr<<"CorrelRecoParent_t::Reconstruct - failed particle casting"<<std::endl; exit(-1);}
73
7488b3de 74 AliKFVertex primVtx(*(fjcESD->GetPrimaryVertex()));
c97d2ae1 75 if(primVtx.GetNContributors()<=0) return kFALSE;
7488b3de 76 AliKFParticle::SetField(fjcESD->GetMagneticField());
c97d2ae1 77 AliKFParticle* pKF1 = new AliKFParticle; AliKFParticle* pKF2 = new AliKFParticle;
78 if(e1->Param()==NULL || e1->Covar()==NULL || e2->Param()==NULL || e2->Covar()==NULL)
79 {std::cerr<<"CorrelRecoParent_t::Reconstruct - null parameter pointer"<<std::endl; exit(-1);}
80 pKF1->Create(e1->Param(), e1->Covar(), e1->Q(), 11*e1->Q()); // AliKFParticle uses Pythia PIDs
81 pKF2->Create(e2->Param(), e2->Covar(), e2->Q(), 11*e2->Q()); // so electron=11 and positron=-11
82
83 AliKFParticle DiElectron(*pKF1,*pKF2);
e1b97289 84 DiElectron.SetMassConstraint(91,3); // the dielectron mass cut (1st=mass,2nd=sigma)
c97d2ae1 85 primVtx += DiElectron;
86 DiElectron.SetProductionVertex(primVtx);
87 Double_t chi2=100000.;
88 if(DiElectron.GetNDF()!=0) chi2=DiElectron.GetChi2()/DiElectron.GetNDF();
89 if(chi2>3.5) return kFALSE; // the dielectron vertex cut
90
91 Float_t px = DiElectron.GetPx();
92 Float_t py = DiElectron.GetPy();
93 Float_t pz = DiElectron.GetPz();
94 Float_t ener = DiElectron.GetE();
95 Float_t theta = TMath::ATan(TMath::Sqrt(px*px+py*py)/pz);
96 fPt = TMath::Sqrt(px*px+py*py)*Float_t(p1->Q()*p2->Q());
97 fPhi = TMath::ATan(py/px);
98 fEta = -TMath::Log(TMath::Tan(theta/2.));
99 fMass = ener - TMath::Sqrt(px*px+py*py+pz*pz);
100 fAssym = TMath::Abs((e1->P()-e2->P())/(e1->P()+e2->P()));
101 fOpenAng = -999.; // compute opening angle
102
103 delete pKF1; delete pKF2;
104
105 } else {
106
107 // code for parent reconstruction based on TLorentzVector:
108 TLorentzVector part1, part2, fPartSum;
109 part1.SetPxPyPzE(p1->Px(), p1->Py(), p1->Pz(), p1->E());
110 part2.SetPxPyPzE(p2->Px(), p2->Py(), p2->Pz(), p2->E());
111
112 fPartSum.SetPxPyPzE(0.,0.,0.,0.);
113 fPartSum = part1 + part2;
114 Float_t pT = fPartSum.Pt();
115 if(TMath::Abs(p1->Q())>0 && TMath::Abs(p2->Q())>0)
116 fPt = pT*Float_t(p1->Q()*p2->Q()); // fPt stores charge as its sign
117 else
118 fPt = pT;
119 fPhi = fPartSum.Phi();
120 fEta = fPartSum.Eta();
121 fMass = fPartSum.M();
122 fAssym = TMath::Abs((p1->P()-p2->P())/(p1->P()+p2->P()));
123 fOpenAng = part1.Angle(part2.Vect());
124 if(NotInMass(fID,fMass)) return kFALSE;
125 }
126
127 return kTRUE;
128}
129
11ad5089 130Bool_t CorrelRecoParent_t::NotInMass(cPartType_t pID, Float_t mass){
c97d2ae1 131 // THE MASS RANGES SHOULD PROBABLY BE MOMENTUM AND CENTRALITY DEPENDENT!!!
11ad5089 132 if(pID!=t_dielectron && pID!=t_diphoton) return kFALSE;
c97d2ae1 133
e1b97289 134 const Float_t kZ0MassMin = 82; // 91-3*3
135 const Float_t kZ0MassMax = 100; // 91+3*3
136 const Float_t kPi0MassMin = 0.11; // 0.14-3*0.1
137 const Float_t kPi0MassMax = 0.17; // 0.14+3*0.1
11ad5089 138 if(pID==t_dielectron && mass>kZ0MassMin && mass<kZ0MassMax) return kFALSE;
139 if(pID==t_diphoton && mass>kPi0MassMin && mass<kPi0MassMax) return kFALSE;
c97d2ae1 140
141 return kTRUE;
142}
143
7488b3de 144void CorrelRecoParent_t::Show() const {
c97d2ae1 145 // printout method
146 std::cout<<" RecoParent pT="<<Pt()<<" phi="<<Phi()<<" eta="<<Eta()<<" m="<<M()<<" id="<<ID()
147 <<" assym="<<Assym()<<" open="<<OpenAng()<<std::endl;
148}