JAPAn
Just Another Parity Analyzer
Loading...
Searching...
No Matches
VQwClock.cc
Go to the documentation of this file.
1/*!
2 * \file VQwClock.cc
3 * \brief Virtual base class implementation for clock channels
4 *
5 * Factory helpers to create concrete Clock channels by module type.
6 * Documentation-only edits; runtime behavior unchanged.
7 */
8
9#include "VQwClock.h"
10
11#include "QwClock.h"
12
13// System headers
14#include <stdexcept>
15
16// Qweak database headers
17#ifdef __USE_DATABASE__
18#include "QwDBInterface.h"
19#endif // __USE_DATABASE__
20
21// Qweak types that we want to use in this template
22#include "QwVQWK_Channel.h"
23#include "QwScaler_Channel.h"
24
25
26/**
27 * Create a concrete Clock instance for the requested module type.
28 * Supported: VQWK, SIS3801, SIS3801D24/SCALER.
29 */
30VQwClock* VQwClock::Create(TString subsystemname, TString name, TString type)
31{
32 Bool_t localDebug = kFALSE;
33 type.ToUpper();
34 if( localDebug ) QwMessage<<"Creating Clock of type: "<<type<<" with name: "<<
35 name<<". Subsystem Name: " <<subsystemname<<"\n";
36 // (jc2) As a first try, let's do this the ugly way (but rather very
37 // simple), just list out the types of Clock's supported by this code!!!
38 if( type == "VQWK") { // (jc2) I don't know why on earth anyone would want
39 // a VQWK clock, but it is added here for completion :)
40 return new QwClock<QwVQWK_Channel>(subsystemname,name,type);
41 } else if ( type == "SIS3801" ) {
42 return new QwClock<QwSIS3801_Channel>(subsystemname,name,type);
43 } else if ( type == "SCALER" || type == "SIS3801D24" ) {
44 return new QwClock<QwSIS3801D24_Channel>(subsystemname,name,type);
45 } else { // Unsupported one!
46 QwWarning << "Clock of type="<<type<<" is UNSUPPORTED!!\n";
47 exit(-1);
48 }
49}
50
51/** Copy-construct a concrete Clock based on the source module type. */
53 Bool_t localDebug = kFALSE;
54 TString type = source.GetModuleType();
55 type.ToUpper();
56 if (localDebug) QwMessage<<"Creating Clock of type: " << type << QwLog::endl;
57 // (jc2) As a first try, let's do this the ugly way (but rather very
58 // simple), just list out the types of Clock's supported by this code!!!
59 if( type == "VQWK") { // (jc2) I don't know why on earth anyone would want
60 // a VQWK clock, but it is added here for completion :)
61 return new QwClock<QwVQWK_Channel>(dynamic_cast<const QwClock<QwVQWK_Channel>&>(source));
62 } else if ( type == "SIS3801" ) {
63 return new QwClock<QwSIS3801_Channel>(dynamic_cast<const QwClock<QwSIS3801_Channel>&>(source));
64 } else if ( type == "SCALER" || type == "SIS3801D24" ) {
65 return new QwClock<QwSIS3801D24_Channel>(dynamic_cast<const QwClock<QwSIS3801D24_Channel>&>(source));
66 } else { // Unsupported one!
67 QwWarning << "Clock of type="<<type<<" is UNSUPPORTED!!\n";
68 exit(-1);
69 }
70
71}
Base and derived classes for scaler channel data handling.
#define QwWarning
Predefined log drain for warnings.
Definition QwLog.h:44
#define QwMessage
Predefined log drain for regular messages.
Definition QwLog.h:49
Decoding and management for VQWK ADC channels (6x32-bit datawords)
Database interface for QwIntegrationPMT and subsystems.
Clock channel implementation for normalization and timing.
static std::ostream & endl(std::ostream &)
End of the line.
Definition QwLog.cc:297
TString GetModuleType() const
Return the type of the beam instrument.
Standard clock channel with calibration representing frequency.
Definition QwClock.h:42
VQwClock()
Definition VQwClock.h:56
static VQwClock * Create(TString subsystemname, TString type, TString name)
Definition VQwClock.cc:30