CMS 3D CMS Logo

List of all members | Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes
tnp::BaseTreeFiller Class Reference

#include <BaseTreeFiller.h>

Inheritance diagram for tnp::BaseTreeFiller:
tnp::TPTreeFiller

Public Member Functions

 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)
 
 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...
 
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...
 
BaseTreeFilleroperator= (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...
 

Protected Types

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...
 

Protected Member Functions

void addBranches_ (TTree *tree, const edm::ParameterSet &iConfig, edm::ConsumesCollector &iC, const std::string &branchNamePrefix="")
 

Protected Attributes

edm::EDGetTokenT< GenLumiInfoHeader_genLumiInfoToken
 
edm::EDGetTokenT< LHEEventProduct_LHECollection
 
edm::EDGetTokenT< LHERunInfoProduct_lheRunInfoToken
 
bool addCaloMet_
 
bool addEventVariablesInfo_
 Add branches with event variables: met, sum ET, .. etc. More...
 
bool addRho_
 
bool addRunLumiInfo_
 Add branches with run and lumisection number. More...
 
edm::EDGetTokenT< reco::BeamSpotbeamSpotToken_
 
uint64_t event_
 
std::vector< ProbeFlagflags_
 
edm::EDGetTokenT< reco::GenParticleCollectiongenParticlesToken_
 
float lhe_ht_
 
bool LHEinfo_
 
float lheWeight_ [9]
 
uint32_t lumi_
 
float mBSx_
 
float mBSy_
 
float mBSz_
 
edm::EDGetTokenT< reco::CaloMETCollectionmetToken_
 
float mMET_
 
float mMETSign_
 
uint32_t mNPV_
 
float mpfMET_
 
float mpfMETSign_
 
float mpfPhi_
 
float mpfSumET_
 
float mPVx_
 
float mPVy_
 
float mPVz_
 
float mSumET_
 
float mtcMET_
 
float mtcMETSign_
 
float mtcSumET_
 
edm::EDGetTokenT< reco::PFMETCollectionpfmetToken_
 
edm::EDGetTokenT< pat::METCollectionpfmetTokenMiniAOD_
 
edm::EDGetTokenT< std::vector< PileupSummaryInfo > > pileupInfoToken_
 
float psWeight_ [5]
 
float PUweight_
 
edm::EDGetTokenT< double > PUweightSrcToken_
 
edm::EDGetTokenT< reco::VertexCollectionrecVtxsToken_
 
float rho_
 
edm::EDGetTokenT< double > rhoToken_
 
uint32_t run_
 
bool storePUweight_
 Store Pileup weight when running over Monte Carlo. More...
 
edm::EDGetTokenT< reco::METCollectiontcmetToken_
 
float totWeight_
 
TTree * tree_
 
int truePU_
 
std::vector< ProbeVariablevars_
 
float weight_
 
WeightMode weightMode_
 
edm::EDGetTokenT< GenEventInfoProductweightSrcToken_
 

Detailed Description

Definition at line 139 of file BaseTreeFiller.h.

Member Enumeration Documentation

◆ 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.

Constructor & Destructor Documentation

◆ BaseTreeFiller() [1/4]

tnp::BaseTreeFiller::BaseTreeFiller ( const BaseTreeFiller )
delete

◆ BaseTreeFiller() [2/4]

tnp::BaseTreeFiller::BaseTreeFiller ( const char *  name,
const edm::ParameterSet config,
edm::ConsumesCollector &&  iC 
)
inline

specify the name of the TTree, and the configuration for it

Definition at line 144 of file BaseTreeFiller.h.

145  : BaseTreeFiller(name, config, iC) {}
Definition: config.py:1
BaseTreeFiller(const BaseTreeFiller &)=delete

◆ BaseTreeFiller() [3/4]

tnp::BaseTreeFiller::BaseTreeFiller ( const char *  name,
const edm::ParameterSet config,
edm::ConsumesCollector iC 
)

FC (EGM) - add possibility to customize collections (can run other miniAOD)

Definition at line 33 of file BaseTreeFiller.cc.

References edm::ConsumesCollector::consumes(), edm::ParameterSet::existsAs(), make_classfiles::fs, edm::ParameterSet::getParameter(), ProducerED_cfi::InputTag, edm::ConsumesCollector::mayConsume(), mergeVDriftHistosByStation::name, and isotrackNtuplerCondor::None.

33  {
34  // make trees as requested
36  tree_ = fs->make<TTree>(name, name);
37 
38  // add the branches
39  addBranches_(tree_, iConfig, iC, "");
40 
41  // set up weights, if needed
42  if (iConfig.existsAs<double>("eventWeight")) {
44  weight_ = iConfig.getParameter<double>("eventWeight");
45  } else if (iConfig.existsAs<edm::InputTag>("eventWeight")) {
47  weightSrcToken_ = iC.consumes<GenEventInfoProduct>(iConfig.getParameter<edm::InputTag>("eventWeight"));
48  tree_->Branch("psWeight", &psWeight_, "psWeight[5]/F");
49  } else {
50  weightMode_ = None;
51  }
52  if (weightMode_ != None) {
53  tree_->Branch("weight", &weight_, "weight/F");
54  tree_->Branch("totWeight", &totWeight_, "totWeight/F");
55  }
56 
57  LHEinfo_ = iConfig.existsAs<edm::InputTag>("LHEWeightSrc");
58  if (LHEinfo_) {
59  _LHECollection = iC.consumes<LHEEventProduct>(iConfig.getParameter<edm::InputTag>("LHEWeightSrc"));
60  tree_->Branch("lheWeight", &lheWeight_, "lheWeight[9]/F");
61  tree_->Branch("lhe_ht", &lhe_ht_, "lhe_ht/F");
62  }
63 
64  storePUweight_ = iConfig.existsAs<edm::InputTag>("PUWeightSrc") ? true : false;
65  if (storePUweight_) {
66  PUweightSrcToken_ = iC.consumes<double>(iConfig.getParameter<edm::InputTag>("PUWeightSrc"));
67  tree_->Branch("PUweight", &PUweight_, "PUweight/F");
68  }
69 
70  if (iConfig.existsAs<edm::InputTag>("pileupInfoTag"))
72  iC.consumes<std::vector<PileupSummaryInfo> >(iConfig.getParameter<edm::InputTag>("pileupInfoTag"));
73 
74  addRunLumiInfo_ = iConfig.existsAs<bool>("addRunLumiInfo") ? iConfig.getParameter<bool>("addRunLumiInfo") : false;
75  if (addRunLumiInfo_) {
76  tree_->Branch("run", &run_, "run/i");
77  tree_->Branch("lumi", &lumi_, "lumi/i");
78  tree_->Branch("event", &event_, "event/l");
79  tree_->Branch("truePU", &truePU_, "truePU/I");
80  }
82  iConfig.existsAs<bool>("addEventVariablesInfo") ? iConfig.getParameter<bool>("addEventVariablesInfo") : false;
85  edm::InputTag bsIT = iConfig.existsAs<edm::InputTag>("beamSpot") ? iConfig.getParameter<edm::InputTag>("beamSpot")
86  : edm::InputTag("offlineBeamSpot");
87  edm::InputTag vtxIT = iConfig.existsAs<edm::InputTag>("vertexCollection")
88  ? iConfig.getParameter<edm::InputTag>("vertexCollection")
89  : edm::InputTag("offlinePrimaryVertices");
90  edm::InputTag pfMetIT = iConfig.existsAs<edm::InputTag>("pfMet") ? iConfig.getParameter<edm::InputTag>("pfMet")
91  : edm::InputTag("pfMet");
92  edm::InputTag tcMetIT = iConfig.existsAs<edm::InputTag>("tcMet") ? iConfig.getParameter<edm::InputTag>("tcMet")
93  : edm::InputTag("tcMet");
94  edm::InputTag clMetIT =
95  iConfig.existsAs<edm::InputTag>("clMet") ? iConfig.getParameter<edm::InputTag>("clMet") : edm::InputTag("met");
96 
101  addCaloMet_ = iConfig.existsAs<bool>("addCaloMet") ? iConfig.getParameter<bool>("addCaloMet") : true;
102  tree_->Branch("event_nPV", &mNPV_, "mNPV/I");
103  if (addCaloMet_) {
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");
109  tree_->Branch("event_met_tcmet", &mtcMET_, "mtcMET/F");
110  tree_->Branch("event_met_tcsumet", &mtcSumET_, "mtcSumET/F");
111  tree_->Branch("event_met_tcmetsignificance", &mtcMETSign_, "mtcMETSign/F");
112  }
113  tree_->Branch("event_met_pfmet", &mpfMET_, "mpfMET/F");
114  tree_->Branch("event_met_pfphi", &mpfPhi_, "mpfPhi/F");
115  tree_->Branch("event_met_pfsumet", &mpfSumET_, "mpfSumET/F");
116 
117  tree_->Branch("event_met_pfmetsignificance", &mpfMETSign_, "mpfMETSign/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");
124  }
125 
126  addRho_ = iConfig.existsAs<edm::InputTag>("rho") ? true : false;
127  if (addRho_) {
128  rhoToken_ = iC.consumes<double>(iConfig.getParameter<edm::InputTag>("rho"));
129  tree_->Branch("event_rho", &rho_, "rho/F");
130  }
131 }
bool addEventVariablesInfo_
Add branches with event variables: met, sum ET, .. etc.
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
edm::EDGetTokenT< reco::PFMETCollection > pfmetToken_
edm::EDGetTokenT< GenEventInfoProduct > weightSrcToken_
EDGetTokenT< ProductType > mayConsume(edm::InputTag const &tag)
bool addRunLumiInfo_
Add branches with run and lumisection number.
std::vector< MET > METCollection
Definition: MET.h:31
edm::EDGetTokenT< double > PUweightSrcToken_
std::vector< Vertex > VertexCollection
collection of Vertex objects
Definition: VertexFwd.h:9
std::vector< reco::MET > METCollection
collection of MET objects
Definition: METCollection.h:22
edm::EDGetTokenT< reco::CaloMETCollection > metToken_
edm::EDGetTokenT< LHEEventProduct > _LHECollection
edm::EDGetTokenT< pat::METCollection > pfmetTokenMiniAOD_
edm::EDGetTokenT< reco::METCollection > tcmetToken_
edm::EDGetTokenT< double > rhoToken_
void addBranches_(TTree *tree, const edm::ParameterSet &iConfig, edm::ConsumesCollector &iC, const std::string &branchNamePrefix="")
std::vector< reco::CaloMET > CaloMETCollection
collection of CaloMET objects
edm::EDGetTokenT< reco::VertexCollection > recVtxsToken_
edm::EDGetTokenT< reco::BeamSpot > beamSpotToken_
std::vector< reco::PFMET > PFMETCollection
collection of PFMET objects
edm::EDGetTokenT< std::vector< PileupSummaryInfo > > pileupInfoToken_
bool storePUweight_
Store Pileup weight when running over Monte Carlo.

◆ BaseTreeFiller() [4/4]

tnp::BaseTreeFiller::BaseTreeFiller ( BaseTreeFiller main,
const edm::ParameterSet iConfig,
edm::ConsumesCollector &&  iC,
const std::string &  branchNamePrefix 
)

Add branches to an existing TTree managed by another BaseTreeFiller.

Definition at line 133 of file BaseTreeFiller.cc.

References addBranches_(), addRunLumiInfo_, and storePUweight_.

137  : addRunLumiInfo_(false), addEventVariablesInfo_(false), tree_(nullptr) {
138  addRunLumiInfo_ = main.addRunLumiInfo_;
139  storePUweight_ = main.storePUweight_;
140  addBranches_(main.tree_, iConfig, iC, branchNamePrefix);
141 }
bool addEventVariablesInfo_
Add branches with event variables: met, sum ET, .. etc.
bool addRunLumiInfo_
Add branches with run and lumisection number.
void addBranches_(TTree *tree, const edm::ParameterSet &iConfig, edm::ConsumesCollector &iC, const std::string &branchNamePrefix="")
Definition: main.py:1
bool storePUweight_
Store Pileup weight when running over Monte Carlo.

◆ ~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.

184 {}

Member Function Documentation

◆ addBranches_()

void tnp::BaseTreeFiller::addBranches_ ( TTree *  tree,
const edm::ParameterSet iConfig,
edm::ConsumesCollector iC,
const std::string &  branchNamePrefix = "" 
)
protected

Definition at line 143 of file BaseTreeFiller.cc.

References edm::ConsumesCollector::consumes(), HLT_2024v14_cff::flags, edm::ParameterSet::getParameter(), ALPAKA_ACCELERATOR_NAMESPACE::vertexFinder::it, AlCaHLTBitMon_QueryRunRegistry::string, and EcalPhiSymFlatTableProducers_cfi::variables.

Referenced by BaseTreeFiller().

146  {
147  // set up variables
149  //.. the ones that are strings
150  std::vector<std::string> stringVars = variables.getParameterNamesForType<std::string>();
151  for (std::vector<std::string>::const_iterator it = stringVars.begin(), ed = stringVars.end(); it != ed; ++it) {
152  vars_.push_back(tnp::ProbeVariable(branchNamePrefix + *it, variables.getParameter<std::string>(*it)));
153  }
154  //.. the ones that are InputTags
155  std::vector<std::string> inputTagVars = variables.getParameterNamesForType<edm::InputTag>();
156  for (std::vector<std::string>::const_iterator it = inputTagVars.begin(), ed = inputTagVars.end(); it != ed; ++it) {
157  vars_.push_back(tnp::ProbeVariable(branchNamePrefix + *it,
158  iC.consumes<edm::ValueMap<float> >(variables.getParameter<edm::InputTag>(*it))));
159  }
160  // set up flags
162  //.. the ones that are strings
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) {
165  flags_.push_back(tnp::ProbeFlag(branchNamePrefix + *it, flags.getParameter<std::string>(*it)));
166  }
167  //.. the ones that are InputTags
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) {
170  flags_.push_back(tnp::ProbeFlag(branchNamePrefix + *it,
171  iC.consumes<edm::View<reco::Candidate> >(flags.getParameter<edm::InputTag>(*it))));
172  }
173 
174  // then make all the variables in the trees
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());
177  }
178 
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());
181  }
182 }
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
std::vector< ProbeVariable > vars_
A variable for the probe: can be a string expression or an external ValueMap<float> ...
std::vector< ProbeFlag > flags_
Definition: tree.py:1

◆ fill()

void tnp::BaseTreeFiller::fill ( const reco::CandidateBaseRef probe) const

To be called once per probe, to fill the values for this probe.

Definition at line 346 of file BaseTreeFiller.cc.

References RemoveAddSevLevel::flag, and ALCARECOEcalPhiSym_cff::var.

Referenced by tnp::TPTreeFiller::fill().

346  {
347  for (auto const &var : vars_)
348  var.fill(probe);
349  for (auto const &flag : flags_)
350  flag.fill(probe);
351 
352  if (tree_)
353  tree_->Fill();
354 }
std::vector< ProbeVariable > vars_
std::vector< ProbeFlag > flags_

◆ 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.

References funct::abs(), isoTrack_cff::beamSpot, ALCARECOEcalPhiSym_cff::float, LHEEventProduct::hepeup(), mps_fire::i, lhef::HEPEUP::IDUP, iEvent, lhef::HEPEUP::ISTUP, edm::HandleBase::isValid(), ALPAKA_ACCELERATOR_NAMESPACE::vertexFinder::it, isotrackApplyRegressor::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().

186  {
187  run_ = iEvent.id().run();
188  lumi_ = iEvent.id().luminosityBlock();
189  event_ = iEvent.id().event();
190 
191  truePU_ = 0;
192  if (!iEvent.isRealData() and !pileupInfoToken_.isUninitialized()) {
194  iEvent.getByToken(pileupInfoToken_, PupInfo);
195  truePU_ = PupInfo->begin()->getTrueNumInteractions();
196  }
197 
198  totWeight_ = 1.;
199  for (std::vector<tnp::ProbeVariable>::const_iterator it = vars_.begin(), ed = vars_.end(); it != ed; ++it) {
200  it->init(iEvent);
201  }
202  for (std::vector<tnp::ProbeFlag>::const_iterator it = flags_.begin(), ed = flags_.end(); it != ed; ++it) {
203  it->init(iEvent);
204  }
205  for (int i = 0; i < 5; i++) {
206  psWeight_[i] = 1.; // init
207  }
208  if (weightMode_ == External) {
209  // edm::Handle<double> weight;
210  // iEvent.getByToken(weightSrcToken_, weight);
211  // weight_ = *weight;
213  iEvent.getByToken(weightSrcToken_, weight);
214  weight_ = weight->weight();
215  totWeight_ *= weight_;
216  if (weight->weights().size() >= 10) {
217  int k = 1;
218  for (int i = 6; i < 10; i++) {
219  // hardcoded Pythia 8 isrDefHi,fsrDefHi,isrDefLo,fsrDefLo
220  psWeight_[k] = weight->weights().at(i) / weight->weight();
221  k++;
222  }
223  }
224  }
225 
226  for (unsigned int i = 0; i < 9; i++) {
227  lheWeight_[i] = 1.; // init
228  }
229  lhe_ht_ = 0.;
231  edm::Handle<LHEEventProduct> lheEventHandle;
232  iEvent.getByToken(_LHECollection, lheEventHandle);
233  for (unsigned int i = 0; i < 9; i++) {
234  lheWeight_[i] = lheEventHandle->weights().at(i).wgt / lheEventHandle->originalXWGTUP();
235  }
236  for (int i = 0; i < lheEventHandle->hepeup().NUP; i++) {
237  int id = lheEventHandle->hepeup().IDUP[i];
238  int st = lheEventHandle->hepeup().ISTUP[i];
239 
240  // calculate HT at LHE level
241  if ((abs(id) < 6 || id == 21) && st > 0) {
242  lhe_ht_ += sqrt(pow(lheEventHandle->hepeup().PUP[i][0], 2) + pow(lheEventHandle->hepeup().PUP[i][1], 2));
243  }
244  }
245  }
246 
248  PUweight_ = 1;
250  edm::Handle<double> weightPU;
251  bool isPresent = iEvent.getByToken(PUweightSrcToken_, weightPU);
252  if (isPresent)
253  PUweight_ = float(*weightPU);
255  }
256 
261  iEvent.getByToken(recVtxsToken_, recVtxs);
262  mNPV_ = 0;
263  mPVx_ = 100.0;
264  mPVy_ = 100.0;
265  mPVz_ = 100.0;
266 
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)) {
270  mNPV_++;
271  if (mNPV_ == 1) { // store the first good primary vertex
272  mPVx_ = (*recVtxs)[ind].x();
273  mPVy_ = (*recVtxs)[ind].y();
274  mPVz_ = (*recVtxs)[ind].z();
275  }
276  }
277  }
278 
281  iEvent.getByToken(beamSpotToken_, beamSpot);
282  mBSx_ = beamSpot->position().X();
283  mBSy_ = beamSpot->position().Y();
284  mBSz_ = beamSpot->position().Z();
285 
286  if (addCaloMet_) {
289  iEvent.getByToken(metToken_, met);
290  if (met->empty()) {
291  mMET_ = -1;
292  mSumET_ = -1;
293  mMETSign_ = -1;
294  } else {
295  mMET_ = (*met)[0].et();
296  mSumET_ = (*met)[0].sumEt();
297  mMETSign_ = (*met)[0].significance();
298  }
299 
302  iEvent.getByToken(tcmetToken_, tcmet);
303  if (tcmet->empty()) {
304  mtcMET_ = -1;
305  mtcSumET_ = -1;
306  mtcMETSign_ = -1;
307  } else {
308  mtcMET_ = (*tcmet)[0].et();
309  mtcSumET_ = (*tcmet)[0].sumEt();
310  mtcMETSign_ = (*tcmet)[0].significance();
311  }
312  }
313 
316  iEvent.getByToken(pfmetToken_, pfmet);
317  if (pfmet.isValid()) {
318  if (pfmet->empty()) {
319  mpfMET_ = -1;
320  mpfSumET_ = -1;
321  mpfMETSign_ = -1;
322  } else {
323  mpfMET_ = (*pfmet)[0].et();
324  mpfPhi_ = (*pfmet)[0].phi();
325  mpfSumET_ = (*pfmet)[0].sumEt();
326  mpfMETSign_ = (*pfmet)[0].significance();
327  }
328  } else {
330  iEvent.getByToken(pfmetTokenMiniAOD_, pfmet2);
331  const pat::MET &met = pfmet2->front();
332  mpfMET_ = met.pt();
333  mpfPhi_ = met.phi();
334  mpfSumET_ = met.sumEt();
335  mpfMETSign_ = met.significance();
336  }
337 
338  if (addRho_) {
339  edm::Handle<double> rhos;
340  iEvent.getByToken(rhoToken_, rhos);
341  rho_ = (float)*rhos;
342  }
343  }
344 }
bool addEventVariablesInfo_
Add branches with event variables: met, sum ET, .. etc.
Analysis-level MET class.
Definition: MET.h:40
edm::EDGetTokenT< reco::PFMETCollection > pfmetToken_
edm::EDGetTokenT< GenEventInfoProduct > weightSrcToken_
double originalXWGTUP() const
edm::EDGetTokenT< double > PUweightSrcToken_
constexpr bool isUninitialized() const noexcept
Definition: EDGetToken.h:98
std::vector< ProbeVariable > vars_
Definition: weight.py:1
std::vector< ProbeFlag > flags_
int iEvent
Definition: GenABIO.cc:224
edm::EDGetTokenT< reco::CaloMETCollection > metToken_
edm::EDGetTokenT< LHEEventProduct > _LHECollection
T sqrt(T t)
Definition: SSEVec.h:23
std::vector< FiveVector > PUP
Definition: LesHouches.h:246
edm::EDGetTokenT< pat::METCollection > pfmetTokenMiniAOD_
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
edm::EDGetTokenT< reco::METCollection > tcmetToken_
std::vector< int > ISTUP
Definition: LesHouches.h:228
edm::EDGetTokenT< double > rhoToken_
std::vector< int > IDUP
Definition: LesHouches.h:223
edm::EDGetTokenT< reco::VertexCollection > recVtxsToken_
bool isValid() const
Definition: HandleBase.h:70
edm::EDGetTokenT< reco::BeamSpot > beamSpotToken_
edm::EDGetTokenT< std::vector< PileupSummaryInfo > > pileupInfoToken_
bool storePUweight_
Store Pileup weight when running over Monte Carlo.
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:29
const std::vector< WGT > & weights() const
const lhef::HEPEUP & hepeup() const

◆ operator=()

BaseTreeFiller& tnp::BaseTreeFiller::operator= ( const BaseTreeFiller )
delete

◆ storePUweight()

bool tnp::BaseTreeFiller::storePUweight ( ) const
inline

Definition at line 171 of file BaseTreeFiller.h.

171 { return storePUweight_; };
bool storePUweight_
Store Pileup weight when running over Monte Carlo.

◆ writeProvenance()

void tnp::BaseTreeFiller::writeProvenance ( const edm::ParameterSet pset) const

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.

References muonDTDigis_cfi::pset.

355  {
356  TList *list = tree_->GetUserInfo();
357  list->Add(new TObjString(pset.dump().c_str()));
358 }

Member Data Documentation

◆ _genLumiInfoToken

edm::EDGetTokenT<GenLumiInfoHeader> tnp::BaseTreeFiller::_genLumiInfoToken
protected

Definition at line 183 of file BaseTreeFiller.h.

◆ _LHECollection

edm::EDGetTokenT<LHEEventProduct> tnp::BaseTreeFiller::_LHECollection
protected

Definition at line 182 of file BaseTreeFiller.h.

◆ _lheRunInfoToken

edm::EDGetTokenT<LHERunInfoProduct> tnp::BaseTreeFiller::_lheRunInfoToken
protected

Definition at line 184 of file BaseTreeFiller.h.

◆ addCaloMet_

bool tnp::BaseTreeFiller::addCaloMet_
protected

Definition at line 205 of file BaseTreeFiller.h.

◆ 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

Definition at line 204 of file BaseTreeFiller.h.

◆ addRunLumiInfo_

bool tnp::BaseTreeFiller::addRunLumiInfo_
protected

Add branches with run and lumisection number.

Definition at line 197 of file BaseTreeFiller.h.

Referenced by BaseTreeFiller().

◆ beamSpotToken_

edm::EDGetTokenT<reco::BeamSpot> tnp::BaseTreeFiller::beamSpotToken_
protected

Definition at line 189 of file BaseTreeFiller.h.

◆ event_

uint64_t tnp::BaseTreeFiller::event_
mutableprotected

Definition at line 218 of file BaseTreeFiller.h.

◆ flags_

std::vector<ProbeFlag> tnp::BaseTreeFiller::flags_
protected

Definition at line 175 of file BaseTreeFiller.h.

◆ genParticlesToken_

edm::EDGetTokenT<reco::GenParticleCollection> tnp::BaseTreeFiller::genParticlesToken_
protected

Definition at line 185 of file BaseTreeFiller.h.

◆ lhe_ht_

float tnp::BaseTreeFiller::lhe_ht_
mutableprotected

Definition at line 223 of file BaseTreeFiller.h.

◆ LHEinfo_

bool tnp::BaseTreeFiller::LHEinfo_
protected

Definition at line 180 of file BaseTreeFiller.h.

◆ lheWeight_

float tnp::BaseTreeFiller::lheWeight_[9]
mutableprotected

Definition at line 215 of file BaseTreeFiller.h.

◆ lumi_

uint32_t tnp::BaseTreeFiller::lumi_
mutableprotected

Definition at line 217 of file BaseTreeFiller.h.

◆ mBSx_

float tnp::BaseTreeFiller::mBSx_
mutableprotected

Definition at line 221 of file BaseTreeFiller.h.

◆ mBSy_

float tnp::BaseTreeFiller::mBSy_
mutableprotected

Definition at line 221 of file BaseTreeFiller.h.

◆ mBSz_

float tnp::BaseTreeFiller::mBSz_
mutableprotected

Definition at line 221 of file BaseTreeFiller.h.

◆ metToken_

edm::EDGetTokenT<reco::CaloMETCollection> tnp::BaseTreeFiller::metToken_
protected

Definition at line 190 of file BaseTreeFiller.h.

◆ mMET_

float tnp::BaseTreeFiller::mMET_
mutableprotected

Definition at line 223 of file BaseTreeFiller.h.

◆ mMETSign_

float tnp::BaseTreeFiller::mMETSign_
mutableprotected

Definition at line 223 of file BaseTreeFiller.h.

◆ mNPV_

uint32_t tnp::BaseTreeFiller::mNPV_
mutableprotected

Definition at line 217 of file BaseTreeFiller.h.

◆ mpfMET_

float tnp::BaseTreeFiller::mpfMET_
mutableprotected

Definition at line 223 of file BaseTreeFiller.h.

◆ mpfMETSign_

float tnp::BaseTreeFiller::mpfMETSign_
mutableprotected

Definition at line 223 of file BaseTreeFiller.h.

◆ mpfPhi_

float tnp::BaseTreeFiller::mpfPhi_
mutableprotected

Definition at line 223 of file BaseTreeFiller.h.

◆ mpfSumET_

float tnp::BaseTreeFiller::mpfSumET_
mutableprotected

Definition at line 223 of file BaseTreeFiller.h.

◆ mPVx_

float tnp::BaseTreeFiller::mPVx_
mutableprotected

Definition at line 221 of file BaseTreeFiller.h.

◆ mPVy_

float tnp::BaseTreeFiller::mPVy_
mutableprotected

Definition at line 221 of file BaseTreeFiller.h.

◆ mPVz_

float tnp::BaseTreeFiller::mPVz_
mutableprotected

Definition at line 221 of file BaseTreeFiller.h.

◆ mSumET_

float tnp::BaseTreeFiller::mSumET_
mutableprotected

Definition at line 223 of file BaseTreeFiller.h.

◆ mtcMET_

float tnp::BaseTreeFiller::mtcMET_
mutableprotected

Definition at line 223 of file BaseTreeFiller.h.

◆ mtcMETSign_

float tnp::BaseTreeFiller::mtcMETSign_
mutableprotected

Definition at line 223 of file BaseTreeFiller.h.

◆ mtcSumET_

float tnp::BaseTreeFiller::mtcSumET_
mutableprotected

Definition at line 223 of file BaseTreeFiller.h.

◆ pfmetToken_

edm::EDGetTokenT<reco::PFMETCollection> tnp::BaseTreeFiller::pfmetToken_
protected

Definition at line 192 of file BaseTreeFiller.h.

◆ pfmetTokenMiniAOD_

edm::EDGetTokenT<pat::METCollection> tnp::BaseTreeFiller::pfmetTokenMiniAOD_
protected

Definition at line 193 of file BaseTreeFiller.h.

◆ pileupInfoToken_

edm::EDGetTokenT<std::vector<PileupSummaryInfo> > tnp::BaseTreeFiller::pileupInfoToken_
protected

Definition at line 194 of file BaseTreeFiller.h.

◆ psWeight_

float tnp::BaseTreeFiller::psWeight_[5]
mutableprotected

Definition at line 216 of file BaseTreeFiller.h.

◆ PUweight_

float tnp::BaseTreeFiller::PUweight_
mutableprotected

Definition at line 214 of file BaseTreeFiller.h.

◆ PUweightSrcToken_

edm::EDGetTokenT<double> tnp::BaseTreeFiller::PUweightSrcToken_
protected

Definition at line 186 of file BaseTreeFiller.h.

◆ recVtxsToken_

edm::EDGetTokenT<reco::VertexCollection> tnp::BaseTreeFiller::recVtxsToken_
protected

Definition at line 188 of file BaseTreeFiller.h.

◆ rho_

float tnp::BaseTreeFiller::rho_
mutableprotected

Definition at line 222 of file BaseTreeFiller.h.

◆ rhoToken_

edm::EDGetTokenT<double> tnp::BaseTreeFiller::rhoToken_
protected

Definition at line 187 of file BaseTreeFiller.h.

◆ run_

uint32_t tnp::BaseTreeFiller::run_
mutableprotected

Definition at line 217 of file BaseTreeFiller.h.

◆ storePUweight_

bool tnp::BaseTreeFiller::storePUweight_
protected

Store Pileup weight when running over Monte Carlo.

Definition at line 200 of file BaseTreeFiller.h.

Referenced by BaseTreeFiller().

◆ tcmetToken_

edm::EDGetTokenT<reco::METCollection> tnp::BaseTreeFiller::tcmetToken_
protected

Definition at line 191 of file BaseTreeFiller.h.

◆ totWeight_

float tnp::BaseTreeFiller::totWeight_
mutableprotected

Definition at line 214 of file BaseTreeFiller.h.

◆ tree_

TTree* tnp::BaseTreeFiller::tree_
mutableprotected

Definition at line 213 of file BaseTreeFiller.h.

Referenced by tnp::TPTreeFiller::TPTreeFiller().

◆ truePU_

int tnp::BaseTreeFiller::truePU_
mutableprotected

Definition at line 219 of file BaseTreeFiller.h.

◆ vars_

std::vector<ProbeVariable> tnp::BaseTreeFiller::vars_
protected

Definition at line 171 of file BaseTreeFiller.h.

◆ weight_

float tnp::BaseTreeFiller::weight_
mutableprotected

Definition at line 214 of file BaseTreeFiller.h.

◆ weightMode_

WeightMode tnp::BaseTreeFiller::weightMode_
protected

Definition at line 179 of file BaseTreeFiller.h.

◆ weightSrcToken_

edm::EDGetTokenT<GenEventInfoProduct> tnp::BaseTreeFiller::weightSrcToken_
protected

Definition at line 181 of file BaseTreeFiller.h.