ATLAS Offline Software
AsgDeadHVCellRemovalTool.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 #include "xAODEgamma/Egamma.h"
9 
10 AsgDeadHVCellRemovalTool::AsgDeadHVCellRemovalTool(const std::string& myname) :
11  asg::AsgTool(myname){
12 }
13 
15 
17  return StatusCode::SUCCESS ;
18 }
19 
21  return StatusCode::SUCCESS;
22 }
23 
25 
26  if ( !eg ){
27  ATH_MSG_ERROR ("Failed, no egamma object.");
28  return false;
29  }
30 
31  const xAOD::CaloCluster* cluster = eg->caloCluster();
32  if ( !cluster ){
33  ATH_MSG_ERROR ("Failed, cluster.");
34  return false;
35  }
36 
37  const xAOD::EventInfo *eventInfo = evtStore()->retrieve< const xAOD::EventInfo> ("EventInfo");
38  bool isSimul= eventInfo->eventType(xAOD::EventInfo::IS_SIMULATION);
39 
40  unsigned int runnumber (0);
41  static const SG::AuxElement::ConstAccessor<unsigned int> randomrunnumber("RandomRunNumber");
42  static const SG::AuxElement::ConstAccessor<unsigned int> datarunnumber("runNumber");
43 
44  if(!isSimul&& datarunnumber.isAvailable(*eventInfo) ){
45  runnumber = datarunnumber(*eventInfo);
46  }
47  else if(isSimul && randomrunnumber.isAvailable(*eventInfo) ){
48  runnumber = randomrunnumber(*eventInfo);
49  }
50  else {
51  ATH_MSG_ERROR ("Failed, to retrieve the proper run number from event info");
52  return false;
53  }
54 
55  double eta_calo;
56  double phi_calo;
57  if (! cluster->retrieveMoment(xAOD::CaloCluster::ETACALOFRAME,eta_calo) ||
58  ! cluster->retrieveMoment(xAOD::CaloCluster::PHICALOFRAME,phi_calo)){
59  ATH_MSG_ERROR ("Could not get Eta/Phi in calo frame");
60  return false;
61  }
62 
63  if ((runnumber>=296939 && runnumber<298967) ||
64  (runnumber>=299144 && runnumber<300279)){
65 
66  if ( eta_calo > - 1.825
67  && eta_calo < -1.5
68  && phi_calo > -1.104921
69  && phi_calo < -0.956748){
70  return false;
71  }
72  }
73 
74  if ((runnumber>=298967 && runnumber<299144 ) ||
75  (runnumber>=300279 && runnumber< 305291)){
76 
77  if (eta_calo > - 1.825
78  && eta_calo < -1.5
79  && phi_calo > -1.104921
80  && phi_calo < -0.956748){
81  return false;
82  }
83 
84  if (eta_calo> - 1.825
85  && eta_calo < -1.5
86  && phi_calo > 1.054922
87  && phi_calo < 1.203097){
88  return false;
89  }
90  }
91 
92  return true ;
93 }
94 
96  return accept (&part);
97 }
98 
LArG4FSStartPointFilter.part
part
Definition: LArG4FSStartPointFilter.py:21
AsgDeadHVCellRemovalTool::accept
virtual bool accept(const xAOD::Egamma *eg) const final
Definition: AsgDeadHVCellRemovalTool.cxx:24
ParticleTest.eg
eg
Definition: ParticleTest.py:29
CutsMETMaker::accept
StatusCode accept(const xAOD::Muon *mu)
Definition: CutsMETMaker.cxx:18
asg
Definition: DataHandleTestTool.h:28
xAOD::Egamma_v1
Definition: Egamma_v1.h:56
SG::ConstAccessor
Helper class to provide constant type-safe access to aux data.
Definition: ConstAccessor.h:54
xAOD::EventInfo_v1::IS_SIMULATION
@ IS_SIMULATION
true: simulation, false: data
Definition: EventInfo_v1.h:151
AsgDeadHVCellRemovalTool::finalize
virtual StatusCode finalize()
Gaudi Service Interface method implementations.
Definition: AsgDeadHVCellRemovalTool.cxx:20
Egamma.h
xAOD::CaloCluster_v1
Description of a calorimeter cluster.
Definition: CaloCluster_v1.h:59
AsgDeadHVCellRemovalTool::~AsgDeadHVCellRemovalTool
virtual ASG_TOOL_CLASS2(AsgDeadHVCellRemovalTool, IAsgDeadHVCellRemovalTool, asg::IAsgTool) public ~AsgDeadHVCellRemovalTool()
Standard constructor.
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
CaloCluster.h
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
AsgDeadHVCellRemovalTool.h
xAOD::CaloCluster_v1::retrieveMoment
bool retrieveMoment(MomentType type, double &value) const
Retrieve individual moment.
Definition: CaloCluster_v1.cxx:738
DeMoScan.runnumber
runnumber
Definition: DeMoScan.py:266
AsgDeadHVCellRemovalTool::initialize
virtual StatusCode initialize()
Gaudi Service Interface method implementations.
Definition: AsgDeadHVCellRemovalTool.cxx:16
xAOD::CaloCluster_v1::PHICALOFRAME
@ PHICALOFRAME
Phi in the calo frame (for egamma)
Definition: CaloCluster_v1.h:188
EventInfo.h
xAOD::EventInfo_v1
Class describing the basic event information.
Definition: EventInfo_v1.h:43
SG::ConstAccessor::isAvailable
bool isAvailable(const ELT &e) const
Test to see if this variable exists in the store.
xAOD::CaloCluster_v1::ETACALOFRAME
@ ETACALOFRAME
Eta in the calo frame (for egamma)
Definition: CaloCluster_v1.h:187
xAOD::EventInfo_v1::eventType
bool eventType(EventType type) const
Check for one particular bitmask value.