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 Attributes
TrackEfficiencyMonitor Class Reference

#include <DQM/TrackerMonitorTrack/src/TrackEfficiencyMonitor.cc>

Inheritance diagram for TrackEfficiencyMonitor:
edm::EDAnalyzer

Public Types

enum  SemiCylinder { Up, Down }
 
typedef reco::Track Track
 
typedef reco::TrackCollection TrackCollection
 
- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
typedef WorkerT< EDAnalyzerWorkerType
 

Public Member Functions

virtual void analyze (const edm::Event &, const edm::EventSetup &)
 
virtual void beginJob (void)
 
SemiCylinder checkSemiCylinder (const Track &)
 
int compatibleLayers (TrajectoryStateOnSurface theTSOS)
 
virtual void endJob (void)
 
std::pair
< TrajectoryStateOnSurface,
const DetLayer * > 
findNextLayer (TrajectoryStateOnSurface startTSOS, std::vector< const DetLayer * > trackCompatibleLayers, bool isUpMuon)
 
void testSTATracks (edm::Handle< TrackCollection > tkTracks, edm::Handle< TrackCollection > staTracks)
 
void testTrackerTracks (edm::Handle< TrackCollection > tkTracks, edm::Handle< TrackCollection > staTracks)
 
 TrackEfficiencyMonitor (const edm::ParameterSet &)
 
bool trackerAcceptance (TrajectoryStateOnSurface theTSOS, double theRadius, double theMaxZ)
 
 ~TrackEfficiencyMonitor ()
 
- Public Member Functions inherited from edm::EDAnalyzer
 EDAnalyzer ()
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 

Private Attributes

edm::ESHandle< MagneticFieldbField
 
edm::ParameterSet conf_
 
MonitorElementdeltaX
 
MonitorElementdeltaY
 
DQMStoredqmStore_
 
int failedToPropagate
 
bool findDetLayer
 
std::string histname
 
bool isBFieldOff_
 
edm::ESHandle< MeasurementTrackermeasurementTrackerHandle
 
MonitorElementmuonCompatibleLayers
 
MonitorElementmuonD0
 
MonitorElementmuonEta
 
MonitorElementmuonPhi
 
MonitorElementmuonX
 
MonitorElementmuonY
 
MonitorElementmuonZ
 
int nCompatibleLayers
 
MonitorElementsignDeltaX
 
MonitorElementsignDeltaY
 
edm::ESHandle
< GeometricSearchTracker
theGeometricSearchTracker
 
double theMaxZ_
 
MuonServiceProxytheMuonServiceProxy
 
const DirectTrackerNavigationtheNavigation
 
edm::ESHandle< PropagatorthePropagator
 
edm::ESHandle< PropagatorthePropagatorCyl
 
double theRadius_
 
edm::InputTag theSTATracksLabel_
 
edm::InputTag theTKTracksLabel_
 
edm::ESHandle
< GeometricSearchTracker
theTracker
 
edm::ESHandle
< TransientTrackBuilder
theTTrackBuilder
 
MonitorElementtrackCompatibleLayers
 
MonitorElementtrackD0
 
bool trackEfficiency_
 
MonitorElementtrackEta
 
MonitorElementtrackPhi
 
MonitorElementtrackX
 
MonitorElementtrackY
 
MonitorElementtrackZ
 

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
CurrentProcessingContext const * currentContext () const
 

Detailed Description

Monitoring source to measure the track efficiency

Definition at line 40 of file TrackEfficiencyMonitor.h.

Member Typedef Documentation

Definition at line 42 of file TrackEfficiencyMonitor.h.

Definition at line 43 of file TrackEfficiencyMonitor.h.

Member Enumeration Documentation

Constructor & Destructor Documentation

TrackEfficiencyMonitor::TrackEfficiencyMonitor ( const edm::ParameterSet iConfig)
explicit

Definition at line 53 of file TrackEfficiencyMonitor.cc.

References conf_, dqmStore_, edm::ParameterSet::getParameter(), isBFieldOff_, cppFunctionSkipper::operator, theMaxZ_, theRadius_, theSTATracksLabel_, theTKTracksLabel_, and trackEfficiency_.

55 {
57 
58  theRadius_ = iConfig.getParameter<double>("theRadius");
59  theMaxZ_ = iConfig.getParameter<double>("theMaxZ");
60  isBFieldOff_ = iConfig.getParameter<bool>("isBFieldOff");
61  trackEfficiency_ = iConfig.getParameter<bool>("trackEfficiency");
62  theTKTracksLabel_ = iConfig.getParameter<edm::InputTag>("TKTrackCollection");
63  theSTATracksLabel_ = iConfig.getParameter<edm::InputTag>("STATrackCollection");
64 
65 
66  conf_ = iConfig;
67 }
T getParameter(std::string const &) const
TrackEfficiencyMonitor::~TrackEfficiencyMonitor ( )

Definition at line 72 of file TrackEfficiencyMonitor.cc.

74 {}

Member Function Documentation

void TrackEfficiencyMonitor::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
)
virtual

Implements edm::EDAnalyzer.

Definition at line 260 of file TrackEfficiencyMonitor.cc.

References bField, edm::EventSetup::get(), edm::Event::getByLabel(), isBFieldOff_, muon::isGoodMuon(), measurementTrackerHandle, nCompatibleLayers, edm::ESHandle< class >::product(), muonTagProbeFilters_cff::staTracks, testSTATracks(), testTrackerTracks(), theNavigation, thePropagator, theSTATracksLabel_, theTKTracksLabel_, theTracker, theTTrackBuilder, and trackEfficiency_.

262 {
263 
264 
266  iEvent.getByLabel(theTKTracksLabel_, tkTracks);
268  iEvent.getByLabel(theSTATracksLabel_, staTracks);
270  iSetup.get<NavigationSchoolRecord>().get("CosmicNavigationSchool", nav);
271  NavigationSetter setter(*nav.product());
273 
274  nCompatibleLayers = 0;
275 
276  iSetup.get<TransientTrackRecord>().get("TransientTrackBuilder",theTTrackBuilder);
277  iSetup.get<TrackingComponentsRecord>().get("SteppingHelixPropagatorAny",thePropagator);
278  iSetup.get<IdealMagneticFieldRecord>().get(bField);
281 
282 
283  if(trackEfficiency_){
284  //---------------------------------------------------
285  // Select muons with good quality
286  // If B field is on, no up-down matching between the muons
287  //---------------------------------------------------
288  bool isGoodMuon = false;
289  double mudd0 = 0., mudphi = 0., muddsz = 0., mudeta = 0.;
290  if(isBFieldOff_)
291  {
292  if ( staTracks->size() == 2 )
293  {
294  for ( unsigned int bindex = 0; bindex < staTracks->size(); ++bindex )
295  {
296 
297  if (0 == bindex){
298  mudd0+=(*staTracks)[bindex].d0();
299  mudphi+=(*staTracks)[bindex].phi();
300  muddsz+=(*staTracks)[bindex].dsz();
301  mudeta+=(*staTracks)[bindex].eta();}
302  if (1 == bindex){
303  mudd0-=(*staTracks)[bindex].d0();
304  mudphi-=(*staTracks)[bindex].phi();
305  muddsz-=(*staTracks)[bindex].dsz();
306  mudeta-=(*staTracks)[bindex].eta();}
307  }
308  if ((fabs(mudd0)<15.0)&&(fabs(mudphi)<0.045)&&(fabs(muddsz)<20.0)&&(fabs(mudeta)<0.060)) isGoodMuon = true;
309  }
310 
311  if(isGoodMuon) testTrackerTracks(tkTracks,staTracks);
312 
313  }
314  else if ( staTracks->size() == 1 || staTracks->size() == 2) testTrackerTracks(tkTracks,staTracks);
315  }
316 
317 
318  if(!trackEfficiency_ && tkTracks->size() == 1 ){
319  if( (tkTracks->front()).normalizedChi2() < 5 &&
320  (tkTracks->front()).hitPattern().numberOfValidHits() > 8)
321  testSTATracks(tkTracks,staTracks);
322  }
323 
324 
325  delete theNavigation;
326 
327 }
edm::ESHandle< MagneticField > bField
edm::ESHandle< GeometricSearchTracker > theTracker
edm::ESHandle< MeasurementTracker > measurementTrackerHandle
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:356
bool isGoodMuon(const reco::Muon &muon, SelectionType type, reco::Muon::ArbitrationType arbitrationType=reco::Muon::SegmentAndTrackArbitration)
main GoodMuon wrapper call
edm::ESHandle< Propagator > thePropagator
edm::ESHandle< TransientTrackBuilder > theTTrackBuilder
const T & get() const
Definition: EventSetup.h:55
T const * product() const
Definition: ESHandle.h:62
void testTrackerTracks(edm::Handle< TrackCollection > tkTracks, edm::Handle< TrackCollection > staTracks)
const DirectTrackerNavigation * theNavigation
void testSTATracks(edm::Handle< TrackCollection > tkTracks, edm::Handle< TrackCollection > staTracks)
void TrackEfficiencyMonitor::beginJob ( void  )
virtual

Reimplemented from edm::EDAnalyzer.

Definition at line 80 of file TrackEfficiencyMonitor.cc.

References DQMStore::book1D(), conf_, deltaX, deltaY, dqmStore_, edm::ParameterSet::getParameter(), histname, muonCompatibleLayers, muonD0, muonEta, muonPhi, muonX, muonY, muonZ, MonitorElement::setAxisTitle(), DQMStore::setCurrentFolder(), signDeltaX, signDeltaY, trackCompatibleLayers, trackD0, trackEta, trackPhi, trackX, trackY, and trackZ.

82 {
83  std::string MEFolderName = conf_.getParameter<std::string>("FolderName");
84  std::string AlgoName = conf_.getParameter<std::string>("AlgoName");
85 
86 
87  dqmStore_->setCurrentFolder(MEFolderName);
88 
89  //
90  int muonXBin = conf_.getParameter<int> ("muonXBin");
91  double muonXMin = conf_.getParameter<double>("muonXMin");
92  double muonXMax = conf_.getParameter<double>("muonXMax");
93 
94  histname = "muonX_";
95  muonX = dqmStore_->book1D(histname+AlgoName, histname+AlgoName, muonXBin, muonXMin, muonXMax);
96  muonX->setAxisTitle("");
97 
98  //
99  int muonYBin = conf_.getParameter<int> ("muonYBin");
100  double muonYMin = conf_.getParameter<double>("muonYMin");
101  double muonYMax = conf_.getParameter<double>("muonYMax");
102 
103  histname = "muonY_";
104  muonY = dqmStore_->book1D(histname+AlgoName, histname+AlgoName, muonYBin, muonYMin, muonYMax);
105  muonY->setAxisTitle("");
106 
107  //
108  int muonZBin = conf_.getParameter<int> ("muonZBin");
109  double muonZMin = conf_.getParameter<double>("muonZMin");
110  double muonZMax = conf_.getParameter<double>("muonZMax");
111 
112  histname = "muonZ_";
113  muonZ = dqmStore_->book1D(histname+AlgoName, histname+AlgoName, muonZBin, muonZMin, muonZMax);
114  muonZ->setAxisTitle("");
115 
116  //
117  int muonEtaBin = conf_.getParameter<int> ("muonEtaBin");
118  double muonEtaMin = conf_.getParameter<double>("muonEtaMin");
119  double muonEtaMax = conf_.getParameter<double>("muonEtaMax");
120 
121  histname = "muonEta_";
122  muonEta = dqmStore_->book1D(histname+AlgoName, histname+AlgoName, muonEtaBin, muonEtaMin, muonEtaMax);
123  muonEta->setAxisTitle("");
124 
125  //
126  int muonPhiBin = conf_.getParameter<int> ("muonPhiBin");
127  double muonPhiMin = conf_.getParameter<double>("muonPhiMin");
128  double muonPhiMax = conf_.getParameter<double>("muonPhiMax");
129 
130  histname = "muonPhi_";
131  muonPhi = dqmStore_->book1D(histname+AlgoName, histname+AlgoName, muonPhiBin, muonPhiMin, muonPhiMax);
132  muonPhi->setAxisTitle("");
133 
134  //
135  int muonD0Bin = conf_.getParameter<int> ("muonD0Bin");
136  double muonD0Min = conf_.getParameter<double>("muonD0Min");
137  double muonD0Max = conf_.getParameter<double>("muonD0Max");
138 
139  histname = "muonD0_";
140  muonD0 = dqmStore_->book1D(histname+AlgoName, histname+AlgoName, muonD0Bin, muonD0Min, muonD0Max);
141  muonD0->setAxisTitle("");
142 
143  //
144  int muonCompatibleLayersBin = conf_.getParameter<int> ("muonCompatibleLayersBin");
145  double muonCompatibleLayersMin = conf_.getParameter<double>("muonCompatibleLayersMin");
146  double muonCompatibleLayersMax = conf_.getParameter<double>("muonCompatibleLayersMax");
147 
148  histname = "muonCompatibleLayers_";
149  muonCompatibleLayers = dqmStore_->book1D(histname+AlgoName, histname+AlgoName, muonCompatibleLayersBin, muonCompatibleLayersMin, muonCompatibleLayersMax);
151 
152  //------------------------------------------------------------------------------------
153 
154  //
155  int trackXBin = conf_.getParameter<int> ("trackXBin");
156  double trackXMin = conf_.getParameter<double>("trackXMin");
157  double trackXMax = conf_.getParameter<double>("trackXMax");
158 
159  histname = "trackX_";
160  trackX = dqmStore_->book1D(histname+AlgoName, histname+AlgoName, trackXBin, trackXMin, trackXMax);
161  trackX->setAxisTitle("");
162 
163  //
164  int trackYBin = conf_.getParameter<int> ("trackYBin");
165  double trackYMin = conf_.getParameter<double>("trackYMin");
166  double trackYMax = conf_.getParameter<double>("trackYMax");
167 
168  histname = "trackY_";
169  trackY = dqmStore_->book1D(histname+AlgoName, histname+AlgoName, trackYBin, trackYMin, trackYMax);
170  trackY->setAxisTitle("");
171 
172  //
173  int trackZBin = conf_.getParameter<int> ("trackZBin");
174  double trackZMin = conf_.getParameter<double>("trackZMin");
175  double trackZMax = conf_.getParameter<double>("trackZMax");
176 
177  histname = "trackZ_";
178  trackZ = dqmStore_->book1D(histname+AlgoName, histname+AlgoName, trackZBin, trackZMin, trackZMax);
179  trackZ->setAxisTitle("");
180 
181  //
182  int trackEtaBin = conf_.getParameter<int> ("trackEtaBin");
183  double trackEtaMin = conf_.getParameter<double>("trackEtaMin");
184  double trackEtaMax = conf_.getParameter<double>("trackEtaMax");
185 
186  histname = "trackEta_";
187  trackEta = dqmStore_->book1D(histname+AlgoName, histname+AlgoName, trackEtaBin, trackEtaMin, trackEtaMax);
188  trackEta->setAxisTitle("");
189 
190  //
191  int trackPhiBin = conf_.getParameter<int> ("trackPhiBin");
192  double trackPhiMin = conf_.getParameter<double>("trackPhiMin");
193  double trackPhiMax = conf_.getParameter<double>("trackPhiMax");
194 
195  histname = "trackPhi_";
196  trackPhi = dqmStore_->book1D(histname+AlgoName, histname+AlgoName, trackPhiBin, trackPhiMin, trackPhiMax);
197  trackPhi->setAxisTitle("");
198 
199  //
200  int trackD0Bin = conf_.getParameter<int> ("trackD0Bin");
201  double trackD0Min = conf_.getParameter<double>("trackD0Min");
202  double trackD0Max = conf_.getParameter<double>("trackD0Max");
203 
204  histname = "trackD0_";
205  trackD0 = dqmStore_->book1D(histname+AlgoName, histname+AlgoName, trackD0Bin, trackD0Min, trackD0Max);
206  trackD0->setAxisTitle("");
207 
208  //
209  int trackCompatibleLayersBin = conf_.getParameter<int> ("trackCompatibleLayersBin");
210  double trackCompatibleLayersMin = conf_.getParameter<double>("trackCompatibleLayersMin");
211  double trackCompatibleLayersMax = conf_.getParameter<double>("trackCompatibleLayersMax");
212 
213  histname = "trackCompatibleLayers_";
214  trackCompatibleLayers = dqmStore_->book1D(histname+AlgoName, histname+AlgoName, trackCompatibleLayersBin, trackCompatibleLayersMin, trackCompatibleLayersMax);
216 
217  //------------------------------------------------------------------------------------
218 
219  //
220  int deltaXBin = conf_.getParameter<int> ("deltaXBin");
221  double deltaXMin = conf_.getParameter<double>("deltaXMin");
222  double deltaXMax = conf_.getParameter<double>("deltaXMax");
223 
224  histname = "deltaX_";
225  deltaX = dqmStore_->book1D(histname+AlgoName, histname+AlgoName, deltaXBin, deltaXMin, deltaXMax);
226  deltaX->setAxisTitle("");
227 
228  //
229  int deltaYBin = conf_.getParameter<int> ("deltaYBin");
230  double deltaYMin = conf_.getParameter<double>("deltaYMin");
231  double deltaYMax = conf_.getParameter<double>("deltaYMax");
232 
233  histname = "deltaY_";
234  deltaY = dqmStore_->book1D(histname+AlgoName, histname+AlgoName, deltaYBin, deltaYMin, deltaYMax);
235  deltaY->setAxisTitle("");
236 
237  //
238  int signDeltaXBin = conf_.getParameter<int> ("signDeltaXBin");
239  double signDeltaXMin = conf_.getParameter<double>("signDeltaXMin");
240  double signDeltaXMax = conf_.getParameter<double>("signDeltaXMax");
241 
242  histname = "signDeltaX_";
243  signDeltaX = dqmStore_->book1D(histname+AlgoName, histname+AlgoName, signDeltaXBin, signDeltaXMin, signDeltaXMax);
245 
246  //
247  int signDeltaYBin = conf_.getParameter<int> ("signDeltaYBin");
248  double signDeltaYMin = conf_.getParameter<double>("signDeltaYMin");
249  double signDeltaYMax = conf_.getParameter<double>("signDeltaYMax");
250 
251  histname = "signDeltaY_";
252  signDeltaY = dqmStore_->book1D(histname+AlgoName, histname+AlgoName, signDeltaYBin, signDeltaYMin, signDeltaYMax);
254 
255 }
T getParameter(std::string const &) const
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
Definition: DQMStore.cc:717
MonitorElement * muonCompatibleLayers
MonitorElement * trackCompatibleLayers
void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:429
TrackEfficiencyMonitor::SemiCylinder TrackEfficiencyMonitor::checkSemiCylinder ( const Track tk)
int TrackEfficiencyMonitor::compatibleLayers ( TrajectoryStateOnSurface  theTSOS)

Definition at line 638 of file TrackEfficiencyMonitor.cc.

References alongMomentum, findDetLayer, findNextLayer(), TrajectoryStateOnSurface::freeState(), TrajectoryStateOnSurface::globalPosition(), TrajectoryStateOnSurface::isValid(), gen::k, measurementTrackerHandle, DetLayer::nextLayers(), Propagator::propagate(), Propagator::setPropagationDirection(), GeometricSearchDet::surface(), thePropagator, trackCompatibleLayers, and PV3DBase< T, PVType, FrameType >::y().

Referenced by testTrackerTracks().

640 {
641  //---------------------------------------------------
642  // check the number of compatible layers
643  //---------------------------------------------------
644 
645  std::vector< BarrelDetLayer*> barrelTOBLayers = measurementTrackerHandle->geometricSearchTracker()->tobLayers() ;
646 
647  unsigned int layers = 0;
648  for ( unsigned int k=0 ; k < barrelTOBLayers.size() ; k++ )
649  {
650  const DetLayer* firstLay = barrelTOBLayers[barrelTOBLayers.size() -1 - k];
651 
652  //Propagator* theTmpPropagator = new SteppingHelixPropagator(&*bField,anyDirection);
653 
654 
655 
656  Propagator* theTmpPropagator = &*thePropagator->clone();
657  theTmpPropagator->setPropagationDirection(alongMomentum);
658 
659  TrajectoryStateOnSurface startTSOS = theTmpPropagator->propagate(*theTSOS.freeState(),firstLay->surface());
660 
661  std::vector< const DetLayer*> trackCompatibleLayers;
662 
663  findDetLayer = true;
664  bool isUpMuon = false;
665  bool firstdtep = true;
666 
667  if(startTSOS.isValid())
668  {
669 
670  if(firstdtep) layers++;
671 
672  int nwhile = 0;
673 
674  //for other compatible layers
675  while ( startTSOS.isValid() && firstLay && findDetLayer)
676  {
677 
678  if(firstdtep && startTSOS.globalPosition().y()> 0) isUpMuon = true;
679 
680  if(firstdtep){
681  std::vector< const DetLayer*> firstCompatibleLayers;
682  firstCompatibleLayers.push_back(firstLay);
683  std::pair<TrajectoryStateOnSurface, const DetLayer* > nextLayer = findNextLayer(theTSOS, firstCompatibleLayers, isUpMuon );
684  firstdtep = false;
685  }
686  else{
687  trackCompatibleLayers = firstLay->nextLayers(*(startTSOS.freeState()),alongMomentum);
688  if (trackCompatibleLayers.size()!=0 ){
689  std::pair<TrajectoryStateOnSurface, const DetLayer* > nextLayer = findNextLayer(startTSOS, trackCompatibleLayers, isUpMuon );
690  if (firstLay != nextLayer.second ){
691  firstLay = nextLayer.second;
692  startTSOS = nextLayer.first;
693  layers++;
694  }
695  else firstLay=0;
696  }
697  }
698  nwhile++;
699  if(nwhile > 100) break;
700 
701  }
702  delete theTmpPropagator;
703  break;
704  }
705  delete theTmpPropagator;
706  }
707  return layers;
708 
709 }
virtual const BoundSurface & surface() const =0
The surface of the GeometricSearchDet.
std::pair< TrajectoryStateOnSurface, const DetLayer * > findNextLayer(TrajectoryStateOnSurface startTSOS, std::vector< const DetLayer * > trackCompatibleLayers, bool isUpMuon)
virtual std::vector< const DetLayer * > nextLayers(NavigationDirection direction) const
Definition: DetLayer.cc:35
T y() const
Definition: PV3DBase.h:62
GlobalPoint globalPosition() const
FreeTrajectoryState * freeState(bool withErrors=true) const
edm::ESHandle< MeasurementTracker > measurementTrackerHandle
virtual TrajectoryStateOnSurface propagate(const FreeTrajectoryState &, const Surface &) const
Definition: Propagator.cc:12
int k[5][pyjets_maxn]
edm::ESHandle< Propagator > thePropagator
virtual void setPropagationDirection(PropagationDirection dir) const
Definition: Propagator.h:132
MonitorElement * trackCompatibleLayers
void TrackEfficiencyMonitor::endJob ( void  )
virtual

Reimplemented from edm::EDAnalyzer.

Definition at line 332 of file TrackEfficiencyMonitor.cc.

References conf_, dqmStore_, edm::ParameterSet::getParameter(), dumpDBToFile_GT_ttrig_cfg::outputFileName, DQMStore::save(), and DQMStore::showDirStructure().

334 {
335  bool outputMEsInRootFile = conf_.getParameter<bool>("OutputMEsInRootFile");
336  std::string outputFileName = conf_.getParameter<std::string>("OutputFileName");
337  if(outputMEsInRootFile){
339  dqmStore_->save(outputFileName);
340  }
341 
342  //if ( theNavigation ) delete theNavigation;
343 
344 }
T getParameter(std::string const &) const
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:2113
void showDirStructure(void) const
Definition: DQMStore.cc:2761
std::pair< TrajectoryStateOnSurface, const DetLayer * > TrackEfficiencyMonitor::findNextLayer ( TrajectoryStateOnSurface  startTSOS,
std::vector< const DetLayer * >  trackCompatibleLayers,
bool  isUpMuon 
)

Definition at line 715 of file TrackEfficiencyMonitor.cc.

References alongMomentum, findDetLayer, TrajectoryStateOnSurface::freeState(), TrajectoryStateOnSurface::isValid(), Propagator::propagate(), Propagator::setPropagationDirection(), and thePropagator.

Referenced by compatibleLayers().

717 {
718 
719  //Propagator* theTmpPropagator = new SteppingHelixPropagator(&*bField,anyDirection);
720 
721 
722  Propagator* theTmpPropagator = &*thePropagator->clone();
723  theTmpPropagator->setPropagationDirection(alongMomentum);
724 
725 
726  std::vector<const DetLayer*>::iterator itl;
727  findDetLayer = false;
728  for (itl=trackCompatibleLayers.begin();itl!=trackCompatibleLayers.end();++itl) {
729  TrajectoryStateOnSurface tsos = theTmpPropagator->propagate(*(sTSOS.freeState()),(**itl).surface());
730  if (tsos.isValid())
731  {
732  sTSOS = tsos;
733  findDetLayer = true;
734 
735  break;
736  }
737  }
738  std::pair<TrajectoryStateOnSurface, const DetLayer* > blabla;
739  blabla.first = sTSOS;
740  blabla.second = &**itl;
741  delete theTmpPropagator;
742  return blabla;
743 }
virtual TrajectoryStateOnSurface propagate(const FreeTrajectoryState &, const Surface &) const
Definition: Propagator.cc:12
edm::ESHandle< Propagator > thePropagator
virtual void setPropagationDirection(PropagationDirection dir) const
Definition: Propagator.h:132
MonitorElement * trackCompatibleLayers
void TrackEfficiencyMonitor::testSTATracks ( edm::Handle< TrackCollection tkTracks,
edm::Handle< TrackCollection staTracks 
)

Definition at line 489 of file TrackEfficiencyMonitor.cc.

References checkSemiCylinder(), PV3DBase< T, PVType, FrameType >::eta(), eta(), failedToPropagate, MonitorElement::Fill(), TrajectoryStateOnSurface::globalDirection(), TrajectoryStateOnSurface::globalPosition(), reco::TransientTrack::impactPointState(), reco::TransientTrack::innermostMeasurementState(), TrajectoryStateOnSurface::isValid(), TrajectoryStateOnSurface::localPosition(), muonD0, muonEta, muonPhi, muonX, muonY, muonZ, reco::TransientTrack::outermostMeasurementState(), phi, PV3DBase< T, PVType, FrameType >::phi(), funct::pow(), TrajectoryStateOnSurface::surface(), thePropagator, theTTrackBuilder, trackD0, trackEta, trackPhi, trackX, trackY, trackZ, Up, PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

Referenced by analyze().

491 {
492 
493 
494  reco::TransientTrack tkTT = theTTrackBuilder->build(tkTracks->front());
495  double ipX = tkTT.impactPointState().globalPosition().x();
496  double ipY = tkTT.impactPointState().globalPosition().y();
497  double ipZ = tkTT.impactPointState().globalPosition().z();
498  double eta = tkTT.impactPointState().globalDirection().eta();
499  double phi = tkTT.impactPointState().globalDirection().phi();
500  double d0 = (*tkTracks)[0].d0();
501 
503  LocalVector diffLocal;
504  TrajectoryStateOnSurface staState;
505  bool isTrack = false;
506 
507 
508  if(!staTracks->empty()){
509 
510  //---------------------------------------------------
511  //look for associated muons
512  //---------------------------------------------------
513 
514  float DR2min = 1000;
515  reco::TrackCollection::const_iterator closestTrk = staTracks->end();
516  //----------------------loop on tracker tracks:
517  for(reco::TrackCollection::const_iterator staTrack = staTracks->begin(); staTrack != staTracks->end(); ++staTrack){
519 
520  reco::TransientTrack staTT = theTTrackBuilder->build(*staTrack);
521  failedToPropagate = 1;
522  staState = thePropagator->propagate(staTT.outermostMeasurementState(),tkInner.surface());
523 
524 
525  if(staState.isValid())
526  {
527  failedToPropagate = 0;
528  diffLocal = tkInner.localPosition() - staState.localPosition();
529 
530  double DR2 = diffLocal.x()*diffLocal.x()+diffLocal.y()*diffLocal.y();
531  if (DR2<DR2min) { DR2min = DR2; closestTrk = staTrack;}
532  if ( pow(DR2,0.5) < 100. ) isTrack = true;
533  }
534  }
535  }
536  }
537 
538  if(failedToPropagate == 0)
539  {
540 
541  trackX->Fill(ipX);
542  trackY->Fill(ipY);
543  trackZ->Fill(ipZ);
544  trackEta->Fill(eta);
545  trackPhi->Fill(phi);
546  trackD0->Fill(d0);
547 
548  if(isTrack)
549  {
550  muonX->Fill(ipX);
551  muonY->Fill(ipY);
552  muonZ->Fill(ipZ);
553  muonEta->Fill(eta);
554  muonPhi->Fill(phi);
555  muonD0->Fill(d0);
556  }
557  }
558 
559 
560 
561 }
Geom::Phi< T > phi() const
Definition: PV3DBase.h:68
T y() const
Definition: PV3DBase.h:62
GlobalPoint globalPosition() const
T eta() const
TrajectoryStateOnSurface innermostMeasurementState() const
void Fill(long long x)
T z() const
Definition: PV3DBase.h:63
TrajectoryStateOnSurface outermostMeasurementState() const
edm::ESHandle< Propagator > thePropagator
edm::ESHandle< TransientTrackBuilder > theTTrackBuilder
T eta() const
Definition: PV3DBase.h:75
const Surface & surface() const
TrajectoryStateOnSurface impactPointState() const
SemiCylinder checkSemiCylinder(const Track &)
T x() const
Definition: PV3DBase.h:61
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:40
GlobalVector globalDirection() const
Definition: DDAxes.h:10
void TrackEfficiencyMonitor::testTrackerTracks ( edm::Handle< TrackCollection tkTracks,
edm::Handle< TrackCollection staTracks 
)

Definition at line 349 of file TrackEfficiencyMonitor.cc.

References checkSemiCylinder(), compatibleLayers(), deltaX, deltaY, PV3DBase< T, PVType, FrameType >::eta(), eta(), failedToPropagate, MonitorElement::Fill(), TrajectoryStateOnSurface::globalDirection(), TrajectoryStateOnSurface::globalPosition(), i, reco::TransientTrack::impactPointState(), reco::TransientTrack::innermostMeasurementState(), TrajectoryStateOnSurface::isValid(), TrajectoryStateOnSurface::localError(), TrajectoryStateOnSurface::localPosition(), metname, muonCompatibleLayers, muonD0, muonEta, muonPhi, muonX, muonY, muonZ, nCompatibleLayers, reco::TransientTrack::outermostMeasurementState(), phi, PV3DBase< T, PVType, FrameType >::phi(), LocalTrajectoryError::positionError(), funct::pow(), signDeltaX, signDeltaY, TrajectoryStateOnSurface::surface(), theMaxZ_, thePropagator, theRadius_, theTTrackBuilder, trackCompatibleLayers, trackD0, trackerAcceptance(), trackEta, trackPhi, trackX, trackY, trackZ, Up, PV3DBase< T, PVType, FrameType >::x(), LocalError::xx(), PV3DBase< T, PVType, FrameType >::y(), LocalError::yy(), and PV3DBase< T, PVType, FrameType >::z().

Referenced by analyze().

351 {
352 
353  const std::string metname = "testStandAloneMuonTracks";
354 
355  //---------------------------------------------------
356  // get the index of the "up" muon
357  // histograms will only be computed for the "up" muon
358  //---------------------------------------------------
359 
360  int nUpMuon = 0;
361  int idxUpMuon = -1;
362  for(unsigned int i =0; i< staTracks->size(); i++){
363  if( checkSemiCylinder((*staTracks)[i]) == TrackEfficiencyMonitor::Up ){
364  nUpMuon++;
365  idxUpMuon = i;
366  }
367  }
368 
369 
370  if( nUpMuon == 1)
371  {
372 
373  //---------------------------------------------------
374  //get the muon informations
375  //---------------------------------------------------
376 
377  reco::TransientTrack staTT = theTTrackBuilder->build((*staTracks)[idxUpMuon]);
378  double ipX = staTT.impactPointState().globalPosition().x();
379  double ipY = staTT.impactPointState().globalPosition().y();
380  double ipZ = staTT.impactPointState().globalPosition().z();
381  double eta = staTT.impactPointState().globalDirection().eta();
382  double phi = staTT.impactPointState().globalDirection().phi();
383  double d0 = (*staTracks)[idxUpMuon].d0();
384 
386  TrajectoryStateOnSurface theTSOSCompLayers = staTT.outermostMeasurementState();
387 
388 
389  //---------------------------------------------------
390  //check if the muon is in the tracker acceptance
391  //---------------------------------------------------
392  bool isInTrackerAcceptance = false;
393  isInTrackerAcceptance = trackerAcceptance( theTSOS, theRadius_ , theMaxZ_ );
394 
395  //---------------------------------------------------st
396  //count the number of compatible layers
397  //---------------------------------------------------
398  nCompatibleLayers = compatibleLayers(theTSOSCompLayers);
399 
400  if(isInTrackerAcceptance && (*staTracks)[idxUpMuon].hitPattern().numberOfValidHits() > 28)
401  {
402  //---------------------------------------------------
403  //count the number of good muon candidates
404  //---------------------------------------------------
405 
406  TrajectoryStateOnSurface staState;
407  LocalVector diffLocal;
408 
409 
410  bool isTrack = false;
411  if(!tkTracks->empty())
412  {
413  //---------------------------------------------------
414  //look for associated tracks
415  //---------------------------------------------------
416  float DR2min = 1000;
417  reco::TrackCollection::const_iterator closestTrk = tkTracks->end();
418 
419  for(reco::TrackCollection::const_iterator tkTrack = tkTracks->begin(); tkTrack != tkTracks->end(); ++tkTrack)
420  {
421  reco::TransientTrack tkTT = theTTrackBuilder->build(*tkTrack);
423  staState = thePropagator->propagate(staTT.outermostMeasurementState(),tkInner.surface());
424  failedToPropagate = 1;
425 
426  if(staState.isValid())
427  {
428  failedToPropagate = 0;
429  diffLocal = tkInner.localPosition() - staState.localPosition();
430  double DR2 = diffLocal.x()*diffLocal.x()+diffLocal.y()*diffLocal.y();
431  if (DR2<DR2min) { DR2min = DR2; closestTrk = tkTrack;}
432  if ( pow(DR2,0.5) < 100. ) isTrack = true;
433  }
434  }
435 
436 
437  if (DR2min != 1000)
438  {
439 
440  reco::TransientTrack tkTT = theTTrackBuilder->build(*closestTrk);
442  staState = thePropagator->propagate(staTT.outermostMeasurementState(),tkInner.surface());
443  deltaX->Fill(diffLocal.x());
444  deltaY->Fill(diffLocal.y());
445  signDeltaX->Fill(diffLocal.x()/(tkInner.localError().positionError().xx() + staState.localError().positionError().xx()));
446  signDeltaY->Fill(diffLocal.y()/(tkInner.localError().positionError().yy() + staState.localError().positionError().yy()));
447 
448  }
449  }
450 
451 
452  if(failedToPropagate == 0)
453  {
454  muonX->Fill(ipX);
455  muonY->Fill(ipY);
456  muonZ->Fill(ipZ);
457  muonEta->Fill(eta);
458  muonPhi->Fill(phi);
459  muonD0->Fill(d0);
461 
462  if(isTrack)
463  {
464  trackX->Fill(ipX);
465  trackY->Fill(ipY);
466  trackZ->Fill(ipZ);
467  trackEta->Fill(eta);
468  trackPhi->Fill(phi);
469  trackD0->Fill(d0);
471  }
472  }
473  }
474  }
475 
476 }
int compatibleLayers(TrajectoryStateOnSurface theTSOS)
int i
Definition: DBlmapReader.cc:9
float xx() const
Definition: LocalError.h:24
const std::string metname
Geom::Phi< T > phi() const
Definition: PV3DBase.h:68
T y() const
Definition: PV3DBase.h:62
GlobalPoint globalPosition() const
T eta() const
LocalError positionError() const
TrajectoryStateOnSurface innermostMeasurementState() const
void Fill(long long x)
MonitorElement * muonCompatibleLayers
float yy() const
Definition: LocalError.h:26
T z() const
Definition: PV3DBase.h:63
const LocalTrajectoryError & localError() const
TrajectoryStateOnSurface outermostMeasurementState() const
edm::ESHandle< Propagator > thePropagator
edm::ESHandle< TransientTrackBuilder > theTTrackBuilder
T eta() const
Definition: PV3DBase.h:75
bool trackerAcceptance(TrajectoryStateOnSurface theTSOS, double theRadius, double theMaxZ)
const Surface & surface() const
TrajectoryStateOnSurface impactPointState() const
SemiCylinder checkSemiCylinder(const Track &)
MonitorElement * trackCompatibleLayers
T x() const
Definition: PV3DBase.h:61
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:40
GlobalVector globalDirection() const
Definition: DDAxes.h:10
bool TrackEfficiencyMonitor::trackerAcceptance ( TrajectoryStateOnSurface  theTSOS,
double  theRadius,
double  theMaxZ 
)

Definition at line 589 of file TrackEfficiencyMonitor.cc.

References accept(), alongMomentum, Cylinder::build(), TrajectoryStateOnSurface::freeState(), TrajectoryStateOnSurface::globalPosition(), TrajectoryStateOnSurface::isValid(), oppositeToMomentum, Propagator::propagate(), Propagator::setPropagationDirection(), thePropagator, PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

Referenced by testTrackerTracks().

591 {
592 
593  //---------------------------------------------------
594  // check if the muon is in the tracker acceptance
595  // check the compatibility with a cylinder of radius "theRadius"
596  //---------------------------------------------------
597 
598  //Propagator* theTmpPropagator = new SteppingHelixPropagator(&*bField,anyDirection);
599 
600  //Propagator* theTmpPropagator = &*thePropagator;
601  Propagator* theTmpPropagator = &*thePropagator->clone();
602 
603  if (theTSOS.globalPosition().y() <0 ) theTmpPropagator->setPropagationDirection(oppositeToMomentum);
604  else theTmpPropagator->setPropagationDirection(alongMomentum);
605 
608  const Cylinder::CylinderPointer cyl = Cylinder::build(pos0, rot0, theRadius);
609  TrajectoryStateOnSurface tsosAtCyl = theTmpPropagator->propagate(*theTSOS.freeState(), *cyl);
610  double accept = false;
611  if ( tsosAtCyl.isValid() ) {
612  if (fabs(tsosAtCyl.globalPosition().z())<theMaxZ ) {
615  const Cylinder::CylinderPointer cyl2 = Cylinder::build(pos02, rot02, theRadius -10);
616  TrajectoryStateOnSurface tsosAtCyl2 = theTmpPropagator->propagate(*tsosAtCyl.freeState(), *cyl2);
617  if ( tsosAtCyl2.isValid() ) {
620  const Cylinder::CylinderPointer cyl3 = Cylinder::build(pos03, rot03, theRadius );
621  TrajectoryStateOnSurface tsosAtCyl3 = theTmpPropagator->propagate(*tsosAtCyl2.freeState(), *cyl3);
622  if ( tsosAtCyl3.isValid() ) {
623  accept=true;
624  }
625  }
626 
627  }
628  }
629  delete theTmpPropagator;
630  //muon propagated to the barrel cylinder
631  return accept;
632 
633 }
T y() const
Definition: PV3DBase.h:62
GlobalPoint globalPosition() const
bool accept(const edm::Event &event, const edm::TriggerResults &triggerTable, const std::string &triggerPath)
Definition: TopDQMHelpers.h:22
FreeTrajectoryState * freeState(bool withErrors=true) const
T z() const
Definition: PV3DBase.h:63
virtual TrajectoryStateOnSurface propagate(const FreeTrajectoryState &, const Surface &) const
Definition: Propagator.cc:12
edm::ESHandle< Propagator > thePropagator
static CylinderPointer build(const PositionType &pos, const RotationType &rot, Scalar radius, MediumProperties *mp=0)
Definition: Cylinder.h:29
virtual void setPropagationDirection(PropagationDirection dir) const
Definition: Propagator.h:132

Member Data Documentation

edm::ESHandle<MagneticField> TrackEfficiencyMonitor::bField
private

Definition at line 112 of file TrackEfficiencyMonitor.h.

Referenced by analyze().

edm::ParameterSet TrackEfficiencyMonitor::conf_
private

Definition at line 68 of file TrackEfficiencyMonitor.h.

Referenced by beginJob(), endJob(), and TrackEfficiencyMonitor().

MonitorElement* TrackEfficiencyMonitor::deltaX
private

Definition at line 99 of file TrackEfficiencyMonitor.h.

Referenced by beginJob(), and testTrackerTracks().

MonitorElement* TrackEfficiencyMonitor::deltaY
private

Definition at line 100 of file TrackEfficiencyMonitor.h.

Referenced by beginJob(), and testTrackerTracks().

DQMStore* TrackEfficiencyMonitor::dqmStore_
private

Definition at line 67 of file TrackEfficiencyMonitor.h.

Referenced by beginJob(), endJob(), and TrackEfficiencyMonitor().

int TrackEfficiencyMonitor::failedToPropagate
private

Definition at line 79 of file TrackEfficiencyMonitor.h.

Referenced by testSTATracks(), and testTrackerTracks().

bool TrackEfficiencyMonitor::findDetLayer
private

Definition at line 81 of file TrackEfficiencyMonitor.h.

Referenced by compatibleLayers(), and findNextLayer().

std::string TrackEfficiencyMonitor::histname
private

Definition at line 65 of file TrackEfficiencyMonitor.h.

Referenced by beginJob().

bool TrackEfficiencyMonitor::isBFieldOff_
private

Definition at line 72 of file TrackEfficiencyMonitor.h.

Referenced by analyze(), and TrackEfficiencyMonitor().

edm::ESHandle<MeasurementTracker> TrackEfficiencyMonitor::measurementTrackerHandle
private

Definition at line 114 of file TrackEfficiencyMonitor.h.

Referenced by analyze(), and compatibleLayers().

MonitorElement* TrackEfficiencyMonitor::muonCompatibleLayers
private

Definition at line 89 of file TrackEfficiencyMonitor.h.

Referenced by beginJob(), and testTrackerTracks().

MonitorElement* TrackEfficiencyMonitor::muonD0
private

Definition at line 88 of file TrackEfficiencyMonitor.h.

Referenced by beginJob(), testSTATracks(), and testTrackerTracks().

MonitorElement* TrackEfficiencyMonitor::muonEta
private

Definition at line 86 of file TrackEfficiencyMonitor.h.

Referenced by beginJob(), testSTATracks(), and testTrackerTracks().

MonitorElement* TrackEfficiencyMonitor::muonPhi
private

Definition at line 87 of file TrackEfficiencyMonitor.h.

Referenced by beginJob(), testSTATracks(), and testTrackerTracks().

MonitorElement* TrackEfficiencyMonitor::muonX
private

Definition at line 83 of file TrackEfficiencyMonitor.h.

Referenced by beginJob(), testSTATracks(), and testTrackerTracks().

MonitorElement* TrackEfficiencyMonitor::muonY
private

Definition at line 84 of file TrackEfficiencyMonitor.h.

Referenced by beginJob(), testSTATracks(), and testTrackerTracks().

MonitorElement* TrackEfficiencyMonitor::muonZ
private

Definition at line 85 of file TrackEfficiencyMonitor.h.

Referenced by beginJob(), testSTATracks(), and testTrackerTracks().

int TrackEfficiencyMonitor::nCompatibleLayers
private

Definition at line 80 of file TrackEfficiencyMonitor.h.

Referenced by analyze(), and testTrackerTracks().

MonitorElement* TrackEfficiencyMonitor::signDeltaX
private

Definition at line 101 of file TrackEfficiencyMonitor.h.

Referenced by beginJob(), and testTrackerTracks().

MonitorElement* TrackEfficiencyMonitor::signDeltaY
private

Definition at line 102 of file TrackEfficiencyMonitor.h.

Referenced by beginJob(), and testTrackerTracks().

edm::ESHandle<GeometricSearchTracker> TrackEfficiencyMonitor::theGeometricSearchTracker
private

Definition at line 107 of file TrackEfficiencyMonitor.h.

double TrackEfficiencyMonitor::theMaxZ_
private

Definition at line 71 of file TrackEfficiencyMonitor.h.

Referenced by testTrackerTracks(), and TrackEfficiencyMonitor().

MuonServiceProxy* TrackEfficiencyMonitor::theMuonServiceProxy
private

Definition at line 105 of file TrackEfficiencyMonitor.h.

const DirectTrackerNavigation* TrackEfficiencyMonitor::theNavigation
private

Definition at line 104 of file TrackEfficiencyMonitor.h.

Referenced by analyze().

edm::ESHandle<Propagator> TrackEfficiencyMonitor::thePropagator
private
edm::ESHandle<Propagator> TrackEfficiencyMonitor::thePropagatorCyl
private

Definition at line 109 of file TrackEfficiencyMonitor.h.

double TrackEfficiencyMonitor::theRadius_
private

Definition at line 70 of file TrackEfficiencyMonitor.h.

Referenced by testTrackerTracks(), and TrackEfficiencyMonitor().

edm::InputTag TrackEfficiencyMonitor::theSTATracksLabel_
private

Definition at line 77 of file TrackEfficiencyMonitor.h.

Referenced by analyze(), and TrackEfficiencyMonitor().

edm::InputTag TrackEfficiencyMonitor::theTKTracksLabel_
private

Definition at line 76 of file TrackEfficiencyMonitor.h.

Referenced by analyze(), and TrackEfficiencyMonitor().

edm::ESHandle<GeometricSearchTracker> TrackEfficiencyMonitor::theTracker
private

Definition at line 111 of file TrackEfficiencyMonitor.h.

Referenced by analyze().

edm::ESHandle<TransientTrackBuilder> TrackEfficiencyMonitor::theTTrackBuilder
private

Definition at line 110 of file TrackEfficiencyMonitor.h.

Referenced by analyze(), testSTATracks(), and testTrackerTracks().

MonitorElement* TrackEfficiencyMonitor::trackCompatibleLayers
private

Definition at line 97 of file TrackEfficiencyMonitor.h.

Referenced by beginJob(), compatibleLayers(), and testTrackerTracks().

MonitorElement* TrackEfficiencyMonitor::trackD0
private

Definition at line 96 of file TrackEfficiencyMonitor.h.

Referenced by beginJob(), testSTATracks(), and testTrackerTracks().

bool TrackEfficiencyMonitor::trackEfficiency_
private

Definition at line 73 of file TrackEfficiencyMonitor.h.

Referenced by analyze(), and TrackEfficiencyMonitor().

MonitorElement* TrackEfficiencyMonitor::trackEta
private

Definition at line 94 of file TrackEfficiencyMonitor.h.

Referenced by beginJob(), testSTATracks(), and testTrackerTracks().

MonitorElement* TrackEfficiencyMonitor::trackPhi
private

Definition at line 95 of file TrackEfficiencyMonitor.h.

Referenced by beginJob(), testSTATracks(), and testTrackerTracks().

MonitorElement* TrackEfficiencyMonitor::trackX
private

Definition at line 91 of file TrackEfficiencyMonitor.h.

Referenced by beginJob(), testSTATracks(), and testTrackerTracks().

MonitorElement* TrackEfficiencyMonitor::trackY
private

Definition at line 92 of file TrackEfficiencyMonitor.h.

Referenced by beginJob(), testSTATracks(), and testTrackerTracks().

MonitorElement* TrackEfficiencyMonitor::trackZ
private

Definition at line 93 of file TrackEfficiencyMonitor.h.

Referenced by beginJob(), testSTATracks(), and testTrackerTracks().