CMS 3D CMS Logo

/data/doxygen/doxygen-1.7.3/gen/CMSSW_4_2_8/src/QCDAnalysis/UEAnalysis/interface/AnalysisRootpleProducer.h

Go to the documentation of this file.
00001 #ifndef AnalysisRootpleProducer_H
00002 #define AnalysisRootpleProducer_H
00003 
00004 #include <iostream>
00005 
00006 #include <FWCore/Framework/interface/Event.h>
00007 #include <FWCore/Framework/interface/ESHandle.h>
00008 #include <FWCore/Framework/interface/MakerMacros.h>
00009 #include <FWCore/Framework/interface/Frameworkfwd.h>
00010 #include <FWCore/ParameterSet/interface/ParameterSet.h>
00011 #include <DataFormats/Common/interface/Handle.h>
00012 
00013 #include "FWCore/Framework/interface/EDAnalyzer.h"
00014 #include "SimDataFormats/GeneratorProducts/interface/HepMCProduct.h"
00015 
00016 #include <FWCore/ServiceRegistry/interface/Service.h>
00017 #include <CommonTools/UtilAlgos/interface/TFileService.h>
00018 
00019 #include <TROOT.h>
00020 #include <TTree.h>
00021 #include <TFile.h>
00022 #include <TLorentzVector.h>
00023 #include <TObjString.h>
00024 #include <TClonesArray.h>
00025 
00026 #include "DataFormats/JetReco/interface/Jet.h"
00027 #include "DataFormats/JetReco/interface/GenJet.h"
00028 #include "DataFormats/JetReco/interface/GenJetCollection.h"
00029 #include "DataFormats/JetReco/interface/CaloJetCollection.h"
00030 #include "DataFormats/JetReco/interface/BasicJet.h"
00031 #include "DataFormats/JetReco/interface/BasicJetCollection.h"
00032 #include "DataFormats/Candidate/interface/Candidate.h"
00033 #include "DataFormats/HepMCCandidate/interface/GenParticle.h"
00034 
00035 // access trigger results
00036 #include <DataFormats/Common/interface/TriggerResults.h>
00037 #include <DataFormats/HLTReco/interface/TriggerEvent.h> 
00038 #include <DataFormats/HLTReco/interface/TriggerFilterObjectWithRefs.h>
00039 
00040 class AnalysisRootpleProducer : public edm::EDAnalyzer
00041 {
00042   
00043 public:
00044   
00045   //
00046   explicit AnalysisRootpleProducer( const edm::ParameterSet& ) ;
00047   virtual ~AnalysisRootpleProducer() {} // no need to delete ROOT stuff
00048   // as it'll be deleted upon closing TFile
00049   
00050   virtual void analyze( const edm::Event&, const edm::EventSetup& ) ;
00051   virtual void beginJob() ;
00052   virtual void endJob() ;
00053   
00054   void fillEventInfo(int);
00055   void fillMCParticles(float, float, float, float);
00056   void fillTracks(float, float, float, float);
00057   void fillInclusiveJet(float, float, float, float);
00058   void fillChargedJet(float, float, float, float);
00059   void fillTracksJet(float, float, float, float);
00060   void fillCaloJet(float, float, float, float);
00061   void store();
00062 
00063 private:
00064   
00065   bool onlyRECO;
00066 
00067   edm::InputTag mcEvent; // label of MC event
00068   edm::InputTag genJetCollName; // label of Jet made with MC particles
00069   edm::InputTag chgJetCollName; // label of Jet made with only charged MC particles
00070   edm::InputTag chgGenPartCollName; // label of charged MC particles
00071   edm::InputTag tracksJetCollName;
00072   edm::InputTag recoCaloJetCollName;
00073   edm::InputTag tracksCollName;
00074   edm::InputTag triggerResultsTag;
00075 
00076   edm::Handle< edm::HepMCProduct         > EvtHandle ;
00077   edm::Handle< std::vector<reco::GenParticle> > CandHandleMC ;
00078   edm::Handle< reco::GenJetCollection    > GenJetsHandle ;
00079   edm::Handle< reco::GenJetCollection    > ChgGenJetsHandle ;
00080   edm::Handle< reco::CandidateCollection > CandHandleRECO ;
00081   edm::Handle< reco::BasicJetCollection  > TracksJetsHandle ;
00082   edm::Handle< reco::CaloJetCollection   > RecoCaloJetsHandle ;
00083   edm::Handle< edm::TriggerResults       > triggerResults;
00084   //  edm::Handle<TriggerFilterObjectWithRefs> hltFilter; // not used at the moment: can access objects that fired the trigger
00085 
00086   edm::Service<TFileService> fs;
00087 
00088   float piG;
00089 
00090   TTree* AnalysisTree;
00091 
00092   static const int NMCPMAX = 10000;   
00093   static const int NTKMAX = 10000;
00094   static const int NIJMAX = 10000;
00095   static const int NCJMAX = 10000;
00096   static const int NTJMAX = 10000;
00097   static const int NEHJMAX = 10000;
00098 
00099   int EventKind,NumberMCParticles,NumberTracks,NumberInclusiveJet,NumberChargedJet,NumberTracksJet,NumberCaloJet;
00100   
00101   float MomentumMC[NMCPMAX],TransverseMomentumMC[NMCPMAX],EtaMC[NMCPMAX],PhiMC[NMCPMAX];
00102   float MomentumTK[NTKMAX],TransverseMomentumTK[NTKMAX],EtaTK[NTKMAX],PhiTK[NTKMAX];
00103   float MomentumIJ[NIJMAX],TransverseMomentumIJ[NIJMAX],EtaIJ[NIJMAX],PhiIJ[NIJMAX];
00104   float MomentumCJ[NCJMAX],TransverseMomentumCJ[NCJMAX],EtaCJ[NCJMAX],PhiCJ[NCJMAX];
00105   float MomentumTJ[NTJMAX],TransverseMomentumTJ[NTJMAX],EtaTJ[NTJMAX],PhiTJ[NTJMAX];
00106   float MomentumEHJ[NEHJMAX],TransverseMomentumEHJ[NEHJMAX],EtaEHJ[NEHJMAX],PhiEHJ[NEHJMAX];
00107 
00108   TClonesArray* MonteCarlo;
00109   TClonesArray* InclusiveJet;
00110   TClonesArray* ChargedJet;
00111   TClonesArray* Track;
00112   TClonesArray* TracksJet;
00113   TClonesArray* CalorimeterJet;
00114   TClonesArray* acceptedTriggers;
00115 };
00116 
00117 #endif