CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
HLTMuonL2SelectorForL3IO.cc
Go to the documentation of this file.
1 
13 
16  l2Src_(consumes<reco::TrackCollection>(iConfig.getParameter<edm::InputTag>("l2Src"))),
17  l3OISrc_(consumes<reco::TrackCollection>(iConfig.getParameter<edm::InputTag>("l3OISrc"))),
18  useOuterHitPosition_(iConfig.getParameter<bool>("useOuterHitPosition")),
19  xDiffMax_(iConfig.getParameter<double>("xDiffMax")),
20  yDiffMax_(iConfig.getParameter<double>("yDiffMax")),
21  zDiffMax_(iConfig.getParameter<double>("zDiffMax")),
22  dRDiffMax_(iConfig.getParameter<double>("dRDiffMax")){
23  LogTrace("Muon|RecoMuon|HLTMuonL2SelectorForL3IO")<<"constructor called";
24  produces<reco::TrackCollection>();
25 }
26 
29 
32  const std::string metname = "Muon|RecoMuon|HLTMuonL2SelectorForL3IO";
33 
34 // IN:
36  iEvent.getByToken(l2Src_, l2TrackCol);
37 
39  iEvent.getByToken(l3OISrc_, l3TrackCol);
40 
41 // OUT:
42  std::auto_ptr<std::vector<reco::Track> > result(new std::vector<reco::Track>());
43 
44  auto const& l2Tracks = *l2TrackCol.product();
45  auto const& l3Tracks = *l3TrackCol.product();
46  for (auto&& l2 : l2Tracks){
47  bool l2found=false;
48  for (auto&& l3 : l3Tracks){
50  // If x,y are within 0.5cm of each other: L2 has been found already
51  // z found to change beyond this (perhaps a refitting issue?)
52  if (std::abs(l2.outerPosition().X()-l3.outerPosition().X()) < xDiffMax_ &&
53  std::abs(l2.outerPosition().Y()-l3.outerPosition().Y()) < yDiffMax_ &&
54  std::abs(l2.outerPosition().Z()-l3.outerPosition().Z()) < zDiffMax_){
55  l2found=true;
56  }
57  }
58  else{
59  if (deltaR(l3,l2)<dRDiffMax_) l2found=true;
60  }
61  }
62  if (!l2found) result->push_back(l2);
63  }
64 
65  iEvent.put(result);
66 }
67 
70  desc.add<edm::InputTag>("l2Src",edm::InputTag("hltL2Muons","UpdatedAtVtx"));
71  desc.add<edm::InputTag>("l3OISrc",edm::InputTag("hltL2Muons","UpdatedAtVtx"));
72  desc.add<bool>("useOuterHitPosition",true); //ToDo: Check whether untracked or tracked
73  desc.add<double>("xDiffMax",0.5);
74  desc.add<double>("yDiffMax",0.5);
75  desc.add<double>("zDiffMax",9999.0);
76  desc.add<double>("dRDiffMax",0.01);
77  descriptions.add("HLTMuonL2SelectorForL3IO",desc);
78 }
HLTMuonL2SelectorForL3IO(const edm::ParameterSet &)
constructor with config
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:464
const std::string metname
std::vector< Track > TrackCollection
collection of Tracks
Definition: TrackFwd.h:14
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
default values
int iEvent
Definition: GenABIO.cc:230
const edm::EDGetTokenT< reco::TrackCollection > l3OISrc_
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:120
tuple result
Definition: query.py:137
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
ParameterDescriptionBase * add(U const &iLabel, T const &value)
#define LogTrace(id)
double deltaR(double eta1, double eta2, double phi1, double phi2)
Definition: TreeUtility.cc:17
T const * product() const
Definition: Handle.h:81
const edm::EDGetTokenT< reco::TrackCollection > l2Src_
void add(std::string const &label, ParameterSetDescription const &psetDescription)
virtual void produce(edm::Event &, const edm::EventSetup &)
select muons
virtual ~HLTMuonL2SelectorForL3IO()
destructor