CMS 3D CMS Logo

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