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