]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG/muon/AliDimuInfoStoreMC.cxx
o small fix
[u/mrichter/AliRoot.git] / PWG / muon / AliDimuInfoStoreMC.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 info of MC particles
21 //
22 // Author: X-M. Zhang, zhang@clermont.in2p3.fr
23 //                     zhangxm@iopp.ccnu.edu.cn
24 /////////////////////////////////////////////////////////////
25
26 #include "AliMuonInfoStoreMC.h"
27 #include "AliDimuInfoStoreRD.h"
28 #include "AliDimuInfoStoreMC.h"
29
30 ClassImp(AliDimuInfoStoreMC)
31
32 const TString AliDimuInfoStoreMC::fgkStdBranchName("DimuMC");
33 const Int_t   AliDimuInfoStoreMC::fgkSourcesN = 6;
34
35 //-----------------------------------------------------------------------------
36 AliDimuInfoStoreMC::AliDimuInfoStoreMC() :
37 AliDimuInfoStoreRD(),
38 fIsFull(kFALSE),
39 fLorentzP(),
40 fSource(-1)
41 {
42   //
43   // default constructor
44   //
45 }
46
47 //-----------------------------------------------------------------------------
48 AliDimuInfoStoreMC::AliDimuInfoStoreMC(AliMuonInfoStoreMC* const trk0, AliMuonInfoStoreMC* const trk1, UInt_t selMask, Bool_t full) :
49 AliDimuInfoStoreRD(),
50 fIsFull(full),
51 fLorentzP(),
52 fSource(-1)
53 {
54   //
55   // default constructor
56   //
57   fSelMask = selMask;
58   fMuonRef[0] = trk0;
59   fMuonRef[1] = trk1;
60   fLorentzP = trk0->LorentzP() + trk1->LorentzP();
61   AliDimuInfoStoreRD::FillDimuInfo();
62   if (fIsFull) this->FindDimuonSourceFull();
63   else this->FindDimuonSourceFast();
64 }
65
66 //-----------------------------------------------------------------------------
67 AliDimuInfoStoreMC::AliDimuInfoStoreMC(const AliDimuInfoStoreMC &src) :
68 AliDimuInfoStoreRD(src),
69 fIsFull(src.fIsFull),
70 fLorentzP(src.fLorentzP),
71 fSource(src.fSource)
72 {
73   //
74   // copy constructor
75   //
76 }
77
78 //-----------------------------------------------------------------------------
79 AliDimuInfoStoreMC& AliDimuInfoStoreMC::operator=(const AliDimuInfoStoreMC &src)
80 {
81   //
82   // assignment constructor
83   //
84   if(&src==this) return *this;
85
86   fIsFull   = src.fIsFull;
87   fLorentzP = src.fLorentzP;
88   fSource   = src.fSource;
89
90   return *this;
91 }
92
93
94 //-----------------------------------------------------------------------------
95 AliDimuInfoStoreMC::~AliDimuInfoStoreMC()
96 {
97   //
98   // destructor
99   //
100 }
101
102 //-----------------------------------------------------------------------------
103 void AliDimuInfoStoreMC::FindDimuonSourceFast()
104 {
105   // find corr relation of two particles (fast for p-p)
106
107   AliMuonInfoStoreMC *trk0 = (AliMuonInfoStoreMC*)fMuonRef[0].GetObject();
108   Int_t src0 = trk0->Source();
109   if (src0<0 || src0==4 || src0==3) {
110     fSource=5; return;
111   }
112
113   AliMuonInfoStoreMC *trk1 = (AliMuonInfoStoreMC*)fMuonRef[1].GetObject();
114   Int_t src1 = trk1->Source();
115   if (src1<0 || src1==4 || src1==3) {
116     fSource=5; return;
117   }
118
119   // Drell-Yan is expected very small at LHC, we ingore it
120   Int_t np0 = trk0->ParentsN() - 1;
121   if (np0<0) {
122     fSource=5; return;
123   }
124   Int_t np1 = trk1->ParentsN() - 1;
125   if (np1<0) {
126     fSource=5; return;
127   }
128
129   if (trk0->IsMotherAResonance(np0) &&
130       trk1->IsMotherAResonance(np1) &&
131       trk0->ParentIndex(np0)==trk1->ParentIndex(np1)) {
132     fSource=4; return;
133   }
134
135   if (src0==0 && src1==0) {
136     if ((trk0->ParentIndex(0))==(trk1->ParentIndex(0)))
137       fSource = 1;
138     else
139       fSource = 0;
140     return;
141   }
142
143   if (src0==1 && src1==1) {
144     if ((trk0->ParentIndex(0))==(trk1->ParentIndex(0)))
145       fSource = 3;
146     else
147       fSource = 2;
148     return;
149   }
150
151   fSource = 5;
152   return;
153 }