CMS 3D CMS Logo

Public Member Functions | Private Attributes

PFBlockProducer Class Reference

Producer for particle flow blocks. More...

#include <PFBlockProducer.h>

Inheritance diagram for PFBlockProducer:
edm::EDProducer edm::ProducerBase edm::ProductRegistryHelper

List of all members.

Public Member Functions

virtual void beginJob ()
virtual void beginRun (edm::Run &r, const edm::EventSetup &c)
 PFBlockProducer (const edm::ParameterSet &)
virtual void produce (edm::Event &, const edm::EventSetup &)
 ~PFBlockProducer ()

Private Attributes

edm::InputTag inputTagConvBremGsfRecTracks_
edm::InputTag inputTagEGPhotons_
edm::InputTag inputTagGsfRecTracks_
edm::InputTag inputTagPFClustersECAL_
edm::InputTag inputTagPFClustersHCAL_
edm::InputTag inputTagPFClustersHFEM_
edm::InputTag inputTagPFClustersHFHAD_
edm::InputTag inputTagPFClustersPS_
edm::InputTag inputTagPFConversions_
edm::InputTag inputTagPFNuclear_
edm::InputTag inputTagPFV0_
edm::InputTag inputTagRecMuons_
edm::InputTag inputTagRecTracks_
PFBlockAlgo pfBlockAlgo_
 Particle flow block algorithm.
bool useConvBremGsfTracks_
 switch on/off Conversions Brem Recovery
bool useConversions_
 switch on/off Conversions
bool useEGPhotons_
 use EG photons ?
bool useKDTreeTrackEcalLinker_
bool useNuclear_
 use NuclearInteractions ?
bool usePFatHLT_
 Particle Flow at HLT ?
bool useV0_
 switch on/off V0
bool verbose_
 verbose ?

Detailed Description

Producer for particle flow blocks.

This producer makes use of PFBlockAlgo, the particle flow block algorithm. Particle flow itself consists in reconstructing particles from the particle flow blocks This is done at a later stage, see PFProducer and PFAlgo.

Author:
Colin Bernet
Date:
April 2007

Definition at line 34 of file PFBlockProducer.h.


Constructor & Destructor Documentation

PFBlockProducer::PFBlockProducer ( const edm::ParameterSet iConfig) [explicit]

Definition at line 34 of file PFBlockProducer.cc.

References edm::ParameterSet::getParameter(), and edm::ParameterSet::getUntrackedParameter().

                                                               {
  

  // use configuration file to setup input/output collection names
  inputTagRecTracks_ 
    = iConfig.getParameter<InputTag>("RecTracks");

  inputTagGsfRecTracks_ 
    = iConfig.getParameter<InputTag>("GsfRecTracks");

    inputTagConvBremGsfRecTracks_ 
    = iConfig.getParameter<InputTag>("ConvBremGsfRecTracks");

  inputTagRecMuons_ 
    = iConfig.getParameter<InputTag>("RecMuons");

  inputTagPFNuclear_ 
    = iConfig.getParameter<InputTag>("PFNuclear");

  inputTagPFConversions_ 
    = iConfig.getParameter<InputTag>("PFConversions");

  inputTagPFV0_ 
    = iConfig.getParameter<InputTag>("PFV0");

  inputTagPFClustersECAL_ 
    = iConfig.getParameter<InputTag>("PFClustersECAL");

  inputTagPFClustersHCAL_ 
    = iConfig.getParameter<InputTag>("PFClustersHCAL");

  inputTagPFClustersHFEM_ 
    = iConfig.getParameter<InputTag>("PFClustersHFEM");

  inputTagPFClustersHFHAD_ 
    = iConfig.getParameter<InputTag>("PFClustersHFHAD");

  inputTagPFClustersPS_ 
    = iConfig.getParameter<InputTag>("PFClustersPS");

  useEGPhotons_ = iConfig.getParameter<bool>("useEGPhotons");
  
  if(useEGPhotons_) {
    inputTagEGPhotons_
      = iConfig.getParameter<InputTag>("EGPhotons");
  }

  verbose_ = 
    iConfig.getUntrackedParameter<bool>("verbose",false);

  bool debug_ = 
    iConfig.getUntrackedParameter<bool>("debug",false);

  usePFatHLT_ = iConfig.getParameter<bool>("usePFatHLT");

  useNuclear_ = iConfig.getParameter<bool>("useNuclear");

  useConversions_ = iConfig.getParameter<bool>("useConversions");
  
  useConvBremGsfTracks_ = iConfig.getParameter<bool>("useConvBremGsfTracks");

  bool useConvBremPFRecTracks = iConfig.getParameter<bool>("useConvBremPFRecTracks");

  useV0_ = iConfig.getParameter<bool>("useV0");

  produces<reco::PFBlockCollection>();
  
  // Glowinski & Gouzevitch
  useKDTreeTrackEcalLinker_ = iConfig.getParameter<bool>("useKDTreeTrackEcalLinker");
  // !Glowinski & Gouzevitch
  
  // particle flow parameters  -----------------------------------

  std::vector<double> DPtovPtCut 
     = iConfig.getParameter<std::vector<double> >("pf_DPtoverPt_Cut");   
  if (DPtovPtCut.size()!=5)
    {
      edm::LogError("MisConfiguration")<<" vector pf_DPtoverPt_Cut has to be of size 5";
      throw;
    }

  std::vector<unsigned> NHitCut 
     = iConfig.getParameter<std::vector<unsigned> >("pf_NHit_Cut");   
  if (NHitCut.size()!=5)
    {
      edm::LogError("MisConfiguration")<<" vector pf_NHit_Cut has to be of size 5";
      throw;
    }

  bool useIterTracking
    = iConfig.getParameter<bool>("useIterTracking");

  int nuclearInteractionsPurity
    = iConfig.getParameter<unsigned>("nuclearInteractionsPurity");

  // if first parameter 0, deactivated 
  std::vector<double> EGPhotonSelectionCuts ;

  if (useEGPhotons_)
    EGPhotonSelectionCuts = iConfig.getParameter<std::vector<double> >("PhotonSelectionCuts");   


  if (useNuclear_){
    if (nuclearInteractionsPurity > 3 || nuclearInteractionsPurity < 1)  {
      nuclearInteractionsPurity = 1;
      edm::LogInfo("PFBlockProducer")  << "NI purity not properly implemented. Set it to the strongest level " << nuclearInteractionsPurity << endl;
    }
    vector<string> securityLevel;
    securityLevel.push_back("isNucl"); securityLevel.push_back("isNucl && isNuclLoose");  securityLevel.push_back("isNucl && isNuclLoose && isNuclKink"); 
    edm::LogInfo("PFBlockProducer")  << "NI interactions are corrected in PFlow for " << securityLevel[nuclearInteractionsPurity-1].c_str() << endl;
  }


  pfBlockAlgo_.setParameters( DPtovPtCut,
                              NHitCut,
                              useConvBremPFRecTracks,
                              useIterTracking,
                              nuclearInteractionsPurity,
                              useEGPhotons_,
                              EGPhotonSelectionCuts );
  
  pfBlockAlgo_.setDebug(debug_);

  // Glowinski & Gouzevitch
  pfBlockAlgo_.setUseOptimization(useKDTreeTrackEcalLinker_);
  // !Glowinski & Gouzevitch
}
PFBlockProducer::~PFBlockProducer ( )

Definition at line 164 of file PFBlockProducer.cc.

{ }

Member Function Documentation

void PFBlockProducer::beginJob ( void  ) [virtual]

Reimplemented from edm::EDProducer.

Definition at line 169 of file PFBlockProducer.cc.

{ }
void PFBlockProducer::beginRun ( edm::Run r,
const edm::EventSetup c 
) [virtual]

Reimplemented from edm::EDProducer.

Definition at line 172 of file PFBlockProducer.cc.

                                                    { }
void PFBlockProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
) [virtual]

Implements edm::EDProducer.

Definition at line 177 of file PFBlockProducer.cc.

References edm::EventID::event(), newFWLiteAna::found, edm::Event::getByLabel(), edm::EventBase::id(), LogDebug, pfConversions_cfi::pfConversions, pfV0_cfi::pfV0, edm::Event::put(), and edm::EventID::run().

                                                   {
  
  LogDebug("PFBlockProducer")<<"START event: "<<iEvent.id().event()
                             <<" in run "<<iEvent.id().run()<<endl;
  
  
  // get rectracks
  
  Handle< reco::PFRecTrackCollection > recTracks;
  
  // LogDebug("PFBlockProducer")<<"get reco tracks"<<endl;
  bool found = iEvent.getByLabel(inputTagRecTracks_, recTracks);
    
  if(!found )
    LogError("PFBlockProducer")<<" cannot get rectracks: "
                               <<inputTagRecTracks_<<endl;



  // get GsfTracks 
  Handle< reco::GsfPFRecTrackCollection > GsfrecTracks;

  if(!usePFatHLT_) {
    found = iEvent.getByLabel(inputTagGsfRecTracks_,GsfrecTracks);

    if(!found )
      LogError("PFBlockProducer")<<" cannot get Gsfrectracks: "
                                 << inputTagGsfRecTracks_ <<endl;
  }

  // get ConvBremGsfTracks 
  Handle< reco::GsfPFRecTrackCollection > convBremGsfrecTracks;

  if(useConvBremGsfTracks_) {
    found = iEvent.getByLabel(inputTagConvBremGsfRecTracks_,convBremGsfrecTracks);

    if(!found )
      LogError("PFBlockProducer")<<" cannot get ConvBremGsfrectracks: "
                                 << inputTagConvBremGsfRecTracks_ <<endl;
  }

  // get recmuons
  Handle< reco::MuonCollection > recMuons;

  // LogDebug("PFBlockProducer")<<"get reco muons"<<endl;
  //if(!usePFatHLT_) {
  found = iEvent.getByLabel(inputTagRecMuons_, recMuons);
  
    //if(!found )
    //  LogError("PFBlockProducer")<<" cannot get recmuons: "
    //                   <<inputTagRecMuons_<<endl;

  // get PFNuclearInteractions
  //}
  //---------- Gouzevitch
  //  Handle< reco::PFNuclearInteractionCollection > pfNuclears; 
  Handle< reco::PFDisplacedTrackerVertexCollection > pfNuclears; 

  if( useNuclear_ ) {

    found = iEvent.getByLabel(inputTagPFNuclear_, pfNuclears);
    if(!found )
      LogError("PFBlockProducer")<<" cannot get PFNuclearInteractions : "
                               <<inputTagPFNuclear_<<endl;
  }



 
  // get conversions
  Handle< reco::PFConversionCollection > pfConversions;
  if( useConversions_ ) {
    found = iEvent.getByLabel(inputTagPFConversions_, pfConversions);
    
    if(!found )
      LogError("PFBlockProducer")<<" cannot get PFConversions : "
                                 <<inputTagPFConversions_<<endl;
  }
  

  // get V0s
  Handle< reco::PFV0Collection > pfV0;
  if( useV0_ ) {
    found = iEvent.getByLabel(inputTagPFV0_, pfV0);
    
    if(!found )
      LogError("PFBlockProducer")<<" cannot get PFV0 : "
                                 <<inputTagPFV0_<<endl;
  }


  
  // get ECAL, HCAL and PS clusters
  
  
  Handle< reco::PFClusterCollection > clustersECAL;
  found = iEvent.getByLabel(inputTagPFClustersECAL_, 
                            clustersECAL);      
  if(!found )
    LogError("PFBlockProducer")<<" cannot get ECAL clusters: "
                               <<inputTagPFClustersECAL_<<endl;
    
  
  Handle< reco::PFClusterCollection > clustersHCAL;
  found = iEvent.getByLabel(inputTagPFClustersHCAL_, 
                            clustersHCAL);      
  if(!found )
    LogError("PFBlockProducer")<<" cannot get HCAL clusters: "
                               <<inputTagPFClustersHCAL_<<endl;
    
  Handle< reco::PFClusterCollection > clustersHFEM;
  found = iEvent.getByLabel(inputTagPFClustersHFEM_, 
                            clustersHFEM);      
  if(!found )
    LogError("PFBlockProducer")<<" cannot get HFEM clusters: "
                               <<inputTagPFClustersHFEM_<<endl;
    
  Handle< reco::PFClusterCollection > clustersHFHAD;
  found = iEvent.getByLabel(inputTagPFClustersHFHAD_, 
                            clustersHFHAD);      
  if(!found )
    LogError("PFBlockProducer")<<" cannot get HFHAD clusters: "
                               <<inputTagPFClustersHFHAD_<<endl;
    

  Handle< reco::PFClusterCollection > clustersPS;
  found = iEvent.getByLabel(inputTagPFClustersPS_, 
                            clustersPS);      
  if(!found )
    LogError("PFBlockProducer")<<" cannot get PS clusters: "
                               <<inputTagPFClustersPS_<<endl;

  // dummy. Not used in the full framework 
  Handle< reco::PFRecTrackCollection > nuclearRecTracks;

  
  Handle< reco::PhotonCollection >  egPhotons;
  found = iEvent.getByLabel(inputTagEGPhotons_,
                            egPhotons);

  if(!found && useEGPhotons_ )
    LogError("PFBlockProducer")<<" cannot get photons" 
                               << inputTagEGPhotons_ << endl;

  if( usePFatHLT_  ) {
     pfBlockAlgo_.setInput( recTracks,          
                            recMuons,
                           clustersECAL,
                           clustersHCAL,
                           clustersHFEM,
                           clustersHFHAD,
                           clustersPS );
  } else { 
    pfBlockAlgo_.setInput( recTracks, 
                           GsfrecTracks,
                           convBremGsfrecTracks,
                           recMuons, 
                           pfNuclears,
                           nuclearRecTracks,
                           pfConversions,
                           pfV0,
                           clustersECAL,
                           clustersHCAL,
                           clustersHFEM,
                           clustersHFHAD,
                           clustersPS,
                           egPhotons);
  }
  pfBlockAlgo_.findBlocks();
  
  if(verbose_) {
    ostringstream  str;
    str<<pfBlockAlgo_<<endl;
    LogInfo("PFBlockProducer") << str.str()<<endl;
  }    
  
  auto_ptr< reco::PFBlockCollection > 
    pOutputBlockCollection( pfBlockAlgo_.transferBlocks() ); 
  
  
  iEvent.put(pOutputBlockCollection);
  
  LogDebug("PFBlockProducer")<<"STOP event: "<<iEvent.id().event()
                             <<" in run "<<iEvent.id().run()<<endl;
}

Member Data Documentation

Definition at line 53 of file PFBlockProducer.h.

Definition at line 63 of file PFBlockProducer.h.

Definition at line 52 of file PFBlockProducer.h.

Definition at line 56 of file PFBlockProducer.h.

Definition at line 57 of file PFBlockProducer.h.

Definition at line 58 of file PFBlockProducer.h.

Definition at line 59 of file PFBlockProducer.h.

Definition at line 60 of file PFBlockProducer.h.

Definition at line 61 of file PFBlockProducer.h.

Definition at line 55 of file PFBlockProducer.h.

Definition at line 62 of file PFBlockProducer.h.

Definition at line 54 of file PFBlockProducer.h.

Definition at line 51 of file PFBlockProducer.h.

Particle flow block algorithm.

Definition at line 92 of file PFBlockProducer.h.

switch on/off Conversions Brem Recovery

Definition at line 78 of file PFBlockProducer.h.

switch on/off Conversions

Definition at line 75 of file PFBlockProducer.h.

use EG photons ?

Definition at line 72 of file PFBlockProducer.h.

Definition at line 88 of file PFBlockProducer.h.

use NuclearInteractions ?

Definition at line 69 of file PFBlockProducer.h.

Particle Flow at HLT ?

Definition at line 84 of file PFBlockProducer.h.

bool PFBlockProducer::useV0_ [private]

switch on/off V0

Definition at line 81 of file PFBlockProducer.h.

bool PFBlockProducer::verbose_ [private]

verbose ?

Definition at line 66 of file PFBlockProducer.h.