ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/JetFitAnalyzer/src/JetFitAnalyzer.cc
Revision: 1.3
Committed: Wed Oct 14 03:09:38 2009 UTC (15 years, 6 months ago) by dnisson
Content type: text/plain
Branch: MAIN
CVS Tags: V00-01-03, V00-01-02, V00-01-01
Branch point for: V00-01-03-branch
Changes since 1.2: +3 -2 lines
Log Message:
oops, forgot headers

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.3 // $Id: JetFitAnalyzer.cc,v 1.2 2009/10/14 02:46:26 dnisson Exp $
25 dnisson 1.1 //
26     //
27    
28     #include "UserCode/JetFitAnalyzer/interface/JetFitAnalyzer.h"
29    
30     #include <vector>
31 dnisson 1.3 #include <iostream>
32 dnisson 1.1
33     JetFitAnalyzer::JetFitAnalyzer(const edm::ParameterSet& iConfig)
34     : user_minuit(0)
35     {
36     // get parameters from iConfig
37     ignorezero_ = iConfig.getUntrackedParameter("ignorezero", false);
38     rebinX_ = iConfig.getUntrackedParameter("rebinX", 1);
39     rebinY_ = iConfig.getUntrackedParameter("rebinY", 1);
40     P_cutoff_val_ = iConfig.getUntrackedParameter("P_cutoff_val", 0.5);
41    
42     jetfit::set_ignorezero(ignorezero_);
43     }
44    
45    
46     JetFitAnalyzer::~JetFitAnalyzer()
47     {
48    
49     // do anything here that needs to be done at desctruction time
50     // (e.g. close files, deallocate resources etc.)
51    
52     }
53    
54    
55     //
56     // member functions
57     //
58    
59     // ------------ method called to for each event ------------
60     void
61     JetFitAnalyzer::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup)
62     {
63     using namespace edm;
64    
65     jetfit::results r; std::vector<jetfit::trouble> t;
66    
67     TH2D *histo = make_histo(iEvent, iSetup);
68 dnisson 1.2 if (histo != 0) {
69     jetfit::model_def &_mdef = make_model_def(iEvent, iSetup, histo);
70     jetfit::set_model_def(&_mdef);
71     r = jetfit::fit_histo(histo, t, user_minuit, _mdef.get_n_special_par_sets(),
72     rebinX_, rebinY_, P_cutoff_val_);
73     analyze_results(r, t, histo);
74     }
75     else {
76 dnisson 1.3 std::cerr << "Fitting not performed" << std::endl;
77 dnisson 1.2 }
78 dnisson 1.1 }
79    
80    
81     // ------------ method called once each job just before starting event loop ------------
82     void
83     JetFitAnalyzer::beginJob(const edm::EventSetup&)
84     {
85     }
86    
87     // ------------ method called once each job just after ending the event loop ------------
88     void
89     JetFitAnalyzer::endJob() {
90     }
91    
92     //define this as a plug-in
93     // this is a base class-we can't do this DEFINE_FWK_MODULE(JetFitAnalyzer);