StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StHbtThCFGaussFit.cxx
1 /***************************************************************************
2  *
3  *
4  *
5  * Author: Laurent Conin, Fabrice Retiere, Subatech, France
6  ***************************************************************************
7  *
8  * Description :implementation of StHbtThCFGaussFit
9  *
10  ***************************************************************************
11  *
12  *
13  *
14  ***************************************************************************/
15 
16 #include "StHbtMaker/ThCorrFctn/StHbtThCFGaussFit.h"
17 
18 #include "StHbtMaker/ThCorrFctn/StHbtThCFGaussSizeCollection.hh"
19 #include "StHbtMaker/ThCorrFctn/StHbtThCFGaussSize.h"
20 #include "StHbtMaker/Base/StHbtThCorrFctn.hh"
21 #include "StHbtMaker/Infrastructure/StHbtPair.hh"
22 #include "StHbtMaker/Infrastructure/StHbtTypes.hh"
23 
24 #include "TRandom.h"
25 #include <Stsstream.h>
26 
27 #ifdef __ROOT__
28  ClassImp(StHbtThCFGaussFit)
29 #endif
30 
31 StHbtThCFGaussFit::StHbtThCFGaussFit():
32  mMaxX(0), mMaxY(0), mMaxZ(0), mMaxT(0)
33 { /* no-op */ };
34 
35 StHbtThCFGaussFit::~StHbtThCFGaussFit()
36 { /* no-op */ } ;
37 
38 void StHbtThCFGaussFit::AddCorrFctn(const StHbtThCorrFctn *aCF){
39  if (mSizeColl.size()<=0) {
40  cout << "StHbtThCFGaussFit - At Least One Gaussian Size must be plugged before " << endl;
41  cout << " StHbtThCFGaussFit - Warning - " << aCF->GetName() << " has NOT been added " << endl;
42  }
43  StHbtThCFGaussSizeIterator iter;
44  for (iter=mSizeColl.begin(); iter!=mSizeColl.end();iter++){
45  (*iter)->AddCorrFctn(aCF);
46  }
47 }
48 
49 void StHbtThCFGaussFit::AddSize(const char* aName, double aX, double aY, double aZ, double aT){
50  if (aX>mMaxX) { mMaxX=aX;mPair.SetSize(mMaxX,mMaxY,mMaxZ,mMaxT);};
51  if (aY>mMaxY) { mMaxY=aY;mPair.SetSize(mMaxX,mMaxY,mMaxZ,mMaxT);};
52  if (aZ>mMaxZ) { mMaxZ=aZ;mPair.SetSize(mMaxX,mMaxY,mMaxZ,mMaxT);};
53  if (aT>mMaxT) { mMaxT=aT;mPair.SetSize(mMaxX,mMaxY,mMaxZ,mMaxT);};
54  if (mSizeColl.size()>0) {
55  StHbtThCFGaussSize* tFirstSize=(*(mSizeColl.begin()));
56  mSizeColl.push_back(tFirstSize->Copy(aName,aX,aY,aZ,aT));
57  } else {
58  mSizeColl.push_back(new StHbtThCFGaussSize(aName,aX,aY,aZ,aT));
59  };
60 };
61 
62 void StHbtThCFGaussFit::AddRealPair( const StHbtPair* aPair) {};
63 
64 void StHbtThCFGaussFit::AddMixedPair( const StHbtPair* aPair) {
65  if (mSizeColl.size()>0) {
66  mPair.Set(aPair);
67  double tProb=mRand.Rndm(); if(tProb){/*nothing*/};
68  StHbtThCFGaussSizeIterator iter;
69  for (iter=mSizeColl.begin(); iter!=mSizeColl.end();iter++){
70  // if (mPair.GetRejectionProb2Size((*iter)->GetSizeX(),(*iter)->GetSizeY(),
71  // (*iter)->GetSizeZ(),(*iter)->GetTime())>tProb)
72  (*iter)->FillPair(&mPair);
73  }
74  }
75 }
76 
77 
78 void StHbtThCFGaussFit::Finish() {
79  if (mSizeColl.size()>0) {
80  StHbtThCFGaussSizeIterator iter;
81  for (iter=mSizeColl.begin(); iter!=mSizeColl.end();iter++){
82  (*iter)->Finish();
83  }
84  }
85 }
86 
87 StHbtString StHbtThCFGaussFit::Report() {
88  std::ostringstream tStr;
89  tStr << "Correlation - Gaussian Fit Manager Report" << endl;
90  tStr << mPair.Report() ;
91 
92  tStr << mSizeColl.size() << " Sizes defined " << endl;
93 
94  if (mSizeColl.size()>0) {
95  StHbtThCFGaussSizeIterator iter;
96  for (iter=mSizeColl.begin(); iter!=mSizeColl.end();iter++){
97  tStr << (*iter)->Report() << endl;
98  }
99  }
100  StHbtString returnThis = tStr.str();
101  return returnThis;
102 }
103 
104 inline void StHbtThCFGaussFit::SetWeight(StHbtFsiWeight* aWeight) {mPair.SetWeight(aWeight);};
105 inline void StHbtThCFGaussFit::UseHiddenMomentum() {mPair.UseHiddenMomentum();};
106 inline void StHbtThCFGaussFit::UseParticleMomentum() {mPair.UseParticleMomentum();};
107 
108 inline void StHbtThCFGaussFit::UseHiddenPid() {mPair.UseHiddenPid();};
109 inline void StHbtThCFGaussFit::UseFixedPid( int const tPid1, double const tMass1)
110 {mPair.UseFixedPid( tPid1, tMass1) ;};
111 inline void StHbtThCFGaussFit::UseFixedPid( int const tPid1,double const tMass1, int const tPid2,double const tMass2 )
112 {mPair.UseFixedPid(tPid1, tMass1, tPid2, tMass2 );};
113 
114 inline void StHbtThCFGaussFit::SetBoostRCMS(double aPlab,double aMBeam, double aMTarget)
115  {mPair.SetBoostRCMS(aPlab,aMBeam, aMTarget);};
116 inline void StHbtThCFGaussFit::SetRCMS() {mPair.SetRCMS();};
117 inline void StHbtThCFGaussFit::SetLCMS() {mPair.SetLCMS();};
118 inline void StHbtThCFGaussFit::SetPRF() {mPair.SetPRF();};
119 
120 inline void StHbtThCFGaussFit::AddSize(const char* aName, double aXYZ, double aT){
121  AddSize(aName,aXYZ,aXYZ,aXYZ,aT);};
122 
123 inline StHbtThCFGaussSizeCollection *StHbtThCFGaussFit::getCollection() { return &mSizeColl; }