CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
RootChamberWriter.cc
Go to the documentation of this file.
3 
4 #include <iostream>
5 using namespace std;
6 
7 
9 {
10  theHits = new TClonesArray("RootSimHit");
11  theTree = new TTree(treeName.c_str(), "Neutron Background");
12  theTree->Bronch("Hits", "TClonesArray", &theHits);
13 }
14 
15 
17 {
18 //std::cout << "WRITING " << theTree->GetEntries() << std::endl;
19 // theTree->Write();
20  //delete theHits;
21  //delete theTree;
22 }
23 
24 
26 {
27 std::cout << "ENTRIES BEFORE " << theTree->GetEntries() << std::endl;
28  theHits->Delete();
29  theHits->Expand(hits.size());
30  for(unsigned int i = 0; i < hits.size(); ++i)
31  {
32  new((*theHits)[i]) RootSimHit(hits[i]);
33  }
34  theTree->Fill();
35 std::cout << "ENTRIES AFTER " << theTree->GetEntries() << std::endl;
36 }
37 
int i
Definition: DBlmapReader.cc:9
RootChamberWriter()
default ctor, for STL
~RootChamberWriter()
writes the tree, and deletes everything
void write(const edm::PSimHitContainer &hits)
tuple cout
Definition: gather_cfg.py:121
std::vector< PSimHit > PSimHitContainer