Commit 7e3addfb authored by Matthew Scott Rudolph's avatar Matthew Scott Rudolph Committed by Graeme Stewart
Browse files

suppress warning for missing DBM fields when dict version does not have DBM...

suppress warning for missing DBM fields when dict version does not have DBM (InDetIdentifier-00-10-01)
parent e10a7902
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
/**
* @file InDetIdentifierDict.h
*
* @brief This file includes the class for dictionary definitions
*
* @author RD Schaffer <R.D.Schaffer@cern.ch>
*
* $Id: $
*/
#ifndef INDETIDENTIFIER_INDETIDENTIFIERDICT_H
#define INDETIDENTIFIER_INDETIDENTIFIERDICT_H
#include "InDetIdentifier/PixelID.h"
#include "InDetIdentifier/SCT_ID.h"
#include "InDetIdentifier/SiliconID.h"
#include "InDetIdentifier/TRT_ID.h"
#endif // INDETIDENTIFIER_INDETIDENTIFIERDICT_H
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
#ifndef INDETIDENTIFIER_XXX_SILICONID_H
#define INDETIDENTIFIER_XXX_SILICONID_H
/**
* @file SiliconID.h
*
* @brief This is an Identifier helper class for both the Pixel and
* SCT subdetectors. This class defines identifier hashes which span
* BOTH the pixels and the scts.
*
* @author RD Schaffer <R.D.Schaffer@cern.ch>
*
* $Id: SiliconID.h,v 1.2 2005-06-22 14:39:49 schaffer Exp $
*/
//<<<<<< INCLUDES >>>>>>
#include "AtlasDetDescr/AtlasDetectorID.h"
#include "Identifier/Identifier.h"
#include "Identifier/IdentifierHash.h"
//#include "Identifier/Range.h"
#include "Identifier/IdHelper.h"
#include "InDetIdentifier/PixelID.h"
#include "InDetIdentifier/SCT_ID.h"
//#include "IdDict/IdDictFieldImplementation.h"
#include "CLIDSvc/CLASS_DEF.h"
//<<<<<< CLASS DECLARATIONS >>>>>>
/**
** @class SiliconID
**
** @brief This is an Identifier helper class for both the Pixel and
** SCT subdetectors. This class defines identifier hashes which span
** BOTH the pixels and the scts.
**
** PixelID and SCT_ID id helpers should be used to create and decode
** identifiers for the two subdetectors. This class should be used
** to go between a ids and a hash which covers both subdetectors.
**
**/
class SiliconID : public AtlasDetectorID
{
public:
/// @name public typedefs
//@{
typedef Identifier::size_type size_type;
//@}
/// @name strutors
//@{
SiliconID(void);
SiliconID(const PixelID* pixel_helper, const SCT_ID* sct_helper);
~SiliconID(void);
//@}
/// @name Optimized accessors: less optimal than PixelID/SCT_ID
//@{
/// Identifier from hash
Identifier wafer_id (IdentifierHash wafer_hash) const;
/// wafer hash from id
IdentifierHash wafer_hash (Identifier wafer_id) const;
/// Hash table maximum sizes
size_type wafer_hash_max (void) const;
/// Test for barrel - generic, i.e. works for EITHER pixel or sct id
bool is_barrel (const Identifier& id) const;
/// Test for pixle b-layer - generic, i.e. works for EITHER pixel or sct id
bool is_blayer (const Identifier& id) const;
//@}
/// Test whether hash is pixel or sct
bool is_hash_pixel (IdentifierHash wafer_hash) const;
/// Access Iterators over full set of ids. Wafer iterator is sorted
///Identifier wafer_id (unsigned int) const;
/// @name methods from abstract interface - NOT IMPLEMENTED
//@{
/// Create compact id from hash id (return == 0 for OK)
virtual int get_id (const IdentifierHash& hash_id,
Identifier& id,
const IdContext* context = 0) const;
/// Create hash id from compact id (return == 0 for OK)
virtual int get_hash (const Identifier& id,
IdentifierHash& hash_id,
const IdContext* context = 0) const;
/// Initialization from the identifier dictionary
virtual int initialize_from_dictionary(const IdDictMgr& dict_mgr);
//@}
/// Tests of packing
int test_wafer_hashes (void) const;
private:
size_type m_wafer_hash_max;
size_type m_pixel_wafer_hash_max;
const PixelID* m_pixel_helper;
const SCT_ID* m_sct_helper;
};
/////////////////////////////////////////////////////////////////////////////
//<<<<<< INLINE MEMBER FUNCTIONS >>>>>>
/////////////////////////////////////////////////////////////////////////////
//using the macros below we can assign an identifier (and a version)
//This is required and checked at compile time when you try to record/retrieve
CLASS_DEF(SiliconID, 129452393, 1)
//----------------------------------------------------------------------------
inline Identifier
SiliconID::wafer_id (IdentifierHash wafer_hash) const
{
// Identifier from hash
if (wafer_hash < m_pixel_wafer_hash_max) {
// Pixel hash
return (m_pixel_helper->wafer_id(wafer_hash));
}
else if (wafer_hash < m_wafer_hash_max) {
// SCT hash
return (m_sct_helper->wafer_id(wafer_hash - m_pixel_wafer_hash_max));
}
// return invalid Identifier
Identifier result;
return (result);
}
//----------------------------------------------------------------------------
inline IdentifierHash
SiliconID::wafer_hash (Identifier wafer_id) const
{
// wafer hash from id
if (is_pixel(wafer_id)) {
// Pixel id
return (m_pixel_helper->wafer_hash(wafer_id));
}
else {
// SCT hash + pixel hash max
return (m_sct_helper->wafer_hash(wafer_id) + m_pixel_wafer_hash_max);
}
}
//----------------------------------------------------------------------------
inline SiliconID::size_type
SiliconID::wafer_hash_max (void) const
{
// Hash table maximum sizes
return (m_wafer_hash_max);
}
//----------------------------------------------------------------------------
inline bool
SiliconID::is_barrel (const Identifier& id) const
{
if (is_pixel(id)) {
// Pixel id
return (m_pixel_helper->is_barrel(id));
}
else {
// SCT
return (m_sct_helper->is_barrel(id));
}
}
//----------------------------------------------------------------------------
/// Test for pixle b-layer
inline bool
SiliconID::is_blayer (const Identifier& id) const
{
if (is_pixel(id)) {
// Pixel id
return (m_pixel_helper->is_blayer(id));
}
else {
// SCT
return (false);
}
}
//----------------------------------------------------------------------------
/// Test of hash for pixel/sct
inline bool
SiliconID::is_hash_pixel (IdentifierHash wafer_hash) const
{
// Identifier from hash
if (wafer_hash < m_pixel_wafer_hash_max) {
// Pixel hash
return (true);
}
// SCT hash
return (false);
}
#endif // INDETIDENTIFIER_SILICONID_H
<lcgdict>
<class name="PixelID" />
<class name="SCT_ID" />
<class name="SiliconID" />
<class name="TRT_ID" />
</lcgdict>
package InDetIdentifier
author RD Schaffer <R.D.Schaffer@cern.ch>
author Grant Gorfine <gorfine@nikhef.nl>
use AtlasPolicy AtlasPolicy-*
use AtlasDetDescr AtlasDetDescr-* DetectorDescription
use Identifier Identifier-* DetectorDescription
use IdDict IdDict-* DetectorDescription
use CLIDSvc CLIDSvc-* Control
library InDetIdentifier PixelID.cxx \
SCT_ID.cxx \
TRT_ID.cxx \
SiliconID.cxx
apply_pattern installed_library
private
use GaudiInterface GaudiInterface-* External
use IdDictParser IdDictParser-* DetectorDescription
application test_indet_id ../test/test_indet_id.cxx
macro_append test_indet_id_dependencies InDetIdentifier
# The following use is to get the lcgdict pattern.
# This is "hidden" behind "private" and "no_auto_imports" to keep
# clients of EventInfo from seeing excess dependencies
private
use AtlasReflex AtlasReflex-* External -no_auto_imports
# Pattern to build the dict lib. User should create a single header
# file: <package>Dict.h which includes all other .h files. See EventInfoDict
# A selection file must be created by hand. This file lists the
# classes to be added to the dictionary, and which fields are
# transient. It should be put in ../<package> dir and is conventionally called
# selection.xml.
# Must temporarily omit emission of methods - fails
apply_pattern lcgdict dict=InDetIdentifier selectionfile=selection.xml headerfiles="../InDetIdentifier/InDetIdentifierDict.h"
This diff is collapsed.
This diff is collapsed.
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
/**
* @file SiliconID.cxx
*
* @author RD Schaffer <R.D.Schaffer@cern.ch>
*
* $Id: SiliconID.cxx,v 1.2 2009-01-07 16:05:20 schaffer Exp $
*/
//<<<<<< INCLUDES >>>>>>
#include "InDetIdentifier/SiliconID.h"
//#include "InDetIdentifier/PixelID.h"
//#include "InDetIdentifier/SCT_ID.h"
#include "Identifier/IdentifierHash.h"
#include "IdDict/IdDictDefs.h"
#include "GaudiKernel/MsgStream.h"
#include <iostream>
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
SiliconID::SiliconID(void)
:
m_wafer_hash_max(0),
m_pixel_wafer_hash_max(0),
m_pixel_helper(0),
m_sct_helper(0)
{}
SiliconID::SiliconID(const PixelID* pixel_helper, const SCT_ID* sct_helper)
:
m_wafer_hash_max(0),
m_pixel_wafer_hash_max(0),
m_pixel_helper(pixel_helper),
m_sct_helper(sct_helper)
{}
SiliconID::~SiliconID(void)
{}
int
SiliconID::initialize_from_dictionary(const IdDictMgr& dict_mgr)
{
MsgStream log(m_msgSvc, "SiliconID");
if(m_msgSvc) log << MSG::INFO << "Initialize from dictionary" << endreq;
else std::cout << " INFO SiliconID Initialize from dictionary" << std::endl;
// Check whether this helper should be reinitialized
if (!reinitialize(dict_mgr)) {
if(m_msgSvc) log << MSG::INFO << "Request to reinitialize not satisfied - tags have not changed" << endreq;
else std::cout << " INFO SiliconID::initialize_from_dictionary - Request to reinitialize not satisfied - tags have not changed" << std::endl;
return (0);
}
else {
if(m_msgSvc) log << MSG::DEBUG << "(Re)initialize" << endreq;
else std::cout << " DEBUG SiliconID::initialize_from_dictionary - (Re)initialize" << std::endl;
}
// init base object
if(AtlasDetectorID::initialize_from_dictionary(dict_mgr)) return (1);
// Register version of InnerDetector dictionary
if (register_dict_tag(dict_mgr, "InnerDetector")) return(1);
// Make sure that pix/sct helpers are initialized
// CANNOT MODIFY CONST HELPERS
//if(m_pixel_helper->initialize_from_dictionary(dict_mgr)) return (1);
//if(m_sct_helper->initialize_from_dictionary(dict_mgr)) return (1);
m_pixel_wafer_hash_max = m_pixel_helper->wafer_hash_max();
m_wafer_hash_max = m_sct_helper->wafer_hash_max() + m_pixel_wafer_hash_max;
return 0;
}
// From hash get Identifier
int
SiliconID::get_id (const IdentifierHash& /*hash_id*/,
Identifier& id,
const IdContext* /*context*/) const
{
int result = 1;
Identifier newid;
id = newid;
return (result);
}
int
SiliconID::get_hash (const Identifier& /*id*/,
IdentifierHash& hash_id,
const IdContext* /*context*/) const
{
// Get the hash code from either a vec (for wafers) or calculate
// it (pixels). For the former, we convert to compact and call
// get_hash again. For the latter, we calculate the hash from the
// Identifier.
int result = 1;
hash_id = 0;
return (result);
}
int
SiliconID::test_wafer_hashes (void) const
{
MsgStream log(m_msgSvc, "IdDictTest_SiliconID");
if(m_msgSvc) log << MSG::INFO << "test_wafer_packing: wafer hash max, pix, sct "
<< wafer_hash_max() << " "
<< m_pixel_helper->wafer_hash_max() << " "
<< m_sct_helper->wafer_hash_max() << " "
<< endreq;
else std::cout << " INFO SiliconID::test_wafer_packing: wafer hash max, pix, sct "
<< wafer_hash_max() << " "
<< m_pixel_helper->wafer_hash_max() << " "
<< m_sct_helper->wafer_hash_max() << " "
<< std::endl;
bool error = false;
int nids = 0;
int nblay = 0;
int nbar = 0;
int nbars = 0;
int nbarp = 0;
int nHashPix = 0;
for (unsigned int i = 0; i < wafer_hash_max(); ++i, ++nids) {
Identifier id = wafer_id(i);
if (i < 10) {
if(m_msgSvc) log << MSG::INFO << "test_wafer_packing: id "
<< show_to_string(id)
<< endreq;
else std::cout << " INFO SiliconID::test_wafer_packing: id "
<< show_to_string(id)
<< std::endl;
}
// Check hash
IdentifierHash hash = wafer_hash(id);
if (hash != i) {
if(m_msgSvc) log << MSG::ERROR << "test_wafer_packing: wafer_hash not equal to i "
<< "hash: " << hash << " i: " << i << " "
<< show_to_string(id)
<< endreq;
else std::cout << " ERROR SiliconID::test_wafer_packing: wafer_hash not equal to i "
<< "hash: " << hash << " i: " << i << " "
<< show_to_string(id)
<< std::endl;
error = true;
}
// Check is_barrel
if (is_barrel(id)) {
nbar++;
if(is_sct(id)) {
nbars++;
if(!m_sct_helper->is_barrel(id)) {
if(m_msgSvc) log << MSG::ERROR << "test_wafer_packing: is_barrel fails for sct. "
<< "hash: " << hash << " i: " << i << " "
<< show_to_string(id)
<< endreq;
else std::cout << " ERROR SiliconID::test_wafer_packing: is_barrel fails for sct. "
<< "hash: " << hash << " i: " << i << " "
<< show_to_string(id)
<< std::endl;
error = true;
}
}
else {
nbarp++;
if(!m_pixel_helper->is_barrel(id)) {
if(m_msgSvc) log << MSG::ERROR << "test_wafer_packing: is_barrel fails for pixel. "
<< "hash: " << hash << " i: " << i << " "
<< show_to_string(id)
<< endreq;
else std::cout << " ERROR SiliconID::test_wafer_packing: is_barrel fails for pixel. "
<< "hash: " << hash << " i: " << i << " "
<< show_to_string(id)
<< std::endl;
error = true;
}
}
}
// Check is_blayer
if (is_blayer(id)) {
nblay++;
if(is_sct(id)) {
if(m_msgSvc) log << MSG::ERROR << "test_wafer_packing: is_blayer is sct. "
<< "hash: " << hash << " i: " << i << " "
<< show_to_string(id)
<< endreq;
else std::cout << " ERROR SiliconID::test_wafer_packing: is_blayer is sct. "
<< "hash: " << hash << " i: " << i << " "
<< show_to_string(id)
<< std::endl;
error = true;
}
else {
if(!m_pixel_helper->is_blayer(id)) {
if(m_msgSvc) log << MSG::ERROR << "test_wafer_packing: is_blayer fails for pixel. "
<< "hash: " << hash << " i: " << i << " "
<< show_to_string(id)
<< endreq;
else std::cout << " ERROR SiliconID::test_wafer_packing: is_blayer fails for pixel. "
<< "hash: " << hash << " i: " << i << " "
<< show_to_string(id)
<< std::endl;
error = true;
}
}
}
// Check is_pixel
if (is_hash_pixel(i) != is_pixel(id)) {
if(m_msgSvc) log << MSG::ERROR << "test_wafer_packing: is_hash_pixel "
<< "hash: " << hash << " i: " << i << " "
<< show_to_string(id)
<< endreq;
else std::cout << " ERROR SiliconID::test_wafer_packing: is_hash_pixel "
<< "hash: " << hash << " i: " << i << " "
<< show_to_string(id)
<< std::endl;
error = true;
}
else {
nHashPix++;
}
}
if(m_msgSvc) {
log << MSG::INFO << "Looped over " << nids << " hashes "
<< endreq;
log << MSG::INFO << "Number of is_barrel (pix/sct): " << nbar
<< " " << nbarp << " " << nbars
<< endreq;
log << MSG::INFO << "Number of is_blayer: " << nblay
<< endreq;
log << MSG::INFO << "Number of matching is_hash_pixel/is_pixel: " << nHashPix
<< endreq;
}
else {
std::cout << " INFO Looped over " << nids << " hashes "
<< std::endl;
std::cout << " INFO Number of is_barrel (pix/sct): " << nbar
<< " " << nbarp << " " << nbars
<< std::endl;
std::cout << " INFO Number of is_blayer: " << nblay
<< std::endl;
std::cout << " INFO Number of matching is_hash_pixel/is_pixel: " << nHashPix
<< std::endl;
}
if (error) return (1);
return (0);
}
This diff is collapsed.
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment