Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
LBNEQuickPiToNuVect Class Reference

#include <LBNEQuickPiToNu.hh>

Public Member Functions

void YesDoThis ()
 
bool doIt () const
 
void open (const std::string &prefix)
 
void close ()
 
void addPion (int trNum1, int sign1, double e, G4ThreeVector p)
 
void RingHangerPion (int trNum1, int sign, G4ThreeVector p, G4ThreeVector xPos)
 
void blessPion (int trNum1, double e, G4ThreeVector p)
 
void reset ()
 
void evtOut ()
 

Static Public Member Functions

static LBNEQuickPiToNuVectInstance ()
 

Private Member Functions

 LBNEQuickPiToNuVect ()
 
 LBNEQuickPiToNuVect (LBNEQuickPiToNuVect const &)
 
LBNEQuickPiToNuVectoperator= (LBNEQuickPiToNuVect const &)
 

Private Attributes

bool doItForReal
 
std::vector< LBNEQuickPiToNudata
 
std::ofstream fOut
 

Static Private Attributes

static LBNEQuickPiToNuVectm_pInstance =0
 

Detailed Description

Definition at line 49 of file LBNEQuickPiToNu.hh.

Constructor & Destructor Documentation

LBNEQuickPiToNuVect::LBNEQuickPiToNuVect ( )
private

Definition at line 29 of file LBNEQuickPiToNu.cc.

29  {
30  doItForReal = false;
31 }
LBNEQuickPiToNuVect::LBNEQuickPiToNuVect ( LBNEQuickPiToNuVect const &  )
private

Member Function Documentation

void LBNEQuickPiToNuVect::addPion ( int  trNum1,
int  sign1,
double  e,
G4ThreeVector  p 
)
inline

Definition at line 74 of file LBNEQuickPiToNu.hh.

74  {
75  LBNERunManager* pRunManager=(LBNERunManager*)LBNERunManager::GetRunManager();
76  int evtno = pRunManager->GetCurrentEvent()->GetEventID();
77  LBNEQuickPiToNu a; a.evtNum = evtno; a.sign = sign1;
78  a.trNum = trNum1; a.piEnergy=e;
79  for (size_t k=0; k!=3; k++) a.piMomentumTarget[k]= p[k];
80  data.push_back(a);
81  }
std::vector< LBNEQuickPiToNu > data
std::vector< double > piMomentumTarget
const GenericPointer< typename T::ValueType > T2 T::AllocatorType & a
Definition: pointer.h:1124
p
Definition: test.py:223
void LBNEQuickPiToNuVect::blessPion ( int  trNum1,
double  e,
G4ThreeVector  p 
)
inline

Definition at line 100 of file LBNEQuickPiToNu.hh.

100  {
101  bool foundPion = false;
102  for (std::vector<LBNEQuickPiToNu>::iterator it=data.begin(); it!=data.end(); it++) {
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];
107  }
108  it->nuEnergy = e;
109  foundPion = true; return;
110  if (!foundPion) {
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());
115  }
116  }
117  }
intermediate_table::iterator iterator
std::vector< LBNEQuickPiToNu > data
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
Definition: G4Exception.cc:45
p
Definition: test.py:223
QTextStream & endl(QTextStream &s)
void LBNEQuickPiToNuVect::close ( )
inline

Definition at line 73 of file LBNEQuickPiToNu.hh.

73 {fOut.close();}
bool LBNEQuickPiToNuVect::doIt ( ) const
inline

Definition at line 62 of file LBNEQuickPiToNu.hh.

62 {return doItForReal;}
void LBNEQuickPiToNuVect::evtOut ( )
inline

Definition at line 120 of file LBNEQuickPiToNu.hh.

120  {
121  for (std::vector<LBNEQuickPiToNu>::const_iterator it=data.begin(); it!=data.end(); it++) {
122  if ((it->trNum == -9999) || (it->trNum == -9998)) continue;
123  if (std::abs(it->nuEnergy) < 0.001) continue; // gave no neutrino..
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];
131  if (rSq > 1.0e-6)
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];
136  fOut << std::endl;
137  }
138  this->reset();
139  }
std::vector< LBNEQuickPiToNu > data
intermediate_table::const_iterator const_iterator
T abs(T value)
if(!yymsg) yymsg
QTextStream & endl(QTextStream &s)
LBNEQuickPiToNuVect * LBNEQuickPiToNuVect::Instance ( )
static

Definition at line 21 of file LBNEQuickPiToNu.cc.

21  {
22 
24 
25  return m_pInstance;
26 }
static LBNEQuickPiToNuVect * m_pInstance
void LBNEQuickPiToNuVect::open ( const std::string prefix)
inline

Definition at line 63 of file LBNEQuickPiToNu.hh.

63  {
64  if (fOut.is_open()) {
65  std::cerr << " From LBNEQuickPiToNuVect, file has been already opened, close it " << std::endl;
66  fOut.close();
67  }
68  std::string fName(prefix); fName += std::string("QuickPitoNu_v1.txt");
69  fOut.open(fName.c_str());
70  fOut << " evtNum trNum sign piEnergy nuEnergy piPxTgt piPyTgt pixH2 piyH2 pizH2 piPxH2 piPyH2 ";
71  fOut << " nuPx nuPy " << std::endl; // P stands for slope ,Px/Pz...
72  }
std::string string
Definition: nybbler.cc:12
string prefix
Definition: submitScan.py:88
QTextStream & endl(QTextStream &s)
LBNEQuickPiToNuVect& LBNEQuickPiToNuVect::operator= ( LBNEQuickPiToNuVect const &  )
private
void LBNEQuickPiToNuVect::reset ( )
inline

Definition at line 118 of file LBNEQuickPiToNu.hh.

118 { data.clear();}
std::vector< LBNEQuickPiToNu > data
void LBNEQuickPiToNuVect::RingHangerPion ( int  trNum1,
int  sign,
G4ThreeVector  p,
G4ThreeVector  xPos 
)
inline

Definition at line 82 of file LBNEQuickPiToNu.hh.

82  {
83  bool foundPion = false;
84  for (std::vector<LBNEQuickPiToNu>::iterator it=data.begin(); it!=data.end(); it++) {
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];
90  }
91  foundPion = true; return;
92  }
93  if (!foundPion) {
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);
97  }
98  }
intermediate_table::iterator iterator
std::vector< LBNEQuickPiToNu > data
p
Definition: test.py:223
int sign(double val)
Definition: UtilFunc.cxx:103
void addPion(int trNum1, int sign1, double e, G4ThreeVector p)
QTextStream & endl(QTextStream &s)
void LBNEQuickPiToNuVect::YesDoThis ( )
inline

Definition at line 61 of file LBNEQuickPiToNu.hh.

61 { doItForReal = true;}

Member Data Documentation

std::vector<LBNEQuickPiToNu> LBNEQuickPiToNuVect::data
private

Definition at line 56 of file LBNEQuickPiToNu.hh.

bool LBNEQuickPiToNuVect::doItForReal
private

Definition at line 55 of file LBNEQuickPiToNu.hh.

std::ofstream LBNEQuickPiToNuVect::fOut
private

Definition at line 57 of file LBNEQuickPiToNu.hh.

LBNEQuickPiToNuVect * LBNEQuickPiToNuVect::m_pInstance =0
staticprivate

Definition at line 54 of file LBNEQuickPiToNu.hh.


The documentation for this class was generated from the following files: