3 #include "Math/VectorUtil.h"
10 jets_ (cfg.getParameter<edm::InputTag>(
"jets" )),
11 leps_ (cfg.getParameter<edm::InputTag>(
"leps" )),
12 maxNJets_ (cfg.getParameter<int> (
"maxNJets" )),
13 useDeltaR_ (cfg.getParameter<bool> (
"useDeltaR" )),
14 useBTagging_ (cfg.getParameter<bool> (
"useBTagging" )),
15 bTagAlgorithm_ (cfg.getParameter<std::string> (
"bTagAlgorithm" )),
16 minBDiscBJets_ (cfg.getParameter<double> (
"minBDiscBJets" )),
17 maxBDiscLightJets_(cfg.getParameter<double> (
"maxBDiscLightJets"))
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 );
51 if(leps->empty() || jets->size() < 4){
52 pOut->push_back( match );
54 *pJetsConsidered = jets->size();
55 evt.
put(pJetsConsidered,
"NumberOfConsideredJets");
61 *pJetsConsidered = maxNJets;
62 evt.
put(pJetsConsidered,
"NumberOfConsideredJets");
64 std::vector<bool> isBJet;
65 std::vector<bool> isLJet;
68 for(
unsigned int idx=0; idx<maxNJets; ++idx) {
82 for(
unsigned int idx=0; idx<maxNJets; ++idx){
83 if(
useBTagging_ && (!isLJet[idx] || (cntBJets<=2 && isBJet[idx])))
continue;
84 for(
unsigned int jdx=(idx+1); jdx<maxNJets; ++jdx){
85 if(
useBTagging_ && (!isLJet[jdx] || (cntBJets<=2 && isBJet[jdx]) || (cntBJets==3 && isBJet[idx] && isBJet[jdx])))
continue;
86 double dist =
distance((*jets)[idx].
p4(), (*jets)[jdx].
p4());
87 if( minDist<0. || dist<minDist ){
97 wHad = (*jets)[lightQ].p4() + (*jets)[lightQBar].p4();
106 for(
unsigned int idx=0; idx<maxNJets; ++idx){
109 if( (
int)idx!=lightQ && (
int)idx!=lightQBar ) {
110 double dist =
distance((*jets)[idx].
p4(), wHad);
111 if( minDist<0. || dist<minDist ){
125 for(
unsigned int idx=0; idx<maxNJets; ++idx){
128 if( (
int)idx!=lightQ && (
int)idx!=lightQBar && (
int)idx!=hadB ){
129 double dist =
distance((*jets)[idx].
p4(), (*leps)[0].
p4());
130 if( minDist<0. || dist<minDist ){
142 pOut->push_back( match );
151 if(
useDeltaR_)
return ROOT::Math::VectorUtil::DeltaR(v1, v2);
152 return fabs(v1.theta() - v2.theta());
double maxBDiscLightJets_
bool isValid(const int &idx, const edm::Handle< std::vector< pat::Jet > > &jets)
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
virtual void produce(edm::Event &evt, const edm::EventSetup &setup)
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
TtSemiLepJetCombGeom(const edm::ParameterSet &)
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
double distance(const math::XYZTLorentzVector &, const math::XYZTLorentzVector &)
std::string bTagAlgorithm_
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
math::XYZTLorentzVector LorentzVector
Lorentz vector.
void setup(std::vector< TH2F > &depth, std::string name, std::string units="")