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

Comparing UserCode/HbbAnalysis/plugins/HbbTreeMaker.cc (file contents):
Revision 1.47 by agilbert, Sat Oct 29 08:04:37 2011 UTC vs.
Revision 1.48 by agilbert, Wed Jan 25 18:45:49 2012 UTC

# Line 43 | Line 43
43   #include "SimDataFormats/GeneratorProducts/interface/GenRunInfoProduct.h"
44   #include "SimDataFormats/GeneratorProducts/interface/HepMCProduct.h"
45   #include "SimDataFormats/GeneratorProducts/interface/LHEEventProduct.h"
46 + #include "SimDataFormats/GeneratorProducts/interface/GenEventInfoProduct.h"
47 +
48  
49   #include "FWCore/ServiceRegistry/interface/Service.h"
50   #include "FWCore/Framework/interface/Run.h"
# Line 252 | Line 254 | void HbbTreeMaker::analyze(const edm::Ev
254    if (!processData_) {
255      edm::Handle<edm::HepMCProduct> mcProd;
256      edm::Handle<GenRunInfoProduct> lRunProd;
257 +    edm::Handle<GenEventInfoProduct> genEventInfoHandle;
258 +
259      try {
260        aEvt.getByLabel("generator", mcProd );
261      } catch(cms::Exception& e)  {
# Line 262 | Line 266 | void HbbTreeMaker::analyze(const edm::Ev
266      } catch(cms::Exception& e)  {
267        std::cout << "AMM: Collection GenInfoProduct not available! Exception : " << e.what() << ". " << std::endl;
268      }
269 <
270 <    if (mcProd.isValid() && lRunProd.isValid()){
271 <    HbbGenInfo(mcProd,lRunProd);
269 >    try {
270 >      aEvt.getByLabel("generator",genEventInfoHandle);
271 >    } catch(cms::Exception& e)  {
272 >      std::cout << "AMM: Collection GenEventInfoProduct not available! Exception : " << e.what() << ". " << std::endl;
273      }
274  
275 +    HbbGenInfo(mcProd,lRunProd,genEventInfoHandle);
276 +
277      edm::Handle<reco::GenJetCollection> lGenJets;
278      try {
279        aEvt.getByLabel(genJetSrc_,lGenJets);  
# Line 835 | Line 842 | void HbbTreeMaker::HbbElectrons(const ed
842            lID.trackerDrivenSeed = (*iter).trackerDrivenSeed();
843  
844            aVec.push_back(HbbAnalysis::Electron(lFourVec,lLep,lSC,lIso,lID));
845 +
846 +    //Testing
847 +    std::vector<HbbAnalysis::Electron>::iterator it = aVec.end() - 1;
848 +    if ( (int(it->idVars().electronIDs.find("simpleEleId85relIso")->second+0.5) != 7 &&  it->WPrel85())
849 +        || (int(it->idVars().electronIDs.find("simpleEleId85relIso")->second+0.5) == 7 &&  !it->WPrel85()) ) {
850 +      std::cout << "SHIT!" << std::endl;
851 +      std::cout << "Direct: " << it->WPrel85() << "\tFrom PAT: "  << int(it->idVars().electronIDs.find("simpleEleId85relIso")->second+0.5) << std::endl;
852 +    }
853 +
854 +    
855 +
856          }
857      }
858    }
# Line 1829 | Line 1847 | void HbbTreeMaker::HbbParticles(const ed
1847            //std::cout << ((reco::GenParticle*)p.daughter(i) - ptrToFirst) << " " << p.daughter(i) << "\t";
1848          }
1849                  aVec.push_back(lObj);
1850 +          //if (mccount < 50) std::cout << "------Particle " << mccount << std::endl;
1851 +          //if (mccount < 50) lObj.Print();
1852          //std::cout << std::endl;
1853        }
1854   /*
# Line 1858 | Line 1878 | void HbbTreeMaker::HbbParticles(const ed
1878  
1879    if (debug_>1){
1880      for (unsigned int imc(0); imc < aVec.size(); ++imc){
1881 <      //HbbAnalysis::GenParticle & p = aVec.at(imc);
1882 <      //p.print();
1881 >      HbbAnalysis::GenParticle & p = aVec.at(imc);
1882 >      p.Print();
1883      }
1884    }
1885  
# Line 1929 | Line 1949 | void HbbTreeMaker::HbbGenJets(const edm:
1949                lObj.addConstituent(HbbAnalysis::GenParticle(lGenFourVec,lGen));
1950              }
1951            }
1952 +    //std::cout << "--------------------------------------------" << std::endl;
1953 +    //std::cout << "GenJet: " << std::endl;
1954 +    //std::cout << "--------------------------------------------" << std::endl;
1955 +    //lObj.Print();
1956            aVec.push_back(lObj);
1957          }
1958      }
# Line 2064 | Line 2088 | void HbbTreeMaker::fillHLTVector(const e
2088   }
2089   */
2090   void HbbTreeMaker::HbbGenInfo(const edm::Handle<edm::HepMCProduct> & amcProd,
2091 <                              const edm::Handle<GenRunInfoProduct> & aRunProd)
2091 >                              const edm::Handle<GenRunInfoProduct> & aRunProd,
2092 >            const edm::Handle<GenEventInfoProduct> & aInfoProd)
2093   {
2094 <  const HepMC::GenEvent * genEvt = amcProd->GetEvent();
2094 >
2095    HbbAnalysis::GenInfo lInfo;
2096  
2097 <  lInfo.processID(genEvt->signal_process_id());
2098 <  lInfo.ptHat(genEvt->event_scale());
2097 >  if (amcProd.isValid()) {
2098 >    const HepMC::GenEvent * genEvt = amcProd->GetEvent();
2099 >    lInfo.processID(genEvt->signal_process_id());
2100 >    lInfo.ptHat(genEvt->event_scale());
2101 >  }
2102  
2103 <  lInfo.internalXS(aRunProd->internalXSec().value(),
2076 <                   aRunProd->internalXSec().error());
2103 >  if (aRunProd.isValid()) {
2104  
2105 <  lInfo.externalXSLO(aRunProd->externalXSecLO().value(),
2106 <                     aRunProd->externalXSecLO().error());
2107 <  
2108 <  lInfo.externalXSNLO(aRunProd->externalXSecNLO().value(),
2109 <                      aRunProd->externalXSecNLO().error());
2110 <  
2111 <  lInfo.filterEff(aRunProd->filterEfficiency());
2105 >    lInfo.internalXS(aRunProd->internalXSec().value(),
2106 >        aRunProd->internalXSec().error());
2107 >
2108 >    lInfo.externalXSLO(aRunProd->externalXSecLO().value(),
2109 >        aRunProd->externalXSecLO().error());
2110 >
2111 >    lInfo.externalXSNLO(aRunProd->externalXSecNLO().value(),
2112 >        aRunProd->externalXSecNLO().error());
2113 >
2114 >    lInfo.filterEff(aRunProd->filterEfficiency());
2115 >  }
2116 >
2117 >  if (aInfoProd.isValid()) {
2118 >    lInfo.weight(aInfoProd->weight());
2119 >  }
2120      
2121    event_->generatorInfo(lInfo);
2122  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines