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/HepMCProduct/interface/HepMCProduct.h"
00015
00016 #include <FWCore/ServiceRegistry/interface/Service.h>
00017 #include <PhysicsTools/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
00036 #include <FWCore/Framework/interface/TriggerNames.h>
00037 #include <DataFormats/Common/interface/TriggerResults.h>
00038 #include <DataFormats/HLTReco/interface/TriggerEvent.h>
00039 #include <DataFormats/HLTReco/interface/TriggerFilterObjectWithRefs.h>
00040
00041 using namespace edm;
00042 using namespace reco;
00043 using namespace trigger;
00044 using std::vector;
00045
00046 class AnalysisRootpleProducer : public edm::EDAnalyzer
00047 {
00048
00049 public:
00050
00051
00052 explicit AnalysisRootpleProducer( const edm::ParameterSet& ) ;
00053 virtual ~AnalysisRootpleProducer() {}
00054
00055
00056 virtual void analyze( const edm::Event&, const edm::EventSetup& ) ;
00057 virtual void beginJob( const edm::EventSetup& ) ;
00058 virtual void endJob() ;
00059
00060 void fillEventInfo(int);
00061 void fillMCParticles(float, float, float, float);
00062 void fillTracks(float, float, float, float);
00063 void fillInclusiveJet(float, float, float, float);
00064 void fillChargedJet(float, float, float, float);
00065 void fillTracksJet(float, float, float, float);
00066 void fillCaloJet(float, float, float, float);
00067 void store();
00068
00069 private:
00070
00071 bool onlyRECO;
00072
00073 InputTag mcEvent;
00074 InputTag genJetCollName;
00075 InputTag chgJetCollName;
00076 InputTag chgGenPartCollName;
00077 InputTag tracksJetCollName;
00078 InputTag recoCaloJetCollName;
00079 InputTag tracksCollName;
00080 InputTag triggerResultsTag;
00081
00082 Handle< HepMCProduct > EvtHandle ;
00083 Handle< vector<GenParticle> > CandHandleMC ;
00084 Handle< GenJetCollection > GenJetsHandle ;
00085 Handle< GenJetCollection > ChgGenJetsHandle ;
00086 Handle< CandidateCollection > CandHandleRECO ;
00087 Handle< BasicJetCollection > TracksJetsHandle ;
00088 Handle< CaloJetCollection > RecoCaloJetsHandle ;
00089 Handle<TriggerResults> triggerResults;
00090
00091 TriggerNames triggerNames;
00092
00093 edm::Service<TFileService> fs;
00094
00095 float piG;
00096
00097 TTree* AnalysisTree;
00098
00099 static const int NMCPMAX = 10000;
00100 static const int NTKMAX = 10000;
00101 static const int NIJMAX = 10000;
00102 static const int NCJMAX = 10000;
00103 static const int NTJMAX = 10000;
00104 static const int NEHJMAX = 10000;
00105
00106 int EventKind,NumberMCParticles,NumberTracks,NumberInclusiveJet,NumberChargedJet,NumberTracksJet,NumberCaloJet;
00107
00108 float MomentumMC[NMCPMAX],TransverseMomentumMC[NMCPMAX],EtaMC[NMCPMAX],PhiMC[NMCPMAX];
00109 float MomentumTK[NTKMAX],TransverseMomentumTK[NTKMAX],EtaTK[NTKMAX],PhiTK[NTKMAX];
00110 float MomentumIJ[NIJMAX],TransverseMomentumIJ[NIJMAX],EtaIJ[NIJMAX],PhiIJ[NIJMAX];
00111 float MomentumCJ[NCJMAX],TransverseMomentumCJ[NCJMAX],EtaCJ[NCJMAX],PhiCJ[NCJMAX];
00112 float MomentumTJ[NTJMAX],TransverseMomentumTJ[NTJMAX],EtaTJ[NTJMAX],PhiTJ[NTJMAX];
00113 float MomentumEHJ[NEHJMAX],TransverseMomentumEHJ[NEHJMAX],EtaEHJ[NEHJMAX],PhiEHJ[NEHJMAX];
00114
00115 TClonesArray* MonteCarlo;
00116 TClonesArray* InclusiveJet;
00117 TClonesArray* ChargedJet;
00118 TClonesArray* Track;
00119 TClonesArray* TracksJet;
00120 TClonesArray* CalorimeterJet;
00121 TClonesArray* acceptedTriggers;
00122 };
00123
00124 #endif