ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/VHbbAnalysis/VHbbDataFormats/src/HbbCandidateFinderAlgo.cc
Revision: 1.35
Committed: Fri May 25 12:32:04 2012 UTC (12 years, 11 months ago) by malbouis
Content type: text/plain
Branch: MAIN
CVS Tags: Step2ForV32_v2, Step2ForV32_v1, Step2ForV32_v0
Changes since 1.34: +3 -1 lines
Log Message:
add back type1pfCorrected from revision 1.33

File Contents

# User Rev Content
1 tboccali 1.1 #include "VHbbAnalysis/VHbbDataFormats/interface/HbbCandidateFinderAlgo.h"
2     #include "VHbbAnalysis/VHbbDataFormats/interface/VHbbCandidateTools.h"
3 arizzi 1.24 #include "VHbbAnalysis/VHbbDataFormats/interface/VHbbEventAuxInfo.h"
4    
5 dlopes 1.19 #include "DataFormats/Math/interface/deltaR.h"
6 tboccali 1.10 #include <algorithm>
7 tboccali 1.1
8     #include <iostream>
9     #include<cstdlib>
10    
11     struct CompareJetPt {
12     bool operator()( const VHbbEvent::SimpleJet& j1, const VHbbEvent::SimpleJet& j2 ) const {
13 tboccali 1.4 return j1.p4.Pt() > j2.p4.Pt();
14 tboccali 1.1 }
15     };
16    
17     struct CompareBTag {
18     bool operator()(const VHbbEvent::SimpleJet& j1, const VHbbEvent::SimpleJet& j2 ) const {
19     return j1.csv > j2.csv;
20     }
21     };
22    
23 arizzi 1.5 VHbbCandidate HbbCandidateFinderAlgo::changeHiggs(bool useHighestPtHiggs , const VHbbCandidate & old)
24     {
25     VHbbCandidateTools selector(verbose_);
26    
27     VHbbCandidate temp(old);
28     VHbbEvent::SimpleJet j1,j2;
29     std::vector<VHbbEvent::SimpleJet> addJets;
30     std::vector<VHbbEvent::SimpleJet> jets;
31    
32     for(size_t i=0; i < old.H.jets.size();i++) jets.push_back(old.H.jets[i]);
33     for(size_t i=0; i < old.additionalJets.size();i++) jets.push_back(old.additionalJets[i]);
34    
35     bool foundJets;
36    
37     if (useHighestPtHiggs == false){
38     foundJets = findDiJets(jets,j1,j2,addJets) ;
39     }else{
40     foundJets= findDiJetsHighestPt(jets,j1,j2,addJets) ;
41     }
42    
43     temp.H.jets.clear();
44     temp.H.jets.push_back(j1);
45     temp.H.jets.push_back(j2);
46     temp.H.p4 = (j1).p4+(j2).p4;
47     TVector3 higgsBoost;
48     higgsBoost = (temp.H.p4).BoostVector();
49     temp.H.helicities.clear();
50     temp.H.helicities.push_back(selector.getHelicity(j1,higgsBoost));
51     temp.H.helicities.push_back(selector.getHelicity(j2,higgsBoost));
52     temp.H.deltaTheta = selector.getDeltaTheta(j1,j2);
53     temp.additionalJets = addJets;
54     return temp;
55    
56     }
57 tboccali 1.1
58    
59    
60 arizzi 1.24 void HbbCandidateFinderAlgo::run (const VHbbEvent* event, std::vector<VHbbCandidate> & candidates,const VHbbEventAuxInfo & aux){
61     //
62     // search for leptons
63     //
64     std::vector<VHbbEvent::MuonInfo> mu;
65     std::vector<VHbbEvent::ElectronInfo> ele;
66     // std::vector<VHbbEvent::MuonInfo> mu;
67     std::vector<unsigned int> muPos;
68     findMuons(event->muInfo,mu, muPos,aux);
69     // std::vector<VHbbEvent::ElectronInfo> ele;
70     std::vector<unsigned int> elePos;
71     findElectrons(event->eleInfo,ele, elePos,aux);
72    
73 malbouis 1.34 std::vector<VHbbEvent::TauInfo> tau;
74     std::vector<unsigned int> tauPos;
75     findTaus(event->tauInfo,tau, tauPos);
76    
77 arizzi 1.24 //FIXME: cleaning here
78    
79 tboccali 1.1 //
80     // first find the jets
81     //
82    
83     VHbbCandidateTools selector(verbose_);
84 arizzi 1.25 std::vector<VHbbEvent::SimpleJet> noOverlap;
85     for(size_t j=0; j< event->simpleJets2.size(); j++)
86     {
87     float overlap=false;
88     for(size_t i=0; i< mu.size(); i++) {
89     if(deltaR(mu[i].p4.Eta(),mu[i].p4.Phi(),event->simpleJets2[j].p4.Eta(),event->simpleJets2[j].p4.Phi()) < 0.5) overlap=true;
90     }
91     for(size_t i=0; i< ele.size(); i++) {
92     if(deltaR(ele[i].p4.Eta(),ele[i].p4.Phi(),event->simpleJets2[j].p4.Eta(),event->simpleJets2[j].p4.Phi()) < 0.5) overlap=true;
93     }
94    
95     if(!overlap) noOverlap.push_back(event->simpleJets2[j]);
96     else
97     {
98 arizzi 1.27 // std::cout << "jet removed in cleaning" << std::endl;
99 arizzi 1.25 }
100     }
101    
102 tboccali 1.1
103     VHbbEvent::SimpleJet j1,j2;
104     std::vector<VHbbEvent::SimpleJet> addJets;
105 tboccali 1.2 bool foundJets;
106     if (useHighestPtHiggs_ == false){
107 arizzi 1.26 foundJets = findDiJets(noOverlap,j1,j2,addJets) ;
108 tboccali 1.2 }else{
109 arizzi 1.26 foundJets= findDiJetsHighestPt(noOverlap,j1,j2,addJets) ;
110 tboccali 1.2 }
111 tboccali 1.1
112     if (verbose_){
113     std::cout <<" Found Dijets: "<<foundJets<< " Additional: "<<addJets.size()<< std::endl;
114     }
115    
116 arizzi 1.21 // if (foundJets == false) return;
117    
118 dlopes 1.19
119     bool foundHardJets;
120     VHbbEvent::HardJet fatj1;
121     std::vector<VHbbEvent::SimpleJet> subJetsout;
122 arizzi 1.21 std::vector<VHbbEvent::SimpleJet> addJetsFat;
123     foundHardJets= findFatJet(event->hardJets,event->subJets,event->filterJets,fatj1,subJetsout, event->simpleJets2, addJetsFat, mu, ele) ;
124 dlopes 1.19
125 arizzi 1.21 if (foundJets == false && foundHardJets == false) return;
126 dlopes 1.19
127    
128 tboccali 1.1
129     std::vector<VHbbEvent::METInfo> met;
130 malbouis 1.35
131     // findMET(event->pfmet, met);
132     findMET(event->pfmetType1corr, met);
133 tboccali 1.1
134     if (verbose_){
135     std::cout <<" Electrons: "<< ele.size()<<std::endl;
136     std::cout <<" Muons : "<< mu.size()<<std::endl;
137 malbouis 1.34 std::cout <<" Taus : "<< tau.size()<<std::endl;
138 tboccali 1.1 std::cout <<" MET : "<< met.size()<<std::endl;
139     }
140 malbouis 1.34 if (ele.size()<1 && mu.size() < 1 && met.size()<1 && tau.size()<1) return;
141 tboccali 1.1 //
142     // fill!
143     //
144     VHbbCandidate temp;
145 arizzi 1.21 temp.H.HiggsFlag = foundJets;
146     if(foundJets){
147 tboccali 1.1 temp.H.jets.push_back(j1);
148     temp.H.jets.push_back(j2);
149 tboccali 1.4 temp.H.p4 = (j1).p4+(j2).p4;
150 tboccali 1.1 TVector3 higgsBoost;
151 tboccali 1.4 higgsBoost = (temp.H.p4).BoostVector();
152 tboccali 1.1 temp.H.helicities.push_back(selector.getHelicity(j1,higgsBoost));
153     temp.H.helicities.push_back(selector.getHelicity(j2,higgsBoost));
154     temp.H.deltaTheta = selector.getDeltaTheta(j1,j2);
155 arizzi 1.21 }
156 dlopes 1.19
157     temp.FatH.FatHiggsFlag= foundHardJets;
158     if(foundHardJets){
159     temp.FatH.p4 = fatj1.p4;
160     temp.FatH.subjetsSize=subJetsout.size();
161     if(subJetsout.size()==2) {temp.FatH.jets.push_back(subJetsout[0]);temp.FatH.jets.push_back(subJetsout[1]);}
162     if(subJetsout.size()==3) {temp.FatH.jets.push_back(subJetsout[0]);
163     temp.FatH.jets.push_back(subJetsout[1]);temp.FatH.jets.push_back(subJetsout[2]);}
164     }
165    
166 malbouis 1.34 std::vector<VHbbEvent::TauInfo> tauNoCandidateJetOverlap;
167     std::vector<unsigned int> tauPosNoCandidateJetOverlap;
168     removeTauOverlapWithJets(tau,temp.H.jets,tauNoCandidateJetOverlap,tauPos,tauPosNoCandidateJetOverlap);
169    
170 tboccali 1.1 temp.additionalJets = addJets;
171 arizzi 1.21 temp.additionalJetsFat = addJetsFat;
172 tboccali 1.1 temp.V.mets = met;
173     temp.V.muons = mu;
174     temp.V.electrons = ele;
175 malbouis 1.34 temp.V.taus = tauNoCandidateJetOverlap;
176 tboccali 1.1
177     //
178     // now see which kind of andidate this can be
179     //
180    
181     VHbbCandidate result;
182     bool ok = false;
183     //
184     // first: hZmumu
185     //
186    
187     if (verbose_){
188     std::cout <<" START SELECTION "<<std::endl;
189     }
190 tboccali 1.12 //
191     //
192     // change must allow a candidate to be both Zee and Zmumu
193    
194     // Zmumu
195 tboccali 1.9 result = selector.getHZmumuCandidate(temp,ok,muPos);
196 tboccali 1.1 if ( ok == true ){
197     result.setCandidateType(VHbbCandidate::Zmumu);
198     candidates.push_back(result);
199 tboccali 1.12 }
200     // HZee
201     result = selector. getHZeeCandidate(temp,ok,elePos);
202     if ( ok == true ){
203     result.setCandidateType(VHbbCandidate::Zee);
204     candidates.push_back(result);
205     }
206     //HWmunu
207     result = selector. getHWmunCandidate(temp,ok,muPos);
208     if ( ok == true ){
209     result.setCandidateType(VHbbCandidate::Wmun);
210     candidates.push_back(result);
211     }
212     // HWenu
213     result = selector. getHWenCandidate(temp,ok,elePos);
214     if ( ok == true ){
215     result.setCandidateType(VHbbCandidate::Wen);
216     candidates.push_back(result);
217     }
218    
219 malbouis 1.34 // New tau categorizations currently commented out
220     /*
221     result = selector.getHWtaunCandidate(temp,ok,tauPosNoCandidateJetOverlap);
222     if ( ok == true ){
223     if (verbose_) std::cout << "We have a taun candidate" << std::endl;
224     result.setCandidateType(VHbbCandidate::Wtaun);
225     candidates.push_back(result);
226     }
227     result = selector.getHZtaumuCandidate(temp,ok,muPos,tauPosNoCandidateJetOverlap);
228     if ( ok == true ){
229     if (verbose_) std::cout << "We have a HZtaumu candidate" << std::endl;
230     result.setCandidateType(VHbbCandidate::Ztaumu);
231     candidates.push_back(result);
232     }
233     */
234    
235 tboccali 1.12 if (candidates.size()!=0 ) return;
236    
237     // HZnn - look at it only if nothing found up to now
238     result = selector. getHZnnCandidate(temp,ok);
239     if ( ok == true ){
240     result.setCandidateType(VHbbCandidate::Znn);
241     candidates.push_back(result);
242 tboccali 1.1 }
243     return;
244     }
245    
246     void HbbCandidateFinderAlgo::findMET(const VHbbEvent::METInfo & met, std::vector<VHbbEvent::METInfo>& out){
247     //
248    
249     // just preselection: met significance > 2
250 tboccali 1.3 // removed on request by A. Rizzi - no filter at all
251     // if (met.metSig >2 ) out.push_back(met);
252     out.push_back(met);
253 tboccali 1.1 if (verbose_){
254     std::cout <<" CandidateFinder: Input MET = "<<met.metSig<<" Output MET = "<<out.size()<<std::endl;
255     }
256    
257     }
258 arizzi 1.14 bool HbbCandidateFinderAlgo::jetID(const VHbbEvent::SimpleJet & j)
259     {
260     if(j.neutralHadronEFraction > 0.99) return false;
261     if(j.neutralEmEFraction > 0.99) return false;
262 arizzi 1.21 if(fabs(j.p4.Eta())<2.4 && j.chargedEmEFraction > 0.99) return false;
263     if(fabs(j.p4.Eta())<2.4 && j.chargedHadronEFraction == 0) return false;
264     if(fabs(j.p4.Eta())<2.4 && j.ntracks == 0) return false;
265 arizzi 1.14 if(j.nConstituents <= 1) return false;
266     return true;
267     }
268 tboccali 1.1
269    
270 tboccali 1.10 bool HbbCandidateFinderAlgo::findDiJets (const std::vector<VHbbEvent::SimpleJet>& jetsin, VHbbEvent::SimpleJet& j1, VHbbEvent::SimpleJet& j2,std::vector<VHbbEvent::SimpleJet>& addJets){
271 tboccali 1.1
272    
273 tboccali 1.10
274     if (verbose_){
275     std::cout <<" CandidateFinder: Input Jets = "<<jetsin.size()<<std::endl;
276 tboccali 1.1 }
277    
278 tboccali 1.10
279 tboccali 1.1 CompareBTag bTagComparator;
280     CompareJetPt ptComparator;
281 arizzi 1.13 float etaThr = 2.5;
282 tboccali 1.1
283    
284 tboccali 1.10 if (jetsin.size()<2) return false;
285    
286     std::vector<VHbbEvent::SimpleJet> jets = jetsin;
287 tboccali 1.1
288 tboccali 1.10 std::sort(jets.begin(), jets.end(), bTagComparator);
289    
290     //
291     // now I need at least 2 with pt > threshold
292     //
293     unsigned int index1=999999, index2=999999;
294 arizzi 1.11 for (unsigned int i =0; i< jets.size(); ++i){
295 arizzi 1.16 if (jets[i].p4.Pt()> jetPtThreshold && fabs(jets[i].p4.Eta()) < etaThr /*&& jetID(jets[i])*/){
296 tboccali 1.10 if (index1 == 999999) {
297     index1=i;
298     }else if (index2 == 999999){
299     index2=i;
300     break;
301     }
302     }
303     }
304     if (index1==999999 || index2== 999999) return false;
305    
306     if (jets[index1].p4.Pt()<(jets[index2].p4.Pt())){
307     std::swap (index1,index2);
308     }
309     j1 = jets[index1];
310     j2 = jets[index2];
311 tboccali 1.1
312 tboccali 1.10 //
313 tboccali 1.1 // additional jets
314     //
315 tboccali 1.10 if (jets.size()>2){
316     for (unsigned int i=0 ; i< jets.size(); ++i){
317     if (i != index1 && i != index2 )
318     addJets.push_back(jets[i]);
319 tboccali 1.1 }
320     }
321 tboccali 1.10
322 tboccali 1.1 if (verbose_){
323     std::cout <<" CandidateFinder: Output Jets = "<<2<<" Additional = "<<addJets.size()<<std::endl;
324     }
325 tboccali 1.10
326    
327     std::sort(addJets.begin(), addJets.end(), ptComparator);
328     return true;
329    
330    
331 tboccali 1.1
332    
333    
334     }
335    
336 tboccali 1.2
337 tboccali 1.10 bool HbbCandidateFinderAlgo::findDiJetsHighestPt (const std::vector<VHbbEvent::SimpleJet>& jetsin, VHbbEvent::SimpleJet& j1, VHbbEvent::SimpleJet& j2,std::vector<VHbbEvent::SimpleJet>& addJets){
338 tboccali 1.2
339    
340 tboccali 1.10 if (verbose_){
341     std::cout <<" CandidateFinder: Input Jets = "<<jetsin.size()<<std::endl;
342     }
343     if (jetsin.size()<2) return false;
344    
345 arizzi 1.13 float etaThr = 2.5;
346 tboccali 1.10 std::vector<VHbbEvent::SimpleJet> jets = jetsin;
347     //loop over the dijets and save the one with highest Pt
348    
349     CompareJetPt ptComparator;
350     std::sort(jets.begin(), jets.end(), ptComparator);
351     //
352     // so if i<j, pt(i)>pt(j)
353     //
354    
355     float highestPt = -1000;
356     unsigned int highesti=999999,highestj=999999;
357     for (unsigned int i =0; i< jets.size()-1; ++i){
358     for (unsigned int j =i+1; j< jets.size(); ++j){
359     float pt = (jets[i].p4+jets[j].p4).Pt();
360 arizzi 1.14 if (pt>highestPt && jets[j].p4.Pt()> jetPtThreshold && jets[i].p4.Pt()> jetPtThreshold && fabs(jets[i].p4.Eta()) < etaThr && fabs(jets[j].p4.Eta()) < etaThr && jetID(jets[i]) && jetID(jets[j]) ){
361 tboccali 1.10 highestPt = pt;
362     highesti=i;
363     highestj=j;
364     }
365     }
366     }
367    
368     if (highesti == 999999 || highestj == 999999) return false;
369     j1 = jets[highesti];
370     j2 = jets[highestj];
371    
372     for (unsigned int i=0; i<jets.size(); ++i){
373     if (i!= highesti && i!= highestj)
374     addJets.push_back(jets[i]);
375     }
376    
377     if (verbose_){
378     std::cout <<" CandidateFinder: Output Jets = "<<2<<" Additional = "<<addJets.size()<<std::endl;
379     }
380     std::sort(addJets.begin(), addJets.end(), ptComparator);
381     return true;
382 tboccali 1.2 }
383    
384    
385 arizzi 1.21 bool HbbCandidateFinderAlgo::findFatJet (const std::vector<VHbbEvent::HardJet>& jetsin, const std::vector<VHbbEvent::SimpleJet>& subjetsin, const std::vector<VHbbEvent::SimpleJet>& filterjetsin, VHbbEvent::HardJet& fatj1,std::vector<VHbbEvent::SimpleJet>& subJetsout, const std::vector<VHbbEvent::SimpleJet>& ak5jetsin, std::vector<VHbbEvent::SimpleJet>& addJetsFat, const std::vector<VHbbEvent::MuonInfo>& muons, const std::vector<VHbbEvent::ElectronInfo>& electrons){
386 dlopes 1.19
387     if (verbose_){
388     std::cout <<" CandidateFinder: Input Jets = "<<jetsin.size()<<std::endl;
389     }
390     if (jetsin.size()<1) return false;
391 arizzi 1.21
392     float etaThr = 2.5;
393 dlopes 1.19 std::vector<VHbbEvent::HardJet> hardjets = jetsin;
394     std::vector<VHbbEvent::SimpleJet> subjets = subjetsin;
395     std::vector<VHbbEvent::SimpleJet> filterjets = filterjetsin;
396    
397 arizzi 1.21 fatj1=hardjets[0]; // to avoid warning if subjet below fail selection
398    
399    
400 dlopes 1.19 /* TMatrixD *pointerEta = new TMatrixD(90,80);
401     TMatrixD* pointerPhi = new TMatrixD(90,80);
402     for (unsigned int i =0; i< hardjets.size(); i++){
403     for (unsigned int j=0; j< i.constituents; j++){
404     TMatrixDRow(*pointerEta,i)(j)=i.etaSub[j];
405     TMatrixDRow(*pointerPhi,i)(j)=i.phiSub[j];
406     }
407     }
408     */
409    
410     // debug
411     /* std::cout << "hardjet size: " << hardjets.size() << "\n";
412     std::cout << "subjet size: " << subjets.size() << "\n";
413     std::cout << "filterjet size: " << filterjets.size() << "\n";
414     for(unsigned int kk=0;kk<subjets.size();kk++){
415     std::cout << "subjet pt: " << subjets[kk].p4.Pt() << " eta,phi " <<
416     subjets[kk].p4.Eta() << " , " << subjets[kk].p4.Phi() << "\n";
417     }
418     for(unsigned int kk=0;kk<filterjets.size();kk++){
419     std::cout << "filterjet pt: " << filterjets[kk].p4.Pt() << " eta,phi " <<
420     filterjets[kk].p4.Eta() << " , " << filterjets[kk].p4.Phi() << "\n";
421     }*/
422     // debug
423    
424     double minBtag1=-9999.;
425     for (unsigned int i =0; i< hardjets.size(); i++){
426     int subJetIn[300];
427     for(int k=0;k<300;k++)subJetIn[k]=-99;
428     int subJetIn1st[2];
429     for(int k=0;k<2;k++)subJetIn1st[k]=-99;
430     // TMatrixDRow* roweta=new TMatrixDRow(*pointerEta,i);
431     // TMatrixDRow* rowphi=new TMatrixDRow(*pointerPhi,i);
432    
433    
434     // debug
435     // std::cout << "HardJet pt: " << hardjets[i].p4.Pt() << " # daughters " <<
436     // hardjets[i].constituents << "\n";
437     // debug
438    
439     if(hardjets[i].constituents<4) continue;
440    
441     // first get ja and jb from first decomposition
442     int In1st=0;
443     for(int j=0;j<2;j++){
444     // debug
445     // std::cout << "hardJet constituent pt: " << hardjets[i].subFourMomentum[j].Pt() << " eta,phi " <<
446     // hardjets[i].subFourMomentum[j].Eta() << " , " << hardjets[i].subFourMomentum[j].Phi() << "\n";
447     // debug
448     for(unsigned int kk=0;kk<subjets.size();kk++){
449     // if(subjets.eta[kk]==roweta->GetPtr()[j] && subjets.phi[kk]==rowphi->GetPtr()[j])
450     // subJetIn1st[In1st]=kk;}
451     // if(subjets[kk].p4.Eta()==hardjets[i].etaSub[j] && subjets[kk].p4.Phi()==hardjets[i].phiSub[j])
452     // subJetIn1st[In1st]=kk;}
453     // if(subjets[kk].p4.Eta()==hardjets[i].subFourMomentum[j].Eta() && subjets[kk].p4.Phi()==hardjets[i].subFourMomentum[j].Phi())
454     // subJetIn1st[In1st]=kk;}
455     double deltaR_1=deltaR(subjets[kk].p4.Eta(),subjets[kk].p4.Phi(),hardjets[i].subFourMomentum[j].Eta(),hardjets[i].subFourMomentum[j].Phi()); if(deltaR_1<0.01) subJetIn1st[In1st]=kk;}
456     In1st++;
457     }
458    
459     // then get all subjets from decomposition with
460     for(int j=2;j<hardjets[i].constituents;j++){
461     // debug
462     // std::cout << "hardJet constituent pt: " << hardjets[i].subFourMomentum[j].Pt() << " eta,phi " <<
463     // hardjets[i].subFourMomentum[j].Eta() << " , " << hardjets[i].subFourMomentum[j].Phi() << "\n";
464     // debug
465     // cout << "n: " << i << "," << j << " hardjetsub eta: " << roweta->GetPtr()[j] << " phi: " <<
466     // rowphi->GetPtr()[j] << "\n";
467     for(unsigned int kk=0;kk<filterjets.size();kk++){
468     // if(subjets.eta[kk]==roweta->GetPtr()[j] && subjets.phi[kk]==rowphi->GetPtr()[j])
469     // subJetIn[j]=kk;}
470     // if(subjets[kk].p4.Eta()==hardjets[i].etaSub[j] && subjets[kk].p4.Phi()==hardjets[i].phiSub[j])
471     // subJetIn[j]=kk;}
472     // if(subjets[kk].p4.Eta()==hardjets[i].subFourMomentum[j].Eta() && subjets[kk].p4.Phi()==hardjets[i].subFourMomentum[j].Phi()) subJetIn[j]=kk;
473     double deltaR_1=deltaR(filterjets[kk].p4.Eta(),filterjets[kk].p4.Phi(),hardjets[i].subFourMomentum[j].Eta(),hardjets[i].subFourMomentum[j].Phi()); if(deltaR_1<0.01) subJetIn[j-2]=kk;}
474     }
475    
476    
477     //debug
478     // std::cout << "index in subjetTag: " << subJetIn1st[0] << "," << subJetIn1st[1] << "\n";
479     // std::cout << "index in subfilterTag: " << subJetIn[0] << "," << subJetIn[1] << "," << subJetIn[2] << "\n";
480     // debug
481    
482     if(subJetIn1st[0]==-99 || subJetIn1st[1]==-99) continue;
483     if(subJetIn[0]==-99 || subJetIn[1]==-99) continue;
484    
485     int nBtag=0;
486     for(int j=0;j<2;j++){
487     if(subjets[subJetIn1st[j]].csv>0.) nBtag++;}
488    
489     int nPt=0;
490     for(int j=0;j<2;j++){
491 arizzi 1.21 //// if(subjets[subJetIn1st[j]].p4.Pt()>30. && fabs(subjets[subJetIn1st[j]].p4.Eta())<etaThr && jetID(subjets[subJetIn1st[j]])) nPt++;}
492     if(filterjets[subJetIn[j]].p4.Pt()>20. && fabs(filterjets[subJetIn[j]].p4.Eta())<etaThr && jetID(filterjets[subJetIn[j]])) nPt++;}
493 dlopes 1.19
494     // if(nBtag<2 || nPt<2) continue;
495     if(nPt<2) continue;
496    
497 arizzi 1.21 ///// lepton overlap
498     int muOverlap=0;
499     for (unsigned int it = 0; it < muons.size(); ++it){
500     if (
501     muons[it]. globChi2<10 &&
502     muons[it].nPixelHits>= 1 &&
503     muons[it].globNHits != 0 &&
504     muons[it].nHits > 10 &&
505     //tracker
506     (muons[it].cat & 0x1) &&
507     //global
508     (muons[it].cat & 0x2) &&
509     muons[it].nMatches >=2 &&
510     muons[it].ipDb<.2 &&
511     (muons[it].pfChaIso+muons[it].pfPhoIso+muons[it].pfNeuIso)/muons[it].p4.Pt()<.15 &&
512     fabs(muons[it].p4.Eta())<2.4 &&
513     muons[it].p4.Pt()>20 ) {
514     for(int j=0;j<2;j++){
515     if(deltaR(muons[it].p4.Eta(),muons[it].p4.Phi(),filterjets[subJetIn[j]].p4.Eta(),filterjets[subJetIn[j]].p4.Phi())<0.3) muOverlap++;}
516     }
517     }
518    
519     int elecOverlap=0;
520     for (unsigned int it = 0; it< electrons.size(); ++it){
521     if (
522     // fake
523     (fabs(electrons[it].id95 - 7)) < 0.1 &&
524     fabs(electrons[it].p4.Eta()) < 2.5 &&
525     //Remove this workaround as now we have the proper flags
526     // !( fabs(electrons[it].p4.Eta()) < 1.57 && fabs(electrons[it].p4.Eta()) > 1.44) &&
527     electrons[it].p4.Pt()>15 // I use the minimum ok for both Z and W
528     && (electrons[it].pfChaIso+electrons[it].pfPhoIso+electrons[it].pfNeuIso)/electrons[it].p4.Pt()<.15
529     ){
530     for(int j=0;j<2;j++){
531     if(deltaR(electrons[it].p4.Eta(),electrons[it].p4.Phi(),filterjets[subJetIn[j]].p4.Eta(),filterjets[subJetIn[j]].p4.Phi())<0.3) elecOverlap++;}
532     }
533     }
534    
535    
536     if(muOverlap>0) continue;
537     if(elecOverlap>0) continue;
538    
539 dlopes 1.19 // if(subjets[subJetIn1st[0]].csv+subjets[subJetIn1st[1]].csv>minBtag1){
540     // minBtag1=subjets[subJetIn1st[0]].csv+subjets[subJetIn1st[1]].csv;
541     if((subjets[subJetIn1st[0]].p4+subjets[subJetIn1st[1]].p4).Pt()>minBtag1){
542     minBtag1=(subjets[subJetIn1st[0]].p4+subjets[subJetIn1st[1]].p4).Pt();
543 arizzi 1.21 /* double filtpt=0;
544     if(subJetIn[0]!=-99 && subJetIn[1]!=-99) filtpt=(filterjets[subJetIn[0]].p4+filterjets[subJetIn[1]].p4).Pt();
545     if(subJetIn[0]!=-99 && subJetIn[1]!=-99 && subJetIn[2]!=-99) filtpt=(filterjets[subJetIn[0]].p4+filterjets[subJetIn[1]].p4+filterjets[subJetIn[2]].p4).Pt();
546     if(filtpt>minBtag1){
547     minBtag1=filtpt;
548     */
549     // if(hardjets[i].p4.Pt()>minBtag1){
550     // minBtag1=hardjets[i].p4.Pt();
551 dlopes 1.19 fatj1=hardjets[i];
552     subJetsout.clear();
553     if(subJetIn[0]!=-99) subJetsout.push_back(filterjets[subJetIn[0]]);
554     if(subJetIn[1]!=-99) subJetsout.push_back(filterjets[subJetIn[1]]);
555     if(subJetIn[2]!=-99) subJetsout.push_back(filterjets[subJetIn[2]]);
556     }
557    
558     } // loop hard jet
559    
560 arizzi 1.21
561     //
562     // additional jets
563     //
564     std::vector<VHbbEvent::SimpleJet> ak5jets = ak5jetsin;
565    
566     addJetsFat.clear();
567     for (unsigned int i=0 ; i< ak5jets.size(); ++i){
568     int overlap=0;
569     for (unsigned int j=0 ; j< subJetsout.size(); ++j){
570     if(subJetsout[j].p4.Pt() <20.) continue;
571     if (deltaR(ak5jets[i].p4.Eta(),ak5jets[i].p4.Phi(),subJetsout[j].p4.Eta(),subJetsout[j].p4.Phi())<0.3) overlap++;
572     }
573     if(overlap==0) addJetsFat.push_back(ak5jets[i]);
574     }
575    
576    
577 dlopes 1.19
578     return true;
579     }
580    
581 malbouis 1.34 void HbbCandidateFinderAlgo::removeTauOverlapWithJets(const std::vector<VHbbEvent::TauInfo>& taus, const std::vector<VHbbEvent::SimpleJet>& jets, std::vector<VHbbEvent::TauInfo>& out, const std::vector<unsigned int>& oldPositions,std::vector<unsigned int>& positions) {
582     for (unsigned int it = 0; it < taus.size(); ++it){
583     bool overlap = false;
584     for (unsigned int jit = 0 ; jit < jets.size() ; ++jit) {
585     if (taus[it].p4.DeltaR(jets[jit].p4) < 0.2) {
586     overlap = true;
587     if (verbose_) {
588     std::cout << "Found overlap of tau (pt,eta,phi)=(" << taus[it].p4.Pt() <<","<< taus[it].p4.Eta() <<","<< taus[it].p4.Phi() << ")"
589     << "with candidate jet (pt,eta,phi)=(" << jets[jit].p4.Pt() <<","<< jets[jit].p4.Eta() <<","<< jets[jit].p4.Phi() << ")"
590     << std::endl;
591     }
592     }
593     }
594     if (!overlap) {
595     if (verbose_) {
596     std::cout << "No overlap with tau (pt,eta,phi)=(" << taus[it].p4.Pt() <<","<< taus[it].p4.Eta() <<","<< taus[it].p4.Phi() << "); keeping it " << std::endl;
597     }
598     out.push_back(taus[it]);
599     positions.push_back(oldPositions[it]);
600     }
601     }
602     }
603    
604     void HbbCandidateFinderAlgo::findTaus(const std::vector<VHbbEvent::TauInfo>& taus, std::vector<VHbbEvent::TauInfo>& out, std::vector<unsigned int>& positions){
605     if (verbose_) std::cout << "[SCZ] Tau size=" << taus.size() << std::endl;
606     for (unsigned int it = 0; it < taus.size(); ++it){
607     /*
608     myPatTau.tauID("decayModeFinding"); // cuts on tau invariant mass, etc
609     myPatTau.tauID("byLooseCombinedIsolationDeltaBetaCorr") // isolated
610     taus, corrected for PU use DB technique
611     myPatTau.tauID("againstMuonTight"); // remove muons faking hadronic taus
612     myPatTau.tauID("againstElectronLoose/againstElectronMedium/againstElectronMVA");
613     // remove electrons faking hadronic taus, choose based on your fake - e background.
614     */
615    
616     if (verbose_) {
617     std::cout << "(pt,decayModeFinding,byLooseCombinedIsolationDeltaBetaCorr,againstMuonTight,againstElectronLoose,againstElectronMedium,againstElectronMVA)=("
618     << taus[it].p4.Pt() << ","
619     << (taus[it].decayModeFinding>0.5) << ","
620     << (taus[it].byLooseCombinedIsolationDeltaBetaCorr>0.5) << ","
621     << (taus[it].againstMuonTight>0.5) << ","
622     << (taus[it].againstElectronLoose>0.5) <<","
623     << (taus[it].againstElectronMedium>0.5) <<","
624     << (taus[it].againstElectronMVA>0.5) << ")" << std::endl;
625     }
626    
627     if (taus[it].decayModeFinding>0.5&&taus[it].byLooseCombinedIsolationDeltaBetaCorr>0.5&&taus[it].againstMuonTight>0.5&&taus[it].againstElectronLoose>0.5&&taus[it].p4.Pt()>20.) {
628     out.push_back(taus[it]);
629     positions.push_back(it);
630     }
631     }
632     if (verbose_){
633     std::cout <<" CandidateFinder: Input Taus = "<<taus.size()<<" Output Taus = "<<out.size()<<std::endl;
634     }
635     }
636    
637 tboccali 1.2
638 arizzi 1.24 void HbbCandidateFinderAlgo::findMuons(const std::vector<VHbbEvent::MuonInfo>& muons, std::vector<VHbbEvent::MuonInfo>& out, std::vector<unsigned int>& positions,const VHbbEventAuxInfo & aux){
639 tboccali 1.1 /* Use:
640     For both W -> mu nu and Z -> mu mu, we adopt the standard VBTF muon selection described in VbtfWmunuBaselineSelection. The explicit cuts are reproduced here:
641    
642 bortigno 1.6 We use RECO (pf?) Muons that are both Global and Tracker
643 tboccali 1.1 chi2/ndof < 10 for the global muon fit
644     The track associated to the muon must have
645     >= 1 pixel hits
646     >= 10 pixel + strip hits
647     >= 1 valid hit in the muon chambers
648     >= 2 muon stations
649     |dxy| < 0.2
650     |eta| < 2.4
651 bortigno 1.6 PF Relative combined isolation (R) is required to be < 0.15
652     R = [pfChaIso + pfNeuIso + pfPhoIso] / pT(mu) computed in a cone of radius 0.3 in eta-phi
653 tboccali 1.1 pT(mu) > 20 GeV
654     */
655 tboccali 1.9 // for (std::vector<VHbbEvent::MuonInfo>::const_iterator it = muons.begin(); it!= muons.end(); ++it){
656 arizzi 1.22
657     /* New iso:
658    
659     Alternatively, for analysis using rho correction, Effective Areas are also provided using following prescription:
660     Correction to be done as PFIsoCorr = PF(PFNoPU) – Max ((PF(Nh+Ph) - ρ’EACombined),0.0)) where ρ’=max(ρ,0.0) and with a 0.5 GeV threshold on neutrals
661     Rho is neutral rho, defined in full tracker acceptance, with a 0.5 GeV threshold on neutrals. This can be taken, starting from 50X, from the event directly (double_kt6PFJetsCentralNeutral_rho_RECO.obj) For its exact definition see [2].
662     Values of Effective Areas EACombined are provided in this link, page 9 (see PF Combined Column, DeltaR >0/4 )
663     [2] kt6PFJetsCentralNeutral = kt6PFJets.clone( src = cms.InputTag("pfAllNeutralHadronsAndPhotons"), Ghost_EtaMax = cms.double(3.1), Rho_EtaMax = cms.double(2.5), inputEtMin = cms.double(0.5) )
664    
665     Effective area, last column matters for us:
666     | PF Neutral | PF Photons | PF Combined |
667     Muon Eta | DR < 0.30 | DR < 0.40 | DR < 0.30 | DR < 0.40 | DR < 0.30 | DR < 0.40 |
668     0.0 < |eta| < 1.0 | 0.107 +/- 0.010 | 0.166 +/- 0.013 | 0.274 +/- 0.017 | 0.504 +/- 0.020 | 0.382 +/- 0.034 | 0.674 +/- 0.020 |
669     1.0 < |eta| < 1.5 | 0.141 +/- 0.016 | 0.259 +/- 0.023 | 0.161 +/- 0.019 | 0.306 +/- 0.027 | 0.317 +/- 0.045 | 0.565 +/- 0.027 |
670     1.5 < |eta| < 2.0 | 0.159 +/- 0.017 | 0.247 +/- 0.025 | 0.079 +/- 0.015 | 0.198 +/- 0.026 | 0.242 +/- 0.040 | 0.442 +/- 0.026 |
671     2.0 < |eta| < 2.2 | 0.102 +/- 0.022 | 0.220 +/- 0.036 | 0.168 +/- 0.035 | 0.287 +/- 0.048 | 0.326 +/- 0.076 | 0.515 +/- 0.048 |
672     2.2 < |eta| < 2.3 | 0.096 +/- 0.030 | 0.340 +/- 0.072 | 0.359 +/- 0.072 | 0.525 +/- 0.074 | 0.462 +/- 0.159 | 0.821 +/- 0.074 |
673     2.3 < |eta| < 2.4 | 0.104 +/- 0.036 | 0.216 +/- 0.056 | 0.294 +/- 0.064 | 0.488 +/- 0.083 | 0.372 +/- 0.141 | 0.660 +/- 0.083 |
674    
675     */
676    
677 tboccali 1.9 for (unsigned int it = 0; it < muons.size(); ++it){
678 arizzi 1.24 float mincor=0.0;
679     float minrho=0.0;
680     float rhoN = std::max(aux.puInfo.rhoNeutral,minrho);
681     float eta=muons[it].p4.Eta();
682     float area=0.5;
683     if(fabs(eta)>0.0 && fabs(eta) <= 1.0) {area=0.674;}
684     if(fabs(eta)>1.0 && fabs(eta) <= 1.5) {area=0.565;}
685     if(fabs(eta)>1.5 && fabs(eta) <= 2.0) {area=0.442;}
686     if(fabs(eta)>2.0 && fabs(eta) <= 2.2) {area=0.515;}
687     if(fabs(eta)>2.2 && fabs(eta) <= 2.3) {area=0.821;}
688     if(fabs(eta)>2.3 && fabs(eta) <= 2.4) {area=0.660;}
689 arizzi 1.30 float pfCorrIso = (muons[it].pfChaIso+ std::max(muons[it].pfPhoIso+muons[it].pfNeuIso-rhoN*area,mincor))/muons[it].p4.Pt();
690 tboccali 1.1 if (
691 arizzi 1.22 muons[it].isPF &&
692 tboccali 1.9 muons[it]. globChi2<10 &&
693     muons[it].nPixelHits>= 1 &&
694 arizzi 1.16 muons[it].globNHits != 0 &&
695 arizzi 1.22 muons[it].nValidLayers > 5 &&
696     // muons[it].nHits > 10 &&
697 arizzi 1.13 //tracker
698 arizzi 1.22 // (muons[it].cat & 0x1) &&
699 bortigno 1.7 //global
700 arizzi 1.16 (muons[it].cat & 0x2) &&
701 arizzi 1.15 muons[it].nMatches >=2 &&
702 tboccali 1.9 muons[it].ipDb<.2 &&
703     // (muons[it].hIso+muons[it].eIso+muons[it].tIso)/muons[it].p4.Pt()<.15 &&
704 arizzi 1.29 pfCorrIso < 0.12 &&
705 tboccali 1.9 fabs(muons[it].p4.Eta())<2.4 &&
706 arizzi 1.13 muons[it].p4.Pt()>20 ) {
707 tboccali 1.9 out.push_back(muons[it]);
708     positions.push_back(it);
709 tboccali 1.1 }
710 arizzi 1.13 }
711 tboccali 1.1 if (verbose_){
712     std::cout <<" CandidateFinder: Input Muons = "<<muons.size()<<" Output Muons = "<<out.size()<<std::endl;
713     }
714    
715    
716     }
717    
718    
719 arizzi 1.24 void HbbCandidateFinderAlgo::findElectrons(const std::vector<VHbbEvent::ElectronInfo>& electrons, std::vector<VHbbEvent::ElectronInfo>& out, std::vector<unsigned int>& positions,const VHbbEventAuxInfo & aux){
720     /*
721 tboccali 1.1 We adopt the standard cut-based selection from VBTF described in detail here.
722    
723     Z -> ee
724 bortigno 1.6 gsf (pf?) electrons
725 tboccali 1.1 VBTF WP95
726     |eta|<2.5, excluding the gap 1.44 < |eta| < 1.57
727     pT(e) > 20
728    
729     W -> e nu
730 bortigno 1.6 gsf (pf?) electrons
731 tboccali 1.1 VBTF WP80
732     |eta|<2.5, excluding the gap 1.44 < |eta| < 1.57
733     pT(e) > 30
734     */
735 tboccali 1.9 // for (std::vector<VHbbEvent::ElectronInfo>::const_iterator it = electrons.begin(); it!= electrons.end(); ++it){
736 arizzi 1.28 /*
737     isocorr = chargediso + max(PFIso(&gamma;) - rho * Aeff(&gamma), 0.) + max(PFIso(NH) - rho * Aeff(NH), 0.)
738     0<abs(eta)<1.0 Aeff(NH) = 0.024 +/- 0.001 Aeff(γ) = 0.081 +/- 0.001 Aeff(γ+NH) = 0.10 +/- 0.002
739     1.0<abs(eta)<1.479 Aeff(NH) = 0.037 +/- 0.001 Aeff(γ) = 0.084 +/- 0.003 Aeff(γ+NH) = 0.12 +/- 0.003
740     1.479<abs(eta)<2.0 Aeff(NH) = 0.037 +/- 0.001 Aeff(γ) = 0.048 +/- 0.001 Aeff(γ+NH) = 0.085 +/- 0.002
741     2.0<abs(eta)<2.2 Aeff(NH) = 0.023 +/- 0.001 Aeff(γ) = 0.089 +/- 0.002 Aeff(γ+NH) = 0.11 +/- 0.003
742     2.2<abs(eta)<2.3 Aeff(NH) = 0.023 +/- 0.002 Aeff(γ) = 0.092 +/- 0.004 Aeff(γ+NH) = 0.12 +/- 0.004
743     2.3<abs(eta)<2.4 Aeff(NH) = 0.021 +/- 0.002 Aeff(γ) = 0.097 +/- 0.004 Aeff(γ+NH) = 0.12 +/- 0.005
744     2.4< abs(eta)<123213 Aeff(NH) = 0.021 +/- 0.003 Aeff(γ) = 0.11 +/- 0.004 Aeff(γ+NH) = 0.13 +/- 0.006
745    
746     */
747 tboccali 1.9 for (unsigned int it = 0; it< electrons.size(); ++it){
748 arizzi 1.28 float mincor=0.0;
749     float minrho=0.0;
750     float rhoN = std::max(aux.puInfo.rhoNeutral,minrho);
751     float eta=electrons[it].p4.Eta();
752     float areagamma=0.5;
753     float areaNH=0.5;
754 arizzi 1.29 float areaComb=0.5;
755     if(fabs(eta) <= 1.0 ) {areagamma=0.081; areaNH=0.024; areaComb=0.10;}
756     if(fabs(eta) > 1.0 && fabs(eta) <= 1.479 ) {areagamma=0.084; areaNH=0.037; areaComb=0.12;}
757     if(fabs(eta) > 1.479 && fabs(eta) <= 2.0 ) {areagamma=0.048; areaNH=0.037; areaComb=0.085;}
758     if(fabs(eta) > 2.0 && fabs(eta) <= 2.2 ) {areagamma=0.089; areaNH=0.023; areaComb=0.11;}
759     if(fabs(eta) > 2.2 && fabs(eta) <= 2.3 ) {areagamma=0.092; areaNH=0.023; areaComb=0.12;}
760     if(fabs(eta) > 2.3 && fabs(eta) <= 2.4 ) {areagamma=0.097; areaNH=0.021; areaComb=0.12;}
761     if(fabs(eta) > 2.4 ) {areagamma=0.11; areaNH=0.021; areaComb=0.13;}
762 arizzi 1.28
763    
764 arizzi 1.32 //Correct electron photon double count
765     float pho=electrons[it].pfPhoIso;
766     if(electrons[it].innerHits>0)
767     {
768     pho-=electrons[it].pfPhoIsoDoubleCounted;
769     }
770    
771     float pfCorrIso = (electrons[it].pfChaIso+ std::max(pho-rhoN*areagamma,mincor )+std::max(electrons[it].pfNeuIso-rhoN*areaNH,mincor))/electrons[it].p4.Pt();
772 arizzi 1.31 float iso=pfCorrIso;
773     float id=electrons[it].mvaOutTrig;
774     bool wp70=((fabs(eta) < 0.8 && id>0.977 && iso < 0.093) || (fabs(eta) >= 0.8 && fabs(eta) < 1.479 && id>0.956 && iso < 0.095) || (fabs(eta) >= 1.479 && fabs(eta) < 2.5 && id>0.966 && iso < 0.171));
775     bool wp80=((fabs(eta) < 0.8 && id>0.913 && iso < 0.105) || (fabs(eta) >= 0.8 && fabs(eta) < 1.479 && id>0.964 && iso < 0.178) || (fabs(eta) >= 1.479 && fabs(eta) < 2.5 && id>0.899 && iso < 0.150));
776     bool wp85=((fabs(eta) < 0.8 && id>0.929 && iso < 0.135) || (fabs(eta) >= 0.8 && fabs(eta) < 1.479 && id>0.931 && iso < 0.159) || (fabs(eta) >= 1.479 && fabs(eta) < 2.5 && id>0.805 && iso < 0.155));
777     bool wp90=((fabs(eta) < 0.8 && id>0.877 && iso < 0.177) || (fabs(eta) >= 0.8 && fabs(eta) < 1.479 && id>0.794 && iso < 0.180) || (fabs(eta) >= 1.479 && fabs(eta) < 2.5 && id>0.846 && iso < 0.244));
778     bool wp95=((fabs(eta) < 0.8 && id>0.858 && iso < 0.253) || (fabs(eta) >= 0.8 && fabs(eta) < 1.479 && id>0.425 && iso < 0.225) || (fabs(eta) >= 1.479 && fabs(eta) < 2.5 && id>0.759 && iso < 0.308));
779     bool wpHWW=((fabs(eta) < 0.8 && id>0.94 && iso < 0.15) || (fabs(eta) >= 0.8 && fabs(eta) < 1.479 && id>0.85 && iso < 0.15) || (fabs(eta) >= 1.479 && fabs(eta) < 2.5 && id>0.92 && iso < 0.15));
780 arizzi 1.28
781    
782 tboccali 1.1 if (
783 arizzi 1.28
784 tboccali 1.1 // fake
785 arizzi 1.23 /* "(isEE || isEB) && !isEBEEGap &&"
786     " (chargedHadronIso + neutralHadronIso + photonIso)/pt <0.10 &&"
787     "dB < 0.02 && " #dB is computed wrt PV but is transverse only, no info about dZ(vertex)
788     "( "
789     "(isEE && ("
790     "abs(deltaEtaSuperClusterTrackAtVtx) < 0.005 && abs(deltaPhiSuperClusterTrackAtVtx) < 0.02 && sigmaIetaIeta < 0.03 && hadronicOverEm < 0.10 && abs(1./ecalEnergy*(1.-eSuperClusterOverP)) < 0.05 "
791     ")) || "
792     "(isEB && ( "
793     "abs(deltaEtaSuperClusterTrackAtVtx) < 0.004 && abs(deltaPhiSuperClusterTrackAtVtx) < 0.03 && sigmaIetaIeta < 0.01 && hadronicOverEm < 0.12 && abs(1./ecalEnergy*(1.-eSuperClusterOverP)) < 0.05"
794     "))"
795     #or use mvaNonTrigV0 and mvaTrigV0
796     ")" */
797 arizzi 1.22 // (fabs(electrons[it].id95 - 7)) < 0.1 &&
798 arizzi 1.31 wp95 &&
799 arizzi 1.23 //2012 cut based ELE ID
800 arizzi 1.31 /* fabs(electrons[it].dxy) < 0.02 &&
801 arizzi 1.23 fabs(electrons[it].dz) < 0.1 &&
802     ((electrons[it].isEE &&
803     fabs(electrons[it].Deta) < 0.005 &&
804     fabs(electrons[it].Dphi) < 0.02 &&
805     electrons[it].sihih < 0.03 &&
806     electrons[it].HoE < 0.10 &&
807     fabs(electrons[it].fMVAVar_IoEmIoP) < 0.05
808     ) ||
809     (electrons[it].isEB &&
810     fabs(electrons[it].Deta) < 0.004 &&
811     fabs(electrons[it].Dphi) < 0.03 &&
812     electrons[it].sihih < 0.01 &&
813     electrons[it].HoE < 0.12 &&
814     fabs(electrons[it].fMVAVar_IoEmIoP) < 0.05
815     )
816     ) &&
817 arizzi 1.28 pfCorrIso < 0.1 &&
818 tboccali 1.9 fabs(electrons[it].p4.Eta()) < 2.5 &&
819 arizzi 1.31 */
820 arizzi 1.18 //Remove this workaround as now we have the proper flags
821     // !( fabs(electrons[it].p4.Eta()) < 1.57 && fabs(electrons[it].p4.Eta()) > 1.44) &&
822 tboccali 1.9 electrons[it].p4.Pt()>20 // I use the minimum ok for both Z and W
823 tboccali 1.1 ){
824 arizzi 1.24 /* std::cout << "dxy .dz .isEE .Deta .Dphi .sihih .HoE .fMVAVar_IoEmIoP .isEB " <<std::endl;
825     std::cout << fabs(electrons[it].dxy) << " " << fabs(electrons[it].dz) << " " << electrons[it].isEE << " " <<
826     fabs(electrons[it].Deta)
827     << " " << fabs(electrons[it].Dphi)
828     << " " <<electrons[it].sihih
829     << " " <<electrons[it].HoE
830     << " " <<fabs(electrons[it].fMVAVar_IoEmIoP)
831     << " " <<electrons[it].isEB << std::endl;
832     */
833    
834 tboccali 1.9 out.push_back(electrons[it]);
835     positions.push_back(it);
836 tboccali 1.1 }
837     }
838     if (verbose_){
839     std::cout <<" CandidateFinder: Input Electrons = "<<electrons.size()<<" Output Electrons = "<<out.size()<<std::endl;
840     }
841    
842    
843     }
844