c5c81eb3a2b29f0c84498539e24836bde2f944bb
[u/mrichter/AliRoot.git] / PWG2 / FEMTOSCOPY / AliFemto / AliFemtoModelManager.cxx
1 ////////////////////////////////////////////////////////////////////////////////
2 ///                                                                          ///
3 /// AliFemtoModelManager - main helper class for femtoscopy calculations     ///
4 /// Manages weight generation, freeze-out coordinates generation             ///
5 /// Authors: Adam Kisiel kisiel@mps.ohio-state.edu                           ///
6 ///                                                                          ///
7 ////////////////////////////////////////////////////////////////////////////////
8 #ifdef __ROOT__
9   ClassImp(AliFemtoModelManager, 1)
10 #endif
11
12 #include "AliFemtoModelManager.h"
13 #include "AliFemtoModelHiddenInfo.h"
14
15 //_____________________________________________
16 AliFemtoModelManager::AliFemtoModelManager():
17   fFreezeOutGenerator(0),
18   fWeightGenerator(0),
19   fCreateCopyHiddenInfo(kFALSE)
20 {
21 }
22 //_____________________________________________
23 AliFemtoModelManager::AliFemtoModelManager(const AliFemtoModelManager& aManager):
24   fFreezeOutGenerator(0),
25   fWeightGenerator(0),
26   fCreateCopyHiddenInfo(aManager.fCreateCopyHiddenInfo)
27 {
28   if (aManager.fFreezeOutGenerator) {
29     fFreezeOutGenerator = aManager.fFreezeOutGenerator->Clone();
30   }
31   if (aManager.fWeightGenerator) {
32     fWeightGenerator = aManager.fWeightGenerator->Clone();
33   }
34 }
35 //_____________________________________________
36 AliFemtoModelManager::~AliFemtoModelManager()
37 {
38   if (fFreezeOutGenerator) delete fFreezeOutGenerator;
39   if (fWeightGenerator) delete fWeightGenerator;
40 }
41 //_____________________________________________
42 AliFemtoModelManager& AliFemtoModelManager::operator=(const AliFemtoModelManager& aManager)
43 {
44   if (this == &aManager)
45     return *this;
46   if (aManager.fFreezeOutGenerator) {
47     fFreezeOutGenerator = aManager.fFreezeOutGenerator->Clone();
48   }
49   else fFreezeOutGenerator = 0;
50   if (aManager.fWeightGenerator) {
51     fWeightGenerator = aManager.fWeightGenerator->Clone();
52   }
53   else fWeightGenerator = 0;
54   fCreateCopyHiddenInfo = aManager.fCreateCopyHiddenInfo;
55   
56   return *this;
57 }
58 //_____________________________________________
59 void AliFemtoModelManager::AcceptFreezeOutGenerator(AliFemtoModelFreezeOutGenerator *aFreeze)
60 {
61   fFreezeOutGenerator = aFreeze;
62 }
63 //_____________________________________________
64 void AliFemtoModelManager::AcceptWeightGenerator(AliFemtoModelWeightGenerator *aWeight)
65 {
66   fWeightGenerator = aWeight;
67 }
68 //_____________________________________________
69 Double_t AliFemtoModelManager::GetWeight(AliFemtoPair *aPair)
70 {
71   if (!fWeightGenerator) {
72     cout << "No weight generator set! Cannot calculate weight" << endl;
73     exit(0);
74   }
75   // Return femtoscopic weight for a fiven pair
76   if (fCreateCopyHiddenInfo) {
77     // Try to gess particle masses and pid from the weight generator
78     Double_t tMass1, tMass2;
79     Int_t tPid1, tPid2;
80     if (fWeightGenerator->GetPairType() == AliFemtoModelWeightGenerator::fgkPionPlusPionPlus) {
81       tMass1 = 0.13957;
82       tMass2 = 0.13957;
83       tPid1 = 211;
84       tPid2 = 211;
85     }
86     if (fWeightGenerator->GetPairType() == AliFemtoModelWeightGenerator::fgkPionPlusPionMinus) {
87       tMass1 = 0.13957;
88       tMass2 = 0.13957;
89       tPid1 = 211;
90       tPid2 = -211;
91     }
92     if (fWeightGenerator->GetPairType() == AliFemtoModelWeightGenerator::fgkKaonPlusKaonPlus) {
93       tMass1 = 0.493677;
94       tMass2 = 0.493677;
95       tPid1 = 321;
96       tPid2 = 321;
97     }
98     if (fWeightGenerator->GetPairType() == AliFemtoModelWeightGenerator::fgkKaonPlusKaonMinus) {
99       tMass1 = 0.493677;
100       tMass2 = 0.493677;
101       tPid1 = 321;
102       tPid2 = -321;
103     }
104     if (fWeightGenerator->GetPairType() == AliFemtoModelWeightGenerator::fgkProtonProton) {
105       tMass1 = 0.938272;
106       tMass2 = 0.938272;
107       tPid1 = 2212;
108       tPid2 = 2212;
109     }
110     if (fWeightGenerator->GetPairType() == AliFemtoModelWeightGenerator::fgkProtonAntiproton) {
111       tMass1 = 0.938272;
112       tMass2 = 0.938272;
113       tPid1 = 2212;
114       tPid2 = -2212;
115     }
116     if (fWeightGenerator->GetPairType() == AliFemtoModelWeightGenerator::fgkPionPlusKaonPlus) {
117       tMass1 = 0.13957;
118       tMass2 = 0.493677;
119       tPid1 = 211;
120       tPid2 = 321;
121     }
122     if (fWeightGenerator->GetPairType() == AliFemtoModelWeightGenerator::fgkPionPlusKaonMinus) {
123       tMass1 = 0.13957;
124       tMass2 = 0.493677;
125       tPid1 = 211;
126       tPid2 = -321;
127     }
128     if (fWeightGenerator->GetPairType() == AliFemtoModelWeightGenerator::fgkPionPlusProton) {
129       tMass1 = 0.13957;
130       tMass2 = 0.938272;
131       tPid1 = 211;
132       tPid2 = 2212;
133     }
134     if (fWeightGenerator->GetPairType() == AliFemtoModelWeightGenerator::fgkPionPlusAntiproton) {
135       tMass1 = 0.13957;
136       tMass2 = 0.938272;
137       tPid1 = 211;
138       tPid2 = -2212;
139     }
140     if (fWeightGenerator->GetPairType() == AliFemtoModelWeightGenerator::fgkKaonPlusProton) {
141       tMass1 = 0.493677;
142       tMass2 = 0.938272;
143       tPid1 = 321;
144       tPid2 = 2212;
145     }
146     if (fWeightGenerator->GetPairType() == AliFemtoModelWeightGenerator::fgkKaonPlusAntiproton) {
147       tMass1 = 0.493677;
148       tMass2 = 0.938272;
149       tPid1 = 321;
150       tPid2 = -2212;
151     }
152
153     if (!(aPair->Track1()->HiddenInfo())) {
154       AliFemtoModelHiddenInfo *inf1 = new AliFemtoModelHiddenInfo();
155       inf1->SetTrueMomentum(aPair->Track1()->Track()->P());
156       inf1->SetMass(tMass1);
157       inf1->SetPDGPid(tPid1);
158       aPair->Track1()->SetHiddenInfo(inf1);
159       delete inf1;
160     }
161     if (!(aPair->Track2()->HiddenInfo())) {
162       AliFemtoModelHiddenInfo *inf2 = new AliFemtoModelHiddenInfo();
163       inf2->SetTrueMomentum(aPair->Track2()->Track()->P());
164       inf2->SetMass(tMass2);
165       inf2->SetPDGPid(tPid2);
166       aPair->Track2()->SetHiddenInfo(inf2);
167       delete inf2;
168     }
169   }
170
171   if (fFreezeOutGenerator) {
172     fFreezeOutGenerator->GenerateFreezeOut(aPair);
173   }
174   return fWeightGenerator->GenerateWeight(aPair);
175 }
176 //_____________________________________________
177 void AliFemtoModelManager::CreateCopyHiddenInfo()
178 {
179   fCreateCopyHiddenInfo = kTRUE;
180 }
181 //_____________________________________________
182 AliFemtoModelFreezeOutGenerator* AliFemtoModelManager::GetFreezeOutGenerator()
183 {
184   return fFreezeOutGenerator;
185 }
186 //_____________________________________________
187 AliFemtoModelWeightGenerator*    AliFemtoModelManager::GetWeightGenerator()
188 {
189   return fWeightGenerator;
190 }