198 const int NMaxParticlesPerEvent = 1000;
201 int tStdHepStatus[NMaxParticlesPerEvent] = {0};
202 int tStdHepPdg[NMaxParticlesPerEvent] = {0};
203 double tStdHepP4[4*NMaxParticlesPerEvent] = {0.};
206 TFile *neutFile =
new TFile(
fFileName.c_str(),
"READ");
207 TTree *neutTree = (TTree*)neutFile->Get(
"nRooTracker");
208 int NEvents = (
int)neutTree->GetEntries();
209 std::cout <<
"Reading in " << NEvents <<
" NEUT events. " <<
std::endl;
211 neutTree->SetBranchAddress(
"StdHepN",&tStdHepN);
212 neutTree->SetBranchAddress(
"StdHepStatus",&tStdHepStatus);
213 neutTree->SetBranchAddress(
"StdHepPdg",&tStdHepPdg);
215 TTree *neutTreeRot = NULL;
219 neutTreeRot = (TTree*)neutFile->Get(
"nRooTrackerRot");
220 neutTreeRot->SetBranchAddress(
"StdHepP4Rot",&tStdHepP4);
224 neutTree->SetBranchAddress(
"StdHepP4",&tStdHepP4);
230 neutTree->GetEntry(i);
233 neutTreeRot->GetEntry(i);
240 std::cout <<
"Event #" << i+1 <<
" in LArSoft, event #" << i <<
" in ROOT file." <<
std::endl;
241 std::cout <<
"NParticles:\t" << tStdHepN <<
" (from 0 to " << tStdHepN-1 <<
")" <<
std::endl;
244 for(
int j=0; j<tStdHepN; j++)
246 double fAbsoluteParticleMomentum = sqrt(
pow(tStdHepP4[4*j],2) +
pow(tStdHepP4[4*j+1],2) +
pow(tStdHepP4[4*j+2],2) );
249 if( tStdHepPdg[j] != 0 && tStdHepStatus[j] == 1 && j > 0 && fAbsoluteParticleMomentum > 0 )
251 static TDatabasePDG pdgt;
252 TParticlePDG* pdgp = pdgt.GetParticle(tStdHepPdg[j]);
254 RooTrackerParticle *rootrackerparticle =
new RooTrackerParticle();
255 rootrackerparticle->pdg = tStdHepPdg[j];
256 rootrackerparticle->mass = pdgp->Mass();
260 rootrackerparticle->momX = tStdHepP4[4*j];
261 rootrackerparticle->momY = tStdHepP4[4*j+1];
262 rootrackerparticle->momZ = tStdHepP4[4*j+2];
263 rootrackerparticle->energy = tStdHepP4[4*j+3];
269 std::cout <<
"Particle " << j <<
":" <<
std::endl;
270 std::cout <<
"Status particle " << j <<
":\t" << tStdHepStatus[j] <<
std::endl;
271 std::cout <<
"PDG particle " << j <<
":\t" << rootrackerparticle->pdg <<
std::endl;
272 std::cout <<
"Mass particle " << j <<
":\t" << rootrackerparticle->mass <<
std::endl;
273 std::cout <<
"StartPositionX particle " << j <<
":\t" << rootrackerparticle->startX <<
std::endl;
274 std::cout <<
"StartPositionY particle " << j <<
":\t" <<rootrackerparticle->startY <<
std::endl;
275 std::cout <<
"StartPositionZ particle " << j <<
":\t" << rootrackerparticle->startZ <<
std::endl;
276 std::cout <<
"StartMomentumX particle " << j <<
":\t" << rootrackerparticle->momX <<
std::endl;
277 std::cout <<
"StartMomentumY particle " << j <<
":\t" <<rootrackerparticle->momY <<
std::endl;
278 std::cout <<
"StartMomentumZ particle " << j <<
":\t" << rootrackerparticle->momZ <<
std::endl;
279 std::cout <<
"StartEnergy particle " << j <<
":\t" << tStdHepP4[4*j+3] <<
std::endl;
280 std::cout <<
"Absolute momentum particle " << j <<
":\t" << fAbsoluteParticleMomentum <<
std::endl;
bool fUseRotatedStartMomentum
std::map< int, std::vector< RooTrackerParticle * > > RooTrackerEventMap
QTextStream & endl(QTextStream &s)