|
ATLAS Offline Software
|
Go to the documentation of this file.
14 #include "GaudiKernel/ClassID.h"
93 #include "CaloEvent/CaloClusterContainer.h"
107 template<
class T,
class EDMLIST = TypeInfo_EDM>
struct known{
110 static const bool value = !std::is_same<HLT::TypeInformation::ERROR_THE_FOLLOWING_TYPE_IS_NOT_KNOWN_TO_THE_EDM<T>,
search_result>
::value;
116 template<
typename T>
struct getCLID<
T,false>{
static int ID(){
return -1;}};
128 return StatusCode::SUCCESS;
173 return StatusCode::SUCCESS;
178 template<
typename AOD,
typename XAOD,
typename CnvTool>
193 std::string fmtkey_xAOD =
IH::template format<XAOD>(newLabel);
194 std::string fmtkey_xAODAux =
IH::template format<xAODAux>(newLabel+
"Aux.");
196 const AOD* aod = this->
m_sg->template tryConstRetrieve<AOD>(fmtkey_AOD);
198 ATH_MSG_WARNING(
"AOD key: " << fmtkey_AOD <<
" not found for xAOD conversion");
199 return StatusCode::SUCCESS;
202 ATH_MSG_DEBUG(
"attempting to convert " << fmtkey_AOD <<
" of size " << aod->size() <<
" to " << fmtkey_xAOD);
204 XAOD* xaod = this->
m_sg->template tryRetrieve<XAOD>(fmtkey_xAOD);
206 ATH_MSG_WARNING(
"xAOD key: " << fmtkey_xAOD <<
" not found for xAOD conversion");
207 return StatusCode::SUCCESS;
212 if(aod->size() != xaod->size()){
213 ATH_MSG_ERROR(
"conversion resulted in differently sized containers");
214 return StatusCode::FAILURE;
216 return StatusCode::SUCCESS;
222 std::string fmtkey_xAOD =
IH::template format<XAOD>(newLabel);
223 std::string fmtkey_xAODAux =
IH::template format<xAODAux>(newLabel+
"Aux.");
225 const AOD* aod = this->
m_sg->template tryConstRetrieve<AOD>(fmtkey_AOD);
228 return StatusCode::SUCCESS;
230 ATH_MSG_DEBUG(
"AOD container " << fmtkey_AOD <<
" extracted of size " << aod->size() );
234 if( aod->size() != tpb_aod->
size() ) {
235 ATH_MSG_WARNING(
"sizes of the container " << fmtkey_AOD <<
" and the corresponding (?) trigpassbits object are different: "
236 << aod->size() <<
" vs " << tpb_aod->
size() <<
", will not convert TrigPassBits for this container" );
237 return StatusCode::SUCCESS;
240 XAOD* xaod = this->
m_sg->template tryRetrieve<XAOD>(fmtkey_xAOD);
243 return StatusCode::SUCCESS;
245 ATH_MSG_DEBUG(
"xAOD container " << fmtkey_xAOD <<
" extracted of size " << xaod->size());
247 if(aod->size() != xaod->size()) {
248 ATH_MSG_ERROR(
"containers before and after the conversion are of different sizes");
249 return StatusCode::FAILURE;
255 for(
uint i=0;
i<aod->size();
i++) {
257 ATH_MSG_DEBUG(
"looking at object " <<
i+1 <<
" of " << aod->size() );
268 tpb_xaod = xBits.release();
269 return StatusCode::SUCCESS;
285 ATH_MSG_WARNING(
"muon label: " << format<xAOD::MuonContainer>(newLabel) <<
" not found for xAOD conversion");
286 return StatusCode::SUCCESS;
290 if(!xaodCombTrackParticles){
291 ATH_MSG_WARNING(
"muon label: " << format<xAOD::TrackParticleContainer>(newLabel+
"_CombTrackParticles") <<
" not found for xAOD conversion");
292 return StatusCode::SUCCESS;
296 if(!xaodCombTrackParticles){
297 ATH_MSG_WARNING(
"muon label: " << format<xAOD::TrackParticleContainer>(newLabel+
"_ExtrapTrackParticles") <<
" not found for xAOD conversion");
298 return StatusCode::SUCCESS;
304 ATH_MSG_WARNING(
"muon label: " << format<TrigMuonEFInfoContainer>(
label) <<
" not found for xAOD conversion");
305 return StatusCode::SUCCESS;
308 CHECK(this->
m_tool->convertTrigMuonEFInfoContainer( *aod, *xaodMuon, xaodCombTrackParticles, xaodExtrapTrackParticles));
313 return StatusCode::SUCCESS;
321 return StatusCode::SUCCESS;
324 if( aod->
size() != tpb_aod->
size() ) {
325 ATH_MSG_WARNING(
"sizes of the muon container " <<
label <<
" and the corresponding (?) trigpassbits object are different: "
326 << aod->
size() <<
" vs " << tpb_aod->
size() <<
", will not convert TrigPassBits for this container" );
328 xAOD::MuonContainer* xaodMuon = this->
m_sg->template tryRetrieve<xAOD::MuonContainer>(format<xAOD::MuonContainer>(newLabel));
330 ATH_MSG_WARNING(
"xAOD key: " << format<xAOD::MuonContainer>(newLabel) <<
" not found");
331 return StatusCode::SUCCESS;
333 ATH_MSG_DEBUG(
"xAOD muon container " << format<xAOD::MuonContainer>(newLabel) <<
" extracted of size " << xaodMuon->
size());
335 if(aod->
size() != xaodMuon->
size()) {
336 ATH_MSG_ERROR(
"containers before and after the conversion are of different sizes");
337 return StatusCode::FAILURE;
356 tpb_xaod = xBits.release();
357 return StatusCode::SUCCESS;
365 m_tauJetTool(
"xAODMaker::TauJetCnvTool/TauJetCnvTool",this),
366 m_combMuonTool(
"xAODMaker::CombinedMuonFeatureContainerCnvTool/CombinedMuonFeatureContainerCnvTool",this),
367 m_isoMuonTool(
"xAODMaker::IsoMuonFeatureContainerCnvTool/IsoMuonFeatureContainerCnvTool",this),
368 m_trigMuonTool(
"TrigMuonEFInfoToMuonCnvTool/TrigMuonEFInfoToMuonCnvTool",this),
369 m_jetCnvTool(
"xAODMaker::JetCnvTool/JetCnvTool",this),
370 m_trigCaloClusterTool(
"xAODMaker::TrigCaloClusterCnvTool/TrigCaloClusterCnvTool",this),
371 m_emClusterTool(
"xAODMaker::TrigEMClusterCnvTool/TrigEMClusterCnvTool",this),
372 m_bjetTool(
"xAODMaker::TrigBjetCnvTool/TrigBjetCnvTool",this),
373 m_efBphysTool(
"xAODMaker::TrigEFBphysContainerCnvTool/TrigEFBphysContainerCnvTool",this),
374 m_l2BphysTool(
"xAODMaker::TrigL2BphysContainerCnvTool/TrigL2BphysContainerCnvTool",this),
375 m_trigMetTool(
"xAODMaker::TrigMissingETCnvTool/TrigMissingETCnvTool",this),
376 m_trigSpacePtsTool(
"xAODMaker::TrigSpacePointCountsCnvTool/TrigSpacePointCountsCnvTool",this),
377 m_trigMbtsBitsTool(
"xAODMaker::TrigT2MbtsBitsCnvTool/TrigT2MbtsBitsCnvTool",this),
378 m_trigTrackCtsTool(
"xAODMaker::TrigTrackCountsCnvTool/TrigTrackCountsCnvTool",this),
379 m_trigVtxCtsTool(
"xAODMaker::TrigVertexCountsCnvTool/TrigVertexCountsCnvTool",this),
380 m_electronTool(
"xAODMaker::ElectronCnvTool/ElectronCnvTool", this ),
381 m_photonTool(
"xAODMaker::PhotonCnvTool/PhotonCnvTool", this ),
382 m_caloClusterTool(
"xAODMaker::CaloClusterCnvTool/CaloClusterCnvTool", this),
383 m_trigPassBitsTool(
"xAODMaker::TrigPassBitsCnvTool/TrigPassBitsCnvTool", this )
385 declareInterface<ITrigBStoxAODTool>(
this );
434 m_helpers.insert( std::pair<CLID,BStoXAODHelper::MuonHelper*>
571 <<
") is not the same as the number of old containers names ("
573 return StatusCode::FAILURE;
586 return StatusCode::SUCCESS;
590 std::vector<std::pair<CLID,std::string> >::const_iterator clidlabel;
591 std::vector<std::pair<CLID,std::string> >::const_iterator clidNewLabel =
m_clid_newLabels.begin();
597 ATH_MSG_WARNING(
"couldn't find holder for " << clidlabel->first <<
" " << clidlabel->second);
603 std::multimap<CLID,BStoXAODHelper::IHelper*>::const_iterator hit;
606 std::string clabel = clidlabel->second;
611 <<
" for label " << clidlabel->second <<
", new label " << clidNewLabel->second);
612 CHECK(hit->second->help(clidlabel->second,clidNewLabel->second));
616 ATH_MSG_DEBUG(
"couldn't find converters for clid: " << clidlabel->first);
619 return StatusCode::SUCCESS;
627 std::vector<HLT::TriggerElement*>& allTEs = nav->
getAllTEs();
629 ATH_MSG_DEBUG(
"rewiring Navigation for xAOD. working on " << allTEs.size() <<
" TEs");
630 for(
auto te : allTEs){
631 std::vector<HLT::TriggerElement::FeatureAccessHelper>& feats = te->getFeatureAccessHelpers();
632 for(
auto& featacchelp : feats){
638 ATH_MSG_WARNING(
"could not find old holder for CLID " << featacchelp.getCLID() <<
" and subTypeIndex: " << featacchelp.getIndex());
642 std::multimap<CLID,BStoXAODHelper::IHelper*>::const_iterator
it =
m_helpers.end();
643 std::string old_label = oldholder->
label();
648 bool iselement = (oldholder->
typeClid()==
it->second->AODElementClid());
649 bool iscontainer = (oldholder->
typeClid()==
it->second->AODContainerClid());
651 ATH_MSG_VERBOSE(
"old is element feature " << iselement <<
" or container feature: " << iscontainer);
653 if(!(iselement || iscontainer)){
654 ATH_MSG_WARNING(
"not clear what kind of feature we're dealing with. Skipping. Old holder is:" << *oldholder);
657 CLID newTypeClid = CLID_NULL;
658 if(iselement) newTypeClid =
it->second->xAODElementClid();
659 if(iscontainer) newTypeClid =
it->second->xAODContainerClid();
661 std::lock_guard<std::recursive_mutex> lock(nav->
getMutex());
667 ATH_MSG_WARNING(
"could not find new holder for xAOD clid " << newTypeClid <<
" and label " << oldholder->
label());
673 ATH_MSG_VERBOSE(
"changing CLID: " << featacchelp.getCLID() <<
" to " << newTypeClid);
676 featacchelp.setCLIDandIndex(newTypeClid,newholder->
subTypeIndex());
677 ATH_MSG_VERBOSE(
"clid is now: " << featacchelp.getCLID() <<
" sti: " << featacchelp.getIndex().subTypeIndex());
684 return StatusCode::SUCCESS;
691 const std::vector<std::string>& newProperty,
692 std::vector<std::pair<CLID,std::string> >& decoded,
693 std::vector<std::pair<CLID,std::string> >& decodedNewNames) {
695 SmartIF<IClassIDSvc> clidSvc{service(
"ClassIDSvc")};
698 if( property.size() != newProperty.size() ) {
699 ATH_MSG_ERROR(
"vector sizes of new and old SG labels are different: "
700 << newProperty.size() <<
" vs " << property.size() );
701 return StatusCode::FAILURE;
704 std::vector<std::string>::const_iterator
it;
705 std::vector<std::string>::const_iterator itNew = newProperty.begin();
706 for (
it = property.begin();
it != property.end(); ++
it, ++itNew ) {
709 std::string label_new;
712 if (
it->find(
'#') != std::string::npos ) {
713 type =
it->substr(0,
it->find(
'#') );
720 if ( itNew->find(
'#') != std::string::npos ) {
721 label_new = itNew->substr(itNew->find(
'#')+1 );
726 if ( clidSvc->getIDOfTypeName(
type, clid).isFailure() ) {
728 <<
" check property");
729 return StatusCode::FAILURE;
732 ATH_MSG_DEBUG(
"Recognized CLID : " <<
type <<
" and label: " <<
label <<
", new label will be: " << label_new);
733 decoded.push_back(std::make_pair(clid,
label));
734 decodedNewNames.push_back(std::make_pair(clid, label_new));
736 return StatusCode::SUCCESS;
745 std::vector<HLT::TriggerElement*>& allTEs = nav->
getAllTEs();
747 ATH_MSG_DEBUG(
"setting xAOD TrigPassBits. Working on " << allTEs.size() <<
" TEs");
749 for(
auto te : allTEs){
750 std::vector<HLT::TriggerElement::FeatureAccessHelper>& feats = te->getFeatureAccessHelpers();
751 for(
auto& featacchelp : feats){
757 ATH_MSG_WARNING(
"could not find holder for CLID " << featacchelp.getCLID() <<
" and subTypeIndex: " << featacchelp.getIndex());
761 if(holder->
label() ==
"passbits") {
762 ATH_MSG_VERBOSE(
"skipping this feature, as this is the passbits object itself" );
766 std::multimap<CLID,BStoXAODHelper::IHelper*>::const_iterator
it =
m_helpers.end();
767 std::string hlabel = holder->
label();
772 <<
", label " << holder->
label() <<
" corresponding to xAOD CLID " <<
it->second->xAODContainerClid() );
774 bool iselement = (holder->
typeClid()==
it->second->AODElementClid());
775 bool iscontainer = (holder->
typeClid()==
it->second->AODContainerClid());
777 ATH_MSG_VERBOSE(
"is element feature " << iselement <<
" or container feature: " << iscontainer);
779 if(!(iselement || iscontainer)){
780 ATH_MSG_WARNING(
"not clear what kind of feature we're dealing with. Skipping. The holder is:" << *holder);
785 const TrigPassBitsCollection* bits_collection =
evtStore()->template tryConstRetrieve<TrigPassBitsCollection>(
"HLT_TrigPassBitsCollection_passbits");
786 if(bits_collection !=
nullptr) {
787 ATH_MSG_DEBUG(
"aod bits collection extracted of size " << bits_collection->
size() );
799 if(xaod_bits_collection !=
nullptr)
800 ATH_MSG_DEBUG(
"xaod bits container extracted of size " << xaod_bits_collection->
size() );
807 if ( nav->
getFeature(te, bits,
"passbits" ) ){
819 if(bits_collection !=
nullptr && xaod_bits_collection !=
nullptr && bits !=
nullptr) {
822 if(bits == bits_collection->
at(
i)) {
830 std::pair<CLID,std::string> pair = std::make_pair( featacchelp.getCLID(), holder->
label() );
831 std::vector<std::pair<CLID,std::string> >::const_iterator it_new_label;
833 std::string new_label =
"";
835 new_label = (*it_new_label).second;
836 ATH_MSG_DEBUG(
"calling help_fillTrigPassBits for TE " << te <<
", feature CLID " << featacchelp.getCLID()
837 <<
", aod container " << holder->
label() <<
", new container name: " << new_label );
838 CHECK(
it->second->help_fillTrigPassBits( holder->
label(), new_label, bits_collection->
at(bits_nr), xaod_tpb ) );
840 ATH_MSG_DEBUG(
"new label was not found, presumably this container was not converted. Will not look for TrigPassBits" );
843 if(xaod_tpb !=
nullptr) {
844 xaod_bits_collection->
at(bits_nr) = xaod_tpb;
845 ATH_MSG_VERBOSE(
"after the conversion, size of xAOD::TrigPassBits is " << xaod_bits_collection->
at(bits_nr)->size() );
849 ATH_MSG_WARNING(
"TrigPassBits object was not identified within container!" );
857 return StatusCode::SUCCESS;
862 auto myrange = helpers.equal_range(clid);
869 return StatusCode::SUCCESS;
874 for(;
it!=myrange.second;++
it) {
875 CLID myHelperxAODCLID = (*it).second->xAODContainerClid();
879 return StatusCode::SUCCESS;
885 return StatusCode::SUCCESS;
889 <<
", probably you should accomodate for this change in the code above" );
890 return StatusCode::FAILURE;
894 return StatusCode::SUCCESS;
JetConstituentVector::iterator iterator
virtual CLID containerClid() const =0
virtual StatusCode initialize(MsgStream &m, StoreGateSvc &s)
master_search< typename EDMLIST::map, get_strictly_feat, T >::result::search_result search_result
bool isPassing(const OBJ *obj, const CONT *container) const
Check if an element of a container is passing/failing.
virtual StatusCode help(const std::string &label, const std::string &newLabel)
bool passed(DecisionID id, const DecisionIDContainer &idSet)
checks if required decision ID is in the set of IDs in the container
std::vector< Identifier > ID
std::string find(const std::string &s)
return a remapped string
const std::string & label() const
returns the label of objects stores by this holder
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
T * tryRetrieve() const
Variant of the above which doesn't print a warning message.
virtual CLID AODElementClid()=0
Storable container for CaloCluster.
const std::string m_AODprefix
std::recursive_mutex & getMutex()
Container of TrigEFBjet objects to be stored in POOL.
unsigned int size() const
gets size of the bits array
virtual StatusCode help_fillTrigPassBits(const std::string &label, const std::string &newLabel, const TrigPassBits *tpb_aod, xAOD::TrigPassBits *&tpb_xaod)
std::string formatSGkey(const std::string &prefix, const std::string &containername, const std::string &label)
declaration of formatting function.
#define ATH_MSG_VERBOSE(x)
std::string format(const std::string &label)
Container from TrigEMCluster type objects.
bool getFeature(const TriggerElement *te, const T *&features, const std::string &label="", std::string &sourcelabel=::HLT::TrigNavStructure::m_unspecifiedLabel) const
HLTNavDetails::Holder< T > * getHolder(uint16_t subTypeIndex) const
as above but does not create holder on demand (return 0 if not found)
static const CLID & ID()
the CLID of T
ServiceHandle< StoreGateSvc > & evtStore()
The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
The Athena Transient Store API.
virtual CLID AODContainerClid()=0
::StatusCode StatusCode
StatusCode definition for legacy code.
MuonHelper(const ToolHandle< ITrigMuonEFInfoToMuonCnvTool > &tool)
Type describing which elements in a container passed a trigger chain.
Default, invalid implementation of ClassID_traits.
std::unique_ptr< TrigPassBits_v1 > makeTrigPassBits(const CONT *container, uint32_t containerKey=xAOD::TrigPassBits_v1::DEFAULT_KEY)
Helper function creating a new object to describe a target container.
TrigHolderStructure & getHolderStorage()
#define CHECK(...)
Evaluate an expression and check for errors.
The Navigation class, organizes TriggerElements into the tree structure.
bool isPassing(const TrigPassBits *bits, const T *obj, const CONTAINER *container)
Check the bit for the object in the associated bits object.
virtual StatusCode help(const std::string &label, const std::string &newLabel)=0
uint32_t CLID
The Class ID type.
master_search< typename EDMLIST::map, HLT::TypeInformation::get_cont, CONTAINER >::result::search_result::aux type
Container2Aux< XAOD >::type xAODAux
bool msgLvl(const MSG::Level l)
const T * tryConstRetrieve() const
void markPassing(const OBJ *obj, const CONT *container, bool passed=true)
Mark one of the elements of the target container as passing/failing.
std::vector< TriggerElement * > & getAllTEs()
access needed by slimming tools.
Tool used by TrigBSExtraction to convert to xAOD.
virtual StatusCode help_fillTrigPassBits(const std::string &label, const std::string &newLabel, const TrigPassBits *tpb_aod, xAOD::TrigPassBits *&tpb_xaod)
virtual CLID typeClid() const =0
returns the CLID of objects stores by this holder
#define ATH_MSG_WARNING(x)
virtual CLID xAODContainerClid()=0
virtual StatusCode help(const std::string &label, const std::string &newLabel)
uint16_t subTypeIndex() const
returns the index (short number used when linking object to the TE) of objects stores by this holder
virtual CLID xAODElementClid()=0
MsgStream & msg(MSG::Level l)
const T * at(size_type n) const
Access an element, as an rvalue.
HolderType * getHolder(class_id_type clid, const std::variant< sub_index_type, std::string > &stiOrLabel) const
float distance(const Amg::Vector3D &p1, const Amg::Vector3D &p2)
calculates the distance between two point in 3D space
size_type size() const noexcept
Returns the number of elements in the collection.
Container from TrigCaloCluster type objects.
DefaultHelper(const ToolHandle< CnvTool > &tool)
virtual StatusCode help_fillTrigPassBits(const std::string &label, const std::string &newLabel, const TrigPassBits *tpb_aod, xAOD::TrigPassBits *&tpb_xaod)=0