3 |
|
#include "MitPhysics/Utils/interface/MuonTools.h" |
4 |
|
#include <TFile.h> |
5 |
|
|
6 |
+ |
ClassImp(mithep::MuonTools) |
7 |
+ |
|
8 |
|
using namespace mithep; |
9 |
|
|
10 |
|
//-------------------------------------------------------------------------------------------------- |
93 |
|
Double_t MuonTools::GetCaloCompatability(const Muon *iMuon, |
94 |
|
Bool_t iEMSpecial, Bool_t iCorrectedHCAL) const |
95 |
|
{ |
96 |
< |
// todo |
96 |
> |
// Get calo compatibility value for given muon based on calorimeter templates. |
97 |
> |
// If iEMSpecial is true, then a use different arrangement of ECAL for compatibility. |
98 |
|
|
99 |
|
Double_t lEta = iMuon->Eta(); |
100 |
|
Double_t aEta = TMath::Abs(lEta); |
147 |
|
|
148 |
|
if (aEta < 1.1) { |
149 |
|
if(iCorrectedHCAL) |
150 |
< |
lHad *= TMath::Sin(2*TMath::ATan(TMath::Exp(lEta))); //todo ask! |
150 |
> |
lHad *= TMath::Sin(2*TMath::ATan(TMath::Exp(lEta))); |
151 |
|
lTPionHad = fpion_had_etaB; |
152 |
|
lTMuonHad = fmuon_had_etaB; |
153 |
|
} |
279 |
|
return iMuon->PromptTight(Muon::kAny); |
280 |
|
break; |
281 |
|
case kTMOneStationLoose: |
282 |
< |
return iMuon->TMOneStation(99999,999999); |
282 |
> |
return iMuon->TMOneStation(999999,999999); |
283 |
|
break; |
284 |
|
case kTMOneStationTight: |
285 |
|
return iMuon->TMOneStation(); |
301 |
|
break; |
302 |
|
} |
303 |
|
|
304 |
< |
Double_t lVal = 1.2*GetSegmentCompatability(iMuon); |
305 |
< |
if (lVal/1.2 == 0.5) |
304 |
> |
Double_t lVal = GetSegmentCompatability(iMuon); |
305 |
> |
if (lVal == 0.5) // exclude this border case |
306 |
|
return kFALSE; |
307 |
|
|
308 |
+ |
lVal *= 1.2; |
309 |
|
lVal += 0.8*GetCaloCompatability(iMuon,kTRUE,kTRUE); |
310 |
|
if (lVal > tm2dcut) |
311 |
|
return kTRUE; |
312 |
+ |
|
313 |
|
return kFALSE; |
314 |
|
} |
315 |
|
|
316 |
|
//-------------------------------------------------------------------------------------------------- |
317 |
|
Double_t MuonTools::GetSegmentCompatability(const mithep::Muon *iMuon) const |
318 |
|
{ |
319 |
< |
// todo |
319 |
> |
// Get segment compatability for given muon based on likelihood of well defined |
320 |
> |
// track through chambers. |
321 |
|
|
322 |
|
Int_t lNStationsCrossed = 0; |
323 |
|
Int_t lNStationsSegment = 0; |
338 |
|
} else |
339 |
|
lStCrossed[i0] = 0; |
340 |
|
|
341 |
< |
if(iMuon->GetDX(i0) < 999999.) { //Use iMuon->GetSegmentX--> CHECK |
341 |
> |
if(iMuon->GetDX(i0) < 999999.) { |
342 |
|
lNStationsSegment++; |
343 |
|
lStSegmentmatch[i0] = 1; |
344 |
|
} else |
428 |
|
ret->SetDirectory(0); |
429 |
|
return ret; |
430 |
|
} |
431 |
+ |
//-------------------------------------------------------------------------------------------------- |
432 |
+ |
Bool_t MuonTools::PassD0Cut(const Muon *mu, const VertexCol *vertices, Double_t fD0Cut) |
433 |
+ |
{ |
434 |
+ |
Bool_t d0cut = kFALSE; |
435 |
+ |
const Track *mt = mu->BestTrk(); |
436 |
+ |
if (!mt) return kFALSE; |
437 |
+ |
|
438 |
+ |
Double_t d0_real = 1e30; |
439 |
+ |
for(UInt_t i0 = 0; i0 < vertices->GetEntries(); i0++) { |
440 |
+ |
if(vertices->At(i0)->NTracks() > 0){ |
441 |
+ |
Double_t pD0 = mt->D0Corrected(*vertices->At(i0)); |
442 |
+ |
d0_real = TMath::Abs(pD0); |
443 |
+ |
break; |
444 |
+ |
} |
445 |
+ |
} |
446 |
+ |
if(d0_real < fD0Cut) d0cut = kTRUE; |
447 |
+ |
|
448 |
+ |
return d0cut; |
449 |
+ |
} |
450 |
|
|
451 |
+ |
//-------------------------------------------------------------------------------------------------- |
452 |
+ |
Bool_t MuonTools::PassD0Cut(const Muon *mu, const BeamSpotCol *beamspots, Double_t fD0Cut) |
453 |
+ |
{ |
454 |
+ |
Bool_t d0cut = kFALSE; |
455 |
+ |
const Track *mt = mu->BestTrk(); |
456 |
+ |
if (!mt) return kFALSE; |
457 |
+ |
|
458 |
+ |
// d0 cut |
459 |
+ |
Double_t d0_real = 99999; |
460 |
+ |
for(UInt_t i0 = 0; i0 < beamspots->GetEntries(); i0++) { |
461 |
+ |
Double_t pD0 = mt->D0Corrected(*beamspots->At(i0)); |
462 |
+ |
if(TMath::Abs(pD0) < TMath::Abs(d0_real)) d0_real = TMath::Abs(pD0); |
463 |
+ |
} |
464 |
+ |
if(d0_real < fD0Cut) d0cut = kTRUE; |
465 |
+ |
|
466 |
+ |
return d0cut; |
467 |
+ |
} |
468 |
+ |
|
469 |
+ |
//-------------------------------------------------------------------------------------------------- |
470 |
+ |
Bool_t MuonTools::PassSoftMuonCut(const Muon *mu, const VertexCol *vertices) |
471 |
+ |
{ |
472 |
+ |
if(mu->Pt() <= 3.0) return kFALSE; |
473 |
+ |
|
474 |
+ |
if(!mu->IsTrackerMuon()) return kFALSE; |
475 |
+ |
|
476 |
+ |
if(!mu->Quality().Quality(MuonQuality::TMLastStationAngTight)) return kFALSE; |
477 |
+ |
|
478 |
+ |
if(mu->BestTrk()->NHits() <= 10) return kFALSE; |
479 |
+ |
|
480 |
+ |
if(!PassD0Cut(mu, vertices, 0.2)) return kFALSE; |
481 |
+ |
|
482 |
+ |
Double_t totalIso = 1.0 * mu->IsoR03SumPt() + |
483 |
+ |
1.0 * mu->IsoR03EmEt() + |
484 |
+ |
1.0 * mu->IsoR03HadEt(); |
485 |
+ |
if (totalIso < (mu->Pt()*0.10) && mu->Pt() > 20.0) return kFALSE; |
486 |
+ |
|
487 |
+ |
return kTRUE; |
488 |
+ |
} |