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:
edm::EDAnalyzer edm::EDConsumerBase

Classes

struct  RadiusComparatorInOut
 

Public Types

enum  EtaRange { all, barrel, endcap }
 
- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 

Public Member Functions

void analyze (const edm::Event &event, const edm::EventSetup &eventSetup)
 
virtual void beginJob ()
 
virtual void beginRun ()
 
virtual void endJob ()
 
virtual void endRun ()
 
 MuonTrackResidualAnalyzer (const edm::ParameterSet &pset)
 Constructor. More...
 
virtual ~MuonTrackResidualAnalyzer ()
 Destructor. More...
 
- Public Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 
- Public Member Functions inherited from edm::EDConsumerBase
 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
 
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::InputTag rpcSimHitLabel
 
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 edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
- 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 45 of file MuonTrackResidualAnalyzer.h.

Member Enumeration Documentation

Constructor & Destructor Documentation

MuonTrackResidualAnalyzer::MuonTrackResidualAnalyzer ( const edm::ParameterSet pset)

Constructor.

Definition at line 37 of file MuonTrackResidualAnalyzer.cc.

References Chi2MeasurementEstimatorESProducer_cfi::Chi2MeasurementEstimator, dbe_, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), LogDebug, MuonServiceProxy_cff::MuonServiceProxy, cppFunctionSkipper::operator, dbtoconf::out, and AlCaHLTBitMon_QueryRunRegistry::string.

37  {
38 
39  // service parameters
40  ParameterSet serviceParameters = pset.getParameter<ParameterSet>("ServiceParameters");
41  // the services
42  theService = new MuonServiceProxy(serviceParameters);
43 
44  theMuonTrackLabel = pset.getParameter<InputTag>("MuonTrack");
45  theMuonTrackToken = consumes<reco::TrackCollection>(theMuonTrackLabel);
46 
47  cscSimHitLabel = pset.getParameter<InputTag>("CSCSimHit");
48  dtSimHitLabel = pset.getParameter<InputTag>("DTSimHit");
49  rpcSimHitLabel = pset.getParameter<InputTag>("RPCSimHit");
50  theCSCSimHitToken = consumes<std::vector<PSimHit> >(cscSimHitLabel);
51  theDTSimHitToken = consumes<std::vector<PSimHit> >(dtSimHitLabel);
52  theRPCSimHitToken = consumes<std::vector<PSimHit> >(rpcSimHitLabel);
53 
55  out = pset.getUntrackedParameter<string>("rootFileName");
56  dirName_ = pset.getUntrackedParameter<std::string>("dirName");
57 
58  // Sim or Real
59  theDataType = pset.getParameter<InputTag>("DataType");
60  if(theDataType.label() != "RealData" && theDataType.label() != "SimData")
61  LogDebug("MuonTrackResidualAnalyzer")<<"Error in Data Type!!";
62  theDataTypeToken = consumes<edm::SimTrackContainer>(theDataType);
63 
64  theEtaRange = (EtaRange) pset.getParameter<int>("EtaRange");
65 
66  theUpdator = new KFUpdator();
68 
70 }
#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:42
edm::EDGetTokenT< edm::SimTrackContainer > theDataTypeToken
edm::EDGetTokenT< std::vector< PSimHit > > theCSCSimHitToken
edm::EDGetTokenT< std::vector< PSimHit > > theDTSimHitToken
MuonTrackResidualAnalyzer::~MuonTrackResidualAnalyzer ( )
virtual

Destructor.

Definition at line 73 of file MuonTrackResidualAnalyzer.cc.

73  {
74  delete theUpdator;
75  delete theEstimator;
76  delete theService;
77 }
MeasurementEstimator * theEstimator

Member Function Documentation

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

Implements edm::EDAnalyzer.

Definition at line 124 of file MuonTrackResidualAnalyzer.cc.

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

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

Reimplemented from edm::EDAnalyzer.

Definition at line 80 of file MuonTrackResidualAnalyzer.cc.

80  {
81 
82 }
void MuonTrackResidualAnalyzer::beginRun ( void  )
virtual

Definition at line 86 of file MuonTrackResidualAnalyzer.cc.

References DQMStore::book1D(), DQMStore::book2D(), DQMStore::cd(), dbe_, TrackerOfflineValidation_Dqm_cff::dirName, edm::InputTag::instance(), edm::InputTag::label(), LogDebug, edm::InputTag::process(), python.rootplot.root2matplotlib::replace(), DQMStore::setCurrentFolder(), and DQMStore::showDirStructure().

86  {
87  LogDebug("MuonTrackResidualAnalyzer")<<"Begin Run";
88 
90 
91  dbe_->cd();
93  string dirName=dirName_;
94  if (algo.process()!="")
95  dirName+=algo.process()+"_";
96  if(algo.label()!="")
97  dirName+=algo.label()+"_";
98  if(algo.instance()!="")
99  dirName+=algo.instance()+"";
100  if (dirName.find("Tracks")<dirName.length()){
101  dirName.replace(dirName.find("Tracks"),6,"");
102  }
103  std::replace(dirName.begin(), dirName.end(), ':', '_');
104  dbe_->setCurrentFolder(dirName.c_str());
105 
106 
107  hDPtRef = dbe_->book1D("DeltaPtRef","P^{in}_{t}-P^{in ref}",10000,-20,20);
108 
109  // Resolution wrt the 1D Rec Hits
110  // h1DRecHitRes = new HResolution1DRecHit("TotalRec");
111 
112  // Resolution wrt the 1d Sim Hits
113  // h1DSimHitRes = new HResolution1DRecHit("TotalSim");
114 
115  hSimHitsPerTrack = dbe_->book1D("SimHitsPerTrack","Number of sim hits per track",55,0,55);
116  hSimHitsPerTrackVsEta = dbe_->book2D("SimHitsPerTrackVsEta","Number of sim hits per track VS #eta",120,-3.,3.,55,0,55);
117  hDeltaPtVsEtaSim = dbe_->book2D("DeltaPtVsEtaSim","#Delta P_{t} vs #eta gen, sim quantity",120,-3.,3.,500,-250.,250.);
118  hDeltaPtVsEtaSim2 = dbe_->book2D("DeltaPtVsEtaSim2","#Delta P_{t} vs #eta gen, sim quantity",120,-3.,3.,500,-250.,250.);
119 }
#define LogDebug(id)
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
Definition: DQMStore.cc:872
void cd(void)
go to top directory (ie. root)
Definition: DQMStore.cc:561
std::string const & label() const
Definition: InputTag.h:42
std::string const & process() const
Definition: InputTag.h:46
void showDirStructure(void) const
Definition: DQMStore.cc:2961
MonitorElement * book2D(const char *name, const char *title, int nchX, double lowX, double highX, int nchY, double lowY, double highY)
Book 2D histogram.
Definition: DQMStore.cc:1000
std::string const & instance() const
Definition: InputTag.h:43
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:584
void MuonTrackResidualAnalyzer::computeResolution ( Trajectory trajectory,
std::map< DetId, const PSimHit * > &  hitIdMap,
HResolution1DRecHit histos 
)
private

Definition at line 336 of file MuonTrackResidualAnalyzer.cc.

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

338  {
339 
341 
342  for(Trajectory::DataContainer::const_iterator datum = data.begin();
343  datum != data.end(); ++datum){
344 
345  GlobalPoint fitPoint = datum->updatedState().globalPosition();
346 
347  // FIXME!
348  // double errX = datum->updatedState().cartesianError().matrix()[0][0];
349  // double errY = datum->updatedState().cartesianError().matrix()[1][1];
350  // double errZ = datum->updatedState().cartesianError().matrix()[2][2];
351  //
352  double errX = datum->updatedState().localError().matrix()(3,3);
353  double errY = datum->updatedState().localError().matrix()(4,4);
354  double errZ = 1.;
355 
356  map<DetId,const PSimHit*>::const_iterator it = hitIdMap.find(datum->recHit()->geographicalId());
357 
358 
359  if (it == hitIdMap.end() ) continue; // FIXME! Put a counter
360 
361  const PSimHit* simhit = it->second;
362 
363  LocalPoint simHitPoint = simhit->localPosition();
364 
365  const GeomDet* geomDet = theService->trackingGeometry()->idToDet(DetId(simhit->detUnitId()));
366 
367  LocalPoint fitLocalPoint = geomDet->toLocal(fitPoint);
368 
369  LocalVector diff = fitLocalPoint-simHitPoint;
370 
371 
372  cout << "SimHit position "<< simHitPoint << endl;
373  cout << "Fit position "<< fitLocalPoint << endl;
374  cout << "Fit position2 "<< datum->updatedState().localPosition() << endl;
375  cout << "Errors on the fit position: (" << errX << "," << errY << "," << errZ << ")"<<endl;
376  cout << "Resolution on x: " << diff.x()/abs(simHitPoint.x()) << endl;
377  cout << "Resolution on y: " << diff.y()/abs(simHitPoint.y()) << endl;
378  cout << "Resolution on z: " << diff.z()/abs(simHitPoint.z()) << endl;
379 
380  cout << "Eta direction: "<< simhit->momentumAtEntry().eta() <<" eta position: " << simHitPoint.eta() << endl;
381  cout << "Phi direction: "<< simhit->momentumAtEntry().phi() <<" phi position: " << simHitPoint.phi() << endl;
382 
383 
384  histos->Fill( simHitPoint.x(), simHitPoint.y(), simHitPoint.z(),
385  diff.x(), diff.y(), diff.z(),
386  errX, errY, errZ,
387  simhit->momentumAtEntry().eta(), simhit->momentumAtEntry().phi());
388  // simHitPoint.eta(), simHitPoint.phi() ); // FIXME!
389  }
390 
391 
392 }
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:62
DataContainer const & measurements() const
Definition: Trajectory.h:215
std::vector< TrajectoryMeasurement > DataContainer
Definition: Trajectory.h:42
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
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
tuple cout
Definition: gather_cfg.py:121
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:338
T x() const
Definition: PV3DBase.h:62
unsigned int detUnitId() const
Definition: PSimHit.h:93
void MuonTrackResidualAnalyzer::endJob ( void  )
virtual

Reimplemented from edm::EDAnalyzer.

Definition at line 84 of file MuonTrackResidualAnalyzer.cc.

84  {
85 }
void MuonTrackResidualAnalyzer::endRun ( void  )
virtual

Definition at line 121 of file MuonTrackResidualAnalyzer.cc.

References dbe_, dbtoconf::out, and DQMStore::save().

121  {
122  if ( out.size() != 0 && dbe_ ) dbe_->save(out);
123 }
void save(const std::string &filename, const std::string &path="", const std::string &pattern="", const std::string &rewrite="", const uint32_t run=0, SaveReferenceTag ref=SaveWithReference, int minStatus=dqm::qstatus::STATUS_OK, const std::string &fileupdate="RECREATE")
Definition: DQMStore.cc:2296
bool MuonTrackResidualAnalyzer::isInTheAcceptance ( double  eta)
private

Definition at line 262 of file MuonTrackResidualAnalyzer.cc.

References funct::abs(), cond::ecalcond::all, Reference_intrackfit_cff::barrel, Reference_intrackfit_cff::endcap, and LogDebug.

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

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

279  {
280 
282 
283  map<DetId,const PSimHit*> hitIdMap;
284  theSimHitContainer.clear();
285 
286  mapMuSimHitsPerId(dtSimhits,hitIdMap);
287  mapMuSimHitsPerId(cscSimhits,hitIdMap);
288  mapMuSimHitsPerId(rpcSimhits,hitIdMap);
289 
290  if(theSimHitContainer.size() >1)
291  stable_sort(theSimHitContainer.begin(),theSimHitContainer.end(),RadiusComparatorInOut(theService->trackingGeometry()));
292 
293  LogDebug("MuonTrackResidualAnalyzer")<<"Sim Hit list";
294  int count=1;
295  for(vector<const PSimHit*>::const_iterator it = theSimHitContainer.begin();
296  it != theSimHitContainer.end(); ++it){
297  LogTrace("MuonTrackResidualAnalyzer")<<count
298  << " "
299  << " Process Type: " << (*it)->processType()
300  << " "
301  << debug.dumpMuonId(DetId( (*it)->detUnitId() ))<<endl;
302  }
303 
304  return hitIdMap;
305 }
#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 308 of file MuonTrackResidualAnalyzer.cc.

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

309  {
310 
311  for(PSimHitContainer::const_iterator simhit = simhits->begin();
312  simhit != simhits->end(); ++simhit) {
313 
314  if ( abs(simhit->particleType()) != 13 && theSimTkId != simhit->trackId()) continue;
315 
316  theSimHitContainer.push_back(&*simhit);
317  DetId id = DetId(simhit->detUnitId());
318 
319  if(id.subdetId() == MuonSubdetId::DT){
320  DTLayerId lId(id.rawId());
321  id = DetId(lId.rawId());
322  }
323 
324  map<DetId,const PSimHit*>::const_iterator it = hitIdMap.find(id);
325 
326  if (it == hitIdMap.end() )
327  hitIdMap[id] = &*simhit;
328  else
329  LogDebug("MuonTrackResidualAnalyzer")<<"TWO muons in the same sensible volume!!";
330 
332  }
333 }
#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 94 of file MuonTrackResidualAnalyzer.h.

DQMStore* MuonTrackResidualAnalyzer::dbe_
private

Definition at line 84 of file MuonTrackResidualAnalyzer.h.

std::string MuonTrackResidualAnalyzer::dirName_
private

Definition at line 85 of file MuonTrackResidualAnalyzer.h.

edm::InputTag MuonTrackResidualAnalyzer::dtSimHitLabel
private

Definition at line 95 of file MuonTrackResidualAnalyzer.h.

HResolution1DRecHit* MuonTrackResidualAnalyzer::h1DRecHitRes
private

Definition at line 111 of file MuonTrackResidualAnalyzer.h.

HResolution1DRecHit* MuonTrackResidualAnalyzer::h1DSimHitRes
private

Definition at line 114 of file MuonTrackResidualAnalyzer.h.

MonitorElement* MuonTrackResidualAnalyzer::hDeltaPtVsEtaSim
private

Definition at line 118 of file MuonTrackResidualAnalyzer.h.

MonitorElement* MuonTrackResidualAnalyzer::hDeltaPtVsEtaSim2
private

Definition at line 119 of file MuonTrackResidualAnalyzer.h.

MonitorElement* MuonTrackResidualAnalyzer::hDPtRef
private

Definition at line 108 of file MuonTrackResidualAnalyzer.h.

MonitorElement* MuonTrackResidualAnalyzer::hSimHitsPerTrack
private

Definition at line 116 of file MuonTrackResidualAnalyzer.h.

MonitorElement* MuonTrackResidualAnalyzer::hSimHitsPerTrackVsEta
private

Definition at line 117 of file MuonTrackResidualAnalyzer.h.

std::string MuonTrackResidualAnalyzer::out
private

Definition at line 87 of file MuonTrackResidualAnalyzer.h.

edm::InputTag MuonTrackResidualAnalyzer::rpcSimHitLabel
private

Definition at line 96 of file MuonTrackResidualAnalyzer.h.

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

Definition at line 99 of file MuonTrackResidualAnalyzer.h.

edm::InputTag MuonTrackResidualAnalyzer::theDataType
private

Definition at line 89 of file MuonTrackResidualAnalyzer.h.

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

Definition at line 90 of file MuonTrackResidualAnalyzer.h.

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

Definition at line 100 of file MuonTrackResidualAnalyzer.h.

MeasurementEstimator* MuonTrackResidualAnalyzer::theEstimator
private

Definition at line 105 of file MuonTrackResidualAnalyzer.h.

EtaRange MuonTrackResidualAnalyzer::theEtaRange
private

Definition at line 91 of file MuonTrackResidualAnalyzer.h.

int MuonTrackResidualAnalyzer::theMuonSimHitNumberPerEvent
private

Definition at line 121 of file MuonTrackResidualAnalyzer.h.

edm::InputTag MuonTrackResidualAnalyzer::theMuonTrackLabel
private

Definition at line 93 of file MuonTrackResidualAnalyzer.h.

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

Definition at line 98 of file MuonTrackResidualAnalyzer.h.

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

Definition at line 101 of file MuonTrackResidualAnalyzer.h.

MuonServiceProxy* MuonTrackResidualAnalyzer::theService
private

Definition at line 103 of file MuonTrackResidualAnalyzer.h.

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

Definition at line 126 of file MuonTrackResidualAnalyzer.h.

unsigned int MuonTrackResidualAnalyzer::theSimTkId
private

Definition at line 123 of file MuonTrackResidualAnalyzer.h.

KFUpdator* MuonTrackResidualAnalyzer::theUpdator
private

Definition at line 104 of file MuonTrackResidualAnalyzer.h.