#include <SimMuon/Neutron/src/AsciiNeutronReader.h>
Public Member Functions | |
AsciiNeutronReader (std::string fileNameBase) | |
virtual void | readNextEvent (int chamberType, edm::PSimHitContainer &result) |
Private Member Functions | |
int | read_nhits (std::ifstream &fin, int chamberType) |
void | resetStreampos (std::ifstream &fin, int chamberType) |
Private Attributes | |
std::string | theFileNameBase |
std::vector< std::streampos > | theStreamPos |
It reads the events sequentially, and loops back to the beginning when it reaches EOF
Definition at line 17 of file AsciiNeutronReader.h.
AsciiNeutronReader::AsciiNeutronReader | ( | std::string | fileNameBase | ) |
Referenced by readNextEvent().
void AsciiNeutronReader::readNextEvent | ( | int | chamberType, | |
edm::PSimHitContainer & | result | |||
) | [virtual] |
Implements NeutronReader.
Definition at line 18 of file AsciiNeutronReader.cc.
References Exception, cmsRelvalreport::exit, aod_PYTHIA_cfg::fileName, in, p, phi, read_nhits(), theFileNameBase, theStreamPos, theta, and track.
00018 { 00019 stringstream fileName; 00020 fileName << theFileNameBase << chamberType; 00021 ifstream fin(fileName.str().c_str(), ios::in); 00022 if(!fin.is_open()) { 00023 throw cms::Exception("NeutronReader") 00024 << "Muon neutron noise file missing " << fileName.str(); 00025 } 00026 00027 int nhits = read_nhits(fin, chamberType); 00028 for(int ihit = 0; ihit < nhits; ++ihit) { 00029 float entryX, entryY, entryZ, exitX, exitY, exitZ; 00030 float p, tof, eloss, theta, phi; 00031 int type, layer, track; 00032 00033 fin >> entryX >> entryY >> entryZ 00034 >> exitX >> exitY >> exitZ 00035 >> p >> tof >> eloss >> type >> layer >> track >> theta >> phi; 00036 LocalPoint entry(entryX, entryY, entryZ); 00037 LocalPoint exit (exitX, exitY, exitZ); 00038 PSimHit phit(entry, exit, p, tof, eloss, type, layer, track, theta, phi); 00039 result.push_back(phit); 00040 } 00041 theStreamPos[chamberType] = fin.tellg(); 00042 }
std::string AsciiNeutronReader::theFileNameBase [private] |
std::vector<std::streampos> AsciiNeutronReader::theStreamPos [private] |