CMS 3D CMS Logo

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

#include <PhysicsObjectsMonitor.h>

Inheritance diagram for PhysicsObjectsMonitor:
edm::EDAnalyzer edm::EDConsumerBase

Public Member Functions

void analyze (const edm::Event &event, const edm::EventSetup &eventSetup)
 
virtual void beginJob ()
 
virtual void endJob ()
 
 PhysicsObjectsMonitor (const edm::ParameterSet &pset)
 Constructor. More...
 
virtual ~PhysicsObjectsMonitor ()
 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 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
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
typedef WorkerT< EDAnalyzerWorkerType
 
- 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

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

Date:
2009/12/14 22:22:11
Revision:
1.5
Author
M. Mulders - CERN marti.nosp@m.jn.m.nosp@m.ulder.nosp@m.s@ce.nosp@m.rn.ch Based on STAMuonAnalyzer by 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:
2009/12/14 22:22:12
Revision:
1.9
Author
M. Mulders - CERN marti.nosp@m.jn.m.nosp@m.ulder.nosp@m.s@ce.nosp@m.rn.ch Based on STAMuonAnalyzer by R. Bellan - INFN Torino ricca.nosp@m.rdo..nosp@m.bella.nosp@m.n@ce.nosp@m.rn.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 edm::ParameterSet::getUntrackedParameter(), and cppFunctionSkipper::operator.

35  {
36  theSTAMuonLabel = pset.getUntrackedParameter<string>("StandAloneTrackCollectionLabel");
37  theSeedCollectionLabel = pset.getUntrackedParameter<string>("MuonSeedCollectionLabel");
38 
39  theRootFileName = pset.getUntrackedParameter<string>("rootFileName");
40  saveRootFile = pset.getUntrackedParameter<bool>("produceRootFile");
41 
42  theDataType = pset.getUntrackedParameter<string>("DataType");
43 
44  if(theDataType != "RealData" && theDataType != "SimData")
45  edm::LogInfo ("PhysicsObjectsMonitor") << "Error in Data Type!!"<<endl;
46 
49 
52 
53 
54 
55 
56 }
T getUntrackedParameter(std::string const &, T const &) const
PhysicsObjectsMonitor::~PhysicsObjectsMonitor ( )
virtual

Destructor.

Definition at line 59 of file PhysicsObjectsMonitor.cc.

59  {
60 }

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 DeDxDiscriminatorTools::charge(), TrajectoryStateClosestToPoint::charge(), MuonSubdetId::CSC, debug, MuonSubdetId::DT, MuonPatternRecoDumper::dumpFTS(), edm::EventSetup::get(), reco::TransientTrack::impactPointTSCP(), PV3DBase< T, PVType, FrameType >::mag(), TrajectoryStateClosestToPoint::momentum(), PV3DBase< T, PVType, FrameType >::perp(), reco::TransientTrack::recHitsBegin(), reco::TransientTrack::recHitsEnd(), recPt, MuonSubdetId::RPC, muonTagProbeFilters_cff::staTracks, TrajectoryStateClosestToPoint::theState(), PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

106  {
107 
108  edm::LogInfo ("PhysicsObjectsMonitor") << "Run: " << event.id().run() << " Event: " << event.id().event();
110 
111  // Get the RecTrack collection from the event
113  event.getByLabel(theSTAMuonLabel, staTracks);
114 
115  ESHandle<MagneticField> theMGField;
116  eventSetup.get<IdealMagneticFieldRecord>().get(theMGField);
117 
118 
119  double recPt=0.;
120  double simPt=0.;
121 
122  // Get the SimTrack collection from the event
123  // if(theDataType == "SimData"){
124  // Handle<SimTrackContainer> simTracks;
125  // event.getByLabel("g4SimHits",simTracks);
126 
127  // numberOfRecTracks += staTracks->size();
128 
129  // SimTrackContainer::const_iterator simTrack;
130 
131  // edm::LogInfo ("PhysicsObjectsMonitor") <<"Simulated tracks: ";
132  // for (simTrack = simTracks->begin(); simTrack != simTracks->end(); ++simTrack){
133  // if (abs((*simTrack).type()) == 13) {
134  // edm::LogInfo ("PhysicsObjectsMonitor") << "Sim pT: "<<(*simTrack).momentum().perp()<<endl;
135  // simPt=(*simTrack).momentum().perp();
136  // edm::LogInfo ("PhysicsObjectsMonitor") <<"Sim Eta: "<<(*simTrack).momentum().eta()<<endl;
137  // numberOfSimTracks++;
138  // }
139  // }
140  // edm::LogInfo ("PhysicsObjectsMonitor") << "\n";
141  //}
142 
143  reco::TrackCollection::const_iterator staTrack;
144 
145  edm::LogInfo ("PhysicsObjectsMonitor") << "Reconstructed tracks: " << staTracks->size() << endl;
146  Nmuon->Fill(staTracks->size());
147  for (staTrack = staTracks->begin(); staTrack != staTracks->end(); ++staTrack){
148  reco::TransientTrack track(*staTrack,&*theMGField);
149 
150  int nrechits=0;
151  int nDThits=0;
152  int nCSChits=0;
153  int nRPChits=0;
154 
155  for (trackingRecHit_iterator it = track.recHitsBegin (); it != track.recHitsEnd (); it++) {
156  if ((*it)->isValid ()) {
157  edm::LogInfo ("PhysicsObjectsMonitor") << "Analyzer: Aha this looks like a Rechit!" << std::endl;
158  if((*it)->geographicalId().subdetId() == MuonSubdetId::DT) {
159  nDThits++;
160  } else if((*it)->geographicalId().subdetId() == MuonSubdetId::CSC) {
161  nCSChits++;
162  } else if((*it)->geographicalId().subdetId() == MuonSubdetId::RPC) {
163  nRPChits++;
164  } else {
165  edm::LogInfo ("PhysicsObjectsMonitor") << "This is an UNKNOWN hit !! " << std::endl;
166  }
167  nrechits++;
168  }
169  }
170 
171  Nrechits->Fill(nrechits);
172  NDThits->Fill(nDThits);
173  NCSChits->Fill(nCSChits);
174  DTvsCSC->Fill(nDThits,nCSChits);
175  NRPChits->Fill(nRPChits);
176 
177  debug.dumpFTS(track.impactPointTSCP().theState());
178 
179  recPt = track.impactPointTSCP().momentum().perp();
180  edm::LogInfo ("PhysicsObjectsMonitor") << " p: "<<track.impactPointTSCP().momentum().mag()<< " pT: "<<recPt<<endl;
181  pt->Fill(recPt);
182  ptot->Fill(track.impactPointTSCP().momentum().mag());
183  charge->Fill(track.impactPointTSCP().charge());
184  px->Fill(track.impactPointTSCP().momentum().x());
185  py->Fill(track.impactPointTSCP().momentum().y());
186  pz->Fill(track.impactPointTSCP().momentum().z());
187  }
188  edm::LogInfo ("PhysicsObjectsMonitor") <<"---"<<endl;
189  if(recPt && theDataType == "SimData"){
190  hPres->Fill( (recPt-simPt)/simPt);
191  h1_Pres->Fill( ( 1/recPt - 1/simPt)/ (1/simPt));
192 
193  }
194 }
void Fill(long long x)
std::string dumpFTS(const FreeTrajectoryState &fts) const
static const int CSC
Definition: MuonSubdetId.h:15
const T & get() const
Definition: EventSetup.h:55
static const int RPC
Definition: MuonSubdetId.h:16
static const int DT
Definition: MuonSubdetId.h:14
double recPt
#define debug
Definition: MEtoEDMFormat.h:34
void PhysicsObjectsMonitor::beginJob ( void  )
virtual

Reimplemented from edm::EDAnalyzer.

Definition at line 62 of file PhysicsObjectsMonitor.cc.

References DeDxDiscriminatorTools::charge().

62  {
63 
64  dbe->setCurrentFolder("PhysicsObjects/MuonReconstruction");
65 
66 
67  hPres = dbe->book1D("pTRes","pT Resolution",100,-2,2);
68  h1_Pres =dbe->book1D("invPTRes","1/pT Resolution",100,-2,2);
69 
70  charge= dbe->book1D("charge","track charge",5,-2.5,2.5);
71  ptot = dbe->book1D("ptot","track momentum",50,0,50);
72  pt = dbe->book1D("pt","track pT",100,0,50);
73  px = dbe->book1D("px ","track px",100,-50,50);
74  py = dbe->book1D("py","track py",100,-50,50);
75  pz = dbe->book1D("pz","track pz",100,-50,50);
76  Nmuon = dbe->book1D("Nmuon","Number of muon tracks",11,-.5,10.5);
77  Nrechits = dbe->book1D("Nrechits","Number of RecHits/Segments on track",21,-.5,21.5);
78  NDThits = dbe->book1D("NDThits","Number of DT Hits/Segments on track",31,-.5,31.5);
79  NCSChits = dbe->book1D("NCSChits","Number of CSC Hits/Segments on track",31,-.5,31.5);
80  NRPChits = dbe->book1D("NRPChits","Number of RPC hits on track",11,-.5,11.5);
81 
82  DTvsCSC = dbe->book2D("DTvsCSC","Number of DT vs CSC hits on track",29,-.5,28.5,29,-.5,28.5);
83  TH2F * root_ob = DTvsCSC->getTH2F();
84  root_ob->SetXTitle("Number of DT hits");
85  root_ob->SetYTitle("Number of CSC hits");
86 
87 }
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
Definition: DQMStore.cc:722
TH2F * getTH2F(void) const
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
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:434
void PhysicsObjectsMonitor::endJob ( void  )
virtual

Reimplemented from edm::EDAnalyzer.

Definition at line 89 of file PhysicsObjectsMonitor.cc.

89  {
90 
91  if(theDataType == "SimData"){
92  // edm::LogInfo ("PhysicsObjectsMonitor") << "Number of Sim tracks: " << numberOfSimTracks;
93  edm::LogInfo ("PhysicsObjectsMonitor") << "Sorry! Running this package on simulation is no longer supported! ";
94  }
95 
96  edm::LogInfo ("PhysicsObjectsMonitor") << "Number of Reco tracks: " << numberOfRecTracks ;
97 
99  dbe->setCurrentFolder("PhysicsObjects/MuonReconstruction");
100  dbe->removeContents();
101 
102 
103 }
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
void removeContents(void)
erase all monitoring elements in current directory (not including subfolders);
Definition: DQMStore.cc:2569
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:434

Member Data Documentation

MonitorElement* PhysicsObjectsMonitor::charge
private
MonitorElement* PhysicsObjectsMonitor::CSCvsRPC
private

Definition at line 74 of file PhysicsObjectsMonitor.h.

DQMStore* PhysicsObjectsMonitor::dbe
private

Definition at line 51 of file PhysicsObjectsMonitor.h.

MonitorElement* PhysicsObjectsMonitor::DTvsCSC
private

Definition at line 72 of file PhysicsObjectsMonitor.h.

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.

MonitorElement* PhysicsObjectsMonitor::hPres
private

Definition at line 58 of file PhysicsObjectsMonitor.h.

MonitorElement* PhysicsObjectsMonitor::NCSChits
private

Definition at line 71 of file PhysicsObjectsMonitor.h.

MonitorElement* PhysicsObjectsMonitor::NDThits
private

Definition at line 70 of file PhysicsObjectsMonitor.h.

MonitorElement* PhysicsObjectsMonitor::Nmuon
private

Definition at line 68 of file PhysicsObjectsMonitor.h.

MonitorElement* PhysicsObjectsMonitor::Nrechits
private

Definition at line 69 of file PhysicsObjectsMonitor.h.

MonitorElement* PhysicsObjectsMonitor::NRPChits
private

Definition at line 75 of file PhysicsObjectsMonitor.h.

int PhysicsObjectsMonitor::numberOfRecTracks
private

Definition at line 80 of file PhysicsObjectsMonitor.h.

int PhysicsObjectsMonitor::numberOfSimTracks
private

Definition at line 79 of file PhysicsObjectsMonitor.h.

MonitorElement* PhysicsObjectsMonitor::pt
private

Definition at line 64 of file PhysicsObjectsMonitor.h.

MonitorElement* PhysicsObjectsMonitor::ptot
private

Definition at line 63 of file PhysicsObjectsMonitor.h.

MonitorElement* PhysicsObjectsMonitor::px
private

Definition at line 65 of file PhysicsObjectsMonitor.h.

MonitorElement* PhysicsObjectsMonitor::py
private

Definition at line 66 of file PhysicsObjectsMonitor.h.

MonitorElement* PhysicsObjectsMonitor::pz
private

Definition at line 67 of file PhysicsObjectsMonitor.h.

bool PhysicsObjectsMonitor::saveRootFile
private

Definition at line 50 of file PhysicsObjectsMonitor.h.

std::string PhysicsObjectsMonitor::theDataType
private

Definition at line 82 of file PhysicsObjectsMonitor.h.

std::string PhysicsObjectsMonitor::theRootFileName
private

Definition at line 49 of file PhysicsObjectsMonitor.h.

std::string PhysicsObjectsMonitor::theSeedCollectionLabel
private

Definition at line 55 of file PhysicsObjectsMonitor.h.

std::string PhysicsObjectsMonitor::theSTAMuonLabel
private

Definition at line 54 of file PhysicsObjectsMonitor.h.