CMS 3D CMS Logo

CMSDAS11DijetTestAnalyzer.cc
Go to the documentation of this file.
1 // CMSDAS11DijetTestAnalyzer.cc
2 // Description: A basic dijet analyzer for the CMSDAS 2011
3 // Author: John Paul Chou
4 // Date: January 12, 2011
5 
7 
12 
15 
18 
19 #include <TH1D.h>
20 #include <TH2D.h>
21 
23  : edm::EDAnalyzer(),
24  jetSrc(params.getParameter<edm::InputTag>("jetSrc")),
25  vertexSrc(params.getParameter<edm::InputTag>("vertexSrc")),
26  jetCorrections(params.getParameter<std::string>("jetCorrections")),
27  innerDeltaEta(params.getParameter<double>("innerDeltaEta")),
28  outerDeltaEta(params.getParameter<double>("outerDeltaEta")),
29  JESbias(params.getParameter<double>("JESbias")) {
30  // setup file service
32 
33  const int NBINS = 36;
34  Double_t BOUNDARIES[NBINS] = {220, 244, 270, 296, 325, 354, 386, 419, 453, 489, 526, 565,
35  606, 649, 693, 740, 788, 838, 890, 944, 1000, 1058, 1118, 1181,
36  1246, 1313, 1383, 1455, 1530, 1607, 1687, 1770, 1856, 1945, 2037, 2132};
37 
38  // setup histograms
39  hVertexZ = fs->make<TH1D>("hVertexZ", "Z position of the Vertex", 50, -20, 20);
40  hJetRawPt = fs->make<TH1D>("hJetRawPt", "Raw Jet Pt", 50, 0, 1000);
41  hJetCorrPt = fs->make<TH1D>("hJetCorrPt", "Corrected Jet Pt", 50, 0, 1000);
42  hJet1Pt = fs->make<TH1D>("hJet1Pt", "Corrected Jet1 Pt", 50, 0, 1000);
43  hJet2Pt = fs->make<TH1D>("hJet2Pt", "Corrected Jet2 Pt", 50, 0, 1000);
44 
45  hJetEta = fs->make<TH1D>("hJetEta", "Corrected Jet Eta", 50, -5, 5);
46  hJet1Eta = fs->make<TH1D>("hJet1Eta", "Corrected Jet1 Eta", 50, -5, 5);
47  hJet2Eta = fs->make<TH1D>("hJet2Eta", "Corrected Jet2 Eta", 50, -5, 5);
48 
49  hJetPhi = fs->make<TH1D>("hJetPhi", "Corrected Jet Phi", 50, -3.1415, 3.1415);
50  hJet1Phi = fs->make<TH1D>("hJet1Phi", "Corrected Jet1 Phi", 50, -3.1415, 3.1415);
51  hJet2Phi = fs->make<TH1D>("hJet2Phi", "Corrected Jet2 Phi", 50, -3.1415, 3.1415);
52 
53  hJetEMF = fs->make<TH1D>("hJetEMF", "EM Fraction of Jets", 50, 0, 1);
54  hJet1EMF = fs->make<TH1D>("hJet1EMF", "EM Fraction of Jet1", 50, 0, 1);
55  hJet2EMF = fs->make<TH1D>("hJet2EMF", "EM Fraction of Jet2", 50, 0, 1);
56 
57  hCorDijetMass = fs->make<TH1D>("hCorDijetMass", "Corrected Dijet Mass", NBINS - 1, BOUNDARIES);
58  hDijetDeltaPhi = fs->make<TH1D>("hDijetDeltaPhi", "Dijet |#Delta #phi|", 50, 0, 3.1415);
59  hDijetDeltaEta = fs->make<TH1D>("hDijetDeltaEta", "Dijet |#Delta #eta|", 50, 0, 1.3);
61  fs->make<TH2D>("hDijetDeltaPhiNJets", "Dijet |#Delta #phi| v. the number of jets", 50, 0, 3.1415, 7, 0.5, 7.5);
62  hDijetEta1Eta2 = fs->make<TH2D>("hDijetEta1Eta2", "Eta 1 versus Eta 2 of dijet events", 50, -5, 5, 50, -5, 5);
63 
64  hInnerDijetMass = fs->make<TH1D>("hInnerDijetMass", "Corrected Inner Dijet Mass", NBINS - 1, BOUNDARIES);
65  hOuterDijetMass = fs->make<TH1D>("hOuterDijetMass", "Corrected Outer Dijet Mass", NBINS - 1, BOUNDARIES);
66 }
67 
69 
72  double mWeight;
74  iEvent.getByLabel("generator", hEventInfo);
75  if (hEventInfo.isValid()) {
76  mWeight = hEventInfo->weight();
77  } else
78  mWeight = 1.;
79 
81  // Get event ID information
83  //int nrun=iEvent.id().run();
84  //int nlumi=iEvent.luminosityBlock();
85  //int nevent=iEvent.id().event();
86 
88  // Get Primary Vertex Information
90 
91  // magic to get the vertices from EDM
93  iEvent.getByLabel(vertexSrc, vertices_h);
94  if (!vertices_h.isValid()) {
95  std::cout << "Didja hear the one about the empty vertex collection?\n";
96  return;
97  }
98 
99  // require in the event that there is at least one reconstructed vertex
100  if (vertices_h->empty())
101  return;
102 
103  // pick the first (i.e. highest sum pt) verte
104  const reco::Vertex* theVertex = &(vertices_h->front());
105 
106  // require that the vertex meets certain criteria
107  if (theVertex->ndof() < 5)
108  return;
109  if (fabs(theVertex->z()) > 24.0)
110  return;
111  if (fabs(theVertex->position().rho()) > 2.0)
112  return;
113 
115  // Get Jet Information
117 
118  // magic to get the jets from EDM
120  iEvent.getByLabel(jetSrc, jets_h);
121  if (!jets_h.isValid()) {
122  std::cout << "Didja hear the one about the empty jet collection?\n";
123  return;
124  }
125 
126  // magic to get the jet energy corrections
128  corrector->vectorialCorrection();
129  // collection of selected jets
130  std::vector<reco::CaloJet> selectedJets;
131 
132  // loop over the jet collection
133  for (reco::CaloJetCollection::const_iterator j_it = jets_h->begin(); j_it != jets_h->end(); j_it++) {
134  reco::CaloJet jet = *j_it;
135 
136  // put the selected jets into a collection
137  selectedJets.push_back(jet);
138  }
139 
140  hVertexZ->Fill(theVertex->z(), mWeight);
141  return;
142 }
143 
CMSDAS11DijetTestAnalyzer::hCorDijetMass
TH1D * hCorDijetMass
Definition: CMSDAS11DijetTestAnalyzer.h:48
reco::CaloJet
Jets made from CaloTowers.
Definition: CaloJet.h:27
MessageLogger.h
NBINS
const int NBINS
Definition: CaloCachedShapeIntegrator.cc:3
CMSDAS11DijetTestAnalyzer::hJet2Phi
TH1D * hJet2Phi
Definition: CMSDAS11DijetTestAnalyzer.h:56
CalibrationSummaryClient_cfi.params
params
Definition: CalibrationSummaryClient_cfi.py:14
reco::Vertex::z
double z() const
z coordinate
Definition: Vertex.h:120
CMSDAS11DijetTestAnalyzer::hJet2Eta
TH1D * hJet2Eta
Definition: CMSDAS11DijetTestAnalyzer.h:55
JetCorrector.h
edm
HLT enums.
Definition: AlignableModifier.h:19
gather_cfg.cout
cout
Definition: gather_cfg.py:144
HLT_FULL_cff.InputTag
InputTag
Definition: HLT_FULL_cff.py:89285
reco::Vertex::position
const Point & position() const
position
Definition: Vertex.h:114
edm::Handle
Definition: AssociativeIterator.h:50
CMSDAS11DijetTestAnalyzer::hDijetDeltaEta
TH1D * hDijetDeltaEta
Definition: CMSDAS11DijetTestAnalyzer.h:59
GenRunInfoProduct.h
JetCorrector
Definition: JetCorrector.h:19
CMSDAS11DijetTestAnalyzer::hJet2EMF
TH1D * hJet2EMF
Definition: CMSDAS11DijetTestAnalyzer.h:57
CMSDAS11DijetTestAnalyzer
Definition: CMSDAS11DijetTestAnalyzer.h:20
pfClustersFromHGC3DClusters_cfi.corrector
corrector
Definition: pfClustersFromHGC3DClusters_cfi.py:5
MakerMacros.h
CMSDAS11DijetTestAnalyzer::hInnerDijetMass
TH1D * hInnerDijetMass
Definition: CMSDAS11DijetTestAnalyzer.h:63
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
Service.h
CMSDAS11DijetTestAnalyzer::endJob
void endJob(void) override
Definition: CMSDAS11DijetTestAnalyzer.cc:68
CMSDAS11DijetTestAnalyzer.h
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
Vertex.h
TFileService.h
edm::ParameterSet
Definition: ParameterSet.h:47
CMSDAS11DijetTestAnalyzer::hJet1EMF
TH1D * hJet1EMF
Definition: CMSDAS11DijetTestAnalyzer.h:53
GenEventInfoProduct.h
CMSDAS11DijetTestAnalyzer::analyze
void analyze(const edm::Event &, const edm::EventSetup &) override
Definition: CMSDAS11DijetTestAnalyzer.cc:70
CMSDAS11DijetTestAnalyzer::hJetCorrPt
TH1D * hJetCorrPt
Definition: CMSDAS11DijetTestAnalyzer.h:41
edm::Service< TFileService >
iEvent
int iEvent
Definition: GenABIO.cc:224
CMSDAS11DijetTestAnalyzer::hJetEta
TH1D * hJetEta
Definition: CMSDAS11DijetTestAnalyzer.h:43
JetCorrector::getJetCorrector
static const JetCorrector * getJetCorrector(const std::string &fName, const edm::EventSetup &fSetup)
retrieve corrector from the event setup. troughs exception if something is missing
Definition: JetCorrector.cc:48
edm::EventSetup
Definition: EventSetup.h:58
CMSDAS11DijetTestAnalyzer::hJetEMF
TH1D * hJetEMF
Definition: CMSDAS11DijetTestAnalyzer.h:45
CMSDAS11DijetTestAnalyzer::CMSDAS11DijetTestAnalyzer
CMSDAS11DijetTestAnalyzer(const edm::ParameterSet &)
Definition: CMSDAS11DijetTestAnalyzer.cc:22
CMSDAS11DijetTestAnalyzer::jetSrc
edm::InputTag jetSrc
Definition: CMSDAS11DijetTestAnalyzer.h:32
CMSDAS11DijetTestAnalyzer::hVertexZ
TH1D * hVertexZ
Definition: CMSDAS11DijetTestAnalyzer.h:40
std
Definition: JetResolutionObject.h:76
CMSDAS11DijetTestAnalyzer::hJet1Phi
TH1D * hJet1Phi
Definition: CMSDAS11DijetTestAnalyzer.h:52
CMSDAS11DijetTestAnalyzer::jetCorrections
std::string jetCorrections
Definition: CMSDAS11DijetTestAnalyzer.h:34
metsig::jet
Definition: SignAlgoResolutions.h:47
CMSDAS11DijetTestAnalyzer::hOuterDijetMass
TH1D * hOuterDijetMass
Definition: CMSDAS11DijetTestAnalyzer.h:64
CMSDAS11DijetTestAnalyzer::hDijetDeltaPhi
TH1D * hDijetDeltaPhi
Definition: CMSDAS11DijetTestAnalyzer.h:58
CMSDAS11DijetTestAnalyzer::hDijetDeltaPhiNJets
TH2D * hDijetDeltaPhiNJets
Definition: CMSDAS11DijetTestAnalyzer.h:60
CMSDAS11DijetTestAnalyzer::hJet1Eta
TH1D * hJet1Eta
Definition: CMSDAS11DijetTestAnalyzer.h:51
objectSelection_cff.selectedJets
selectedJets
Definition: objectSelection_cff.py:99
CMSDAS11DijetTestAnalyzer::hJet2Pt
TH1D * hJet2Pt
Definition: CMSDAS11DijetTestAnalyzer.h:54
pixelTracksMonitoring_cff.vertexSrc
vertexSrc
Definition: pixelTracksMonitoring_cff.py:59
edm::HandleBase::isValid
bool isValid() const
Definition: HandleBase.h:70
edm::Event
Definition: Event.h:73
DisplacedJet_Monitor_cff.jetSrc
jetSrc
Definition: DisplacedJet_Monitor_cff.py:79
reco::Vertex::ndof
double ndof() const
Definition: Vertex.h:110
CMSDAS11DijetTestAnalyzer::hJetRawPt
TH1D * hJetRawPt
Definition: CMSDAS11DijetTestAnalyzer.h:42
CMSDAS11DijetTestAnalyzer::hJet1Pt
TH1D * hJet1Pt
Definition: CMSDAS11DijetTestAnalyzer.h:50
CMSDAS11DijetTestAnalyzer::hDijetEta1Eta2
TH2D * hDijetEta1Eta2
Definition: CMSDAS11DijetTestAnalyzer.h:61
CMSDAS11DijetTestAnalyzer::vertexSrc
edm::InputTag vertexSrc
Definition: CMSDAS11DijetTestAnalyzer.h:33
reco::Vertex
Definition: Vertex.h:35
TFileService::make
T * make(const Args &... args) const
make new ROOT object
Definition: TFileService.h:64
CMSDAS11DijetTestAnalyzer::hJetPhi
TH1D * hJetPhi
Definition: CMSDAS11DijetTestAnalyzer.h:44
GenEventInfoProduct::weight
double weight() const
Definition: GenEventInfoProduct.h:35