Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:17:32

0001 
0002 // Copyright 2007-2025, Jefferson Science Associates, LLC.
0003 // Subject to the terms in the LICENSE file found in the top-level directory.
0004 // Author: David Lawrence
0005 
0006 #pragma once
0007 #include <stdint.h>
0008 #include <string>
0009 
0010 class JCalibration;
0011 
0012 /// This is a base class for all event source generators. JANA implements
0013 /// event sources in a modular way so that new types of sources can be
0014 /// easily added. Typically, this just means different file formats, but
0015 /// an also be networked or shared memory sources. To provide a new
0016 /// source type, a class must inherit from JEventSourceGenerator and
0017 /// implement the three virtual methods it defines:
0018 ///
0019 /// Description:
0020 ///     This method should just return a short string that can be used to
0021 ///     inform the user what type of source this implements. It is purely
0022 ///     informational in that the framework never looks at its contents.
0023 ///
0024 /// CheckOpenable:
0025 ///     This method should "peek" at the source to see if it is one that
0026 ///     it can open. It should return a value between 0 and 1 inclusive
0027 ///     with 0 meaning "cannot open" and 1 meaning "absolutely can open".
0028 ///     The check can be as simple as looking at the source name (e.g.
0029 ///     does it have a specific suffix) or more involved (e.g. opening
0030 ///     the file and checking for a magic header). Note that it should
0031 ///     not be assumed that the source represents a file name. It could
0032 ///     indicate a URL or how to connect to some other non-file source.
0033 ///
0034 /// MakeJEventSource:
0035 ///     This will be called when the value of CheckOpenable returned
0036 ///     by this object is larger than that returned by all other
0037 ///     JEventSourceGenerator objects. This should simply instantiate
0038 ///     an object of the JEventSource based class that does the actual
0039 ///     work of reading objects from the source.
0040 
0041 class JCalibrationGenerator{
0042     public:
0043         JCalibrationGenerator(){}
0044         virtual ~JCalibrationGenerator(){}
0045 
0046         virtual const char* Description(void)=0; ///< Get string indicating type of calibration this handles
0047         virtual double CheckOpenable(std::string url, int32_t run, std::string context)=0; ///< Test probability of opening the given calibration
0048         virtual JCalibration* MakeJCalibration(std::string url, int32_t run, std::string context)=0; ///< Instantiate an JCalibration object (subclass)
0049 
0050 };
0051 
0052