File indexing completed on 2024-04-06 12:24:16
0001 #include "FWCore/Framework/interface/ProducesCollector.h"
0002 #include "PhysicsTools/UtilAlgos/interface/NTupler.h"
0003
0004 #include "PhysicsTools/UtilAlgos/interface/StringBasedNTupler.h"
0005 #include "PhysicsTools/UtilAlgos/interface/VariableNTupler.h"
0006
0007
0008 class CompleteNTupler : public NTupler {
0009 public:
0010 CompleteNTupler(const edm::ParameterSet& iConfig) {
0011 sN = new StringBasedNTupler(iConfig);
0012 if (iConfig.exists("variablesPSet"))
0013 if (!iConfig.getParameter<edm::ParameterSet>("variablesPSet").empty())
0014 vN = new VariableNTupler(iConfig);
0015 else
0016 vN = nullptr;
0017 else
0018 vN = nullptr;
0019
0020
0021
0022
0023
0024
0025
0026
0027 }
0028
0029 uint registerleaves(edm::ProducesCollector producesCollector) override {
0030 uint nLeaves = 0;
0031 nLeaves += sN->registerleaves(producesCollector);
0032 if (vN)
0033 nLeaves += vN->registerleaves(producesCollector);
0034
0035
0036 return nLeaves;
0037 }
0038 void fill(edm::Event& iEvent) override {
0039 sN->fill(iEvent);
0040 if (vN)
0041 vN->fill(iEvent);
0042
0043
0044
0045 sN->callBack();
0046 if (vN)
0047 vN->callBack();
0048
0049
0050 }
0051
0052 private:
0053 StringBasedNTupler* sN;
0054 VariableNTupler* vN;
0055
0056 };