5#ifndef TILERECUTILS_TILECELLBUILDER_H
6#define TILERECUTILS_TILECELLBUILDER_H
50#include "GaudiKernel/ToolHandle.h"
51#include "GaudiKernel/ServiceHandle.h"
53#include "CLHEP/Units/SystemOfUnits.h"
109 :
public extends<AthAlgTool, ICaloCellMakerTool>
112 TileCellBuilder(
const std::string&
type,
const std::string& name,
const IInterface* parent);
118 virtual StatusCode
finalize()
override;
122 const EventContext& ctx)
const override;
124 void reset(
bool fullSizeCont,
bool printReset =
true);
139 "Input Tile raw channel container key"};
143 "Input Tile DSP raw channel container key"};
157 "Output Tile MBTS container key"};
161 "Output Tile E4 prime container key"};
165 "Dummy decoration key to aid scheduling"};
172 "Keep time for channels with energy above cut"};
175 "Similar cut for MBTS in pC"};
179 Gaudi::Property<float>
m_zeroEnergy{
this,
"BadChannelZeroEnergy", 0.5 * CLHEP::MeV,
180 "Energy to store in every PMT if both PMT are bad"};
183 "Cut on channel quality (set energy to m_zeroEnergy for them)"};
185 "Should time be corrected (deltat added from CondDB)"};
187 "If true, amplitude is corrected by parabolic function (needed for OF without iterations)"};
188 Gaudi::Property<bool>
m_of2{
this,
"OF2",
true,
189 "If true, assume OF2 method for amplitude correction, otherwise - OF1"};
191 "If true, missing raw channels are taken from DSP container"};
195 "Correct amplitude if it's above amplitude threshold (in ADC counts)"};
197 "Correct amplitude if time is above time min threshold"};
199 "Correct amplitude if time is below time max threshold"};
202 Gaudi::Property<float>
m_minEneChan{
this,
"MinEnergyChan", -5000. * CLHEP::MeV,
203 "Normal channel energy threshold for masking"};
204 Gaudi::Property<float>
m_minEneGap{
this,
"MinEnergyGap", -10000. * CLHEP::MeV,
205 "Gap channel energy threshold for masking"};
206 Gaudi::Property<float>
m_minEneMBTS{
this,
"MinEnergyMBTS", -999999. * CLHEP::MeV,
207 "MBTS channel energy threshold for masking (not used currently)"};
209 "Cell energy threshold (in MeV) to consider the cell"};
211 "Maximum time difference between the PMTs in the cell"};
212 Gaudi::Property<float>
m_maxTime{
this,
"MaxTime", 100000.,
"Maximum time for the PMTs in the cells"};
213 Gaudi::Property<float>
m_minTime{
this,
"MinTime", -100000.,
"Minimum time for the PMTs in the cells"};
214 Gaudi::Property<float>
m_maxChi2{
this,
"MaxChi2", 100000.,
"Maximum chi2 for the PMTs in the cells"};
215 Gaudi::Property<float>
m_minChi2{
this,
"MinChi2", -100000.,
"Minimum chi2 for the PMTs in the cells"};
217 Gaudi::Property<bool>
m_fullSizeCont{
this,
"fullSizeCont",
true,
"Use full size cell container"};
219 "Put zero energy in bad channels and recover from single-channel failure using second PMT in a cell"};
221 "Create fake E3/E4 crack scintillators with zero energy when they do not exist"};
223 "For two-gain calib runs skip one of two gains (never skip any gain by default)"};
225 "Use demonstrator cabling (if set to 2015 - assume TB 2015 cabling)"};
226 Gaudi::Property<bool>
m_checkDCS{
this,
"CheckDCS",
false,
"Check DCS state"};
237 "TileBadChannels",
"TileBadChannels",
"Input Tile bad channel status"};
243 "TileEMScale",
"TileEMScale",
"Input Tile EMS calibration constants"};
246 "TileCondToolTiming",
"TileCondToolTiming",
"Tile timing tool"};
249 "NoiseFilterTools", {},
"Tile noise filter tools"};
255 "TileDCS",
"TileDCS",
"Input Tile DCS status"};
261 "TileCablingSvc",
"TileCablingSvc",
"The Tile cabling service"};
299 template<
class ITERATOR,
class COLLECTION>
300 void build (
const EventContext& ctx,
303 const ITERATOR & begin,
304 const ITERATOR & end,
319 void correctCell(
TileCell* pCell,
int correction,
int pmt,
int gain,
float ener,
float time,
320 unsigned char iqual,
unsigned char qbit,
int ch_type)
const;
323 return std::min(255, abs((
int) qual));
331 bool count_over,
bool good_time,
bool good_ener,
332 bool overflow,
bool underflow,
333 bool good_overflowfit)
const;
335 template<
typename T,
typename V>
363 m_itr = m_first->begin();
366 m_itr = m_second->begin();
368 m_params = m_params2;
371 m_itr = m_second->end();
380 if (
m_pos != i.m_pos ||
m_itr != i.m_itr)
return true;
422 Gaudi::Property<std::string>
m_infoName{
this,
"TileInfoName",
"TileInfo",
"Name of TileInfo object"};
object to store information about affected regions in calorimeter
Property holding a SG store/key/clid from which a ReadHandle is made.
Property holding a SG store/key/clid from which a WriteHandle is made.
TileContainer< TileCell > TileCellContainer
Information produced by TileDQstatusAlg (used to be done by TileBeamInfoProvider).
Container class for CaloCell.
Property holding a SG store/key/clid from which a ReadHandle is made.
Property holding a SG store/key/clid/attr name from which a WriteDecorHandle is made.
Property holding a SG store/key/clid from which a WriteHandle is made.
Condition object to keep Tile channel and ADC status.
DoubleVectorIterator & operator=(const DoubleVectorIterator &other)=default
DoubleVectorIterator(const DoubleVectorIterator &i)=default
DoubleVectorIterator(VecParams ¶ms, T *f, const VecParams ¶ms1, T *s, const VecParams ¶ms2, int p)
const VecParams & m_params1
bool operator!=(const DoubleVectorIterator &i)
DoubleVectorIterator & operator++()
const VecParams & m_params2
ToolHandle< TileCondToolTiming > m_tileToolTiming
const TileDetDescrManager * m_tileMgr
Pointer to TileDetDescrManager.
SG::ReadHandleKey< TileRawChannelContainer > m_dspRawChannelContainerKey
Gaudi::Property< bool > m_fakeCrackCells
virtual ~TileCellBuilder()
Destructor.
Gaudi::Property< float > m_eneForTimeCut
Gaudi::Property< float > m_ampMinThresh
TileDrawerEvtStatus TileDrawerEvtStatusArray[5][64]
status of every drawer
SG::ReadHandleKey< TileDQstatus > m_DQstatusKey
const TileTBID * m_tileTBID
Pointer to TileTBID.
Gaudi::Property< bool > m_correctTime
ServiceHandle< TileCablingSvc > m_cablingSvc
Name of Tile cabling service.
Gaudi::Property< bool > m_maskBadChannels
Gaudi::Property< int > m_qualityCut
Gaudi::Property< bool > m_correctAmplitude
TileCellBuilder(const std::string &type, const std::string &name, const IInterface *parent)
Contructor.
Gaudi::Property< bool > m_mergeChannels
SG::WriteDecorHandleKey< xAOD::EventInfo > m_EventInfoTileStatusKey
bool maskBadChannel(TileDrawerEvtStatusArray &drawerEvtStatus, const TileDQstatus *DQstatus, const TileDCSState *dcsState, const TileBadChannels *badChannels, TileCell *pCell, HWIdentifier hwid) const
method to check if channels are good or bad.
SG::ReadHandleKey< TileRawChannelContainer > m_rawChannelContainerKey
Gaudi::Property< float > m_zeroEnergy
Gaudi::Property< float > m_minChi2
friend class TileHid2RESrcID
Gaudi::Property< bool > m_of2
const MbtsDetDescrManager * m_mbtsMgr
Pointer to MbtsDetDescrManager.
const TileInfo * m_tileInfo
Gaudi::Property< float > m_maxTime
bool maskBadChannels(TileDrawerEvtStatusArray &drawerEvtStatus, const TileDQstatus *DQstatus, const TileDCSState *dcsState, const TileBadChannels *badChannels, TileCell *pCell) const
Gaudi::Property< float > m_eneForTimeCutMBTS
Gaudi::Property< float > m_timeMaxThresh
unsigned char iquality(float qual) const
bool m_thresholdNotSet
bool variable to check whether some threshold have been set
SG::ReadCondHandleKey< TileDCSState > m_DCSStateKey
Name of TileDCSState object in condition store.
float m_ADCmaskValuePlusEps
Gaudi::Property< float > m_minTime
const TileCablingService * m_cabling
TileCabling instance.
Gaudi::Property< float > m_maxChi2
unsigned char qbits(TileDrawerEvtStatusArray &drawerEvtStatus, TileFragHash::TYPE RChType, int ros, int drawer, bool count_over, bool good_time, bool good_ener, bool overflow, bool underflow, bool good_overflowfit) const
method to compute the cell quality bits
const TileHWID * m_tileHWID
Pointer to TileHWID.
SG::ReadCondHandleKey< TileEMScale > m_emScaleKey
Name of TileEMScale in condition store.
std::vector< CaloAffectedRegionInfo > m_affectedRegionInfo_current_run
Gaudi::Property< float > m_eThreshold
SG::WriteHandleKey< TileCellContainer > m_E4prContainerKey
Gaudi::Property< float > m_minEneChan
Gaudi::Property< float > m_timeMinThresh
SG::WriteHandleKey< TileCellContainer > m_MBTSContainerKey
Gaudi::Property< float > m_maxTimeDiff
void correctCell(TileCell *pCell, int correction, int pmt, int gain, float ener, float time, unsigned char iqual, unsigned char qbit, int ch_type) const
Compute calibrated energy, time, etc.
SG::ReadHandleKey< xAOD::EventInfo > m_eventInfoKey
Gaudi::Property< bool > m_checkDCS
static const InterfaceID & interfaceID()
SG::ReadCondHandleKey< TileBadChannels > m_badChannelsKey
Name of TileBadChannels in condition store.
Gaudi::Property< float > m_minEneGap
ToolHandleArray< ITileRawChannelTool > m_noiseFilterTools
void build(const EventContext &ctx, TileDrawerEvtStatusArray &drawerEvtStatus, VecParams ¶ms, const ITERATOR &begin, const ITERATOR &end, COLLECTION *coll, TileCellContainer *MBTSCells, TileCellContainer *E4prCells) const
< method to process raw channels from a given vector and store them in collection
std::vector< CaloAffectedRegionInfo > m_affectedRegionInfo_global
std::string m_dspRawChannelContainer
virtual StatusCode finalize() override
Gaudi::Property< bool > m_fullSizeCont
Gaudi::Property< int > m_useDemoCabling
Gaudi::Property< float > m_minEneMBTS
Gaudi::Property< int > m_skipGain
Gaudi::Property< std::string > m_infoName
float m_ADCmaskValueMinusEps
const TileID * m_tileID
Pointer to TileID.
virtual StatusCode initialize() override
Initializer.
Condition object to keep Tile DCS status from DB.
Class that holds Data Quality fragment information and provides functions to extract the data quality...
This class keep detailed status info about one drawer in a given event.
This class keep detailed status info about one drawer in whole run.
Helper class for TileCal online (hardware) identifiers.
Helper class for TileCal offline identifiers.
Helper class for TileCal offline identifiers of ancillary testbeam detectors and MBTS.
const std::string process
TileFragHash::TYPE m_RChType
TileRawChannelUnit::UNIT m_RChUnit