CMS 3D CMS Logo

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

#include <MuonTrackAnalyzer.h>

Inheritance diagram for MuonTrackAnalyzer:
one::DQMEDAnalyzer< T > one::dqmimplementation::DQMBaseClass< T... >

Public Types

enum  EtaRange { all, barrel, endcap }
 

Public Member Functions

void analyze (const edm::Event &event, const edm::EventSetup &eventSetup) override
 
void beginJob () override
 
void bookHistograms (DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
 
void endRun (DQMStore::IBooker &ibooker)
 
 MuonTrackAnalyzer (const edm::ParameterSet &pset)
 Constructor. More...
 
void seedsAnalysis (const edm::Event &event, const edm::EventSetup &eventSetup, edm::Handle< edm::SimTrackContainer > simTracks)
 
void tracksAnalysis (const edm::Event &event, const edm::EventSetup &eventSetup, edm::Handle< edm::SimTrackContainer > simTracks)
 
 ~MuonTrackAnalyzer () override
 Destructor. More...
 
- Public Member Functions inherited from one::DQMEDAnalyzer< T >
 DQMEDAnalyzer ()=default
 
 DQMEDAnalyzer (DQMEDAnalyzer< T... > const &)=delete
 
 DQMEDAnalyzer (DQMEDAnalyzer< T... > &&)=delete
 
 ~DQMEDAnalyzer () override=default
 

Private Member Functions

bool checkMuonSimHitPresence (const edm::Event &event, edm::Handle< edm::SimTrackContainer > simTracks)
 
void fillPlots (const edm::Event &event, edm::Handle< edm::SimTrackContainer > &simTracks)
 
void fillPlots (reco::TransientTrack &track, SimTrack &simTrack)
 
void fillPlots (TrajectoryStateOnSurface &recoTSOS, SimTrack &simState, HTrack *, MuonPatternRecoDumper &)
 
void fillPlots (FreeTrajectoryState &recoFTS, SimTrack &simTrack, HTrack *histo, MuonPatternRecoDumper &debug)
 
TrajectoryStateOnSurface getSeedTSOS (const TrajectorySeed &seed)
 
std::pair< SimTrack, double > getSimTrack (TrajectoryStateOnSurface &tsos, edm::Handle< edm::SimTrackContainer > simTracks)
 
bool isInTheAcceptance (double eta)
 

Private Attributes

DQMStoredbe_
 
std::string dirName_
 
bool doSeedsAnalysis
 
bool doTracksAnalysis
 
MonitorElementhChargeVsEta
 
MonitorElementhChargeVsPt
 
MonitorElementhChi2
 
MonitorElementhChi2Norm
 
MonitorElementhChi2NormVsEta
 
MonitorElementhChi2Prob
 
MonitorElementhChi2ProbVsEta
 
MonitorElementhChi2VsEta
 
MonitorElementhDeltaPt_In_Out_VsEta
 
MonitorElementhDeltaPtVsEta
 
MonitorElementhDof
 
MonitorElementhDofVsEta
 
MonitorElementhHitsPerTrack
 
MonitorElementhHitsPerTrackVsEta
 
MonitorElementhNumberOfTracks
 
MonitorElementhNumberOfTracksVsEta
 
MonitorElementhPtRecVsPtGen
 
HTrackhRecoSeedInner
 
HTrackhRecoSeedPCA
 
HTrackhRecoTracksInner
 
HTrackhRecoTracksOuter
 
HTrackhRecoTracksPCA
 
HTrackVariableshSimTracks
 
int numberOfRecTracks
 
int numberOfSimTracks
 
std::string out
 
edm::ParameterSet pset
 
std::string subsystemname_
 
edm::InputTag theCSCSimHitLabel
 
edm::EDGetTokenT< std::vector< PSimHit > > theCSCSimHitToken
 
edm::InputTag theDTSimHitLabel
 
edm::EDGetTokenT< std::vector< PSimHit > > theDTSimHitToken
 
EtaRange theEtaRange
 
edm::InputTag theRPCSimHitLabel
 
edm::EDGetTokenT< std::vector< PSimHit > > theRPCSimHitToken
 
std::string theSeedPropagatorName
 
edm::InputTag theSeedsLabel
 
edm::EDGetTokenT< TrajectorySeedCollectiontheSeedsToken
 
MuonServiceProxytheService
 
edm::InputTag theSimTracksLabel
 
edm::EDGetTokenT< edm::SimTrackContainertheSimTracksToken
 
edm::InputTag theTracksLabel
 
edm::EDGetTokenT< reco::TrackCollectiontheTracksToken
 
MuonUpdatorAtVertextheUpdator
 

Detailed Description

Analyzer of the Muon tracks

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

Analyzer of the StandAlone muon tracks

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

Definition at line 48 of file MuonTrackAnalyzer.h.

Member Enumeration Documentation

Constructor & Destructor Documentation

MuonTrackAnalyzer::MuonTrackAnalyzer ( const edm::ParameterSet pset)

Constructor.

Definition at line 40 of file MuonTrackAnalyzer.cc.

References dbe_, MuonAnalyzers_cfi::EtaRange, edm::ParameterSet::getParameter(), MuonServiceProxy_cff::MuonServiceProxy, MuonUpdatorAtVertex_cff::MuonUpdatorAtVertex, Utilities::operator, MillePedeFileConverter_cfg::out, muonDTDigis_cfi::pset, and AlCaHLTBitMon_QueryRunRegistry::string.

40  {
41 
42  // service parameters
43  pset = ps;
44  ParameterSet serviceParameters = pset.getParameter<ParameterSet>("ServiceParameters");
45  // the services
46  theService = new MuonServiceProxy(serviceParameters);
47 
48  theSimTracksLabel = edm::InputTag("g4SimHits");
49  theSimTracksToken = consumes<edm::SimTrackContainer>(theSimTracksLabel);
50 
51  theTracksLabel = pset.getParameter<InputTag>("Tracks");
52  theTracksToken = consumes<reco::TrackCollection>(theTracksLabel);
53  doTracksAnalysis = pset.getUntrackedParameter<bool>("DoTracksAnalysis",true);
54 
55  doSeedsAnalysis = pset.getUntrackedParameter<bool>("DoSeedsAnalysis",false);
56  if(doSeedsAnalysis){
57  theSeedsLabel = pset.getParameter<InputTag>("MuonSeed");
58  theSeedsToken = consumes<TrajectorySeedCollection>(theSeedsLabel);
59  ParameterSet updatorPar = pset.getParameter<ParameterSet>("MuonUpdatorAtVertexParameters");
60  theSeedPropagatorName = updatorPar.getParameter<string>("Propagator");
61 
62  theUpdator = new MuonUpdatorAtVertex(updatorPar,theService);
63  }
64 
65  theCSCSimHitLabel = pset.getParameter<InputTag>("CSCSimHit");
66  theDTSimHitLabel = pset.getParameter<InputTag>("DTSimHit");
67  theRPCSimHitLabel = pset.getParameter<InputTag>("RPCSimHit");
68  theCSCSimHitToken = consumes<std::vector<PSimHit> >(theCSCSimHitLabel);
69  theDTSimHitToken = consumes<std::vector<PSimHit> >(theDTSimHitLabel);
70  theRPCSimHitToken = consumes<std::vector<PSimHit> >(theRPCSimHitLabel);
71 
72  theEtaRange = (EtaRange) pset.getParameter<int>("EtaRange");
73 
74  // number of sim tracks
76  // number of reco tracks
78 
80  out = pset.getUntrackedParameter<string>("rootFileName");
81  dirName_ = pset.getUntrackedParameter<std::string>("dirName");
82  subsystemname_ = pset.getUntrackedParameter<std::string>("subSystemFolder", "YourSubsystem") ;
83 }
std::string theSeedPropagatorName
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
edm::EDGetTokenT< TrajectorySeedCollection > theSeedsToken
edm::InputTag theCSCSimHitLabel
edm::EDGetTokenT< std::vector< PSimHit > > theCSCSimHitToken
edm::EDGetTokenT< std::vector< PSimHit > > theDTSimHitToken
edm::InputTag theDTSimHitLabel
edm::InputTag theSeedsLabel
edm::EDGetTokenT< edm::SimTrackContainer > theSimTracksToken
edm::EDGetTokenT< std::vector< PSimHit > > theRPCSimHitToken
MuonUpdatorAtVertex * theUpdator
std::string subsystemname_
edm::EDGetTokenT< reco::TrackCollection > theTracksToken
edm::InputTag theSimTracksLabel
edm::InputTag theRPCSimHitLabel
MuonServiceProxy * theService
edm::InputTag theTracksLabel
MuonTrackAnalyzer::~MuonTrackAnalyzer ( )
override

Destructor.

Definition at line 86 of file MuonTrackAnalyzer.cc.

86  {
87  if (theService) delete theService;
88 }
MuonServiceProxy * theService

Member Function Documentation

void MuonTrackAnalyzer::analyze ( const edm::Event event,
const edm::EventSetup eventSetup 
)
override

Definition at line 194 of file MuonTrackAnalyzer.cc.

References LogDebug, and tkConvValidator_cfi::simTracks.

194  {
195 
196  LogDebug("MuonTrackAnalyzer") << "Run: " << event.id().run() << " Event: " << event.id().event();
197 
198  // Update the services
199  theService->update(eventSetup);
200 
202  event.getByToken(theSimTracksToken,simTracks);
203  fillPlots(event,simTracks);
204 
205 
206  if(doTracksAnalysis)
207  tracksAnalysis(event,eventSetup,simTracks);
208 
209  if(doSeedsAnalysis)
210  seedsAnalysis(event,eventSetup,simTracks);
211 
212 
213 }
#define LogDebug(id)
void seedsAnalysis(const edm::Event &event, const edm::EventSetup &eventSetup, edm::Handle< edm::SimTrackContainer > simTracks)
edm::EDGetTokenT< edm::SimTrackContainer > theSimTracksToken
void tracksAnalysis(const edm::Event &event, const edm::EventSetup &eventSetup, edm::Handle< edm::SimTrackContainer > simTracks)
MuonServiceProxy * theService
void fillPlots(const edm::Event &event, edm::Handle< edm::SimTrackContainer > &simTracks)
void MuonTrackAnalyzer::beginJob ( void  )
override

Definition at line 90 of file MuonTrackAnalyzer.cc.

90  {
91 
92  //theFile->cd();
93 }
void MuonTrackAnalyzer::bookHistograms ( DQMStore::IBooker ibooker,
edm::Run const &  iRun,
edm::EventSetup const &   
)
override

Definition at line 94 of file MuonTrackAnalyzer.cc.

References patPFMETCorrections_cff::algo, DQMStore::IBooker::book1D(), DQMStore::IBooker::book2D(), DQMStore::IBooker::cd(), TrackerOfflineValidation_Dqm_cff::dirName, hChi2, edm::InputTag::instance(), edm::InputTag::label(), edm::InputTag::process(), python.rootplot.root2matplotlib::replace(), DQMStore::IBooker::setCurrentFolder(), and AlCaHLTBitMon_QueryRunRegistry::string.

96  {
97 
98  ibooker.cd();
99 
100 
102  string dirName=dirName_;
103  if (algo.process()!="")
104  dirName+=algo.process()+"_";
105  if(algo.label()!="")
106  dirName+=algo.label()+"_";
107  if(algo.instance()!="")
108  dirName+=algo.instance()+"";
109  if (dirName.find("Tracks")<dirName.length()){
110  dirName.replace(dirName.find("Tracks"),6,"");
111  }
112  std::replace(dirName.begin(), dirName.end(), ':', '_');
113  ibooker.setCurrentFolder(dirName);
114 
115  //ibooker.goUp();
116  std::string simName = dirName;
117  simName+="/SimTracks";
118  hSimTracks = new HTrackVariables(ibooker,simName,"SimTracks");
119 
120  ibooker.cd();
121  ibooker.setCurrentFolder(dirName);
122 
123  // Create the root file
124  //theFile = new TFile(theRootFileName.c_str(), "RECREATE");
125 
126  if(doSeedsAnalysis){
127  ibooker.cd();
128  ibooker.setCurrentFolder(dirName);
129  hRecoSeedInner = new HTrack(ibooker,dirName,"RecoSeed","Inner");
130  hRecoSeedPCA = new HTrack(ibooker,dirName,"RecoSeed","PCA");
131  }
132 
133  if(doTracksAnalysis){
134  ibooker.cd();
135  ibooker.setCurrentFolder(dirName);
136  hRecoTracksPCA = new HTrack(ibooker,dirName,"RecoTracks","PCA");
137  hRecoTracksInner = new HTrack(ibooker,dirName,"RecoTracks","Inner");
138  hRecoTracksOuter = new HTrack(ibooker,dirName,"RecoTracks","Outer");
139 
140  ibooker.cd();
141  ibooker.setCurrentFolder(dirName);
142 
143  // General Histos
144 
145 
146  hChi2 = ibooker.book1D("chi2","#chi^2",200,0,200);
147  hChi2VsEta = ibooker.book2D("chi2VsEta","#chi^2 VS #eta",120,-3.,3.,200,0,200);
148 
149  hChi2Norm = ibooker.book1D("chi2Norm","Normalized #chi^2",400,0,100);
150  hChi2NormVsEta = ibooker.book2D("chi2NormVsEta","Normalized #chi^2 VS #eta",120,-3.,3.,400,0,100);
151 
152  hHitsPerTrack = ibooker.book1D("HitsPerTrack","Number of hits per track",55,0,55);
153  hHitsPerTrackVsEta = ibooker.book2D("HitsPerTrackVsEta","Number of hits per track VS #eta",
154  120,-3.,3.,55,0,55);
155 
156  hDof = ibooker.book1D("dof","Number of Degree of Freedom",55,0,55);
157  hDofVsEta = ibooker.book2D("dofVsEta","Number of Degree of Freedom VS #eta",120,-3.,3.,55,0,55);
158 
159  hChi2Prob = ibooker.book1D("chi2Prob","#chi^2 probability",200,0,1);
160  hChi2ProbVsEta = ibooker.book2D("chi2ProbVsEta","#chi^2 probability VS #eta",120,-3.,3.,200,0,1);
161 
162  hNumberOfTracks = ibooker.book1D("NumberOfTracks","Number of reconstructed tracks per event",200,0,200);
163  hNumberOfTracksVsEta = ibooker.book2D("NumberOfTracksVsEta",
164  "Number of reconstructed tracks per event VS #eta",
165  120,-3.,3.,10,0,10);
166 
167  hChargeVsEta = ibooker.book2D("ChargeVsEta","Charge vs #eta gen",120,-3.,3.,4,-2.,2.);
168  hChargeVsPt = ibooker.book2D("ChargeVsPt","Charge vs P_{T} gen",250,0,200,4,-2.,2.);
169  hPtRecVsPtGen = ibooker.book2D("PtRecVsPtGen","P_{T} rec vs P_{T} gen",250,0,200,250,0,200);
170 
171  hDeltaPtVsEta = ibooker.book2D("DeltaPtVsEta","#Delta P_{t} vs #eta gen",120,-3.,3.,500,-250.,250.);
172  hDeltaPt_In_Out_VsEta = ibooker.book2D("DeltaPt_In_Out_VsEta_","P^{in}_{t} - P^{out}_{t} vs #eta gen",120,-3.,3.,500,-250.,250.);
173  }
174 
175 }
MonitorElement * hChi2VsEta
MonitorElement * hChi2ProbVsEta
MonitorElement * hDof
MonitorElement * hDeltaPtVsEta
def replace(string, replacements)
MonitorElement * hChi2
MonitorElement * hChi2Norm
MonitorElement * hDofVsEta
void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:268
HTrackVariables * hSimTracks
MonitorElement * hPtRecVsPtGen
MonitorElement * hChargeVsEta
MonitorElement * hHitsPerTrack
MonitorElement * hNumberOfTracks
MonitorElement * book1D(Args &&...args)
Definition: DQMStore.h:106
MonitorElement * book2D(Args &&...args)
Definition: DQMStore.h:109
MonitorElement * hHitsPerTrackVsEta
MonitorElement * hChi2NormVsEta
std::string const & label() const
Definition: InputTag.h:36
std::string const & process() const
Definition: InputTag.h:40
MonitorElement * hChargeVsPt
MonitorElement * hNumberOfTracksVsEta
MonitorElement * hChi2Prob
Definition: HTrack.h:14
std::string const & instance() const
Definition: InputTag.h:37
MonitorElement * hDeltaPt_In_Out_VsEta
edm::InputTag theTracksLabel
bool MuonTrackAnalyzer::checkMuonSimHitPresence ( const edm::Event event,
edm::Handle< edm::SimTrackContainer simTracks 
)
private

Definition at line 436 of file MuonTrackAnalyzer.cc.

References funct::abs(), and muonSimHitMatcherPSet::simTrack.

437  {
438 
439  // Get the SimHit collection from the event
440  Handle<PSimHitContainer> dtSimHits;
441  event.getByToken(theDTSimHitToken, dtSimHits);
442 
443 
444  Handle<PSimHitContainer> cscSimHits;
445  event.getByToken(theCSCSimHitToken, cscSimHits);
446 
447  Handle<PSimHitContainer> rpcSimHits;
448  event.getByToken(theRPCSimHitToken, rpcSimHits);
449 
450  map<unsigned int, vector<const PSimHit*> > mapOfMuonSimHits;
451 
452  for(PSimHitContainer::const_iterator simhit = dtSimHits->begin();
453  simhit != dtSimHits->end(); ++simhit) {
454  if (abs(simhit->particleType()) != 13) continue;
455  mapOfMuonSimHits[simhit->trackId()].push_back(&*simhit);
456  }
457 
458  for(PSimHitContainer::const_iterator simhit = cscSimHits->begin();
459  simhit != cscSimHits->end(); ++simhit) {
460  if (abs(simhit->particleType()) != 13) continue;
461  mapOfMuonSimHits[simhit->trackId()].push_back(&*simhit);
462  }
463 
464  for(PSimHitContainer::const_iterator simhit = rpcSimHits->begin();
465  simhit != rpcSimHits->end(); ++simhit) {
466  if (abs(simhit->particleType()) != 13) continue;
467  mapOfMuonSimHits[simhit->trackId()].push_back(&*simhit);
468  }
469 
470  bool presence = false;
471 
472  for (SimTrackContainer::const_iterator simTrack = simTracks->begin();
473  simTrack != simTracks->end(); ++simTrack){
474 
475  if (abs(simTrack->type()) != 13) continue;
476 
477  map<unsigned int, vector<const PSimHit*> >::const_iterator mapIterator =
478  mapOfMuonSimHits.find(simTrack->trackId());
479 
480  if (mapIterator != mapOfMuonSimHits.end())
481  presence = true;
482  }
483 
484  return presence;
485 }
edm::EDGetTokenT< std::vector< PSimHit > > theCSCSimHitToken
edm::EDGetTokenT< std::vector< PSimHit > > theDTSimHitToken
edm::EDGetTokenT< std::vector< PSimHit > > theRPCSimHitToken
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
void MuonTrackAnalyzer::endRun ( DQMStore::IBooker ibooker)

Definition at line 177 of file MuonTrackAnalyzer.cc.

References dbe_, and MillePedeFileConverter_cfg::out.

177  {
178  LogInfo("MuonTrackAnalyzer")<< "Number of Sim tracks: " << numberOfSimTracks;
179 
180  LogInfo("MuonTrackAnalyzer") << "Number of Reco tracks: " << numberOfRecTracks;
181 
182 
183  if(doTracksAnalysis){
184  double eff = hRecoTracksPCA->computeEfficiency(hSimTracks,ibooker);
185  LogInfo("MuonTrackAnalyzer") <<" *Track Efficiency* = "<< eff <<"%";
186  }
187 
188  if(doSeedsAnalysis){
189  double eff = hRecoSeedInner->computeEfficiency(hSimTracks,ibooker);
190  LogInfo("MuonTrackAnalyzer")<<" *Seed Efficiency* = "<< eff <<"%";
191  }
192  if ( !out.empty() && dbe_ ) dbe_->save(out);
193 }
HTrackVariables * hSimTracks
double computeEfficiency(HTrackVariables *sim, DQMStore::IBooker &)
Definition: HTrack.cc:141
void MuonTrackAnalyzer::fillPlots ( const edm::Event event,
edm::Handle< edm::SimTrackContainer > &  simTracks 
)
private

Definition at line 300 of file MuonTrackAnalyzer.cc.

References funct::abs(), LogTrace, muonSimHitMatcherPSet::simTrack, and mathSSE::sqrt().

300  {
301 
302  if(!checkMuonSimHitPresence(event,simTracks)) return;
303 
304  // Loop over the Sim tracks
305  SimTrackContainer::const_iterator simTrack;
306  LogTrace("MuonTrackAnalyzer")<<"Simulated tracks: "<<simTracks->size()<<endl;
307 
308  for (simTrack = simTracks->begin(); simTrack != simTracks->end(); ++simTrack)
309  if (abs((*simTrack).type()) == 13) {
310 
311  if( !isInTheAcceptance( (*simTrack).momentum().eta()) ) continue; // FIXME!!
312 
314 
315  LogTrace("MuonTrackAnalyzer")<<"Simualted muon:"<<endl;
316  LogTrace("MuonTrackAnalyzer")<<"Sim pT: "<<sqrt((*simTrack).momentum().perp2())<<endl;
317  LogTrace("MuonTrackAnalyzer")<<"Sim Eta: "<<(*simTrack).momentum().eta()<<endl; // FIXME
318 
319  hSimTracks->Fill((*simTrack).momentum().mag(),
320  sqrt((*simTrack).momentum().perp2()),
321  (*simTrack).momentum().eta(),
322  (*simTrack).momentum().phi(),
323  -(*simTrack).type()/ abs((*simTrack).type()) ); // Double FIXME
324  LogTrace("MuonTrackAnalyzer") << "hSimTracks filled" << endl;
325  }
326 
327  LogTrace("MuonTrackAnalyzer") << endl;
328 }
bool checkMuonSimHitPresence(const edm::Event &event, edm::Handle< edm::SimTrackContainer > simTracks)
HTrackVariables * hSimTracks
T sqrt(T t)
Definition: SSEVec.h:18
bool isInTheAcceptance(double eta)
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
#define LogTrace(id)
void Fill(double p, double pt, double eta, double phi, double charge)
Definition: Histograms.h:71
void MuonTrackAnalyzer::fillPlots ( reco::TransientTrack track,
SimTrack simTrack 
)
private

Definition at line 331 of file MuonTrackAnalyzer.cc.

References reco::TransientTrack::chi2(), ChiSquaredProbability(), hChi2, LogTrace, CoreSimTrack::momentum(), reco::TransientTrack::ndof(), reco::TransientTrack::normalizedChi2(), and reco::TransientTrack::recHitsSize().

331  {
332 
333  LogTrace("MuonTrackAnalyzer")<<"Analizer: New track, chi2: "<<track.chi2()<<" dof: "<<track.ndof()<<endl;
334  hChi2->Fill(track.chi2());
335  hDof->Fill(track.ndof());
336  hChi2Norm->Fill(track.normalizedChi2());
337  hHitsPerTrack->Fill(track.recHitsSize());
338 
339  hChi2Prob->Fill( ChiSquaredProbability(track.chi2(),track.ndof()) );
340 
341  hChi2VsEta->Fill(simTrack.momentum().eta(),track.chi2());
342  hChi2NormVsEta->Fill(simTrack.momentum().eta(),track.normalizedChi2());
343  hChi2ProbVsEta->Fill(simTrack.momentum().eta(),ChiSquaredProbability(track.chi2(),track.ndof()));
344  hHitsPerTrackVsEta->Fill(simTrack.momentum().eta(),track.recHitsSize());
345  hDofVsEta->Fill(simTrack.momentum().eta(),track.ndof());
346 }
MonitorElement * hChi2VsEta
MonitorElement * hChi2ProbVsEta
MonitorElement * hDof
size_t recHitsSize() const
number of RecHits
double chi2() const
chi-squared of the fit
MonitorElement * hChi2
MonitorElement * hChi2Norm
void Fill(long long x)
MonitorElement * hDofVsEta
MonitorElement * hHitsPerTrack
float ChiSquaredProbability(double chiSquared, double nrDOF)
#define LogTrace(id)
MonitorElement * hHitsPerTrackVsEta
double normalizedChi2() const
chi-squared divided by n.d.o.f.
MonitorElement * hChi2NormVsEta
double ndof() const
number of degrees of freedom of the fit
const math::XYZTLorentzVectorD & momentum() const
Definition: CoreSimTrack.h:19
MonitorElement * hChi2Prob
void MuonTrackAnalyzer::fillPlots ( TrajectoryStateOnSurface recoTSOS,
SimTrack simState,
HTrack histo,
MuonPatternRecoDumper debug 
)
private

Definition at line 349 of file MuonTrackAnalyzer.cc.

References HTrack::computeResolutionAndPull(), MuonPatternRecoDumper::dumpTSOS(), HTrack::Fill(), HTrack::FillDeltaR(), TrajectoryStateOnSurface::globalMomentum(), LogTrace, CoreSimTrack::momentum(), trackingPlots::reco, PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

350  {
351 
352  LogTrace("MuonTrackAnalyzer") << debug.dumpTSOS(recoTSOS)<<endl;
353  histo->Fill(recoTSOS);
354 
355  GlobalVector tsosVect = recoTSOS.globalMomentum();
356  math::XYZVectorD reco(tsosVect.x(), tsosVect.y(), tsosVect.z());
357  double deltaRVal = deltaR<double>(reco.eta(),reco.phi(),
358  simTrack.momentum().eta(),simTrack.momentum().phi());
359  histo->FillDeltaR(deltaRVal);
360 
361  histo->computeResolutionAndPull(recoTSOS,simTrack);
362 }
void computeResolutionAndPull(TrajectoryStateOnSurface &vtx, SimTrack &simTrack)
Definition: HTrack.cc:146
T y() const
Definition: PV3DBase.h:63
std::string dumpTSOS(const TrajectoryStateOnSurface &tsos) const
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > XYZVectorD
spatial vector with cartesian internal representation
Definition: Vector3D.h:8
T z() const
Definition: PV3DBase.h:64
void Fill(TrajectoryStateOnSurface &)
Definition: HTrack.cc:123
#define LogTrace(id)
fixed size matrix
GlobalVector globalMomentum() const
void FillDeltaR(double)
Definition: HTrack.cc:136
T x() const
Definition: PV3DBase.h:62
void MuonTrackAnalyzer::fillPlots ( FreeTrajectoryState recoFTS,
SimTrack simTrack,
HTrack histo,
MuonPatternRecoDumper debug 
)
private

Definition at line 365 of file MuonTrackAnalyzer.cc.

References HTrack::computeResolutionAndPull(), MuonPatternRecoDumper::dumpFTS(), HTrack::Fill(), HTrack::FillDeltaR(), LogTrace, CoreSimTrack::momentum(), FreeTrajectoryState::momentum(), trackingPlots::reco, PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

366  {
367 
368  LogTrace("MuonTrackAnalyzer") << debug.dumpFTS(recoFTS)<<endl;
369  histo->Fill(recoFTS);
370 
371  GlobalVector ftsVect = recoFTS.momentum();
372  math::XYZVectorD reco(ftsVect.x(), ftsVect.y(), ftsVect.z());
373  double deltaRVal = deltaR<double>(reco.eta(),reco.phi(),
374  simTrack.momentum().eta(),simTrack.momentum().phi());
375  histo->FillDeltaR(deltaRVal);
376 
377  histo->computeResolutionAndPull(recoFTS,simTrack);
378 }
void computeResolutionAndPull(TrajectoryStateOnSurface &vtx, SimTrack &simTrack)
Definition: HTrack.cc:146
T y() const
Definition: PV3DBase.h:63
std::string dumpFTS(const FreeTrajectoryState &fts) const
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > XYZVectorD
spatial vector with cartesian internal representation
Definition: Vector3D.h:8
T z() const
Definition: PV3DBase.h:64
void Fill(TrajectoryStateOnSurface &)
Definition: HTrack.cc:123
GlobalVector momentum() const
#define LogTrace(id)
fixed size matrix
const math::XYZTLorentzVectorD & momentum() const
Definition: CoreSimTrack.h:19
void FillDeltaR(double)
Definition: HTrack.cc:136
T x() const
Definition: PV3DBase.h:62
TrajectoryStateOnSurface MuonTrackAnalyzer::getSeedTSOS ( const TrajectorySeed seed)
private

Definition at line 487 of file MuonTrackAnalyzer.cc.

References PTrajectoryStateOnDet::detId(), TrajectoryStateOnSurface::freeState(), TrajectoryStateOnSurface::isValid(), oppositeToMomentum, mps_fire::result, TrajectorySeed::startingState(), GeometricSearchDet::surface(), and trajectoryStateTransform::transientState().

487  {
488 
489  // Get the Trajectory State on Det (persistent version of a TSOS) from the seed
490  PTrajectoryStateOnDet pTSOD = seed.startingState();
491 
492  // Transform it in a TrajectoryStateOnSurface
493 
494 
495  DetId seedDetId(pTSOD.detId());
496 
497  const GeomDet* gdet = theService->trackingGeometry()->idToDet( seedDetId );
498 
499  TrajectoryStateOnSurface initialState = trajectoryStateTransform::transientState(pTSOD, &(gdet->surface()), &*theService->magneticField());
500 
501  // Get the layer on which the seed relies
502  const DetLayer *initialLayer = theService->detLayerGeometry()->idToLayer( seedDetId );
503 
505 
506  // ask for compatible layers
507  vector<const DetLayer*> detLayers;
508  detLayers = theService->muonNavigationSchool()->compatibleLayers(*initialLayer, *initialState.freeState(),detLayerOrder);
509 
510  TrajectoryStateOnSurface result = initialState;
511  if(!detLayers.empty()){
512  const DetLayer* finalLayer = detLayers.back();
513  const TrajectoryStateOnSurface propagatedState = theService->propagator(theSeedPropagatorName)->propagate(initialState, finalLayer->surface());
514  if(propagatedState.isValid())
515  result = propagatedState;
516  }
517 
518  return result;
519 }
std::string theSeedPropagatorName
PropagationDirection
FreeTrajectoryState const * freeState(bool withErrors=true) const
virtual const BoundSurface & surface() const =0
The surface of the GeometricSearchDet.
unsigned int detId() const
Definition: DetId.h:18
PTrajectoryStateOnDet const & startingState() const
TrajectoryStateOnSurface transientState(const PTrajectoryStateOnDet &ts, const Surface *surface, const MagneticField *field)
MuonServiceProxy * theService
pair< SimTrack, double > MuonTrackAnalyzer::getSimTrack ( TrajectoryStateOnSurface tsos,
edm::Handle< edm::SimTrackContainer simTracks 
)
private

Definition at line 380 of file MuonTrackAnalyzer.cc.

References funct::abs(), TrajectoryStateOnSurface::globalMomentum(), LogTrace, mps_fire::result, muonSimHitMatcherPSet::simTrack, PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

381  {
382 
383 // // Loop over the Sim tracks
384 // SimTrackContainer::const_iterator simTrack;
385 
386 // SimTrack result;
387 // int mu=0;
388 // for (simTrack = simTracks->begin(); simTrack != simTracks->end(); ++simTrack)
389 // if (abs((*simTrack).type()) == 13) {
390 // result = *simTrack;
391 // ++mu;
392 // }
393 
394 // if(mu != 1) LogTrace("MuonTrackAnalyzer") << "WARNING!! more than 1 simulated muon!!" <<endl;
395 // return result;
396 
397 
398  // Loop over the Sim tracks
399  SimTrackContainer::const_iterator simTrack;
400 
402 
403  double bestDeltaR = 10e5;
404  for (simTrack = simTracks->begin(); simTrack != simTracks->end(); ++simTrack){
405  if (abs((*simTrack).type()) != 13) continue;
406 
407  // double newDeltaR = tsos.globalMomentum().basicVector().deltaR(simTrack->momentum().vect());
408  GlobalVector tsosVect = tsos.globalMomentum();
409  math::XYZVectorD vect(tsosVect.x(), tsosVect.y(), tsosVect.z());
410  double newDeltaR = deltaR<double>(vect.eta(),vect.phi(),
411  simTrack->momentum().eta(),simTrack->momentum().phi());
412 
413  if ( newDeltaR < bestDeltaR ) {
414  LogTrace("MuonTrackAnalyzer") << "Matching Track with DeltaR = " << newDeltaR<<endl;
415  bestDeltaR = newDeltaR;
416  result = *simTrack;
417  }
418  }
419  return pair<SimTrack,double>(result,bestDeltaR);
420 }
T y() const
Definition: PV3DBase.h:63
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > XYZVectorD
spatial vector with cartesian internal representation
Definition: Vector3D.h:8
T z() const
Definition: PV3DBase.h:64
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
#define LogTrace(id)
GlobalVector globalMomentum() const
T x() const
Definition: PV3DBase.h:62
bool MuonTrackAnalyzer::isInTheAcceptance ( double  eta)
private

Definition at line 423 of file MuonTrackAnalyzer.cc.

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

423  {
424  switch(theEtaRange){
425  case all:
426  return ( abs(eta) <= 2.4 ) ? true : false;
427  case barrel:
428  return ( abs(eta) < 1.1 ) ? true : false;
429  case endcap:
430  return ( abs(eta) >= 1.1 && abs(eta) <= 2.4 ) ? true : false;
431  default:
432  {LogTrace("MuonTrackAnalyzer")<<"No correct Eta range selected!! "<<endl; return false;}
433  }
434 }
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
#define LogTrace(id)
void MuonTrackAnalyzer::seedsAnalysis ( const edm::Event event,
const edm::EventSetup eventSetup,
edm::Handle< edm::SimTrackContainer simTracks 
)

Definition at line 215 of file MuonTrackAnalyzer.cc.

References debug, LogTrace, and SurveyInfoScenario_cff::seed.

216  {
217 
219 
220  // Get the RecTrack collection from the event
222  event.getByToken(theSeedsToken, seeds);
223 
224  LogTrace("MuonTrackAnalyzer")<<"Number of reconstructed seeds: " << seeds->size()<<endl;
225 
226  for(TrajectorySeedCollection::const_iterator seed = seeds->begin();
227  seed != seeds->end(); ++seed){
229  pair<SimTrack,double> sim = getSimTrack(seedTSOS,simTracks);
230  fillPlots(seedTSOS, sim.first,
231  hRecoSeedInner, debug);
232 
233  std::pair<bool,FreeTrajectoryState> propSeed =
235  if(propSeed.first)
236  fillPlots(propSeed.second, sim.first,
237  hRecoSeedPCA, debug);
238  else
239  LogTrace("MuonTrackAnalyzer")<<"Error in seed propagation"<<endl;
240 
241  }
242 }
std::pair< SimTrack, double > getSimTrack(TrajectoryStateOnSurface &tsos, edm::Handle< edm::SimTrackContainer > simTracks)
edm::EDGetTokenT< TrajectorySeedCollection > theSeedsToken
TrajectoryStateOnSurface getSeedTSOS(const TrajectorySeed &seed)
MuonUpdatorAtVertex * theUpdator
#define LogTrace(id)
#define debug
Definition: HDRShower.cc:19
void fillPlots(const edm::Event &event, edm::Handle< edm::SimTrackContainer > &simTracks)
std::pair< bool, FreeTrajectoryState > propagateToNominalLine(const TrajectoryStateOnSurface &tsos) const
Propagate the state to the 2D-PCA (nominal CMS axis)
void MuonTrackAnalyzer::tracksAnalysis ( const edm::Event event,
const edm::EventSetup eventSetup,
edm::Handle< edm::SimTrackContainer simTracks 
)

Definition at line 245 of file MuonTrackAnalyzer.cc.

References TrajectoryStateOnSurface::charge(), debug, TrajectoryStateOnSurface::globalMomentum(), LogTrace, CoreSimTrack::momentum(), PV3DBase< T, PVType, FrameType >::perp(), muonSimHitMatcherPSet::simTrack, mathSSE::sqrt(), protons_cff::t, HiIsolationCommonParameters_cff::track, and l1t::tracks.

246  {
248 
249 
250  // Get the RecTrack collection from the event
252  event.getByToken(theTracksToken, tracks);
253 
254  LogTrace("MuonTrackAnalyzer")<<"Reconstructed tracks: " << tracks->size() << endl;
255  hNumberOfTracks->Fill(tracks->size());
256 
257  if(!tracks->empty()) numberOfRecTracks++;
258 
259  // Loop over the Rec tracks
260  for(reco::TrackCollection::const_iterator t = tracks->begin(); t != tracks->end(); ++t) {
261 
262  reco::TransientTrack track(*t,&*theService->magneticField(),theService->trackingGeometry());
263 
264  TrajectoryStateOnSurface outerTSOS = track.outermostMeasurementState();
265  TrajectoryStateOnSurface innerTSOS = track.innermostMeasurementState();
266  TrajectoryStateOnSurface pcaTSOS = track.impactPointState();
267 
268  pair<SimTrack,double> sim = getSimTrack(pcaTSOS,simTracks);
269  SimTrack simTrack = sim.first;
270  hNumberOfTracksVsEta->Fill(simTrack.momentum().eta(), tracks->size());
271  fillPlots(track,simTrack);
272 
273  LogTrace("MuonTrackAnalyzer") << "State at the outer surface: " << endl;
274  fillPlots(outerTSOS,simTrack,hRecoTracksOuter,debug);
275 
276  LogTrace("MuonTrackAnalyzer") << "State at the inner surface: " << endl;
277  fillPlots(innerTSOS,simTrack,hRecoTracksInner,debug);
278 
279  LogTrace("MuonTrackAnalyzer") << "State at PCA: " << endl;
280  fillPlots(pcaTSOS,simTrack,hRecoTracksPCA,debug);
281 
282  double deltaPt_in_out = innerTSOS.globalMomentum().perp()-outerTSOS.globalMomentum().perp();
283  hDeltaPt_In_Out_VsEta->Fill(simTrack.momentum().eta(),deltaPt_in_out);
284 
285  double deltaPt_pca_sim = pcaTSOS.globalMomentum().perp()-sqrt(simTrack.momentum().Perp2());
286  hDeltaPtVsEta->Fill(simTrack.momentum().eta(),deltaPt_pca_sim);
287 
288  hChargeVsEta->Fill(simTrack.momentum().eta(),pcaTSOS.charge());
289 
290  hChargeVsPt->Fill(sqrt(simTrack.momentum().perp2()),pcaTSOS.charge());
291 
292  hPtRecVsPtGen->Fill(sqrt(simTrack.momentum().perp2()),pcaTSOS.globalMomentum().perp());
293  }
294  LogTrace("MuonTrackAnalyzer")<<"--------------------------------------------"<<endl;
295 }
T perp() const
Definition: PV3DBase.h:72
std::pair< SimTrack, double > getSimTrack(TrajectoryStateOnSurface &tsos, edm::Handle< edm::SimTrackContainer > simTracks)
MonitorElement * hDeltaPtVsEta
void Fill(long long x)
MonitorElement * hPtRecVsPtGen
MonitorElement * hChargeVsEta
T sqrt(T t)
Definition: SSEVec.h:18
MonitorElement * hNumberOfTracks
edm::EDGetTokenT< reco::TrackCollection > theTracksToken
#define LogTrace(id)
#define debug
Definition: HDRShower.cc:19
GlobalVector globalMomentum() const
const math::XYZTLorentzVectorD & momentum() const
Definition: CoreSimTrack.h:19
MonitorElement * hChargeVsPt
MonitorElement * hNumberOfTracksVsEta
MuonServiceProxy * theService
void fillPlots(const edm::Event &event, edm::Handle< edm::SimTrackContainer > &simTracks)
MonitorElement * hDeltaPt_In_Out_VsEta

Member Data Documentation

DQMStore* MuonTrackAnalyzer::dbe_
private

Definition at line 91 of file MuonTrackAnalyzer.h.

std::string MuonTrackAnalyzer::dirName_
private

Definition at line 92 of file MuonTrackAnalyzer.h.

bool MuonTrackAnalyzer::doSeedsAnalysis
private

Definition at line 117 of file MuonTrackAnalyzer.h.

bool MuonTrackAnalyzer::doTracksAnalysis
private

Definition at line 116 of file MuonTrackAnalyzer.h.

MonitorElement* MuonTrackAnalyzer::hChargeVsEta
private

Definition at line 132 of file MuonTrackAnalyzer.h.

MonitorElement* MuonTrackAnalyzer::hChargeVsPt
private

Definition at line 133 of file MuonTrackAnalyzer.h.

MonitorElement* MuonTrackAnalyzer::hChi2
private

Definition at line 124 of file MuonTrackAnalyzer.h.

MonitorElement* MuonTrackAnalyzer::hChi2Norm
private

Definition at line 125 of file MuonTrackAnalyzer.h.

MonitorElement* MuonTrackAnalyzer::hChi2NormVsEta
private

Definition at line 137 of file MuonTrackAnalyzer.h.

MonitorElement* MuonTrackAnalyzer::hChi2Prob
private

Definition at line 128 of file MuonTrackAnalyzer.h.

MonitorElement* MuonTrackAnalyzer::hChi2ProbVsEta
private

Definition at line 140 of file MuonTrackAnalyzer.h.

MonitorElement* MuonTrackAnalyzer::hChi2VsEta
private

Definition at line 136 of file MuonTrackAnalyzer.h.

MonitorElement* MuonTrackAnalyzer::hDeltaPt_In_Out_VsEta
private

Definition at line 142 of file MuonTrackAnalyzer.h.

MonitorElement* MuonTrackAnalyzer::hDeltaPtVsEta
private

Definition at line 141 of file MuonTrackAnalyzer.h.

MonitorElement* MuonTrackAnalyzer::hDof
private

Definition at line 127 of file MuonTrackAnalyzer.h.

MonitorElement* MuonTrackAnalyzer::hDofVsEta
private

Definition at line 139 of file MuonTrackAnalyzer.h.

MonitorElement* MuonTrackAnalyzer::hHitsPerTrack
private

Definition at line 126 of file MuonTrackAnalyzer.h.

MonitorElement* MuonTrackAnalyzer::hHitsPerTrackVsEta
private

Definition at line 138 of file MuonTrackAnalyzer.h.

MonitorElement* MuonTrackAnalyzer::hNumberOfTracks
private

Definition at line 130 of file MuonTrackAnalyzer.h.

MonitorElement* MuonTrackAnalyzer::hNumberOfTracksVsEta
private

Definition at line 131 of file MuonTrackAnalyzer.h.

MonitorElement* MuonTrackAnalyzer::hPtRecVsPtGen
private

Definition at line 134 of file MuonTrackAnalyzer.h.

HTrack* MuonTrackAnalyzer::hRecoSeedInner
private

Definition at line 146 of file MuonTrackAnalyzer.h.

HTrack* MuonTrackAnalyzer::hRecoSeedPCA
private

Definition at line 147 of file MuonTrackAnalyzer.h.

HTrack* MuonTrackAnalyzer::hRecoTracksInner
private

Definition at line 149 of file MuonTrackAnalyzer.h.

HTrack* MuonTrackAnalyzer::hRecoTracksOuter
private

Definition at line 150 of file MuonTrackAnalyzer.h.

HTrack* MuonTrackAnalyzer::hRecoTracksPCA
private

Definition at line 148 of file MuonTrackAnalyzer.h.

HTrackVariables* MuonTrackAnalyzer::hSimTracks
private

Definition at line 144 of file MuonTrackAnalyzer.h.

int MuonTrackAnalyzer::numberOfRecTracks
private

Definition at line 154 of file MuonTrackAnalyzer.h.

int MuonTrackAnalyzer::numberOfSimTracks
private

Definition at line 153 of file MuonTrackAnalyzer.h.

std::string MuonTrackAnalyzer::out
private

Definition at line 94 of file MuonTrackAnalyzer.h.

edm::ParameterSet MuonTrackAnalyzer::pset
private

Definition at line 96 of file MuonTrackAnalyzer.h.

std::string MuonTrackAnalyzer::subsystemname_
private

Definition at line 95 of file MuonTrackAnalyzer.h.

edm::InputTag MuonTrackAnalyzer::theCSCSimHitLabel
private

Definition at line 104 of file MuonTrackAnalyzer.h.

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

Definition at line 111 of file MuonTrackAnalyzer.h.

edm::InputTag MuonTrackAnalyzer::theDTSimHitLabel
private

Definition at line 105 of file MuonTrackAnalyzer.h.

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

Definition at line 112 of file MuonTrackAnalyzer.h.

EtaRange MuonTrackAnalyzer::theEtaRange
private

Definition at line 99 of file MuonTrackAnalyzer.h.

edm::InputTag MuonTrackAnalyzer::theRPCSimHitLabel
private

Definition at line 106 of file MuonTrackAnalyzer.h.

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

Definition at line 113 of file MuonTrackAnalyzer.h.

std::string MuonTrackAnalyzer::theSeedPropagatorName
private

Definition at line 118 of file MuonTrackAnalyzer.h.

edm::InputTag MuonTrackAnalyzer::theSeedsLabel
private

Definition at line 102 of file MuonTrackAnalyzer.h.

edm::EDGetTokenT<TrajectorySeedCollection> MuonTrackAnalyzer::theSeedsToken
private

Definition at line 109 of file MuonTrackAnalyzer.h.

MuonServiceProxy* MuonTrackAnalyzer::theService
private

Definition at line 120 of file MuonTrackAnalyzer.h.

edm::InputTag MuonTrackAnalyzer::theSimTracksLabel
private

Definition at line 101 of file MuonTrackAnalyzer.h.

edm::EDGetTokenT<edm::SimTrackContainer> MuonTrackAnalyzer::theSimTracksToken
private

Definition at line 108 of file MuonTrackAnalyzer.h.

edm::InputTag MuonTrackAnalyzer::theTracksLabel
private

Definition at line 103 of file MuonTrackAnalyzer.h.

edm::EDGetTokenT<reco::TrackCollection> MuonTrackAnalyzer::theTracksToken
private

Definition at line 110 of file MuonTrackAnalyzer.h.

MuonUpdatorAtVertex* MuonTrackAnalyzer::theUpdator
private

Definition at line 121 of file MuonTrackAnalyzer.h.