ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/CmsHi/JetAnalysis/src/MyVirtualJetProducer.h
Revision: 1.5
Committed: Wed Oct 20 14:11:46 2010 UTC (14 years, 6 months ago) by yilmaz
Content type: text/plain
Branch: MAIN
CVS Tags: HiForest_V02_53, HiForest_V02_52, HiForest_V02_51, HiForest_V02_50, HiForest_V02_49, HiForest_V02_48, HiForest_V02_47, HiForest_V02_46, HiForest_V02_45, HiForest_V02_44, HiForest_V02_43, HiForest_V02_42, HiForest_V02_41, HiForest_V02_40, HiForest_V02_39, HiForest_V02_38, HiForest_V02_37, HiForest_V02_36, HiForest_V02_35, HiForest_V02_34, HiForest_V02_33, HiForest_V02_32, HiForest_V02_31, HiForest_V02_30, HiForest_V02_27, HiForest_V02_26, QM_2012, HiForest_V02_25, HiForest_V02_24, HiForest_V02_23, HiForest_V02_22, HiForest_V02_21, HiForest_V02_20, HiForest_V02_19, HiForest_V02_18, HiForest_V02_17, HiForest_V02_16, HiForest_V02_15, HiForest_V02_14, HiForest_V02_13, HiForest_V02_12, HiForest_V02_11, HiForest_V02_10, HiForest_V02_09, HiForest_V02_08, HiForest_V02_07, HiForest_V02_06, HiForest_V02_05, HiForest_V02_04, HiForest_V02_03, HiForest_V02_02, HiForest_V02_01, HiForest_V02_00, hi44X_02, hi413_03, hi441_1, hi441_0, hi413_11, hi413_10, hi413_09, hi413_08, hi413_07, hi413_06, hi413_05, hi413_04, hi413_02, hi39X_01, tag_d20110915, cmssw39x_base, cmssw39X_base
Branch point for: branch_44x, cmssw39x_branch
Changes since 1.4: +2 -0 lines
Log Message:
upadte

File Contents

# User Rev Content
1 yilmaz 1.1 #ifndef RecoJets_JetProducers_plugins_MyVirtualJetProducer_h
2     #define RecoJets_JetProducers_plugins_MyVirtualJetProducer_h
3    
4    
5     #include "FWCore/Framework/interface/EDProducer.h"
6     #include "FWCore/ParameterSet/interface/ParameterSet.h"
7     #include "DataFormats/Candidate/interface/Candidate.h"
8     #include "DataFormats/Candidate/interface/CandidateFwd.h"
9     #include "DataFormats/JetReco/interface/Jet.h"
10     #include "DataFormats/JetReco/interface/CaloJet.h"
11     #include "DataFormats/JetReco/interface/PFJet.h"
12     #include "DataFormats/JetReco/interface/BasicJet.h"
13     #include "DataFormats/JetReco/interface/GenJet.h"
14    
15     #include "RecoJets/JetProducers/interface/PileUpSubtractor.h"
16    
17     #include "fastjet/JetDefinition.hh"
18     #include "fastjet/ClusterSequence.hh"
19     #include "fastjet/ClusterSequenceArea.hh"
20     #include "fastjet/PseudoJet.hh"
21     #include "fastjet/ActiveAreaSpec.hh"
22    
23     #include <vector>
24     #include <boost/shared_ptr.hpp>
25 yilmaz 1.2 #include "TNtuple.h"
26 yilmaz 1.1
27     class MyVirtualJetProducer : public edm::EDProducer
28     {
29     protected:
30     //
31     // typedefs & structs
32     //
33     struct JetType {
34     enum Type {
35     BasicJet,
36     GenJet,
37     CaloJet,
38     PFJet,
39     TrackJet,
40     LastJetType // no real type, technical
41     };
42     static const char *names[];
43     static Type byName(const std::string &name);
44     };
45    
46     JetType::Type jetTypeE;
47    
48     inline bool makeCaloJet(const JetType::Type &fTag) {
49     return fTag == JetType::CaloJet;
50     }
51     inline bool makePFJet(const JetType::Type &fTag) {
52     return fTag == JetType::PFJet;
53     }
54     inline bool makeGenJet(const JetType::Type &fTag) {
55     return fTag == JetType::GenJet;
56     }
57     inline bool makeTrackJet(const JetType::Type &fTag) {
58     return fTag == JetType::TrackJet;
59     }
60     inline bool makeBasicJet(const JetType::Type &fTag) {
61     return fTag == JetType::BasicJet;
62     }
63    
64    
65     //
66     // construction/destruction
67     //
68     public:
69     explicit MyVirtualJetProducer(const edm::ParameterSet& iConfig);
70     virtual ~MyVirtualJetProducer();
71    
72     // typedefs
73     typedef boost::shared_ptr<fastjet::ClusterSequence> ClusterSequencePtr;
74     typedef boost::shared_ptr<fastjet::JetDefinition::Plugin> PluginPtr;
75     typedef boost::shared_ptr<fastjet::JetDefinition> JetDefPtr;
76     typedef boost::shared_ptr<fastjet::ActiveAreaSpec> ActiveAreaSpecPtr;
77     typedef boost::shared_ptr<fastjet::RangeDefinition> RangeDefPtr;
78 yilmaz 1.2
79     TNtuple* ntuple;
80 yilmaz 1.1
81     //
82     // member functions
83     //
84     public:
85     virtual void produce(edm::Event& iEvent, const edm::EventSetup& iSetup);
86     std::string jetType() const { return jetType_; }
87    
88     protected:
89    
90     //
91     // Internal methods for jet production.
92     // The user can either use the defaults, or override all of these methods.
93     //
94    
95     // This method creates the "produces" statement in the constructor.
96     // The default is to produce a single jet collection as per the user's request
97     // (Calo,PF,Basic, or Gen).
98     virtual void makeProduces( std::string s, std::string tag = "" );
99    
100     // This method inputs the constituents from "inputs" and modifies
101     // fjInputs.
102     virtual void inputTowers();
103    
104     // This checks if the tower is anomalous (if a calo tower).
105     virtual bool isAnomalousTower(reco::CandidatePtr input);
106    
107     // This will copy the fastjet constituents to the jet itself.
108     virtual void copyConstituents(const std::vector<fastjet::PseudoJet>&fjConstituents,
109     reco::Jet* jet);
110    
111     // This will run the actual algorithm. This method is pure virtual and
112     // has no default.
113     virtual void runAlgorithm( edm::Event& iEvent, const edm::EventSetup& iSetup) = 0;
114    
115     // Do the offset correction.
116     // Only runs if "doPUOffsetCorrection_" is true.
117     void offsetCorrectJets(std::vector<fastjet::PseudoJet> & orphanInput);
118    
119     // This will write the jets to the event.
120     // The default is to write out the single jet collection in the default "produces"
121     // statement.
122     // This is a function template that can be called for the five types
123     // CaloJet, PFJet, GenJet, TrackJet, BasicJet. This is not suitable
124     // for compound jets.
125     // Note: The "output" method is virtual and can be overriden.
126     // The default behavior is to call the function template "writeJets".
127     virtual void output( edm::Event & iEvent, edm::EventSetup const& iSetup );
128     template< typename T >
129     void writeJets( edm::Event & iEvent, edm::EventSetup const& iSetup );
130    
131     // This method copies the constituents from the fjConstituents method
132     // to an output of CandidatePtr's.
133     virtual std::vector<reco::CandidatePtr>
134     getConstituents(const std::vector<fastjet::PseudoJet>&fjConstituents);
135    
136    
137    
138     //
139     // member data
140     //
141     protected:
142     std::string moduleLabel_; // label for this module
143     edm::InputTag src_; // input constituent source
144     edm::InputTag srcPVs_; // primary vertex source
145     std::string jetType_; // type of jet (Calo,PF,Basic,Gen)
146     std::string jetAlgorithm_; // the jet algorithm to use
147     double rParam_; // the R parameter to use
148     double inputEtMin_; // minimum et of input constituents
149     double inputEMin_; // minimum e of input constituents
150     double jetPtMin_; // minimum jet pt
151     bool doPVCorrection_; // correct to primary vertex?
152    
153     // for restricting inputs due to processing time
154     bool restrictInputs_; // restrict inputs to first "maxInputs" inputs.
155     unsigned int maxInputs_; // maximum number of inputs.
156    
157     // for fastjet jet area calculation
158     bool doAreaFastjet_; // calculate area w/ fastjet?
159     // for fastjet rho calculation
160     bool doRhoFastjet_; // calculate rho w/ fastjet?
161 yilmaz 1.4 bool doFastJetNonUniform_; // choice of eta-dependent PU calculation
162 yilmaz 1.1
163     // for pileup offset correction
164     bool doPUOffsetCorr_; // add the pileup calculation from offset correction?
165 yilmaz 1.3 std::string puSubtractorName_;
166 yilmaz 1.4
167 yilmaz 1.1 // anomalous cell cuts
168     unsigned int maxBadEcalCells_; // maximum number of bad ECAL cells
169     unsigned int maxRecoveredEcalCells_; // maximum number of recovered ECAL cells
170     unsigned int maxProblematicEcalCells_; // maximum number of problematic ECAL cells
171     unsigned int maxBadHcalCells_; // maximum number of bad HCAL cells
172     unsigned int maxRecoveredHcalCells_; // maximum number of recovered HCAL cells
173     unsigned int maxProblematicHcalCells_; // maximum number of problematic HCAL cells
174    
175     std::vector<edm::Ptr<reco::Candidate> > inputs_; // input candidates [View, PtrVector and CandCollection have limitations]
176     reco::Particle::Point vertex_; // Primary vertex
177     ClusterSequencePtr fjClusterSeq_; // fastjet cluster sequence
178     JetDefPtr fjJetDefinition_; // fastjet jet definition
179     PluginPtr fjPlugin_; // fastjet plugin
180     ActiveAreaSpecPtr fjActiveArea_; // fastjet active area definition
181     RangeDefPtr fjRangeDef_; // range definition
182     std::vector<fastjet::PseudoJet> fjInputs_; // fastjet inputs
183     std::vector<fastjet::PseudoJet> fjJets_; // fastjet jets
184    
185 yilmaz 1.4 // Parameters of the eta-dependent rho calculation
186     std::vector<double> puCenters_;
187     double puWidth_;
188    
189 yilmaz 1.1 std::string jetCollInstanceName_; // instance name for output jet collection
190 yilmaz 1.5
191     public:
192 yilmaz 1.1 boost::shared_ptr<PileUpSubtractor> subtractor_;
193 yilmaz 1.2 const CaloGeometry *geo;
194 yilmaz 1.1
195     };
196    
197    
198    
199    
200    
201     #endif