CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
AsciiNeutronWriter.cc
Go to the documentation of this file.
3 #include <sstream>
4 #include <fstream>
5 
6 using namespace std;
7 
8 AsciiNeutronWriter::AsciiNeutronWriter(string fileNameBase) : theFileNameBase(fileNameBase) {}
9 
11 
12 void AsciiNeutronWriter::writeCluster(int chamberType, const edm::PSimHitContainer& hits) {
13  // open the correct file
14  stringstream s;
15  s << theFileNameBase << chamberType;
16  LogDebug("NeutronWriter") << "opening " << s.str();
17  ofstream os;
18  os.open(s.str().c_str(), ofstream::app);
19  os << hits.size() << endl;
20  for (size_t i = 0; i < hits.size(); ++i) {
21  PSimHit h = hits[i];
22  os << h.entryPoint().x() << " " << h.entryPoint().y() << " " << h.entryPoint().z() << " " << h.exitPoint().x()
23  << " " << h.exitPoint().y() << " " << h.exitPoint().z() << " " << h.pabs() << " "
24  << " " << h.timeOfFlight() << " " << h.energyLoss() << " " << h.particleType() << " " << h.detUnitId() << " "
25  << h.trackId() << " " << h.momentumAtEntry().theta() << " " << h.momentumAtEntry().phi() << endl;
26  }
27 }
LocalVector momentumAtEntry() const
The momentum of the track that produced the hit, at entry point.
Definition: PSimHit.h:55
Geom::Phi< T > phi() const
Definition: PV3DBase.h:66
T y() const
Definition: PV3DBase.h:60
~AsciiNeutronWriter() override
AsciiNeutronWriter(std::string fileNameBase)
Geom::Theta< T > theta() const
Definition: PV3DBase.h:72
Local3DPoint exitPoint() const
Exit point in the local Det frame.
Definition: PSimHit.h:46
float timeOfFlight() const
Definition: PSimHit.h:73
void writeCluster(int chamberType, const edm::PSimHitContainer &hits) override
writes out a list of SimHits.
T z() const
Definition: PV3DBase.h:61
float pabs() const
fast and more accurate access to momentumAtEntry().mag()
Definition: PSimHit.h:67
std::string theFileNameBase
float energyLoss() const
The energy deposit in the PSimHit, in ???.
Definition: PSimHit.h:79
int particleType() const
Definition: PSimHit.h:89
unsigned int trackId() const
Definition: PSimHit.h:106
std::vector< PSimHit > PSimHitContainer
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4
T x() const
Definition: PV3DBase.h:59
Local3DPoint entryPoint() const
Entry point in the local Det frame.
Definition: PSimHit.h:43
unsigned int detUnitId() const
Definition: PSimHit.h:97
#define LogDebug(id)