CMS 3D CMS Logo

Public Member Functions | Protected Member Functions | Private Attributes

AsciiNeutronWriter Class Reference

#include <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 writeCluster (int chamberType, const edm::PSimHitContainer &hits)
 writes out a list of SimHits.

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.

                                                          :
  theFileNameBase(fileNameBase)  {
}
AsciiNeutronWriter::~AsciiNeutronWriter ( ) [virtual]

Definition at line 13 of file AsciiNeutronWriter.cc.

                                        {
}

Member Function Documentation

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

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(), asciidump::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().

{
  // open the correct file
  stringstream s;
  s << theFileNameBase << chamberType;
  LogDebug("NeutronWriter") << "opening " << s.str();
  ofstream os;
  os.open(s.str().c_str(), ofstream::app);
  os << hits.size() << endl;
  for(size_t i = 0; i < hits.size(); ++i) {
    PSimHit h = hits[i];
    os << h.entryPoint().x() << " " << h.entryPoint().y() << " " 
       << h.entryPoint().z() << " " << h.exitPoint().x() << " " 
       << h.exitPoint().y() << " " << h.exitPoint().z() << " "
       << h.pabs() << " " << " " << h.timeOfFlight() << " " 
       << h.energyLoss() << " " <<h.particleType() << " " 
       << h.detUnitId() << " " << h.trackId() << " " 
       << h.momentumAtEntry().theta() << " " << h.momentumAtEntry().phi() << endl;
  }
}

Member Data Documentation

std::string AsciiNeutronWriter::theFileNameBase [private]

Definition at line 22 of file AsciiNeutronWriter.h.

Referenced by writeCluster().