CMS 3D CMS Logo

List of all members | Public Member Functions | Public Attributes | Private Member Functions | Private Attributes
L1JetRecoTreeProducer Class Reference

#include <L1Trigger/L1TNtuples/src/L1JetRecoTreeProducer.cc>

Inheritance diagram for L1JetRecoTreeProducer:
edm::one::EDAnalyzer< edm::one::SharedResources > edm::one::EDAnalyzerBase edm::EDConsumerBase

Public Member Functions

 L1JetRecoTreeProducer (const edm::ParameterSet &)
 
 ~L1JetRecoTreeProducer () override
 
- Public Member Functions inherited from edm::one::EDAnalyzer< edm::one::SharedResources >
 EDAnalyzer ()=default
 
 EDAnalyzer (const EDAnalyzer &)=delete
 
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
const EDAnalyzeroperator= (const EDAnalyzer &)=delete
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
bool wantsInputProcessBlocks () const final
 
bool wantsProcessBlocks () const final
 
- Public Member Functions inherited from edm::one::EDAnalyzerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzerBase ()
 
ModuleDescription const & moduleDescription () const
 
bool wantsStreamLuminosityBlocks () const
 
bool wantsStreamRuns () const
 
 ~EDAnalyzerBase () override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESProxyIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex > const & esGetTokenRecordIndicesVector (edm::Transition iTrans) const
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::array< std::vector< ModuleDescription const *> *, NumBranchTypes > &modulesAll, std::vector< ModuleProcessName > &modulesInPreviousProcesses, ProductRegistry const &preg, std::map< std::string, ModuleDescription const *> const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Public Attributes

L1Analysis::L1AnalysisRecoJetDataFormatjet_data
 
L1Analysis::L1AnalysisRecoMetDataFormatmet_data
 

Private Member Functions

void analyze (const edm::Event &, const edm::EventSetup &) override
 
void beginJob (void) override
 
bool caloJetID (const reco::CaloJet &jet)
 
void doCaloJetCorr (edm::Handle< reco::CaloJetCollection > caloJets, edm::Handle< reco::JetCorrector > caloJetCorr)
 
void doCaloJets (edm::Handle< reco::CaloJetCollection > caloJets)
 
void doCaloMet (edm::Handle< reco::CaloMETCollection > caloMet)
 
void doCaloMetBE (edm::Handle< reco::CaloMETCollection > caloMetBE)
 
void doPFJetCorr (edm::Handle< reco::PFJetCollection > pfJets, edm::Handle< reco::JetCorrector > pfJetCorr)
 
void doPFJets (edm::Handle< reco::PFJetCollection > pfJets)
 
void doPFMet (edm::Handle< reco::PFMETCollection > pfMet)
 
void doPFMetNoMu (edm::Handle< reco::PFMETCollection > pfMet, edm::Handle< reco::MuonCollection >)
 
void endJob () override
 
bool pfJetID (const reco::PFJet &jet)
 

Private Attributes

edm::EDGetTokenT< reco::JetCorrectorcaloJECToken_
 
bool caloJetCorrMissing_
 
bool caloJetIDMissing_
 
edm::EDGetTokenT< edm::ValueMap< reco::JetID > > caloJetIDToken_
 
bool caloJetsMissing_
 
edm::EDGetTokenT< reco::CaloJetCollectioncaloJetToken_
 
bool caloMetBEMissing_
 
edm::EDGetTokenT< reco::CaloMETCollectioncaloMetBEToken_
 
bool caloMetMissing_
 
edm::EDGetTokenT< reco::CaloMETCollectioncaloMetToken_
 
double jetetaMax_
 
double jetptThreshold_
 
unsigned int maxCl_
 
unsigned int maxJet_
 
unsigned int maxTrk_
 
unsigned int maxVtx_
 
bool muonsMissing_
 
edm::EDGetTokenT< reco::MuonCollectionmuonToken_
 
edm::EDGetTokenT< reco::JetCorrectorpfJECToken_
 
bool pfJetCorrMissing_
 
bool pfJetsMissing_
 
edm::EDGetTokenT< reco::PFJetCollectionpfJetToken_
 
bool pfMetMissing_
 
edm::EDGetTokenT< reco::PFMETCollectionpfMetToken_
 
TTree * tree_
 

Additional Inherited Members

- Public Types inherited from edm::one::EDAnalyzerBase
typedef EDAnalyzerBase ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::one::EDAnalyzerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< Bconsumes (edm::InputTag tag) noexcept
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes ()
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag)
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
void resetItemsToGetFrom (BranchType iType)
 

Detailed Description

Description: Produces tree containing reco quantities

Definition at line 58 of file L1JetRecoTreeProducer.cc.

Constructor & Destructor Documentation

◆ L1JetRecoTreeProducer()

L1JetRecoTreeProducer::L1JetRecoTreeProducer ( const edm::ParameterSet iConfig)
explicit

Definition at line 122 of file L1JetRecoTreeProducer.cc.

References caloJECToken_, caloJetIDToken_, caloJetToken_, caloMetBEToken_, caloMetToken_, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), ProducerED_cfi::InputTag, jet_data, jetetaMax_, jetptThreshold_, TFileService::kSharedResource, TFileService::make(), maxJet_, met_data, muonToken_, pfJECToken_, pfJetToken_, pfMetToken_, and tree_.

123  : pfJetsMissing_(false),
124  pfJetCorrMissing_(false),
125  caloJetCorrMissing_(false),
126  caloJetsMissing_(false),
127  caloJetIDMissing_(false),
128  pfMetMissing_(false),
129  caloMetMissing_(false),
130  caloMetBEMissing_(false),
131  muonsMissing_(false) {
132  caloJetToken_ =
133  consumes<reco::CaloJetCollection>(iConfig.getUntrackedParameter("caloJetToken", edm::InputTag("ak4CaloJets")));
134  pfJetToken_ =
135  consumes<reco::PFJetCollection>(iConfig.getUntrackedParameter("pfJetToken", edm::InputTag("ak4PFJetsCHS")));
137  consumes<edm::ValueMap<reco::JetID> >(iConfig.getUntrackedParameter("caloJetIDToken", edm::InputTag("ak4JetID")));
138  pfJECToken_ = consumes<reco::JetCorrector>(
139  iConfig.getUntrackedParameter<edm::InputTag>("pfJECToken", edm::InputTag("ak4PFCHSL1FastL2L3ResidualCorrector")));
140  caloJECToken_ = consumes<reco::JetCorrector>(iConfig.getUntrackedParameter<edm::InputTag>(
141  "caloJECToken", edm::InputTag("ak4CaloL1FastL2L3ResidualCorrector")));
142 
143  pfMetToken_ = consumes<reco::PFMETCollection>(iConfig.getUntrackedParameter("pfMetToken", edm::InputTag("pfMetT1")));
144  caloMetToken_ =
145  consumes<reco::CaloMETCollection>(iConfig.getUntrackedParameter("caloMetToken", edm::InputTag("caloMet")));
147  consumes<reco::CaloMETCollection>(iConfig.getUntrackedParameter("caloMetBEToken", edm::InputTag("caloMetBE")));
148 
149  muonToken_ = consumes<reco::MuonCollection>(iConfig.getUntrackedParameter("muonToken", edm::InputTag("muons")));
150 
151  usesResource(TFileService::kSharedResource);
152 
153  jetptThreshold_ = iConfig.getParameter<double>("jetptThreshold");
154  jetetaMax_ = iConfig.getParameter<double>("jetetaMax");
155  maxJet_ = iConfig.getParameter<unsigned int>("maxJet");
156 
159 
160  // set up output
162  tree_ = fs_->make<TTree>("JetRecoTree", "JetRecoTree");
163  tree_->Branch("Jet", "L1Analysis::L1AnalysisRecoJetDataFormat", &jet_data, 32000, 3);
164  tree_->Branch("Sums", "L1Analysis::L1AnalysisRecoMetDataFormat", &met_data, 32000, 3);
165 }
static const std::string kSharedResource
Definition: TFileService.h:76
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
L1Analysis::L1AnalysisRecoMetDataFormat * met_data
edm::EDGetTokenT< reco::CaloMETCollection > caloMetToken_
edm::EDGetTokenT< reco::JetCorrector > pfJECToken_
T getUntrackedParameter(std::string const &, T const &) const
L1Analysis::L1AnalysisRecoJetDataFormat * jet_data
edm::EDGetTokenT< edm::ValueMap< reco::JetID > > caloJetIDToken_
edm::EDGetTokenT< reco::PFJetCollection > pfJetToken_
edm::EDGetTokenT< reco::PFMETCollection > pfMetToken_
edm::EDGetTokenT< reco::MuonCollection > muonToken_
edm::EDGetTokenT< reco::JetCorrector > caloJECToken_
edm::EDGetTokenT< reco::CaloJetCollection > caloJetToken_
T * make(const Args &...args) const
make new ROOT object
Definition: TFileService.h:64
edm::EDGetTokenT< reco::CaloMETCollection > caloMetBEToken_

◆ ~L1JetRecoTreeProducer()

L1JetRecoTreeProducer::~L1JetRecoTreeProducer ( )
override

Definition at line 167 of file L1JetRecoTreeProducer.cc.

167  {
168  // do anything here that needs to be done at desctruction time
169  // (e.g. close files, deallocate resources etc.)
170 }

Member Function Documentation

◆ analyze()

void L1JetRecoTreeProducer::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivatevirtual

Implements edm::one::EDAnalyzerBase.

Definition at line 177 of file L1JetRecoTreeProducer.cc.

References caloJECToken_, caloJetCorrMissing_, caloJetIDMissing_, caloJetIDToken_, isolatedTracks_cfi::caloJets, caloJetsMissing_, caloJetToken_, heavyionUCCDQM_cfi::caloMet, CaloMET_cfi::caloMetBE, caloMetBEMissing_, caloMetBEToken_, caloMetMissing_, caloMetToken_, doCaloJetCorr(), doCaloJets(), doCaloMet(), doCaloMetBE(), doPFJetCorr(), doPFJets(), doPFMet(), doPFMetNoMu(), iEvent, edm::HandleBase::isValid(), jet_data, met_data, PDWG_BPHSkim_cff::muons, muonsMissing_, muonToken_, L1Analysis::L1AnalysisRecoJetDataFormat::nCaloJets, L1Analysis::L1AnalysisRecoJetDataFormat::nJets, pfJECToken_, pfJetCorrMissing_, pfJetBenchmark_cfi::pfJets, pfJetsMissing_, pfJetToken_, RecoPFMET_cff::pfMet, pfMetMissing_, pfMetToken_, L1Analysis::L1AnalysisRecoMetDataFormat::Reset(), L1Analysis::L1AnalysisRecoJetDataFormat::Reset(), and tree_.

177  {
178  jet_data->Reset();
179  met_data->Reset();
180 
181  // get jets
183  iEvent.getByToken(pfJetToken_, pfJets);
184 
185  // get calo jets
187  iEvent.getByToken(caloJetToken_, caloJets);
188 
189  //get sums
191  iEvent.getByToken(pfMetToken_, pfMet);
192 
193  // get jet ID
195  iEvent.getByToken(caloJetIDToken_, jetsID);
196 
198  iEvent.getByToken(pfJECToken_, pfJetCorr);
199 
201  iEvent.getByToken(caloJECToken_, caloJetCorr);
202 
204  iEvent.getByToken(caloMetToken_, caloMet);
205 
207  iEvent.getByToken(caloMetBEToken_, caloMetBE);
208 
209  // get muons
211  iEvent.getByToken(muonToken_, muons);
212 
213  if (pfJets.isValid()) {
214  jet_data->nJets = 0;
215 
216  doPFJets(pfJets);
217 
218  } else {
219  if (!pfJetsMissing_) {
220  edm::LogWarning("MissingProduct") << "PFJets not found. Branch will not be filled" << std::endl;
221  }
222  pfJetsMissing_ = true;
223  }
224 
225  if (pfJetCorr.isValid()) {
226  doPFJetCorr(pfJets, pfJetCorr);
227 
228  } else {
229  if (!pfJetCorrMissing_) {
230  edm::LogWarning("MissingProduct") << "PF Jet Corrector not found. Branch will not be filled" << std::endl;
231  }
232  pfJetCorrMissing_ = true;
233  }
234 
235  if (caloJets.isValid()) {
236  jet_data->nCaloJets = 0;
237 
239 
240  } else {
241  if (!caloJetsMissing_) {
242  edm::LogWarning("MissingProduct") << "Calo Jets not found. Branch will not be filled" << std::endl;
243  }
244  caloJetsMissing_ = true;
245  }
246 
247  if (caloJetCorr.isValid()) {
248  doCaloJetCorr(caloJets, caloJetCorr);
249 
250  } else {
251  if (!caloJetCorrMissing_) {
252  edm::LogWarning("MissingProduct") << "Calo Jet Corrector not found. Branch will not be filled" << std::endl;
253  }
254  caloJetCorrMissing_ = true;
255  }
256 
257  if (!jetsID.isValid()) {
258  if (!caloJetIDMissing_) {
259  edm::LogWarning("MissingProduct") << "Calo Jet ID not found. Branch will not be filled" << std::endl;
260  }
261  caloJetIDMissing_ = true;
262  }
263 
264  if (pfMet.isValid()) {
265  doPFMet(pfMet);
266 
267  if (muons.isValid()) {
269 
270  } else {
271  if (!muonsMissing_) {
272  edm::LogWarning("MissingProduct") << "Muons not found. PFMetNoMu branch will not be filled" << std::endl;
273  }
274  muonsMissing_ = true;
275  }
276  } else {
277  if (!pfMetMissing_) {
278  edm::LogWarning("MissingProduct") << "PFMet not found. Branch will not be filled" << std::endl;
279  }
280  pfMetMissing_ = true;
281  }
282 
283  if (caloMet.isValid()) {
285 
286  } else {
287  if (!caloMetMissing_) {
288  edm::LogWarning("MissingProduct") << "CaloMet not found. Branch will not be filled" << std::endl;
289  }
290  caloMetMissing_ = true;
291  }
292 
293  if (caloMetBE.isValid()) {
295 
296  } else {
297  if (!caloMetBEMissing_) {
298  edm::LogWarning("MissingProduct") << "CaloMetBE not found. Branch will not be filled" << std::endl;
299  }
300  caloMetBEMissing_ = true;
301  }
302 
303  tree_->Fill();
304 }
void doPFMet(edm::Handle< reco::PFMETCollection > pfMet)
L1Analysis::L1AnalysisRecoMetDataFormat * met_data
void doPFJetCorr(edm::Handle< reco::PFJetCollection > pfJets, edm::Handle< reco::JetCorrector > pfJetCorr)
edm::EDGetTokenT< reco::CaloMETCollection > caloMetToken_
void doPFJets(edm::Handle< reco::PFJetCollection > pfJets)
caloMetBE
____________________________________________________________________________||
Definition: CaloMET_cfi.py:19
edm::EDGetTokenT< reco::JetCorrector > pfJECToken_
void doCaloMetBE(edm::Handle< reco::CaloMETCollection > caloMetBE)
L1Analysis::L1AnalysisRecoJetDataFormat * jet_data
int iEvent
Definition: GenABIO.cc:224
edm::EDGetTokenT< edm::ValueMap< reco::JetID > > caloJetIDToken_
edm::EDGetTokenT< reco::PFJetCollection > pfJetToken_
void doCaloJetCorr(edm::Handle< reco::CaloJetCollection > caloJets, edm::Handle< reco::JetCorrector > caloJetCorr)
void doPFMetNoMu(edm::Handle< reco::PFMETCollection > pfMet, edm::Handle< reco::MuonCollection >)
void doCaloMet(edm::Handle< reco::CaloMETCollection > caloMet)
edm::EDGetTokenT< reco::PFMETCollection > pfMetToken_
void doCaloJets(edm::Handle< reco::CaloJetCollection > caloJets)
bool isValid() const
Definition: HandleBase.h:70
edm::EDGetTokenT< reco::MuonCollection > muonToken_
edm::EDGetTokenT< reco::JetCorrector > caloJECToken_
edm::EDGetTokenT< reco::CaloJetCollection > caloJetToken_
Log< level::Warning, false > LogWarning
edm::EDGetTokenT< reco::CaloMETCollection > caloMetBEToken_

◆ beginJob()

void L1JetRecoTreeProducer::beginJob ( void  )
overrideprivatevirtual

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 524 of file L1JetRecoTreeProducer.cc.

524 {}

◆ caloJetID()

bool L1JetRecoTreeProducer::caloJetID ( const reco::CaloJet jet)
private

Definition at line 517 of file L1JetRecoTreeProducer.cc.

References createJobs::tmp.

Referenced by doCaloJetCorr(), and doCaloJets().

517  {
518  bool tmp = true;
519 
520  return tmp;
521 }
tmp
align.sh
Definition: createJobs.py:716

◆ doCaloJetCorr()

void L1JetRecoTreeProducer::doCaloJetCorr ( edm::Handle< reco::CaloJetCollection caloJets,
edm::Handle< reco::JetCorrector caloJetCorr 
)
private

Definition at line 404 of file L1JetRecoTreeProducer.cc.

References funct::abs(), L1Analysis::L1AnalysisRecoJetDataFormat::caloCorrFactor, L1Analysis::L1AnalysisRecoJetDataFormat::caloEtCorr, L1Analysis::L1AnalysisRecoMetDataFormat::caloHt, caloJetID(), caloJetIDMissing_, isolatedTracks_cfi::caloJets, reco::JetCorrector::correction(), jet_data, jetetaMax_, jetptThreshold_, maxJet_, met_data, and edm::Handle< T >::product().

Referenced by analyze().

405  {
406  float caloCorrFactor = 1.;
407  unsigned int nCaloJets = 0;
408 
409  met_data->caloHt = 0;
410 
411  for (auto it = caloJets->begin(); it != caloJets->end() && nCaloJets < maxJet_; ++it) {
412  if (!caloJetIDMissing_)
413  if (!caloJetID(*it))
414  continue;
415 
416  caloCorrFactor = caloJetCorr.product()->correction(*it);
417 
418  jet_data->caloEtCorr.push_back(it->et() * caloCorrFactor);
419  jet_data->caloCorrFactor.push_back(caloCorrFactor);
420 
421  nCaloJets++;
422 
423  if (it->pt() * caloCorrFactor > jetptThreshold_ && std::abs(it->eta()) < jetetaMax_) {
424  met_data->caloHt += it->pt() * caloCorrFactor;
425  }
426  }
427 }
L1Analysis::L1AnalysisRecoMetDataFormat * met_data
T const * product() const
Definition: Handle.h:70
double correction(const LorentzVector &fJet) const
get correction using Jet information only
Definition: JetCorrector.h:46
L1Analysis::L1AnalysisRecoJetDataFormat * jet_data
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
bool caloJetID(const reco::CaloJet &jet)

◆ doCaloJets()

void L1JetRecoTreeProducer::doCaloJets ( edm::Handle< reco::CaloJetCollection caloJets)
private

Definition at line 306 of file L1JetRecoTreeProducer.cc.

References L1Analysis::L1AnalysisRecoJetDataFormat::caloE, L1Analysis::L1AnalysisRecoJetDataFormat::caloEt, L1Analysis::L1AnalysisRecoJetDataFormat::caloEta, caloJetID(), caloJetIDMissing_, isolatedTracks_cfi::caloJets, L1Analysis::L1AnalysisRecoJetDataFormat::caloPhi, L1Analysis::L1AnalysisRecoJetDataFormat::eEmEB, L1Analysis::L1AnalysisRecoJetDataFormat::eEmEE, L1Analysis::L1AnalysisRecoJetDataFormat::eEMF, L1Analysis::L1AnalysisRecoJetDataFormat::eEmHF, L1Analysis::L1AnalysisRecoJetDataFormat::eHadHB, L1Analysis::L1AnalysisRecoJetDataFormat::eHadHE, L1Analysis::L1AnalysisRecoJetDataFormat::eHadHF, L1Analysis::L1AnalysisRecoJetDataFormat::eHadHO, L1Analysis::L1AnalysisRecoJetDataFormat::eMaxEcalTow, L1Analysis::L1AnalysisRecoJetDataFormat::eMaxHcalTow, jet_data, maxJet_, L1Analysis::L1AnalysisRecoJetDataFormat::n60, L1Analysis::L1AnalysisRecoJetDataFormat::nCaloJets, and L1Analysis::L1AnalysisRecoJetDataFormat::towerArea.

Referenced by analyze().

306  {
307  for (auto it = caloJets->begin(); it != caloJets->end() && jet_data->nCaloJets < maxJet_; ++it) {
308  if (!caloJetIDMissing_)
309  if (!caloJetID(*it))
310  continue;
311 
312  jet_data->caloEt.push_back(it->et());
313  jet_data->caloEta.push_back(it->eta());
314  jet_data->caloPhi.push_back(it->phi());
315  jet_data->caloE.push_back(it->energy());
316 
317  jet_data->eEMF.push_back(it->emEnergyFraction());
318  jet_data->eEmEB.push_back(it->emEnergyInEB());
319  jet_data->eEmEE.push_back(it->emEnergyInEE());
320  jet_data->eEmHF.push_back(it->emEnergyInHF());
321  jet_data->eHadHB.push_back(it->hadEnergyInHB());
322  jet_data->eHadHE.push_back(it->hadEnergyInHE());
323  jet_data->eHadHO.push_back(it->hadEnergyInHO());
324  jet_data->eHadHF.push_back(it->hadEnergyInHF());
325  jet_data->eMaxEcalTow.push_back(it->maxEInEmTowers());
326  jet_data->eMaxHcalTow.push_back(it->maxEInHadTowers());
327  jet_data->towerArea.push_back(it->towersArea());
328  jet_data->n60.push_back(it->n60());
329 
330  jet_data->nCaloJets++;
331  }
332 }
L1Analysis::L1AnalysisRecoJetDataFormat * jet_data
bool caloJetID(const reco::CaloJet &jet)

◆ doCaloMet()

void L1JetRecoTreeProducer::doCaloMet ( edm::Handle< reco::CaloMETCollection caloMet)
private

Definition at line 471 of file L1JetRecoTreeProducer.cc.

References heavyionUCCDQM_cfi::caloMet, L1Analysis::L1AnalysisRecoMetDataFormat::caloMet, L1Analysis::L1AnalysisRecoMetDataFormat::caloMetPhi, L1Analysis::L1AnalysisRecoMetDataFormat::caloSumEt, reco::LeafCandidate::et(), met_data, reco::LeafCandidate::phi(), and reco::MET::sumEt().

Referenced by analyze().

471  {
472  const reco::CaloMETCollection* metCol = caloMet.product();
473  const reco::CaloMET theMet = metCol->front();
474 
475  met_data->caloMet = theMet.et();
476  met_data->caloMetPhi = theMet.phi();
477  met_data->caloSumEt = theMet.sumEt();
478 }
L1Analysis::L1AnalysisRecoMetDataFormat * met_data
double sumEt() const
Definition: MET.h:56
std::vector< reco::CaloMET > CaloMETCollection
collection of CaloMET objects
double et() const final
transverse energy
double phi() const final
momentum azimuthal angle

◆ doCaloMetBE()

void L1JetRecoTreeProducer::doCaloMetBE ( edm::Handle< reco::CaloMETCollection caloMetBE)
private

Definition at line 480 of file L1JetRecoTreeProducer.cc.

References CaloMET_cfi::caloMetBE, L1Analysis::L1AnalysisRecoMetDataFormat::caloMetBE, L1Analysis::L1AnalysisRecoMetDataFormat::caloMetPhiBE, L1Analysis::L1AnalysisRecoMetDataFormat::caloSumEtBE, reco::LeafCandidate::et(), met_data, reco::LeafCandidate::phi(), and reco::MET::sumEt().

Referenced by analyze().

480  {
481  const reco::CaloMETCollection* metCol = caloMetBE.product();
482  const reco::CaloMET theMet = metCol->front();
483 
484  met_data->caloMetBE = theMet.et();
485  met_data->caloMetPhiBE = theMet.phi();
486  met_data->caloSumEtBE = theMet.sumEt();
487 }
L1Analysis::L1AnalysisRecoMetDataFormat * met_data
caloMetBE
____________________________________________________________________________||
Definition: CaloMET_cfi.py:19
double sumEt() const
Definition: MET.h:56
std::vector< reco::CaloMET > CaloMETCollection
collection of CaloMET objects
double et() const final
transverse energy
double phi() const final
momentum azimuthal angle

◆ doPFJetCorr()

void L1JetRecoTreeProducer::doPFJetCorr ( edm::Handle< reco::PFJetCollection pfJets,
edm::Handle< reco::JetCorrector pfJetCorr 
)
private

Definition at line 369 of file L1JetRecoTreeProducer.cc.

References funct::abs(), reco::JetCorrector::correction(), L1Analysis::L1AnalysisRecoJetDataFormat::corrFactor, L1Analysis::L1AnalysisRecoJetDataFormat::etCorr, L1Analysis::L1AnalysisRecoMetDataFormat::Ht, jet_data, jetetaMax_, jetptThreshold_, maxJet_, met_data, L1Analysis::L1AnalysisRecoMetDataFormat::mHt, L1Analysis::L1AnalysisRecoMetDataFormat::mHtPhi, l1ctJetFileWriter_cfi::nJets, pfJetID(), pfJetBenchmark_cfi::pfJets, and edm::Handle< T >::product().

Referenced by analyze().

370  {
371  float corrFactor = 1.;
372  unsigned int nJets = 0;
373 
374  float mHx = 0;
375  float mHy = 0;
376 
377  met_data->Ht = 0;
378  met_data->mHt = -999.;
379  met_data->mHtPhi = -999.;
380 
381  for (auto it = pfJets->begin(); it != pfJets->end() && nJets < maxJet_; ++it) {
382  if (!pfJetID(*it))
383  continue;
384 
385  corrFactor = pfJetCorr.product()->correction(*it);
386 
387  jet_data->etCorr.push_back(it->et() * corrFactor);
388  jet_data->corrFactor.push_back(corrFactor);
389 
390  nJets++;
391 
392  if (it->pt() * corrFactor > jetptThreshold_ && std::abs(it->eta()) < jetetaMax_) {
393  mHx += -1. * it->px() * corrFactor;
394  mHy += -1. * it->py() * corrFactor;
395  met_data->Ht += it->pt() * corrFactor;
396  }
397  }
398 
399  TVector2 tv2 = TVector2(mHx, mHy);
400  met_data->mHt = tv2.Mod();
401  met_data->mHtPhi = tv2.Phi();
402 }
bool pfJetID(const reco::PFJet &jet)
L1Analysis::L1AnalysisRecoMetDataFormat * met_data
T const * product() const
Definition: Handle.h:70
double correction(const LorentzVector &fJet) const
get correction using Jet information only
Definition: JetCorrector.h:46
L1Analysis::L1AnalysisRecoJetDataFormat * jet_data
Abs< T >::type abs(const T &t)
Definition: Abs.h:22

◆ doPFJets()

void L1JetRecoTreeProducer::doPFJets ( edm::Handle< reco::PFJetCollection pfJets)
private

Definition at line 334 of file L1JetRecoTreeProducer.cc.

References L1Analysis::L1AnalysisRecoJetDataFormat::cemef, L1Analysis::L1AnalysisRecoJetDataFormat::chef, L1Analysis::L1AnalysisRecoJetDataFormat::chMult, L1Analysis::L1AnalysisRecoJetDataFormat::cmef, L1Analysis::L1AnalysisRecoJetDataFormat::cMult, L1Analysis::L1AnalysisRecoJetDataFormat::e, L1Analysis::L1AnalysisRecoJetDataFormat::eef, L1Analysis::L1AnalysisRecoJetDataFormat::elMult, L1Analysis::L1AnalysisRecoJetDataFormat::et, L1Analysis::L1AnalysisRecoJetDataFormat::eta, L1Analysis::L1AnalysisRecoJetDataFormat::hfemef, L1Analysis::L1AnalysisRecoJetDataFormat::hfemMult, L1Analysis::L1AnalysisRecoJetDataFormat::hfhef, L1Analysis::L1AnalysisRecoJetDataFormat::hfhMult, jet_data, maxJet_, L1Analysis::L1AnalysisRecoJetDataFormat::mef, L1Analysis::L1AnalysisRecoJetDataFormat::muMult, L1Analysis::L1AnalysisRecoJetDataFormat::nemef, L1Analysis::L1AnalysisRecoJetDataFormat::nhef, L1Analysis::L1AnalysisRecoJetDataFormat::nhMult, L1Analysis::L1AnalysisRecoJetDataFormat::nJets, L1Analysis::L1AnalysisRecoJetDataFormat::nMult, L1Analysis::L1AnalysisRecoJetDataFormat::pef, pfJetID(), pfJetBenchmark_cfi::pfJets, L1Analysis::L1AnalysisRecoJetDataFormat::phi, and L1Analysis::L1AnalysisRecoJetDataFormat::phMult.

Referenced by analyze().

334  {
335  for (auto it = pfJets->begin(); it != pfJets->end() && jet_data->nJets < maxJet_; ++it) {
336  if (!pfJetID(*it))
337  continue;
338 
339  jet_data->et.push_back(it->et());
340  jet_data->eta.push_back(it->eta());
341  jet_data->phi.push_back(it->phi());
342  jet_data->e.push_back(it->energy());
343 
344  jet_data->chef.push_back(it->chargedHadronEnergyFraction());
345  jet_data->nhef.push_back(it->neutralHadronEnergyFraction());
346  jet_data->pef.push_back(it->photonEnergyFraction());
347  jet_data->eef.push_back(it->electronEnergyFraction());
348  jet_data->mef.push_back(it->muonEnergyFraction());
349  jet_data->hfhef.push_back(it->HFHadronEnergyFraction());
350  jet_data->hfemef.push_back(it->HFEMEnergyFraction());
351  jet_data->chMult.push_back(it->chargedHadronMultiplicity());
352  jet_data->nhMult.push_back(it->neutralHadronMultiplicity());
353  jet_data->phMult.push_back(it->photonMultiplicity());
354  jet_data->elMult.push_back(it->electronMultiplicity());
355  jet_data->muMult.push_back(it->muonMultiplicity());
356  jet_data->hfhMult.push_back(it->HFHadronMultiplicity());
357  jet_data->hfemMult.push_back(it->HFEMMultiplicity());
358 
359  jet_data->cemef.push_back(it->chargedEmEnergyFraction());
360  jet_data->cmef.push_back(it->chargedMuEnergyFraction());
361  jet_data->nemef.push_back(it->neutralEmEnergyFraction());
362  jet_data->cMult.push_back(it->chargedMultiplicity());
363  jet_data->nMult.push_back(it->neutralMultiplicity());
364 
365  jet_data->nJets++;
366  }
367 }
bool pfJetID(const reco::PFJet &jet)
L1Analysis::L1AnalysisRecoJetDataFormat * jet_data

◆ doPFMet()

void L1JetRecoTreeProducer::doPFMet ( edm::Handle< reco::PFMETCollection pfMet)
private

Definition at line 429 of file L1JetRecoTreeProducer.cc.

References reco::LeafCandidate::et(), L1Analysis::L1AnalysisRecoMetDataFormat::met, met_data, L1Analysis::L1AnalysisRecoMetDataFormat::metPhi, L1Analysis::L1AnalysisRecoMetDataFormat::metPx, L1Analysis::L1AnalysisRecoMetDataFormat::metPy, RecoPFMET_cff::pfMet, reco::LeafCandidate::phi(), reco::LeafCandidate::px(), reco::LeafCandidate::py(), reco::MET::sumEt(), and L1Analysis::L1AnalysisRecoMetDataFormat::sumEt.

Referenced by analyze().

429  {
430  const reco::PFMETCollection* metCol = pfMet.product();
431  const reco::PFMET theMet = metCol->front();
432 
433  met_data->met = theMet.et();
434  met_data->metPhi = theMet.phi();
435  met_data->sumEt = theMet.sumEt();
436  met_data->metPx = theMet.px();
437  met_data->metPy = theMet.py();
438 }
L1Analysis::L1AnalysisRecoMetDataFormat * met_data
double sumEt() const
Definition: MET.h:56
double px() const final
x coordinate of momentum vector
double py() const final
y coordinate of momentum vector
double et() const final
transverse energy
std::vector< reco::PFMET > PFMETCollection
collection of PFMET objects
double phi() const final
momentum azimuthal angle

◆ doPFMetNoMu()

void L1JetRecoTreeProducer::doPFMetNoMu ( edm::Handle< reco::PFMETCollection pfMet,
edm::Handle< reco::MuonCollection muons 
)
private

Definition at line 440 of file L1JetRecoTreeProducer.cc.

References reco::LeafCandidate::et(), met_data, PDWG_BPHSkim_cff::muons, RecoPFMET_cff::pfMet, L1Analysis::L1AnalysisRecoMetDataFormat::pfMetNoMu, L1Analysis::L1AnalysisRecoMetDataFormat::pfMetNoMuPhi, L1Analysis::L1AnalysisRecoMetDataFormat::pfMetNoMuPx, L1Analysis::L1AnalysisRecoMetDataFormat::pfMetNoMuPy, reco::LeafCandidate::phi(), reco::LeafCandidate::px(), reco::LeafCandidate::py(), and reco::LeafCandidate::setP4().

Referenced by analyze().

441  {
442  const reco::PFMETCollection* metCol = pfMet.product();
443  const reco::PFMET theMet = metCol->front();
444  reco::PFMET thePFMetNoMu = metCol->front();
445 
446  double pfMetNoMuPx = theMet.px();
447  double pfMetNoMuPy = theMet.py();
448 
449  double muPx(0.), muPy(0.);
450 
451  for (auto it = muons->begin(); it != muons->end(); ++it) {
452  if (it->isPFMuon()) {
453  muPx += it->px();
454  muPy += it->py();
455  }
456  }
457 
458  pfMetNoMuPx += muPx;
459  pfMetNoMuPy += muPy;
460 
461  math::XYZTLorentzVector pfMetNoMuP4(pfMetNoMuPx, pfMetNoMuPy, 0, hypot(pfMetNoMuPx, pfMetNoMuPy));
462 
463  thePFMetNoMu.setP4(pfMetNoMuP4);
464 
465  met_data->pfMetNoMu = thePFMetNoMu.et();
466  met_data->pfMetNoMuPhi = thePFMetNoMu.phi();
467  met_data->pfMetNoMuPx = thePFMetNoMu.px();
468  met_data->pfMetNoMuPy = thePFMetNoMu.py();
469 }
L1Analysis::L1AnalysisRecoMetDataFormat * met_data
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
Definition: LorentzVector.h:29
double px() const final
x coordinate of momentum vector
double py() const final
y coordinate of momentum vector
double et() const final
transverse energy
std::vector< reco::PFMET > PFMETCollection
collection of PFMET objects
double phi() const final
momentum azimuthal angle
void setP4(const LorentzVector &p4) final
set 4-momentum

◆ endJob()

void L1JetRecoTreeProducer::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 527 of file L1JetRecoTreeProducer.cc.

527 {}

◆ pfJetID()

bool L1JetRecoTreeProducer::pfJetID ( const reco::PFJet jet)
private

Definition at line 489 of file L1JetRecoTreeProducer.cc.

References funct::abs(), metsig::jet, and createJobs::tmp.

Referenced by doPFJetCorr(), and doPFJets().

489  {
490  bool tmp = true;
491  if (std::abs(jet.eta()) < 2.7) {
492  tmp &= jet.neutralHadronEnergyFraction() < 0.9;
493  tmp &= jet.neutralEmEnergyFraction() < 0.9;
494  tmp &= (jet.chargedMultiplicity() + jet.neutralMultiplicity()) > 1;
495  tmp &= jet.muonEnergyFraction() < 0.8;
496  tmp &= jet.chargedHadronEnergyFraction() > 0.0;
497  tmp &= jet.chargedMultiplicity() > 0;
498  tmp &= jet.chargedEmEnergyFraction() < 0.9;
499  }
500  if (std::abs(jet.eta()) > 2.7 && std::abs(jet.eta()) < 3.0) {
501  tmp &= jet.neutralEmEnergyFraction() > 0.01;
502  tmp &= jet.neutralHadronEnergyFraction() < 0.98;
503  tmp &= jet.neutralMultiplicity() > 2;
504  }
505  if (std::abs(jet.eta()) > 3.0) {
506  tmp &= jet.neutralEmEnergyFraction() < 0.9;
507  tmp &= jet.neutralMultiplicity() > 10;
508  }
509 
510  // our custom selection
511  //tmp &= jet.muonMultiplicity() == 0;
512  //tmp &= jet.electronMultiplicity() == 0;
513 
514  return tmp;
515 }
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
tmp
align.sh
Definition: createJobs.py:716

Member Data Documentation

◆ caloJECToken_

edm::EDGetTokenT<reco::JetCorrector> L1JetRecoTreeProducer::caloJECToken_
private

Definition at line 94 of file L1JetRecoTreeProducer.cc.

Referenced by analyze(), and L1JetRecoTreeProducer().

◆ caloJetCorrMissing_

bool L1JetRecoTreeProducer::caloJetCorrMissing_
private

Definition at line 112 of file L1JetRecoTreeProducer.cc.

Referenced by analyze().

◆ caloJetIDMissing_

bool L1JetRecoTreeProducer::caloJetIDMissing_
private

Definition at line 114 of file L1JetRecoTreeProducer.cc.

Referenced by analyze(), doCaloJetCorr(), and doCaloJets().

◆ caloJetIDToken_

edm::EDGetTokenT<edm::ValueMap<reco::JetID> > L1JetRecoTreeProducer::caloJetIDToken_
private

Definition at line 92 of file L1JetRecoTreeProducer.cc.

Referenced by analyze(), and L1JetRecoTreeProducer().

◆ caloJetsMissing_

bool L1JetRecoTreeProducer::caloJetsMissing_
private

Definition at line 113 of file L1JetRecoTreeProducer.cc.

Referenced by analyze().

◆ caloJetToken_

edm::EDGetTokenT<reco::CaloJetCollection> L1JetRecoTreeProducer::caloJetToken_
private

Definition at line 91 of file L1JetRecoTreeProducer.cc.

Referenced by analyze(), and L1JetRecoTreeProducer().

◆ caloMetBEMissing_

bool L1JetRecoTreeProducer::caloMetBEMissing_
private

Definition at line 117 of file L1JetRecoTreeProducer.cc.

Referenced by analyze().

◆ caloMetBEToken_

edm::EDGetTokenT<reco::CaloMETCollection> L1JetRecoTreeProducer::caloMetBEToken_
private

Definition at line 98 of file L1JetRecoTreeProducer.cc.

Referenced by analyze(), and L1JetRecoTreeProducer().

◆ caloMetMissing_

bool L1JetRecoTreeProducer::caloMetMissing_
private

Definition at line 116 of file L1JetRecoTreeProducer.cc.

Referenced by analyze().

◆ caloMetToken_

edm::EDGetTokenT<reco::CaloMETCollection> L1JetRecoTreeProducer::caloMetToken_
private

Definition at line 97 of file L1JetRecoTreeProducer.cc.

Referenced by analyze(), and L1JetRecoTreeProducer().

◆ jet_data

L1Analysis::L1AnalysisRecoJetDataFormat* L1JetRecoTreeProducer::jet_data

◆ jetetaMax_

double L1JetRecoTreeProducer::jetetaMax_
private

Definition at line 105 of file L1JetRecoTreeProducer.cc.

Referenced by doCaloJetCorr(), doPFJetCorr(), and L1JetRecoTreeProducer().

◆ jetptThreshold_

double L1JetRecoTreeProducer::jetptThreshold_
private

Definition at line 104 of file L1JetRecoTreeProducer.cc.

Referenced by doCaloJetCorr(), doPFJetCorr(), and L1JetRecoTreeProducer().

◆ maxCl_

unsigned int L1JetRecoTreeProducer::maxCl_
private

Definition at line 106 of file L1JetRecoTreeProducer.cc.

◆ maxJet_

unsigned int L1JetRecoTreeProducer::maxJet_
private

◆ maxTrk_

unsigned int L1JetRecoTreeProducer::maxTrk_
private

Definition at line 109 of file L1JetRecoTreeProducer.cc.

◆ maxVtx_

unsigned int L1JetRecoTreeProducer::maxVtx_
private

Definition at line 108 of file L1JetRecoTreeProducer.cc.

◆ met_data

L1Analysis::L1AnalysisRecoMetDataFormat* L1JetRecoTreeProducer::met_data

◆ muonsMissing_

bool L1JetRecoTreeProducer::muonsMissing_
private

Definition at line 119 of file L1JetRecoTreeProducer.cc.

Referenced by analyze().

◆ muonToken_

edm::EDGetTokenT<reco::MuonCollection> L1JetRecoTreeProducer::muonToken_
private

Definition at line 100 of file L1JetRecoTreeProducer.cc.

Referenced by analyze(), and L1JetRecoTreeProducer().

◆ pfJECToken_

edm::EDGetTokenT<reco::JetCorrector> L1JetRecoTreeProducer::pfJECToken_
private

Definition at line 93 of file L1JetRecoTreeProducer.cc.

Referenced by analyze(), and L1JetRecoTreeProducer().

◆ pfJetCorrMissing_

bool L1JetRecoTreeProducer::pfJetCorrMissing_
private

Definition at line 111 of file L1JetRecoTreeProducer.cc.

Referenced by analyze().

◆ pfJetsMissing_

bool L1JetRecoTreeProducer::pfJetsMissing_
private

Definition at line 103 of file L1JetRecoTreeProducer.cc.

Referenced by analyze().

◆ pfJetToken_

edm::EDGetTokenT<reco::PFJetCollection> L1JetRecoTreeProducer::pfJetToken_
private

Definition at line 90 of file L1JetRecoTreeProducer.cc.

Referenced by analyze(), and L1JetRecoTreeProducer().

◆ pfMetMissing_

bool L1JetRecoTreeProducer::pfMetMissing_
private

Definition at line 115 of file L1JetRecoTreeProducer.cc.

Referenced by analyze().

◆ pfMetToken_

edm::EDGetTokenT<reco::PFMETCollection> L1JetRecoTreeProducer::pfMetToken_
private

Definition at line 96 of file L1JetRecoTreeProducer.cc.

Referenced by analyze(), and L1JetRecoTreeProducer().

◆ tree_

TTree* L1JetRecoTreeProducer::tree_
private

Definition at line 87 of file L1JetRecoTreeProducer.cc.

Referenced by analyze(), and L1JetRecoTreeProducer().