CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Types | Public Member Functions | Private Member Functions | Private Attributes
MuonTrackAnalyzer Class Reference

#include <MuonTrackAnalyzer.h>

Inheritance diagram for MuonTrackAnalyzer:
edm::EDAnalyzer edm::EDConsumerBase

Public Types

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

Public Member Functions

void analyze (const edm::Event &event, const edm::EventSetup &eventSetup)
 
virtual void beginJob ()
 
virtual void endJob ()
 
 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)
 
virtual ~MuonTrackAnalyzer ()
 Destructor. More...
 
- Public Member Functions inherited from edm::EDAnalyzer
 EDAnalyzer ()
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 
- Public Member Functions inherited from edm::EDConsumerBase
 EDConsumerBase ()
 
ProductHolderIndex indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndex > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndex > &) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

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::InputTag theCSCSimHitLabel
 
edm::InputTag theDTSimHitLabel
 
EtaRange theEtaRange
 
edm::InputTag theRPCSimHitLabel
 
std::string theSeedPropagatorName
 
edm::InputTag theSeedsLabel
 
MuonServiceProxytheService
 
edm::InputTag theTracksLabel
 
MuonUpdatorAtVertextheUpdator
 

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::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
CurrentProcessingContext const * currentContext () const
 
- 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

Analyzer of the Muon tracks

Date:
2011/12/22 20:44:37
Revision:
1.9
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

Date:
2010/02/20 21:02:35
Revision:
1.6
Author
R. Bellan - INFN Torino ricca.nosp@m.rdo..nosp@m.bella.nosp@m.n@ce.nosp@m.rn.ch

Definition at line 40 of file MuonTrackAnalyzer.h.

Member Enumeration Documentation

Constructor & Destructor Documentation

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

Constructor.

Definition at line 49 of file MuonTrackAnalyzer.cc.

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

49  {
50 
51  // service parameters
52  ParameterSet serviceParameters = pset.getParameter<ParameterSet>("ServiceParameters");
53  // the services
54  theService = new MuonServiceProxy(serviceParameters);
55 
56  theTracksLabel = pset.getParameter<InputTag>("Tracks");
57  doTracksAnalysis = pset.getUntrackedParameter<bool>("DoTracksAnalysis",true);
58 
59  doSeedsAnalysis = pset.getUntrackedParameter<bool>("DoSeedsAnalysis",false);
60  if(doSeedsAnalysis){
61  theSeedsLabel = pset.getParameter<InputTag>("MuonSeed");
62  ParameterSet updatorPar = pset.getParameter<ParameterSet>("MuonUpdatorAtVertexParameters");
63  theSeedPropagatorName = updatorPar.getParameter<string>("Propagator");
64 
65  theUpdator = new MuonUpdatorAtVertex(updatorPar,theService);
66  }
67 
68  theCSCSimHitLabel = pset.getParameter<InputTag>("CSCSimHit");
69  theDTSimHitLabel = pset.getParameter<InputTag>("DTSimHit");
70  theRPCSimHitLabel = pset.getParameter<InputTag>("RPCSimHit");
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 
83 }
std::string theSeedPropagatorName
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
edm::InputTag theCSCSimHitLabel
edm::InputTag theDTSimHitLabel
edm::InputTag theSeedsLabel
MuonUpdatorAtVertex * theUpdator
edm::InputTag theRPCSimHitLabel
MuonServiceProxy * theService
edm::InputTag theTracksLabel
MuonTrackAnalyzer::~MuonTrackAnalyzer ( )
virtual

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 
)
virtual

Implements edm::EDAnalyzer.

Definition at line 190 of file MuonTrackAnalyzer.cc.

References LogDebug.

190  {
191 
192  LogDebug("MuonTrackAnalyzer") << "Run: " << event.id().run() << " Event: " << event.id().event();
193 
194  // Update the services
195  theService->update(eventSetup);
196 
197  Handle<SimTrackContainer> simTracks;
198  event.getByLabel("g4SimHits",simTracks);
199  fillPlots(event,simTracks);
200 
201 
202  if(doTracksAnalysis)
203  tracksAnalysis(event,eventSetup,simTracks);
204 
205  if(doSeedsAnalysis)
206  seedsAnalysis(event,eventSetup,simTracks);
207 
208 
209 }
#define LogDebug(id)
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)
MuonServiceProxy * theService
void fillPlots(const edm::Event &event, edm::Handle< edm::SimTrackContainer > &simTracks)
void MuonTrackAnalyzer::beginJob ( void  )
virtual

Reimplemented from edm::EDAnalyzer.

Definition at line 90 of file MuonTrackAnalyzer.cc.

References DQMStore::book1D(), DQMStore::book2D(), DQMStore::cd(), dbe_, TrackerOfflineValidation_Dqm_cff::dirName, hChi2, edm::InputTag::instance(), edm::InputTag::label(), edm::InputTag::process(), linker::replace(), DQMStore::setCurrentFolder(), DQMStore::showDirStructure(), and AlCaHLTBitMon_QueryRunRegistry::string.

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

Definition at line 432 of file MuonTrackAnalyzer.cc.

References abs.

433  {
434 
435  // Get the SimHit collection from the event
436  Handle<PSimHitContainer> dtSimHits;
437  event.getByLabel(theDTSimHitLabel.instance(),theDTSimHitLabel.label(), dtSimHits);
438 
439  Handle<PSimHitContainer> cscSimHits;
440  event.getByLabel(theCSCSimHitLabel.instance(),theCSCSimHitLabel.label(), cscSimHits);
441 
442  Handle<PSimHitContainer> rpcSimHits;
443  event.getByLabel(theRPCSimHitLabel.instance(),theRPCSimHitLabel.label(), rpcSimHits);
444 
445  map<unsigned int, vector<const PSimHit*> > mapOfMuonSimHits;
446 
447  for(PSimHitContainer::const_iterator simhit = dtSimHits->begin();
448  simhit != dtSimHits->end(); ++simhit) {
449  if (abs(simhit->particleType()) != 13) continue;
450  mapOfMuonSimHits[simhit->trackId()].push_back(&*simhit);
451  }
452 
453  for(PSimHitContainer::const_iterator simhit = cscSimHits->begin();
454  simhit != cscSimHits->end(); ++simhit) {
455  if (abs(simhit->particleType()) != 13) continue;
456  mapOfMuonSimHits[simhit->trackId()].push_back(&*simhit);
457  }
458 
459  for(PSimHitContainer::const_iterator simhit = rpcSimHits->begin();
460  simhit != rpcSimHits->end(); ++simhit) {
461  if (abs(simhit->particleType()) != 13) continue;
462  mapOfMuonSimHits[simhit->trackId()].push_back(&*simhit);
463  }
464 
465  bool presence = false;
466 
467  for (SimTrackContainer::const_iterator simTrack = simTracks->begin();
468  simTrack != simTracks->end(); ++simTrack){
469 
470  if (abs(simTrack->type()) != 13) continue;
471 
472  map<unsigned int, vector<const PSimHit*> >::const_iterator mapIterator =
473  mapOfMuonSimHits.find(simTrack->trackId());
474 
475  if (mapIterator != mapOfMuonSimHits.end())
476  presence = true;
477  }
478 
479  return presence;
480 }
edm::InputTag theCSCSimHitLabel
#define abs(x)
Definition: mlp_lapack.h:159
edm::InputTag theDTSimHitLabel
edm::InputTag theRPCSimHitLabel
std::string const & label() const
Definition: InputTag.h:42
std::string const & instance() const
Definition: InputTag.h:43
void MuonTrackAnalyzer::endJob ( void  )
virtual

Reimplemented from edm::EDAnalyzer.

Definition at line 171 of file MuonTrackAnalyzer.cc.

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

171  {
172  LogInfo("MuonTrackAnalyzer")<< "Number of Sim tracks: " << numberOfSimTracks;
173 
174  LogInfo("MuonTrackAnalyzer") << "Number of Reco tracks: " << numberOfRecTracks;
175 
176 
177  if(doTracksAnalysis){
179  LogInfo("MuonTrackAnalyzer") <<" *Track Efficiency* = "<< eff <<"%";
180  }
181 
182  if(doSeedsAnalysis){
184  LogInfo("MuonTrackAnalyzer")<<" *Seed Efficiency* = "<< eff <<"%";
185  }
186 
187  if ( out.size() != 0 && dbe_ ) dbe_->save(out);
188 }
void save(const std::string &filename, const std::string &path="", const std::string &pattern="", const std::string &rewrite="", SaveReferenceTag ref=SaveWithReference, int minStatus=dqm::qstatus::STATUS_OK, const std::string &fileupdate="RECREATE")
Definition: DQMStore.cc:2118
HTrackVariables * hSimTracks
double computeEfficiency(HTrackVariables *sim)
Definition: HTrack.cc:147
void MuonTrackAnalyzer::fillPlots ( const edm::Event event,
edm::Handle< edm::SimTrackContainer > &  simTracks 
)
private

Definition at line 296 of file MuonTrackAnalyzer.cc.

References abs, LogTrace, and mathSSE::sqrt().

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

Definition at line 327 of file MuonTrackAnalyzer.cc.

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

327  {
328 
329  LogTrace("MuonTrackAnalyzer")<<"Analizer: New track, chi2: "<<track.chi2()<<" dof: "<<track.ndof()<<endl;
330  hChi2->Fill(track.chi2());
331  hDof->Fill(track.ndof());
332  hChi2Norm->Fill(track.normalizedChi2());
333  hHitsPerTrack->Fill(track.recHitsSize());
334 
335  hChi2Prob->Fill( ChiSquaredProbability(track.chi2(),track.ndof()) );
336 
337  hChi2VsEta->Fill(simTrack.momentum().eta(),track.chi2());
338  hChi2NormVsEta->Fill(simTrack.momentum().eta(),track.normalizedChi2());
339  hChi2ProbVsEta->Fill(simTrack.momentum().eta(),ChiSquaredProbability(track.chi2(),track.ndof()));
340  hHitsPerTrackVsEta->Fill(simTrack.momentum().eta(),track.recHitsSize());
341  hDofVsEta->Fill(simTrack.momentum().eta(),track.ndof());
342 }
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
particle info...
Definition: CoreSimTrack.h:36
MonitorElement * hChi2Prob
void MuonTrackAnalyzer::fillPlots ( TrajectoryStateOnSurface recoTSOS,
SimTrack simState,
HTrack histo,
MuonPatternRecoDumper debug 
)
private

Definition at line 345 of file MuonTrackAnalyzer.cc.

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

346  {
347 
348  LogTrace("MuonTrackAnalyzer") << debug.dumpTSOS(recoTSOS)<<endl;
349  histo->Fill(recoTSOS);
350 
351  GlobalVector tsosVect = recoTSOS.globalMomentum();
352  math::XYZVectorD reco(tsosVect.x(), tsosVect.y(), tsosVect.z());
353  double deltaRVal = deltaR<double>(reco.eta(),reco.phi(),
354  simTrack.momentum().eta(),simTrack.momentum().phi());
355  histo->FillDeltaR(deltaRVal);
356 
357  histo->computeResolutionAndPull(recoTSOS,simTrack);
358 }
void computeResolutionAndPull(TrajectoryStateOnSurface &vtx, SimTrack &simTrack)
Definition: HTrack.cc:152
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:9
T z() const
Definition: PV3DBase.h:64
void Fill(TrajectoryStateOnSurface &)
Definition: HTrack.cc:129
#define LogTrace(id)
GlobalVector globalMomentum() const
void FillDeltaR(double)
Definition: HTrack.cc:142
T x() const
Definition: PV3DBase.h:62
void MuonTrackAnalyzer::fillPlots ( FreeTrajectoryState recoFTS,
SimTrack simTrack,
HTrack histo,
MuonPatternRecoDumper debug 
)
private

Definition at line 361 of file MuonTrackAnalyzer.cc.

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

362  {
363 
364  LogTrace("MuonTrackAnalyzer") << debug.dumpFTS(recoFTS)<<endl;
365  histo->Fill(recoFTS);
366 
367  GlobalVector ftsVect = recoFTS.momentum();
368  math::XYZVectorD reco(ftsVect.x(), ftsVect.y(), ftsVect.z());
369  double deltaRVal = deltaR<double>(reco.eta(),reco.phi(),
370  simTrack.momentum().eta(),simTrack.momentum().phi());
371  histo->FillDeltaR(deltaRVal);
372 
373  histo->computeResolutionAndPull(recoFTS,simTrack);
374 }
void computeResolutionAndPull(TrajectoryStateOnSurface &vtx, SimTrack &simTrack)
Definition: HTrack.cc:152
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:9
T z() const
Definition: PV3DBase.h:64
void Fill(TrajectoryStateOnSurface &)
Definition: HTrack.cc:129
GlobalVector momentum() const
#define LogTrace(id)
const math::XYZTLorentzVectorD & momentum() const
particle info...
Definition: CoreSimTrack.h:36
void FillDeltaR(double)
Definition: HTrack.cc:142
T x() const
Definition: PV3DBase.h:62
TrajectoryStateOnSurface MuonTrackAnalyzer::getSeedTSOS ( const TrajectorySeed seed)
private

Definition at line 482 of file MuonTrackAnalyzer.cc.

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

482  {
483 
484  // Get the Trajectory State on Det (persistent version of a TSOS) from the seed
485  PTrajectoryStateOnDet pTSOD = seed.startingState();
486 
487  // Transform it in a TrajectoryStateOnSurface
488 
489 
490  DetId seedDetId(pTSOD.detId());
491 
492  const GeomDet* gdet = theService->trackingGeometry()->idToDet( seedDetId );
493 
494  TrajectoryStateOnSurface initialState = trajectoryStateTransform::transientState(pTSOD, &(gdet->surface()), &*theService->magneticField());
495 
496  // Get the layer on which the seed relies
497  const DetLayer *initialLayer = theService->detLayerGeometry()->idToLayer( seedDetId );
498 
500 
501  // ask for compatible layers
502  vector<const DetLayer*> detLayers;
503  detLayers = initialLayer->compatibleLayers( *initialState.freeState(),detLayerOrder);
504 
505  TrajectoryStateOnSurface result = initialState;
506  if(detLayers.size()){
507  const DetLayer* finalLayer = detLayers.back();
508  const TrajectoryStateOnSurface propagatedState = theService->propagator(theSeedPropagatorName)->propagate(initialState, finalLayer->surface());
509  if(propagatedState.isValid())
510  result = propagatedState;
511  }
512 
513  return result;
514 }
std::string theSeedPropagatorName
virtual const BoundSurface & surface() const =0
The surface of the GeometricSearchDet.
PropagationDirection
FreeTrajectoryState * freeState(bool withErrors=true) const
tuple result
Definition: query.py:137
unsigned int detId() const
Definition: DetId.h:20
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 376 of file MuonTrackAnalyzer.cc.

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

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

Definition at line 419 of file MuonTrackAnalyzer.cc.

References abs, cond::ecalcond::all, Reference_intrackfit_cff::barrel, Reference_intrackfit_cff::endcap, and LogTrace.

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

Definition at line 211 of file MuonTrackAnalyzer.cc.

References debug, and LogTrace.

212  {
213 
215 
216  // Get the RecTrack collection from the event
218  event.getByLabel(theSeedsLabel, seeds);
219 
220  LogTrace("MuonTrackAnalyzer")<<"Number of reconstructed seeds: " << seeds->size()<<endl;
221 
222  for(TrajectorySeedCollection::const_iterator seed = seeds->begin();
223  seed != seeds->end(); ++seed){
224  TrajectoryStateOnSurface seedTSOS = getSeedTSOS(*seed);
225  pair<SimTrack,double> sim = getSimTrack(seedTSOS,simTracks);
226  fillPlots(seedTSOS, sim.first,
227  hRecoSeedInner, debug);
228 
229  std::pair<bool,FreeTrajectoryState> propSeed =
231  if(propSeed.first)
232  fillPlots(propSeed.second, sim.first,
233  hRecoSeedPCA, debug);
234  else
235  LogTrace("MuonTrackAnalyzer")<<"Error in seed propagation"<<endl;
236 
237  }
238 }
std::pair< SimTrack, double > getSimTrack(TrajectoryStateOnSurface &tsos, edm::Handle< edm::SimTrackContainer > simTracks)
TrajectoryStateOnSurface getSeedTSOS(const TrajectorySeed &seed)
Definition: sim.h:19
edm::InputTag theSeedsLabel
MuonUpdatorAtVertex * theUpdator
#define LogTrace(id)
#define debug
Definition: MEtoEDMFormat.h:34
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 241 of file MuonTrackAnalyzer.cc.

References TrajectoryStateOnSurface::charge(), debug, TrajectoryStateOnSurface::globalMomentum(), LogTrace, CoreSimTrack::momentum(), PV3DBase< T, PVType, FrameType >::perp(), mathSSE::sqrt(), lumiQTWidget::t, and testEve_cfg::tracks.

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

Member Data Documentation

DQMStore* MuonTrackAnalyzer::dbe_
private

Definition at line 83 of file MuonTrackAnalyzer.h.

std::string MuonTrackAnalyzer::dirName_
private

Definition at line 84 of file MuonTrackAnalyzer.h.

bool MuonTrackAnalyzer::doSeedsAnalysis
private

Definition at line 98 of file MuonTrackAnalyzer.h.

bool MuonTrackAnalyzer::doTracksAnalysis
private

Definition at line 97 of file MuonTrackAnalyzer.h.

MonitorElement* MuonTrackAnalyzer::hChargeVsEta
private

Definition at line 113 of file MuonTrackAnalyzer.h.

MonitorElement* MuonTrackAnalyzer::hChargeVsPt
private

Definition at line 114 of file MuonTrackAnalyzer.h.

MonitorElement* MuonTrackAnalyzer::hChi2
private

Definition at line 105 of file MuonTrackAnalyzer.h.

MonitorElement* MuonTrackAnalyzer::hChi2Norm
private

Definition at line 106 of file MuonTrackAnalyzer.h.

MonitorElement* MuonTrackAnalyzer::hChi2NormVsEta
private

Definition at line 118 of file MuonTrackAnalyzer.h.

MonitorElement* MuonTrackAnalyzer::hChi2Prob
private

Definition at line 109 of file MuonTrackAnalyzer.h.

MonitorElement* MuonTrackAnalyzer::hChi2ProbVsEta
private

Definition at line 121 of file MuonTrackAnalyzer.h.

MonitorElement* MuonTrackAnalyzer::hChi2VsEta
private

Definition at line 117 of file MuonTrackAnalyzer.h.

MonitorElement* MuonTrackAnalyzer::hDeltaPt_In_Out_VsEta
private

Definition at line 123 of file MuonTrackAnalyzer.h.

MonitorElement* MuonTrackAnalyzer::hDeltaPtVsEta
private

Definition at line 122 of file MuonTrackAnalyzer.h.

MonitorElement* MuonTrackAnalyzer::hDof
private

Definition at line 108 of file MuonTrackAnalyzer.h.

MonitorElement* MuonTrackAnalyzer::hDofVsEta
private

Definition at line 120 of file MuonTrackAnalyzer.h.

MonitorElement* MuonTrackAnalyzer::hHitsPerTrack
private

Definition at line 107 of file MuonTrackAnalyzer.h.

MonitorElement* MuonTrackAnalyzer::hHitsPerTrackVsEta
private

Definition at line 119 of file MuonTrackAnalyzer.h.

MonitorElement* MuonTrackAnalyzer::hNumberOfTracks
private

Definition at line 111 of file MuonTrackAnalyzer.h.

MonitorElement* MuonTrackAnalyzer::hNumberOfTracksVsEta
private

Definition at line 112 of file MuonTrackAnalyzer.h.

MonitorElement* MuonTrackAnalyzer::hPtRecVsPtGen
private

Definition at line 115 of file MuonTrackAnalyzer.h.

HTrack* MuonTrackAnalyzer::hRecoSeedInner
private

Definition at line 127 of file MuonTrackAnalyzer.h.

HTrack* MuonTrackAnalyzer::hRecoSeedPCA
private

Definition at line 128 of file MuonTrackAnalyzer.h.

HTrack* MuonTrackAnalyzer::hRecoTracksInner
private

Definition at line 130 of file MuonTrackAnalyzer.h.

HTrack* MuonTrackAnalyzer::hRecoTracksOuter
private

Definition at line 131 of file MuonTrackAnalyzer.h.

HTrack* MuonTrackAnalyzer::hRecoTracksPCA
private

Definition at line 129 of file MuonTrackAnalyzer.h.

HTrackVariables* MuonTrackAnalyzer::hSimTracks
private

Definition at line 125 of file MuonTrackAnalyzer.h.

int MuonTrackAnalyzer::numberOfRecTracks
private

Definition at line 135 of file MuonTrackAnalyzer.h.

int MuonTrackAnalyzer::numberOfSimTracks
private

Definition at line 134 of file MuonTrackAnalyzer.h.

std::string MuonTrackAnalyzer::out
private

Definition at line 86 of file MuonTrackAnalyzer.h.

edm::InputTag MuonTrackAnalyzer::theCSCSimHitLabel
private

Definition at line 93 of file MuonTrackAnalyzer.h.

edm::InputTag MuonTrackAnalyzer::theDTSimHitLabel
private

Definition at line 94 of file MuonTrackAnalyzer.h.

EtaRange MuonTrackAnalyzer::theEtaRange
private

Definition at line 89 of file MuonTrackAnalyzer.h.

edm::InputTag MuonTrackAnalyzer::theRPCSimHitLabel
private

Definition at line 95 of file MuonTrackAnalyzer.h.

std::string MuonTrackAnalyzer::theSeedPropagatorName
private

Definition at line 99 of file MuonTrackAnalyzer.h.

edm::InputTag MuonTrackAnalyzer::theSeedsLabel
private

Definition at line 92 of file MuonTrackAnalyzer.h.

MuonServiceProxy* MuonTrackAnalyzer::theService
private

Definition at line 101 of file MuonTrackAnalyzer.h.

edm::InputTag MuonTrackAnalyzer::theTracksLabel
private

Definition at line 91 of file MuonTrackAnalyzer.h.

MuonUpdatorAtVertex* MuonTrackAnalyzer::theUpdator
private

Definition at line 102 of file MuonTrackAnalyzer.h.