CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

HLTDisplacedmumumuVtxProducer Class Reference

#include <HLTDisplacedmumumuVtxProducer.h>

Inheritance diagram for HLTDisplacedmumumuVtxProducer:
edm::EDProducer edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

List of all members.

Public Member Functions

virtual void beginJob ()
virtual void endJob ()
 HLTDisplacedmumumuVtxProducer (const edm::ParameterSet &)
virtual void produce (edm::Event &, const edm::EventSetup &)
 ~HLTDisplacedmumumuVtxProducer ()

Private Member Functions

bool checkPreviousCand (const reco::TrackRef &trackref, std::vector< reco::RecoChargedCandidateRef > &ref2)

Private Attributes

int chargeOpt_
double maxEta_
double maxInvMass_
double minInvMass_
double minPt_
double minPtTriplet_
edm::InputTag previousCandTag_
edm::InputTag src_

Detailed Description

Definition at line 28 of file HLTDisplacedmumumuVtxProducer.h.


Constructor & Destructor Documentation

HLTDisplacedmumumuVtxProducer::HLTDisplacedmumumuVtxProducer ( const edm::ParameterSet iConfig) [explicit]

Definition at line 35 of file HLTDisplacedmumumuVtxProducer.cc.

                                                                                          :     
  src_ (iConfig.getParameter<edm::InputTag>("Src")),
  previousCandTag_(iConfig.getParameter<edm::InputTag>("PreviousCandTag")),
  maxEta_ (iConfig.getParameter<double>("MaxEta")),
  minPt_ (iConfig.getParameter<double>("MinPt")),
  minPtTriplet_ (iConfig.getParameter<double>("MinPtTriplet")),
  minInvMass_ (iConfig.getParameter<double>("MinInvMass")),
  maxInvMass_ (iConfig.getParameter<double>("MaxInvMass")),
  chargeOpt_ (iConfig.getParameter<int>("ChargeOpt"))
{
  produces<VertexCollection>();
}
HLTDisplacedmumumuVtxProducer::~HLTDisplacedmumumuVtxProducer ( )

Definition at line 49 of file HLTDisplacedmumumuVtxProducer.cc.

{
  
}

Member Function Documentation

void HLTDisplacedmumumuVtxProducer::beginJob ( void  ) [virtual]

Reimplemented from edm::EDProducer.

Definition at line 56 of file HLTDisplacedmumumuVtxProducer.cc.

{
  
}
bool HLTDisplacedmumumuVtxProducer::checkPreviousCand ( const reco::TrackRef trackref,
std::vector< reco::RecoChargedCandidateRef > &  ref2 
) [private]

Referenced by produce().

void HLTDisplacedmumumuVtxProducer::endJob ( void  ) [virtual]

Reimplemented from edm::EDProducer.

Definition at line 62 of file HLTDisplacedmumumuVtxProducer.cc.

{
  
}
void HLTDisplacedmumumuVtxProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
) [virtual]

Implements edm::EDProducer.

Definition at line 68 of file HLTDisplacedmumumuVtxProducer.cc.

References abs, chargeOpt_, checkPreviousCand(), edm::EventSetup::get(), edm::Ref< C, T, F >::get(), edm::Event::getByLabel(), TransientVertex::isValid(), LogDebug, maxEta_, maxInvMass_, minInvMass_, minPt_, minPtTriplet_, AlCaHLTBitMon_ParallelJobs::p, p1, p2, p3, previousCandTag_, edm::Event::put(), mathSSE::sqrt(), src_, trigger::TriggerMuon, KalmanVertexFitter::vertex(), and GoodVertex_cfg::vertexCollection.

{
  double const MuMass = 0.106;
  double const MuMass2 = MuMass*MuMass;
  
  
  // get hold of muon trks
  Handle<RecoChargedCandidateCollection> mucands;
  iEvent.getByLabel (src_,mucands);
  
  //get the transient track builder:
  edm::ESHandle<TransientTrackBuilder> theB;
  iSetup.get<TransientTrackRecord>().get("TransientTrackBuilder",theB);
  
  std::auto_ptr<VertexCollection> vertexCollection(new VertexCollection());
  
  // look at all mucands,  check cuts and make vertices
  double e1,e2,e3;
  Particle::LorentzVector p,p1,p2,p3;
  
  RecoChargedCandidateCollection::const_iterator cand1;
  RecoChargedCandidateCollection::const_iterator cand2;
  RecoChargedCandidateCollection::const_iterator cand3;
  
  // get the objects passing the previous filter
  Handle<TriggerFilterObjectWithRefs> previousCands;
  iEvent.getByLabel (previousCandTag_,previousCands);
  
  vector<RecoChargedCandidateRef> vPrevCands;
  previousCands->getObjects(TriggerMuon,vPrevCands);
  
  for (cand1=mucands->begin(); cand1!=mucands->end(); cand1++) {
    TrackRef tk1 = cand1->get<TrackRef>();
    LogDebug("HLTDisplacedMumumuFilter") << " 1st muon in loop: q*pt= " << cand1->charge()*cand1->pt() << ", eta= " << cand1->eta() << ", hits= " << tk1->numberOfValidHits();
    
    //first check if this muon passed the previous filter
    if( ! checkPreviousCand( tk1, vPrevCands) ) continue;
    
    // cuts
    if (fabs(cand1->eta())>maxEta_) continue;
    if (cand1->pt() < minPt_) continue;
    
    cand2 = cand1; cand2++;
    for (; cand2!=mucands->end(); cand2++) {
      TrackRef tk2 = cand2->get<TrackRef>();
      
      // eta cut
      LogDebug("HLTMuonDimuonFilter") << " 2nd muon in loop: q*pt= " << cand2->charge()*cand2->pt() << ", eta= " << cand2->eta() << ", hits= " << tk2->numberOfValidHits() << ", d0= " << tk2->d0();
      //first check if this muon passed the previous filter
      if( ! checkPreviousCand( tk2, vPrevCands) ) continue;
      
      // cuts
      if (fabs(cand2->eta())>maxEta_) continue;
      if (cand2->pt() < minPt_) continue;
      
      cand3 = cand2; cand3++;
      for (; cand3!=mucands->end(); cand3++) {
        TrackRef tk3 = cand3->get<TrackRef>();
        
        // eta cut
        LogDebug("HLTMuonDimuonFilter") << " 3rd muon in loop: q*pt= " << cand3->charge()*cand3->pt() << ", eta= " << cand3->eta() << ", hits= " << tk3->numberOfValidHits() << ", d0= " << tk3->d0();
        //first check if this muon passed the previous filter
        if( ! checkPreviousCand( tk3, vPrevCands) ) continue;
        
        // cuts
        if (fabs(cand3->eta())>maxEta_) continue;
        if (cand3->pt() < minPt_) continue;
        
        // opposite sign or same sign
        if (chargeOpt_>0) {
          if (fabs (cand1->charge() + cand2->charge() + cand3->charge()) != chargeOpt_) continue;
        }
        
        // Combined dimuon system
        e1 = sqrt(cand1->momentum().Mag2()+MuMass2);
        e2 = sqrt(cand2->momentum().Mag2()+MuMass2);
        e3 = sqrt(cand3->momentum().Mag2()+MuMass2);
        p1 = Particle::LorentzVector(cand1->px(),cand1->py(),cand1->pz(),e1);
        p2 = Particle::LorentzVector(cand2->px(),cand2->py(),cand2->pz(),e2);
        p3 = Particle::LorentzVector(cand3->px(),cand3->py(),cand3->pz(),e3);
        p = p1+p2+p3;
        
        
        if (p.pt()<minPtTriplet_) continue;
        
        double invmass = abs(p.mass());
        LogDebug("HLTDisplacedMumumuFilter") << " ... 1-2 invmass= " << invmass;
        
        if (invmass<minInvMass_) continue;
        if (invmass>maxInvMass_) continue;
        
        // do the vertex fit
        vector<TransientTrack> t_tks;
        TransientTrack ttkp1 = (*theB).build(&tk1);
        TransientTrack ttkp2 = (*theB).build(&tk2);
        TransientTrack ttkp3 = (*theB).build(&tk3);
        t_tks.push_back(ttkp1);
        t_tks.push_back(ttkp2);
        t_tks.push_back(ttkp3);
        
        
        if (t_tks.size()!=3) continue;
        
        KalmanVertexFitter kvf;
        TransientVertex tv = kvf.vertex(t_tks);
        
        if (!tv.isValid()) continue;
        
        Vertex vertex = tv;
        
        // put vertex in the event
        vertexCollection->push_back(vertex);
      }
    }
  }
  iEvent.put(vertexCollection);
}

Member Data Documentation

Definition at line 47 of file HLTDisplacedmumumuVtxProducer.h.

Referenced by produce().

Definition at line 42 of file HLTDisplacedmumumuVtxProducer.h.

Referenced by produce().

Definition at line 46 of file HLTDisplacedmumumuVtxProducer.h.

Referenced by produce().

Definition at line 45 of file HLTDisplacedmumumuVtxProducer.h.

Referenced by produce().

Definition at line 43 of file HLTDisplacedmumumuVtxProducer.h.

Referenced by produce().

Definition at line 44 of file HLTDisplacedmumumuVtxProducer.h.

Referenced by produce().

Definition at line 41 of file HLTDisplacedmumumuVtxProducer.h.

Referenced by produce().

Definition at line 40 of file HLTDisplacedmumumuVtxProducer.h.

Referenced by produce().