CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
DualByL2TSG.cc
Go to the documentation of this file.
5 
11 
13  theCategory = "DualByL2TSG";
14  theL3CollectionLabelA = pset.getParameter<edm::InputTag>("L3TkCollectionA");
15  if (nTSGs() != 2) {
16  edm::LogError(theCategory) << "not two seed generators provided";
17  }
18 
20 }
21 
22 unsigned int DualByL2TSG::selectTSG(const TrackCand& muonTrackCand, const TrackingRegion& region) {
23  LogDebug(theCategory) << "|eta|=|" << muonTrackCand.second->eta() << "|";
24 
25  bool re_do_this_L2 = true;
26  //LogDebug("TrackerSeedGenerator")<<theEvent;
27  //getEvent();
28 
29  //retrieve L3 track collection
31  getEvent()->getByToken(l3muonToken, l3muonH);
32  if (l3muonH.failedToGet())
33  return 0;
34 
35  unsigned int maxI = l3muonH->size();
36 
37  LogDebug(theCategory) << "TheCollectionA size " << maxI;
38 
39  // Loop through all tracks, if the track was seeded from this L2, then skip
40  for (unsigned int i = 0; i != maxI; ++i) {
41  reco::TrackRef tk(l3muonH, i);
43  tk->seedRef().castTo<edm::Ref<L3MuonTrajectorySeedCollection> >();
44  reco::TrackRef staTrack = l3seedRef->l2Track();
45 
46  if (staTrack == (muonTrackCand.second))
47  re_do_this_L2 = false;
48  //LogDebug(theCategory) << "The DualByL2TSG selectTSG loop " << re_do_this_L2 << " staCand " << muonTrackCand.second->eta() << " " << muonTrackCand.second->pt() << " alreadyMadeRefToL3 " << staTrack->eta() << " " << staTrack->pt();
49  }
50 
51  LogDebug(theCategory) << "The DualByL2TSG to use " << re_do_this_L2;
52 
53  return re_do_this_L2 ? 1 : 0;
54 }
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
edm::EDGetTokenT< reco::TrackCollection > l3muonToken
Definition: DualByL2TSG.h:29
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:539
DualByL2TSG(const edm::ParameterSet &pset, edm::ConsumesCollector &iC)
Definition: DualByL2TSG.cc:12
std::vector< Track > TrackCollection
collection of Tracks
Definition: TrackFwd.h:14
unsigned int selectTSG(const TrackCand &, const TrackingRegion &) override
decide the TSG depending on the existence of a L3 track seeded from the L2. Return value is 0 or 1...
Definition: DualByL2TSG.cc:22
Log< level::Error, false > LogError
std::pair< const Trajectory *, reco::TrackRef > TrackCand
edm::Handle< reco::TrackCollection > l3muonH
Definition: DualByL2TSG.h:28
const edm::Event * getEvent() const
bool failedToGet() const
Definition: HandleBase.h:72
std::string theCategory
Definition: DualByL2TSG.h:26
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
unsigned int nTSGs()
Definition: CompositeTSG.h:38
edm::InputTag theL3CollectionLabelA
Definition: DualByL2TSG.h:27
#define LogDebug(id)