CMS 3D CMS Logo

Functions
PatBasicFWLiteJetAnalyzer.cc File Reference
#include <memory>
#include <string>
#include <vector>
#include <sstream>
#include <fstream>
#include <iostream>
#include <TH1F.h>
#include <TROOT.h>
#include <TFile.h>
#include <TSystem.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:

Definition at line 21 of file PatBasicFWLiteJetAnalyzer.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  edm::InputTag jets_(fwliteParameters.getParameter<edm::InputTag>("jets"));
50 
51  // book a set of histograms
53  TFileDirectory theDir = fs.mkdir("analyzeBasicPat");
54  TH1F* jetPt_ = theDir.make<TH1F>("jetPt", "pt", 100, 0., 300.);
55  TH1F* jetEta_ = theDir.make<TH1F>("jetEta", "eta", 100, -3., 3.);
56  TH1F* jetPhi_ = theDir.make<TH1F>("jetPhi", "phi", 100, -5., 5.);
57  TH1F* disc_ = theDir.make<TH1F>("disc", "Discriminant", 100, 0.0, 10.0);
58  TH1F* constituentPt_ = theDir.make<TH1F>("constituentPt", "Constituent pT", 100, 0, 300.0);
59 
60  // open input file (can be located on castor)
61  TFile* inFile = TFile::Open(input_.c_str());
62 
63  // ----------------------------------------------------------------------
64  // Second Part:
65  //
66  // * loop the events in the input file
67  // * receive the collections of interest via fwlite::Handle
68  // * fill the histograms
69  // * after the loop close the input file
70  // ----------------------------------------------------------------------
71 
72  // loop the events
73  unsigned int iEvent = 0;
74  fwlite::Event ev(inFile);
75  for (ev.toBegin(); !ev.atEnd(); ++ev, ++iEvent) {
76  edm::EventBase const& event = ev;
77 
78  // break loop after end of file is reached
79  // or after 1000 events have been processed
80  if (iEvent == 1000)
81  break;
82 
83  // simple event counter
84  if (iEvent > 0 && iEvent % 1 == 0) {
85  std::cout << " processing event: " << iEvent << std::endl;
86  }
87 
88  // Handle to the jet collection
91  event.getByLabel(jets_, jets);
92 
93  // loop jet collection and fill histograms
94  for (unsigned i = 0; i < jets->size(); ++i) {
95  // basic kinematics
96  jetPt_->Fill((*jets)[i].pt());
97  jetEta_->Fill((*jets)[i].eta());
98  jetPhi_->Fill((*jets)[i].phi());
99  // access tag infos
100  reco::SecondaryVertexTagInfo const* svTagInfos = (*jets)[i].tagInfoSecondaryVertex("secondaryVertex");
101  if (svTagInfos != nullptr) {
102  if (svTagInfos->nVertices() > 0) {
103  disc_->Fill(svTagInfos->flightDistance(0).value());
104  }
105  }
106  // access calo towers
107  std::vector<reco::PFCandidatePtr> const& pfConstituents = (*jets)[i].getPFConstituents();
108  for (std::vector<reco::PFCandidatePtr>::const_iterator ibegin = pfConstituents.begin(),
109  iend = pfConstituents.end(),
110  iconstituent = ibegin;
111  iconstituent != iend;
112  ++iconstituent) {
113  constituentPt_->Fill((*iconstituent)->pt());
114  }
115  }
116  }
117  // close input file
118  inFile->Close();
119 
120  // ----------------------------------------------------------------------
121  // Third Part:
122  //
123  // * never forget to free the memory of objects you created
124  // ----------------------------------------------------------------------
125 
126  // in this example there is nothing to do
127 
128  // that's it!
129  return 0;
130 }

References dir2webdir::argc, cmsBatch::argv, gather_cfg::cout, FWLiteEnabler::enable(), PVValHelper::eta, ev, edm::ParameterSet::getParameter(), mps_fire::i, iEvent, commonCuts_cff::jetLabel, singleTopDQM_cfi::jets, TFileDirectory::make(), TFileDirectory::mkdir(), PVValHelper::phi, PyBind11ProcessDesc::processDesc(), DiDispStaMuonMonitor_cfi::pt, AlCaHLTBitMon_QueryRunRegistry::string, HLT_FULL_cff::svTagInfos, 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
mps_fire.i
i
Definition: mps_fire.py:428
dir2webdir.argc
argc
Definition: dir2webdir.py:39
DiDispStaMuonMonitor_cfi.pt
pt
Definition: DiDispStaMuonMonitor_cfi.py:39
TFileDirectory::make
T * make(const Args &... args) const
make new ROOT object
Definition: TFileDirectory.h:53
gather_cfg.cout
cout
Definition: gather_cfg.py:144
reco::TemplatedSecondaryVertexTagInfo
Definition: TemplatedSecondaryVertexTagInfo.h:47
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
HLT_FULL_cff.svTagInfos
svTagInfos
Definition: HLT_FULL_cff.py:52123
commonCuts_cff.jetLabel
jetLabel
Definition: commonCuts_cff.py:15
PVValHelper::eta
Definition: PVValidationHelpers.h:70
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
PyBind11ProcessDesc
Definition: PyBind11ProcessDesc.h:16
FWLiteEnabler::enable
static void enable()
enable automatic library loading
Definition: FWLiteEnabler.cc:46
edm::ParameterSet
Definition: ParameterSet.h:47
PVValHelper::phi
Definition: PVValidationHelpers.h:69
iEvent
int iEvent
Definition: GenABIO.cc:224
fwlite::Event
Definition: Event.h:87
ev
bool ev
Definition: Hydjet2Hadronizer.cc:95
edm::EventBase
Definition: EventBase.h:46
fwlite::TFileService
Definition: TFileService.h:12
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
edm::InputTag
Definition: InputTag.h:15