CMS 3D CMS Logo

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)
 
 ~AsciiNeutronWriter () override
 
- 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

void writeCluster (int chamberType, const edm::PSimHitContainer &hits) override
 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 11 of file AsciiNeutronWriter.h.

Constructor & Destructor Documentation

AsciiNeutronWriter::AsciiNeutronWriter ( std::string  fileNameBase)

Definition at line 8 of file AsciiNeutronWriter.cc.

8 : theFileNameBase(fileNameBase) {}
std::string theFileNameBase
AsciiNeutronWriter::~AsciiNeutronWriter ( )
override

Definition at line 10 of file AsciiNeutronWriter.cc.

10 {}

Member Function Documentation

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

writes out a list of SimHits.

Implements NeutronWriter.

Definition at line 12 of file AsciiNeutronWriter.cc.

References PSimHit::detUnitId(), PSimHit::energyLoss(), PSimHit::entryPoint(), PSimHit::exitPoint(), h, mps_fire::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().

12  {
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 }
#define LogDebug(id)
FWCore Framework interface EventSetupRecordImplementation h
Helper function to determine trigger accepts.
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
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
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
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

Member Data Documentation

std::string AsciiNeutronWriter::theFileNameBase
private

Definition at line 20 of file AsciiNeutronWriter.h.

Referenced by writeCluster().