8 jetsToken_ (consumes< std::vector<pat::Jet> >(cfg.getParameter<edm::InputTag>(
"jets" ))),
9 lepsToken_ (consumes< edm::
View<
reco::RecoCandidate> >(cfg.getParameter<edm::InputTag>(
"leps" ))),
10 metsToken_ (consumes< std::vector<pat::
MET> >(cfg.getParameter<edm::InputTag>(
"mets" ))),
11 maxNJets_ (cfg.getParameter<int> (
"maxNJets" )),
12 wMass_ (cfg.getParameter<double> (
"wMass" )),
13 useBTagging_ (cfg.getParameter<bool> (
"useBTagging" )),
14 bTagAlgorithm_ (cfg.getParameter<std::
string> (
"bTagAlgorithm" )),
15 minBDiscBJets_ (cfg.getParameter<double> (
"minBDiscBJets" )),
16 maxBDiscLightJets_(cfg.getParameter<double> (
"maxBDiscLightJets")),
17 neutrinoSolutionType_(cfg.getParameter<int> (
"neutrinoSolutionType"))
21 <<
"Parameter maxNJets can not be set to " <<
maxNJets_ <<
". \n"
22 <<
"It has to be larger than 4 or can be set to -1 to take all jets.";
24 produces<std::vector<std::vector<int> > >();
25 produces<int>(
"NumberOfConsideredJets");
35 std::auto_ptr<std::vector<std::vector<int> > > pOut(
new std::vector<std::vector<int> >);
36 std::auto_ptr<int> pJetsConsidered(
new int);
38 std::vector<int>
match;
39 for(
unsigned int i = 0;
i < 4; ++
i)
40 match.push_back( -1 );
55 if(leps->empty() || jets->size() < 4 || mets->empty()){
56 pOut->push_back( match );
58 *pJetsConsidered = jets->size();
59 evt.
put(pJetsConsidered,
"NumberOfConsideredJets");
65 *pJetsConsidered = maxNJets;
66 evt.
put(pJetsConsidered,
"NumberOfConsideredJets");
68 std::vector<bool> isBJet;
69 std::vector<bool> isLJet;
72 for(
unsigned int idx=0;
idx<maxNJets; ++
idx) {
84 std::vector<int> closestToWMassIndices;
85 closestToWMassIndices.push_back(-1);
86 closestToWMassIndices.push_back(-1);
89 for(
unsigned jdx=(idx+1); jdx<maxNJets; ++jdx){
90 if(
useBTagging_ && (!isLJet[jdx] || (cntBJets<=2 && isBJet[jdx]) || (cntBJets==3 && isBJet[idx] && isBJet[jdx])))
continue;
94 if( wDist<0. || wDist>fabs(sum.mass()-
wMass_) ){
95 wDist=fabs(sum.mass()-
wMass_);
96 closestToWMassIndices.clear();
97 closestToWMassIndices.push_back(idx);
98 closestToWMassIndices.push_back(jdx);
106 double neutrino_pz = 0.;
109 mez.
SetMET( *mets->begin() );
110 if( dynamic_cast<const reco::Muon*>(&(leps->front())) )
112 else if( dynamic_cast<const reco::GsfElectron*>(&(leps->front())) )
115 throw cms::Exception(
"UnimplementedFeature") <<
"Type of lepton given together with MET for solving neutrino kinematics is neither muon nor electron.\n";
118 const math::XYZTLorentzVector neutrino( mets->begin()->px(), mets->begin()->py(), neutrino_pz,
sqrt(mets->begin()->px()*mets->begin()->px()
119 + mets->begin()->py()*mets->begin()->py()
120 + neutrino_pz*neutrino_pz) );
131 if(
isValid(closestToWMassIndices[0], jets) &&
isValid(closestToWMassIndices[1], jets)) {
133 (*jets)[closestToWMassIndices[0]].p4()+
134 (*jets)[closestToWMassIndices[1]].p4();
136 for(
unsigned idx=0;
idx<maxNJets; ++
idx){
139 if( (
int)idx!=closestToWMassIndices[0] && (
int)idx!=closestToWMassIndices[1] ){
142 for(
unsigned jdx=0; jdx<maxNJets; ++jdx){
145 if( (
int)jdx!=closestToWMassIndices[0] && (
int)jdx!=closestToWMassIndices[1] && jdx!=idx ){
147 if( deltaTop<0. || deltaTop>fabs(hadTop.mass()-lepTop.mass()) ){
148 deltaTop=fabs(hadTop.mass()-lepTop.mass());
163 pOut->push_back( match );
void SetLepton(const pat::Particle &lepton, bool isMuon=true)
Set lepton.
bool getByToken(EDGetToken token, Handle< PROD > &result) const
edm::EDGetTokenT< std::vector< pat::Jet > > jetsToken_
virtual void produce(edm::Event &evt, const edm::EventSetup &setup)
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
void SetMET(const pat::MET &MET)
Set MET.
double Calculate(int type=1)
member functions
int neutrinoSolutionType_
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
bool isValid(const int &idx, const edm::Handle< std::vector< pat::Jet > > &jets)
edm::EDGetTokenT< edm::View< reco::RecoCandidate > > lepsToken_
double maxBDiscLightJets_
tuple idx
DEBUGGING if hasattr(process,"trackMonIterativeTracking2012"): print "trackMonIterativeTracking2012 D...
TtSemiLepJetCombWMassDeltaTopMass(const edm::ParameterSet &)
edm::EDGetTokenT< std::vector< pat::MET > > metsToken_
std::string bTagAlgorithm_
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
~TtSemiLepJetCombWMassDeltaTopMass()
math::XYZTLorentzVector LorentzVector
Lorentz vector.
void setup(std::vector< TH2F > &depth, std::string name, std::string units="")