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

Comparing UserCode/MPIAnalyzer/src/MPIntuple.cc (file contents):
Revision 1.24 by naodell, Mon Nov 29 13:09:04 2010 UTC vs.
Revision 1.25 by naodell, Tue Nov 30 14:08:14 2010 UTC

# Line 47 | Line 47
47   // ntuple storage classes
48   #include "TCJet.h"
49   #include "TCPrimaryVtx.h"
50 + #include "TCGenJet.h"
51  
52   // Need for HLT trigger info:
53   #include "FWCore/Common/interface/TriggerNames.h"
# Line 105 | Line 106 | class MPIntuple : public edm::EDAnalyzer
106    TFile* ntupleFile;
107  
108    TClonesArray* jet_ak5PF;
109 <  TClonesArray* jetP4_ak5Gen;
109 >  TClonesArray* jet_ak5Gen;
110    TClonesArray* primaryVtx;
111  
112    bool doGenJets_;
# Line 409 | Line 410 | void MPIntuple::analyze(const edm::Event
410        
411        if(myJet.pt() > 5){
412          
413 <        new ((*jetP4_ak5Gen)[genCount]) TLorentzVector(myJet.px(), myJet.py(), myJet.pz(), myJet.energy());
413 >        TCGenJet* jetCon = new ((*jet_ak5Gen)[genCount]) TCGenJet;
414 >
415 >        jetCon->SetP4(myJet.px(), myJet.py(), myJet.pz(), myJet.energy());
416 >
417 >        jetCon->SetHadEnergy(myJet.hadEnergy());
418 >        jetCon->SetEmEnergy(myJet.emEnergy());
419 >        jetCon->SetInvEnergy(myJet.invisibleEnergy());
420 >        jetCon->SetAuxEnergy(myJet.auxiliaryEnergy());
421 >        jetCon->SetNumConstit(myJet.getGenConstituents().size());
422  
423          const reco::GenParticle *myGenParticle = myJet.getGenConstituent(0);
424          const reco::Candidate   *myMother      = myGenParticle->mother();
# Line 418 | Line 427 | void MPIntuple::analyze(const edm::Event
427          for(int iter = 0; nGrandMas != 0; ++iter)
428          {
429            myMother  = myMother->mother();
430 <          nGrandMas = myMother->mother()->numberOfMothers();
430 >          nGrandMas = myMother->mother()->numberOfMothers();                
431          }
432          //cout<<myJet.print()<<endl;
433 <        cout<<"Jet flavor: "<< myMother->pdgId()<<endl;
433 >        //cout<<"Jet flavor: "<< myMother->pdgId()<<endl;
434 >        jetCon->SetJetFlavor(myMother->pdgId());        
435          ++genCount;
436          
437        }
# Line 502 | Line 512 | void MPIntuple::analyze(const edm::Event
512  
513    jet_ak5PF->Clear();
514    primaryVtx->Clear();
515 <  jetP4_ak5Gen->Clear();
515 >  jet_ak5Gen->Clear();
516  
517   }
518  
# Line 524 | Line 534 | void  MPIntuple::beginJob()
534    p1_nVtcs                 = new TProfile("p1_nVtcs", "<N> per run", 5200.0, 132300.0, 137500.0, 0.0, 6.0);
535  
536    jet_ak5PF                = new TClonesArray("TCJet");
537 <  jetP4_ak5Gen             = new TClonesArray("TLorentzVector");
537 >  jet_ak5Gen               = new TClonesArray("TCGenJet");
538    primaryVtx               = new TClonesArray("TCPrimaryVtx");
539  
540  
541    sTree->Branch("jet_ak5PF",&jet_ak5PF, 6400, 0);
542 <  sTree->Branch("jetP4_ak5Gen",&jetP4_ak5Gen, 6400, 0);
542 >  sTree->Branch("jet_ak5Gen",&jet_ak5Gen, 6400, 0);
543    sTree->Branch("primaryVtx",&primaryVtx, 6400, 0);
544  
545    sTree->Branch("eventNumber",&eventNumber, "eventNumber/I");

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines