Initial check-in of the model classes
[u/mrichter/AliRoot.git] / PWG2 / FEMTOSCOPY / AliFemto / Model / 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   // Return femtoscopic weight for a fiven pair
72   if (fCreateCopyHiddenInfo) {
73     if (!(aPair->track1()->HiddenInfo())) {
74       AliFemtoModelHiddenInfo *inf1 = new AliFemtoModelHiddenInfo();
75       inf1->SetTrueMomentum(aPair->track1()->Track()->P());
76       inf1->SetMass(0.13957);
77       aPair->track1()->SetHiddenInfo(inf1);
78       delete inf1;
79     }
80     if (!(aPair->track2()->HiddenInfo())) {
81       AliFemtoModelHiddenInfo *inf2 = new AliFemtoModelHiddenInfo();
82       inf2->SetTrueMomentum(aPair->track2()->Track()->P());
83       inf2->SetMass(0.13957);
84       aPair->track2()->SetHiddenInfo(inf2);
85       delete inf2;
86     }
87   }
88
89   if (fFreezeOutGenerator) {
90     fFreezeOutGenerator->GenerateFreezeOut(aPair);
91   }
92   return fWeightGenerator->GenerateWeight(aPair);
93 }
94 //_____________________________________________
95 void AliFemtoModelManager::CreateCopyHiddenInfo()
96 {
97   fCreateCopyHiddenInfo = kTRUE;
98 }
99 //_____________________________________________
100 AliFemtoModelFreezeOutGenerator* AliFemtoModelManager::GetFreezeOutGenerator()
101 {
102   return fFreezeOutGenerator;
103 }
104 //_____________________________________________
105 AliFemtoModelWeightGenerator*    AliFemtoModelManager::GetWeightGenerator()
106 {
107   return fWeightGenerator;
108 }