CMS 3D CMS Logo

Functions
PatMcMatchFWLiteAnalyzer.cc File Reference
#include <memory>
#include <string>
#include <vector>
#include <sstream>
#include <fstream>
#include <iostream>
#include <TH2F.h>
#include <TROOT.h>
#include <TFile.h>
#include <TSystem.h>
#include "DataFormats/FWLite/interface/Handle.h"
#include "DataFormats/PatCandidates/interface/Muon.h"
#include "DataFormats/PatCandidates/interface/Jet.h"
#include "FWCore/FWLite/interface/FWLiteEnabler.h"

Go to the source code of this file.

Functions

int main (int argc, char *argv[])
 

Function Documentation

◆ main()

int main ( int  argc,
char *  argv[] 
)

===============================================================================================================================================================================================


variant2: for each run define phi-averaged A for normalization channel (Dref,16) and then, divide Rijk on it, i.e. get RRijk




















































































eta=27

eta=25

eta=23

eta=22

eta=21

eta=26

eta=24

eta=19

eta=17

eta=25

eta=23

eta=22

eta=21

eta=26

eta=24

eta=20

eta=19

eta=18

eta=27 L1=1

eta=25 L1=1

eta=23 L1=1

eta=22 L1=1

eta=21 L1=1

eta=29 L1=1

eta=26 L1=1

eta=24 L1=1

eta=20 L1=1

eta=19 L1=1

eta=18 L1=1

eta=17 L1=1

eta=28 L7=1

eta=27 L7=1

eta=25 L7=1

eta=23 L7=1

eta=22 L7=1

eta=21 L7=1

eta=26 L7=1

eta=24 L7=1

eta=20 L7=1

eta=19 L7=1

eta=18 L7=1

eta=17 L7=1

eta=27

eta=25

eta=23

eta=22

eta=21

eta=26

eta=24

eta=19

eta=17

eta=25

eta=23

eta=22

eta=21

eta=26

eta=24

eta=20

eta=19

eta=18

eta=27 L1=1

eta=25 L1=1

eta=23 L1=1

eta=22 L1=1

eta=21 L1=1

eta=26 L1=1

eta=24 L1=1

eta=20 L1=1

eta=19 L1=1

eta=18 L1=1

eta=17 L1=1

eta=28 L7=1

eta=27 L7=1

eta=25 L7=1

eta=23 L7=1

eta=22 L7=1

eta=21 L7=1

eta=26 L7=1

eta=24 L7=1

eta=20 L7=1

eta=19 L7=1

eta=18 L7=1

eta=17 L7=1

eta=27

eta=28

errA with average Amplitudes

errA with average Amplitudes

errA with average Amplitudes

errA with average Amplitudes

Summed Amplitude Plots:





Summed Amplitude Plots:

Summed Amplitude Plots:

Summed Amplitude Plots:

Summed Amplitude Plots:

Summed Amplitude Plots:

RBX:

errA with average Amplitudes

errA with average Amplitudes

errA with average Amplitudes

errA with average Amplitudes

Summed Amplitude Plots:





Summed Amplitude Plots:

Summed Amplitude Plots:

Summed Amplitude Plots:

Summed Amplitude Plots:

Summed Amplitude Plots:

RBX:

errA with average Amplitudes

errA with average Amplitudes

errA with average Amplitudes

errA with average Amplitudes

Summed Amplitude Plots:





Summed Amplitude Plots:

Summed Amplitude Plots:

Summed Amplitude Plots:

Summed Amplitude Plots:

Summed Amplitude Plots:

RBX:

Prepare maps of good/bad channels:

Prepare maps of good/bad channels:

Prepare maps of good/bad channels:

Prepare maps of good/bad channels:


CALO JETS


PF JETS

Definition at line 19 of file PatMcMatchFWLiteAnalyzer.cc.

References gather_cfg::cout, FWLiteEnabler::enable(), edmPickEvents::event, mps_fire::i, iEvent, PDWG_EXODelayedJetMET_cff::jets, PDWG_BPHSkim_cff::muons, L1TdeCSCTF_cfi::outFile, and reco::LeafCandidate::pt().

20 {
21  // ----------------------------------------------------------------------
22  // First Part:
23  //
24  // * enable FWLite
25  // * book the histograms of interest
26  // * open the input file
27  // ----------------------------------------------------------------------
28 
29  // load framework libraries
30  gSystem->Load( "libFWCoreFWLite" );
32 
33  // book a set of histograms
34  TH2F* muonPt_ = new TH2F( "muonPt", "Muon Pt", 60, 0., 300., 60, 0., 300. ); // 2-D histo for muon Pt
35  muonPt_->SetXTitle( "gen." );
36  muonPt_->SetYTitle( "reco." );
37  TH2F* jetPt_ = new TH2F( "jetPt", "Jet Pt", 100, 0., 500., 100, 0., 500. ); // 2-D histo for jet Pt
38  jetPt_->SetXTitle( "gen." );
39  jetPt_->SetYTitle( "reco." );
40 
41  // open input file (can be located on castor)
42  TFile* inFile = TFile::Open( "file:edmPatMcMatch.root" ); // Adapt the input file name
43 
44  // ----------------------------------------------------------------------
45  // Second Part:
46  //
47  // * loop the events in the input file
48  // * receive the collections of interest via fwlite::Handle
49  // * fill the histograms
50  // * after the loop close the input file
51  // ----------------------------------------------------------------------
52 
53  // loop the events
54  unsigned int iEvent=0;
55  fwlite::Event event(inFile);
56  for(event.toBegin(); !event.atEnd(); ++event, ++iEvent){
57  // break loop after end of file is reached
58  // or after 1000 events have been processed
59  if( iEvent==1000 ) break;
60 
61  // simple event counter
62  if(iEvent>0 && iEvent%25==0){ // Reduce print-out
63  std::cout << " processing event: " << iEvent << std::endl;
64  }
65 
66  // fwlite::Handle to the muon collection
67  fwlite::Handle<std::vector<pat::Muon> > muons; // Access the muon collection
68  muons.getByLabel(event, "cleanLayer1Muons");
69  // fwlite::Handle to the muon collection
70  fwlite::Handle<std::vector<pat::Jet> > jets; // Access the jet collection
71  jets.getByLabel(event, "cleanLayer1Jets");
72 
73  // loop muon collection and fill histograms
74  for(unsigned i=0; i<muons->size(); ++i){
75  const reco::GenParticle * genMuon = (*muons)[i].genParticle(); // Get the matched generator muon
76  if ( genMuon ) { // Check for valid reference
77  muonPt_->Fill( genMuon->pt(), (*muons)[i].pt() ); // Fill 2-D histo
78  }
79  }
80  // loop jet collection and fill histograms
81  for(unsigned i=0; i<jets->size(); ++i){
82  const reco::GenJet * genJet = (*jets)[i].genJet(); // Get the matched generator jet
83  if ( genJet ) { // Check for valid reference
84  jetPt_->Fill( genJet->pt(), (*jets)[i].pt() ); // Fill 2-D histo
85  }
86  }
87  }
88  // close input file
89  inFile->Close();
90 
91  // ----------------------------------------------------------------------
92  // Third Part:
93  //
94  // * open the output file
95  // * write the histograms to the output file
96  // * close the output file
97  // ----------------------------------------------------------------------
98 
99  //open output file
100  TFile outFile( "rootPatMcMatch.root", "recreate" ); // Adapt the output file name
101  outFile.mkdir("analyzeMcMatchPat"); // Adapt output file according to modifications
102  outFile.cd("analyzeMcMatchPat");
103  muonPt_->Write( );
104  jetPt_->Write( );
105  outFile.Close();
106 
107  // ----------------------------------------------------------------------
108  // Fourth Part:
109  //
110  // * never forgett to free the memory of the histograms
111  // ----------------------------------------------------------------------
112 
113  // free allocated space
114  delete muonPt_; // Delete the muon histo
115  delete jetPt_; // Delete the jet histo
116 
117  // that's it!
118  return 0;
119 }
double pt() const final
transverse momentum
int iEvent
Definition: GenABIO.cc:224
static void enable()
enable automatic library loading
Jets made from MC generator particles.
Definition: GenJet.h:23
Definition: event.py:1