00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036 #ifndef ATLFAST_FUNCTIONOBJECTS_H
00037 #define ATLFAST_FUNCTIONOBJECTS_H
00038
00039 #include "AtlfastCode/IKinematic.h"
00040 #include <cmath>
00041
00042 #include "AtlfastCode/Phi.h"
00043
00044
00045
00046
00047
00048
00049
00050 namespace SortAttribute {
00051
00052
00053
00054
00061 class AscendingPhi {
00062 public:
00063 bool operator()
00064 ( const Atlfast::IKinematic* a, const Atlfast::IKinematic* b ) const {
00065 return( a->phi() < b->phi() ) ; }
00066
00067 bool operator()
00068 ( const Atlfast::IKinematic& a, const Atlfast::IKinematic& b ) const
00069 { return this->operator() ( &a, &b ) ; }
00070 };
00077 class DescendingPhi {
00078 public:
00079 bool operator()
00080 ( const Atlfast::IKinematic* a, const Atlfast::IKinematic* b ) const
00081 { return( a->phi() > b->phi() ) ; }
00082 bool operator()
00083 ( const Atlfast::IKinematic& a, const Atlfast::IKinematic& b ) const
00084 { return( a.phi() > b.phi() ) ; }
00085 };
00086
00087
00088
00095 class AscendingEta {
00096 public:
00097 bool operator()
00098 ( const Atlfast::IKinematic* a, const Atlfast::IKinematic* b ) const
00099 { return( a->eta() < b->eta() ) ; }
00100 bool operator()
00101 ( const Atlfast::IKinematic& a, const Atlfast::IKinematic& b ) const
00102 { return( a.eta() < b.eta() ) ; }
00103 };
00110 class DescendingEta {
00111 public:
00112 bool operator()
00113 ( const Atlfast::IKinematic* a, const Atlfast::IKinematic* b ) const
00114 { return( a->eta() > b->eta() ) ; }
00115 bool operator()
00116 ( const Atlfast::IKinematic& a, const Atlfast::IKinematic& b ) const
00117 { return( a.eta() > b.eta() ) ; }
00118 };
00119
00120
00121
00122
00129 class AscendingET {
00130 public:
00131
00132
00133 bool operator()
00134 ( const Atlfast::IKinematic* a, const Atlfast::IKinematic* b ) const
00135 { return( a->eT() < b->eT() ) ; }
00136 bool operator()
00137 ( const Atlfast::IKinematic& a, const Atlfast::IKinematic& b ) const
00138 { return( a.eT() < b.eT() ) ; }
00139
00140
00141 bool operator()
00142 ( const double boundary , const Atlfast::IKinematic* a ) const
00143 { return (boundary < a->eT()) ; }
00144 bool operator()
00145 ( const double boundary , const Atlfast::IKinematic& a ) const
00146 { return (boundary < a.eT()) ; }
00147
00148 };
00155 class DescendingET {
00156 public:
00157 bool operator()
00158 ( const Atlfast::IKinematic* a, const Atlfast::IKinematic* b ) const
00159 { return( a->eT() > b->eT() ) ; }
00160 bool operator()
00161 ( const Atlfast::IKinematic& a, const Atlfast::IKinematic& b ) const
00162 { return( a.eT() > b.eT() ) ; }
00163 };
00164
00165
00166
00173 class AscendingPT {
00174 public:
00175 bool operator()
00176 ( const Atlfast::IKinematic* a, const Atlfast::IKinematic* b ) const
00177 { return( a->pT() < b->pT() ) ; }
00178 bool operator()
00179 ( const Atlfast::IKinematic& a, const Atlfast::IKinematic& b ) const
00180 { return( a.pT() < b.pT() ) ; }
00181 };
00188 class DescendingPT {
00189 public:
00190 bool operator()
00191 ( const Atlfast::IKinematic* a, const Atlfast::IKinematic* b ) const
00192 { return( a->pT() > b->pT() ) ; }
00193 bool operator()
00194 ( const Atlfast::IKinematic& a, const Atlfast::IKinematic& b ) const
00195 { return( a.pT() > b.pT() ) ; }
00196 };
00197
00198
00199
00206 class AscendingMT {
00207 public:
00208 bool operator()
00209 ( const Atlfast::IKinematic* a, const Atlfast::IKinematic* b ) const
00210 { return( a->mT() < b->mT() ) ; }
00211 bool operator()
00212 ( const Atlfast::IKinematic& a, const Atlfast::IKinematic& b ) const
00213 { return( a.mT() < b.mT() ) ; }
00214 };
00221 class DescendingMT {
00222 public:
00223 bool operator()
00224 ( const Atlfast::IKinematic* a, const Atlfast::IKinematic* b ) const
00225 { return( a->mT() > b->mT() ) ; }
00226 bool operator()
00227 ( const Atlfast::IKinematic& a, const Atlfast::IKinematic& b ) const
00228 { return( a.mT() > b.mT() ) ; }
00229 };
00230
00231
00238 class DeltaPhi {
00239
00240 private:
00241 Atlfast::IKinematic* ref ;
00242
00243 public:
00244
00245
00246 DeltaPhi( Atlfast::IKinematic* reference ) : ref(reference) {}
00247 DeltaPhi( Atlfast::IKinematic& reference ) : ref(&reference) {}
00248
00249
00250 bool operator()
00251 ( const Atlfast::IKinematic* a, const Atlfast::IKinematic* b ) const
00252 {
00253 Phi a_dPhi( a->phi() - ref->phi() ) ;
00254 Phi b_dPhi( b->phi() - ref->phi() ) ;
00255
00256 return ( abs(a_dPhi) < abs(b_dPhi) ) ;
00257 }
00258
00259
00260 bool operator()
00261 ( const Atlfast::IKinematic& a, const Atlfast::IKinematic& b ) const
00262 { return this->operator() ( &a, &b ) ; }
00263
00264 };
00265
00266
00273 class DeltaEta {
00274
00275 private:
00276 Atlfast::IKinematic* ref ;
00277
00278 public:
00279
00281 DeltaEta( Atlfast::IKinematic* reference ) : ref(reference) {}
00283 DeltaEta( Atlfast::IKinematic& reference ) : ref(&reference) {}
00284
00286 bool operator()
00287 ( const Atlfast::IKinematic* a, const Atlfast::IKinematic* b ) const {
00288 return(
00289 abs(a->eta() - ref->eta())
00290 <
00291 abs(b->eta() - ref->eta())
00292 );
00293 }
00294
00296 bool operator()
00297 ( const Atlfast::IKinematic& a, const Atlfast::IKinematic& b ) const
00298 { return this->operator() ( &a, &b ) ; }
00299
00300 };
00301
00302
00303
00310 class DeltaR {
00311
00312 private:
00313 Atlfast::IKinematic* ref ;
00314
00315 public:
00316
00318 DeltaR( Atlfast::IKinematic* reference ) : ref(reference) {}
00320 DeltaR( Atlfast::IKinematic& reference ) : ref(&reference) {}
00321
00323 bool operator()
00324 ( const Atlfast::IKinematic* a, const Atlfast::IKinematic* b ) const {
00325
00326 Phi a_dPhi( a->phi() - ref->phi() ) ;
00327 Phi b_dPhi( b->phi() - ref->phi() ) ;
00328
00329 double dista =
00330 sqrt(
00331 (a_dPhi*a_dPhi) +
00332 (a->eta() - ref->eta())*(a->eta() - ref->eta())
00333 );
00334
00335 double distb =
00336 sqrt(
00337 (b_dPhi*b_dPhi) +
00338 (b->eta() - ref->eta())*(b->eta() - ref->eta())
00339 );
00340
00341 return ( dista < distb ) ;
00342 }
00343
00344
00346 bool operator()
00347 ( const Atlfast::IKinematic& a, const Atlfast::IKinematic& b ) const
00348 { return this->operator() ( &a, &b ) ; }
00349
00350 };
00351
00352
00353
00354 }
00355
00356
00357
00358
00359
00360
00361
00362 namespace PartitionCondition {
00363
00364
00365
00371 class AboveThresholdET {
00372
00373 public:
00374
00375 AboveThresholdET( double boundary ) : m_boundary(boundary) {}
00377 bool operator() ( const Atlfast::IKinematic* a ) const
00378 { return (m_boundary < a->eT()) ; }
00380 bool operator() ( const Atlfast::IKinematic& a ) const
00381 { return (m_boundary < a.eT()) ; }
00382
00383 private:
00385 double m_boundary ;
00386
00387 };
00393 class BelowThresholdET {
00394
00395 public:
00396
00397 BelowThresholdET( double boundary ) : m_boundary(boundary) {}
00399 bool operator() ( const Atlfast::IKinematic* a ) const
00400 { return (m_boundary > a->eT()) ; }
00402 bool operator() ( const Atlfast::IKinematic& a ) const
00403 { return (m_boundary > a.eT()) ; }
00404
00405 private:
00407 double m_boundary ;
00408
00409 };
00410
00411
00412
00418 class BelowThresholdDeltaR {
00419
00420 public:
00422 BelowThresholdDeltaR( Atlfast::IKinematic* ref, double boundary )
00423 : m_boundary(boundary), m_ref(ref) {}
00424
00425 BelowThresholdDeltaR( Atlfast::IKinematic& ref, double boundary )
00426 : m_boundary(boundary), m_ref(&ref) {}
00427
00428 bool operator() ( const Atlfast::IKinematic* a ) const
00429 {
00430 Phi dphi( a->phi() - m_ref->phi() ) ;
00431
00432 double dist =
00433 sqrt(
00434 (dphi*dphi) +
00435 (a->eta() - m_ref->eta())*(a->eta() - m_ref->eta())
00436 );
00437
00438 return (dist < m_boundary) ;
00439
00440 }
00441
00442 bool operator()
00443 ( const Atlfast::IKinematic& a ) const
00444 { return this->operator()( &a ) ; }
00445
00446 private:
00447 double m_boundary ;
00448 Atlfast::IKinematic* m_ref ;
00449
00450 };
00451
00452
00453
00454
00455 }
00456
00457
00458
00459
00460 #endif
00461
00462
00463
00464
00465