src
SimMuon
Neutron
src
RootChamberWriter.cc
Go to the documentation of this file.
1
#include "
SimMuon/Neutron/src/RootChamberWriter.h
"
2
#include "
SimMuon/Neutron/src/RootSimHit.h
"
3
4
#include <iostream>
5
using namespace
std
;
6
7
RootChamberWriter::RootChamberWriter
(
const
std::string
& treeName) {
8
theHits
=
new
TClonesArray(
"RootSimHit"
);
9
theTree =
new
TTree(treeName.c_str(),
"Neutron Background"
);
10
theTree->Bronch(
"Hits"
,
"TClonesArray"
, &
theHits
);
11
}
12
13
RootChamberWriter::~RootChamberWriter
() {
14
//std::cout << "WRITING " << theTree->GetEntries() << std::endl;
15
// theTree->Write();
16
//delete theHits;
17
//delete theTree;
18
}
19
20
void
RootChamberWriter::write
(
const
edm::PSimHitContainer
&
hits
) {
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
}
RootSimHit.h
mps_fire.i
i
Definition:
mps_fire.py:429
RootSimHit
Definition:
RootSimHit.h:7
hfClusterShapes_cfi.hits
hits
Definition:
hfClusterShapes_cfi.py:5
std
Definition:
JetResolutionObject.h:76
RootChamberWriter::RootChamberWriter
RootChamberWriter()
default ctor, for STL
Definition:
RootChamberWriter.h:11
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition:
AlCaHLTBitMon_QueryRunRegistry.py:256
bscTrigger_cfi.theHits
theHits
Definition:
bscTrigger_cfi.py:18
RootChamberWriter::~RootChamberWriter
~RootChamberWriter()
writes the tree, and deletes everything
Definition:
RootChamberWriter.cc:13
RootChamberWriter::write
void write(const edm::PSimHitContainer &hits)
Definition:
RootChamberWriter.cc:20
RootChamberWriter.h
edm::PSimHitContainer
std::vector< PSimHit > PSimHitContainer
Definition:
PSimHitContainer.h:11
gather_cfg.cout
cout
Definition:
gather_cfg.py:144
Generated for CMSSW Reference Manual by
1.8.14