src
SimMuon
Neutron
src
RootChamberReader.cc
Go to the documentation of this file.
1
#include "
SimMuon/Neutron/src/RootChamberReader.h
"
2
#include "
SimMuon/Neutron/src/RootSimHit.h
"
3
#include "
FWCore/MessageLogger/interface/MessageLogger.h
"
4
#include "TClonesArray.h"
5
using namespace
std
;
6
7
RootChamberReader::RootChamberReader
() : theTree(nullptr),
theHits
(nullptr), thePosition(0), theSize(0) {}
8
9
RootChamberReader::RootChamberReader
(TFile *
file
,
const
std::string
&
treeName
)
10
: theTree((TTree *)
file
->
Get
(
treeName
.c_str())),
11
theHits
(new TClonesArray(
"RootSimHit"
)),
12
thePosition(-1),
13
theSize(0) {
14
if
(
theTree
!=
nullptr
) {
15
theTree
->SetBranchAddress(
"Hits"
, &
theHits
);
16
theSize
=
theTree
->GetEntries();
17
}
18
}
19
20
RootChamberReader::~RootChamberReader
() {
21
// delete theHits;
22
// delete theTree;
23
}
24
25
void
RootChamberReader::read
(
edm::PSimHitContainer
&
hits
) {
26
// if there's no tree, make no events
27
if
(
theTree
!=
nullptr
&&
theSize
!= 0) {
28
++
thePosition
;
29
// start again from the beginning, if needed
30
if
(
thePosition
>=
theSize
)
31
thePosition
= 0;
32
theTree
->GetEntry(
thePosition
);
33
34
TIter
next
(
theHits
);
35
RootSimHit
*rootHit;
36
while
((rootHit = (
RootSimHit
*)
next
())) {
37
hits
.push_back(rootHit->
get
());
38
}
39
LogTrace
(
"Neutrons"
) <<
"Event "
<<
thePosition
<<
" OF "
<<
theSize
<<
" has "
<<
hits
.size() <<
" hits "
;
40
}
41
}
RootSimHit.h
ticlDumper_cff.treeName
treeName
Definition:
ticlDumper_cff.py:30
MessageLogger.h
RootSimHit
Definition:
RootSimHit.h:7
RootChamberReader::theHits
TClonesArray * theHits
Definition:
RootChamberReader.h:20
hfClusterShapes_cfi.hits
hits
Definition:
hfClusterShapes_cfi.py:5
std
Definition:
JetResolutionObject.h:76
RootChamberReader::thePosition
int thePosition
Definition:
RootChamberReader.h:21
GetRecoTauVFromDQM_MC_cff.next
next
Definition:
GetRecoTauVFromDQM_MC_cff.py:31
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition:
AlCaHLTBitMon_QueryRunRegistry.py:256
LogTrace
#define LogTrace(id)
Definition:
MessageLogger.h:242
RootSimHit::get
PSimHit get() const
Definition:
RootSimHit.cc:21
RootChamberReader::theTree
TTree * theTree
Definition:
RootChamberReader.h:19
RootChamberReader::read
void read(edm::PSimHitContainer &hits)
Definition:
RootChamberReader.cc:25
RootChamberReader.h
RootChamberReader::RootChamberReader
RootChamberReader()
default ctor, for STL
Definition:
RootChamberReader.cc:7
bscTrigger_cfi.theHits
theHits
Definition:
bscTrigger_cfi.py:18
RootChamberReader::theSize
int theSize
Definition:
RootChamberReader.h:22
geometryDiff.file
file
Definition:
geometryDiff.py:13
RootChamberReader::~RootChamberReader
~RootChamberReader()
writes the tree, and deletes everything
Definition:
RootChamberReader.cc:20
edm::PSimHitContainer
std::vector< PSimHit > PSimHitContainer
Definition:
PSimHitContainer.h:11
Get
T * Get(Args... args)
Definition:
Trend.h:122
Generated for CMSSW Reference Manual by
1.8.14