00001 // Dear emacs, this is -*- c++ -*- 00002 // $Id$ 00003 #ifndef XAODCUTFLOW_VERSIONS_CUTBOOKKEEPER_V1_H 00004 #define XAODCUTFLOW_VERSIONS_CUTBOOKKEEPER_V1_H 00005 00006 // STL includes 00007 #include <string> 00008 #include <iosfwd> 00009 #include <stdint.h> 00010 #include <vector> 00011 00012 // Core include(s): 00013 #include "AthContainers/AuxElement.h" 00014 00015 00016 namespace xAOD { 00017 00025 class CutBookkeeper_v1 : public SG::AuxElement { 00026 00027 public: 00028 00030 enum CutLogic { 00031 UNKNOWN = 0, 00032 ALLEVENTSPROCESSED = 1, 00033 ALLEVENTSWRITTEN = 2, 00034 OTHER = 3, 00035 ACCEPT = 4, 00036 REQUIRE = 5, 00037 VETO = 6, 00038 }; 00039 00040 00042 struct Payload { 00043 public: 00044 Payload operator+( const Payload& rhs ) { 00045 Payload result; 00046 result.nAcceptedEvents = this->nAcceptedEvents + rhs.nAcceptedEvents; 00047 result.sumOfEventWeights = this->sumOfEventWeights + rhs.sumOfEventWeights; 00048 result.sumOfEventWeightsSquared = this->sumOfEventWeightsSquared + rhs.sumOfEventWeightsSquared; 00049 return result; 00050 } 00051 00052 Payload& operator+=( const Payload& rhs ) { 00053 this->nAcceptedEvents += rhs.nAcceptedEvents; 00054 this->sumOfEventWeights += rhs.sumOfEventWeights; 00055 this->sumOfEventWeightsSquared += rhs.sumOfEventWeightsSquared; 00056 return *this; 00057 } 00058 00059 public: 00060 uint64_t nAcceptedEvents; 00061 double sumOfEventWeights; 00062 double sumOfEventWeightsSquared; 00063 }; 00064 00065 00066 00068 CutBookkeeper_v1(); 00069 00070 00071 00073 ~CutBookkeeper_v1(); 00074 00075 00076 00078 bool operator==( const CutBookkeeper_v1& rhs ) { 00079 return this->isEqualTo( &rhs ); 00080 } 00081 00082 00085 00087 unsigned int nameIdentifier() const; 00089 unsigned int uniqueIdentifier() const; 00090 00091 private: 00093 void setNameIdentifier( unsigned int hash ); 00095 void setUniqueIdentifier( unsigned int hash ); 00096 00097 public: 00099 const std::string& name() const; 00101 void setName( const std::string& name ); 00102 00104 const std::string& description() const; 00106 void setDescription( const std::string &description ); 00107 00108 00110 bool isTopFilter() const; 00112 void setTopFilter( bool isTopFilter ); 00113 00114 00116 CutLogic cutLogic() const; 00118 void setCutLogic( CutLogic logic ); 00119 00121 int cycle() const; 00123 void setCycle( int cycle ); 00124 00126 const std::string& inputStream() const; 00128 void setInputStream( const std::string& inputstream ); 00129 00131 const std::vector<std::string>& outputStreams() const; 00133 bool hasOutputStream( const std::string& outputstream ) const; 00135 void addOutputStream( const std::string& outputstream ); 00137 void addOutputStreamForAllUsed( const std::string& outputstream ); 00139 void setOutputStreams( const std::vector<std::string>& outputstreams ); 00140 00142 00143 00146 00149 Payload payload() const; 00151 void setPayload( const Payload& payload ); 00152 00154 uint64_t nAcceptedEvents() const; 00156 void setNAcceptedEvents( uint64_t nEvents ); 00158 void addNAcceptedEvents( uint64_t nEvents ); 00159 00161 double sumOfEventWeights() const; 00163 void setSumOfEventWeights( double nWeightedEvents ); 00165 void addSumOfEventWeights( double nWeightedEvents ); 00166 00168 double sumOfEventWeightsSquared() const; 00170 void setSumOfEventWeightsSquared( double nWeightedEventsSquared ); 00172 void addSumOfEventWeightsSquared( double nWeightedEventsSquared ); 00173 00175 00176 00178 bool isEqualTo( const CutBookkeeper_v1 *eb ) const; 00179 00180 00181 00184 00186 bool hasParent() const; 00188 const xAOD::CutBookkeeper_v1* parent() const; 00190 void setParent( const CutBookkeeper_v1* parentEB ); 00192 std::size_t nChildren() const; 00194 bool hasChild( const xAOD::CutBookkeeper_v1* testCBK ) const; 00196 const xAOD::CutBookkeeper_v1* child( std::size_t i ) const; 00198 void setChildren( const std::vector< CutBookkeeper_v1* >& childrenEB ); 00200 void addChildren( const std::vector< CutBookkeeper_v1* >& childrenEB ); 00202 void addChild( CutBookkeeper_v1* childEB ); 00205 CutBookkeeper_v1* addNewChild( const std::string& name, 00206 const std::string& description ); 00207 00209 00210 00211 00214 00216 std::size_t nUsedOthers() const; 00218 bool hasUsedOther( const xAOD::CutBookkeeper_v1* testCBK ) const; 00220 const xAOD::CutBookkeeper_v1* usedOther( std::size_t i ) const; 00222 void setUsedOthers( const std::vector< CutBookkeeper_v1* >& usedOthers ); 00224 void addUsedOthers( const std::vector< CutBookkeeper_v1* >& usedOthers ); 00226 void addUsedOther( CutBookkeeper_v1* usedOtherEB ); 00227 00229 00230 00231 00235 00237 std::size_t nSiblings() const; 00239 bool hasSibling( const xAOD::CutBookkeeper_v1* testCBK ) const; 00241 const xAOD::CutBookkeeper_v1* sibling( std::size_t i ) const; 00243 void setSiblings( const std::vector< CutBookkeeper_v1* >& siblings ); 00245 void addSiblings( const std::vector< CutBookkeeper_v1* >& siblings ); 00247 void addSibling( CutBookkeeper_v1* siblingsEB ); 00248 00250 00251 00253 void toPersistent(); 00254 00255 00256 }; 00257 00258 00259 } // namespace xAOD 00260 00261 00262 #endif //> XAODCUTFLOW_VERSIONS_CUTBOOKKEEPER_V1_H