Main Page
Namespaces
Classes
Package Documentation
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
()
8
: theTree(
nullptr
),
9
theHits(
nullptr
),
10
thePosition(0),
11
theSize(0)
12
{
13
}
14
15
16
RootChamberReader::RootChamberReader
(TFile *
file
,
const
std::string
& treeName)
17
:
theTree
( (TTree *) file->Get(treeName.c_str()) ),
18
theHits
(new TClonesArray(
"RootSimHit"
)),
19
thePosition
(-1),
20
theSize
(0)
21
{
22
if
(
theTree
!=
nullptr
)
23
{
24
theTree
->SetBranchAddress(
"Hits"
, &
theHits
);
25
theSize
=
theTree
->GetEntries();
26
}
27
}
28
29
30
RootChamberReader::~RootChamberReader
()
31
{
32
// delete theHits;
33
// delete theTree;
34
}
35
36
37
void
RootChamberReader::read
(
edm::PSimHitContainer
&
hits
)
38
{
39
// if there's no tree, make no events
40
if
(
theTree
!=
nullptr
&&
theSize
!= 0)
41
{
42
++
thePosition
;
43
// start again from the beginning, if needed
44
if
(
thePosition
>=
theSize
)
thePosition
= 0;
45
theTree
->GetEntry(
thePosition
);
46
47
TIter
next
(
theHits
);
48
RootSimHit
* rootHit;
49
while
( (rootHit = (
RootSimHit
*)
next
()) )
50
{
51
hits.push_back(rootHit->
get
());
52
}
53
LogTrace
(
"Neutrons"
) <<
"Event "
<<
thePosition
<<
" OF "
<<
theSize
54
<<
" has "
<< hits.size() <<
" hits "
;
55
}
56
}
57
58
RootSimHit.h
MessageLogger.h
RootSimHit
Definition:
RootSimHit.h:7
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition:
AlCaHLTBitMon_QueryRunRegistry.py:255
RootSimHit::get
PSimHit get() const
Definition:
RootSimHit.cc:22
RootChamberReader::theHits
TClonesArray * theHits
Definition:
RootChamberReader.h:21
hfClusterShapes_cfi.hits
hits
Definition:
hfClusterShapes_cfi.py:5
std
Definition:
JetResolutionObject.h:80
RootChamberReader::thePosition
int thePosition
Definition:
RootChamberReader.h:22
nullptr
#define nullptr
GetRecoTauVFromDQM_MC_cff.next
next
Definition:
GetRecoTauVFromDQM_MC_cff.py:30
RootChamberReader::theTree
TTree * theTree
Definition:
RootChamberReader.h:20
RootChamberReader::read
void read(edm::PSimHitContainer &hits)
Definition:
RootChamberReader.cc:37
RootChamberReader.h
RootChamberReader::RootChamberReader
RootChamberReader()
default ctor, for STL
Definition:
RootChamberReader.cc:7
FrontierConditions_GlobalTag_cff.file
file
Definition:
FrontierConditions_GlobalTag_cff.py:13
RootChamberReader::theSize
int theSize
Definition:
RootChamberReader.h:23
LogTrace
#define LogTrace(id)
Definition:
PFTrackAlgoTools.cc:504
RootChamberReader::~RootChamberReader
~RootChamberReader()
writes the tree, and deletes everything
Definition:
RootChamberReader.cc:30
edm::PSimHitContainer
std::vector< PSimHit > PSimHitContainer
Definition:
PSimHitContainer.h:11
Generated for CMSSW Reference Manual by
1.8.11