7 jets_ (cfg.getParameter<edm::InputTag>(
"jets" )),
8 leps_ (cfg.getParameter<edm::InputTag>(
"leps" )),
9 maxNJets_ (cfg.getParameter<int> (
"maxNJets" )),
10 wMass_ (cfg.getParameter<double> (
"wMass" )),
11 useBTagging_ (cfg.getParameter<bool> (
"useBTagging" )),
12 bTagAlgorithm_ (cfg.getParameter<std::
string> (
"bTagAlgorithm" )),
13 minBDiscBJets_ (cfg.getParameter<double> (
"minBDiscBJets" )),
14 maxBDiscLightJets_(cfg.getParameter<double> (
"maxBDiscLightJets"))
18 <<
"Parameter maxNJets can not be set to " <<
maxNJets_ <<
". \n"
19 <<
"It has to be larger than 4 or can be set to -1 to take all jets.";
21 produces<std::vector<std::vector<int> > >();
22 produces<int>(
"NumberOfConsideredJets");
32 std::auto_ptr<std::vector<std::vector<int> > > pOut(
new std::vector<std::vector<int> >);
33 std::auto_ptr<int> pJetsConsidered(
new int);
35 std::vector<int>
match;
36 for(
unsigned int i = 0;
i < 4; ++
i)
37 match.push_back( -1 );
49 if(leps->empty() || jets->size() < 4){
50 pOut->push_back( match );
52 *pJetsConsidered = jets->size();
53 evt.
put(pJetsConsidered,
"NumberOfConsideredJets");
59 *pJetsConsidered = maxNJets;
60 evt.
put(pJetsConsidered,
"NumberOfConsideredJets");
62 std::vector<bool> isBJet;
63 std::vector<bool> isLJet;
66 for(
unsigned int idx=0;
idx<maxNJets; ++
idx) {
78 std::vector<int> closestToWMassIndices;
79 closestToWMassIndices.push_back(-1);
80 closestToWMassIndices.push_back(-1);
83 for(
unsigned jdx=(idx+1); jdx<maxNJets; ++jdx){
84 if(
useBTagging_ && (!isLJet[jdx] || (cntBJets<=2 && isBJet[jdx]) || (cntBJets==3 && isBJet[idx] && isBJet[jdx])))
continue;
88 if( wDist<0. || wDist>fabs(sum.mass()-
wMass_) ){
89 wDist=fabs(sum.mass()-
wMass_);
90 closestToWMassIndices.clear();
91 closestToWMassIndices.push_back(idx);
92 closestToWMassIndices.push_back(jdx);
103 if(
isValid(closestToWMassIndices[0], jets) &&
isValid(closestToWMassIndices[1], jets)) {
104 for(
unsigned idx=0;
idx<maxNJets; ++
idx){
107 if( (
int)idx!=closestToWMassIndices[0] && (
int)idx!=closestToWMassIndices[1] ){
109 (*jets)[closestToWMassIndices[0]].p4()+
110 (*jets)[closestToWMassIndices[1]].p4()+
112 if( maxPt<0. || maxPt<sum.pt() ){
127 for(
unsigned idx=0;
idx<maxNJets; ++
idx){
130 if( (
int)idx!=closestToWMassIndices[0] && (
int)idx!=closestToWMassIndices[1] && (
int)idx!=hadB) {
132 (*jets)[
idx].p4()+(*leps)[ 0 ].p4();
133 if( maxPt<0. || maxPt<sum.pt() ){
145 pOut->push_back( match );
~TtSemiLepJetCombWMassMaxSumPt()
bool isValid(const int &idx, const edm::Handle< std::vector< pat::Jet > > &jets)
TtSemiLepJetCombWMassMaxSumPt(const edm::ParameterSet &)
std::string bTagAlgorithm_
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
tuple idx
DEBUGGING if hasattr(process,"trackMonIterativeTracking2012"): print "trackMonIterativeTracking2012 D...
double maxBDiscLightJets_
virtual void produce(edm::Event &evt, const edm::EventSetup &setup)
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="")