513 std::vector<float> empty4Vector;
514 empty4Vector.resize(4);
517 p1PhotonConversionPos.reserve(NPi0FinalState);
518 p1PhotonConversionMom.reserve(NPi0FinalState);
519 p2PhotonConversionPos.reserve(NPi0FinalState);
520 p2PhotonConversionMom.reserve(NPi0FinalState);
521 pionPos.reserve(NPi0FinalState);
522 pionMom.reserve(NPi0FinalState);
523 miscPhotonConversionPos.reserve(NGamma);
524 miscPhotonConversionMom.reserve(NGamma);
527 int nPrimaryLepton(0);
528 int nPrimaryGamma(0);
531 chargedPionPos.resize(NChargedPions);
532 chargedPionMom.resize(NChargedPions);
536 for (
unsigned int i = 0; i < mclarg4 ->
size(); i ++){
537 art::Ptr<simb::MCParticle> particle(mclarg4,i);
541 if (particle -> Mother() == 0 ){
546 if (isCC == 0) nPrimaryLepton ++;
548 if (
abs(particle -> PdgCode()) == 11 ||
549 abs(particle -> PdgCode()) == 12 ||
550 abs(particle -> PdgCode()) == 13 ||
551 abs(particle -> PdgCode()) == 14 )
556 int nTrajectoryPoints = particle -> NumberTrajectoryPoints();
557 leptonPos.reserve(nTrajectoryPoints);
558 leptonMom.reserve(nTrajectoryPoints);
559 for (
int traj_point = 0; traj_point < nTrajectoryPoints; ++traj_point){
560 leptonPos.push_back(empty4Vector);
561 pack4Vector(particle -> Position(traj_point),leptonPos.back());
562 leptonMom.push_back(empty4Vector);
563 pack4Vector(particle -> Momentum(traj_point),leptonMom.back());
564 if (!
isInTPC(particle -> Position(traj_point).Vect()))
break;
568 if (particle -> PdgCode() == 22)
571 TLorentzVector conversionPoint, conversionMom;
573 miscPhotonConversionPos.push_back(empty4Vector);
574 miscPhotonConversionMom.push_back(empty4Vector);
575 pack4Vector(conversionPoint,miscPhotonConversionPos.back());
576 pack4Vector(conversionMom, miscPhotonConversionMom.back());
579 if (particle -> PdgCode() == 111)
581 pionPos.push_back(empty4Vector);
582 pionMom.push_back(empty4Vector);
583 pack4Vector(particle->EndPosition(),pionPos.back());
587 if ( particle -> NumberDaughters() == 2){
589 TLorentzVector conversionPoint, conversionMom;
590 art::Ptr<simb::MCParticle> daughter0
594 p1PhotonConversionPos.push_back(empty4Vector);
595 p1PhotonConversionMom.push_back(empty4Vector);
596 pack4Vector(conversionPoint,p1PhotonConversionPos.back());
597 pack4Vector(conversionMom, p1PhotonConversionMom.back());
600 art::Ptr<simb::MCParticle> daughter1
604 p2PhotonConversionPos.push_back(empty4Vector);
605 p2PhotonConversionMom.push_back(empty4Vector);
606 pack4Vector(conversionPoint,p2PhotonConversionPos.back());
607 pack4Vector(conversionMom, p2PhotonConversionMom.back());
611 TLorentzVector conversionPoint, conversionMom;
612 p2PhotonConversionPos.push_back(empty4Vector);
613 p2PhotonConversionMom.push_back(empty4Vector);
614 for (
int daughter = 0; daughter < 3; daughter ++ ){
615 art::Ptr<simb::MCParticle> daughterParticle
617 if (daughterParticle->PdgCode() == 22) {
621 p1PhotonConversionPos.push_back(empty4Vector);
622 p1PhotonConversionMom.push_back(empty4Vector);
623 pack4Vector(conversionPoint,p1PhotonConversionPos.back());
624 pack4Vector(conversionMom, p1PhotonConversionMom.back());
632 if (
abs(particle -> PdgCode()) == 211)
634 chargedPionSign.push_back(particle ->PdgCode() / 211);
635 int nTrajectoryPoints = particle -> NumberTrajectoryPoints();
636 unsigned int index = chargedPionSign.size() - 1;
637 chargedPionPos[index].reserve(nTrajectoryPoints);
638 chargedPionMom[index].reserve(nTrajectoryPoints);
639 for (
int traj_point = 0; traj_point < nTrajectoryPoints; ++ traj_point){
640 chargedPionPos[index].push_back(empty4Vector);
642 chargedPionPos[index].back());
643 chargedPionMom[index].push_back(empty4Vector);
645 chargedPionMom[index].back());
657 if (nPrimaryGamma != NGamma){
658 std::cerr <<
"Major problems here ... nPrimaryGamma\n"
659 <<
" Should be " << NGamma
660 <<
" but is " << nPrimaryGamma <<
"\n";
663 if (nPrimaryPi0 != NPi0FinalState){
664 std::cerr <<
"Major problems here ... nPrimaryPi0\n"
665 <<
" Should be " << NPi0FinalState
666 <<
" but is " << nPrimaryPi0 <<
"\n";
void pack4Vector(const TLorentzVector &input, std::vector< float > &output) const
void GetPhotonConversionInfo(art::Ptr< simb::MCParticle > photon, TLorentzVector &ConversionPos, TLorentzVector &ConversionMom)
bool isInTPC(const TVector3 &) const
BEGIN_PROLOG could also be cerr
std::size_t size(FixedBins< T, C > const &) noexcept
art::Ptr< simb::MCParticle > getParticleByID(art::Handle< std::vector< simb::MCParticle > > &mclistLARG4, int) const