CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_1_8_patch13/src/RecoParticleFlow/PFRootEvent/src/FWLiteJetProducer.cc

Go to the documentation of this file.
00001 #include "RecoParticleFlow/PFRootEvent/interface/FWLiteJetProducer.h"
00002 #include "RecoParticleFlow/PFRootEvent/interface/ProtoJet.h"
00003 #include "RecoParticleFlow/PFRootEvent/interface/JetRecoTypes.h"
00004 #include "DataFormats/JetReco/interface/CaloJet.h"
00005 #include "DataFormats/JetReco/interface/GenJet.h"
00006 #include "DataFormats/JetReco/interface/BasicJet.h"
00007 #include "RecoParticleFlow/PFRootEvent/interface/JetMaker.h"
00008 #include "RecoParticleFlow/PFRootEvent/interface/JetAlgoHelper.h"
00009 #include "DataFormats/Candidate/interface/CandidateFwd.h"
00010 #include "FWCore/Framework/interface/EDProducer.h"
00011 #include "DataFormats/Common/interface/EDProductfwd.h"
00012 #include "DataFormats/Candidate/interface/CandidateFwd.h"
00013 #include "DataFormats/RecoCandidate/interface/RecoCandidate.h"
00014 #include <iostream>
00015 #include <vector>
00016 
00017 using namespace reco;
00018 using namespace std;
00019 using namespace JetReco;
00020 
00021 //--------------test Mac/afs------------------
00022 
00023 FWLiteJetProducer::FWLiteJetProducer(){ 
00024 
00025   mEtInputCut_=0.5;     
00026   mEInputCut_=0.;
00027   seedThreshold_=1.0;
00028   coneRadius_=0.5;
00029   coneAreaFraction_=1.0;
00030   maxPairSize_=2;
00031   maxIterations_=100;
00032   overlapThreshold_=0.75;
00033   ptMin_=10.;
00034   rparam_=1.;
00035   algoIC_=0;
00036   algoMC_=0;
00037 }
00038 
00039 
00040 
00041 
00042 //-----------------------------------------------------------
00043 FWLiteJetProducer::~FWLiteJetProducer() {       
00044   delete algoIC_;
00045   delete algoMC_;
00046 }
00047 //-----------------------------------------------------------
00048 
00049 void FWLiteJetProducer::updateParameter(){
00050   
00051   if (algoIC_) delete algoIC_;
00052   if (algoMC_) delete algoMC_;
00053   algoIC_= new CMSIterativeConeAlgorithm(seedThreshold_,coneRadius_ );
00054   algoMC_= new CMSMidpointAlgorithm(seedThreshold_, coneRadius_,coneAreaFraction_, 
00055                                     maxPairSize_, maxIterations_, overlapThreshold_, 0) ; 
00056   algoF_.setPtMin(ptMin_);
00057   algoF_.setRParam(rparam_);
00058   print();
00059 }
00060 
00061 
00062 //-----------------------------------------------------------
00063 void FWLiteJetProducer::print() {       
00064 
00065   cout <<"--- FWLiteJetProducer:Print(): ---" << endl;
00066 
00067   cout <<"Cut: mEtInputCut " << mEtInputCut_  <<endl;
00068   cout <<"Cut: mEInputCut " <<  mEInputCut_<<endl; 
00069   cout <<"IC/MC: seedThreshold " << seedThreshold_  <<endl;
00070   cout <<"IC/MC: coneRadius " << coneRadius_ <<endl;
00071   cout <<"MC: coneAreaFraction " << coneAreaFraction_ <<endl; 
00072   cout <<"MC: maxPairSize " <<maxPairSize_ <<endl;
00073   cout <<"MC: maxIterations " << maxIterations_ <<endl;
00074   cout <<"MC: overlapThreshold " <<  overlapThreshold_<<endl;
00075   cout <<"FJ: PtMin " << ptMin_ <<endl;
00076   cout <<"FJ: Rparam " <<  rparam_<<endl;
00077   cout <<"----------------------------------" << endl;
00078 
00079 }
00080 
00081 
00082 
00083 //-----------------------------------------------------------
00084 void FWLiteJetProducer::applyCuts(const reco::CandidatePtrVector& Candidates, 
00085                                   JetReco::InputCollection* input){
00087   //edm::OrphanHandle< reco::CandidateCollection >  CandidateHandle(&(Candidates), edm::ProductID(20001) );
00088 
00089   input->reserve ( Candidates.size());  
00090   //cout<<" Candidate " << CandidateHandle->size()<<Candidates.size() << endl;
00091   for (unsigned i = 0; i <Candidates.size() ; i++) {
00092     const reco::Candidate* constituent = Candidates[i].get();        
00093 
00094     if ((mEtInputCut_ <= 0 || constituent->et() > mEtInputCut_) &&
00095         (mEInputCut_ <= 0 || constituent->energy() > mEInputCut_)) {                    
00096       input->push_back (InputItem(constituent,i));                  
00097     }
00098   }
00099 }
00100 
00101 //-----------------------------------------------------------
00102 void FWLiteJetProducer::makeIterativeConeJets(const InputCollection& fInput, OutputCollection* fOutput){        
00103   if (fInput.empty ()) {
00104     std::cout << "empty input for jet algorithm: bypassing..." << std::endl;
00105   }
00106   else {                                      
00107     algoIC_->run(fInput, & (*fOutput));
00108   }     
00109 }       
00110 
00111 //-----------------------------------------------------------
00112 void FWLiteJetProducer::makeFastJets(const InputCollection& fInput, OutputCollection* fOutput){
00113   // FastJetFWLiteWrapper algo;
00114   if (fInput.empty ()) {
00115     std::cout << "empty input for jet algorithm: bypassing..." << std::endl;
00116   }
00117   else {                                      
00118     algoF_.run(fInput, &(*fOutput));
00119   } 
00120 }
00121 
00122 //-----------------------------------------------------------
00123 void FWLiteJetProducer::makeMidpointJets(const InputCollection& fInput, OutputCollection* fOutput){
00124   //  CMSMidpointAlgorithm algo;
00125   if (fInput.empty ()) {
00126     std::cout << "empty input for jet algorithm: bypassing..." << std::endl;
00127   }
00128   else {                                      
00129     algoMC_->run(fInput, &(*fOutput));
00130   } 
00131 }
00132 
00133 
00134 
00135 //-----------------------------------------------------------