CMS 3D CMS Logo

AsciiNeutronWriter Class Reference

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. More...

#include <SimMuon/Neutron/src/AsciiNeutronWriter.h>

Inheritance diagram for AsciiNeutronWriter:

NeutronWriter

List of all members.

Public Member Functions

 AsciiNeutronWriter (std::string fileNameBase)
virtual ~AsciiNeutronWriter ()

Protected Member Functions

virtual void writeEvent (int chamberType, const edm::PSimHitContainer &hits)
 makes an "event" from a list of SimHits. Called by writeEvent

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  ) 

AsciiNeutronWriter::~AsciiNeutronWriter (  )  [virtual]

Definition at line 13 of file AsciiNeutronWriter.cc.

00013                                         {
00014 }


Member Function Documentation

void AsciiNeutronWriter::writeEvent ( int  detType,
const edm::PSimHitContainer simHits 
) [protected, virtual]

makes an "event" from a list of SimHits. Called by writeEvent

Implements NeutronWriter.

Definition at line 17 of file AsciiNeutronWriter.cc.

References PSimHit::detUnitId(), lat::endl(), PSimHit::energyLoss(), PSimHit::entryPoint(), PSimHit::exitPoint(), h, i, LogDebug, PSimHit::momentumAtEntry(), PSimHit::pabs(), PSimHit::particleType(), PV3DBase< T, PVType, FrameType >::phi(), 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().

00018 {
00019   // open the correct file
00020   stringstream s;
00021   s << theFileNameBase << chamberType;
00022   LogDebug("NeutronWriter") << "opening " << s.str();
00023   ofstream os;
00024   os.open(s.str().c_str(), ofstream::app);
00025   os << hits.size() << endl;
00026   for(size_t i = 0; i < hits.size(); ++i) {
00027     PSimHit h = hits[i];
00028     os << h.entryPoint().x() << " " << h.entryPoint().y() << " " 
00029        << h.entryPoint().z() << " " << h.exitPoint().x() << " " 
00030        << h.exitPoint().y() << " " << h.exitPoint().z() << " "
00031        << h.pabs() << " " << " " << h.timeOfFlight() << " " 
00032        << h.energyLoss() << " " <<h.particleType() << " " 
00033        << h.detUnitId() << " " << h.trackId() << " " 
00034        << h.momentumAtEntry().theta() << " " << h.momentumAtEntry().phi() << endl;
00035   }
00036 }


Member Data Documentation

std::string AsciiNeutronWriter::theFileNameBase [private]

Definition at line 22 of file AsciiNeutronWriter.h.

Referenced by writeEvent().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:14:49 2009 for CMSSW by  doxygen 1.5.4