16 using namespace TMath;
41 string fname =
"TimingFile" + nrun +
"_" +
name +
".txt";
43 if(FileEmptyCheck(
fname))
45 std::cout<<
" +++++ The file:" <<
fname <<
" is empty, time-fit will not be performed +++"<<std::endl;
51 for(
uint i = 0;
i < m_interface->nChannels();
i++ ){
52 if(
i%10000 == 0 ) cout <<
"Processing entry " <<
i << endl;
53 if( m_interface->historySize(
i) == 0 )
continue;
54 const History* history = m_interface->cellHistory(
i);
55 if( !history )
continue;
61 if( caloPart > 0 )
det = 1;
62 if( caloPart < 0 )
det = 0;
68 for(
uint j = 0; j < history->
nData(); j++ ){
72 if( history->
data(j)->
problems(
true) !=
"None" )
continue;
76 if( fabs( history->
data(j)->
ofcTime() ) > 20.00 )
continue;
86 if(
name ==
"EMB" ) detec = 0;
87 else if(
name ==
"EMEC" ) detec = 1;
88 else if(
name ==
"HEC" ) detec = 2;
89 else if(
name ==
"FCAL" ) detec = 3;
90 file << detec <<
" " <<
det <<
" " <<
ft <<
" " << slot <<
" " <<
t <<
" "<<
e << endl;
104 return file.peek() == std::ifstream::traits_type::eof();
112 for(
int d = 0;
d < 2;
d++ ){
113 for(
int ft = 0;
ft < 32;
ft++ ){
114 for(
int sl = 0; sl < 15; sl++ )
115 Median[
d][
ft][sl] = -99.;
119 TH1F *timefeb[2][32][16];
120 TF1 *fit1 =
new TF1(
"fit1" ,
"gaus" , 3 );
122 double Hist_entries, Fit_mean, Fit_sigma, Fit_error;
124 std::vector< std::vector<double> > myvec;
126 tfilename =
"TimingFile" + nrun +
"_" +
name +
".txt";
128 if(FileEmptyCheck(tfilename))
130 std::cout<<
" +++++ The file:" << tfilename <<
" is empty, time-fit will not be performed +++"<<std::endl;
134 myvec = readTimingFiles(tfilename);
136 string Filename =
"OFCTime_PerFEB_" +
name +
".root";
137 TFile *FebTime =
new TFile( Filename.c_str(),
"READ");
139 double median2, TotalE = 0.0;
140 int dete = -1,
side, feedT, slot;
142 std::vector<double> myvector;
143 std::vector<double> myvector2;
144 std::vector<double>
energy;
147 string ffname =
"mediantest_" + nrun +
"_" +
name +
".txt";
150 for(
uint l = 0;
l < (myvec.size() -1);
l++ ){
151 float mean = myvec[
l][4];
152 double E = myvec[
l][5];
153 myvector.push_back(
mean);
154 myvector2.push_back(
mean);
158 if( ( myvec[
l][3] != myvec[
l+1][3] ) || (
l == myvec.size()-2 ) ){
160 median2 = getTimeWeightedMedian(myvector, myvector2,
energy, TotalE);
166 feedT =
int(myvec[
l][2]);
167 slot =
int(myvec[
l][3]);
168 if(
name ==
"EMB" ) dete = 0;
169 else if(
name ==
"EMEC" ) dete = 1;
170 else if(
name ==
"HEC" ) dete = 2;
171 else if(
name ==
"FCAL" ) dete = 3;
172 ff << dete <<
" " <<
side <<
" " << feedT <<
" " << slot <<
" " << median2 << endl;
173 Median[
side][feedT][slot] = median2;
177 string savename =
"FEB_time_fitMean_" + nrun +
"_" +
name +
".txt";
183 std::vector<double> timevector;
187 else if(
name ==
"EMEC" )
det = 1;
188 else if(
name ==
"HEC" )
det = 2;
189 else if(
name ==
"FCAL" )
det = 3;
191 for(
int d = 0;
d < 2;
d++ ){
192 for(
int ft = 0;
ft < 32;
ft++ ){
193 for(
int sl = 0; sl < 15; sl++ ){
198 if( !timefeb[
d][
ft][sl+1] )
201 Hist_entries = timefeb[
d][
ft][sl+1]->GetEntries();
203 if( Hist_entries == 0 )
continue;
205 timefeb[
d][
ft][sl+1]->Fit(
"fit1",
"mE",
"N",-10, 10 );
209 rms = fit1->GetParameter(2);
210 double n1 = -99., n2 = -99.;
211 rmsDist=timefeb[
d][
ft][sl+1]->GetRMS();
213 max = timefeb[
d][
ft][sl+1]->GetXaxis()->GetBinCenter(timefeb[
d][
ft][sl+1]->GetMaximumBin());
215 if(
name ==
"FCAL" )
n1 = n2 = 0.8;
216 else if(
name ==
"EMEC" ){
217 if( sl+1 == 13 && rmsDist > 3.0 ){
220 else if( rmsDist > 3. && sl+1 > 13 ){
223 else if( sl+1 == 9 && (
ft == 2 ||
ft == 9 ||
ft == 15 ||
ft == 21 ) )
225 else if( ( sl+1 == 8 || sl+1 == 9 ) && rmsDist > 3.0 )
227 else if( sl+1 == 8 &&
ft == 13 )
232 else if(
name ==
"HEC" )
n1 = n2 = 1.5;
234 if( sl+1 == 9 || sl+1 == 10 ){
237 else if( sl+1 >= 2 && sl+1 < 6 ){
240 else if( sl+1 == 14 ){
248 Fit_mean = fit1->GetParameter(1);
249 Fit_sigma = fit1->GetParameter(2);
250 Fit_error = fit1->GetParError(1);
252 median_error = 1.253*timefeb[
d][
ft][sl+1]->GetRMS()/sqrt(Hist_entries);
255 if( Hist_entries <= 50 ){
256 file <<
det <<
" " <<
d <<
" " <<
ft <<
" " << sl+1 <<
" " << Median[
d][
ft][sl+1] <<
" " << median_error << endl;
258 else if( gMinuit->fCstatu ==
"SUCCESSFUL" && Fit_error >= Fit_mean && Fit_sigma > 1.5*rmsDist ){
259 file <<
det <<
" " <<
d <<
" " <<
ft <<
" " << sl+1 <<
" " << Median[
d][
ft][sl+1] <<
" " << median_error << endl;
261 else if( gMinuit->fCstatu !=
"SUCCESSFUL" ){
262 file <<
det <<
" " <<
d <<
" " <<
ft <<
" " << sl+1 <<
" " << Median[
d][
ft][sl+1] <<
" " << median_error << endl;
265 file <<
det <<
" " <<
d <<
" " <<
ft <<
" " << sl+1 <<
" " << Fit_mean <<
" " << Fit_error << endl;
286 TH1F *
h =
new TH1F( Form(
"h_%d", dete) , Form(
"h_%d", dete) , 160, -20, 20 );
289 TH1F *
h1 =
new TH1F( Form(
"h1_%d", dete) , Form(
"h1_%d", dete) , 100, 0, 15000 );
290 TH2F *h2 =
new TH2F( Form(
"h2_%d", dete) , Form(
"h2_%d", dete) , 100, 0, 15000, 160, -20, 20 );
293 for(
uint i = 0;
i < m_interface->nChannels();
i++ ){
294 if( m_interface->historySize(
i) == 0 )
continue;
296 const History* history = m_interface->cellHistory(
i);
297 if( !history )
continue;
311 for(
uint j = 0; j < history->
nData(); j++ ){
313 int NumberRun = history->
data(j)->
run();
315 if( history->
data(j)->
problems(
true) !=
"None" )
continue;
319 if( fabs( history->
data(j)->
ofcTime() ) > 20 )
continue;
325 if( ( calo <= 3 &&
Gain == 0 ) || ( calo == 4 &&
Gain == 1 ) || ( calo == 5 &&
Gain == 1 && NumberRun < 216867 ) || ( calo == 5 &&
Gain == 0 && NumberRun >= 216867 ) )
h->Fill(
t,
e );
326 if( ( calo <= 3 &&
Gain == 0 ) || ( calo == 4 &&
Gain == 1 ) || ( calo == 5 &&
Gain == 1 && NumberRun < 216867 ) || ( calo == 5 &&
Gain == 0 && NumberRun >=216867 ) )
h1->Fill( history->
data(j)->
quality() );
327 if( ( calo <= 3 &&
Gain == 0 ) || ( calo == 4 &&
Gain == 1 ) || ( calo == 5 &&
Gain == 1 && NumberRun < 216867 ) || ( calo == 5 &&
Gain == 0 && NumberRun >= 216867) ) h2->Fill( history->
data(j)->
quality(),
t );
331 TCanvas *
c =
new TCanvas( Form(
"c_%d_%s", dete, nrun.c_str()), Form(
"c_%d_%s", dete, nrun.c_str()), 129,165,700,600 );
333 h->SetTitle(Form(
"hist_%d", dete) );
336 h->GetXaxis()->SetTitle(
"ofcTime [ns]");
339 TF1 *
fit =
new TF1(
"fit",
"gaus", 3);
340 fit->SetParameter(1,
h->GetMean());
341 fit->SetParameter(2,
h->GetRMS());
342 fit->SetParLimits(1, -10, 10);
343 fit->SetParLimits(2, 0, 10);
349 h->Draw(
"histsame""E2");
351 TFile *
fi =
new TFile( Form(
"Time_%d_%s.root", dete, nrun.c_str()),
"RECREATE" );
358 TString
path =
"Plots/";
359 c->Print(
path+Form(
"Time_%d_%s.eps", dete, nrun.c_str()) );
360 c->Print(
path+Form(
"Time_%d_%s.png", dete, nrun.c_str()) );
370 std::string Filename =
"FEB_time_fitMean_" + nrun +
"_" +
name +
".txt";
372 std::ifstream
f(Filename.c_str(), ios::in);
373 std::vector<double>
mean;
374 std::vector<int>
side;
381 f >>
n1 >> n2 >> n3 >> n4 >> n5 >> n6;
383 if (
f.good() && !
f.bad() && !
f.fail())
392 TH1F *
h =
new TH1F(Form(
"FEB_Av_%s",
name.c_str()), Form(
"FEB_Av_%s",
name.c_str()), 240, -30., 30.);
393 TH1F *sAh =
new TH1F(Form(
"FEB_Av_%s_sideA",
name.c_str()), Form(
"FEB_Av_%s_sideA",
name.c_str()), 240, -30., 30.);
394 TH1F *sCh =
new TH1F(Form(
"FEB_Av_%s_sideC",
name.c_str()), Form(
"FEB_Av_%s_sideC",
name.c_str()), 240, -30., 30.);
396 for (
unsigned int i = 0;
i <
mean.size();
i++)
410 TCanvas *
c =
new TCanvas(Form(
"c_FEB_Av_%s",
name.c_str()), Form(
"c_FEB_Av_%s",
name.c_str()), 129, 165, 700, 600);
413 h->GetXaxis()->SetTitle(
"<t_{FEB}> [ns]");
414 h->GetYaxis()->SetTitle(
"Number of FEBs / 0.25 ns");
417 TString
path =
"Plots/";
418 c->Print(
path + Form(
"t_FEB_%s.png",
name.c_str()));
419 c->Print(
path + Form(
"t_FEB_%s.eps",
name.c_str()));
420 c->Print(
path + Form(
"t_FEB_%s.pdf",
name.c_str()));
422 TCanvas *sAc =
new TCanvas(Form(
"c_FEB_Av_%s_sideA",
name.c_str()), Form(
"c_FEB_Av_%s_sideA",
name.c_str()), 129, 165, 700, 600);
425 sAh->GetXaxis()->SetTitle(
"<t_{FEB}> [ns]");
426 sAh->GetYaxis()->SetTitle(
"Number of FEBs / 0.25 ns");
428 sAc->Print(
path + Form(
"t_FEB_%s_sideA.png",
name.c_str()));
430 TCanvas *sCc =
new TCanvas(Form(
"c_FEB_Av_%s_sideC",
name.c_str()), Form(
"c_FEB_Av_%s_sideC",
name.c_str()), 129, 165, 700, 600);
433 sCh->GetXaxis()->SetTitle(
"<t_{FEB}> [ns]");
434 sCh->GetYaxis()->SetTitle(
"Number of FEBs / 0.25 ns");
436 sCc->Print(
path + Form(
"t_FEB_%s_sideC.png",
name.c_str()));
438 std::string plotname =
"FEB_average_" + nrun +
"_" +
name +
".root";
439 TFile *
fi =
new TFile(plotname.c_str(),
"RECREATE");
443 std::string plotnamesA =
"FEB_average_" + nrun +
"_" +
name +
"_sideA.root";
444 TFile *fisA =
new TFile(plotnamesA.c_str(),
"RECREATE");
448 std::string plotnamesC =
"FEB_average_" + nrun +
"_" +
name +
"_sideC.root";
449 TFile *fisC =
new TFile(plotnamesC.c_str(),
"RECREATE");
460 string Filename =
"FEB_time_fitMean_" + nrun +
"_" +
name +
".txt";
462 ifstream
f( Filename.c_str(), ios::in );
470 f >>
n1 >> n2 >> n3 >> n4 >> n5 >> n6;
472 if(
f.good() && !
f.bad() && !
f.fail() ){
474 side.push_back( n2 );
480 TH1F *
h =
new TH1F( Form(
"FEB_Av_%s",
name.c_str()), Form(
"FEB_Av_%s",
name.c_str()), 120, -15., 15. );
481 TH1F *sAh =
new TH1F( Form(
"FEB_Av_%s_sideA",
name.c_str()), Form(
"FEB_Av_%s_sideA",
name.c_str()), 120, -15., 15. );
482 TH1F *sCh =
new TH1F( Form(
"FEB_Av_%s_sideC",
name.c_str()), Form(
"FEB_Av_%s_sideC",
name.c_str()), 120, -15., 15. );
484 for(
unsigned int i=0;
i<
mean.size();
i++ ){
487 if(
side.at(
i) == 1 )
488 sAh->Fill(
mean[
i] );
490 sCh->Fill(
mean[
i] );
497 TCanvas *
c =
new TCanvas( Form(
"c_FEB_Av_%s",
name.c_str()), Form(
"c_FEB_Av_%s",
name.c_str()), 129,165,700,600 );
500 h->GetXaxis()->SetTitle(
"<t_{FEB}> [ns]");
501 h->GetYaxis()->SetTitle(
"Number of FEBs / 0.25 ns");
504 TString
path =
"Plots/";
505 c->Print(
path+ Form(
"t_FEB_%s.png",
name.c_str()) );
506 c->Print(
path+ Form(
"t_FEB_%s.eps",
name.c_str()) );
507 c->Print(
path+ Form(
"t_FEB_%s.pdf",
name.c_str()) );
509 TCanvas *sAc =
new TCanvas( Form(
"c_FEB_Av_%s_sideA",
name.c_str()), Form(
"c_FEB_Av_%s_sideA",
name.c_str()), 129,165,700,600 );
512 sAh->GetXaxis()->SetTitle(
"<t_{FEB}> [ns]");
513 sAh->GetYaxis()->SetTitle(
"Number of FEBs / 0.25 ns");
515 sAc->Print(
path+ Form(
"t_FEB_%s_sideA.png",
name.c_str()) );
517 TCanvas *sCc =
new TCanvas( Form(
"c_FEB_Av_%s_sideC",
name.c_str()), Form(
"c_FEB_Av_%s_sideC",
name.c_str()), 129,165,700,600 );
520 sCh->GetXaxis()->SetTitle(
"<t_{FEB}> [ns]");
521 sCh->GetYaxis()->SetTitle(
"Number of FEBs / 0.25 ns");
523 sCc->Print(
path+ Form(
"t_FEB_%s_sideC.png",
name.c_str()) );
526 std::string plotname =
"FEB_average_" + nrun +
"_" +
name +
".root";
527 TFile *
fi =
new TFile( plotname.c_str(),
"RECREATE" );
541 string name =
"FEB_time_fitMean_" + nrun +
".txt";
544 string detparts[4] = {
"EMB",
"EMEC",
"HEC",
"FCAL"};
546 for(
int i = 0;
i < 4;
i++ ){
547 string tmpname = detparts[
i];
548 string file =
"FEB_time_fitMean_" + nrun +
"_" + tmpname +
".txt";
550 if(FileEmptyCheck(
file))
552 std::cout<<
" +++++ no information for " << tmpname <<
", therefore it's timing information is not merged +++"<<std::endl;
556 ifstream
f(
file.c_str(), ios::in );
562 f >>
n1 >> n2 >> n3 >> n4 >> n5 >> n6;
564 if(
f.good() && !
f.bad() && !
f.fail() )
565 mergedfile <<
n1 <<
" " << n2 <<
" " << n3 <<
" " << n4 <<
" " << n5 <<
" " << n6 << endl;
586 for(
int i = 0;
i < 4;
i++ ){
587 for(
int j = 0; j < 2; j++ ){
588 for(
int k = 0;
k < 16;
k++ ){
589 for(
int m = 0;
m < 32;
m++ ){
590 param[
i][j][
m][
k] = -99.;
597 ofstream febCorrfile;
598 string name =
"FEB_Corr_" + nrun +
".txt";
601 string name2 =
"FEB_time_fitMean_"+nrun+
".txt";
602 ifstream
f( name2.c_str(), ios::in );
609 f >>
n1 >> n2 >> n3 >> n4 >> n5 >> n6;
611 if(
f.good() && !
f.bad() && !
f.fail() ){
612 param[
n1][n2][n3][n4] = n5;
620 string HECFEBID[48] = {
"0x3a1a0000",
"0x3a520000",
"0x3a820000",
"0x3ab20000",
"0x3a1a8000",
"0x3a528000",
"0x3a828000",
"0x3ab28000",
"0x3a1b0000",
"0x3a530000",
"0x3a830000",
"0x3ab30000",
"0x3a1b8000",
"0x3a538000",
"0x3a838000",
"0x3ab38000",
"0x3a1c0000",
"0x3a540000",
"0x3a840000",
"0x3ab40000",
"0x3a1c8000",
"0x3a548000",
"0x3a848000",
"0x3ab48000",
"0x3b1a0000",
"0x3b520000",
"0x3b820000",
"0x3bb20000",
"0x3b1a8000",
"0x3b528000",
"0x3b828000",
"0x3bb28000",
"0x3b1b0000",
"0x3b530000",
"0x3b830000",
"0x3bb30000",
"0x3b1b8000",
"0x3b538000",
"0x3b838000",
"0x3bb38000",
"0x3b1c0000",
"0x3b540000",
"0x3b840000",
"0x3bb40000",
"0x3b1c8000",
"0x3b548000",
"0x3b848000",
"0x3bb48000" };
621 string FCALFEBID[28] = {
"0x3a300000",
"0x3a308000",
"0x3a310000",
"0x3a318000",
"0x3a320000",
"0x3a328000",
"0x3a330000",
"0x3a340000",
"0x3a348000",
"0x3a350000",
"0x3a358000",
"0x3a360000",
"0x3a368000",
"0x3a370000",
"0x3b300000",
"0x3b308000",
"0x3b310000",
"0x3b318000",
"0x3b320000",
"0x3b328000",
"0x3b330000",
"0x3b340000",
"0x3b348000",
"0x3b350000",
"0x3b358000",
"0x3b360000",
"0x3b368000",
"0x3b370000" };
624 string nameid =
"FEB_Corr_FEBID_" + nrun +
".txt";
625 corrfile.open( nameid.c_str(),
ios::out );
628 for(
int i = 0;
i < 4;
i++ ){
630 for(
int j = 0; j < 2; j++ ){
631 for(
int k = 0;
k < 16;
k++ ){
632 for(
int m = 0;
m < 32;
m++ ){
633 if( param[
i][j][
m][
k] != -99. &&
error[
i][j][
m][
k] != -99.){
634 febCorrfile <<
i <<
" " << j <<
" " <<
k <<
" " <<
m <<
" " << param[
i][j][
m][
k] <<
" " <<
error[
i][j][
m][
k] << endl;
635 if(
i < 2 )corrfile <<
"0x" << std::hex << (0x38000000|
i<<25|j<<24|
m<<19|(
k-1)<<15) <<
" " << std::dec << param[
i][j][
m][
k] << endl;
636 else if(
i == 2 )corrfile << HECFEBID[
kk] <<
" " << param[
i][j][
m][
k] << endl;
637 else corrfile << FCALFEBID[
kk] <<
" " << param[
i][j][
m][
k] << endl;
658 TGraphErrors **
g =
new TGraphErrors*[15];
659 TGraphErrors **
g1 =
new TGraphErrors*[15];
660 TGraphErrors **
g2 =
new TGraphErrors*[15];
661 TGraphErrors **g3 =
new TGraphErrors*[15];
662 TGraphErrors **
g4 =
new TGraphErrors*[15];
663 TGraphErrors **g5 =
new TGraphErrors*[15];
664 TGraphErrors **g6 =
new TGraphErrors*[15];
666 TGraph** gzero =
new TGraph*[15];
667 TCanvas **
c =
new TCanvas*[4];
668 TLatex *
l =
new TLatex();
669 l->SetTextSize(0.065);
671 int count = 0, count1 = 0, count2 = 0, count3 = 0, count4 = 0, count5 = 0, count6 = 0;
672 TString
path =
"Plots/";
677 if(
det == 1 )special = 2;
678 for(
int crates = 0; crates < special; crates++ ){
679 string cratename =
"Standard";
680 if( crates == 1 ) cratename =
"Special";
683 c[
side] =
new TCanvas( Form(
"c%d%d%s",
det,
side, cratename.c_str() ), Form(
"c%d%d%s",
det,
side, cratename.c_str()), 1100, 600 );
684 c[
side]->Divide( 5, 3 );
686 for(
int i = 0;
i < 15;
i++ ){
687 g[
i] =
new TGraphErrors();
688 g1[
i] =
new TGraphErrors();
689 g2[
i] =
new TGraphErrors();
690 g3[
i] =
new TGraphErrors();
691 g4[
i] =
new TGraphErrors();
692 g5[
i] =
new TGraphErrors();
693 g6[
i] =
new TGraphErrors();
695 gzero[
i] =
new TGraph();
697 for(
int j = 0; j < 32; j++ ){
698 if(
det == 1 && crates == 0 && ( j == 2 || j == 3 || j == 9 || j == 10 || j == 15 || j == 16 || j ==21 || j == 22 ) )
continue;
699 if(
det == 1 && crates == 1 && !( j == 2 || j == 3 || j == 9 || j == 10 || j == 15 || j == 16 || j ==21 || j == 22 ) )
continue;
701 gzero[
i]->SetPoint( j, j, 0 );
702 if( param[
det][
side][j][
i+1] == -99 )
continue;
709 g[
i]->SetMarkerColor(4);
710 g[
i]->GetYaxis()->SetRangeUser(-5, 5);
715 g1[
i]->SetPoint(count1-1, j, param[
det][
side][j][
i+1]);
717 g1[
i]->SetMarkerColor(4);
719 else if( j == 3 || j == 10 || j == 16 || j == 22 ){
720 if(
i >= 4 &&
i <= 9 ){
722 g2[
i]->SetPoint(count2-1, j, param[
det][
side][j][
i+1]);
724 g2[
i]->SetMarkerColor(3);
726 else if(
i == 0 ||
i == 1){
728 g3[
i]->SetPoint(count3-1, j, param[
det][
side][j][
i+1]);
730 g3[
i]->SetMarkerColor(6);
733 else if( j == 2 || j == 9 || j == 15 || j == 21 ){
735 g4[
i]->SetPoint(count4-1, j, param[
det][
side][j][
i+1]);
737 g4[
i]->SetMarkerColor(2);
742 g5[
i]->SetPoint(count5-1, j, param[
det][
side][j][
i+1]);
744 g5[
i]->SetMarkerColor(1+12*(j%2));
748 g6[
i]->SetPoint(count6-1, j, param[
det][
side][j][
i+1]);
750 g6[
i]->SetMarkerColor(1+12*(j%2));
753 g[
i]->GetYaxis()->SetRangeUser(-5, 5);
757 count = 0; count1 = 0; count2 = 0; count3 = 0; count4 = 0; count5 = 0; count6 = 0;
760 g[
i]->GetXaxis()->SetTitle(
"FT");
761 g[
i]->GetYaxis()->SetTitle(
"ofcTime[ns]");
762 g[
i]->GetXaxis()->SetLabelSize(0.065);
763 g[
i]->GetYaxis()->SetLabelSize(0.065);
764 g[
i]->SetMarkerSize(0.4);
765 g1[
i]->SetMarkerSize(0.4);
766 g2[
i]->SetMarkerSize(0.4);
767 g3[
i]->SetMarkerSize(0.4);
768 g4[
i]->SetMarkerSize(0.4);
769 g5[
i]->SetMarkerSize(0.4);
770 g6[
i]->SetMarkerSize(0.4);
771 g[
i]->SetTitle( Form(
"#color[2]{#bf{Slot %d}}",
i+1 ) );
780 gzero[
i]->SetMarkerSize(0.2);
783 string detname =
"EMB";
784 if(
det == 1 )detname =
"EMEC";
785 else if(
det == 2 )detname =
"HEC";
786 else if(
det == 3 )detname =
"FCAL";
787 c[
side]->Print(
path+ Form(
"t_FEB_side%d_%s_%s.png",
side, detname.c_str(), cratename.c_str()));
804 if( quality > 4000 ) pass =
false;
808 if( fabs(
time ) > 10.00 )pass =
false;
819 if( calo == 2 || calo == 3 ){
822 if( calo == 3 &&
energy < 3000. ) pass =
false;
823 if( calo == 2 &&
energy < 1000. ) pass =
false;
827 if( calo == 3 &&
energy < 2000. ) pass =
false;
828 if( calo == 2 &&
energy < 3000. ) pass =
false;
832 if(
layer == 3 && quality > 10000 ) pass =
false;
833 if( slot == 13 && (
ft == 2 ||
ft == 9 ||
ft == 15 ||
ft == 21 ) && quality > 4000 ) pass =
false;
834 if( slot == 14 && (
ft == 2 ||
ft == 9 ||
ft == 15 ||
ft == 21 ) && quality > 4000 ) pass =
false;
835 if( slot == 15 && (
ft == 2 ||
ft == 9 ||
ft == 15 ||
ft == 21 ) && quality > 4000 ) pass =
false;
838 if( calo == 4 &&
energy < 3500. ) pass =
false;
839 if( calo == 5 &&
energy < 10000. ) pass =
false;
849 std::vector< std::vector <double> >
Data;
851 ifstream
f(
file.c_str() );
857 else if(
file.find(
"EMEC" ) <
file.length() )
name =
"EMEC";
858 else if(
file.find(
"HEC" ) <
file.length() )
name =
"HEC";
859 else if(
file.find(
"FCAL" ) <
file.length() )
name =
"FCAL";
861 for(
int d = 0;
d < 2;
d++ ){
862 for(
int ft = 0;
ft < 32;
ft++ ){
863 for(
int sl = 0; sl < 15; sl++ ){
864 h[
d][
ft][sl+1] =
new TH1F( Form(
"h_%s_%d_%d_%d",
name.c_str(),
d,
ft, sl+1) , Form(
"h_%s_%d_%d_%d",
name.c_str(),
d,
ft, sl+1), 200, -20, 20 );
865 h[
d][
ft][sl+1]->Sumw2();
872 if( !
f )cerr <<
"Timing File " <<
file <<
"cannot be read" << endl;
878 if(
f.good() && !
f.bad() && !
f.fail() ){
879 f >>
n1 >> n2 >> n3 >> n4 >> n5 >> n6;
881 std::vector<double>
tmp;
890 h[n2][n3][n4]->Fill( n5, n6 );
900 TFile *
ff =
new TFile(
filename.c_str(),
"RECREATE" );
902 for(
int d = 0;
d < 2;
d++ ){
903 for(
int ft = 0;
ft < 32;
ft++ ){
904 for(
int sl = 0; sl < 15; sl++ )
905 h[
d][
ft][sl+1]->Write();
922 TGraph *
g =
new TGraph();
923 double wmedian = -99.,
weights, w0 = -1., cumulWeights = 0.0;
925 bool wcondition =
false;
929 for(
int i = 0;
i <
Size;
i++ ){
932 cumulWeights = cumulWeights +
weights;
933 g->SetPoint(
g->GetN(), cumulWeights,
time[
i] );
935 wcondition = w0 > 0.5;
938 if( wcondition ) wmedian =
g->Eval(w0+(1-w0)/2);
939 else wmedian=
g->Eval(0.5);