CMS 3D CMS Logo

Public Types | Public Member Functions | Private Member Functions | Private Attributes

FlavorHistoryFilter Class Reference

#include <PhysicsTools/FlavorHistoryFilter/src/FlavorHistoryFilter.cc>

Inheritance diagram for FlavorHistoryFilter:
edm::EDFilter edm::ProducerBase edm::ProductRegistryHelper

List of all members.

Public Types

typedef
reco::FlavorHistory::FLAVOR_T 
flavor_type
typedef std::vector< int > flavor_vector

Public Member Functions

 FlavorHistoryFilter (const edm::ParameterSet &)
 ~FlavorHistoryFilter ()

Private Member Functions

virtual void endJob ()
virtual bool filter (edm::Event &, const edm::EventSetup &)

Private Attributes

reco::FlavorHistorySelectorUtilb_me_
reco::FlavorHistorySelectorUtilb_ps_
reco::FlavorHistorySelectorUtilb_ps_comp_
reco::FlavorHistorySelectorUtilbb_me_
reco::FlavorHistorySelectorUtilbb_me_comp_
edm::InputTag bsrc_
reco::FlavorHistorySelectorUtilc_me_
reco::FlavorHistorySelectorUtilc_ps_
reco::FlavorHistorySelectorUtilc_ps_comp_
reco::FlavorHistorySelectorUtilcc_me_
reco::FlavorHistorySelectorUtilcc_me_comp_
edm::InputTag csrc_
double dr_
int pathToSelect_

Detailed Description

Description:

This now filters events hierarchically. Previously this was done at the python configuration level, which was cumbersome for users to use.

Now, the hierarchy is:

Create prioritized paths to separate HF composition samples.

These are exclusive priorities, so sample "i" will not overlap with "i+1". Note that the "dr" values below correspond to the dr between the matched genjet, and the sister genjet.

1) W+bb with >= 2 jets from the ME (dr > 0.5) 2) W+b or W+bb with 1 jet from the ME 3) W+cc from the ME (dr > 0.5) 4) W+c or W+cc with 1 jet from the ME 5) W+bb with 1 jet from the parton shower (dr == 0.0) 6) W+cc with 1 jet from the parton shower (dr == 0.0)

These are the "trash bin" samples that we're throwing away:

7) W+bb with >= 2 partons but 1 jet from the ME (dr == 0.0) 8) W+cc with >= 2 partons but 1 jet from the ME (dr == 0.0) 9) W+bb with >= 2 partons but 2 jets from the PS (dr > 0.5) 10)W+cc with >= 2 partons but 2 jets from the PS (dr > 0.5)

And here is the true "light flavor" sample:

11) Veto of all the previous (W+ light jets)

Implementation: <Notes on="" implementation>="">

Definition at line 77 of file FlavorHistoryFilter.h.


Member Typedef Documentation

Definition at line 79 of file FlavorHistoryFilter.h.

typedef std::vector<int> FlavorHistoryFilter::flavor_vector

Definition at line 80 of file FlavorHistoryFilter.h.


Constructor & Destructor Documentation

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

Definition at line 31 of file FlavorHistoryFilter.cc.

References b_me_, b_ps_, b_ps_comp_, bb_me_, bb_me_comp_, c_me_, c_ps_, c_ps_comp_, cc_me_, cc_me_comp_, dr_, edm::ParameterSet::exists(), edm::ParameterSet::getParameter(), pathToSelect_, and validate_alignment_devdb10_cfg::verbose.

                                                                       :
  bsrc_           ( iConfig.getParameter<edm::InputTag>("bsrc" ) ),
  csrc_           ( iConfig.getParameter<edm::InputTag>("csrc" ) )
{
  if ( iConfig.exists("pathToSelect") )
    pathToSelect_ =        iConfig.getParameter<int>    ("pathToSelect");
  else
    pathToSelect_ = -1;

  // This is the "interface" delta R with which to decide
  // where to take the event from
  dr_                =  iConfig.getParameter<double> ("dr" ) ;
  bool verbose        ( iConfig.getParameter<bool>   ("verbose") );

  // Set up the boundaries.
  // dr0 = 0.0
  // dr1 = set by user
  // dr2 = infinity
  double dr0 = 0.0;
  double dr1 = dr_;
  double dr2 = 99999.0;
  

  // These are the processes that can come from the matrix element calculation
  std::vector<int> me_ids;
  me_ids.push_back(2);   // flavor excitation
  me_ids.push_back(3);   // flavor creation
  
  // These are the processes that can come from the parton shower calculation
  std::vector<int> ps_ids;
  ps_ids.push_back(1);   // gluon splitting


  // To select bb->2 events from matrix element... Path 1 
  bb_me_ = new FlavorHistorySelectorUtil( 5,
                                          2,
                                          me_ids,
                                          dr1,
                                          dr2,
                                          verbose );

  // To select  b->1 events from matrix element... Path 2 
  b_me_  = new FlavorHistorySelectorUtil( 5,
                                          1,
                                          me_ids,
                                          dr0,
                                          dr0,
                                          verbose );


  // To select cc->2 events from matrix element... Path 3
  cc_me_ = new FlavorHistorySelectorUtil( 4,
                                          2,
                                          me_ids,
                                          dr1,
                                          dr2,
                                          verbose );

  // To select  c->1 events from matrix element... Path 4
  c_me_  = new FlavorHistorySelectorUtil( 4,
                                          1,
                                          me_ids,
                                          dr0,
                                          dr0,
                                          verbose );

  // To select bb->2 events from parton shower ... Path 5 
  b_ps_  = new FlavorHistorySelectorUtil( 5,
                                          1,
                                          ps_ids,
                                          dr0,
                                          dr1,
                                          verbose );

  
  // To select cc->2 events from parton shower ... Path 6 
  c_ps_  = new FlavorHistorySelectorUtil( 4,
                                          1,
                                          ps_ids,
                                          dr0,
                                          dr1,
                                          verbose );  

  // To select bb->1 events from matrix element... Path 7
  bb_me_comp_ = new FlavorHistorySelectorUtil( 5,
                                               2,
                                               me_ids,
                                               dr0,
                                               dr1,
                                               verbose );

  // To select cc->1 events from matrix element... Path 8 
  cc_me_comp_ = new FlavorHistorySelectorUtil( 4,
                                               2,
                                               me_ids,
                                               dr0,
                                               dr1,
                                               verbose );

  // To select bb->2 events from parton shower ... Path 9 
  b_ps_comp_  = new FlavorHistorySelectorUtil( 5,
                                               2,
                                               ps_ids,
                                               dr1,
                                               dr2,
                                               verbose );

  // To select cc->1 events from parton shower ... Path 10
  c_ps_comp_  = new FlavorHistorySelectorUtil( 4,
                                               2,
                                               ps_ids,
                                               dr1,
                                               dr2,
                                               verbose );

  // The veto of all of these is               ... Path 11
  

  // This will write 1-11 (the path number), or 0 if error. 
  produces<unsigned int>();
}
FlavorHistoryFilter::~FlavorHistoryFilter ( )

Definition at line 154 of file FlavorHistoryFilter.cc.

References b_me_, b_ps_, b_ps_comp_, bb_me_, bb_me_comp_, c_me_, c_ps_, c_ps_comp_, cc_me_, and cc_me_comp_.

{
 
  if ( bb_me_ ) delete bb_me_; 
  if (  b_me_ ) delete b_me_;
  if ( cc_me_ ) delete cc_me_; 
  if (  c_me_ ) delete c_me_;  
  if (  b_ps_ ) delete b_ps_; 
  if (  c_ps_ ) delete c_ps_; 

  if ( bb_me_comp_ ) delete bb_me_comp_; 
  if ( cc_me_comp_ ) delete cc_me_comp_; 
  if (  b_ps_comp_ ) delete b_ps_comp_; 
  if (  c_ps_comp_ ) delete c_ps_comp_;



 
}

Member Function Documentation

void FlavorHistoryFilter::endJob ( void  ) [private, virtual]

Reimplemented from edm::EDFilter.

Definition at line 249 of file FlavorHistoryFilter.cc.

                            {
}
bool FlavorHistoryFilter::filter ( edm::Event iEvent,
const edm::EventSetup iSetup 
) [private, virtual]

Implements edm::EDFilter.

Definition at line 177 of file FlavorHistoryFilter.cc.

References b_me_, b_ps_, b_ps_comp_, bb_me_, bb_me_comp_, bsrc_, c_me_, c_ps_, c_ps_comp_, cc_me_, cc_me_comp_, csrc_, edm::Event::getByLabel(), pathToSelect_, edm::Event::put(), benchmark_cfg::select, reco::FlavorHistorySelectorUtil::select(), and elec_selection::selection().

{

  // Get the flavor history
  Handle<FlavorHistoryEvent > bFlavorHistoryEvent;
  iEvent.getByLabel(bsrc_,bFlavorHistoryEvent);

  Handle<FlavorHistoryEvent > cFlavorHistoryEvent;
  iEvent.getByLabel(csrc_,cFlavorHistoryEvent);

  std::auto_ptr<unsigned int> selection ( new unsigned int() );

  // Get the number of matched b-jets in the event
  unsigned int nb = bFlavorHistoryEvent->nb();
  // Get the number of matched c-jets in the event
  unsigned int nc = cFlavorHistoryEvent->nc();
  // Get the two flavor sources. The highest takes precedence
  // over the rest. 
  FlavorHistory::FLAVOR_T bFlavorSource = bFlavorHistoryEvent->flavorSource();
  FlavorHistory::FLAVOR_T cFlavorSource = cFlavorHistoryEvent->flavorSource();
  FlavorHistory::FLAVOR_T flavorSource = FlavorHistory::FLAVOR_NULL;
  // Get the highest flavor in the event
  unsigned int highestFlavor = 0;  
  // Get the delta r between the two heavy flavor matched jets.
  double dr = -1;

  // Preference is in increasing priority:
  //  1: gluon splitting
  //  2: flavor excitation
  //  3: flavor creation (matrix element)
  //  4: flavor decay
  if ( bFlavorSource >= cFlavorSource ) {    
    flavorSource = bFlavorHistoryEvent->flavorSource();
    highestFlavor = bFlavorHistoryEvent->highestFlavor();
    dr = bFlavorHistoryEvent->deltaR();    
  }
  else {
    flavorSource = cFlavorHistoryEvent->flavorSource();
    highestFlavor = cFlavorHistoryEvent->highestFlavor();
    dr = cFlavorHistoryEvent->deltaR();
  }

  
  *selection = 0;
  // Now make hierarchical determination
  if      ( bb_me_     ->select( nb, nc, highestFlavor, flavorSource, dr ) ) *selection = 1;
  else if (  b_me_     ->select( nb, nc, highestFlavor, flavorSource, dr ) ) *selection = 2;
  else if ( cc_me_     ->select( nb, nc, highestFlavor, flavorSource, dr ) ) *selection = 3;
  else if (  c_me_     ->select( nb, nc, highestFlavor, flavorSource, dr ) ) *selection = 4;
  else if (  b_ps_     ->select( nb, nc, highestFlavor, flavorSource, dr ) ) *selection = 5;
  else if (  c_ps_     ->select( nb, nc, highestFlavor, flavorSource, dr ) ) *selection = 6;
  else if ( bb_me_comp_->select( nb, nc, highestFlavor, flavorSource, dr ) ) *selection = 7;
  else if ( cc_me_comp_->select( nb, nc, highestFlavor, flavorSource, dr ) ) *selection = 8;
  else if (  b_ps_comp_->select( nb, nc, highestFlavor, flavorSource, dr ) ) *selection = 9;
  else if (  c_ps_comp_->select( nb, nc, highestFlavor, flavorSource, dr ) ) *selection = 10;
  else *selection = 11;

  bool pass = false;
  if ( pathToSelect_ > 0 ) {
    pass = (*selection > 0 && *selection == static_cast<unsigned int>(pathToSelect_ ) );
  } else {
    pass = true;
  }

  iEvent.put( selection );

  return pass; 

}

Member Data Documentation

Definition at line 96 of file FlavorHistoryFilter.h.

Referenced by filter(), FlavorHistoryFilter(), and ~FlavorHistoryFilter().

Definition at line 99 of file FlavorHistoryFilter.h.

Referenced by filter(), FlavorHistoryFilter(), and ~FlavorHistoryFilter().

Definition at line 103 of file FlavorHistoryFilter.h.

Referenced by filter(), FlavorHistoryFilter(), and ~FlavorHistoryFilter().

Definition at line 95 of file FlavorHistoryFilter.h.

Referenced by filter(), FlavorHistoryFilter(), and ~FlavorHistoryFilter().

Definition at line 101 of file FlavorHistoryFilter.h.

Referenced by filter(), FlavorHistoryFilter(), and ~FlavorHistoryFilter().

Definition at line 90 of file FlavorHistoryFilter.h.

Referenced by filter().

Definition at line 98 of file FlavorHistoryFilter.h.

Referenced by filter(), FlavorHistoryFilter(), and ~FlavorHistoryFilter().

Definition at line 100 of file FlavorHistoryFilter.h.

Referenced by filter(), FlavorHistoryFilter(), and ~FlavorHistoryFilter().

Definition at line 104 of file FlavorHistoryFilter.h.

Referenced by filter(), FlavorHistoryFilter(), and ~FlavorHistoryFilter().

Definition at line 97 of file FlavorHistoryFilter.h.

Referenced by filter(), FlavorHistoryFilter(), and ~FlavorHistoryFilter().

Definition at line 102 of file FlavorHistoryFilter.h.

Referenced by filter(), FlavorHistoryFilter(), and ~FlavorHistoryFilter().

Definition at line 91 of file FlavorHistoryFilter.h.

Referenced by filter().

double FlavorHistoryFilter::dr_ [private]

Definition at line 93 of file FlavorHistoryFilter.h.

Referenced by FlavorHistoryFilter().

Definition at line 92 of file FlavorHistoryFilter.h.

Referenced by filter(), and FlavorHistoryFilter().