CMS 3D CMS Logo

RootChamberWriter.cc
Go to the documentation of this file.
3 
4 #include <iostream>
5 using namespace std;
6 
8  theHits = new TClonesArray("RootSimHit");
9  theTree = new TTree(treeName.c_str(), "Neutron Background");
10  theTree->Bronch("Hits", "TClonesArray", &theHits);
11 }
12 
14  //std::cout << "WRITING " << theTree->GetEntries() << std::endl;
15  // theTree->Write();
16  //delete theHits;
17  //delete theTree;
18 }
19 
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 }
RootChamberWriter()
default ctor, for STL
~RootChamberWriter()
writes the tree, and deletes everything
void write(const edm::PSimHitContainer &hits)
std::vector< PSimHit > PSimHitContainer