26 if(XsecCov->GetNumParamsFromDetID(SampleDetID, kSpline) > 0){
27 MACH3LOG_INFO(
"Found {} splines for this sample so I will create a spline object", XsecCov->GetNumParamsFromDetID(SampleDetID, kSpline));
29 splineFile = (splineFDBase*)DUNESplines;
30 InitialiseSplineObject();
33 MACH3LOG_INFO(
"Found {} splines for this sample so I will not load or evaluate splines", XsecCov->GetNumParamsFromDetID(SampleDetID, kSpline));
44 MCSamples[i].ntotal_weight_pointers[j] = 6;
45 MCSamples[i].total_weight_pointers[j] =
new const double*[MCSamples[i].ntotal_weight_pointers[j]];
48 MCSamples[i].total_weight_pointers[j][2] = MCSamples[i].osc_w_pointer[j];
51 MCSamples[i].total_weight_pointers[j][5] = &(MCSamples[i].xsec_w[j]);
59 int nutype = sample_nutype[iSample];
60 int oscnutype = sample_oscnutype[iSample];
61 bool signal = sample_signal[iSample];
63 MACH3LOG_INFO(
"-------------------------------------------------------------------");
64 MACH3LOG_INFO(
"Input File: {}", mc_files.at(iSample));
66 _sampleFile = TFile::Open(mc_files.at(iSample).c_str(),
"READ");
70 MACH3LOG_INFO(
"Found \"caf\" tree in {}", mc_files[iSample]);
71 MACH3LOG_INFO(
"With number of entries: {}",
_data->GetEntries());
74 MACH3LOG_ERROR(
"Could not find \"caf\" tree in {}", mc_files[iSample]);
75 throw MaCh3Exception(__FILE__, __LINE__);
78 _data->SetBranchStatus(
"*", 1);
79 _data->SetBranchAddress(
"rec", &
sr);
85 duneobj->nutype = nutype;
86 duneobj->oscnutype = oscnutype;
87 duneobj->signal = signal;
133 int num_no_recparticles = 0;
135 int num_in_fdv_noreco = 0;
136 int num_notin_fdv =0;
137 int num_nanenergy =0;
138 int num_nanparticles =0;
141 for (
int i = 0; i < (duneobj->
nEvents); ++i) {
143 double radius = pow((pow((
sr->mc.nu[0].vtx.y+150),2) + pow((
sr->mc.nu[0].vtx.z-1486),2)),0.5);
144 if(std::abs(
sr->mc.nu[0].vtx.x)<=209.0 && radius<=227.02){
152 if(
sr->common.ixn.ngsft == 0){
156 duneobj->
rw_yrec[i] = (double)(0);
164 int nixns = (int)(
sr->common.ixn.ngsft);
165 for(
int i_ixn =0; i_ixn<nixns; i_ixn++) {
166 int nrecoparticles = (int)(
sr->common.ixn.gsft[i_ixn].part.ngsft);
168 int nanparticles = 0;
169 if(nrecoparticles ==0){
170 double radius = pow((pow((
sr->mc.nu[0].vtx.y+150.),2) + pow((
sr->mc.nu[0].vtx.z-1486.),2)),0.5);
171 if(std::abs(
sr->mc.nu[0].vtx.x)<=209.0 || radius<=227.02) {
174 num_no_recparticles++;}
175 for(
int i_part =0; i_part<nrecoparticles; i_part++) {
176 float erec_part = (float)(
sr->common.ixn.gsft[i_ixn].part.gsft[i_part].E);
177 if(std::isnan(erec_part)){nanparticles++;}
178 erec_total+=erec_part;
179 if((
float)(
sr->common.ixn.gsft[i_ixn].part.gsft[i_part].score.gsft_pid.muon_score>muonscore)){
180 if(erec_part>elep_reco){
181 elep_reco = erec_part;
182 duneobj->
rw_reco_vtx_x[i] = (double)((
float)(
sr->common.ixn.gsft[i_ixn].part.gsft[i_part].start.x));
183 duneobj->
rw_reco_vtx_y[i] = (double)((
float)(
sr->common.ixn.gsft[i_ixn].part.gsft[i_part].start.y));
184 duneobj->
rw_reco_vtx_z[i] = (double)((
float)(
sr->common.ixn.gsft[i_ixn].part.gsft[i_part].start.z));
185 duneobj->
rw_lep_pT[i] = (double)(pow(pow((
float)(
sr->common.ixn.gsft[i_ixn].part.gsft[i_part].p.x), 2) + pow((
float)(
sr->common.ixn.gsft[i_ixn].part.gsft[i_part].p.y), 2), 0.5));
186 duneobj->
rw_lep_pZ[i] = (double)(
sr->common.ixn.gsft[i_ixn].part.gsft[i_part].p.z);
191 num_nanparticles = num_nanparticles + (nanparticles/nrecoparticles);
193 if(std::isnan(erec_total)){num_nanenergy++; erec_total = (float)(
sr->common.ixn.gsft[0].Enu.lep_calo);}
195 else{duneobj->
rw_erec[i]=(double)(erec_total);}
200 else{duneobj->
rw_yrec[i] = (double)(0);}
201 duneobj->
rw_etru[i] = (double)(
sr->mc.nu[0].E);
202 duneobj->
rw_isCC[i] = (int)(
sr->mc.nu[0].iscc);
207 int ntrueparticles = (int)(
sr->mc.nu[0].nprim);
208 for(
int i_truepart =0; i_truepart<ntrueparticles; i_truepart++){
209 if(std::abs(
sr->mc.nu[0].prim[i_truepart].pdg) == 13){
214 int ntruesecparticles = (int)(
sr->mc.nu[0].nsec);
215 for(
int i_truepart =0; i_truepart<ntruesecparticles; i_truepart++){
216 if(std::abs(
sr->mc.nu[0].sec[i_truepart].pdg) == 13){
221 duneobj->
nproton[i] =
sr->mc.nu[0].nproton;
223 duneobj->
npip[i] =
sr->mc.nu[0].npip;
224 duneobj->
npim[i] =
sr->mc.nu[0].npim;
225 duneobj->
npi0[i] =
sr->mc.nu[0].npi0;
228 duneobj->
rw_vtx_x[i] = (double)(
sr->mc.nu[0].vtx.x);
229 duneobj->
rw_vtx_y[i] = (double)(
sr->mc.nu[0].vtx.y);
230 duneobj->
rw_vtx_z[i] = (double)(
sr->mc.nu[0].vtx.z);
232 duneobj->
rw_rad[i] = (double)(pow((pow((duneobj->
rw_vtx_y[i]+150),2) + pow((duneobj->
rw_vtx_z[i]-1486),2)),0.5));
240 _isCC = (int)(
sr->mc.nu[0].iscc);
242 int mode= TMath::Abs(
_mode);
253 double* KinematicValue;
255 switch(KinematicParameter) {
302 MACH3LOG_ERROR(
"Did not recognise Kinematic Parameter type...");
303 throw MaCh3Exception(__FILE__, __LINE__);
306 return KinematicValue;
329 fdmc_base *fdobj = &(MCSamples[iSample]);
331 fdobj->nutype = duneobj->nutype;
332 fdobj->oscnutype = duneobj->oscnutype;
333 fdobj->signal = duneobj->signal;
334 fdobj->SampleDetID = SampleDetID;
336 for(
int iEvent = 0 ;iEvent < fdobj->nEvents ; ++iEvent){
337 fdobj->rw_etru[iEvent] = &(duneobj->
rw_etru[iEvent]);
338 fdobj->mode[iEvent] = &(duneobj->
mode[iEvent]);
339 fdobj->Target[iEvent] = &(duneobj->
Target[iEvent]);
351 std::vector<double> binningVector;
354 for(
double ibins =0; ibins<10*10; ibins++){
355 double binval = ibins/10;
356 binningVector.push_back(binval);
360 for(
double ibins =0; ibins<10*10; ibins++){
361 double binval = ibins/10;
362 binningVector.push_back(binval);
367 for(
double ibins =0; ibins<259*2; ibins++){
368 binningVector.push_back(ibins-259);
373 for(
double ibins =0; ibins<277*2; ibins++){
374 binningVector.push_back(ibins-277-150);
379 for(
double ibins =0; ibins<277*2; ibins++){
380 binningVector.push_back(ibins-277+1486);
384 for(
double ibins =0; ibins<10; ibins++){
385 binningVector.push_back(ibins);
389 for(
double ibins =0; ibins<50; ibins++){
390 binningVector.push_back(ibins);
394 for(
double ibins =0; ibins<3; ibins++){
395 binningVector.push_back(ibins);
400 for(
double ibins =0; ibins<20*10; ibins++){
401 binningVector.push_back(-10+(
double)(ibins)/10);
405 for(
double ibins =0; ibins<20*10; ibins++){
406 binningVector.push_back(-10+(
double)(ibins)/10);
411 for(
double ibins =0; ibins<10; ibins++){
412 binningVector.push_back(ibins);
416 for(
double ibins =0; ibins<10*10; ibins++){
417 binningVector.push_back((
double)(ibins)/10);
421 for(
double ibins =0; ibins<10*10; ibins++){
422 binningVector.push_back((
double)(ibins)/10);
427 for(
double ibins =0; ibins<300; ibins++){
428 binningVector.push_back(ibins);
433 for(
double ibins =0; ibins<10*10; ibins++){
434 binningVector.push_back((
double)(ibins)/10);
438 for(
double ibins =0; ibins<10*100; ibins++){
439 binningVector.push_back(ibins/100);
444 return binningVector;