/usr/include/CLHEP/GenericFunctions/CutBase.hh is in libclhep-dev 2.1.4.1+dfsg-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 | // -*- C++ -*-
// $Id: CutBase.hh,v 1.2 2003/09/06 14:04:13 boudreau Exp $
// --------------------CutBase--------------------------------//
// //
// CutBase, by Joe Boudreau //
// //
// //
// CutBase: set of classes for doing boolean operations on //
// cuts. These classes function a little like STL //
// predicates, but they extend functionality by permitting //
// Boolean operations. They are sitting here in Generic //
// Functions package because they are quite similar to the //
// generic functions, except that instead of obeying a //
// Function algebra, these objects obey a Boolean algebra. //
// //
// IF YOU INHERIT YOUR PREDICATE FROM Cut<Type>, you will //
// for free get all the boolean operations on the predicate. //
// Here is an example where the type is an integer: //
// //
// //
// class IsPrime:public Cut<int> { //
// // Implies you will implement operator () (int) const, //
// // And clone() const //
// } //
// //
// class IsInRange:public Cut<int> { //
// // Implies you will implement operator () (int) const, //
// // And clone() const //
// } //
// //
// //
// Then the following example should work, note the use of //
// Boolean operations: //
// //
// const int N=100; //
// int array[N]; //
// for (int i=0;i<N;i++) array[i]=i; //
// std::ostream_iterator<int> dest(std::cout,"\n"); //
// //
// const Cut<int>::Predicate cut = IsPrime() && IsInRange(3,9);
// std::remove_copy_if(array, array+N, dest, !cut); //
// //
// //
// //
// //
// -----------------------------------------------------------//
#ifndef _CutBase_h_
#define _CutBase_h_
#include <functional>
/**
* @author
* @ingroup genfun
*/
template<class Type>
class Cut {
public:
//-----------Boolean operations-----------------------------//
// //
//...For OR'ing the cuts. //
// //
class OR; //
OR operator ||( const Cut<Type> & A ) const; //
// //
//...For AND'ing the cuts. //
// //
class AND; //
AND operator &&( const Cut<Type> & A ) const; //
// //
//...For negating the cuts: //
// //
class NOT; //
NOT operator ! ( void ) const; //
// //
//----------------------------------------------------------//
//-----------Constructors & cetera--------------------------//
Cut(); //
Cut(const Cut & right); //
virtual ~Cut(); //
virtual Cut * clone() const = 0; //
//----------------------------------------------------------//
//-----------Concrete class holding any cut:----------------//
// //
class Predicate; //
// //
//----------------------------------------------------------//
//----------------------------------------------------------//
// Evaluate predicate //
// //
virtual bool operator ()( const Type & t ) const = 0; //
// //
//----------------------------------------------------------//
};
//--------------------------------------------------------------------------
// Common standard Cut classes
//--------------------------------------------------------------------------
template<class Type>
class Cut<Type>::AND : public Cut<Type> {
public:
AND( const AND & right );
AND( const Cut & A, const Cut & B );
virtual ~AND();
virtual AND * clone( void ) const;
virtual bool operator ()( const Type & t ) const;
private:
const AND & operator=( const AND & right );
Cut * _pA;
Cut * _pB;
};
template<class Type>
class Cut<Type>::OR : public Cut<Type>
{
public:
OR( const OR & right );
OR( const Cut & A, const Cut & B );
virtual ~OR();
virtual OR * clone( void ) const;
virtual bool operator ()( const Type & t ) const;
private:
const OR & operator=( const OR & right );
Cut * _pA;
Cut * _pB;
};
template<class Type>
class Cut<Type>::NOT : public Cut<Type>
{
public:
NOT( const NOT & right );
NOT( const Cut & A );
virtual ~NOT();
virtual NOT * clone( void ) const;
virtual bool operator ()( const Type & t ) const;
private:
const NOT & operator=( const NOT & right );
Cut * _pA ;
};
template<class Type>
class Cut<Type>::Predicate : public Cut<Type>
{
public:
Predicate( const Predicate & right );
Predicate( const Cut & A );
virtual ~Predicate();
virtual Predicate * clone( void ) const;
virtual bool operator ()( const Type & t ) const;
private:
const Predicate & operator=( const Predicate & right );
Cut * _pA ;
};
#include "CLHEP/GenericFunctions/CutBase.icc"
#endif
|