CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Protected Member Functions | Private Attributes
AsciiNeutronWriter Class Reference

#include <AsciiNeutronWriter.h>

Inheritance diagram for AsciiNeutronWriter:
NeutronWriter

Public Member Functions

 AsciiNeutronWriter (std::string fileNameBase)
 
virtual ~AsciiNeutronWriter ()
 
- Public Member Functions inherited from NeutronWriter
virtual void beginEvent (edm::Event &e, const edm::EventSetup &es)
 
virtual void endEvent ()
 
virtual void initialize (int detType)
 
virtual ~NeutronWriter ()
 

Protected Member Functions

virtual void writeCluster (int chamberType, const edm::PSimHitContainer &hits)
 writes out a list of SimHits. More...
 

Private Attributes

std::string theFileNameBase
 

Detailed Description

This writes the fields of a SimHit into an ASCII file, which can be read out later to add neutron hits to a muon chamber

Definition at line 12 of file AsciiNeutronWriter.h.

Constructor & Destructor Documentation

AsciiNeutronWriter::AsciiNeutronWriter ( std::string  fileNameBase)

Definition at line 8 of file AsciiNeutronWriter.cc.

8  :
9  theFileNameBase(fileNameBase) {
10 }
std::string theFileNameBase
AsciiNeutronWriter::~AsciiNeutronWriter ( )
virtual

Definition at line 13 of file AsciiNeutronWriter.cc.

13  {
14 }

Member Function Documentation

void AsciiNeutronWriter::writeCluster ( int  detType,
const edm::PSimHitContainer simHits 
)
protectedvirtual

writes out a list of SimHits.

Implements NeutronWriter.

Definition at line 17 of file AsciiNeutronWriter.cc.

References PSimHit::detUnitId(), PSimHit::energyLoss(), PSimHit::entryPoint(), PSimHit::exitPoint(), h, i, LogDebug, PSimHit::momentumAtEntry(), PSimHit::pabs(), PSimHit::particleType(), PV3DBase< T, PVType, FrameType >::phi(), alignCSCRings::s, theFileNameBase, PV3DBase< T, PVType, FrameType >::theta(), PSimHit::timeOfFlight(), PSimHit::trackId(), PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

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 }
#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:69
T y() const
Definition: PV3DBase.h:63
Geom::Theta< T > theta() const
Definition: PV3DBase.h:75
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:64
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
T x() const
Definition: PV3DBase.h:62
Local3DPoint entryPoint() const
Entry point in the local Det frame.
Definition: PSimHit.h:35
unsigned int detUnitId() const
Definition: PSimHit.h:93

Member Data Documentation

std::string AsciiNeutronWriter::theFileNameBase
private

Definition at line 22 of file AsciiNeutronWriter.h.

Referenced by writeCluster().