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

References RecoTauCleanerPlugins::charge.

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

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