CMS 3D CMS Logo

Functions
FWLiteHistograms.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:

Prepare maps of good/bad channels:

Prepare maps of good/bad channels:

Definition at line 22 of file FWLiteHistograms.cc.

References dir2webdir::argc, GCPpyPlots::argv, gather_cfg::cout, DeadROC_duringRun::dir, FWLiteEnabler::enable(), makeMEIFBenchmarkPlots::ev, compareTotals::fs, testHGCalDigi_cfg::inFile, EgHLTOffHistBins_cfi::mass, PDWG_BPHSkim_cff::muons, writedatasetfile::parser, AlCaHLTBitMon_QueryRunRegistry::string, and align_cfg::TFileService.

22  {
23  // define what muon you are using; this is necessary as FWLite is not
24  // capable of reading edm::Views
25  using reco::Muon;
26 
27  // ----------------------------------------------------------------------
28  // First Part:
29  //
30  // * enable FWLite
31  // * book the histograms of interest
32  // * open the input file
33  // ----------------------------------------------------------------------
34 
35  // load framework libraries
36  gSystem->Load("libFWCoreFWLite");
38 
39  // initialize command line parser
40  optutl::CommandLineParser parser("Analyze FWLite Histograms");
41 
42  // set defaults
43  parser.integerValue("maxEvents") = 1000;
44  parser.integerValue("outputEvery") = 10;
45  parser.stringValue("outputFile") = "analyzeFWLiteHistograms.root";
46 
47  // parse arguments
48  parser.parseArguments(argc, argv);
49  int maxEvents_ = parser.integerValue("maxEvents");
50  unsigned int outputEvery_ = parser.integerValue("outputEvery");
51  std::string outputFile_ = parser.stringValue("outputFile");
52  std::vector<std::string> inputFiles_ = parser.stringVector("inputFiles");
53 
54  // book a set of histograms
56  TFileDirectory dir = fs.mkdir("analyzeBasicPat");
57  TH1F* muonPt_ = dir.make<TH1F>("muonPt", "pt", 100, 0., 300.);
58  TH1F* muonEta_ = dir.make<TH1F>("muonEta", "eta", 100, -3., 3.);
59  TH1F* muonPhi_ = dir.make<TH1F>("muonPhi", "phi", 100, -5., 5.);
60  TH1F* mumuMass_ = dir.make<TH1F>("mumuMass", "mass", 90, 30., 120.);
61 
62  // loop the events
63  int ievt = 0;
64  for (unsigned int iFile = 0; iFile < inputFiles_.size(); ++iFile) {
65  // open input file (can be located on castor)
66  TFile* inFile = TFile::Open(inputFiles_[iFile].c_str());
67  if (inFile) {
68  // ----------------------------------------------------------------------
69  // Second Part:
70  //
71  // * loop the events in the input file
72  // * receive the collections of interest via fwlite::Handle
73  // * fill the histograms
74  // * after the loop close the input file
75  // ----------------------------------------------------------------------
77  for (ev.toBegin(); !ev.atEnd(); ++ev, ++ievt) {
78  edm::EventBase const& event = ev;
79  // break loop if maximal number of events is reached
80  if (maxEvents_ > 0 ? ievt + 1 > maxEvents_ : false)
81  break;
82  // simple event counter
83  if (outputEvery_ != 0 ? (ievt > 0 && ievt % outputEvery_ == 0) : false)
84  std::cout << " processing event: " << ievt << std::endl;
85 
86  // Handle to the muon collection
88  event.getByLabel(std::string("muons"), muons);
89 
90  // loop muon collection and fill histograms
91  for (std::vector<Muon>::const_iterator mu1 = muons->begin(); mu1 != muons->end(); ++mu1) {
92  muonPt_->Fill(mu1->pt());
93  muonEta_->Fill(mu1->eta());
94  muonPhi_->Fill(mu1->phi());
95  if (mu1->pt() > 20 && fabs(mu1->eta()) < 2.1) {
96  for (std::vector<Muon>::const_iterator mu2 = muons->begin(); mu2 != muons->end(); ++mu2) {
97  if (mu2 > mu1) { // prevent double conting
98  if (mu1->charge() * mu2->charge() < 0) { // check only muon pairs of unequal charge
99  if (mu2->pt() > 20 && fabs(mu2->eta()) < 2.1) {
100  mumuMass_->Fill((mu1->p4() + mu2->p4()).mass());
101  }
102  }
103  }
104  }
105  }
106  }
107  }
108  // close input file
109  inFile->Close();
110  }
111  // break loop if maximal number of events is reached:
112  // this has to be done twice to stop the file loop as well
113  if (maxEvents_ > 0 ? ievt + 1 > maxEvents_ : false)
114  break;
115  }
116  return 0;
117 }
static void enable()
enable automatic library loading