Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:23:38

0001 // -*- C++ -*-
0002 //
0003 // Package:     MVAComputer
0004 // Class  :     ProcCount
0005 //
0006 
0007 // Implementation:
0008 //     Variable processor that returns the number of input variable instances
0009 //
0010 // Author:      Christophe Saout
0011 // Created:     Fri May 18 20:05 CEST 2007
0012 //
0013 
0014 #include "FWCore/Utilities/interface/Exception.h"
0015 
0016 #include "PhysicsTools/MVAComputer/interface/VarProcessor.h"
0017 #include "PhysicsTools/MVAComputer/interface/Calibration.h"
0018 
0019 using namespace PhysicsTools;
0020 
0021 namespace {  // anonymous
0022 
0023   class ProcCount : public VarProcessor {
0024   public:
0025     typedef VarProcessor::Registry::Registry<ProcCount, Calibration::ProcCount> Registry;
0026 
0027     ProcCount(const char *name, const Calibration::ProcCount *calib, const MVAComputer *computer);
0028     ~ProcCount() override {}
0029 
0030     void configure(ConfIterator iter, unsigned int n) override;
0031     void eval(ValueIterator iter, unsigned int n) const override;
0032   };
0033 
0034   ProcCount::Registry registry("ProcCount");
0035 
0036   ProcCount::ProcCount(const char *name, const Calibration::ProcCount *calib, const MVAComputer *computer)
0037       : VarProcessor(name, calib, computer) {}
0038 
0039   void ProcCount::configure(ConfIterator iter, unsigned int n) {
0040     while (iter)
0041       iter++(Variable::FLAG_ALL) << Variable::FLAG_NONE;
0042   }
0043 
0044   void ProcCount::eval(ValueIterator iter, unsigned int n) const {
0045     while (iter) {
0046       unsigned int count = iter.size();
0047       iter(count);
0048       iter++;
0049     }
0050   }
0051 
0052 }  // anonymous namespace