Skip to content
Snippets Groups Projects
Commit f55d2ef1 authored by Vakhtang Tsulaia's avatar Vakhtang Tsulaia
Browse files

Merge branch 'change_LArAffectedRegion' into 'master'

Change LArAffectedRegion info

See merge request atlas/athena!16590
parents b442d270 4e02af32
No related branches found
No related tags found
No related merge requests found
Showing
with 69 additions and 1745 deletions
......@@ -55,10 +55,8 @@ def make_CaloSwDeadOTX_back(name = None,
confclass = None,
**kw):
from CaloTools.CaloAffectedToolDefault import CaloAffectedToolDefault
theAffectedTool = CaloAffectedToolDefault()
from AthenaCommon.AppMgr import ToolSvc
ToolSvc += theAffectedTool
from CaloTools.CaloToolsConf import CaloAffectedTool
theAffectedTool = CaloAffectedTool("CaloAffectedForDeadOTX_back")
# Make the tool.
return makecorr (versions = CaloSwDeadOTX_back_versions,
......
......@@ -55,10 +55,8 @@ def make_CaloSwDeadOTX_ps(name = None,
confclass = None,
**kw):
from CaloTools.CaloAffectedToolDefault import CaloAffectedToolDefault
theAffectedTool = CaloAffectedToolDefault()
from AthenaCommon.AppMgr import ToolSvc
ToolSvc += theAffectedTool
from CaloTools.CaloToolsConf import CaloAffectedTool
theAffectedTool = CaloAffectedTool("CaloAffectedToolForDeadOTX_ps")
# Make the tool.
return makecorr (versions = CaloSwDeadOTX_ps_versions,
......
......@@ -33,8 +33,7 @@ CaloSwDeadOTX_back::CaloSwDeadOTX_back
(const std::string& type,
const std::string& name,
const IInterface* parent)
: CaloClusterCorrectionCommon(type, name, parent) ,
m_affectedTool("CaloAffectedTool")
: CaloClusterCorrectionCommon(type, name, parent)
{
declareConstant("correction" , m_correction);
declareConstant("sampling_depth" , m_sampling_depth);
......@@ -42,7 +41,6 @@ CaloSwDeadOTX_back::CaloSwDeadOTX_back
declareConstant("eta_end_crack" , m_eta_end_crack);
declareConstant("etamax" , m_etamax);
declareConstant("use_raw_eta" , m_use_raw_eta);
declareProperty("affectedTool" , m_affectedTool);
}
StatusCode CaloSwDeadOTX_back::initialize()
......@@ -53,7 +51,8 @@ StatusCode CaloSwDeadOTX_back::initialize()
// the template in AlgTool.
// CHECK( setProperty ("isDummy", std::string("1")) );
ATH_CHECK(m_affKey.initialize());
ATH_MSG_DEBUG( " --------------->>>>> CaloSwDeadOTX_back :: retrieving affectedTool" << endmsg);
if (m_affectedTool.retrieve().isFailure()){
......@@ -67,7 +66,7 @@ StatusCode CaloSwDeadOTX_back::initialize()
}
void CaloSwDeadOTX_back::makeTheCorrection
(const EventContext& /*ctx*/,
(const EventContext& ctx,
CaloCluster* cluster,
const CaloDetDescrElement* /*elt*/,
float eta,
......@@ -80,6 +79,13 @@ void CaloSwDeadOTX_back::makeTheCorrection
// ??? In principle, we should use adj_eta for the interpolation
// and range checks. However, the v2 corrections were derived
// using regular eta instead.
//
//Get affected info for this event
SG::ReadCondHandle<CaloAffectedRegionInfoVec> affHdl{m_affKey,ctx};
const CaloAffectedRegionInfoVec* affCont=*affHdl;
if(!affCont) {
ATH_MSG_WARNING("Do not have affected regions info, is this expected ?");
}
float the_aeta;
if (m_use_raw_eta)
......@@ -129,10 +135,8 @@ void CaloSwDeadOTX_back::makeTheCorrection
float dphi = 0.025;
int layer = si * 4 + 3 ;
bool check = m_affectedTool->isAffected(cluster ,deta , dphi ,layer,layer,0) ; // check dead OTX in barrel PS
bool check = m_affectedTool->isAffected(cluster, affCont, deta , dphi ,layer,layer,0) ; // check dead OTX in barrel PS
// bool checke = m_affectedTool->isAffected(cluster ,deta , dphi ,4,4,0) ; // check dead OTX in endcap PS
// bool checkb = m_affectedTool->isAffected(cluster ,deta , dphi ,0,0,0) ; // check dead OTX in barrel PS
// if a cluster is in an affected region set the back energy to zero else return
......
......@@ -15,6 +15,7 @@ PACKAGE: offline/Calorimeter/CaloClusterCorrection
#include "CaloInterface/ICaloAffectedTool.h"
#include "CaloClusterCorrection/CaloClusterCorrectionCommon.h"
#include "CaloConditions/Array.h"
#include "CaloConditions/CaloAffectedRegionInfoVec.h"
class CaloSwDeadOTX_back : public CaloClusterCorrectionCommon
{
......@@ -57,8 +58,10 @@ public:
private:
// std::string m_affectedTool;
ToolHandle<ICaloAffectedTool> m_affectedTool;
SG::ReadCondHandleKey<CaloAffectedRegionInfoVec> m_affKey{this,
"LArAffectedRegionKey", "LArAffectedRegionInfo", "SG key for affected regions cond object"};
ToolHandle<ICaloAffectedTool> m_affectedTool{this, "AffectedTool", "CaloAffectedTool", "affected tool instance"};
CaloRec::Array<3> m_correction;
CaloRec::Array<2> m_sampling_depth;
......
......@@ -32,8 +32,7 @@ CaloSwDeadOTX_ps::CaloSwDeadOTX_ps
(const std::string& type,
const std::string& name,
const IInterface* parent)
: CaloClusterCorrectionCommon(type, name, parent) ,
m_affectedTool("CaloAffectedTool")
: CaloClusterCorrectionCommon(type, name, parent)
{
declareConstant("correction" , m_correction);
declareConstant("sampling_depth" , m_sampling_depth);
......@@ -41,7 +40,6 @@ CaloSwDeadOTX_ps::CaloSwDeadOTX_ps
declareConstant("eta_end_crack" , m_eta_end_crack);
declareConstant("etamax" , m_etamax);
declareConstant("use_raw_eta" , m_use_raw_eta);
declareProperty("affectedTool" , m_affectedTool);
}
StatusCode CaloSwDeadOTX_ps::initialize()
......@@ -52,6 +50,7 @@ StatusCode CaloSwDeadOTX_ps::initialize()
// the template in AlgTool.
// CHECK( setProperty ("isDummy", std::string("1")) );
ATH_CHECK(m_affKey.initialize());
ATH_MSG_DEBUG( " --------------->>>>> CaloSwDeadOTX_ps :: retrieving affectedTool" << endmsg);
......@@ -66,7 +65,7 @@ StatusCode CaloSwDeadOTX_ps::initialize()
}
void CaloSwDeadOTX_ps::makeTheCorrection
(const EventContext& /*ctx*/,
(const EventContext& ctx,
CaloCluster* cluster,
const CaloDetDescrElement* /*elt*/,
float eta,
......@@ -80,6 +79,13 @@ void CaloSwDeadOTX_ps::makeTheCorrection
// and range checks. However, the v2 corrections were derived
// using regular eta instead.
//Get affected info for this event
SG::ReadCondHandle<CaloAffectedRegionInfoVec> affHdl{m_affKey,ctx};
const CaloAffectedRegionInfoVec* affCont=*affHdl;
if(!affCont) {
ATH_MSG_WARNING("Do not have affected regions info, is this expected ?");
}
float the_aeta;
if (m_use_raw_eta)
the_aeta = std::abs (adj_eta);
......@@ -129,10 +135,8 @@ void CaloSwDeadOTX_ps::makeTheCorrection
float dphi = 0.025;
int layer = si * 4 ;
bool check = m_affectedTool->isAffected(cluster ,deta , dphi ,layer,layer,0) ; // check dead OTX in barrel PS
bool check = m_affectedTool->isAffected(cluster, affCont, deta , dphi ,layer,layer,0) ; // check dead OTX in barrel PS
// bool checke = m_affectedTool->isAffected(cluster ,deta , dphi ,4,4,0) ; // check dead OTX in endcap PS
// bool checkb = m_affectedTool->isAffected(cluster ,deta , dphi ,0,0,0) ; // check dead OTX in barrel PS
// if a cluster is in an affected region set the PS energy to zero else return
......
......@@ -15,6 +15,7 @@ PACKAGE: offline/Calorimeter/CaloClusterCorrection
#include "CaloInterface/ICaloAffectedTool.h"
#include "CaloClusterCorrection/CaloClusterCorrectionCommon.h"
#include "CaloConditions/Array.h"
#include "CaloConditions/CaloAffectedRegionInfoVec.h"
class CaloSwDeadOTX_ps : public CaloClusterCorrectionCommon
{
......@@ -57,8 +58,9 @@ public:
private:
// std::string m_affectedTool;
ToolHandle<ICaloAffectedTool> m_affectedTool;
SG::ReadCondHandleKey<CaloAffectedRegionInfoVec> m_affKey{this,
"LArAffectedRegionKey", "LArAffectedRegionInfo", "SG key for affected regions cond object"};
ToolHandle<ICaloAffectedTool> m_affectedTool{this, "AffectedTool", "CaloAffectedTool", "affected tool instance"};
CaloRec::Array<3> m_correction;
CaloRec::Array<2> m_sampling_depth;
......
......@@ -12,5 +12,5 @@ typedef std::vector<CaloAffectedRegionInfo> CaloAffectedRegionInfoVec;
#include "AthenaKernel/CLASS_DEF.h"
CLASS_DEF( CaloAffectedRegionInfoVec , 36372397, 1 )
CLASS_DEF( CondCont<CaloAffectedRegionInfoVec>, 162668004 , 1 )
#endif
......@@ -9,6 +9,7 @@ atlas_subdir( CaloInterface )
atlas_depends_on_subdirs( PUBLIC
Calorimeter/CaloEvent
Calorimeter/CaloIdentifier
Calorimeter/CaloConditions
Control/AthenaKernel
DetectorDescription/Identifier
Event/xAOD/xAODCaloEvent
......@@ -22,7 +23,7 @@ atlas_add_dictionary( CaloInterfaceDict
CaloInterface/CaloInterfaceDict.h
CaloInterface/selection.xml
INCLUDE_DIRS ${ROOT_INCLUDE_DIRS}
LINK_LIBRARIES ${ROOT_LIBRARIES} CaloEvent CaloIdentifier AthenaKernel Identifier xAODCaloEvent GaudiKernel )
LINK_LIBRARIES ${ROOT_LIBRARIES} CaloEvent CaloIdentifier CaloConditions AthenaKernel Identifier xAODCaloEvent GaudiKernel )
# Install files from the package:
atlas_install_headers( CaloInterface )
......
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
*/
///////////////////////////////////////////////////////////////////////////////
......@@ -7,6 +7,7 @@
///
/// \author G.Unal
/// \date March 2010
/// \updated Dec 2018 by P. Strizenec
///
///////////////////////////////////////////////////////////////////////////////
......@@ -15,6 +16,9 @@
// Includes for Gaudi
#include "GaudiKernel/IAlgTool.h"
#include "AthenaKernel/CondCont.h"
#include "CaloConditions/CaloAffectedRegionInfoVec.h"
#include <vector>
namespace xAOD {
......@@ -26,7 +30,7 @@ class ICaloAffectedTool: virtual public IAlgTool {
public:
static const InterfaceID& interfaceID() {
static const InterfaceID IID_ICaloAffectedTool("ICaloAffectedTool", 1 , 0);
static const InterfaceID IID_ICaloAffectedTool("ICaloAffectedTool", 2 , 0);
return IID_ICaloAffectedTool;
}
......@@ -35,6 +39,7 @@ public:
and with a problemType (0= deadReadout, 1 = deadHV, 2 = affectedHV, -1= all problems)
@param p 4 momentum pointer to check
@param vAff pointer to conditions object with affected regions
@param deta = eta tolerance
@param dphi = phi tolerance
@param layer_min = min calo layer to check
......@@ -42,13 +47,14 @@ public:
@param problemType = type of problem in affacted region
*/
virtual bool isAffected(const xAOD::IParticle *p, float deta=0, float dphi=0, int layer_min=0, int layer_max=-1, int problemType=-1) const = 0;
virtual bool isAffected(const xAOD::IParticle *p, const CaloAffectedRegionInfoVec *vAff, float deta=0, float dphi=0, int layer_min=0, int layer_max=-1, int problemType=-1) const = 0;
/*
Return list of layers affected with their problem for a given 4 momentum
Return true is any problem is fonund
@param p 4 momentum pointer to check
@param vAff pointer to conditions object with affected regions
@param deta = eta tolerance
@param dphi = phi tolerance
@param problemType = filters only a given type of problem (-1 : all problems)
......@@ -56,7 +62,7 @@ public:
@param problem_list = reference of vector to store list of problems
*/
virtual bool listAffected(const xAOD::IParticle* p, std::vector<int>& layer_list, std::vector<int>& problem_list, float deta=0, float dphi=0, int problemType=-1) const =0;
virtual bool listAffected(const xAOD::IParticle* p, const CaloAffectedRegionInfoVec *vAff, std::vector<int>& layer_list, std::vector<int>& problem_list, float deta=0, float dphi=0, int problemType=-1) const =0;
};
......
......@@ -291,12 +291,12 @@ if jobproperties.CaloRecFlags.doTileMuId() :
#
# information on Calo AffectedRegion, write metadata
# information on Calo AffectedRegion, write conditions object
#
if DetFlags.dcs.LAr_on():
if jobproperties.CaloRecFlags.doLArAffectedRegion() and rec.doESD and (not rec.readESD):
if jobproperties.CaloRecFlags.doLArAffectedRegion():
try:
include ("LArAffectedRegion/LArAffectedRegion_write.py")
include ("LArRecUtils/LArAffectedRegion.py")
except Exception:
treatException("Could not setup LArAffectedRegion")
......
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
*/
/**
@class CaloAffectedTool
@brief Tool to check if object is in an affected region
@author G.Unal
@ changed to use conditions object by P. Strizenec
*/
#ifndef CALOTOOLS_CaloAffectedTool_H
......@@ -13,8 +14,6 @@
#include "AthenaBaseComps/AthAlgTool.h"
#include "GaudiKernel/IIncidentListener.h"
#include "GaudiKernel/IIncidentSvc.h"
#include "CaloInterface/ICaloAffectedTool.h"
#include "CaloConditions/CaloAffectedRegionInfoVec.h"
#include "AthenaKernel/IOVSvcDefs.h"
......@@ -26,21 +25,8 @@ namespace xAOD {
class StoreGateSvc;
class CaloAffectedTool: public AthAlgTool,
virtual public ICaloAffectedTool, virtual public IIncidentListener
virtual public ICaloAffectedTool
{
private:
CaloAffectedRegionInfoVec* m_affectedRegions;
StatusCode updateAffectedRegionsFromDB(IOVSVC_CALLBACK_ARGS);
StatusCode readDB();
virtual void handle(const Incident& inc) override;
bool m_read;
bool m_readRaw;
public:
......@@ -49,9 +35,9 @@ public:
const IInterface* parent);
virtual ~CaloAffectedTool();
virtual bool isAffected(const xAOD::IParticle *p, float deta=0., float dphi=0., int layer_min=0, int layer_max=-1, int problemType=-1) const override;
virtual bool isAffected(const xAOD::IParticle *p, const CaloAffectedRegionInfoVec *vAff, float deta=0., float dphi=0., int layer_min=0, int layer_max=-1, int problemType=-1) const override;
virtual bool listAffected(const xAOD::IParticle* p, std::vector<int>& layer_list, std::vector<int>& problem_list, float deta=0, float dphi=0, int problemType=-1) const override;
virtual bool listAffected(const xAOD::IParticle* p, const CaloAffectedRegionInfoVec *vAff, std::vector<int>& layer_list, std::vector<int>& problem_list, float deta=0, float dphi=0, int problemType=-1) const override;
virtual StatusCode initialize() override;
......
# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
from AthenaCommon.Logging import logging
def CaloAffectedToolDefault(name='CaloAffectedToolDefault'):
# check if tool already exists
from AthenaCommon.AppMgr import ServiceMgr as svcMgr
if hasattr(svcMgr.ToolSvc, name):
# re-use previously configured (public) tool
return getattr(svcMgr.ToolSvc, name)
mlog = logging.getLogger( 'CaloAffectedToolDefault' )
from CaloTools.CaloToolsConf import CaloAffectedTool
theTool = CaloAffectedTool(name)
from RecExConfig.RecFlags import rec
if rec.readRDO():
theTool.readRaw = True
else:
theTool.readRaw = False
from IOVDbSvc.CondDB import conddb
conddb.addFolder ('', '/LAR/LArAffectedRegionInfo<metaOnly/>')
return theTool
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
*/
#include "CaloTools/CaloAffectedTool.h"
//#include "EventKernel/I4Momentum.h"
#include "xAODBase/IParticle.h"
#include "StoreGate/StoreGateSvc.h"
#include "CaloConditions/CaloAffectedRegionInfoVec.h"
......@@ -14,145 +13,37 @@
CaloAffectedTool::CaloAffectedTool (const std::string& type,
const std::string& name,
const IInterface* parent) :
AthAlgTool(type, name, parent),
m_read(false),
m_readRaw(true)
AthAlgTool(type, name, parent)
{
m_affectedRegions=nullptr;
declareInterface<ICaloAffectedTool>(this);
declareProperty("readRaw",m_readRaw);
}
//-----------------------------------------------------------------
CaloAffectedTool::~CaloAffectedTool() {
if (m_affectedRegions && !m_readRaw) delete m_affectedRegions;
}
//-------------------------------------------------------------------
StatusCode CaloAffectedTool::initialize() {
if (!m_readRaw) {
if (detStore()->contains<CondAttrListCollection>("/LAR/LArAffectedRegionInfo")) {
const DataHandle<CondAttrListCollection> affectedRegionH;
if (detStore()->regFcn(&CaloAffectedTool::updateAffectedRegionsFromDB,
this,
affectedRegionH,
"/LAR/LArAffectedRegionInfo").isSuccess()) {
ATH_MSG_DEBUG( "Registered callback for LArAffectedRegion " );
}
else {
ATH_MSG_WARNING( "Cannot register callback for LArAffectedRegion " );
}
}
else {
ATH_MSG_WARNING( " no LArAffectedRegion information available from metadata " );
}
}
else {
// register incident handler for begin event
IIncidentSvc* incSvc = nullptr;
ATH_CHECK( service( "IncidentSvc", incSvc ) );
long int priority=100;
incSvc->addListener(this,"BeginEvent",priority);
}
m_read=false;
return StatusCode::SUCCESS;
}
//---------------------------------------------------------
void CaloAffectedTool::handle(const Incident& inc) {
if (inc.type()!="BeginEvent")
return;
if (detStore()->contains<CaloAffectedRegionInfoVec>("LArAffectedRegion")) {
if (detStore()->retrieve(m_affectedRegions,"LArAffectedRegion").isFailure()) {
ATH_MSG_WARNING( " cannot read LArAffectedRegion at begin of event " );
return;
}
m_read=true;
//std::cout << " got affected regions at beginning of event " << std::endl;
return;
}
return;
}
//--------------------------------------------------
StatusCode CaloAffectedTool::updateAffectedRegionsFromDB(IOVSVC_CALLBACK_ARGS) {
return this->readDB();
}
StatusCode CaloAffectedTool::readDB() {
ATH_MSG_INFO( "updateAffectedRegionsFromDB()" );
// retrieve from detStore
const CondAttrListCollection* attrListColl = nullptr;
StatusCode sc = detStore()->retrieve(attrListColl, "/LAR/LArAffectedRegionInfo");
if (sc.isFailure()) {
ATH_MSG_WARNING( "attrrListColl not found for /LAR/CaloAffectedRegionInfo " );
return StatusCode::SUCCESS;
}
if (m_affectedRegions) {
m_affectedRegions->clear();
}
else {
m_affectedRegions = new CaloAffectedRegionInfoVec();
}
// Loop over collection
CondAttrListCollection::const_iterator first = attrListColl->begin();
CondAttrListCollection::const_iterator last = attrListColl->end();
for (; first != last; ++first) {
std::ostringstream attrStr1;
(*first).second.toOutputStream( attrStr1 );
ATH_MSG_DEBUG( "ChanNum " << (*first).first <<
" Attribute list " << attrStr1.str() );
// const AttributeList& attrList = (*first).second;
const coral::AttributeList& attrList = (*first).second;
CaloAffectedRegionInfo info;
float eta_min = attrList["eta_min"].data<float>();
float eta_max = attrList["eta_max"].data<float>();
float phi_min = attrList["phi_min"].data<float>();
float phi_max = attrList["phi_max"].data<float>();
int layer_min = attrList["layer_min"].data<int>();
int layer_max = attrList["layer_max"].data<int>();
//std::cout << " affected region found " << eta_min << " " << eta_max << " " << phi_min << " " << phi_max << " " << layer_min << " " << layer_max << " " << attrList["problem"].data<int>() << std::endl;
CaloAffectedRegionInfo::type_problem problem = (CaloAffectedRegionInfo::type_problem)(attrList["problem"].data<int>());
info.FillCaloAffectedRegionInfo(eta_min,eta_max,phi_min,phi_max,layer_min,layer_max,problem);
m_affectedRegions->push_back(info);
}
m_read = true;
return StatusCode::SUCCESS;
}
//-------------------------------------------------
bool CaloAffectedTool::isAffected(const xAOD::IParticle *p, float deta, float dphi, int layer_min, int layer_max, int problemType) const
bool CaloAffectedTool::isAffected(const xAOD::IParticle *p, const CaloAffectedRegionInfoVec *vAff, float deta, float dphi, int layer_min, int layer_max, int problemType) const
{
if(!vAff) return false;
static float epsilon=1e-6;
//std::cout << " in isAffected " << p->eta() << " " << p->phi() << std::endl;
if (!m_read) return false;
if (!m_affectedRegions) return false;
std::vector<CaloAffectedRegionInfo>::const_iterator reg1 = m_affectedRegions->begin();
std::vector<CaloAffectedRegionInfo>::const_iterator reg2 = m_affectedRegions->end();
std::vector<CaloAffectedRegionInfo>::const_iterator reg1 = vAff->begin();
std::vector<CaloAffectedRegionInfo>::const_iterator reg2 = vAff->end();
for (;reg1 != reg2; ++reg1) {
const CaloAffectedRegionInfo* region = &(*reg1);
......@@ -194,9 +85,11 @@ bool CaloAffectedTool::isAffected(const xAOD::IParticle *p, float deta, float dp
}
//-------------------------------------------------
bool CaloAffectedTool::listAffected(const xAOD::IParticle*p, std::vector<int>& layer_list, std::vector<int>& problem_list, float deta, float dphi, int problemType) const
bool CaloAffectedTool::listAffected(const xAOD::IParticle*p, const CaloAffectedRegionInfoVec *vAff, std::vector<int>& layer_list, std::vector<int>& problem_list, float deta, float dphi, int problemType) const
{
if(!vAff) return false;
bool found = false;
static float epsilon=1e-6;
......@@ -204,11 +97,9 @@ bool CaloAffectedTool::listAffected(const xAOD::IParticle*p, std::vector<int>& l
layer_list.clear();
problem_list.clear();
if (!m_read) return false;
if (!m_affectedRegions) return false;
std::vector<CaloAffectedRegionInfo>::const_iterator reg1 = m_affectedRegions->begin();
std::vector<CaloAffectedRegionInfo>::const_iterator reg2 = m_affectedRegions->end();
std::vector<CaloAffectedRegionInfo>::const_iterator reg1 = vAff->begin();
std::vector<CaloAffectedRegionInfo>::const_iterator reg2 = vAff->end();
for (;reg1 != reg2; ++reg1) {
const CaloAffectedRegionInfo* region = &(*reg1);
......
################################################################################
# Package: LArAffectedRegion
################################################################################
# Declare the package name:
atlas_subdir( LArAffectedRegion )
# Declare the package's dependencies:
atlas_depends_on_subdirs( PUBLIC
Calorimeter/CaloConditions
Calorimeter/CaloIdentifier
Control/AthenaBaseComps
Control/AthenaKernel
Control/StoreGate
Database/AthenaPOOL/AthenaPoolUtilities
GaudiKernel
LArCalorimeter/LArIdentifier
PRIVATE
Calorimeter/CaloDetDescr
Calorimeter/CaloGeoHelpers
Database/IOVDbMetaDataTools
Event/EventInfo
LArCalorimeter/LArElecCalib
LArCalorimeter/LArGeoModel/LArHV
LArCalorimeter/LArRecConditions
LArCalorimeter/LArCabling )
# External dependencies:
find_package( CORAL COMPONENTS CoralBase CoralKernel RelationalAccess )
# Component(s) in the package:
atlas_add_component( LArAffectedRegion
src/*.cxx
src/components/*.cxx
INCLUDE_DIRS ${CORAL_INCLUDE_DIRS}
LINK_LIBRARIES ${CORAL_LIBRARIES} CaloConditions CaloIdentifier AthenaBaseComps AthenaKernel StoreGateLib SGtests AthenaPoolUtilities GaudiKernel LArIdentifier CaloDetDescrLib CaloGeoHelpers EventInfo LArHV LArRecConditions LArCablingLib )
# Install files from the package:
atlas_install_headers( LArAffectedRegion )
atlas_install_joboptions( share/*.py )
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
#ifndef LArAffectedRegionAlg_H
#define LArAffectedRegionAlg_H
#include "AthenaBaseComps/AthAlgorithm.h"
#include "GaudiKernel/ToolHandle.h"
#include "GaudiKernel/IIncidentListener.h"
#include "StoreGate/DataHandle.h"
#include "LArIdentifier/LArOnlineID.h"
#include <vector>
#include "CaloConditions/CaloAffectedRegionInfo.h"
#include "CaloConditions/CaloAffectedRegionInfoVec.h"
#include "AthenaKernel/IOVSvcDefs.h" // for the definition of IOVSVC_CALLBACK_ARGS
#include "CaloIdentifier/CaloIdManager.h"
//#include ToolHandle<ILArHVTool> m_hvtool;
#include "AthenaPoolUtilities/CondAttrListCollection.h"
#include "IOVDbMetaDataTools/IIOVDbMetaDataTool.h"
#include "LArElecCalib/ILArHVTool.h"
#include "CaloDetDescr/CaloDetDescrManager.h"
#include "StoreGate/ReadCondHandleKey.h"
#include "LArRecConditions/LArBadChannelCont.h"
#include "LArCabling/LArOnOffIdMapping.h"
class LArOnlineID;
class CaloIdManager;
class LArAffectedRegionAlg : public AthAlgorithm,virtual public IIncidentListener {
//---
public:
LArAffectedRegionAlg(const std::string& name, ISvcLocator* pSvcLocator );
StatusCode initialize();
StatusCode execute();
StatusCode finalize();
void handle(const Incident& inc);
StatusCode updateMethod();
StatusCode updateAffectedRegionsFromDB(IOVSVC_CALLBACK_ARGS);
void searchNonNominalHV_EMB();
void searchNonNominalHV_EMEC_OUTER();
void searchNonNominalHV_EMEC_INNER();
void searchNonNominalHV_HEC();
void searchNonNominalHV_FCAL();
float HV_nominal(const char *identification,const float eta);
std::vector<int> returnProblem(const float eta, const float phi, const float delta_eta, const float delta_phi);
int getOccurenceProblem(const std::vector<CaloAffectedRegionInfo>& ArrayLArAffectedRegionInfo_global,float eta_min,float eta_max,float phi_min,float phi_max,int layer_min,int layer_max,int problem,float rate);
void debuggingSearchDoublons(const std::vector<CaloAffectedRegionInfo>& ArrayLArAffectedRegionInfo);
//---
private:
SG::ReadCondHandleKey<LArBadFebCont> m_BFKey{this, "MissingFEBKey", "LArBadFeb", "SG key for missing FEB object"};
SG::ReadCondHandleKey<LArOnOffIdMapping> m_cablingKey{this, "OnOffMap", "LArOnOffIdMap", "SG key for mapping object"};
std::vector<CaloAffectedRegionInfo> m_ArrayLArAffectedRegionInfo_global;
std::vector<CaloAffectedRegionInfo> m_ArrayLArAffectedRegionInfo_current_run;
const DataHandle<CaloIdManager> m_caloIdMgr;
ToolHandle<ILArHVTool> m_hvtool;
const LArOnlineID* m_onlineID;
const DataHandle<CaloDetDescrManager> m_calodetdescrmgr;
bool m_readingFromBytestream;
CondAttrListCollection* m_attrListColl; // info to give to metadata
ToolHandle<IIOVDbMetaDataTool> m_metaDataTool; // Access to iov meta data tool
bool m_doHV;
void extendPhiRegion(float phi, float & phi_min, float & phi_max);
};
#endif
# jobOptions fragment to setup writing of LAr affected region
if not hasattr(topSequence, 'LArAffectedRegionAlg'):
from LArAffectedRegion.LArAffectedRegionConf import LArAffectedRegionAlg
theLArAffectedRegionAlg = LArAffectedRegionAlg()
theLArAffectedRegionAlg.ReadingFromBytestream = False
topSequence+=theLArAffectedRegionAlg
from IOVDbSvc.CondDB import conddb
conddb.addFolder ('', '/LAR/LArAffectedRegionInfo<metaOnly/>')
###############################################################
#
# Job options file to run Digitization
#
#==============================================================
#these lines is to have information on what is installed
theAuditorSvc = svcMgr.AuditorSvc
theApp.AuditAlgorithms=True
theApp.AuditServices=True
theApp.AuditTools=True
theAuditorSvc += CfgMgr.NameAuditor()
#=================
from AthenaCommon.GlobalFlags import globalflags
globalflags.DetGeo = 'atlas'
globalflags.DataSource = 'data'
globalflags.InputFormat = 'pool'
from AthenaCommon.DetFlags import DetFlags
#David :
DetFlags.detdescr.all_setOn()
DetFlags.Muon_setOff()
DetFlags.ID_setOff()
# DetFlags.Tile_setOff()
# DetFlags.readRDOBS.LAr_setOn()
# DetFlags.makeRIO.Calo_setOn()
#ADDED TO CHECK
#David :
#DetFlags.Calo_setOn()
from RecExConfig.RecFlags import rec
rec.doCBNT=False
rec.doMuon = False
rec.doInDet = False
rec.doTrigger =False
#rec.doTile = False
rec.doESD = False
rec.doWriteESD = False
rec.doAOD = False
rec.doWriteAOD = False
rec.doWriteRDO = False
#do the print
rec.doDumpProperties=True
include( "PartPropSvc/PartPropSvc.py" )
# Get a handle to the ServiceManager
from AthenaCommon.AppMgr import ServiceMgr as svcMgr
# Get a handle to the ApplicationManager
#from AthenaCommon.AppMgr import theApp
from AthenaCommon.AthenaCommonFlags import athenaCommonFlags
athenaCommonFlags.FilesInput = ["ESD.pool.root"]
from LArConditionsCommon.LArCondFlags import larCondFlags
from AthenaCommon.GlobalFlags import jobproperties
jobproperties.Global.DetDescrVersion='ATLAS-GEO-00-00-00'
#jobproperties.Global.DetDescrVersion='ATLAS-CSC-00-00-00'
include("RecExCommon/RecExCommon_topOptions.py")
from IOVDbSvc import IOVDb
svcMgr.IOVDbSvc.GlobalTag = "COMCOND-ES1C-000-00"
svcMgr.IOVDbSvc.OutputLevel = DEBUG
from LArAffectedRegion.LArAffectedRegionConf import LArAffectedRegionAlg
theLArAffectedRegionAlg=LArAffectedRegionAlg()
# if we read from ESD, AOD, etc. set the following to false
theLArAffectedRegionAlg.ReadingFromBytestream = False
# Need the following when reading from ESD/AOD/etc.
#avoid searching on oracle
svcMgr.IOVDbSvc.Folders += [ "/LAR/LArAffectedRegionInfo<metaOnly/>" ]
topSequence += theLArAffectedRegionAlg
#--------------------------------------------------------------
# Event related parameters
#--------------------------------------------------------------
# Number of events to be processed (default is 10)
theApp.EvtMax = 10
# jobOptions fragment to setup writing of LAr affected region
from LArConditionsCommon import LArHVDB
from LArAffectedRegion.LArAffectedRegionConf import LArAffectedRegionAlg
theLArAffectedRegionAlg = LArAffectedRegionAlg()
from AthenaCommon.GlobalFlags import globalflags
if globalflags.DataSource()=='data':
theLArAffectedRegionAlg.doHV = True
else:
theLArAffectedRegionAlg.doHV = False
from AthenaCommon.AlgSequence import AlgSequence
topSequence = AlgSequence()
topSequence+=theLArAffectedRegionAlg
###############################################################
#
# Job options file to run Digitization
#
#==============================================================
from AthenaCommon.Resilience import treatException,protectedInclude
#these lines is to have information on what is installed
theAuditorSvc = svcMgr.AuditorSvc
theApp.AuditAlgorithms=True
theApp.AuditServices=True
theApp.AuditTools=True
theAuditorSvc += CfgMgr.NameAuditor()
#=================
from AthenaCommon.GlobalFlags import globalflags
globalflags.DetGeo = 'atlas'
globalflags.DataSource = 'data'
globalflags.InputFormat = 'bytestream'
from AthenaCommon.DetFlags import DetFlags
DetFlags.detdescr.all_setOn()
DetFlags.Muon_setOff()
DetFlags.ID_setOff()
DetFlags.Tile_setOff()
DetFlags.ALFA_setOff()
DetFlags.readRDOBS.LAr_setOn()
DetFlags.makeRIO.Calo_setOn()
#ADDED TO CHECK
DetFlags.Calo_setOn()
from RecExConfig.RecFlags import rec
rec.doMuon = False
rec.doInDet = False
rec.doTile = False
rec.doESD = False
rec.doWriteESD = False
rec.doAOD = False
rec.doWriteAOD = False
rec.doWriteRDO = False
include( "PartPropSvc/PartPropSvc.py" )
# Get a handle to the ServiceManager
from AthenaCommon.AppMgr import ServiceMgr as svcMgr
# Get a handle to the ApplicationManager
from AthenaCommon.AppMgr import theApp
from AthenaCommon.AlgSequence import AlgSequence
topSequence = AlgSequence()
from AthenaCommon.AthenaCommonFlags import athenaCommonFlags
athenaCommonFlags.BSRDOInput = ["/afs/cern.ch/user/g/gencomm/w0/RTT_INPUT_DATA/CosmicATN/daq.ATLAS.0091900.physics.IDCosmic.LB0001.SFO-1._0001.10EVTS.data"]
include( "ByteStreamCnvSvc/BSEventStorageEventSelector_jobOptions.py" )
svcMgr.ByteStreamInputSvc.FullFileName=athenaCommonFlags.BSRDOInput()
svcMgr.ByteStreamAddressProviderSvc.TypeNames += ["LArDigitContainer/FREE"]
from LArConditionsCommon.LArCondFlags import larCondFlags
from AthenaCommon.GlobalFlags import jobproperties
jobproperties.Global.DetDescrVersion='ATLAS-GEO-00-00-00'
from IOVDbSvc import IOVDb
svcMgr.IOVDbSvc.GlobalTag = "COMCOND-ES1C-000-00"
svcMgr.IOVDbSvc.OutputLevel = DEBUG
#=================For HV
from IOVDbSvc.CondDB import conddb
conddb.addFolder("DCS_OFL","/LAR/DCS/HV/BARREl/I16")
conddb.addFolder("DCS_OFL","/LAR/DCS/HV/BARREL/I8")
#to read HV mapping from database file instead of Ascii file in LArTools
conddb.addFolder("LAR_OFL","/LAR/IdentifierOfl/HVLineToElectrodeMap")
conddb.addOverride("/LAR/IdentifierOfl/HVLineToElectrodeMap","LARIdentifierOflHVLineToElectrodeMap-UPD4-01")
#======================
# the Tile, LAr and Calo detector description package
include( "CaloDetMgrDetDescrCnv/CaloDetMgrDetDescrCnv_joboptions.py" )
include( "LArDetDescr/LArDetDescr_joboptions.py" )
include( "LArConditionsCommon/LArConditionsCommon_comm_jobOptions.py")
from AtlasGeoModel import SetGeometryVersion
from AtlasGeoModel import GeoModelInit
# ---- add algorithm
from LArAffectedRegion.LArAffectedRegionConf import LArAffectedRegionAlg
topSequence+=LArAffectedRegionAlg()
#------------------------------------------------------
# Set output level threshold (2=DEBUG, 3=INFO, 4=WARNING, 5=ERROR, 6=FATAL )
#-------------------------------------------------------------
svcMgr.MessageSvc.OutputLevel = INFO
#increase the number of letter reserved to the alg/tool name from 18 to 30
svcMgr.MessageSvc.Format = "% F%50W%S%7W%R%T %0W%M"
svcMgr.MessageSvc.defaultLimit = 9999999 # all messages
svcMgr.MessageSvc.useColors = False
svcMgr.MessageSvc.defaultLimit=1000000
#---------------------------------------------------------------------
# Perfmon
#--------------------------------------------------------------------
from PerfMonComps.PerfMonFlags import jobproperties
jobproperties.PerfMonFlags.doMonitoring = True
from PerfMonComps.JobOptCfg import PerfMonSvc
svcMgr += PerfMonSvc()
jobproperties.PerfMonFlags.doDetailedMonitoring = True
#--------------------------------------------------------------
# Event related parameters
#--------------------------------------------------------------
# Number of events to be processed (default is 10)
theApp.EvtMax = 10
theApp.EvtSel = "EventSelector"
#Create output StreamESD
from AthenaPoolCnvSvc.WriteAthenaPool import AthenaPoolOutputStream
StreamESD=AthenaPoolOutputStream("StreamESD",athenaCommonFlags.PoolESDOutput(),True)
StreamESD.ForceRead = True
# Put MetaData in ESD stream
StreamESD.MetadataItemList += [ "LumiBlockCollection#*" ]
include ("EventAthenaPool/EventAthenaPoolItemList_joboptions.py")
StreamESD.ItemList+=fullItemList
#David, instruction to get all the info in the DetectorStore
ServiceMgr.DetectorStore.Dump=True
This diff is collapsed.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment