00001
00002 #include "StjeJetCuts.h"
00003
00004 #include <StJetFinder/StProtoJet.h>
00005 #include <StJetFinder/StJetPars.h>
00006
00007 #include <algorithm>
00008 #include <iterator>
00009
00010 using namespace std;
00011
00012 StjeJetCuts::StjeJetCuts(const StppAnaPars* ap, ProtoJetList& protoJets)
00013 : _protoJetList(protoJets)
00014 , _anaPar(*ap)
00015 {
00016
00017 }
00018
00019 StjeJetCuts::~StjeJetCuts()
00020 {
00021
00022 }
00023
00024 void StjeJetCuts::Apply()
00025 {
00026 ProtoJetList newList;
00027
00028 for (ProtoJetList::iterator jet = _protoJetList.begin(); jet != _protoJetList.end(); ++jet) {
00029
00030 if(shouldNotKeep(*jet)) continue;
00031
00032 newList.push_back(*jet);
00033
00034 }
00035
00036 _protoJetList.clear();
00037
00038 copy(newList.begin(), newList.end(), back_inserter(_protoJetList));
00039 }
00040
00041 bool StjeJetCuts::shouldNotKeep(StProtoJet &pj)
00042 {
00043 if(pj.pt() <= _anaPar.mJetPtMin) return true;
00044
00045 if(fabs(pj.eta()) >= _anaPar.mJetEtaMax) return true;
00046
00047 if(fabs(pj.eta()) <= _anaPar.mJetEtaMin) return true;
00048
00049 if((int)pj.numberOfParticles() < _anaPar.mJetNmin) return true;
00050
00051 return false;
00052 }