CMS 3D CMS Logo

PhysicsObjectsMonitor Class Reference

For now: Analyzer of StandAlone muon tracks Later: Add other detectors and more Reco. More...

#include <DQM/PhysicsObjectsMonitoring/interface/PhysicsObjectsMonitor.h>

Inheritance diagram for PhysicsObjectsMonitor:

edm::EDAnalyzer

List of all members.

Public Member Functions

void analyze (const edm::Event &event, const edm::EventSetup &eventSetup)
virtual void beginJob (const edm::EventSetup &eventSetup)
virtual void endJob ()
 PhysicsObjectsMonitor (const edm::ParameterSet &pset)
 Constructor.
virtual ~PhysicsObjectsMonitor ()
 Destructor.

Private Attributes

MonitorElementcharge
MonitorElementCSCvsRPC
DQMStoredbe
MonitorElementDTvsCSC
MonitorElementDTvsRPC
MonitorElementh1_Pres
MonitorElementhPres
MonitorElementNCSChits
MonitorElementNDThits
MonitorElementNmuon
MonitorElementNrechits
MonitorElementNRPChits
int numberOfRecTracks
int numberOfSimTracks
MonitorElementpt
MonitorElementptot
MonitorElementpx
MonitorElementpy
MonitorElementpz
bool saveRootFile
std::string theDataType
std::string theRootFileName
std::string theSeedCollectionLabel
std::string theSTAMuonLabel


Detailed Description

For now: Analyzer of StandAlone muon tracks Later: Add other detectors and more Reco.

Analyzer of the StandAlone muon tracks.

Date
2008/03/01 00:40:13
Revision
1.4
Author:
M. Mulders - CERN <martijn.mulders@cern.ch> Based on STAMuonAnalyzer by R. Bellan - INFN Torino <riccardo.bellan@cern.ch>
Date
2008/03/01 00:40:13
Revision
1.8
Author:
M. Mulders - CERN <martijn.mulders@cern.ch> Based on STAMuonAnalyzer by R. Bellan - INFN Torino <riccardo.bellan@cern.ch>

Definition at line 32 of file PhysicsObjectsMonitor.h.


Constructor & Destructor Documentation

PhysicsObjectsMonitor::PhysicsObjectsMonitor ( const edm::ParameterSet pset  ) 

Constructor.

get hold of back-end interface

Definition at line 35 of file PhysicsObjectsMonitor.cc.

References dbe, lat::endl(), edm::ParameterSet::getUntrackedParameter(), numberOfRecTracks, numberOfSimTracks, saveRootFile, theDataType, theRootFileName, theSeedCollectionLabel, and theSTAMuonLabel.

00035                                                                     {
00036   theSTAMuonLabel = pset.getUntrackedParameter<string>("StandAloneTrackCollectionLabel");
00037   theSeedCollectionLabel = pset.getUntrackedParameter<string>("MuonSeedCollectionLabel");
00038 
00039   theRootFileName = pset.getUntrackedParameter<string>("rootFileName");
00040   saveRootFile = pset.getUntrackedParameter<bool>("produceRootFile");
00041 
00042   theDataType = pset.getUntrackedParameter<string>("DataType");
00043   
00044   if(theDataType != "RealData" && theDataType != "SimData")
00045   edm::LogInfo ("PhysicsObjectsMonitor") <<  "Error in Data Type!!"<<endl;
00046 
00047   numberOfSimTracks=0;
00048   numberOfRecTracks=0;
00049 
00051   dbe = edm::Service<DQMStore>().operator->();
00052   
00053 
00054 
00055 
00056 }

PhysicsObjectsMonitor::~PhysicsObjectsMonitor (  )  [virtual]

Destructor.

Definition at line 59 of file PhysicsObjectsMonitor.cc.

00059                                              {
00060 }


Member Function Documentation

void PhysicsObjectsMonitor::analyze ( const edm::Event event,
const edm::EventSetup eventSetup 
) [virtual]

Implements edm::EDAnalyzer.

Definition at line 106 of file PhysicsObjectsMonitor.cc.

References charge, TrajectoryStateClosestToPoint::charge(), MuonSubdetId::CSC, debug, MuonSubdetId::DT, DTvsCSC, MuonPatternRecoDumper::dumpFTS(), lat::endl(), MonitorElement::Fill(), edm::EventSetup::get(), h1_Pres, hPres, reco::TransientTrack::impactPointTSCP(), it, PV3DBase< T, PVType, FrameType >::mag(), TrajectoryStateClosestToPoint::momentum(), NCSChits, NDThits, Nmuon, Nrechits, NRPChits, PV3DBase< T, PVType, FrameType >::perp(), pt, ptot, px, py, pz, reco::TransientTrack::recHitsBegin(), reco::TransientTrack::recHitsEnd(), recPt, MuonSubdetId::RPC, theDataType, theSTAMuonLabel, TrajectoryStateClosestToPoint::theState(), track, PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

00106                                                                                     {
00107   
00108   edm::LogInfo ("PhysicsObjectsMonitor") << "Run: " << event.id().run() << " Event: " << event.id().event();
00109   MuonPatternRecoDumper debug;
00110   
00111   // Get the RecTrack collection from the event
00112   Handle<reco::TrackCollection> staTracks;
00113   event.getByLabel(theSTAMuonLabel, staTracks);
00114 
00115   ESHandle<MagneticField> theMGField;
00116   eventSetup.get<IdealMagneticFieldRecord>().get(theMGField);
00117 
00118   
00119   double recPt=0.;
00120   double simPt=0.;
00121 
00122   // Get the SimTrack collection from the event
00123   //  if(theDataType == "SimData"){
00124   //  Handle<SimTrackContainer> simTracks;
00125   //  event.getByLabel("g4SimHits",simTracks);
00126     
00127   //  numberOfRecTracks += staTracks->size();
00128 
00129   //    SimTrackContainer::const_iterator simTrack;
00130 
00131   //    edm::LogInfo ("PhysicsObjectsMonitor") <<"Simulated tracks: ";
00132   //  for (simTrack = simTracks->begin(); simTrack != simTracks->end(); ++simTrack){
00133   //    if (abs((*simTrack).type()) == 13) {
00134   //      edm::LogInfo ("PhysicsObjectsMonitor") <<     "Sim pT: "<<(*simTrack).momentum().perp()<<endl;
00135   //    simPt=(*simTrack).momentum().perp();
00136   //    edm::LogInfo ("PhysicsObjectsMonitor") <<"Sim Eta: "<<(*simTrack).momentum().eta()<<endl;
00137   //    numberOfSimTracks++;
00138   //   }    
00139   //  }
00140   //  edm::LogInfo ("PhysicsObjectsMonitor") << "\n";
00141   //}
00142   
00143   reco::TrackCollection::const_iterator staTrack;
00144   
00145   edm::LogInfo ("PhysicsObjectsMonitor") << "Reconstructed tracks: " << staTracks->size() << endl;
00146   Nmuon->Fill(staTracks->size());
00147   for (staTrack = staTracks->begin(); staTrack != staTracks->end(); ++staTrack){
00148     reco::TransientTrack track(*staTrack,&*theMGField); 
00149     
00150     int nrechits=0;
00151     int nDThits=0;
00152     int nCSChits=0;
00153     int nRPChits=0;
00154 
00155     for (trackingRecHit_iterator it = track.recHitsBegin ();  it != track.recHitsEnd (); it++) {
00156       if ((*it)->isValid ()) {      
00157         edm::LogInfo ("PhysicsObjectsMonitor") << "Analyzer:  Aha this looks like a Rechit!" << std::endl;
00158         if((*it)->geographicalId().subdetId() == MuonSubdetId::DT) {
00159           nDThits++;
00160         } else if((*it)->geographicalId().subdetId() == MuonSubdetId::CSC) {
00161           nCSChits++;
00162         } else if((*it)->geographicalId().subdetId() == MuonSubdetId::RPC) {
00163           nRPChits++;
00164         } else {
00165          edm::LogInfo ("PhysicsObjectsMonitor") <<  "This is an UNKNOWN hit !! " << std::endl;
00166         }
00167         nrechits++;
00168       }
00169     }
00170                 
00171     Nrechits->Fill(nrechits);
00172     NDThits->Fill(nDThits);
00173     NCSChits->Fill(nCSChits);
00174     DTvsCSC->Fill(nDThits,nCSChits);
00175     NRPChits->Fill(nRPChits);
00176 
00177     debug.dumpFTS(track.impactPointTSCP().theState());
00178     
00179     recPt = track.impactPointTSCP().momentum().perp();    
00180     edm::LogInfo ("PhysicsObjectsMonitor") << " p: "<<track.impactPointTSCP().momentum().mag()<< " pT: "<<recPt<<endl;
00181     pt->Fill(recPt);
00182     ptot->Fill(track.impactPointTSCP().momentum().mag());
00183     charge->Fill(track.impactPointTSCP().charge());
00184     px->Fill(track.impactPointTSCP().momentum().x());
00185     py->Fill(track.impactPointTSCP().momentum().y());
00186     pz->Fill(track.impactPointTSCP().momentum().z());
00187   }
00188   edm::LogInfo ("PhysicsObjectsMonitor") <<"---"<<endl;
00189   if(recPt && theDataType == "SimData"){
00190     hPres->Fill( (recPt-simPt)/simPt);
00191     h1_Pres->Fill( ( 1/recPt - 1/simPt)/ (1/simPt));
00192 
00193   }  
00194 }

void PhysicsObjectsMonitor::beginJob ( const edm::EventSetup eventSetup  )  [virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 62 of file PhysicsObjectsMonitor.cc.

References DQMStore::book1D(), DQMStore::book2D(), charge, dbe, DTvsCSC, MonitorElement::getTH2F(), h1_Pres, hPres, NCSChits, NDThits, Nmuon, Nrechits, NRPChits, pt, ptot, px, py, pz, and DQMStore::setCurrentFolder().

00062                                                                 {
00063 
00064   dbe->setCurrentFolder("PhysicsObjects/MuonReconstruction");           
00065 
00066 
00067   hPres = dbe->book1D("pTRes","pT Resolution",100,-2,2);
00068   h1_Pres =dbe->book1D("invPTRes","1/pT Resolution",100,-2,2);
00069 
00070   charge= dbe->book1D("charge","track charge",5,-2.5,2.5);
00071   ptot = dbe->book1D("ptot","track momentum",50,0,50);
00072   pt = dbe->book1D("pt","track pT",100,0,50);
00073   px = dbe->book1D("px ","track px",100,-50,50);
00074   py = dbe->book1D("py","track py",100,-50,50);
00075   pz = dbe->book1D("pz","track pz",100,-50,50);
00076   Nmuon = dbe->book1D("Nmuon","Number of muon tracks",11,-.5,10.5);
00077   Nrechits = dbe->book1D("Nrechits","Number of RecHits/Segments on track",21,-.5,21.5);
00078   NDThits = dbe->book1D("NDThits","Number of DT Hits/Segments on track",31,-.5,31.5);
00079   NCSChits = dbe->book1D("NCSChits","Number of CSC Hits/Segments on track",31,-.5,31.5);
00080   NRPChits = dbe->book1D("NRPChits","Number of RPC hits on track",11,-.5,11.5);
00081 
00082   DTvsCSC = dbe->book2D("DTvsCSC","Number of DT vs CSC hits on track",29,-.5,28.5,29,-.5,28.5);
00083   TH2F * root_ob = DTvsCSC->getTH2F();
00084   root_ob->SetXTitle("Number of DT hits");
00085   root_ob->SetYTitle("Number of CSC hits");
00086 
00087 }

void PhysicsObjectsMonitor::endJob ( void   )  [virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 89 of file PhysicsObjectsMonitor.cc.

References dbe, numberOfRecTracks, DQMStore::removeContents(), DQMStore::save(), saveRootFile, DQMStore::setCurrentFolder(), theDataType, and theRootFileName.

00089                                   {
00090   
00091  if(theDataType == "SimData"){
00092    //     edm::LogInfo ("PhysicsObjectsMonitor") << "Number of Sim tracks: " << numberOfSimTracks;
00093     edm::LogInfo ("PhysicsObjectsMonitor") << "Sorry! Running this package on simulation is no longer supported! ";
00094   }
00095 
00096   edm::LogInfo ("PhysicsObjectsMonitor") << "Number of Reco tracks: " << numberOfRecTracks ;
00097 
00098   if(saveRootFile) dbe->save(theRootFileName); 
00099   dbe->setCurrentFolder("PhysicsObjects/MuonReconstruction");
00100   dbe->removeContents();
00101 
00102 
00103 }


Member Data Documentation

MonitorElement* PhysicsObjectsMonitor::charge [private]

Definition at line 62 of file PhysicsObjectsMonitor.h.

Referenced by analyze(), and beginJob().

MonitorElement* PhysicsObjectsMonitor::CSCvsRPC [private]

Definition at line 74 of file PhysicsObjectsMonitor.h.

DQMStore* PhysicsObjectsMonitor::dbe [private]

Definition at line 51 of file PhysicsObjectsMonitor.h.

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

MonitorElement* PhysicsObjectsMonitor::DTvsCSC [private]

Definition at line 72 of file PhysicsObjectsMonitor.h.

Referenced by analyze(), and beginJob().

MonitorElement* PhysicsObjectsMonitor::DTvsRPC [private]

Definition at line 73 of file PhysicsObjectsMonitor.h.

MonitorElement* PhysicsObjectsMonitor::h1_Pres [private]

Definition at line 59 of file PhysicsObjectsMonitor.h.

Referenced by analyze(), and beginJob().

MonitorElement* PhysicsObjectsMonitor::hPres [private]

Definition at line 58 of file PhysicsObjectsMonitor.h.

Referenced by analyze(), and beginJob().

MonitorElement* PhysicsObjectsMonitor::NCSChits [private]

Definition at line 71 of file PhysicsObjectsMonitor.h.

Referenced by analyze(), and beginJob().

MonitorElement* PhysicsObjectsMonitor::NDThits [private]

Definition at line 70 of file PhysicsObjectsMonitor.h.

Referenced by analyze(), and beginJob().

MonitorElement* PhysicsObjectsMonitor::Nmuon [private]

Definition at line 68 of file PhysicsObjectsMonitor.h.

Referenced by analyze(), and beginJob().

MonitorElement* PhysicsObjectsMonitor::Nrechits [private]

Definition at line 69 of file PhysicsObjectsMonitor.h.

Referenced by analyze(), and beginJob().

MonitorElement* PhysicsObjectsMonitor::NRPChits [private]

Definition at line 75 of file PhysicsObjectsMonitor.h.

Referenced by analyze(), and beginJob().

int PhysicsObjectsMonitor::numberOfRecTracks [private]

Definition at line 80 of file PhysicsObjectsMonitor.h.

Referenced by endJob(), and PhysicsObjectsMonitor().

int PhysicsObjectsMonitor::numberOfSimTracks [private]

Definition at line 79 of file PhysicsObjectsMonitor.h.

Referenced by PhysicsObjectsMonitor().

MonitorElement* PhysicsObjectsMonitor::pt [private]

Definition at line 64 of file PhysicsObjectsMonitor.h.

Referenced by analyze(), and beginJob().

MonitorElement* PhysicsObjectsMonitor::ptot [private]

Definition at line 63 of file PhysicsObjectsMonitor.h.

Referenced by analyze(), and beginJob().

MonitorElement* PhysicsObjectsMonitor::px [private]

Definition at line 65 of file PhysicsObjectsMonitor.h.

Referenced by analyze(), and beginJob().

MonitorElement* PhysicsObjectsMonitor::py [private]

Definition at line 66 of file PhysicsObjectsMonitor.h.

Referenced by analyze(), and beginJob().

MonitorElement* PhysicsObjectsMonitor::pz [private]

Definition at line 67 of file PhysicsObjectsMonitor.h.

Referenced by analyze(), and beginJob().

bool PhysicsObjectsMonitor::saveRootFile [private]

Definition at line 50 of file PhysicsObjectsMonitor.h.

Referenced by endJob(), and PhysicsObjectsMonitor().

std::string PhysicsObjectsMonitor::theDataType [private]

Definition at line 82 of file PhysicsObjectsMonitor.h.

Referenced by analyze(), endJob(), and PhysicsObjectsMonitor().

std::string PhysicsObjectsMonitor::theRootFileName [private]

Definition at line 49 of file PhysicsObjectsMonitor.h.

Referenced by endJob(), and PhysicsObjectsMonitor().

std::string PhysicsObjectsMonitor::theSeedCollectionLabel [private]

Definition at line 55 of file PhysicsObjectsMonitor.h.

Referenced by PhysicsObjectsMonitor().

std::string PhysicsObjectsMonitor::theSTAMuonLabel [private]

Definition at line 54 of file PhysicsObjectsMonitor.h.

Referenced by analyze(), and PhysicsObjectsMonitor().


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