24 using namespace susybsm;
39 useBetaFromTk = iConfig.
getParameter<
bool> (
"useBetaFromTk" );
40 useBetaFromMuon = iConfig.
getParameter<
bool> (
"useBetaFromMuon");
41 useBetaFromRpc = iConfig.
getParameter<
bool> (
"useBetaFromRpc" );
42 useBetaFromEcal = iConfig.
getParameter<
bool> (
"useBetaFromEcal");
50 maxInvPtDiff = iConfig.
getParameter<
double> (
"maxInvPtDiff");
58 std::vector<edm::ParameterSet> SelectionParameters = iConfig.
getParameter<std::vector<edm::ParameterSet> >(
"SelectionParameters");
59 for(
unsigned int i=0;
i<SelectionParameters.size();
i++){
64 produces<susybsm::HSCParticleCollection >();
65 if(useBetaFromEcal)produces<susybsm::HSCPCaloInfoCollection >();
85 using namespace susybsm;
89 iEvent.
getByLabel(m_muonsTag,muonCollectionHandle);
93 iEvent.
getByLabel(m_trackTag,trackCollectionHandle);
97 iEvent.
getByLabel(m_trackIsoTag,trackIsoCollectionHandle);
102 std::auto_ptr<susybsm::HSCParticleCollection>
result(hscp);
105 std::auto_ptr<susybsm::HSCPCaloInfoCollection> caloInfoCollaptr(caloInfoColl);
109 *hscp = getHSCPSeedCollection(trackCollectionHandle, muonCollectionHandle);
112 for(susybsm::HSCParticleCollection::iterator hscpcandidate = hscp->begin(); hscpcandidate != hscp->end(); ++hscpcandidate) {
115 if(track.
isNull())
continue;
116 float dRMin=1000;
int found = -1;
117 for(
unsigned int t=0;
t<trackIsoCollectionHandle->size();
t++) {
119 if( fabs( (1.0/track->pt())-(1.0/Isotrack->pt())) > maxInvPtDiff)
continue;
120 float dR =
deltaR(track->momentum(), Isotrack->momentum());
121 if(dR <= minDR && dR < dRMin){ dRMin=
dR; found =
t;}
123 if(found>=0)hscpcandidate->setTrackIso(
reco::TrackRef( trackIsoCollectionHandle, found ));
128 for(susybsm::HSCParticleCollection::iterator hscpcandidate = hscp->begin(); hscpcandidate != hscp->end(); ++hscpcandidate) {
129 beta_calculator_TK->addInfoToCandidate(*hscpcandidate, iEvent,iSetup);
134 for(susybsm::HSCParticleCollection::iterator hscpcandidate = hscp->begin(); hscpcandidate != hscp->end(); ++hscpcandidate) {
135 beta_calculator_MUON->addInfoToCandidate(*hscpcandidate, iEvent,iSetup);
140 for(susybsm::HSCParticleCollection::iterator hscpcandidate = hscp->begin(); hscpcandidate != hscp->end(); ++hscpcandidate) {
141 beta_calculator_RPC->addInfoToCandidate(*hscpcandidate, iEvent, iSetup);
150 caloInfoColl->resize(hscp->size());
151 for(susybsm::HSCParticleCollection::iterator hscpcandidate = hscp->begin(); hscpcandidate != hscp->end(); ++hscpcandidate, Index++) {
152 beta_calculator_ECAL->addInfoToCandidate(*hscpcandidate,trackCollectionHandle,iEvent,iSetup, (*caloInfoColl)[Index]);
156 for(
int i=0;
i<(int)hscp->size();
i++) {
157 susybsm::HSCParticleCollection::iterator hscpcandidate = hscp->begin() +
i;
158 bool decision =
false;
159 for(
unsigned int s=0;
s<Selectors.size();
s++){decision |= Selectors[
s]->isSelected(*hscpcandidate);}
161 hscp->erase(hscpcandidate);
162 if(useBetaFromEcal)caloInfoColl->erase(caloInfoColl->begin() +
i);
166 bool filterResult = !Filter_ || (Filter_ && hscp->size()>=1);
175 for(
int i=0;
i<(int)hscp->size();
i++) {
176 susybsm::HSCParticleCollection::iterator hscpcandidate = hscp->begin() +
i;
208 std::vector<HSCParticle> HSCPCollection;
211 std::vector<reco::TrackRef>
tracks;
212 for(
unsigned int i=0;
i<trackCollectionHandle->size();
i++){
214 if(track->p()<minTkP || (track->chi2()/track->ndof())>maxTkChi2 || track->found()<minTkHits)
continue;
215 tracks.push_back( track );
219 for(
unsigned int m=0;
m<muonCollectionHandle->size();
m++){
221 if(muon->p()<minMuP )
continue;
222 TrackRef innertrack = muon->innerTrack();
223 if(innertrack.
isNull())
continue;
227 float dRMin=1000;
int found = -1;
228 for(
unsigned int t=0;
t<tracks.size();
t++) {
230 if( fabs( (1.0/innertrack->pt())-(1.0/track->pt())) > maxInvPtDiff)
continue;
231 float dR =
deltaR(innertrack->momentum(), track->momentum());
232 if(dR <= minDR && dR < dRMin){ dRMin=
dR; found =
t;}
240 tracks.erase(tracks.begin()+
found);
242 HSCPCollection.push_back(candidate);
246 for(
unsigned int m=0;
m<muonCollectionHandle->size();
m++){
248 if(muon->p()<minMuP)
continue;
249 TrackRef innertrack = muon->innerTrack();
253 float dRMin=1000;
int found = -1;
254 for(
unsigned int t=0;
t<tracks.size();
t++) {
256 if( fabs( (1.0/muon->pt())-(1.0/track->pt())) > maxInvPtDiff)
continue;
257 float dR =
deltaR(muon->momentum(), track->momentum());
258 if(dR <= minDR && dR < dRMin){ dRMin=
dR; found =
t;}
266 tracks.erase(tracks.begin()+
found);
268 HSCPCollection.push_back(candidate);
272 for(
unsigned int i=0;
i<tracks.size();
i++){
275 HSCPCollection.push_back(candidate);
278 return HSCPCollection;
void setMuon(const reco::MuonRef &data)
T getParameter(std::string const &) const
std::vector< susybsm::HSCParticle > getHSCPSeedCollection(edm::Handle< reco::TrackCollection > &trackCollectionHandle, edm::Handle< reco::MuonCollection > &muonCollectionHandle)
std::vector< HSCPCaloInfo > HSCPCaloInfoCollection
#define DEFINE_FWK_MODULE(type)
bool isNonnull() const
Checks for non-null.
edm::Ref< HSCPCaloInfoCollection > HSCPCaloInfoRef
std::vector< HSCParticle > HSCParticleCollection
bool isNull() const
Checks for null.
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
edm::Ref< MuonCollection > MuonRef
presistent reference to a Muon
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
double deltaR(double eta1, double eta2, double phi1, double phi2)
edm::Ref< TrackCollection > TrackRef
persistent reference to a Track
HSCParticleProducer(const edm::ParameterSet &)
virtual bool filter(edm::Event &, const edm::EventSetup &)
void setTrack(const reco::TrackRef &data)