Back to home page

Project CMSSW displayed by LXR

 
 

    


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 //#include "PhysicsTools/UtilAlgos/interface/AdHocNTupler.h"
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     /*    if (iConfig.exists("AdHocNPSet"))
0021       if (!iConfig.getParameter<edm::ParameterSet>("AdHocNPSet").empty())
0022     aN = new AdHocNTupler(iConfig);
0023       else aN=0;
0024     else
0025       aN=0;
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     //    if (aN)
0035     //      nLeaves+=aN->registerleaves(producesCollector);
0036     return nLeaves;
0037   }
0038   void fill(edm::Event& iEvent) override {
0039     sN->fill(iEvent);
0040     if (vN)
0041       vN->fill(iEvent);
0042     //    if (aN)
0043     //      aN->fill(iEvent);
0044 
0045     sN->callBack();
0046     if (vN)
0047       vN->callBack();
0048     //    if (aN)
0049     //      aN->callBack();
0050   }
0051 
0052 private:
0053   StringBasedNTupler* sN;
0054   VariableNTupler* vN;
0055   //  AdHocNTupler * aN;
0056 };