CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Hemisphere.h
Go to the documentation of this file.
1 #ifndef PhysicsTools_Heppy_Hemisphere_h
2 #define PhysicsTools_Heppy_Hemisphere_h
3 
4 
5 /* \class Hemisphere
6  *
7  * Class that, given the 4-momenta of the objects in the event,
8  * allows to split up the event into two "hemispheres" according
9  * to different criteria (see below)/
10  *
11  * Authors: Luc Pape & Filip Moortgat Date: July 2005
12  * Updated: July 2006
13  * Updated: 15 Sept 2006
14  * Updated: 15 November 2006
15  * Updated: 01 November 2008
16  * Updated: 13 December 2010 (P.Nef)
17  * Updated: 09 February 2011
18  * Updated: 26 September 2011 (P.Nef)
19  */
20 
21 
22 #include <vector>
23 #include <iostream>
24 #include <cmath>
25 
26 namespace heppy {
27 
28 class Hemisphere {
29 
30  public:
31 
32  // There are 2 constructors:
33  // 1. Constructor taking as argument vectors of Px, Py, Pz and E of the objects in
34  // the event that should be separated, the seeding method and the hemisphere
35  // association method,
36  // 2. Constructor taking as argument vectors of Px, Py, Pz and E of the objects in
37  // the event that should be separated. The seeding method and the hemisphere
38  // association method should then be defined by SetMethod(seeding_method, association_method).
39  //
40  // Seeding method: choice of 2 inital axes
41  // 1: 1st: max P ; 2nd: max P * delta R wrt first one (if delta R > 0.5)
42  // 2: 2 objects who give maximal invariant mass (recommended)
43  // 3: 2 objects who give maximal transverse mass
44  // 4: 2 leading jets (min dR can be set by SetDRminSeed1())
45  //
46  // Hemisphere association method:
47  // 1: maximum pt longitudinal projected on the axes
48  // 2: minimal mass squared sum of the hemispheres
49  // 3: minimal Lund distance (recommended)
50  //
51  // Note that SetMethod() also allows the seeding and/or association method to be
52  // redefined for an existing hemisphere object. The GetAxis() or GetGrouping() is
53  // then recomputed using the newly defined methods.
54  //
55  // Some parameters possibly affecting the logic of hemisphere reconstruction can also be set
56  // by the user:
57  // SetNoSeed() to prevent the given object from being used as a seed
58  // (but it can be associated to hemispheres).
59  // SetNoAssoc() to prevent the given object from being used in the hemisphere association
60  // (then it cannot be used as seed either).
61  // ClearAllNoLists() to reset the list of NoSeed and NoAssoc objects to empty.
62  // SetDRminSeed1() minimum value of DeltaR between the two hemisphere seed for seed method 1
63  // (default = 0.5). Does not affect other methods.
64  // SetnItermax() maximum number of iterations allowed for the association methods (default = 100).
65  //
66  // Methods are provided to avoid including ISR jets into the hemispheres.
67  // This is done by declaring the variable type and cut value above which an object should not
68  // be included in the hemispheres.
69  // Only 1 cut can be used at the time (a new declaration overwrites the previous one).
70  // RejectISRPtmax() max Pt w.r.t. the hemisphere below which objects can be included
71  // (default = 10000. GeV)
72  // RejectISRDRmax() max DeltaR below which objects can be included
73  // (default = 10.)
74 
76 
77  Hemisphere(std::vector<float> Px_vector, std::vector<float> Py_vector, std::vector<float> Pz_vector, std::vector<float> E_vector, int seed_method, int hemisphere_association_method);
78 
79  Hemisphere(std::vector<float> Px_vector, std::vector<float> Py_vector, std::vector<float> Pz_vector, std::vector<float> E_vector);
80 
81  // Destructor
83 
84  // return Nx, Ny, Nz, P, E of the axis of group 1
85  std::vector<float> getAxis1();
86  // return Nx, Ny, Nz, P, E of the axis of group 2
87  std::vector<float> getAxis2();
88 
89  // where Nx, Ny, Nz are the direction cosines e.g. Nx = Px/P,
90  // P is the momentum, E is the energy
91 
92  // return vector with "1" and "2"'s according to which group the object belongs
93  // and 0 if the object is not associated to any hemisphere
94  // (order of objects in vector is same as input)
95  std::vector<int> getGrouping();
96 
97  // set or overwrite the seed and association methods
98  void SetMethod(int seed_method, int hemisphere_association_method) {
99  seed_meth = seed_method;
100  hemi_meth = hemisphere_association_method;
101  status = 0;
102  }
103 
104  // prevent an object from being used as a seed (but it can be associated to hemispheres)
105  // (method introduced on 15/09/06)
106  void SetNoSeed(int object_number) {
107  Object_Noseed[object_number] = 1;
108  status = 0;
109  }
110 
111  // prevent an object from being used for hemisphere asociation (and for seeding)
112  // (method introduced on 01/11/08)
113  void SetNoAssoc(int object_number) {
114  Object_Noassoc[object_number] = 1;
115  Object_Noseed[object_number] = 1;
116  status = 0;
117  }
118 
119  // reset the list of NoSeed and NoAssoc objects to empty
120  // (method introduced on 01/11/08)
122  for (int i = 0; i < (int)Object_Noseed.size(); ++i) {
123  Object_Noassoc[i] = 0;
124  Object_Noseed[i] = 0;
125  status = 0;
126  }
127  }
128 
129  // set the min DeltaR for the seeds of seed method 1
130  // (method introduced on 01/11/08)
131  void SetDRminSeed1(float rmin) {
132  dRminSeed1 = rmin;
133  }
134 
135  // set the maximum number of iterations allowed for association
136  // (method introduced on 01/11/08)
137  void SetnItermax(int niter) {
138  nItermax = niter;
139  }
140 
141  // set max Pt w.r.t. the hemisphere below which objects can be included
142  void RejectISRPtmax(float ptmax) {
143  rejectISRPtmax = ptmax;
144  rejectISRPt = 1;
145  rejectISRDR = 0;
146  rejectISR = 1;
147  status = 0;
148  }
149 
150  // set max DeltaR below which objects can be included
151  void RejectISRDRmax(float drmax) {
152  rejectISRDRmax = drmax;
153  rejectISRDR = 1;
154  rejectISRPt = 0;
155  rejectISR = 1;
156  status = 0;
157  }
158 
159  // controls the level of debug prints
160  void SetDebug(int debug) { dbg = debug; }
161  int GetNumLoop(){return numLoop;}
162 
163 
164  private:
165 
166  // the hemisphere separation algorithm
167  int Reconstruct();
168  int RejectISR();
169 
170 
171  std::vector<float> Object_Px;
172  std::vector<float> Object_Py;
173  std::vector<float> Object_Pz;
174  std::vector<float> Object_P;
175  std::vector<float> Object_Pt;
176  std::vector<float> Object_E;
177  std::vector<float> Object_Phi;
178  std::vector<float> Object_Eta;
179  std::vector<int> Object_Group;
180  std::vector<int> Object_Noseed;
181  std::vector<int> Object_Noassoc;
182 
183  std::vector<float> Axis1;
184  std::vector<float> Axis2;
185 
186  //static const float hemivsn = 1.01;
189  int status;
190  float dRminSeed1;
191  int nItermax;
197  int dbg;
198  int numLoop;
199 
200 };
201 }
202 
203 #endif
std::vector< float > getAxis1()
Definition: Hemisphere.cc:44
int i
Definition: DBlmapReader.cc:9
void SetDRminSeed1(float rmin)
Definition: Hemisphere.h:131
std::vector< float > Object_Phi
Definition: Hemisphere.h:177
std::vector< float > Object_P
Definition: Hemisphere.h:174
std::vector< float > Axis2
Definition: Hemisphere.h:184
std::vector< int > getGrouping()
Definition: Hemisphere.cc:65
std::vector< float > Object_Eta
Definition: Hemisphere.h:178
void ClearAllNoLists()
Definition: Hemisphere.h:121
std::vector< float > Object_Py
Definition: Hemisphere.h:172
std::vector< int > Object_Noseed
Definition: Hemisphere.h:180
void SetDebug(int debug)
Definition: Hemisphere.h:160
void RejectISRDRmax(float drmax)
Definition: Hemisphere.h:151
void SetNoSeed(int object_number)
Definition: Hemisphere.h:106
std::vector< float > Object_E
Definition: Hemisphere.h:176
std::vector< float > Object_Pt
Definition: Hemisphere.h:175
std::vector< int > Object_Noassoc
Definition: Hemisphere.h:181
#define debug
Definition: HDRShower.cc:19
void RejectISRPtmax(float ptmax)
Definition: Hemisphere.h:142
void SetMethod(int seed_method, int hemisphere_association_method)
Definition: Hemisphere.h:98
std::vector< float > getAxis2()
Definition: Hemisphere.cc:54
std::vector< float > Object_Pz
Definition: Hemisphere.h:173
void SetnItermax(int niter)
Definition: Hemisphere.h:137
std::vector< float > Object_Px
Definition: Hemisphere.h:171
std::vector< float > Axis1
Definition: Hemisphere.h:183
std::vector< int > Object_Group
Definition: Hemisphere.h:179
void SetNoAssoc(int object_number)
Definition: Hemisphere.h:113