Skip to content

Commit

Permalink
Merge pull request #13922 from mbandrews/Timing+TTF80X
Browse files Browse the repository at this point in the history
Add TimingTask sequence. Add TTF plots.
  • Loading branch information
cmsbuild committed Apr 14, 2016
2 parents 60f96ea + de7fe9f commit f30cae3
Show file tree
Hide file tree
Showing 7 changed files with 125 additions and 26 deletions.
17 changes: 9 additions & 8 deletions DQM/EcalMonitorClient/python/TimingClient_cfi.py
Expand Up @@ -11,6 +11,7 @@
toleranceMeanFwd = 6.
toleranceRMSFwd = 12.
tailPopulThreshold = 0.4
timeWindow = 25.

ecalTimingClient = cms.untracked.PSet(
params = cms.untracked.PSet(
Expand Down Expand Up @@ -68,16 +69,16 @@
FwdvBkwd = cms.untracked.PSet(
kind = cms.untracked.string('TH2F'),
yaxis = cms.untracked.PSet(
high = cms.untracked.double(25.0),
high = cms.untracked.double(timeWindow),
nbins = cms.untracked.int32(50),
low = cms.untracked.double(-25.0),
low = cms.untracked.double(-timeWindow),
title = cms.untracked.string('time (ns)')
),
otype = cms.untracked.string('Ecal2P'),
xaxis = cms.untracked.PSet(
high = cms.untracked.double(25.0),
high = cms.untracked.double(timeWindow),
nbins = cms.untracked.int32(50),
low = cms.untracked.double(-25.0)
low = cms.untracked.double(-timeWindow)
),
btype = cms.untracked.string('User'),
path = cms.untracked.string('%(subdet)s/%(prefix)sTimingTask/%(prefix)sTMT timing %(prefix)s+ vs %(prefix)s-'),
Expand All @@ -100,9 +101,9 @@
),
otype = cms.untracked.string('SM'),
xaxis = cms.untracked.PSet(
high = cms.untracked.double(25.0),
high = cms.untracked.double(timeWindow),
nbins = cms.untracked.int32(100),
low = cms.untracked.double(-25.0)
low = cms.untracked.double(-timeWindow)
),
btype = cms.untracked.string('User'),
path = cms.untracked.string('%(subdet)s/%(prefix)sTimingClient/%(prefix)sTMT timing mean %(sm)s'),
Expand Down Expand Up @@ -137,9 +138,9 @@
kind = cms.untracked.string('TH1F'),
otype = cms.untracked.string('Ecal3P'),
xaxis = cms.untracked.PSet(
high = cms.untracked.double(25.0),
high = cms.untracked.double(timeWindow),
nbins = cms.untracked.int32(100),
low = cms.untracked.double(-25.0),
low = cms.untracked.double(-timeWindow),
title = cms.untracked.string('time (ns)')
),
btype = cms.untracked.string('User'),
Expand Down
11 changes: 10 additions & 1 deletion DQM/EcalMonitorClient/python/TrigPrimClient_cfi.py
Expand Up @@ -13,7 +13,9 @@
),
sources = cms.untracked.PSet(
EtEmulError = ecalTrigPrimTask.MEs.EtEmulError,
MatchedIndex = ecalTrigPrimTask.MEs.MatchedIndex
MatchedIndex = ecalTrigPrimTask.MEs.MatchedIndex,
TTFlags4 = ecalTrigPrimTask.MEs.TTFlags4,
TTMaskMapAll = ecalTrigPrimTask.MEs.TTMaskMapAll
),
MEs = cms.untracked.PSet(
NonSingleSummary = cms.untracked.PSet(
Expand Down Expand Up @@ -42,6 +44,13 @@
otype = cms.untracked.string('Ecal3P'),
btype = cms.untracked.string('TriggerTower'),
description = cms.untracked.string('Emulator TP timing where the largest number of events had Et matches. Towers with entries less than ' + str(minEntries) + ' are not considered.')
),
TTF4vMask = cms.untracked.PSet(
path = cms.untracked.string('%(subdet)s/%(prefix)sTriggerTowerTask/%(prefix)sTTT TTF4 vs Masking Status%(suffix)s'),
kind = cms.untracked.string('TH2F'),
otype = cms.untracked.string('Ecal3P'),
btype = cms.untracked.string('TriggerTower'),
description = cms.untracked.string('Summarizes whether a TT was masked in the TPGRecords, or had an instance of TT Flag=4.<br/>GRAY: Masked, no TTF4,<br/>BLACK: Masked, with TTF4,<br/>BLUE: Not Masked, with TTF4.')
)
)
)
26 changes: 25 additions & 1 deletion DQM/EcalMonitorClient/src/TrigPrimClient.cc
Expand Up @@ -72,7 +72,31 @@ namespace ecaldqm
else
meEmulQualitySummary.setBinContent(ttid, doMask ? kMGood : kGood);
}
}

// Fill TTF4 v Masking ME
// NOT an occupancy plot: only tells you if non-zero TTF4 occupancy was seen
// without giving info about how many were seen
MESet& meTTF4vMask(MEs_.at("TTF4vMask"));
MESet const& sTTFlags4(sources_.at("TTFlags4"));
MESet const& sTTMaskMapAll(sources_.at("TTMaskMapAll"));

// Loop over all TTs
for(unsigned iTT(0); iTT < EcalTrigTowerDetId::kSizeForDenseIndexing; iTT++) {
EcalTrigTowerDetId ttid(EcalTrigTowerDetId::detIdFromDenseIndex(iTT));
bool isMasked( sTTMaskMapAll.getBinContent(ttid) > 0. );
bool hasTTF4( sTTFlags4.getBinContent(ttid) > 0. );
if ( isMasked ) {
if ( hasTTF4 )
meTTF4vMask.setBinContent( ttid,12 ); // Masked, has TTF4
else
meTTF4vMask.setBinContent( ttid,11 ); // Masked, no TTF4
} else {
if ( hasTTF4 )
meTTF4vMask.setBinContent( ttid,13 ); // not Masked, has TTF4
}
} // TT loop

} // TrigPrimClient::producePlots()

DEFINE_ECALDQM_WORKER(TrigPrimClient);
}
10 changes: 10 additions & 0 deletions DQM/EcalMonitorTasks/interface/TrigPrimTask.h
Expand Up @@ -5,6 +5,11 @@

#include "DataFormats/EcalDigi/interface/EcalDigiCollections.h"

#include "FWCore/Framework/interface/ESHandle.h"

#include "CondFormats/EcalObjects/interface/EcalTPGTowerStatus.h"
#include "CondFormats/EcalObjects/interface/EcalTPGStripStatus.h"

namespace ecaldqm {

class TrigPrimTask : public DQWorkerTask {
Expand All @@ -16,6 +21,7 @@ namespace ecaldqm {

bool analyze(void const*, Collections) override;

void beginRun(edm::Run const&, edm::EventSetup const&) override;
void beginEvent(edm::Event const&, edm::EventSetup const&) override;

void runOnRealTPs(EcalTrigPrimDigiCollection const&);
Expand All @@ -42,6 +48,10 @@ namespace ecaldqm {
double bxBin_;

std::map<uint32_t, unsigned> towerReadouts_;

edm::ESHandle<EcalTPGTowerStatus> TTStatusRcd;
edm::ESHandle<EcalTPGStripStatus> StripStatusRcd;

};

inline bool TrigPrimTask::analyze(void const* _p, Collections _collection){
Expand Down
1 change: 1 addition & 0 deletions DQM/EcalMonitorTasks/python/EcalMonitorTask_cfi.py
Expand Up @@ -26,6 +26,7 @@
"PresampleTask",
"RawDataTask",
"RecoSummaryTask",
"TimingTask",
"TrigPrimTask"
),
# task parameters (included from indivitual cfis)
Expand Down
14 changes: 14 additions & 0 deletions DQM/EcalMonitorTasks/python/TrigPrimTask_cfi.py
Expand Up @@ -149,13 +149,27 @@
btype = cms.untracked.string('DCC'),
description = cms.untracked.string('Distribution of the trigger tower flags.')
),
TTFlags4 = cms.untracked.PSet(
path = cms.untracked.string('%(subdet)s/%(prefix)sTriggerTowerTask/%(prefix)sTTT TTF4 Occupancy%(suffix)s'),
kind = cms.untracked.string('TH2F'),
otype = cms.untracked.string('Ecal3P'),
btype = cms.untracked.string('TriggerTower'),
description = cms.untracked.string('Occupancy for TP digis with TTF=4.')
),
TTMaskMap = cms.untracked.PSet(
path = cms.untracked.string('%(subdet)s/%(prefix)sTriggerTowerTask/TTStatus/%(prefix)sTTT TT Masking Status%(sm)s'),
kind = cms.untracked.string('TProfile2D'),
otype = cms.untracked.string('SM'),
btype = cms.untracked.string('PseudoStrip'),
description = cms.untracked.string('Trigger tower and pseudo-strip masking status: a TT or strip is red if it is masked')
),
TTMaskMapAll = cms.untracked.PSet(
path = cms.untracked.string('%(subdet)s/%(prefix)sTriggerTowerTask/%(prefix)sTTT TT Masking Status%(suffix)s'),
kind = cms.untracked.string('TH2F'),
otype = cms.untracked.string('Ecal3P'),
btype = cms.untracked.string('TriggerTower'),
description = cms.untracked.string('Trigger tower masking status: a TT is red if it is masked.')
),
TTFMismatch = cms.untracked.PSet(
# path = cms.untracked.string('Ecal/Errors/TriggerPrimitives/FlagMismatch/'),
path = cms.untracked.string('%(subdet)s/%(prefix)sSelectiveReadoutTask/%(prefix)sSRT TT flag mismatch%(suffix)s'),
Expand Down
72 changes: 56 additions & 16 deletions DQM/EcalMonitorTasks/src/TrigPrimTask.cc
Expand Up @@ -3,16 +3,12 @@
#include "DQM/EcalCommon/interface/EcalDQMCommonUtils.h"
#include "FWCore/Framework/interface/EventSetup.h"

#include "FWCore/Framework/interface/ESHandle.h"
#include "FWCore/Framework/interface/Event.h"
#include "FWCore/Common/interface/TriggerResultsByName.h"
#include "FWCore/ParameterSet/interface/ParameterSet.h"

#include "CondFormats/DataRecord/interface/EcalTPGTowerStatusRcd.h"
#include "CondFormats/EcalObjects/interface/EcalTPGTowerStatus.h"

#include "CondFormats/DataRecord/interface/EcalTPGStripStatusRcd.h"
#include "CondFormats/EcalObjects/interface/EcalTPGStripStatus.h"

#include <iomanip>

Expand Down Expand Up @@ -51,6 +47,16 @@ namespace ecaldqm
if(runOnEmul_) _dependencies.push_back(Dependency(kTrigPrimEmulDigi, kEBDigi, kEEDigi, kTrigPrimDigi));
}

void
TrigPrimTask::beginRun(edm::Run const&, edm::EventSetup const& _es)
{
// Read-in Status records:
// Status records stay constant over run so they are read-in only once here
// but filled by LS in runOnRealTPs() because MEs are not yet booked at beginRun()
_es.get<EcalTPGTowerStatusRcd>().get( TTStatusRcd );
_es.get<EcalTPGStripStatusRcd>().get( StripStatusRcd );
}

void
TrigPrimTask::beginEvent(edm::Event const& _evt, edm::EventSetup const& _es)
{
Expand All @@ -66,14 +72,14 @@ namespace ecaldqm
int* pBin(std::upper_bound(bxBinEdges_, bxBinEdges_ + nBXBins + 1, _evt.bunchCrossing()));
bxBin_ = static_cast<int>(pBin - bxBinEdges_) - 0.5;

edm::ESHandle<EcalTPGTowerStatus> TTStatusRcd;
_es.get<EcalTPGTowerStatusRcd>().get(TTStatusRcd);
const EcalTPGTowerStatus * TTStatus=TTStatusRcd.product();
edm::ESHandle<EcalTPGTowerStatus> TTStatusRcd_;
_es.get<EcalTPGTowerStatusRcd>().get(TTStatusRcd_);
const EcalTPGTowerStatus * TTStatus=TTStatusRcd_.product();
const EcalTPGTowerStatusMap &towerMap=TTStatus->getMap();

edm::ESHandle<EcalTPGStripStatus> StripStatusRcd;
_es.get<EcalTPGStripStatusRcd>().get(StripStatusRcd);
const EcalTPGStripStatus * StripStatus=StripStatusRcd.product();
edm::ESHandle<EcalTPGStripStatus> StripStatusRcd_;
_es.get<EcalTPGStripStatusRcd>().get(StripStatusRcd_);
const EcalTPGStripStatus * StripStatus=StripStatusRcd_.product();
const EcalTPGStripStatusMap &stripMap=StripStatus->getMap();

MESet& meTTMaskMap(MEs_.at("TTMaskMap"));
Expand All @@ -83,7 +89,7 @@ namespace ecaldqm
if ((*ttItr).second > 0)
{
const EcalTrigTowerDetId ttid((*ttItr).first);
if(ttid.subDet() == EcalBarrel)
//if(ttid.subDet() == EcalBarrel)
meTTMaskMap.fill(ttid,1);
}//masked
}//loop on towers
Expand All @@ -93,7 +99,7 @@ namespace ecaldqm
if ((*stItr).second > 0)
{
const EcalElectronicsId stid((*stItr).first);
if(stid.subdet() == EcalEndcap);
//if(stid.subdet() == EcalEndcap);
meTTMaskMap.fill(stid,1);
}//masked
}//loop on pseudo-strips
Expand Down Expand Up @@ -175,6 +181,7 @@ namespace ecaldqm
MESet& meMedIntMap(MEs_.at("MedIntMap"));
MESet& meHighIntMap(MEs_.at("HighIntMap"));
MESet& meTTFlags(MEs_.at("TTFlags"));
MESet& meTTFlags4( MEs_.at("TTFlags4") );
MESet& meTTFMismatch(MEs_.at("TTFMismatch"));
MESet& meOccVsBx(MEs_.at("OccVsBx"));

Expand Down Expand Up @@ -216,16 +223,49 @@ namespace ecaldqm
break;
}

meTTFlags.fill(ttid, float(tpItr->ttFlag()));
// Fill TT Flag MEs
float ttF( tpItr->ttFlag() );
meTTFlags.fill( ttid, ttF );
// Monitor occupancy of TTF=4
// which contains info about TT auto-masking
if ( ttF == 4. )
meTTFlags4.fill( ttid );

if((interest == 1 || interest == 3) && towerReadouts_[ttid.rawId()] != getTrigTowerMap()->constituentsOf(ttid).size())
meTTFMismatch.fill(ttid);
}

meOccVsBx.fill(EcalBarrel, bxBin_, nTP[0]);
meOccVsBx.fill( EcalBarrel, bxBin_, nTP[0]);
meOccVsBx.fill(-EcalEndcap, bxBin_, nTP[1]);
meOccVsBx.fill(EcalEndcap, bxBin_, nTP[2]);
}
meOccVsBx.fill( EcalEndcap, bxBin_, nTP[2]);

// Set TT/Strip Masking status in Ecal3P view
// Status Records are read-in at beginRun() but filled here
// Requestied by ECAL Trigger in addition to TTMaskMap plots in SM view
MESet& meTTMaskMapAll(MEs_.at("TTMaskMapAll"));

// Fill from TT Status Rcd
const EcalTPGTowerStatus *TTStatus( TTStatusRcd.product() );
const EcalTPGTowerStatusMap &TTStatusMap( TTStatus->getMap() );
for( EcalTPGTowerStatusMap::const_iterator ttItr(TTStatusMap.begin()); ttItr != TTStatusMap.end(); ++ttItr ){
const EcalTrigTowerDetId ttid( ttItr->first );
if ( ttItr->second > 0 )
meTTMaskMapAll.setBinContent( ttid,1 ); // TT is masked
} // TTs

// Fill from Strip Status Rcd
const EcalTPGStripStatus *StripStatus( StripStatusRcd.product() );
const EcalTPGStripStatusMap &StripStatusMap( StripStatus->getMap() );
for( EcalTPGStripStatusMap::const_iterator stItr(StripStatusMap.begin()); stItr != StripStatusMap.end(); ++stItr ){
const EcalTriggerElectronicsId stid( stItr->first );
// Since ME has kTriggerTower binning, convert to EcalTrigTowerDetId first
// In principle, setBinContent() could be implemented for EcalTriggerElectronicsId class as well
const EcalTrigTowerDetId ttid( getElectronicsMap()->getTrigTowerDetId(stid.tccId(), stid.ttId()) );
if ( stItr->second > 0 )
meTTMaskMapAll.setBinContent( ttid,1 ); // PseudoStrip is masked
} // PseudoStrips

} // TrigPrimTask::runOnRealTPs()

void
TrigPrimTask::runOnEmulTPs(EcalTrigPrimDigiCollection const& _tps)
Expand Down

0 comments on commit f30cae3

Please sign in to comment.