#include <RecoJets/JetProducers/src/BaseJetProducer.h>
Public Member Functions | |
BaseJetProducer (const edm::ParameterSet &ps) | |
std::string | jetType () const |
jet type | |
virtual void | produce (edm::Event &e, const edm::EventSetup &c) |
Produces the EDM products. | |
virtual bool | runAlgorithm (const JetReco::InputCollection &fInput, JetReco::OutputCollection *fOutput)=0 |
run algorithm itself | |
virtual | ~BaseJetProducer () |
Default destructor. | |
Private Attributes | |
double | mEInputCut |
double | mEtInputCut |
double | mJetPtMin |
std::string | mJetType |
edm::InputTag | mSrc |
bool | mVerbose |
Definition at line 21 of file BaseJetProducer.h.
BaseJetProducer::BaseJetProducer | ( | const edm::ParameterSet & | ps | ) |
Definition at line 81 of file BaseJetProducer.cc.
References edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), makeBasicJet(), makeCaloJet(), makeGenJet(), makePFJet(), and mJetType.
00082 : mSrc(conf.getParameter<edm::InputTag>( "src" )), 00083 mJetType (conf.getUntrackedParameter<string>( "jetType", "CaloJet")), 00084 mVerbose (conf.getUntrackedParameter<bool>("verbose", false)), 00085 mEtInputCut (conf.getParameter<double>("inputEtMin")), 00086 mEInputCut (conf.getParameter<double>("inputEMin")), 00087 mJetPtMin (conf.getParameter<double>("jetPtMin")) 00088 { 00089 std::string alias = conf.getUntrackedParameter<string>( "alias", conf.getParameter<std::string>("@module_label")); 00090 if (makeCaloJet (mJetType)) { 00091 produces<CaloJetCollection>().setBranchAlias (alias); 00092 } 00093 else if (makePFJet (mJetType)) produces<PFJetCollection>().setBranchAlias (alias); 00094 else if (makeGenJet (mJetType)) produces<GenJetCollection>().setBranchAlias (alias); 00095 else if (makeBasicJet (mJetType)) produces<BasicJetCollection>().setBranchAlias (alias); 00096 // else if (makeGenericJet (mJetType)) produces<GenericJetCollection>().setBranchAlias (alias); 00097 }
BaseJetProducer::~BaseJetProducer | ( | ) | [virtual] |
std::string cms::BaseJetProducer::jetType | ( | ) | const [inline] |
jet type
Definition at line 32 of file BaseJetProducer.h.
References mJetType.
00032 {return mJetType;}
void BaseJetProducer::produce | ( | edm::Event & | e, | |
const edm::EventSetup & | c | |||
) | [virtual] |
Produces the EDM products.
Implements edm::EDProducer.
Definition at line 103 of file BaseJetProducer.cc.
References DetId::Calo, copyConstituents(), copyVariables(), GenMuonPlsPt100GeV_cfg::cout, dumpJets(), lat::endl(), edm::EventSetup::get(), edm::Event::getByLabel(), ProtoJet::getTowerList(), i, index, iggi_31X_cfg::input, pfTauBenchmarkGeneric_cfi::jets, makeBasicJet(), makeCaloJet(), makeGenJet(), makePFJet(), JetMaker::makeSpecific(), output(), ProtoJet::p4(), edm::Event::put(), sortByPt(), and CaloTowerDetId::SubdetId.
00104 { 00105 // get input 00106 edm::Handle<edm::View <Candidate> > inputHandle; 00107 e.getByLabel( mSrc, inputHandle); 00108 // convert to input collection 00109 JetReco::InputCollection input; 00110 input.reserve (inputHandle->size()); 00111 for (unsigned i = 0; i < inputHandle->size(); ++i) { 00112 if ((mEtInputCut <= 0 || (*inputHandle)[i].et() > mEtInputCut) && 00113 (mEInputCut <= 0 || (*inputHandle)[i].energy() > mEInputCut)) { 00114 input.push_back (JetReco::InputItem (&((*inputHandle)[i]), i)); 00115 } 00116 } 00117 if (mVerbose) { 00118 std::cout << "BaseJetProducer::produce-> INPUT COLLECTION selected from" << mSrc 00119 << " with ET > " << mEtInputCut << " and/or E > " << mEInputCut << std::endl; 00120 for (unsigned index = 0; index < input.size(); ++index) { 00121 std::cout << " Input " << index << ", px/py/pz/pt/e: " 00122 << input[index]->px() << '/' << input[index]->py() << '/' << input[index]->pz() << '/' 00123 << input[index]->pt() << '/' << input[index]->energy() 00124 << std::endl; 00125 } 00126 } 00127 00128 // run algorithm 00129 vector <ProtoJet> output; 00130 if (input.empty ()) { 00131 edm::LogInfo ("Empty Event") << "empty input for jet algorithm: bypassing..." << std::endl; 00132 } 00133 else { 00134 runAlgorithm (input, &output); 00135 } 00136 00137 // produce output collection 00138 if (mVerbose) { 00139 std::cout << "OUTPUT JET COLLECTION:" << std::endl; 00140 } 00141 reco::Jet::Point vertex (0,0,0); // do not have true vertex yet, use default 00142 // make sure protojets are sorted 00143 sortByPt (&output); 00144 if (makeCaloJet (mJetType)) { 00145 edm::ESHandle<CaloGeometry> geometry; 00146 fSetup.get<CaloGeometryRecord>().get(geometry); 00147 const CaloSubdetectorGeometry* towerGeometry = 00148 geometry->getSubdetectorGeometry(DetId::Calo, CaloTowerDetId::SubdetId); 00149 auto_ptr<CaloJetCollection> jets (new CaloJetCollection); 00150 jets->reserve(output.size()); 00151 for (unsigned iJet = 0; iJet < output.size (); ++iJet) { 00152 ProtoJet* protojet = &(output [iJet]); 00153 if (protojet->p4().pt()<mJetPtMin) continue; 00154 const JetReco::InputCollection& constituents = protojet->getTowerList(); 00155 CaloJet::Specific specific; 00156 JetMaker::makeSpecific (constituents, *towerGeometry, &specific); 00157 jets->push_back (CaloJet (protojet->p4(), vertex, specific)); 00158 Jet* newJet = &(jets->back()); 00159 copyConstituents (constituents, *inputHandle, newJet); 00160 copyVariables (*protojet, newJet); 00161 } 00162 if (mVerbose) dumpJets (*jets); 00163 e.put(jets); 00164 } 00165 else if (makePFJet (mJetType)) { 00166 auto_ptr<PFJetCollection> jets (new PFJetCollection); 00167 jets->reserve(output.size()); 00168 for (unsigned iJet = 0; iJet < output.size (); ++iJet) { 00169 ProtoJet* protojet = &(output [iJet]); 00170 if (protojet->p4().pt()<mJetPtMin) continue; 00171 const JetReco::InputCollection& constituents = protojet->getTowerList(); 00172 PFJet::Specific specific; 00173 JetMaker::makeSpecific (constituents, &specific); 00174 jets->push_back (PFJet (protojet->p4(), vertex, specific)); 00175 Jet* newJet = &(jets->back()); 00176 copyConstituents (constituents, *inputHandle, newJet); 00177 copyVariables (*protojet, newJet); 00178 } 00179 if (mVerbose) dumpJets (*jets); 00180 e.put(jets); 00181 } 00182 else if (makeGenJet (mJetType)) { 00183 auto_ptr<GenJetCollection> jets (new GenJetCollection); 00184 jets->reserve(output.size()); 00185 for (unsigned iJet = 0; iJet < output.size (); ++iJet) { 00186 ProtoJet* protojet = &(output [iJet]); 00187 if (protojet->p4().pt()<mJetPtMin) continue; 00188 const JetReco::InputCollection& constituents = protojet->getTowerList(); 00189 GenJet::Specific specific; 00190 JetMaker::makeSpecific (constituents, &specific); 00191 jets->push_back (GenJet (protojet->p4(), vertex, specific)); 00192 Jet* newJet = &(jets->back()); 00193 copyConstituents (constituents, *inputHandle, newJet); 00194 copyVariables (*protojet, newJet); 00195 } 00196 if (mVerbose) dumpJets (*jets); 00197 e.put(jets); 00198 } 00199 else if (makeBasicJet (mJetType)) { 00200 auto_ptr<BasicJetCollection> jets (new BasicJetCollection); 00201 jets->reserve(output.size()); 00202 for (unsigned iJet = 0; iJet < output.size (); ++iJet) { 00203 ProtoJet* protojet = &(output [iJet]); 00204 if (protojet->p4().pt()<mJetPtMin) continue; 00205 const JetReco::InputCollection& constituents = protojet->getTowerList(); 00206 jets->push_back (BasicJet (protojet->p4(), vertex)); 00207 Jet* newJet = &(jets->back()); 00208 copyConstituents (constituents, *inputHandle, newJet); 00209 copyVariables (*protojet, newJet); 00210 } 00211 if (mVerbose) dumpJets (*jets); 00212 e.put(jets); 00213 } 00214 // else if (makeGenericJet (mJetType)) { 00215 // auto_ptr<GenericJetCollection> jets (new GenericJetCollection); 00216 // jets->reserve(output.size()); 00217 // for (unsigned iJet = 0; iJet < output.size (); ++iJet) { 00218 // ProtoJet* protojet = output [iJet]; 00219 // const JetReco::InputCollection& constituents = protojet->getTowerList(); 00220 // jets->push_back (GenericJet (protojet->p4())); 00221 // Jet* newJet = &(jets->back()); 00222 // copyConstituents (constituents, *inputHandle, newJet); 00223 // copyVariables (*protojet, newJet); 00224 // } 00225 // if (mVerbose) dumpJets (*jets); 00226 // e.put(jets); 00227 // } 00228 }
virtual bool cms::BaseJetProducer::runAlgorithm | ( | const JetReco::InputCollection & | fInput, | |
JetReco::OutputCollection * | fOutput | |||
) | [pure virtual] |
run algorithm itself
Implemented in cms::CDFMidpointJetProducer, cms::ExtKtJetProducer, cms::IterativeConeJetProducer, cms::KtJetProducer, cms::MidpointJetProducer, and cms::SISConeJetProducer.
double cms::BaseJetProducer::mEInputCut [private] |
Definition at line 43 of file BaseJetProducer.h.
double cms::BaseJetProducer::mEtInputCut [private] |
Definition at line 42 of file BaseJetProducer.h.
double cms::BaseJetProducer::mJetPtMin [private] |
Definition at line 44 of file BaseJetProducer.h.
std::string cms::BaseJetProducer::mJetType [private] |
edm::InputTag cms::BaseJetProducer::mSrc [private] |
Definition at line 39 of file BaseJetProducer.h.
bool cms::BaseJetProducer::mVerbose [private] |
Definition at line 41 of file BaseJetProducer.h.