CMS 3D CMS Logo

List of all members | Public Member Functions | Private Types | Private Member Functions | Private Attributes | Static Private Attributes
MuIsoValidation Class Reference

#include <MuIsoValidation.h>

Inheritance diagram for MuIsoValidation:
one::DQMEDAnalyzer< T > one::dqmimplementation::DQMBaseClass< T... >

Public Member Functions

 MuIsoValidation (const edm::ParameterSet &)
 
 ~MuIsoValidation () override
 
- Public Member Functions inherited from one::DQMEDAnalyzer< T >
 DQMEDAnalyzer ()=default
 
 DQMEDAnalyzer (DQMEDAnalyzer< T... > const &)=delete
 
 DQMEDAnalyzer (DQMEDAnalyzer< T... > &&)=delete
 
 ~DQMEDAnalyzer () override=default
 

Private Types

enum  { NOAXIS, XAXIS, YAXIS, ZAXIS }
 
typedef edm::Handle< reco::IsoDepositMapMuIsoDepHandle
 
typedef const reco::IsoDeposit MuIsoDepRef
 
typedef edm::RefToBase< reco::MuonMuonBaseRef
 
typedef edm::View< reco::Muon >::const_iterator MuonIterator
 

Private Member Functions

void analyze (const edm::Event &, const edm::EventSetup &) override
 
void bookHistograms (DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
 
void FillHistos ()
 
TH1 * GetTH1FromMonitorElement (MonitorElement *me)
 
TH2 * GetTH2FromMonitorElement (MonitorElement *me)
 
TProfile * GetTProfileFromMonitorElement (MonitorElement *me)
 
void InitStatics ()
 
void MakeLogBinsForProfile (Double_t *bin_edges, const double min, const double max)
 
void NormalizeHistos ()
 
void RecordData (MuonIterator muon)
 

Private Attributes

std::vector< std::string > axis_titles
 
std::vector< MonitorElement * > cd_plots
 
std::vector< int > cdCompNeeded
 
std::string dirName
 
edm::InputTag ecalIsoDeposit_Tag
 
std::vector< MonitorElement * > h_1D
 
MonitorElementh_nMuons
 
edm::InputTag hcalIsoDeposit_Tag
 
edm::InputTag hoIsoDeposit_Tag
 
edm::ParameterSet iConfig
 
std::vector< int > isContinuous
 
double L_BIN_WIDTH
 
int LOG_BINNING_ENABLED
 
double LOG_BINNING_RATIO
 
std::vector< std::string > main_titles
 
edm::InputTag Muon_Tag
 
edm::EDGetTokenT< edm::View< reco::Muon > > Muon_Token
 
std::vector< std::string > names
 
int nEvents
 
int nIncMuons
 
int NUM_LOG_BINS
 
std::vector< std::vector< MonitorElement * > > p_2D
 
std::vector< std::vector< double > > param
 
bool requireCombinedMuon
 
std::string rootfilename
 
double S_BIN_WIDTH
 
std::string subDirName
 
std::string subsystemname_
 
double theData [NUM_VARS]
 
int theMuonData
 
std::string title_cd
 
std::string title_cone
 
std::string title_sam
 
edm::InputTag tkIsoDeposit_Tag
 

Static Private Attributes

static const int NUM_VARS = 21
 

Detailed Description

Definition at line 59 of file MuIsoValidation.h.

Member Typedef Documentation

Definition at line 63 of file MuIsoValidation.h.

Definition at line 64 of file MuIsoValidation.h.

Definition at line 62 of file MuIsoValidation.h.

typedef edm::View<reco::Muon>::const_iterator MuIsoValidation::MuonIterator
private

Definition at line 61 of file MuIsoValidation.h.

Member Enumeration Documentation

anonymous enum
private

Constructor & Destructor Documentation

MuIsoValidation::MuIsoValidation ( const edm::ParameterSet ps)
explicit

Definition at line 63 of file MuIsoValidation.cc.

References cd_plots, dirName, edm::ParameterSet::getUntrackedParameter(), h_1D, iConfig, InitStatics(), Muon_Tag, Muon_Token, nEvents, nIncMuons, NUM_VARS, p_2D, requireCombinedMuon, AlCaHLTBitMon_QueryRunRegistry::string, and subsystemname_.

64 {
65  iConfig=ps;
66 
67  // rootfilename = iConfig.getUntrackedParameter<string>("rootfilename"); // comment out for inclusion
68  requireCombinedMuon = iConfig.getUntrackedParameter<bool>("requireCombinedMuon");
70  //subDirName = iConfig.getParameter<std::string>("@module_label");
71 
72  //dirName += subDirName;
73 
74  //--------Initialize tags-------
75  Muon_Tag = iConfig.getUntrackedParameter<edm::InputTag>("Global_Muon_Label");
76  Muon_Token = consumes<edm::View<reco::Muon> >(Muon_Tag);
77 
78  //-------Initialize counters----------------
79  nEvents = 0;
80  nIncMuons = 0;
81  // nCombinedMuons = 0;
82 
83  InitStatics();
84 
85  //Set up DAQ
86  subsystemname_ = iConfig.getUntrackedParameter<std::string>("subSystemFolder", "YourSubsystem") ;
87 
88  //------"allocate" space for the data vectors-------
89  h_1D.resize (NUM_VARS);
90  cd_plots.resize(NUM_VARS);
91  p_2D.resize(NUM_VARS, vector<MonitorElement*>(NUM_VARS));
92 
93 }
T getUntrackedParameter(std::string const &, T const &) const
std::vector< std::vector< MonitorElement * > > p_2D
std::vector< MonitorElement * > h_1D
edm::EDGetTokenT< edm::View< reco::Muon > > Muon_Token
edm::ParameterSet iConfig
std::vector< MonitorElement * > cd_plots
std::string dirName
static const int NUM_VARS
edm::InputTag Muon_Tag
std::string subsystemname_
MuIsoValidation::~MuIsoValidation ( )
override

Definition at line 98 of file MuIsoValidation.cc.

98  {
99 
100  //Deallocate memory
101 
102 }

Member Function Documentation

void MuIsoValidation::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivate

Definition at line 282 of file MuIsoValidation.cc.

References MonitorElement::Fill(), FillHistos(), edm::Event::getByToken(), h_nMuons, metsig::muon, Muon_Token, nEvents, nIncMuons, RecordData(), requireCombinedMuon, theMuonData, and parallelization::uint().

282  {
283 
284  ++nEvents;
285  edm::LogInfo("Tutorial") << "\nInvestigating event #" << nEvents<<"\n";
286 
287  // Get Muon Collection
288  edm::Handle<edm::View<reco::Muon> > muonsHandle; //
289  iEvent.getByToken(Muon_Token, muonsHandle);
290 
291  //Fill event entry in histogram of number of muons
292  edm::LogInfo("Tutorial") << "Number of Muons: " << muonsHandle->size();
293  theMuonData = muonsHandle->size();
295 
296  //Fill historgams concerning muon isolation
297  uint iMuon=0;
298  for (MuonIterator muon = muonsHandle->begin(); muon != muonsHandle->end(); ++muon, ++iMuon ) {
299  ++nIncMuons;
300  if (requireCombinedMuon) {
301  if (muon->combinedMuon().isNull()) continue;
302  }
303  RecordData(muon);
304  FillHistos();
305  }
306 }
void RecordData(MuonIterator muon)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:517
edm::View< reco::Muon >::const_iterator MuonIterator
edm::EDGetTokenT< edm::View< reco::Muon > > Muon_Token
void Fill(long long x)
MonitorElement * h_nMuons
def uint(string)
void MuIsoValidation::bookHistograms ( DQMStore::IBooker ibooker,
edm::Run const &  iRun,
edm::EventSetup const &   
)
overrideprivate

Definition at line 353 of file MuIsoValidation.cc.

References axis_titles, create_public_lumi_plots::bin_edges, DQMStore::IBooker::book1D(), DQMStore::IBooker::bookProfile(), cd_plots, cdCompNeeded, dirName, GetTH1FromMonitorElement(), GetTProfileFromMonitorElement(), h_1D, h_nMuons, isContinuous, LOG_BINNING_ENABLED, main_titles, MakeLogBinsForProfile(), names, NUM_LOG_BINS, NUM_VARS, p_2D, param, MonitorElement::setAxisTitle(), DQMStore::IBooker::setCurrentFolder(), title_cd, title_cone, title_sam, JetChargeProducer_cfi::var, XAXIS, and YAXIS.

353  {
354 
355  ibooker.setCurrentFolder(dirName);
356  //---initialize number of muons histogram---
357  h_nMuons = ibooker.book1D("nMuons", title_sam + "Number of Muons", 20, 0., 20.);
358  h_nMuons->setAxisTitle("Number of Muons",XAXIS);
359  h_nMuons->setAxisTitle("Fraction of Events",YAXIS);
360 
361 
362  //---Initialize 1D Histograms---
363  for(int var = 0; var < NUM_VARS; var++){
364  h_1D[var] = ibooker.book1D(
365  names[var],
366  title_sam + main_titles[var] + title_cone,
367  (int)param[var][0],
368  param[var][1],
369  param[var][2]
370  );
371  h_1D[var]->setAxisTitle(axis_titles[var],XAXIS);
372  h_1D[var]->setAxisTitle("Fraction of Muons",YAXIS);
373  GetTH1FromMonitorElement(h_1D[var])->Sumw2();
374 
375  if (cdCompNeeded[var]) {
376  cd_plots[var] = ibooker.book1D(
377  names[var] + "_cd",
379  (int)param[var][0],
380  param[var][1],
381  param[var][2]
382  );
383  cd_plots[var]->setAxisTitle(axis_titles[var],XAXIS);
384  cd_plots[var]->setAxisTitle("Fraction of Muons",YAXIS);
385  GetTH1FromMonitorElement(cd_plots[var])->Sumw2();
386  }
387  }//Finish 1D
388 
389  //---Initialize 2D Histograms---
390  for(int var1 = 0; var1 < NUM_VARS; var1++){
391  for(int var2 = 0; var2 < NUM_VARS; var2++){
392  if(var1 == var2) continue;
393 
394  /* h_2D[var1][var2] = ibooker.book2D(
395  names[var1] + "_" + names[var2] + "_s",
396  //title is in "y-var vs. x-var" format
397  title_sam + main_titles[var2] + " <vs> " + main_titles[var1] + title_cone,
398  (int)param[var1][0],
399  param[var1][1],
400  param[var1][2],
401  (int)param[var2][0],
402  param[var2][1],
403  param[var2][2]
404  );
405  */
406  //Monitor elements is weird and takes y axis parameters as well
407  //as x axis parameters for a 1D profile plot
408  p_2D[var1][var2] = ibooker.bookProfile(
409  names[var1] + "_" + names[var2],
410  title_sam + main_titles[var2] + " <vs> " + main_titles[var1] + title_cone,
411  (int)param[var1][0],
412  param[var1][1],
413  param[var1][2],
414  (int)param[var2][0], //documentation says this is disregarded
415  param[var2][1], //does this do anything?
416  param[var2][2], //does this do anything?
417  " " //profile errors = spread/sqrt(num_datums)
418  );
419 
420  if(LOG_BINNING_ENABLED && isContinuous[var1]){
421  Double_t * bin_edges = new Double_t[NUM_LOG_BINS+1];
422  // nbins+1 because there is one more edge than there are bins
423  MakeLogBinsForProfile(bin_edges, param[var1][1], param[var1][2]);
424  GetTProfileFromMonitorElement(p_2D[var1][var2])->SetBins(NUM_LOG_BINS, bin_edges);
425  delete[] bin_edges;
426  }
427  /* h_2D[var1][var2]->setAxisTitle(axis_titles[var1],XAXIS);
428  h_2D[var1][var2]->setAxisTitle(axis_titles[var2],YAXIS);
429  GetTH2FromMonitorElement(h_2D[var1][var2])->Sumw2();
430  */
431 
432  p_2D[var1][var2]->setAxisTitle(axis_titles[var1],XAXIS);
433  p_2D[var1][var2]->setAxisTitle(axis_titles[var2],YAXIS);
434  // GetTProfileFromMonitorElement(p_2D[var1][var2])->Sumw2();
435  }
436  }//Finish 2D
437 
438 
439 
440  //avg pT not defined for zero tracks.
441  //MonitorElement is inflxible and won't let me change the
442  //number of bins! I guess all I'm doing here is changing
443  //range of the x axis when it is printed, not the actual
444  //bins that are filled
445  p_2D[4][9]->setAxisRange(0.5,15.5,XAXIS);
446 
447 }
std::vector< int > isContinuous
TH1 * GetTH1FromMonitorElement(MonitorElement *me)
std::vector< std::vector< MonitorElement * > > p_2D
std::vector< std::string > names
MonitorElement * bookProfile(Args &&...args)
Definition: DQMStore.h:113
std::string title_cd
std::vector< std::string > main_titles
std::vector< MonitorElement * > h_1D
TProfile * GetTProfileFromMonitorElement(MonitorElement *me)
MonitorElement * h_nMuons
void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:268
std::string title_sam
std::vector< MonitorElement * > cd_plots
std::string dirName
std::string title_cone
MonitorElement * book1D(Args &&...args)
Definition: DQMStore.h:106
static const int NUM_VARS
std::vector< std::vector< double > > param
void MakeLogBinsForProfile(Double_t *bin_edges, const double min, const double max)
std::vector< std::string > axis_titles
void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)
std::vector< int > cdCompNeeded
void MuIsoValidation::FillHistos ( )
private

Definition at line 489 of file MuIsoValidation.cc.

References cd_plots, cdCompNeeded, h_1D, NUM_VARS, p_2D, theData, and JetChargeProducer_cfi::var.

Referenced by analyze().

489  {
490 
491 
492  //----------Fill 1D histograms---------------
493  for(int var=0; var<NUM_VARS; var++){
494  h_1D[var]->Fill(theData[var]);
495  if (cdCompNeeded[var]) cd_plots[var]->Fill(theData[var]);//right now, this is a regular PDF (just like h_1D)
496  }//Finish 1D
497 
498  //----------Fill 2D histograms---------------
499  for(int var1=0; var1<NUM_VARS; ++var1){
500  for(int var2=0; var2<NUM_VARS; ++var2){
501  if(var1 == var2) continue;
502  //change below to regular int interating!
503  // h_2D[var1][var2]->Fill(theData[var1], theData[var2]);
504  p_2D[var1][var2]->Fill(theData[var1], theData[var2]);
505  }
506  }//Finish 2D
507 }
std::vector< std::vector< MonitorElement * > > p_2D
double theData[NUM_VARS]
std::vector< MonitorElement * > h_1D
std::vector< MonitorElement * > cd_plots
static const int NUM_VARS
std::vector< int > cdCompNeeded
TH1 * MuIsoValidation::GetTH1FromMonitorElement ( MonitorElement me)
private

Definition at line 509 of file MuIsoValidation.cc.

References MonitorElement::getTH1().

Referenced by bookHistograms(), and NormalizeHistos().

509  {
510  return me->getTH1();
511 }
TH1 * getTH1() const
TH2 * MuIsoValidation::GetTH2FromMonitorElement ( MonitorElement me)
private

Definition at line 513 of file MuIsoValidation.cc.

References MonitorElement::getTH2F().

513  {
514  return me->getTH2F();
515 }
TH2F * getTH2F() const
TProfile * MuIsoValidation::GetTProfileFromMonitorElement ( MonitorElement me)
private

Definition at line 517 of file MuIsoValidation.cc.

References DEFINE_FWK_MODULE, and MonitorElement::getTProfile().

Referenced by bookHistograms().

517  {
518  return me->getTProfile();
519 }
TProfile * getTProfile() const
void MuIsoValidation::InitStatics ( )
private

Definition at line 107 of file MuIsoValidation.cc.

References axis_titles, cdCompNeeded, createfilelist::int, isContinuous, L_BIN_WIDTH, LOG_BINNING_ENABLED, LOG_BINNING_RATIO, main_titles, names, NUM_LOG_BINS, NUM_VARS, param, S_BIN_WIDTH, title_cd, title_cone, and title_sam.

Referenced by MuIsoValidation().

107  {
108 
109  //-----------Initialize primatives-----------
110  S_BIN_WIDTH = 1.0;//in GeV
111  L_BIN_WIDTH = 2.0;//in GeV
113  NUM_LOG_BINS = 15;
114  LOG_BINNING_RATIO = 1.1;//ratio by which each bin is wider than the last for log binning
115  //i.e. bin widths are (x), (r*x), (r^2*x), ..., (r^(nbins)*x)
116 
117 
118  //-------Initialize Titles---------
119  title_sam = "";//"[Sample b-jet events] ";
120  title_cone = "";//" [in R=0.3 IsoDeposit Cone]";
121  //The above two pieces of info will be printed on the title of the whole page,
122  //not for each individual histogram
123  title_cd = "C.D. of ";
124 
125  //-------"Allocate" memory for vectors
126  main_titles.resize(NUM_VARS);
127  axis_titles.resize(NUM_VARS);
128  names.resize(NUM_VARS);
129  param.resize(NUM_VARS, vector<double>(3) );
130  isContinuous.resize(NUM_VARS);
131  cdCompNeeded.resize(NUM_VARS);
132 
133  //-----Titles of the plots-----------
134  main_titles[0 ] = "Total Tracker Momentum";
135  main_titles[1 ] = "Total EM Cal Energy";
136  main_titles[2 ] = "Total Had Cal Energy";
137  main_titles[3 ] = "Total HO Cal Energy";
138  main_titles[4 ] = "Number of Tracker Tracks";
139  main_titles[5 ] = "Number of Jets around Muon";
140  main_titles[6 ] = "Tracker p_{T} within veto cone";
141  main_titles[7 ] = "EM E_{T} within veto cone";
142  main_titles[8 ] = "Had E_{T} within veto cone";
143  main_titles[9 ] = "HO E_{T} within veto cone";
144  main_titles[10] = "Muon p_{T}";
145  main_titles[11] = "Muon #eta";
146  main_titles[12] = "Muon #phi";
147  main_titles[13] = "Average Momentum per Track ";
148  main_titles[14] = "Weighted Energy";
149  main_titles[15] = "PF Sum of Charged Hadron Pt";
150  main_titles[16] = "PF Sum of Total Hadron Pt";
151  main_titles[17] = "PF Sum of E,Mu Pt";
152  main_titles[18] = "PF Sum of Neutral Hadron Et";
153  main_titles[19] = "PF Sum of Photon Et";
154  main_titles[20] = "PF Sum of Pt from non-PV";
155 
156  //------Titles on the X or Y axis------------
157  axis_titles[0 ] = "#Sigma p_{T} (GeV)";
158  axis_titles[1 ] = "#Sigma E_{T}^{EM} (GeV)";
159  axis_titles[2 ] = "#Sigma E_{T}^{Had} (GeV)";
160  axis_titles[3 ] = "#Sigma E_{T}^{HO} (GeV)";
161  axis_titles[4 ] = "N_{Tracks}";
162  axis_titles[5 ] = "N_{Jets}";
163  axis_titles[6 ] = "#Sigma p_{T,veto} (GeV)";
164  axis_titles[7 ] = "#Sigma E_{T,veto}^{EM} (GeV)";
165  axis_titles[8 ] = "#Sigma E_{T,veto}^{Had} (GeV)";
166  axis_titles[9 ] = "#Sigma E_{T,veto}^{HO} (GeV)";
167  axis_titles[10] = "p_{T,#mu} (GeV)";
168  axis_titles[11] = "#eta_{#mu}";
169  axis_titles[12] = "#phi_{#mu}";
170  axis_titles[13] = "#Sigma p_{T} / N_{Tracks} (GeV)";
171  axis_titles[14] = "(1.5) X #Sigma E_{T}^{EM} + #Sigma E_{T}^{Had}";
172  axis_titles[15] = "#Sigma p_{T}^{PFHadCha} (GeV)";
173  axis_titles[16] = "#Sigma p_{T}^{PFTotCha} (GeV)";
174  axis_titles[17] = "#Sigma p_{T}^{PFEMu} (GeV)";
175  axis_titles[18] = "#Sigma E_{T}^{PFHadNeu} (GeV)";
176  axis_titles[19] = "#Sigma E_{T}^{PFPhot} (GeV)";
177  axis_titles[20] = "#Sigma p_{T}^{PFPU} (GeV)";
178 
179  //-----------Names given for the root file----------
180  names[0 ] = "sumPt";
181  names[1 ] = "emEt";
182  names[2 ] = "hadEt";
183  names[3 ] = "hoEt";
184  names[4 ] = "nTracks";
185  names[5 ] = "nJets";
186  names[6 ] = "trackerVetoPt";
187  names[7 ] = "emVetoEt";
188  names[8 ] = "hadVetoEt";
189  names[9 ] = "hoVetoEt";
190  names[10] = "muonPt";
191  names[11] = "muonEta";
192  names[12] = "muonPhi";
193  names[13] = "avgPt";
194  names[14] = "weightedEt";
195  names[15] = "PFsumChargedHadronPt";
196  names[16] = "PFsumChargedTotalPt";
197  names[17] = "PFsumEMuPt";
198  names[18] = "PFsumNeutralHadronEt";
199  names[19] = "PFsumPhotonEt";
200  names[20] = "PFsumPUPt";
201 
202  //----------Parameters for binning of histograms---------
203  //param[var][0] is the number of bins
204  //param[var][1] is the low edge of the low bin
205  //param[var][2] is the high edge of the high bin
206  //
207  // maximum value------,
208  // |
209  // V
210  param[0 ][0]= (int)( 20.0/S_BIN_WIDTH); param[0 ][1]= 0.0; param[0 ][2]= param[0 ][0]*S_BIN_WIDTH;
211  param[1 ][0]= (int)( 20.0/S_BIN_WIDTH); param[1 ][1]= 0.0; param[1 ][2]= param[1 ][0]*S_BIN_WIDTH;
212  param[2 ][0]= (int)( 20.0/S_BIN_WIDTH); param[2 ][1]= 0.0; param[2 ][2]= param[2 ][0]*S_BIN_WIDTH;
213  param[3 ][0]= 20; param[3 ][1]= 0.0; param[3 ][2]= 2.0;
214  param[4 ][0]= 16; param[4 ][1]= -0.5; param[4 ][2]= param[4 ][0]-0.5;
215  param[5 ][0]= 4; param[5 ][1]= -0.5; param[5 ][2]= param[5 ][0]-0.5;
216  param[6 ][0]= (int)( 40.0/S_BIN_WIDTH); param[6 ][1]= 0.0; param[6 ][2]= param[6 ][0]*S_BIN_WIDTH;
217  param[7 ][0]= 20; param[7 ][1]= 0.0; param[7 ][2]= 10.0;
218  param[8 ][0]= (int)( 20.0/S_BIN_WIDTH); param[8 ][1]= 0.0; param[8 ][2]= param[8 ][0]*S_BIN_WIDTH;
219  param[9 ][0]= 20; param[9 ][1]= 0.0; param[9 ][2]= 5.0;
220  param[10][0]= (int)( 40.0/S_BIN_WIDTH); param[10][1]= 0.0; param[10][2]= param[10][0]*S_BIN_WIDTH;
221  param[11][0]= 24; param[11][1]= -2.4; param[11][2]= 2.4;
222  param[12][0]= 32; param[12][1]= -3.2; param[12][2]= 3.2;
223  param[13][0]= (int)( 15.0/S_BIN_WIDTH); param[13][1]= 0.0; param[13][2]= param[13][0]*S_BIN_WIDTH;
224  param[14][0]= (int)( 20.0/S_BIN_WIDTH); param[14][1]= 0.0; param[14][2]= param[14][0]*S_BIN_WIDTH;
225  param[15][0]= (int)( 20.0/S_BIN_WIDTH); param[15][1]= 0.0; param[15][2]= param[15][0]*S_BIN_WIDTH;
226  param[16][0]= (int)( 20.0/S_BIN_WIDTH); param[15][1]= 0.0; param[16][2]= param[16][0]*S_BIN_WIDTH;
227  param[17][0]= (int)( 20.0/S_BIN_WIDTH)+1; param[17][1]= -S_BIN_WIDTH; param[17][2]= param[17][0]*S_BIN_WIDTH;
228  param[18][0]= (int)( 20.0/S_BIN_WIDTH); param[18][1]= 0.0; param[18][2]= param[18][0]*S_BIN_WIDTH;
229  param[19][0]= (int)( 20.0/S_BIN_WIDTH); param[19][1]= 0.0; param[19][2]= param[19][0]*S_BIN_WIDTH;
230  param[20][0]= (int)( 20.0/S_BIN_WIDTH); param[20][1]= 0.0; param[20][2]= param[20][0]*S_BIN_WIDTH;
231 
232  //--------------Is the variable continuous (i.e. non-integer)?-------------
233  //---------(Log binning will only be used for continuous variables)--------
234  isContinuous[0 ] = 1;
235  isContinuous[1 ] = 1;
236  isContinuous[2 ] = 1;
237  isContinuous[3 ] = 1;
238  isContinuous[4 ] = 0;
239  isContinuous[5 ] = 0;
240  isContinuous[6 ] = 1;
241  isContinuous[7 ] = 1;
242  isContinuous[8 ] = 1;
243  isContinuous[9 ] = 1;
244  isContinuous[10] = 1;
245  isContinuous[11] = 1;
246  isContinuous[12] = 1;
247  isContinuous[13] = 1;
248  isContinuous[14] = 1;
249  isContinuous[15] = 1;
250  isContinuous[16] = 1;
251  isContinuous[17] = 1;
252  isContinuous[18] = 1;
253  isContinuous[19] = 1;
254  isContinuous[20] = 1;
255 
256  //----Should the cumulative distribution be calculated for this variable?-----
257  cdCompNeeded[0 ] = 1;
258  cdCompNeeded[1 ] = 1;
259  cdCompNeeded[2 ] = 1;
260  cdCompNeeded[3 ] = 1;
261  cdCompNeeded[4 ] = 1;
262  cdCompNeeded[5 ] = 1;
263  cdCompNeeded[6 ] = 1;
264  cdCompNeeded[7 ] = 1;
265  cdCompNeeded[8 ] = 1;
266  cdCompNeeded[9 ] = 1;
267  cdCompNeeded[10] = 0;
268  cdCompNeeded[11] = 0;
269  cdCompNeeded[12] = 0;
270  cdCompNeeded[13] = 1;
271  cdCompNeeded[14] = 1;
272  cdCompNeeded[15] = 1;
273  cdCompNeeded[16] = 1;
274  cdCompNeeded[17] = 1;
275  cdCompNeeded[18] = 1;
276  cdCompNeeded[19] = 1;
277  cdCompNeeded[20] = 1;
278 }
std::vector< int > isContinuous
std::vector< std::string > names
std::string title_cd
std::vector< std::string > main_titles
std::string title_sam
std::string title_cone
static const int NUM_VARS
std::vector< std::vector< double > > param
std::vector< std::string > axis_titles
std::vector< int > cdCompNeeded
void MuIsoValidation::MakeLogBinsForProfile ( Double_t *  bin_edges,
const double  min,
const double  max 
)
private

Definition at line 449 of file MuIsoValidation.cc.

References LOG_BINNING_RATIO, SiStripPI::max, min(), gen::n, pileupCalc::nbins, NUM_LOG_BINS, funct::pow(), and alignCSCRings::r.

Referenced by bookHistograms().

450  {
451 
452  const double &r = LOG_BINNING_RATIO;
453  const int &nbins = NUM_LOG_BINS;
454 
455  const double first_bin_width = (r > 1.0) ? //so we don't divide by zero
456  (max - min)*(1-r)/(1-pow(r,nbins)) :
457  (max - min)/nbins;
458 
459  bin_edges[0] = min;
460  bin_edges[1] = min + first_bin_width;
461  for(int n = 2; n<nbins; ++n){
462  bin_edges[n] = bin_edges[n-1] + (bin_edges[n-1] - bin_edges[n-2])*r;
463  }
464  bin_edges[nbins] = max;
465 }
T min(T a, T b)
Definition: MathUtil.h:58
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:40
void MuIsoValidation::NormalizeHistos ( )
private

Definition at line 467 of file MuIsoValidation.cc.

References cd_plots, cdCompNeeded, GetTH1FromMonitorElement(), h_1D, createfilelist::int, gen::n, NUM_VARS, param, and JetChargeProducer_cfi::var.

467  {
468  for(int var=0; var<NUM_VARS; var++){
469  //turn cd_plots into CDF's
470  //underflow -> bin #0. overflow -> bin #(nbins+1)
471  //0th bin doesn't need changed
472 
473  //----normalize------
474  double entries = GetTH1FromMonitorElement(h_1D[var])->GetEntries();
475  if (entries==0)continue;
476  GetTH1FromMonitorElement(h_1D[var])->Scale(1./entries);
477 
478  if (cdCompNeeded[var]) {
479  int n_max = int(param[var][0])+1;
480  for(int n=1; n<=n_max; ++n){
481  cd_plots[var]->setBinContent(n, cd_plots[var]->getBinContent(n) + cd_plots[var]->getBinContent(n-1)); //Integrate.
482  }
483  //----normalize------
484  GetTH1FromMonitorElement(cd_plots[var])->Scale(1./entries);
485  }
486  }
487 }
TH1 * GetTH1FromMonitorElement(MonitorElement *me)
std::vector< MonitorElement * > h_1D
std::vector< MonitorElement * > cd_plots
static const int NUM_VARS
std::vector< std::vector< double > > param
std::vector< int > cdCompNeeded
void MuIsoValidation::RecordData ( MuonIterator  muon)
private

Definition at line 309 of file MuIsoValidation.cc.

References theData.

Referenced by analyze().

309  {
310 
311 
312  theData[0] = muon->isolationR03().sumPt;
313  theData[1] = muon->isolationR03().emEt;
314  theData[2] = muon->isolationR03().hadEt;
315  theData[3] = muon->isolationR03().hoEt;
316 
317  theData[4] = muon->isolationR03().nTracks;
318  theData[5] = muon->isolationR03().nJets;
319  theData[6] = muon->isolationR03().trackerVetoPt;
320  theData[7] = muon->isolationR03().emVetoEt;
321  theData[8] = muon->isolationR03().hadVetoEt;
322  theData[9] = muon->isolationR03().hoVetoEt;
323 
324  theData[10] = muon->pt();
325  theData[11] = muon->eta();
326  theData[12] = muon->phi();
327 
328  // make sure nTracks != 0 before filling this one
329  if (theData[4] != 0) theData[13] = (double)theData[0] / (double)theData[4];
330  else theData[13] = -99;
331 
332  theData[14] = 1.5 * theData[1] + theData[2];
333 
334  // Now PF isolation
335  theData[15] = -99.;
336  theData[16] = -99.;
337  theData[17] = -99.;
338  theData[18] = -99.;
339  theData[19] = -99.;
340  theData[20] = -99.;
341  if ( muon->isPFMuon() && muon->isPFIsolationValid() ) {
342  theData[15] = muon->pfIsolationR03().sumChargedHadronPt;
343  theData[16] = muon->pfIsolationR03().sumChargedParticlePt;
344  theData[17] = muon->pfIsolationR03().sumChargedParticlePt-muon->pfIsolationR03().sumChargedHadronPt;
345  theData[18] = muon->pfIsolationR03().sumNeutralHadronEt;
346  theData[19] = muon->pfIsolationR03().sumPhotonEt;
347  theData[20] = muon->pfIsolationR03().sumPUPt;
348  }
349 
350 }
double theData[NUM_VARS]

Member Data Documentation

std::vector<std::string> MuIsoValidation::axis_titles
private

Definition at line 119 of file MuIsoValidation.h.

Referenced by bookHistograms(), and InitStatics().

std::vector<MonitorElement*> MuIsoValidation::cd_plots
private

Definition at line 137 of file MuIsoValidation.h.

Referenced by bookHistograms(), FillHistos(), MuIsoValidation(), and NormalizeHistos().

std::vector<int> MuIsoValidation::cdCompNeeded
private

Definition at line 123 of file MuIsoValidation.h.

Referenced by bookHistograms(), FillHistos(), InitStatics(), and NormalizeHistos().

std::string MuIsoValidation::dirName
private
edm::InputTag MuIsoValidation::ecalIsoDeposit_Tag
private

Definition at line 94 of file MuIsoValidation.h.

std::vector<MonitorElement*> MuIsoValidation::h_1D
private

Definition at line 136 of file MuIsoValidation.h.

Referenced by bookHistograms(), FillHistos(), MuIsoValidation(), and NormalizeHistos().

MonitorElement* MuIsoValidation::h_nMuons
private

Definition at line 135 of file MuIsoValidation.h.

Referenced by analyze(), and bookHistograms().

edm::InputTag MuIsoValidation::hcalIsoDeposit_Tag
private

Definition at line 93 of file MuIsoValidation.h.

edm::InputTag MuIsoValidation::hoIsoDeposit_Tag
private

Definition at line 95 of file MuIsoValidation.h.

edm::ParameterSet MuIsoValidation::iConfig
private

Definition at line 129 of file MuIsoValidation.h.

Referenced by MuIsoValidation().

std::vector<int> MuIsoValidation::isContinuous
private

Definition at line 122 of file MuIsoValidation.h.

Referenced by bookHistograms(), and InitStatics().

double MuIsoValidation::L_BIN_WIDTH
private

Definition at line 107 of file MuIsoValidation.h.

Referenced by InitStatics().

int MuIsoValidation::LOG_BINNING_ENABLED
private

Definition at line 109 of file MuIsoValidation.h.

Referenced by bookHistograms(), and InitStatics().

double MuIsoValidation::LOG_BINNING_RATIO
private

Definition at line 111 of file MuIsoValidation.h.

Referenced by InitStatics(), and MakeLogBinsForProfile().

std::vector<std::string> MuIsoValidation::main_titles
private

Definition at line 118 of file MuIsoValidation.h.

Referenced by bookHistograms(), and InitStatics().

edm::InputTag MuIsoValidation::Muon_Tag
private

Definition at line 90 of file MuIsoValidation.h.

Referenced by MuIsoValidation().

edm::EDGetTokenT<edm::View<reco::Muon> > MuIsoValidation::Muon_Token
private

Definition at line 91 of file MuIsoValidation.h.

Referenced by analyze(), and MuIsoValidation().

std::vector<std::string> MuIsoValidation::names
private

Definition at line 120 of file MuIsoValidation.h.

Referenced by bookHistograms(), and InitStatics().

int MuIsoValidation::nEvents
private

Definition at line 142 of file MuIsoValidation.h.

Referenced by analyze(), and MuIsoValidation().

int MuIsoValidation::nIncMuons
private

Definition at line 143 of file MuIsoValidation.h.

Referenced by analyze(), and MuIsoValidation().

int MuIsoValidation::NUM_LOG_BINS
private

Definition at line 110 of file MuIsoValidation.h.

Referenced by bookHistograms(), InitStatics(), and MakeLogBinsForProfile().

const int MuIsoValidation::NUM_VARS = 21
staticprivate
std::vector< std::vector<MonitorElement*> > MuIsoValidation::p_2D
private

Definition at line 139 of file MuIsoValidation.h.

Referenced by bookHistograms(), FillHistos(), and MuIsoValidation().

std::vector< std::vector<double> > MuIsoValidation::param
private

Definition at line 121 of file MuIsoValidation.h.

Referenced by bookHistograms(), InitStatics(), and NormalizeHistos().

bool MuIsoValidation::requireCombinedMuon
private

Definition at line 112 of file MuIsoValidation.h.

Referenced by analyze(), and MuIsoValidation().

std::string MuIsoValidation::rootfilename
private

Definition at line 98 of file MuIsoValidation.h.

double MuIsoValidation::S_BIN_WIDTH
private

Definition at line 108 of file MuIsoValidation.h.

Referenced by InitStatics().

std::string MuIsoValidation::subDirName
private

Definition at line 101 of file MuIsoValidation.h.

std::string MuIsoValidation::subsystemname_
private

Definition at line 103 of file MuIsoValidation.h.

Referenced by MuIsoValidation().

double MuIsoValidation::theData[NUM_VARS]
private

Definition at line 132 of file MuIsoValidation.h.

Referenced by FillHistos(), and RecordData().

int MuIsoValidation::theMuonData
private

Definition at line 131 of file MuIsoValidation.h.

Referenced by analyze().

std::string MuIsoValidation::title_cd
private

Definition at line 116 of file MuIsoValidation.h.

Referenced by bookHistograms(), and InitStatics().

std::string MuIsoValidation::title_cone
private

Definition at line 115 of file MuIsoValidation.h.

Referenced by bookHistograms(), and InitStatics().

std::string MuIsoValidation::title_sam
private

Definition at line 114 of file MuIsoValidation.h.

Referenced by bookHistograms(), and InitStatics().

edm::InputTag MuIsoValidation::tkIsoDeposit_Tag
private

Definition at line 92 of file MuIsoValidation.h.