Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:32:09

0001 #ifndef Validation_EventGenerator_WeightManager
0002 #define Validation_EventGenerator_WeightManager
0003 
0004 // Utility class, that computes the event weight,
0005 // either returning the weight as stored in the HepMCCollection
0006 // or returning the product of the weights stored in
0007 // a vector of GenEventInfoProducts
0008 
0009 #include "FWCore/Utilities/interface/InputTag.h"
0010 #include "SimDataFormats/GeneratorProducts/interface/HepMCProduct.h"
0011 #include "SimDataFormats/GeneratorProducts/interface/GenEventInfoProduct.h"
0012 
0013 #include "FWCore/Framework/interface/ConsumesCollector.h"
0014 #include <vector>
0015 
0016 namespace edm {
0017   class ParameterSet;
0018   class Event;
0019 }  // namespace edm
0020 
0021 class WeightManager {
0022 public:
0023   WeightManager(const edm::ParameterSet&, edm::ConsumesCollector iC);
0024   ~WeightManager(){};
0025 
0026   double weight(const edm::Event&);
0027   std::vector<std::vector<double>> weightsCollection(const edm::Event&);
0028 
0029 private:
0030   bool _useHepMC;
0031   std::vector<edm::InputTag> _genEventInfos;
0032   edm::InputTag _hepmcCollection;
0033 
0034   edm::EDGetTokenT<edm::HepMCProduct> hepmcCollectionToken_;
0035   std::vector<edm::EDGetTokenT<GenEventInfoProduct>> genEventInfosTokens_;
0036 };
0037 
0038 #endif