351 const float gastpc_len = 2.;
353 const float gastpc_B = 0.5;
354 const float gastpc_padPitch = 1.0;
355 const float gastpc_X0 = 1300.;
357 const float sigmaP_short = 0.1;
359 const float sigma_x = 0.1;
361 std::vector<float> v;
362 for (
float pit = 0.040; pit < 20.0; pit += 0.001)
370 const float NeutronECAL_detEff[2] = {0.2, 0.4};
371 const float sigmaNeutronECAL_first = 0.11;
375 const float ECAL_stock = 0.06;
376 const float ECAL_const = 0.02;
377 TF1 *fRes =
new TF1(
"fRes",
"TMath::Sqrt ( [0]*[0]/x + [1]*[1] )");
378 fRes->FixParameter(0, ECAL_stock);
379 fRes->FixParameter(1, ECAL_const);
383 const int nLayers = 60;
385 const double ECAL_MIP_Res = 0.23;
387 const double MIP2GeV_factor = 0.814 / 1000;
389 const float ECAL_time_resolution = 1.;
390 TParticlePDG *neutron = TDatabasePDG::Instance()->GetParticle(2112);
391 const float neutron_mass = neutron->Mass();
395 TString
filename=
"${DUNE_PARDATA_DIR}/MPD/dedxPID/dedxpidmatrices8kevcm.root";
396 TFile
infile(filename,
"READ");
400 for (
int q = 0; q < 501; ++q)
402 sprintf(str,
"%d", q);
407 m_pidinterp.insert( std::make_pair(q, (TH2F*)
infile.Get(s.c_str())->Clone(
"pidinterp")) );
418 std::vector<float> *MC_Q2 = 0;
419 TBranch *b_MC_Q2 = 0;
420 std::vector<float> *MC_W = 0;
422 std::vector<float> *MC_Y = 0;
424 std::vector<float> *MC_X = 0;
426 std::vector<float> *MC_Theta = 0;
427 TBranch *b_MC_Theta = 0;
428 std::vector<float> *MCVertX = 0;
429 TBranch *b_MCVertX = 0;
430 std::vector<float> *MCVertY = 0;
431 TBranch *b_MCVertY = 0;
432 std::vector<float> *MCVertZ = 0;
433 TBranch *b_MCVertZ = 0;
434 std::vector<float> *MCNuPx = 0;
435 TBranch *b_MCNuPx = 0;
436 std::vector<float> *MCNuPy = 0;
437 TBranch *b_MCNuPy = 0;
438 std::vector<float> *MCNuPz = 0;
439 TBranch *b_MCNuPz = 0;
440 std::vector<int> *NType = 0;
441 TBranch *b_NType = 0;
442 std::vector<int> *CCNC = 0;
444 std::vector<int> *Mode = 0;
446 std::vector<int> *Gint=0;
448 std::vector<int> *TgtPDG = 0;
449 TBranch *b_TgtPDG = 0;
450 std::vector<int> *
GT_T = 0;
452 std::vector<int> *InterT=0;
453 TBranch *b_InterT = 0;
454 std::vector<float> *Weight = 0;
455 TBranch *b_Weight = 0;
457 std::vector<int> *_nGPart = 0;
458 TBranch *b_nGPart = 0;
459 std::vector<int> *_GPartPdg = 0;
460 TBranch *b_GPartPdg = 0;
461 std::vector<int> *_GPartStatus = 0;
462 TBranch *b_GPartStatus = 0;
463 std::vector<std::string> *_GPartName = 0;
464 TBranch *b_GPartName = 0;
465 std::vector<int> *_GPartFirstMom = 0;
466 TBranch *b_GPartFirstMom = 0;
467 std::vector<int> *_GPartLastMom = 0;
468 TBranch *b_GPartLastMom = 0;
469 std::vector<int> *_GPartFirstDaugh = 0;
470 TBranch *b_GPartFirstDaugh = 0;
471 std::vector<int> *_GPartLastDaugh = 0;
472 TBranch *b_GPartLastDaugh = 0;
473 std::vector<float> *_GPartPx = 0;
474 TBranch *b_GPartPx = 0;
475 std::vector<float> *_GPartPy = 0;
476 TBranch *b_GPartPy = 0;
477 std::vector<float> *_GPartPz = 0;
478 TBranch *b_GPartPz = 0;
479 std::vector<float> *_GPartE = 0;
480 TBranch *b_GPartE = 0;
481 std::vector<float> *_GPartMass = 0;
482 TBranch *b_GPartMass = 0;
484 std::vector<int> *
PDG = 0;
486 std::vector<int> *MCPTrkID = 0;
487 TBranch *b_MCPTrkID = 0;
488 std::vector<int> *MCMotherTrkID = 0;
489 TBranch *b_MCMotherTrkID = 0;
490 std::vector<int> *PDGMother = 0;
491 TBranch *b_PDGMother = 0;
492 std::vector<float> *MCPTime = 0;
493 TBranch *b_MCPTime = 0;
494 std::vector<float> *MCPStartX = 0;
495 TBranch *b_MCPStartX = 0;
496 std::vector<float> *MCPStartY = 0;
497 TBranch *b_MCPStartY = 0;
498 std::vector<float> *MCPStartZ = 0;
499 TBranch *b_MCPStartZ = 0;
500 std::vector<float> *MCPStartPX = 0;
501 TBranch *b_MCPStartPX = 0;
502 std::vector<float> *MCPStartPY = 0;
503 TBranch *b_MCPStartPY = 0;
504 std::vector<float> *MCPStartPZ = 0;
505 TBranch *b_MCPStartPZ = 0;
506 std::vector<std::string> *MCPProc = 0;
507 TBranch *b_MCPProc = 0;
508 std::vector<std::string> *MCPEndProc = 0;
509 TBranch *b_MCPEndProc = 0;
510 std::vector<float> *MCPEndX = 0;
511 TBranch *b_MCPEndX = 0;
512 std::vector<float> *MCPEndY = 0;
513 TBranch *b_MCPEndY = 0;
514 std::vector<float> *MCPEndZ = 0;
515 TBranch *b_MCPEndZ = 0;
516 std::vector<float> *TrajMCPX = 0;
517 TBranch *b_TrajMCPX = 0;
518 std::vector<float> *TrajMCPY = 0;
519 TBranch *b_TrajMCPY = 0;
520 std::vector<float> *TrajMCPZ = 0;
521 TBranch *b_TrajMCPZ = 0;
522 std::vector<int> *TrajMCPTrajIndex = 0;
523 TBranch *b_TrajMCPTrajIndex = 0;
525 _inttree->SetBranchAddress(
"Event", &Event);
526 _inttree->SetBranchAddress(
"SubRun", &SubRun);
527 _inttree->SetBranchAddress(
"Run", &Run);
530 _inttree->SetBranchAddress(
"NType", &NType, &b_NType);
531 _inttree->SetBranchAddress(
"CCNC", &CCNC, &b_CCNC);
532 _inttree->SetBranchAddress(
"MC_Q2", &MC_Q2, &b_MC_Q2);
533 _inttree->SetBranchAddress(
"MC_W", &MC_W, &b_MC_W);
534 _inttree->SetBranchAddress(
"MC_Y", &MC_Y, &b_MC_Y);
535 _inttree->SetBranchAddress(
"MC_X", &MC_X, &b_MC_X);
536 _inttree->SetBranchAddress(
"MC_Theta", &MC_Theta, &b_MC_Theta);
537 _inttree->SetBranchAddress(
"Mode", &Mode, &b_Mode);
538 _inttree->SetBranchAddress(
"Gint", &Gint, &b_Gint);
539 _inttree->SetBranchAddress(
"TgtPDG", &TgtPDG, &b_TgtPDG);
540 _inttree->SetBranchAddress(
"GT_T", >_T, &b_GT_T);
541 _inttree->SetBranchAddress(
"MCVertX", &MCVertX, &b_MCVertX);
542 _inttree->SetBranchAddress(
"MCVertY", &MCVertY, &b_MCVertY);
543 _inttree->SetBranchAddress(
"MCVertZ", &MCVertZ, &b_MCVertZ);
544 _inttree->SetBranchAddress(
"MCNuPx", &MCNuPx, &b_MCNuPx);
545 _inttree->SetBranchAddress(
"MCNuPy", &MCNuPy, &b_MCNuPy);
546 _inttree->SetBranchAddress(
"MCNuPz", &MCNuPz, &b_MCNuPz);
547 _inttree->SetBranchAddress(
"InterT", &InterT, &b_InterT);
548 _inttree->SetBranchAddress(
"Weight", &Weight, &b_Weight);
550 _inttree->SetBranchAddress(
"nGPart", &_nGPart, &b_nGPart);
551 _inttree->SetBranchAddress(
"GPartPdg", &_GPartPdg, &b_GPartPdg);
552 _inttree->SetBranchAddress(
"GPartStatus", &_GPartStatus, &b_GPartStatus);
553 _inttree->SetBranchAddress(
"GPartName", &_GPartName, &b_GPartName);
554 _inttree->SetBranchAddress(
"GPartFirstMom", &_GPartFirstMom, &b_GPartFirstMom);
555 _inttree->SetBranchAddress(
"GPartLastMom", &_GPartLastMom, &b_GPartLastMom);
556 _inttree->SetBranchAddress(
"GPartFirstDaugh", &_GPartFirstDaugh, &b_GPartFirstDaugh);
557 _inttree->SetBranchAddress(
"GPartLastDaugh", &_GPartLastDaugh, &b_GPartLastDaugh);
558 _inttree->SetBranchAddress(
"GPartPx", &_GPartPx, &b_GPartPx);
559 _inttree->SetBranchAddress(
"GPartPy", &_GPartPy, &b_GPartPy);
560 _inttree->SetBranchAddress(
"GPartPz", &_GPartPz, &b_GPartPz);
561 _inttree->SetBranchAddress(
"GPartE", &_GPartE, &b_GPartE);
562 _inttree->SetBranchAddress(
"GPartMass", &_GPartMass, &b_GPartMass);
565 _inttree->SetBranchAddress(
"PDG", &PDG, &b_PDG);
566 _inttree->SetBranchAddress(
"MCTrkID", &MCPTrkID, &b_MCPTrkID);
567 _inttree->SetBranchAddress(
"MotherTrkID", &MCMotherTrkID, &b_MCMotherTrkID);
568 _inttree->SetBranchAddress(
"MCPTime", &MCPTime, &b_MCPTime);
569 _inttree->SetBranchAddress(
"MCPStartX", &MCPStartX, &b_MCPStartX);
570 _inttree->SetBranchAddress(
"MCPStartY", &MCPStartY, &b_MCPStartY);
571 _inttree->SetBranchAddress(
"MCPStartZ", &MCPStartZ, &b_MCPStartZ);
572 _inttree->SetBranchAddress(
"MCPEndX", &MCPEndX, &b_MCPEndX);
573 _inttree->SetBranchAddress(
"MCPEndY", &MCPEndY, &b_MCPEndY);
574 _inttree->SetBranchAddress(
"MCPEndZ", &MCPEndZ, &b_MCPEndZ);
575 _inttree->SetBranchAddress(
"PDGMother", &PDGMother, &b_PDGMother);
576 _inttree->SetBranchAddress(
"MCPStartPX", &MCPStartPX, &b_MCPStartPX);
577 _inttree->SetBranchAddress(
"MCPStartPY", &MCPStartPY, &b_MCPStartPY);
578 _inttree->SetBranchAddress(
"MCPStartPZ", &MCPStartPZ, &b_MCPStartPZ);
579 _inttree->SetBranchAddress(
"MCPProc", &MCPProc, &b_MCPProc);
580 _inttree->SetBranchAddress(
"MCPEndProc", &MCPEndProc, &b_MCPEndProc);
581 _inttree->SetBranchAddress(
"TrajMCPX", &TrajMCPX, &b_TrajMCPX);
582 _inttree->SetBranchAddress(
"TrajMCPY", &TrajMCPY, &b_TrajMCPY);
583 _inttree->SetBranchAddress(
"TrajMCPZ", &TrajMCPZ, &b_TrajMCPZ);
585 _inttree->SetBranchAddress(
"TrajMCPTrackID", &TrajMCPTrajIndex, &b_TrajMCPTrajIndex);
588 std::vector<int> neutrinos = {12, 14, 16};
589 std::vector<int> pdg_neutral = {22, 2112, 111, 130, 310, 311, 2114};
591 std::vector<int> pdg_charged = {211, 13, 2212, 321, 1000010020, 11};
608 for(
size_t i = 0; i < NType->size(); i++)
610 ccnc.push_back(CCNC->at(i));
611 ntype.push_back(NType->at(i));
612 q2.push_back(MC_Q2->at(i));
613 w.push_back(MC_W->at(i));
614 y.push_back(MC_Y->at(i));
615 x.push_back(MC_X->at(i));
616 theta.push_back(MC_Theta->at(i));
617 mode.push_back(Mode->at(i));
618 intert.push_back(InterT->at(i));
624 vertx.push_back(MCVertX->at(i));
625 verty.push_back(MCVertY->at(i));
626 vertz.push_back(MCVertZ->at(i));
628 mcnupx.push_back(MCNuPx->at(i));
629 mcnupy.push_back(MCNuPy->at(i));
630 mcnupz.push_back(MCNuPz->at(i));
633 for(
size_t i = 0; i < Gint->size(); i++)
635 gint.push_back(Gint->at(i));
636 tgtpdg.push_back(TgtPDG->at(i));
637 gt_t.push_back(GT_T->at(i));
638 weight.push_back(Weight->at(i));
641 for(
size_t i = 0; i < _nGPart->size(); i++)
643 nGPart.push_back(_nGPart->at(i));
644 for(
int j = 0; j < _nGPart->at(i); j++) {
645 GPartPdg.push_back(_GPartPdg->at(j));
652 GPartPx.push_back(_GPartPx->at(j));
653 GPartPy.push_back(_GPartPy->at(j));
654 GPartPz.push_back(_GPartPz->at(j));
655 GPartE.push_back(_GPartE->at(j));
663 unsigned int nFSP = 0;
669 for(
size_t i = 0; i < MCPStartPX->size(); i++ )
675 int mctrackid = MCPTrkID->at(i);
676 int pdg = PDG->at(i);
680 TVector3 mcp(MCPStartPX->at(i), MCPStartPY->at(i), MCPStartPZ->at(i));
681 float ptrue = (mcp).Mag();
682 float pypz = std::sqrt( MCPStartPY->at(i)*MCPStartPY->at(i) + MCPStartPZ->at(i)*MCPStartPZ->at(i));
685 auto result = std::find(pdg_neutral.begin(), pdg_neutral.end(),
abs(pdg));
686 bool isNeutral = (result != pdg_neutral.end()) ?
true :
false;
700 double tracklen = 0.;
701 double tracklen_perp = 0.;
706 for(
size_t itraj = 1; itraj < TrajMCPX->size(); itraj++)
709 if(TrajMCPTrajIndex->at(itraj) == mctrackid)
722 TVector3 diff(TrajMCPX->at(itraj) - TrajMCPX->at(itraj-1), TrajMCPY->at(itraj) - TrajMCPY->at(itraj-1), TrajMCPZ->at(itraj) - TrajMCPZ->at(itraj-1));
724 TVector2 tracklen_perp_vec(TrajMCPZ->at(itraj) - TrajMCPZ->at(itraj-1), TrajMCPY->at(itraj) - TrajMCPY->at(itraj-1));
726 tracklen += diff.Mag();
727 tracklen_perp += tracklen_perp_vec.Mod();
731 trkLen.push_back(tracklen);
738 TVector3 xhat(1, 0, 0);
745 float angle = atan(mcp.X() / mcp.Z());
747 float time = MCPTime->at(i);
770 if(
trkLen.at(nFSP) > gastpc_len )
772 for (
int pidm = 0; pidm < 6; ++pidm)
774 if (
abs(pdg) == pdg_charged.at(pidm) )
784 truepx.push_back(MCPStartPX->at(i));
785 truepy.push_back(MCPStartPY->at(i));
786 truepz.push_back(MCPStartPZ->at(i));
804 truep.push_back(ptrue);
808 _MCProc.push_back(mcp_process);
811 mctrkid.push_back(MCPTrkID->at(i));
812 motherid.push_back(MCMotherTrkID->at(i));
818 float nHits = round (
trkLen.at(nFSP) / gastpc_padPitch);
820 float sigma_angle_1 = ((sigma_x * sigma_x * 0.0001) /
trkLen.at(nFSP)*
trkLen.at(nFSP)*0.0001) * (12*(nHits-1))/(nHits*(nHits+1));
822 float sigma_angle_2 = (0.015*0.015 / (3. * ptrue *
ptrue)) * (
trkLen.at(nFSP)/gastpc_X0);
824 float sigma_angle_short = sqrt(sigma_angle_1 + sigma_angle_2);
857 int nHits = round (
trkLen.at(nFSP) / gastpc_padPitch);
860 float tan_lambda = MCPStartPX->at(i)/pypz;
861 float lambda = atan2(MCPStartPX->at(i), pypz);
862 float del_lambda = 0.0062;
863 float temp = pypz*tan_lambda*del_lambda;
864 float sigmaP = (1./cos(lambda))*sqrt(sigmaPt*sigmaPt + temp*temp);
870 float sigma_angle_1 = ((sigma_x * sigma_x * 0.0001) /
trkLen.at(nFSP)*
trkLen.at(nFSP)*0.0001) * (12*(nHits-1))/(nHits*(nHits+1));
872 float sigma_angle_2 = (0.015*0.015 / (3. * ptrue *
ptrue)) * (
trkLen.at(nFSP)/gastpc_X0);
874 float sigma_angle = sqrt(sigma_angle_1 + sigma_angle_2);
890 TParticlePDG *part = TDatabasePDG::Instance()->GetParticle(
abs(pdg));
895 if( pdg == 1000010020 ) {
897 float etrue = std::sqrt(ptrue*ptrue + mass*mass) - mass;
898 float ECAL_resolution = fRes->Eval(etrue)*etrue;
903 etime.push_back(ecaltime);
921 float mass = part->Mass();
922 float etrue = std::sqrt(ptrue*ptrue + mass*mass);
923 float ECAL_resolution = fRes->Eval(etrue)*etrue;
925 erecon.push_back((ereco > 0) ? ereco : 0.);
927 etime.push_back(ecaltime);
931 if(
abs(pdg) == 11 ){
934 else if(
abs(pdg) == 13 ||
abs(pdg) == 211 )
946 else if(ptrue >= 0.48 && ptrue < 0.75)
951 if(random_number > (1 - 0.8)) {
962 if(random_number > (1 - 0.8)) {
970 else if(ptrue >= 0.75 && ptrue < 0.9)
974 if(random_number > (1 - 0.9)) {
982 if(
abs(pdg) == 211) {
983 if(random_number > (1 - 0.9)) {
995 if(random_number > (1 - 0.95)) {
1003 if(
abs(pdg) == 211){
1004 if(random_number > (1 - 0.95)) {
1013 else if(
abs(pdg) == 2212 )
1026 double Evis = (double)nLayers;
1030 double Erec = Evis * MIP2GeV_factor;
1031 erecon.push_back((Erec > 0) ? Erec : 0.);
1032 etime.push_back(ecaltime);
1036 if(
abs(pdg) == 13 ||
abs(pdg) == 211 ||
abs(pdg) == 2212 ) {
1048 etime.push_back(-1);
1067 std::vector<double> vec;
1068 std::vector<std::string> pnamelist = {
"#pi",
"#mu",
"p",
"K",
"d",
"e"};
1069 std::vector<std::string> recopnamelist = {
"#pi",
"#mu",
"p",
"K",
"d",
"e"};
1072 float dist = 100000000.;
1076 for (
int q = 0; q < 501; ++q)
1080 unsigned first = fulltitle.find(
"=");
1081 unsigned last = fulltitle.find(
"GeV");
1082 std::string substr = fulltitle.substr(first+1, last - first-1);
1083 float pidinterp_mom = std::atof(substr.c_str());
1085 float disttemp =
std::abs(pidinterp_mom - p);
1090 if( disttemp < dist ){
1099 std::vector< std::pair<float, std::string> > v_prob;
1105 if ( trueparticlename == pnamelist[pidm] )
1108 for (
int pidr = 0; pidr < 6; ++pidr)
1112 if (recoparticlename == recopnamelist[pidr])
1114 float prob =
m_pidinterp[qclosest]->GetBinContent(pidm+1,pidr+1);
1120 v_prob.push_back( std::make_pair(prob, recoparticlename) );
1125 if(v_prob.size() > 1)
1128 std::sort(v_prob.begin(), v_prob.end());
1132 std::partial_sum(v_prob.begin(), v_prob.end(), v_prob.begin(), [](
const P& _x,
const P& _y){
return P(_x.first + _y.first, _y.second);});
1134 for(
size_t ivec = 0; ivec < v_prob.size()-1; ivec++)
1136 if( random_number < v_prob.at(ivec+1).first && random_number >= v_prob.at(ivec).first )
1138 pid = pdg_charged.at(
std::distance( recopnamelist.begin(), std::find(recopnamelist.begin(), recopnamelist.end(), v_prob.at(ivec+1).second) ) );
1144 pid = pdg_charged.at(
std::distance( recopnamelist.begin(), std::find(recopnamelist.begin(), recopnamelist.end(), v_prob.at(0).second) ) );
1157 auto found = std::find(pdg_charged.begin(), pdg_charged.end(),
abs(pdg));
1158 if(
found == pdg_charged.end())
1165 truepx.push_back(MCPStartPX->at(i));
1166 truepy.push_back(MCPStartPY->at(i));
1167 truepz.push_back(MCPStartPZ->at(i));
1179 _MCPEndX.push_back(MCPEndX->at(i));
1180 _MCPEndY.push_back(MCPEndY->at(i));
1181 _MCPEndZ.push_back(MCPEndZ->at(i));
1185 truep.push_back(ptrue);
1189 _MCProc.push_back(mcp_process);
1192 etime.push_back(-1);
1198 for (
int pidr = 0; pidr < 6; ++pidr)
prob_arr.push_back(-1);
1199 mctrkid.push_back(MCPTrkID->at(i));
1200 motherid.push_back(MCMotherTrkID->at(i));
1220 float true_KE = std::sqrt(ptrue*ptrue + neutron_mass*neutron_mass) - neutron_mass;
1222 int index = (true_KE >= 0.05) ? 1 : 0;
1226 if(random_number > (1 - NeutronECAL_detEff[index]) && true_KE > 0.003)
1233 float eres = sigmaNeutronECAL_first * true_KE;
1235 float ereco = ereco_KE + neutron_mass;
1236 erecon.push_back(ereco > 0 ? ereco : 0.);
1239 truep.push_back(ptrue);
1240 truepx.push_back(MCPStartPX->at(i));
1241 truepy.push_back(MCPStartPY->at(i));
1242 truepz.push_back(MCPStartPZ->at(i));
1254 _MCPEndX.push_back(MCPEndX->at(i));
1255 _MCPEndY.push_back(MCPEndY->at(i));
1256 _MCPEndZ.push_back(MCPEndZ->at(i));
1260 _MCProc.push_back(mcp_process);
1263 etime.push_back(ecaltime);
1268 for (
int pidr = 0; pidr < 6; ++pidr)
prob_arr.push_back(-1);
1269 mctrkid.push_back(MCPTrkID->at(i));
1270 motherid.push_back(MCMotherTrkID->at(i));
1276 truep.push_back(ptrue);
1280 truepx.push_back(MCPStartPX->at(i));
1281 truepy.push_back(MCPStartPY->at(i));
1282 truepz.push_back(MCPStartPZ->at(i));
1294 _MCPEndX.push_back(MCPEndX->at(i));
1295 _MCPEndY.push_back(MCPEndY->at(i));
1296 _MCPEndZ.push_back(MCPEndZ->at(i));
1300 _MCProc.push_back(mcp_process);
1303 etime.push_back(-1);
1308 for (
int pidr = 0; pidr < 6; ++pidr)
prob_arr.push_back(-1);
1309 mctrkid.push_back(MCPTrkID->at(i));
1310 motherid.push_back(MCMotherTrkID->at(i));
1317 truep.push_back(ptrue);
1321 truepx.push_back(MCPStartPX->at(i));
1322 truepy.push_back(MCPStartPY->at(i));
1323 truepz.push_back(MCPStartPZ->at(i));
1335 _MCPEndX.push_back(MCPEndX->at(i));
1336 _MCPEndY.push_back(MCPEndY->at(i));
1337 _MCPEndZ.push_back(MCPEndZ->at(i));
1341 _MCProc.push_back(mcp_process);
1344 etime.push_back(-1);
1349 for (
int pidr = 0; pidr < 6; ++pidr)
prob_arr.push_back(-1);
1350 mctrkid.push_back(MCPTrkID->at(i));
1351 motherid.push_back(MCMotherTrkID->at(i));
1365 truep.push_back(ptrue);
1367 truepx.push_back(MCPStartPX->at(i));
1368 truepy.push_back(MCPStartPY->at(i));
1369 truepz.push_back(MCPStartPZ->at(i));
1381 _MCPEndX.push_back(MCPEndX->at(i));
1382 _MCPEndY.push_back(MCPEndY->at(i));
1383 _MCPEndZ.push_back(MCPEndZ->at(i));
1388 _MCProc.push_back(mcp_process);
1391 etime.push_back(-1);
1395 for (
int pidr = 0; pidr < 6; ++pidr)
prob_arr.push_back(-1);
1397 mctrkid.push_back(MCPTrkID->at(i));
1398 motherid.push_back(MCMotherTrkID->at(i));
1408 if( PDGMother->at(i) != 111 )
1414 float ECAL_resolution = fRes->Eval(ptrue)*
ptrue;
1416 erecon.push_back( (ereco > 0) ? ereco : 0. );
1420 truep.push_back(ptrue);
1422 truepx.push_back(MCPStartPX->at(i));
1423 truepy.push_back(MCPStartPY->at(i));
1424 truepz.push_back(MCPStartPZ->at(i));
1436 _MCPEndX.push_back(MCPEndX->at(i));
1437 _MCPEndY.push_back(MCPEndY->at(i));
1438 _MCPEndZ.push_back(MCPEndZ->at(i));
1443 _MCProc.push_back(mcp_process);
1446 etime.push_back(ecaltime);
1453 for (
int pidr = 0; pidr < 6; ++pidr)
prob_arr.push_back(-1);
1454 mctrkid.push_back(MCPTrkID->at(i));
1455 motherid.push_back(MCMotherTrkID->at(i));
1464 truep.push_back(ptrue);
1466 truepx.push_back(MCPStartPX->at(i));
1467 truepy.push_back(MCPStartPY->at(i));
1468 truepz.push_back(MCPStartPZ->at(i));
1480 _MCPEndX.push_back(MCPEndX->at(i));
1481 _MCPEndY.push_back(MCPEndY->at(i));
1482 _MCPEndZ.push_back(MCPEndZ->at(i));
1487 _MCProc.push_back(mcp_process);
1490 etime.push_back(-1);
1495 for (
int pidr = 0; pidr < 6; ++pidr)
prob_arr.push_back(-1);
1496 mctrkid.push_back(MCPTrkID->at(i));
1497 motherid.push_back(MCMotherTrkID->at(i));
1509 float ECAL_resolution = fRes->Eval(ptrue)*
ptrue;
1511 erecon.push_back((ereco > 0) ? ereco : 0.);
1515 truep.push_back(ptrue);
1517 truepx.push_back(MCPStartPX->at(i));
1518 truepy.push_back(MCPStartPY->at(i));
1519 truepz.push_back(MCPStartPZ->at(i));
1531 _MCPEndX.push_back(MCPEndX->at(i));
1532 _MCPEndY.push_back(MCPEndY->at(i));
1533 _MCPEndZ.push_back(MCPEndZ->at(i));
1538 _MCProc.push_back(mcp_process);
1541 etime.push_back(ecaltime);
1548 for (
int pidr = 0; pidr < 6; ++pidr)
prob_arr.push_back(-1);
1549 mctrkid.push_back(MCPTrkID->at(i));
1550 motherid.push_back(MCMotherTrkID->at(i));
1559 truep.push_back(ptrue);
1561 truepx.push_back(MCPStartPX->at(i));
1562 truepy.push_back(MCPStartPY->at(i));
1563 truepz.push_back(MCPStartPZ->at(i));
1575 _MCPEndX.push_back(MCPEndX->at(i));
1576 _MCPEndY.push_back(MCPEndY->at(i));
1577 _MCPEndZ.push_back(MCPEndZ->at(i));
1582 _MCProc.push_back(mcp_process);
1585 etime.push_back(-1);
1590 for (
int pidr = 0; pidr < 6; ++pidr)
prob_arr.push_back(-1);
1591 mctrkid.push_back(MCPTrkID->at(i));
1592 motherid.push_back(MCMotherTrkID->at(i));
1600 else if(std::find(neutrinos.begin(), neutrinos.end(),
abs(pdg)) != neutrinos.end())
1605 truepx.push_back(MCPStartPX->at(i));
1606 truepy.push_back(MCPStartPY->at(i));
1607 truepz.push_back(MCPStartPZ->at(i));
1619 _MCPEndX.push_back(MCPEndX->at(i));
1620 _MCPEndY.push_back(MCPEndY->at(i));
1621 _MCPEndZ.push_back(MCPEndZ->at(i));
1625 truep.push_back(ptrue);
1629 _MCProc.push_back(mcp_process);
1633 etime.push_back(-1);
1639 for (
int pidr = 0; pidr < 6; ++pidr)
prob_arr.push_back(-1);
1641 mctrkid.push_back(MCPTrkID->at(i));
1642 motherid.push_back(MCMotherTrkID->at(i));
1653 truepx.push_back(MCPStartPX->at(i));
1654 truepy.push_back(MCPStartPY->at(i));
1655 truepz.push_back(MCPStartPZ->at(i));
1667 _MCPEndX.push_back(MCPEndX->at(i));
1668 _MCPEndY.push_back(MCPEndY->at(i));
1669 _MCPEndZ.push_back(MCPEndZ->at(i));
1673 truep.push_back(ptrue);
1677 _MCProc.push_back(mcp_process);
1681 etime.push_back(ecaltime);
1683 TParticlePDG *part = TDatabasePDG::Instance()->GetParticle(
abs(pdg));
1686 mass = part->Mass();
1688 float etrue = std::sqrt(ptrue*ptrue + mass*mass);
1689 float ECAL_resolution = fRes->Eval(etrue)*etrue;
1691 erecon.push_back((ereco > 0) ? ereco : 0.);
1694 if(
abs(pdg) == 11 ){
1697 else if(
abs(pdg) == 13 ||
abs(pdg) == 211 )
1709 else if(ptrue >= 0.48 && ptrue < 0.75)
1714 if(random_number > (1 - 0.8)) {
1725 if(random_number > (1 - 0.8)) {
1733 else if(ptrue >= 0.75 && ptrue < 0.9)
1737 if(random_number > (1 - 0.9)) {
1745 if(
abs(pdg) == 211) {
1746 if(random_number > (1 - 0.9)) {
1758 if(random_number > (1 - 0.95)) {
1766 if(
abs(pdg) == 211){
1767 if(random_number > (1 - 0.95)) {
1776 else if(
abs(pdg) == 2212 )
1787 for (
int pidr = 0; pidr < 6; ++pidr)
prob_arr.push_back(-1);
1789 mctrkid.push_back(MCPTrkID->at(i));
1790 motherid.push_back(MCMotherTrkID->at(i));
1795 truepx.push_back(MCPStartPX->at(i));
1796 truepy.push_back(MCPStartPY->at(i));
1797 truepz.push_back(MCPStartPZ->at(i));
1809 _MCPEndX.push_back(MCPEndX->at(i));
1810 _MCPEndY.push_back(MCPEndY->at(i));
1811 _MCPEndZ.push_back(MCPEndZ->at(i));
1815 truep.push_back(ptrue);
1819 _MCProc.push_back(mcp_process);
1824 double Evis = (double)nLayers;
1828 double Erec = Evis * MIP2GeV_factor;
1829 erecon.push_back((Erec > 0) ? Erec : 0.);
1830 etime.push_back(ecaltime);
1834 if(
abs(pdg) == 13 ||
abs(pdg) == 211 ||
abs(pdg) == 2212 ) {
1844 for (
int pidr = 0; pidr < 6; ++pidr)
prob_arr.push_back(-1);
1846 mctrkid.push_back(MCPTrkID->at(i));
1847 motherid.push_back(MCMotherTrkID->at(i));
1853 truepx.push_back(MCPStartPX->at(i));
1854 truepy.push_back(MCPStartPY->at(i));
1855 truepz.push_back(MCPStartPZ->at(i));
1867 _MCPEndX.push_back(MCPEndX->at(i));
1868 _MCPEndY.push_back(MCPEndY->at(i));
1869 _MCPEndZ.push_back(MCPEndZ->at(i));
1873 truep.push_back(ptrue);
1877 _MCProc.push_back(mcp_process);
1880 etime.push_back(-1);
1886 for (
int pidr = 0; pidr < 6; ++pidr)
prob_arr.push_back(-1);
1887 mctrkid.push_back(MCPTrkID->at(i));
1888 motherid.push_back(MCMotherTrkID->at(i));
1898 _nFSP.push_back(nFSP);
1905 std::cerr <<
"Number of FSP " << nFSP <<
std::endl;
1955 std::cerr <<
"Event with wrong vector sizes... skipped" <<
std::endl;
bool isBarrel(const TVector3 &point)
std::vector< double > _angle
std::vector< int > tgtpdg
std::vector< int > GPartFirstDaugh
std::vector< unsigned int > isInBetweenStart
std::vector< int > GPartStatus
std::vector< int > recopid
std::vector< float > GPartPz
std::vector< std::string > _MCEndProc
std::vector< unsigned int > isBarrelStart
std::vector< double > truep
std::vector< double > etime
std::vector< float > GPartPy
std::vector< double > trkLen
std::vector< double > trkLenPerp
std::vector< int > _MCPStartY
std::vector< unsigned int > _nFSP
std::vector< std::string > GPartName
float GaussianSmearing(const float &mean, const float &sigma)
std::vector< double > _preco
float calcGluck(double sigmaX, double B, double X0, float nHits, double mom, double length, double &ratio)
std::vector< unsigned int > isEndcapEnd
std::vector< int > motherid
std::vector< unsigned int > isFidStart
std::vector< float > GPartMass
std::vector< double > mctime
std::vector< unsigned int > isBarrelEnd
std::vector< double > mcnupy
std::vector< int > recopidecal
std::vector< unsigned int > isThroughCaloStart
std::vector< double > erecon
std::vector< int > GPartFirstMom
std::vector< double > mcnupz
std::vector< double > theta
std::vector< int > _MCPEndZ
std::vector< int > _MCPStartX
std::vector< int > detected
std::pair< float, std::string > P
bool PointInTPC(const TVector3 &point)
std::vector< unsigned int > isThroughCaloEnd
bool isThroughCalo(const TVector3 &point)
std::vector< int > intert
std::vector< double > anglereco
std::vector< int > _MCPStartZ
std::vector< int > truepdg
bool PointInCalo(const TVector3 &point)
std::vector< double > verty
std::unordered_map< int, TH2F * > m_pidinterp
double distance(double x1, double y1, double z1, double x2, double y2, double z2)
std::vector< float > GPartE
std::vector< unsigned int > isInBetweenEnd
std::vector< int > nGPart
std::vector< int > pdgmother
std::vector< int > _MCPEndY
std::vector< unsigned int > isTPCStart
std::vector< double > vertz
std::vector< double > truepz
std::vector< double > vertx
constexpr double dist(const TReal *x, const TReal *y, const unsigned int dimension)
std::vector< double > truepx
std::vector< int > weight
std::vector< int > GPartLastMom
unsigned int _correct4origin
sets the string for the coordinates origins (World or TPC)
std::vector< float > GPartPx
std::vector< unsigned int > isCaloEnd
std::vector< unsigned int > isFidEnd
std::vector< int > GPartPdg
bool PointInFiducial(const TVector3 &point)
std::vector< unsigned int > isTPCEnd
std::vector< unsigned int > isCaloStart
std::vector< double > truepy
std::vector< double > mcnupx
bool isEndcap(const TVector3 &point)
std::vector< unsigned int > isEndcapStart
std::vector< int > mctrkid
std::vector< int > GPartLastDaugh
bool PointStopBetween(const TVector3 &point)
std::vector< double > prob_arr
std::vector< int > _MCPEndX
QTextStream & endl(QTextStream &s)
QCString & append(const char *s)
std::vector< std::string > _MCProc