CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
PPSAssociationCuts.h
Go to the documentation of this file.
1 /****************************************************************************
2  * Authors:
3  * Jan Kašpar
4  * Grzegorz Sroka
5  ****************************************************************************/
6 
7 #ifndef CondFormats_PPSObjects_PPSAssociationCuts_h
8 #define CondFormats_PPSObjects_PPSAssociationCuts_h
9 
10 struct TF1;
11 
16 
17 #include <iostream>
18 #include <memory>
19 #include <cmath>
20 #include <vector>
21 
23 public:
24  class CutsPerArm {
25  public:
26  enum Quantities { qX, qY, qXi, qThetaY };
27 
29 
30  CutsPerArm(const edm::ParameterSet &iConfig, int sector);
31 
33 
34  const std::vector<std::string> &getMeans() const { return s_means_; }
35  const std::vector<std::string> &getThresholds() const { return s_thresholds_; }
36 
37  double getTiTrMin() const { return ti_tr_min_; }
38  double getTiTrMax() const { return ti_tr_max_; }
39 
40  // build TF1 representations of the mean and threshold functions
41  void buildFunctions();
42 
43  // returns whether the specified cut is applied
44  bool isApplied(Quantities quantity) const;
45 
46  // returns whether if the specified cut is satisfied (for a particular event)
47  bool isSatisfied(Quantities quantity, double x_near, double y_near, double xangle, double q_NF_diff) const;
48 
49  protected:
50  // string representation of the cut parameters - for serialisation
51  std::vector<std::string> s_means_;
52  std::vector<std::string> s_thresholds_;
53 
54  // TF1 representation of the cut parameters - for run time evaluations
55  std::vector<std::shared_ptr<TF1> > f_means_ COND_TRANSIENT;
56  std::vector<std::shared_ptr<TF1> > f_thresholds_ COND_TRANSIENT;
57 
58  // timing-tracking cuts
59  double ti_tr_min_;
60  double ti_tr_max_;
61 
62  static double evaluateExpression(std::shared_ptr<TF1> expression, double x_near, double y_near, double xangle);
63 
65  };
66 
68 
70 
72 
73  // checks if the data have a valid structure
74  bool isValid() const;
75 
76  // builds run-time data members, useful e.g. after loading data from DB
77  void initialize();
78 
79  const CutsPerArm &getAssociationCuts(const int sector) const { return association_cuts_.find(sector)->second; }
80 
82 
83 private:
84  std::map<unsigned int, CutsPerArm> association_cuts_;
85 
87 };
88 
89 //----------------------------------------------------------------------------------------------------
90 
91 std::ostream &operator<<(std::ostream &os, const PPSAssociationCuts::CutsPerArm &cutsPerArm);
92 
93 std::ostream &operator<<(std::ostream &os, const PPSAssociationCuts &ppsAssociationCuts);
94 
95 #endif
const std::vector< std::string > & getThresholds() const
const std::vector< std::string > & getMeans() const
std::ostream & operator<<(std::ostream &out, const ALILine &li)
Definition: ALILine.cc:167
std::map< unsigned int, CutsPerArm > association_cuts_
bool isSatisfied(Quantities quantity, double x_near, double y_near, double xangle, double q_NF_diff) const
bool isApplied(Quantities quantity) const
std::vector< std::string > s_thresholds_
#define COND_TRANSIENT
Definition: Serializable.h:63
std::vector< std::shared_ptr< TF1 > > f_means_
static double evaluateExpression(std::shared_ptr< TF1 > expression, double x_near, double y_near, double xangle)
const CutsPerArm & getAssociationCuts(const int sector) const
#define COND_SERIALIZABLE
Definition: Serializable.h:39
static edm::ParameterSetDescription getDefaultParameters()
std::vector< std::shared_ptr< TF1 > > f_thresholds_
std::vector< std::string > s_means_