ATLAS Offline Software
HiggsFilter.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 // -------------------------------------------------------------
6 //
7 // File: GeneratorFilters/HiggsFilter.cxx
8 //
9 // Description:
10 //
11 // This filter requires the event to contain at least
12 // one Higgs with pt at or above Ptcut.
13 //
14 // Events that do not contain H are rejected.
15 //
16 // Only H decaying to b bbar are analyzed and counted in this algorithm.
17 //
18 // Originally created using GeneratorFilters templates for DC3 purposes.
19 //
20 // AuthorList:
21 //
22 // M. Casolino: February 5, 2014
23 //
24 
25 // Header for this module:-
26 
28 
29 //--------------------------------------------------------------------------
30 HiggsFilter::HiggsFilter(const std::string& name,
31  ISvcLocator* pSvcLocator): GenFilter(name,pSvcLocator) {
32  //--------------------------------------------------------------------------
33  declareProperty("Ptcut",m_Ptmin = 0.);
34  declareProperty("Ptmaxcut",m_Ptmax = 200000000.);
35 }
36 
37 
38 //---------------------------------------------------------------------------
40 //---------------------------------------------------------------------------
41 
42 
43 // Loop over all events in McEventCollection
44 
46 
47  int N_Higgs = 0;
48 
49  int N_Higgs_all = 0;
50 
51  int N_pt_above_cut = 0;
52 
53 
54  // Loop over all events in MCCollection
55  for (itr = events()->begin(); itr!=events()->end(); ++itr) {
56 
57  // Loop over all particles in the event
58  const HepMC::GenEvent* genEvt = (*itr);
59 
60  for(const auto& pitr: *genEvt){
61  if( std::abs(pitr->pdg_id()) != 25 ) continue;
62  N_Higgs_all++;
63  auto decayVtx = pitr->end_vertex();
64  // verify if we got a valid pointer and retrieve the number of daughters
65  if (!decayVtx ) continue;
66  int n_daughters = decayVtx->particles_out_size();
67  if( n_daughters < 2 ) continue;
68  for (const auto& child_mcpart: *decayVtx) {
69  if ( std::abs(child_mcpart->pdg_id()) != 5 ) continue;
70  if ( pitr->pdg_id() == 25 ) {
71  N_Higgs++;
72  }
73  if( (pitr->momentum().perp() >=m_Ptmin && pitr->momentum().perp() <m_Ptmax ) ){
74  N_pt_above_cut++;
75  }
76  }//child loop
77  }
78  }
79 
80  ATH_MSG_INFO( "Found " << N_Higgs_all << " Higgs in event record" );
81 
82  ATH_MSG_INFO("Found " << N_Higgs << " H -> b bbar decays" );
83 
84  ATH_MSG_INFO( "The number of Higgs with pt above " << m_Ptmin/1000.0 << " GeV/c is " << N_pt_above_cut );
85 
86  if ( N_Higgs_all <= 0 ){
87  ATH_MSG_ERROR( "No Higgs was found in a (presumably) Higgs event! Event is rejected." );
88  }
89 
90  if ( N_Higgs >= 2 ){
91  ATH_MSG_WARNING( "More than one H -> b b. Event is accepted.");
92  }
93 
94  if( N_pt_above_cut >= 1 && N_Higgs >= 1) {
95  return StatusCode::SUCCESS;
96  }
97 
98  // if we get here we have failed
99  setFilterPassed(false);
100  return StatusCode::SUCCESS;
101 }
HiggsFilter::m_Ptmin
double m_Ptmin
Definition: HiggsFilter.h:39
DataModel_detail::const_iterator
Const iterator class for DataVector/DataList.
Definition: DVLIterator.h:82
HiggsFilter::filterEvent
virtual StatusCode filterEvent()
Definition: HiggsFilter.cxx:39
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
AthCommonDataStore< AthCommonMsg< Algorithm > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
PlotCalibFromCool.begin
begin
Definition: PlotCalibFromCool.py:94
python.DataFormatRates.events
events
Definition: DataFormatRates.py:105
GenFilter
Base class for event generator filtering modules.
Definition: GenFilter.h:30
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
HiggsFilter::m_Ptmax
double m_Ptmax
Definition: HiggsFilter.h:40
HiggsFilter::HiggsFilter
HiggsFilter(const std::string &name, ISvcLocator *pSvcLocator)
Definition: HiggsFilter.cxx:30
HiggsFilter.h