22 using namespace susybsm;
38 useBetaFromTk = iConfig.
getParameter<
bool> (
"useBetaFromTk" );
39 useBetaFromMuon = iConfig.
getParameter<
bool> (
"useBetaFromMuon");
40 useBetaFromRpc = iConfig.
getParameter<
bool> (
"useBetaFromRpc" );
41 useBetaFromEcal = iConfig.
getParameter<
bool> (
"useBetaFromEcal");
52 maxInvPtDiff = iConfig.
getParameter<
double> (
"maxInvPtDiff");
54 if(useBetaFromTk )beta_calculator_TK =
new BetaCalculatorTK (iConfig, consumesCollector());
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());
60 std::vector<edm::ParameterSet> SelectionParameters = iConfig.
getParameter<std::vector<edm::ParameterSet> >(
"SelectionParameters");
61 for(
unsigned int i=0;
i<SelectionParameters.size();
i++){
66 produces<susybsm::HSCParticleCollection >();
67 if(useBetaFromEcal)produces<susybsm::HSCPCaloInfoCollection >();
87 using namespace susybsm;
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::auto_ptr<susybsm::HSCParticleCollection>
result(hscp);
111 std::auto_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;
122 float dRMin=1000;
int found = -1;
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);
165 if(useBetaFromEcal)caloInfoColl->erase(caloInfoColl->begin() +
i);
169 bool filterResult = !Filter_ || (Filter_ && hscp->size()>=1);
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;
229 if((track->p()<minTkP || (track->chi2()/track->ndof())>maxTkChi2 || track->found()<minTkHits) && !isMuon)
continue;
230 tracks.push_back( track );
234 for(
unsigned int m=0;
m<muonCollectionHandle->size();
m++){
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;
244 float dRMin=1000;
int found = -1;
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();
267 if(muon->p()<minMuP && SApt<minSAMuPt)
continue;
268 TrackRef innertrack = muon->innerTrack();
272 float dRMin=1000;
int found = -1;
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++){
294 if(MTmuon->pt()<minMTMuPt )
continue;
297 float dRMin=1000;
int found = -1;
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
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
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
edm::Ref< MuonCollection > MuonRef
presistent reference to a Muon
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
std::vector< susybsm::HSCParticle > getHSCPSeedCollection(edm::Handle< reco::TrackCollection > &trackCollectionHandle, edm::Handle< reco::MuonCollection > &muonCollectionHandle, edm::Handle< reco::MuonCollection > &MTmuonCollectionHandle)
HSCParticleProducer(const edm::ParameterSet &)
virtual bool filter(edm::Event &, const edm::EventSetup &)
void setTrack(const reco::TrackRef &data)