1 #ifndef RecoCandidate_IsoDeposit_H 2 #define RecoCandidate_IsoDeposit_H 29 namespace isodeposit {
33 virtual bool veto(
double eta,
double phi,
float value)
const = 0;
36 virtual void centerOn(
double eta,
double phi) {
37 throw cms::Exception(
"Not Implemented") <<
"This AbsVeto implementation (" <<
typeid(
this).
name() <<
") does not support the centerOn(eta,phi) method";
61 Veto(Direction
dir,
double d):vetoDir(dir), dR(d) {}
63 typedef std::vector<Veto>
Vetos;
73 const Direction &
direction()
const {
return theDirection; }
74 double eta()
const {
return theDirection.eta();}
75 double phi()
const {
return theDirection.phi();}
83 void addDeposit(
double dr,
double deposit);
84 void addDeposit(
const Direction & depDir,
double deposit);
89 const Vetos &
vetos = Vetos(),
90 bool skipDepositVeto =
false 94 double depositWithin( Direction
dir,
96 const Vetos &
vetos = Vetos(),
97 bool skipDepositVeto =
false 101 std::pair<double,int>
102 depositAndCountWithin(
104 const Vetos &
vetos = Vetos(),
106 bool skipDepositVeto =
false 110 std::pair<double,int>
111 depositAndCountWithin(
114 const Vetos &
vetos = Vetos(),
116 bool skipDepositVeto =
false 120 double depositWithin(
122 const AbsVetos &
vetos,
123 bool skipDepositVeto =
false 127 std::pair<double,int>
128 depositAndCountWithin(
130 const AbsVetos & vetos,
131 bool skipDepositVeto =
false 147 float dR()
const {
return it_->first.deltaR; }
148 float eta()
const {
if (!cacheReady_) doDir();
return cache_.eta(); }
149 float phi()
const {
if (!cacheReady_) doDir();
return cache_.phi(); }
150 float value()
const {
return it_->second; }
155 void doDir()
const { cache_ = parent_->direction() + it_->first; cacheReady_ =
true; }
157 parent_(parent), it_(it), cache_(), cacheReady_(
false) { }
159 mutable std::multimap<Distance, float>::const_iterator
it_;
169 void operator+=(DepIterator deposit) { sum_ += deposit->second; }
187 void operator+=(DepIterator deposit) { sum2_ += deposit->second*deposit->second; }
188 void operator+=(
double deposit) { sum2_ += deposit*deposit; }
196 void operator+=(DepIterator deposit) {
if (deposit->second > max_) max_ = deposit->second; }
197 void operator+=(
double deposit) {
if (deposit > max_) max_ = deposit; }
206 void operator+=(DepIterator deposit) {sum_ +=deposit->first.deltaR; count_+=1.0; }
216 void operator+=(DepIterator deposit) {sum_ +=deposit->first.deltaR;}
223 template<
typename Algo>
224 double algoWithin(
double coneSize,
225 const AbsVetos & vetos =
AbsVetos(),
226 bool skipDepositVeto =
false 229 template<
typename Algo>
230 double algoWithin(
const Direction &,
232 const AbsVetos & vetos =
AbsVetos(),
233 bool skipDepositVeto =
false 236 double countWithin(
double coneSize,
237 const AbsVetos & vetos =
AbsVetos(),
238 bool skipDepositVeto =
false 241 double sumWithin(
double coneSize,
242 const AbsVetos & vetos =
AbsVetos(),
243 bool skipDepositVeto =
false 246 double sumWithin(
const Direction & dir,
248 const AbsVetos & vetos =
AbsVetos(),
249 bool skipDepositVeto =
false 251 double sum2Within(
double coneSize,
252 const AbsVetos & vetos =
AbsVetos(),
253 bool skipDepositVeto =
false 256 double maxWithin(
double coneSize,
257 const AbsVetos & vetos =
AbsVetos(),
258 bool skipDepositVeto =
false 261 double nearestDR(
double coneSize,
262 const AbsVetos & vetos =
AbsVetos(),
263 bool skipDepositVeto =
false 287 template<
typename Algo>
292 typedef AbsVetos::const_iterator IV;
293 IV ivEnd = vetos.end();
296 typedef DepositsMultimap::const_iterator IM;
297 IM imLoc = theDeposits.upper_bound( maxDistance );
298 for (IM im = theDeposits.begin(); im != imLoc; ++im) {
300 Direction dirDep = theDirection+im->first;
301 for (IV iv = vetos.begin(); iv < ivEnd; ++iv) {
302 if ((*iv)->veto(dirDep.
eta(), dirDep.
phi(), im->second)) { vetoed =
true;
break; }
305 if (skipDepositVeto || (dirDep.
deltaR(theVeto.vetoDir) > theVeto.dR)) {
310 return algo.result();
313 template<
typename Algo>
315 const AbsVetos& vetos,
bool skipDepositVeto)
const 319 typedef AbsVetos::const_iterator IV;
320 IV ivEnd = vetos.end();
321 typedef DepositsMultimap::const_iterator IM;
322 IM imLoc = theDeposits.end();
323 for (IM im = theDeposits.begin(); im != imLoc; ++im) {
325 Direction dirDep = theDirection+im->first;
326 Distance newDist = dirDep -
dir;
327 if(newDist.
deltaR > coneSize)
continue;
328 for (IV iv = vetos.begin(); iv < ivEnd; ++iv) {
329 if ((*iv)->veto(dirDep.
eta(), dirDep.
phi(), im->second)) { vetoed =
true;
break; }
332 if (skipDepositVeto || (dirDep.
deltaR(theVeto.vetoDir) > theVeto.dR)) {
337 return algo.result();
double candEnergy() const
Get energy or pT attached to cand trajectory.
const Direction & direction() const
Get direction of isolation cone.
virtual void centerOn(double eta, double phi)
const Veto & veto() const
Get veto area.
void operator+=(double deposit)
void operator+=(DepIterator deposit)
DepositsMultimap::const_iterator DepIterator
void setVeto(const Veto &aVeto)
Set veto.
double algoWithin(double coneSize, const AbsVetos &vetos=AbsVetos(), bool skipDepositVeto=false) const
Get some info about the deposit (e.g. sum, max, sum2, count)
const reco::IsoDeposit * parent_
Direction::Distance Distance
void operator+=(DepIterator deposit)
virtual ~IsoDeposit()
Destructor.
S & print(S &os, JobReport::InputFile const &f)
Veto(Direction dir, double d)
void operator+=(double deposit)
void operator+=(DepIterator deposit)
void operator+=(DepIterator deposit)
const const_iterator * operator->() const
Veto theVeto
area to be excluded in computaion of depositWithin
void operator+=(DepIterator deposit)
DepositsMultimap theDeposits
the deposits identifed by relative position to center of cone and deposit value
const const_iterator & operator++()
void addCandEnergy(double et)
Set energy or pT attached to cand trajectory.
std::multimap< Distance, float > DepositsMultimap
const_iterator begin() const
std::multimap< Distance, float >::const_iterator it_
const_iterator(const IsoDeposit *parent, std::multimap< Distance, float >::const_iterator it)
reco::IsoDeposit IsoDeposit
et
define resolution functions of each parameter
void operator+=(double deposit)
isodeposit::AbsVeto AbsVeto
std::vector< Veto > Vetos
std::vector< AbsVeto * > AbsVetos
void operator+=(DepIterator deposit)
isodeposit::Direction Direction
float theCandTag
float tagging cand, ment to be transverse energy or pT attached to cand,
Direction theDirection
direcion of deposit (center of isolation cone)
isodeposit::AbsVetos AbsVetos
const_iterator end() const
virtual bool veto(double eta, double phi, float value) const =0
Return "true" if a deposit at specific (eta,phi) with that value must be vetoed in the sum...
bool operator!=(const const_iterator &it2)
void operator+=(double deposit)
Direction::Distance Distance
double deltaR(const Direction &dir2) const