AliHLTMUONRecHitsSource::AliHLTMUONRecHitsSource() :
AliHLTOfflineDataSource(),
- fMCDataInterface(NULL), fDataInterface(NULL),
- fSelection(kWholePlane)
+ fMCDataInterface(NULL),
+ fDataInterface(NULL),
+ fSelection(kWholePlane),
+ fCurrentEvent(0)
{
for (Int_t i = 0; i < AliMUONConstants::NTrackingCh(); i++)
fServeChamber[i] = false;
bool simdata = false;
bool recdata = false;
bool chamberWasSet = false;
+ fCurrentEvent = 0;
+ bool firstEventSet = false;
+ bool eventNumLitSet = false;
for (int i = 0; i < argc; i++)
{
if (result != 0) return result;
chamberWasSet = true;
}
+ else if (strcmp(argv[i], "-firstevent") == 0)
+ {
+ if (eventNumLitSet)
+ {
+ HLTWarning("The -firstevent flag is overridden by a"
+ " previous use of -event_number_literal."
+ );
+ }
+ i++;
+ if (i >= argc)
+ {
+ HLTError("Expected a positive number after -firstevent.");
+ return EINVAL;
+ }
+ char* end = "";
+ long num = strtol(argv[i], &end, 0);
+ if (*end != '\0' or num < 0) // Check if the conversion is OK.
+ {
+ HLTError(Form(
+ "Expected a positive number after -firstevent"
+ " but got: %s", argv[i]
+ ));
+ return EINVAL;
+ }
+ fCurrentEvent = Int_t(num);
+ firstEventSet = true;
+ }
+ else if (strcmp(argv[i], "-event_number_literal") == 0)
+ {
+ if (firstEventSet)
+ {
+ HLTWarning("The -event_number_literal option will"
+ " override -firstevent."
+ );
+ }
+ fCurrentEvent = -1;
+ eventNumLitSet = true;
+ }
else
{
Logging(kHLTLogError,
}
}
+ // Check that the fCurrentEvent number falls within the correct range.
+ UInt_t maxevent = 0;
+ if (fMCDataInterface != NULL)
+ maxevent = UInt_t(fMCDataInterface->NumberOfEvents());
+ else if (fDataInterface != NULL)
+ maxevent = UInt_t(fDataInterface->NumberOfEvents());
+ if (fCurrentEvent != -1 and UInt_t(fCurrentEvent) >= maxevent and maxevent != 0)
+ {
+ fCurrentEvent = 0;
+ HLTWarning(Form("The selected first event number (%d) was larger than"
+ " the available number of events (%d). Resetting the event"
+ " counter to zero.", fCurrentEvent, maxevent
+ ));
+ }
+
return 0;
}
return EINVAL;
}
- // Use the fEventID as the event number to load, check it and load that
- // event with the runloader.
+ // Use the fEventID as the event number to load if fCurrentEvent == -1,
+ // check it and load that event with the runloader.
+ // If fCurrentEvent is a positive number then us it instead and
+ // increment it.
UInt_t eventnumber = UInt_t(evtData.fEventID);
UInt_t maxevent = fMCDataInterface != NULL ?
UInt_t(fMCDataInterface->NumberOfEvents())
: UInt_t(fDataInterface->NumberOfEvents());
+ if (fCurrentEvent != -1)
+ {
+ eventnumber = UInt_t(fCurrentEvent);
+ fCurrentEvent++;
+ if (UInt_t(fCurrentEvent) >= maxevent)
+ fCurrentEvent = 0;
+ }
if ( eventnumber >= maxevent )
{
Logging(kHLTLogError,
* in the range [1..10]. The string after '-chamber' is a comma separated
* list of numbers or ranges. Some examples of strings:
* 1 1-2 1,2,3 1,3-5,7 etc...
+ * -firstevent <number>
+ * Indicates the first event number to fetch from AliRoot. The default is to
+ * start from zero and increment the event number after every GetEvent call.
+ * This mode causes the component to ignore the event number passed to it by
+ * the system and rather use an internal counter. This mode can be overriden
+ * with the -event_number_literal flag.
+ * -event_number_literal
+ * This flag indicates to use the event numbers as literal indices into the
+ * AliRoot trees. This option will cause the component to ignore the -firstevent
+ * flag.
*/
class AliHLTMUONRecHitsSource : public AliHLTOfflineDataSource
{
SelectionType fSelection; //! Indicates if we should publish from the left, right or whole XY plane.
bool fServeChamber[10]; //! Flag to indicate if hits from a given chamber should be published.
+
+ Int_t fCurrentEvent; //! The current event index that is loaded.
+ // -1 indicates that we should rather use the event
+ // numbers as given by the system.
ClassDef(AliHLTMUONRecHitsSource, 0); // dHLT data source for reconstructed hit data blocks.
};
fMCDataInterface(NULL),
fDataInterface(NULL),
fBuildFromHits(false),
- fSelection(kWholePlane)
+ fSelection(kWholePlane),
+ fCurrentEvent(0)
{
}
bool hitdata = false;
bool simdata = false;
bool recdata = false;
+ fCurrentEvent = 0;
+ bool firstEventSet = false;
+ bool eventNumLitSet = false;
for (int i = 0; i < argc; i++)
{
return EINVAL;
}
}
+ else if (strcmp(argv[i], "-firstevent") == 0)
+ {
+ if (eventNumLitSet)
+ {
+ HLTWarning("The -firstevent flag is overridden by a"
+ " previous use of -event_number_literal."
+ );
+ }
+ i++;
+ if (i >= argc)
+ {
+ HLTError("Expected a positive number after -firstevent.");
+ return EINVAL;
+ }
+ char* end = "";
+ long num = strtol(argv[i], &end, 0);
+ if (*end != '\0' or num < 0) // Check if the conversion is OK.
+ {
+ HLTError(Form(
+ "Expected a positive number after -firstevent"
+ " but got: %s", argv[i]
+ ));
+ return EINVAL;
+ }
+ fCurrentEvent = Int_t(num);
+ firstEventSet = true;
+ }
+ else if (strcmp(argv[i], "-event_number_literal") == 0)
+ {
+ if (firstEventSet)
+ {
+ HLTWarning("The -event_number_literal option will"
+ " override -firstevent."
+ );
+ }
+ fCurrentEvent = -1;
+ eventNumLitSet = true;
+ }
else
{
Logging(kHLTLogError,
}
}
+ // Check that the fCurrentEvent number falls within the correct range.
+ UInt_t maxevent = 0;
+ if (fMCDataInterface != NULL)
+ maxevent = UInt_t(fMCDataInterface->NumberOfEvents());
+ else if (fDataInterface != NULL)
+ maxevent = UInt_t(fDataInterface->NumberOfEvents());
+ if (fCurrentEvent != -1 and UInt_t(fCurrentEvent) >= maxevent and maxevent != 0)
+ {
+ fCurrentEvent = 0;
+ HLTWarning(Form("The selected first event number (%d) was larger than"
+ " the available number of events (%d). Resetting the event"
+ " counter to zero.", fCurrentEvent, maxevent
+ ));
+ }
+
return 0;
}
return EINVAL;
}
- // Use the fEventID as the event number to load, check it and load that
- // event with the runloader.
+ // Use the fEventID as the event number to load if fCurrentEvent == -1,
+ // check it and load that event with the runloader.
+ // If fCurrentEvent is a positive number then us it instead and
+ // increment it.
UInt_t eventnumber = UInt_t(evtData.fEventID);
UInt_t maxevent = fMCDataInterface != NULL ?
UInt_t(fMCDataInterface->NumberOfEvents())
: UInt_t(fDataInterface->NumberOfEvents());
+ if (fCurrentEvent != -1)
+ {
+ eventnumber = UInt_t(fCurrentEvent);
+ fCurrentEvent++;
+ if (UInt_t(fCurrentEvent) >= maxevent)
+ fCurrentEvent = 0;
+ }
if ( eventnumber >= maxevent )
{
Logging(kHLTLogError,
* -plane left|right|all
* Specifies if data from the left (x < 0), right (x >= 0) or the whole XY
* plane should be published.
+ * -firstevent <number>
+ * Indicates the first event number to fetch from AliRoot. The default is to
+ * start from zero and increment the event number after every GetEvent call.
+ * This mode causes the component to ignore the event number passed to it by
+ * the system and rather use an internal counter. This mode can be overriden
+ * with the -event_number_literal flag.
+ * -event_number_literal
+ * This flag indicates to use the event numbers as literal indices into the
+ * AliRoot trees. This option will cause the component to ignore the -firstevent
+ * flag.
*/
class AliHLTMUONTriggerRecordsSource : public AliHLTOfflineDataSource
{
};
SelectionType fSelection; //! Indicates if we should publish from the left, right or whole XY plane.
-
+
+ Int_t fCurrentEvent; //! The current event index that is loaded.
+ // -1 indicates that we should rather use the event
+ // numbers as given by the system.
+
ClassDef(AliHLTMUONTriggerRecordsSource, 0); // dHLT data source for trigger record data blocks.
};