Skip to content
Snippets Groups Projects
Commit 4e7f801e authored by Sebastien Ponce's avatar Sebastien Ponce
Browse files

Dropped UTCommonBase and UTHistoAlgBase

parent 889e0f16
No related branches found
No related tags found
2 merge requests!3702merge counter decoder into Louis' original branch,!3369Removal of UT common base classes
Pipeline #3433413 passed
......@@ -18,6 +18,9 @@
#include "UTDet/DeUTLayer.h"
#include "UTDet/DeUTSector.h"
#include "UTDet/DeUTStation.h"
#include "fmt/format.h"
#include <cassert>
#include <memory>
#include <string>
......@@ -252,6 +255,18 @@ public:
/** get list of disabled beetles */
[[nodiscard]] std::vector<LHCb::UTChannelID> disabledBeetles() const;
/** beetle as a string */
std::string uniqueBeetle( const LHCb::UTChannelID& chan ) const {
auto const sector = findSector( chan );
return fmt::format( "{}Beetle{}", sector->nickname(), sector->beetle( chan ) );
};
/** port */
std::string uniquePort( const LHCb::UTChannelID& chan ) const {
const unsigned int port = ( ( chan.strip() - 1u ) / LHCbConstants::nStripsInPort ) + 1u;
return fmt::format( "{}Port{}", uniqueBeetle( chan ), port );
};
private:
/** set the first Station number */
void setFirstStation( unsigned int iStation );
......
......@@ -59,8 +59,13 @@ namespace LHCb {
return UniqueLayerToString( chan ) + detRegionToString( chan.detRegion() );
}
/// unique layer string from layer and station
static std::string UniqueLayerToString( unsigned int layer, unsigned int station );
/// unique layer string from id
static std::string UniqueLayerToString( const LHCb::UTChannelID& chan );
static std::string UniqueLayerToString( const LHCb::UTChannelID& chan ) {
return UniqueLayerToString( chan.layer(), chan.station() );
}
/// unique sector string from id
static std::string UniqueSectorToString( const LHCb::UTChannelID& chan );
......
......@@ -66,25 +66,24 @@ std::vector<std::string> LHCb::UTNames::allLayers() {
return {stationVec[0] + "X", stationVec[0] + "U", stationVec[1] + "V", stationVec[1] + "X"};
}
std::string LHCb::UTNames::UniqueLayerToString( const LHCb::UTChannelID& chan ) {
std::string layer = "UnknownLayer";
if ( chan.station() == 1 ) {
if ( chan.layer() == 1 ) {
layer = "X";
} else if ( chan.layer() == 2 ) {
layer = "U";
std::string LHCb::UTNames::UniqueLayerToString( unsigned int layer, unsigned int station ) {
std::string res = "UnknownLayer";
if ( station == 1 ) {
if ( layer == 1 ) {
res = "X";
} else if ( layer == 2 ) {
res = "U";
}
} else if ( chan.station() == 2 ) {
if ( chan.layer() == 1 ) {
layer = "V";
} else if ( chan.layer() == 2 ) {
layer = "X";
} else if ( station == 2 ) {
if ( layer == 1 ) {
res = "V";
} else if ( layer == 2 ) {
res = "X";
}
} else {
// nothing
}
return StationToString( chan ) + layer;
return StationToString( station ) + res;
}
std::string LHCb::UTNames::channelToString( const LHCb::UTChannelID& chan ) {
......
/*****************************************************************************\
* (c) Copyright 2000-2020 CERN for the benefit of the LHCb Collaboration *
* *
* This software is distributed under the terms of the GNU General Public *
* Licence version 3 (GPL Version 3), copied verbatim in the file "COPYING". *
* *
* In applying this licence, CERN does not waive the privileges and immunities *
* granted to it by virtue of its status as an Intergovernmental Organization *
* or submit itself to any jurisdiction. *
\*****************************************************************************/
#pragma once
#include "Event/ProcStatus.h"
#include "GaudiAlg/GaudiHistoAlg.h"
#include "GaudiAlg/GaudiHistoTool.h"
#include "GaudiAlg/GaudiTool.h"
#include "GaudiAlg/GaudiTupleAlg.h"
#include "GaudiAlg/GaudiTupleTool.h"
#include "GaudiKernel/ISvcLocator.h"
#include "GaudiKernel/StatusCode.h"
#include "Kernel/IUTReadoutTool.h"
#include "Kernel/LHCbConstants.h"
#include "Kernel/UTChannelID.h"
#include "Kernel/UTLexicalCaster.h"
#include "Kernel/UTNames.h"
#include "UTDet/DeUTDetector.h"
#include "UTDet/DeUTSector.h"
#include <map>
#include <string>
#include <vector>
namespace UT {
/**
* Base class providing common functionality for all UT tools and algorithms
*
* @author Andy Beiter (based on code by Matthew Needham)
* @date 2018-09-04
*/
template <class PBASE>
class CommonBase : public PBASE {
public:
using PBASE::PBASE;
const DeUTDetector* tracker() const { return nullptr; }
/** get the readout tool */
const IUTReadoutTool* readoutTool() const { return m_readoutTool.get(); }
/** station as a string */
std::string station( const LHCb::UTChannelID& chan ) const { return LHCb::UTNames::StationToString( chan ); }
/** region as string */
std::string uniqueDetRegion( const LHCb::UTChannelID& chan ) const {
return LHCb::UTNames::UniqueRegionToString( chan );
}
/** layer as a string */
std::string uniqueLayer( const LHCb::UTChannelID& chan ) const {
return LHCb::UTNames::UniqueLayerToString( chan );
}
/** sector as a string */
std::string uniqueSector( const LHCb::UTChannelID& chan ) const {
return LHCb::UTNames::UniqueSectorToString( chan );
};
/** beetle as a string */
std::string uniqueBeetle( const LHCb::UTChannelID& chan ) const {
auto const theSector = findSector( chan );
return theSector->nickname() + "Beetle" + toString( theSector->beetle( chan ) );
};
/** port */
std::string uniquePort( const LHCb::UTChannelID& chan ) const {
const unsigned int port = ( ( chan.strip() - 1u ) / LHCbConstants::nStripsInPort ) + 1u;
return uniqueBeetle( chan ) + "Port" + toString( port );
};
/** detector type as a string */
std::string detectorType( const LHCb::UTChannelID& chan ) const {
// const DeUTSector* sector = tracker()->findSector( chan );
return /*sector ? sector->type() :*/ "Unknown";
};
/** safe finding of the sector - exception thrown if not valid */
DeUTSector* findSector( const LHCb::UTChannelID& aChannel ) const {
// auto const sector = tracker()->findSector( aChannel );
// if ( !sector )
throw GaudiException( "No sector found", this->name(), StatusCode::FAILURE );
// return sector;
}
/** return a procstatus in case event is aborted */
StatusCode procFailure( const std::string& reason, const bool aborted = false ) const {
LHCb::ProcStatus* procStat =
this->template getOrCreate<LHCb::ProcStatus, LHCb::ProcStatus>( LHCb::ProcStatusLocation::Default );
procStat->addAlgorithmStatus( this->name(), "UT", reason, -3, aborted );
return this->Warning( "Processing failed: " + reason, StatusCode::SUCCESS, 1 );
}
private:
ToolHandle<IUTReadoutTool> m_readoutTool{this, "ReadoutTool", "UTReadoutTool"};
};
} // namespace UT
/*****************************************************************************\
* (c) Copyright 2000-2018 CERN for the benefit of the LHCb Collaboration *
* *
* This software is distributed under the terms of the GNU General Public *
* Licence version 3 (GPL Version 3), copied verbatim in the file "COPYING". *
* *
* In applying this licence, CERN does not waive the privileges and immunities *
* granted to it by virtue of its status as an Intergovernmental Organization *
* or submit itself to any jurisdiction. *
\*****************************************************************************/
//-----------------------------------------------------------------------------
/** @file UTHistoBase.h
*
* Header file for algorithm base class : UT::AlgBase
*
* @author Andy Beiter (based on code by Matthew Needham)
* @date 2018-09-04
*/
//-----------------------------------------------------------------------------
#include "GaudiAlg/GaudiHistoAlg.h"
#include "Kernel/UTCommonBase.h"
namespace UT {
//-----------------------------------------------------------------------------
/** @class AlgBase UTHistoBase.h UTKernel/UTHistoBase.h
*
* Abstract base class for UT algorithms providing
* some basic functionality.
*
* @author Andy Beiter (based on code by Matthew Needham)
* @date 2018-09-04
*/
//-----------------------------------------------------------------------------
using HistoAlgBase = CommonBase<GaudiHistoAlg>;
} // namespace UT
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