|
|
#include <BaseTreeFiller.h>
|
| BaseTreeFiller (BaseTreeFiller &main, const edm::ParameterSet &iConfig, edm::ConsumesCollector &&iC, const std::string &branchNamePrefix) |
| Add branches to an existing TTree managed by another BaseTreeFiller. More...
|
|
| BaseTreeFiller (const BaseTreeFiller &)=delete |
|
| BaseTreeFiller (const char *name, const edm::ParameterSet &config, edm::ConsumesCollector &&iC) |
| specify the name of the TTree, and the configuration for it More...
|
|
| BaseTreeFiller (const char *name, const edm::ParameterSet &config, edm::ConsumesCollector &iC) |
|
void | fill (const reco::CandidateBaseRef &probe) const |
| To be called once per probe, to fill the values for this probe. More...
|
|
void | init (const edm::Event &iEvent) const |
| To be called once per event, to load possible external variables. More...
|
|
BaseTreeFiller & | operator= (const BaseTreeFiller &)=delete |
|
bool | storePUweight () const |
|
void | writeProvenance (const edm::ParameterSet &pset) const |
|
| ~BaseTreeFiller () |
| Destructor, does nothing but it's out-of-line as we have complex data members. More...
|
|
|
enum | WeightMode { None,
Fixed,
External
} |
| How event weights are defined: 'None' = no weights, 'Fixed' = one value specified in cfg file, 'External' = read weight from the event (as double) More...
|
|
Definition at line 139 of file BaseTreeFiller.h.
◆ WeightMode
How event weights are defined: 'None' = no weights, 'Fixed' = one value specified in cfg file, 'External' = read weight from the event (as double)
Enumerator |
---|
None | |
Fixed | |
External | |
Definition at line 178 of file BaseTreeFiller.h.
◆ BaseTreeFiller() [1/4]
◆ BaseTreeFiller() [2/4]
specify the name of the TTree, and the configuration for it
Definition at line 144 of file BaseTreeFiller.h.
◆ BaseTreeFiller() [3/4]
FC (EGM) - add possibility to customize collections (can run other miniAOD)
Definition at line 33 of file BaseTreeFiller.cc.
42 if (iConfig.existsAs<
double>(
"eventWeight")) {
44 weight_ = iConfig.getParameter<
double>(
"eventWeight");
74 addRunLumiInfo_ = iConfig.existsAs<
bool>(
"addRunLumiInfo") ? iConfig.getParameter<
bool>(
"addRunLumiInfo") :
false;
82 iConfig.existsAs<
bool>(
"addEventVariablesInfo") ? iConfig.getParameter<
bool>(
"addEventVariablesInfo") :
false;
101 addCaloMet_ = iConfig.existsAs<
bool>(
"addCaloMet") ? iConfig.getParameter<
bool>(
"addCaloMet") :
true;
106 tree_->Branch(
"event_met_calomet", &
mMET_,
"mMET/F");
107 tree_->Branch(
"event_met_calosumet", &
mSumET_,
"mSumET/F");
108 tree_->Branch(
"event_met_calometsignificance", &
mMETSign_,
"mMETSign/F");
118 tree_->Branch(
"event_PrimaryVertex_x", &
mPVx_,
"mPVx/F");
119 tree_->Branch(
"event_PrimaryVertex_y", &
mPVy_,
"mPVy/F");
120 tree_->Branch(
"event_PrimaryVertex_z", &
mPVz_,
"mPVz/F");
121 tree_->Branch(
"event_BeamSpot_x", &
mBSx_,
"mBSx/F");
122 tree_->Branch(
"event_BeamSpot_y", &
mBSy_,
"mBSy/F");
123 tree_->Branch(
"event_BeamSpot_z", &
mBSz_,
"mBSz/F");
129 tree_->Branch(
"event_rho", &
rho_,
"rho/F");
References edm::ConsumesCollector::consumes(), event_(), edm::ParameterSet::existsAs(), edm::ParameterSet::getParameter(), HLT_FULL_cff::InputTag, TFileService::make(), edm::ConsumesCollector::mayConsume(), Skims_PA_cff::name, and None.
◆ BaseTreeFiller() [4/4]
◆ ~BaseTreeFiller()
tnp::BaseTreeFiller::~BaseTreeFiller |
( |
| ) |
|
Destructor, does nothing but it's out-of-line as we have complex data members.
Definition at line 184 of file BaseTreeFiller.cc.
◆ addBranches_()
Definition at line 143 of file BaseTreeFiller.cc.
151 for (std::vector<std::string>::const_iterator it = stringVars.begin(), ed = stringVars.end(); it != ed; ++it) {
156 for (std::vector<std::string>::const_iterator it = inputTagVars.begin(), ed = inputTagVars.end(); it != ed; ++it) {
163 std::vector<std::string> stringFlags =
flags.getParameterNamesForType<
std::string>();
164 for (std::vector<std::string>::const_iterator it = stringFlags.begin(), ed = stringFlags.end(); it != ed; ++it) {
168 std::vector<std::string> inputTagFlags =
flags.getParameterNamesForType<
edm::InputTag>();
169 for (std::vector<std::string>::const_iterator it = inputTagFlags.begin(), ed = inputTagFlags.end(); it != ed; ++it) {
175 for (std::vector<tnp::ProbeVariable>::iterator it =
vars_.begin(), ed =
vars_.end(); it != ed; ++it) {
176 tree->Branch(it->name().c_str(), it->address(), (it->name() +
"/F").c_str());
179 for (std::vector<tnp::ProbeFlag>::iterator it =
flags_.begin(), ed =
flags_.end(); it != ed; ++it) {
180 tree->Branch(it->name().c_str(), it->address(), (it->name() +
"/I").c_str());
References edm::ConsumesCollector::consumes(), HLT_FULL_cff::flags, edm::ParameterSet::getParameter(), AlCaHLTBitMon_QueryRunRegistry::string, and L1TEGammaDiff_cfi::variables.
Referenced by BaseTreeFiller().
◆ fill()
◆ init()
void tnp::BaseTreeFiller::init |
( |
const edm::Event & |
iEvent | ) |
const |
To be called once per event, to load possible external variables.
*********** store some event variables: MET, SumET ****** ///////// Primary vertex //////////////
Definition at line 186 of file BaseTreeFiller.cc.
195 truePU_ = PupInfo->begin()->getTrueNumInteractions();
199 for (std::vector<tnp::ProbeVariable>::const_iterator it =
vars_.begin(), ed =
vars_.end(); it != ed; ++it) {
202 for (std::vector<tnp::ProbeFlag>::const_iterator it =
flags_.begin(), ed =
flags_.end(); it != ed; ++it) {
205 for (
int i = 0;
i < 5;
i++) {
216 if (
weight->weights().size() >= 10) {
218 for (
int i = 6;
i < 10;
i++) {
226 for (
unsigned int i = 0;
i < 9;
i++) {
233 for (
unsigned int i = 0;
i < 9;
i++) {
236 for (
int i = 0;
i < lheEventHandle->
hepeup().
NUP;
i++) {
241 if ((
abs(
id) < 6 ||
id == 21) && st > 0) {
267 for (
unsigned int ind = 0; ind < recVtxs->size(); ind++) {
268 if (!((*recVtxs)[ind].isFake()) && ((*recVtxs)[ind].ndof() > 4) && (fabs((*recVtxs)[ind].
z()) <= 24.0) &&
269 ((*recVtxs)[ind].position().Rho() <= 2.0)) {
272 mPVx_ = (*recVtxs)[ind].x();
273 mPVy_ = (*recVtxs)[ind].y();
274 mPVz_ = (*recVtxs)[ind].z();
295 mMET_ = (*met)[0].et();
303 if (tcmet->empty()) {
318 if (pfmet->empty()) {
References funct::abs(), pwdgSkimBPark_cfi::beamSpot, event_(), dqmMemoryStats::float, LHEEventProduct::hepeup(), mps_fire::i, lhef::HEPEUP::IDUP, iEvent, lhef::HEPEUP::ISTUP, edm::HandleBase::isValid(), dqmdumpme::k, BTaggingMonitor_cfi::met, lhef::HEPEUP::NUP, LHEEventProduct::originalXWGTUP(), funct::pow(), lhef::HEPEUP::PUP, mathSSE::sqrt(), mps_merge::weight, and LHEEventProduct::weights().
Referenced by tnp::TPTreeFiller::init().
◆ operator=()
◆ storePUweight()
bool tnp::BaseTreeFiller::storePUweight |
( |
| ) |
const |
|
inline |
◆ writeProvenance()
Write a string dump of this PSet into the TTree header. see macro in test directory for how to retrieve it from the output root file
Definition at line 355 of file BaseTreeFiller.cc.
356 TList *list =
tree_->GetUserInfo();
357 list->Add(
new TObjString(
pset.dump().c_str()));
References muonDTDigis_cfi::pset.
◆ _genLumiInfoToken
◆ _LHECollection
◆ _lheRunInfoToken
◆ addCaloMet_
bool tnp::BaseTreeFiller::addCaloMet_ |
|
protected |
◆ addEventVariablesInfo_
bool tnp::BaseTreeFiller::addEventVariablesInfo_ |
|
protected |
Add branches with event variables: met, sum ET, .. etc.
Definition at line 203 of file BaseTreeFiller.h.
◆ addRho_
bool tnp::BaseTreeFiller::addRho_ |
|
protected |
◆ addRunLumiInfo_
bool tnp::BaseTreeFiller::addRunLumiInfo_ |
|
protected |
◆ beamSpotToken_
◆ event_
uint64_t tnp::BaseTreeFiller::event_ |
|
mutableprotected |
◆ flags_
std::vector<ProbeFlag> tnp::BaseTreeFiller::flags_ |
|
protected |
◆ genParticlesToken_
◆ lhe_ht_
float tnp::BaseTreeFiller::lhe_ht_ |
|
mutableprotected |
◆ LHEinfo_
bool tnp::BaseTreeFiller::LHEinfo_ |
|
protected |
◆ lheWeight_
float tnp::BaseTreeFiller::lheWeight_[9] |
|
mutableprotected |
◆ lumi_
uint32_t tnp::BaseTreeFiller::lumi_ |
|
mutableprotected |
◆ mBSx_
float tnp::BaseTreeFiller::mBSx_ |
|
mutableprotected |
◆ mBSy_
float tnp::BaseTreeFiller::mBSy_ |
|
mutableprotected |
◆ mBSz_
float tnp::BaseTreeFiller::mBSz_ |
|
mutableprotected |
◆ metToken_
◆ mMET_
float tnp::BaseTreeFiller::mMET_ |
|
mutableprotected |
◆ mMETSign_
float tnp::BaseTreeFiller::mMETSign_ |
|
mutableprotected |
◆ mNPV_
uint32_t tnp::BaseTreeFiller::mNPV_ |
|
mutableprotected |
◆ mpfMET_
float tnp::BaseTreeFiller::mpfMET_ |
|
mutableprotected |
◆ mpfMETSign_
float tnp::BaseTreeFiller::mpfMETSign_ |
|
mutableprotected |
◆ mpfPhi_
float tnp::BaseTreeFiller::mpfPhi_ |
|
mutableprotected |
◆ mpfSumET_
float tnp::BaseTreeFiller::mpfSumET_ |
|
mutableprotected |
◆ mPVx_
float tnp::BaseTreeFiller::mPVx_ |
|
mutableprotected |
◆ mPVy_
float tnp::BaseTreeFiller::mPVy_ |
|
mutableprotected |
◆ mPVz_
float tnp::BaseTreeFiller::mPVz_ |
|
mutableprotected |
◆ mSumET_
float tnp::BaseTreeFiller::mSumET_ |
|
mutableprotected |
◆ mtcMET_
float tnp::BaseTreeFiller::mtcMET_ |
|
mutableprotected |
◆ mtcMETSign_
float tnp::BaseTreeFiller::mtcMETSign_ |
|
mutableprotected |
◆ mtcSumET_
float tnp::BaseTreeFiller::mtcSumET_ |
|
mutableprotected |
◆ pfmetToken_
◆ pfmetTokenMiniAOD_
◆ pileupInfoToken_
◆ psWeight_
float tnp::BaseTreeFiller::psWeight_[5] |
|
mutableprotected |
◆ PUweight_
float tnp::BaseTreeFiller::PUweight_ |
|
mutableprotected |
◆ PUweightSrcToken_
◆ recVtxsToken_
◆ rho_
float tnp::BaseTreeFiller::rho_ |
|
mutableprotected |
◆ rhoToken_
◆ run_
uint32_t tnp::BaseTreeFiller::run_ |
|
mutableprotected |
◆ storePUweight_
bool tnp::BaseTreeFiller::storePUweight_ |
|
protected |
◆ tcmetToken_
◆ totWeight_
float tnp::BaseTreeFiller::totWeight_ |
|
mutableprotected |
◆ tree_
TTree* tnp::BaseTreeFiller::tree_ |
|
mutableprotected |
◆ truePU_
int tnp::BaseTreeFiller::truePU_ |
|
mutableprotected |
◆ vars_
◆ weight_
float tnp::BaseTreeFiller::weight_ |
|
mutableprotected |
◆ weightMode_
◆ weightSrcToken_
std::vector< reco::PFMET > PFMETCollection
collection of PFMET objects
edm::EDGetTokenT< double > rhoToken_
double originalXWGTUP() const
std::vector< Vertex > VertexCollection
collection of Vertex objects
edm::EDGetTokenT< reco::CaloMETCollection > metToken_
bool storePUweight_
Store Pileup weight when running over Monte Carlo.
constexpr bool isUninitialized() const noexcept
BaseTreeFiller(const BaseTreeFiller &)=delete
std::vector< reco::MET > METCollection
collection of MET objects
edm::EDGetTokenT< LHEEventProduct > _LHECollection
bool addRunLumiInfo_
Add branches with run and lumisection number.
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
edm::EDGetTokenT< reco::BeamSpot > beamSpotToken_
edm::EDGetTokenT< std::vector< PileupSummaryInfo > > pileupInfoToken_
edm::EDGetTokenT< GenEventInfoProduct > weightSrcToken_
EDGetTokenT< ProductType > mayConsume(edm::InputTag const &tag)
const std::vector< WGT > & weights() const
Analysis-level MET class.
edm::EDGetTokenT< reco::VertexCollection > recVtxsToken_
std::vector< MET > METCollection
T * make(const Args &...args) const
make new ROOT object
std::vector< ProbeFlag > flags_
bool addEventVariablesInfo_
Add branches with event variables: met, sum ET, .. etc.
std::vector< ProbeVariable > vars_
const lhef::HEPEUP & hepeup() const
edm::EDGetTokenT< reco::PFMETCollection > pfmetToken_
edm::EDGetTokenT< reco::METCollection > tcmetToken_
T getParameter(std::string const &) const
Power< A, B >::type pow(const A &a, const B &b)
Abs< T >::type abs(const T &t)
std::vector< reco::CaloMET > CaloMETCollection
collection of CaloMET objects
A variable for the probe: can be a string expression or an external ValueMap<float>
void addBranches_(TTree *tree, const edm::ParameterSet &iConfig, edm::ConsumesCollector &iC, const std::string &branchNamePrefix="")
edm::EDGetTokenT< double > PUweightSrcToken_
std::vector< FiveVector > PUP
edm::EDGetTokenT< pat::METCollection > pfmetTokenMiniAOD_