Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:02:31

0001 #ifndef MixingModuleConfig_H
0002 #define MixingModuleConfig_H
0003 
0004 #include "CondFormats/Serialization/interface/Serializable.h"
0005 
0006 #include <vector>
0007 #include <string>
0008 #include <iostream>
0009 
0010 namespace edm {
0011   class ParameterSet;
0012 }
0013 
0014 class MixingInputConfig {
0015 public:
0016   MixingInputConfig();
0017   virtual ~MixingInputConfig(){};
0018 
0019   const int itype() const { return t_; }
0020   std::string type() const {
0021     switch (t_) {
0022       case 0:
0023         return "none";
0024       case 1:
0025         return "fixed";
0026       case 2:
0027         return "poisson";
0028       case 3:
0029         return "histo";
0030       case 4:
0031         return "probFunction";
0032         // FIX ME: add default
0033     }
0034     return "";
0035   }
0036   int itype(std::string s) const {
0037     if (s == "none")
0038       return 0;
0039     if (s == "fixed")
0040       return 1;
0041     if (s == "poisson")
0042       return 2;
0043     if (s == "histo")
0044       return 3;
0045     if (s == "probFunction")
0046       return 4;
0047     return 0;
0048   }
0049 
0050   const double averageNumber() const { return an_; }
0051   //  const int intAverage() const { return ia_;}
0052   const std::vector<int>& probFunctionVariable() const { return dpfv_; }
0053   const std::vector<double>& probValue() const { return dp_; }
0054   const int outOfTime() const { return moot_; }
0055   const int fixedOutOfTime() const { return ioot_; }
0056 
0057   void read(edm::ParameterSet& pset);
0058 
0059 private:
0060   int t_;
0061   double an_;
0062   //  int ia_;
0063   std::vector<int> dpfv_;
0064   std::vector<double> dp_;
0065   int moot_;
0066   int ioot_;
0067 
0068   COND_SERIALIZABLE;
0069 };
0070 
0071 class MixingModuleConfig {
0072 public:
0073   MixingModuleConfig();
0074   virtual ~MixingModuleConfig(){};
0075 
0076   const MixingInputConfig& config(unsigned int i = 0) const { return configs_[i]; }
0077 
0078   const int& bunchSpace() const { return bs_; }
0079   const int& minBunch() const { return minb_; }
0080   const int& maxBunch() const { return maxb_; }
0081 
0082   void read(edm::ParameterSet& pset);
0083 
0084 private:
0085   std::vector<MixingInputConfig> configs_;
0086 
0087   int minb_;
0088   int maxb_;
0089   int bs_;
0090 
0091   COND_SERIALIZABLE;
0092 };
0093 
0094 std::ostream& operator<<(std::ostream&, const MixingModuleConfig& beam);
0095 std::ostream& operator<<(std::ostream&, const MixingInputConfig& beam);
0096 
0097 #endif