ATLAS Offline Software
ForwardProtonFilter.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 // GeneratorFilters/ForwardProtonFilter
6 //
7 // Allows the user to search for forward intact protons originating from
8 // elastic and diffractive interactions. Event passes filters if there forward
9 // proton with xi and pt in given range. If double tag option is enables, such
10 // protons are requested on both sides. single_tagA/single_tagC require protons
11 // on a given side, regardless what's happenning on the other
12 //
13 // Authors:
14 // Rafal Staszewski Jul 2011
15 
18 
19 ForwardProtonFilter::ForwardProtonFilter(const std::string& name, ISvcLocator* pSvcLocator)
20  : GenFilter(name,pSvcLocator)
21 {
22  declareProperty("xi_min", m_xiMin = 0.01);
23  declareProperty("xi_max", m_xiMax = 0.20);
24  declareProperty("pt_min", m_ptMin = 0); // [MeV]
25  declareProperty("pt_max", m_ptMax = 10e3); // [MeV]
26  declareProperty("beam_energy", m_E0 = 7e6); // [MeV]
27  declareProperty("double_tag", m_DoubleTag = false);
28  declareProperty("single_tagA", m_Single_tagA = false); // require proton on A, regardless of C
29  declareProperty("single_tagC", m_Single_tagC = false); // require proton on C, regardelss of A
30 }
31 
32 
34  bool accepted_A = false;
35  bool accepted_C = false;
36 
38  for (itr = events()->begin(); itr != events()->end(); ++itr) {
39  const HepMC::GenEvent* genEvt = *itr;
40  for (const auto& part: *genEvt) {
41  if ( !MC::isStable(part)) continue;
42 
43  // We are specifically looking for protons
44  const long pid = part->pdg_id();
45  if (pid != 2212 ) continue;
46 
47  const double E = part->momentum().e();
48  const double pz = part->momentum().pz();
49  const double pt = part->momentum().perp();
50  const double xi = (m_E0-E)/m_E0;
51  if (m_xiMin <= xi && xi <= m_xiMax && m_ptMin <= pt && pt <= m_ptMax) {
52  accepted_C = (pz > 0);
53  accepted_A = (pz < 0);
54  }
55 
56  if (accepted_A) ATH_MSG_DEBUG("Found a proton with xi=" << xi << " on side C");
57  if (accepted_C) ATH_MSG_DEBUG("Found a proton with xi=" << xi << " on side A");
58 
59  if ( m_DoubleTag && (accepted_A && accepted_C) ) return StatusCode::SUCCESS;
60  if (!m_DoubleTag ) {
61 
62  // if Single tag is not requested, do or
63  if(!m_Single_tagA && !m_Single_tagC && (accepted_A || accepted_C) ) return StatusCode::SUCCESS;
64 
65  // if single tag request - check for presence on particular side
66  if(m_Single_tagA && accepted_A) return StatusCode::SUCCESS;
67  if(m_Single_tagC && accepted_C) return StatusCode::SUCCESS;
68 
69  }
70 
71  }
72  }
73 
74  // If we get here the event doesn't pass the criteria
75  setFilterPassed(false);
76  return StatusCode::SUCCESS;
77 }
LArG4FSStartPointFilter.part
part
Definition: LArG4FSStartPointFilter.py:21
ForwardProtonFilter::filterEvent
virtual StatusCode filterEvent()
Definition: ForwardProtonFilter.cxx:33
ForwardProtonFilter::m_Single_tagC
bool m_Single_tagC
Definition: ForwardProtonFilter.h:27
DataModel_detail::const_iterator
Const iterator class for DataVector/DataList.
Definition: DVLIterator.h:82
AthCommonDataStore< AthCommonMsg< Algorithm > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
PlotCalibFromCool.begin
begin
Definition: PlotCalibFromCool.py:94
test_pyathena.pt
pt
Definition: test_pyathena.py:11
python.DataFormatRates.events
events
Definition: DataFormatRates.py:105
ForwardProtonFilter::m_xiMin
double m_xiMin
Definition: ForwardProtonFilter.h:20
ForwardProtonFilter::ForwardProtonFilter
ForwardProtonFilter(const std::string &name, ISvcLocator *pSvcLocator)
Definition: ForwardProtonFilter.cxx:19
GenFilter
Base class for event generator filtering modules.
Definition: GenFilter.h:30
CheckAppliedSFs.e3
e3
Definition: CheckAppliedSFs.py:264
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ForwardProtonFilter::m_ptMin
double m_ptMin
Definition: ForwardProtonFilter.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
ForwardProtonFilter::m_E0
double m_E0
Definition: ForwardProtonFilter.h:24
ParticleGun_EoverP_Config.pid
pid
Definition: ParticleGun_EoverP_Config.py:62
Amg::pz
@ pz
Definition: GeoPrimitives.h:40
ForwardProtonFilter.h
ForwardProtonFilter::m_xiMax
double m_xiMax
Definition: ForwardProtonFilter.h:21
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
VP1PartSpect::E
@ E
Definition: VP1PartSpectFlags.h:21
ForwardProtonFilter::m_DoubleTag
bool m_DoubleTag
Definition: ForwardProtonFilter.h:25
MC::isStable
bool isStable(const T &p)
Definition: HepMCHelpers.h:30
ForwardProtonFilter::m_ptMax
double m_ptMax
Definition: ForwardProtonFilter.h:23
ForwardProtonFilter::m_Single_tagA
bool m_Single_tagA
Definition: ForwardProtonFilter.h:26
HepMCHelpers.h