Skip to content

Commit

Permalink
Pull fsp updates. Fixes a bug with timestamp updates in the buffer wi…
Browse files Browse the repository at this point in the history
…th interleaved records. Changes the default prescale algorithm to ratio instead of rate. Renames variables accordingly.
  • Loading branch information
ssailer committed Dec 22, 2024
1 parent c5c5a70 commit 69abed4
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 35 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@
// FSP Internal Parser variables
int nfspHWChannels;
int* fspHWChannelMap;
unsigned short* fspHWPrescalingThresholds;
unsigned short* fspHWPrescaleThresholds;

int nfspPSChannels;
int* fspPSChannelMap;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,10 @@ - (id) init
[self setConfigParam:@"fspBaselineChan" withValue:[NSNumber numberWithInt:-1]];
[self setConfigParam:@"fspMuonChan" withValue:[NSNumber numberWithInt:-1]];
[self setConfigParam:@"fspHWMajThreshold" withValue:[NSNumber numberWithInt:-1]];
[self setConfigParam:@"fspHWPreScalingRate" withValue:[NSNumber numberWithDouble:0.00]];
[self setConfigParam:@"fspHWPreScaleRatio" withValue:[NSNumber numberWithInt:0]];
[self setConfigParam:@"fspPSPreWindow" withValue:[NSNumber numberWithInt:2000000]];
[self setConfigParam:@"fspPSPostWindow" withValue:[NSNumber numberWithInt:2000000]];
[self setConfigParam:@"fspPSPreScalingRate" withValue:[NSNumber numberWithDouble:0.0]];
[self setConfigParam:@"fspPSPreScaleRatio" withValue:[NSNumber numberWithInt:0]];
[self setConfigParam:@"fspPSMuonCoincidence" withValue:[NSNumber numberWithBool:NO]];
[self setConfigParam:@"fspPSSumWindowStart" withValue:[NSNumber numberWithInt:-1]];
[self setConfigParam:@"fspPSSumWindowStop" withValue:[NSNumber numberWithInt:-1]];
Expand Down Expand Up @@ -133,7 +133,7 @@ - (id) init
fspPSChannelShapings = (int*)calloc(FCIOMaxChannels, sizeof(int));
fspPSChannelLowPass = (float*)calloc(FCIOMaxChannels, sizeof(float));
fspHWChannelMap = (int*)calloc(FCIOMaxChannels, sizeof(int));
fspHWPrescalingThresholds = (unsigned short*)calloc(FCIOMaxChannels, sizeof(unsigned short));
fspHWPrescaleThresholds = (unsigned short*)calloc(FCIOMaxChannels, sizeof(unsigned short));
fspFlagChannelMap = (int*)calloc(FCIOMaxChannels, sizeof(int));
fspFlagChannelThresholds = (int*)calloc(FCIOMaxChannels, sizeof(int));
runFailedAlarm = nil;
Expand Down Expand Up @@ -251,7 +251,7 @@ - (void) dealloc
free(fspPSChannelShapings);
free(fspPSChannelLowPass);
free(fspHWChannelMap);
free(fspHWPrescalingThresholds);
free(fspHWPrescaleThresholds);
free(fspFlagChannelMap);
free(fspFlagChannelThresholds);
[super dealloc];
Expand Down Expand Up @@ -491,16 +491,16 @@ - (NSNumber*) configParam:(NSString*)p
return [NSNumber numberWithInt:[[configParams objectForKey:p] intValue]];
else if([p isEqualToString:@"fspHWMajThreshold"])
return [NSNumber numberWithInt:[[configParams objectForKey:p] intValue]];
else if([p isEqualToString:@"fspHWPreScalingRate"])
return [NSNumber numberWithDouble:[[configParams objectForKey:p] doubleValue]];
else if([p isEqualToString:@"fspHWPreScaleRatio"])
return [NSNumber numberWithDouble:[[configParams objectForKey:p] intValue]];
// else if([p isEqualToString:@"fspHWCheckAll"])
// return [NSNumber numberWithBool:[[configParams objectForKey:p] boolValue]];
else if([p isEqualToString:@"fspPSPreWindow"])
return [NSNumber numberWithInt:[[configParams objectForKey:p] intValue]];
else if([p isEqualToString:@"fspPSPostWindow"])
return [NSNumber numberWithInt:[[configParams objectForKey:p] intValue]];
else if([p isEqualToString:@"fspPSPreScalingRate"])
return [NSNumber numberWithDouble:[[configParams objectForKey:p] doubleValue]];
else if([p isEqualToString:@"fspPSPreScaleRatio"])
return [NSNumber numberWithDouble:[[configParams objectForKey:p] intValue]];
else if([p isEqualToString:@"fspPSMuonCoincidence"])
return [NSNumber numberWithBool:[[configParams objectForKey:p] boolValue]];
else if([p isEqualToString:@"fspPSSumWindowStart"])
Expand Down Expand Up @@ -993,18 +993,18 @@ - (void) setConfigParam:(NSString*)p withValue:(NSNumber*)v
[configParams setObject:[NSNumber numberWithInt:MIN(MAX(-1,[v intValue]),2304)] forKey:p];
else if([p isEqualToString:@"fspHWMajThreshold"])
[configParams setObject:[NSNumber numberWithInt:MIN(MAX(1,[v intValue]),2304)] forKey:p];
else if([p isEqualToString:@"fspHWPreScalingRate"])
[configParams setObject:[NSNumber numberWithDouble:MAX(0.0,[v doubleValue])] forKey:p];
else if([p isEqualToString:@"fspHWPreScalingThreshold"])
else if([p isEqualToString:@"fspHWPrescaleRatio"])
[configParams setObject:[NSNumber numberWithInt:MAX(0,[v intValue])] forKey:p];
else if([p isEqualToString:@"fspHWPreScaleThreshold"])
[configParams setObject:[NSNumber numberWithInt:MAX(0,[v intValue])] forKey:p];
// else if([p isEqualToString:@"fspHWCheckAll"])
// [configParams setObject:[NSNumber numberWithBool:[v boolValue]] forKey:p];
else if([p isEqualToString:@"fspPSPreWindow"])
[configParams setObject:[NSNumber numberWithInt:MIN(MAX(0,[v intValue]),2147483647)] forKey:p];
else if([p isEqualToString:@"fspPSPostWindow"])
[configParams setObject:[NSNumber numberWithInt:MIN(MAX(0,[v intValue]),2147483647)] forKey:p];
else if([p isEqualToString:@"fspPSPreScalingRate"])
[configParams setObject:[NSNumber numberWithDouble:MAX(0.0,[v doubleValue])] forKey:p];
else if([p isEqualToString:@"fspPSPreScaleRatio"])
[configParams setObject:[NSNumber numberWithInt:MAX(0.0,[v intValue])] forKey:p];
else if([p isEqualToString:@"fspPSMuonCoincidence"])
[configParams setObject:[NSNumber numberWithBool:[v boolValue]] forKey:p];
else if([p isEqualToString:@"fspPSSumWindowStart"])
Expand Down Expand Up @@ -1263,7 +1263,7 @@ - (bool) setupStreamProcessor
}
case 2: { // HW Multiplicity
fspHWChannelMap[nfspHWChannels] = identifier;
fspHWPrescalingThresholds[nfspHWChannels] = (unsigned short)[adc swtThreshold:ich];
fspHWPrescaleThresholds[nfspHWChannels] = (unsigned short)[adc swtThreshold:ich];
nfspHWChannels++;
break;
}
Expand Down Expand Up @@ -1337,8 +1337,8 @@ - (bool) setupStreamProcessor
if (!FSPSetGeParameters(processor, nfspHWChannels, fspHWChannelMap, FCIO_TRACE_MAP_FORMAT,
[[self configParam:@"fspHWMajThreshold"] intValue],
0, // do not skip any channels to check
fspHWPrescalingThresholds,
[[self configParam:@"fspHWPreScalingRate"] floatValue])) {
fspHWPrescaleThresholds,
[[self configParam:@"fspHWPreScaleRatio"] intValue])) {
NSLogColor([NSColor redColor], @"%@: setupSoftwareTrigger: Error parsing HW Multiplicity parameters.\n", [self identifier]);
return NO;
}
Expand All @@ -1355,7 +1355,7 @@ - (bool) setupStreamProcessor
[[self configParam:@"fspPSSumWindowStop"] intValue],
[[self configParam:@"fspPSAbsoluteThreshold"] floatValue],
[[self configParam:@"fspPSCoincidenceThreshold"] floatValue],
[[self configParam:@"fspPSPreScalingRate"] floatValue],
[[self configParam:@"fspPSPreScaleRatio"] intValue],
[[self configParam:@"fspPSMuonCoincidence"] intValue])) {
NSLogColor([NSColor redColor], @"%@: setupSoftwareTrigger: Error parsing Peak Sum parameters.\n", [self identifier]);
return NO;
Expand Down Expand Up @@ -2471,7 +2471,7 @@ - (id) initWithCoder:(NSCoder*)decoder
fspPSChannelShapings = (int*)calloc(FCIOMaxChannels, sizeof(int));
fspPSChannelLowPass = (float*)calloc(FCIOMaxChannels, sizeof(float));
fspHWChannelMap = (int*)calloc(FCIOMaxChannels, sizeof(int));
fspHWPrescalingThresholds = (unsigned short*)calloc(FCIOMaxChannels, sizeof(unsigned short));
fspHWPrescaleThresholds = (unsigned short*)calloc(FCIOMaxChannels, sizeof(unsigned short));
fspFlagChannelMap = (int*)calloc(FCIOMaxChannels, sizeof(int));
fspFlagChannelThresholds = (int*)calloc(FCIOMaxChannels, sizeof(int));

Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file not shown.
Binary file not shown.
Loading

0 comments on commit 69abed4

Please sign in to comment.