CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Attributes
RootChamberWriter Class Reference

#include <RootChamberWriter.h>

Public Member Functions

 RootChamberWriter ()
 default ctor, for STL More...
 
 RootChamberWriter (const std::string &treeName)
 
TTree * tree ()
 
void write (const edm::PSimHitContainer &hits)
 
 ~RootChamberWriter ()
 writes the tree, and deletes everything More...
 

Private Attributes

TClonesArray * theHits
 
TTree * theTree
 

Detailed Description

Definition at line 8 of file RootChamberWriter.h.

Constructor & Destructor Documentation

RootChamberWriter::RootChamberWriter ( )
inline

default ctor, for STL

Definition at line 12 of file RootChamberWriter.h.

12 : theTree(0), theHits(0) {}
TClonesArray * theHits
RootChamberWriter::RootChamberWriter ( const std::string &  treeName)

Definition at line 5 of file RootChamberWriter.cc.

6 {
7  theHits = new TClonesArray("RootSimHit");
8  theTree = new TTree(treeName.c_str(), "Neutron Background");
9  theTree->Bronch("Hits", "TClonesArray", &theHits);
10 }
TClonesArray * theHits
RootChamberWriter::~RootChamberWriter ( )

writes the tree, and deletes everything

Definition at line 13 of file RootChamberWriter.cc.

14 {
15 //std::cout << "WRITING " << theTree->GetEntries() << std::endl;
16 // theTree->Write();
17  //delete theHits;
18  //delete theTree;
19 }

Member Function Documentation

TTree* RootChamberWriter::tree ( )
inline

Definition at line 20 of file RootChamberWriter.h.

References theTree.

20 {return theTree;}
void RootChamberWriter::write ( const edm::PSimHitContainer hits)

Definition at line 22 of file RootChamberWriter.cc.

References gather_cfg::cout, and i.

23 {
24 std::cout << "ENTRIES BEFORE " << theTree->GetEntries() << std::endl;
25  theHits->Delete();
26  theHits->Expand(hits.size());
27  for(unsigned int i = 0; i < hits.size(); ++i)
28  {
29  new((*theHits)[i]) RootSimHit(hits[i]);
30  }
31  theTree->Fill();
32 std::cout << "ENTRIES AFTER " << theTree->GetEntries() << std::endl;
33 }
int i
Definition: DBlmapReader.cc:9
TClonesArray * theHits
tuple cout
Definition: gather_cfg.py:121

Member Data Documentation

TClonesArray* RootChamberWriter::theHits
private

Definition at line 24 of file RootChamberWriter.h.

TTree* RootChamberWriter::theTree
private

Definition at line 23 of file RootChamberWriter.h.

Referenced by tree().