Main Page | Class Hierarchy | Alphabetical List | Compound List | File List | Compound Members | File Members | Related Pages

CutFlow.C

Go to the documentation of this file.
00001 
00017 #include "jbltools/sfh/CutFlow.h"
00018 #include "jbltools/sfh/FillIterator.h"
00019 #include "jbltools/sfh/IntFunPoR.h"
00020 #include "jbltools/sfh/BaseCutBase.h"
00021 
00022 #include <iostream>
00023 #include <cstring>
00024 
00025 static const char *ident="@(#)$Id: CutFlow.C,v 1.2 2005/07/20 10:56:41 blist Exp $";
00026 
00027  
00028 CutFlow::CutFlow (int nbins, const BaseCut *cuts[], const IntFunPoR& iter_, const char *name) 
00029 : BaseCut ((name ? std::string(name) : "")),
00030   theCuts(nbins), 
00031   iter (iter_.pif)
00032 {
00033   if (!iter) {
00034     std::cerr << "CutFlow::CutFlow warning: No iterator given for " << getName()
00035               << "!" << std::endl;
00036   
00037   }
00038   for (int i = 0; i < nbins; ++i) {
00039     theCuts[i] = cuts[i];
00040   }
00041 }
00042 
00043 CutFlow::CutFlow (int nbins, BaseCut *cuts[], const IntFunPoR& iter_, const char *name) 
00044 : BaseCut ((name ? std::string(name) : "")),
00045   theCuts(nbins), 
00046   iter (iter_.pif)
00047 {
00048   if (!iter) {
00049     std::cerr << "CutFlow::CutFlow warning: No iterator given for " << getName()
00050               << "!" << std::endl;
00051   
00052   }
00053   for (int i = 0; i < nbins; ++i) {
00054     theCuts[i] = cuts[i];
00055   }
00056 }
00057 
00058 bool CutFlow::operator() () const {
00059   if (!iter) return false;
00060   int i = (*iter)();
00061   const BaseCut *cut = (i >= 0 && static_cast<unsigned int>(i) < theCuts.size()) ? theCuts[i] : 0;                 
00062   return cut ? (*cut)() : true; 
00063 }    
00064                     
00065 const FillIterator *CutFlow::getIterator() const {
00066   return iter ? iter->getIterator() : 0;
00067 }

Generated on Thu Oct 26 12:52:55 2006 for SFH by doxygen 1.3.2