CMS 3D CMS Logo

Functions
PatCleaningExercise.cc File Reference
#include <vector>
#include "TH1.h"
#include "TFile.h"
#include <TROOT.h>
#include <TSystem.h>
#include "DataFormats/Math/interface/deltaR.h"
#include "DataFormats/FWLite/interface/Event.h"
#include "DataFormats/Common/interface/Handle.h"
#include "DataFormats/PatCandidates/interface/Jet.h"
#include "FWCore/ParameterSet/interface/ProcessDesc.h"
#include "FWCore/FWLite/interface/FWLiteEnabler.h"
#include "PhysicsTools/FWLite/interface/TFileService.h"
#include "FWCore/ParameterSetReader/interface/ProcessDescImpl.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:


CALO JETS


PF JETS

Definition at line 21 of file PatCleaningExercise.cc.

21  {
22  // ----------------------------------------------------------------------
23  // First Part:
24  //
25  // * enable FWLite
26  // * book the histograms of interest
27  // * open the input file
28  // ----------------------------------------------------------------------
29 
30  // load framework libraries
31  gSystem->Load("libFWCoreFWLite");
33 
34  // only allow one argument for this simple example which should be the
35  // the python cfg file
36  if (argc < 2) {
37  std::cout << "Usage : " << argv[0] << " [parameters.py]" << std::endl;
38  return 0;
39  }
40 
41  // get the python configuration
42  ProcessDescImpl builder(argv[1]);
43  const edm::ParameterSet& fwliteParameters =
44  builder.processDesc()->getProcessPSet()->getParameter<edm::ParameterSet>("FWLiteParams");
45 
46  // now get each parameter
47  std::string input_(fwliteParameters.getParameter<std::string>("inputFile"));
48  std::string output_(fwliteParameters.getParameter<std::string>("outputFile"));
49  std::string overlaps_(fwliteParameters.getParameter<std::string>("overlaps"));
50  edm::InputTag jets_(fwliteParameters.getParameter<edm::InputTag>("jets"));
51 
52  // book a set of histograms
54  TFileDirectory theDir = fs.mkdir("analyzePatCleaning");
55  TH1F* emfAllJets_ = theDir.make<TH1F>("emfAllJets", "f_{emf}(All Jets)", 20, 0., 1.);
56  TH1F* emfCleanJets_ = theDir.make<TH1F>("emfCleanJets", "f_{emf}(Clean Jets)", 20, 0., 1.);
57  TH1F* emfOverlapJets_ = theDir.make<TH1F>("emfOverlapJets", "f_{emf}(Overlap Jets)", 20, 0., 1.);
58  TH1F* deltaRElecJet_ = theDir.make<TH1F>("deltaRElecJet", "#DeltaR (elec, jet)", 10, 0., 0.5);
59  TH1F* elecOverJet_ = theDir.make<TH1F>("elecOverJet", "E_{elec}/E_{jet}", 100, 0., 2.);
60  TH1F* nOverlaps_ = theDir.make<TH1F>("nOverlaps", "Number of overlaps", 5, 0., 5.);
61 
62  // open input file (can be located on castor)
63  TFile* inFile = TFile::Open(input_.c_str());
64 
65  // ----------------------------------------------------------------------
66  // Second Part:
67  //
68  // * loop the events in the input file
69  // * receive the collections of interest via fwlite::Handle
70  // * fill the histograms
71  // * after the loop close the input file
72  // ----------------------------------------------------------------------
73 
74  // loop the events
75  unsigned int iEvent = 0;
76  fwlite::Event ev(inFile);
77  for (ev.toBegin(); !ev.atEnd(); ++ev, ++iEvent) {
78  edm::EventBase const& event = ev;
79 
80  // break loop after end of file is reached
81  // or after 1000 events have been processed
82  if (iEvent == 1000)
83  break;
84 
85  // simple event counter
86  if (iEvent > 0 && iEvent % 1 == 0) {
87  std::cout << " processing event: " << iEvent << std::endl;
88  }
89 
90  // handle to jet collection
92  event.getByLabel(jets_, jets);
93 
94  // loop over the jets in the event
95  for (std::vector<pat::Jet>::const_iterator jet = jets->begin(); jet != jets->end(); jet++) {
96  if (jet->pt() > 20 && jet == jets->begin()) {
97  emfAllJets_->Fill(jet->emEnergyFraction());
98  if (!jet->hasOverlaps(overlaps_)) {
99  emfCleanJets_->Fill(jet->emEnergyFraction());
100  } else {
101  //get all overlaps
102  const reco::CandidatePtrVector overlaps = jet->overlaps(overlaps_);
103  nOverlaps_->Fill(overlaps.size());
104  emfOverlapJets_->Fill(jet->emEnergyFraction());
105  //loop over the overlaps
107  overlap++) {
108  float deltaR = reco::deltaR((*overlap)->eta(), (*overlap)->phi(), jet->eta(), jet->phi());
109  deltaRElecJet_->Fill(deltaR);
110  elecOverJet_->Fill((*overlap)->energy() / jet->energy());
111  }
112  }
113  }
114  }
115  }
116  inFile->Close();
117  return 0;
118 }

References dir2webdir::argc, cmsBatch::argv, gather_cfg::cout, reco::deltaR(), PbPb_ZMuSkimMuonDPG_cff::deltaR, FWLiteEnabler::enable(), ev, edm::ParameterSet::getParameter(), iEvent, metsig::jet, singleTopDQM_cfi::jets, TFileDirectory::make(), TFileDirectory::mkdir(), muon::overlap(), analyzePatCleaning_cfg::overlaps, PyBind11ProcessDesc::processDesc(), AlCaHLTBitMon_QueryRunRegistry::string, and align_cfg::TFileService.

TFileDirectory::mkdir
TFileDirectory mkdir(const std::string &dir, const std::string &descr="")
create a new subdirectory
Definition: TFileDirectory.cc:112
cmsBatch.argv
argv
Definition: cmsBatch.py:279
dir2webdir.argc
argc
Definition: dir2webdir.py:39
gather_cfg.cout
cout
Definition: gather_cfg.py:144
edm::PtrVectorItr
Definition: PtrVector.h:51
singleTopDQM_cfi.jets
jets
Definition: singleTopDQM_cfi.py:42
TFileDirectory
Definition: TFileDirectory.h:24
align_cfg.TFileService
TFileService
Definition: align_cfg.py:143
edm::Handle
Definition: AssociativeIterator.h:50
edm::PtrVector< Candidate >
PbPb_ZMuSkimMuonDPG_cff.deltaR
deltaR
Definition: PbPb_ZMuSkimMuonDPG_cff.py:63
PyBind11ProcessDesc
Definition: PyBind11ProcessDesc.h:16
analyzePatCleaning_cfg.overlaps
overlaps
Definition: analyzePatCleaning_cfg.py:9
FWLiteEnabler::enable
static void enable()
enable automatic library loading
Definition: FWLiteEnabler.cc:46
edm::ParameterSet
Definition: ParameterSet.h:47
iEvent
int iEvent
Definition: GenABIO.cc:224
muon::overlap
bool overlap(const reco::Muon &muon1, const reco::Muon &muon2, double pullX=1.0, double pullY=1.0, bool checkAdjacentChambers=false)
Definition: MuonSelectors.cc:791
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
fwlite::Event
Definition: Event.h:87
metsig::jet
Definition: SignAlgoResolutions.h:47
ev
bool ev
Definition: Hydjet2Hadronizer.cc:97
edm::EventBase
Definition: EventBase.h:46
TFileDirectory::make
T * make(const Args &...args) const
make new ROOT object
Definition: TFileDirectory.h:53
fwlite::TFileService
Definition: TFileService.h:12
reco::deltaR
constexpr auto deltaR(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
Definition: deltaR.h:30
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
edm::InputTag
Definition: InputTag.h:15