ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/LJMet/Utils/src/PlotReco.cc
(Generate patch)

Comparing UserCode/LJMet/Utils/src/PlotReco.cc (file contents):
Revision 1.1 by kukartse, Tue Nov 10 22:29:35 2009 UTC vs.
Revision 1.2 by kukartse, Wed Dec 2 19:42:47 2009 UTC

# Line 28 | Line 28
28   #include "DataFormats/BeamSpot/interface/BeamSpot.h"
29   #include "DataFormats/EgammaCandidates/interface/GsfElectron.h"
30   #include "DataFormats/Math/interface/deltaR.h"
31 + #include "FWCore/ServiceRegistry/interface/Service.h"
32 + #include "PhysicsTools/UtilAlgos/interface/TFileService.h"
33  
34   using namespace edm;
35  
36   PlotReco::PlotReco(const edm::ParameterSet& iConfig){
37    std::cout << "=======>: PlotReco::PlotReco()" << std::endl;
38 +
39 +  //
40 +  //_____ init TFileService, needed for the output root file
41 +  //
42 +  edm::Service<TFileService> fs;
43 +  _tree = fs->make<TTree>("ttljets", "ttljets", 64000000);
44 +
45 +  irun = 0;
46 +  ievent = 0;
47 +  ilumi = 0;
48 +  njets = 0;
49 +  jet1_pt = -1.0;
50 +  jet1_eta = -1.0;
51 +  jet1_phi = -1.0;
52   }
53  
54  
# Line 49 | Line 65 | PlotReco::analyze(const edm::Event& iEve
65    //
66    //_____ event book keeping
67    //
68 <  unsigned int irun   = (unsigned int)iEvent.id().run();
68 >  irun   = (unsigned int)iEvent.id().run();
69    // this will work starting with CMSSW_340:
70    //unsigned int ilumi  = (unsigned int)iEvent.id().luminosityBlock();
71 <  unsigned int ilumi  = (unsigned int)iEvent.getLuminosityBlock().luminosityBlock();
72 <  unsigned int ievent = (unsigned int)iEvent.id().event();
71 >  ilumi  = (unsigned int)iEvent.getLuminosityBlock().luminosityBlock();
72 >  ievent = (unsigned int)iEvent.id().event();
73    cout << std::endl << "===> Provenance: " << std::endl;
74    cout << "Run, lumi, event: " << irun << ", " << ilumi << ", "<< ievent << std::endl;
75    //
# Line 62 | Line 78 | PlotReco::analyze(const edm::Event& iEve
78    std::cout << std::endl << "===> Check PAT jets: " << std::endl;
79    Handle< vector< reco::CaloJet > > jets;
80    iEvent . getByLabel( "kt4CaloJets", jets );
81 <  int jet_coll_size = jets->size();
82 <  cout << "jet collection size: "<< jet_coll_size << endl;
83 <  if (jet_coll_size>0){
84 <    double _pt = (*jets)[0].pt();
85 <    double _eta = (*jets)[0].eta();
86 <    cout << "pT= " << _pt << ", eta=" << _eta << std::endl;
81 >  njets = jets->size();
82 >  cout << "jet collection size: "<< njets << endl;
83 >  if (njets>0){
84 >    jet1_pt = (*jets)[0].pt();
85 >    jet1_eta = (*jets)[0].eta();
86 >    jet1_phi = (*jets)[0].phi();
87 >    cout << "pT= " << jet1_pt << ", eta=" << jet1_eta << std::endl;
88    }
89    //
90    //_____ check trigger
# Line 98 | Line 115 | PlotReco::analyze(const edm::Event& iEve
115        << "No beam spot available in the event \n";
116    }
117    cout << beamSpot.x0() << "   " << beamSpot.y0() << "   " << beamSpot.z0() << std::endl;
118 +
119 +  //_____ fill the tree
120 +  _tree -> Fill();
121   }
122  
123  
# Line 105 | Line 125 | void
125   PlotReco::beginJob()
126   {
127    std::cout << "=======>: PlotReco::beginJob()" << std::endl;
128 +
129 +  _tree -> Branch("event", &ievent, "event/I" );
130 +  _tree -> Branch("lumi", &ilumi, "lumi/I" );
131 +  _tree -> Branch("run", &irun, "run/I" );
132 +  _tree -> Branch("njets", &njets, "njets/I" );
133 +  _tree -> Branch("jet1_pt", &jet1_pt, "jet1_pt/D" );
134 +  _tree -> Branch("jet1_eta", &jet1_eta, "jet1_eta/D" );
135 +  _tree -> Branch("jet1_phi", &jet1_phi, "jet1_phi/D" );
136   }
137  
138  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines