CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
AnalysisTasksAnalyzerBTag.cc
Go to the documentation of this file.
5 
6 
9  edm::BasicAnalyzer::BasicAnalyzer(cfg, fs),
10  Jets_(cfg.getParameter<edm::InputTag>("Jets")),
11  bTagAlgo_(cfg.getParameter<std::string>("bTagAlgo")),
12  bins_(cfg.getParameter<unsigned int>("bins")),
13  lowerbin_(cfg.getParameter<double>("lowerbin")),
14  upperbin_(cfg.getParameter<double>("upperbin"))
15 {
16  hists_["NumSoftMuons"] = fs.make<TH1F>("NumSoftMuons" , "NumSoftMuons" ,4, -0.5, 3.5);
17  hists_["BTag_b"] = fs.make<TH1F>("BTag_b" , "BTag_b" , bins_, lowerbin_, upperbin_);
18  hists_["BTag_g"] = fs.make<TH1F>("BTag_g" , "BTag_g" , bins_, lowerbin_, upperbin_);
19  hists_["BTag_c"] = fs.make<TH1F>("BTag_c" , "BTag_c" , bins_, lowerbin_, upperbin_);
20  hists_["BTag_uds"] = fs.make<TH1F>("BTag_uds", "BTag_uds", bins_, lowerbin_, upperbin_);
21  hists_["BTag_other"] = fs.make<TH1F>("BTag_other", "BTag_other", bins_, lowerbin_, upperbin_);
22  hists_["effBTag_b"] = fs.make<TH1F>("effBTag_b" , "effBTag_b" , bins_, lowerbin_, upperbin_);
23  hists_["effBTag_g"] = fs.make<TH1F>("effBTag_g" , "effBTag_g" , bins_, lowerbin_, upperbin_);
24  hists_["effBTag_c"] = fs.make<TH1F>("effBTag_c" , "effBTag_c" , bins_, lowerbin_, upperbin_);
25  hists_["effBTag_uds"] = fs.make<TH1F>("effBTag_uds", "effBTag_uds", bins_, lowerbin_, upperbin_);
26  hists_["effBTag_other"] = fs.make<TH1F>("effBTag_other", "effBTag_other", bins_, lowerbin_, upperbin_);
27 }
29 {
30  for(unsigned int i=0; i< bins_; ++i){
31  hists_["effBTag_b"]->SetBinContent(i,hists_["BTag_b"]->Integral(i,hists_["BTag_b"]->GetNbinsX()+1)/hists_["BTag_b"]->Integral(0,hists_["BTag_b"]->GetNbinsX()+1) );
32  hists_["effBTag_g"]->SetBinContent(i,hists_["BTag_g"]->Integral(i,hists_["BTag_g"]->GetNbinsX()+1)/hists_["BTag_g"]->Integral(0,hists_["BTag_g"]->GetNbinsX()+1) );
33  hists_["effBTag_c"]->SetBinContent(i,hists_["BTag_c"]->Integral(i,hists_["BTag_c"]->GetNbinsX()+1)/hists_["BTag_c"]->Integral(0,hists_["BTag_c"]->GetNbinsX()+1) );
34  hists_["effBTag_uds"]->SetBinContent(i,hists_["BTag_uds"]->Integral(i,hists_["BTag_uds"]->GetNbinsX()+1)/hists_["BTag_uds"]->Integral(0,hists_["BTag_uds"]->GetNbinsX()+1) );
35  hists_["effBTag_other"]->SetBinContent(i,hists_["BTag_other"]->Integral(i,hists_["BTag_other"]->GetNbinsX()+1)/hists_["BTag_other"]->Integral(0,hists_["BTag_other"]->GetNbinsX()+1) );
36  }
37 }
39 void
41 {
42  // define what Jet you are using; this is necessary as FWLite is not
43  // capable of reading edm::Views
44  using pat::Jet;
45 
46  // Handle to the Jet collection
48  event.getByLabel(Jets_, Jets);
49 
50  // loop Jet collection and fill histograms
51  for(std::vector<Jet>::const_iterator Jet_it=Jets->begin(); Jet_it!=Jets->end(); ++Jet_it){
52  edm::LogInfo ("hint3") << "\n \n investigate the next jet...\n \n "<<std::endl;
53  pat::Jet Jet(*Jet_it);
54 
55 
56  const std::vector< std::pair< std::string, float > > discrPairs = Jet.getPairDiscri();
57  for(unsigned int pair_i = 0;pair_i <discrPairs.size(); ++pair_i ){
58  edm::LogInfo ("hint3") << "discr name: "<< discrPairs[pair_i].first<<" value: "<< discrPairs[pair_i].second<<std::endl;
59  }
60 
61  //Categorize the Jets
62  if( abs(Jet.partonFlavour())==5){
63  hists_["BTag_b"]->Fill(Jet.bDiscriminator(bTagAlgo_));
64  }
65  else{
66  if( abs(Jet.partonFlavour())==21 || abs(Jet.partonFlavour())==9 ){
67  hists_["BTag_g"]->Fill(Jet.bDiscriminator(bTagAlgo_));
68  }
69  else{
70  if( abs(Jet.partonFlavour())==4){
71  hists_["BTag_c"]->Fill(Jet.bDiscriminator(bTagAlgo_));
72  }
73  else{
74  if( abs(Jet.partonFlavour())==1 || abs(Jet.partonFlavour())==2 || abs(Jet.partonFlavour())==3){
75  hists_["BTag_uds"]->Fill(Jet.bDiscriminator(bTagAlgo_));
76  }
77  else{
78  hists_["BTag_other"]->Fill(Jet.bDiscriminator(bTagAlgo_));
79  }
80  }
81  }
82  }
83  }
84 }
int i
Definition: DBlmapReader.cc:9
void analyze(const edm::EventBase &event)
everything that needs to be done during the event loop
#define abs(x)
Definition: mlp_lapack.h:159
Abstract base class for FWLite and EDM friendly analyzers.
std::map< std::string, TH1 * > hists_
histograms
tuple Jets
Definition: METSkim_cff.py:17
float bDiscriminator(const std::string &theLabel) const
-— methods for accessing b-tagging info -—
Definition: Jet.cc:314
virtual ~AnalysisTasksAnalyzerBTag()
default destructor
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
int partonFlavour() const
return the parton-based flavour of the jet
Definition: Jet.cc:196
AnalysisTasksAnalyzerBTag(const edm::ParameterSet &cfg, TFileDirectory &fs)
default constructor
Analysis-level calorimeter jet class.
Definition: Jet.h:72
T * make() const
make new ROOT object
edm::InputTag Jets_
input tag for mouns
const std::vector< std::pair< std::string, float > > & getPairDiscri() const
get vector of paire labelname-disciValue
Definition: Jet.cc:309