Main Page
Namespaces
Classes
Package Documentation
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Groups
Pages
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
mergeVDriftHistosByStation.file
tuple file
Definition:
mergeVDriftHistosByStation.py:55
MessageLogger.h
RootSimHit
Definition:
RootSimHit.h:7
RootSimHit::get
PSimHit get() const
Definition:
RootSimHit.cc:21
RootChamberReader::theHits
TClonesArray * theHits
Definition:
RootChamberReader.h:20
RootChamberReader::thePosition
int thePosition
Definition:
RootChamberReader.h:21
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition:
AlCaHLTBitMon_QueryRunRegistry.py:256
LogTrace
#define LogTrace(id)
Definition:
MessageLogger.h:234
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
RootChamberReader::theSize
int theSize
Definition:
RootChamberReader.h:22
RootChamberReader::~RootChamberReader
~RootChamberReader()
writes the tree, and deletes everything
Definition:
RootChamberReader.cc:20
edm::PSimHitContainer
std::vector< PSimHit > PSimHitContainer
Definition:
PSimHitContainer.h:11
GetRecoTauVFromDQM_MC_cff.next
tuple next
Definition:
GetRecoTauVFromDQM_MC_cff.py:31
Generated for CMSSW Reference Manual by
1.8.5