CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
AnalysisTasksAnalyzerJEC.cc
Go to the documentation of this file.
5 #include "TH2.h"
6 #include "TProfile.h"
7 
10  edm::BasicAnalyzer::BasicAnalyzer(cfg, fs),
11  Jets_(cfg.getParameter<edm::InputTag>("Jets")),
12  jecLevel_(cfg.getParameter<std::string>("jecLevel")),
13  jecSetLabel_(cfg.getParameter<std::string>("jecSetLabel"))
14 {
15  hists_["Response" ] = fs.make<TH2F>("Response" , "response "+TString(jecLevel_)+"; #eta;p_{T}(reco)/p_{T}(gen)" , 5, -3.3, 3.3, 100, 0.4, 1.6);
16 }
19 {
20 }
22 void
24 {
25  // define what Jet you are using; this is necessary as FWLite is not
26  // capable of reading edm::Views
27  using pat::Jet;
28 
29  // Handle to the Jet collection
31  event.getByLabel(Jets_, Jets);
32 
33  // loop Jet collection and fill histograms
34  for(std::vector<Jet>::const_iterator jet_it=Jets->begin(); jet_it!=Jets->end(); ++jet_it){
35 
36 
38  for(unsigned int k=0; k< jet_it->availableJECSets().size(); ++k){
39  edm::LogInfo ("hint1") <<"\n \n *************** HINT 1 *************** \n \n Label of available JEC Set: "<< jet_it->availableJECSets()[k]
40  <<"\n \n You found out which JEC Sets were created within the PAT tuple creation! The wrong label caused the segmentation fault in the next for-loop where you ask for JEC levels of a JEC Set that does not exist. Correct the JEC label in your config file and eliminate the segmentation fault. \n *********************************************** \n";
41  }
42  for(unsigned int k=0; k< jet_it->availableJECLevels().size(); ++k){
43  edm::LogInfo("hint2")<<" \n \n Label of available JEC level: "<< jet_it->availableJECLevels(jecSetLabel_)[k] << "\n \n ";
44  }
45  edm::LogInfo("hint2")<<"\n \n *************** HINT 2 ************** \n You did it correctly congratulations!!!! And you found out above which JEC levels are saved within the jets. We want to investigate these in the following with the response function. At the moment you are trying to access the JEC Level: "
46  << jecLevel_ << ". Does it exist? This causes the error below (see 'Exception Message')! Correct the label of the correction level to an existing one that you are interested in. \n ******************************************* \n " <<std::endl;
47  if(jet_it->genParticlesSize()>0){
48  hists_["Response" ]->Fill( jet_it->correctedJet(jecLevel_).eta(), jet_it->correctedJet(jecLevel_).pt()/ jet_it->genParticle(0)->pt());
49  }
50  }
51 }
AnalysisTasksAnalyzerJEC(const edm::ParameterSet &cfg, TFileDirectory &fs)
default constructor
edm::InputTag Jets_
input tag for mouns
void analyze(const edm::EventBase &event)
everything that needs to be done during the event loop
virtual ~AnalysisTasksAnalyzerJEC()
default destructor
Abstract base class for FWLite and EDM friendly analyzers.
tuple Jets
Definition: METSkim_cff.py:17
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 k[5][pyjets_maxn]
Analysis-level calorimeter jet class.
Definition: Jet.h:71
std::map< std::string, TH2 * > hists_
histograms
T * make() const
make new ROOT object