3 #include <TDatabasePDG.h>
4 #include <TLorentzVector.h>
47 std::vector<EicSmearStep>
steps;
60 static int particle_index = 0;
67 not_smeared_prt.
SetId(pdg);
68 not_smeared_prt.
SetIndex(particle_index++);
74 smeared_prt = detector.
Smear(not_smeared_prt);
83 double in_p = input_vect.P();
84 double sm_p = smeared_prt->
GetP();
85 double in_e = input_vect.E();
86 double sm_e = smeared_prt->
GetE();
89 bool zero_p = TMath::Abs(in_p)>0.001 && TMath::Abs(sm_p)<0.00001;
90 bool zero_e = TMath::Abs(in_e)>0.001 && TMath::Abs(sm_e)<0.00001;
92 if(zero_p && zero_e) {
114 TDatabasePDG*
db = TDatabasePDG::Instance();
116 TParticlePDG* pdg_particle =
db->GetParticle(pdg);
119 stat.null_particles=0;
120 stat.zero_e_smear_p=0;
121 stat.smear_e_zero_p=0;
122 stat.smear_e_smear_p=0;
123 stat.zero_e_zero_p=0;
125 stat.null_particles_eta =
new TH1D(
"null_particles_eta",
"Unsmeared particles;#eta;counts", 200, -5, 5 );
126 stat.zero_e_smear_p_eta =
new TH1D(
"zero_e_smear_p_eta",
"only p smeared;#eta;counts", 100, -5, 5 );
127 stat.smear_e_zero_p_eta =
new TH1D(
"smear_e_zero_p_eta",
"only e smeared;#eta;counts", 100, -5, 5 );
128 stat.zero_e_zero_p_eta =
new TH1D(
"zero_e_zero_p_eta",
"Unsmeared particles;#eta;counts", 100, -5, 5 );
129 stat.smear_e_smear_p_eta =
new TH1D(
"smear_e_smear_p_eta",
"smeared e, smeared p;#eta;counts", 100, -5, 5 );
131 stat.smear_DelP =
new TH2D(
"smear_DelP",
"#Delta p/p;p;#Delta p/p", 100, 0, 20, 100, -0.1,0.1);
135 for(
int angle_deg=angleinc; angle_deg < 180; angle_deg+=angleinc) {
137 TLorentzVector input_vect(0, 0,
mom, sqrt (
mom*
mom + pow(pdg_particle->Mass(),2)) );
146 stat.null_particles++;
147 stat.null_particles_eta->Fill(input_vect.Eta());
150 stat.zero_e_smear_p++;
151 stat.zero_e_smear_p_eta->Fill(input_vect.Eta());
152 stat.smear_DelP->Fill(input_vect.P(), (input_vect.P() - step.
smeared_lorentz.P()) / input_vect.P());
155 stat.smear_e_zero_p++;
156 stat.smear_e_zero_p_eta->Fill(input_vect.Eta());
159 stat.zero_e_zero_p++;
160 stat.zero_e_zero_p_eta->Fill(input_vect.Eta());
163 stat.smear_e_smear_p++;
164 stat.smear_e_smear_p_eta->Fill(input_vect.Eta());
165 stat.smear_DelP->Fill(input_vect.P(), (input_vect.P() - step.
smeared_lorentz.P()) / input_vect.P());
169 stat.steps.push_back(step);
178 cout<<
"SmearingFactory statistics:\n";
179 cout <<
" total_particles = " << setw(8) << stat.
total_particles <<
" \n";
180 cout <<
" null_particles = " << setw(8) << stat.
null_particles <<
" (not smeared)\n";
181 cout <<
" zero_e_zero_p = " << setw(8) << stat.
zero_e_zero_p <<
" (not smeared)\n";
182 cout <<
" zero_e_smear_p = " << setw(8) << stat.
zero_e_smear_p <<
" (partly smeared)\n";
183 cout <<
" smear_e_zero_p = " << setw(8) << stat.
smear_e_zero_p <<
" (partly smeared)\n";
184 cout <<
" smear_e_smear_p = " << setw(8) << stat.
smear_e_smear_p <<
" (smeared)\n";
198 std::string detstring =
"Matrix";
206 for (
auto &
c: detstring)
c = toupper(
c);
209 if ( TString(detstring).Contains(
"MATRIX") && TString(detstring).Contains(
"FF")){
210 const int beam_mom_nn=100;
217 std::cerr <<
"Detector sepcified as " << detstring
218 <<
" not recognized or empty." << std::endl;
225 gStyle->SetOptStat(0);
226 gStyle->SetHistLineWidth(2);
227 float lMargin = 0.12;
228 float bMargin = 0.12;
229 gStyle->SetLabelSize(.05,
"XY");
230 gStyle->SetTitleSize(.05,
"XY");
231 gStyle->SetTitleOffset(1.1,
"x");
232 gStyle->SetTitleOffset(1.1,
"y");
235 TString
title = detstring;
236 title +=
", pid="; title +=
pid;
237 TLegend *
leg =
new TLegend( 0.65, 0.65, 0.95, 0.95, title);
265 TString outname=detstring;
266 outname +=
"_"; outname+=
pid;
267 outname +=
"_eta.png";
268 gPad->SaveAs(outname);
269 gPad->SaveAs(
"etaplot.png");
275 outname +=
"_"; outname+=
pid;
276 outname +=
"_DelP.png";
277 gPad->SaveAs(outname);
278 gPad->SaveAs(
"DelPplot.png");