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