CMS 3D CMS Logo

List of all members | Classes | Public Types | Public Member Functions | Private Member Functions | Private Attributes
MuonTrackResidualAnalyzer Class Reference

#include <MuonTrackResidualAnalyzer.h>

Inheritance diagram for MuonTrackResidualAnalyzer:
DQMOneEDAnalyzer<> edm::one::EDProducer< edm::EndRunProducer, edm::one::WatchRuns, edm::Accumulator, Args... > edm::one::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Classes

struct  RadiusComparatorInOut
 

Public Types

enum  EtaRange { all, barrel, endcap }
 
- Public Types inherited from DQMOneEDAnalyzer<>
typedef dqm::reco::DQMStore DQMStore
 
typedef dqm::reco::MonitorElement MonitorElement
 
- Public Types inherited from edm::one::EDProducerBase
typedef EDProducerBase ModuleType
 
- Public Types inherited from edm::ProducerBase
using ModuleToResolverIndicies = std::unordered_multimap< std::string, std::tuple< edm::TypeID const *, const char *, edm::ProductResolverIndex > >
 
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 

Public Member Functions

void analyze (const edm::Event &event, const edm::EventSetup &eventSetup) override
 
void bookHistograms (DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
 
void dqmEndRun (edm::Run const &, edm::EventSetup const &) override
 
 MuonTrackResidualAnalyzer (const edm::ParameterSet &ps)
 Constructor. More...
 
 ~MuonTrackResidualAnalyzer () override
 Destructor. More...
 
- Public Member Functions inherited from DQMOneEDAnalyzer<>
void accumulate (edm::Event const &event, edm::EventSetup const &setup) override
 
void beginRun (edm::Run const &run, edm::EventSetup const &setup) final
 
 DQMOneEDAnalyzer ()
 
void endRun (edm::Run const &, edm::EventSetup const &) final
 
void endRunProduce (edm::Run &run, edm::EventSetup const &setup) final
 
virtual bool getCanSaveByLumi ()
 
- Public Member Functions inherited from edm::one::EDProducer< edm::EndRunProducer, edm::one::WatchRuns, edm::Accumulator, Args... >
 EDProducer ()=default
 
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
- Public Member Functions inherited from edm::one::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
bool wantsStreamLuminosityBlocks () const
 
bool wantsStreamRuns () const
 
 ~EDProducerBase () override
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
std::vector< edm::ProductResolverIndex > const & putTokenIndexToProductResolverIndex () const
 
std::vector< bool > const & recordProvenanceList () const
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, ModuleToResolverIndicies const &iIndicies, std::string const &moduleLabel)
 
TypeLabelList const & typeLabelList () const
 used by the fwk to register the list of products of this module More...
 
 ~ProducerBase () noexcept(false) override
 
- 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 &&)=default
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
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
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Member Functions

void computeResolution (Trajectory &trajectory, std::map< DetId, const PSimHit * > &hitIdMap, HResolution1DRecHit *histos)
 
bool isInTheAcceptance (double eta)
 
std::map< DetId, const PSimHit * > mapMuSimHitsPerId (edm::Handle< edm::PSimHitContainer > dtSimhits, edm::Handle< edm::PSimHitContainer > cscSimhits, edm::Handle< edm::PSimHitContainer > rpcSimhits)
 
void mapMuSimHitsPerId (edm::Handle< edm::PSimHitContainer > simhits, std::map< DetId, const PSimHit * > &hitIdMap)
 

Private Attributes

edm::InputTag cscSimHitLabel
 
DQMStoredbe_
 
std::string dirName_
 
edm::InputTag dtSimHitLabel
 
HResolution1DRecHith1DRecHitRes
 
HResolution1DRecHith1DSimHitRes
 
MonitorElementhDeltaPtVsEtaSim
 
MonitorElementhDeltaPtVsEtaSim2
 
MonitorElementhDPtRef
 
MonitorElementhSimHitsPerTrack
 
MonitorElementhSimHitsPerTrackVsEta
 
std::string out
 
edm::ParameterSet pset
 
edm::InputTag rpcSimHitLabel
 
std::string subsystemname_
 
edm::EDGetTokenT< std::vector< PSimHit > > theCSCSimHitToken
 
edm::InputTag theDataType
 
edm::EDGetTokenT< edm::SimTrackContainertheDataTypeToken
 
edm::EDGetTokenT< std::vector< PSimHit > > theDTSimHitToken
 
MeasurementEstimatortheEstimator
 
EtaRange theEtaRange
 
int theMuonSimHitNumberPerEvent
 
edm::InputTag theMuonTrackLabel
 
edm::EDGetTokenT< reco::TrackCollectiontheMuonTrackToken
 
edm::EDGetTokenT< std::vector< PSimHit > > theRPCSimHitToken
 
MuonServiceProxytheService
 
std::vector< const PSimHit * > theSimHitContainer
 
unsigned int theSimTkId
 
KFUpdatortheUpdator
 

Additional Inherited Members

- Static Public Member Functions inherited from edm::one::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from DQMOneEDAnalyzer<>
virtual void bookHistograms (DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &)=0
 
virtual void dqmBeginRun (edm::Run const &, edm::EventSetup const &)
 
- Protected Member Functions inherited from edm::ProducerBase
template<class ProductType >
BranchAliasSetterT< ProductType > produces ()
 declare what type of product will make and with which optional label More...
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces ()
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces ()
 
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<BranchType B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<Transition B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
ProducesCollector producesCollector ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (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 ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
- Protected Attributes inherited from DQMOneEDAnalyzer<>
edm::EDPutTokenT< DQMTokenrunToken_
 

Detailed Description

No description available.

Author
R. Bellan - INFN Torino ricca.nosp@m.rdo..nosp@m.bella.nosp@m.n@ce.nosp@m.rn.ch

Definition at line 40 of file MuonTrackResidualAnalyzer.h.

Member Enumeration Documentation

◆ EtaRange

Enumerator
all 
barrel 
endcap 

Definition at line 42 of file MuonTrackResidualAnalyzer.h.

42 { all, barrel, endcap };

Constructor & Destructor Documentation

◆ MuonTrackResidualAnalyzer()

MuonTrackResidualAnalyzer::MuonTrackResidualAnalyzer ( const edm::ParameterSet ps)

Constructor.

Definition at line 38 of file MuonTrackResidualAnalyzer.cc.

38  {
39  pset = ps;
40  // service parameters
41  ParameterSet serviceParameters = pset.getParameter<ParameterSet>("ServiceParameters");
42  // the services
43  theService = new MuonServiceProxy(serviceParameters, consumesCollector());
44 
46  theMuonTrackToken = consumes<reco::TrackCollection>(theMuonTrackLabel);
47 
48  cscSimHitLabel = pset.getParameter<InputTag>("CSCSimHit");
49  dtSimHitLabel = pset.getParameter<InputTag>("DTSimHit");
50  rpcSimHitLabel = pset.getParameter<InputTag>("RPCSimHit");
51  theCSCSimHitToken = consumes<std::vector<PSimHit> >(cscSimHitLabel);
52  theDTSimHitToken = consumes<std::vector<PSimHit> >(dtSimHitLabel);
53  theRPCSimHitToken = consumes<std::vector<PSimHit> >(rpcSimHitLabel);
54 
55  dbe_ = edm::Service<DQMStore>().operator->();
56  out = pset.getUntrackedParameter<string>("rootFileName");
58  subsystemname_ = pset.getUntrackedParameter<std::string>("subSystemFolder", "YourSubsystem");
59 
60  // Sim or Real
61  theDataType = pset.getParameter<InputTag>("DataType");
62  if (theDataType.label() != "RealData" && theDataType.label() != "SimData")
63  LogDebug("MuonTrackResidualAnalyzer") << "Error in Data Type!!";
64  theDataTypeToken = consumes<edm::SimTrackContainer>(theDataType);
65 
66  theEtaRange = (EtaRange)pset.getParameter<int>("EtaRange");
67 
68  theUpdator = new KFUpdator();
70 
72 }

References Chi2MeasurementEstimator_cfi::Chi2MeasurementEstimator, dbe_, MuonAnalyzers_cfi::EtaRange, LogDebug, MuonServiceProxy_cff::MuonServiceProxy, MillePedeFileConverter_cfg::out, muonDTDigis_cfi::pset, and AlCaHLTBitMon_QueryRunRegistry::string.

◆ ~MuonTrackResidualAnalyzer()

MuonTrackResidualAnalyzer::~MuonTrackResidualAnalyzer ( )
override

Destructor.

Definition at line 75 of file MuonTrackResidualAnalyzer.cc.

75  {
76  delete theUpdator;
77  delete theEstimator;
78  delete theService;
79 }

Member Function Documentation

◆ analyze()

void MuonTrackResidualAnalyzer::analyze ( const edm::Event event,
const edm::EventSetup eventSetup 
)
overridevirtual

Reimplemented from DQMOneEDAnalyzer<>.

Definition at line 122 of file MuonTrackResidualAnalyzer.cc.

122  {
123  LogDebug("MuonTrackResidualAnalyzer") << "Analyze";
124 
125  // Update the services
126  theService->update(eventSetup);
129 
130  // Get the SimHit collection from the event
131  Handle<PSimHitContainer> dtSimHits;
132  event.getByToken(theDTSimHitToken, dtSimHits);
133 
134  Handle<PSimHitContainer> cscSimHits;
135  event.getByToken(theCSCSimHitToken, cscSimHits);
136 
137  Handle<PSimHitContainer> rpcSimHits;
138  event.getByToken(theRPCSimHitToken, rpcSimHits);
139 
141 
142  // FIXME Add the tracker one??
143 
144  // Map simhits per DetId
145  map<DetId, const PSimHit *> muonSimHitsPerId = mapMuSimHitsPerId(dtSimHits, cscSimHits, rpcSimHits);
146 
148 
149  double etaSim = 0;
150 
151  if (theDataType.label() == "SimData") {
152  // Get the SimTrack collection from the event
153  event.getByToken(theDataTypeToken, simTracks);
154 
155  // Loop over the Sim tracks
156  SimTrackContainer::const_iterator simTrack;
157 
158  for (simTrack = simTracks->begin(); simTrack != simTracks->end(); ++simTrack)
159  if (abs((*simTrack).type()) == 13) {
160  hSimHitsPerTrackVsEta->Fill((*simTrack).momentum().eta(), theMuonSimHitNumberPerEvent);
161  etaSim = (*simTrack).momentum().eta();
162  theSimTkId = (*simTrack).trackId();
163  }
164  }
165 
166  // Get the RecTrack collection from the event
168  event.getByToken(theMuonTrackToken, muonTracks);
169 
170  reco::TrackCollection::const_iterator muonTrack;
171 
172  // Loop over the Rec tracks
173  for (muonTrack = muonTracks->begin(); muonTrack != muonTracks->end(); ++muonTrack) {
174  reco::TransientTrack track(*muonTrack, &*theService->magneticField(), theService->trackingGeometry());
175 
176  TrajectoryStateOnSurface outerTSOS = track.outermostMeasurementState();
177  TrajectoryStateOnSurface innerTSOS = track.innermostMeasurementState();
178 
180 
181  // SimHit Energy loss analysis
182  double momAtEntry = -150., momAtExit = -150.;
183 
184  if (theSimHitContainer.size() > 1) {
185  const GeomDet *geomDetA = theService->trackingGeometry()->idToDet(DetId(theSimHitContainer.front()->detUnitId()));
186  double distA = geomDetA->toGlobal(theSimHitContainer.front()->localPosition()).mag();
187 
188  const GeomDet *geomDetB = theService->trackingGeometry()->idToDet(DetId(theSimHitContainer.back()->detUnitId()));
189  double distB = geomDetB->toGlobal(theSimHitContainer.back()->localPosition()).mag();
190 
191  LogTrace("MuonTrackResidualAnalyzer")
192  << "Inner SimHit: " << theSimHitContainer.front()->particleType()
193  << " Pt: " << theSimHitContainer.front()->momentumAtEntry().perp()
194  << " E: " << theSimHitContainer.front()->momentumAtEntry().perp() << " R: " << distA << endl;
195  LogTrace("MuonTrackResidualAnalyzer")
196  << "Outer SimHit: " << theSimHitContainer.back()->particleType()
197  << " Pt: " << theSimHitContainer.back()->momentumAtEntry().perp()
198  << " E: " << theSimHitContainer.front()->momentumAtEntry().perp() << " R: " << distB << endl;
199 
200  momAtEntry = theSimHitContainer.front()->momentumAtEntry().perp();
201  momAtExit = theSimHitContainer.back()->momentumAtEntry().perp();
202  }
203 
204  trackingRecHit_iterator rhFirst = track.recHitsBegin();
205  trackingRecHit_iterator rhLast = track.recHitsEnd() - 1;
206  map<DetId, const PSimHit *>::const_iterator itFirst = muonSimHitsPerId.find((*rhFirst)->geographicalId());
207  map<DetId, const PSimHit *>::const_iterator itLast = muonSimHitsPerId.find((*rhLast)->geographicalId());
208 
209  double momAtEntry2 = -150, momAtExit2 = -150.;
210  if (itFirst != muonSimHitsPerId.end())
211  momAtEntry2 = itFirst->second->momentumAtEntry().perp();
212  else {
213  LogDebug("MuonTrackResidualAnalyzer") << "No first sim hit found";
214  ++rhFirst;
215  itFirst = muonSimHitsPerId.find((*rhFirst)->geographicalId());
216  if (itFirst != muonSimHitsPerId.end())
217  momAtEntry2 = itFirst->second->momentumAtEntry().perp();
218  else {
219  LogDebug("MuonTrackResidualAnalyzer") << "No second sim hit found";
220  // continue;
221  }
222  }
223 
224  if (itLast != muonSimHitsPerId.end())
225  momAtExit2 = itLast->second->momentumAtEntry().perp();
226  else {
227  LogDebug("MuonTrackResidualAnalyzer") << "No last sim hit found";
228  --rhLast;
229  itLast = muonSimHitsPerId.find((*rhLast)->geographicalId());
230  if (itLast != muonSimHitsPerId.end())
231  momAtExit2 = itLast->second->momentumAtEntry().perp();
232  else {
233  LogDebug("MuonTrackResidualAnalyzer") << "No last but one sim hit found";
234  // continue;
235  }
236  }
237 
238  if (etaSim) {
239  if (momAtEntry >= 0 && momAtExit >= 0)
240  hDeltaPtVsEtaSim->Fill(etaSim, momAtEntry - momAtExit);
241  if (momAtEntry2 >= 0 && momAtExit2 >= 0)
242  hDeltaPtVsEtaSim2->Fill(etaSim, momAtEntry2 - momAtExit2);
243  } else
244  LogDebug("MuonTrackResidualAnalyzer") << "NO SimTrack'eta";
245  //
246 
247  // computeResolution(trajectoryBW,muonSimHitsPerId,h1DSimHitRes);
248  // computeResolution(smoothed,muonSimHitsPerId,h1DSimHitRes);
249  }
250 }

References funct::abs(), debug, LogDebug, LogTrace, mag(), mps_fire::result, muonSimHitMatcherPSet::simTrack, TrackCandidateProducer_cfi::simTracks, GeomDet::toGlobal(), and HLT_2018_cff::track.

◆ bookHistograms()

void MuonTrackResidualAnalyzer::bookHistograms ( DQMStore::IBooker ibooker,
edm::Run const &  iRun,
edm::EventSetup const &   
)
override

Definition at line 81 of file MuonTrackResidualAnalyzer.cc.

83  {
84  LogDebug("MuonTrackResidualAnalyzer") << "Begin Run";
85 
86  ibooker.cd();
88  string dirName = dirName_;
89  if (!algo.process().empty())
90  dirName += algo.process() + "_";
91  if (!algo.label().empty())
92  dirName += algo.label() + "_";
93  if (!algo.instance().empty())
94  dirName += algo.instance() + "";
95  if (dirName.find("Tracks") < dirName.length()) {
96  dirName.replace(dirName.find("Tracks"), 6, "");
97  }
98  std::replace(dirName.begin(), dirName.end(), ':', '_');
99  ibooker.setCurrentFolder(dirName);
100 
101  hDPtRef = ibooker.book1D("DeltaPtRef", "P^{in}_{t}-P^{in ref}", 10000, -20, 20);
102 
103  // Resolution wrt the 1D Rec Hits
104  // h1DRecHitRes = new HResolution1DRecHit("TotalRec");
105 
106  // Resolution wrt the 1d Sim Hits
107  // h1DSimHitRes = new HResolution1DRecHit("TotalSim");
108 
109  hSimHitsPerTrack = ibooker.book1D("SimHitsPerTrack", "Number of sim hits per track", 55, 0, 55);
111  ibooker.book2D("SimHitsPerTrackVsEta", "Number of sim hits per track VS #eta", 120, -3., 3., 55, 0, 55);
113  ibooker.book2D("DeltaPtVsEtaSim", "#Delta P_{t} vs #eta gen, sim quantity", 120, -3., 3., 500, -250., 250.);
115  ibooker.book2D("DeltaPtVsEtaSim2", "#Delta P_{t} vs #eta gen, sim quantity", 120, -3., 3., 500, -250., 250.);
116 }

References dqm::implementation::IBooker::book1D(), dqm::implementation::IBooker::book2D(), dqm::implementation::NavigatorBase::cd(), TrackerOfflineValidation_Dqm_cff::dirName, LogDebug, python.rootplot.root2matplotlib::replace(), and dqm::implementation::NavigatorBase::setCurrentFolder().

◆ computeResolution()

void MuonTrackResidualAnalyzer::computeResolution ( Trajectory trajectory,
std::map< DetId, const PSimHit * > &  hitIdMap,
HResolution1DRecHit histos 
)
private

Definition at line 320 of file MuonTrackResidualAnalyzer.cc.

322  {
324 
325  for (Trajectory::DataContainer::const_iterator datum = data.begin(); datum != data.end(); ++datum) {
326  GlobalPoint fitPoint = datum->updatedState().globalPosition();
327 
328  // FIXME!
329  // double errX = datum->updatedState().cartesianError().matrix()[0][0];
330  // double errY = datum->updatedState().cartesianError().matrix()[1][1];
331  // double errZ = datum->updatedState().cartesianError().matrix()[2][2];
332  //
333  double errX = datum->updatedState().localError().matrix()(3, 3);
334  double errY = datum->updatedState().localError().matrix()(4, 4);
335  double errZ = 1.;
336 
337  map<DetId, const PSimHit *>::const_iterator it = hitIdMap.find(datum->recHit()->geographicalId());
338 
339  if (it == hitIdMap.end())
340  continue; // FIXME! Put a counter
341 
342  const PSimHit *simhit = it->second;
343 
344  LocalPoint simHitPoint = simhit->localPosition();
345 
346  const GeomDet *geomDet = theService->trackingGeometry()->idToDet(DetId(simhit->detUnitId()));
347 
348  LocalPoint fitLocalPoint = geomDet->toLocal(fitPoint);
349 
350  LocalVector diff = fitLocalPoint - simHitPoint;
351 
352  cout << "SimHit position " << simHitPoint << endl;
353  cout << "Fit position " << fitLocalPoint << endl;
354  cout << "Fit position2 " << datum->updatedState().localPosition() << endl;
355  cout << "Errors on the fit position: (" << errX << "," << errY << "," << errZ << ")" << endl;
356  cout << "Resolution on x: " << diff.x() / abs(simHitPoint.x()) << endl;
357  cout << "Resolution on y: " << diff.y() / abs(simHitPoint.y()) << endl;
358  cout << "Resolution on z: " << diff.z() / abs(simHitPoint.z()) << endl;
359 
360  cout << "Eta direction: " << simhit->momentumAtEntry().eta() << " eta position: " << simHitPoint.eta() << endl;
361  cout << "Phi direction: " << simhit->momentumAtEntry().phi() << " phi position: " << simHitPoint.phi() << endl;
362 
363  histos->Fill(simHitPoint.x(),
364  simHitPoint.y(),
365  simHitPoint.z(),
366  diff.x(),
367  diff.y(),
368  diff.z(),
369  errX,
370  errY,
371  errZ,
372  simhit->momentumAtEntry().eta(),
373  simhit->momentumAtEntry().phi());
374  // simHitPoint.eta(), simHitPoint.phi() ); // FIXME!
375  }
376 }

References funct::abs(), gather_cfg::cout, std::data(), PSimHit::detUnitId(), change_name::diff, fftjetvertexadder_cfi::errX, fftjetvertexadder_cfi::errY, fftjetvertexadder_cfi::errZ, PV3DBase< T, PVType, FrameType >::eta(), combine::histos, PSimHit::localPosition(), Trajectory::measurements(), PSimHit::momentumAtEntry(), PV3DBase< T, PVType, FrameType >::phi(), Geom::Phi< T1, Range >::phi(), and GeomDet::toLocal().

◆ dqmEndRun()

void MuonTrackResidualAnalyzer::dqmEndRun ( edm::Run const &  ,
edm::EventSetup const &   
)
overridevirtual

Reimplemented from DQMOneEDAnalyzer<>.

Definition at line 118 of file MuonTrackResidualAnalyzer.cc.

118  {
119  if (!out.empty() && dbe_)
120  dbe_->save(out);
121 }

References dbe_, MillePedeFileConverter_cfg::out, and dqm::implementation::DQMStore::save().

◆ isInTheAcceptance()

bool MuonTrackResidualAnalyzer::isInTheAcceptance ( double  eta)
private

Definition at line 252 of file MuonTrackResidualAnalyzer.cc.

252  {
253  switch (theEtaRange) {
254  case all:
255  return (abs(eta) <= 2.4) ? true : false;
256  case barrel:
257  return (abs(eta) < 1.1) ? true : false;
258  case endcap:
259  return (abs(eta) >= 1.1 && abs(eta) <= 2.4) ? true : false;
260  default: {
261  LogDebug("MuonTrackResidualAnalyzer") << "No correct Eta range selected!! ";
262  return false;
263  }
264  }
265 }

References funct::abs(), python.cmstools::all(), Reference_intrackfit_cff::barrel, makeMuonMisalignmentScenario::endcap, PVValHelper::eta, LogDebug, and funct::true.

◆ mapMuSimHitsPerId() [1/2]

map< DetId, const PSimHit * > MuonTrackResidualAnalyzer::mapMuSimHitsPerId ( edm::Handle< edm::PSimHitContainer dtSimhits,
edm::Handle< edm::PSimHitContainer cscSimhits,
edm::Handle< edm::PSimHitContainer rpcSimhits 
)
private

Definition at line 268 of file MuonTrackResidualAnalyzer.cc.

270  {
272 
273  map<DetId, const PSimHit *> hitIdMap;
274  theSimHitContainer.clear();
275 
276  mapMuSimHitsPerId(dtSimhits, hitIdMap);
277  mapMuSimHitsPerId(cscSimhits, hitIdMap);
278  mapMuSimHitsPerId(rpcSimhits, hitIdMap);
279 
280  if (theSimHitContainer.size() > 1)
281  stable_sort(
282  theSimHitContainer.begin(), theSimHitContainer.end(), RadiusComparatorInOut(theService->trackingGeometry()));
283 
284  LogDebug("MuonTrackResidualAnalyzer") << "Sim Hit list";
285  int count = 1;
286  for (vector<const PSimHit *>::const_iterator it = theSimHitContainer.begin(); it != theSimHitContainer.end(); ++it) {
287  LogTrace("MuonTrackResidualAnalyzer")
288  << count << " "
289  << " Process Type: " << (*it)->processType() << " " << debug.dumpMuonId(DetId((*it)->detUnitId())) << endl;
290  }
291 
292  return hitIdMap;
293 }

References KineDebug3::count(), debug, LogDebug, and LogTrace.

◆ mapMuSimHitsPerId() [2/2]

void MuonTrackResidualAnalyzer::mapMuSimHitsPerId ( edm::Handle< edm::PSimHitContainer simhits,
std::map< DetId, const PSimHit * > &  hitIdMap 
)
private

Definition at line 295 of file MuonTrackResidualAnalyzer.cc.

296  {
297  for (PSimHitContainer::const_iterator simhit = simhits->begin(); simhit != simhits->end(); ++simhit) {
298  if (abs(simhit->particleType()) != 13 && theSimTkId != simhit->trackId())
299  continue;
300 
301  theSimHitContainer.push_back(&*simhit);
302  DetId id = DetId(simhit->detUnitId());
303 
304  if (id.subdetId() == MuonSubdetId::DT) {
305  DTLayerId lId(id.rawId());
306  id = DetId(lId.rawId());
307  }
308 
309  map<DetId, const PSimHit *>::const_iterator it = hitIdMap.find(id);
310 
311  if (it == hitIdMap.end())
312  hitIdMap[id] = &*simhit;
313  else
314  LogDebug("MuonTrackResidualAnalyzer") << "TWO muons in the same sensible volume!!";
315 
317  }
318 }

References funct::abs(), MuonSubdetId::DT, LogDebug, DetId::rawId(), and HLTBitAnalyser_cfi::simhits.

Member Data Documentation

◆ cscSimHitLabel

edm::InputTag MuonTrackResidualAnalyzer::cscSimHitLabel
private

Definition at line 84 of file MuonTrackResidualAnalyzer.h.

◆ dbe_

DQMStore* MuonTrackResidualAnalyzer::dbe_
private

Definition at line 73 of file MuonTrackResidualAnalyzer.h.

◆ dirName_

std::string MuonTrackResidualAnalyzer::dirName_
private

Definition at line 74 of file MuonTrackResidualAnalyzer.h.

◆ dtSimHitLabel

edm::InputTag MuonTrackResidualAnalyzer::dtSimHitLabel
private

Definition at line 85 of file MuonTrackResidualAnalyzer.h.

◆ h1DRecHitRes

HResolution1DRecHit* MuonTrackResidualAnalyzer::h1DRecHitRes
private

Definition at line 101 of file MuonTrackResidualAnalyzer.h.

◆ h1DSimHitRes

HResolution1DRecHit* MuonTrackResidualAnalyzer::h1DSimHitRes
private

Definition at line 104 of file MuonTrackResidualAnalyzer.h.

◆ hDeltaPtVsEtaSim

MonitorElement* MuonTrackResidualAnalyzer::hDeltaPtVsEtaSim
private

Definition at line 108 of file MuonTrackResidualAnalyzer.h.

◆ hDeltaPtVsEtaSim2

MonitorElement* MuonTrackResidualAnalyzer::hDeltaPtVsEtaSim2
private

Definition at line 109 of file MuonTrackResidualAnalyzer.h.

◆ hDPtRef

MonitorElement* MuonTrackResidualAnalyzer::hDPtRef
private

Definition at line 98 of file MuonTrackResidualAnalyzer.h.

◆ hSimHitsPerTrack

MonitorElement* MuonTrackResidualAnalyzer::hSimHitsPerTrack
private

Definition at line 106 of file MuonTrackResidualAnalyzer.h.

◆ hSimHitsPerTrackVsEta

MonitorElement* MuonTrackResidualAnalyzer::hSimHitsPerTrackVsEta
private

Definition at line 107 of file MuonTrackResidualAnalyzer.h.

◆ out

std::string MuonTrackResidualAnalyzer::out
private

Definition at line 77 of file MuonTrackResidualAnalyzer.h.

◆ pset

edm::ParameterSet MuonTrackResidualAnalyzer::pset
private

Definition at line 76 of file MuonTrackResidualAnalyzer.h.

◆ rpcSimHitLabel

edm::InputTag MuonTrackResidualAnalyzer::rpcSimHitLabel
private

Definition at line 86 of file MuonTrackResidualAnalyzer.h.

◆ subsystemname_

std::string MuonTrackResidualAnalyzer::subsystemname_
private

Definition at line 75 of file MuonTrackResidualAnalyzer.h.

◆ theCSCSimHitToken

edm::EDGetTokenT<std::vector<PSimHit> > MuonTrackResidualAnalyzer::theCSCSimHitToken
private

Definition at line 89 of file MuonTrackResidualAnalyzer.h.

◆ theDataType

edm::InputTag MuonTrackResidualAnalyzer::theDataType
private

Definition at line 79 of file MuonTrackResidualAnalyzer.h.

◆ theDataTypeToken

edm::EDGetTokenT<edm::SimTrackContainer> MuonTrackResidualAnalyzer::theDataTypeToken
private

Definition at line 80 of file MuonTrackResidualAnalyzer.h.

◆ theDTSimHitToken

edm::EDGetTokenT<std::vector<PSimHit> > MuonTrackResidualAnalyzer::theDTSimHitToken
private

Definition at line 90 of file MuonTrackResidualAnalyzer.h.

◆ theEstimator

MeasurementEstimator* MuonTrackResidualAnalyzer::theEstimator
private

Definition at line 95 of file MuonTrackResidualAnalyzer.h.

◆ theEtaRange

EtaRange MuonTrackResidualAnalyzer::theEtaRange
private

Definition at line 81 of file MuonTrackResidualAnalyzer.h.

◆ theMuonSimHitNumberPerEvent

int MuonTrackResidualAnalyzer::theMuonSimHitNumberPerEvent
private

Definition at line 111 of file MuonTrackResidualAnalyzer.h.

◆ theMuonTrackLabel

edm::InputTag MuonTrackResidualAnalyzer::theMuonTrackLabel
private

Definition at line 83 of file MuonTrackResidualAnalyzer.h.

◆ theMuonTrackToken

edm::EDGetTokenT<reco::TrackCollection> MuonTrackResidualAnalyzer::theMuonTrackToken
private

Definition at line 88 of file MuonTrackResidualAnalyzer.h.

◆ theRPCSimHitToken

edm::EDGetTokenT<std::vector<PSimHit> > MuonTrackResidualAnalyzer::theRPCSimHitToken
private

Definition at line 91 of file MuonTrackResidualAnalyzer.h.

◆ theService

MuonServiceProxy* MuonTrackResidualAnalyzer::theService
private

Definition at line 93 of file MuonTrackResidualAnalyzer.h.

◆ theSimHitContainer

std::vector<const PSimHit *> MuonTrackResidualAnalyzer::theSimHitContainer
private

Definition at line 115 of file MuonTrackResidualAnalyzer.h.

◆ theSimTkId

unsigned int MuonTrackResidualAnalyzer::theSimTkId
private

Definition at line 113 of file MuonTrackResidualAnalyzer.h.

◆ theUpdator

KFUpdator* MuonTrackResidualAnalyzer::theUpdator
private

Definition at line 94 of file MuonTrackResidualAnalyzer.h.

Vector3DBase< float, LocalTag >
MuonTrackResidualAnalyzer::theSimHitContainer
std::vector< const PSimHit * > theSimHitContainer
Definition: MuonTrackResidualAnalyzer.h:115
change_name.diff
diff
Definition: change_name.py:13
fftjetvertexadder_cfi.errZ
errZ
Definition: fftjetvertexadder_cfi.py:39
MuonTrackResidualAnalyzer::theUpdator
KFUpdator * theUpdator
Definition: MuonTrackResidualAnalyzer.h:94
MuonTrackResidualAnalyzer::hDeltaPtVsEtaSim
MonitorElement * hDeltaPtVsEtaSim
Definition: MuonTrackResidualAnalyzer.h:108
MuonTrackResidualAnalyzer::barrel
Definition: MuonTrackResidualAnalyzer.h:42
MuonTrackResidualAnalyzer::hDPtRef
MonitorElement * hDPtRef
Definition: MuonTrackResidualAnalyzer.h:98
MuonTrackResidualAnalyzer::theCSCSimHitToken
edm::EDGetTokenT< std::vector< PSimHit > > theCSCSimHitToken
Definition: MuonTrackResidualAnalyzer.h:89
MuonTrackResidualAnalyzer::theDTSimHitToken
edm::EDGetTokenT< std::vector< PSimHit > > theDTSimHitToken
Definition: MuonTrackResidualAnalyzer.h:90
GeomDet
Definition: GeomDet.h:27
MuonTrackResidualAnalyzer::theEtaRange
EtaRange theEtaRange
Definition: MuonTrackResidualAnalyzer.h:81
fftjetvertexadder_cfi.errY
errY
Definition: fftjetvertexadder_cfi.py:38
MuonTrackResidualAnalyzer::mapMuSimHitsPerId
std::map< DetId, const PSimHit * > mapMuSimHitsPerId(edm::Handle< edm::PSimHitContainer > dtSimhits, edm::Handle< edm::PSimHitContainer > cscSimhits, edm::Handle< edm::PSimHitContainer > rpcSimhits)
Definition: MuonTrackResidualAnalyzer.cc:268
MuonTrackResidualAnalyzer::out
std::string out
Definition: MuonTrackResidualAnalyzer.h:77
gather_cfg.cout
cout
Definition: gather_cfg.py:144
MuonTrackResidualAnalyzer::endcap
Definition: MuonTrackResidualAnalyzer.h:42
MuonTrackResidualAnalyzer::cscSimHitLabel
edm::InputTag cscSimHitLabel
Definition: MuonTrackResidualAnalyzer.h:84
MuonTrackResidualAnalyzer::hDeltaPtVsEtaSim2
MonitorElement * hDeltaPtVsEtaSim2
Definition: MuonTrackResidualAnalyzer.h:109
MuonTrackResidualAnalyzer::theService
MuonServiceProxy * theService
Definition: MuonTrackResidualAnalyzer.h:93
TrackCandidateProducer_cfi.simTracks
simTracks
Definition: TrackCandidateProducer_cfi.py:15
edm::EDConsumerBase::consumesCollector
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
Definition: EDConsumerBase.cc:71
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
edm::Handle
Definition: AssociativeIterator.h:50
MuonTrackResidualAnalyzer::theRPCSimHitToken
edm::EDGetTokenT< std::vector< PSimHit > > theRPCSimHitToken
Definition: MuonTrackResidualAnalyzer.h:91
MuonTrackResidualAnalyzer::subsystemname_
std::string subsystemname_
Definition: MuonTrackResidualAnalyzer.h:75
MuonServiceProxy_cff.MuonServiceProxy
MuonServiceProxy
Definition: MuonServiceProxy_cff.py:15
PSimHit::detUnitId
unsigned int detUnitId() const
Definition: PSimHit.h:97
MuonTrackResidualAnalyzer::dbe_
DQMStore * dbe_
Definition: MuonTrackResidualAnalyzer.h:73
edm::InputTag::label
std::string const & label() const
Definition: InputTag.h:36
DetId
Definition: DetId.h:17
cmsdt::algo
algo
Definition: constants.h:164
TrajectoryStateOnSurface
Definition: TrajectoryStateOnSurface.h:16
debug
#define debug
Definition: HDRShower.cc:19
MuonTrackResidualAnalyzer::theMuonSimHitNumberPerEvent
int theMuonSimHitNumberPerEvent
Definition: MuonTrackResidualAnalyzer.h:111
MuonPatternRecoDumper
Definition: MuonPatternRecoDumper.h:18
MuonTrackResidualAnalyzer::hSimHitsPerTrack
MonitorElement * hSimHitsPerTrack
Definition: MuonTrackResidualAnalyzer.h:106
MuonTrackResidualAnalyzer::theMuonTrackLabel
edm::InputTag theMuonTrackLabel
Definition: MuonTrackResidualAnalyzer.h:83
Trajectory::DataContainer
std::vector< TrajectoryMeasurement > DataContainer
Definition: Trajectory.h:40
PVValHelper::eta
Definition: PVValidationHelpers.h:69
dqm::impl::MonitorElement::Fill
void Fill(long long x)
Definition: MonitorElement.h:290
Chi2MeasurementEstimator_cfi.Chi2MeasurementEstimator
Chi2MeasurementEstimator
Definition: Chi2MeasurementEstimator_cfi.py:5
PSimHit::localPosition
Local3DPoint localPosition() const
Definition: PSimHit.h:52
MuonSubdetId::DT
static constexpr int DT
Definition: MuonSubdetId.h:11
Point3DBase< float, GlobalTag >
GeomDet::toLocal
LocalPoint toLocal(const GlobalPoint &gp) const
Conversion to the R.F. of the GeomDet.
Definition: GeomDet.h:58
dqm::implementation::DQMStore::save
DQM_DEPRECATED void save(std::string const &filename, std::string const &path="")
Definition: DQMStore.cc:760
DTLayerId
Definition: DTLayerId.h:12
edm::OwnVector::const_iterator
Definition: OwnVector.h:41
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
MuonTrackResidualAnalyzer::pset
edm::ParameterSet pset
Definition: MuonTrackResidualAnalyzer.h:76
funct::true
true
Definition: Factorize.h:173
GeomDet::toGlobal
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
Definition: GeomDet.h:49
HLTBitAnalyser_cfi.simhits
simhits
SIM objects.
Definition: HLTBitAnalyser_cfi.py:21
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:670
edm::ParameterSet
Definition: ParameterSet.h:36
Geom::Phi::phi
T1 phi() const
Definition: Phi.h:78
MuonTrackResidualAnalyzer::rpcSimHitLabel
edm::InputTag rpcSimHitLabel
Definition: MuonTrackResidualAnalyzer.h:86
TrackingRecHit::ConstRecHitContainer
std::vector< ConstRecHitPointer > ConstRecHitContainer
Definition: TrackingRecHit.h:32
KineDebug3::count
void count()
Definition: KinematicConstrainedVertexUpdatorT.h:21
muonSimHitMatcherPSet.simTrack
simTrack
Definition: muonSimHitMatcherPSet.py:4
PV3DBase::eta
T eta() const
Definition: PV3DBase.h:73
MuonTrackResidualAnalyzer::hSimHitsPerTrackVsEta
MonitorElement * hSimHitsPerTrackVsEta
Definition: MuonTrackResidualAnalyzer.h:107
edm::Service
Definition: Service.h:30
MuonTrackResidualAnalyzer::all
Definition: MuonTrackResidualAnalyzer.h:42
Trajectory::measurements
DataContainer const & measurements() const
Definition: Trajectory.h:178
combine.histos
histos
Definition: combine.py:4
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
MuonTrackResidualAnalyzer::theDataTypeToken
edm::EDGetTokenT< edm::SimTrackContainer > theDataTypeToken
Definition: MuonTrackResidualAnalyzer.h:80
mag
T mag() const
The vector magnitude. Equivalent to sqrt(vec.mag2())
Definition: Basic3DVectorLD.h:127
reco::TransientTrack
Definition: TransientTrack.h:19
MuonTrackResidualAnalyzer::dtSimHitLabel
edm::InputTag dtSimHitLabel
Definition: MuonTrackResidualAnalyzer.h:85
PSimHit::momentumAtEntry
LocalVector momentumAtEntry() const
The momentum of the track that produced the hit, at entry point.
Definition: PSimHit.h:55
MuonTrackResidualAnalyzer::dirName_
std::string dirName_
Definition: MuonTrackResidualAnalyzer.h:74
TrackerOfflineValidation_Dqm_cff.dirName
dirName
Definition: TrackerOfflineValidation_Dqm_cff.py:55
MuonTrackResidualAnalyzer::theMuonTrackToken
edm::EDGetTokenT< reco::TrackCollection > theMuonTrackToken
Definition: MuonTrackResidualAnalyzer.h:88
data
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
HLT_2018_cff.track
track
Definition: HLT_2018_cff.py:10352
mps_fire.result
result
Definition: mps_fire.py:303
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
LogTrace
#define LogTrace(id)
Definition: MessageLogger.h:671
PSimHit
Definition: PSimHit.h:15
MuonTrackResidualAnalyzer::EtaRange
EtaRange
Definition: MuonTrackResidualAnalyzer.h:42
MuonTrackResidualAnalyzer::theDataType
edm::InputTag theDataType
Definition: MuonTrackResidualAnalyzer.h:79
fftjetvertexadder_cfi.errX
errX
Definition: fftjetvertexadder_cfi.py:37
edm::InputTag
Definition: InputTag.h:15
MuonTrackResidualAnalyzer::theEstimator
MeasurementEstimator * theEstimator
Definition: MuonTrackResidualAnalyzer.h:95
PV3DBase::phi
Geom::Phi< T > phi() const
Definition: PV3DBase.h:66
KFUpdator
Definition: KFUpdator.h:32
MuonTrackResidualAnalyzer::theSimTkId
unsigned int theSimTkId
Definition: MuonTrackResidualAnalyzer.h:113
python.rootplot.root2matplotlib.replace
def replace(string, replacements)
Definition: root2matplotlib.py:444