CMS 3D CMS Logo

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

#include <StEvtSolutionMaker.h>

Inheritance diagram for StEvtSolutionMaker:
edm::EDProducer edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

void produce (edm::Event &, const edm::EventSetup &) override
 
 StEvtSolutionMaker (const edm::ParameterSet &)
 
 ~StEvtSolutionMaker () override
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
SerialTaskQueueglobalLuminosityBlocksQueue ()
 
SerialTaskQueueglobalRunsQueue ()
 
ModuleDescription const & moduleDescription () const
 
 ~EDProducer () override
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
std::vector< edm::ProductResolverIndex > const & putTokenIndexToProductResolverIndex () const
 
std::vector< bool > const & recordProvenanceList () const
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, ModuleToResolverIndicies const &iIndicies, std::string const &moduleLabel)
 
TypeLabelList const & typeLabelList () const
 used by the fwk to register the list of products of this module More...
 
 ~ProducerBase () noexcept(false) 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 &&)=default
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
ESProxyIndex const * esGetTokenIndices (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::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Attributes

bool addLRJetComb_
 
std::vector< int > constraints_
 
bool doKinFit_
 
edm::EDGetTokenT< std::vector< pat::Electron > > electronSrcToken_
 
edm::EDGetTokenT< StGenEventgenEvtSrcToken_
 
int jetCorrScheme_
 
int jetParam_
 
edm::EDGetTokenT< std::vector< pat::Jet > > jetSrcToken_
 
int lepParam_
 
std::string leptonFlavour_
 
bool matchToGenEvt_
 
double maxDeltaS_
 
double maxF_
 
int maxNrIter_
 
int metParam_
 
edm::EDGetTokenT< std::vector< pat::MET > > metSrcToken_
 
edm::EDGetTokenT< std::vector< pat::Muon > > muonSrcToken_
 
StKinFittermyKinFitter
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
- Public Types inherited from edm::ProducerBase
using ModuleToResolverIndicies = std::unordered_multimap< std::string, std::tuple< edm::TypeID const *, const char *, edm::ProductResolverIndex > >
 
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
static bool wantsGlobalLuminosityBlocks ()
 
static bool wantsGlobalRuns ()
 
static bool wantsStreamLuminosityBlocks ()
 
static bool wantsStreamRuns ()
 
- Protected Member Functions inherited from edm::ProducerBase
template<class ProductType >
BranchAliasSetterT< ProductType > produces ()
 declare what type of product will make and with which optional label More...
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces ()
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces ()
 
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<BranchType B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<Transition B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
ProducesCollector producesCollector ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (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)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 

Detailed Description

Definition at line 16 of file StEvtSolutionMaker.h.

Constructor & Destructor Documentation

◆ StEvtSolutionMaker()

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

Definition at line 8 of file StEvtSolutionMaker.cc.

8  {
9  // configurables
10  electronSrcToken_ = mayConsume<std::vector<pat::Electron> >(iConfig.getParameter<edm::InputTag>("electronSource"));
11  muonSrcToken_ = mayConsume<std::vector<pat::Muon> >(iConfig.getParameter<edm::InputTag>("muonSource"));
12  metSrcToken_ = consumes<std::vector<pat::MET> >(iConfig.getParameter<edm::InputTag>("metSource"));
13  jetSrcToken_ = consumes<std::vector<pat::Jet> >(iConfig.getParameter<edm::InputTag>("jetSource"));
14  genEvtSrcToken_ = mayConsume<StGenEvent>(edm::InputTag("genEvt"));
15  leptonFlavour_ = iConfig.getParameter<std::string>("leptonFlavour");
16  jetCorrScheme_ = iConfig.getParameter<int>("jetCorrectionScheme");
17  //jetInput_ = iConfig.getParameter< std::string > ("jetInput");
18  doKinFit_ = iConfig.getParameter<bool>("doKinFit");
19  addLRJetComb_ = iConfig.getParameter<bool>("addLRJetComb");
20  maxNrIter_ = iConfig.getParameter<int>("maxNrIter");
21  maxDeltaS_ = iConfig.getParameter<double>("maxDeltaS");
22  maxF_ = iConfig.getParameter<double>("maxF");
23  jetParam_ = iConfig.getParameter<int>("jetParametrisation");
24  lepParam_ = iConfig.getParameter<int>("lepParametrisation");
25  metParam_ = iConfig.getParameter<int>("metParametrisation");
26  constraints_ = iConfig.getParameter<std::vector<int> >("constraints");
27  matchToGenEvt_ = iConfig.getParameter<bool>("matchToGenEvt");
28 
29  // define kinfitter
30  if (doKinFit_) {
32  }
33  // define what will be produced
34  produces<std::vector<StEvtSolution> >();
35 }

References addLRJetComb_, constraints_, doKinFit_, electronSrcToken_, genEvtSrcToken_, edm::ParameterSet::getParameter(), jetCorrScheme_, jetParam_, jetSrcToken_, lepParam_, leptonFlavour_, matchToGenEvt_, maxDeltaS_, maxF_, maxNrIter_, metParam_, metSrcToken_, muonSrcToken_, myKinFitter, and AlCaHLTBitMon_QueryRunRegistry::string.

◆ ~StEvtSolutionMaker()

StEvtSolutionMaker::~StEvtSolutionMaker ( )
override

Definition at line 37 of file StEvtSolutionMaker.cc.

37  {
38  if (doKinFit_)
39  delete myKinFitter;
40 }

References doKinFit_, and myKinFitter.

Member Function Documentation

◆ produce()

void StEvtSolutionMaker::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overridevirtual

Implements edm::EDProducer.

Definition at line 42 of file StEvtSolutionMaker.cc.

42  {
43  //
44  // TopObject Selection
45  //
46 
47  // select lepton (the TtLepton vectors are, for the moment, sorted on pT)
48  bool leptonFound = false;
50  if (leptonFlavour_ == "muon") {
51  iEvent.getByToken(muonSrcToken_, muons);
52  if (!muons->empty())
53  leptonFound = true;
54  }
56  if (leptonFlavour_ == "electron") {
57  iEvent.getByToken(electronSrcToken_, electrons);
58  if (!electrons->empty())
59  leptonFound = true;
60  }
61 
62  // select MET (TopMET vector is sorted on ET)
63  bool metFound = false;
65  iEvent.getByToken(metSrcToken_, mets);
66  if (!mets->empty())
67  metFound = true;
68 
69  // select Jets
70  bool jetsFound = false;
72  iEvent.getByToken(jetSrcToken_, jets);
73  unsigned int maxJets = 2; //this has to become a custom-defined parameter (we may want 2 or 3 jets)
74  if (jets->size() >= 2)
75  jetsFound = true;
76 
77  std::vector<StEvtSolution>* evtsols = new std::vector<StEvtSolution>();
78  if (leptonFound && metFound && jetsFound) {
79  std::cout << "constructing solutions" << std::endl;
80  for (unsigned int b = 0; b < maxJets; b++) {
81  for (unsigned int l = 0; l < maxJets; l++) {
82  if (b != l) { // to avoid double counting
83  StEvtSolution asol;
85  if (leptonFlavour_ == "muon")
86  asol.setMuon(muons, 0);
87  if (leptonFlavour_ == "electron")
88  asol.setElectron(electrons, 0);
89  asol.setNeutrino(mets, 0);
90  asol.setBottom(jets, b);
91  asol.setLight(jets, l);
92 
93  if (doKinFit_)
94  asol = myKinFitter->addKinFitInfo(&asol);
95 
96  /* to be adapted to ST (Andrea)
97  if(addLRJetComb_){
98  asol.setPtrueCombExist(jetCombProbs[m].getPTrueCombExist(&afitsol));
99  asol.setPtrueBJetSel(jetCombProbs[m].getPTrueBJetSel(&afitsol));
100  asol.setPtrueBhadrSel(jetCombProbs[m].getPTrueBhadrSel(&afitsol));
101  asol.setPtrueJetComb(afitsol.getPtrueCombExist()*afitsol.getPtrueBJetSel()*afitsol.getPtrueBhadrSel());
102  }
103  */
104  evtsols->push_back(asol);
105  }
106  }
107  }
108 
109  // if asked for, match the event solutions to the gen Event
110  if (matchToGenEvt_) {
111  /*
112  edm::Handle<StGenEvent> genEvt;
113  iEvent.getByToken (genEvtSrcToken_,genEvt);
114  double bestSolDR = 9999.;
115  int bestSol = 0;
116  for(size_t s=0; s<evtsols->size(); s++) {
117  (*evtsols)[s].setGenEvt(genEvt->particles());
118  vector<double> bm = BestMatch((*evtsols)[s], false); //false to use DR, true SpaceAngles
119  (*evtsols)[s].setSumDeltaRjp(bm[0]); // dRBB + dRLL
120  (*evtsols)[s].setChangeBL((int) bm[1]); // has swapped or not
121  (*evtsols)[s].setDeltaRB(bm[2]);
122  (*evtsols)[s].setDeltaRL(bm[3]);
123  if(bm[0]<bestSolDR) { bestSolDR = bm[0]; bestSol = s; }
124  }
125  (*evtsols)[bestSol].setBestSol(true);
126  */
127  }
128 
129  //store the vector of solutions to the event
130  std::unique_ptr<std::vector<StEvtSolution> > pOut(evtsols);
131  iEvent.put(std::move(pOut));
132  } else {
133  std::cout << "@@@ No calibrated solutions built, because: " << std::endl;
134  ;
135  if (jets->size() < maxJets)
136  std::cout << "@ nr jets = " << jets->size() << " < " << maxJets << std::endl;
137  if (leptonFlavour_ == "muon" && !leptonFound)
138  std::cout << "@ no good muon candidate" << std::endl;
139  if (leptonFlavour_ == "electron" && !leptonFound)
140  std::cout << "@ no good electron candidate" << std::endl;
141  if (mets->empty())
142  std::cout << "@ no MET reconstruction" << std::endl;
143 
144  StEvtSolution asol;
145  evtsols->push_back(asol);
146  std::unique_ptr<std::vector<StEvtSolution> > pOut(evtsols);
147  iEvent.put(std::move(pOut));
148  }
149 }

References StKinFitter::addKinFitInfo(), b, gather_cfg::cout, doKinFit_, pwdgSkimBPark_cfi::electrons, electronSrcToken_, iEvent, jetCorrScheme_, singleTopDQM_cfi::jets, jetSrcToken_, cmsLHEtoEOSManager::l, leptonFlavour_, matchToGenEvt_, singleTopDQM_cfi::mets, metSrcToken_, eostools::move(), PDWG_BPHSkim_cff::muons, muonSrcToken_, myKinFitter, StEvtSolution::setBottom(), StEvtSolution::setElectron(), StEvtSolution::setJetCorrectionScheme(), StEvtSolution::setLight(), StEvtSolution::setMuon(), and StEvtSolution::setNeutrino().

Member Data Documentation

◆ addLRJetComb_

bool StEvtSolutionMaker::addLRJetComb_
private

Definition at line 35 of file StEvtSolutionMaker.h.

Referenced by StEvtSolutionMaker().

◆ constraints_

std::vector<int> StEvtSolutionMaker::constraints_
private

Definition at line 39 of file StEvtSolutionMaker.h.

Referenced by StEvtSolutionMaker().

◆ doKinFit_

bool StEvtSolutionMaker::doKinFit_
private

Definition at line 35 of file StEvtSolutionMaker.h.

Referenced by produce(), StEvtSolutionMaker(), and ~StEvtSolutionMaker().

◆ electronSrcToken_

edm::EDGetTokenT<std::vector<pat::Electron> > StEvtSolutionMaker::electronSrcToken_
private

Definition at line 26 of file StEvtSolutionMaker.h.

Referenced by produce(), and StEvtSolutionMaker().

◆ genEvtSrcToken_

edm::EDGetTokenT<StGenEvent> StEvtSolutionMaker::genEvtSrcToken_
private

Definition at line 30 of file StEvtSolutionMaker.h.

Referenced by StEvtSolutionMaker().

◆ jetCorrScheme_

int StEvtSolutionMaker::jetCorrScheme_
private

Definition at line 32 of file StEvtSolutionMaker.h.

Referenced by produce(), and StEvtSolutionMaker().

◆ jetParam_

int StEvtSolutionMaker::jetParam_
private

Definition at line 38 of file StEvtSolutionMaker.h.

Referenced by StEvtSolutionMaker().

◆ jetSrcToken_

edm::EDGetTokenT<std::vector<pat::Jet> > StEvtSolutionMaker::jetSrcToken_
private

Definition at line 29 of file StEvtSolutionMaker.h.

Referenced by produce(), and StEvtSolutionMaker().

◆ lepParam_

int StEvtSolutionMaker::lepParam_
private

Definition at line 38 of file StEvtSolutionMaker.h.

Referenced by StEvtSolutionMaker().

◆ leptonFlavour_

std::string StEvtSolutionMaker::leptonFlavour_
private

Definition at line 31 of file StEvtSolutionMaker.h.

Referenced by produce(), and StEvtSolutionMaker().

◆ matchToGenEvt_

bool StEvtSolutionMaker::matchToGenEvt_
private

Definition at line 35 of file StEvtSolutionMaker.h.

Referenced by produce(), and StEvtSolutionMaker().

◆ maxDeltaS_

double StEvtSolutionMaker::maxDeltaS_
private

Definition at line 37 of file StEvtSolutionMaker.h.

Referenced by StEvtSolutionMaker().

◆ maxF_

double StEvtSolutionMaker::maxF_
private

Definition at line 37 of file StEvtSolutionMaker.h.

Referenced by StEvtSolutionMaker().

◆ maxNrIter_

int StEvtSolutionMaker::maxNrIter_
private

Definition at line 36 of file StEvtSolutionMaker.h.

Referenced by StEvtSolutionMaker().

◆ metParam_

int StEvtSolutionMaker::metParam_
private

Definition at line 38 of file StEvtSolutionMaker.h.

Referenced by StEvtSolutionMaker().

◆ metSrcToken_

edm::EDGetTokenT<std::vector<pat::MET> > StEvtSolutionMaker::metSrcToken_
private

Definition at line 28 of file StEvtSolutionMaker.h.

Referenced by produce(), and StEvtSolutionMaker().

◆ muonSrcToken_

edm::EDGetTokenT<std::vector<pat::Muon> > StEvtSolutionMaker::muonSrcToken_
private

Definition at line 27 of file StEvtSolutionMaker.h.

Referenced by produce(), and StEvtSolutionMaker().

◆ myKinFitter

StKinFitter* StEvtSolutionMaker::myKinFitter
private

Definition at line 24 of file StEvtSolutionMaker.h.

Referenced by produce(), StEvtSolutionMaker(), and ~StEvtSolutionMaker().

StEvtSolutionMaker::lepParam_
int lepParam_
Definition: StEvtSolutionMaker.h:38
StEvtSolutionMaker::metSrcToken_
edm::EDGetTokenT< std::vector< pat::MET > > metSrcToken_
Definition: StEvtSolutionMaker.h:28
StEvtSolutionMaker::genEvtSrcToken_
edm::EDGetTokenT< StGenEvent > genEvtSrcToken_
Definition: StEvtSolutionMaker.h:30
PDWG_BPHSkim_cff.muons
muons
Definition: PDWG_BPHSkim_cff.py:47
StEvtSolutionMaker::electronSrcToken_
edm::EDGetTokenT< std::vector< pat::Electron > > electronSrcToken_
Definition: StEvtSolutionMaker.h:26
gather_cfg.cout
cout
Definition: gather_cfg.py:144
StEvtSolution::setJetCorrectionScheme
void setJetCorrectionScheme(int scheme)
Definition: StEvtSolution.h:103
StEvtSolutionMaker::addLRJetComb_
bool addLRJetComb_
Definition: StEvtSolutionMaker.h:35
singleTopDQM_cfi.jets
jets
Definition: singleTopDQM_cfi.py:42
singleTopDQM_cfi.mets
mets
Definition: singleTopDQM_cfi.py:43
StEvtSolutionMaker::leptonFlavour_
std::string leptonFlavour_
Definition: StEvtSolutionMaker.h:31
edm::Handle
Definition: AssociativeIterator.h:50
StEvtSolutionMaker::muonSrcToken_
edm::EDGetTokenT< std::vector< pat::Muon > > muonSrcToken_
Definition: StEvtSolutionMaker.h:27
StEvtSolutionMaker::doKinFit_
bool doKinFit_
Definition: StEvtSolutionMaker.h:35
StEvtSolution::setLight
void setLight(const edm::Handle< std::vector< pat::Jet > > &jet, int i)
Definition: StEvtSolution.h:107
StEvtSolutionMaker::myKinFitter
StKinFitter * myKinFitter
Definition: StEvtSolutionMaker.h:24
StEvtSolutionMaker::jetCorrScheme_
int jetCorrScheme_
Definition: StEvtSolutionMaker.h:32
b
double b
Definition: hdecay.h:118
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
StEvtSolution::setMuon
void setMuon(const edm::Handle< std::vector< pat::Muon > > &muon, int i)
Definition: StEvtSolution.h:110
StEvtSolutionMaker::constraints_
std::vector< int > constraints_
Definition: StEvtSolutionMaker.h:39
iEvent
int iEvent
Definition: GenABIO.cc:224
StEvtSolution::setElectron
void setElectron(const edm::Handle< std::vector< pat::Electron > > &elec, int i)
Definition: StEvtSolution.h:114
StEvtSolutionMaker::jetSrcToken_
edm::EDGetTokenT< std::vector< pat::Jet > > jetSrcToken_
Definition: StEvtSolutionMaker.h:29
StEvtSolution::setNeutrino
void setNeutrino(const edm::Handle< std::vector< pat::MET > > &met, int i)
Definition: StEvtSolution.h:118
StEvtSolutionMaker::maxF_
double maxF_
Definition: StEvtSolutionMaker.h:37
StKinFitter::addKinFitInfo
StEvtSolution addKinFitInfo(StEvtSolution *asol)
Definition: StKinFitter.cc:69
cmsLHEtoEOSManager.l
l
Definition: cmsLHEtoEOSManager.py:193
StEvtSolutionMaker::maxDeltaS_
double maxDeltaS_
Definition: StEvtSolutionMaker.h:37
StEvtSolution::setBottom
void setBottom(const edm::Handle< std::vector< pat::Jet > > &jet, int i)
Definition: StEvtSolution.h:104
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
eostools.move
def move(src, dest)
Definition: eostools.py:511
pwdgSkimBPark_cfi.electrons
electrons
Definition: pwdgSkimBPark_cfi.py:6
StEvtSolutionMaker::maxNrIter_
int maxNrIter_
Definition: StEvtSolutionMaker.h:36
StEvtSolutionMaker::jetParam_
int jetParam_
Definition: StEvtSolutionMaker.h:38
StEvtSolutionMaker::metParam_
int metParam_
Definition: StEvtSolutionMaker.h:38
StKinFitter
Definition: StKinFitter.h:19
edm::InputTag
Definition: InputTag.h:15
StEvtSolutionMaker::matchToGenEvt_
bool matchToGenEvt_
Definition: StEvtSolutionMaker.h:35
StEvtSolution
Definition: StEvtSolution.h:21