File indexing completed on 2024-04-06 12:30:49
0001 #include "SimMuon/Neutron/src/RootNeutronReader.h"
0002 #include <sstream>
0003
0004 RootNeutronReader::RootNeutronReader(const std::string& fileName) : theFile(new TFile(fileName.c_str())) {}
0005
0006 RootChamberReader& RootNeutronReader::chamberReader(int chamberType) {
0007 std::map<int, RootChamberReader>::iterator mapItr = theChamberReaders.find(chamberType);
0008
0009 if (mapItr != theChamberReaders.end()) {
0010 return mapItr->second;
0011 } else {
0012
0013 std::ostringstream treeName;
0014 treeName << "ChamberType" << chamberType;
0015 theChamberReaders[chamberType] = RootChamberReader(theFile, treeName.str());
0016 return theChamberReaders[chamberType];
0017 }
0018 }
0019
0020 void RootNeutronReader::readNextEvent(int chamberType, edm::PSimHitContainer& result) {
0021 chamberReader(chamberType).read(result);
0022 }