CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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:
DQMEDAnalyzer edm::stream::EDAnalyzer< edm::RunSummaryCache< dqmDetails::NoCache >, edm::LuminosityBlockSummaryCache< dqmDetails::NoCache > > edm::stream::EDAnalyzerBase edm::EDConsumerBase

Classes

struct  RadiusComparatorInOut
 

Public Types

enum  EtaRange { all, barrel, endcap }
 
- 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
 

Public Member Functions

void analyze (const edm::Event &event, const edm::EventSetup &eventSetup)
 
virtual void beginJob ()
 
void bookHistograms (DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
 
virtual void endRun ()
 
 MuonTrackResidualAnalyzer (const edm::ParameterSet &ps)
 Constructor. More...
 
virtual ~MuonTrackResidualAnalyzer ()
 Destructor. More...
 
- Public Member Functions inherited from DQMEDAnalyzer
virtual void beginRun (edm::Run const &, edm::EventSetup const &) final
 
virtual void beginStream (edm::StreamID id) final
 
virtual void dqmBeginRun (edm::Run const &, edm::EventSetup const &)
 
 DQMEDAnalyzer (void)
 
virtual void endLuminosityBlockSummary (edm::LuminosityBlock const &, edm::EventSetup const &, dqmDetails::NoCache *) const final
 
virtual void endRunSummary (edm::Run const &, edm::EventSetup const &, dqmDetails::NoCache *) const final
 
uint32_t streamId () const
 
- Public Member Functions inherited from edm::stream::EDAnalyzer< edm::RunSummaryCache< dqmDetails::NoCache >, edm::LuminosityBlockSummaryCache< dqmDetails::NoCache > >
 EDAnalyzer ()=default
 
- Public Member Functions inherited from edm::stream::EDAnalyzerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzerBase ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDAnalyzerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 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 (std::string const &iProcessName, std::string const &iModuleLabel, bool iPrint, std::vector< char const * > &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 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::SimTrackContainer
theDataTypeToken
 
edm::EDGetTokenT< std::vector
< PSimHit > > 
theDTSimHitToken
 
MeasurementEstimatortheEstimator
 
EtaRange theEtaRange
 
int theMuonSimHitNumberPerEvent
 
edm::InputTag theMuonTrackLabel
 
edm::EDGetTokenT
< reco::TrackCollection
theMuonTrackToken
 
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 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

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 47 of file MuonTrackResidualAnalyzer.h.

Member Enumeration Documentation

Constructor & Destructor Documentation

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

Constructor.

Definition at line 38 of file MuonTrackResidualAnalyzer.cc.

References dbe_, LogDebug, MuonServiceProxy_cff::MuonServiceProxy, cppFunctionSkipper::operator, GenerateHcalLaserBadRunList::out, TrackValidation_cff::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);
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 
73 }
#define LogDebug(id)
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
MeasurementEstimator * theEstimator
edm::EDGetTokenT< reco::TrackCollection > theMuonTrackToken
edm::EDGetTokenT< std::vector< PSimHit > > theRPCSimHitToken
std::string const & label() const
Definition: InputTag.h:36
edm::EDGetTokenT< edm::SimTrackContainer > theDataTypeToken
edm::EDGetTokenT< std::vector< PSimHit > > theCSCSimHitToken
edm::EDGetTokenT< std::vector< PSimHit > > theDTSimHitToken
MuonTrackResidualAnalyzer::~MuonTrackResidualAnalyzer ( )
virtual

Destructor.

Definition at line 76 of file MuonTrackResidualAnalyzer.cc.

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

Member Function Documentation

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

Implements edm::stream::EDAnalyzerBase.

Definition at line 128 of file MuonTrackResidualAnalyzer.cc.

References funct::abs(), debug, LogDebug, LogTrace, mag(), mps_fire::result, and GeomDet::toGlobal().

128  {
129  LogDebug("MuonTrackResidualAnalyzer")<<"Analyze";
130 
131  // Update the services
132  theService->update(eventSetup);
135 
136  // Get the SimHit collection from the event
137  Handle<PSimHitContainer> dtSimHits;
138  event.getByToken(theDTSimHitToken, dtSimHits);
139 
140  Handle<PSimHitContainer> cscSimHits;
141  event.getByToken(theCSCSimHitToken, cscSimHits);
142 
143  Handle<PSimHitContainer> rpcSimHits;
144  event.getByToken(theRPCSimHitToken, rpcSimHits);
145 
146  Handle<SimTrackContainer> simTracks;
147 
148  // FIXME Add the tracker one??
149 
150  // Map simhits per DetId
151  map<DetId, const PSimHit* > muonSimHitsPerId =
152  mapMuSimHitsPerId(dtSimHits,cscSimHits,rpcSimHits);
153 
155 
156  double etaSim=0;
157 
158  if(theDataType.label() == "SimData"){
159 
160  // Get the SimTrack collection from the event
161  event.getByToken(theDataTypeToken,simTracks);
162 
163  // Loop over the Sim tracks
164  SimTrackContainer::const_iterator simTrack;
165 
166  for (simTrack = simTracks->begin(); simTrack != simTracks->end(); ++simTrack)
167  if (abs((*simTrack).type()) == 13){
168  hSimHitsPerTrackVsEta->Fill((*simTrack).momentum().eta(),theMuonSimHitNumberPerEvent);
169  etaSim = (*simTrack).momentum().eta();
170  theSimTkId = (*simTrack).trackId();
171 
172  }
173  }
174 
175 
176  // Get the RecTrack collection from the event
178  event.getByToken(theMuonTrackToken, muonTracks);
179 
180  reco::TrackCollection::const_iterator muonTrack;
181 
182  // Loop over the Rec tracks
183  for (muonTrack = muonTracks->begin(); muonTrack != muonTracks->end(); ++muonTrack) {
184 
185  reco::TransientTrack track(*muonTrack,&*theService->magneticField(),theService->trackingGeometry());
186 
187  TrajectoryStateOnSurface outerTSOS = track.outermostMeasurementState();
188  TrajectoryStateOnSurface innerTSOS = track.innermostMeasurementState();
189 
191 
192  // SimHit Energy loss analysis
193  double momAtEntry = -150., momAtExit = -150.;
194 
195  if(theSimHitContainer.size()>1){
196 
197  const GeomDet *geomDetA = theService->trackingGeometry()->idToDet(DetId(theSimHitContainer.front()->detUnitId()));
198  double distA = geomDetA->toGlobal(theSimHitContainer.front()->localPosition()).mag();
199 
200  const GeomDet *geomDetB = theService->trackingGeometry()->idToDet(DetId(theSimHitContainer.back()->detUnitId()));
201  double distB = geomDetB->toGlobal(theSimHitContainer.back()->localPosition()).mag();
202 
203  LogTrace("MuonTrackResidualAnalyzer")<<"Inner SimHit: "<<theSimHitContainer.front()->particleType()
204  <<" Pt: "<<theSimHitContainer.front()->momentumAtEntry().perp()
205  <<" E: "<<theSimHitContainer.front()->momentumAtEntry().perp()
206  <<" R: "<<distA<<endl;
207  LogTrace("MuonTrackResidualAnalyzer")<<"Outer SimHit: "<<theSimHitContainer.back()->particleType()
208  <<" Pt: "<<theSimHitContainer.back()->momentumAtEntry().perp()
209  <<" E: "<<theSimHitContainer.front()->momentumAtEntry().perp()
210  <<" R: "<<distB<<endl;
211 
212  momAtEntry = theSimHitContainer.front()->momentumAtEntry().perp();
213  momAtExit = theSimHitContainer.back()->momentumAtEntry().perp();
214  }
215 
216  trackingRecHit_iterator rhFirst = track.recHitsBegin();
217  trackingRecHit_iterator rhLast = track.recHitsEnd()-1;
218  map<DetId,const PSimHit*>::const_iterator itFirst = muonSimHitsPerId.find((*rhFirst)->geographicalId());
219  map<DetId,const PSimHit*>::const_iterator itLast = muonSimHitsPerId.find((*rhLast)->geographicalId());
220 
221  double momAtEntry2 = -150, momAtExit2 = -150.;
222  if (itFirst != muonSimHitsPerId.end() )
223  momAtEntry2 = itFirst->second->momentumAtEntry().perp();
224  else {
225  LogDebug("MuonTrackResidualAnalyzer")<<"No first sim hit found";
226  ++rhFirst;
227  itFirst = muonSimHitsPerId.find((*rhFirst)->geographicalId());
228  if (itFirst != muonSimHitsPerId.end() )
229  momAtEntry2 = itFirst->second->momentumAtEntry().perp();
230  else{
231  LogDebug("MuonTrackResidualAnalyzer")<<"No second sim hit found";
232  // continue;
233  }
234  }
235 
236  if (itLast != muonSimHitsPerId.end() )
237  momAtExit2 = itLast->second->momentumAtEntry().perp();
238  else {
239  LogDebug("MuonTrackResidualAnalyzer")<<"No last sim hit found";
240  --rhLast;
241  itLast = muonSimHitsPerId.find((*rhLast)->geographicalId());
242  if (itLast != muonSimHitsPerId.end() )
243  momAtExit2 = itLast->second->momentumAtEntry().perp();
244  else{
245  LogDebug("MuonTrackResidualAnalyzer")<<"No last but one sim hit found";
246  // continue;
247  }
248  }
249 
250  if(etaSim){
251  if(momAtEntry >=0 && momAtExit >= 0)
252  hDeltaPtVsEtaSim->Fill(etaSim,momAtEntry-momAtExit);
253  if(momAtEntry2 >=0 && momAtExit2 >= 0)
254  hDeltaPtVsEtaSim2->Fill(etaSim,momAtEntry2-momAtExit2);
255  }
256  else
257  LogDebug("MuonTrackResidualAnalyzer")<<"NO SimTrack'eta";
258  //
259 
260  // computeResolution(trajectoryBW,muonSimHitsPerId,h1DSimHitRes);
261  // computeResolution(smoothed,muonSimHitsPerId,h1DSimHitRes);
262 
263  }
264 }
#define LogDebug(id)
std::map< DetId, const PSimHit * > mapMuSimHitsPerId(edm::Handle< edm::PSimHitContainer > dtSimhits, edm::Handle< edm::PSimHitContainer > cscSimhits, edm::Handle< edm::PSimHitContainer > rpcSimhits)
edm::EDGetTokenT< reco::TrackCollection > theMuonTrackToken
T mag() const
The vector magnitude. Equivalent to sqrt(vec.mag2())
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
Definition: GeomDet.h:52
tuple result
Definition: mps_fire.py:83
void Fill(long long x)
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
#define LogTrace(id)
std::vector< ConstRecHitPointer > ConstRecHitContainer
Definition: DetId.h:18
std::vector< const PSimHit * > theSimHitContainer
#define debug
Definition: HDRShower.cc:19
edm::EDGetTokenT< std::vector< PSimHit > > theRPCSimHitToken
std::string const & label() const
Definition: InputTag.h:36
edm::EDGetTokenT< edm::SimTrackContainer > theDataTypeToken
edm::EDGetTokenT< std::vector< PSimHit > > theCSCSimHitToken
TrackingRecHitCollection::base::const_iterator trackingRecHit_iterator
iterator over a vector of reference to TrackingRecHit in the same collection
edm::EDGetTokenT< std::vector< PSimHit > > theDTSimHitToken
void MuonTrackResidualAnalyzer::beginJob ( void  )
virtual

Definition at line 83 of file MuonTrackResidualAnalyzer.cc.

83  {
84 
85 }
void MuonTrackResidualAnalyzer::bookHistograms ( DQMStore::IBooker ibooker,
edm::Run const &  iRun,
edm::EventSetup const &   
)
overridevirtual

Implements DQMEDAnalyzer.

Definition at line 87 of file MuonTrackResidualAnalyzer.cc.

References ecalcalib_dqm_sourceclient-live_cfg::algo, DQMStore::IBooker::book1D(), DQMStore::IBooker::book2D(), DQMStore::IBooker::cd(), TrackerOfflineValidation_Dqm_cff::dirName, edm::InputTag::instance(), edm::InputTag::label(), LogDebug, edm::InputTag::process(), python.rootplot.root2matplotlib::replace(), and DQMStore::IBooker::setCurrentFolder().

90 {
91  LogDebug("MuonTrackResidualAnalyzer")<<"Begin Run";
92 
93  //ibooker.showDirStructure();
94 
95  ibooker.cd();
97  string dirName=dirName_;
98  if (algo.process()!="")
99  dirName+=algo.process()+"_";
100  if(algo.label()!="")
101  dirName+=algo.label()+"_";
102  if(algo.instance()!="")
103  dirName+=algo.instance()+"";
104  if (dirName.find("Tracks")<dirName.length()){
105  dirName.replace(dirName.find("Tracks"),6,"");
106  }
107  std::replace(dirName.begin(), dirName.end(), ':', '_');
108  ibooker.setCurrentFolder(dirName.c_str());
109 
110 
111  hDPtRef = ibooker.book1D("DeltaPtRef","P^{in}_{t}-P^{in ref}",10000,-20,20);
112 
113  // Resolution wrt the 1D Rec Hits
114  // h1DRecHitRes = new HResolution1DRecHit("TotalRec");
115 
116  // Resolution wrt the 1d Sim Hits
117  // h1DSimHitRes = new HResolution1DRecHit("TotalSim");
118 
119  hSimHitsPerTrack = ibooker.book1D("SimHitsPerTrack","Number of sim hits per track",55,0,55);
120  hSimHitsPerTrackVsEta = ibooker.book2D("SimHitsPerTrackVsEta","Number of sim hits per track VS #eta",120,-3.,3.,55,0,55);
121  hDeltaPtVsEtaSim = ibooker.book2D("DeltaPtVsEtaSim","#Delta P_{t} vs #eta gen, sim quantity",120,-3.,3.,500,-250.,250.);
122  hDeltaPtVsEtaSim2 = ibooker.book2D("DeltaPtVsEtaSim2","#Delta P_{t} vs #eta gen, sim quantity",120,-3.,3.,500,-250.,250.);
123 }
#define LogDebug(id)
void cd(void)
Definition: DQMStore.cc:268
MonitorElement * book1D(Args &&...args)
Definition: DQMStore.h:115
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:276
MonitorElement * book2D(Args &&...args)
Definition: DQMStore.h:133
std::string const & label() const
Definition: InputTag.h:36
std::string const & process() const
Definition: InputTag.h:40
std::string const & instance() const
Definition: InputTag.h:37
void MuonTrackResidualAnalyzer::computeResolution ( Trajectory trajectory,
std::map< DetId, const PSimHit * > &  hitIdMap,
HResolution1DRecHit histos 
)
private

Definition at line 340 of file MuonTrackResidualAnalyzer.cc.

References funct::abs(), gather_cfg::cout, AlCaHLTBitMon_QueryRunRegistry::data, PSimHit::detUnitId(), mps_update::diff, PV3DBase< T, PVType, FrameType >::eta(), HResolution1DRecHit::Fill(), PSimHit::localPosition(), Trajectory::measurements(), PSimHit::momentumAtEntry(), Geom::Phi< T >::phi(), PV3DBase< T, PVType, FrameType >::phi(), GeomDet::toLocal(), PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

342  {
343 
345 
346  for(Trajectory::DataContainer::const_iterator datum = data.begin();
347  datum != data.end(); ++datum){
348 
349  GlobalPoint fitPoint = datum->updatedState().globalPosition();
350 
351  // FIXME!
352  // double errX = datum->updatedState().cartesianError().matrix()[0][0];
353  // double errY = datum->updatedState().cartesianError().matrix()[1][1];
354  // double errZ = datum->updatedState().cartesianError().matrix()[2][2];
355  //
356  double errX = datum->updatedState().localError().matrix()(3,3);
357  double errY = datum->updatedState().localError().matrix()(4,4);
358  double errZ = 1.;
359 
360  map<DetId,const PSimHit*>::const_iterator it = hitIdMap.find(datum->recHit()->geographicalId());
361 
362 
363  if (it == hitIdMap.end() ) continue; // FIXME! Put a counter
364 
365  const PSimHit* simhit = it->second;
366 
367  LocalPoint simHitPoint = simhit->localPosition();
368 
369  const GeomDet* geomDet = theService->trackingGeometry()->idToDet(DetId(simhit->detUnitId()));
370 
371  LocalPoint fitLocalPoint = geomDet->toLocal(fitPoint);
372 
373  LocalVector diff = fitLocalPoint-simHitPoint;
374 
375 
376  cout << "SimHit position "<< simHitPoint << endl;
377  cout << "Fit position "<< fitLocalPoint << endl;
378  cout << "Fit position2 "<< datum->updatedState().localPosition() << endl;
379  cout << "Errors on the fit position: (" << errX << "," << errY << "," << errZ << ")"<<endl;
380  cout << "Resolution on x: " << diff.x()/abs(simHitPoint.x()) << endl;
381  cout << "Resolution on y: " << diff.y()/abs(simHitPoint.y()) << endl;
382  cout << "Resolution on z: " << diff.z()/abs(simHitPoint.z()) << endl;
383 
384  cout << "Eta direction: "<< simhit->momentumAtEntry().eta() <<" eta position: " << simHitPoint.eta() << endl;
385  cout << "Phi direction: "<< simhit->momentumAtEntry().phi() <<" phi position: " << simHitPoint.phi() << endl;
386 
387 
388  histos->Fill( simHitPoint.x(), simHitPoint.y(), simHitPoint.z(),
389  diff.x(), diff.y(), diff.z(),
390  errX, errY, errZ,
391  simhit->momentumAtEntry().eta(), simhit->momentumAtEntry().phi());
392  // simHitPoint.eta(), simHitPoint.phi() ); // FIXME!
393  }
394 
395 
396 }
LocalVector momentumAtEntry() const
The momentum of the track that produced the hit, at entry point.
Definition: PSimHit.h:47
Geom::Phi< T > phi() const
Definition: PV3DBase.h:69
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
list diff
Definition: mps_update.py:85
DataContainer const & measurements() const
Definition: Trajectory.h:250
std::vector< TrajectoryMeasurement > DataContainer
Definition: Trajectory.h:44
Local3DPoint localPosition() const
Definition: PSimHit.h:44
T phi() const
Definition: Phi.h:41
T z() const
Definition: PV3DBase.h:64
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
Definition: DetId.h:18
T eta() const
Definition: PV3DBase.h:76
tuple cout
Definition: gather_cfg.py:145
void Fill(double x, double y, double z, double dx, double dy, double dz, double errx, double erry, double errz, double eta, double phi)
Definition: Histograms.h:333
T x() const
Definition: PV3DBase.h:62
unsigned int detUnitId() const
Definition: PSimHit.h:93
void MuonTrackResidualAnalyzer::endRun ( void  )
virtual

Definition at line 125 of file MuonTrackResidualAnalyzer.cc.

References dbe_, and GenerateHcalLaserBadRunList::out.

125  {
126  if ( out.size() != 0 && dbe_ ) dbe_->save(out);
127 }
bool MuonTrackResidualAnalyzer::isInTheAcceptance ( double  eta)
private

Definition at line 266 of file MuonTrackResidualAnalyzer.cc.

References funct::abs(), Vispa.Plugins.EdmBrowser.EdmDataAccessor::all(), Reference_intrackfit_cff::barrel, Reference_intrackfit_cff::endcap, and LogDebug.

266  {
267  switch(theEtaRange){
268  case all:
269  return ( abs(eta) <= 2.4 ) ? true : false;
270  case barrel:
271  return ( abs(eta) < 1.1 ) ? true : false;
272  case endcap:
273  return ( abs(eta) >= 1.1 && abs(eta) <= 2.4 ) ? true : false;
274  default:
275  {LogDebug("MuonTrackResidualAnalyzer")<<"No correct Eta range selected!! "; return false;}
276  }
277 }
#define LogDebug(id)
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
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 281 of file MuonTrackResidualAnalyzer.cc.

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

283  {
284 
286 
287  map<DetId,const PSimHit*> hitIdMap;
288  theSimHitContainer.clear();
289 
290  mapMuSimHitsPerId(dtSimhits,hitIdMap);
291  mapMuSimHitsPerId(cscSimhits,hitIdMap);
292  mapMuSimHitsPerId(rpcSimhits,hitIdMap);
293 
294  if(theSimHitContainer.size() >1)
295  stable_sort(theSimHitContainer.begin(),theSimHitContainer.end(),RadiusComparatorInOut(theService->trackingGeometry()));
296 
297  LogDebug("MuonTrackResidualAnalyzer")<<"Sim Hit list";
298  int count=1;
299  for(vector<const PSimHit*>::const_iterator it = theSimHitContainer.begin();
300  it != theSimHitContainer.end(); ++it){
301  LogTrace("MuonTrackResidualAnalyzer")<<count
302  << " "
303  << " Process Type: " << (*it)->processType()
304  << " "
305  << debug.dumpMuonId(DetId( (*it)->detUnitId() ))<<endl;
306  }
307 
308  return hitIdMap;
309 }
#define LogDebug(id)
std::map< DetId, const PSimHit * > mapMuSimHitsPerId(edm::Handle< edm::PSimHitContainer > dtSimhits, edm::Handle< edm::PSimHitContainer > cscSimhits, edm::Handle< edm::PSimHitContainer > rpcSimhits)
std::string dumpMuonId(const DetId &id) const
#define LogTrace(id)
Definition: DetId.h:18
std::vector< const PSimHit * > theSimHitContainer
#define debug
Definition: HDRShower.cc:19
void MuonTrackResidualAnalyzer::mapMuSimHitsPerId ( edm::Handle< edm::PSimHitContainer simhits,
std::map< DetId, const PSimHit * > &  hitIdMap 
)
private

Definition at line 312 of file MuonTrackResidualAnalyzer.cc.

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

313  {
314 
315  for(PSimHitContainer::const_iterator simhit = simhits->begin();
316  simhit != simhits->end(); ++simhit) {
317 
318  if ( abs(simhit->particleType()) != 13 && theSimTkId != simhit->trackId()) continue;
319 
320  theSimHitContainer.push_back(&*simhit);
321  DetId id = DetId(simhit->detUnitId());
322 
323  if(id.subdetId() == MuonSubdetId::DT){
324  DTLayerId lId(id.rawId());
325  id = DetId(lId.rawId());
326  }
327 
328  map<DetId,const PSimHit*>::const_iterator it = hitIdMap.find(id);
329 
330  if (it == hitIdMap.end() )
331  hitIdMap[id] = &*simhit;
332  else
333  LogDebug("MuonTrackResidualAnalyzer")<<"TWO muons in the same sensible volume!!";
334 
336  }
337 }
#define LogDebug(id)
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
Definition: DetId.h:18
std::vector< const PSimHit * > theSimHitContainer
static const int DT
Definition: MuonSubdetId.h:12

Member Data Documentation

edm::InputTag MuonTrackResidualAnalyzer::cscSimHitLabel
private

Definition at line 96 of file MuonTrackResidualAnalyzer.h.

DQMStore* MuonTrackResidualAnalyzer::dbe_
private

Definition at line 85 of file MuonTrackResidualAnalyzer.h.

std::string MuonTrackResidualAnalyzer::dirName_
private

Definition at line 86 of file MuonTrackResidualAnalyzer.h.

edm::InputTag MuonTrackResidualAnalyzer::dtSimHitLabel
private

Definition at line 97 of file MuonTrackResidualAnalyzer.h.

HResolution1DRecHit* MuonTrackResidualAnalyzer::h1DRecHitRes
private

Definition at line 113 of file MuonTrackResidualAnalyzer.h.

HResolution1DRecHit* MuonTrackResidualAnalyzer::h1DSimHitRes
private

Definition at line 116 of file MuonTrackResidualAnalyzer.h.

MonitorElement* MuonTrackResidualAnalyzer::hDeltaPtVsEtaSim
private

Definition at line 120 of file MuonTrackResidualAnalyzer.h.

MonitorElement* MuonTrackResidualAnalyzer::hDeltaPtVsEtaSim2
private

Definition at line 121 of file MuonTrackResidualAnalyzer.h.

MonitorElement* MuonTrackResidualAnalyzer::hDPtRef
private

Definition at line 110 of file MuonTrackResidualAnalyzer.h.

MonitorElement* MuonTrackResidualAnalyzer::hSimHitsPerTrack
private

Definition at line 118 of file MuonTrackResidualAnalyzer.h.

MonitorElement* MuonTrackResidualAnalyzer::hSimHitsPerTrackVsEta
private

Definition at line 119 of file MuonTrackResidualAnalyzer.h.

std::string MuonTrackResidualAnalyzer::out
private

Definition at line 89 of file MuonTrackResidualAnalyzer.h.

edm::ParameterSet MuonTrackResidualAnalyzer::pset
private

Definition at line 88 of file MuonTrackResidualAnalyzer.h.

edm::InputTag MuonTrackResidualAnalyzer::rpcSimHitLabel
private

Definition at line 98 of file MuonTrackResidualAnalyzer.h.

std::string MuonTrackResidualAnalyzer::subsystemname_
private

Definition at line 87 of file MuonTrackResidualAnalyzer.h.

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

Definition at line 101 of file MuonTrackResidualAnalyzer.h.

edm::InputTag MuonTrackResidualAnalyzer::theDataType
private

Definition at line 91 of file MuonTrackResidualAnalyzer.h.

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

Definition at line 92 of file MuonTrackResidualAnalyzer.h.

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

Definition at line 102 of file MuonTrackResidualAnalyzer.h.

MeasurementEstimator* MuonTrackResidualAnalyzer::theEstimator
private

Definition at line 107 of file MuonTrackResidualAnalyzer.h.

EtaRange MuonTrackResidualAnalyzer::theEtaRange
private

Definition at line 93 of file MuonTrackResidualAnalyzer.h.

int MuonTrackResidualAnalyzer::theMuonSimHitNumberPerEvent
private

Definition at line 123 of file MuonTrackResidualAnalyzer.h.

edm::InputTag MuonTrackResidualAnalyzer::theMuonTrackLabel
private

Definition at line 95 of file MuonTrackResidualAnalyzer.h.

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

Definition at line 100 of file MuonTrackResidualAnalyzer.h.

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

Definition at line 103 of file MuonTrackResidualAnalyzer.h.

MuonServiceProxy* MuonTrackResidualAnalyzer::theService
private

Definition at line 105 of file MuonTrackResidualAnalyzer.h.

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

Definition at line 128 of file MuonTrackResidualAnalyzer.h.

unsigned int MuonTrackResidualAnalyzer::theSimTkId
private

Definition at line 125 of file MuonTrackResidualAnalyzer.h.

KFUpdator* MuonTrackResidualAnalyzer::theUpdator
private

Definition at line 106 of file MuonTrackResidualAnalyzer.h.