Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:30:49

0001 #ifndef AsciiNeutronReader_h
0002 #define AsciiNeutronReader_h
0003 
0004 #include <iostream>
0005 #include <string>
0006 #include <vector>
0007 #include <fstream>
0008 #include "SimMuon/Neutron/src/NeutronReader.h"
0009 
0010 /** This reads patterns of neutron hits in muon chambers
0011  * from an ASCII database,
0012  * so they can be superimposed onto signal events.
0013  * It reads the events sequentially, and loops
0014  * back to the beginning when it reaches EOF
0015  */
0016 
0017 class AsciiNeutronReader : public NeutronReader {
0018 public:
0019   AsciiNeutronReader(std::string fileNameBase);
0020 
0021   void readNextEvent(int chamberType, edm::PSimHitContainer& result) override;
0022 
0023 private:
0024   int read_nhits(std::ifstream& fin, int chamberType);
0025   void resetStreampos(std::ifstream& fin, int chamberType);
0026 
0027   std::string theFileNameBase;
0028   std::vector<std::streampos> theStreamPos;
0029 };
0030 
0031 #endif