CMS 3D CMS Logo

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() [1/2]

RootChamberWriter::RootChamberWriter ( )
inline

default ctor, for STL

Definition at line 11 of file RootChamberWriter.h.

11 : theTree(nullptr), theHits(nullptr) {}

◆ RootChamberWriter() [2/2]

RootChamberWriter::RootChamberWriter ( const std::string &  treeName)

Definition at line 7 of file RootChamberWriter.cc.

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

References bscTrigger_cfi::theHits.

◆ ~RootChamberWriter()

RootChamberWriter::~RootChamberWriter ( )

writes the tree, and deletes everything

Definition at line 13 of file RootChamberWriter.cc.

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

Member Function Documentation

◆ tree()

TTree* RootChamberWriter::tree ( )
inline

◆ write()

void RootChamberWriter::write ( const edm::PSimHitContainer hits)

Definition at line 20 of file RootChamberWriter.cc.

20  {
21  std::cout << "ENTRIES BEFORE " << theTree->GetEntries() << std::endl;
22  theHits->Delete();
23  theHits->Expand(hits.size());
24  for (unsigned int i = 0; i < hits.size(); ++i) {
25  new ((*theHits)[i]) RootSimHit(hits[i]);
26  }
27  theTree->Fill();
28  std::cout << "ENTRIES AFTER " << theTree->GetEntries() << std::endl;
29 }

References gather_cfg::cout, hfClusterShapes_cfi::hits, mps_fire::i, and bscTrigger_cfi::theHits.

Member Data Documentation

◆ theHits

TClonesArray* RootChamberWriter::theHits
private

Definition at line 23 of file RootChamberWriter.h.

◆ theTree

TTree* RootChamberWriter::theTree
private

Definition at line 22 of file RootChamberWriter.h.

Referenced by tree().

RootChamberWriter::theTree
TTree * theTree
Definition: RootChamberWriter.h:22
mps_fire.i
i
Definition: mps_fire.py:428
RootChamberWriter::theHits
TClonesArray * theHits
Definition: RootChamberWriter.h:23
hfClusterShapes_cfi.hits
hits
Definition: hfClusterShapes_cfi.py:5
gather_cfg.cout
cout
Definition: gather_cfg.py:144
RootSimHit
Definition: RootSimHit.h:7