CMS 3D CMS Logo

Functions
PatBasicFWLiteAnalyzer.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 "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 "DataFormats/PatCandidates/interface/Muon.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:

Definition at line 25 of file PatBasicFWLiteAnalyzer.cc.

25  {
26  // ----------------------------------------------------------------------
27  // First Part:
28  //
29  // * enable FWLite
30  // * book the histograms of interest
31  // * open the input file
32  // ----------------------------------------------------------------------
33 
34  // load framework libraries
35  gSystem->Load("libFWCoreFWLite");
37 
38  // only allow one argument for this simple example which should be the
39  // the python cfg file
40  if (argc < 2) {
41  std::cout << "Usage : " << argv[0] << " [parameters.py]" << std::endl;
42  return 0;
43  }
44  if (!edm::readPSetsFrom(argv[1])->existsAs<edm::ParameterSet>("process")) {
45  std::cout << " ERROR: ParametersSet 'process' is missing in your configuration file" << std::endl;
46  exit(0);
47  }
48  // get the python configuration
49  const edm::ParameterSet& process = edm::readPSetsFrom(argv[1])->getParameter<edm::ParameterSet>("process");
50  fwlite::InputSource inputHandler_(process);
51  fwlite::OutputFiles outputHandler_(process);
52 
53  // now get each parameter
54  const edm::ParameterSet& ana = process.getParameter<edm::ParameterSet>("muonAnalyzer");
55  edm::InputTag muons_(ana.getParameter<edm::InputTag>("muons"));
56 
57  // book a set of histograms
58  fwlite::TFileService fs = fwlite::TFileService(outputHandler_.file());
59  TFileDirectory dir = fs.mkdir("analyzeBasicPat");
60  TH1F* muonPt_ = dir.make<TH1F>("muonPt", "pt", 100, 0., 300.);
61  TH1F* muonEta_ = dir.make<TH1F>("muonEta", "eta", 100, -3., 3.);
62  TH1F* muonPhi_ = dir.make<TH1F>("muonPhi", "phi", 100, -5., 5.);
63 
64  // loop the events
65  int ievt = 0;
66  int maxEvents_(inputHandler_.maxEvents());
67  for (unsigned int iFile = 0; iFile < inputHandler_.files().size(); ++iFile) {
68  // open input file (can be located on castor)
69  TFile* inFile = TFile::Open(inputHandler_.files()[iFile].c_str());
70  if (inFile) {
71  // ----------------------------------------------------------------------
72  // Second Part:
73  //
74  // * loop the events in the input file
75  // * receive the collections of interest via fwlite::Handle
76  // * fill the histograms
77  // * after the loop close the input file
78  // ----------------------------------------------------------------------
79  fwlite::Event ev(inFile);
80  for (ev.toBegin(); !ev.atEnd(); ++ev, ++ievt) {
81  edm::EventBase const& event = ev;
82  // break loop if maximal number of events is reached
83  if (maxEvents_ > 0 ? ievt + 1 > maxEvents_ : false)
84  break;
85  // simple event counter
86  if (inputHandler_.reportAfter() != 0 ? (ievt > 0 && ievt % inputHandler_.reportAfter() == 0) : false)
87  std::cout << " processing event: " << ievt << std::endl;
88 
89  // Handle to the muon collection
91  event.getByLabel(muons_, muons);
92 
93  // loop muon collection and fill histograms
94  for (unsigned i = 0; i < muons->size(); ++i) {
95  muonPt_->Fill((*muons)[i].pt());
96  muonEta_->Fill((*muons)[i].eta());
97  muonPhi_->Fill((*muons)[i].phi());
98  }
99  }
100  // close input file
101  inFile->Close();
102  }
103  // break loop if maximal number of events is reached:
104  // this has to be done twice to stop the file loop as well
105  if (maxEvents_ > 0 ? ievt + 1 > maxEvents_ : false)
106  break;
107  }
108  return 0;
109 }

References dir2webdir::argc, cmsBatch::argv, gather_cfg::cout, DeadROC_duringRun::dir, FWLiteEnabler::enable(), PVValHelper::eta, ev, beamvalidation::exit(), fwlite::OutputFiles::file(), edm::ParameterSet::getParameter(), mps_fire::i, TFileDirectory::mkdir(), PDWG_BPHSkim_cff::muons, PVValHelper::phi, LaserDQM_cfg::process, DiDispStaMuonMonitor_cfi::pt, edm::readPSetsFrom(), and align_cfg::TFileService.

PDWG_BPHSkim_cff.muons
muons
Definition: PDWG_BPHSkim_cff.py:47
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:355
dir2webdir.argc
argc
Definition: dir2webdir.py:39
DiDispStaMuonMonitor_cfi.pt
pt
Definition: DiDispStaMuonMonitor_cfi.py:39
edm::readPSetsFrom
std::unique_ptr< edm::ParameterSet > readPSetsFrom(std::string const &fileOrString)
Definition: ParameterSetReader.cc:23
gather_cfg.cout
cout
Definition: gather_cfg.py:144
TFileDirectory
Definition: TFileDirectory.h:24
fwlite::InputSource
Definition: InputSource.h:19
align_cfg.TFileService
TFileService
Definition: align_cfg.py:143
edm::Handle
Definition: AssociativeIterator.h:50
PVValHelper::eta
Definition: PVValidationHelpers.h:69
fwlite::OutputFiles
Definition: OutputFiles.h:19
FWLiteEnabler::enable
static void enable()
enable automatic library loading
Definition: FWLiteEnabler.cc:46
edm::ParameterSet
Definition: ParameterSet.h:36
PVValHelper::phi
Definition: PVValidationHelpers.h:68
LaserDQM_cfg.process
process
Definition: LaserDQM_cfg.py:3
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
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
beamvalidation.exit
def exit(msg="")
Definition: beamvalidation.py:53
edm::InputTag
Definition: InputTag.h:15
DeadROC_duringRun.dir
dir
Definition: DeadROC_duringRun.py:23