CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

MuonIdDQM Class Reference

#include <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 ()
virtual void endJob ()
virtual void Fill (MonitorElement *, float)

Private Attributes

std::string baseFolder_
edm::Handle< CSCSegmentCollectioncscSegmentCollectionH_
DQMStoredbe_
edm::Handle
< DTRecSegment4DCollection
dtSegmentCollectionH_
edm::ESHandle
< GlobalTrackingGeometry
geometry_
MonitorElementhCSCDdXdZ [4][4]
MonitorElementhCSCDdYdZ [4][4]
MonitorElementhCSCDx [4][4]
MonitorElementhCSCDy [4][4]
MonitorElementhCSCNumSegments [4][4]
MonitorElementhCSCPulldXdZ [4][4]
MonitorElementhCSCPulldYdZ [4][4]
MonitorElementhCSCPullx [4][4]
MonitorElementhCSCPully [4][4]
MonitorElementhDTDdXdZ [4][4]
MonitorElementhDTDdYdZ [4][3]
MonitorElementhDTDx [4][4]
MonitorElementhDTDy [4][3]
MonitorElementhDTNumSegments [4][4]
MonitorElementhDTPulldXdZ [4][4]
MonitorElementhDTPulldYdZ [4][3]
MonitorElementhDTPullx [4][4]
MonitorElementhDTPully [4][3]
MonitorElementhNumChambers [4]
MonitorElementhNumMatches [4]
MonitorElementhSegmentIsAssociatedBool
edm::InputTag inputCSCSegmentCollection_
edm::InputTag inputDTRecSegment4DCollection_
edm::InputTag inputMuonCollection_
edm::Handle< reco::MuonCollectionmuonCollectionH_
bool useGlobalMuons_
bool useGlobalMuonsNotTrackerMuons_
bool useTrackerMuons_
bool useTrackerMuonsNotGlobalMuons_

Detailed Description

Definition at line 51 of file MuonIdDQM.h.


Constructor & Destructor Documentation

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

Definition at line 18 of file MuonIdDQM.cc.

{}

Member Function Documentation

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

Implements edm::EDAnalyzer.

Definition at line 121 of file MuonIdDQM.cc.

References MuonSubdetId::CSC, cscSegmentCollectionH_, MuonSubdetId::DT, dtSegmentCollectionH_, Fill(), MonitorElement::Fill(), geometry_, edm::EventSetup::get(), edm::Event::getByLabel(), hCSCDdXdZ, hCSCDdYdZ, hCSCDx, hCSCDy, hCSCNumSegments, hCSCPulldXdZ, hCSCPulldYdZ, hCSCPullx, hCSCPully, hDTDdXdZ, hDTDdYdZ, hDTDx, hDTDy, hDTNumSegments, hDTPulldXdZ, hDTPulldYdZ, hDTPullx, hDTPully, hNumChambers, hNumMatches, hSegmentIsAssociatedBool, i, inputCSCSegmentCollection_, inputDTRecSegment4DCollection_, inputMuonCollection_, metsig::muon, muonCollectionH_, dt_dqm_sourceclient_common_cff::reco, mathSSE::sqrt(), relativeConstraints::station, useGlobalMuons_, useGlobalMuonsNotTrackerMuons_, useTrackerMuons_, useTrackerMuonsNotGlobalMuons_, PV3DBase< T, PVType, FrameType >::x(), LocalError::xx(), PV3DBase< T, PVType, FrameType >::y(), LocalError::yy(), and PV3DBase< T, PVType, FrameType >::z().

{
   using namespace edm;
   using namespace reco;

   iEvent.getByLabel(inputMuonCollection_, muonCollectionH_);
   iEvent.getByLabel(inputDTRecSegment4DCollection_, dtSegmentCollectionH_);
   iEvent.getByLabel(inputCSCSegmentCollection_, cscSegmentCollectionH_);
   iSetup.get<GlobalTrackingGeometryRecord>().get(geometry_);

   for(MuonCollection::const_iterator muon = muonCollectionH_->begin();
         muon != muonCollectionH_->end(); ++muon)
   {
      // trackerMuon == 0; globalMuon == 1; trackerMuon && !globalMuon == 2; globalMuon && !trackerMuon == 3
      for (unsigned int i = 0; i < 4; i++) {
         if (i == 0 && (! useTrackerMuons_ || ! muon->isTrackerMuon())) continue;
         if (i == 1 && (! useGlobalMuons_ || ! muon->isGlobalMuon())) continue;
         if (i == 2 && (! useTrackerMuonsNotGlobalMuons_ || (! (muon->isTrackerMuon() && ! muon->isGlobalMuon())))) continue;
         if (i == 3 && (! useGlobalMuonsNotTrackerMuons_ || (! (muon->isGlobalMuon() && ! muon->isTrackerMuon())))) continue;

         hNumChambers[i]->Fill(muon->numberOfChambers());
         hNumMatches[i]->Fill(muon->numberOfMatches(Muon::SegmentAndTrackArbitration));

         // by station
         for(int station = 0; station < 4; ++station)
         {
            // only fill num segments if we crossed (or nearly crossed) a chamber
            if (muon->trackX(station+1, MuonSubdetId::DT, Muon::NoArbitration) < 900000)
               hDTNumSegments[i][station]->Fill(muon->numberOfSegments(station+1, MuonSubdetId::DT, Muon::NoArbitration));
            Fill(hDTDx[i][station], muon->dX(station+1, MuonSubdetId::DT, Muon::SegmentAndTrackArbitration));
            Fill(hDTPullx[i][station], muon->pullX(station+1, MuonSubdetId::DT, Muon::SegmentAndTrackArbitration, true));
            Fill(hDTDdXdZ[i][station], muon->dDxDz(station+1, MuonSubdetId::DT, Muon::SegmentAndTrackArbitration));
            Fill(hDTPulldXdZ[i][station], muon->pullDxDz(station+1, MuonSubdetId::DT, Muon::SegmentAndTrackArbitration, true));

            if (station < 3) {
               Fill(hDTDy[i][station], muon->dY(station+1, MuonSubdetId::DT, Muon::SegmentAndTrackArbitration));
               Fill(hDTPully[i][station], muon->pullY(station+1, MuonSubdetId::DT, Muon::SegmentAndTrackArbitration, true));
               Fill(hDTDdYdZ[i][station], muon->dDyDz(station+1, MuonSubdetId::DT, Muon::SegmentAndTrackArbitration));
               Fill(hDTPulldYdZ[i][station], muon->pullDyDz(station+1, MuonSubdetId::DT, Muon::SegmentAndTrackArbitration, true));
            }

            // only fill num segments if we crossed (or nearly crossed) a chamber
            if (muon->trackX(station+1, MuonSubdetId::CSC, Muon::NoArbitration) < 900000)
               hCSCNumSegments[i][station]->Fill(muon->numberOfSegments(station+1, MuonSubdetId::CSC, Muon::NoArbitration));
            Fill(hCSCDx[i][station], muon->dX(station+1, MuonSubdetId::CSC, Muon::SegmentAndTrackArbitration));
            Fill(hCSCPullx[i][station], muon->pullX(station+1, MuonSubdetId::CSC, Muon::SegmentAndTrackArbitration, true));
            Fill(hCSCDdXdZ[i][station], muon->dDxDz(station+1, MuonSubdetId::CSC, Muon::SegmentAndTrackArbitration));
            Fill(hCSCPulldXdZ[i][station], muon->pullDxDz(station+1, MuonSubdetId::CSC, Muon::SegmentAndTrackArbitration, true));
            Fill(hCSCDy[i][station], muon->dY(station+1, MuonSubdetId::CSC, Muon::SegmentAndTrackArbitration));
            Fill(hCSCPully[i][station], muon->pullY(station+1, MuonSubdetId::CSC, Muon::SegmentAndTrackArbitration, true));
            Fill(hCSCDdYdZ[i][station], muon->dDyDz(station+1, MuonSubdetId::CSC, Muon::SegmentAndTrackArbitration));
            Fill(hCSCPulldYdZ[i][station], muon->pullDyDz(station+1, MuonSubdetId::CSC, Muon::SegmentAndTrackArbitration, true));
         }
      }
   }// muon

   for(DTRecSegment4DCollection::const_iterator segment = dtSegmentCollectionH_->begin();
         segment != dtSegmentCollectionH_->end(); ++segment)
   {
      LocalPoint  segmentLocalPosition       = segment->localPosition();
      LocalVector segmentLocalDirection      = segment->localDirection();
      LocalError  segmentLocalPositionError  = segment->localPositionError();
      LocalError  segmentLocalDirectionError = segment->localDirectionError();
      bool segmentFound = false;

      for(MuonCollection::const_iterator muon = muonCollectionH_->begin();
            muon != muonCollectionH_->end(); ++muon)
      {
         if (! muon->isMatchesValid())
            continue;

         for(std::vector<MuonChamberMatch>::const_iterator chamberMatch = muon->matches().begin();
               chamberMatch != muon->matches().end(); ++chamberMatch) {
            for(std::vector<MuonSegmentMatch>::const_iterator segmentMatch = chamberMatch->segmentMatches.begin();
                  segmentMatch != chamberMatch->segmentMatches.end(); ++segmentMatch)
            {
               if (fabs(segmentMatch->x       - segmentLocalPosition.x()                           ) < 1E-6 &&
                   fabs(segmentMatch->y       - segmentLocalPosition.y()                           ) < 1E-6 &&
                   fabs(segmentMatch->dXdZ    - segmentLocalDirection.x()/segmentLocalDirection.z()) < 1E-6 &&
                   fabs(segmentMatch->dYdZ    - segmentLocalDirection.y()/segmentLocalDirection.z()) < 1E-6 &&
                   fabs(segmentMatch->xErr    - sqrt(segmentLocalPositionError.xx())               ) < 1E-6 &&
                   fabs(segmentMatch->yErr    - sqrt(segmentLocalPositionError.yy())               ) < 1E-6 &&
                   fabs(segmentMatch->dXdZErr - sqrt(segmentLocalDirectionError.xx())              ) < 1E-6 &&
                   fabs(segmentMatch->dYdZErr - sqrt(segmentLocalDirectionError.yy())              ) < 1E-6)
               {
                  segmentFound = true;
                  break;
               }
            }// segmentMatch
            if (segmentFound) break;
         }// chamberMatch
         if (segmentFound) break;
      }// muon

      if (segmentFound)
         hSegmentIsAssociatedBool->Fill(1.);
      else
         hSegmentIsAssociatedBool->Fill(0.);
   }// dt segment

   for(CSCSegmentCollection::const_iterator segment = cscSegmentCollectionH_->begin();
         segment != cscSegmentCollectionH_->end(); ++segment)
   {
      LocalPoint  segmentLocalPosition       = segment->localPosition();
      LocalVector segmentLocalDirection      = segment->localDirection();
      LocalError  segmentLocalPositionError  = segment->localPositionError();
      LocalError  segmentLocalDirectionError = segment->localDirectionError();
      bool segmentFound = false;

      for(MuonCollection::const_iterator muon = muonCollectionH_->begin();
            muon != muonCollectionH_->end(); ++muon)
      {
         if (! muon->isMatchesValid())
            continue;

         for(std::vector<MuonChamberMatch>::const_iterator chamberMatch = muon->matches().begin();
               chamberMatch != muon->matches().end(); ++chamberMatch) {
            for(std::vector<MuonSegmentMatch>::const_iterator segmentMatch = chamberMatch->segmentMatches.begin();
                  segmentMatch != chamberMatch->segmentMatches.end(); ++segmentMatch)
            {
               if (fabs(segmentMatch->x       - segmentLocalPosition.x()                           ) < 1E-6 &&
                   fabs(segmentMatch->y       - segmentLocalPosition.y()                           ) < 1E-6 &&
                   fabs(segmentMatch->dXdZ    - segmentLocalDirection.x()/segmentLocalDirection.z()) < 1E-6 &&
                   fabs(segmentMatch->dYdZ    - segmentLocalDirection.y()/segmentLocalDirection.z()) < 1E-6 &&
                   fabs(segmentMatch->xErr    - sqrt(segmentLocalPositionError.xx())               ) < 1E-6 &&
                   fabs(segmentMatch->yErr    - sqrt(segmentLocalPositionError.yy())               ) < 1E-6 &&
                   fabs(segmentMatch->dXdZErr - sqrt(segmentLocalDirectionError.xx())              ) < 1E-6 &&
                   fabs(segmentMatch->dYdZErr - sqrt(segmentLocalDirectionError.yy())              ) < 1E-6)
               {
                  segmentFound = true;
                  break;
               }
            }// segmentMatch
            if (segmentFound) break;
         }// chamberMatch
         if (segmentFound) break;
      }// muon

      if (segmentFound)
         hSegmentIsAssociatedBool->Fill(1.);
      else
         hSegmentIsAssociatedBool->Fill(0.);
   }// csc segment
}
void MuonIdDQM::beginJob ( void  ) [private, virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 21 of file MuonIdDQM.cc.

References baseFolder_, DQMStore::book1D(), dbe_, hCSCDdXdZ, hCSCDdYdZ, hCSCDx, hCSCDy, hCSCNumSegments, hCSCPulldXdZ, hCSCPulldYdZ, hCSCPullx, hCSCPully, hDTDdXdZ, hDTDdYdZ, hDTDx, hDTDy, hDTNumSegments, hDTPulldXdZ, hDTPulldYdZ, hDTPullx, hDTPully, hNumChambers, hNumMatches, hSegmentIsAssociatedBool, i, mergeVDriftHistosByStation::name, DQMStore::setCurrentFolder(), relativeConstraints::station, indexGen::title, useGlobalMuons_, useGlobalMuonsNotTrackerMuons_, useTrackerMuons_, and useTrackerMuonsNotGlobalMuons_.

{
   char name[100], title[200];

   // trackerMuon == 0; globalMuon == 1; trackerMuon && !globalMuon == 2; globalMuon && !trackerMuon == 3
   for (unsigned int i = 0; i < 4; i++) {
      if ((i == 0 && ! useTrackerMuons_) || (i == 1 && ! useGlobalMuons_)) continue;
      if ((i == 2 && ! useTrackerMuonsNotGlobalMuons_) || (i == 3 && ! useGlobalMuonsNotTrackerMuons_)) continue;
      if (i == 0) dbe_->setCurrentFolder(baseFolder_+"/TrackerMuons");
      if (i == 1) dbe_->setCurrentFolder(baseFolder_+"/GlobalMuons");
      if (i == 2) dbe_->setCurrentFolder(baseFolder_+"/TrackerMuonsNotGlobalMuons");
      if (i == 3) dbe_->setCurrentFolder(baseFolder_+"/GlobalMuonsNotTrackerMuons");

      hNumChambers[i] = dbe_->book1D("hNumChambers", "Number of Chambers", 11, -0.5, 10.5);
      hNumMatches[i] = dbe_->book1D("hNumMatches", "Number of Matches", 11, -0.5, 10.5);

      // by station
      for(int station = 0; station < 4; ++station)
      {
         sprintf(name, "hDT%iNumSegments", station+1);
         sprintf(title, "DT Station %i Number of Segments (No Arbitration)", station+1);
         hDTNumSegments[i][station] = dbe_->book1D(name, title, 11, -0.5, 10.5);

         sprintf(name, "hDT%iDx", station+1);
         sprintf(title, "DT Station %i Delta X", station+1);
         hDTDx[i][station] = dbe_->book1D(name, title, 100, -100., 100.);

         sprintf(name, "hDT%iPullx", station+1);
         sprintf(title, "DT Station %i Pull X", station+1);
         hDTPullx[i][station] = dbe_->book1D(name, title, 100, -20., 20.);

         sprintf(name, "hDT%iDdXdZ", station+1);
         sprintf(title, "DT Station %i Delta DxDz", station+1);
         hDTDdXdZ[i][station] = dbe_->book1D(name, title, 100, -1., 1.);

         sprintf(name, "hDT%iPulldXdZ", station+1);
         sprintf(title, "DT Station %i Pull DxDz", station+1);
         hDTPulldXdZ[i][station] = dbe_->book1D(name, title, 100, -20., 20.);

         if (station < 3) {
            sprintf(name, "hDT%iDy", station+1);
            sprintf(title, "DT Station %i Delta Y", station+1);
            hDTDy[i][station] = dbe_->book1D(name, title, 100, -150., 150.);

            sprintf(name, "hDT%iPully", station+1);
            sprintf(title, "DT Station %i Pull Y", station+1);
            hDTPully[i][station] = dbe_->book1D(name, title, 100, -20., 20.);

            sprintf(name, "hDT%iDdYdZ", station+1);
            sprintf(title, "DT Station %i Delta DyDz", station+1);
            hDTDdYdZ[i][station] = dbe_->book1D(name, title, 100, -2., 2.);

            sprintf(name, "hDT%iPulldYdZ", station+1);
            sprintf(title, "DT Station %i Pull DyDz", station+1);
            hDTPulldYdZ[i][station] = dbe_->book1D(name, title, 100, -20., 20.);
         }

         sprintf(name, "hCSC%iNumSegments", station+1);
         sprintf(title, "CSC Station %i Number of Segments (No Arbitration)", station+1);
         hCSCNumSegments[i][station] = dbe_->book1D(name, title, 11, -0.5, 10.5);

         sprintf(name, "hCSC%iDx", station+1);
         sprintf(title, "CSC Station %i Delta X", station+1);
         hCSCDx[i][station] = dbe_->book1D(name, title, 100, -50., 50.);

         sprintf(name, "hCSC%iPullx", station+1);
         sprintf(title, "CSC Station %i Pull X", station+1);
         hCSCPullx[i][station] = dbe_->book1D(name, title, 100, -20., 20.);

         sprintf(name, "hCSC%iDdXdZ", station+1);
         sprintf(title, "CSC Station %i Delta DxDz", station+1);
         hCSCDdXdZ[i][station] = dbe_->book1D(name, title, 100, -1., 1.);

         sprintf(name, "hCSC%iPulldXdZ", station+1);
         sprintf(title, "CSC Station %i Pull DxDz", station+1);
         hCSCPulldXdZ[i][station] = dbe_->book1D(name, title, 100, -20., 20.);

         sprintf(name, "hCSC%iDy", station+1);
         sprintf(title, "CSC Station %i Delta Y", station+1);
         hCSCDy[i][station] = dbe_->book1D(name, title, 100, -50., 50.);

         sprintf(name, "hCSC%iPully", station+1);
         sprintf(title, "CSC Station %i Pull Y", station+1);
         hCSCPully[i][station] = dbe_->book1D(name, title, 100, -20., 20.);

         sprintf(name, "hCSC%iDdYdZ", station+1);
         sprintf(title, "CSC Station %i Delta DyDz", station+1);
         hCSCDdYdZ[i][station] = dbe_->book1D(name, title, 100, -1., 1.);

         sprintf(name, "hCSC%iPulldYdZ", station+1);
         sprintf(title, "CSC Station %i Pull DyDz", station+1);
         hCSCPulldYdZ[i][station] = dbe_->book1D(name, title, 100, -20., 20.);
      }// station
   }

   dbe_->setCurrentFolder(baseFolder_);
   hSegmentIsAssociatedBool = dbe_->book1D("hSegmentIsAssociatedBool", "Segment Is Associated Boolean", 2, -0.5, 1.5);
}
void MuonIdDQM::endJob ( void  ) [private, virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 267 of file MuonIdDQM.cc.

{}
void MuonIdDQM::Fill ( MonitorElement me,
float  f 
) [private, virtual]

Definition at line 269 of file MuonIdDQM.cc.

References MonitorElement::Fill().

Referenced by analyze().

                                                {
   if (fabs(f) > 900000) return;
   //if (fabs(f) < 1E-8) return;
   me->Fill(f);
}

Member Data Documentation

std::string MuonIdDQM::baseFolder_ [private]

Definition at line 72 of file MuonIdDQM.h.

Referenced by beginJob(), and MuonIdDQM().

Definition at line 76 of file MuonIdDQM.h.

Referenced by analyze().

Definition at line 62 of file MuonIdDQM.h.

Referenced by beginJob(), and MuonIdDQM().

Definition at line 75 of file MuonIdDQM.h.

Referenced by analyze().

Definition at line 77 of file MuonIdDQM.h.

Referenced by analyze().

Definition at line 96 of file MuonIdDQM.h.

Referenced by analyze(), and beginJob().

Definition at line 100 of file MuonIdDQM.h.

Referenced by analyze(), and beginJob().

Definition at line 94 of file MuonIdDQM.h.

Referenced by analyze(), and beginJob().

Definition at line 98 of file MuonIdDQM.h.

Referenced by analyze(), and beginJob().

Definition at line 93 of file MuonIdDQM.h.

Referenced by analyze(), and beginJob().

Definition at line 97 of file MuonIdDQM.h.

Referenced by analyze(), and beginJob().

Definition at line 101 of file MuonIdDQM.h.

Referenced by analyze(), and beginJob().

Definition at line 95 of file MuonIdDQM.h.

Referenced by analyze(), and beginJob().

Definition at line 99 of file MuonIdDQM.h.

Referenced by analyze(), and beginJob().

Definition at line 87 of file MuonIdDQM.h.

Referenced by analyze(), and beginJob().

Definition at line 91 of file MuonIdDQM.h.

Referenced by analyze(), and beginJob().

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

Definition at line 85 of file MuonIdDQM.h.

Referenced by analyze(), and beginJob().

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

Definition at line 89 of file MuonIdDQM.h.

Referenced by analyze(), and beginJob().

Definition at line 84 of file MuonIdDQM.h.

Referenced by analyze(), and beginJob().

Definition at line 88 of file MuonIdDQM.h.

Referenced by analyze(), and beginJob().

Definition at line 92 of file MuonIdDQM.h.

Referenced by analyze(), and beginJob().

Definition at line 86 of file MuonIdDQM.h.

Referenced by analyze(), and beginJob().

Definition at line 90 of file MuonIdDQM.h.

Referenced by analyze(), and beginJob().

Definition at line 80 of file MuonIdDQM.h.

Referenced by analyze(), and beginJob().

Definition at line 81 of file MuonIdDQM.h.

Referenced by analyze(), and beginJob().

Definition at line 104 of file MuonIdDQM.h.

Referenced by analyze(), and beginJob().

Definition at line 67 of file MuonIdDQM.h.

Referenced by analyze(), and MuonIdDQM().

Definition at line 66 of file MuonIdDQM.h.

Referenced by analyze(), and MuonIdDQM().

Definition at line 65 of file MuonIdDQM.h.

Referenced by analyze(), and MuonIdDQM().

Definition at line 74 of file MuonIdDQM.h.

Referenced by analyze().

Definition at line 69 of file MuonIdDQM.h.

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

Definition at line 71 of file MuonIdDQM.h.

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

Definition at line 68 of file MuonIdDQM.h.

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

Definition at line 70 of file MuonIdDQM.h.

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