ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/VHbbAnalysis/HbbAnalyzer/plugins/HbbAnalyzerNew.cc
(Generate patch)

Comparing UserCode/VHbbAnalysis/HbbAnalyzer/plugins/HbbAnalyzerNew.cc (file contents):
Revision 1.29 by tboccali, Fri Sep 9 11:00:04 2011 UTC vs.
Revision 1.31 by tboccali, Fri Sep 9 12:34:45 2011 UTC

# Line 95 | Line 95 | HbbAnalyzerNew::produce(edm::Event& iEve
95    // JEC Uncertainty
96  
97    //  JetCorrectionUncertainty *jecUnc=0;
98 <  edm::ESHandle<g> JetCorParColl;
98 >  edm::ESHandle<JetCorrectorParametersCollection> JetCorParColl;
99    iSetup.get<JetCorrectionsRecord>().get("AK5PF",JetCorParColl);
100 <  std::cout <<" PIPPO " << JetCorParColl.isValid()<<" " <<std::endl;
100 >  JetCorrectionUncertainty *jecUnc=0;
101 >  //  if (!runOnMC_){
102    JetCorrectorParameters const & JetCorPar = (*JetCorParColl)["Uncertainty"];
103 <  std::cout <<" Pluto " << &JetCorPar<<std::endl;
104 <  JetCorrectionUncertainty *jecUnc = new JetCorrectionUncertainty(JetCorPar);
104 <  
105 <
103 >  jecUnc = new JetCorrectionUncertainty(JetCorPar);
104 >  //  }
105    
106    std::auto_ptr<VHbbEvent> hbbInfo( new VHbbEvent() );  
107    std::auto_ptr<VHbbEventAuxInfo> auxInfo( new VHbbEventAuxInfo() );
# Line 396 | Line 395 | BTagSFContainer btagSFs;
395      //       njetscounter++;
396      VHbbEvent::SimpleJet sj;
397      fillSimpleJet(sj,jet_iter);
398 <    if(runOnMC_)    setJecUnc(sj,jecUnc);
400 <    /*    sj.flavour = jet_iter->partonFlavour();
398 >    //    if(!runOnMC_)
399  
400 <    sj.tche=jet_iter->bDiscriminator("trackCountingHighEffBJetTags");
401 <    sj.tchp=jet_iter->bDiscriminator("trackCountingHighPurBJetTags");
402 <    sj.jp=jet_iter->bDiscriminator("jetProbabilityBJetTags");
403 <    sj.jpb=jet_iter->bDiscriminator("jetBProbabilityBJetTags");
404 <    sj.ssvhe=jet_iter->bDiscriminator("simpleSecondaryVertexHighEffBJetTags");
407 <    sj.csv=jet_iter->bDiscriminator("combinedSecondaryVertexBJetTags");
408 <    sj.csvmva=jet_iter->bDiscriminator("combinedSecondaryVertexMVABJetTags");
409 <    sj.charge=jet_iter->jetCharge();
410 <    sj.ntracks=jet_iter->associatedTracks().size();
411 <    sj.p4=GENPTOLORP(jet_iter);
412 <    sj.chargedTracksFourMomentum=(getChargedTracksMomentum(&*(jet_iter)));
413 <    sj.SF_CSVL=1;
414 <    sj.SF_CSVM=1;
415 <    sj.SF_CSVT=1;
416 <    sj.SF_CSVLerr=0;
417 <    sj.SF_CSVMerr=0;
418 <    sj.SF_CSVTerr=0;
400 >   setJecUnc(sj,jecUnc);
401 >
402 >    Particle::LorentzVector p4Jet = jet_iter->p4();
403 >
404 >    if(runOnMC_){
405  
406 +      fillScaleFactors(sj, btagSFs);
407 +
408 +      //PAT genJet matching
409 +      //genJet
410 +      const reco::GenJet *gJ = jet_iter->genJet();
411 +      //physical parton for mother info ONLY
412 +      if( (jet_iter->genParton())
413 +          and (jet_iter->genParton()->mother()) )
414 +        sj.bestMCmomid=jet_iter->genParton()->mother()->pdgId();
415 +      TLorentzVector gJp4;
416 +      if(gJ){
417 +        gJp4.SetPtEtaPhiE(gJ->pt(),gJ->eta(),gJ->phi(),gJ->energy());
418 +        sj. bestMCp4mom = gJp4;
419 +        if(verbose_){
420 +          std::clog << "genJet matched Pt = " << gJp4.Pt() << std::endl;
421 +          std::clog << "genJet matched eta = " << gJp4.Eta() << std::endl;
422 +          std::clog << "genJet matched deltaR = " <<gJp4.DeltaR(sj.p4) << std::endl;
423 +          std::clog << "genJet matched mother id = " << sj.bestMCmomid << std::endl;
424 +        }
425 +      }
426 +      
427 +    } //isMC
428 +    hbbInfo->simpleJets.push_back(sj);
429      
430 +  }
431  
432 <    sj.chargedHadronEFraction = jet_iter-> chargedHadronEnergyFraction();
432 >  for(edm::View<pat::Jet>::const_iterator jet_iter = simplejets3.begin(); jet_iter!=simplejets3.end(); ++jet_iter){
433 >    //     if(jet_iter->pt()>50)
434 >    //       njetscounter++;
435 >    VHbbEvent::SimpleJet sj;
436 >    fillSimpleJet(sj,jet_iter);
437 >    //    if(!runOnMC_)  
438 >  setJecUnc(sj,jecUnc);
439  
440  
441 <    //
426 <    // addtaginfo for csv
427 <    //
441 >   Particle::LorentzVector p4Jet = jet_iter->p4();
442  
443 <    if (jet_iter->hasTagInfo("SimpleSecondaryVertex")) {
443 >    if(runOnMC_){
444  
445 <      const reco::SecondaryVertexTagInfo * tf = jet_iter->tagInfoSecondaryVertex();
432 <      sj.vtxMass = tf->secondaryVertex(0).p4().mass();
433 <      sj.vtxNTracks = tf->secondaryVertex(0).nTracks();
434 <      Measurement1D m = tf->flightDistance(0);
435 <      sj.vtx3dL = m.value();
436 <      sj.vtx3deL = m.error();
437 <    }
445 >      fillScaleFactors(sj, btagSFs);
446  
447 +      //PAT genJet matching
448 +      //genJet
449 +      const reco::GenJet *gJ = jet_iter->genJet();
450 +      //physical parton for mother info ONLY
451 +      if( (jet_iter->genParton())
452 +          and (jet_iter->genParton()->mother()) )
453 +        sj.bestMCmomid=jet_iter->genParton()->mother()->pdgId();
454 +      TLorentzVector gJp4;
455 +      if(gJ){
456 +        gJp4.SetPtEtaPhiE(gJ->pt(),gJ->eta(),gJ->phi(),gJ->energy());
457 +        sj. bestMCp4mom = gJp4;
458 +        if(verbose_){
459 +          std::clog << "genJet matched Pt = " << gJp4.Pt() << std::endl;
460 +          std::clog << "genJet matched eta = " << gJp4.Eta() << std::endl;
461 +          std::clog << "genJet matched deltaR = " <<gJp4.DeltaR(sj.p4) << std::endl;
462 +          std::clog << "genJet matched mother id = " << sj.bestMCmomid << std::endl;
463 +        }
464 +      }
465 +      
466 +    } //isMC
467 +    hbbInfo->simpleJets3.push_back(sj);
468 +    
469 +  }
470  
471 <    //
472 <    // add tVector
473 <    //
474 <    sj.tVector = getTvect(&(*jet_iter));
471 >  for(edm::View<pat::Jet>::const_iterator jet_iter = simplejets4.begin(); jet_iter!=simplejets4.end(); ++jet_iter){
472 >    //     if(jet_iter->pt()>50)
473 >    //       njetscounter++;
474 >    VHbbEvent::SimpleJet sj;
475 >    fillSimpleJet(sj,jet_iter);
476 >    //    if(!runOnMC_)  
477 >    setJecUnc(sj,jecUnc);
478  
445    */
479  
480      Particle::LorentzVector p4Jet = jet_iter->p4();
481  
# Line 470 | Line 503 | BTagSFContainer btagSFs;
503        }
504        
505      } //isMC
506 <    hbbInfo->simpleJets.push_back(sj);
506 >    hbbInfo->simpleJets4.push_back(sj);
507      
508    }
509 <  
509 >
510    
511    for(edm::View<pat::Jet>::const_iterator jet_iter = simplejets2.begin(); jet_iter!=simplejets2.end(); ++jet_iter){
512      
513      VHbbEvent::SimpleJet sj;
514      fillSimpleJet(sj,jet_iter);    
515 <  if(runOnMC_)   setJecUnc(sj,jecUnc);
515 >    //  if(!runOnMC_)  
516 > setJecUnc(sj,jecUnc);
517      /*    sj.flavour = jet_iter->partonFlavour();
518      
519      
# Line 620 | Line 654 | BTagSFContainer btagSFs;
654  
655      VHbbEvent::SimpleJet sj;
656      fillSimpleJet(sj,subjet_iter);
657 <  if(runOnMC_)    setJecUnc(sj,jecUnc);
657 >    //  if(!runOnMC_)  
658 >    setJecUnc(sj,jecUnc);
659      /*    sj.flavour = subjet_iter->partonFlavour();
660      sj.tVector = getTvect(&(*subjet_iter));
661      sj.tche=subjet_iter->bDiscriminator("trackCountingHighEffBJetTags");
# Line 1275 | Line 1310 | void HbbAnalyzerNew ::fillSimpleJet (VHb
1310      //    if (jet_iter->hasTagInfo("SimpleSecondaryVertex")) {
1311  
1312      const reco::SecondaryVertexTagInfo * tf = jet_iter->tagInfoSecondaryVertex();
1313 <    if (tf){
1313 >   if (tf){
1314 >      std::cout <<" PIPPO!!!!"<<std::endl;
1315 >      std::cout <<" PIPPO!!!!ddd "<<tf->nVertices()<<std::endl;
1316        sj.vtxMass = tf->secondaryVertex(0).p4().mass();
1317 +      std::cout <<" PIPPO2!!!!"<<std::endl;
1318        sj.vtxNTracks = tf->secondaryVertex(0).nTracks();
1319 +      std::cout <<" PIPPO3!!!!"<<std::endl;
1320        std::vector<reco::TrackBaseRef >::const_iterator tit =  tf->secondaryVertex(0).tracks_begin();
1321 +      std::cout <<" PIPPO4!!!!"<<std::endl;
1322        for (; tit<  tf->secondaryVertex(0).tracks_end(); ++tit){
1323          sj.vtxTrackIds.push_back(tit->key());
1324        }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines