Automatic switching of x-y beam spot to z-y beam spot when looking in region between moderator and mirror
This commit is contained in:
parent
0e0a1d64c6
commit
da31480306
@ -14,7 +14,11 @@ void sr_transm(const char* fname, int saveID)
|
||||
TFile* f1 = new TFile(fname);
|
||||
t1 = (TTree*) gDirectory->FindObjectAny("t1");
|
||||
|
||||
sprintf(cutStr,"save_detID== %3i &&save_particleID==-13 && save_pz>0",saveID);
|
||||
if (saveID < 868)
|
||||
sprintf(cutStr,"save_detID== %3i &&save_particleID==-13",saveID);
|
||||
else
|
||||
sprintf(cutStr,"save_detID== %3i &&save_particleID==-13 && save_pz>0",saveID);
|
||||
|
||||
gStyle->SetPalette(1,0);
|
||||
TCanvas* c1 = new TCanvas("c1","Polarization and Transmission",60,40,600,800);
|
||||
c1->Divide(2,3);
|
||||
@ -65,7 +69,11 @@ void sr_transm(const char* fname, int saveID)
|
||||
// Resulting beam spot
|
||||
c1->cd(4)->SetGridx();c1->cd(4)->SetGridy(); // c1->cd(3);
|
||||
// t1->Draw("save_y:save_x>>bspot_hist(64,-40,40,64,-40,40)","save_detID==902&&save_particleID==-13");
|
||||
t1->Draw("save_y:save_x>>bspot_hist(80,-40,40,80,-40,40)",cutStr);
|
||||
if (saveID < 868)
|
||||
t1->Draw("save_y:(save_z+1678.)>>bspot_hist(80,-40,40,80,-40,40)",cutStr);
|
||||
else
|
||||
t1->Draw("save_y:save_x>>bspot_hist(80,-40,40,80,-40,40)",cutStr);
|
||||
|
||||
bspot_hist = (TH2D*) gDirectory->Get("bspot_hist");
|
||||
bspot_hist->SetTitle("Muon beam cross section [mm]");
|
||||
/* bspot_hist->GetXaxis()->SetTitle("x at z=16 [mm]")
|
||||
@ -86,7 +94,10 @@ void sr_transm(const char* fname, int saveID)
|
||||
// Resulting beam spot cross section
|
||||
c1->cd(6);
|
||||
c1->cd(6)->SetGridx();c1->cd(6)->SetGridy();
|
||||
t1->Draw("save_y:save_x>>bspot_hist1(80,-20,20,80,-20,20)",cutStr);
|
||||
if (saveID < 868)
|
||||
t1->Draw("save_y:(save_z+1678.)>>bspot_hist1(80,-20,20,80,-20,20)",cutStr);
|
||||
else
|
||||
t1->Draw("save_y:save_x>>bspot_hist1(80,-20,20,80,-20,20)",cutStr);
|
||||
bspot_hist1 = (TH2D*) gDirectory->Get("bspot_hist1");
|
||||
bspot_hist1->SetTitle("Muon beam cross section [mm]");
|
||||
bspot_hist1->GetXaxis()->SetTitle("x (mm)");
|
||||
@ -94,10 +105,13 @@ void sr_transm(const char* fname, int saveID)
|
||||
bspot_hist1->Draw();
|
||||
bspot_hist1->Draw("cont0 same");
|
||||
cout << "Mean x, Mean y, RMS x, RMS y: " << bspot_hist1->GetMean(1) << ", " << bspot_hist1->GetMean(2) << ", " << bspot_hist1->GetRMS(1) << ", " << bspot_hist1->GetRMS(2) << ", " << endl;
|
||||
cout << "Fraction in [-10.,10.]: " << bspot_hist->Integral(31,50,31,50)/bspot_hist->Integral(1,80,1,80) << endl;
|
||||
cout << "Fraction in [-5.0,5.0]: " << bspot_hist->Integral(36,45,36,45)/bspot_hist->Integral(1,80,1,80) << endl;
|
||||
cout << "Fraction in [ -5.,15.]: " << bspot_hist1->Integral(31,70,31,70)/bspot_hist1->Integral(1,80,1,80) << endl;
|
||||
cout << "Fraction in [-10.,10.]: " << bspot_hist1->Integral(21,60,21,60)/bspot_hist1->Integral(1,80,1,80) << endl;
|
||||
cout << "Fraction in [-12.5,12.5]: " << bspot_hist1->Integral(16,65,16,65)/bspot_hist1->Integral(1,80,1,80) << endl;
|
||||
cout << "Fraction in [-5.0,5.0]: " << bspot_hist1->Integral(31,50,31,50)/bspot_hist1->Integral(1,80,1,80) << endl;
|
||||
|
||||
cout << "Fraction in [-2.5,2.5]: " << bspot_hist1->Integral(36,45,36,45)/bspot_hist->Integral(1,80,1,80) << endl;
|
||||
cout << "Fraction in [-2.5,2.5]: " << bspot_hist1->Integral(36,45,36,45)/bspot_hist1->Integral(1,80,1,80) << endl;
|
||||
cout << "N[-20,20]: " << bspot_hist1->Integral(1,80,1,80) << endl;
|
||||
}
|
||||
|
||||
void phase_space(const char* fname)
|
||||
@ -318,7 +332,7 @@ void Beam_Env(const char* fname, Int_t iSlice, Int_t fSlice)
|
||||
// Resulting beam spot
|
||||
Cond.Form("save_detID==%d&&save_particleID==-13",i);
|
||||
// Cond.Form("save_detID==%d&& (save_particleID!=22) ",i);
|
||||
t1->Draw("save_z:save_y:save_x>>bspot_hist(64,-80,80,64,-80,80,100,-2600,300)",Cond);
|
||||
t1->Draw("save_z:save_y:save_x>>bspot_hist(100,-100,100,100,-100,100,100,-2600,300)",Cond);
|
||||
// t1->Draw("save_z:save_y:save_x>>bspot_hist(64,-40,40,64,-40,40,100,-290,290)",Cond);
|
||||
bspot_hist = (TH2D*) gDirectory->Get("bspot_hist");
|
||||
// Get properties of slice
|
||||
@ -332,7 +346,7 @@ void Beam_Env(const char* fname, Int_t iSlice, Int_t fSlice)
|
||||
|
||||
Nbins=bspot_hist->Integral();
|
||||
|
||||
printf("%d\t%g\t%g\t%g\t%g\t%g\t%g\n",i,zSlice,Xrms,Yrms,Xavg,Yavg,Nbins);
|
||||
printf("%d\t%10.1f\t%6.2f\t%6.2f\t%6.2f\t%6.2f\t%g\n",i,zSlice,Xrms,Yrms,Xavg,Yavg,Nbins);
|
||||
// delete bspot_hist;
|
||||
}
|
||||
// t1->Draw("save_z:save_y:save_x>>bspot_hist(64,-40,40,64,-40,40,100,-290,290)","save_particleID==-13");
|
||||
|
Loading…
x
Reference in New Issue
Block a user