13 CanvasName.push_back(
static_cast<string>(
"Offset-bunch0") );
14 CanvasName.push_back(
static_cast<string>(
"Offset-bunch1") );
15 CanvasName.push_back(
static_cast<string>(
"Offset-bunch2") );
16 CanvasName.push_back(
static_cast<string>(
"Offset-bunch3") );
17 CanvasName.push_back(
static_cast<string>(
"Sigma-bunch0") );
18 CanvasName.push_back(
static_cast<string>(
"Sigma-bunch1") );
19 CanvasName.push_back(
static_cast<string>(
"Sigma-bunch2") );
20 CanvasName.push_back(
static_cast<string>(
"Sigma-bunch3") );
34 numGraphs = numGraphs + (*iter);
37 cout <<
"tofcalgsec::calib_barrel_common: the number of Graphs is NOT reasonable!!!" << endl;
41 m_name = string(
"calib_etf_bunch");
44 const double tbegin = -0.8;
45 const double tend = 0.8;
49 for(
unsigned int j=0; j<4; j++ ) {
51 if( k==0 ) {
sprintf( hname,
"tleft-bunch%i", j); }
52 else if( k==1 ) {
sprintf( hname,
"tright-bunch%i", j); }
53 else if( k==2 ) {
sprintf( hname,
"tcombine-bunch%i", j); }
55 m_histograms.push_back(
new TH1F( hname, hname, tbin, tbegin, tend ) );
80 std::cout << setiosflags(ios::left) << setw(10) << icounter << setw(8) <<
data->size() << setw(30) <<
name() << std::endl;
82 if(
data->size() > 0 ) {
83 std::vector<Record*>::iterator
iter =
data->begin();
85 fillRecord( (*
iter) );
99void calib_etf_bunch::fillRecord(
const Record* r ) {
100 double t0 = r->
phi();
101 int ibunch =
static_cast<int>(t0/(12000./499.8/
nKind)+0.1)%
nKind;
102 if( ibunch<0 || ibunch>
int(
nKind) )
return;
113void calib_etf_bunch::fitHistogram() {
114 TF1* g =
new TF1(
"g",
"gaus");
118 std::vector<TH1F*>::iterator iter1 =
m_histograms.begin();
119 std::vector<HepVector>::iterator iter2 = m_fitresult.begin();
121 (*iter1)->Fit( g,
"Q");
122 (*iter2)[0] = g->GetParameter(1);
123 (*iter2)[1] = g->GetParError(1);
124 (*iter2)[2] = g->GetParameter(2);
125 (*iter2)[3] = g->GetParError(2);
132void calib_etf_bunch::fillGraph() {
134 char gname1[256], gname2[256];
148 std::vector<double> toffset, toffseterr;
149 std::vector<double> tsigma, tsigmaerr;
155 unsigned int number = 0;
156 std::vector<HepVector>::iterator
iter = m_fitresult.begin();
157 for(
unsigned int j=0; j<4; j++ ) {
158 sprintf( gname1,
"bunch%i-offset", j );
159 sprintf( gname2,
"bunch%i-sigma", j );
166 toffset[k] = (*(
iter+number))[0];
167 toffseterr[k] = (*(
iter+number))[1];
168 tsigma[k] = (*(
iter+number))[2];
169 tsigmaerr[k] = (*(
iter+number))[3];
170 gra[j]->SetBinContent( k+1, toffset[k] );
171 gra[j]->SetBinError( k+1, toffseterr[k] );
172 gra[j+4]->SetBinContent( k+1, tsigma[k] );
173 gra[j+4]->SetBinError( k+1, tsigmaerr[k] );
178 gra[j]->SetMarkerSize(1.5);
179 gra[j]->SetMarkerStyle(20);
180 gra[j]->SetMarkerColor(2);
183 gra[j+1]->SetMarkerSize(1.5);
184 gra[j+1]->SetMarkerStyle(21);
185 gra[j+1]->SetMarkerColor(4);
193void calib_etf_bunch::fitGraph() {
194 TF1* p0 =
new TF1(
"p0",
"pol0");
198 X = HepVector( 2, 0 );
201 (*(
iter+i))->Fit(
"p0",
"Q" );
202 X[0] = p0->GetParameter(0);
203 X[1] = p0->GetParError(0);
sprintf(cut,"kal_costheta0_em>-0.93&&kal_costheta0_em<0.93&&kal_pxy0_em>=0.05+%d*0.1&&kal_pxy0_em<0.15+%d*0.1&&NGch>=2", j, j)
std::vector< Record * > RecordSet
const unsigned int NStrip
const int nGraphTotalBunch
std::vector< HepVector > m_result
std::vector< TH1F * > m_histograms
unsigned int nBinPerCounter
unsigned int nCanvasPerCounter
unsigned int nHistPerCounter
const string & name() const
std::vector< unsigned int > nGraphPerCanvas
std::vector< string > CanvasName
std::vector< TH1F * > m_graphs
void calculate(RecordSet *&data, unsigned int ibunch)
calib_etf_bunch(const unsigned int nbunch)