18 CanvasName.push_back(
static_cast<string>(
"Most Probable Value of Q0 vs TOF counter Number (Barrel part)") );
19 CanvasName.push_back(
static_cast<string>(
"Sigma of Q0 vs TOF Counter Number (Barrel part)") );
23 m_name = string(
"calib_barrel_q0");
28 numGraphs = numGraphs + (*iter);
31 cout <<
"tofcalgsec::calib_barrel_q0: the number of Graphs is NOT reasonable!!!" << endl;
36 const double qbegin = 0.0;
37 const double qend = 5000.0;
41 for(
unsigned int i=0; i<
NBarrel; i++ ) {
44 sprintf( hname,
"Q0-tofid-%i", i );
45 m_histograms.push_back(
new TH1F( hname, hname, qbin, qbegin, qend ) );
47 m_fitresult.push_back( HepVector(
nParQ0,0) );
53 for(
unsigned int i=0; i<
NBarrel; i++ ) {
69 std::cout << setiosflags(ios::left) << setw(10) << icounter << setw(8) <<
data->size() << setw(30) <<
name() << std::endl;
71 if(
data->size() > 0 ) {
72 std::vector<Record*>::iterator
iter =
data->begin();
74 fillRecord( (*
iter), icounter );
77 fitHistogram( icounter );
88void calib_barrel_q0::fillRecord(
const Record* r,
unsigned int icounter ) {
90 (*iter)->Fill( r->
q0() );
95void calib_barrel_q0::fitHistogram(
unsigned int icounter ) {
96 TF1* ld =
new TF1(
"ld",
"landau");
100 std::vector<TH1F*>::iterator iter1 =
m_histograms.begin() + icounter;
101 std::vector<HepVector>::iterator iter2 = m_fitresult.begin() + icounter;
102 (*iter1)->Fit( ld,
"Q");
103 (*iter2)[0] = ld->GetParameter(1);
104 (*iter2)[1] = ld->GetParError(1);
105 (*iter2)[2] = ld->GetParameter(2);
106 (*iter2)[3] = ld->GetParError(2);
112void calib_barrel_q0::fillGraph() {
114 std::vector<double> qmean, qmeanerr;
115 std::vector<double> qsig, qsigerr;
121 std::vector<HepVector>::iterator
iter = m_fitresult.begin();
123 qmean[i] = (*iter)[0];
124 qmeanerr[i] = (*iter)[1];
125 qsig[i] = (*iter)[2];
126 qsigerr[i] = (*iter)[3];
129 TGraphErrors* graph1 =
new TGraphErrors(
NBarrel, &itofid[0], &qmean[0], &itofiderr[0], &qmeanerr[0]);
131 graph1->SetMarkerSize(1.5);
132 graph1->SetMarkerStyle(20);
133 graph1->SetMarkerColor(2);
136 TGraphErrors* graph2 =
new TGraphErrors(
NBarrel, &itofid[0], &qsig[0], &itofiderr[0], &qsigerr[0]);
138 graph2->SetMarkerSize(1.5);
139 graph2->SetMarkerStyle(20);
140 graph2->SetMarkerColor(4);
147void calib_barrel_q0::fitGraph() {
148 unsigned int number = 0;
149 std::vector<HepVector>::iterator iter1 =
m_result.begin();
150 std::vector<HepVector>::iterator iter2 = m_fitresult.begin();
151 for( ; iter1!=
m_result.end(); iter1++, number++ ) {
152 (*iter1)[0] = (*(iter2+number))[0]/ (*iter2)[0];
153 (*iter1)[1] = (*(iter2+number))[0];
154 (*iter1)[2] = (*(iter2+number))[2];
std::vector< Record * > RecordSet
const unsigned int NBarrel
std::vector< HepVector > m_result
std::vector< TH1F * > m_histograms
unsigned int nBinPerCounter
std::vector< TGraphErrors * > m_graphs
unsigned int nCanvasPerCounter
unsigned int nHistPerCounter
const string & name() const
std::vector< unsigned int > nGraphPerCanvas
std::vector< string > CanvasName
void calculate(RecordSet *&data, unsigned int icounter)