55 if(useBetaFromMuon)beta_calculator_MUON =
new BetaCalculatorMUON(iConfig, consumesCollector());
56 if(useBetaFromRpc )beta_calculator_RPC =
new BetaCalculatorRPC (iConfig, consumesCollector());
57 if(useBetaFromEcal)beta_calculator_ECAL =
new BetaCalculatorECAL(iConfig, consumesCollector());
61 for(
unsigned int i=0;
i<SelectionParameters.size();
i++){
66 produces<susybsm::HSCParticleCollection >();
67 if(useBetaFromEcal)produces<susybsm::HSCPCaloInfoCollection >();
91 iEvent.
getByToken(m_muonsToken,muonCollectionHandle);
95 iEvent.
getByToken(m_MTmuonsToken,MTmuonCollectionHandle);
99 iEvent.
getByToken(m_trackToken,trackCollectionHandle);
103 iEvent.
getByToken(m_trackIsoToken,trackIsoCollectionHandle);
108 std::unique_ptr<susybsm::HSCParticleCollection>
result(hscp);
111 std::unique_ptr<susybsm::HSCPCaloInfoCollection> caloInfoCollaptr(caloInfoColl);
115 *hscp = getHSCPSeedCollection(trackCollectionHandle, muonCollectionHandle, MTmuonCollectionHandle);
118 for(susybsm::HSCParticleCollection::iterator hscpcandidate = hscp->begin(); hscpcandidate != hscp->end(); ++hscpcandidate) {
121 if(track.
isNull())
continue;
123 for(
unsigned int t=0;
t<trackIsoCollectionHandle->size();
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;}
129 if(found>=0)hscpcandidate->setTrackIso(
reco::TrackRef( trackIsoCollectionHandle, found ));
134 for(susybsm::HSCParticleCollection::iterator hscpcandidate = hscp->begin(); hscpcandidate != hscp->end(); ++hscpcandidate) {
135 beta_calculator_TK->addInfoToCandidate(*hscpcandidate, iEvent,iSetup);
140 for(susybsm::HSCParticleCollection::iterator hscpcandidate = hscp->begin(); hscpcandidate != hscp->end(); ++hscpcandidate) {
141 beta_calculator_MUON->addInfoToCandidate(*hscpcandidate, iEvent,iSetup);
146 for(susybsm::HSCParticleCollection::iterator hscpcandidate = hscp->begin(); hscpcandidate != hscp->end(); ++hscpcandidate) {
147 beta_calculator_RPC->addInfoToCandidate(*hscpcandidate, iEvent, iSetup);
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]);
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);}
164 hscp->erase(hscpcandidate);
169 bool filterResult = !Filter_ || (Filter_ && !hscp->empty());
178 for(
int i=0;
i<(
int)hscp->size();
i++) {
179 susybsm::HSCParticleCollection::iterator hscpcandidate = hscp->begin() +
i;
211 std::vector<HSCParticle> HSCPCollection;
214 std::vector<reco::TrackRef>
tracks;
215 for(
unsigned int i=0;
i<trackCollectionHandle->size();
i++){
220 for(
unsigned int m=0;
m<muonCollectionHandle->size();
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;
230 tracks.push_back( track );
234 for(
unsigned int m=0;
m<muonCollectionHandle->size();
m++){
237 if(muon->isStandAloneMuon()) SApt=muon->standAloneMuon()->pt();
239 TrackRef innertrack = muon->innerTrack();
240 if(innertrack.
isNull())
continue;
245 for(
unsigned int t=0;
t<tracks.size();
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;}
257 tracks.erase(tracks.begin()+
found);
259 HSCPCollection.push_back(candidate);
263 for(
unsigned int m=0;
m<muonCollectionHandle->size();
m++){
266 if(muon->isStandAloneMuon()) SApt=muon->standAloneMuon()->pt();
268 TrackRef innertrack = muon->innerTrack();
273 for(
unsigned int t=0;
t<tracks.size();
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;}
285 tracks.erase(tracks.begin()+
found);
287 HSCPCollection.push_back(candidate);
292 for(
unsigned int m=0;
m<MTmuonCollectionHandle->size();
m++){
298 for(
unsigned int i=0;
i<HSCPCollection.size();
i++) {
299 if(!HSCPCollection[
i].hasMuonRef())
continue;
301 float dR =
deltaR(muon->momentum(), MTmuon->momentum());
302 if(dR <=
minMTDR && dR < dRMin){ dRMin=
dR; found =
i;}
304 if(found>-1) HSCPCollection[
found].setMTMuon(MTmuon);
308 HSCPCollection.push_back(candidate);
314 for(
unsigned int i=0;
i<tracks.size();
i++){
317 HSCPCollection.push_back(candidate);
320 return HSCPCollection;
void setMuon(const reco::MuonRef &data)
T getParameter(std::string const &) const
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
bool isNonnull() const
Checks for non-null.
bool isMuon(const Candidate &part)
std::vector< HSCPCaloInfo > HSCPCaloInfoCollection
bool getByToken(EDGetToken token, Handle< PROD > &result) const
#define DEFINE_FWK_MODULE(type)
void setMTMuon(const reco::MuonRef &data)
edm::Ref< HSCPCaloInfoCollection > HSCPCaloInfoRef
std::vector< HSCParticle > HSCParticleCollection
edm::Ref< MuonCollection > MuonRef
presistent reference to a Muon
bool filter(edm::Event &, const edm::EventSetup &) override
bool isNull() const
Checks for null.
double deltaR(double eta1, double eta2, double phi1, double phi2)
edm::Ref< TrackCollection > TrackRef
persistent reference to a Track
~HSCParticleProducer() override
std::vector< susybsm::HSCParticle > getHSCPSeedCollection(edm::Handle< reco::TrackCollection > &trackCollectionHandle, edm::Handle< reco::MuonCollection > &muonCollectionHandle, edm::Handle< reco::MuonCollection > &MTmuonCollectionHandle)
HSCParticleProducer(const edm::ParameterSet &)
void setTrack(const reco::TrackRef &data)