#include <RootNeutronWriter.h>
Public Member Functions | |
RootChamberWriter & | chamberWriter (int chamberType) |
virtual void | initialize (int detType) |
RootNeutronWriter (const std::string &fileName) | |
virtual void | writeCluster (int chamberType, const edm::PSimHitContainer &hits) |
writes out a list of SimHits. | |
virtual | ~RootNeutronWriter () |
Private Attributes | |
std::map< int, RootChamberWriter > | theChamberWriters |
TFile * | theFile |
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 14 of file RootNeutronWriter.h.
RootNeutronWriter::RootNeutronWriter | ( | const std::string & | fileName | ) |
Definition at line 6 of file RootNeutronWriter.cc.
References interactiveExample::theFile.
RootNeutronWriter::~RootNeutronWriter | ( | ) | [virtual] |
Definition at line 12 of file RootNeutronWriter.cc.
References interactiveExample::theFile.
{ for(std::map<int, RootChamberWriter>::iterator mapItr = theChamberWriters.begin(); mapItr != theChamberWriters.end(); ++mapItr) { mapItr->second.tree()->Print(); // the tree will remember which file it's from theFile = mapItr->second.tree()->GetCurrentFile(); } theFile->Write(); // theFile->Close(); }
RootChamberWriter & RootNeutronWriter::chamberWriter | ( | int | chamberType | ) |
Definition at line 33 of file RootNeutronWriter.cc.
References Exception.
{ std::map<int, RootChamberWriter>::iterator mapItr = theChamberWriters.find(chamberType); if(mapItr != theChamberWriters.end()) { return mapItr->second; } else { throw cms::Exception("NeutronWriter") << "It's dangerous to create ROOT chamber " << "writers during processing. The global file may change"; // make a new one initialize(chamberType); return theChamberWriters[chamberType]; } }
void RootNeutronWriter::initialize | ( | int | detType | ) | [virtual] |
users should use this to create chamberwriters for each chamber type just after creation
Reimplemented from NeutronWriter.
Definition at line 26 of file RootNeutronWriter.cc.
{ ostringstream treeName; treeName << "ChamberType" << chamberType; theChamberWriters[chamberType] = RootChamberWriter(treeName.str()); }
void RootNeutronWriter::writeCluster | ( | int | detType, |
const edm::PSimHitContainer & | simHits | ||
) | [virtual] |
writes out a list of SimHits.
Implements NeutronWriter.
Definition at line 52 of file RootNeutronWriter.cc.
References gather_cfg::cout.
{ std::cout << "ROOTNEUTRONWRITER " << chamberType << " HITS SIZE " << hits.size() <<std::endl; chamberWriter(chamberType).write(hits); }
std::map<int, RootChamberWriter> RootNeutronWriter::theChamberWriters [private] |
Definition at line 29 of file RootNeutronWriter.h.
TFile* RootNeutronWriter::theFile [private] |
Definition at line 30 of file RootNeutronWriter.h.