CMS 3D CMS Logo

TrackingMonitor Class Reference

Monitoring source for general quantities related to tracks. More...

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

Inheritance diagram for TrackingMonitor:

edm::EDAnalyzer

List of all members.

Public Member Functions

virtual void analyze (const edm::Event &, const edm::EventSetup &)
virtual void beginJob (edm::EventSetup const &iSetup)
virtual void endJob (void)
 TrackingMonitor (const edm::ParameterSet &)
 ~TrackingMonitor ()

Private Attributes

edm::ParameterSet conf_
DQMStoredqmStore_
std::string histname
MonitorElementNumberOfMeanLayersPerTrack
MonitorElementNumberOfMeanRecHitsPerTrack
MonitorElementNumberOfTracks
TrackAnalyzertheTrackAnalyzer


Detailed Description

Monitoring source for general quantities related to tracks.

Definition at line 28 of file TrackingMonitor.h.


Constructor & Destructor Documentation

TrackingMonitor::TrackingMonitor ( const edm::ParameterSet iConfig  )  [explicit]

Definition at line 24 of file TrackingMonitor.cc.

References conf_, dqmStore_, and theTrackAnalyzer.

00024                                                                {
00025   dqmStore_ = edm::Service<DQMStore>().operator->();
00026   conf_ = iConfig;
00027 
00028   // the track analyzer
00029   theTrackAnalyzer = new TrackAnalyzer(conf_);
00030 }

TrackingMonitor::~TrackingMonitor (  ) 

Definition at line 32 of file TrackingMonitor.cc.

References theTrackAnalyzer.

00032                                   { 
00033   delete theTrackAnalyzer;
00034 }


Member Function Documentation

void TrackingMonitor::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
) [virtual]

Implements edm::EDAnalyzer.

Definition at line 75 of file TrackingMonitor.cc.

References TrackAnalyzer::analyze(), conf_, MonitorElement::Fill(), edm::Event::getByLabel(), edm::ParameterSet::getParameter(), NumberOfMeanLayersPerTrack, NumberOfMeanRecHitsPerTrack, NumberOfTracks, theTrackAnalyzer, and track.

00075                                                                                  {
00076 
00077   using namespace edm;
00078   
00079   InputTag trackProducer = conf_.getParameter<edm::InputTag>("TrackProducer");
00080   
00081   Handle<reco::TrackCollection> trackCollection;
00082   iEvent.getByLabel(trackProducer, trackCollection);
00083   if (!trackCollection.isValid()) return;
00084 
00085   NumberOfTracks->Fill(trackCollection->size());
00086   
00087   int totalRecHits = 0, totalLayers = 0;
00088   for (reco::TrackCollection::const_iterator track = trackCollection->begin(); track!=trackCollection->end(); ++track) {
00089   
00090     totalRecHits += track->found();
00091     totalLayers += track->hitPattern().trackerLayersWithMeasurement();
00092 
00093     theTrackAnalyzer->analyze(iEvent, iSetup, *track);
00094   }
00095 
00096   double meanrechits = 0, meanlayers = 0;
00097   // check that track size to avoid division by zero.
00098   if (trackCollection->size()) {
00099     meanrechits = static_cast<double>(totalRecHits)/static_cast<double>(trackCollection->size());
00100     meanlayers = static_cast<double>(totalLayers)/static_cast<double>(trackCollection->size());
00101   }
00102   NumberOfMeanRecHitsPerTrack->Fill(meanrechits);
00103   NumberOfMeanLayersPerTrack->Fill(meanlayers);
00104 }

void TrackingMonitor::beginJob ( edm::EventSetup const &  iSetup  )  [virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 36 of file TrackingMonitor.cc.

References TrackAnalyzer::beginJob(), DQMStore::book1D(), conf_, dqmStore_, edm::ParameterSet::getParameter(), histname, NumberOfMeanLayersPerTrack, NumberOfMeanRecHitsPerTrack, NumberOfTracks, MonitorElement::setAxisTitle(), DQMStore::setCurrentFolder(), and theTrackAnalyzer.

00036                                                           {
00037 
00038   using namespace edm;
00039 
00040   std::string AlgoName     = conf_.getParameter<std::string>("AlgoName");
00041   std::string MEFolderName = conf_.getParameter<std::string>("FolderName"); 
00042 
00043   dqmStore_->setCurrentFolder(MEFolderName);
00044 
00045   int    TKNoBin = conf_.getParameter<int>("TkSizeBin");
00046   double TKNoMin = conf_.getParameter<double>("TkSizeMin");
00047   double TKNoMax = conf_.getParameter<double>("TkSizeMax");
00048 
00049   int    TKHitBin = conf_.getParameter<int>("RecHitBin");
00050   double TKHitMin = conf_.getParameter<double>("RecHitMin");
00051   double TKHitMax = conf_.getParameter<double>("RecHitMax");
00052 
00053   int    TKLayBin = conf_.getParameter<int>("RecLayBin");
00054   double TKLayMin = conf_.getParameter<double>("RecLayMin");
00055   double TKLayMax = conf_.getParameter<double>("RecLayMax");
00056 
00057   histname = "NumberOfTracks_";
00058   NumberOfTracks = dqmStore_->book1D(histname+AlgoName, histname+AlgoName, TKNoBin, TKNoMin, TKNoMax);
00059 
00060   histname = "NumberOfMeanRecHitsPerTrack_";
00061   NumberOfMeanRecHitsPerTrack = dqmStore_->book1D(histname+AlgoName, histname+AlgoName, TKHitBin, TKHitMin, TKHitMax);
00062   NumberOfMeanRecHitsPerTrack->setAxisTitle("Mean number of RecHits per track");
00063 
00064   histname = "NumberOfMeanLayersPerTrack_";
00065   NumberOfMeanLayersPerTrack = dqmStore_->book1D(histname+AlgoName, histname+AlgoName, TKLayBin, TKLayMin, TKLayMax);
00066   NumberOfMeanLayersPerTrack->setAxisTitle("Mean number of Layers per track");
00067 
00068   theTrackAnalyzer->beginJob(iSetup, dqmStore_);
00069  
00070 }

void TrackingMonitor::endJob ( void   )  [virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 107 of file TrackingMonitor.cc.

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

00107                                  {
00108   bool outputMEsInRootFile = conf_.getParameter<bool>("OutputMEsInRootFile");
00109   std::string outputFileName = conf_.getParameter<std::string>("OutputFileName");
00110   if(outputMEsInRootFile){
00111     dqmStore_->showDirStructure();
00112     dqmStore_->save(outputFileName);
00113   }
00114 
00115   
00116 }


Member Data Documentation

edm::ParameterSet TrackingMonitor::conf_ [private]

Definition at line 46 of file TrackingMonitor.h.

Referenced by analyze(), beginJob(), endJob(), and TrackingMonitor().

DQMStore* TrackingMonitor::dqmStore_ [private]

Definition at line 45 of file TrackingMonitor.h.

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

std::string TrackingMonitor::histname [private]

Definition at line 43 of file TrackingMonitor.h.

Referenced by beginJob().

MonitorElement* TrackingMonitor::NumberOfMeanLayersPerTrack [private]

Definition at line 53 of file TrackingMonitor.h.

Referenced by analyze(), and beginJob().

MonitorElement* TrackingMonitor::NumberOfMeanRecHitsPerTrack [private]

Definition at line 52 of file TrackingMonitor.h.

Referenced by analyze(), and beginJob().

MonitorElement* TrackingMonitor::NumberOfTracks [private]

Definition at line 51 of file TrackingMonitor.h.

Referenced by analyze(), and beginJob().

TrackAnalyzer* TrackingMonitor::theTrackAnalyzer [private]

Definition at line 49 of file TrackingMonitor.h.

Referenced by analyze(), beginJob(), TrackingMonitor(), and ~TrackingMonitor().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:34:12 2009 for CMSSW by  doxygen 1.5.4