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
ExampleMuonAnalyzer Class Reference

#include <MuonAnalyzer.h>

Inheritance diagram for ExampleMuonAnalyzer:
edm::EDAnalyzer

Public Member Functions

void analyze (const edm::Event &event, const edm::EventSetup &eventSetup)
 
virtual void beginJob ()
 
virtual void endJob ()
 
 ExampleMuonAnalyzer (const edm::ParameterSet &pset)
 Constructor. More...
 
virtual ~ExampleMuonAnalyzer ()
 Destructor. More...
 
- Public Member Functions inherited from edm::EDAnalyzer
 EDAnalyzer ()
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 

Private Attributes

TH1F * h4MuInvMass
 
TH1I * hChamberMatched
 
TH1F * hEHcal
 
TH1F * hMuCaloCompatibility
 
TH1I * hMuIdAlgo
 
TH1F * hMuIso03CaloComb
 
TH1F * hMuIso03SumPt
 
TH1I * hMuonType
 
TH1F * hMuSegCompatibility
 
TH1I * hNMuons
 
TH1F * hPtRec
 
TH2F * hPtReso
 
TH1F * hPtSTATKDiff
 
std::string theMuonLabel
 

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)
 
- Protected Member Functions inherited from edm::EDAnalyzer
CurrentProcessingContext const * currentContext () const
 

Detailed Description

Analyzer of the muon objects

Date:
2009/11/06 10:06:22
Revision:
1.6
Author
R. Bellan - CERN ricca.nosp@m.rdo..nosp@m.bella.nosp@m.n@ce.nosp@m.rn.ch

Analyzer of the muon objects

Date:
2009/09/29 19:46:13
Revision:
1.3
Author
R. Bellan - CERN ricca.nosp@m.rdo..nosp@m.bella.nosp@m.n@ce.nosp@m.rn.ch

Definition at line 25 of file MuonAnalyzer.h.

Constructor & Destructor Documentation

ExampleMuonAnalyzer::ExampleMuonAnalyzer ( const edm::ParameterSet pset)

Constructor.

Definition at line 31 of file MuonAnalyzer.cc.

References edm::ParameterSet::getUntrackedParameter().

31  {
32 
33  theMuonLabel = pset.getUntrackedParameter<string>("MuonCollection");
34 }
T getUntrackedParameter(std::string const &, T const &) const
std::string theMuonLabel
Definition: MuonAnalyzer.h:42
ExampleMuonAnalyzer::~ExampleMuonAnalyzer ( )
virtual

Destructor.

Definition at line 37 of file MuonAnalyzer.cc.

37  {
38 }

Member Function Documentation

void ExampleMuonAnalyzer::analyze ( const edm::Event event,
const edm::EventSetup eventSetup 
)
virtual

simple selection... Do not want to write here my super-secret Higgs analysis ;-)

Implements edm::EDAnalyzer.

Definition at line 71 of file MuonAnalyzer.cc.

References muon::All, muon::AllArbitrated, muon::AllStandAloneMuons, muon::AllTrackerMuons, diffTreeTool::diff, muon::GlobalMuonPromptTight, muon::isGoodMuon(), metsig::muon, patZpeak::muons, muon::segmentCompatibility(), muon::TM2DCompatibilityLoose, muon::TM2DCompatibilityTight, muon::TMLastStationLoose, muon::TMLastStationOptimizedLowPtLoose, muon::TMLastStationOptimizedLowPtTight, muon::TMLastStationTight, muon::TMOneStationLoose, muon::TMOneStationTight, and muon::TrackerMuonArbitrated.

71  {
72 
73  // Get the Muon collection
75  event.getByLabel(theMuonLabel, muons);
76 
77  // How many muons in the event?
78  hNMuons->Fill(muons->size());
79 
80  pat::MuonCollection selectedMuons;
81 
82 
83  // Let's look inside the muon collection.
84  for (pat::MuonCollection::const_iterator muon = muons->begin(); muon != muons->end(); ++muon){
85 
86  // pT spectra of muons
87  hPtRec->Fill(muon->pt());
88 
89  // what is the resolution in pt? Easy! We have the association with generated information
90  // cout<<muon->pt()<<" "<<muon->genParticle()->pt()<<endl;
91  if( muon->genLepton()!=0){
92  double reso = (muon->pt() - muon->genLepton()->pt())/muon->genLepton()->pt();
93  hPtReso->Fill(muon->genLepton()->pt(),reso);
94  }
95 
96  // What is the energy deposit in HCal?
97  if(muon->isEnergyValid())
98  hEHcal->Fill(muon->calEnergy().had);
99 
100  // Which type of muons in the collection?
101  if(muon->isStandAloneMuon())
102  if(muon->isGlobalMuon())
103  if(muon->isTrackerMuon()) hMuonType->Fill(1); // STA + GLB + TM
104  else hMuonType->Fill(2); // STA + GLB
105  else
106  if(muon->isTrackerMuon()) hMuonType->Fill(3); // STA + TM
107  else hMuonType->Fill(5); // STA
108  else
109  if(muon->isTrackerMuon()) hMuonType->Fill(4); // TM
110 
111  // ...mmm I want to study the relative resolution of the STA track with respect to the Tracker track.
112  // or I want to look at a track stab
113  if(muon->isGlobalMuon()){
114  double diff = muon->innerTrack()->pt() - muon->standAloneMuon()->pt();
115  hPtSTATKDiff->Fill(diff);
116  }
117 
118  // Muon ID quantities
119 
120  // Muon in CMS are usually MIP. What is the compatibility of a muon HP using only claorimeters?
121  if(muon->isCaloCompatibilityValid())
122  hMuCaloCompatibility->Fill(muon->caloCompatibility());
123 
124  // The muon system can also be used just as only for ID. What is the compatibility of a muon HP using only calorimeters?
126 
127 
128  // How many chambers have been associated to a muon track?
129  hChamberMatched->Fill(muon->numberOfChambers());
130  // If you look at MuonSegmentMatcher class you will see a lot of interesting quantities to look at!
131  // you can get the list of matched info using matches()
132 
133 
134  // Muon ID selection. As described in AN-2008/098
135  if(muon::isGoodMuon(*muon, muon::All)) // dummy options - always true
136  hMuIdAlgo->Fill(0);
137  if(muon::isGoodMuon(*muon, muon::AllStandAloneMuons)) // checks isStandAloneMuon flag
138  hMuIdAlgo->Fill(1);
139  if(muon::isGoodMuon(*muon, muon::AllTrackerMuons)) // checks isTrackerMuon flag
140  hMuIdAlgo->Fill(2);
141  if(muon::isGoodMuon(*muon, muon::TrackerMuonArbitrated)) // resolve ambiguity of sharing segments
142  hMuIdAlgo->Fill(3);
143  if(muon::isGoodMuon(*muon, muon::AllArbitrated)) // all muons with the tracker muon arbitrated
144  hMuIdAlgo->Fill(4);
145  if(muon::isGoodMuon(*muon, muon::GlobalMuonPromptTight)) // global muons with tighter fit requirements
146  hMuIdAlgo->Fill(5);
147  if(muon::isGoodMuon(*muon, muon::TMLastStationLoose)) // penetration depth loose selector
148  hMuIdAlgo->Fill(6);
149  if(muon::isGoodMuon(*muon, muon::TMLastStationTight)) // penetration depth tight selector
150  hMuIdAlgo->Fill(7);
151  if(muon::isGoodMuon(*muon, muon::TM2DCompatibilityLoose)) // likelihood based loose selector
152  hMuIdAlgo->Fill(8);
153  if(muon::isGoodMuon(*muon, muon::TM2DCompatibilityTight)) // likelihood based tight selector
154  hMuIdAlgo->Fill(9);
155  if(muon::isGoodMuon(*muon, muon::TMOneStationLoose)) // require one well matched segment
156  hMuIdAlgo->Fill(10);
157  if(muon::isGoodMuon(*muon, muon::TMOneStationTight)) // require one well matched segment
158  hMuIdAlgo->Fill(11);
159  if(muon::isGoodMuon(*muon, muon::TMLastStationOptimizedLowPtLoose)) // combination of TMLastStation and TMOneStation
160  hMuIdAlgo->Fill(12);
161  if(muon::isGoodMuon(*muon, muon::TMLastStationOptimizedLowPtTight)) // combination of TMLastStation and TMOneStation
162  hMuIdAlgo->Fill(13);
163 
164 
165 
166  // Isolation variables. There are many type of isolation. You can even build your own combining the output of
167  // muon->isolationR03(). E.g.: 1.2*muon->isolationR03().emEt + 0.8*muon->isolationR03().hadEt
168  // *** WARNING *** it is just an EXAMPLE!
169  if(muon->isIsolationValid()){
170  hMuIso03CaloComb->Fill(1.2*muon->isolationR03().emEt + 0.8*muon->isolationR03().hadEt);
171  hMuIso03SumPt->Fill(muon->isolationR03().sumPt);
172  }
173 
174  // OK, let see if we understood everything.
175  // Suppose we are searching for H->ZZ->4mu.
176  // In mean the 4 muons have/are:
177  // high pt (but 1 out of 4 can be at quite low pt)
178  // isolated
179  // so, we can make some requirements
180  if(muon->isolationR03().sumPt< 0.2){
181  if(muon->isGlobalMuon() ||
184  selectedMuons.push_back(*muon);
185  }
186  }
187 
189  if(selectedMuons.size() == 4){
191  for (pat::MuonCollection::const_iterator muon = selectedMuons.begin(); muon != selectedMuons.end(); ++muon){
192  p4CM = p4CM + muon->p4();
193  }
194  h4MuInvMass->Fill(p4CM.mass());
195  }
196 }
TH1F * hMuSegCompatibility
Definition: MuonAnalyzer.h:55
TH1F * hMuCaloCompatibility
Definition: MuonAnalyzer.h:54
std::string theMuonLabel
Definition: MuonAnalyzer.h:42
float segmentCompatibility(const reco::Muon &muon, reco::Muon::ArbitrationType arbitrationType=reco::Muon::SegmentAndTrackArbitration)
bool isGoodMuon(const reco::Muon &muon, SelectionType type, reco::Muon::ArbitrationType arbitrationType=reco::Muon::SegmentAndTrackArbitration)
main GoodMuon wrapper call
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Definition: Candidate.h:39
std::vector< Muon > MuonCollection
Definition: Muon.h:36
tuple muons
Definition: patZpeak.py:38
void ExampleMuonAnalyzer::beginJob ( void  )
virtual

Reimplemented from edm::EDAnalyzer.

Definition at line 40 of file MuonAnalyzer.cc.

References fileService, and TFileDirectory::make().

40  {
41 
42  // Book histograms
44  hPtRec = fileService->make<TH1F>("pT","p_{T}^{rec}",250,0,120);
45  hPtReso = fileService->make<TH2F>("pT_Reso","(p_{T}^{rec}-p_{T}^{sim})/p_{T}^{sim}",250,0,120,100,-0.2,0.2);
46  hNMuons = fileService->make<TH1I>("NMuons","Number of muons per event",20,0,20);
47 
48  hEHcal = fileService->make<TH1F>("EHCal","Energy deposit in HCAL",100,0,10);
49 
50  // ID
51  hMuonType = fileService->make<TH1I>("MuonType", "Type of Muons", 5, 1, 6);
52  hPtSTATKDiff = fileService->make<TH1F>("DiffPt_STA_TK","p^{TK}_{T}-p^{STA}_T",200,-50,50);
53  hMuCaloCompatibility = fileService->make<TH1F>("CaloCompatibility","Muon HP using Calorimeters only",100,0,1);
54  hMuSegCompatibility = fileService->make<TH1F>("SegmentCompatibility","Muon HP using segments only",100,0,1);
55  hChamberMatched = fileService->make<TH1I>("NumMatchedChamber", "Number of matched chambers", 7, 0, 7);
56  hMuIdAlgo = fileService->make<TH1I>("MuonIDSelectors", "Results of muon id selectors", 13, 0, 13);
57 
58  // Isolation
59  hMuIso03SumPt = fileService->make<TH1F>("MuIso03SumPt","Isolation #Delta(R)=0.3: SumPt",200,0,10);
60  hMuIso03CaloComb = fileService->make<TH1F>("MuIso03CaloComb","Isolation #Delta(R)=0.3: 1.2*ECAL+0.8HCAL",200,0,10);
61 
62  // 4Mu invariant mass
63  h4MuInvMass = fileService->make<TH1F>("InvMass4MuSystem","Invariant mass of the 4 muons system",200,0,500);
64 
65 }
TH1F * hMuSegCompatibility
Definition: MuonAnalyzer.h:55
TH1F * hMuCaloCompatibility
Definition: MuonAnalyzer.h:54
edm::Service< TFileService > fileService
T * make() const
make new ROOT object
void ExampleMuonAnalyzer::endJob ( void  )
virtual

Reimplemented from edm::EDAnalyzer.

Definition at line 67 of file MuonAnalyzer.cc.

67  {
68 }

Member Data Documentation

TH1F* ExampleMuonAnalyzer::h4MuInvMass
private

Definition at line 63 of file MuonAnalyzer.h.

TH1I* ExampleMuonAnalyzer::hChamberMatched
private

Definition at line 56 of file MuonAnalyzer.h.

TH1F* ExampleMuonAnalyzer::hEHcal
private

Definition at line 48 of file MuonAnalyzer.h.

TH1F* ExampleMuonAnalyzer::hMuCaloCompatibility
private

Definition at line 54 of file MuonAnalyzer.h.

TH1I* ExampleMuonAnalyzer::hMuIdAlgo
private

Definition at line 57 of file MuonAnalyzer.h.

TH1F* ExampleMuonAnalyzer::hMuIso03CaloComb
private

Definition at line 61 of file MuonAnalyzer.h.

TH1F* ExampleMuonAnalyzer::hMuIso03SumPt
private

Definition at line 60 of file MuonAnalyzer.h.

TH1I* ExampleMuonAnalyzer::hMuonType
private

Definition at line 50 of file MuonAnalyzer.h.

TH1F* ExampleMuonAnalyzer::hMuSegCompatibility
private

Definition at line 55 of file MuonAnalyzer.h.

TH1I* ExampleMuonAnalyzer::hNMuons
private

Definition at line 45 of file MuonAnalyzer.h.

TH1F* ExampleMuonAnalyzer::hPtRec
private

Definition at line 46 of file MuonAnalyzer.h.

TH2F* ExampleMuonAnalyzer::hPtReso
private

Definition at line 47 of file MuonAnalyzer.h.

TH1F* ExampleMuonAnalyzer::hPtSTATKDiff
private

Definition at line 51 of file MuonAnalyzer.h.

std::string ExampleMuonAnalyzer::theMuonLabel
private

Definition at line 42 of file MuonAnalyzer.h.