00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #include "FWCore/Utilities/interface/Exception.h"
00017
00018 #include "PhysicsTools/MVAComputer/interface/VarProcessor.h"
00019 #include "PhysicsTools/MVAComputer/interface/Calibration.h"
00020
00021 using namespace PhysicsTools;
00022
00023 namespace {
00024
00025 class ProcSplitter : public VarProcessor {
00026 public:
00027 typedef VarProcessor::Registry::Registry<ProcSplitter,
00028 Calibration::ProcSplitter> Registry;
00029
00030 ProcSplitter(const char *name,
00031 const Calibration::ProcSplitter *calib,
00032 const MVAComputer *computer);
00033 virtual ~ProcSplitter() {}
00034
00035 virtual void configure(ConfIterator iter, unsigned int n);
00036 virtual void eval(ValueIterator iter, unsigned int n) const;
00037
00038 private:
00039 unsigned int count;
00040 };
00041
00042 static ProcSplitter::Registry registry("ProcSplitter");
00043
00044 ProcSplitter::ProcSplitter(const char *name,
00045 const Calibration::ProcSplitter *calib,
00046 const MVAComputer *computer) :
00047 VarProcessor(name, calib, computer),
00048 count(calib->nFirst)
00049 {
00050 }
00051
00052 void ProcSplitter::configure(ConfIterator iter, unsigned int n)
00053 {
00054 while(iter) {
00055 for(unsigned int i = 0; i < count; i++)
00056 iter << Variable::FLAG_OPTIONAL;
00057 iter << iter++(Variable::FLAG_ALL);
00058 }
00059 }
00060
00061 void ProcSplitter::eval(ValueIterator iter, unsigned int n) const
00062 {
00063 while(iter) {
00064 unsigned int i = 0;
00065 while(i < iter.size()) {
00066 iter << iter[i];
00067 if (i++ < count)
00068 iter();
00069 }
00070 while(i++ < count)
00071 iter();
00072 iter();
00073 iter++;
00074 }
00075 }
00076
00077 }