]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG3/muon/AliDimuInfoStoreRD.cxx
remove dependency to aliroot libraries, access of ESDEvent object through abstract...
[u/mrichter/AliRoot.git] / PWG3 / muon / AliDimuInfoStoreRD.cxx
1 /**************************************************************************
2  * Copyright(c) 1998-2006, 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 /////////////////////////////////////////////////////////////
17 //
18 // class used to extract and store reco info of dimu candidate
19 //
20 // Author: X-M. Zhang, zhang@clermont.in2p3.fr
21 //                     zhangxm@iopp.ccnu.edu.cn
22 /////////////////////////////////////////////////////////////
23
24 #include <TDatabasePDG.h>
25 #include <TLorentzVector.h>
26
27 #include "AliMuonInfoStoreRD.h"
28 #include "AliDimuInfoStoreRD.h"
29
30 ClassImp(AliDimuInfoStoreRD)
31
32 const TString AliDimuInfoStoreRD::fgkStdBranchName("DimuRD");
33 Double_t      AliDimuInfoStoreRD::fgCutd[12] = {-999999., 999999.,
34                                                 -999999., 999999.,
35                                                 -999999., 999999.,
36                                                 -999999., 999999.,
37                                                 -999999., 999999.,
38                                                 -999999., 999999.};
39
40 //-----------------------------------------------------------------------------
41 AliDimuInfoStoreRD::AliDimuInfoStoreRD() :
42 TObject(),
43 fMomentum(),
44 fCharge(0),
45 fInvM(0.)
46 {
47   //
48   // default constructor
49   //
50   for (Int_t i=2; i--;) fMuonRef[i] = 0;
51 }
52
53 //-----------------------------------------------------------------------------
54 AliDimuInfoStoreRD::AliDimuInfoStoreRD(AliMuonInfoStoreRD* const trk0, AliMuonInfoStoreRD* const trk1) :
55 TObject(),
56 fMomentum(),
57 fCharge(0),
58 fInvM(0.)
59 {
60   //
61   // default constructor
62   //
63   fMuonRef[0] = trk0;
64   fMuonRef[1] = trk1;
65   FillDimuInfo();
66 }
67
68 //-----------------------------------------------------------------------------
69 AliDimuInfoStoreRD::AliDimuInfoStoreRD(const AliDimuInfoStoreRD &src) :
70 TObject(src),
71 fMomentum(src.fMomentum),
72 fCharge(src.fCharge),
73 fInvM(src.fInvM)
74 {
75   //
76   // copy constructor
77   //
78   for (Int_t i=2; i--;) fMuonRef[i] = src.fMuonRef[i];
79 }
80
81 //-----------------------------------------------------------------------------
82 AliDimuInfoStoreRD& AliDimuInfoStoreRD::operator=(const AliDimuInfoStoreRD &src)
83 {
84   //
85   // assignment constructor
86   //
87   if(&src==this) return *this;
88
89   fMomentum = src.fMomentum;
90   fCharge   = src.fCharge;
91   fInvM     = src.fInvM;
92   for (Int_t i=2; i--;) fMuonRef[i] = src.fMuonRef[i];
93
94   return *this;
95 }
96
97 //-----------------------------------------------------------------------------
98 AliDimuInfoStoreRD::~AliDimuInfoStoreRD()
99 {
100   //
101   // destructor
102   //
103 }
104
105 //-----------------------------------------------------------------------------
106 void AliDimuInfoStoreRD::FillDimuInfo()
107 {
108   // fill dimuon candidate info from the corresponding two muon tracks
109
110   AliMuonInfoStoreRD *trk0 = (AliMuonInfoStoreRD*)fMuonRef[0].GetObject();
111   AliMuonInfoStoreRD *trk1 = (AliMuonInfoStoreRD*)fMuonRef[1].GetObject();
112
113   fMomentum = trk0->Momentum() + trk1->Momentum();
114   fCharge   = trk0->Charge()   + trk1->Charge();
115
116   Double_t mMu = TDatabasePDG::Instance()->GetParticle(13)->Mass();
117   TLorentzVector lorentzP0, lorentzP1, lorentzP;
118   lorentzP0.SetVectM(trk0->Momentum(), mMu);
119   lorentzP1.SetVectM(trk1->Momentum(), mMu);
120   lorentzP = lorentzP0 + lorentzP1;
121   fInvM = lorentzP.Mag();
122
123   trk0 = 0;
124   trk1 = 0;
125   return;
126 }
127
128 //-----------------------------------------------------------------------------
129 Bool_t AliDimuInfoStoreRD::IsSelected()
130 {
131   // select dimuon candidates according to the corresponding two muon tracks cuts
132
133   Double_t cutsOld[12];
134   AliMuonInfoStoreRD::SelectionCust(cutsOld);
135   AliMuonInfoStoreRD::SetSelectionCuts(AliDimuInfoStoreRD::fgCutd);
136   AliMuonInfoStoreRD *trk0 = (AliMuonInfoStoreRD*)fMuonRef[0].GetObject();
137   AliMuonInfoStoreRD *trk1 = (AliMuonInfoStoreRD*)fMuonRef[1].GetObject(); 
138   if (!trk0->IsSelected()) { AliMuonInfoStoreRD::SetSelectionCuts(cutsOld); return kFALSE; }
139   if (!trk1->IsSelected()) { AliMuonInfoStoreRD::SetSelectionCuts(cutsOld); return kFALSE; }
140
141   AliMuonInfoStoreRD::SetSelectionCuts(cutsOld);
142   return kTRUE;
143 }