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
template<typename T >
using BranchAliasSetterT = ProductRegistryHelper::BranchAliasSetterT< T >
 
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
 
 EDProducer (const EDProducer &)=delete
 
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
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
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
bool wantsInputProcessBlocks () const final
 
bool wantsProcessBlocks () 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 const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESProxyIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex > const & esGetTokenRecordIndicesVector (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::array< std::vector< ModuleDescription const *> *, NumBranchTypes > &modulesAll, std::vector< ModuleProcessName > &modulesInPreviousProcesses, 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 selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
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 dqmBeginRun (edm::Run const &, edm::EventSetup const &)
 
- Protected Member Functions inherited from edm::ProducerBase
template<Transition Tr = Transition::Event>
auto produces (std::string instanceName) noexcept
 declare what type of product will make and with which optional label More...
 
template<Transition B>
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)
 
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 ()
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces ()
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces ()
 
template<Transition Tr = Transition::Event>
auto produces () noexcept
 
ProducesCollector producesCollector ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< Bconsumes (edm::InputTag tag) noexcept
 
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 ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes ()
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag)
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
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)
 
void resetItemsToGetFrom (BranchType iType)
 
- 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

Constructor & Destructor Documentation

◆ MuonTrackResidualAnalyzer()

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

Constructor.

Definition at line 38 of file MuonTrackResidualAnalyzer.cc.

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

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 
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 }
MeasurementEstimator * theEstimator
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
edm::EDGetTokenT< reco::TrackCollection > theMuonTrackToken
std::string const & label() const
Definition: InputTag.h:36
T getUntrackedParameter(std::string const &, T const &) const
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
edm::EDGetTokenT< std::vector< PSimHit > > theRPCSimHitToken
edm::EDGetTokenT< edm::SimTrackContainer > theDataTypeToken
edm::EDGetTokenT< std::vector< PSimHit > > theCSCSimHitToken
edm::EDGetTokenT< std::vector< PSimHit > > theDTSimHitToken
#define LogDebug(id)

◆ ~MuonTrackResidualAnalyzer()

MuonTrackResidualAnalyzer::~MuonTrackResidualAnalyzer ( )
override

Destructor.

Definition at line 75 of file MuonTrackResidualAnalyzer.cc.

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

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.

References funct::abs(), debug, options_cfi::eventSetup, LogDebug, LogTrace, mag(), ALCARECOTkAlDQM_cff::muonTracks, mps_fire::result, cscDigiValidation_cfi::simTrack, TrackCandidateProducer_cfi::simTracks, GeomDet::toGlobal(), and HLT_2023v12_cff::track.

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 }
std::map< DetId, const PSimHit * > mapMuSimHitsPerId(edm::Handle< edm::PSimHitContainer > dtSimhits, edm::Handle< edm::PSimHitContainer > cscSimhits, edm::Handle< edm::PSimHitContainer > rpcSimhits)
std::vector< const PSimHit * > theSimHitContainer
edm::EDGetTokenT< reco::TrackCollection > theMuonTrackToken
std::string const & label() const
Definition: InputTag.h:36
#define LogTrace(id)
void Fill(long long x)
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
Definition: GeomDet.h:49
std::vector< ConstRecHitPointer > ConstRecHitContainer
Definition: DetId.h:17
T mag() const
The vector magnitude. Equivalent to sqrt(vec.mag2())
#define debug
Definition: HDRShower.cc:19
edm::EDGetTokenT< std::vector< PSimHit > > theRPCSimHitToken
edm::EDGetTokenT< edm::SimTrackContainer > theDataTypeToken
edm::EDGetTokenT< std::vector< PSimHit > > theCSCSimHitToken
edm::EDGetTokenT< std::vector< PSimHit > > theDTSimHitToken
#define LogDebug(id)

◆ bookHistograms()

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

Implements DQMOneEDAnalyzer<>.

Definition at line 81 of file MuonTrackResidualAnalyzer.cc.

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().

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 }
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:36
def replace(string, replacements)
MonitorElement * book2D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, FUNC onbooking=NOOP())
Definition: DQMStore.h:212
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
Definition: DQMStore.h:98
#define LogDebug(id)

◆ computeResolution()

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

Definition at line 320 of file MuonTrackResidualAnalyzer.cc.

References funct::abs(), gather_cfg::cout, 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().

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 }
unsigned int detUnitId() const
Definition: PSimHit.h:97
LocalPoint toLocal(const GlobalPoint &gp) const
Conversion to the R.F. of the GeomDet.
Definition: GeomDet.h:58
Geom::Phi< T > phi() const
Definition: PV3DBase.h:66
T eta() const
Definition: PV3DBase.h:73
DataContainer const & measurements() const
Definition: Trajectory.h:178
std::vector< TrajectoryMeasurement > DataContainer
Definition: Trajectory.h:40
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
Definition: DetId.h:17
T1 phi() const
Definition: Phi.h:78
Local3DPoint localPosition() const
Definition: PSimHit.h:52
histos
Definition: combine.py:4
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
LocalVector momentumAtEntry() const
The momentum of the track that produced the hit, at entry point.
Definition: PSimHit.h:55

◆ dqmEndRun()

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

Reimplemented from DQMOneEDAnalyzer<>.

Definition at line 118 of file MuonTrackResidualAnalyzer.cc.

References MillePedeFileConverter_cfg::out.

118  {
119  if (!out.empty() && dbe_)
120  dbe_->save(out);
121 }
DQM_DEPRECATED void save(std::string const &filename, std::string const &path="")
Definition: DQMStore.cc:824

◆ isInTheAcceptance()

bool MuonTrackResidualAnalyzer::isInTheAcceptance ( double  eta)
private

Definition at line 252 of file MuonTrackResidualAnalyzer.cc.

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

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 }
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
#define LogDebug(id)

◆ 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.

References submitPVResolutionJobs::count, debug, LogDebug, and LogTrace.

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 }
std::map< DetId, const PSimHit * > mapMuSimHitsPerId(edm::Handle< edm::PSimHitContainer > dtSimhits, edm::Handle< edm::PSimHitContainer > cscSimhits, edm::Handle< edm::PSimHitContainer > rpcSimhits)
std::vector< const PSimHit * > theSimHitContainer
#define LogTrace(id)
Definition: DetId.h:17
#define debug
Definition: HDRShower.cc:19
#define LogDebug(id)

◆ 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.

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

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 }
std::vector< const PSimHit * > theSimHitContainer
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
Definition: DetId.h:17
static constexpr int DT
Definition: MuonSubdetId.h:11
#define LogDebug(id)

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.