Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 14:30:22

0001 #include "SimMuon/Neutron/src/AsciiNeutronWriter.h"
0002 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0003 #include <sstream>
0004 #include <fstream>
0005 
0006 using namespace std;
0007 
0008 AsciiNeutronWriter::AsciiNeutronWriter(string fileNameBase) : theFileNameBase(fileNameBase) {}
0009 
0010 AsciiNeutronWriter::~AsciiNeutronWriter() {}
0011 
0012 void AsciiNeutronWriter::writeCluster(int chamberType, const edm::PSimHitContainer& hits) {
0013   // open the correct file
0014   stringstream s;
0015   s << theFileNameBase << chamberType;
0016   LogDebug("NeutronWriter") << "opening " << s.str();
0017   ofstream os;
0018   os.open(s.str().c_str(), ofstream::app);
0019   os << hits.size() << endl;
0020   for (size_t i = 0; i < hits.size(); ++i) {
0021     PSimHit h = hits[i];
0022     os << h.entryPoint().x() << " " << h.entryPoint().y() << " " << h.entryPoint().z() << " " << h.exitPoint().x()
0023        << " " << h.exitPoint().y() << " " << h.exitPoint().z() << " " << h.pabs() << " "
0024        << " " << h.timeOfFlight() << " " << h.energyLoss() << " " << h.particleType() << " " << h.detUnitId() << " "
0025        << h.trackId() << " " << h.momentumAtEntry().theta() << " " << h.momentumAtEntry().phi() << endl;
0026   }
0027 }