CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_1_8_patch9/src/Validation/MuonIdentification/src/MuonIdVal.cc

Go to the documentation of this file.
00001 #include "Validation/MuonIdentification/interface/MuonIdVal.h"
00002 
00003 MuonIdVal::MuonIdVal(const edm::ParameterSet& iConfig)
00004 {
00005    inputMuonCollection_ = iConfig.getParameter<edm::InputTag>("inputMuonCollection");
00006    inputDTRecSegment4DCollection_ = iConfig.getParameter<edm::InputTag>("inputDTRecSegment4DCollection");
00007    inputCSCSegmentCollection_ = iConfig.getParameter<edm::InputTag>("inputCSCSegmentCollection");
00008    inputMuonTimeExtraValueMap_ = iConfig.getParameter<edm::InputTag>("inputMuonTimeExtraValueMap");
00009    inputMuonCosmicCompatibilityValueMap_ = iConfig.getParameter<edm::InputTag>("inputMuonCosmicCompatibilityValueMap");
00010    useTrackerMuons_ = iConfig.getUntrackedParameter<bool>("useTrackerMuons");
00011    useGlobalMuons_ = iConfig.getUntrackedParameter<bool>("useGlobalMuons");
00012    useTrackerMuonsNotGlobalMuons_ = iConfig.getUntrackedParameter<bool>("useTrackerMuonsNotGlobalMuons");
00013    useGlobalMuonsNotTrackerMuons_ = iConfig.getUntrackedParameter<bool>("useGlobalMuonsNotTrackerMuons");
00014    makeEnergyPlots_ = iConfig.getUntrackedParameter<bool>("makeEnergyPlots");
00015    makeTimePlots_ = iConfig.getUntrackedParameter<bool>("makeTimePlots");
00016    make2DPlots_ = iConfig.getUntrackedParameter<bool>("make2DPlots");
00017    makeAllChamberPlots_ = iConfig.getUntrackedParameter<bool>("makeAllChamberPlots");
00018    makeCosmicCompatibilityPlots_ = iConfig.getUntrackedParameter<bool>("makeCosmicCompatibilityPlots");
00019    baseFolder_ = iConfig.getUntrackedParameter<std::string>("baseFolder");
00020 
00021    dbe_ = 0;
00022    dbe_ = edm::Service<DQMStore>().operator->();
00023 }
00024 
00025 MuonIdVal::~MuonIdVal() {}
00026 
00027 void 
00028 MuonIdVal::beginJob()
00029 {
00030    char name[100], title[200];
00031 
00032    // trackerMuon == 0; globalMuon == 1; trackerMuon && !globalMuon == 2; globalMuon && !trackerMuon == 3
00033    for (unsigned int i = 0; i < 4; i++) {
00034       if ((i == 0 && ! useTrackerMuons_) || (i == 1 && ! useGlobalMuons_)) continue;
00035       if ((i == 2 && ! useTrackerMuonsNotGlobalMuons_) || (i == 3 && ! useGlobalMuonsNotTrackerMuons_)) continue;
00036       if (i == 0) dbe_->setCurrentFolder(baseFolder_+"/TrackerMuons");
00037       if (i == 1) dbe_->setCurrentFolder(baseFolder_+"/GlobalMuons");
00038       if (i == 2) dbe_->setCurrentFolder(baseFolder_+"/TrackerMuonsNotGlobalMuons");
00039       if (i == 3) dbe_->setCurrentFolder(baseFolder_+"/GlobalMuonsNotTrackerMuons");
00040 
00041       if (makeEnergyPlots_) {
00042          hEnergyEMBarrel[i] = dbe_->book1D("hEnergyEMBarrel", "Energy in ECAL Barrel", 100, -0.5, 2.);
00043          hEnergyHABarrel[i] = dbe_->book1D("hEnergyHABarrel", "Energy in HCAL Barrel", 100, -4., 12.);
00044          hEnergyHO[i] = dbe_->book1D("hEnergyHO", "Energy HO", 100, -2., 5.);
00045          hEnergyEMEndcap[i] = dbe_->book1D("hEnergyEMEndcap", "Energy in ECAL Endcap", 100, -0.5, 2.);
00046          hEnergyHAEndcap[i] = dbe_->book1D("hEnergyHAEndcap", "Energy in HCAL Endcap", 100, -4., 12.);
00047       }
00048 
00049       if (makeTimePlots_) {
00050          hMuonTimeNDOF[i] = dbe_->book1D("hMuonTimeNDOF", "MuonTime NDOF", 52, -1.5, 50.5);
00051          hMuonTimeTimeAtIpInOut[i] = dbe_->book1D("hMuonTimeTimeAtIpInOut", "MuonTime TimeAtIpInOut", 100, -20., 20.);
00052          hMuonTimeTimeAtIpInOutErr[i] = dbe_->book1D("hMuonTimeTimeAtIpInOutErr", "MuonTime TimeAtIpInOutErr", 100, 0., 8.);
00053          hMuonTimeTimeAtIpOutIn[i] = dbe_->book1D("hMuonTimeTimeAtIpOutIn", "MuonTime TimeAtIpOutIn", 100, -1., 75.);
00054          hMuonTimeTimeAtIpOutInErr[i] = dbe_->book1D("hMuonTimeTimeAtIpOutInErr", "MuonTime TimeAtIpOutInErr", 100, 0., 8.);
00055          hMuonTimeExtraCombinedNDOF[i] = dbe_->book1D("hMuonTimeExtraCombinedNDOF", "MuonTimeExtra Combined NDOF", 52, -1.5, 50.5);
00056          hMuonTimeExtraCombinedTimeAtIpInOut[i] = dbe_->book1D("hMuonTimeExtraCombinedTimeAtIpInOut", "MuonTimeExtra Combined TimeAtIpInOut", 100, -20., 20.);
00057          hMuonTimeExtraCombinedTimeAtIpInOutErr[i] = dbe_->book1D("hMuonTimeExtraCombinedTimeAtIpInOutErr", "MuonTimeExtra Combined TimeAtIpInOutErr", 100, 0., 8.);
00058          hMuonTimeExtraCombinedTimeAtIpOutIn[i] = dbe_->book1D("hMuonTimeExtraCombinedTimeAtIpOutIn", "MuonTimeExtra Combined TimeAtIpOutIn", 100, -1., 75.);
00059          hMuonTimeExtraCombinedTimeAtIpOutInErr[i] = dbe_->book1D("hMuonTimeExtraCombinedTimeAtIpOutInErr", "MuonTimeExtra Combined TimeAtIpOutInErr", 100, 0., 8.);
00060          hMuonTimeExtraCSCNDOF[i] = dbe_->book1D("hMuonTimeExtraCSCNDOF", "MuonTimeExtra CSC NDOF", 52, -1.5, 50.5);
00061          hMuonTimeExtraCSCTimeAtIpInOut[i] = dbe_->book1D("hMuonTimeExtraCSCTimeAtIpInOut", "MuonTimeExtra CSC TimeAtIpInOut", 100, -20., 20.);
00062          hMuonTimeExtraCSCTimeAtIpInOutErr[i] = dbe_->book1D("hMuonTimeExtraCSCTimeAtIpInOutErr", "MuonTimeExtra CSC TimeAtIpInOutErr", 100, 0., 8.);
00063          hMuonTimeExtraCSCTimeAtIpOutIn[i] = dbe_->book1D("hMuonTimeExtraCSCTimeAtIpOutIn", "MuonTimeExtra CSC TimeAtIpOutIn", 100, -1., 75.);
00064          hMuonTimeExtraCSCTimeAtIpOutInErr[i] = dbe_->book1D("hMuonTimeExtraCSCTimeAtIpOutInErr", "MuonTimeExtra CSC TimeAtIpOutInErr", 100, 0., 8.);
00065          hMuonTimeExtraDTNDOF[i] = dbe_->book1D("hMuonTimeExtraDTNDOF", "MuonTimeExtra DT NDOF", 52, -1.5, 50.5);
00066          hMuonTimeExtraDTTimeAtIpInOut[i] = dbe_->book1D("hMuonTimeExtraDTTimeAtIpInOut", "MuonTimeExtra DT TimeAtIpInOut", 100, -20., 20.);
00067          hMuonTimeExtraDTTimeAtIpInOutErr[i] = dbe_->book1D("hMuonTimeExtraDTTimeAtIpInOutErr", "MuonTimeExtra DT TimeAtIpInOutErr", 100, 0., 8.);
00068          hMuonTimeExtraDTTimeAtIpOutIn[i] = dbe_->book1D("hMuonTimeExtraDTTimeAtIpOutIn", "MuonTimeExtra DT TimeAtIpOutIn", 100, -1., 75.);
00069          hMuonTimeExtraDTTimeAtIpOutInErr[i] = dbe_->book1D("hMuonTimeExtraDTTimeAtIpOutInErr", "MuonTimeExtra DT TimeAtIpOutInErr", 100, 0., 8.);
00070       }
00071 
00072       hCaloCompat[i] = dbe_->book1D("hCaloCompat", "Calo Compatibility", 101, -0.05, 1.05);
00073       hSegmentCompat[i] = dbe_->book1D("hSegmentCompat", "Segment Compatibility", 101, -0.05, 1.05);
00074       if (make2DPlots_)
00075          hCaloSegmentCompat[i] = dbe_->book2D("hCaloSegmentCompat", "Calo Compatibility vs. Segment Compatibility", 101, -0.05, 1.05, 101, -0.05, 1.05);
00076       hMuonQualityTrkRelChi2[i] = dbe_->book1D("hMuonQualityTrkRelChi2", "MuonQuality TrkRelChi2", 100, 0., 1.5);
00077       hMuonQualityStaRelChi2[i] = dbe_->book1D("hMuonQualityStaRelChi2", "MuonQuality StaRelChi2", 100, 0., 3.);
00078       hMuonQualityTrkKink[i] = dbe_->book1D("hMuonQualityTrkKink", "MuonQuality TrkKink", 100, 0., 150.);
00079       hGlobalMuonPromptTightBool[i] = dbe_->book1D("hGlobalMuonPromptTightBool", "GlobalMuonPromptTight Boolean", 2, -0.5, 1.5);
00080       hTMLastStationLooseBool[i] = dbe_->book1D("hTMLastStationLooseBool", "TMLastStationLoose Boolean", 2, -0.5, 1.5);
00081       hTMLastStationTightBool[i] = dbe_->book1D("hTMLastStationTightBool", "TMLastStationTight Boolean", 2, -0.5, 1.5);
00082       hTM2DCompatibilityLooseBool[i] = dbe_->book1D("hTM2DCompatibilityLooseBool", "TM2DCompatibilityLoose Boolean", 2, -0.5, 1.5);
00083       hTM2DCompatibilityTightBool[i] = dbe_->book1D("hTM2DCompatibilityTightBool", "TM2DCompatibilityTight Boolean", 2, -0.5, 1.5);
00084       hTMOneStationLooseBool[i] = dbe_->book1D("hTMOneStationLooseBool", "TMOneStationLoose Boolean", 2, -0.5, 1.5);
00085       hTMOneStationTightBool[i] = dbe_->book1D("hTMOneStationTightBool", "TMOneStationTight Boolean", 2, -0.5, 1.5);
00086       hTMLastStationOptimizedLowPtLooseBool[i] = dbe_->book1D("hTMLastStationOptimizedLowPtLooseBool", "TMLastStationOptimizedLowPtLoose Boolean", 2, -0.5, 1.5);
00087       hTMLastStationOptimizedLowPtTightBool[i] = dbe_->book1D("hTMLastStationOptimizedLowPtTightBool", "TMLastStationOptimizedLowPtTight Boolean", 2, -0.5, 1.5);
00088       hGMTkChiCompatibilityBool[i] = dbe_->book1D("hGMTkChiCompatibilityBool", "GMTkChiCompatibility Boolean", 2, -0.5, 1.5);
00089       hGMStaChiCompatibilityBool[i] = dbe_->book1D("hGMStaChiCompatibilityBool", "GMStaChiCompatibility Boolean", 2, -0.5, 1.5);
00090       hGMTkKinkTightBool[i] = dbe_->book1D("hGMTkKinkTightBool", "GMTkKinkTight Boolean", 2, -0.5, 1.5);
00091       hTMLastStationAngLooseBool[i] = dbe_->book1D("hTMLastStationAngLooseBool", "TMLastStationAngLoose Boolean", 2, -0.5, 1.5);
00092       hTMLastStationAngTightBool[i] = dbe_->book1D("hTMLastStationAngTightBool", "TMLastStationAngTight Boolean", 2, -0.5, 1.5);
00093       hTMOneStationAngLooseBool[i] = dbe_->book1D("hTMOneStationAngLooseBool", "TMOneStationAngLoose Boolean", 2, -0.5, 1.5);
00094       hTMOneStationAngTightBool[i] = dbe_->book1D("hTMOneStationAngTightBool", "TMOneStationAngTight Boolean", 2, -0.5, 1.5);
00095       hTMLastStationOptimizedBarrelLowPtLooseBool[i] = dbe_->book1D("hTMLastStationOptimizedBarrelLowPtLooseBool", "TMLastStationOptimizedBarrelLowPtLoose Boolean", 2, -0.5, 1.5);
00096       hTMLastStationOptimizedBarrelLowPtTightBool[i] = dbe_->book1D("hTMLastStationOptimizedBarrelLowPtTightBool", "TMLastStationOptimizedBarrelLowPtTight Boolean", 2, -0.5, 1.5);
00097 
00098       if (makeCosmicCompatibilityPlots_) {
00099         hCombinedCosmicCompat[i] = dbe_->book1D("hCombinedCosmicCompat", "hCombinedCosmicCompatibility float", 40, 0., 10.);
00100         hTimeCosmicCompat[i] = dbe_->book1D("hTimeCosmicCompat", "hTimeCosmicCompatibility float", 6, 0., 3.);
00101         hB2BCosmicCompat[i] = dbe_->book1D("hB2BCosmicCompat", "Number of back-to-back partners", 10, 0, 10);
00102         hOverlapCosmicCompat[i] = dbe_->book1D("hOverlapCosmicCompat", "Overlap between muons and 1Leg", 2, 0, 2);
00103       }
00104 
00105       // by station
00106       for(int station = 0; station < 4; ++station)
00107       {
00108          sprintf(name, "hDT%iPullxPropErr", station+1);
00109          sprintf(title, "DT Station %i Pull X w/ Propagation Error Only", station+1);
00110          hDTPullxPropErr[i][station] = dbe_->book1D(name, title, 100, -20., 20.);
00111 
00112          sprintf(name, "hDT%iPulldXdZPropErr", station+1);
00113          sprintf(title, "DT Station %i Pull DxDz w/ Propagation Error Only", station+1);
00114          hDTPulldXdZPropErr[i][station] = dbe_->book1D(name, title, 100, -20., 20.);
00115 
00116          if (station < 3) {
00117             sprintf(name, "hDT%iPullyPropErr", station+1);
00118             sprintf(title, "DT Station %i Pull Y w/ Propagation Error Only", station+1);
00119             hDTPullyPropErr[i][station] = dbe_->book1D(name, title, 100, -20., 20.);
00120 
00121             sprintf(name, "hDT%iPulldYdZPropErr", station+1);
00122             sprintf(title, "DT Station %i Pull DyDz w/ Propagation Error Only", station+1);
00123             hDTPulldYdZPropErr[i][station] = dbe_->book1D(name, title, 100, -20., 20.);
00124          }
00125 
00126          sprintf(name, "hDT%iDistWithSegment", station+1);
00127          sprintf(title, "DT Station %i Dist When There Is A Segment", station+1);
00128          hDTDistWithSegment[i][station] = dbe_->book1D(name, title, 100, -140., 30.);
00129 
00130          sprintf(name, "hDT%iDistWithNoSegment", station+1);
00131          sprintf(title, "DT Station %i Dist When There Is No Segment", station+1);
00132          hDTDistWithNoSegment[i][station] = dbe_->book1D(name, title, 100, -140., 30.);
00133 
00134          sprintf(name, "hDT%iPullDistWithSegment", station+1);
00135          sprintf(title, "DT Station %i Pull Dist When There Is A Segment", station+1);
00136          hDTPullDistWithSegment[i][station] = dbe_->book1D(name, title, 100, -140., 30.);
00137 
00138          sprintf(name, "hDT%iPullDistWithNoSegment", station+1);
00139          sprintf(title, "DT Station %i Pull Dist When There Is No Segment", station+1);
00140          hDTPullDistWithNoSegment[i][station] = dbe_->book1D(name, title, 100, -140., 30.);
00141 
00142          sprintf(name, "hCSC%iPullxPropErr", station+1);
00143          sprintf(title, "CSC Station %i Pull X w/ Propagation Error Only", station+1);
00144          hCSCPullxPropErr[i][station] = dbe_->book1D(name, title, 100, -20., 20.);
00145 
00146          sprintf(name, "hCSC%iPulldXdZPropErr", station+1);
00147          sprintf(title, "CSC Station %i Pull DxDz w/ Propagation Error Only", station+1);
00148          hCSCPulldXdZPropErr[i][station] = dbe_->book1D(name, title, 100, -20., 20.);
00149 
00150          sprintf(name, "hCSC%iPullyPropErr", station+1);
00151          sprintf(title, "CSC Station %i Pull Y w/ Propagation Error Only", station+1);
00152          hCSCPullyPropErr[i][station] = dbe_->book1D(name, title, 100, -20., 20.);
00153 
00154          sprintf(name, "hCSC%iPulldYdZPropErr", station+1);
00155          sprintf(title, "CSC Station %i Pull DyDz w/ Propagation Error Only", station+1);
00156          hCSCPulldYdZPropErr[i][station] = dbe_->book1D(name, title, 100, -50., 50.);
00157 
00158          sprintf(name, "hCSC%iDistWithSegment", station+1);
00159          sprintf(title, "CSC Station %i Dist When There Is A Segment", station+1);
00160          hCSCDistWithSegment[i][station] = dbe_->book1D(name, title, 100, -70., 20.);
00161 
00162          sprintf(name, "hCSC%iDistWithNoSegment", station+1);
00163          sprintf(title, "CSC Station %i Dist When There Is No Segment", station+1);
00164          hCSCDistWithNoSegment[i][station] = dbe_->book1D(name, title, 100, -70., 20.);
00165 
00166          sprintf(name, "hCSC%iPullDistWithSegment", station+1);
00167          sprintf(title, "CSC Station %i Pull Dist When There Is A Segment", station+1);
00168          hCSCPullDistWithSegment[i][station] = dbe_->book1D(name, title, 100, -70., 20.);
00169 
00170          sprintf(name, "hCSC%iPullDistWithNoSegment", station+1);
00171          sprintf(title, "CSC Station %i Pull Dist When There Is No Segment", station+1);
00172          hCSCPullDistWithNoSegment[i][station] = dbe_->book1D(name, title, 100, -70., 20.);
00173       }// station
00174    }
00175 
00176    if (make2DPlots_) {
00177       dbe_->setCurrentFolder(baseFolder_);
00178       hSegmentIsAssociatedRZ = dbe_->book2D("hSegmentIsAssociatedRZ", "R-Z of Associated Segments", 2140, -1070., 1070., 850, 0., 850.);
00179       hSegmentIsAssociatedXY = dbe_->book2D("hSegmentIsAssociatedXY", "X-Y of Associated Segments", 1700, -850., 850., 1700, -850., 850.);
00180       hSegmentIsNotAssociatedRZ = dbe_->book2D("hSegmentIsNotAssociatedRZ", "R-Z of Not Associated Segments", 2140, -1070., 1070., 850, 0., 850.);
00181       hSegmentIsNotAssociatedXY = dbe_->book2D("hSegmentIsNotAssociatedXY", "X-Y of Not Associated Segments", 1700, -850., 850., 1700, -850., 850.);
00182       hSegmentIsBestDrAssociatedRZ = dbe_->book2D("hSegmentIsBestDrAssociatedRZ", "R-Z of Best in Station by #DeltaR Associated Segments", 2140, -1070., 1070., 850, 0., 850.);
00183       hSegmentIsBestDrAssociatedXY = dbe_->book2D("hSegmentIsBestDrAssociatedXY", "X-Y of Best in Station by #DeltaR Associated Segments", 1700, -850., 850., 1700, -850., 850.);
00184       hSegmentIsBestDrNotAssociatedRZ = dbe_->book2D("hSegmentIsBestDrNotAssociatedRZ", "R-Z of Best in Station by #DeltaR Not Associated Segments", 2140, -1070., 1070., 850, 0., 850.);
00185       hSegmentIsBestDrNotAssociatedXY = dbe_->book2D("hSegmentIsBestDrNotAssociatedXY", "X-Y of Best in Station by #DeltaR Not Associated Segments", 1700, -850., 850., 1700, -850., 850.);
00186    }
00187 
00188    if (useTrackerMuons_ && makeAllChamberPlots_) {
00189       dbe_->setCurrentFolder(baseFolder_+"/TrackerMuons");
00190 
00191       // by chamber
00192       for(int station = 0; station < 4; ++station) {
00193          // DT wheels: -2 -> 2
00194          for(int wheel = 0; wheel < 5; ++wheel) {
00195             // DT sectors: 1 -> 14
00196             for(int sector = 0; sector < 14; ++sector)
00197             {
00198                sprintf(name, "hDTChamberDx_%i_%i_%i", station+1, wheel-2, sector+1);
00199                sprintf(title, "DT Chamber Delta X: Station %i Wheel %i Sector %i", station+1, wheel-2, sector+1);
00200                hDTChamberDx[station][wheel][sector] = dbe_->book1D(name, title, 100, -100., 100.);
00201 
00202                if (station < 3) {
00203                   sprintf(name, "hDTChamberDy_%i_%i_%i", station+1, wheel-2, sector+1);
00204                   sprintf(title, "DT Chamber Delta Y: Station %i Wheel %i Sector %i", station+1, wheel-2, sector+1);
00205                   hDTChamberDy[station][wheel][sector] = dbe_->book1D(name, title, 100, -150., 150.);
00206                }
00207 
00208                sprintf(name, "hDTChamberEdgeXWithSegment_%i_%i_%i", station+1, wheel-2, sector+1);
00209                sprintf(title, "DT Chamber Edge X When There Is A Segment: Station %i Wheel %i Sector %i", station+1, wheel-2, sector+1);
00210                hDTChamberEdgeXWithSegment[station][wheel][sector] = dbe_->book1D(name, title, 100, -140., 30.);
00211 
00212                sprintf(name, "hDTChamberEdgeXWithNoSegment_%i_%i_%i", station+1, wheel-2, sector+1);
00213                sprintf(title, "DT Chamber Edge X When There Is No Segment: Station %i Wheel %i Sector %i", station+1, wheel-2, sector+1);
00214                hDTChamberEdgeXWithNoSegment[station][wheel][sector] = dbe_->book1D(name, title, 100, -140., 30.);
00215 
00216                sprintf(name, "hDTChamberEdgeYWithSegment_%i_%i_%i", station+1, wheel-2, sector+1);
00217                sprintf(title, "DT Chamber Edge Y When There Is A Segment: Station %i Wheel %i Sector %i", station+1, wheel-2, sector+1);
00218                hDTChamberEdgeYWithSegment[station][wheel][sector] = dbe_->book1D(name, title, 100, -140., 30.);
00219 
00220                sprintf(name, "hDTChamberEdgeYWithNoSegment_%i_%i_%i", station+1, wheel-2, sector+1);
00221                sprintf(title, "DT Chamber Edge Y When There Is No Segment: Station %i Wheel %i Sector %i", station+1, wheel-2, sector+1);
00222                hDTChamberEdgeYWithNoSegment[station][wheel][sector] = dbe_->book1D(name, title, 100, -140., 30.);
00223             }// sector
00224          }// wheel
00225 
00226          // CSC endcaps: 1 -> 2
00227          for(int endcap = 0; endcap < 2; ++endcap) {
00228             // CSC rings: 1 -> 4
00229             for(int ring = 0; ring < 4; ++ring) {
00230                // CSC chambers: 1 -> 36
00231                for(int chamber = 0; chamber < 36; ++chamber)
00232                {
00233                   sprintf(name, "hCSCChamberDx_%i_%i_%i_%i", endcap+1, station+1, ring+1, chamber+1);
00234                   sprintf(title, "CSC Chamber Delta X: Endcap %i Station %i Ring %i Chamber %i", endcap+1, station+1, ring+1, chamber+1);
00235                   hCSCChamberDx[endcap][station][ring][chamber] = dbe_->book1D(name, title, 100, -50., 50.);
00236 
00237                   sprintf(name, "hCSCChamberDy_%i_%i_%i_%i", endcap+1, station+1, ring+1, chamber+1);
00238                   sprintf(title, "CSC Chamber Delta Y: Endcap %i Station %i Ring %i Chamber %i", endcap+1, station+1, ring+1, chamber+1);
00239                   hCSCChamberDy[endcap][station][ring][chamber] = dbe_->book1D(name, title, 100, -50., 50.);
00240 
00241                   sprintf(name, "hCSCChamberEdgeXWithSegment_%i_%i_%i_%i", endcap+1, station+1, ring+1, chamber+1);
00242                   sprintf(title, "CSC Chamber Edge X When There Is A Segment: Endcap %i Station %i Ring %i Chamber %i", endcap+1, station+1, ring+1, chamber+1);
00243                   hCSCChamberEdgeXWithSegment[endcap][station][ring][chamber] = dbe_->book1D(name, title, 100, -70., 20.);
00244 
00245                   sprintf(name, "hCSCChamberEdgeXWithNoSegment_%i_%i_%i_%i", endcap+1, station+1, ring+1, chamber+1);
00246                   sprintf(title, "CSC Chamber Edge X When There Is No Segment: Endcap %i Station %i Ring %i Chamber %i", endcap+1, station+1, ring+1, chamber+1);
00247                   hCSCChamberEdgeXWithNoSegment[endcap][station][ring][chamber] = dbe_->book1D(name, title, 100, -70., 20.);
00248 
00249                   sprintf(name, "hCSCChamberEdgeYWithSegment_%i_%i_%i_%i", endcap+1, station+1, ring+1, chamber+1);
00250                   sprintf(title, "CSC Chamber Edge Y When There Is A Segment: Endcap %i Station %i Ring %i Chamber %i", endcap+1, station+1, ring+1, chamber+1);
00251                   hCSCChamberEdgeYWithSegment[endcap][station][ring][chamber] = dbe_->book1D(name, title, 100, -70., 20.);
00252 
00253                   sprintf(name, "hCSCChamberEdgeYWithNoSegment_%i_%i_%i_%i", endcap+1, station+1, ring+1, chamber+1);
00254                   sprintf(title, "CSC Chamber Edge Y When There Is No Segment: Endcap %i Station %i Ring %i Chamber %i", endcap+1, station+1, ring+1, chamber+1);
00255                   hCSCChamberEdgeYWithNoSegment[endcap][station][ring][chamber] = dbe_->book1D(name, title, 100, -70., 20.);
00256                }// chamber
00257             }// ring
00258          }// endcap
00259       }// station
00260    }
00261 }
00262 
00263 void
00264 MuonIdVal::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup)
00265 {
00266    using namespace edm;
00267    using namespace reco;
00268 
00269    iEvent.getByLabel(inputMuonCollection_, muonCollectionH_);
00270    iEvent.getByLabel(inputDTRecSegment4DCollection_, dtSegmentCollectionH_);
00271    iEvent.getByLabel(inputCSCSegmentCollection_, cscSegmentCollectionH_);
00272    iEvent.getByLabel(inputMuonTimeExtraValueMap_.label(), "combined", combinedMuonTimeExtraValueMapH_);
00273    iEvent.getByLabel(inputMuonTimeExtraValueMap_.label(), "csc", cscMuonTimeExtraValueMapH_);
00274    iEvent.getByLabel(inputMuonTimeExtraValueMap_.label(), "dt", dtMuonTimeExtraValueMapH_);
00275    iEvent.getByLabel(inputMuonCosmicCompatibilityValueMap_.label(), muonCosmicCompatibilityValueMapH_);
00276   
00277    iSetup.get<GlobalTrackingGeometryRecord>().get(geometry_);
00278 
00279    unsigned int muonIdx = 0;
00280    for(MuonCollection::const_iterator muon = muonCollectionH_->begin();
00281          muon != muonCollectionH_->end(); ++muon)
00282    {
00283       // trackerMuon == 0; globalMuon == 1; trackerMuon && !globalMuon == 2; globalMuon && !trackerMuon == 3
00284       for (unsigned int i = 0; i < 4; i++) {
00285          if (i == 0 && (! useTrackerMuons_ || ! muon->isTrackerMuon())) continue;
00286          if (i == 1 && (! useGlobalMuons_ || ! muon->isGlobalMuon())) continue;
00287          if (i == 2 && (! useTrackerMuonsNotGlobalMuons_ || (! (muon->isTrackerMuon() && ! muon->isGlobalMuon())))) continue;
00288          if (i == 3 && (! useGlobalMuonsNotTrackerMuons_ || (! (muon->isGlobalMuon() && ! muon->isTrackerMuon())))) continue;
00289 
00290          if (makeEnergyPlots_ && muon->isEnergyValid()) {
00291             // EM
00292             if (fabs(muon->eta()) > 1.479)
00293                hEnergyEMEndcap[i]->Fill(muon->calEnergy().em); 
00294             else
00295                hEnergyEMBarrel[i]->Fill(muon->calEnergy().em);
00296             // HAD
00297             if (fabs(muon->eta()) > 1.4)
00298                hEnergyHAEndcap[i]->Fill(muon->calEnergy().had);
00299             else
00300                hEnergyHABarrel[i]->Fill(muon->calEnergy().had);
00301             // HO
00302             if (fabs(muon->eta()) < 1.26)
00303                hEnergyHO[i]->Fill(muon->calEnergy().ho);
00304          }
00305 
00306          if (makeTimePlots_) {
00307             if (muon->isTimeValid()) {
00308                hMuonTimeNDOF[i]->Fill(muon->time().nDof);
00309                hMuonTimeTimeAtIpInOut[i]->Fill(muon->time().timeAtIpInOut);
00310                hMuonTimeTimeAtIpInOutErr[i]->Fill(muon->time().timeAtIpInOutErr);
00311                hMuonTimeTimeAtIpOutIn[i]->Fill(muon->time().timeAtIpOutIn);
00312                hMuonTimeTimeAtIpOutInErr[i]->Fill(muon->time().timeAtIpOutInErr);
00313             }
00314 
00315             MuonRef muonRef(muonCollectionH_, muonIdx);
00316             MuonTimeExtra combinedMuonTimeExtra = (*combinedMuonTimeExtraValueMapH_)[muonRef];
00317             MuonTimeExtra cscMuonTimeExtra = (*cscMuonTimeExtraValueMapH_)[muonRef];
00318             MuonTimeExtra dtMuonTimeExtra = (*dtMuonTimeExtraValueMapH_)[muonRef];
00319 
00320             hMuonTimeExtraCombinedNDOF[i]->Fill(combinedMuonTimeExtra.nDof());
00321             hMuonTimeExtraCombinedTimeAtIpInOut[i]->Fill(combinedMuonTimeExtra.timeAtIpInOut());
00322             hMuonTimeExtraCombinedTimeAtIpInOutErr[i]->Fill(combinedMuonTimeExtra.timeAtIpInOutErr());
00323             hMuonTimeExtraCombinedTimeAtIpOutIn[i]->Fill(combinedMuonTimeExtra.timeAtIpOutIn());
00324             hMuonTimeExtraCombinedTimeAtIpOutInErr[i]->Fill(combinedMuonTimeExtra.timeAtIpOutInErr());
00325             hMuonTimeExtraCSCNDOF[i]->Fill(cscMuonTimeExtra.nDof());
00326             hMuonTimeExtraCSCTimeAtIpInOut[i]->Fill(cscMuonTimeExtra.timeAtIpInOut());
00327             hMuonTimeExtraCSCTimeAtIpInOutErr[i]->Fill(cscMuonTimeExtra.timeAtIpInOutErr());
00328             hMuonTimeExtraCSCTimeAtIpOutIn[i]->Fill(cscMuonTimeExtra.timeAtIpOutIn());
00329             hMuonTimeExtraCSCTimeAtIpOutInErr[i]->Fill(cscMuonTimeExtra.timeAtIpOutInErr());
00330             hMuonTimeExtraDTNDOF[i]->Fill(dtMuonTimeExtra.nDof());
00331             hMuonTimeExtraDTTimeAtIpInOut[i]->Fill(dtMuonTimeExtra.timeAtIpInOut());
00332             hMuonTimeExtraDTTimeAtIpInOutErr[i]->Fill(dtMuonTimeExtra.timeAtIpInOutErr());
00333             hMuonTimeExtraDTTimeAtIpOutIn[i]->Fill(dtMuonTimeExtra.timeAtIpOutIn());
00334             hMuonTimeExtraDTTimeAtIpOutInErr[i]->Fill(dtMuonTimeExtra.timeAtIpOutInErr());
00335          }
00336 
00337          if (muon->isCaloCompatibilityValid())
00338             hCaloCompat[i]->Fill(muon->caloCompatibility());
00339          hSegmentCompat[i]->Fill(muon::segmentCompatibility(*muon));
00340          if (make2DPlots_ && muon->isCaloCompatibilityValid())
00341             hCaloSegmentCompat[i]->Fill(muon->caloCompatibility(), muon::segmentCompatibility(*muon));
00342          if (muon->isQualityValid()) {
00343             hMuonQualityTrkRelChi2[i]->Fill(muon->combinedQuality().trkRelChi2);
00344             hMuonQualityStaRelChi2[i]->Fill(muon->combinedQuality().staRelChi2);
00345             hMuonQualityTrkKink[i]->Fill(muon->combinedQuality().trkKink);
00346          }
00347          hGlobalMuonPromptTightBool[i]->Fill(muon::isGoodMuon(*muon, muon::GlobalMuonPromptTight));
00348          hTMLastStationLooseBool[i]->Fill(muon::isGoodMuon(*muon, muon::TMLastStationLoose));
00349          hTMLastStationTightBool[i]->Fill(muon::isGoodMuon(*muon, muon::TMLastStationTight));
00350          hTM2DCompatibilityLooseBool[i]->Fill(muon::isGoodMuon(*muon, muon::TM2DCompatibilityLoose));
00351          hTM2DCompatibilityTightBool[i]->Fill(muon::isGoodMuon(*muon, muon::TM2DCompatibilityTight));
00352          hTMOneStationLooseBool[i]->Fill(muon::isGoodMuon(*muon, muon::TMOneStationLoose));
00353          hTMOneStationTightBool[i]->Fill(muon::isGoodMuon(*muon, muon::TMOneStationTight));
00354          hTMLastStationOptimizedLowPtLooseBool[i]->Fill(muon::isGoodMuon(*muon, muon::TMLastStationOptimizedLowPtLoose));
00355          hTMLastStationOptimizedLowPtTightBool[i]->Fill(muon::isGoodMuon(*muon, muon::TMLastStationOptimizedLowPtTight));
00356          hGMTkChiCompatibilityBool[i]->Fill(muon::isGoodMuon(*muon, muon::GMTkChiCompatibility));
00357          hGMStaChiCompatibilityBool[i]->Fill(muon::isGoodMuon(*muon, muon::GMStaChiCompatibility));
00358          hGMTkKinkTightBool[i]->Fill(muon::isGoodMuon(*muon, muon::GMTkKinkTight));
00359          hTMLastStationAngLooseBool[i]->Fill(muon::isGoodMuon(*muon, muon::TMLastStationAngLoose));
00360          hTMLastStationAngTightBool[i]->Fill(muon::isGoodMuon(*muon, muon::TMLastStationAngTight));
00361          hTMOneStationAngLooseBool[i]->Fill(muon::isGoodMuon(*muon, muon::TMOneStationAngLoose));
00362          hTMOneStationAngTightBool[i]->Fill(muon::isGoodMuon(*muon, muon::TMOneStationAngTight));
00363          hTMLastStationOptimizedBarrelLowPtLooseBool[i]->Fill(muon::isGoodMuon(*muon, muon::TMLastStationOptimizedBarrelLowPtLoose));
00364          hTMLastStationOptimizedBarrelLowPtTightBool[i]->Fill(muon::isGoodMuon(*muon, muon::TMLastStationOptimizedBarrelLowPtTight));
00365 
00366          if (makeCosmicCompatibilityPlots_) {
00367            MuonRef muonRef(muonCollectionH_, muonIdx);
00368            MuonCosmicCompatibility muonCosmicCompatibility = (*muonCosmicCompatibilityValueMapH_)[muonRef];
00369            hCombinedCosmicCompat[i]->Fill(muonCosmicCompatibility.cosmicCompatibility);
00370            hTimeCosmicCompat[i]->Fill(muonCosmicCompatibility.timeCompatibility);
00371            hB2BCosmicCompat[i]->Fill(muonCosmicCompatibility.backToBackCompatibility);
00372            hOverlapCosmicCompat[i]->Fill(muonCosmicCompatibility.overlapCompatibility);
00373          }
00374          
00375          // by station
00376          for(int station = 0; station < 4; ++station)
00377          {
00378             Fill(hDTPullxPropErr[i][station], muon->pullX(station+1, MuonSubdetId::DT, Muon::SegmentAndTrackArbitration, false));
00379             Fill(hDTPulldXdZPropErr[i][station], muon->pullDxDz(station+1, MuonSubdetId::DT, Muon::SegmentAndTrackArbitration, false));
00380 
00381             if (station < 3) {
00382                Fill(hDTPullyPropErr[i][station], muon->pullY(station+1, MuonSubdetId::DT, Muon::SegmentAndTrackArbitration, false));
00383                Fill(hDTPulldYdZPropErr[i][station], muon->pullDyDz(station+1, MuonSubdetId::DT, Muon::SegmentAndTrackArbitration, false));
00384             }
00385 
00386             float distance = muon->trackDist(station+1, MuonSubdetId::DT);
00387             float error    = muon->trackDistErr(station+1, MuonSubdetId::DT);
00388             if (error == 0) error = 0.000001;
00389 
00390             if (muon->numberOfSegments(station+1, MuonSubdetId::DT, Muon::NoArbitration) > 0) {
00391                Fill(hDTDistWithSegment[i][station], distance);
00392                Fill(hDTPullDistWithSegment[i][station], distance/error);
00393             } else {
00394                Fill(hDTDistWithNoSegment[i][station], distance);
00395                Fill(hDTPullDistWithNoSegment[i][station], distance/error);
00396             }
00397 
00398             Fill(hCSCPullxPropErr[i][station], muon->pullX(station+1, MuonSubdetId::CSC, Muon::SegmentAndTrackArbitration, false));
00399             Fill(hCSCPulldXdZPropErr[i][station], muon->pullDxDz(station+1, MuonSubdetId::CSC, Muon::SegmentAndTrackArbitration, false));
00400             Fill(hCSCPullyPropErr[i][station], muon->pullY(station+1, MuonSubdetId::CSC, Muon::SegmentAndTrackArbitration, false));
00401             Fill(hCSCPulldYdZPropErr[i][station], muon->pullDyDz(station+1, MuonSubdetId::CSC, Muon::SegmentAndTrackArbitration, false));
00402 
00403             distance = muon->trackDist(station+1, MuonSubdetId::CSC);
00404             error    = muon->trackDistErr(station+1, MuonSubdetId::CSC);
00405             if (error == 0) error = 0.000001;
00406 
00407             if (muon->numberOfSegments(station+1, MuonSubdetId::CSC, Muon::NoArbitration) > 0) {
00408                Fill(hCSCDistWithSegment[i][station], distance);
00409                Fill(hCSCPullDistWithSegment[i][station], distance/error);
00410             } else {
00411                Fill(hCSCDistWithNoSegment[i][station], distance);
00412                Fill(hCSCPullDistWithNoSegment[i][station], distance/error);
00413             }
00414          }// station
00415       }
00416 
00417       if (! useTrackerMuons_ || ! muon->isTrackerMuon()) continue;
00418       if (makeAllChamberPlots_) {
00419          // by chamber
00420          for(std::vector<MuonChamberMatch>::const_iterator chamberMatch = muon->matches().begin();
00421                chamberMatch != muon->matches().end(); ++chamberMatch)
00422          {
00423             int station = chamberMatch->station();
00424 
00425             if (chamberMatch->detector() == MuonSubdetId::DT) {
00426                DTChamberId dtId(chamberMatch->id.rawId());
00427                int wheel  = dtId.wheel();
00428                int sector = dtId.sector();
00429 
00430                if (chamberMatch->segmentMatches.empty()) {
00431                   Fill(hDTChamberEdgeXWithNoSegment[station-1][wheel+2][sector-1], chamberMatch->edgeX);
00432                   Fill(hDTChamberEdgeYWithNoSegment[station-1][wheel+2][sector-1], chamberMatch->edgeY);
00433                } else {
00434                   Fill(hDTChamberEdgeXWithSegment[station-1][wheel+2][sector-1], chamberMatch->edgeX);
00435                   Fill(hDTChamberEdgeYWithSegment[station-1][wheel+2][sector-1], chamberMatch->edgeY);
00436 
00437                   for(std::vector<MuonSegmentMatch>::const_iterator segmentMatch = chamberMatch->segmentMatches.begin();
00438                         segmentMatch != chamberMatch->segmentMatches.end(); ++segmentMatch)
00439                   {
00440                      if (segmentMatch->isMask(MuonSegmentMatch::BestInChamberByDR)) {
00441                         Fill(hDTChamberDx[station-1][wheel+2][sector-1], chamberMatch->x-segmentMatch->x);
00442                         if (station < 4) Fill(hDTChamberDy[station-1][wheel+2][sector-1], chamberMatch->y-segmentMatch->y);
00443                         break;
00444                      }
00445                   }// segmentMatch
00446                }
00447 
00448                continue;
00449             }
00450 
00451             if (chamberMatch->detector() == MuonSubdetId::CSC)  {
00452                CSCDetId cscId(chamberMatch->id.rawId());
00453                int endcap  = cscId.endcap();
00454                int ring    = cscId.ring();
00455                int chamber = cscId.chamber();
00456 
00457                if (chamberMatch->segmentMatches.empty()) {
00458                   Fill(hCSCChamberEdgeXWithNoSegment[endcap-1][station-1][ring-1][chamber-1], chamberMatch->edgeX);
00459                   Fill(hCSCChamberEdgeYWithNoSegment[endcap-1][station-1][ring-1][chamber-1], chamberMatch->edgeY);
00460                } else {
00461                   Fill(hCSCChamberEdgeXWithSegment[endcap-1][station-1][ring-1][chamber-1], chamberMatch->edgeX);
00462                   Fill(hCSCChamberEdgeYWithSegment[endcap-1][station-1][ring-1][chamber-1], chamberMatch->edgeY);
00463 
00464                   for(std::vector<MuonSegmentMatch>::const_iterator segmentMatch = chamberMatch->segmentMatches.begin();
00465                         segmentMatch != chamberMatch->segmentMatches.end(); ++segmentMatch)
00466                   {
00467                      if (segmentMatch->isMask(MuonSegmentMatch::BestInChamberByDR)) {
00468                         Fill(hCSCChamberDx[endcap-1][station-1][ring-1][chamber-1], chamberMatch->x-segmentMatch->x);
00469                         Fill(hCSCChamberDy[endcap-1][station-1][ring-1][chamber-1], chamberMatch->y-segmentMatch->y);
00470                         break;
00471                      }
00472                   }// segmentMatch
00473                }
00474             }
00475          }// chamberMatch
00476       }
00477       ++muonIdx;
00478    }// muon
00479 
00480    if (! make2DPlots_) return;
00481 
00482    for(DTRecSegment4DCollection::const_iterator segment = dtSegmentCollectionH_->begin();
00483          segment != dtSegmentCollectionH_->end(); ++segment)
00484    {
00485       LocalPoint  segmentLocalPosition       = segment->localPosition();
00486       LocalVector segmentLocalDirection      = segment->localDirection();
00487       LocalError  segmentLocalPositionError  = segment->localPositionError();
00488       LocalError  segmentLocalDirectionError = segment->localDirectionError();
00489       const GeomDet* segmentGeomDet = geometry_->idToDet(segment->geographicalId());
00490       GlobalPoint segmentGlobalPosition = segmentGeomDet->toGlobal(segment->localPosition());
00491       bool segmentFound = false;
00492       bool segmentBestDrFound = false;
00493 
00494       for(MuonCollection::const_iterator muon = muonCollectionH_->begin();
00495             muon != muonCollectionH_->end(); ++muon)
00496       {
00497          if (! muon->isMatchesValid())
00498             continue;
00499 
00500          for(std::vector<MuonChamberMatch>::const_iterator chamberMatch = muon->matches().begin();
00501                chamberMatch != muon->matches().end(); ++chamberMatch) {
00502             for(std::vector<MuonSegmentMatch>::const_iterator segmentMatch = chamberMatch->segmentMatches.begin();
00503                   segmentMatch != chamberMatch->segmentMatches.end(); ++segmentMatch)
00504             {
00505                if (fabs(segmentMatch->x       - segmentLocalPosition.x()                           ) < 1E-6 &&
00506                    fabs(segmentMatch->y       - segmentLocalPosition.y()                           ) < 1E-6 &&
00507                    fabs(segmentMatch->dXdZ    - segmentLocalDirection.x()/segmentLocalDirection.z()) < 1E-6 &&
00508                    fabs(segmentMatch->dYdZ    - segmentLocalDirection.y()/segmentLocalDirection.z()) < 1E-6 &&
00509                    fabs(segmentMatch->xErr    - sqrt(segmentLocalPositionError.xx())               ) < 1E-6 &&
00510                    fabs(segmentMatch->yErr    - sqrt(segmentLocalPositionError.yy())               ) < 1E-6 &&
00511                    fabs(segmentMatch->dXdZErr - sqrt(segmentLocalDirectionError.xx())              ) < 1E-6 &&
00512                    fabs(segmentMatch->dYdZErr - sqrt(segmentLocalDirectionError.yy())              ) < 1E-6)
00513                {
00514                   segmentFound = true;
00515                   if (segmentMatch->isMask(reco::MuonSegmentMatch::BestInStationByDR)) segmentBestDrFound = true;
00516                   break;
00517                }
00518             }// segmentMatch
00519             if (segmentFound) break;
00520          }// chamberMatch
00521          if (segmentFound) break;
00522       }// muon
00523 
00524       if (segmentFound) {
00525          hSegmentIsAssociatedRZ->Fill(segmentGlobalPosition.z(), segmentGlobalPosition.perp());
00526          hSegmentIsAssociatedXY->Fill(segmentGlobalPosition.x(), segmentGlobalPosition.y());
00527 
00528          if (segmentBestDrFound) {
00529             hSegmentIsBestDrAssociatedRZ->Fill(segmentGlobalPosition.z(), segmentGlobalPosition.perp());
00530             hSegmentIsBestDrAssociatedXY->Fill(segmentGlobalPosition.x(), segmentGlobalPosition.y());
00531          }
00532       } else {
00533          hSegmentIsNotAssociatedRZ->Fill(segmentGlobalPosition.z(), segmentGlobalPosition.perp());
00534          hSegmentIsNotAssociatedXY->Fill(segmentGlobalPosition.x(), segmentGlobalPosition.y());
00535          hSegmentIsBestDrNotAssociatedRZ->Fill(segmentGlobalPosition.z(), segmentGlobalPosition.perp());
00536          hSegmentIsBestDrNotAssociatedXY->Fill(segmentGlobalPosition.x(), segmentGlobalPosition.y());
00537       }
00538    }// dt segment
00539 
00540    for(CSCSegmentCollection::const_iterator segment = cscSegmentCollectionH_->begin();
00541          segment != cscSegmentCollectionH_->end(); ++segment)
00542    {
00543       LocalPoint  segmentLocalPosition       = segment->localPosition();
00544       LocalVector segmentLocalDirection      = segment->localDirection();
00545       LocalError  segmentLocalPositionError  = segment->localPositionError();
00546       LocalError  segmentLocalDirectionError = segment->localDirectionError();
00547       const GeomDet* segmentGeomDet = geometry_->idToDet(segment->geographicalId());
00548       GlobalPoint segmentGlobalPosition = segmentGeomDet->toGlobal(segment->localPosition());
00549       bool segmentFound = false;
00550       bool segmentBestDrFound = false;
00551 
00552       for(MuonCollection::const_iterator muon = muonCollectionH_->begin();
00553             muon != muonCollectionH_->end(); ++muon)
00554       {
00555          if (! muon->isMatchesValid())
00556             continue;
00557 
00558          for(std::vector<MuonChamberMatch>::const_iterator chamberMatch = muon->matches().begin();
00559                chamberMatch != muon->matches().end(); ++chamberMatch) {
00560             for(std::vector<MuonSegmentMatch>::const_iterator segmentMatch = chamberMatch->segmentMatches.begin();
00561                   segmentMatch != chamberMatch->segmentMatches.end(); ++segmentMatch)
00562             {
00563                if (fabs(segmentMatch->x       - segmentLocalPosition.x()                           ) < 1E-6 &&
00564                    fabs(segmentMatch->y       - segmentLocalPosition.y()                           ) < 1E-6 &&
00565                    fabs(segmentMatch->dXdZ    - segmentLocalDirection.x()/segmentLocalDirection.z()) < 1E-6 &&
00566                    fabs(segmentMatch->dYdZ    - segmentLocalDirection.y()/segmentLocalDirection.z()) < 1E-6 &&
00567                    fabs(segmentMatch->xErr    - sqrt(segmentLocalPositionError.xx())               ) < 1E-6 &&
00568                    fabs(segmentMatch->yErr    - sqrt(segmentLocalPositionError.yy())               ) < 1E-6 &&
00569                    fabs(segmentMatch->dXdZErr - sqrt(segmentLocalDirectionError.xx())              ) < 1E-6 &&
00570                    fabs(segmentMatch->dYdZErr - sqrt(segmentLocalDirectionError.yy())              ) < 1E-6)
00571                {
00572                   segmentFound = true;
00573                   if (segmentMatch->isMask(reco::MuonSegmentMatch::BestInStationByDR)) segmentBestDrFound = true;
00574                   break;
00575                }
00576             }// segmentMatch
00577             if (segmentFound) break;
00578          }// chamberMatch
00579          if (segmentFound) break;
00580       }// muon
00581 
00582       if (segmentFound) {
00583          hSegmentIsAssociatedRZ->Fill(segmentGlobalPosition.z(), segmentGlobalPosition.perp());
00584          hSegmentIsAssociatedXY->Fill(segmentGlobalPosition.x(), segmentGlobalPosition.y());
00585 
00586          if (segmentBestDrFound) {
00587             hSegmentIsBestDrAssociatedRZ->Fill(segmentGlobalPosition.z(), segmentGlobalPosition.perp());
00588             hSegmentIsBestDrAssociatedXY->Fill(segmentGlobalPosition.x(), segmentGlobalPosition.y());
00589          }
00590       } else {
00591          hSegmentIsNotAssociatedRZ->Fill(segmentGlobalPosition.z(), segmentGlobalPosition.perp());
00592          hSegmentIsNotAssociatedXY->Fill(segmentGlobalPosition.x(), segmentGlobalPosition.y());
00593          hSegmentIsBestDrNotAssociatedRZ->Fill(segmentGlobalPosition.z(), segmentGlobalPosition.perp());
00594          hSegmentIsBestDrNotAssociatedXY->Fill(segmentGlobalPosition.x(), segmentGlobalPosition.y());
00595       }
00596    }// csc segment
00597 }
00598 
00599 void 
00600 MuonIdVal::endJob() {}
00601 
00602 void MuonIdVal::Fill(MonitorElement* me, float f) {
00603    if (fabs(f) > 900000) return;
00604    //if (fabs(f) < 1E-8) return;
00605    me->Fill(f);
00606 }
00607 
00608 //define this as a plug-in
00609 DEFINE_FWK_MODULE(MuonIdVal);