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 7 of file ChargeAssignment.h.

References RecoTauCleanerPlugins::charge.

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

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