00001 #include "DQM/Physics/src/EwkMuLumiMonitorDQM.h"
00002
00003 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00004 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00005 #include "DataFormats/Common/interface/Handle.h"
00006
00007 #include "FWCore/ServiceRegistry/interface/Service.h"
00008 #include "CommonTools/UtilAlgos/interface/TFileService.h"
00009
00010 #include "DQMServices/Core/interface/DQMStore.h"
00011 #include "DQMServices/Core/interface/MonitorElement.h"
00012
00013
00014
00015 #include "DataFormats/Common/interface/View.h"
00016 #include "DataFormats/Common/interface/Handle.h"
00017
00018 #include "DataFormats/RecoCandidate/interface/IsoDepositVetos.h"
00019 #include "DataFormats/RecoCandidate/interface/IsoDepositDirection.h"
00020
00021 #include "FWCore/Common/interface/TriggerNames.h"
00022 #include "FWCore/Framework/interface/Event.h"
00023 #include "DataFormats/Common/interface/TriggerResults.h"
00024 #include "DataFormats/HLTReco/interface/TriggerObject.h"
00025 #include "DataFormats/HLTReco/interface/TriggerEvent.h"
00026 #include "DataFormats/Math/interface/deltaR.h"
00027
00028 #include "DataFormats/METReco/interface/MET.h"
00029 #include "DataFormats/BeamSpot/interface/BeamSpot.h"
00030
00031 #include "DataFormats/Math/interface/LorentzVector.h"
00032
00033
00034 using namespace edm;
00035 using namespace std;
00036 using namespace reco;
00037 using namespace isodeposit;
00038
00039 EwkMuLumiMonitorDQM::EwkMuLumiMonitorDQM( const ParameterSet & cfg ) :
00040
00041 trigTag_(cfg.getUntrackedParameter<edm::InputTag> ("TrigTag", edm::InputTag("TriggerResults::HLT"))),
00042 trigEv_(cfg.getUntrackedParameter<edm::InputTag> ("triggerEvent")),
00043 muonTag_(cfg.getUntrackedParameter<edm::InputTag>("muons")),
00044 trackTag_(cfg.getUntrackedParameter<edm::InputTag>("tracks")),
00045 caloTowerTag_(cfg.getUntrackedParameter<edm::InputTag>("calotower")),
00046 metTag_(cfg.getUntrackedParameter<edm::InputTag> ("metTag")),
00047 metIncludesMuons_(cfg.getUntrackedParameter<bool> ("METIncludesMuons")),
00048
00049
00050
00051
00052
00053 ptMuCut_(cfg.getUntrackedParameter<double>("ptMuCut")),
00054 etaMuCut_(cfg.getUntrackedParameter<double>("etaMuCut")),
00055 isRelativeIso_(cfg.getUntrackedParameter<bool>("IsRelativeIso")),
00056 isCombinedIso_(cfg.getUntrackedParameter<bool>("IsCombinedIso")),
00057 isoCut03_(cfg.getUntrackedParameter<double>("IsoCut03")),
00058
00059 ptThreshold_(cfg.getUntrackedParameter<double>("ptThreshold")),
00060
00061 maxDPtRel_(cfg.getUntrackedParameter<double>("maxDPtRel")),
00062 maxDeltaR_(cfg.getUntrackedParameter<double>("maxDeltaR")),
00063 mtMin_(cfg.getUntrackedParameter<double>("mtMin")),
00064 mtMax_(cfg.getUntrackedParameter<double>("mtMax")),
00065 acopCut_(cfg.getUntrackedParameter<double>("acopCut")),
00066 dxyCut_(cfg.getUntrackedParameter<double>("DxyCut")) {
00067
00068 isValidHltConfig_ = false;
00069
00070 }
00071
00072
00073
00074 void EwkMuLumiMonitorDQM::beginRun(const Run& r, const EventSetup&iSetup) {
00075 nall = 0;
00076 nEvWithHighPtMu=0;
00077 nInKinRange= 0;
00078 nsel = 0;
00079 niso = 0;
00080 nhlt =0;
00081 n1hlt =0;
00082 n2hlt =0;
00083 nNotIso =0;
00084 nGlbSta =0;
00085 nGlbTrk =0;
00086 nTMass =0;
00087 nW=0;
00088
00089
00090 bool isConfigChanged = false;
00091
00092
00093 isValidHltConfig_ = hltConfigProvider_.init( r, iSetup, trigTag_.process(), isConfigChanged );
00094
00095
00096 }
00097
00098
00099 void EwkMuLumiMonitorDQM::beginJob() {
00100 theDbe = Service<DQMStore>().operator->();
00101 theDbe->setCurrentFolder("Physics/EwkMuLumiMonitorDQM");
00102
00103 init_histograms();
00104 }
00105
00106 void EwkMuLumiMonitorDQM::init_histograms() {
00107
00108 char chtitle[256] = "";
00109 for (int i=0; i<2; ++i) {
00110 snprintf(chtitle, 255, "Z mass [GeV/c^{2}]");
00111 mass2HLT_ = theDbe->book1D("Z_2HLT_MASS",chtitle,200,0.,200.);
00112 mass1HLT_ = theDbe->book1D("Z_1HLT_MASS",chtitle,200,0.,200.);
00113 massNotIso_ = theDbe->book1D("Z_NOTISO_MASS",chtitle,200,0.,200.);
00114 massGlbSta_ = theDbe->book1D("Z_GLBSTA_MASS",chtitle,200,0.,200.);
00115 massGlbTrk_ = theDbe->book1D("Z_GLBTRK_MASS",chtitle,200,0.,200.);
00116 massIsBothGlbTrkThanW_ = theDbe->book1D("Z_ISBOTHGLBTRKTHANW_MASS",chtitle,200,0.,200.);
00117
00118
00119 snprintf(chtitle, 255, "Z high mass [GeV/c^{2}]");
00120 highMass2HLT_ = theDbe->book1D("Z_2HLT_HIGHMASS",chtitle,2000,0.,2000.);
00121 highMass1HLT_ = theDbe->book1D("Z_1HLT_HIGHMASS",chtitle,2000,0.,2000.);
00122 highMassNotIso_ = theDbe->book1D("Z_NOTISO_HIGHMASS",chtitle,2000,0.,2000.);
00123 highMassGlbSta_ = theDbe->book1D("Z_GLBSTA_HIGHMASS",chtitle,2000,0.,2000.);
00124 highMassGlbTrk_ = theDbe->book1D("Z_GLBTRK_HIGHMASS",chtitle,2000,0.,2000.);
00125 highMassIsBothGlbTrkThanW_ = theDbe->book1D("Z_ISBOTHGLBTRKTHANW_HIGHMASS",chtitle,2000,0.,2000.);
00126
00127
00128
00129
00130
00131
00132
00133
00134
00135
00136
00137
00138
00139
00140
00141
00142 snprintf(chtitle, 255, "Transverse mass [GeV]" );
00143 TMass_ = theDbe->book1D("TMASS",chtitle,300,0.,300.);
00144
00145 }
00146 }
00147
00148
00149
00150 double EwkMuLumiMonitorDQM::muIso( const reco::Muon & mu ) {
00151 double isovar = mu.isolationR03().sumPt;
00152 if (isCombinedIso_) {
00153 isovar += mu.isolationR03().emEt;
00154 isovar += mu.isolationR03().hadEt;
00155 }
00156 if (isRelativeIso_) isovar /= mu.pt();
00157 return isovar;
00158 }
00159
00160 double EwkMuLumiMonitorDQM::tkIso( const reco::Track tk, Handle< TrackCollection > tracks , Handle<CaloTowerCollection> calotower ) {
00161 double ptSum = 0;
00162 for (size_t i=0; i< tracks->size(); ++i){
00163 const reco::Track & elem = tracks->at(i);
00164 double elemPt = elem.pt();
00165
00166 double elemVx = elem.vx();
00167 double elemVy = elem.vy();
00168 double elemD0 = sqrt( elemVx * elemVx + elemVy * elemVy );
00169 if ( elemD0 > 0.2 ) continue;
00170 double dz = fabs( elem.vz() - tk.vz());
00171 if ( dz > 0.1) continue;
00172
00173 if ( elemPt < ptThreshold_ ) continue;
00174 double dR = deltaR( elem.eta(), elem.phi(), tk.eta(), tk.phi() );
00175
00176 if ( (dR < 0.01) || (dR > 0.3) ) continue;
00177 ptSum += elemPt;
00178 }
00179 if (isCombinedIso_) {
00180
00181 for (CaloTowerCollection::const_iterator it=calotower->begin(); it!=calotower->end();++it ){
00182 double dR = deltaR( it->eta(), it->phi(),tk.outerEta(), tk.outerPhi() );
00183
00184 if ( (dR < 0.1) || (dR > 0.3) ) continue;
00185 ptSum += it->emEnergy();
00186 ptSum += it->hadEnergy();
00187 }
00188 }
00189 if (isRelativeIso_) ptSum /= tk.pt();
00190 return ptSum;
00191 }
00192
00193
00194
00195 bool EwkMuLumiMonitorDQM::IsMuMatchedToHLTMu ( const reco::Muon & mu, std::vector<reco::Particle> HLTMu , double DR, double DPtRel ) {
00196 size_t dim = HLTMu.size();
00197 size_t nPass=0;
00198 if (dim==0) return false;
00199 for (size_t k =0; k< dim; k++ ) {
00200 if ( (deltaR(HLTMu[k], mu) < DR) && (fabs(HLTMu[k].pt() - mu.pt())/ HLTMu[k].pt()<DPtRel)){
00201 nPass++ ;
00202 }
00203 }
00204 return (nPass>0);
00205 }
00206
00207
00208
00209 void EwkMuLumiMonitorDQM::endJob() {
00210 }
00211
00212 void EwkMuLumiMonitorDQM::endRun(const Run& r, const EventSetup&) {
00213
00214 LogVerbatim("") << "\n>>>>>> Z/W SELECTION SUMMARY BEGIN >>>>>>>>>>>>>>>";
00215 LogVerbatim("") << "Total numer of events analyzed: " << nall << " [events]";
00216 LogVerbatim("") << "Total numer of events selected: " << nsel << " [events]";
00217
00218 LogVerbatim("") << "Passing HLT criteria: " << nhlt << " [events] " ;
00219 LogVerbatim("") << "Passing 2 HLT match criteria: " << n2hlt << " [events] " ;
00220 LogVerbatim("") << "Passing 1 HLT match criteria: " << n1hlt << " [events] " ;
00221 LogVerbatim("") << "Passing Not Iso criteria: " << nNotIso << " [events] " ;
00222 LogVerbatim("") << "Passing GlbSta criteria: " << nGlbSta << " [events] " ;
00223 LogVerbatim("") << "Passing W criteria: " << nTMass << " [events] " ;
00224 LogVerbatim("") << ">>>>>> Z/W SELECTION SUMMARY END >>>>>>>>>>>>>>>\n";
00225 }
00226
00227 void EwkMuLumiMonitorDQM::analyze (const Event & ev, const EventSetup &) {
00228 nall++;
00229 bool iso_sel = false;
00230 bool hlt_sel = false;
00231 double iso1=-1;
00232 double iso2=-1;
00233 bool isMu1Iso = false;
00234 bool isMu2Iso = false;
00235 bool singleTrigFlag1 = false;
00236 bool singleTrigFlag2 = false;
00237 isZGolden1HLT_=false;
00238 isZGolden2HLT_=false;
00239 isZGoldenNoIso_=false;
00240 isZGlbSta_=false;
00241 isZGlbTrk_=false;
00242 isW_=false;
00243
00244 bool trigger_fired = false;
00245
00246 Handle<TriggerResults> triggerResults;
00247 if (!ev.getByLabel(trigTag_, triggerResults)) {
00248
00249 return;
00250 }
00251
00252 ev.getByLabel(trigTag_, triggerResults);
00253
00254
00255
00256
00257
00258
00259
00260
00261
00262
00263
00264
00265
00266
00267
00268 string lowestMuonUnprescaledTrig = "";
00269 bool lowestMuonUnprescaledTrigFound = false;
00270 const std::vector<std::string>& triggerNames = hltConfigProvider_.triggerNames();
00271 for (size_t ts = 0; ts< triggerNames.size() ; ts++){
00272 string trig = triggerNames[ts];
00273 size_t f = trig.find("HLT_Mu");
00274 if ( (f != std::string::npos) ) {
00275
00276
00278 bool prescaled = false;
00279 const unsigned int prescaleSize = hltConfigProvider_.prescaleSize() ;
00280 for (unsigned int ps= 0; ps< prescaleSize; ps++){
00281 const unsigned int prescaleValue = hltConfigProvider_.prescaleValue(ps, trig) ;
00282 if (prescaleValue != 1) prescaled =true;
00283
00284 }
00285 if (!prescaled){
00286
00287 for (unsigned int n=9; n<100 ; n++ ){
00288 string lowestTrig= "HLT_Mu";
00289 string lowestTrigv0 = "copy";
00290 std::stringstream out;
00291 out << n;
00292 std::string s = out.str();
00293 lowestTrig.append(s);
00294 lowestTrigv0 = lowestTrig;
00295 for (unsigned int v = 1; v<10 ; v++ ){
00296 lowestTrig.append("_v");
00297 std::stringstream oout;
00298 oout << v;
00299 std::string ss = oout.str();
00300 lowestTrig.append(ss);
00301 if (trig==lowestTrig) lowestMuonUnprescaledTrig = trig ;
00302 if (trig==lowestTrig) lowestMuonUnprescaledTrigFound = true ;
00303 if (trig==lowestTrig) break ;
00304 }
00305 if (lowestMuonUnprescaledTrigFound) break;
00306
00307 lowestTrig = lowestTrigv0;
00308 if (trig==lowestTrig) lowestMuonUnprescaledTrig = trig ;
00309
00310 if (trig==lowestTrig) lowestMuonUnprescaledTrigFound = true ;
00311 if (trig==lowestTrig) break ;
00312 }
00313 if (lowestMuonUnprescaledTrigFound) break;
00314 }
00315 }
00316 }
00317
00318 unsigned int triggerIndex;
00319
00320
00321 std::string hltPath_ = lowestMuonUnprescaledTrig;
00322
00323 triggerIndex = hltConfigProvider_.triggerIndex(hltPath_);
00324 if (triggerIndex < triggerResults->size()) trigger_fired = triggerResults->accept(triggerIndex);
00325 std::string L3FilterName_="";
00326 if (trigger_fired){
00327 const std::vector<std::string>& moduleLabs = hltConfigProvider_.moduleLabels(hltPath_);
00328
00329
00330
00331
00332
00333 size_t moduleLabsSizeMinus2 = moduleLabs.size() - 2 ;
00334
00335
00336 L3FilterName_ = moduleLabs[moduleLabsSizeMinus2];
00337
00338 }
00339
00340
00341 edm::Handle< trigger::TriggerEvent > handleTriggerEvent;
00342 LogTrace("") << ">>> Trigger bit: " << trigger_fired << " (" << hltPath_ << ")";
00343 if ( ! ev.getByLabel( trigEv_, handleTriggerEvent )) {
00344
00345 return;
00346 }
00347 ev.getByLabel( trigEv_, handleTriggerEvent );
00348 const trigger::TriggerObjectCollection & toc(handleTriggerEvent->getObjects());
00349 size_t nMuHLT =0;
00350 std::vector<reco::Particle> HLTMuMatched;
00351 for ( size_t ia = 0; ia < handleTriggerEvent->sizeFilters(); ++ ia) {
00352 std::string fullname = handleTriggerEvent->filterTag(ia).encode();
00353
00354 std::string name;
00355 size_t p = fullname.find_first_of(':');
00356 if ( p != std::string::npos) {
00357 name = fullname.substr(0, p);
00358 }
00359 else {
00360 name = fullname;
00361 }
00362 if ( &toc !=0 ) {
00363 const trigger::Keys & k = handleTriggerEvent->filterKeys(ia);
00364 for (trigger::Keys::const_iterator ki = k.begin(); ki !=k.end(); ++ki ) {
00365
00366 if (name == L3FilterName_ ) {
00367
00368 hlt_sel=true;
00369 nhlt++;
00370 HLTMuMatched.push_back(toc[*ki].particle());
00371 nMuHLT++;
00372 }
00373 }
00374 }
00375 }
00376
00377
00378 Handle<reco::BeamSpot> beamSpotHandle;
00379 if (!ev.getByLabel(InputTag("offlineBeamSpot"), beamSpotHandle)) {
00380
00381 return;
00382 }
00383
00384
00385
00386 Handle<View<Muon> > muons;
00387 if (!ev.getByLabel(muonTag_, muons)) {
00388
00389 return;
00390 }
00391
00392 ev.getByLabel(muonTag_, muons);
00393
00394 std::vector<reco::Muon> highPtGlbMuons;
00395 std::vector<reco::Muon> highPtStaMuons;
00396
00397 for (size_t i=0; i<muons->size(); i++ ){
00398 const reco::Muon & mu = muons->at(i);
00399 double pt = mu.pt();
00400 double eta = mu.eta();
00401 if (pt> ptMuCut_ && fabs(eta)< etaMuCut_ ) {
00402 if (mu.isGlobalMuon()) {
00403
00404 double dxy = mu.innerTrack()->dxy(beamSpotHandle->position());
00405 if (fabs(dxy)>dxyCut_) continue;
00406 highPtGlbMuons.push_back(mu);
00407 }
00408 if (mu.isGlobalMuon()) continue;
00409
00410 if(mu.isStandAloneMuon()) highPtStaMuons.push_back(mu);
00411 nEvWithHighPtMu++;
00412 }
00413 }
00414 size_t nHighPtGlbMu = highPtGlbMuons.size();
00415 size_t nHighPtStaMu = highPtStaMuons.size();
00416 if ( hlt_sel && (nHighPtGlbMu> 0) ) {
00417
00418
00419 (nHighPtGlbMu> 10)? nHighPtGlbMu=10 : 1;
00420
00421 if (nHighPtGlbMu>1 ){
00422 for(unsigned int i =0 ; i < nHighPtGlbMu ; i++) {
00423 reco::Muon muon1 = highPtGlbMuons[i];
00424 math::XYZTLorentzVector mu1(muon1.p4());
00425
00426 for (unsigned int j =i+1; j <nHighPtGlbMu ; ++j ){
00427 reco::Muon muon2 = highPtGlbMuons[j];
00428 math::XYZTLorentzVector mu2(muon2.p4());
00429
00430 if (muon1.charge() == muon2.charge()) continue;
00431 math::XYZTLorentzVector pair = mu1 + mu2;
00432 double mass = pair.M();
00433
00434 iso1 = muIso ( muon1 );
00435 iso2 = muIso ( muon2 );
00436 isMu1Iso = (iso1 < isoCut03_);
00437 isMu2Iso = (iso2 < isoCut03_);
00438 singleTrigFlag1 = IsMuMatchedToHLTMu ( muon1, HLTMuMatched ,maxDeltaR_, maxDPtRel_ );
00439 singleTrigFlag2 = IsMuMatchedToHLTMu ( muon2, HLTMuMatched ,maxDeltaR_, maxDPtRel_ );
00440 if (singleTrigFlag1 && singleTrigFlag2) isZGolden2HLT_ = true;
00441 if ( (singleTrigFlag1 && !singleTrigFlag2) || (!singleTrigFlag1 && singleTrigFlag2) ) isZGolden1HLT_ = true;
00442
00443 if (isZGolden2HLT_ || isZGolden1HLT_){
00444
00445 highPtGlbMuons.erase(highPtGlbMuons.begin() + i );
00446 highPtGlbMuons.erase(highPtGlbMuons.begin() + j );
00447
00448 nHighPtGlbMu = highPtGlbMuons.size();
00449
00450 if ( isMu1Iso && isMu2Iso ){
00451 niso++;
00452 iso_sel=true;
00453 if (isZGolden2HLT_) {
00454 n2hlt++;
00455 mass2HLT_->Fill(mass);
00456 highMass2HLT_->Fill(mass);
00457
00458
00459
00460
00461
00462
00463
00464
00465
00466 }
00467 if (isZGolden1HLT_) {
00468 n1hlt++;
00469 mass1HLT_->Fill(mass);
00470 highMass1HLT_->Fill(mass);
00471
00472
00473
00474
00475
00476
00477
00478
00479
00480 }
00481 } else {
00482
00483
00484 if (((isMu1Iso && !isMu2Iso) || (!isMu1Iso && isMu2Iso )) && (isZGolden2HLT_ && isZGolden1HLT_) ) {
00485 isZGoldenNoIso_=true;
00486 nNotIso++;
00487 massNotIso_->Fill(mass);
00488 highMassNotIso_->Fill(mass);
00489 }
00490
00491
00492
00493
00494
00495
00496
00497
00498
00499 }
00500 }
00501 }
00502 }
00503 }
00504
00505
00506 if ( !(isZGolden2HLT_ || isZGolden1HLT_ )){
00507 Handle<View<MET> > metCollection;
00508 if (!ev.getByLabel(metTag_, metCollection)) {
00509
00510 return;
00511 }
00512 const MET& met = metCollection->at(0);
00513 nW=0;
00514 for(unsigned int i =0 ; i < nHighPtGlbMu ; i++) {
00515 reco::Muon muon1 = highPtGlbMuons[i];
00516
00517
00518
00519
00520
00521
00522
00523
00524 iso1 = muIso ( muon1 );
00525 isMu1Iso = (iso1 < isoCut03_);
00526 if (!isMu1Iso) continue;
00527
00528 singleTrigFlag1 = IsMuMatchedToHLTMu ( muon1, HLTMuMatched ,maxDeltaR_, maxDPtRel_ );
00529 if (!singleTrigFlag1) continue;
00530
00531
00532 double met_px = met.px();
00533 double met_py = met.py();
00534
00535 if (!metIncludesMuons_) {
00536 for(unsigned int i =0 ; i < nHighPtGlbMu ; i++) {
00537 reco::Muon muon1 = highPtGlbMuons[i];
00538 met_px -= muon1.px();
00539 met_py -= muon1.py();
00540 }
00541 }
00542 double met_et = met.pt() ;
00543 LogTrace("") << ">>> MET, MET_px, MET_py: " << met_et << ", " << met_px << ", " << met_py << " [GeV]";
00544 double w_et = met_et+ muon1.pt();
00545 double w_px = met_px+ muon1.px();
00546 double w_py = met_py+muon1.py();
00547 double massT = w_et*w_et - w_px*w_px - w_py*w_py;
00548 massT = (massT>0) ? sqrt(massT) : 0;
00549
00550 Geom::Phi<double> deltaphi(muon1.phi()-atan2(met_py,met_px));
00551 double acop = M_PI - fabs(deltaphi.value());
00552
00553 if (acop > acopCut_) continue ;
00554 TMass_->Fill(massT);
00555 if (massT<mtMin_ || massT>mtMax_) continue;
00556
00557 isW_=true;
00558 nW++;
00559 nTMass++;
00560 }
00561 }
00562
00563 if ( !(isZGolden2HLT_ || isZGolden1HLT_ || isZGoldenNoIso_ )){
00564 for(unsigned int i =0 ; i < nHighPtGlbMu ; ++i) {
00565 reco::Muon glbMuon = highPtGlbMuons[i];
00566 math::XYZTLorentzVector mu1(glbMuon.p4());
00567
00568
00569 singleTrigFlag1 = IsMuMatchedToHLTMu ( glbMuon, HLTMuMatched ,maxDeltaR_, maxDPtRel_ );
00570 if (!singleTrigFlag1) continue;
00571
00572 iso1 = muIso ( glbMuon );
00573 isMu1Iso = (iso1 < isoCut03_);
00574 if (!isMu1Iso) continue;
00575
00576
00577 (nHighPtStaMu> 10)? nHighPtStaMu=10 : 1;
00578 for (unsigned int j =0; j <nHighPtStaMu ; ++j ){
00579 reco::Muon staMuon = highPtStaMuons[j];
00580 math::XYZTLorentzVector mu2(staMuon.p4());
00581
00582 if (glbMuon.charge() == staMuon.charge()) continue;
00583 math::XYZTLorentzVector pair = mu1 + mu2;
00584 double mass = pair.M();
00585 iso2 = muIso ( staMuon);
00586 isMu2Iso = (iso2 < isoCut03_);
00587 LogTrace("") << "\t... isolation value" << iso1 <<", isolated? " << isMu1Iso ;
00588 LogTrace("") << "\t... isolation value" << iso2 <<", isolated? " << isMu2Iso ;
00589
00590 if (isMu2Iso ) {
00591 isZGlbSta_=true;
00592 nGlbSta++;
00593 massGlbSta_->Fill(mass);
00594 highMassGlbSta_->Fill(mass);
00595
00596
00597
00598
00599
00600
00601
00602
00603
00604 }
00605 }
00606
00607 Handle< TrackCollection > tracks;
00608 if (!ev.getByLabel(trackTag_, tracks)) {
00609
00610 return;
00611 }
00612 ev.getByLabel(trackTag_, tracks);
00613 Handle< CaloTowerCollection > calotower;
00614 if (!ev.getByLabel(caloTowerTag_, calotower)) {
00615
00616 return;
00617 }
00618 ev.getByLabel(caloTowerTag_, calotower);
00619
00620 size_t nTrk = tracks->size();
00621 (nTrk> 5000)? nTrk=5000 : 1;
00622 for (unsigned int j=0; j<nTrk; j++ ){
00623 const reco::Track & tk = tracks->at(j);
00624 if (glbMuon.charge() == tk.charge()) continue;
00625 double pt2 = tk.pt();
00626 double eta = tk.eta();
00627 double dxy = tk.dxy(beamSpotHandle->position());
00628 if (pt2< ptMuCut_ || fabs(eta) > etaMuCut_ || fabs(dxy)>dxyCut_) continue;
00629
00630 math::XYZTLorentzVector mu2(tk.px(),tk.py(), tk.pz(), sqrt( (tk.p() * tk.p()) + ( 0.10566 * 0.10566))) ;
00631 math::XYZTLorentzVector pair = mu1 + mu2;
00632 double mass = pair.M();
00633
00634 iso2 = tkIso( tk, tracks, calotower);
00635 isMu2Iso = (iso2 < isoCut03_);
00636
00637 if (isMu2Iso) {
00638 isZGlbTrk_=true;
00639 nGlbTrk++;
00640 massGlbTrk_->Fill(mass);
00641 highMassGlbTrk_->Fill(mass);
00642 if (!isW_) continue;
00643 massIsBothGlbTrkThanW_->Fill(mass);
00644 highMassIsBothGlbTrkThanW_->Fill(mass);
00645
00646
00647
00648
00649
00650
00651
00652
00653
00654 }
00655 }
00656 }
00657 }
00658 }
00659 if ( (hlt_sel || isZGolden2HLT_ || isZGolden1HLT_ || isZGoldenNoIso_ || isZGlbSta_ || isZGlbTrk_ || isW_) ) {
00660 nsel++;
00661 LogTrace("") << ">>>> Event ACCEPTED";
00662 } else {
00663 LogTrace("") << ">>>> Event REJECTED";
00664 }
00665 return;
00666 }