CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
HSCParticleProducer Class Reference

#include <SUSYBSMAnalysis/HSCParticleProducer/interface/HSCParticleProducer.h>

Inheritance diagram for HSCParticleProducer:
edm::EDFilter edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 HSCParticleProducer (const edm::ParameterSet &)
 
 ~HSCParticleProducer () override
 
- Public Member Functions inherited from edm::EDFilter
 EDFilter ()
 
ModuleDescription const & moduleDescription () const
 
 ~EDFilter () override
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
std::vector< edm::ProductResolverIndex > const & putTokenIndexToProductResolverIndex () const
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, ModuleToResolverIndicies const &iIndicies, std::string const &moduleLabel)
 
virtual ~ProducerBase () noexcept(false)
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Member Functions

void beginJob () override
 
void endJob () override
 
bool filter (edm::Event &, const edm::EventSetup &) override
 
std::vector< susybsm::HSCParticlegetHSCPSeedCollection (edm::Handle< reco::TrackCollection > &trackCollectionHandle, edm::Handle< reco::MuonCollection > &muonCollectionHandle, edm::Handle< reco::MuonCollection > &MTmuonCollectionHandle)
 

Private Attributes

BetaCalculatorECALbeta_calculator_ECAL
 
BetaCalculatorMUONbeta_calculator_MUON
 
BetaCalculatorRPCbeta_calculator_RPC
 
BetaCalculatorTKbeta_calculator_TK
 
bool Filter_
 
edm::EDGetTokenT< reco::MuonCollectionm_MTmuonsToken
 
edm::EDGetTokenT< reco::MuonCollectionm_muonsToken
 
edm::EDGetTokenT< reco::TrackCollectionm_trackIsoToken
 
edm::EDGetTokenT< reco::TrackCollectionm_trackToken
 
float maxInvPtDiff
 
float maxTkChi2
 
float minDR
 
float minMTDR
 
float minMTMuPt
 
float minMuP
 
float minSAMuPt
 
unsigned int minTkHits
 
float minTkP
 
std::vector< CandidateSelector * > Selectors
 
bool useBetaFromEcal
 
bool useBetaFromMuon
 
bool useBetaFromRpc
 
bool useBetaFromTk
 

Additional Inherited Members

- Public Types inherited from edm::EDFilter
typedef EDFilter ModuleType
 
- Public Types inherited from edm::ProducerBase
using ModuleToResolverIndicies = std::unordered_multimap< std::string, std::tuple< edm::TypeID const *, const char *, edm::ProductResolverIndex >>
 
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::EDFilter
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

Description: Producer for HSCP candidates, merging tracker dt information and rpc information

Implementation: <Notes on="" implementation>="">

Definition at line 54 of file HSCParticleProducer.h.

Constructor & Destructor Documentation

HSCParticleProducer::HSCParticleProducer ( const edm::ParameterSet iConfig)
explicit

Definition at line 25 of file HSCParticleProducer.cc.

References edm::ParameterSet::getParameter(), mps_fire::i, HSCParticleProducer_cff::maxInvPtDiff, HSCParticleProducer_cff::maxTkChi2, electronTrackIsolations_cfi::minDR, HSCParticleProducer_cff::minMTDR, HSCParticleProducer_cff::minMTMuPt, HSCParticleProducer_cff::minMuP, HSCParticleProducer_cff::minSAMuPt, HSCParticleProducer_cff::minTkHits, HSCParticleProducer_cff::minTkP, HSCParticleProducer_cff::SelectionParameters, HSCParticleProducer_cff::useBetaFromEcal, HSCParticleProducer_cff::useBetaFromMuon, HSCParticleProducer_cff::useBetaFromRpc, and HSCParticleProducer_cff::useBetaFromTk.

25  {
26  using namespace edm;
27  using namespace std;
28 
29  // the Act as Event filter
30  Filter_ = iConfig.getParameter<bool> ("filter");
31 
32  // the input collections
33  m_trackToken = consumes<reco::TrackCollection>(iConfig.getParameter<edm::InputTag>("tracks"));
34  m_muonsToken = consumes<reco::MuonCollection>(iConfig.getParameter<edm::InputTag>("muons"));
35  m_MTmuonsToken = consumes<reco::MuonCollection>(iConfig.getParameter<edm::InputTag>("MTmuons"));
36  m_trackIsoToken = consumes<reco::TrackCollection>(iConfig.getParameter<edm::InputTag>("tracksIsolation"));
37 
38  useBetaFromTk = iConfig.getParameter<bool> ("useBetaFromTk" );
39  useBetaFromMuon = iConfig.getParameter<bool> ("useBetaFromMuon");
40  useBetaFromRpc = iConfig.getParameter<bool> ("useBetaFromRpc" );
41  useBetaFromEcal = iConfig.getParameter<bool> ("useBetaFromEcal");
42 
43  // the parameters
44  minTkP = iConfig.getParameter<double> ("minTkP"); // 30
45  maxTkChi2 = iConfig.getParameter<double> ("maxTkChi2"); // 5
46  minTkHits = iConfig.getParameter<uint32_t>("minTkHits"); // 9
47  minMuP = iConfig.getParameter<double> ("minMuP"); // 30
48  minDR = iConfig.getParameter<double> ("minDR"); // 0.1
49  minSAMuPt = iConfig.getParameter<double> ("minSAMuPt"); // 70
50  minMTMuPt = iConfig.getParameter<double> ("minMTMuPt"); // 70
51  minMTDR = iConfig.getParameter<double> ("minMTDR"); // 0.3
52  maxInvPtDiff = iConfig.getParameter<double> ("maxInvPtDiff"); // 0.005
53 
58 
59  // Load all the selections
60  std::vector<edm::ParameterSet> SelectionParameters = iConfig.getParameter<std::vector<edm::ParameterSet> >("SelectionParameters");
61  for(unsigned int i=0;i<SelectionParameters.size();i++){
62  Selectors.push_back(new CandidateSelector(SelectionParameters[i]) );
63  }
64 
65  // what I produce
66  produces<susybsm::HSCParticleCollection >();
67  if(useBetaFromEcal)produces<susybsm::HSCPCaloInfoCollection >();
68 
69 }
T getParameter(std::string const &) const
edm::EDGetTokenT< reco::MuonCollection > m_muonsToken
BetaCalculatorMUON * beta_calculator_MUON
BetaCalculatorTK * beta_calculator_TK
BetaCalculatorECAL * beta_calculator_ECAL
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
edm::EDGetTokenT< reco::MuonCollection > m_MTmuonsToken
edm::EDGetTokenT< reco::TrackCollection > m_trackToken
BetaCalculatorRPC * beta_calculator_RPC
std::vector< CandidateSelector * > Selectors
HLT enums.
edm::EDGetTokenT< reco::TrackCollection > m_trackIsoToken
HSCParticleProducer::~HSCParticleProducer ( )
override

Definition at line 71 of file HSCParticleProducer.cc.

71  {
72  // do anything here that needs to be done at desctruction time
73  // (e.g. close files, deallocate resources etc.)
74 }

Member Function Documentation

void HSCParticleProducer::beginJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDFilter.

Definition at line 201 of file HSCParticleProducer.cc.

201  {
202 }
void HSCParticleProducer::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDFilter.

Definition at line 206 of file HSCParticleProducer.cc.

206  {
207 }
bool HSCParticleProducer::filter ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivate

Definition at line 82 of file HSCParticleProducer.cc.

References deltaR(), PFRecoTauDiscriminationAgainstElectronDeadECAL_cfi::dR, allElectronIsolations_cfi::dRMin, runEdmFileComparison::found, edm::Event::getByToken(), mps_fire::i, createfilelist::int, edm::Ref< C, T, F >::isNull(), HSCParticleProducer_cff::maxInvPtDiff, electronTrackIsolations_cfi::minDR, eostools::move(), edm::Event::put(), mps_fire::result, alignCSCRings::s, lumiQTWidget::t, HiIsolationCommonParameters_cff::track, HSCParticleProducer_cff::useBetaFromEcal, HSCParticleProducer_cff::useBetaFromMuon, HSCParticleProducer_cff::useBetaFromRpc, and HSCParticleProducer_cff::useBetaFromTk.

82  {
83 
84  using namespace edm;
85  using namespace reco;
86  using namespace std;
87  using namespace susybsm;
88 
89  // information from the muons
90  edm::Handle<reco::MuonCollection> muonCollectionHandle;
91  iEvent.getByToken(m_muonsToken,muonCollectionHandle);
92 
93  //information from the mean timer muons
94  edm::Handle<reco::MuonCollection> MTmuonCollectionHandle;
95  iEvent.getByToken(m_MTmuonsToken,MTmuonCollectionHandle);
96 
97  // information from the tracks
98  edm::Handle<reco::TrackCollection> trackCollectionHandle;
99  iEvent.getByToken(m_trackToken,trackCollectionHandle);
100 
101  // information from the tracks iso
102  edm::Handle<reco::TrackCollection> trackIsoCollectionHandle;
103  iEvent.getByToken(m_trackIsoToken,trackIsoCollectionHandle);
104 
105 
106  // creates the output collection
108  std::unique_ptr<susybsm::HSCParticleCollection> result(hscp);
109 
111  std::unique_ptr<susybsm::HSCPCaloInfoCollection> caloInfoCollaptr(caloInfoColl);
112 
113 
114  // Fill the output collection with HSCP Candidate (the candiate only contains ref to muon AND/OR track object)
115  *hscp = getHSCPSeedCollection(trackCollectionHandle, muonCollectionHandle, MTmuonCollectionHandle);
116 
117  // find the track ref for isolation purposed (main track is supposed to be the Iso track after refitting)
118  for(susybsm::HSCParticleCollection::iterator hscpcandidate = hscp->begin(); hscpcandidate != hscp->end(); ++hscpcandidate) {
119  // Matching is needed because input track collection and muon inner track may lightly differs due to track refit
120  reco::TrackRef track = hscpcandidate->trackRef();
121  if(track.isNull())continue;
122  float dRMin=1000; int found = -1;
123  for(unsigned int t=0; t<trackIsoCollectionHandle->size();t++) {
124  reco::TrackRef Isotrack = reco::TrackRef( trackIsoCollectionHandle, t );
125  if( fabs( (1.0/track->pt())-(1.0/Isotrack->pt())) > maxInvPtDiff) continue;
126  float dR = deltaR(track->momentum(), Isotrack->momentum());
127  if(dR <= minDR && dR < dRMin){ dRMin=dR; found = t;}
128  }
129  if(found>=0)hscpcandidate->setTrackIso(reco::TrackRef( trackIsoCollectionHandle, found ));
130  }
131 
132  // compute the TRACKER contribution
133  if(useBetaFromTk){
134  for(susybsm::HSCParticleCollection::iterator hscpcandidate = hscp->begin(); hscpcandidate != hscp->end(); ++hscpcandidate) {
135  beta_calculator_TK->addInfoToCandidate(*hscpcandidate, iEvent,iSetup);
136  }}
137 
138  // compute the MUON contribution
139  if(useBetaFromMuon){
140  for(susybsm::HSCParticleCollection::iterator hscpcandidate = hscp->begin(); hscpcandidate != hscp->end(); ++hscpcandidate) {
141  beta_calculator_MUON->addInfoToCandidate(*hscpcandidate, iEvent,iSetup);
142  }}
143 
144  // compute the RPC contribution
145  if(useBetaFromRpc){
146  for(susybsm::HSCParticleCollection::iterator hscpcandidate = hscp->begin(); hscpcandidate != hscp->end(); ++hscpcandidate) {
147  beta_calculator_RPC->addInfoToCandidate(*hscpcandidate, iEvent, iSetup);
148  }}
149 
150  // compute the ECAL contribution
151  if(useBetaFromEcal){
152  int Index=0;
153  caloInfoColl->resize(hscp->size());
154  for(susybsm::HSCParticleCollection::iterator hscpcandidate = hscp->begin(); hscpcandidate != hscp->end(); ++hscpcandidate, Index++) {
155  beta_calculator_ECAL->addInfoToCandidate(*hscpcandidate,trackCollectionHandle,iEvent,iSetup, (*caloInfoColl)[Index]);
156  }}
157 
158  // cleanup the collection based on the input selection
159  for(int i=0;i<(int)hscp->size();i++) {
160  susybsm::HSCParticleCollection::iterator hscpcandidate = hscp->begin() + i;
161  bool decision = false;
162  for(unsigned int s=0;s<Selectors.size();s++){decision |= Selectors[s]->isSelected(*hscpcandidate);}
163  if(!decision){
164  hscp->erase(hscpcandidate);
165  if(useBetaFromEcal)caloInfoColl->erase(caloInfoColl->begin() + i);
166  i--;
167  }
168  }
169  bool filterResult = !Filter_ || (Filter_ && !hscp->empty());
170 
171 
172 
173 
174  // output result
175  if(useBetaFromEcal){
176  edm::OrphanHandle<susybsm::HSCPCaloInfoCollection> caloInfoHandle= iEvent.put(std::move(caloInfoCollaptr));
177  // adding the reftoCaloInfoObject to the HSCP Object
178  for(int i=0;i<(int)hscp->size();i++) {
179  susybsm::HSCParticleCollection::iterator hscpcandidate = hscp->begin() + i;
180  hscpcandidate->setCaloInfo(HSCPCaloInfoRef(caloInfoHandle,i));
181  }
182  }
183 
184 
185  // output result
186 
187 
189 // if(useBetaFromEcal){
190 // edm::RefProd<susybsm::HSCParticleCollection> hscpCollectionHandle = iEvent.getRefBeforePut<susybsm::HSCParticleCollection>();
191 // filler.insert(putHandle, CaloInfoColl.begin(), CaloInfoColl.end());
192 // filler.fill();
193 // iEvent.put(std::move(CaloInfoMap));
194 // }
195 
196  return filterResult;
197 }
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:127
std::vector< HSCPCaloInfo > HSCPCaloInfoCollection
Definition: HSCPCaloInfo.h:58
edm::EDGetTokenT< reco::MuonCollection > m_muonsToken
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:508
void addInfoToCandidate(susybsm::HSCParticle &candidate, const edm::Event &iEvent, const edm::EventSetup &iSetup)
BetaCalculatorMUON * beta_calculator_MUON
void addInfoToCandidate(susybsm::HSCParticle &candidate, edm::Handle< reco::TrackCollection > &tracks, edm::Event &iEvent, const edm::EventSetup &iSetup, susybsm::HSCPCaloInfo &caloInfo)
BetaCalculatorTK * beta_calculator_TK
void addInfoToCandidate(susybsm::HSCParticle &candidate, edm::Event &iEvent, const edm::EventSetup &iSetup)
BetaCalculatorECAL * beta_calculator_ECAL
edm::Ref< HSCPCaloInfoCollection > HSCPCaloInfoRef
Definition: HSCPCaloInfo.h:60
std::vector< HSCParticle > HSCParticleCollection
Definition: HSCParticle.h:94
edm::EDGetTokenT< reco::MuonCollection > m_MTmuonsToken
void addInfoToCandidate(susybsm::HSCParticle &candidate, edm::Event &iEvent, const edm::EventSetup &iSetup)
bool isNull() const
Checks for null.
Definition: Ref.h:250
double deltaR(double eta1, double eta2, double phi1, double phi2)
Definition: TreeUtility.cc:17
edm::EDGetTokenT< reco::TrackCollection > m_trackToken
edm::Ref< TrackCollection > TrackRef
persistent reference to a Track
Definition: TrackFwd.h:20
BetaCalculatorRPC * beta_calculator_RPC
std::vector< CandidateSelector * > Selectors
std::vector< susybsm::HSCParticle > getHSCPSeedCollection(edm::Handle< reco::TrackCollection > &trackCollectionHandle, edm::Handle< reco::MuonCollection > &muonCollectionHandle, edm::Handle< reco::MuonCollection > &MTmuonCollectionHandle)
fixed size matrix
HLT enums.
edm::EDGetTokenT< reco::TrackCollection > m_trackIsoToken
def move(src, dest)
Definition: eostools.py:510
std::vector< HSCParticle > HSCParticleProducer::getHSCPSeedCollection ( edm::Handle< reco::TrackCollection > &  trackCollectionHandle,
edm::Handle< reco::MuonCollection > &  muonCollectionHandle,
edm::Handle< reco::MuonCollection > &  MTmuonCollectionHandle 
)
private

Definition at line 209 of file HSCParticleProducer.cc.

References DEFINE_FWK_MODULE, deltaR(), PFRecoTauDiscriminationAgainstElectronDeadECAL_cfi::dR, allElectronIsolations_cfi::dRMin, runEdmFileComparison::found, mps_fire::i, reco::isMuon(), edm::Ref< C, T, F >::isNonnull(), edm::Ref< C, T, F >::isNull(), funct::m, HSCParticleProducer_cff::maxInvPtDiff, HSCParticleProducer_cff::maxTkChi2, electronTrackIsolations_cfi::minDR, HSCParticleProducer_cff::minMTDR, HSCParticleProducer_cff::minMTMuPt, HSCParticleProducer_cff::minMuP, HSCParticleProducer_cff::minSAMuPt, HSCParticleProducer_cff::minTkHits, HSCParticleProducer_cff::minTkP, susybsm::HSCParticle::setMTMuon(), susybsm::HSCParticle::setMuon(), susybsm::HSCParticle::setTrack(), lumiQTWidget::t, HiIsolationCommonParameters_cff::track, and l1t::tracks.

210 {
211  std::vector<HSCParticle> HSCPCollection;
212 
213  // Store a local vector of track ref (that can be modified if matching)
214  std::vector<reco::TrackRef> tracks;
215  for(unsigned int i=0; i<trackCollectionHandle->size(); i++){
216  TrackRef track = reco::TrackRef( trackCollectionHandle, i );
217 
218  //If track is from muon always keep it
219  bool isMuon=false;
220  for(unsigned int m=0; m<muonCollectionHandle->size(); m++){
221  reco::MuonRef muon = reco::MuonRef( muonCollectionHandle, m );
222  TrackRef innertrack = muon->innerTrack();
223  if(innertrack.isNull())continue;
224  if( fabs( (1.0/innertrack->pt())-(1.0/track->pt())) > maxInvPtDiff) continue;
225  float dR = deltaR(innertrack->momentum(), track->momentum());
226  if(dR <= minDR) isMuon=true;
227  }
228 
229  if((track->p()<minTkP || (track->chi2()/track->ndof())>maxTkChi2 || track->found()<minTkHits) && !isMuon)continue;
230  tracks.push_back( track );
231  }
232 
233  // Loop on muons with inner track ref and create Muon HSCP Candidate
234  for(unsigned int m=0; m<muonCollectionHandle->size(); m++){
235  reco::MuonRef muon = reco::MuonRef( muonCollectionHandle, m );
236  double SApt=-1;
237  if(muon->isStandAloneMuon()) SApt=muon->standAloneMuon()->pt();
238  if(muon->p()<minMuP && SApt<minSAMuPt)continue;
239  TrackRef innertrack = muon->innerTrack();
240  if(innertrack.isNull())continue;
241 
242  // Check if the inner track match any track in order to create a Muon+Track HSCP Candidate
243  // Matching is needed because input track collection and muon inner track may lightly differs due to track refit
244  float dRMin=1000; int found = -1;
245  for(unsigned int t=0; t<tracks.size();t++) {
246  reco::TrackRef track = tracks[t];
247  if( fabs( (1.0/innertrack->pt())-(1.0/track->pt())) > maxInvPtDiff) continue;
248  float dR = deltaR(innertrack->momentum(), track->momentum());
249  if(dR <= minDR && dR < dRMin){ dRMin=dR; found = t;}
250  }
251 
252  HSCParticle candidate;
253  candidate.setMuon(muon);
254  if(found>=0){
255 // printf("MUON with Inner Track Matching --> DR = %6.2f (%6.2f %+6.2f %+6.2f):(%6.2f %+6.2f %+6.2f) vs (%6.2f %+6.2f %+6.2f)\n",dRMin,muon->pt(), muon->eta(), muon->phi(), innertrack->pt(), innertrack->eta(), innertrack->phi(), tracks[found]->pt(), tracks[found]->eta(), tracks[found]->phi() );
256  candidate.setTrack(tracks[found]);
257  tracks.erase(tracks.begin()+found);
258  }
259  HSCPCollection.push_back(candidate);
260  }
261 
262  // Loop on muons without inner tracks and create Muon HSCP Candidate
263  for(unsigned int m=0; m<muonCollectionHandle->size(); m++){
264  reco::MuonRef muon = reco::MuonRef( muonCollectionHandle, m );
265  double SApt=-1;
266  if(muon->isStandAloneMuon()) SApt=muon->standAloneMuon()->pt();
267  if(muon->p()<minMuP && SApt<minSAMuPt)continue;
268  TrackRef innertrack = muon->innerTrack();
269  if(innertrack.isNonnull())continue;
270 
271  // Check if the muon match any track in order to create a Muon+Track HSCP Candidate
272  float dRMin=1000; int found = -1;
273  for(unsigned int t=0; t<tracks.size();t++) {
274  reco::TrackRef track = tracks[t];
275  if( fabs( (1.0/muon->pt())-(1.0/track->pt())) > maxInvPtDiff) continue;
276  float dR = deltaR(muon->momentum(), track->momentum());
277  if(dR <= minDR && dR < dRMin){ dRMin=dR; found = t;}
278  }
279 
280  HSCParticle candidate;
281  candidate.setMuon(muon);
282  if(found>=0){
283 // printf("MUON without Inner Track Matching --> DR = %6.2f (%6.2f %+6.2f %+6.2f) vs (%6.2f %+6.2f %+6.2f)\n",dRMin,muon->pt(), muon->eta(), muon->phi(), tracks[found]->pt(), tracks[found]->eta(), tracks[found]->phi() );
284  candidate.setTrack(tracks[found]);
285  tracks.erase(tracks.begin()+found);
286  }
287  HSCPCollection.push_back(candidate);
288  }
289 
290 
291  //Loop on MT muons and add to collection
292  for(unsigned int m=0; m<MTmuonCollectionHandle->size(); m++){
293  reco::MuonRef MTmuon = reco::MuonRef( MTmuonCollectionHandle, m );
294  if(MTmuon->pt()<minMTMuPt )continue;
295 
296  //Check if matches muon HSCP candidate and add reference
297  float dRMin=1000; int found = -1;
298  for(unsigned int i=0; i<HSCPCollection.size(); i++) {
299  if(!HSCPCollection[i].hasMuonRef()) continue;
300  reco::MuonRef muon = HSCPCollection[i].muonRef();
301  float dR = deltaR(muon->momentum(), MTmuon->momentum());
302  if(dR <= minMTDR && dR < dRMin){ dRMin=dR; found = i;}
303  }
304  if(found>-1) HSCPCollection[found].setMTMuon(MTmuon);
305  else {
306  HSCParticle candidate;
307  candidate.setMTMuon(MTmuon);
308  HSCPCollection.push_back(candidate);
309  }
310  }
311 
312 
313  // Loop on tracks not matching muon and create Track HSCP Candidate
314  for(unsigned int i=0; i<tracks.size(); i++){
315  HSCParticle candidate;
316  candidate.setTrack(tracks[i]);
317  HSCPCollection.push_back(candidate);
318  }
319 
320  return HSCPCollection;
321 }
void setMuon(const reco::MuonRef &data)
Definition: HSCParticle.h:63
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:253
bool isMuon(const Candidate &part)
Definition: pdgIdUtils.h:11
void setMTMuon(const reco::MuonRef &data)
Definition: HSCParticle.h:64
edm::Ref< MuonCollection > MuonRef
presistent reference to a Muon
Definition: MuonFwd.h:13
bool isNull() const
Checks for null.
Definition: Ref.h:250
double deltaR(double eta1, double eta2, double phi1, double phi2)
Definition: TreeUtility.cc:17
edm::Ref< TrackCollection > TrackRef
persistent reference to a Track
Definition: TrackFwd.h:20
void setTrack(const reco::TrackRef &data)
Definition: HSCParticle.h:65

Member Data Documentation

BetaCalculatorECAL* HSCParticleProducer::beta_calculator_ECAL
private

Definition at line 92 of file HSCParticleProducer.h.

BetaCalculatorMUON* HSCParticleProducer::beta_calculator_MUON
private

Definition at line 90 of file HSCParticleProducer.h.

BetaCalculatorRPC* HSCParticleProducer::beta_calculator_RPC
private

Definition at line 91 of file HSCParticleProducer.h.

BetaCalculatorTK* HSCParticleProducer::beta_calculator_TK
private

Definition at line 89 of file HSCParticleProducer.h.

bool HSCParticleProducer::Filter_
private

Definition at line 67 of file HSCParticleProducer.h.

edm::EDGetTokenT<reco::MuonCollection> HSCParticleProducer::m_MTmuonsToken
private

Definition at line 72 of file HSCParticleProducer.h.

edm::EDGetTokenT<reco::MuonCollection> HSCParticleProducer::m_muonsToken
private

Definition at line 71 of file HSCParticleProducer.h.

edm::EDGetTokenT<reco::TrackCollection> HSCParticleProducer::m_trackIsoToken
private

Definition at line 70 of file HSCParticleProducer.h.

edm::EDGetTokenT<reco::TrackCollection> HSCParticleProducer::m_trackToken
private

Definition at line 69 of file HSCParticleProducer.h.

float HSCParticleProducer::maxInvPtDiff
private

Definition at line 87 of file HSCParticleProducer.h.

float HSCParticleProducer::maxTkChi2
private

Definition at line 80 of file HSCParticleProducer.h.

float HSCParticleProducer::minDR
private

Definition at line 85 of file HSCParticleProducer.h.

float HSCParticleProducer::minMTDR
private

Definition at line 86 of file HSCParticleProducer.h.

float HSCParticleProducer::minMTMuPt
private

Definition at line 84 of file HSCParticleProducer.h.

float HSCParticleProducer::minMuP
private

Definition at line 82 of file HSCParticleProducer.h.

float HSCParticleProducer::minSAMuPt
private

Definition at line 83 of file HSCParticleProducer.h.

unsigned int HSCParticleProducer::minTkHits
private

Definition at line 81 of file HSCParticleProducer.h.

float HSCParticleProducer::minTkP
private

Definition at line 79 of file HSCParticleProducer.h.

std::vector<CandidateSelector*> HSCParticleProducer::Selectors
private

Definition at line 94 of file HSCParticleProducer.h.

bool HSCParticleProducer::useBetaFromEcal
private

Definition at line 77 of file HSCParticleProducer.h.

bool HSCParticleProducer::useBetaFromMuon
private

Definition at line 75 of file HSCParticleProducer.h.

bool HSCParticleProducer::useBetaFromRpc
private

Definition at line 76 of file HSCParticleProducer.h.

bool HSCParticleProducer::useBetaFromTk
private

Definition at line 74 of file HSCParticleProducer.h.