00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #include "DQMOffline/Muon/interface/MuonIsolationDQM.h"
00026
00027
00028 #include <memory>
00029 #include <string>
00030 #include <typeinfo>
00031 #include <utility>
00032
00033
00034 #include "TH1.h"
00035 #include "TH2.h"
00036 #include "TProfile.h"
00037
00038
00039 #include "FWCore/Framework/interface/MakerMacros.h"
00040 #include "FWCore/Framework/interface/Event.h"
00041 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00042
00043
00044 #include "DataFormats/TrackReco/interface/Track.h"
00045
00046 #include "DataFormats/VertexReco/interface/Vertex.h"
00047 #include "DataFormats/VertexReco/interface/VertexFwd.h"
00048
00049
00050 using std::vector;
00051 using std::pair;
00052 using std::string;
00053
00054 using namespace std;
00055
00056
00057
00058 MuonIsolationDQM::MuonIsolationDQM(const edm::ParameterSet& iConfig){
00059 #ifdef DEBUG
00060 cout << " Initialise Constructor " << endl;
00061 #endif
00062 requireSTAMuon = iConfig.getUntrackedParameter<bool>("requireSTAMuon");
00063 requireTRKMuon = iConfig.getUntrackedParameter<bool>("requireTRKMuon");
00064 requireGLBMuon = iConfig.getUntrackedParameter<bool>("requireGLBMuon");
00065 dirName = iConfig.getParameter<std::string>("directory");
00066
00067
00068 Muon_Tag = iConfig.getUntrackedParameter<edm::InputTag>("Global_Muon_Label");
00069 theVertexCollectionLabel = iConfig.getUntrackedParameter<edm::InputTag>("vertexLabel");
00070
00071
00072 nEvents = 0;
00073 nSTAMuons = 0;
00074 nTRKMuons = 0;
00075 nGLBMuons = 0;
00076
00077 InitStatics();
00078
00079
00080 dbe = 0;
00081 dbe = edm::Service<DQMStore>().operator->();
00082
00083
00084
00085 h_1D.resize(NUM_VARS);
00086 h_2D.resize(NUM_VARS_2D);
00087 h_1D_NVTX.resize(NUM_VARS_NVTX);
00088
00089 dbe->cd();
00090 }
00091
00092
00093
00094
00095 MuonIsolationDQM::~MuonIsolationDQM(){
00096 #ifdef DEBUG
00097 cout << "Calling destructor" << endl;
00098 #endif
00099
00100
00101 }
00102
00103
00104
00105
00106 void MuonIsolationDQM::InitStatics(){
00107 #ifdef DEBUG
00108 cout<< " InitStatistics() " << endl;
00109 #endif
00110
00111 S_BIN_WIDTH = 1.0;
00112 L_BIN_WIDTH = 2.0;
00113 LOG_BINNING_ENABLED = 1;
00114 NUM_LOG_BINS = 15;
00115 LOG_BINNING_RATIO = 1.1;
00116
00117
00118
00119
00120 title_sam = "";
00121 title_cone = "";
00122
00123
00124
00125
00126
00127 main_titles.resize(NUM_VARS);
00128 axis_titles.resize(NUM_VARS);
00129 names.resize(NUM_VARS);
00130 param.resize(NUM_VARS, vector<double>(3) );
00131 isContinuous.resize(NUM_VARS);
00132
00133 titles_2D.resize(NUM_VARS_2D);
00134 names_2D.resize(NUM_VARS_2D);
00135
00136 main_titles_NVtxs.resize(NUM_VARS_NVTX);
00137 axis_titles_NVtxs.resize(NUM_VARS_NVTX);
00138 names_NVtxs.resize(NUM_VARS_NVTX);
00139
00140 #ifdef DEBUG
00141 cout << "InitStatistics(): vectors resized " << endl;
00142 #endif
00143
00144 main_titles[0 ] = "Total Tracker Momentum, #Delta R = 0.3";
00145 main_titles[1 ] = "Total EM Cal Energy, #Delta R = 0.3";
00146 main_titles[2 ] = "Total Had Cal Energy, #Delta R = 0.3";
00147 main_titles[3 ] = "Total HO Cal Energy, #Delta R = 0.3";
00148 main_titles[4 ] = "Number of Tracker Tracks, #Delta R = 0.3";
00149 main_titles[5 ] = "Number of Jets around Muon, #Delta R = 0.3";
00150 main_titles[6 ] = "Tracker p_{T} within veto cone, #Delta R = 0.3";
00151 main_titles[7 ] = "EM E_{T} within veto cone, #Delta R = 0.3";
00152 main_titles[8 ] = "Had E_{T} within veto cone, #Delta R = 0.3";
00153 main_titles[9 ] = "HO E_{T} within veto cone, #Delta R = 0.3";
00154 main_titles[10] = "Average Momentum per Track, #Delta R = 0.3";
00155 main_titles[11] = "Weighted Energy, #Delta R = 0.3";
00156
00157 main_titles[12] = "Total Tracker Momentum, #Delta R = 0.5";
00158 main_titles[13] = "Total EM Cal Energy, #Delta R = 0.5";
00159 main_titles[14] = "Total Had Cal Energy, #Delta R = 0.5";
00160 main_titles[15] = "Total HO Cal Energy, #Delta R = 0.5";
00161 main_titles[16] = "Number of Tracker Tracks, #Delta R = 0.5";
00162 main_titles[17] = "Number of Jets around Muon, #Delta R = 0.5";
00163 main_titles[18] = "Tracker p_{T} within veto cone, #Delta R = 0.5";
00164 main_titles[19] = "EM E_{T} within veto cone, #Delta R = 0.5";
00165 main_titles[20] = "Had E_{T} within veto cone, #Delta R = 0.5";
00166 main_titles[21] = "HO E_{T} within veto cone, #Delta R = 0.5";
00167 main_titles[22] = "Average Momentum per Track, #Delta R = 0.5";
00168 main_titles[23] = "Weighted Energy, #Delta R = 0.5";
00169
00170
00171 main_titles[24 ] = "Relative Detector-Based Isolation, #Delta R = 0.3";
00172 main_titles[25 ] = "Relative Detector-Based Isolation, #Delta R = 0.5";
00173
00174
00175 main_titles[26 ] = "Sum PF Charged Hadron Pt, #Delta R = 0.3";
00176 main_titles[27 ] = "Sum PF Neutral Hadron Pt, #Delta R = 0.3";
00177 main_titles[28 ] = "Sum PF Photon Et, #Delta R = 0.3";
00178 main_titles[29 ] = "Sum PF Neutral Hadron Pt (Higher Pt threshold), #Delta R = 0.3";
00179 main_titles[30 ] = "Sum PF Photon Et (Higher Pt threshold), #Delta R = 0.3";
00180 main_titles[31 ] = "Sum PF Charged Particles Pt not from PV (for Pu corrections), #Delta R = 0.3";
00181
00182
00183 main_titles[32 ] = "Sum PF Charged Hadron Pt, #Delta R = 0.4";
00184 main_titles[33 ] = "Sum PF Neutral Hadron Pt, #Delta R = 0.4";
00185 main_titles[34 ] = "Sum PF Photon Et, #Delta R = 0.4";
00186 main_titles[35 ] = "Sum PF Neutral Hadron Pt (Higher Pt threshold), #Delta R = 0.4";
00187 main_titles[36 ] = "Sum PF Photon Et (Higher Pt threshold), #Delta R = 0.4";
00188 main_titles[37 ] = "Sum PF Charged Particles Pt not from PV (for Pu corrections), #Delta R = 0.4";
00189
00190 main_titles[38 ] = "Relative PF Isolation, #Delta R = 0.3";
00191 main_titles[39 ] = "Relative PF Isolation, #Delta R = 0.4";
00192
00193 main_titles[40 ] = "Relative PF Isolation (Higher Pt threshold), #Delta R = 0.3";
00194 main_titles[41 ] = "Relative PF Isolation (Higher Pt threshold), #Delta R = 0.4";
00195
00196 main_titles[42 ] = "Sum DR Isolation Profile for Charged Hadron, #Delta R = 0.4";
00197
00198 main_titles[43 ] = "Sum DR Isolation Profile for Neutral Hadron, #Delta R = 0.4";
00199
00200 main_titles[44 ] = "Sum DR Isolation Profile for Photon, #Delta R = 0.4";
00201
00202 main_titles[45 ] = "Mean DR Isolation Profile for Charged Hadron, #Delta R = 0.4";
00203
00204 main_titles[46 ] = "Mean DR Isolation Profile for Neutral Hadron, #Delta R = 0.4";
00205
00206 main_titles[47 ] = "Mean DR Isolation Profile for Photon, #Delta R = 0.4";
00207
00208
00209
00210
00211 #ifdef DEBUG
00212 cout << "InitStatistics(): main titles 1D DONE " << endl;
00213 #endif
00214 titles_2D[0] = "Total Tracker Momentum, #Delta R = 0.3";
00215 titles_2D[1] = "Total EM Cal Energy, #Delta R = 0.3";
00216 titles_2D[2] = "Total Had Cal Energy, #Delta R = 0.3";
00217 titles_2D[3] = "Total HO Cal Energy, #Delta R = 0.3";
00218 titles_2D[4] = "Sum PF Charged Hadron Pt, #Delta R = 0.4";
00219 titles_2D[5] = "Sum PF Neutral Hadron Pt, #Delta R = 0.4";
00220 titles_2D[6] = "Sum PF Photon Et, #Delta R = 0.4";
00221 titles_2D[7] = "Sum PF Charged Pt Not from PV, #Delta R = 0.4";
00222 titles_2D[8] = "Relative Detector-Based Isolation, #Delta R = 0.4";
00223 titles_2D[9] = "Relative PF Isolation, #Delta R = 0.4";
00224
00225
00226 main_titles_NVtxs[0] = "Sum PF Neutral Hadron Pt, #DeltaR = 0.4 ( 0 < N_{Vtx} < 15)";
00227 main_titles_NVtxs[1] = "Sum PF Neutral Hadron Pt, #DeltaR = 0.4 (15 < N_{Vtx} < 30)";
00228 main_titles_NVtxs[2] = "Sum PF Neutral Hadron Pt, #DeltaR = 0.4 (30 < N_{Vtx})";
00229 main_titles_NVtxs[3] = "Sum PF Photon Et, #DeltaR = 0.4 ( 0 < N_{Vtx} < 15)";
00230 main_titles_NVtxs[4] = "Sum PF Photon Et, #DeltaR = 0.4 (15 < N_{Vtx} < 30)";
00231 main_titles_NVtxs[5] = "Sum PF Photon Et, #DeltaR = 0.4 (30 < N_{Vtx})";
00232
00233
00234 #ifdef DEBUG
00235 cout << "InitStatistics(): main titles 2D DONE " << endl;
00236 #endif
00237
00238
00239 axis_titles[0 ] = "#Sigma p_{T} (GeV)";
00240 axis_titles[1 ] = "#Sigma E_{T}^{EM} (GeV)";
00241 axis_titles[2 ] = "#Sigma E_{T}^{Had} (GeV)";
00242 axis_titles[3 ] = "#Sigma E_{T}^{HO} (GeV)";
00243 axis_titles[4 ] = "N_{Tracks}";
00244 axis_titles[5 ] = "N_{Jets}";
00245 axis_titles[6 ] = "#Sigma p_{T,veto} (GeV)";
00246 axis_titles[7 ] = "#Sigma E_{T,veto}^{EM} (GeV)";
00247 axis_titles[8 ] = "#Sigma E_{T,veto}^{Had} (GeV)";
00248 axis_titles[9 ] = "#Sigma E_{T,veto}^{HO} (GeV)";
00249 axis_titles[10] = "#Sigma p_{T} / N_{Tracks} (GeV)";
00250 axis_titles[11] = "(1.5) X #Sigma E_{T}^{EM} + #Sigma E_{T}^{Had}";
00251
00252 axis_titles[12] = "#Sigma p_{T} (GeV)";
00253 axis_titles[13] = "#Sigma E_{T}^{EM} (GeV)";
00254 axis_titles[14] = "#Sigma E_{T}^{Had} (GeV)";
00255 axis_titles[15] = "#Sigma E_{T}^{HO} (GeV)";
00256 axis_titles[16] = "N_{Tracks}";
00257 axis_titles[17] = "N_{Jets}";
00258 axis_titles[18] = "#Sigma p_{T,veto} (GeV)";
00259 axis_titles[19] = "#Sigma E_{T,veto}^{EM} (GeV)";
00260 axis_titles[20] = "#Sigma E_{T,veto}^{Had} (GeV)";
00261 axis_titles[21] = "#Sigma E_{T,veto}^{HO} (GeV)";
00262 axis_titles[22] = "#Sigma p_{T} / N_{Tracks} (GeV)";
00263 axis_titles[23] = "(1.5) X #Sigma E_{T}^{EM} + #Sigma E_{T}^{Had}";
00264
00265 axis_titles[24] = "(#Sigma Tk p_{T} + #Sigma ECAL p_{T} + #Sigma HCAL p_{T})/ Mu p_{T} (GeV)";
00266 axis_titles[25] = "(#Sigma Tk p_{T} + #Sigma ECAL p_{T} + #Sigma HCAL p_{T})/ Mu p_{T} (GeV)";
00267
00268 axis_titles[26] = "#Sigma PFCharged p_{T}";
00269 axis_titles[27] = "#Sigma PFNeutral p_{T}";
00270 axis_titles[28] = "#Sigma PFPhoton p_{T}";
00271 axis_titles[29] = "#Sigma PFNeutral p_{T}";
00272 axis_titles[30] = "#Sigma PFPhoton p_{T}";
00273 axis_titles[31] = "#Sigma PFCharged p_{T}";
00274
00275 axis_titles[32] = "#Sigma PFCharged p_{T}";
00276 axis_titles[33] = "#Sigma PFNeutral p_{T}";
00277 axis_titles[34] = "#Sigma PFPhoton p_{T}";
00278 axis_titles[35] = "#Sigma PFNeutral p_{T}";
00279 axis_titles[36] = "#Sigma PFPhoton p_{T}";
00280 axis_titles[37] = "#Sigma PFCharged p_{T}";
00281
00282 axis_titles[38] = "(#Sigma PFCharged p_{T} + #Sigma PFNeutral p_{T} + #Sigma PFPhoton p_{T}) Mu p_{T} (GeV)";
00283 axis_titles[39] = "(#Sigma PFCharged p_{T} + #Sigma PFNeutral p_{T} + #Sigma PFPhoton p_{T}) Mu p_{T} (GeV)";
00284 axis_titles[40] = "(#Sigma PFCharged p_{T} + #Sigma PFNeutral p_{T} + #Sigma PFPhoton p_{T}) Mu p_{T} (GeV)";
00285 axis_titles[41] = "(#Sigma PFCharged p_{T} + #Sigma PFNeutral p_{T} + #Sigma PFPhoton p_{T}) Mu p_{T} (GeV)";
00286
00287 axis_titles[42] = "#Sigma DR PFCharged";
00288 axis_titles[43] = "#Sigma DR PFNeutral";
00289 axis_titles[44] = "#Sigma DR PFPhoton";
00290
00291 axis_titles[45] = "Mean DR PFCharged";
00292 axis_titles[46] = "Mean DR PFNeutral";
00293 axis_titles[47] = "Mean DR PFPhoton";
00294
00295
00296
00297
00298 axis_titles_NVtxs[0] = "#Sigma PFNeutral p_{T}";
00299 axis_titles_NVtxs[1] = "#Sigma PFNeutral p_{T}";
00300 axis_titles_NVtxs[2] = "#Sigma PFNeutral p_{T}";
00301 axis_titles_NVtxs[3] = "#Sigma PFPhoton p_{T}";
00302 axis_titles_NVtxs[4] = "#Sigma PFPhoton p_{T}";
00303 axis_titles_NVtxs[5] = "#Sigma PFPhoton p_{T}";
00304
00305 #ifdef DEBUG
00306 cout << "InitStatistics(): main titles 1D DONE " << endl;
00307 #endif
00308
00309
00310 names[0 ] = "sumPt_R03";
00311 names[1 ] = "emEt_R03";
00312 names[2 ] = "hadEt_R03";
00313 names[3 ] = "hoEt_R03";
00314 names[4 ] = "nTracks_R03";
00315 names[5 ] = "nJets_R03";
00316 names[6 ] = "trackerVetoPt_R03";
00317 names[7 ] = "emVetoEt_R03";
00318 names[8 ] = "hadVetoEt_R03";
00319 names[9 ] = "hoVetoEt_R03";
00320 names[10] = "avgPt_R03";
00321 names[11] = "weightedEt_R03";
00322
00323 names[12] = "sumPt_R05";
00324 names[13] = "emEt_R05";
00325 names[14] = "hadEt_R05";
00326 names[15] = "hoEt_R05";
00327 names[16] = "nTracks_R05";
00328 names[17] = "nJets_R05";
00329 names[18] = "trackerVetoPt_R05";
00330 names[19] = "emVetoEt_R05";
00331 names[20] = "hadVetoEt_R05";
00332 names[21] = "hoVetoEt_R05";
00333 names[22] = "avgPt_R05";
00334 names[23] = "weightedEt_R05";
00335
00336 names[24] = "relDetIso_R03";
00337 names[25] = "relDetIso_R05";
00338
00339 names[26] = "pfChargedPt_R03";
00340 names[27] = "pfNeutralPt_R03";
00341 names[28] = "pfPhotonPt_R03";
00342 names[29] = "pfNeutralPt_HT_R03";
00343 names[30] = "pfPhotonPt_HT_R03";
00344 names[31] = "pfChargedPt_PU_R03";
00345
00346 names[32] = "pfChargedPt_R04";
00347 names[33] = "pfNeutralPt_R04";
00348 names[34] = "pfPhotonPt_R04";
00349 names[35] = "pfNeutralPt_HT_R04";
00350 names[36] = "pfPhotonPt_HT_R04";
00351 names[37] = "pfChargedPt_PU_R04";
00352
00353 names[38] = "relPFIso_R03";
00354 names[39] = "relPFIso_R04";
00355
00356 names[40] = "relPFIso_HT_R03";
00357 names[41] = "relPFIso_HT_R04";
00358
00359 names[42] = "SumDR_PFCharged_R04";
00360 names[43] = "SumDR_PFNeutral_R04";
00361 names[44] = "SumDR_PFPhoton_R04";
00362
00363 names[45] = "MeanDR_PFCharged_R04";
00364 names[46] = "MeanDR_PFNeutral_R04";
00365 names[47] = "MeanDR_PFPhoton_R04";
00366
00367
00368
00369 #ifdef DEBUG
00370 cout << "InitStatistics(): names 1D DONE " << endl;
00371 #endif
00372
00373 names_2D[0] = "SumPt_R03" ;
00374 names_2D[1] = "emEt_R03" ;
00375 names_2D[2] = "hadEt_R03" ;
00376 names_2D[3] = "hoEt_R03" ;
00377 names_2D[4] = "pfChargedPt_R04" ;
00378 names_2D[5] = "pfNeutralPt_R04" ;
00379 names_2D[6] = "pfPhotonPt_R04" ;
00380 names_2D[7] = "pfChargedPUPt_R04" ;
00381 names_2D[8] = "relDetIso_R03" ;
00382 names_2D[9] = "relPFIso_R04" ;
00383
00384 #ifdef DEBUG
00385 cout << "InitStatistics(): names 2D DONE " << endl;
00386 #endif
00387
00388 names_NVtxs[0] = "pfNeutralPt_R04_PV0to15";
00389 names_NVtxs[1] = "pfNeutralPt_R04_PV15to30";
00390 names_NVtxs[2] = "pfNeutralPt_R04_PV30toInf";
00391 names_NVtxs[3] = "pfPhotonPt_R04_PV0to15";
00392 names_NVtxs[4] = "pfPhotonPt_R04_PV15to30";
00393 names_NVtxs[5] = "pfPhotonPt_R04_PV30toInf";
00394
00395
00396
00397
00398
00399
00400
00401
00402
00403 param[0 ][0]= (int)( 20.0/S_BIN_WIDTH); param[0 ][1]= 0.0; param[0 ][2]= param[0 ][0]*S_BIN_WIDTH;
00404 param[1 ][0]= (int)( 20.0/S_BIN_WIDTH); param[1 ][1]= 0.0; param[1 ][2]= param[1 ][0]*S_BIN_WIDTH;
00405 param[2 ][0]= (int)( 20.0/S_BIN_WIDTH); param[2 ][1]= 0.0; param[2 ][2]= param[2 ][0]*S_BIN_WIDTH;
00406 param[3 ][0]= 20; param[3 ][1]= 0.0; param[3 ][2]= 2.0;
00407 param[4 ][0]= 16; param[4 ][1]= -0.5; param[4 ][2]= param[4 ][0]-0.5;
00408 param[5 ][0]= 4; param[5 ][1]= -0.5; param[5 ][2]= param[5 ][0]-0.5;
00409 param[6 ][0]= (int)( 40.0/S_BIN_WIDTH); param[6 ][1]= 0.0; param[6 ][2]= param[6 ][0]*S_BIN_WIDTH;
00410 param[7 ][0]= 20; param[7 ][1]= 0.0; param[7 ][2]= 10.0;
00411 param[8 ][0]= (int)( 20.0/S_BIN_WIDTH); param[8 ][1]= 0.0; param[8 ][2]= param[8 ][0]*S_BIN_WIDTH;
00412 param[9 ][0]= 20; param[9 ][1]= 0.0; param[9 ][2]= 5.0;
00413 param[10][0]= (int)( 15.0/S_BIN_WIDTH); param[10][1]= 0.0; param[10][2]= param[10][0]*S_BIN_WIDTH;
00414 param[11][0]= (int)( 20.0/S_BIN_WIDTH); param[11][1]= 0.0; param[11][2]= param[11][0]*S_BIN_WIDTH;
00415
00416 param[12][0]= (int)( 20.0/S_BIN_WIDTH); param[12][1]= 0.0; param[12][2]= param[12][0]*S_BIN_WIDTH;
00417 param[13][0]= (int)( 20.0/S_BIN_WIDTH); param[13][1]= 0.0; param[13][2]= param[13][0]*S_BIN_WIDTH;
00418 param[14][0]= (int)( 20.0/S_BIN_WIDTH); param[14][1]= 0.0; param[14][2]= param[14][0]*S_BIN_WIDTH;
00419 param[15][0]= 20; param[15][1]= 0.0; param[15][2]= 2.0;
00420 param[16][0]= 16; param[16][1]= -0.5; param[16][2]= param[16][0]-0.5;
00421 param[17][0]= 4; param[17][1]= -0.5; param[17][2]= param[17][0]-0.5;
00422 param[18][0]= (int)( 40.0/S_BIN_WIDTH); param[18][1]= 0.0; param[18][2]= param[18][0]*S_BIN_WIDTH;
00423 param[19][0]= 20; param[19][1]= 0.0; param[19][2]= 10.0;
00424 param[20][0]= (int)( 20.0/S_BIN_WIDTH); param[20][1]= 0.0; param[20][2]= param[20][0]*S_BIN_WIDTH;
00425 param[21][0]= 20; param[21][1]= 0.0; param[21][2]= 5.0;
00426 param[22][0]= (int)( 15.0/S_BIN_WIDTH); param[22][1]= 0.0; param[22][2]= param[22][0]*S_BIN_WIDTH;
00427 param[23][0]= (int)( 20.0/S_BIN_WIDTH); param[23][1]= 0.0; param[23][2]= param[23][0]*S_BIN_WIDTH;
00428
00429 param[24][0]= 50; param[24][1]= 0.0; param[24][2]= 1.0;
00430 param[25][0]= 50; param[25][1]= 0.0; param[25][2]= 1.0;
00431
00432
00433 param[26 ][0]= (int)( 20.0/S_BIN_WIDTH); param[26 ][1]= 0.0; param[26 ][2]= param[26 ][0]*S_BIN_WIDTH;
00434 param[27 ][0]= (int)( 20.0/S_BIN_WIDTH); param[27 ][1]= 0.0; param[27 ][2]= param[27 ][0]*S_BIN_WIDTH;
00435 param[28 ][0]= (int)( 20.0/S_BIN_WIDTH); param[28 ][1]= 0.0; param[28 ][2]= param[28 ][0]*S_BIN_WIDTH;
00436 param[29 ][0]= (int)( 20.0/S_BIN_WIDTH); param[29 ][1]= 0.0; param[29 ][2]= param[29 ][0]*S_BIN_WIDTH;
00437 param[30 ][0]= (int)( 20.0/S_BIN_WIDTH); param[30 ][1]= 0.0; param[30 ][2]= param[30 ][0]*S_BIN_WIDTH;
00438 param[31 ][0]= (int)( 20.0/S_BIN_WIDTH); param[31 ][1]= 0.0; param[31 ][2]= param[31 ][0]*S_BIN_WIDTH;
00439
00440 param[32 ][0]= (int)( 20.0/S_BIN_WIDTH); param[32 ][1]= 0.0; param[32 ][2]= param[32 ][0]*S_BIN_WIDTH;
00441 param[33 ][0]= (int)( 20.0/S_BIN_WIDTH); param[33 ][1]= 0.0; param[33 ][2]= param[33 ][0]*S_BIN_WIDTH;
00442 param[34 ][0]= (int)( 20.0/S_BIN_WIDTH); param[34 ][1]= 0.0; param[34 ][2]= param[34 ][0]*S_BIN_WIDTH;
00443 param[35 ][0]= (int)( 20.0/S_BIN_WIDTH); param[35 ][1]= 0.0; param[35 ][2]= param[35 ][0]*S_BIN_WIDTH;
00444 param[36 ][0]= (int)( 20.0/S_BIN_WIDTH); param[36 ][1]= 0.0; param[36 ][2]= param[36 ][0]*S_BIN_WIDTH;
00445 param[37 ][0]= (int)( 20.0/S_BIN_WIDTH); param[37 ][1]= 0.0; param[37 ][2]= param[37 ][0]*S_BIN_WIDTH;
00446
00447 param[38][0]= 50; param[38][1]= 0.0; param[38][2]= 1.0;
00448 param[39][0]= 50; param[39][1]= 0.0; param[39][2]= 1.0;
00449
00450 param[40][0]= 50; param[40][1]= 0.0; param[40][2]= 1.0;
00451 param[41][0]= 50; param[41][1]= 0.0; param[41][2]= 1.0;
00452
00453 param[42][0]= 50; param[42][1]= 0.0; param[42][2]= 5;
00454 param[43][0]= 50; param[43][1]= 0.0; param[43][2]= 5;
00455 param[44][0]= 50; param[44][1]= 0.0; param[44][2]= 5;
00456
00457 param[45][0]= 50; param[45][1]= 0.0; param[45][2]= 0.4;
00458 param[46][0]= 50; param[46][1]= 0.0; param[46][2]= 0.4;
00459 param[47][0]= 50; param[47][1]= 0.0; param[47][2]= 0.4;
00460
00461
00462
00463
00464 isContinuous[0 ] = 1;
00465 isContinuous[1 ] = 1;
00466 isContinuous[2 ] = 1;
00467 isContinuous[3 ] = 1;
00468 isContinuous[4 ] = 0;
00469 isContinuous[5 ] = 0;
00470 isContinuous[6 ] = 1;
00471 isContinuous[7 ] = 1;
00472 isContinuous[8 ] = 1;
00473 isContinuous[9 ] = 1;
00474 isContinuous[10] = 1;
00475 isContinuous[11] = 1;
00476
00477 isContinuous[12] = 1;
00478 isContinuous[13] = 1;
00479 isContinuous[14] = 1;
00480 isContinuous[15] = 1;
00481 isContinuous[16] = 0;
00482 isContinuous[17] = 0;
00483 isContinuous[18] = 1;
00484 isContinuous[19] = 1;
00485 isContinuous[20] = 1;
00486 isContinuous[21] = 1;
00487 isContinuous[22] = 1;
00488 isContinuous[23] = 1;
00489
00490 isContinuous[24] = 1;
00491 isContinuous[25] = 1;
00492 isContinuous[26] = 1;
00493 isContinuous[27] = 1;
00494 isContinuous[28] = 1;
00495 isContinuous[29] = 1;
00496 isContinuous[30] = 1;
00497 isContinuous[31] = 1;
00498 isContinuous[32] = 1;
00499 isContinuous[33] = 1;
00500 isContinuous[34] = 1;
00501 isContinuous[35] = 1;
00502 isContinuous[36] = 1;
00503 isContinuous[37] = 1;
00504 isContinuous[38] = 1;
00505 isContinuous[39] = 1;
00506 isContinuous[40] = 1;
00507 isContinuous[41] = 1;
00508 isContinuous[42] = 1;
00509 isContinuous[43] = 1;
00510 isContinuous[44] = 1;
00511 isContinuous[45] = 1;
00512 isContinuous[46] = 1;
00513 isContinuous[47] = 1;
00514
00515
00516 #ifdef DEBUG
00517 cout << "InitStatistics(): DONE " << endl;
00518 #endif
00519 }
00520
00521
00522
00523 void MuonIsolationDQM::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup){
00524
00525 ++nEvents;
00526 edm::LogInfo("Tutorial") << "\nInvestigating event #" << nEvents<<"\n";
00527
00528
00529 edm::Handle<edm::View<reco::Muon> > muonsHandle;
00530 iEvent.getByLabel(Muon_Tag, muonsHandle);
00531
00532
00533 edm::LogInfo("Tutorial") << "Number of Muons: " << muonsHandle->size();
00534 theMuonData = muonsHandle->size();
00535 h_nMuons->Fill(theMuonData);
00536
00537
00538 int _numPV = 0;
00539 edm::Handle<reco::VertexCollection> vertexHandle;
00540 iEvent.getByLabel(theVertexCollectionLabel, vertexHandle);
00541
00542 if (vertexHandle.isValid()){
00543 reco::VertexCollection vertex = *(vertexHandle.product());
00544 for (reco::VertexCollection::const_iterator v = vertex.begin(); v!=vertex.end(); ++v){
00545 if (v->isFake()) continue;
00546 if (v->ndof() < 4) continue;
00547 if (fabs(v->z()) > 24.0) continue;
00548 ++_numPV;
00549 }
00550 }
00551
00552
00553 uint iMuon=0;
00554 dbe->setCurrentFolder(dirName.c_str());
00555 for (MuonIterator muon = muonsHandle->begin(); muon != muonsHandle->end(); ++muon, ++iMuon ) {
00556
00557 if (requireSTAMuon && muon->isStandAloneMuon()) {
00558 ++nSTAMuons;
00559 RecordData(muon);
00560 FillHistos(_numPV);
00561 }
00562 else if (requireTRKMuon && muon->isTrackerMuon()) {
00563 ++nTRKMuons;
00564 RecordData(muon);
00565 FillHistos(_numPV);
00566 }
00567 else if (requireGLBMuon && muon->isGlobalMuon()) {
00568 ++nGLBMuons;
00569 RecordData(muon);
00570 FillHistos(_numPV);
00571 FillNVtxHistos(_numPV);
00572 }
00573 }
00574 dbe->cd();
00575
00576 }
00577
00578
00579 void MuonIsolationDQM::RecordData(MuonIterator muon){
00580 #ifdef DEBUG
00581 std::cout << "RecordData()" << endl;
00582 #endif
00583 float MuPt = muon->pt();
00584
00585 theData[0] = muon->isolationR03().sumPt;
00586 theData[1] = muon->isolationR03().emEt;
00587 theData[2] = muon->isolationR03().hadEt;
00588 theData[3] = muon->isolationR03().hoEt;
00589
00590 theData[4] = muon->isolationR03().nTracks;
00591 theData[5] = muon->isolationR03().nJets;
00592 theData[6] = muon->isolationR03().trackerVetoPt;
00593 theData[7] = muon->isolationR03().emVetoEt;
00594 theData[8] = muon->isolationR03().hadVetoEt;
00595 theData[9] = muon->isolationR03().hoVetoEt;
00596
00597
00598 if (theData[4] != 0) theData[10] = (double)theData[0] / (double)theData[4];
00599 else theData[10] = -99;
00600
00601 theData[11] = 1.5 * theData[1] + theData[2];
00602
00603 theData[12] = muon->isolationR05().sumPt;
00604 theData[13] = muon->isolationR05().emEt;
00605 theData[14] = muon->isolationR05().hadEt;
00606 theData[15] = muon->isolationR05().hoEt;
00607
00608 theData[16] = muon->isolationR05().nTracks;
00609 theData[17] = muon->isolationR05().nJets;
00610 theData[18] = muon->isolationR05().trackerVetoPt;
00611 theData[19] = muon->isolationR05().emVetoEt;
00612 theData[20] = muon->isolationR05().hadVetoEt;
00613 theData[21] = muon->isolationR05().hoVetoEt;
00614
00615
00616 if (theData[16] != 0) theData[22] = (double)theData[12] / (double)theData[16];
00617 else theData[22] = -99;
00618
00619 theData[23] = 1.5 * theData[13] + theData[14];
00620
00621 theData[24] = (theData[0]+theData[1]+theData[2]) / MuPt;
00622 theData[25] = (theData[12]+theData[13]+theData[14]) / MuPt;
00623
00624 theData[26] = muon->pfIsolationR03().sumChargedHadronPt;
00625 theData[27] = muon->pfIsolationR03().sumNeutralHadronEt;
00626 theData[28] = muon->pfIsolationR03().sumPhotonEt;
00627 theData[29] = muon->pfIsolationR03().sumNeutralHadronEtHighThreshold;
00628 theData[30] = muon->pfIsolationR03().sumPhotonEtHighThreshold;
00629 theData[31] = muon->pfIsolationR03().sumPUPt;
00630
00631 theData[32] = muon->pfIsolationR04().sumChargedHadronPt;
00632 theData[33] = muon->pfIsolationR04().sumNeutralHadronEt;
00633 theData[34] = muon->pfIsolationR04().sumPhotonEt;
00634 theData[35] = muon->pfIsolationR04().sumNeutralHadronEtHighThreshold;
00635 theData[36] = muon->pfIsolationR04().sumPhotonEtHighThreshold;
00636 theData[37] = muon->pfIsolationR04().sumPUPt;
00637
00638 theData[38] = (theData[26] + theData[27] + theData[28]) / MuPt;
00639 theData[39] = (theData[32] + theData[33] + theData[34]) / MuPt;
00640
00641 theData[40] = (theData[26] + theData[29] + theData[30]) / MuPt;
00642 theData[41] = (theData[32] + theData[35] + theData[36]) / MuPt;
00643
00644 theData[42] = muon->pfSumDRIsoProfileR04().sumChargedHadronPt;
00645 theData[43] = muon->pfSumDRIsoProfileR04().sumNeutralHadronEt;
00646 theData[44] = muon->pfSumDRIsoProfileR04().sumPhotonEt;
00647 theData[45] = muon->pfMeanDRIsoProfileR04().sumChargedHadronPt;
00648 theData[46] = muon->pfMeanDRIsoProfileR04().sumNeutralHadronEt;
00649 theData[47] = muon->pfMeanDRIsoProfileR04().sumPhotonEt;
00650
00651
00652
00653 theData2D[0] = muon->isolationR03().sumPt;
00654 theData2D[1] = muon->isolationR03().emEt;
00655 theData2D[2] = muon->isolationR03().hadEt;
00656 theData2D[3] = muon->isolationR03().hoEt;
00657
00658 theData2D[4] = muon->pfIsolationR04().sumChargedHadronPt;
00659 theData2D[5] = muon->pfIsolationR04().sumNeutralHadronEt;
00660 theData2D[6] = muon->pfIsolationR04().sumPhotonEt;
00661 theData2D[7] = muon->pfIsolationR04().sumPUPt;
00662
00663 theData2D[8] = theData2D[0] + theData2D[1] + theData2D[2] + theData2D[3] / MuPt;
00664 theData2D[9] = theData2D[4] + theData2D[5] + theData2D[6] / MuPt;
00665
00666
00667
00668 theDataNVtx[0] = muon->pfIsolationR04().sumNeutralHadronEt;
00669 theDataNVtx[1] = theDataNVtx[0];
00670 theDataNVtx[2] = theDataNVtx[0];
00671
00672 theDataNVtx[3] = muon->pfIsolationR04().sumPhotonEt;
00673 theDataNVtx[4] = theDataNVtx[3];
00674 theDataNVtx[5] = theDataNVtx[3];
00675 }
00676
00677
00678 void MuonIsolationDQM::beginJob(void) {
00679 edm::LogInfo("Tutorial") << "\n#########################################\n\n"
00680 << "Lets get started! "
00681 << "\n\n#########################################\n";
00682 dbe->setCurrentFolder(dirName.c_str());
00683 InitHistos();
00684 dbe->cd();
00685 }
00686
00687
00688 void MuonIsolationDQM::endJob() {
00689
00690 if( dbe ) {
00691
00692 if (! dbe->get(dirName+"/nMuons")) return;
00693 }
00694 else
00695 return;
00696
00697 edm::LogInfo("Tutorial") << "\n#########################################\n\n"
00698 << "Total Number of Events: " << nEvents
00699 << "\n\n#########################################\n"
00700 << "\nInitializing Histograms...\n";
00701
00702 edm::LogInfo("Tutorial") << "\nIntializing Finished. Filling...\n";
00703
00704 edm::LogInfo("Tutorial") << "\nFilled. Saving...\n";
00705
00706 edm::LogInfo("Tutorial") << "\nSaved. Peace, homie, I'm out.\n";
00707 }
00708 void MuonIsolationDQM::InitHistos(){
00709
00710 h_nMuons = dbe->book1D("nMuons", title_sam + "Number of Muons", 20, 0., 20.);
00711 h_nMuons->setAxisTitle("Number of Muons",XAXIS);
00712 h_nMuons->setAxisTitle("Fraction of Events",YAXIS);
00713
00714
00715 for(int var = 0; var < NUM_VARS; var++){
00716 h_1D[var] = dbe->book1D(names[var],
00717 title_sam + main_titles[var] + title_cone,
00718 (int)param[var][0],
00719 param[var][1],
00720 param[var][2]
00721 );
00722 h_1D[var]->setAxisTitle(axis_titles[var],XAXIS);
00723 GetTH1FromMonitorElement(h_1D[var])->Sumw2();
00724 }
00725
00726
00727 for (int var = 0; var<NUM_VARS_2D; var++){
00728 h_2D[var] = dbe->bookProfile(names_2D[var] + "_VsPV", titles_2D[var] + " Vs PV", 50, 0.5, 50.5, 20, 0.0, 20.0);
00729
00730 h_2D[var]->setAxisTitle("Number of PV", XAXIS);
00731 h_2D[var]->setAxisTitle(titles_2D[var] + " (GeV)" ,YAXIS);
00732 h_2D[var]->getTH1()->Sumw2();
00733 }
00734
00735
00736 for (int var=0; var<NUM_VARS_NVTX; var++){
00737 h_1D_NVTX[var] = dbe->book1D(names_NVtxs[var], main_titles_NVtxs[var], 50, 0.0, 10.0);
00738 h_1D_NVTX[var]->setAxisTitle(axis_titles_NVtxs[var],XAXIS);
00739 GetTH1FromMonitorElement(h_1D_NVTX[var])->Sumw2();
00740 }
00741 }
00742
00743 void MuonIsolationDQM::NormalizeHistos() {
00744 for(int var=0; var<NUM_VARS; var++){
00745 double entries = GetTH1FromMonitorElement(h_1D[var])->GetEntries();
00746 GetTH1FromMonitorElement(h_1D[var])->Scale(1./entries);
00747 }
00748 }
00749
00750 void MuonIsolationDQM::FillHistos(int numPV){
00751 #ifdef DEBUG
00752 cout << "FillHistos( "<< numPV <<" )"<< endl;
00753 #endif
00754 int overFlowBin;
00755 double overFlow = 0;
00756
00757
00758 for(int var=0; var<NUM_VARS; var++){
00759 h_1D[var]->Fill(theData[var]);
00760
00761 if (theData[var] > param[var][2]) {
00762
00763 overFlowBin = (int) param[var][0] + 1;
00764 overFlow = GetTH1FromMonitorElement(h_1D[var])->GetBinContent(overFlowBin);
00765 GetTH1FromMonitorElement(h_1D[var])->SetBinContent(overFlowBin, overFlow + 1);
00766 }
00767 }
00768
00769 for (int var=0; var<NUM_VARS_2D; var++){
00770 h_2D[var]->Fill(numPV,theData2D[var]);
00771 }
00772
00773 #ifdef DEBUG
00774 cout << "FillHistos( "<< numPV <<" ): DONE"<< endl;
00775 #endif
00776
00777 }
00778 void MuonIsolationDQM::FillNVtxHistos(int PV){
00779 if (PV < 15) { h_1D_NVTX[0]->Fill(theDataNVtx[0]); h_1D_NVTX[3]->Fill(theDataNVtx[3]); }
00780 if (PV >= 15 && PV < 30) { h_1D_NVTX[1]->Fill(theDataNVtx[1]); h_1D_NVTX[4]->Fill(theDataNVtx[4]); }
00781 if (PV >= 30) { h_1D_NVTX[2]->Fill(theDataNVtx[2]); h_1D_NVTX[5]->Fill(theDataNVtx[5]); }
00782 }
00783
00784 TH1* MuonIsolationDQM::GetTH1FromMonitorElement(MonitorElement* me) {
00785 return me->getTH1();
00786 }
00787
00788
00789 DEFINE_FWK_MODULE(MuonIsolationDQM);