QwAnalysis
VQwBCM.cc
Go to the documentation of this file.
1 /**********************************************************\
2 * File: VQwBCM.h *
3 * *
4 * Author: *
5 * Time-stamp: *
6 \**********************************************************/
7 
8 #include "VQwBCM.h"
9 
10 #include "QwBCM.h"
11 #include "QwCombinedBCM.h"
12 
13 // System headers
14 #include <stdexcept>
15 
16 // Qweak database headers
17 #include "QwDBInterface.h"
18 
19 // Qweak types that we want to use in this template
20 #include "QwVQWK_Channel.h"
21 #include "QwScaler_Channel.h"
22 
23 
24 /**
25  * \brief A fast way of creating a BCM of specified type
26  */
27 VQwBCM* VQwBCM::Create(TString subsystemname, TString name, TString type, TString clock)
28 {
29  Bool_t localDebug = kFALSE;
30  type.ToUpper();
31  if( localDebug ) QwMessage<<"Creating BCM of type: "<<type<<" with name: "<<
32  name<<". Subsystem Name: " <<subsystemname<<" and clock name="<<clock<<"\n";
33  // (jc2) As a first try, let's do this the ugly way (but rather very
34  // simple), just list out the types of BCM's supported by this code!!!
35  if( type == "VQWK") {
36  return new QwBCM<QwVQWK_Channel>(subsystemname,name,type);
37  } else if ( type == "SIS3801" ) {
38  return new QwBCM<QwSIS3801_Channel>(subsystemname,name,type,clock);
39  } else if ( type == "SCALER" || type == "SIS3801D24" ) {
40  return new QwBCM<QwSIS3801D24_Channel>(subsystemname,name,type,clock);
41  } else { // Unsupported one!
42  QwWarning << "BCM of type="<<type<<" is UNSUPPORTED!!\n";
43  exit(-1);
44  }
45 }
46 
47 VQwBCM* VQwBCM::Create(const VQwBCM& source)
48 {
49  Bool_t localDebug = kFALSE;
50  TString type = source.GetModuleType();
51  type.ToUpper();
52  if( localDebug ) QwMessage<<"Creating BCM of type: "<<type<<QwLog::endl;
53  // (jc2) As a first try, let's do this the ugly way (but rather very
54  // simple), just list out the types of BCM's supported by this code!!!
55  if( type == "VQWK") {
56  return new QwBCM<QwVQWK_Channel>(dynamic_cast<const QwBCM<QwVQWK_Channel>&>(source));
57  } else if ( type == "SIS3801" ) {
58  return new QwBCM<QwSIS3801_Channel>(dynamic_cast<const QwBCM<QwSIS3801_Channel>&>(source));
59  } else if ( type == "SCALER" || type == "SIS3801D24" ) {
60  return new QwBCM<QwSIS3801D24_Channel>(dynamic_cast<const QwBCM<QwSIS3801D24_Channel>&>(source));
61  } else { // Unsupported one!
62  QwWarning << "BCM of type="<<type<<" is UNSUPPORTED!!\n";
63  exit(-1);
64  }
65 }
66 
67 /**
68  * \brief A fast way of creating a combo BCM of specified type
69  */
70 VQwBCM* VQwBCM::CreateCombo(TString subsystemname, TString name, TString type)
71 {
72  Bool_t localDebug = kFALSE;
73  type.ToUpper();
74  if( localDebug ) QwMessage<<"Creating CombinedBCM of type: "<<type<<" with name: "<<
75  name<<". Subsystem Name: " <<subsystemname<<"\n";
76  // (jc2) As a first try, let's do this the ugly way (but rather very
77  // simple), just list out the types of BCM's supported by this code!!!
78  if( type == "VQWK") {
79  return new QwCombinedBCM<QwVQWK_Channel>(subsystemname,name,type);
80  } else if ( type == "SIS3801" ) { // Default SCALER channel
81  return new QwCombinedBCM<QwSIS3801_Channel>(subsystemname,name,type);
82  } else if ( type == "SCALER" || type == "SIS3801D24" ) {
83  return new QwCombinedBCM<QwSIS3801D24_Channel>(subsystemname,name,type);
84  } else { // Unsupported one!
85  QwWarning << "BCM of type="<<type<<" is UNSUPPORTED!!\n";
86  exit(-1);
87  }
88 }
89 
91 {
92  Bool_t localDebug = kFALSE;
93  TString type = source.GetModuleType();
94  type.ToUpper();
95  if( localDebug ) QwMessage<<"Creating CombinedBCM of type: "<<type<< QwLog::endl;
96  // (jc2) As a first try, let's do this the ugly way (but rather very
97  // simple), just list out the types of BCM's supported by this code!!!
98  if( type == "VQWK") {
99  return new QwCombinedBCM<QwVQWK_Channel>(dynamic_cast<const QwCombinedBCM<QwVQWK_Channel>&>(source));
100  } else if ( type == "SIS3801" ) { // Default SCALER channel
101  return new QwCombinedBCM<QwSIS3801_Channel>(dynamic_cast<const QwCombinedBCM<QwSIS3801_Channel>&>(source));
102  } else if ( type == "SCALER" || type == "SIS3801D24" ) {
103  return new QwCombinedBCM<QwSIS3801D24_Channel>(dynamic_cast<const QwCombinedBCM<QwSIS3801D24_Channel>&>(source));
104  } else { // Unsupported one!
105  QwWarning << "BCM of type="<<type<<" is UNSUPPORTED!!\n";
106  exit(-1);
107  }
108 }
109 
#define QwMessage
Predefined log drain for regular messages.
Definition: QwLog.h:50
static VQwBCM * Create(TString subsystemname, TString type, TString name, TString clock="")
A fast way of creating a BCM of specified type.
Definition: VQwBCM.cc:27
Definition: VQwBCM.h:32
TString GetModuleType() const
Return the type of the beam instrument.
static std::ostream & endl(std::ostream &)
End of the line.
Definition: QwLog.cc:299
Definition: QwBCM.h:34
#define QwWarning
Predefined log drain for warnings.
Definition: QwLog.h:45
static VQwBCM * CreateCombo(TString subsystemname, TString type, TString name)
A fast way of creating a combo BCM of specified type.
Definition: VQwBCM.cc:70