StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StHbtThCFGaussSize.cxx
1 /***************************************************************************
2  *
3  *
4  *
5  * Author: Laurent Conin, Fabrice Retiere, Subatech, France
6  ***************************************************************************
7  *
8  * Description : Implementation of StHbtThCFGaussSize
9  *
10  ***************************************************************************
11  *
12  *
13  *
14  ***************************************************************************/
15 
16 #include "StHbtMaker/ThCorrFctn/StHbtThCFGaussSize.h"
17 #include "StHbtMaker/ThCorrFctn/StHbtThCorrFctnCollection.hh"
18 #include "StHbtMaker/Base/StHbtThCorrFctn.hh"
19 #include "StHbtMaker/Base/StHbtThPair.hh"
20 #include "StHbtMaker/Base/StHbtRoot1DCF.hh"
21 
22 #include <string.h>
23 #include <Stsstream.h>
24 
25 StHbtThCFGaussSize::StHbtThCFGaussSize()
26 {cout << "default constructor - must not be called "<<endl ; exit(0);}
27 
28 StHbtThCFGaussSize::StHbtThCFGaussSize( const char* aName, double aX, double aY,double aZ, double aT) : mSizeX(aX), mSizeY(aY), mSizeZ(aZ), mTime(aT) {
29 mName=new char[strlen(aName)+1];
30 strcpy(mName,aName);
31 }
32 
33 StHbtThCFGaussSize::~StHbtThCFGaussSize()
34 { delete mName;};
35 
36 StHbtThCFGaussSize* StHbtThCFGaussSize::Copy( const char* aName, double aX, double aY,double aZ, double aT) {
37  StHbtThCFGaussSize* NewSize=new StHbtThCFGaussSize(aName,aX,aY,aZ,aT);
38  if (mThCorrFctnColl.size()>0) {
39  StHbtThCorrFctnIterator iter;
40  for (iter=mThCorrFctnColl.begin(); iter!=mThCorrFctnColl.end();iter++){
41  int tBaseNameLen=strlen((*iter)->GetName())-strlen(mName);
42  char* tCFName=new char[tBaseNameLen+strlen(aName)+1];
43  memcpy(tCFName,(*iter)->GetName(),tBaseNameLen);
44  strcpy(tCFName+tBaseNameLen,aName);
45  StHbtThCorrFctn *NewCF=(*iter)->ThClone();
46  NewCF->SetName(tCFName);
47  delete [] tCFName;
48  NewSize->mThCorrFctnColl.push_back(NewCF);
49  };
50  };
51  return NewSize;
52 };
53 
54 void StHbtThCFGaussSize::AddCorrFctn(const StHbtThCorrFctn* aCF){
55 
56  StHbtThCorrFctn* NewCF=aCF->ThClone();
57  char* tName=new char[strlen(aCF->GetName())+strlen(mName)+1];
58  strcpy(tName, aCF->GetName());
59  strcat(tName,mName);
60  NewCF->SetName(tName);
61  delete [] tName;
62  mThCorrFctnColl.push_back(NewCF);
63 }
64 
65 void StHbtThCFGaussSize::FillPair(StHbtThPair* aThPair ){
66  StHbtThCorrFctnIterator iter;
67  for (iter=mThCorrFctnColl.begin(); iter!=mThCorrFctnColl.end();iter++){
68  (*iter)->AddNum(aThPair);
69  (*iter)->AddDen(aThPair);
70  };
71 }
72 
73 void StHbtThCFGaussSize::Finish() {
74  if (mThCorrFctnColl.size()>0) {
75  StHbtThCorrFctnIterator iter;
76  for (iter=mThCorrFctnColl.begin(); iter!=mThCorrFctnColl.end();iter++){
77  (*iter)->Finish();
78  }
79  }
80 }
81 
82 StHbtString StHbtThCFGaussSize::Report() {
83  std::ostringstream tStr;
84  tStr << "Gaussian Size Report - Size=(X="<< mSizeX <<"Y="<< mSizeY
85  <<"Z="<< mSizeZ<< "T="<< mTime << ")" << endl;
86  tStr << mThCorrFctnColl.size() << " Correlation Function Plugged " << endl;
87  if (mThCorrFctnColl.size()>0) {
88  StHbtThCorrFctnIterator iter;
89  for (iter=mThCorrFctnColl.begin(); iter!=mThCorrFctnColl.end();iter++){
90  tStr << (*iter)->Report() << endl;
91  }
92  }
93  StHbtString returnThis = tStr.str();
94  return returnThis;
95 }
96 
97 inline double StHbtThCFGaussSize::GetSizeX() const {return mSizeX;};
98 inline double StHbtThCFGaussSize::GetSizeY() const {return mSizeY;};
99 inline double StHbtThCFGaussSize::GetSizeZ() const {return mSizeZ;};
100 inline double StHbtThCFGaussSize::GetTime() const {return mTime;};
101