CMS 3D CMS Logo

Functions
FWLiteWithSelectorUtils.cc File Reference
#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 "FWCore/FWLite/interface/FWLiteEnabler.h"
#include "DataFormats/FWLite/interface/InputSource.h"
#include "DataFormats/FWLite/interface/OutputFiles.h"
#include "FWCore/ParameterSet/interface/ParameterSet.h"
#include "FWCore/ParameterSetReader/interface/ParameterSetReader.h"
#include "TStopwatch.h"
#include "PhysicsTools/FWLite/interface/WSelector.h"
#include "PhysicsTools/FWLite/interface/TFileService.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:

Definition at line 20 of file FWLiteWithSelectorUtils.cc.

References dir2webdir::argc, GCPpyPlots::argv, gather_cfg::cout, FWLiteEnabler::enable(), reco::LeafCandidate::eta(), makeMEIFBenchmarkPlots::ev, beamvalidation::exit(), fwlite::OutputFiles::file(), compareTotals::fs, testHGCalDigi_cfg::inFile, reco::LeafCandidate::phi(), LaserDQM_cfg::process, reco::LeafCandidate::pt(), edm::readPSetsFrom(), corrVsCorr::selection, and align_cfg::TFileService.

20  {
21  // define what muon you are using; this is necessary as FWLite is not
22  // capable of reading edm::Views
23  using reco::Muon;
24 
25  // ----------------------------------------------------------------------
26  // First Part:
27  //
28  // * enable FWLite
29  // * book the histograms of interest
30  // * open the input file
31  // ----------------------------------------------------------------------
32 
33  // load framework libraries
34  gSystem->Load("libFWCoreFWLite");
36 
37  if (argc < 2) {
38  std::cout << "Usage : " << argv[0] << " [parameters.py]" << std::endl;
39  return 0;
40  }
41 
42  if (!edm::readPSetsFrom(argv[1])->existsAs<edm::ParameterSet>("process")) {
43  std::cout << " ERROR: ParametersSet 'process' is missing in your configuration file" << std::endl;
44  exit(0);
45  }
46  // get the python configuration
47  const edm::ParameterSet& process = edm::readPSetsFrom(argv[1])->getParameter<edm::ParameterSet>("process");
48  fwlite::InputSource inputHandler_(process);
49  fwlite::OutputFiles outputHandler_(process);
50 
51  // initialize the W selector
52  edm::ParameterSet selection = process.getParameter<edm::ParameterSet>("selection");
53  WSelector wSelector(selection);
54  pat::strbitset wSelectorReturns = wSelector.getBitTemplate();
55 
56  // book a set of histograms
57  fwlite::TFileService fs = fwlite::TFileService(outputHandler_.file());
58  TFileDirectory theDir = fs.mkdir("analyzeBasicPat");
59  TH1F* muonPt_ = theDir.make<TH1F>("muonPt", "pt", 100, 0., 300.);
60  TH1F* muonEta_ = theDir.make<TH1F>("muonEta", "eta", 100, -3., 3.);
61  TH1F* muonPhi_ = theDir.make<TH1F>("muonPhi", "phi", 100, -5., 5.);
62 
63  // start a CPU timer
64  TStopwatch timer;
65  timer.Start();
66 
67  // loop the events
68  int ievt = 0;
69  unsigned int nEventsAnalyzed = 0;
70  int maxEvents_(inputHandler_.maxEvents());
71  for (unsigned int iFile = 0; iFile < inputHandler_.files().size(); ++iFile) {
72  // open input file (can be located on castor)
73  TFile* inFile = TFile::Open(inputHandler_.files()[iFile].c_str());
74  if (inFile) {
75  // ----------------------------------------------------------------------
76  // Second Part:
77  //
78  // * loop the events in the input file
79  // * receive the collections of interest via fwlite::Handle
80  // * fill the histograms
81  // * after the loop close the input file
82  // ----------------------------------------------------------------------
84  for (ev.toBegin(); !ev.atEnd(); ++ev, ++ievt) {
85  edm::EventBase const& event = ev;
86  // break loop if maximal number of events is reached
87  if (maxEvents_ > 0 ? ievt + 1 > maxEvents_ : false)
88  break;
89  // simple event counter
90  if (inputHandler_.reportAfter() != 0 ? (ievt > 0 && ievt % inputHandler_.reportAfter() == 0) : false)
91  std::cout << " processing event: " << ievt << std::endl;
92 
93  if (wSelector(event, wSelectorReturns)) {
94  pat::Muon const& wMuon = wSelector.wMuon();
95  muonPt_->Fill(wMuon.pt());
96  muonEta_->Fill(wMuon.eta());
97  muonPhi_->Fill(wMuon.phi());
98  }
99  ++nEventsAnalyzed;
100  }
101  // close input file
102  inFile->Close();
103  }
104  // break loop if maximal number of events is reached:
105  // this has to be done twice to stop the file loop as well
106  if (maxEvents_ > 0 ? ievt + 1 > maxEvents_ : false)
107  break;
108  }
109  // stop CPU timer
110  timer.Stop();
111 
112  // print selector
113  wSelector.print(std::cout);
114 
115  // print some timing statistics
116  double rtime = timer.RealTime();
117  double ctime = timer.CpuTime();
118  // timing printouts
119  printf("Analyzed events: %d \n", nEventsAnalyzed);
120  printf("RealTime=%f seconds, CpuTime=%f seconds\n", rtime, ctime);
121  printf("%4.2f events / RealTime second .\n", (double)nEventsAnalyzed / rtime);
122  printf("%4.2f events / CpuTime second .\n", (double)nEventsAnalyzed / ctime);
123  return 0;
124 }
double pt() const final
transverse momentum
selection
main part
Definition: corrVsCorr.py:100
static void enable()
enable automatic library loading
std::unique_ptr< edm::ParameterSet > readPSetsFrom(std::string const &fileOrString)
double phi() const final
momentum azimuthal angle
Example class of an EventSelector to apply a simple W Boson selection.
Definition: WSelector.h:16
Analysis-level muon class.
Definition: Muon.h:51
Definition: event.py:1
def exit(msg="")
double eta() const final
momentum pseudorapidity