00001 #include <iostream>
00002 #include <sstream>
00003 #include <istream>
00004 #include <fstream>
00005 #include <iomanip>
00006 #include <string>
00007 #include <cmath>
00008 #include <functional>
00009 #include <stdlib.h>
00010 #include <string.h>
00011
00012 #include "HLTrigger/HLTanalyzers/interface/HLTMuon.h"
00013
00014 HLTMuon::HLTMuon() {
00015 evtCounter=0;
00016
00017
00018 _Monte=false;
00019 _Debug=false;
00020 }
00021
00022
00023 void HLTMuon::setup(const edm::ParameterSet& pSet, TTree* HltTree) {
00024
00025 edm::ParameterSet myEmParams = pSet.getParameter<edm::ParameterSet>("RunParameters") ;
00026 std::vector<std::string> parameterNames = myEmParams.getParameterNames() ;
00027
00028 for ( std::vector<std::string>::iterator iParam = parameterNames.begin();
00029 iParam != parameterNames.end(); iParam++ ){
00030 if ( (*iParam) == "Monte" ) _Monte = myEmParams.getParameter<bool>( *iParam );
00031 else if ( (*iParam) == "Debug" ) _Debug = myEmParams.getParameter<bool>( *iParam );
00032 }
00033
00034 const int kMaxMuon = 10000;
00035 muonpt = new float[kMaxMuon];
00036 muonphi = new float[kMaxMuon];
00037 muoneta = new float[kMaxMuon];
00038 muonet = new float[kMaxMuon];
00039 muone = new float[kMaxMuon];
00040 muonchi2NDF = new float[kMaxMuon];
00041 muoncharge = new float[kMaxMuon];
00042 muonTrkIsoR03 = new float[kMaxMuon];
00043 muonECalIsoR03 = new float[kMaxMuon];
00044 muonHCalIsoR03 = new float[kMaxMuon];
00045 muonD0 = new float[kMaxMuon];
00046 muontype = new int[kMaxMuon];
00047 muonNValidTrkHits = new int[kMaxMuon];
00048 muonNValidMuonHits = new int[kMaxMuon];
00049 const int kMaxMuonL2 = 500;
00050 muonl2pt = new float[kMaxMuonL2];
00051 muonl2phi = new float[kMaxMuonL2];
00052 muonl2eta = new float[kMaxMuonL2];
00053 muonl2dr = new float[kMaxMuonL2];
00054 muonl2drsign = new float[kMaxMuonL2];
00055 muonl2dz = new float[kMaxMuonL2];
00056 muonl2vtxz = new float[kMaxMuonL2];
00057 muonl2chg = new int[kMaxMuonL2];
00058 muonl2pterr = new float[kMaxMuonL2];
00059 muonl2iso = new int[kMaxMuonL2];
00060 muonl2nhits = new int[kMaxMuonL2];
00061 muonl2nchambers = new int[kMaxMuonL2];
00062 muonl2nstat = new int[kMaxMuonL2];
00063 muonl2ndtcscstat = new int[kMaxMuonL2];
00064 muonl21idx = new int[kMaxMuonL2];
00065 const int kMaxMuonL3 = 500;
00066 muonl3pt = new float[kMaxMuonL3];
00067 muonl3phi = new float[kMaxMuonL3];
00068 muonl3eta = new float[kMaxMuonL3];
00069 muonl3dr = new float[kMaxMuonL3];
00070 muonl3dz = new float[kMaxMuonL3];
00071 muonl3vtxz = new float[kMaxMuonL3];
00072 muonl3chg = new int[kMaxMuonL3];
00073 muonl3pterr = new float[kMaxMuonL3];
00074 muonl3iso = new int[kMaxMuonL3];
00075 muonl3trk10iso = new int[kMaxMuonL3];
00076 muonl3nhits = new int[kMaxMuonL3];
00077 muonl3normchi2 = new float[kMaxMuonL3];
00078 muonl3npixelhits = new int[kMaxMuonL3];
00079 muonl3ntrackerhits = new int[kMaxMuonL3];
00080 muonl3nmuonhits = new int[kMaxMuonL3];
00081 muonl32idx = new int[kMaxMuonL3];
00082 muonl3globalpt = new float[kMaxMuonL3];
00083 muonl3globaleta = new float[kMaxMuonL3];
00084 muonl3globalphi = new float[kMaxMuonL3];
00085 muonl3globaldr = new float[kMaxMuonL3];
00086 muonl3globaldrsign = new float[kMaxMuonL3];
00087 muonl3globaldz = new float[kMaxMuonL3];
00088 muonl3globalvtxz = new float[kMaxMuonL3];
00089 muonl3globalchg = new int[kMaxMuonL3];
00090 muonl3global2idx = new int[kMaxMuonL3];
00091 const int kMaxTrackerMuon = 500;
00092 trackermuonpt = new float[kMaxTrackerMuon];
00093 trackermuonphi = new float[kMaxTrackerMuon];
00094 trackermuoneta = new float[kMaxTrackerMuon];
00095 trackermuonchg = new int[kMaxTrackerMuon];
00096 trackermuonnhits = new int[kMaxTrackerMuon];
00097 const int kMaxOniaPixel = 500;
00098 oniaPixelpt = new float[kMaxOniaPixel];
00099 oniaPixelphi = new float[kMaxOniaPixel];
00100 oniaPixeleta = new float[kMaxOniaPixel];
00101 oniaPixeldr = new float[kMaxOniaPixel];
00102 oniaPixeldz = new float[kMaxOniaPixel];
00103 oniaPixelchg = new int[kMaxOniaPixel];
00104 oniaPixelHits = new int[kMaxOniaPixel];
00105 oniaPixelNormChi2 = new float[kMaxOniaPixel];
00106 const int kMaxTrackPixel = 500;
00107 oniaTrackpt = new float[kMaxTrackPixel];
00108 oniaTrackphi = new float[kMaxTrackPixel];
00109 oniaTracketa = new float[kMaxTrackPixel];
00110 oniaTrackdr = new float[kMaxTrackPixel];
00111 oniaTrackdz = new float[kMaxTrackPixel];
00112 oniaTrackchg = new int[kMaxTrackPixel];
00113 oniaTrackHits = new int[kMaxTrackPixel];
00114 oniaTrackNormChi2 = new float[kMaxTrackPixel];
00115 const int kMaxMuonL2NoVtx = 500;
00116 muonl2novtxpt = new float[kMaxMuonL2NoVtx];
00117 muonl2novtxphi = new float[kMaxMuonL2NoVtx];
00118 muonl2novtxeta = new float[kMaxMuonL2NoVtx];
00119 muonl2novtxdr = new float[kMaxMuonL2NoVtx];
00120 muonl2novtxdrsign = new float[kMaxMuonL2NoVtx];
00121 muonl2novtxdz = new float[kMaxMuonL2NoVtx];
00122 muonl2novtxchg = new int[kMaxMuonL2NoVtx];
00123 muonl2novtxpterr = new float[kMaxMuonL2NoVtx];
00124 muonl2novtxnhits = new int[kMaxMuonL2NoVtx];
00125 muonl2novtxnchambers = new int[kMaxMuonL2NoVtx];
00126 muonl2novtxnstat = new int[kMaxMuonL2NoVtx];
00127 muonl2novtxndtcscstat = new int[kMaxMuonL2NoVtx];
00128 muonl2novtx1idx = new int[kMaxMuonL2NoVtx];
00129 const int kMaxDiMu = 500;
00130 dimudca = new float[kMaxDiMu];
00131 dimu1st = new int[kMaxDiMu];
00132 dimu2nd = new int[kMaxDiMu];
00133 const int kMaxDiMuVtx = 500;
00134 dimuvtx1st = new int[kMaxDiMuVtx];
00135 dimuvtx2nd = new int[kMaxDiMuVtx];
00136 dimuvtxchi2 = new float[kMaxDiMuVtx];
00137 dimuvtxr = new float[kMaxDiMuVtx];
00138 dimuvtxrsig = new float[kMaxDiMuVtx];
00139 dimuvtxroversig = new float[kMaxDiMuVtx];
00140 dimuvtxcosalpha = new float[kMaxDiMuVtx];
00141 dimuvtxmu2dipmax = new float[kMaxDiMuVtx];
00142 dimuvtxmu2dipmin = new float[kMaxDiMuVtx];
00143 dimuvtxmu2dipsigmax = new float[kMaxDiMuVtx];
00144 dimuvtxmu2dipsigmin = new float[kMaxDiMuVtx];
00145
00146
00147 const int kMaxPfmuon = 10000;
00148 pfmuonpt = new float[kMaxPfmuon];
00149 pfmuonphi = new float[kMaxPfmuon];
00150 pfmuoneta = new float[kMaxPfmuon];
00151 pfmuonet = new float[kMaxPfmuon];
00152 pfmuone = new float[kMaxPfmuon];
00153 pfmuoncharge = new float[kMaxPfmuon];
00154
00155
00156 HltTree->Branch("NrecoMuon",&nmuon,"NrecoMuon/I");
00157 HltTree->Branch("recoMuonPt",muonpt,"recoMuonPt[NrecoMuon]/F");
00158 HltTree->Branch("recoMuonPhi",muonphi,"recoMuonPhi[NrecoMuon]/F");
00159 HltTree->Branch("recoMuonEta",muoneta,"recoMuonEta[NrecoMuon]/F");
00160 HltTree->Branch("recoMuonEt",muonet,"recoMuonEt[NrecoMuon]/F");
00161 HltTree->Branch("recoMuonE",muone,"recoMuonE[NrecoMuon]/F");
00162 HltTree->Branch("recoMuonChi2NDF", muonchi2NDF, "recoMuonChi2NDF[NrecoMuon]/F");
00163 HltTree->Branch("recoMuonCharge", muoncharge , "recoMuonCharge[NrecoMuon]/F");
00164 HltTree->Branch("recoMuonTrkIsoR03", muonTrkIsoR03 , "recoMuonTrkIsoR03[NrecoMuon]/F");
00165 HltTree->Branch("recoMuonECalIsoR03", muonECalIsoR03 , "recoMuonECalIsoR03[NrecoMuon]/F");
00166 HltTree->Branch("recoMuonHCalIsoR03", muonHCalIsoR03 , "recoMuonHCalIsoR03[NrecoMuon]/F");
00167 HltTree->Branch("recoMuonD0", muonD0 , "recoMuonD0[NrecoMuon]/F");
00168 HltTree->Branch("recoMuonType", muontype , "recoMuonType[NrecoMuon]/I");
00169 HltTree->Branch("recoMuonNValidTrkHits", muonNValidTrkHits, "recoMuonNValidTrkHits[NrecoMuon]/I");
00170 HltTree->Branch("recoMuonNValidMuonHits", muonNValidMuonHits,"recoMuonNValidMuonHits[NrecoMuon]/I");
00171
00172 HltTree->Branch("NohMuL2",&nmu2cand,"NohMuL2/I");
00173 HltTree->Branch("ohMuL2Pt",muonl2pt,"ohMuL2Pt[NohMuL2]/F");
00174 HltTree->Branch("ohMuL2Phi",muonl2phi,"ohMuL2Phi[NohMuL2]/F");
00175 HltTree->Branch("ohMuL2Eta",muonl2eta,"ohMuL2Eta[NohMuL2]/F");
00176 HltTree->Branch("ohMuL2Chg",muonl2chg,"ohMuL2Chg[NohMuL2]/I");
00177 HltTree->Branch("ohMuL2PtErr",muonl2pterr,"ohMuL2PtErr[NohMuL2]/F");
00178 HltTree->Branch("ohMuL2Iso",muonl2iso,"ohMuL2Iso[NohMuL2]/I");
00179 HltTree->Branch("ohMuL2Dr",muonl2dr,"ohMuL2Dr[NohMuL2]/F");
00180 HltTree->Branch("ohMuL2DrSign",muonl2drsign,"ohMuL2DrSign[NohMuL2]/F");
00181 HltTree->Branch("ohMuL2Dz",muonl2dz,"ohMuL2Dz[NohMuL2]/F");
00182 HltTree->Branch("ohMuL2VtxZ",muonl2vtxz,"ohMuL2VtxZ[NohMuL2]/F");
00183 HltTree->Branch("ohMuL2Nhits",muonl2nhits,"ohMuL2Nhits[NohMuL2]/I");
00184 HltTree->Branch("ohMuL2Nchambers",muonl2nchambers,"ohMuL2Nchambers[NohMuL2]/I");
00185 HltTree->Branch("ohMuL2Nstat",muonl2nstat,"ohMuL2Nstat[NohMuL2]/I");
00186 HltTree->Branch("ohMuL2NDtCscStat",muonl2ndtcscstat,"ohMuL2NDtCscStat[NohMuL2]/I");
00187 HltTree->Branch("ohMuL2L1idx",muonl21idx,"ohMuL2L1idx[NohMuL2]/I");
00188 HltTree->Branch("NohMuL3",&nmu3cand,"NohMuL3/I");
00189 HltTree->Branch("ohMuL3Pt",muonl3pt,"ohMuL3Pt[NohMuL3]/F");
00190 HltTree->Branch("ohMuL3Phi",muonl3phi,"ohMuL3Phi[NohMuL3]/F");
00191 HltTree->Branch("ohMuL3Eta",muonl3eta,"ohMuL3Eta[NohMuL3]/F");
00192 HltTree->Branch("ohMuL3Chg",muonl3chg,"ohMuL3Chg[NohMuL3]/I");
00193 HltTree->Branch("ohMuL3PtErr",muonl3pterr,"ohMuL3PtErr[NohMuL3]/F");
00194 HltTree->Branch("ohMuL3Iso",muonl3iso,"ohMuL3Iso[NohMuL3]/I");
00195 HltTree->Branch("ohMuL3Trk10Iso",muonl3trk10iso,"ohMuL3Trk10Iso[NohMuL3]/I");
00196 HltTree->Branch("ohMuL3Dr",muonl3dr,"ohMuL3Dr[NohMuL3]/F");
00197 HltTree->Branch("ohMuL3Dz",muonl3dz,"ohMuL3Dz[NohMuL3]/F");
00198 HltTree->Branch("ohMuL3VtxZ",muonl3vtxz,"ohMuL3VtxZ[NohMuL3]/F");
00199 HltTree->Branch("ohMuL3Nhits",muonl3nhits,"ohMuL3Nhits[NohMuL3]/I");
00200 HltTree->Branch("ohMuL3NormChi2", muonl3normchi2, "ohMuL3NormChi2[NohMuL3]/F");
00201 HltTree->Branch("ohMuL3Npixelhits", muonl3npixelhits, "ohMuL3Npixelhits[NohMuL3]/I");
00202 HltTree->Branch("ohMuL3Ntrackerhits", muonl3ntrackerhits, "ohMuL3Ntrackerhits[NohMuL3]/I");
00203 HltTree->Branch("ohMuL3Nmuonhits", muonl3nmuonhits, "ohMuL3Nmuonhits[NohMuL3]/I");
00204 HltTree->Branch("ohMuL3L2idx",muonl32idx,"ohMuL3L2idx[NohMuL3]/I");
00205 HltTree->Branch("ohMuL3globalPt",muonl3globalpt,"ohMuL3globalPt[NohMuL3]/F");
00206 HltTree->Branch("ohMuL3globalEta",muonl3globaleta,"ohMuL3globalEta[NohMuL3]/F");
00207 HltTree->Branch("ohMuL3globalPhi",muonl3globalphi,"ohMuL3globalPhi[NohMuL3]/F");
00208 HltTree->Branch("ohMuL3globalDr",muonl3globaldr,"ohMuL3globalDr[NohMuL3]/F");
00209 HltTree->Branch("ohMuL3globalDrSign",muonl3globaldrsign,"ohMuL3globalDrSign[NohMuL3]/F");
00210 HltTree->Branch("ohMuL3globalDz",muonl3globaldz,"ohMuL3globalDz[NohMuL3]/F");
00211 HltTree->Branch("ohMuL3globalVtxZ",muonl3globalvtxz,"ohMuL3globalVtxZ[NohMuL3]/F");
00212 HltTree->Branch("ohMuL3globalL2idx",muonl3global2idx,"ohMuL3globalL2idx[NohMuL3]/I");
00213
00214 HltTree->Branch("NohOniaPixel",&nOniaPixelCand,"NohOniaPixel/I");
00215 HltTree->Branch("ohOniaPixelPt",oniaPixelpt,"ohOniaPixelPt[NohOniaPixel]/F");
00216 HltTree->Branch("ohOniaPixelPhi",oniaPixelphi,"ohOniaPixelPhi[NohOniaPixel]/F");
00217 HltTree->Branch("ohOniaPixelEta",oniaPixeleta,"ohOniaPixelEta[NohOniaPixel]/F");
00218 HltTree->Branch("ohOniaPixelChg",oniaPixelchg,"ohOniaPixelChg[NohOniaPixel]/I");
00219 HltTree->Branch("ohOniaPixelDr",oniaPixeldr,"ohOniaPixelDr[NohOniaPixel]/F");
00220 HltTree->Branch("ohOniaPixelDz",oniaPixeldz,"ohOniaPixelDz[NohOniaPixel]/F");
00221 HltTree->Branch("ohOniaPixelHits",oniaPixelHits,"ohOniaPixelHits[NohOniaPixel]/I");
00222 HltTree->Branch("ohOniaPixelNormChi2",oniaPixelNormChi2,"ohOniaPixelNormChi2[NohOniaPixel]/F");
00223 HltTree->Branch("NohOniaTrack",&nOniaTrackCand,"NohOniaTrack/I");
00224 HltTree->Branch("ohOniaTrackPt",oniaTrackpt,"ohOniaTrackPt[NohOniaTrack]/F");
00225 HltTree->Branch("ohOniaTrackPhi",oniaTrackphi,"ohOniaTrackPhi[NohOniaTrack]/F");
00226 HltTree->Branch("ohOniaTrackEta",oniaTracketa,"ohOniaTrackEta[NohOniaTrack]/F");
00227 HltTree->Branch("ohOniaTrackChg",oniaTrackchg,"ohOniaTrackChg[NohOniaTrack]/I");
00228 HltTree->Branch("ohOniaTrackDr",oniaTrackdr,"ohOniaTrackDr[NohOniaTrack]/F");
00229 HltTree->Branch("ohOniaTrackDz",oniaTrackdz,"ohOniaTrackDz[NohOniaTrack]/F");
00230 HltTree->Branch("ohOniaTrackHits",oniaTrackHits,"ohOniaTrackHits[NohOniaTrack]/I");
00231 HltTree->Branch("ohOniaTrackNormChi2",oniaTrackNormChi2,"ohOniaTrackNormChi2[NohOniaTrack]/F");
00232 HltTree->Branch("NohMuL2NoVtx",&nmu2cand,"NohMuL2NoVtx/I");
00233 HltTree->Branch("ohMuL2NoVtxPt",muonl2novtxpt,"ohMuL2NoVtxPt[NohMuL2NoVtx]/F");
00234 HltTree->Branch("ohMuL2NoVtxPhi",muonl2novtxphi,"ohMuL2NoVtxPhi[NohMuL2NoVtx]/F");
00235 HltTree->Branch("ohMuL2NoVtxEta",muonl2novtxeta,"ohMuL2NoVtxEta[NohMuL2NoVtx]/F");
00236 HltTree->Branch("ohMuL2NoVtxChg",muonl2novtxchg,"ohMuL2NoVtxChg[NohMuL2NoVtx]/I");
00237 HltTree->Branch("ohMuL2NoVtxPtErr",muonl2novtxpterr,"ohMuL2NoVtxPtErr[NohMuL2NoVtx]/F");
00238 HltTree->Branch("ohMuL2NoVtxDr",muonl2novtxdr,"ohMuL2NoVtxDr[NohMuL2NoVtx]/F");
00239 HltTree->Branch("ohMuL2NoVtxDrSign",muonl2novtxdrsign,"ohMuL2NoVtxDrSign[NohMuL2NoVtx]/F");
00240 HltTree->Branch("ohMuL2NoVtxDz",muonl2novtxdz,"ohMuL2NoVtxDz[NohMuL2NoVtx]/F");
00241 HltTree->Branch("ohMuL2NoVtxNhits",muonl2novtxnhits,"ohMuL2NoVtxNhits[NohMuL2NoVtx]/I");
00242 HltTree->Branch("ohMuL2NoVtxNchambers",muonl2novtxnchambers,"ohMuL2NoVtxNchambers[NohMuL2NoVtx]/I");
00243 HltTree->Branch("ohMuL2NoVtxNstat",muonl2novtxnstat,"ohMuL2NoVtxNstat[NohMuL2NoVtx]/I");
00244 HltTree->Branch("ohMuL2NoVtxNDtCscStat",muonl2novtxndtcscstat,"ohMuL2NoVtxNDtCscStat[NohMuL2NoVtx]/I");
00245 HltTree->Branch("ohMuL2NoVtxL1idx",muonl2novtx1idx,"ohMuL2NoVtxL1idx[NohMuL2NoVtx]/I");
00246 HltTree->Branch("NohDiMu",&nDiMu,"NohDiMu/I");
00247 HltTree->Branch("ohDiMuDCA",dimudca,"ohDiMuDCA[NohDiMu]/F");
00248 HltTree->Branch("ohDiMu1st",dimu1st,"ohDiMu1st[NohDiMu]/I");
00249 HltTree->Branch("ohDiMu2nd",dimu2nd,"ohDiMu2nd[NohDiMu]/I");
00250 HltTree->Branch("NohDiMuVtx",&nDiMuVtx,"NohDiMuVtx/I");
00251 HltTree->Branch("ohDiMuVtx1st",dimuvtx1st,"ohDiMuVtx1st[NohDiMuVtx]/I");
00252 HltTree->Branch("ohDiMuVtx2nd",dimuvtx2nd,"ohDiMuVtx2nd[NohDiMuVtx]/I");
00253 HltTree->Branch("ohDiMuVtxChi2",dimuvtxchi2,"ohDiMuVtxChi2[NohDiMuVtx]/F");
00254 HltTree->Branch("ohDiMuVtxR",dimuvtxr,"ohDiMuVtxR[NohDiMuVtx]/F");
00255 HltTree->Branch("ohDiMuVtxRSig",dimuvtxrsig,"ohDiMuVtxRSig[NohDiMuVtx]/F");
00256 HltTree->Branch("ohDiMuVtxROverSig",dimuvtxroversig,"ohDiMuVtxROverSig[NohDiMuVtx]/F");
00257 HltTree->Branch("ohDiMuVtxCosAlpha",dimuvtxcosalpha,"ohDiMuVtxCosAlpha[NohDiMuVtx]/F");
00258 HltTree->Branch("ohDiMuVtxMu2DIpMax",dimuvtxmu2dipmax,"ohDiMuVtxMu2DIpMax[NohDiMuVtx]/F");
00259 HltTree->Branch("ohDiMuVtxMu2DIpMin",dimuvtxmu2dipmin,"ohDiMuVtxMu2DIpMin[NohDiMuVtx]/F");
00260 HltTree->Branch("ohDiMuVtxMu2DIpSigMax",dimuvtxmu2dipsigmax,"ohDiMuVtxMu2DIpSigMax[NohDiMuVtx]/F");
00261 HltTree->Branch("ohDiMuVtxMu2DIpSigMin",dimuvtxmu2dipsigmin,"ohDiMuVtxMu2DIpSigMin[NohDiMuVtx]/F");
00262 HltTree->Branch("NohTrackerMuon",&ntrackermuoncand,"NohTrackerMuon/I");
00263 HltTree->Branch("ohTrackerMuonPt",trackermuonpt,"ohTrackerMuonPt[NohTrackerMuon]/F");
00264 HltTree->Branch("ohTrackerMuonPhi",trackermuonphi,"ohTrackerMuonPhi[NohTrackerMuon]/F");
00265 HltTree->Branch("ohTrackerMuonEta",trackermuoneta,"ohTrackerMuonEta[NohTrackerMuon]/F");
00266 HltTree->Branch("ohTrackerMuonChg",trackermuonchg,"ohTrackerMuonChg[NohTrackerMuon]/I");
00267 HltTree->Branch("ohTrackerMuonNhits",trackermuonnhits,"ohTrackerMuonNhits[NohTrackerMuon]/I");
00268
00269 HltTree->Branch("NpfMuon",&npfmuon,"NpfMuon/I");
00270 HltTree->Branch("pfMuonPt",pfmuonpt,"pfMuonPt[NpfMuon]/F");
00271 HltTree->Branch("pfMuonPhi",pfmuonphi,"pfMuonPhi[NpfMuon]/F");
00272 HltTree->Branch("pfMuonEta",pfmuoneta,"pfMuonEta[NpfMuon]/F");
00273 HltTree->Branch("pfMuonEt",pfmuonet,"pfMuonEt[NpfMuon]/F");
00274 HltTree->Branch("pfMuonE",pfmuone,"pfMuonE[NpfMuon]/F");
00275 HltTree->Branch("pfMuonCharge", pfmuoncharge , "pfMuonCharge[NpfMuon]/F");
00276
00277
00278 }
00279
00280
00281 void HLTMuon::analyze(const edm::Handle<reco::MuonCollection> & Muon,
00282 const edm::Handle<reco::PFCandidateCollection> & pfMuon,
00283 const edm::Handle<l1extra::L1MuonParticleCollection> & MuCands1,
00284 const edm::Handle<reco::RecoChargedCandidateCollection> & MuCands2,
00285 const edm::Handle<edm::ValueMap<bool> > & isoMap2,
00286 const edm::Handle<reco::RecoChargedCandidateCollection> & MuCands3,
00287 const edm::Handle<edm::ValueMap<bool> > & isoMap3,
00288 const edm::Handle<edm::ValueMap<bool> > & isoTrk10Map3,
00289 const edm::Handle<reco::RecoChargedCandidateCollection> & oniaPixelCands,
00290 const edm::Handle<reco::RecoChargedCandidateCollection> & oniaTrackCands,
00291 const edm::Handle<reco::VertexCollection> & DiMuVtxCands3,
00292 const edm::Handle<reco::RecoChargedCandidateCollection> & MuNoVtxCands2,
00293 const edm::Handle<reco::MuonCollection> & trkmucands,
00294 const edm::ESHandle<MagneticField> & theMagField,
00295 const edm::Handle<reco::BeamSpot> & recoBeamSpotHandle,
00296 TTree* HltTree) {
00297
00298 reco::BeamSpot::Point BSPosition(0,0,0);
00299 BSPosition = recoBeamSpotHandle->position();
00300 const GlobalPoint theBeamSpot = GlobalPoint(recoBeamSpotHandle->position().x(),
00301 recoBeamSpotHandle->position().y(),
00302 recoBeamSpotHandle->position().z());
00303 reco::BeamSpot vtxBS = *recoBeamSpotHandle;
00304
00305
00306
00307 if (Muon.isValid()) {
00308 reco::MuonCollection mymuons;
00309 mymuons = * Muon;
00310 std::sort(mymuons.begin(),mymuons.end(),PtGreater());
00311 nmuon = mymuons.size();
00312 typedef reco::MuonCollection::const_iterator muiter;
00313 int imu=0;
00314 for (muiter i=mymuons.begin(); i!=mymuons.end(); i++)
00315 {
00316 muonpt[imu] = i->pt();
00317 muonphi[imu] = i->phi();
00318 muoneta[imu] = i->eta();
00319 muonet[imu] = i->et();
00320 muone[imu] = i->energy();
00321 muontype[imu] = i->type();
00322 muoncharge[imu] = i->charge();
00323 muonTrkIsoR03[imu] = i->isolationR03().sumPt;
00324 muonECalIsoR03[imu] = i->isolationR03().emEt;
00325 muonHCalIsoR03[imu] = i->isolationR03().hadEt;
00326
00327
00328 if (i->globalTrack().isNonnull())
00329 {
00330 muonchi2NDF[imu] = i->globalTrack()->normalizedChi2();
00331 muonD0[imu] = i->globalTrack()->dxy(BSPosition);
00332 }
00333 else
00334 {
00335 muonchi2NDF[imu] = -99.;
00336 muonD0[imu] = -99.;}
00337
00338 if (i->innerTrack().isNonnull()) muonNValidTrkHits[imu] = i->innerTrack()->numberOfValidHits();
00339 else muonNValidTrkHits[imu] = -99;
00340
00341 if (i->isGlobalMuon()!=0) muonNValidMuonHits[imu] = i->globalTrack()->hitPattern().numberOfValidMuonHits();
00342 else muonNValidMuonHits[imu] = -99;
00343
00344 imu++;
00345 }
00346 }
00347 else {nmuon = 0;}
00348
00349 l1extra::L1MuonParticleCollection myMucands1;
00350 myMucands1 = * MuCands1;
00351
00352 std::sort(myMucands1.begin(),myMucands1.end(),PtGreater());
00353
00355
00356
00357 reco::RecoChargedCandidateCollection myMucands2;
00358 if (MuCands2.isValid()) {
00359
00360 myMucands2 = * MuCands2;
00361 std::sort(myMucands2.begin(),myMucands2.end(),PtGreater());
00362 nmu2cand = myMucands2.size();
00363 typedef reco::RecoChargedCandidateCollection::const_iterator cand;
00364 int imu2c=0;
00365 for (cand i=myMucands2.begin(); i!=myMucands2.end(); i++) {
00366 reco::TrackRef tk = i->get<reco::TrackRef>();
00367
00368 muonl2pt[imu2c] = tk->pt();
00369
00370 muonl2eta[imu2c] = tk->eta();
00371 muonl2phi[imu2c] = tk->phi();
00372
00373
00374
00375
00376 muonl2dr[imu2c] = fabs(tk->dxy(BSPosition));
00377 muonl2drsign[imu2c] = ( tk->dxyError() > 0. ? muonl2dr[imu2c] / tk->dxyError() : 999. );
00378
00379
00380
00381 muonl2dz[imu2c] = tk->dz(BSPosition);
00382 muonl2vtxz[imu2c] = tk->dz();
00383 muonl2nhits[imu2c] = tk->numberOfValidHits();
00384 muonl2nchambers[imu2c] = validChambers(tk);
00385 muonl2nstat[imu2c] = tk->hitPattern().muonStationsWithAnyHits();
00386 muonl2ndtcscstat[imu2c] = tk->hitPattern().dtStationsWithAnyHits() + tk->hitPattern().cscStationsWithAnyHits();
00387
00388
00389
00390
00391
00392
00393
00394 double l2_err0 = tk->error(0);
00395 double l2_abspar0 = fabs(tk->parameter(0));
00396
00397
00398
00399
00400
00401
00402
00403
00404
00405
00406
00407
00408 muonl2pterr[imu2c] = l2_err0/l2_abspar0;
00409 muonl2chg[imu2c] = tk->charge();
00410
00411 if (isoMap2.isValid()){
00412
00413 edm::ValueMap<bool> ::value_type muon1IsIsolated = (*isoMap2)[tk];
00414 muonl2iso[imu2c] = muon1IsIsolated;
00415 }
00416 else {muonl2iso[imu2c] = -999;}
00417
00418 l1extra::L1MuonParticleRef l1;
00419 int il2 = 0;
00420
00421 l1 = tk->seedRef().castTo<edm::Ref< L2MuonTrajectorySeedCollection> >()->l1Particle();
00422 il2++;
00423 int imu1idx = 0;
00424 if (MuCands1.isValid()) {
00425 typedef l1extra::L1MuonParticleCollection::const_iterator candl1;
00426 for (candl1 j=myMucands1.begin(); j!=myMucands1.end(); j++) {
00427 if((j->pt() == l1->pt()) &&
00428 (j->eta() == l1->eta()) &&
00429 (j->phi() == l1->phi()) &&
00430 (j->gmtMuonCand().quality() == l1->gmtMuonCand().quality()))
00431 {break;}
00432
00433
00434 imu1idx++;
00435 }
00436 }
00437 else {imu1idx = -999;}
00438 muonl21idx[imu2c] = imu1idx;
00439
00440 imu2c++;
00441 }
00442 }
00443 else {nmu2cand = 0;}
00444
00445
00446 reco::RecoChargedCandidateCollection myMucands3;
00447 if (MuCands3.isValid()) {
00448 int k = 0;
00449 myMucands3 = * MuCands3;
00450 std::sort(myMucands3.begin(),myMucands3.end(),PtGreater());
00451 nmu3cand = myMucands3.size();
00452 typedef reco::RecoChargedCandidateCollection::const_iterator cand;
00453 int imu3c=0;
00454 int idimuc=0;
00455 for (cand i=myMucands3.begin(); i!=myMucands3.end(); i++) {
00456 reco::TrackRef tk = i->get<reco::TrackRef>();
00457
00458 reco::RecoChargedCandidateRef candref = reco::RecoChargedCandidateRef(MuCands3,k);
00459
00460 reco::TrackRef staTrack;
00461 typedef reco::MuonTrackLinksCollection::const_iterator l3muon;
00462 int il3 = 0;
00463
00464 staTrack = tk->seedRef().castTo<edm::Ref< L3MuonTrajectorySeedCollection> >()->l2Track();
00465 il3++;
00466 int imu2idx = 0;
00467 if (MuCands2.isValid()) {
00468 typedef reco::RecoChargedCandidateCollection::const_iterator candl2;
00469 for (candl2 i=myMucands2.begin(); i!=myMucands2.end(); i++) {
00470 reco::TrackRef tkl2 = i->get<reco::TrackRef>();
00471 if ( tkl2 == staTrack ) {break;}
00472 imu2idx++;
00473 }
00474 }
00475 else {imu2idx = -999;}
00476 muonl3global2idx[imu3c] = imu2idx;
00477 muonl32idx[imu3c] = imu2idx;
00478
00479 muonl3globalpt[imu3c] = tk->pt();
00480 muonl3pt[imu3c] = candref->pt();
00481
00482 muonl3globaleta[imu3c] = tk->eta();
00483 muonl3globalphi[imu3c] = tk->phi();
00484 muonl3eta[imu3c] = candref->eta();
00485 muonl3phi[imu3c] = candref->phi();
00486
00487
00488
00489
00490 muonl3dr[imu3c] = fabs( (- (candref->vx()-BSPosition.x()) * candref->py() + (candref->vy()-BSPosition.y()) * candref->px() ) / candref->pt() );
00491 muonl3globaldr[imu3c] = fabs(tk->dxy(BSPosition));
00492 muonl3globaldrsign[imu3c] = ( tk->dxyError() > 0. ? muonl3globaldr[imu3c] / tk->dxyError() : -999. );
00493
00494
00495
00496 muonl3dz[imu3c] = (candref->vz()-BSPosition.z()) - ((candref->vx()-BSPosition.x())*candref->px()+(candref->vy()-BSPosition.y())*candref->py())/candref->pt() * candref->pz()/candref->pt();
00497 muonl3globaldz[imu3c] = tk->dz(BSPosition);
00498
00499 muonl3vtxz[imu3c] = candref->vz() - ( candref->vx()*candref->px() + candref->vy()*candref->py() )/candref->pt() * candref->pz()/candref->pt();
00500 muonl3globalvtxz[imu3c] = tk->dz();
00501
00502
00503
00504 muonl3nhits[imu3c] = tk->numberOfValidHits();
00505
00506
00507
00508
00509
00510
00511
00512 double l3_err0 = tk->error(0);
00513 double l3_abspar0 = fabs(tk->parameter(0));
00514
00515
00516
00517
00518
00519
00520
00521
00522
00523
00524
00525
00526 muonl3pterr[imu3c] = l3_err0/l3_abspar0;
00527 muonl3globalchg[imu3c] = tk->charge();
00528 muonl3chg[imu3c] = candref->charge();
00529
00530 muonl3normchi2[imu3c] = tk->normalizedChi2();
00531 muonl3npixelhits[imu3c] = tk->hitPattern().numberOfValidPixelHits();
00532 muonl3ntrackerhits[imu3c] = tk->hitPattern().numberOfValidTrackerHits();
00533 muonl3nmuonhits[imu3c] = tk->hitPattern().numberOfValidMuonHits();
00534
00535 if (isoMap3.isValid()){
00536
00537 edm::ValueMap<bool> ::value_type muon1IsIsolated = (*isoMap3)[tk];
00538 muonl3iso[imu3c] = muon1IsIsolated;
00539 }
00540 else {muonl3iso[imu3c] = -999;}
00541
00542 if (isoTrk10Map3.isValid()){
00543
00544 edm::ValueMap<bool> ::value_type muon1IsTrk10Isolated = (*isoTrk10Map3)[tk];
00545 muonl3trk10iso[imu3c] = muon1IsTrk10Isolated;
00546 }
00547 else {muonl3trk10iso[imu3c] =-999;}
00548
00549
00550 int imu3c2nd = imu3c + 1;
00551
00552 for (cand j=i; j!=myMucands3.end(); j++) if (i!=j) {
00553 reco::TrackRef tk2nd = j->get<reco::TrackRef>();
00554 reco::TransientTrack transMu1(*tk, &(*theMagField) );
00555 reco::TransientTrack transMu2(*tk2nd, &(*theMagField) );
00556 TrajectoryStateClosestToPoint mu1TS = transMu1.impactPointTSCP();
00557 TrajectoryStateClosestToPoint mu2TS = transMu2.impactPointTSCP();
00558 if (mu1TS.isValid() && mu2TS.isValid()) {
00559 ClosestApproachInRPhi cApp;
00560 cApp.calculate(mu1TS.theState(), mu2TS.theState());
00561 if (cApp.status()) {
00562 dimudca[idimuc] = cApp.distance();
00563 dimu1st[idimuc] = imu3c;
00564 dimu2nd[idimuc] = imu3c2nd;
00565 idimuc++;
00566 }
00567 }
00568 imu3c2nd++;
00569 }
00570
00571 imu3c++;
00572 k++;
00573 }
00574 nDiMu = idimuc;
00575 }
00576
00577 else {nmu3cand = 0; nDiMu = 0;}
00578
00579 reco::VertexCollection myDimuvtxcands3;
00580 if (DiMuVtxCands3.isValid()) {
00581 myDimuvtxcands3 = * DiMuVtxCands3;
00582 nDiMuVtx = myDimuvtxcands3.size();
00583 typedef reco::VertexCollection::const_iterator cand;
00584 int idimu3c=0;
00585 for (cand ivtx = myDimuvtxcands3.begin(); ivtx != myDimuvtxcands3.end(); ++ivtx) {
00586 dimuvtxchi2[idimu3c] = ivtx->normalizedChi2();
00587 reco::Vertex::trackRef_iterator trackIt = ivtx->tracks_begin();
00588 reco::TrackRef vertextkRef1 = (*trackIt).castTo<reco::TrackRef>();
00589 ++trackIt;
00590 reco::TrackRef vertextkRef2 = (*trackIt).castTo<reco::TrackRef>();
00591 dimuvtx2nd[idimu3c] = -1; dimuvtx1st[idimu3c] = -1;
00592 for (int j=0 ; j<nmu3cand ; j++){
00593 if(fabs(muonl3pt[j] - vertextkRef1->pt()) < 0.0001 && fabs(muonl3eta[j] - vertextkRef1->eta()) < 0.0001 && fabs(muonl3phi[j] - vertextkRef1->phi()) < 0.0001) dimuvtx1st[idimu3c] = j;
00594 if(fabs(muonl3pt[j] - vertextkRef2->pt()) < 0.0001 && fabs(muonl3eta[j] - vertextkRef2->eta()) < 0.0001 && fabs(muonl3phi[j] - vertextkRef2->phi()) < 0.0001) dimuvtx2nd[idimu3c] = j;
00595 }
00596 math::XYZVector pperp(vertextkRef1->px() + vertextkRef2->px(),
00597 vertextkRef1->py() + vertextkRef2->py(),
00598 0.);
00599 reco::Vertex::Point vpoint = ivtx->position();
00600 GlobalPoint vtxPos (vpoint.x(), vpoint.y(), vpoint.z());
00601 reco::Vertex::Error verr = ivtx->error();
00602 GlobalError vtxErr (verr.At(0,0),verr.At(1,0),verr.At(1,1),verr.At(2,0),verr.At(2,1),verr.At(2,2));
00603 GlobalPoint vtxDisFromBS(-1*((vtxBS.x0() - vtxPos.x()) + (vtxPos.z() - vtxBS.z0())*vtxBS.dxdz()),
00604 -1*((vtxBS.y0() - vtxPos.y()) + (vtxPos.z() - vtxBS.z0())*vtxBS.dydz()), 0.0);
00605 dimuvtxr[idimu3c] = vtxDisFromBS.perp();
00606 dimuvtxrsig[idimu3c] = sqrt(vtxErr.rerr(vtxDisFromBS));
00607 dimuvtxroversig[idimu3c] = dimuvtxr[idimu3c]/dimuvtxrsig[idimu3c];
00608 reco::Vertex::Point vperp(vtxDisFromBS.x(),vtxDisFromBS.y(),0.);
00609 dimuvtxcosalpha[idimu3c] = vperp.Dot(pperp)/(vperp.R()*pperp.R());
00610 float mu1ip = -1.0;
00611 float mu2ip = -1.0;
00612 float mu1ipsig = -1.0;
00613 float mu2ipsig = -1.0;
00614 reco::TransientTrack transMu1(*vertextkRef1, &(*theMagField) );
00615 TrajectoryStateClosestToPoint trajMu1BS = transMu1.trajectoryStateClosestToPoint(theBeamSpot);
00616 if(trajMu1BS.isValid()){
00617 mu1ip = fabs(trajMu1BS.perigeeParameters().transverseImpactParameter());
00618 if(trajMu1BS.hasError()) mu1ipsig = mu1ip/trajMu1BS.perigeeError().transverseImpactParameterError();
00619 }
00620 reco::TransientTrack transMu2(*vertextkRef2, &(*theMagField) );
00621 TrajectoryStateClosestToPoint trajMu2BS = transMu2.trajectoryStateClosestToPoint(theBeamSpot);
00622 if(trajMu2BS.isValid()){
00623 mu2ip = fabs(trajMu2BS.perigeeParameters().transverseImpactParameter());
00624 if(trajMu2BS.hasError()) mu2ipsig = mu2ip/trajMu2BS.perigeeError().transverseImpactParameterError();
00625 }
00626 dimuvtxmu2dipmax[idimu3c] = fmax(mu1ip,mu2ip);
00627 dimuvtxmu2dipmin[idimu3c] = fmin(mu1ip,mu2ip);
00628 dimuvtxmu2dipsigmax[idimu3c] = fmax(mu1ipsig,mu2ipsig);
00629 dimuvtxmu2dipsigmin[idimu3c] = fmin(mu1ipsig,mu2ipsig);
00630 }
00631
00632
00633 }
00634 else {nDiMuVtx = 0;}
00635
00636
00637
00638 reco::RecoChargedCandidateCollection muNoVtxMucands2;
00639 if (MuNoVtxCands2.isValid()) {
00640 muNoVtxMucands2 = * MuNoVtxCands2;
00641 std::sort(muNoVtxMucands2.begin(),muNoVtxMucands2.end(),PtGreater());
00642 nmu2cand = muNoVtxMucands2.size();
00643 typedef reco::RecoChargedCandidateCollection::const_iterator cand;
00644 int imu2c=0;
00645 for (cand i=muNoVtxMucands2.begin(); i!=muNoVtxMucands2.end(); i++) {
00646 reco::TrackRef tk = i->get<reco::TrackRef>();
00647
00648 muonl2novtxpt[imu2c] = tk->pt();
00649 muonl2novtxeta[imu2c] = tk->eta();
00650 muonl2novtxphi[imu2c] = tk->phi();
00651 muonl2novtxdr[imu2c] = fabs(tk->dxy(BSPosition));
00652 muonl2novtxdrsign[imu2c] = ( tk->dxyError() > 0. ? muonl2novtxdr[imu2c] / tk->dxyError() : 999. );
00653 muonl2novtxdz[imu2c] = tk->dz(BSPosition);
00654 muonl2novtxnhits[imu2c] = tk->numberOfValidHits();
00655 muonl2novtxnchambers[imu2c] = validChambers(tk);
00656 muonl2novtxnstat[imu2c] = tk->hitPattern().muonStationsWithAnyHits();
00657 muonl2novtxndtcscstat[imu2c] = tk->hitPattern().dtStationsWithAnyHits() + tk->hitPattern().cscStationsWithAnyHits();
00658
00659 double l2_err0 = tk->error(0);
00660 double l2_abspar0 = fabs(tk->parameter(0));
00661
00662 muonl2novtxpterr[imu2c] = l2_err0/l2_abspar0;
00663 muonl2novtxchg[imu2c] = tk->charge();
00664
00665 l1extra::L1MuonParticleRef l1;
00666 int il2 = 0;
00667
00668 l1 = tk->seedRef().castTo<edm::Ref< L2MuonTrajectorySeedCollection> >()->l1Particle();
00669 il2++;
00670 int imu1idx = 0;
00671 if (MuCands1.isValid()) {
00672 typedef l1extra::L1MuonParticleCollection::const_iterator candl1;
00673 for (candl1 j=myMucands1.begin(); j!=myMucands1.end(); j++) {
00674 if((j->pt() == l1->pt()) &&
00675 (j->eta() == l1->eta()) &&
00676 (j->phi() == l1->phi()) &&
00677 (j->gmtMuonCand().quality() == l1->gmtMuonCand().quality()))
00678 {break;}
00679 imu1idx++;
00680 }
00681 }
00682 else {imu1idx = -999;}
00683 muonl2novtx1idx[imu2c] = imu1idx;
00684
00685 imu2c++;
00686 }
00687 }
00688 else {nmu2cand = 0;}
00689
00690
00691
00692
00693 reco::RecoChargedCandidateCollection myOniaPixelCands;
00694 if (oniaPixelCands.isValid()) {
00695 myOniaPixelCands = * oniaPixelCands;
00696 std::sort(myOniaPixelCands.begin(),myOniaPixelCands.end(),PtGreater());
00697 nOniaPixelCand = myOniaPixelCands.size();
00698 typedef reco::RecoChargedCandidateCollection::const_iterator cand;
00699 int ic=0;
00700 for (cand i=myOniaPixelCands.begin(); i!=myOniaPixelCands.end(); i++) {
00701 reco::TrackRef tk = i->get<reco::TrackRef>();
00702
00703 oniaPixelpt[ic] = tk->pt();
00704 oniaPixeleta[ic] = tk->eta();
00705 oniaPixelphi[ic] = tk->phi();
00706 oniaPixeldr[ic] = tk->dxy(BSPosition);
00707 oniaPixeldz[ic] = tk->dz(BSPosition);
00708 oniaPixelchg[ic] = tk->charge();
00709 oniaPixelHits[ic] = tk->numberOfValidHits();
00710 oniaPixelNormChi2[ic] = tk->normalizedChi2();
00711
00712 ic++;
00713 }
00714 }
00715 else {nOniaPixelCand = 0;}
00716
00717
00718 reco::RecoChargedCandidateCollection myOniaTrackCands;
00719 if (oniaTrackCands.isValid()) {
00720 myOniaTrackCands = * oniaTrackCands;
00721 std::sort(myOniaTrackCands.begin(),myOniaTrackCands.end(),PtGreater());
00722 nOniaTrackCand = myOniaTrackCands.size();
00723 typedef reco::RecoChargedCandidateCollection::const_iterator cand;
00724 int ic=0;
00725 for (cand i=myOniaTrackCands.begin(); i!=myOniaTrackCands.end(); i++) {
00726 reco::TrackRef tk = i->get<reco::TrackRef>();
00727
00728 oniaTrackpt[ic] = tk->pt();
00729 oniaTracketa[ic] = tk->eta();
00730 oniaTrackphi[ic] = tk->phi();
00731 oniaTrackdr[ic] = tk->dxy(BSPosition);
00732 oniaTrackdz[ic] = tk->dz(BSPosition);
00733 oniaTrackchg[ic] = tk->charge();
00734 oniaTrackHits[ic] = tk->numberOfValidHits();
00735 oniaTrackNormChi2[ic] = tk->normalizedChi2();
00736
00737 ic++;
00738 }
00739 }
00740 else {nOniaTrackCand = 0;}
00741
00742
00743
00744 if(trkmucands.isValid()) {
00745 int itrackermuc=0;
00746 for ( unsigned int i=0; i<trkmucands->size(); ++i ){
00747 const reco::Muon& muon(trkmucands->at(i));
00748 if (muon.isTrackerMuon()) {
00749 trackermuonpt[itrackermuc] = muon.pt();
00750 trackermuoneta[itrackermuc] = muon.eta();
00751 trackermuonphi[itrackermuc] = muon.phi();
00752 trackermuonchg[itrackermuc] = muon.charge();
00753 if ( !muon.innerTrack().isNull() ){
00754 trackermuonnhits[itrackermuc] = muon.innerTrack()->numberOfValidHits();
00755 }
00756 itrackermuc++;
00757 }
00758 }
00759 ntrackermuoncand=itrackermuc;
00760 }
00761 else {ntrackermuoncand = 0;}
00762
00764
00765 if (pfMuon.isValid()) {
00766 reco::PFCandidateCollection mypfmuons;
00767 mypfmuons = * pfMuon;
00768 std::sort(mypfmuons.begin(),mypfmuons.end(),PtGreater());
00769 npfmuon = mypfmuons.size();
00770 typedef reco::PFCandidateCollection::const_iterator muiter;
00771 int ipfmu=0;
00772 for (muiter i=mypfmuons.begin(); i!=mypfmuons.end(); i++)
00773 {
00774 pfmuonpt[ipfmu] = i->pt();
00775 pfmuonphi[ipfmu] = i->phi();
00776 pfmuoneta[ipfmu] = i->eta();
00777 pfmuonet[ipfmu] = i->et();
00778 pfmuone[ipfmu] = i->energy();
00779 pfmuoncharge[ipfmu] = i->charge();
00780
00781 ipfmu++;
00782 }
00783 }
00784 else {npfmuon = 0;}
00785
00786 }
00787
00788 int HLTMuon::validChambers(const reco::TrackRef & track)
00789 {
00790
00791 std::map<uint32_t,int> DTchambers;
00792 std::map<uint32_t,int> CSCchambers;
00793
00794 for (trackingRecHit_iterator hit = track->recHitsBegin(); hit != track->recHitsEnd(); ++hit) {
00795 if( !((*hit)->isValid()) ) continue;
00796
00797 DetId id = (*hit)->geographicalId();
00798
00799 if (id.det() == DetId::Muon && id.subdetId() == MuonSubdetId::DT) {
00800
00801 uint32_t index = DTChamberId(id).rawId();
00802
00803 if (DTchambers.find(index) == DTchambers.end()) {
00804 DTchambers[index] = 0;
00805 }
00806 DTchambers[index]++;
00807 }
00808
00809 else if (id.det() == DetId::Muon && id.subdetId() == MuonSubdetId::CSC) {
00810
00811 CSCDetId id2(id);
00812 uint32_t index = CSCDetId(id2.endcap(), id2.station(), id2.ring(), id2.chamber(), 0);
00813
00814 if (CSCchambers.find(index) == CSCchambers.end()) {
00815 CSCchambers[index] = 0;
00816 }
00817 CSCchambers[index]++;
00818 }
00819 }
00820
00821
00822 int validChambers = 0;
00823
00824 int minDThits = 1;
00825 int minCSChits = 1;
00826
00827 for (std::map<uint32_t,int>::const_iterator iter = DTchambers.begin(); iter != DTchambers.end(); ++iter) {
00828 if (iter->second >= minDThits) {
00829 validChambers++;
00830 }
00831 }
00832 for (std::map<uint32_t,int>::const_iterator iter = CSCchambers.begin(); iter != CSCchambers.end(); ++iter) {
00833 if (iter->second >= minCSChits) {
00834 validChambers++;
00835 }
00836 }
00837 return validChambers;
00838 }