QwAnalysis
VQwClock.cc
Go to the documentation of this file.
1 /********************************************************\
2 * File: VQwClock.h *
3 * *
4 * Author: Juan Carlos Cornejo <cornejo@jlab.org> *
5 * Time-stamp: <2011-06-16> *
6 \********************************************************/
7 
8 #include "VQwClock.h"
9 
10 #include "QwClock.h"
11 
12 // System headers
13 #include <stdexcept>
14 
15 // Qweak database headers
16 #include "QwDBInterface.h"
17 
18 // Qweak types that we want to use in this template
19 #include "QwVQWK_Channel.h"
20 #include "QwScaler_Channel.h"
21 
22 
23 /**
24  * \brief A fast way of creating a Clock of specified type
25  */
26 VQwClock* VQwClock::Create(TString subsystemname, TString name, TString type)
27 {
28  Bool_t localDebug = kFALSE;
29  type.ToUpper();
30  if( localDebug ) QwMessage<<"Creating Clock of type: "<<type<<" with name: "<<
31  name<<". Subsystem Name: " <<subsystemname<<"\n";
32  // (jc2) As a first try, let's do this the ugly way (but rather very
33  // simple), just list out the types of Clock's supported by this code!!!
34  if( type == "VQWK") { // (jc2) I don't know why on earth anyone would want
35  // a VQWK clock, but it is added here for completion :)
36  return new QwClock<QwVQWK_Channel>(subsystemname,name,type);
37  } else if ( type == "SIS3801" ) {
38  return new QwClock<QwSIS3801_Channel>(subsystemname,name,type);
39  } else if ( type == "SCALER" || type == "SIS3801D24" ) {
40  return new QwClock<QwSIS3801D24_Channel>(subsystemname,name,type);
41  } else { // Unsupported one!
42  QwWarning << "Clock of type="<<type<<" is UNSUPPORTED!!\n";
43  exit(-1);
44  }
45 }
46 
48  Bool_t localDebug = kFALSE;
49  TString type = source.GetModuleType();
50  type.ToUpper();
51  if (localDebug) QwMessage<<"Creating Clock of type: " << type << QwLog::endl;
52  // (jc2) As a first try, let's do this the ugly way (but rather very
53  // simple), just list out the types of Clock's supported by this code!!!
54  if( type == "VQWK") { // (jc2) I don't know why on earth anyone would want
55  // a VQWK clock, but it is added here for completion :)
56  return new QwClock<QwVQWK_Channel>(dynamic_cast<const QwClock<QwVQWK_Channel>&>(source));
57  } else if ( type == "SIS3801" ) {
58  return new QwClock<QwSIS3801_Channel>(dynamic_cast<const QwClock<QwSIS3801_Channel>&>(source));
59  } else if ( type == "SCALER" || type == "SIS3801D24" ) {
60  return new QwClock<QwSIS3801D24_Channel>(dynamic_cast<const QwClock<QwSIS3801D24_Channel>&>(source));
61  } else { // Unsupported one!
62  QwWarning << "Clock of type="<<type<<" is UNSUPPORTED!!\n";
63  exit(-1);
64  }
65 
66 }
#define QwMessage
Predefined log drain for regular messages.
Definition: QwLog.h:50
static VQwClock * Create(TString subsystemname, TString type, TString name)
A fast way of creating a Clock of specified type.
Definition: VQwClock.cc:26
TString GetModuleType() const
Return the type of the beam instrument.
static std::ostream & endl(std::ostream &)
End of the line.
Definition: QwLog.cc:299
#define QwWarning
Predefined log drain for warnings.
Definition: QwLog.h:45