]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG3/muon/AliDimuInfoStoreRD.cxx
9189102f1e44cf279a969b49d2882d021707c925
[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[16] = {-999999., 999999.,
34                                                 -999999., 999999.,
35                                                 -999999., 999999.,
36                                                 -999999., 999999.,
37                                                 -999999., 999999.,
38                                                 -999999., 999999.,
39                                                 -999999., 999999.,
40                                                 -999999., 999999.};
41
42 //-----------------------------------------------------------------------------
43 AliDimuInfoStoreRD::AliDimuInfoStoreRD() :
44 TObject(),
45 fMomentum(),
46 fCharge(0),
47 fInvM(0.)
48 {
49   //
50   // default constructor
51   //
52   for (Int_t i=2; i--;) fMuonRef[i] = 0;
53 }
54
55 //-----------------------------------------------------------------------------
56 AliDimuInfoStoreRD::AliDimuInfoStoreRD(AliMuonInfoStoreRD* const trk0, AliMuonInfoStoreRD* const trk1) :
57 TObject(),
58 fMomentum(),
59 fCharge(0),
60 fInvM(0.)
61 {
62   //
63   // default constructor
64   //
65   fMuonRef[0] = trk0;
66   fMuonRef[1] = trk1;
67   FillDimuInfo();
68 }
69
70 //-----------------------------------------------------------------------------
71 AliDimuInfoStoreRD::AliDimuInfoStoreRD(const AliDimuInfoStoreRD &src) :
72 TObject(src),
73 fMomentum(src.fMomentum),
74 fCharge(src.fCharge),
75 fInvM(src.fInvM)
76 {
77   //
78   // copy constructor
79   //
80   for (Int_t i=2; i--;) fMuonRef[i] = src.fMuonRef[i];
81 }
82
83 //-----------------------------------------------------------------------------
84 AliDimuInfoStoreRD& AliDimuInfoStoreRD::operator=(const AliDimuInfoStoreRD &src)
85 {
86   //
87   // assignment constructor
88   //
89   if(&src==this) return *this;
90
91   fMomentum = src.fMomentum;
92   fCharge   = src.fCharge;
93   fInvM     = src.fInvM;
94   for (Int_t i=2; i--;) fMuonRef[i] = src.fMuonRef[i];
95
96   return *this;
97 }
98
99 //-----------------------------------------------------------------------------
100 AliDimuInfoStoreRD::~AliDimuInfoStoreRD()
101 {
102   //
103   // destructor
104   //
105 }
106
107 //-----------------------------------------------------------------------------
108 void AliDimuInfoStoreRD::FillDimuInfo()
109 {
110   // fill dimuon candidate info from the corresponding two muon tracks
111
112   AliMuonInfoStoreRD *trk0 = (AliMuonInfoStoreRD*)fMuonRef[0].GetObject();
113   AliMuonInfoStoreRD *trk1 = (AliMuonInfoStoreRD*)fMuonRef[1].GetObject();
114
115   fMomentum = trk0->Momentum() + trk1->Momentum();
116   fCharge   = trk0->Charge()   + trk1->Charge();
117
118   Double_t mMu = TDatabasePDG::Instance()->GetParticle(13)->Mass();
119   TLorentzVector lorentzP0, lorentzP1, lorentzP;
120   lorentzP0.SetVectM(trk0->Momentum(), mMu);
121   lorentzP1.SetVectM(trk1->Momentum(), mMu);
122   lorentzP = lorentzP0 + lorentzP1;
123   fInvM = lorentzP.Mag();
124
125   trk0 = 0;
126   trk1 = 0;
127   return;
128 }
129
130 //-----------------------------------------------------------------------------
131 Bool_t AliDimuInfoStoreRD::IsSelected()
132 {
133   // select dimuon candidates according to the corresponding two muon tracks cuts
134
135   Double_t cutsOld[16];
136   AliMuonInfoStoreRD::SelectionCust(cutsOld);
137   AliMuonInfoStoreRD::SetSelectionCuts(AliDimuInfoStoreRD::fgCutd);
138   AliMuonInfoStoreRD *trk0 = (AliMuonInfoStoreRD*)fMuonRef[0].GetObject();
139   AliMuonInfoStoreRD *trk1 = (AliMuonInfoStoreRD*)fMuonRef[1].GetObject(); 
140   if (!trk0->IsSelected()) { AliMuonInfoStoreRD::SetSelectionCuts(cutsOld); return kFALSE; }
141   if (!trk1->IsSelected()) { AliMuonInfoStoreRD::SetSelectionCuts(cutsOld); return kFALSE; }
142
143   AliMuonInfoStoreRD::SetSelectionCuts(cutsOld);
144   return kTRUE;
145 }