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.18 by amagnan, Fri Jun 4 17:11:48 2010 UTC vs.
Revision 1.19 by amagnan, Thu Jun 24 13:41:56 2010 UTC

# Line 4 | Line 4
4   #include "DataFormats/Common/interface/ValueMap.h"
5   #include "DataFormats/Candidate/interface/Candidate.h"
6   #include "DataFormats/HepMCCandidate/interface/GenParticle.h"
7 +
8   #include "DataFormats/MuonReco/interface/Muon.h"
9   #include "DataFormats/MuonReco/interface/MuonFwd.h"
10   #include "DataFormats/MuonReco/interface/MuonSelectors.h"
# Line 18 | Line 19
19   #include "DataFormats/PatCandidates/interface/Jet.h"
20   #include "DataFormats/PatCandidates/interface/MET.h"
21  
22 + #include "SimDataFormats/GeneratorProducts/interface/GenRunInfoProduct.h"
23 + #include "SimDataFormats/GeneratorProducts/interface/HepMCProduct.h"
24 +
25   #include "FWCore/ServiceRegistry/interface/Service.h"
26 + #include "FWCore/Framework/interface/Run.h"
27   #include "CommonTools/UtilAlgos/interface/TFileService.h"
28  
24
29   #include "UserCode/HbbAnalysis/interface/Electron.hh"
30   #include "UserCode/HbbAnalysis/interface/Muon.hh"
31   #include "UserCode/HbbAnalysis/interface/Tau.hh"
# Line 121 | Line 125 | void HbbTreeMaker::analyze(const edm::Ev
125    event_->lumiBlock(aEvt.luminosityBlock());
126    event_->isRealData(aEvt.isRealData());
127  
128 +
129 +  if (!processData_) {
130 +    edm::Handle<edm::HepMCProduct> mcProd;
131 +    edm::Handle<GenRunInfoProduct> lRunProd;
132 +    try {
133 +      aEvt.getByLabel("generator", mcProd );
134 +    } catch(cms::Exception& e)  {
135 +      std::cout << "AMM: Collection HepMCProduct not available! Exception : " << e.what() << ". " << std::endl;
136 +    }
137 +    try {
138 +      aEvt.getRun().getByLabel("generator",lRunProd);
139 +    } catch(cms::Exception& e)  {
140 +      std::cout << "AMM: Collection GenInfoProduct not available! Exception : " << e.what() << ". " << std::endl;
141 +    }
142 +
143 +    HbbGenInfo(mcProd,lRunProd);
144 +  }
145 +
146    edm::Handle<reco::GenParticleCollection> lGenParticles;
147    try {
148      aEvt.getByLabel(genParticleSrc_,lGenParticles);  
# Line 1390 | Line 1412 | void HbbTreeMaker::HbbL1Objects(const ed
1412      }
1413  
1414   }
1415 +
1416   void HbbTreeMaker::HbbHLTObjects(const edm::Handle<trigger::TriggerEvent> & aCol,
1417                                   std::vector<HbbAnalysis::HLTObject> & aVec)
1418   {
# Line 1426 | Line 1449 | void HbbTreeMaker::HbbHLTObjects(const e
1449  
1450   }
1451  
1452 + void HbbTreeMaker::HbbGenInfo(const edm::Handle<edm::HepMCProduct> & amcProd,
1453 +                              const edm::Handle<GenRunInfoProduct> & aRunProd)
1454 + {
1455 +  const HepMC::GenEvent * genEvt = amcProd->GetEvent();
1456 +  HbbAnalysis::GenInfo lInfo;
1457 +
1458 +  lInfo.processID(genEvt->signal_process_id());
1459 +  lInfo.ptHat(genEvt->event_scale());
1460 +
1461 +  lInfo.internalXS(aRunProd->internalXSec().value(),
1462 +                   aRunProd->internalXSec().error());
1463  
1464 +  lInfo.externalXSLO(aRunProd->externalXSecLO().value(),
1465 +                     aRunProd->externalXSecLO().error());
1466 +  
1467 +  lInfo.externalXSNLO(aRunProd->externalXSecNLO().value(),
1468 +                      aRunProd->externalXSecNLO().error());
1469 +  
1470 +  lInfo.filterEff(aRunProd->filterEfficiency());
1471 +    
1472 +  event_->generatorInfo(lInfo);
1473 +
1474 + }
1475 +
1476   #include "FWCore/Framework/interface/MakerMacros.h"
1477   DEFINE_FWK_MODULE(HbbTreeMaker);
1478  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines