Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EMTF DQM Module #13513

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -52,7 +52,9 @@

process.gtDigis.DaqGtFedId = cms.untracked.int32(813)

process.stage2UnpackPath = cms.Path(process.caloStage2Digis+process.gmtStage2Digis)
process.stage2UnpackPath = cms.Path(process.caloStage2Digis +
process.gmtStage2Digis +
process.emtfStage2Digis)

process.l1tMonitorPath = cms.Path(process.l1tStage2online)

Expand Down
43 changes: 43 additions & 0 deletions DQM/L1TMonitor/interface/L1TStage2EMTF.h
@@ -0,0 +1,43 @@
#ifndef DQM_L1TMonitor_L1TStage2EMTF_h
#define DQM_L1TMonitor_L1TStage2EMTF_h

#include "DataFormats/L1TMuon/interface/EMTFOutput.h"

#include "DQMServices/Core/interface/DQMEDAnalyzer.h"
#include "DQMServices/Core/interface/MonitorElement.h"

#include "FWCore/Framework/interface/Event.h"
#include "FWCore/MessageLogger/interface/MessageLogger.h"
#include "FWCore/ParameterSet/interface/ParameterSet.h"


class L1TStage2EMTF : public DQMEDAnalyzer {

public:

L1TStage2EMTF(const edm::ParameterSet& ps);
virtual ~L1TStage2EMTF();

protected:

virtual void dqmBeginRun(const edm::Run&, const edm::EventSetup&);
virtual void beginLuminosityBlock(const edm::LuminosityBlock&, const edm::EventSetup&);
virtual void bookHistograms(DQMStore::IBooker&, const edm::Run&, const edm::EventSetup&) override;
virtual void analyze(const edm::Event&, const edm::EventSetup&) override;

private:

edm::EDGetTokenT<l1t::EMTFOutputCollection> emtfToken;
std::string monitorDir;
bool verbose;

MonitorElement* emtfnTracks;
MonitorElement* emtfTrackBX;
MonitorElement* emtfTrackPt;
MonitorElement* emtfTrackEta;
MonitorElement* emtfTrackPhi;
MonitorElement* emtfTrackPhiFull;
MonitorElement* emtfTrackOccupancy;
};

#endif
9 changes: 9 additions & 0 deletions DQM/L1TMonitor/python/L1TStage2EMTF_cfi.py
@@ -0,0 +1,9 @@
import FWCore.ParameterSet.Config as cms

l1tStage2Emtf = cms.EDAnalyzer(
'L1TStage2EMTF',
emtfSource = cms.InputTag('emtfStage2Digis'),
monitorDir = cms.untracked.string('L1T2016/L1TStage2EMTF'),
verbose = cms.untracked.bool(False),
)

7 changes: 5 additions & 2 deletions DQM/L1TMonitor/python/L1TStage2_cff.py
Expand Up @@ -2,12 +2,15 @@

from DQM.L1TMonitor.L1TStage2CaloLayer2_cfi import *
from DQM.L1TMonitor.L1TStage2mGMT_cfi import *
from DQM.L1TMonitor.L1TStage2EMTF_cfi import *


from EventFilter.L1TRawToDigi.caloStage2Digis_cfi import *
from EventFilter.L1TRawToDigi.gmtStage2Digis_cfi import *
from EventFilter.L1TRawToDigi.emtfStage2Digis_cfi import *

l1tStage2online = cms.Sequence(
l1tStage2CaloLayer2+
l1tStage2mGMT
l1tStage2CaloLayer2 +
l1tStage2mGMT +
l1tStage2Emtf
)
61 changes: 61 additions & 0 deletions DQM/L1TMonitor/src/L1TStage2EMTF.cc
@@ -0,0 +1,61 @@
#include "DQM/L1TMonitor/interface/L1TStage2EMTF.h"


L1TStage2EMTF::L1TStage2EMTF(const edm::ParameterSet& ps)
: emtfToken(consumes<l1t::EMTFOutputCollection>(ps.getParameter<edm::InputTag>("emtfSource"))),
monitorDir(ps.getUntrackedParameter<std::string>("monitorDir", "")),
verbose(ps.getUntrackedParameter<bool>("verbose", false)) {}

L1TStage2EMTF::~L1TStage2EMTF() {}

void L1TStage2EMTF::dqmBeginRun(const edm::Run& r, const edm::EventSetup& c) {}

void L1TStage2EMTF::beginLuminosityBlock(const edm::LuminosityBlock&, const edm::EventSetup&) {}

void L1TStage2EMTF::bookHistograms(DQMStore::IBooker& ibooker, const edm::Run&, const edm::EventSetup&) {

ibooker.setCurrentFolder(monitorDir);

emtfnTracks = ibooker.book1D("emtfnTracks", "Number of EMTF Tracks per Event", 4, 0, 4);

emtfTrackPt = ibooker.book1D("emtfTrackPt", "EMTF Track p_{T}", 512, 0, 512);
emtfTrackPt->setAxisTitle("Track p_{T} [GeV]", 1);

emtfTrackEta = ibooker.book1D("emtfTrackEta", "EMTF Track #eta", 460, -230, 230);
emtfTrackEta->setAxisTitle("Track #eta", 1);

emtfTrackPhi = ibooker.book1D("emtfTrackPhi", "EMTF Track #phi", 116, -16, 100);
emtfTrackPhi->setAxisTitle("Track #phi", 1);

emtfTrackPhiFull = ibooker.book1D("emtfTrackPhiFull", "EMTF Full Precision Track #phi", 4096, 0, 4096);
emtfTrackPhiFull->setAxisTitle("Full Precision Track #phi", 1);

emtfTrackBX = ibooker.book1D("emtfTrackBX", "EMTF Track Bunch Crossings", 4, 0, 4);
emtfTrackBX->setAxisTitle("Track BX", 1);
}

void L1TStage2EMTF::analyze(const edm::Event& e, const edm::EventSetup& c) {

if (verbose) edm::LogInfo("L1TStage2EMTF") << "L1TStage2EMTF: analyze..." << std::endl;

int nTracks = 0;

edm::Handle<l1t::EMTFOutputCollection> EMTF;
e.getByToken(emtfToken, EMTF);

for (std::vector<l1t::EMTFOutput>::const_iterator itEMTF = EMTF->begin(); itEMTF != EMTF->end(); ++itEMTF) {

l1t::emtf::SPCollection SP = itEMTF->GetSPCollection();

for (std::vector<l1t::emtf::SP>::const_iterator itSP = SP.begin(); itSP != SP.end(); ++itSP) {
emtfTrackBX->Fill(itSP->BX());
emtfTrackPt->Fill(itSP->Pt());
emtfTrackEta->Fill(itSP->Eta_GMT());
emtfTrackPhi->Fill(itSP->Phi_GMT());
emtfTrackPhiFull->Fill(itSP->Phi_full());
nTracks++;
}
}
emtfnTracks->Fill(nTracks);
}

3 changes: 3 additions & 0 deletions DQM/L1TMonitor/src/SealModule.cc
Expand Up @@ -35,6 +35,9 @@ DEFINE_FWK_MODULE(L1TStage2mGMT);
#include <DQM/L1TMonitor/interface/L1TStage2BMTF.h>
DEFINE_FWK_MODULE(L1TStage2BMTF);

#include <DQM/L1TMonitor/interface/L1TStage2EMTF.h>
DEFINE_FWK_MODULE(L1TStage2EMTF);

#include <DQM/L1TMonitor/interface/L1TGCT.h>
DEFINE_FWK_MODULE(L1TGCT);

Expand Down
42 changes: 21 additions & 21 deletions DataFormats/L1TMuon/interface/EMTFOutput.h
Expand Up @@ -50,27 +50,27 @@ namespace l1t {
void set_AMC13Trailer(emtf::AMC13Trailer bits) { AMC13Trailer = bits; hasAMC13Trailer = true; };
void set_dataword(uint64_t bits) { dataword = bits; };

bool HasAMC13Header() { return hasAMC13Header; };
bool HasMTF7Header() { return hasMTF7Header; };
bool HasEventHeader() { return hasEventHeader; };
bool HasCounters() { return hasCounters; };
int NumSP() { return numSP; };
int NumRPC() { return numRPC; };
int NumME() { return numME; };
bool HasAMC13Trailer() { return hasAMC13Trailer; };
bool HasMTF7Trailer() { return hasMTF7Trailer; };
bool HasEventTrailer() { return hasEventTrailer; };
emtf::AMC13Header GetAMC13Header() { return AMC13Header; };
emtf::MTF7Header GetMTF7Header() { return MTF7Header; };
emtf::EventHeader GetEventHeader() { return EventHeader; };
emtf::Counters GetCounters() { return Counters; };
emtf::MECollection GetMECollection() { return MECollection; };
emtf::RPCCollection GetRPCCollection() { return RPCCollection; };
emtf::SPCollection GetSPCollection() { return SPCollection; };
emtf::EventTrailer GetEventTrailer() { return EventTrailer; };
emtf::MTF7Trailer GetMTF7Trailer() { return MTF7Trailer; };
emtf::AMC13Trailer GetAMC13Trailer() { return AMC13Trailer; };
const uint64_t Dataword() const { return dataword; };
const bool HasAMC13Header() const { return hasAMC13Header; };
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why should the output be const for all of these functions? @swang373 @mulhearn

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To be honest, I'm not sure. This appears to be following a similar convention to https://github.com/swang373/cmssw/blob/EMTF_DQM_dev/DataFormats/L1TMuon/interface/RegionalMuonCand.h. Perhaps @abrinke1 would be able to comment on this, as I implemented his fix in order for the EMTF DQM module to compile.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure why they need to be const, but without it there were compile errors, and with it, it works.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i understand that the methods should be constant - but not their return types - what were the errors?

On Mar 17, 2016, at 5:37 PM, abrinke1 notifications@github.com wrote:

In DataFormats/L1TMuon/interface/EMTFOutput.h:

  • int NumME() { return numME; };
  • bool HasAMC13Trailer() { return hasAMC13Trailer; };
  • bool HasMTF7Trailer() { return hasMTF7Trailer; };
  • bool HasEventTrailer() { return hasEventTrailer; };
  • emtf::AMC13Header GetAMC13Header() { return AMC13Header; };
  • emtf::MTF7Header GetMTF7Header() { return MTF7Header; };
  • emtf::EventHeader GetEventHeader() { return EventHeader; };
  • emtf::Counters GetCounters() { return Counters; };
  • emtf::MECollection GetMECollection() { return MECollection; };
  • emtf::RPCCollection GetRPCCollection() { return RPCCollection; };
  • emtf::SPCollection GetSPCollection() { return SPCollection; };
  • emtf::EventTrailer GetEventTrailer() { return EventTrailer; };
  • emtf::MTF7Trailer GetMTF7Trailer() { return MTF7Trailer; };
  • emtf::AMC13Trailer GetAMC13Trailer() { return AMC13Trailer; };
  • const uint64_t Dataword() const { return dataword; };
  • const bool HasAMC13Header() const { return hasAMC13Header; };

Not sure why they need to be const, but without it there were compile errors, and with it, it works.


You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @davidlange6 , @abrinke1 ,

With further updates to the DataFormats for EMTF, we are looking into this comment to make sure we code it right. That the methods should be const is agreed upon. My understanding is that the edm::Handle returned by the call to getByToken() is const, so only const methods may be used to access its members.

That the return types do not have to be const, yes, I see that now. Pardon my confusion. If however, we are returning references or pointers to members, then the return type must be const. Is my understanding correct?

const bool HasMTF7Header() const { return hasMTF7Header; };
const bool HasEventHeader() const { return hasEventHeader; };
const bool HasCounters() const { return hasCounters; };
const int NumSP() const { return numSP; };
const int NumRPC() const { return numRPC; };
const int NumME() const { return numME; };
const bool HasAMC13Trailer() const { return hasAMC13Trailer; };
const bool HasMTF7Trailer() const { return hasMTF7Trailer; };
const bool HasEventTrailer() const { return hasEventTrailer; };
const emtf::AMC13Header GetAMC13Header() const { return AMC13Header; };
const emtf::MTF7Header GetMTF7Header() const { return MTF7Header; };
const emtf::EventHeader GetEventHeader() const { return EventHeader; };
const emtf::Counters GetCounters() const { return Counters; };
const emtf::MECollection GetMECollection() const { return MECollection; };
const emtf::RPCCollection GetRPCCollection() const { return RPCCollection; };
const emtf::SPCollection GetSPCollection() const { return SPCollection; };
const emtf::EventTrailer GetEventTrailer() const { return EventTrailer; };
const emtf::MTF7Trailer GetMTF7Trailer() const { return MTF7Trailer; };
const emtf::AMC13Trailer GetAMC13Trailer() const { return AMC13Trailer; };
const uint64_t Dataword() const { return dataword; };

private:
bool hasAMC13Header;
Expand Down
12 changes: 12 additions & 0 deletions EventFilter/L1TRawToDigi/python/emtfStage2Digis_cfi.py
@@ -0,0 +1,12 @@
import FWCore.ParameterSet.Config as cms
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what are the plans for also adding this unpacker to the tier-0? @mulhearn


emtfStage2Digis = cms.EDProducer(
"L1TRawToDigi",
Setup = cms.string("stage2::EMTFSetup"),
InputLabel = cms.InputTag("rawDataCollector"),
FedIds = cms.vint32(1384, 1385),
FWId = cms.uint32(0), ## Need to implement properly - AWB 23.02.16
debug = cms.untracked.bool(False),
MTF7 = cms.untracked.bool(True)
)