test
Main Page
Namespaces
Classes
Package Documentation
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
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
()
8
: theTree(0),
9
theHits(0),
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
!= 0)
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
!= 0 &&
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
mergeVDriftHistosByStation.file
tuple file
Definition:
mergeVDriftHistosByStation.py:54
RootSimHit
Definition:
RootSimHit.h:7
RootSimHit::get
PSimHit get() const
Definition:
RootSimHit.cc:22
RootChamberReader::theHits
TClonesArray * theHits
Definition:
RootChamberReader.h:21
RootChamberReader::thePosition
int thePosition
Definition:
RootChamberReader.h:22
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition:
AlCaHLTBitMon_QueryRunRegistry.py:255
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
RootChamberReader::theSize
int theSize
Definition:
RootChamberReader.h:23
LogTrace
#define LogTrace(id)
Definition:
MessageLogger.h:502
RootChamberReader::~RootChamberReader
~RootChamberReader()
writes the tree, and deletes everything
Definition:
RootChamberReader.cc:30
edm::PSimHitContainer
std::vector< PSimHit > PSimHitContainer
Definition:
PSimHitContainer.h:11
GetRecoTauVFromDQM_MC_cff.next
tuple next
Definition:
GetRecoTauVFromDQM_MC_cff.py:30
Generated for CMSSW Reference Manual by
1.8.5