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