Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
#include "Examples/pbarpToOmegaPiLS/SpinDensityHistLS.hh"
#include <getopt.h>
#include <fstream>
#include <sstream>
#include <string>
#include "Examples/pbarpToOmegaPiLS/AbsOmegaPiLhLS.hh"
#include "Examples/pbarpToOmegaPiLS/AbsOmegaPiEventListLS.hh"
#include "TFile.h"
#include "TH1F.h"
#include "TH2F.h"
#include "TMath.h"
#include "ErrLogger/ErrLogger.hh"
#include <cstdlib>
SpinDensityHistLS::SpinDensityHistLS(const std::string &thePathToRootFile,
boost::shared_ptr<AbsOmegaPiLhLS> absOmegaPiLh,
OmegaPiDataLS::fitParamVal &theParamVal):
_numOfEvts(1000),
_omegaPiLh(absOmegaPiLh),
m_PathToRootFile(thePathToRootFile)
{
boost::shared_ptr<const AbsOmegaPiEventListLS> theEvtList=_omegaPiLh->getEventList();
m_EventData=theEvtList->getMcVecs();
m_pfitParamVal = &theParamVal;
_theTFile=new TFile(m_PathToRootFile.c_str(),"recreate");
_cosOmegaHeliMcHist= new TH1F("_cosOmegaHeliMcHist","cos(#Theta) #omega heli MC",101, -1.0, 1.0);
unsigned int counter=0;
std::vector<OmPiEvtDataLS*>::const_iterator it=m_EventData.begin();
while(it!=m_EventData.end())
{
if (counter>_numOfEvts) break;
_cosOmegaHeliMcHist->Fill((*it)->omegaHeliCm4Vec.CosTheta(), 1.0);
++it;
counter++;
}
}
SpinDensityHistLS::~SpinDensityHistLS()
{
_theTFile->Write();
_theTFile->Close();
}
void SpinDensityHistLS::createHistogram(int M, int M_)
{
std::stringstream strstreamTitle;
strstreamTitle << "#rho^{0}_{" << M << " " << M_ << "}";
std::stringstream strstreamName;
string strPrefixM1;
string strPrefixM2;
int Mn=0, Mn_=0;
if (M<0)
{
strPrefixM1="m";
Mn=abs(M);
}
else Mn=M;
if (M_<0)
{
strPrefixM2="m";
Mn_=abs(M_);
}
else Mn_=M_;
string strCohIncoh;
strCohIncoh="Incoh";
//Create spin density histogram with real part
strstreamName << "_" << strCohIncoh << "spinDensityDataHist_M1" << strPrefixM1 << Mn << "M2" << strPrefixM2 << Mn_;
TH1F* _spinDensityDataHist= new TH1F(strstreamName.str().c_str(),strstreamTitle.str().c_str(),101, -1.0, 1.0);
createSpinDensityHist(_spinDensityDataHist, M, M_, true);
//Create spin density histogram with imaginary part
strstreamName.str("");
strstreamName << "_" << "Imag" << strCohIncoh << "spinDensityDataHist_M1" << strPrefixM1 << Mn << "M2" << strPrefixM2 << Mn_;
TH1F* _spinDensityDataHistImag= new TH1F(strstreamName.str().c_str(),strstreamTitle.str().c_str(),101, -1.0, 1.0);
createSpinDensityHist(_spinDensityDataHistImag, M, M_, false);
_spinDensityDataHist->Divide(_cosOmegaHeliMcHist);
_spinDensityDataHistImag->Divide(_cosOmegaHeliMcHist);
DebugMsg << "calculation done for spin density matrix element rho" << M << M_ << endmsg;
}
void SpinDensityHistLS::createHistograms()
{
createHistogram(0,0);
createHistogram(1,0);
createHistogram(0,1);
createHistogram(-1,0);
createHistogram(0,-1);
createHistogram(1,1);
createHistogram(1,-1);
createHistogram(-1,1);
createHistogram(-1,-1);
}
void SpinDensityHistLS::AddData(TH1F* theHisto, const OmPiEvtDataLS& theEvtData, double dSpinDensity)
{
if (theHisto != 0)
{
theHisto->Fill(theEvtData.omegaHeliCm4Vec.CosTheta(), dSpinDensity);
}
}
/*!
\fn SpinDensityHist::createSpinDensityHist()
*/
void SpinDensityHistLS::createSpinDensityHist(TH1F* theHisto, int M, int M_,bool bReal)
{
std::vector<OmegaPiDataLS::OmPiEvtDataLS*>::const_iterator iterd;
complex<double> SpinDensity;
unsigned int counter=0;
boost::shared_ptr<const AbsOmegaPiEventListLS> theEvtList=_omegaPiLh->getEventList();
std::vector<OmegaPiDataLS::OmPiEvtDataLS*> theData=theEvtList->getMcVecs();
// for (iterd=m_EventData.begin(); iterd!=m_EventData.end(); ++iterd)
for (iterd=theData.begin(); iterd!=theData.end(); ++iterd)
{
if (counter>_numOfEvts) continue;
SpinDensity=_omegaPiLh->spinDensity(M, M_ , (*iterd), (*m_pfitParamVal));
// SpinDensity=_omegaPiLh->spinDensityOmegaFrame(M, M_ , (*iterd), (*m_pfitParamVal));
if (bReal) AddData(theHisto, *(*iterd), SpinDensity.real());
else AddData(theHisto, *(*iterd), SpinDensity.imag());
counter++;
}
}