|
ATLAS Offline Software
|
Go to the documentation of this file.
48 #include "GaudiKernel/ISvcLocator.h"
51 #include <CLHEP/Random/Randomize.h>
58 using CLHEP::RandGaussQ;
106 return StatusCode::FAILURE;
110 ATH_MSG_INFO(
"TileTTL1 from MBTS will not be produced" );
117 ATH_MSG_INFO(
"Bad Channel trigger status will be applied" );
119 ATH_MSG_INFO(
"Bad Channel trigger status will be ignored" );
138 std::vector<double> ttl1Shape(
m_nSamples, 0.);
141 for (
int jsamp = 0; jsamp <
m_nSamples; ++jsamp) {
162 <<
", tileNoise=" << ((
m_tileNoise) ?
"true" :
"false")
169 ATH_MSG_INFO(
"TileHitToTTL1 initialization completed" );
171 return StatusCode::SUCCESS;
195 badChannels = *badChannelsHandle;
209 ATH_CHECK( ttl1Container.
record(std::make_unique<TileTTL1Container>()) );
212 std::unique_ptr<TileTTL1Container> mbtsTTL1Container;
214 mbtsTTL1Container = std::make_unique<TileTTL1Container>();
225 std::vector<double> ttAmp[16];
226 std::vector<double> MBTSAmp;
236 double ttAmpTotIg = 0.;
237 int minieta, maxieta, posneg;
239 for (
int ieta = 0; ieta < 16; ++ieta)
248 std::vector<float> ttL1samples;
249 std::vector<float> MBTSsamples;
254 std::vector<double> ttl1Shape(
m_nSamples, 0.);
301 posneg = minieta = maxieta = 0;
306 for (
int ieta = 0; ieta < 16; ++ieta) {
308 ttAmp[ieta][js] = 0.0;
314 memset(ttHit, 0,
sizeof(ttHit));
315 nTT = nIgnore = nHit = 0;
320 for (
const TileHit* tile_hit : *hitCollection) {
331 hit_calib =
std::round(hit_calib * 1000) / 1000;
346 if (
status.isNoGainL1()) {
352 if (
status.isHalfGainL1()) {
362 if (mbtsTTL1Container) {
367 hitSamples[js] = 0.0;
369 int n_hits = tile_hit->size();
370 for (
int ihit = 0; ihit < n_hits; ++ihit) {
373 double t_hit = -(tile_hit->time(ihit));
376 double e_hit = tile_hit->energy(ihit);
378 hitSamples[js] += e_hit * ttl1MBTSShape[js];
384 MBTSAmp[js] += qfactor * hitSamples[js];
389 MBTSAmp[js] = qfactor * hitSamples[js];
408 <<
", chan is good=" << is_good <<
endmsg;
426 hitSamples[js] = 0.0;
427 int n_hits = tile_hit->size();
428 for (
int ihit = 0; ihit < n_hits; ++ihit) {
431 double t_hit = -(tile_hit->time(ihit));
434 double e_hit = tile_hit->energy(ihit);
436 hitSamples[js] += e_hit * ttl1Shape[js];
443 ttAmp[ieta][js] += qfactor * hitSamples[js];
450 ttAmp[ieta][js] = qfactor * hitSamples[js];
452 if (ieta >= minieta && ieta <= maxieta)
456 if (ieta < minieta || ieta > maxieta || !is_good)
460 if (ieta >= minieta && ieta <= maxieta && is_good) {
461 ttAmpTot += hitSamples[
m_iTrig] * hit_calib;
463 ttAmpTotIg += hitSamples[
m_iTrig] * hit_calib;
480 <<
", tower=" << tower
483 <<
", e0=" << hitSamples[
m_iTrig] * hit_calib
486 <<
", chan is good= " << is_good;
488 if (ieta >= minieta && ieta <= maxieta)
498 nIgnoreTot += nIgnore;
503 <<
"; posneg=" << posneg
504 <<
", minieta=" << minieta
505 <<
", maxieta=" << maxieta
508 <<
", nIgnore=" << nIgnore );
519 if (mbtsTTL1Container) {
533 MBTSAmp[jsamp] *= ttL1Calib;
534 MBTSsamples[jsamp] = MBTSAmp[jsamp] + ttL1Ped;
536 MBTSsamples[jsamp] += ttL1NoiseSigma * Rndm[jsamp];
540 if (MBTSsamples[jsamp] > ttL1Max)
541 MBTSsamples[jsamp] = ttL1Max;
546 if (MBTSsamples[
m_MBTSiTrig] - ttL1Ped < ttL1Thresh)
550 std::unique_ptr<TileTTL1> mbtsTTL1 = std::make_unique<TileTTL1>(MBTS_id, MBTSsamples);
551 mbtsTTL1Container->
push_back(mbtsTTL1.release());
559 for (
int ieta = minieta; ieta <= maxieta; ++ieta) {
575 double peakAmp = 0.0;
577 for (
int jsamp = 0; jsamp <
m_nSamples; ++jsamp) {
578 ttAmp[ieta][jsamp] *= ttL1Calib;
579 ttAmp[ieta][jsamp] += ttL1Ped;
580 if (ttAmp[ieta][jsamp] > peakAmp) {
581 peakAmp = ttAmp[ieta][jsamp];
587 peakAmp += ttL1NoiseSigma * RandGaussQ::shoot(rngWrapper->
getEngine(ctx));
588 ttL1samples[0] = peakAmp;
590 if (ttL1samples[0] - ttL1Ped < ttL1Thresh)
598 <<
", hitTrue=" << ttHit[ieta]
600 <<
", peak Amp=" << ttAmp[ieta][peakSamp]
601 <<
", with noise=" << ttL1samples[0] <<
endmsg;
614 for (
int jsamp = 0; jsamp <
m_nSamples; ++jsamp) {
615 ttAmp[ieta][jsamp] *= ttL1Calib;
616 ttL1samples[jsamp] = ttAmp[ieta][jsamp] + ttL1Ped;
618 ttL1samples[jsamp] += ttL1NoiseSigma * Rndm[jsamp];
622 if (ttL1samples[jsamp] > ttL1Max)
623 ttL1samples[jsamp] = ttL1Max;
628 if (ttL1samples[
m_iTrig] - ttL1Ped < ttL1Thresh)
636 <<
", hitTrue=" << ttHit[ieta]
638 <<
", amp0=" << ttAmp[ieta][
m_iTrig]
646 std::unique_ptr<TileTTL1> ttl1 = std::make_unique<TileTTL1>(ttId[ieta], ttL1samples);
647 ttl1Container->
push_back(ttl1.release());
659 if (mbtsTTL1Container) {
670 <<
" nHitTot=" << nHitTot
671 <<
" nIgnoreTot=" << nIgnoreTot
672 <<
" ttAmpTot=" << ttAmpTot
673 <<
" ttAmpTotIg=" << ttAmpTotIg
674 <<
" =>eneTot=" << ttAmpTot + ttAmpTotIg <<
endmsg;
677 return StatusCode::SUCCESS;
684 return StatusCode::SUCCESS;
def retrieve(aClass, aKey=None)
float getSamplingFraction(unsigned int drawerIdx, unsigned int channel) const
Return Tile Calorimeter sampling fraction.
void setSeed(const std::string &algName, const EventContext &ctx)
Set the random seed using a string (e.g.
double TTL1CosmicsPed(const Identifier &) const
Returns the pedestal of the Cosmics Trigger signal.
const TileTBID * m_tileTBID
Pointer to TileID helper.
Scalar phi() const
phi method
const TileID * m_tileID
Pointer to TileID helper.
bool is_tiletb(const Identifier &id) const
Test ID if it is TileTBID.
ServiceHandle< TileCablingSvc > m_cablingSvc
Name of Tile cabling service.
double TTL1CosmicsCalib(const Identifier &) const
Returns the factor which converts e_dep (HitAmp) to mV in Cosmics board.
int NdigitSamples() const
Returns the number of sammples (digits) per event.
Scalar eta() const
pseudorapidity method
int pmt(const Identifier &id) const
SG::WriteHandleKey< TileTTL1Container > m_ttl1ContainerKey
const TileInfo * m_tileInfo
Pointer to TileInfo.
bool m_tileThresh
If true => apply threshold on the conversion to TileTTL1.
float round(const float toRound, const unsigned int decimals)
Class holding bad channel problems.
int side(const Identifier &id) const
int sample(const Identifier &id) const
bool msgLvl(const MSG::Level lvl) const
SG::ReadCondHandleKey< TileSamplingFraction > m_samplingFractionKey
Name of TileSamplingFraction in condition store.
const TileCablingService * m_cabling
Pointer to the TileCablingService instance.
int tower(const Identifier &id) const
bool m_tileNoise
If true => generate noise for the TileTTL1 creation.
#define ATH_MSG_VERBOSE(x)
int type(const Identifier &id) const
extract type field from TileTB identifier
bool is_valid() const
Check if id is in a valid state.
const std::vector< double > & ttl1Shape() const
Return bunch-X TTL1 shape vector.
int module(const Identifier &id) const
extract module field from TileTB identifier
int channel(const HWIdentifier &id) const
extract channel field from HW identifier
int m_nSamples
number of time slices for each channel
SG::WriteHandleKey< TileTTL1Container > m_mbtsTTL1ContainerKey
const ServiceHandle< StoreGateSvc > & detStore() const
The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
double MBTSL1Ped(const Identifier &) const
Returns the pedestal (in mV) for TTL1 adcs for MBTS.
int ros(const HWIdentifier &id) const
extract ros field from HW identifier
double TTL1CosmicsThresh(const Identifier &) const
Returns the threshold of the Cosmics Trigger Board.
double TTL1Max(const Identifier &) const
Returns max possible value (in mV) for TTL1 adcs.
class for ordering any TileData Objects according to logical (offline) identifier To be used with sor...
int phi(const Identifier id) const
return phi according to :
virtual StatusCode initialize() override
initialize method
float calibrateChannel(unsigned int drawerIdx, unsigned int channel, unsigned int adc, float amplitude, TileRawChannelUnit::UNIT rawDataUnitIn, TileRawChannelUnit::UNIT rawDataUnitOut) const
Calibrate a Tile channel.
Gaudi::Property< bool > m_maskBadChannels
Handle class for recording to StoreGate.
bool m_cosmicsType
if true => use dediated cosmcis TTL1
int ItrigSample() const
The sample at which the pulse should ideally peak.
Gaudi::Property< std::string > m_randomStreamName
Random Stream Name.
double TTL1NoiseSigma(const Identifier &) const
Returns the sigma (in mV) of Noise in TTL1 adcs.
double MBTSL1Max(const Identifier &) const
Returns max possible value (in mV) for TTL1 adcs for MBTS.
::StatusCode StatusCode
StatusCode definition for legacy code.
Identifier drawer2MBTS_id(const HWIdentifier &id) const
Gaudi::Property< std::string > m_infoName
double TTL1Ped(const Identifier &) const
Returns the pedestal (in mV) for TTL1 adcs.
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
int m_MBTSiTrig
index of the triggering time slice for MBTS TTL1
int channel(const Identifier &id) const
extract channel field from TileTB identifier
virtual bool isValid() override final
Can the handle be successfully dereferenced?
SG::ReadHandleKey< TileHitContainer > m_hitContainerKey
ServiceHandle< IAthRNGSvc > m_rndmSvc
Random number generator engine to use.
double MBTSL1Calib(const Identifier &) const
Returns the factor which converts amplitude in pCb to mV in TTL1 for MBTS.
HWIdentifier drawer_id(int frag) const
ROS HWIdentifer.
A wrapper class for event-slot-local random engines.
Condition object to keep Tile channel and ADC status.
Helpers for checking error return status codes and reporting errors.
int eta(const Identifier id) const
return eta according to :
value_type push_back(value_type pElem)
Add an element to the end of the collection.
StatusCode initialize(bool used=true)
CLHEP::HepRandomEngine * getEngine(const EventContext &ctx) const
Retrieve the random engine corresponding to the provided EventContext.
bool TileNoise() const
Noise switched on/off?
const TileBchStatus & getAdcStatus(const HWIdentifier adc_id) const
Return Tile ADC status.
double MBTSL1NoiseSigma(const Identifier &) const
Returns the sigma (in mV) of Noise in TTL1 adcs for MBTS.
HWIdentifier adc_id(int ros, int drawer, int channel, int adc) const
adc HWIdentifer
void sort()
Sort the container.
Gaudi::Property< std::string > m_TileTTL1Type
int m_iTrig
index of the triggering time slice
bool TileZeroSuppress() const
Zero suppression switched on/off?
int drawer(const HWIdentifier &id) const
extract drawer field from HW identifier
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
bool connected(int ros, int drawer) const
const CaloLVL1_ID * m_TT_ID
Pointer to TT Identifier.
SG::ReadCondHandleKey< TileEMScale > m_emScaleKey
Name of TileEMScale in condition store.
const TileHWID * m_tileHWID
Pointer to TileHWID helper.
virtual StatusCode execute(const EventContext &ctx) const override
execute method
static unsigned int getDrawerIdx(unsigned int ros, unsigned int drawer)
Returns a drawer hash.
double TTL1CosmicsNoiseSigma(const Identifier &) const
Returns the sigma (in mV) of Noise in TTL1 Cosmics.
Handle class for reading from StoreGate.
virtual StatusCode finalize() override
finalize method
Identifier tower_id(int pos_neg_z, int sampling, int region, int eta, int phi) const
build a tower identifier
size_type size() const noexcept
Returns the number of elements in the collection.
double TTL1Thresh(const Identifier &) const
Returns the threshold (in mV) for TTL1 adcs.
SG::ReadCondHandleKey< TileBadChannels > m_badChannelsKey
Name of TileBadChannels in condition store.
double MBTSL1Thresh(const Identifier &) const
Returns the threshold (in mV) for TTL1 adcs for MBTS.
int m_MBTSnSamples
number of time slices for each chan for MBTS TTL1
int m_lastTower
total number of towers in TileCal
double TTL1Calib(const Identifier &) const
Returns the factor which converts amplitude in pCb to mV in TTL1.