CMS 3D CMS Logo

Public Member Functions | Private Attributes

RootNeutronReader Class Reference

#include <RootNeutronReader.h>

Inheritance diagram for RootNeutronReader:
NeutronReader

List of all members.

Public Member Functions

RootChamberReaderchamberReader (int chamberType)
virtual void readNextEvent (int chamberType, edm::PSimHitContainer &result)
 RootNeutronReader (const std::string &fileName)

Private Attributes

std::map< int, RootChamberReadertheChamberReaders
TFile * theFile

Detailed Description

This reads patterns of neutron hits in muon chambers from an ROOT database, so they can be superimposed onto signal events. It reads the events sequentially, and loops back to the beginning when it reaches EOF

Definition at line 15 of file RootNeutronReader.h.


Constructor & Destructor Documentation

RootNeutronReader::RootNeutronReader ( const std::string &  fileName)

Definition at line 4 of file RootNeutronReader.cc.

: theFile(new TFile(fileName.c_str()))
{
}

Member Function Documentation

RootChamberReader & RootNeutronReader::chamberReader ( int  chamberType)

Definition at line 10 of file RootNeutronReader.cc.

References theChamberReaders, and theFile.

Referenced by readNextEvent().

{
  std::map<int, RootChamberReader>::iterator mapItr
    = theChamberReaders.find(chamberType);

  if(mapItr != theChamberReaders.end())
  {
    return mapItr->second;
  }
  else
  {
    // make a new one
    std::ostringstream treeName;
    treeName << "ChamberType" << chamberType;
    theChamberReaders[chamberType] = RootChamberReader(theFile, treeName.str());
    return theChamberReaders[chamberType];
  }
}
void RootNeutronReader::readNextEvent ( int  chamberType,
edm::PSimHitContainer result 
) [virtual]

Implements NeutronReader.

Definition at line 30 of file RootNeutronReader.cc.

References chamberReader(), and RootChamberReader::read().

{
   chamberReader(chamberType).read(result);
}

Member Data Documentation

Definition at line 26 of file RootNeutronReader.h.

Referenced by chamberReader().

TFile* RootNeutronReader::theFile [private]

Definition at line 25 of file RootNeutronReader.h.

Referenced by chamberReader().