I have 4 existing branch variables: bif_nTrigger, bif_source, bif_BXID and bif_Time. The first three are integers, the last one is a float. The last three variables all depend on the first, bif_nTrigger. These have all been initialized properly.
I am trying to implement a for loop that will trim two of the variables, bif_Time and bif_BXID, according to whether the value of bif_source is equal to 3. This code is successfully done in python the following way:
# loop for bif_nTrigger times, if bif_source[i] equals 3, read bifTime and bunchcrossingID from this source.
for i in range(0, bif_nTrigger):
if bif_source[i] == 3:
bifTime = bif_Time[i]
bxID = bif_BXID[i] % 2
I am trying to adapt it to C, but I keep getting the following errors:
Error in TTreeFormula::Compile: Bad numerical expression : “bifTime”
Error in TTreeFormula::Compile: Bad numerical expression : “bxID”
My code is as follows:
int bxID;
float bifTime;
for (int i = 0; i = bif_nTrigger; ++i) {
if (bif_source[i] == 3) {
bifTime = bif_Time[i];
bxID = bif_BXID[i] %2;
}
}
I am very new to C and so I can’t seem to figure out what the error is caused by. Any help would be much appreciated!
ROOT Version: 5.28
Platform: C
Compiler: gcc ?