CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Functions
ChargeAssignment.h File Reference

Go to the source code of this file.

Functions

int getCharge (int phi1, int phi2, int phi3, int phi4, int mode)
 

Function Documentation

int getCharge ( int  phi1,
int  phi2,
int  phi3,
int  phi4,
int  mode 
)

Definition at line 17 of file ChargeAssignment.h.

References RecoTauCleanerPlugins::charge.

Referenced by L1TMuonEndCapTrackProducer::produce(), and TrackFitter::run().

17  {
18 
19  // -1 = postive physical charge to match pdgId code (i.e. -13 is positive, anti-muon). +1 = negative physical charge.
20  // Also matches DN-2015/017 format for track finder --> uGMT interface format, where 0 indicates positive, 1 negative.
21  int emuCharge = 0;
22  int phidiffs[6] = {phi2 - phi1, phi3 - phi1, phi4 - phi1, phi3 - phi2, phi4 - phi2, phi4 - phi3};
23 
24  if(mode == 15 ){
25  if(phidiffs[0] > 0)
26  emuCharge = 1;
27  else if(phidiffs[0] == 0 && phidiffs[1] < 0)
28  emuCharge = 1;
29  else if(phidiffs[1] == 0 && phidiffs[2] < 0)
30  emuCharge = 1;
31  else
32  emuCharge = -1;
33  }
34 
35  if(mode == 14){
36  if(phidiffs[0] < 0)
37  emuCharge = -1;
38  else if(phidiffs[0] == 0 && phidiffs[1] < 0)
39  emuCharge = -1;
40  else
41  emuCharge = 1;
42  }
43 
44  if(mode == 13){
45  if(phidiffs[0] > 0)
46  emuCharge = 1;
47  else if(phidiffs[0] == 0 && phidiffs[2] < 0)
48  emuCharge = 1;
49  else
50  emuCharge = -1;
51  }
52 
53  if(mode == 12){
54  if(phidiffs[0] > 0)
55  emuCharge = 1;
56  else
57  emuCharge = -1;
58  }
59 
60  if(mode == 11){
61  if(phidiffs[1] > 0)
62  emuCharge = 1;
63  else if(phidiffs[1] == 0 && phidiffs[2] < 0)
64  emuCharge = 1;
65  else
66  emuCharge = -1;
67  }
68 
69  if(mode == 10){
70  if(phidiffs[1] > 0)
71  emuCharge = 1;
72  else
73  emuCharge = -1;
74  }
75 
76  if(mode == 9){
77  if(phidiffs[2] > 0)
78  emuCharge = 1;
79  else
80  emuCharge = -1;
81  }
82 
83  if(mode == 7){
84  if(phidiffs[3] > 0)
85  emuCharge = 1;
86  else if(phidiffs[3] == 0 && phidiffs[4] < 0)
87  emuCharge = 1;
88  else
89  emuCharge = -1;
90  }
91 
92  if(mode == 6){
93  if(phidiffs[3] > 0)
94  emuCharge = 1;
95  else
96  emuCharge = -1;
97  }
98 
99  if(mode == 5){
100  if(phidiffs[4] > 0)
101  emuCharge = 1;
102  else
103  emuCharge = -1;
104  }
105 
106  if(mode == 3){
107  if(phidiffs[5] > 0)
108  emuCharge = 1;
109  else
110  emuCharge = -1;
111  }
112 
113  int charge = 0;
114  if(emuCharge == 1)
115  charge = 1;
116 
117  return charge;
118 
119 }