CMS 3D CMS Logo

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

#include <DTResolutionAnalysisTask.h>

Inheritance diagram for DTResolutionAnalysisTask:
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)
 
void beginLuminosityBlock (edm::LuminosityBlock const &lumiSeg, edm::EventSetup const &context)
 To reset the MEs. More...
 
void bookHistograms (DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
 BookHistograms. More...
 
void dqmBeginRun (const edm::Run &, const edm::EventSetup &)
 BeginRun. More...
 
 DTResolutionAnalysisTask (const edm::ParameterSet &pset)
 Constructor. More...
 
virtual ~DTResolutionAnalysisTask ()
 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
 
 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
 
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Member Functions

void bookHistos (DQMStore::IBooker &ibooker, DTSuperLayerId slId)
 
void fillHistos (DTSuperLayerId slId, float distExtr, float residual)
 

Private Attributes

edm::ESHandle< DTGeometrydtGeom
 
std::map< DTSuperLayerId,
std::vector< MonitorElement * > > 
histosPerSL
 
int prescaleFactor
 
edm::EDGetTokenT
< DTRecSegment4DCollection
recHits4DToken_
 
int resetCycle
 
u_int32_t thePhiHitsCut
 
u_int32_t theZHitsCut
 
std::string topHistoFolder
 

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, GlobalCache
LuminosityBlockContext
 
typedef
CacheTypes::LuminosityBlockSummaryCache 
LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache,
GlobalCache
RunContext
 
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::NoCache
globalBeginLuminosityBlockSummary (edm::LuminosityBlock const &, edm::EventSetup const &, LuminosityBlockContext const *)
 
static std::shared_ptr
< dqmDetails::NoCache
globalBeginRunSummary (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)
 
- 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)
 

Detailed Description

Definition at line 34 of file DTResolutionAnalysisTask.h.

Constructor & Destructor Documentation

DTResolutionAnalysisTask::DTResolutionAnalysisTask ( const edm::ParameterSet pset)

Constructor.

Definition at line 35 of file DTResolutionAnalysisTask.cc.

References edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), HLT_25ns14e33_v1_cff::InputTag, and dtDQMClient_cfg::prescaleFactor.

35  {
36 
37  edm::LogVerbatim ("DTDQM|DTMonitorModule|DTResolutionAnalysisTask") << "[DTResolutionAnalysisTask] Constructor called!" << endl;
38 
39  // the name of the 4D rec hits collection
40  recHits4DToken_ = consumes<DTRecSegment4DCollection>(
41  edm::InputTag(pset.getParameter<string>("recHits4DLabel")));
42 
43  prescaleFactor = pset.getUntrackedParameter<int>("diagnosticPrescale", 1);
44  resetCycle = pset.getUntrackedParameter<int>("ResetCycle", -1);
45  // top folder for the histograms in DQMStore
46  topHistoFolder = pset.getUntrackedParameter<string>("topHistoFolder","DT/02-Segments");
47 
48  thePhiHitsCut = pset.getUntrackedParameter<u_int32_t>("phiHitsCut",8);
49  theZHitsCut = pset.getUntrackedParameter<u_int32_t>("zHitsCut",4);
50 
51 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
edm::EDGetTokenT< DTRecSegment4DCollection > recHits4DToken_
DTResolutionAnalysisTask::~DTResolutionAnalysisTask ( )
virtual

Destructor.

Definition at line 54 of file DTResolutionAnalysisTask.cc.

54  {
55 
56  edm::LogVerbatim ("DTDQM|DTMonitorModule|DTResolutionAnalysisTask") << "[DTResolutionAnalysisTask] Destructor called!" << endl;
57 
58 }

Member Function Documentation

void DTResolutionAnalysisTask::analyze ( const edm::Event event,
const edm::EventSetup setup 
)
virtual

Implements edm::stream::EDAnalyzerBase.

Definition at line 105 of file DTResolutionAnalysisTask.cc.

References filterCSVwithJSON::copy, funct::cos(), edm::HandleBase::isValid(), DTWireId::layerId(), DTRecSegment2D::specificRecHits(), DTLayer::specificTopology(), DTChamber::superLayer(), DTSuperLayerId::superlayer(), DTLayerId::superlayerId(), GeomDet::toGlobal(), GeomDet::toLocal(), DTWireId::wire(), DTTopology::wirePosition(), PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

105  {
106 
107  edm::LogVerbatim ("DTDQM|DTMonitorModule|DTResolutionAnalysisTask") << "[DTResolutionAnalysisTask] Analyze #Run: " << event.id().run()
108  << " #Event: " << event.id().event() << endl;
109 
110 
111  // Get the 4D segment collection from the event
113  event.getByToken(recHits4DToken_, all4DSegments);
114 
115  // check the validity of the collection
116  if(!all4DSegments.isValid()) return;
117 
118  // Loop over all chambers containing a segment
119  DTRecSegment4DCollection::id_iterator chamberId;
120  for (chamberId = all4DSegments->id_begin();
121  chamberId != all4DSegments->id_end();
122  ++chamberId) {
123  // Get the range for the corresponding ChamerId
124  DTRecSegment4DCollection::range range = all4DSegments->get(*chamberId);
125 
126  // Get the chamber
127  const DTChamber* chamber = dtGeom->chamber(*chamberId);
128 
129  // Loop over the rechits of this ChamerId
130  for (DTRecSegment4DCollection::const_iterator segment4D = range.first;
131  segment4D!=range.second;
132  ++segment4D) {
133 
134  // If Statio != 4 skip RecHits with dimension != 4
135  // For the Station 4 consider 2D RecHits
136  if((*chamberId).station() != 4 && (*segment4D).dimension() != 4) {
137  edm::LogVerbatim ("DTDQM|DTMonitorModule|DTResolutionAnalysisTask") << "[DTResolutionAnalysisTask]***Warning: RecSegment dimension is not 4 but "
138  << (*segment4D).dimension() << "!" << endl;
139  continue;
140  } else if((*chamberId).station() == 4 && (*segment4D).dimension() != 2) {
141  edm::LogVerbatim ("DTDQM|DTMonitorModule|DTResolutionAnalysisTask") << "[DTResolutionAnalysisTask]***Warning: RecSegment dimension is not 2 but "
142  << (*segment4D).dimension() << "!" << endl;
143  continue;
144  }
145 
146 
147  // Get all 1D RecHits at step 3 within the 4D segment
148  vector<DTRecHit1D> recHits1D_S3;
149 
150 
151  // Get 1D RecHits at Step 3 and select only events with
152  // 8 hits in phi and 4 hits in theta (if any)
153 
154  if((*segment4D).hasPhi()) { // has phi component
155  const DTChamberRecSegment2D* phiSeg = (*segment4D).phiSegment();
156  vector<DTRecHit1D> phiRecHits = phiSeg->specificRecHits();
157 
158  if(phiRecHits.size() < thePhiHitsCut) {
159  continue;
160  }
161  copy(phiRecHits.begin(), phiRecHits.end(), back_inserter(recHits1D_S3));
162  } else {
163 
164  }
165 
166  if((*segment4D).hasZed()) {
167  const DTSLRecSegment2D* zSeg = (*segment4D).zSegment();
168  vector<DTRecHit1D> zRecHits = zSeg->specificRecHits();
169  if(zRecHits.size() < theZHitsCut) {
170 
171  continue;
172  }
173  copy(zRecHits.begin(), zRecHits.end(), back_inserter(recHits1D_S3));
174  }
175 
176  // Loop over 1D RecHit inside 4D segment
177  for(vector<DTRecHit1D>::const_iterator recHit1D = recHits1D_S3.begin();
178  recHit1D != recHits1D_S3.end();
179  recHit1D++) {
180  const DTWireId wireId = (*recHit1D).wireId();
181 
182  // Get the layer and the wire position
183  const DTLayer* layer = chamber->superLayer(wireId.superlayerId())->layer(wireId.layerId());
184  float wireX = layer->specificTopology().wirePosition(wireId.wire());
185 
186  // Distance of the 1D rechit from the wire
187  float distRecHitToWire = fabs(wireX - (*recHit1D).localPosition().x());
188 
189  // Extrapolate the segment to the z of the wire
190 
191  // Get wire position in chamber RF
192  LocalPoint wirePosInLay(wireX,(*recHit1D).localPosition().y(),(*recHit1D).localPosition().z());
193  GlobalPoint wirePosGlob = layer->toGlobal(wirePosInLay);
194  LocalPoint wirePosInChamber = chamber->toLocal(wirePosGlob);
195 
196  // Segment position at Wire z in chamber local frame
197  LocalPoint segPosAtZWire = (*segment4D).localPosition()
198  + (*segment4D).localDirection()*wirePosInChamber.z()/cos((*segment4D).localDirection().theta());
199 
200  // Compute the distance of the segment from the wire
201  int sl = wireId.superlayer();
202 
203  double distSegmToWire = -1;
204  if(sl == 1 || sl == 3) {
205  // RPhi SL
206  distSegmToWire = fabs(wirePosInChamber.x() - segPosAtZWire.x());
207  } else if(sl == 2) {
208  // RZ SL
209  distSegmToWire = fabs(wirePosInChamber.y() - segPosAtZWire.y());
210  }
211 
212  if(distSegmToWire > 2.1)
213  edm::LogVerbatim ("DTDQM|DTMonitorModule|DTResolutionAnalysisTask") << " Warning: dist segment-wire: " << distSegmToWire << endl;
214 
215  double residual = distRecHitToWire - distSegmToWire;
216  // FIXME: Fill the histos
217  fillHistos(wireId.superlayerId(), distSegmToWire, residual);
218 
219  }// End of loop over 1D RecHit inside 4D segment
220  }// End of loop over the rechits of this ChamerId
221  }
222  // -----------------------------------------------------------------------------
223 }
float wirePosition(int wireNumber) const
Returns the x position in the layer of a given wire number.
Definition: DTTopology.cc:86
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:52
T y() const
Definition: PV3DBase.h:63
LocalPoint toLocal(const GlobalPoint &gp) const
Conversion to the R.F. of the GeomDet.
Definition: GeomDet.h:67
DTSuperLayerId superlayerId() const
Return the corresponding SuperLayerId.
Definition: DTLayerId.h:59
const DTTopology & specificTopology() const
Definition: DTLayer.cc:42
T z() const
Definition: PV3DBase.h:64
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
edm::EDGetTokenT< DTRecSegment4DCollection > recHits4DToken_
bool isValid() const
Definition: HandleBase.h:75
std::vector< DTRecHit1D > specificRecHits() const
Access to specific components.
int wire() const
Return the wire number.
Definition: DTWireId.h:56
int superlayer() const
Return the superlayer number (deprecated method name)
DTLayerId layerId() const
Return the corresponding LayerId.
Definition: DTWireId.h:62
void fillHistos(DTSuperLayerId slId, float distExtr, float residual)
T x() const
Definition: PV3DBase.h:62
edm::ESHandle< DTGeometry > dtGeom
const DTSuperLayer * superLayer(DTSuperLayerId id) const
Return the superlayer corresponding to the given id.
Definition: DTChamber.cc:65
void DTResolutionAnalysisTask::beginLuminosityBlock ( edm::LuminosityBlock const &  lumiSeg,
edm::EventSetup const &  context 
)
virtual

To reset the MEs.

Reimplemented from edm::stream::EDAnalyzerBase.

Definition at line 88 of file DTResolutionAnalysisTask.cc.

References timingPdfMaker::histo, i, edm::LuminosityBlockBase::id(), edm::LuminosityBlockID::luminosityBlock(), python.multivaluedict::map(), and findQualityFiles::size.

89  {
90 
91  edm::LogVerbatim ("DTDQM|DTMonitorModule|DTResolutionAnalysisTask") << "[DTResolutionTask]: Begin of LS transition"<<endl;
92 
93  if(resetCycle != -1 && lumiSeg.id().luminosityBlock() % resetCycle == 0) {
94  for(map<DTSuperLayerId, vector<MonitorElement*> > ::const_iterator histo = histosPerSL.begin();
95  histo != histosPerSL.end();
96  histo++) {
97  int size = (*histo).second.size();
98  for(int i=0; i<size; i++){
99  (*histo).second[i]->Reset();
100  }
101  }
102  }
103 }
int i
Definition: DBlmapReader.cc:9
std::map< DTSuperLayerId, std::vector< MonitorElement * > > histosPerSL
tuple size
Write out results.
void DTResolutionAnalysisTask::bookHistograms ( DQMStore::IBooker ibooker,
edm::Run const &  iRun,
edm::EventSetup const &   
)
overridevirtual

BookHistograms.

Implements DQMEDAnalyzer.

Definition at line 67 of file DTResolutionAnalysisTask.cc.

References bookHistos(), chambers, and DTChamberId::station().

69  {
70 
71  // Book the histograms
72  vector<const DTChamber*> chambers = dtGeom->chambers();
73  for(vector<const DTChamber*>::const_iterator chamber = chambers.begin();
74  chamber != chambers.end(); ++chamber) { // Loop over all chambers
75  DTChamberId dtChId = (*chamber)->id();
76  for(int sl = 1; sl <= 3; ++sl) { // Loop over SLs
77  if(dtChId.station() == 4 && sl == 2) continue;
78  const DTSuperLayerId dtSLId(dtChId,sl);
79  bookHistos(ibooker,dtSLId);
80  }
81  }
82 
83 }
void bookHistos(DQMStore::IBooker &ibooker, DTSuperLayerId slId)
int station() const
Return the station number.
Definition: DTChamberId.h:51
static char chambers[264][20]
Definition: ReadPGInfo.cc:243
edm::ESHandle< DTGeometry > dtGeom
void DTResolutionAnalysisTask::bookHistos ( DQMStore::IBooker ibooker,
DTSuperLayerId  slId 
)
private

Definition at line 227 of file DTResolutionAnalysisTask.cc.

References DQMStore::IBooker::book1D(), mergeVDriftHistosByStation::histos, DTChamberId::sector(), DQMStore::IBooker::setCurrentFolder(), DTChamberId::station(), relativeConstraints::station, DTSuperLayerId::superlayer(), and DTChamberId::wheel().

227  {
228 
229  edm::LogVerbatim ("DTDQM|DTMonitorModule|DTResolutionAnalysisTask") << " Booking histos for SL: " << slId << endl;
230 
231  // Compose the chamber name
232  stringstream wheel; wheel << slId.wheel();
233  stringstream station; station << slId.station();
234  stringstream sector; sector << slId.sector();
235  stringstream superLayer; superLayer << slId.superlayer();
236 
237 
238  string slHistoName =
239  "_W" + wheel.str() +
240  "_St" + station.str() +
241  "_Sec" + sector.str() +
242  "_SL" + superLayer.str();
243 
244  ibooker.setCurrentFolder(topHistoFolder + "/Wheel" + wheel.str() +
245  "/Sector" + sector.str() +
246  "/Station" + station.str());
247  // Create the monitor elements
248  vector<MonitorElement *> histos;
249  // Note the order matters
250  histos.push_back(ibooker.book1D("hResDist"+slHistoName,
251  "Residuals on the distance from wire (rec_hit - segm_extr) (cm)",
252  200, -0.4, 0.4));
253  histosPerSL[slId] = histos;
254 }
MonitorElement * book1D(Args &&...args)
Definition: DQMStore.h:115
std::map< DTSuperLayerId, std::vector< MonitorElement * > > histosPerSL
int superlayer() const
Return the superlayer number (deprecated method name)
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:274
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 DTResolutionAnalysisTask::dqmBeginRun ( const edm::Run run,
const edm::EventSetup setup 
)
virtual

BeginRun.

Reimplemented from DQMEDAnalyzer.

Definition at line 60 of file DTResolutionAnalysisTask.cc.

References edm::EventSetup::get().

60  {
61 
62  // Get the DT Geometry
63  setup.get<MuonGeometryRecord>().get(dtGeom);
64 
65 }
const T & get() const
Definition: EventSetup.h:55
edm::ESHandle< DTGeometry > dtGeom
void DTResolutionAnalysisTask::fillHistos ( DTSuperLayerId  slId,
float  distExtr,
float  residual 
)
private

Definition at line 258 of file DTResolutionAnalysisTask.cc.

References mergeVDriftHistosByStation::histos.

260  {
261  vector<MonitorElement *> histos = histosPerSL[slId];
262  histos[0]->Fill(residual);
263 }
std::map< DTSuperLayerId, std::vector< MonitorElement * > > histosPerSL

Member Data Documentation

edm::ESHandle<DTGeometry> DTResolutionAnalysisTask::dtGeom
private

Definition at line 59 of file DTResolutionAnalysisTask.h.

std::map<DTSuperLayerId, std::vector<MonitorElement*> > DTResolutionAnalysisTask::histosPerSL
private

Definition at line 77 of file DTResolutionAnalysisTask.h.

int DTResolutionAnalysisTask::prescaleFactor
private

Definition at line 61 of file DTResolutionAnalysisTask.h.

edm::EDGetTokenT<DTRecSegment4DCollection> DTResolutionAnalysisTask::recHits4DToken_
private

Definition at line 68 of file DTResolutionAnalysisTask.h.

int DTResolutionAnalysisTask::resetCycle
private

Definition at line 62 of file DTResolutionAnalysisTask.h.

u_int32_t DTResolutionAnalysisTask::thePhiHitsCut
private

Definition at line 64 of file DTResolutionAnalysisTask.h.

u_int32_t DTResolutionAnalysisTask::theZHitsCut
private

Definition at line 65 of file DTResolutionAnalysisTask.h.

std::string DTResolutionAnalysisTask::topHistoFolder
private

Definition at line 80 of file DTResolutionAnalysisTask.h.