CMS 3D CMS Logo

Public Member Functions | Private Attributes

RootChamberWriter Class Reference

#include <RootChamberWriter.h>

List of all members.

Public Member Functions

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

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.

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

Definition at line 5 of file RootChamberWriter.cc.

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

writes the tree, and deletes everything

Definition at line 13 of file RootChamberWriter.cc.

{
//std::cout << "WRITING " << theTree->GetEntries() << std::endl;
//  theTree->Write();
  //delete theHits;
  //delete theTree;
}

Member Function Documentation

TTree* RootChamberWriter::tree ( ) [inline]

Definition at line 20 of file RootChamberWriter.h.

References theTree.

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

Definition at line 22 of file RootChamberWriter.cc.

References gather_cfg::cout, and i.

{
std::cout << "ENTRIES BEFORE " << theTree->GetEntries() << std::endl;
  theHits->Delete();
  theHits->Expand(hits.size());
  for(unsigned int i = 0; i < hits.size(); ++i)
  {
    new((*theHits)[i]) RootSimHit(hits[i]);
  }
  theTree->Fill();
std::cout << "ENTRIES AFTER " << theTree->GetEntries() << std::endl;
}

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().