ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/CmsHi/JetAnalysis/src/MyVirtualJetProducer.h
Revision: 1.6
Committed: Fri Jan 25 17:08:00 2013 UTC (12 years, 3 months ago) by yilmaz
Content type: text/plain
Branch: MAIN
CVS Tags: HiForest_V02_85, HiForest_V02_84, HiForest_V02_83, HiForest_V02_82, HiForest_V02_81, HiForest_V02_80, HiForest_V02_79, HiForest_V02_78, HiForest_V02_77, HiForest_V02_76, HiForest_V02_75, HiForest_V02_74, HiForest_V02_73, HiForest_V02_72, HiForest_V02_71, HiForest_V02_70, HiForest_V02_69, HiForest_V02_68, HiForest_V02_67, HiForest_V02_66, HiForest_V02_65, HiForest_V02_64, HiForest_V02_63, HiForest_V02_62, HiForest_V02_61, HiForest_V02_60, HiForest_V02_59, HiForest_V02_58, HiForest_V02_57, HiForest_V02_56, HiForest_V02_55, HiForest_V02_54, HEAD
Changes since 1.5: +3 -3 lines
Log Message:
Random cones added

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 yilmaz 1.6 #include "fastjet/GhostedAreaSpec.hh"
22 yilmaz 1.1
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 yilmaz 1.6 typedef boost::shared_ptr<fastjet::GhostedAreaSpec> GhostedAreaSpecPtr;
77 yilmaz 1.1 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 yilmaz 1.6 GhostedAreaSpecPtr fjActiveArea_; // fastjet active area definition
181 yilmaz 1.1 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