Go to the documentation of this file.00001 #include "SimMuon/Neutron/src/RootChamberWriter.h"
00002 #include "SimMuon/Neutron/src/RootSimHit.h"
00003 using namespace std;
00004
00005 RootChamberWriter::RootChamberWriter(const std::string & treeName)
00006 {
00007 theHits = new TClonesArray("RootSimHit");
00008 theTree = new TTree(treeName.c_str(), "Neutron Background");
00009 theTree->Bronch("Hits", "TClonesArray", &theHits);
00010 }
00011
00012
00013 RootChamberWriter::~RootChamberWriter()
00014 {
00015
00016
00017
00018
00019 }
00020
00021
00022 void RootChamberWriter::write(const edm::PSimHitContainer & hits)
00023 {
00024 std::cout << "ENTRIES BEFORE " << theTree->GetEntries() << std::endl;
00025 theHits->Delete();
00026 theHits->Expand(hits.size());
00027 for(unsigned int i = 0; i < hits.size(); ++i)
00028 {
00029 new((*theHits)[i]) RootSimHit(hits[i]);
00030 }
00031 theTree->Fill();
00032 std::cout << "ENTRIES AFTER " << theTree->GetEntries() << std::endl;
00033 }
00034