CMS 3D CMS Logo

MuonIdDQM Class Reference

#include <DQMOffline/Muon/interface/MuonIdDQM.h>

Inheritance diagram for MuonIdDQM:

edm::EDAnalyzer

List of all members.

Public Member Functions

 MuonIdDQM (const edm::ParameterSet &)
 ~MuonIdDQM ()

Private Member Functions

virtual void analyze (const edm::Event &, const edm::EventSetup &)
virtual void beginJob (const edm::EventSetup &)
virtual void endJob ()

Private Attributes

std::string baseFolder_
edm::Handle< CSCSegmentCollectioncscSegmentCollectionH_
DQMStoredbe_
edm::Handle
< DTRecSegment4DCollection
dtSegmentCollectionH_
edm::ESHandle
< GlobalTrackingGeometry
geometry_
MonitorElementhCSCDx [4]
MonitorElementhCSCDy [4]
MonitorElementhCSCNumSegments [4]
MonitorElementhCSCPullx [4]
MonitorElementhCSCPully [4]
MonitorElementhDTDx [4]
MonitorElementhDTDy [3]
MonitorElementhDTNumSegments [4]
MonitorElementhDTPullx [4]
MonitorElementhDTPully [3]
MonitorElementhNumChambers [2]
MonitorElementhNumMatches [2]
MonitorElementhSegmentIsAssociatedBool
edm::InputTag inputCSCSegmentCollection_
edm::InputTag inputDTRecSegment4DCollection_
edm::InputTag inputMuonCollection_
edm::Handle< reco::MuonCollectionmuonCollectionH_
bool useGlobalMuons_
bool useTrackerMuons_


Detailed Description

Definition at line 51 of file MuonIdDQM.h.


Constructor & Destructor Documentation

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

Definition at line 3 of file MuonIdDQM.cc.

References baseFolder_, dbe_, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), inputCSCSegmentCollection_, inputDTRecSegment4DCollection_, inputMuonCollection_, useGlobalMuons_, and useTrackerMuons_.

00004 {
00005    inputMuonCollection_ = iConfig.getParameter<edm::InputTag>("inputMuonCollection");
00006    inputDTRecSegment4DCollection_ = iConfig.getParameter<edm::InputTag>("inputDTRecSegment4DCollection");
00007    inputCSCSegmentCollection_ = iConfig.getParameter<edm::InputTag>("inputCSCSegmentCollection");
00008    useTrackerMuons_ = iConfig.getUntrackedParameter<bool>("useTrackerMuons");
00009    useGlobalMuons_ = iConfig.getUntrackedParameter<bool>("useGlobalMuons");
00010    baseFolder_ = iConfig.getUntrackedParameter<std::string>("baseFolder");
00011 
00012    dbe_ = 0;
00013    dbe_ = edm::Service<DQMStore>().operator->();
00014 }

MuonIdDQM::~MuonIdDQM (  ) 

Definition at line 16 of file MuonIdDQM.cc.

00016 {}


Member Function Documentation

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

Implements edm::EDAnalyzer.

Definition at line 87 of file MuonIdDQM.cc.

References MuonSubdetId::CSC, cscSegmentCollectionH_, MuonSubdetId::DT, dtSegmentCollectionH_, MonitorElement::Fill(), geometry_, edm::EventSetup::get(), edm::Event::getByLabel(), hCSCDx, hCSCDy, hCSCNumSegments, hCSCPullx, hCSCPully, hDTDx, hDTDy, hDTNumSegments, hDTPullx, hDTPully, hNumChambers, hNumMatches, hSegmentIsAssociatedBool, i, inputCSCSegmentCollection_, inputDTRecSegment4DCollection_, inputMuonCollection_, metsig::muon, muonCollectionH_, HcalSimpleRecAlgoImpl::reco(), funct::sqrt(), GeomDet::toGlobal(), useGlobalMuons_, useTrackerMuons_, PV3DBase< T, PVType, FrameType >::x(), LocalError::xx(), PV3DBase< T, PVType, FrameType >::y(), LocalError::yy(), and PV3DBase< T, PVType, FrameType >::z().

00088 {
00089    using namespace edm;
00090    using namespace reco;
00091 
00092    iEvent.getByLabel(inputMuonCollection_, muonCollectionH_);
00093    iEvent.getByLabel(inputDTRecSegment4DCollection_, dtSegmentCollectionH_);
00094    iEvent.getByLabel(inputCSCSegmentCollection_, cscSegmentCollectionH_);
00095    iSetup.get<GlobalTrackingGeometryRecord>().get(geometry_);
00096 
00097    for(MuonCollection::const_iterator muon = muonCollectionH_->begin();
00098          muon != muonCollectionH_->end(); ++muon)
00099    {
00100       // trackerMuon == 0; globalMuon == 1
00101       for (unsigned int i = 0; i < 2; i++) {
00102          if (i == 0 && (! useTrackerMuons_ || ! muon->isTrackerMuon())) continue;
00103          if (i == 1 && (! useGlobalMuons_ || ! muon->isGlobalMuon())) continue;
00104 
00105          hNumChambers[i]->Fill(muon->numberOfChambers());
00106          hNumMatches[i]->Fill(muon->numberOfMatches());
00107       }
00108 
00109       if (! useTrackerMuons_ || ! muon->isTrackerMuon()) continue;
00110 
00111       // by station
00112       for(int station = 0; station < 4; ++station)
00113       {
00114          hDTNumSegments[station]->Fill(muon->numberOfSegments(station+1, MuonSubdetId::DT, Muon::NoArbitration));
00115          hDTDx[station]->Fill(muon->dX(station+1, MuonSubdetId::DT));
00116          hDTPullx[station]->Fill(muon->pullX(station+1, MuonSubdetId::DT, Muon::SegmentArbitration, true));
00117 
00118          if (station < 3) {
00119             hDTDy[station]->Fill(muon->dY(station+1, MuonSubdetId::DT));
00120             hDTPully[station]->Fill(muon->pullY(station+1, MuonSubdetId::DT, Muon::SegmentArbitration, true));
00121          }
00122 
00123          hCSCNumSegments[station]->Fill(muon->numberOfSegments(station+1, MuonSubdetId::CSC, Muon::NoArbitration));
00124          hCSCDx[station]->Fill(muon->dX(station+1, MuonSubdetId::CSC));
00125          hCSCPullx[station]->Fill(muon->pullX(station+1, MuonSubdetId::CSC, Muon::SegmentArbitration, true));
00126          hCSCDy[station]->Fill(muon->dY(station+1, MuonSubdetId::CSC));
00127          hCSCPully[station]->Fill(muon->pullY(station+1, MuonSubdetId::CSC, Muon::SegmentArbitration, true));
00128       }
00129    }// muon
00130 
00131    if (! useTrackerMuons_) return;
00132 
00133    for(DTRecSegment4DCollection::const_iterator segment = dtSegmentCollectionH_->begin();
00134          segment != dtSegmentCollectionH_->end(); ++segment)
00135    {
00136       LocalPoint  segmentLocalPosition       = segment->localPosition();
00137       LocalVector segmentLocalDirection      = segment->localDirection();
00138       LocalError  segmentLocalPositionError  = segment->localPositionError();
00139       LocalError  segmentLocalDirectionError = segment->localDirectionError();
00140       const GeomDet* segmentGeomDet = geometry_->idToDet(segment->geographicalId());
00141       GlobalPoint segmentGlobalPosition = segmentGeomDet->toGlobal(segment->localPosition());
00142       bool segmentFound = false;
00143 
00144       for(MuonCollection::const_iterator muon = muonCollectionH_->begin();
00145             muon != muonCollectionH_->end(); ++muon)
00146       {
00147          if (! muon->isMatchesValid())
00148             continue;
00149 
00150          for(std::vector<MuonChamberMatch>::const_iterator chamberMatch = muon->matches().begin();
00151                chamberMatch != muon->matches().end(); ++chamberMatch) {
00152             for(std::vector<MuonSegmentMatch>::const_iterator segmentMatch = chamberMatch->segmentMatches.begin();
00153                   segmentMatch != chamberMatch->segmentMatches.end(); ++segmentMatch)
00154             {
00155                if (fabs(segmentMatch->x       - segmentLocalPosition.x()                           ) < 1E-6 &&
00156                    fabs(segmentMatch->y       - segmentLocalPosition.y()                           ) < 1E-6 &&
00157                    fabs(segmentMatch->dXdZ    - segmentLocalDirection.x()/segmentLocalDirection.z()) < 1E-6 &&
00158                    fabs(segmentMatch->dYdZ    - segmentLocalDirection.y()/segmentLocalDirection.z()) < 1E-6 &&
00159                    fabs(segmentMatch->xErr    - sqrt(segmentLocalPositionError.xx())               ) < 1E-6 &&
00160                    fabs(segmentMatch->yErr    - sqrt(segmentLocalPositionError.yy())               ) < 1E-6 &&
00161                    fabs(segmentMatch->dXdZErr - sqrt(segmentLocalDirectionError.xx())              ) < 1E-6 &&
00162                    fabs(segmentMatch->dYdZErr - sqrt(segmentLocalDirectionError.yy())              ) < 1E-6)
00163                {
00164                   segmentFound = true;
00165                   break;
00166                }
00167             }// segmentMatch
00168             if (segmentFound) break;
00169          }// chamberMatch
00170          if (segmentFound) break;
00171       }// muon
00172 
00173       if (segmentFound)
00174          hSegmentIsAssociatedBool->Fill(1.);
00175       else
00176          hSegmentIsAssociatedBool->Fill(0.);
00177    }// dt segment
00178 
00179    for(CSCSegmentCollection::const_iterator segment = cscSegmentCollectionH_->begin();
00180          segment != cscSegmentCollectionH_->end(); ++segment)
00181    {
00182       LocalPoint  segmentLocalPosition       = segment->localPosition();
00183       LocalVector segmentLocalDirection      = segment->localDirection();
00184       LocalError  segmentLocalPositionError  = segment->localPositionError();
00185       LocalError  segmentLocalDirectionError = segment->localDirectionError();
00186       const GeomDet* segmentGeomDet = geometry_->idToDet(segment->geographicalId());
00187       GlobalPoint segmentGlobalPosition = segmentGeomDet->toGlobal(segment->localPosition());
00188       bool segmentFound = false;
00189 
00190       for(MuonCollection::const_iterator muon = muonCollectionH_->begin();
00191             muon != muonCollectionH_->end(); ++muon)
00192       {
00193          if (! muon->isMatchesValid())
00194             continue;
00195 
00196          for(std::vector<MuonChamberMatch>::const_iterator chamberMatch = muon->matches().begin();
00197                chamberMatch != muon->matches().end(); ++chamberMatch) {
00198             for(std::vector<MuonSegmentMatch>::const_iterator segmentMatch = chamberMatch->segmentMatches.begin();
00199                   segmentMatch != chamberMatch->segmentMatches.end(); ++segmentMatch)
00200             {
00201                if (fabs(segmentMatch->x       - segmentLocalPosition.x()                           ) < 1E-6 &&
00202                    fabs(segmentMatch->y       - segmentLocalPosition.y()                           ) < 1E-6 &&
00203                    fabs(segmentMatch->dXdZ    - segmentLocalDirection.x()/segmentLocalDirection.z()) < 1E-6 &&
00204                    fabs(segmentMatch->dYdZ    - segmentLocalDirection.y()/segmentLocalDirection.z()) < 1E-6 &&
00205                    fabs(segmentMatch->xErr    - sqrt(segmentLocalPositionError.xx())               ) < 1E-6 &&
00206                    fabs(segmentMatch->yErr    - sqrt(segmentLocalPositionError.yy())               ) < 1E-6 &&
00207                    fabs(segmentMatch->dXdZErr - sqrt(segmentLocalDirectionError.xx())              ) < 1E-6 &&
00208                    fabs(segmentMatch->dYdZErr - sqrt(segmentLocalDirectionError.yy())              ) < 1E-6)
00209                {
00210                   segmentFound = true;
00211                   break;
00212                }
00213             }// segmentMatch
00214             if (segmentFound) break;
00215          }// chamberMatch
00216          if (segmentFound) break;
00217       }// muon
00218 
00219       if (segmentFound)
00220          hSegmentIsAssociatedBool->Fill(1.);
00221       else
00222          hSegmentIsAssociatedBool->Fill(0.);
00223    }// csc segment
00224 }

void MuonIdDQM::beginJob ( const edm::EventSetup  )  [private, virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 19 of file MuonIdDQM.cc.

References baseFolder_, DQMStore::book1D(), dbe_, hCSCDx, hCSCDy, hCSCNumSegments, hCSCPullx, hCSCPully, hDTDx, hDTDy, hDTNumSegments, hDTPullx, hDTPully, hNumChambers, hNumMatches, hSegmentIsAssociatedBool, i, name, DQMStore::setCurrentFolder(), indexGen::title, useGlobalMuons_, and useTrackerMuons_.

00020 {
00021    // trackerMuon == 0; globalMuon == 1
00022    for (unsigned int i = 0; i < 2; i++) {
00023       if ((i == 0 && ! useTrackerMuons_) || (i == 1 && ! useGlobalMuons_)) continue;
00024       if (i == 0) dbe_->setCurrentFolder(baseFolder_+"/TrackerMuons");
00025       if (i == 1) dbe_->setCurrentFolder(baseFolder_+"/GlobalMuons");
00026 
00027       hNumChambers[i] = dbe_->book1D("hNumChambers", "Number of Chambers", 11, -0.5, 10.5);
00028       hNumMatches[i] = dbe_->book1D("hNumMatches", "Number of Matches", 11, -0.5, 10.5);
00029    }
00030 
00031    if (useTrackerMuons_) {
00032       dbe_->setCurrentFolder(baseFolder_+"/TrackerMuons");
00033 
00034       char name[100], title[200];
00035 
00036       // by station
00037       for(int station = 0; station < 4; ++station)
00038       {
00039          sprintf(name, "hDT%iNumSegments", station+1);
00040          sprintf(title, "DT Station %i Number of Segments (No Arbitration)", station+1);
00041          hDTNumSegments[station] = dbe_->book1D(name, title, 11, -0.5, 10.5);
00042 
00043          sprintf(name, "hDT%iDx", station+1);
00044          sprintf(title, "DT Station %i Delta X", station+1);
00045          hDTDx[station] = dbe_->book1D(name, title, 100, -100., 100.);
00046 
00047          sprintf(name, "hDT%iPullx", station+1);
00048          sprintf(title, "DT Station %i Pull X", station+1);
00049          hDTPullx[station] = dbe_->book1D(name, title, 100, -20., 20.);
00050 
00051          if (station < 3) {
00052             sprintf(name, "hDT%iDy", station+1);
00053             sprintf(title, "DT Station %i Delta Y", station+1);
00054             hDTDy[station] = dbe_->book1D(name, title, 100, -150., 150.);
00055 
00056             sprintf(name, "hDT%iPully", station+1);
00057             sprintf(title, "DT Station %i Pull Y", station+1);
00058             hDTPully[station] = dbe_->book1D(name, title, 100, -20., 20.);
00059          }
00060 
00061          sprintf(name, "hCSC%iNumSegments", station+1);
00062          sprintf(title, "CSC Station %i Number of Segments (No Arbitration)", station+1);
00063          hCSCNumSegments[station] = dbe_->book1D(name, title, 11, -0.5, 10.5);
00064 
00065          sprintf(name, "hCSC%iDx", station+1);
00066          sprintf(title, "CSC Station %i Delta X", station+1);
00067          hCSCDx[station] = dbe_->book1D(name, title, 100, -50., 50.);
00068 
00069          sprintf(name, "hCSC%iPullx", station+1);
00070          sprintf(title, "CSC Station %i Pull X", station+1);
00071          hCSCPullx[station] = dbe_->book1D(name, title, 100, -20., 20.);
00072 
00073          sprintf(name, "hCSC%iDy", station+1);
00074          sprintf(title, "CSC Station %i Delta Y", station+1);
00075          hCSCDy[station] = dbe_->book1D(name, title, 100, -50., 50.);
00076 
00077          sprintf(name, "hCSC%iPully", station+1);
00078          sprintf(title, "CSC Station %i Pull Y", station+1);
00079          hCSCPully[station] = dbe_->book1D(name, title, 100, -20., 20.);
00080       }// station
00081 
00082       hSegmentIsAssociatedBool = dbe_->book1D("hSegmentIsAssociatedBool", "Segment Is Associated Boolean", 2, -0.5, 1.5);
00083    }
00084 }

void MuonIdDQM::endJob ( void   )  [private, virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 227 of file MuonIdDQM.cc.

00227 {}


Member Data Documentation

std::string MuonIdDQM::baseFolder_ [private]

Definition at line 69 of file MuonIdDQM.h.

Referenced by beginJob(), and MuonIdDQM().

edm::Handle<CSCSegmentCollection> MuonIdDQM::cscSegmentCollectionH_ [private]

Definition at line 73 of file MuonIdDQM.h.

Referenced by analyze().

DQMStore* MuonIdDQM::dbe_ [private]

Definition at line 61 of file MuonIdDQM.h.

Referenced by beginJob(), and MuonIdDQM().

edm::Handle<DTRecSegment4DCollection> MuonIdDQM::dtSegmentCollectionH_ [private]

Definition at line 72 of file MuonIdDQM.h.

Referenced by analyze().

edm::ESHandle<GlobalTrackingGeometry> MuonIdDQM::geometry_ [private]

Definition at line 74 of file MuonIdDQM.h.

Referenced by analyze().

MonitorElement* MuonIdDQM::hCSCDx[4] [private]

Definition at line 87 of file MuonIdDQM.h.

Referenced by analyze(), and beginJob().

MonitorElement* MuonIdDQM::hCSCDy[4] [private]

Definition at line 89 of file MuonIdDQM.h.

Referenced by analyze(), and beginJob().

MonitorElement* MuonIdDQM::hCSCNumSegments[4] [private]

Definition at line 86 of file MuonIdDQM.h.

Referenced by analyze(), and beginJob().

MonitorElement* MuonIdDQM::hCSCPullx[4] [private]

Definition at line 88 of file MuonIdDQM.h.

Referenced by analyze(), and beginJob().

MonitorElement* MuonIdDQM::hCSCPully[4] [private]

Definition at line 90 of file MuonIdDQM.h.

Referenced by analyze(), and beginJob().

MonitorElement* MuonIdDQM::hDTDx[4] [private]

Definition at line 82 of file MuonIdDQM.h.

Referenced by analyze(), and beginJob().

MonitorElement* MuonIdDQM::hDTDy[3] [private]

Definition at line 84 of file MuonIdDQM.h.

Referenced by analyze(), and beginJob().

MonitorElement* MuonIdDQM::hDTNumSegments[4] [private]

Definition at line 81 of file MuonIdDQM.h.

Referenced by analyze(), and beginJob().

MonitorElement* MuonIdDQM::hDTPullx[4] [private]

Definition at line 83 of file MuonIdDQM.h.

Referenced by analyze(), and beginJob().

MonitorElement* MuonIdDQM::hDTPully[3] [private]

Definition at line 85 of file MuonIdDQM.h.

Referenced by analyze(), and beginJob().

MonitorElement* MuonIdDQM::hNumChambers[2] [private]

Definition at line 77 of file MuonIdDQM.h.

Referenced by analyze(), and beginJob().

MonitorElement* MuonIdDQM::hNumMatches[2] [private]

Definition at line 78 of file MuonIdDQM.h.

Referenced by analyze(), and beginJob().

MonitorElement* MuonIdDQM::hSegmentIsAssociatedBool [private]

Definition at line 92 of file MuonIdDQM.h.

Referenced by analyze(), and beginJob().

edm::InputTag MuonIdDQM::inputCSCSegmentCollection_ [private]

Definition at line 66 of file MuonIdDQM.h.

Referenced by analyze(), and MuonIdDQM().

edm::InputTag MuonIdDQM::inputDTRecSegment4DCollection_ [private]

Definition at line 65 of file MuonIdDQM.h.

Referenced by analyze(), and MuonIdDQM().

edm::InputTag MuonIdDQM::inputMuonCollection_ [private]

Definition at line 64 of file MuonIdDQM.h.

Referenced by analyze(), and MuonIdDQM().

edm::Handle<reco::MuonCollection> MuonIdDQM::muonCollectionH_ [private]

Definition at line 71 of file MuonIdDQM.h.

Referenced by analyze().

bool MuonIdDQM::useGlobalMuons_ [private]

Definition at line 68 of file MuonIdDQM.h.

Referenced by analyze(), beginJob(), and MuonIdDQM().

bool MuonIdDQM::useTrackerMuons_ [private]

Definition at line 67 of file MuonIdDQM.h.

Referenced by analyze(), beginJob(), and MuonIdDQM().


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