21 cout<<
"slag starts..."<<endl;
24 cout <<
"cwb_report_slag.C : Skipping plot production - wave tree should come from a 2- or 3-fold network : " 31 TB.
checkFile(gSystem->Getenv(
"CWB_ROOTLOGON_FILE"));
32 TB.
checkFile(gSystem->Getenv(
"CWB_PARAMETERS_FILE"));
33 TB.
checkFile(gSystem->Getenv(
"CWB_UPARAMETERS_FILE"));
34 TB.
checkFile(gSystem->Getenv(
"CWB_PPARAMETERS_FILE"));
35 TB.
checkFile(gSystem->Getenv(
"CWB_UPPARAMETERS_FILE"));
36 TB.
checkFile(gSystem->Getenv(
"CWB_EPPARAMETERS_FILE"));
38 gStyle->SetTitleFillColor(kWhite);
39 gStyle->SetLineColor(kWhite);
40 gStyle->SetNumberContours(256);
41 gStyle->SetCanvasColor(kWhite);
42 gStyle->SetStatBorderSize(1);
43 gStyle->SetOptStat(kFALSE);
46 gStyle->SetFrameBorderMode(0);
53 TCanvas *
c1 =
new TCanvas(
"Slag",
"Slag",32,55,750,502);
54 c1->Range(-0.75,-1.23433,6.75,8.17182);
59 c1->SetFrameFillColor(0);
60 gStyle->SetPalette(1,0);
62 TChain
wave(
"waveburst");
63 TChain
live(
"liveTime");
72 while ((branch=(TBranch*)
mynext())) {
73 if (
TString(
"slag").CompareTo(branch->GetName())==0) slagFound=
true;
77 cout <<
"cwb_report_slags.C : Error - wave tree does not contain slag leaf : " 92 wave.SetEstimate(num);
94 if(
nIFO==2) {
sel.ReplaceAll(
"1",
"0");
sel.ReplaceAll(
"2",
"1");}
97 cout<<
"Number of Entries: "<<num<<endl;
101 slag2 =
wave.GetV2();
103 double SlagMax =
wave.GetMaximum(
"slag")+
segLen/2.;
104 double SlagMin =
wave.GetMinimum(
"slag")-
segLen/2.;
105 int NSlag = TMath::FloorNint((SlagMax-SlagMin)/
segLen);
106 cout <<
"SLAG MAX : "<<
wave.GetMaximum(
"slag")<<
" s SLAG MIN : "<<
wave.GetMinimum(
"slag")<<
" s #SLAGS : "<<NSlag-1<<endl;
108 if(NSlag==1){cout <<
"Just one slag....Skipping further execution!"<<endl;
exit(0);}
109 sprintf(mytitle,
"FAR distribution over slags (post cat3 & rho>%f)",
T_cut);
110 TH2F* Slag =
new TH2F(
"SLAG",mytitle,NSlag,SlagMin/86400.,SlagMax/86400.,NSlag,SlagMin/86400.,SlagMax/86400.);
111 Slag->GetXaxis()->SetTitle(
"slag[1] shift [day]");
112 Slag->GetYaxis()->SetTitle(
"slag[2] shift [day]");
113 Slag->SetStats(kFALSE);
115 TH2F*
lSlag =
new TH2F(
"LSLAG",
"Live time distribution over slags",NSlag,SlagMin/86400.,SlagMax/86400.,NSlag,SlagMin/86400.,SlagMax/86400.);
117 Slag->Fill(slag1[
l]/86400.,slag2[
l]/86400.);
123 live.SetBranchAddress(
"slag",xslag);
124 live.SetBranchAddress(
"lag",xlag);
125 live.SetBranchAddress(
"live",&xlive);
126 live.SetBranchStatus(
"gps",
false);
131 lSlag->Fill(xslag[0]/86400.,xslag[1]/86400.,xlive);
137 lSlag2->GetXaxis()->SetTitle(
"slag shift [day]");
138 lSlag2->GetYaxis()->SetTitle(
"Live time [day]");
140 lSlag2->SetMarkerStyle(20);
141 lSlag2->Scale(1./86400);
143 lSlag2->SetTitle(mytitle);
146 c1->Update(); c1->SaveAs(fname);
157 for(
int i =1 ;
i<NSlag+1;
i++){
158 for(
int j =1 ;
j<NSlag+1;
j++){
159 if(Slag->GetBinContent(
i,
j)>=1.E-15){
160 FAR[
mycount] = Slag->GetBinContent(
i,
j)*86400.*365;
161 LSlag[
mycount] = lSlag->GetBinContent(
i,
j);
162 LSlag[
mycount] = lSlag->GetBinContent(
i,
j);
163 Dx[
mycount] = xaxis->GetBinCenter(
i);
164 Dy[
mycount] = yaxis->GetBinCenter(
j);
165 D[
mycount] = TMath::Sqrt(pow(Dx[mycount],2)+pow(Dy[mycount],2));
166 eFAR[
mycount] = Slag->GetBinError(
i,
j)/lSlag->GetBinError(
i,
j)*86400.*365;
169 cout <<
"slag[1] :"<<xaxis->GetBinCenter(
i)<<
" slag[2] :"<<yaxis->GetBinCenter(
j)
170 <<
" FAR :"<<FAR[mycount-1] <<
"+/-" <<eFAR[mycount-1] <<
" " <<endl;}
175 cout <<
"Number of slags : " << mycount << endl;
176 double liveTot = lSlag->GetSumOfWeights();
178 cout <<
"Total BKG live time : " << liveTot << endl;
179 double* eN =
new double[
mycount];
182 TCanvas *
c2 =
new TCanvas(
"Slag2",
"Slag2",32,55,1450,502);
183 c2->SetBorderSize(1);
187 c2->SetFrameFillColor(0);
191 fprintf(frate,
"#FAR[years^-1] eFAR Tshift[days]\n");
195 TGraphErrors*
FarPlot=
new TGraphErrors(mycount, Dy, FAR, eN, eFAR);
196 FarPlot->SetLineColor(kBlue);
197 FarPlot->SetMarkerColor(kBlue);
198 FarPlot->SetTitle(
"");
199 FarPlot->SetMarkerStyle(20);
200 FarPlot->SetMarkerSize(1);
201 FarPlot->SetLineStyle(3);
202 FarPlot->GetHistogram()->GetXaxis()->SetRangeUser(TMath::FloorNint(SlagMin/86400.),TMath::CeilNint(SlagMax/86400.));
203 FarPlot->GetHistogram()->SetXTitle(
"time shift [day]");
204 FarPlot->GetHistogram()->SetYTitle(
"FAR [1/year]");
205 FarPlot->GetHistogram()->GetXaxis()->SetTitleSize(0.05);
206 FarPlot->GetHistogram()->GetYaxis()->SetTitleSize(0.05);
207 FarPlot->GetHistogram()->GetXaxis()->SetLabelSize(0.05);
208 FarPlot->GetHistogram()->GetYaxis()->SetLabelSize(0.05);
213 TF1 *
g1 =
new TF1(
"g1",
"pol1",0,SlagMax/86400.);
216 TF1 *
g2 =
new TF1(
"g2",
"pol1",-SlagMax/86400.,0);
219 FarPlot->Fit(g1,
"R");
220 FarPlot->Fit(g2,
"R+",
"SAME");
221 legr =
new TLegend(0.6,0.8,0.885,0.98,
"",
"brNDC");
222 legl =
new TLegend(0.15,0.8,0.4,0.98,
"",
"brNDC");
224 sprintf(lab,
"#chi^{2}/ndf(right) : %3.3g / %d",g1->GetChisquare(),g1->GetNDF());
225 legr->AddEntry(g1, lab,
"l");
226 sprintf(lab,
"P0(right) : %.2f +/- %.2f",g1->GetParameters()[0],g1->GetParErrors()[0]);
227 legr->AddEntry(
"", lab,
"a");
228 sprintf(lab,
"P1(right) : %.2g +/- %.2g",g1->GetParameters()[1],g1->GetParErrors()[1]);
229 legr->AddEntry(
"", lab,
"a");
230 legr->SetLineColor(1);
232 sprintf(lab,
"#chi^{2}/ndf(left) : %3.3g / %d",g2->GetChisquare(),g2->GetNDF());
233 legl->AddEntry(g2, lab,
"l");
234 sprintf(lab,
"P0(left) : %.2f +/- %.2f",g2->GetParameters()[0],g2->GetParErrors()[0]);
235 legl->AddEntry(
"", lab,
"a");
236 sprintf(lab,
"P1(left) : %.2g +/- %.2g",g2->GetParameters()[1],g2->GetParErrors()[1]);
237 legl->AddEntry(
"", lab,
"a");
238 legl->SetLineColor(1);
245 c2->Update(); c2->SaveAs(fname);
TString sel("slag[1]:slag[2]")
fprintf(frate,"#FAR[years^-1] eFAR Tshift[days]\)
TIter mynext(wave.GetListOfBranches())
sprintf(cut,"rho[1]>%f", T_cut)