ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/JetFitAnalyzer/src/JetFitAnalyzer.cc
Revision: 1.14
Committed: Sun Dec 13 19:56:28 2009 UTC (15 years, 5 months ago) by dnisson
Content type: text/plain
Branch: MAIN
CVS Tags: V01-00-01, V01-00-00
Branch point for: V01-00-01-SPECTRUM
Changes since 1.13: +2 -1 lines
Log Message:
Fixed multiple-definition compile errors

File Contents

# User Rev Content
1 dnisson 1.1 // -*- C++ -*-
2     //
3     // Package: JetFitAnalyzer
4     // Class: JetFitAnalyzer
5     //
6     /**\class JetFitAnalyzer JetFitAnalyzer.cc UserCode/JetFitAnalyzer/src/JetFitAnalyzer.cc
7    
8     Description: Base class for using jetfit with CMSSW
9    
10     Implementation:
11     o Method make_histo is used to prepare a histogram for analysis;
12     the user can read this from a file or generate from the actual event
13     o Method make_model_def is used to define a formula and initial
14     parameters for the model used
15     o Method analyze_results performs user analysis on results;
16     the user is given a trouble vector and the original histogram in
17     addition.
18     o The function pointer user_minuit defines what to do after each fit
19     is done. The pointer should be obtained in the subclass constructor.
20     */
21     //
22     // Original Author: David Nisson
23     // Created: Wed Aug 5 16:38:38 PDT 2009
24 dnisson 1.14 // $Id: JetFitAnalyzer.cc,v 1.13 2009/11/27 20:16:59 dnisson Exp $
25 dnisson 1.1 //
26     //
27    
28     #include "UserCode/JetFitAnalyzer/interface/JetFitAnalyzer.h"
29    
30     JetFitAnalyzer::JetFitAnalyzer(const edm::ParameterSet& iConfig)
31     {
32     // get parameters from iConfig
33     P_cutoff_val_ = iConfig.getUntrackedParameter("P_cutoff_val", 0.5);
34 dnisson 1.14
35 dnisson 1.1 }
36    
37    
38     JetFitAnalyzer::~JetFitAnalyzer()
39     {
40    
41     // do anything here that needs to be done at desctruction time
42     // (e.g. close files, deallocate resources etc.)
43    
44     }
45    
46    
47     //
48     // member functions
49     //
50    
51     // ------------ method called to for each event ------------
52     void
53     JetFitAnalyzer::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup)
54     {
55     using namespace edm;
56    
57 dnisson 1.13 HistoFitter histoFitter;
58 dnisson 1.12 std::vector<HistoFitter::Trouble> t;
59 dnisson 1.1
60     TH2D *histo = make_histo(iEvent, iSetup);
61 dnisson 1.2 if (histo != 0) {
62 dnisson 1.11 HistoFitter::ModelDefinition &_mdef = make_model_def(iEvent, iSetup, histo);
63 dnisson 1.13 histoFitter.set_ModelDefinition(&_mdef);
64 dnisson 1.12 HistoFitter::FitResults r(histoFitter.fit_histo(histo, t, 1, P_cutoff_val_));
65 dnisson 1.2 analyze_results(r, t, histo);
66     }
67     else {
68 dnisson 1.3 std::cerr << "Fitting not performed" << std::endl;
69 dnisson 1.2 }
70 dnisson 1.1 }
71    
72    
73     // ------------ method called once each job just before starting event loop ------------
74     void
75     JetFitAnalyzer::beginJob(const edm::EventSetup&)
76     {
77     }
78    
79     // ------------ method called once each job just after ending the event loop ------------
80     void
81     JetFitAnalyzer::endJob() {
82     }
83    
84     //define this as a plug-in
85     // this is a base class-we can't do this DEFINE_FWK_MODULE(JetFitAnalyzer);