3 cout<<
"slag starts..."<<endl;
5 if(
nIFO>3) {cout <<
"slag.C : Skipping plot production - wave tree should come from a 2- or 3-fold network : " <<
net_file_name << endl;
exit(0);}
10 TB.
checkFile(gSystem->Getenv(
"CWB_PARAMETERS_FILE"));
11 TB.
checkFile(gSystem->Getenv(
"CWB_UPARAMETERS_FILE"));
12 TB.
checkFile(gSystem->Getenv(
"CWB_PPARAMETERS_FILE"));
13 TB.
checkFile(gSystem->Getenv(
"CWB_UPPARAMETERS_FILE"));
14 TB.
checkFile(gSystem->Getenv(
"CWB_EPPARAMETERS_FILE"));
16 gStyle->SetTitleFillColor(kWhite);
17 gStyle->SetLineColor(kWhite);
18 gStyle->SetNumberContours(256);
19 gStyle->SetCanvasColor(kWhite);
20 gStyle->SetStatBorderSize(1);
21 gStyle->SetOptStat(kFALSE);
24 gStyle->SetFrameBorderMode(0);
31 TCanvas *
c1 =
new TCanvas(
"Slag",
"Slag",32,55,750,502);
32 c1->Range(-0.75,-1.23433,6.75,8.17182);
37 c1->SetFrameFillColor(0);
38 gStyle->SetPalette(1,0);
40 TChain
wave(
"waveburst");
41 TChain
live(
"liveTime");
50 while ((branch=(TBranch*)
mynext())) {
51 if (
TString(
"slag").CompareTo(branch->GetName())==0) slagFound=
true;
54 if(!slagFound) {cout <<
"slag.C : Error - wave tree does not contain slag leaf : " <<
net_file_name << endl;
exit(1);}
66 wave.SetEstimate(num);
73 if(
nIFO==2) {
sel.ReplaceAll(
"1",
"0");
sel.ReplaceAll(
"2",
"1");}
77 cout<<
"Number of Entries: "<<num<<endl;
83 double SlagMax =
wave.GetMaximum(
"slag")+
segLen/2.;
84 double SlagMin =
wave.GetMinimum(
"slag")-
segLen/2.;
85 int NSlag = TMath::FloorNint((SlagMax-SlagMin)/
segLen);
86 cout <<
"SLAG MAX : "<<
wave.GetMaximum(
"slag")<<
" s SLAG MIN : "<<
wave.GetMinimum(
"slag")<<
" s #SLAGS : "<<NSlag-1<<endl;
88 if(NSlag==1){cout <<
"Just one slag....Skipping further execution!"<<endl;
exit(0);}
89 sprintf(mytitle,
"FAR distribution over slags (post cat3 & rho>%f)",
T_cut);
90 TH2F* Slag =
new TH2F(
"SLAG",mytitle,NSlag,SlagMin/86400.,SlagMax/86400.,NSlag,SlagMin/86400.,SlagMax/86400.);
91 Slag->GetXaxis()->SetTitle(
"slag[1] shift [day]");
93 Slag->GetYaxis()->SetTitle(
"slag[2] shift [day]");
95 Slag->SetStats(kFALSE);
97 TH2F*
lSlag =
new TH2F(
"LSLAG",
"Live time distribution over slags",NSlag,SlagMin/86400.,SlagMax/86400.,NSlag,SlagMin/86400.,SlagMax/86400.);
99 Slag->Fill(slag1[
l]/86400.,slag2[
l]/86400.);
107 live.SetBranchAddress(
"slag",xslag);
108 live.SetBranchAddress(
"lag",xlag);
109 live.SetBranchAddress(
"live",&xlive);
110 live.SetBranchStatus(
"gps",
false);
115 lSlag->Fill(xslag[0]/86400.,xslag[1]/86400.,xlive);
123 c1->Update(); c1->SaveAs(fname);
126 lSlag2->GetXaxis()->SetTitle(
"slag shift [day]");
128 lSlag2->GetYaxis()->SetTitle(
"Live time [day]");
130 lSlag2->SetMarkerStyle(20);
131 lSlag2->Scale(1./86400);
133 lSlag2->SetTitle(mytitle);
136 c1->Update(); c1->SaveAs(fname);
148 for(
int i =1 ;
i<NSlag+1;
i++){
149 for(
int j =1 ;
j<NSlag+1;
j++){
150 if(Slag->GetBinContent(
i,
j)>=1.E-15){
151 FAR[
mycount] = Slag->GetBinContent(
i,
j)*86400.*365;
152 LSlag[
mycount] = lSlag->GetBinContent(
i,
j);
153 LSlag[
mycount] = lSlag->GetBinContent(
i,
j);
154 Dx[
mycount] = xaxis->GetBinCenter(
i);
155 Dy[
mycount] = yaxis->GetBinCenter(
j);
156 D[
mycount] = TMath::Sqrt(pow(Dx[mycount],2)+pow(Dy[mycount],2));
158 eFAR[
mycount] = Slag->GetBinError(
i,
j)/lSlag->GetBinError(
i,
j)*86400.*365;
160 if(
i*
j%100==0){cout <<
"slag[1] :"<<xaxis->GetBinCenter(
i)<<
" slag[2] :"<<yaxis->GetBinCenter(
j) <<
" FAR :"<<FAR[mycount-1] <<
"+/-" <<eFAR[mycount-1] <<
" " <<endl;}
167 cout <<
"Number of slags : " << mycount << endl;
168 double liveTot = lSlag->GetSumOfWeights();
170 cout <<
"Total BKG live time : " << liveTot << endl;
172 double* FAR2 =
new double[
mycount];
173 double* eFAR2 =
new double[
mycount];
175 double* Ny =
new double[
mycount];
176 double* eN =
new double[
mycount];
178 Int_t *myindex =
new Int_t[
mycount];
179 TMath::Sort(mycount,Ny,myindex,
false);
180 for(
int i =0 ;
i<
mycount;
i++){FAR2[
i]=FAR[myindex[
i]];eFAR2[
i]=eFAR[myindex[
i]];N[
i]=D[myindex[
i]];Ny[
i]=Dy[myindex[
i]];eN[
i]=0.0;}
181 TGraphErrors* FarPlot=
new TGraphErrors(mycount, N, FAR2, eN, eFAR2);
182 FarPlot->SetLineColor(kBlue);
183 FarPlot->SetMarkerColor(kBlue);
185 FarPlot->SetTitle(
"FAR vs slag distance");
186 FarPlot->SetMarkerStyle(20);
187 FarPlot->SetMarkerSize(1);
188 FarPlot->SetLineStyle(3);
190 FarPlot->GetHistogram()->SetXTitle(
"slag distance [day]");
191 FarPlot->GetHistogram()->SetYTitle(
"FAR, [1/year]");
194 gStyle->SetOptStat();
198 FarPlot->Fit(
"pol1");
200 c1->Update(); c1->SaveAs(fname);
201 gStyle->SetOptStat(kFALSE);
202 gStyle->SetOptFit(kFALSE);
207 TCanvas *
c2 =
new TCanvas(
"Slag2",
"Slag2",32,55,1450,502);
209 c2->SetBorderSize(1);
213 c2->SetFrameFillColor(0);
218 fprintf(frate,
"#FAR[years^-1] eFAR Tshift[days]\n");
225 TGraphErrors*
FarPlot2=
new TGraphErrors(mycount, Dy, FAR, eN, eFAR);
226 FarPlot2->SetLineColor(kBlue);
227 FarPlot2->SetMarkerColor(kBlue);
229 FarPlot2->SetTitle(
"");
230 FarPlot2->SetMarkerStyle(20);
231 FarPlot2->SetMarkerSize(1);
232 FarPlot2->SetLineStyle(3);
234 FarPlot2->GetHistogram()->GetXaxis()->SetRangeUser(TMath::FloorNint(SlagMin/86400.),TMath::CeilNint(SlagMax/86400.));
235 FarPlot2->GetHistogram()->SetXTitle(
"time shift [day]");
236 FarPlot2->GetHistogram()->SetYTitle(
"FAR [1/year]");
237 FarPlot2->GetHistogram()->GetXaxis()->SetTitleSize(0.05);
238 FarPlot2->GetHistogram()->GetYaxis()->SetTitleSize(0.05);
239 FarPlot2->GetHistogram()->GetXaxis()->SetLabelSize(0.05);
240 FarPlot2->GetHistogram()->GetYaxis()->SetLabelSize(0.05);
244 FarPlot2->Draw(
"AP");
245 TF1 *
g1 =
new TF1(
"g1",
"pol1",0,SlagMax/86400.);
248 TF1 *
g2 =
new TF1(
"g2",
"pol1",-SlagMax/86400.,0);
252 FarPlot2->Fit(g1,
"R");
253 FarPlot2->Fit(g2,
"R+",
"SAME");
257 legr =
new TLegend(0.6,0.8,0.885,0.98,
"",
"brNDC");
258 legl =
new TLegend(0.15,0.8,0.4,0.98,
"",
"brNDC");
260 sprintf(lab,
"#chi^{2}/ndf(right) : %3.3g / %d",g1->GetChisquare(),g1->GetNDF());
261 legr->AddEntry(g1, lab,
"l");
262 sprintf(lab,
"P0(right) : %.2f +/- %.2f",g1->GetParameters()[0],g1->GetParErrors()[0]);
263 legr->AddEntry(
"", lab,
"a");
264 sprintf(lab,
"P1(right) : %.2g +/- %.2g",g1->GetParameters()[1],g1->GetParErrors()[1]);
265 legr->AddEntry(
"", lab,
"a");
266 legr->SetLineColor(1);
268 sprintf(lab,
"#chi^{2}/ndf(left) : %3.3g / %d",g2->GetChisquare(),g2->GetNDF());
269 legl->AddEntry(g2, lab,
"l");
270 sprintf(lab,
"P0(left) : %.2f +/- %.2f",g2->GetParameters()[0],g2->GetParErrors()[0]);
271 legl->AddEntry(
"", lab,
"a");
272 sprintf(lab,
"P1(left) : %.2g +/- %.2g",g2->GetParameters()[1],g2->GetParErrors()[1]);
273 legl->AddEntry(
"", lab,
"a");
274 legl->SetLineColor(1);
283 c2->Update(); c2->SaveAs(fname);
sprintf(cut,"rho[1]>%f", T_cut)
TString sel("slag[1]:slag[2]")
TIter mynext(wave.GetListOfBranches())
fprintf(frate,"#FAR[years^-1] eFAR Tshift[days]\n")