CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Member Functions | Protected Member Functions | Protected Attributes | Private Attributes | Friends
DTLocalTriggerSynchTask Class Reference

#include <DTLocalTriggerSynchTask.h>

Inheritance diagram for DTLocalTriggerSynchTask:
DQMEDAnalyzer edm::stream::EDProducer< edm::GlobalCache< DQMEDAnalyzerGlobalCache >, edm::EndRunProducer, edm::EndLuminosityBlockProducer, edm::Accumulator >

Public Member Functions

 DTLocalTriggerSynchTask (const edm::ParameterSet &ps)
 Constructor. More...
 
 ~DTLocalTriggerSynchTask () override
 Destructor. More...
 
- Public Member Functions inherited from DQMEDAnalyzer
void accumulate (edm::Event const &event, edm::EventSetup const &setup) final
 
void beginLuminosityBlock (edm::LuminosityBlock const &lumi, edm::EventSetup const &setup) final
 
void beginRun (edm::Run const &run, edm::EventSetup const &setup) final
 
void beginStream (edm::StreamID id) final
 
 DQMEDAnalyzer ()
 
void endLuminosityBlock (edm::LuminosityBlock const &lumi, edm::EventSetup const &setup) final
 
void endRun (edm::Run const &run, edm::EventSetup const &setup) final
 
virtual bool getCanSaveByLumi ()
 
- Public Member Functions inherited from edm::stream::EDProducer< edm::GlobalCache< DQMEDAnalyzerGlobalCache >, edm::EndRunProducer, edm::EndLuminosityBlockProducer, edm::Accumulator >
 EDProducer ()=default
 
 EDProducer (const EDProducer &)=delete
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
const EDProduceroperator= (const EDProducer &)=delete
 

Protected Member Functions

void analyze (const edm::Event &event, const edm::EventSetup &context) override
 Analyze. More...
 
std::string & baseDir ()
 
void bookHistograms (DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
 Book the histograms. More...
 
void bookHistos (DQMStore::IBooker &, const DTChamberId &dtCh)
 Book the histograms. More...
 
void dqmBeginRun (const edm::Run &, const edm::EventSetup &) override
 Beginrun. More...
 
- Protected Member Functions inherited from DQMEDAnalyzer
uint64_t meId () const
 

Protected Attributes

const int wheelArrayShift = 3
 
- Protected Attributes inherited from DQMEDAnalyzer
edm::EDPutTokenT< DQMTokenlumiToken_
 
edm::EDPutTokenT< DQMTokenrunToken_
 
unsigned int streamId_
 

Private Attributes

float angleRange
 
std::string baseDirectory
 
float bxTime
 
int fineDelay
 
float minHitsPhi
 
const DTGeometrymuonGeom
 
edm::ESGetToken< DTGeometry,
MuonGeometryRecord
muonGeomToken_
 
int nBXHigh
 
int nBXLow
 
int nevents
 
DTArr3int phCodeBestTM
 
DTArr4int phCodeBXTM
 
bool rangeInBX
 
edm::EDGetTokenT
< DTRecSegment4DCollection
seg_Token_
 
DTArr3int segHitBest
 
MonitorElementtm_IDDataErrorPlot
 
edm::EDGetTokenT
< L1MuDTChambPhContainer
tm_Token_
 
std::map< uint32_t, std::map
< std::string, MonitorElement * > > 
triggerHistos
 
std::unique_ptr< DTTTrigBaseSynctTrigSync
 

Friends

class DTMonitorModule
 

Additional Inherited Members

- Public Types inherited from DQMEDAnalyzer
typedef dqm::reco::DQMStore DQMStore
 
typedef dqm::reco::MonitorElement MonitorElement
 
- Public Types inherited from edm::stream::EDProducer< edm::GlobalCache< DQMEDAnalyzerGlobalCache >, edm::EndRunProducer, edm::EndLuminosityBlockProducer, edm::Accumulator >
using CacheTypes = CacheContexts< T...>
 
using GlobalCache = typename CacheTypes::GlobalCache
 
using HasAbility = AbilityChecker< T...>
 
using InputProcessBlockCache = typename CacheTypes::InputProcessBlockCache
 
using LuminosityBlockCache = typename CacheTypes::LuminosityBlockCache
 
using LuminosityBlockContext = LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCache >
 
using LuminosityBlockSummaryCache = typename CacheTypes::LuminosityBlockSummaryCache
 
using RunCache = typename CacheTypes::RunCache
 
using RunContext = RunContextT< RunCache, GlobalCache >
 
using RunSummaryCache = typename CacheTypes::RunSummaryCache
 
- Static Public Member Functions inherited from DQMEDAnalyzer
static void globalEndJob (DQMEDAnalyzerGlobalCache const *)
 
static void globalEndLuminosityBlockProduce (edm::LuminosityBlock &lumi, edm::EventSetup const &setup, LuminosityBlockContext const *context)
 
static void globalEndRunProduce (edm::Run &run, edm::EventSetup const &setup, RunContext const *context)
 
static std::unique_ptr
< DQMEDAnalyzerGlobalCache
initializeGlobalCache (edm::ParameterSet const &)
 

Detailed Description

Definition at line 50 of file DTLocalTriggerSynchTask.h.

Constructor & Destructor Documentation

DTLocalTriggerSynchTask::DTLocalTriggerSynchTask ( const edm::ParameterSet ps)

Constructor.

Definition at line 41 of file DTLocalTriggerSynchTask.cc.

References get, edm::ParameterSet::getParameter(), and AlCaHLTBitMon_QueryRunRegistry::string.

42  : nevents(0),
43  tTrigSync{DTTTrigSyncFactory::get()->create(ps.getParameter<std::string>("tTrigMode"),
44  ps.getParameter<edm::ParameterSet>("tTrigModeConfig"),
45  consumesCollector())},
46  muonGeomToken_(esConsumes<edm::Transition::BeginRun>()) {
47  edm::LogVerbatim("DTLocalTriggerSynchTask") << "[DTLocalTriggerSynchTask]: Constructor" << endl;
48  tm_Token_ = consumes<L1MuDTChambPhContainer>(ps.getParameter<edm::InputTag>("TMInputTag"));
49  seg_Token_ = consumes<DTRecSegment4DCollection>(ps.getParameter<edm::InputTag>("SEGInputTag"));
50 
51  bxTime = ps.getParameter<double>("bxTimeInterval"); // CB move this to static const or DB
52  rangeInBX = ps.getParameter<bool>("rangeWithinBX");
53  nBXLow = ps.getParameter<int>("nBXLow");
54  nBXHigh = ps.getParameter<int>("nBXHigh");
55  angleRange = ps.getParameter<double>("angleRange");
56  minHitsPhi = ps.getParameter<int>("minHitsPhi");
57  baseDirectory = ps.getParameter<string>("baseDir");
58 }
Log< level::Info, true > LogVerbatim
edm::ESGetToken< DTGeometry, MuonGeometryRecord > muonGeomToken_
std::unique_ptr< DTTTrigBaseSync > tTrigSync
edm::EDGetTokenT< DTRecSegment4DCollection > seg_Token_
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
#define get
edm::EDGetTokenT< L1MuDTChambPhContainer > tm_Token_
DTLocalTriggerSynchTask::~DTLocalTriggerSynchTask ( )
override

Destructor.

Definition at line 60 of file DTLocalTriggerSynchTask.cc.

References nevents.

60  {
61  edm::LogVerbatim("DTLocalTriggerSynchTask") << "[DTLocalTriggerSynchTask]: analyzed " << nevents << " events" << endl;
62 }
Log< level::Info, true > LogVerbatim

Member Function Documentation

void DTLocalTriggerSynchTask::analyze ( const edm::Event event,
const edm::EventSetup context 
)
overrideprotectedvirtual

Analyze.

Reimplemented from DQMEDAnalyzer.

Definition at line 88 of file DTLocalTriggerSynchTask.cc.

References angleRange, bxTime, DTRecSegment2D::degreesOfFreedom(), DeadROC_duringRun::dir, mps_fire::i, DTRecSegment2D::ist0Valid(), dqmiolumiharvest::j, isotrackApplyRegressor::k, minHitsPhi, nevents, phCodeBestTM, DTRecSegment4D::phiSegment(), Geom::pi(), sistrip::SpyUtilities::range(), rangeInBX, DetId::rawId(), DTChamberId::sector(), seg_Token_, DTChamberId::station(), relativeConstraints::station, tm_Token_, HLT_FULL_cff::track, triggerHistos, tTrigSync, and DTChamberId::wheel().

88  {
89  nevents++;
90 
91  for (int i = 0; i < 5; ++i) {
92  for (int j = 0; j < 6; ++j) {
93  for (int k = 0; k < 13; ++k) {
94  phCodeBestTM[j][i][k] = -1;
95  }
96  }
97  }
98 
99  // Get best TM triggers
101  event.getByToken(tm_Token_, l1DTTPGPh);
102  vector<L1MuDTChambPhDigi> const* phTrigs = l1DTTPGPh->getContainer();
103 
104  vector<L1MuDTChambPhDigi>::const_iterator iph = phTrigs->begin();
105  vector<L1MuDTChambPhDigi>::const_iterator iphe = phTrigs->end();
106  for (; iph != iphe; ++iph) {
107  int phwheel = iph->whNum();
108  int phsec = iph->scNum() + 1; // DTTF[0-11] -> DT[1-12] Sector Numbering
109  int phst = iph->stNum();
110  int phcode = iph->code();
111 
112  if (phcode > phCodeBestTM[phwheel + 3][phst][phsec] && phcode < 7) {
113  phCodeBestTM[phwheel + 3][phst][phsec] = phcode;
114  }
115  }
116 
117  //Get best segments (highest number of phi hits)
118  vector<const DTRecSegment4D*> bestSegments4D;
120  event.getByToken(seg_Token_, segments4D);
123 
124  for (chambIdIt = segments4D->id_begin(); chambIdIt != segments4D->id_end(); ++chambIdIt) {
125  DTRecSegment4DCollection::range range = segments4D->get(*chambIdIt);
126  const DTRecSegment4D* best = nullptr;
127  int hitsBest = 0;
128  int hits = 0;
129 
130  for (track = range.first; track != range.second; ++track) {
131  if ((*track).hasPhi()) {
132  hits = (*track).phiSegment()->degreesOfFreedom() + 2;
133  if (hits > hitsBest) {
134  best = &(*track);
135  hitsBest = hits;
136  }
137  }
138  }
139  if (best) {
140  bestSegments4D.push_back(best);
141  }
142  }
143 
144  // Filling histos
145  vector<const DTRecSegment4D*>::const_iterator bestSegIt = bestSegments4D.begin();
146  vector<const DTRecSegment4D*>::const_iterator bestSegEnd = bestSegments4D.end();
147  for (; bestSegIt != bestSegEnd; ++bestSegIt) {
148  float dir = atan((*bestSegIt)->localDirection().x() / (*bestSegIt)->localDirection().z()) * 180 /
149  Geom::pi(); // CB cerca un modo migliore x farlo
150  const DTRecSegment2D* seg2D = (*bestSegIt)->phiSegment();
151  int nHitsPhi = seg2D->degreesOfFreedom() + 2;
152  DTChamberId chambId = (*bestSegIt)->chamberId();
153  map<string, MonitorElement*>& innerME = triggerHistos[chambId.rawId()];
154 
155  if (fabs(dir) < angleRange && nHitsPhi >= minHitsPhi && seg2D->ist0Valid()) {
156  float t0seg = (*bestSegIt)->phiSegment()->t0();
157  float tTrig = (tTrigSync->offset(DTWireId(chambId, 1, 1, 2)) + tTrigSync->offset(DTWireId(chambId, 3, 1, 2))) / 2;
158  float time = tTrig + t0seg;
159  float htime = rangeInBX ? time - int(time / bxTime) * bxTime : time - int(tTrig / bxTime) * bxTime;
160 
161  int wheel = chambId.wheel();
162  int sector = chambId.sector();
163  int station = chambId.station();
164  int scsector = sector > 12 ? sector == 13 ? 4 : 10 : sector;
165 
166  int qualTM = phCodeBestTM[wheel + 3][station][scsector];
167 
168  if (fabs(t0seg) > 0.01) {
169  innerME.find("SEG_TrackCrossingTime")->second->Fill(htime);
170  if (qualTM >= 0)
171  innerME.find("TM_TrackCrossingTimeAll")->second->Fill(htime);
172  if (qualTM == 6)
173  innerME.find("TM_TrackCrossingTimeHH")->second->Fill(htime);
174  }
175  }
176  }
177 }
std::pair< const_iterator, const_iterator > range
iterator range
Definition: RangeMap.h:50
const DTChamberRecSegment2D * phiSegment() const
The superPhi segment: 0 if no phi projection available.
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
identifier iterator
Definition: RangeMap.h:130
std::unique_ptr< DTTTrigBaseSync > tTrigSync
const uint16_t range(const Frame &aFrame)
C::const_iterator const_iterator
constant access iterator type
Definition: RangeMap.h:43
bool ist0Valid() const
edm::EDGetTokenT< DTRecSegment4DCollection > seg_Token_
int degreesOfFreedom() const override
return the DOF of the segment
std::map< uint32_t, std::map< std::string, MonitorElement * > > triggerHistos
int sector() const
Definition: DTChamberId.h:49
constexpr double pi()
Definition: Pi.h:31
int station() const
Return the station number.
Definition: DTChamberId.h:42
edm::EDGetTokenT< L1MuDTChambPhContainer > tm_Token_
int wheel() const
Return the wheel number.
Definition: DTChamberId.h:39
std::string& DTLocalTriggerSynchTask::baseDir ( )
inlineprotected

Definition at line 73 of file DTLocalTriggerSynchTask.h.

References baseDirectory.

Referenced by bookHistograms(), and bookHistos().

73 { return baseDirectory; }
void DTLocalTriggerSynchTask::bookHistograms ( DQMStore::IBooker ibooker,
edm::Run const &  iRun,
edm::EventSetup const &  context 
)
overrideprotectedvirtual

Book the histograms.

Implements DQMEDAnalyzer.

Definition at line 64 of file DTLocalTriggerSynchTask.cc.

References baseDir(), dqm::implementation::IBooker::bookFloat(), bookHistos(), bxTime, DTGeometry::chambers(), dqm::impl::MonitorElement::Fill(), muonGeom, dqm::implementation::NavigatorBase::setCurrentFolder(), triggerHistos, and tTrigSync.

66  {
67  edm::LogVerbatim("DTLocalTriggerSynchTask") << "[DTLocalTriggerSynchTask]: Book Histograms" << endl;
68 
69  ibooker.setCurrentFolder(baseDir());
70  ibooker.bookFloat("BXTimeSpacing")->Fill(bxTime);
71 
72  tTrigSync->setES(context);
73 
74  std::vector<const DTChamber*>::const_iterator chambIt = muonGeom->chambers().begin();
75  std::vector<const DTChamber*>::const_iterator chambEnd = muonGeom->chambers().end();
76 
77  for (; chambIt != chambEnd; ++chambIt) {
78  bookHistos(ibooker, (*chambIt)->id());
79  triggerHistos[(*chambIt)->id().rawId()]["tTrig_SL1"]->Fill(tTrigSync->offset(DTWireId((*chambIt)->id(), 1, 1, 2)));
80  triggerHistos[(*chambIt)->id().rawId()]["tTrig_SL3"]->Fill(tTrigSync->offset(DTWireId((*chambIt)->id(), 3, 1, 2)));
81  }
82 }
Log< level::Info, true > LogVerbatim
const std::vector< const DTChamber * > & chambers() const
Return a vector of all Chamber.
Definition: DTGeometry.cc:84
MonitorElement * bookFloat(TString const &name, FUNC onbooking=NOOP())
Definition: DQMStore.h:80
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:32
std::unique_ptr< DTTTrigBaseSync > tTrigSync
void Fill(long long x)
std::map< uint32_t, std::map< std::string, MonitorElement * > > triggerHistos
void bookHistos(DQMStore::IBooker &, const DTChamberId &dtCh)
Book the histograms.
void DTLocalTriggerSynchTask::bookHistos ( DQMStore::IBooker ibooker,
const DTChamberId dtCh 
)
protected

Book the histograms.

Definition at line 179 of file DTLocalTriggerSynchTask.cc.

References baseDir(), dqm::implementation::IBooker::book1D(), dqm::implementation::IBooker::bookFloat(), bxTime, reco::ceil(), SiStripPI::max, min(), hlt_dqm_clientPB-live_cfg::nbins, nBXHigh, nBXLow, rangeInBX, DetId::rawId(), DTChamberId::sector(), dqm::implementation::NavigatorBase::setCurrentFolder(), DTChamberId::station(), relativeConstraints::station, triggerHistos, and DTChamberId::wheel().

Referenced by bookHistograms().

179  {
180  stringstream wheel;
181  wheel << dtChId.wheel();
182  stringstream station;
183  station << dtChId.station();
184  stringstream sector;
185  sector << dtChId.sector();
186  uint32_t chRawId = dtChId.rawId();
187 
188  ibooker.setCurrentFolder(baseDir() + "/Wheel" + wheel.str() + "/Sector" + sector.str() + "/Station" + station.str());
189 
190  std::vector<string> histoTags = {"SEG_TrackCrossingTime", "TM_TrackCrossingTimeAll", "TM_TrackCrossingTimeHH"};
191 
192  float min = rangeInBX ? 0 : nBXLow * bxTime;
193  float max = rangeInBX ? bxTime : nBXHigh * bxTime;
194  int nbins = static_cast<int>(ceil(rangeInBX ? bxTime : (nBXHigh - nBXLow) * bxTime));
195 
196  for (const auto& histoTag : histoTags) {
197  string histoName =
198  histoTag + (rangeInBX ? "InBX" : "") + "_W" + wheel.str() + "_Sec" + sector.str() + "_St" + station.str();
199  edm::LogVerbatim("DTLocalTriggerSynchTask")
200  << "[DTLocalTriggerSynchTask]: booking " << baseDir() + "/Wheel" << wheel.str() << "/Sector" << sector.str()
201  << "/Station" << station.str() << "/" << histoName << endl;
202 
203  triggerHistos[chRawId][histoTag] = ibooker.book1D(histoName.c_str(), "Track time distribution", nbins, min, max);
204  }
205 
206  string floatTag[2] = {"tTrig_SL1", "tTrig_SL3"};
207 
208  for (int iFloat = 0; iFloat < 2; ++iFloat) {
209  string floatName = floatTag[iFloat] + "_W" + wheel.str() + "_Sec" + sector.str() + "_St" + station.str();
210  triggerHistos[chRawId][floatTag[iFloat]] = ibooker.bookFloat(floatName);
211  }
212 }
Log< level::Info, true > LogVerbatim
constexpr int32_t ceil(float num)
MonitorElement * bookFloat(TString const &name, FUNC onbooking=NOOP())
Definition: DQMStore.h:80
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:32
T min(T a, T b)
Definition: MathUtil.h:58
std::map< uint32_t, std::map< std::string, MonitorElement * > > triggerHistos
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
Definition: DQMStore.h:98
void DTLocalTriggerSynchTask::dqmBeginRun ( const edm::Run run,
const edm::EventSetup context 
)
overrideprotectedvirtual

Beginrun.

Reimplemented from DQMEDAnalyzer.

Definition at line 84 of file DTLocalTriggerSynchTask.cc.

References edm::EventSetup::getData(), muonGeom, and muonGeomToken_.

84  {
85  muonGeom = &context.getData(muonGeomToken_);
86 }
edm::ESGetToken< DTGeometry, MuonGeometryRecord > muonGeomToken_
bool getData(T &iHolder) const
Definition: EventSetup.h:128

Friends And Related Function Documentation

friend class DTMonitorModule
friend

Definition at line 51 of file DTLocalTriggerSynchTask.h.

Member Data Documentation

float DTLocalTriggerSynchTask::angleRange
private

Definition at line 88 of file DTLocalTriggerSynchTask.h.

Referenced by analyze().

std::string DTLocalTriggerSynchTask::baseDirectory
private

Definition at line 93 of file DTLocalTriggerSynchTask.h.

Referenced by baseDir().

float DTLocalTriggerSynchTask::bxTime
private

Definition at line 84 of file DTLocalTriggerSynchTask.h.

Referenced by analyze(), bookHistograms(), and bookHistos().

int DTLocalTriggerSynchTask::fineDelay
private

Definition at line 90 of file DTLocalTriggerSynchTask.h.

float DTLocalTriggerSynchTask::minHitsPhi
private

Definition at line 89 of file DTLocalTriggerSynchTask.h.

Referenced by analyze().

const DTGeometry* DTLocalTriggerSynchTask::muonGeom
private

Definition at line 96 of file DTLocalTriggerSynchTask.h.

Referenced by bookHistograms(), and dqmBeginRun().

edm::ESGetToken<DTGeometry, MuonGeometryRecord> DTLocalTriggerSynchTask::muonGeomToken_
private

Definition at line 95 of file DTLocalTriggerSynchTask.h.

Referenced by dqmBeginRun().

int DTLocalTriggerSynchTask::nBXHigh
private

Definition at line 87 of file DTLocalTriggerSynchTask.h.

Referenced by bookHistos().

int DTLocalTriggerSynchTask::nBXLow
private

Definition at line 86 of file DTLocalTriggerSynchTask.h.

Referenced by bookHistos().

int DTLocalTriggerSynchTask::nevents
private

Definition at line 78 of file DTLocalTriggerSynchTask.h.

Referenced by analyze(), and ~DTLocalTriggerSynchTask().

DTArr3int DTLocalTriggerSynchTask::phCodeBestTM
private

Definition at line 80 of file DTLocalTriggerSynchTask.h.

Referenced by analyze().

DTArr4int DTLocalTriggerSynchTask::phCodeBXTM
private

Definition at line 81 of file DTLocalTriggerSynchTask.h.

bool DTLocalTriggerSynchTask::rangeInBX
private

Definition at line 85 of file DTLocalTriggerSynchTask.h.

Referenced by analyze(), and bookHistos().

edm::EDGetTokenT<DTRecSegment4DCollection> DTLocalTriggerSynchTask::seg_Token_
private

Definition at line 101 of file DTLocalTriggerSynchTask.h.

Referenced by analyze().

DTArr3int DTLocalTriggerSynchTask::segHitBest
private

Definition at line 82 of file DTLocalTriggerSynchTask.h.

MonitorElement* DTLocalTriggerSynchTask::tm_IDDataErrorPlot
private

Definition at line 98 of file DTLocalTriggerSynchTask.h.

edm::EDGetTokenT<L1MuDTChambPhContainer> DTLocalTriggerSynchTask::tm_Token_
private

Definition at line 100 of file DTLocalTriggerSynchTask.h.

Referenced by analyze().

std::map<uint32_t, std::map<std::string, MonitorElement*> > DTLocalTriggerSynchTask::triggerHistos
private

Definition at line 97 of file DTLocalTriggerSynchTask.h.

Referenced by analyze(), bookHistograms(), and bookHistos().

std::unique_ptr<DTTTrigBaseSync> DTLocalTriggerSynchTask::tTrigSync
private

Definition at line 91 of file DTLocalTriggerSynchTask.h.

Referenced by analyze(), and bookHistograms().

const int DTLocalTriggerSynchTask::wheelArrayShift = 3
protected

Definition at line 75 of file DTLocalTriggerSynchTask.h.