CMS 3D CMS Logo

Functions
PatMuonEDMAnalyzer.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/MuonReco/interface/Muon.h"
#include "DataFormats/PatCandidates/interface/Muon.h"
#include "PhysicsTools/FWLite/interface/TFileService.h"
#include "PhysicsTools/FWLite/interface/CommandLineParser.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 22 of file PatMuonEDMAnalyzer.cc.

22  {
23  // ----------------------------------------------------------------------
24  // First Part:
25  //
26  // * enable FWLite
27  // * book the histograms of interest
28  // * open the input file
29  // ----------------------------------------------------------------------
30 
31  // load framework libraries
32  gSystem->Load("libFWCoreFWLite");
34 
35  // initialize command line parser
36  optutl::CommandLineParser parser("Analyze FWLite Histograms");
37 
38  // set defaults
39  parser.integerValue("maxEvents") = 1000;
40  parser.integerValue("outputEvery") = 10;
41  parser.stringValue("outputFile") = "analyzeEdmTuple.root";
42 
43  // parse arguments
44  parser.parseArguments(argc, argv);
45  int maxEvents_ = parser.integerValue("maxEvents");
46  unsigned int outputEvery_ = parser.integerValue("outputEvery");
47  std::string outputFile_ = parser.stringValue("outputFile");
48  std::vector<std::string> inputFiles_ = parser.stringVector("inputFiles");
49 
50  // book a set of histograms
52  TFileDirectory dir = fs.mkdir("analyzePatMuon");
53  TH1F* muonPt_ = dir.make<TH1F>("muonPt", "pt", 100, 0., 300.);
54  TH1F* muonEta_ = dir.make<TH1F>("muonEta", "eta", 100, -3., 3.);
55  TH1F* muonPhi_ = dir.make<TH1F>("muonPhi", "phi", 100, -5., 5.);
56 
57  // loop the events
58  int ievt = 0;
59  for (unsigned int iFile = 0; iFile < inputFiles_.size(); ++iFile) {
60  // open input file (can be located on castor)
61  TFile* inFile = TFile::Open(inputFiles_[iFile].c_str());
62  if (inFile) {
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  fwlite::Event ev(inFile);
72  for (ev.toBegin(); !ev.atEnd(); ++ev, ++ievt) {
73  edm::EventBase const& event = ev;
74  // break loop if maximal number of events is reached
75  if (maxEvents_ > 0 ? ievt + 1 > maxEvents_ : false)
76  break;
77  // simple event counter
78  if (outputEvery_ != 0 ? (ievt > 0 && ievt % outputEvery_ == 0) : false)
79  std::cout << " processing event: " << ievt << std::endl;
80 
81  // Handle to the muon pt
83  event.getByLabel(std::string("patMuonAnalyzer:pt"), muonPt);
84  // loop muon collection and fill histograms
85  for (std::vector<float>::const_iterator mu1 = muonPt->begin(); mu1 != muonPt->end(); ++mu1) {
86  muonPt_->Fill(*mu1);
87  }
88  // Handle to the muon eta
90  event.getByLabel(std::string("patMuonAnalyzer:eta"), muonEta);
91  for (std::vector<float>::const_iterator mu1 = muonEta->begin(); mu1 != muonEta->end(); ++mu1) {
92  muonEta_->Fill(*mu1);
93  }
94  // Handle to the muon phi
96  event.getByLabel(std::string("patMuonAnalyzer:phi"), muonPhi);
97  for (std::vector<float>::const_iterator mu1 = muonPhi->begin(); mu1 != muonPhi->end(); ++mu1) {
98  muonPhi_->Fill(*mu1);
99  }
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  return 0;
110 }

References dir2webdir::argc, cmsBatch::argv, gather_cfg::cout, DeadROC_duringRun::dir, FWLiteEnabler::enable(), ev, TFileDirectory::mkdir(), HLTObjectMonitor_cfi::muonEta, HLTObjectMonitor_cfi::muonPhi, HLTObjectMonitor_cfi::muonPt, writedatasetfile::parser, AlCaHLTBitMon_QueryRunRegistry::string, and align_cfg::TFileService.

HLTObjectMonitor_cfi.muonPt
muonPt
Definition: HLTObjectMonitor_cfi.py:82
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
HLTObjectMonitor_cfi.muonEta
muonEta
Definition: HLTObjectMonitor_cfi.py:92
dir2webdir.argc
argc
Definition: dir2webdir.py:39
gather_cfg.cout
cout
Definition: gather_cfg.py:144
writedatasetfile.parser
parser
Definition: writedatasetfile.py:7
TFileDirectory
Definition: TFileDirectory.h:24
align_cfg.TFileService
TFileService
Definition: align_cfg.py:143
edm::Handle
Definition: AssociativeIterator.h:50
FWLiteEnabler::enable
static void enable()
enable automatic library loading
Definition: FWLiteEnabler.cc:46
HLTObjectMonitor_cfi.muonPhi
muonPhi
Definition: HLTObjectMonitor_cfi.py:102
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
fwlite::Event
Definition: Event.h:87
ev
bool ev
Definition: Hydjet2Hadronizer.cc:97
edm::EventBase
Definition: EventBase.h:46
fwlite::TFileService
Definition: TFileService.h:12
DeadROC_duringRun.dir
dir
Definition: DeadROC_duringRun.py:23
optutl::CommandLineParser
Definition: CommandLineParser.h:10