5 #ifndef LBNEQuickPitoNu_H 6 #define LBNEQuickPitoNu_H 1 11 #include "G4EventManager.hh" 12 #include "G4RunManager.hh" 13 #include "G4ExceptionSeverity.hh" 17 class LBNEQuickPitoNu;
56 std::vector<LBNEQuickPiToNu>
data;
62 inline bool doIt()
const {
return doItForReal;}
65 std::cerr <<
" From LBNEQuickPiToNuVect, file has been already opened, close it " <<
std::endl;
69 fOut.open(fName.c_str());
70 fOut <<
" evtNum trNum sign piEnergy nuEnergy piPxTgt piPyTgt pixH2 piyH2 pizH2 piPxH2 piPyH2 ";
73 inline void close() {fOut.close();}
74 inline void addPion(
int trNum1,
int sign1,
double e, G4ThreeVector
p) {
76 int evtno = pRunManager->GetCurrentEvent()->GetEventID();
83 bool foundPion =
false;
85 if ((it->trNum == -9999) || (it->trNum == -9998))
continue;
86 if (it->trNum != trNum1)
continue;
87 for (
size_t k=0;
k!= 3;
k++) {
88 it->piMomentumAtHangerRing[
k] = p[
k];
89 it->piPosAtHangerRing[
k] = xPos[
k];
91 foundPion =
true;
return;
94 const double e = std::sqrt((139.58*139.58) + p[0]*p[0] + p[1]*p[1] + p[2]*p[2]);
95 std::cerr <<
" Found new secondary pion, declare it with a higher track number " <<
std::endl;
96 addPion(10000+trNum1, sign, e, p);
100 inline void blessPion(
int trNum1,
double e, G4ThreeVector
p) {
101 bool foundPion =
false;
103 if ((it->trNum == -9999) || (it->trNum == -9998))
continue;
104 if ((it->trNum != trNum1) && ((it->trNum-10000) != trNum1))
continue;
105 for (
size_t k=0;
k!= 3;
k++) {
106 it->nuMomentum[
k] = p[
k];
109 foundPion =
true;
return;
111 std::ostringstream mStrStr;
112 mStrStr <<
"Found Unknown pion.. Should not happen.. Stop here. Fatal " <<
std::endl;
113 G4String mStr(mStrStr.str());
114 G4Exception(
"LBNERunAction::BeginOfRunAction",
" ", RunMustBeAborted, mStr.c_str());
118 inline void reset () { data.clear();}
122 if ((it->trNum == -9999) || (it->trNum == -9998))
continue;
123 if (
std::abs(it->nuEnergy) < 0.001)
continue;
124 fOut <<
" " << it->evtNum <<
" " << it->trNum <<
" " << it->sign <<
" " << it->piEnergy;
125 fOut <<
" " << it->nuEnergy;
126 fOut <<
" " << it->piMomentumTarget[0]/it->piMomentumTarget[2] <<
" " 127 << it->piMomentumTarget[1]/it->piMomentumTarget[2];
128 for (
size_t k=0;
k != 3;
k++) fOut <<
" " << it->piPosAtHangerRing[
k];
129 const double rSq = it->piPosAtHangerRing[0]*it->piPosAtHangerRing[0] +
130 it->piPosAtHangerRing[1]*it->piPosAtHangerRing[1];
132 fOut <<
" " << it->piMomentumAtHangerRing[0]/it->piMomentumAtHangerRing[2] <<
" " 133 << it->piMomentumAtHangerRing[1]/it->piMomentumAtHangerRing[2];
134 else fOut <<
" 0. 0. ";
135 fOut <<
" " << it->nuMomentum[0]/it->nuMomentum[2] <<
" " << it->nuMomentum[1]/it->nuMomentum[2];
std::vector< LBNEQuickPiToNu > data
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
void blessPion(int trNum1, double e, G4ThreeVector p)
static LBNEQuickPiToNuVect * m_pInstance
QTextStream & reset(QTextStream &s)
std::vector< double > piMomentumTarget
std::vector< double > piPosAtHangerRing
const GenericPointer< typename T::ValueType > T2 T::AllocatorType & a
void open(const std::string &prefix)
std::vector< double > piMomentumAtHangerRing
std::vector< double > nuMomentum
void addPion(int trNum1, int sign1, double e, G4ThreeVector p)
QTextStream & endl(QTextStream &s)
void RingHangerPion(int trNum1, int sign, G4ThreeVector p, G4ThreeVector xPos)