CMS 3D CMS Logo

List of all members | Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes
DTEfficiencyTask Class Reference

#include <DTEfficiencyTask.h>

Inheritance diagram for DTEfficiencyTask:
DQMEDAnalyzer edm::stream::EDAnalyzer< edm::RunSummaryCache< dqmDetails::NoCache >, edm::LuminosityBlockSummaryCache< dqmDetails::NoCache > > edm::stream::EDAnalyzerBase edm::EDConsumerBase

Public Member Functions

void analyze (const edm::Event &event, const edm::EventSetup &setup) override
 
void beginLuminosityBlock (edm::LuminosityBlock const &lumiSeg, edm::EventSetup const &context) override
 To reset the MEs. More...
 
 DTEfficiencyTask (const edm::ParameterSet &pset)
 Constructor. More...
 
virtual ~DTEfficiencyTask ()
 Destructor. More...
 
- Public Member Functions inherited from DQMEDAnalyzer
virtual void beginRun (edm::Run const &, edm::EventSetup const &) final
 
virtual void beginStream (edm::StreamID id) final
 
virtual void dqmBeginRun (edm::Run const &, edm::EventSetup const &)
 
 DQMEDAnalyzer (void)
 
virtual void endLuminosityBlockSummary (edm::LuminosityBlock const &, edm::EventSetup const &, dqmDetails::NoCache *) const final
 
virtual void endRunSummary (edm::Run const &, edm::EventSetup const &, dqmDetails::NoCache *) const final
 
uint32_t streamId () const
 
- Public Member Functions inherited from edm::stream::EDAnalyzer< edm::RunSummaryCache< dqmDetails::NoCache >, edm::LuminosityBlockSummaryCache< dqmDetails::NoCache > >
 EDAnalyzer ()=default
 
- Public Member Functions inherited from edm::stream::EDAnalyzerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzerBase ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDAnalyzerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
virtual ~EDConsumerBase () noexcept(false)
 

Protected Member Functions

void bookHistograms (DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
 
void dqmBeginRun (const edm::Run &, const edm::EventSetup &) override
 BeginRun. More...
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Private Member Functions

void fillHistos (DTLayerId lId, int firstWire, int lastWire, int numWire)
 
void fillHistos (DTLayerId lId, int firstWire, int lastWire, int missingWire, bool UnassHit)
 

Private Attributes

bool debug
 
std::map< DTLayerId, std::vector< MonitorElement * > > histosPerL
 
edm::ESHandle< DTGeometrymuonGeom
 
edm::ParameterSet parameters
 
edm::EDGetTokenT< DTRecSegment4DCollectionrecHits4DToken_
 
edm::EDGetTokenT< DTRecHitCollectionrecHitToken_
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDAnalyzer< edm::RunSummaryCache< dqmDetails::NoCache >, edm::LuminosityBlockSummaryCache< dqmDetails::NoCache > >
typedef CacheContexts< T... > CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T... > HasAbility
 
typedef CacheTypes::LuminosityBlockCache LuminosityBlockCache
 
typedef LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCacheLuminosityBlockContext
 
typedef CacheTypes::LuminosityBlockSummaryCache LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache, GlobalCacheRunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 
- Public Types inherited from edm::stream::EDAnalyzerBase
typedef EDAnalyzerAdaptorBase ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from DQMEDAnalyzer
static std::shared_ptr< dqmDetails::NoCacheglobalBeginLuminosityBlockSummary (edm::LuminosityBlock const &, edm::EventSetup const &, LuminosityBlockContext const *)
 
static std::shared_ptr< dqmDetails::NoCacheglobalBeginRunSummary (edm::Run const &, edm::EventSetup const &, RunContext const *)
 
static void globalEndLuminosityBlockSummary (edm::LuminosityBlock const &, edm::EventSetup const &, LuminosityBlockContext const *, dqmDetails::NoCache *)
 
static void globalEndRunSummary (edm::Run const &, edm::EventSetup const &, RunContext const *, dqmDetails::NoCache *)
 
- Static Public Member Functions inherited from edm::stream::EDAnalyzerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 

Detailed Description

DQM Analysis of 4D DT segments, it produces plots about:

Author
G. Mila - INFN Torino

Definition at line 38 of file DTEfficiencyTask.h.

Constructor & Destructor Documentation

DTEfficiencyTask::DTEfficiencyTask ( const edm::ParameterSet pset)

Constructor.

Definition at line 37 of file DTEfficiencyTask.cc.

References debug, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), metProducer_cfi::parameters, and muonDTDigis_cfi::pset.

37  {
38 
39  debug = pset.getUntrackedParameter<bool>("debug",false);
40  // the name of the 4D rec hits collection
41  recHits4DToken_ = consumes<DTRecSegment4DCollection>(
42  edm::InputTag(pset.getParameter<string>("recHits4DLabel")));
43  // the name of the rechits collection
44  recHitToken_ = consumes<DTRecHitCollection>(
45  edm::InputTag(pset.getParameter<string>("recHitLabel")));
46 
47  parameters = pset;
48 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
edm::EDGetTokenT< DTRecHitCollection > recHitToken_
edm::EDGetTokenT< DTRecSegment4DCollection > recHits4DToken_
edm::ParameterSet parameters
DTEfficiencyTask::~DTEfficiencyTask ( )
virtual

Destructor.

Definition at line 51 of file DTEfficiencyTask.cc.

51  {
52 }

Member Function Documentation

void DTEfficiencyTask::analyze ( const edm::Event event,
const edm::EventSetup setup 
)
override

Definition at line 153 of file DTEfficiencyTask.cc.

References relativeConstraints::chamber, DTGeometry::chamber(), popcon2dropbox::copy(), funct::cos(), gather_cfg::cout, debug, SoftLeptonByDistance_cfi::distance, DTTopology::firstChannel(), edm::EventSetup::get(), mps_fire::i, DTTopology::lastChannel(), DTChamber::layer(), DTGeometry::layer(), DTWireId::layerId(), DTRangeMapAccessor::layersBySuperLayer(), GetRecoTauVFromDQM_MC_cff::next, rpcPointValidation_cfi::recHit, DTRecSegment2D::specificRecHits(), DTLayer::specificTopology(), DTSuperLayerId::superlayer(), DTLayerId::superlayerId(), DTChamber::superLayers(), PV3DBase< T, PVType, FrameType >::theta(), GeomDet::toGlobal(), GeomDet::toLocal(), PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

153  {
154 
155 
156  if(debug)
157  cout << "[DTEfficiencyTask] Analyze #Run: " << event.id().run()
158  << " #Event: " << event.id().event() << endl;
159 
160 
161  // Get the 4D segment collection from the event
163  event.getByToken(recHits4DToken_, all4DSegments);
164 
165  // Get the rechit collection from the event
166  Handle<DTRecHitCollection> dtRecHits;
167  event.getByToken(recHitToken_, dtRecHits);
168 
169  // Get the DT Geometry
170  ESHandle<DTGeometry> dtGeom;
171  setup.get<MuonGeometryRecord>().get(dtGeom);
172 
173  // Loop over all chambers containing a segment
174  DTRecSegment4DCollection::id_iterator chamberId;
175  for (chamberId = all4DSegments->id_begin();
176  chamberId != all4DSegments->id_end();
177  ++chamberId) {
178 
179  // Get the chamber
180  const DTChamber* chamber = dtGeom->chamber(*chamberId);
181 
182  // Get all 1D RecHits to be used for searches of hits not associated to segments and map them by wire
183  const vector<const DTSuperLayer*> SLayers = chamber->superLayers();
184  map<DTWireId, int> wireAnd1DRecHits;
185  for(vector<const DTSuperLayer*>::const_iterator superlayer = SLayers.begin();
186  superlayer != SLayers.end();
187  superlayer++) {
188  DTRecHitCollection::range range = dtRecHits->get(DTRangeMapAccessor::layersBySuperLayer((*superlayer)->id()));
189  // Loop over the rechits of this ChamberId
190  for (DTRecHitCollection::const_iterator rechit = range.first;
191  rechit!=range.second;
192  ++rechit){
193  wireAnd1DRecHits[(*rechit).wireId()] = (*rechit).wireId().wire();
194  }
195  }
196 
197 
198  // Get the 4D segment range for the corresponding ChamerId
199  DTRecSegment4DCollection::range range = all4DSegments->get(*chamberId);
200  int nsegm = distance(range.first, range.second);
201  if(debug)
202  cout << " Chamber: " << *chamberId << " has " << nsegm
203  << " 4D segments" << endl;
204 
205 
206  // Loop over the rechits of this ChamerId
207  for (DTRecSegment4DCollection::const_iterator segment4D = range.first;
208  segment4D!=range.second;
209  ++segment4D) {
210  if(debug)
211  cout << " == RecSegment dimension: " << (*segment4D).dimension() << endl;
212 
213  // If Station != 4 skip RecHits with dimension != 4
214  // For the Station 4 consider 2D RecHits
215  if((*chamberId).station() != 4 && (*segment4D).dimension() != 4) {
216  if(debug)
217  cout << "[DTEfficiencyTask]***Warning: RecSegment dimension is not 4 but "
218  << (*segment4D).dimension() << ", skipping!" << endl;
219  continue;
220  } else if((*chamberId).station() == 4 && (*segment4D).dimension() != 2) {
221  if(debug)
222  cout << "[DTEfficiencyTask]***Warning: RecSegment dimension is not 2 but "
223  << (*segment4D).dimension() << ", skipping!" << endl;
224  continue;
225  }
226 
227  vector<DTRecHit1D> recHits1D;
228  bool rPhi = false;
229  bool rZ = false;
230 
231  // Get 1D RecHits and select only events with 7 or 8 hits in phi and 3 or 4 hits in theta (if any)
232  const DTChamberRecSegment2D* phiSeg = (*segment4D).phiSegment();
233  vector<DTRecHit1D> phiRecHits = phiSeg->specificRecHits();
234  rPhi = true;
235  if(phiRecHits.size() < 7 || phiRecHits.size() > 8 ) {
236  if(debug)
237  cout << "[DTEfficiencyTask] Phi segments has: " << phiRecHits.size()
238  << " hits, skipping" << endl; // FIXME: info output
239  continue;
240  }
241  copy(phiRecHits.begin(), phiRecHits.end(), back_inserter(recHits1D));
242  const DTSLRecSegment2D* zSeg = 0;
243  if((*segment4D).dimension() == 4) {
244  rZ = true;
245  zSeg = (*segment4D).zSegment();
246  vector<DTRecHit1D> zRecHits = zSeg->specificRecHits();
247  if(zRecHits.size() < 3 || zRecHits.size() > 4 ) {
248  if(debug)
249  cout << "[DTEfficiencyTask] Theta segments has: " << zRecHits.size()
250  << " hits, skipping" << endl; // FIXME: info output
251  continue;
252  }
253  copy(zRecHits.begin(), zRecHits.end(), back_inserter(recHits1D));
254  }
255 
256  // Skip the segment if it has more than 1 hit on the same layer
257  vector<DTWireId> wireMap;
258  for(vector<DTRecHit1D>::const_iterator recHit1D = recHits1D.begin();
259  recHit1D != recHits1D.end();
260  recHit1D++) {
261  wireMap.push_back((*recHit1D).wireId());
262  }
263 
264  bool hitsOnSameLayer = false;
265  for(vector<DTWireId>::const_iterator channelId = wireMap.begin();
266  channelId != wireMap.end(); channelId++) {
267  vector<DTWireId>::const_iterator next = channelId;
268  next++;
269  for(vector<DTWireId>::const_iterator ite = next; ite != wireMap.end(); ite++) {
270  if((*channelId).layerId() == (*ite).layerId()) {
271  hitsOnSameLayer = true;
272  }
273  }
274  }
275  if(hitsOnSameLayer) {
276  if(debug)
277  cout << "[DTEfficiencyTask] This RecHit has 2 hits on the same layer, skipping!" << endl;
278  continue;
279  }
280 
281 
282  // Select 2D segments with angle smaller than 45 deg
283  LocalVector phiDirectionInChamber = (*phiSeg).localDirection();
284  if(rPhi && fabs(phiDirectionInChamber.x()/phiDirectionInChamber.z()) > 1) {
285  if(debug) {
286  cout << " RPhi segment has angle > 45 deg, skipping! " << endl;
287  cout << " Theta = " << phiDirectionInChamber.theta() << endl;
288  }
289  continue;
290  }
291  if(rZ) {
292  LocalVector zDirectionInChamber = (*zSeg).localDirection();
293  if(fabs(zDirectionInChamber.y()/zDirectionInChamber.z()) > 1) {
294  if(debug){
295  cout << " RZ segment has angle > 45 deg, skipping! " << endl;
296  cout << " Theta = " << zDirectionInChamber.theta() << endl;
297  }
298  continue;
299  }
300  }
301 
302 
303  // Skip if the 4D segment has only 10 hits
304  if(recHits1D.size() == 10) {
305  if(debug)
306  cout << "[DTEfficiencyTask] 4D Segment with only 10 hits, skipping!" << endl;
307  continue;
308  }
309 
310 
311  // Analyse the case of 11 recHits for MB1,MB2,MB3 and of 7 recHits for MB4
312  if((rPhi && recHits1D.size() == 7) || (rZ && recHits1D.size() == 11)) {
313 
314  if(debug) {
315  if(rPhi && recHits1D.size() == 7)
316  cout << "[DTEfficiencyTask] MB4 Segment with only 7 hits!" << endl;
317  if(rZ && recHits1D.size() == 11)
318  cout << "[DTEfficiencyTask] 4D Segment with only 11 hits!" << endl;
319  }
320 
321  // Find the layer without RecHits ----------------------------------------
322  const vector<const DTSuperLayer*> SupLayers = chamber->superLayers();
323  map<DTLayerId, bool> layerMap;
324  map<DTWireId, float> wireAndPosInChamberAtLayerZ;
325  // Loop over layers and wires to fill a map
326  for(vector<const DTSuperLayer*>::const_iterator superlayer = SupLayers.begin();
327  superlayer != SupLayers.end();
328  superlayer++) {
329  const vector<const DTLayer*> Layers = (*superlayer)->layers();
330  for(vector<const DTLayer*>::const_iterator layer = Layers.begin();
331  layer != Layers.end();
332  layer++) {
333  layerMap.insert(make_pair((*layer)->id(), false));
334  const int firstWire = dtGeom->layer((*layer)->id())->specificTopology().firstChannel();
335  const int lastWire = dtGeom->layer((*layer)->id())->specificTopology().lastChannel();
336  for(int i=firstWire; i - lastWire <= 0; i++) {
337  DTWireId wireId((*layer)->id(), i);
338  float wireX = (*layer)->specificTopology().wirePosition(wireId.wire());
339  LocalPoint wirePosInLay(wireX,0,0);
340  GlobalPoint wirePosGlob = (*layer)->toGlobal(wirePosInLay);
341  LocalPoint wirePosInChamber = chamber->toLocal(wirePosGlob);
342  if((*superlayer)->id().superlayer() == 1 || (*superlayer)->id().superlayer() == 3) {
343  wireAndPosInChamberAtLayerZ.insert(make_pair(wireId, wirePosInChamber.x()));
344  } else {
345  wireAndPosInChamberAtLayerZ.insert(make_pair(wireId, wirePosInChamber.y()));
346  }
347  }
348  }
349  }
350 
351  // Loop over segment 1D RecHit
352  map<DTLayerId, int> NumWireMap;
353  for(vector<DTRecHit1D>::const_iterator recHit = recHits1D.begin();
354  recHit != recHits1D.end();
355  recHit++) {
356  layerMap[(*recHit).wireId().layerId()]= true;
357  NumWireMap[(*recHit).wireId().layerId()]= (*recHit).wireId().wire();
358  }
359 
360  DTLayerId missLayerId;
361  //Loop over the map and find the layer without hits
362  for(map<DTLayerId, bool>::const_iterator iter = layerMap.begin();
363  iter != layerMap.end(); iter++) {
364  if(!(*iter).second) missLayerId = (*iter).first;
365  }
366  if(debug)
367  cout << "[DTEfficiencyTask] Layer without recHits is: " << missLayerId << endl;
368  // -------------------------------------------------------
369 
370  const DTLayer* missLayer = chamber->layer(missLayerId);
371 
372  LocalPoint missLayerPosInChamber = chamber->toLocal(missLayer->toGlobal(LocalPoint(0,0,0)));
373 
374  // Segment position at Wire z in chamber local frame
375  LocalPoint segPosAtZLayer = (*segment4D).localPosition()
376  + (*segment4D).localDirection()*missLayerPosInChamber.z()/cos((*segment4D).localDirection().theta());
377 
378  DTWireId missWireId;
379 
380  // Find the id of the cell without hit ---------------------------------------------------
381  for(map<DTWireId, float>::const_iterator wireAndPos = wireAndPosInChamberAtLayerZ.begin();
382  wireAndPos != wireAndPosInChamberAtLayerZ.end();
383  wireAndPos++) {
384  DTWireId wireId = (*wireAndPos).first;
385  if(wireId.layerId() == missLayerId) {
386  if(missLayerId.superlayerId().superlayer() == 1 || missLayerId.superlayerId().superlayer() == 3 ) {
387  if(fabs(segPosAtZLayer.x() - (*wireAndPos).second) < 2.1)
388  missWireId = wireId;
389  } else {
390  if(fabs(segPosAtZLayer.y() - (*wireAndPos).second) < 2.1)
391  missWireId = wireId;
392  }
393  }
394  }
395  if(debug)
396  cout << "[DTEfficiencyTask] Cell without hit is: " << missWireId << endl;
397  // ----------------------------------------------------------
398 
399  bool foundUnAssRechit = false;
400 
401  // Look for unassociated hits in this cell
402  if(wireAnd1DRecHits.find(missWireId) != wireAnd1DRecHits.end()) {
403  if(debug)
404  cout << "[DTEfficiencyTask] Unassociated Hit found!" << endl;
405  foundUnAssRechit = true;
406  }
407 
408 
409  for(map<DTLayerId, bool>::const_iterator iter = layerMap.begin();
410  iter != layerMap.end(); iter++) {
411  if((*iter).second)
412  fillHistos((*iter).first, dtGeom->layer((*iter).first)->specificTopology().firstChannel(), dtGeom->layer((*iter).first)->specificTopology().lastChannel(), NumWireMap[(*iter).first]);
413  else
414  fillHistos((*iter).first, dtGeom->layer((*iter).first)->specificTopology().firstChannel(), dtGeom->layer((*iter).first)->specificTopology().lastChannel(), missWireId.wire(), foundUnAssRechit);
415  }
416 
417  } // End of the loop for segment with 7 or 11 recHits
418 
419  if((rPhi && recHits1D.size() == 8) || (rZ && recHits1D.size() == 12)) {
420  map<DTLayerId, int> NumWireMap;
421  DTLayerId LayerID;
422  for(vector<DTRecHit1D>::const_iterator recHit = recHits1D.begin();
423  recHit != recHits1D.end();
424  recHit++) {
425  LayerID = (*recHit).wireId().layerId();
426  NumWireMap[LayerID]= (*recHit).wireId().wire();
427  }
428  for(map<DTLayerId, int>::const_iterator iter = NumWireMap.begin();
429  iter != NumWireMap.end(); iter++) {
430  fillHistos((*iter).first, dtGeom->layer((*iter).first)->specificTopology().firstChannel(), dtGeom->layer((*iter).first)->specificTopology().lastChannel(), NumWireMap[(*iter).first]);
431  }
432  }
433 
434  } // End of loop over the 4D segments inside a sigle chamber
435  } // End of loop over all tha chamber with at least a 4D segment in the event
436 }
std::pair< const_iterator, const_iterator > range
iterator range
Definition: RangeMap.h:50
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
Definition: GeomDet.h:54
static std::pair< DTLayerId, DTSuperLayerIdComparator > layersBySuperLayer(DTSuperLayerId slId)
Access by SL objects written into a RangeMap by layer.
T y() const
Definition: PV3DBase.h:63
LocalPoint toLocal(const GlobalPoint &gp) const
Conversion to the R.F. of the GeomDet.
Definition: GeomDet.h:69
const DTLayer * layer(DTLayerId id) const
Return the layer corresponding to the given id.
Definition: DTChamber.cc:80
DTSuperLayerId superlayerId() const
Return the corresponding SuperLayerId.
Definition: DTLayerId.h:59
void fillHistos(DTLayerId lId, int firstWire, int lastWire, int numWire)
int firstChannel() const
Returns the wire number of the first wire.
Definition: DTTopology.h:78
Geom::Theta< T > theta() const
Definition: PV3DBase.h:75
const DTLayer * layer(DTLayerId id) const
Return a layer given its id.
Definition: DTGeometry.cc:110
edm::EDGetTokenT< DTRecHitCollection > recHitToken_
edm::EDGetTokenT< DTRecSegment4DCollection > recHits4DToken_
int lastChannel() const
Returns the wire number of the last wire.
Definition: DTTopology.h:80
const DTTopology & specificTopology() const
Definition: DTLayer.cc:42
const std::vector< const DTSuperLayer * > & superLayers() const
Return the superlayers in the chamber.
Definition: DTChamber.cc:60
T z() const
Definition: PV3DBase.h:64
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
std::vector< DTRecHit1D > specificRecHits() const
Access to specific components.
int superlayer() const
Return the superlayer number (deprecated method name)
const T & get() const
Definition: EventSetup.h:56
const DTChamber * chamber(DTChamberId id) const
Return a DTChamber given its id.
Definition: DTGeometry.cc:100
DTLayerId layerId() const
Return the corresponding LayerId.
Definition: DTWireId.h:62
T x() const
Definition: PV3DBase.h:62
void DTEfficiencyTask::beginLuminosityBlock ( edm::LuminosityBlock const &  lumiSeg,
edm::EventSetup const &  context 
)
overridevirtual

To reset the MEs.

Reimplemented from edm::stream::EDAnalyzerBase.

Definition at line 137 of file DTEfficiencyTask.cc.

References trackerHits::histo, mps_fire::i, edm::LuminosityBlockBase::id(), edm::LuminosityBlockID::luminosityBlock(), genParticles_cff::map, metProducer_cfi::parameters, and findQualityFiles::size.

137  {
138 
139 
140  if(lumiSeg.id().luminosityBlock()%parameters.getUntrackedParameter<int>("ResetCycle", 3) == 0) {
141  for(map<DTLayerId, vector<MonitorElement*> > ::const_iterator histo = histosPerL.begin();
142  histo != histosPerL.end();
143  histo++) {
144  int size = (*histo).second.size();
145  for(int i=0; i<size; i++){
146  (*histo).second[i]->Reset();
147  }
148  }
149  }
150 
151 }
size
Write out results.
T getUntrackedParameter(std::string const &, T const &) const
std::map< DTLayerId, std::vector< MonitorElement * > > histosPerL
edm::ParameterSet parameters
void DTEfficiencyTask::bookHistograms ( DQMStore::IBooker ibooker,
edm::Run const &  iRun,
edm::EventSetup const &  context 
)
overrideprotectedvirtual

Implements DQMEDAnalyzer.

Definition at line 62 of file DTEfficiencyTask.cc.

References DQMStore::IBooker::book1D(), DTSuperLayerId::chamberId(), gather_cfg::cout, debug, plotFactory::histos, DTLayerId::layer(), DTChamberId::sector(), DQMStore::IBooker::setCurrentFolder(), DTChamberId::station(), relativeConstraints::station, DTSuperLayerId::superlayer(), DTLayerId::superlayerId(), DTChamberId::wheel(), and makeMuonMisalignmentScenario::wheel.

62  {
63 
64  ibooker.setCurrentFolder("DT/DTEfficiencyTask");
65 
66  cout<<"[DTTestPulseTask]: booking"<<endl;
67 
68 
69  //here put the static booking loop
70 
71  // Loop over all the chambers
72  vector<const DTChamber*>::const_iterator ch_it = muonGeom->chambers().begin();
73  vector<const DTChamber*>::const_iterator ch_end = muonGeom->chambers().end();
74 
75  for (; ch_it != ch_end; ++ch_it) {
76 
77  // Loop over the SLs
78  vector<const DTSuperLayer*>::const_iterator sl_it = (*ch_it)->superLayers().begin();
79  vector<const DTSuperLayer*>::const_iterator sl_end = (*ch_it)->superLayers().end();
80 
81  for(; sl_it != sl_end; ++sl_it) {
82  DTSuperLayerId sl = (*sl_it)->id();
83  stringstream superLayer; superLayer << sl.superlayer();
84 
85  // Loop over the Ls
86  vector<const DTLayer*>::const_iterator l_it = (*sl_it)->layers().begin();
87  vector<const DTLayer*>::const_iterator l_end = (*sl_it)->layers().end();
88 
89  for(; l_it != l_end; ++l_it) {
90 
91  DTLayerId layerId = (*l_it)->id();
92  if(debug) cout << " Booking histos for L: " << layerId << endl;
93 
94  // Compose the chamber name
95  stringstream layer; layer << layerId.layer();
96  stringstream superLayer; superLayer << layerId.superlayer();
97  stringstream station; station << layerId.superlayerId().chamberId().station();
98  stringstream sector; sector << layerId.superlayerId().chamberId().sector();
99  stringstream wheel; wheel << layerId.superlayerId().chamberId().wheel();
100 
101  const int firstWire = (*l_it)->specificTopology().firstChannel();
102  const int lastWire = (*l_it)->specificTopology().lastChannel();
103 
104  string lHistoName =
105  "_W" + wheel.str() +
106  "_St" + station.str() +
107  "_Sec" + sector.str() +
108  "_SL" + superLayer.str()+
109  "_L" + layer.str();
110 
111  ibooker.setCurrentFolder("DT/DTEfficiencyTask/Wheel" + wheel.str() +
112  "/Station" + station.str() +
113  "/Sector" + sector.str() +
114  "/SuperLayer" +superLayer.str());
115 
116 
117  // Create the monitor elements
118  vector<MonitorElement *> histos;
119  // histo for hits associated to the 4D reconstructed segment
120  histos.push_back(ibooker.book1D(
121  "hEffOccupancy"+lHistoName, "4D segments recHits occupancy",lastWire-firstWire+1, firstWire-0.5, lastWire+0.5));
122  // histo for hits not associated to the segment
123  histos.push_back(ibooker.book1D(
124  "hEffUnassOccupancy"+lHistoName, "4D segments recHits and Hits not associated occupancy",
125  lastWire-firstWire+1, firstWire-0.5, lastWire+0.5));
126  // histo for cells associated to the 4D reconstructed segment
127  histos.push_back(ibooker.book1D(
128  "hRecSegmOccupancy"+lHistoName, "4D segments cells occupancy",lastWire-firstWire+1, firstWire-0.5, lastWire+0.5));
129 
130  histosPerL[layerId] = histos;
131 
132  } // layer
133  } // superlayer
134  } // chambers
135 }
edm::ESHandle< DTGeometry > muonGeom
const std::vector< const DTChamber * > & chambers() const
Return a vector of all Chamber.
Definition: DTGeometry.cc:85
DTChamberId chamberId() const
Return the corresponding ChamberId.
std::map< DTLayerId, std::vector< MonitorElement * > > histosPerL
int layer() const
Return the layer number.
Definition: DTLayerId.h:53
DTSuperLayerId superlayerId() const
Return the corresponding SuperLayerId.
Definition: DTLayerId.h:59
MonitorElement * book1D(Args &&...args)
Definition: DQMStore.h:115
int superlayer() const
Return the superlayer number (deprecated method name)
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:277
int sector() const
Definition: DTChamberId.h:61
int station() const
Return the station number.
Definition: DTChamberId.h:51
int wheel() const
Return the wheel number.
Definition: DTChamberId.h:45
void DTEfficiencyTask::dqmBeginRun ( const edm::Run run,
const edm::EventSetup context 
)
overrideprotected

BeginRun.

Definition at line 54 of file DTEfficiencyTask.cc.

References edm::EventSetup::get().

54  {
55 
56  // Get the geometry
57  context.get<MuonGeometryRecord>().get(muonGeom);
58 
59 }
edm::ESHandle< DTGeometry > muonGeom
const T & get() const
Definition: EventSetup.h:56
void DTEfficiencyTask::fillHistos ( DTLayerId  lId,
int  firstWire,
int  lastWire,
int  numWire 
)
private

Definition at line 440 of file DTEfficiencyTask.cc.

References plotFactory::histos.

442  {
443 
444  vector<MonitorElement *> histos = histosPerL[lId];
445  histos[0]->Fill(numWire);
446  histos[1]->Fill(numWire);
447  histos[2]->Fill(numWire);
448 }
std::map< DTLayerId, std::vector< MonitorElement * > > histosPerL
void DTEfficiencyTask::fillHistos ( DTLayerId  lId,
int  firstWire,
int  lastWire,
int  missingWire,
bool  UnassHit 
)
private

Definition at line 451 of file DTEfficiencyTask.cc.

References plotFactory::histos.

454  {
455 
456  vector<MonitorElement *> histos = histosPerL[lId];
457  if(unassHit)
458  histos[1]->Fill(missingWire);
459  histos[2]->Fill(missingWire);
460 }
std::map< DTLayerId, std::vector< MonitorElement * > > histosPerL

Member Data Documentation

bool DTEfficiencyTask::debug
private
std::map<DTLayerId, std::vector<MonitorElement*> > DTEfficiencyTask::histosPerL
private

Definition at line 79 of file DTEfficiencyTask.h.

edm::ESHandle<DTGeometry> DTEfficiencyTask::muonGeom
private

Definition at line 62 of file DTEfficiencyTask.h.

edm::ParameterSet DTEfficiencyTask::parameters
private
edm::EDGetTokenT<DTRecSegment4DCollection> DTEfficiencyTask::recHits4DToken_
private

Definition at line 68 of file DTEfficiencyTask.h.

edm::EDGetTokenT<DTRecHitCollection> DTEfficiencyTask::recHitToken_
private

Definition at line 71 of file DTEfficiencyTask.h.