What doug4 is saying is that you are doing the following (simplified):
1 2 3 4
|
cond1 = some_value != 1;
cond2 = some_value != 2;
if (cond1 || cond2) continue;
| |
Do you see the problem? If we expand this, we get
if (some_value != 1 || some_value != 2) continue;
• If some_value == 1, then cond1 will be false, and cond2 will be true.
• If some_value == 2, then cond1 will be true, and cond2 will be false.
• If some_value == anything else, then both conditions will be true.
In all cases, the OR'd result will be
if (true).
Your conditions might have some physics meaning that you explained, but as far as pure logic goes, the union of all 3 of your conditions will always be true, so you need to re-think your logic.
Or, as doug4 said, you might have meant &&, or maybe you meant to use == instead of !=.
Edit: Perhaps you should be comparing your lep_id's individually?
1 2 3 4
|
bool cond1 = ev->lep_id[0] == 11 &&
ev->lep_id[1] == 11 &&
ev->lep_id[2] == 11 &&
ev->lep_id[3] == 11;
| |
Do an electron and positron both have the same lep_id?
cond2 says that if it is not electron positron, and muon and anti-muon |
In English, chaining together a bunch of "nots" and "ands" can be very ambiguous and confusing because it's not clear if the "not" in your sentence is being distributed. Perhaps it might help to write your condition as:
!(electron || positron) && !(muon || anti_muon)
(I'm just guessing what you mean, I don't know physics)
_________________________________________________
Okay, final suggestion for now:
Your first condition is "not 2 electron and positrons".
If that means "!(2 electrons) && !(2 positions)", then you need to have some functionality to determine the number of electrons/positions.
For example:
1 2 3 4 5 6 7 8 9
|
int num_electrons(int lep_id[])
{
return ...;
}
int num_positrons(int lep_id[])
{
return ...;
}
| |
Then, you can write your condition as:
(num_electrons(ev->lep_id) != 2 && num_positrons(ev->lep_id) != 2);
Or perhaps you meant "the sum of positrons and electrons should not be 2", then you would do:
(num_electrons(ev->lep_id) + num_positrons(ev->lep_id) != 2);
Maybe that will help clarify your code. I don't know.
...leaping leptons!