QwAnalysis
QwMainCerenkovDetector Class Reference

#include <QwMainCerenkovDetector.h>

+ Inheritance diagram for QwMainCerenkovDetector:
+ Collaboration diagram for QwMainCerenkovDetector:

Public Member Functions

 QwMainCerenkovDetector (const TString &name)
 Constructor with name. More...
 
 QwMainCerenkovDetector (const QwMainCerenkovDetector &source)
 Copy constructor. More...
 
virtual ~QwMainCerenkovDetector ()
 Virtual destructor. More...
 
void ProcessOptions (QwOptions &options)
 
Int_t LoadChannelMap (TString mapfile)
 Mandatory map file definition. More...
 
Int_t LoadInputParameters (TString pedestalfile)
 Mandatory parameter file definition. More...
 
Int_t LoadEventCuts (TString filename)
 Load the event cuts file. More...
 
Bool_t ApplySingleEventCuts ()
 Apply the single event cuts. More...
 
void IncrementErrorCounters ()
 Increment the error counters. More...
 
void PrintErrorCounters () const
 Report the number of events failed due to HW and event cut failures. More...
 
UInt_t GetEventcutErrorFlag ()
 Return the error flag to the top level routines related to stability checks and ErrorFlag updates. More...
 
void UpdateErrorFlag (const VQwSubsystem *ev_error)
 update the error flag in the subsystem level from the top level routines related to stability checks. This will uniquely update the errorflag at each channel based on the error flag in the corresponding channel in the ev_error subsystem More...
 
Int_t ProcessConfigurationBuffer (const UInt_t roc_id, const UInt_t bank_id, UInt_t *buffer, UInt_t num_words)
 
Int_t ProcessEvBuffer (const UInt_t roc_id, const UInt_t bank_id, UInt_t *buffer, UInt_t num_words)
 TODO: The non-event-type-aware ProcessEvBuffer routine should be replaced with the event-type-aware version. More...
 
void ClearEventData ()
 
Bool_t IsGoodEvent ()
 
void ProcessEvent ()
 
void ExchangeProcessedData ()
 
void ProcessEvent_2 ()
 Process the event data again, including data from other subsystems. Not all derived classes will require a second stage of event data processing. More...
 
Bool_t PublishInternalValues () const
 
void SetRandomEventParameters (Double_t mean, Double_t sigma)
 
void SetRandomEventAsymmetry (Double_t asymmetry)
 
void RandomizeEventData (int helicity=0, Double_t time=0.0)
 
void EncodeEventData (std::vector< UInt_t > &buffer)
 
void ConstructHistograms (TDirectory *folder)
 Construct the histograms for this subsystem in a folder. More...
 
void ConstructHistograms (TDirectory *folder, TString &prefix)
 Construct the histograms for this subsystem in a folder with a prefix. More...
 
void FillHistograms ()
 Fill the histograms for this subsystem. More...
 
void ConstructBranchAndVector (TTree *tree, TString &prefix, std::vector< Double_t > &values)
 Construct the branch and tree vector. More...
 
void ConstructBranch (TTree *tree, TString &prefix)
 Construct the branch and tree vector. More...
 
void ConstructBranch (TTree *tree, TString &prefix, QwParameterFile &trim_file)
 Construct the branch and tree vector based on the trim file. More...
 
void FillTreeVector (std::vector< Double_t > &values) const
 Fill the tree vector. More...
 
void FillDB (QwParityDB *db, TString datatype)
 Fill the database. More...
 
void FillErrDB (QwParityDB *db, TString datatype)
 
const QwIntegrationPMTGetChannel (const TString name) const
 
Bool_t Compare (VQwSubsystem *source)
 
void Blind (const QwBlinder *blinder)
 Blind the asymmetry. More...
 
void Blind (const QwBlinder *blinder, const VQwSubsystemParity *subsys)
 Blind the difference using the yield. More...
 
VQwSubsystemoperator= (VQwSubsystem *value)
 Assignment Note: Must be called at the beginning of all subsystems routine call to operator=(VQwSubsystem *value) by VQwSubsystem::operator=(value) More...
 
VQwSubsystemoperator+= (VQwSubsystem *value)
 
VQwSubsystemoperator-= (VQwSubsystem *value)
 
void Sum (VQwSubsystem *value1, VQwSubsystem *value2)
 
void Difference (VQwSubsystem *value1, VQwSubsystem *value2)
 
void Ratio (VQwSubsystem *numer, VQwSubsystem *denom)
 
void Scale (Double_t factor)
 
void Normalize (VQwDataElement *denom)
 
void AccumulateRunningSum (VQwSubsystem *value)
 Update the running sums for devices. More...
 
void DeaccumulateRunningSum (VQwSubsystem *value)
 remove one entry from the running sums for devices More...
 
void CalculateRunningAverage ()
 Calculate the average for all good events. More...
 
const QwIntegrationPMTGetIntegrationPMT (const TString name) const
 
const QwCombinedPMTGetCombinedPMT (const TString name) const
 
void DoNormalization (Double_t factor=1.0)
 
Bool_t ApplyHWChecks ()
 
void PrintValue () const
 Print values of all channels. More...
 
void WritePromptSummary (QwPromptSummary *ps, TString type)
 
void PrintInfo () const
 Print some information about the subsystem. More...
 
void PrintDetectorID () const
 
- Public Member Functions inherited from VQwSubsystemParity
 VQwSubsystemParity (const TString &name)
 Constructor with name. More...
 
 VQwSubsystemParity (const VQwSubsystemParity &source)
 Copy constructor. More...
 
virtual ~VQwSubsystemParity ()
 Default destructor. More...
 
virtual void FillDB_MPS (QwParityDB *db, TString type)
 Fill the database with MPS-based variables Note that most subsystems don't need to do this. More...
 
virtual UInt_t UpdateErrorFlag ()
 Uses the error flags of contained data elements to update Returns the error flag to the top level routines related to stability checks and ErrorFlag updates. More...
 
virtual Bool_t CheckForEndOfBurst () const
 
- Public Member Functions inherited from VQwSubsystem
 VQwSubsystem (const TString &name)
 Constructor with name. More...
 
 VQwSubsystem (const VQwSubsystem &orig)
 Copy constructor by object. More...
 
virtual ~VQwSubsystem ()
 Default destructor. More...
 
TString GetSubsystemName () const
 
Bool_t HasDataLoaded () const
 
void SetParent (QwSubsystemArray *parent)
 Set the parent of this subsystem to the specified array. More...
 
QwSubsystemArrayGetParent (const unsigned int parent=0) const
 Get the parent of this subsystem. More...
 
VQwSubsystemGetSibling (const std::string &name) const
 Get the sibling with specified name. More...
 
Bool_t PublishInternalValue (const TString &name, const TString &desc, const VQwHardwareChannel *value) const
 Publish a variable name to the parent subsystem array. More...
 
virtual Bool_t PublishByRequest (TString device_name)
 Try to publish an internal variable matching the submitted name. More...
 
Bool_t RequestExternalValue (const TString &name, VQwHardwareChannel *value) const
 Request a named value which is owned by an external subsystem; the request will be handled by the parent subsystem array. More...
 
virtual const VQwHardwareChannelReturnInternalValue (const TString &name) const
 Return a pointer to a varialbe to the parent subsystem array to be delivered to a different subsystem. More...
 
virtual Bool_t ReturnInternalValue (const TString &name, VQwHardwareChannel *value) const
 Return a named value to the parent subsystem array to be delivered to a different subsystem. More...
 
virtual std::vector< TString > GetParamFileNameList ()
 
virtual std::map< TString,
TString > 
GetDetectorMaps ()
 
virtual Int_t LoadDetectorMaps (QwParameterFile &file)
 Parse parameter file to find the map files. More...
 
virtual Int_t LoadGeometryDefinition (TString mapfile)
 Optional geometry definition. More...
 
virtual Int_t LoadCrosstalkDefinition (TString mapfile)
 Optional crosstalk definition. More...
 
void SetEventTypeMask (const UInt_t mask)
 Set event type mask. More...
 
UInt_t GetEventTypeMask () const
 Get event type mask. More...
 
virtual Int_t ProcessEvBuffer (const UInt_t event_type, const UInt_t roc_id, const UInt_t bank_id, UInt_t *buffer, UInt_t num_words)
 
virtual void AtEndOfEventLoop ()
 Perform actions at the end of the event loop. More...
 
virtual void RandomizeEventData (int helicity=0, double time=0.0)
 
virtual void PrintDetectorMaps (Bool_t status) const
 
virtual void ConstructHistograms ()
 Construct the histograms for this subsystem. More...
 
virtual void ConstructHistograms (TString &prefix)
 Construct the histograms for this subsystem with a prefix. More...
 
virtual void ConstructBranchAndVector (TTree *tree, std::vector< Double_t > &values)
 Construct the branch and tree vector. More...
 
virtual void ConstructTree ()
 Construct the tree for this subsystem. More...
 
virtual void ConstructTree (TDirectory *folder)
 Construct the tree for this subsystem in a folder. More...
 
virtual void ConstructTree (TString &prefix)
 Construct the tree for this subsystem with a prefix. More...
 
virtual void ConstructTree (TDirectory *folder, TString &prefix)
 Construct the tree for this subsystem in a folder with a prefix. More...
 
virtual void FillTree ()
 Fill the tree for this subsystem. More...
 
virtual void DeleteTree ()
 Delete the tree for this subsystem. More...
 
- Public Member Functions inherited from MQwHistograms
void ShareHistograms (const MQwHistograms *source)
 Share histogram pointers between objects. More...
 
- Public Member Functions inherited from MQwCloneable< VQwSubsystem, QwMainCerenkovDetector >
virtual ~MQwCloneable ()
 Virtual destructor. More...
 
virtual VQwSubsystemClone () const
 Concrete clone method. More...
 
const VQwFactory< VQwSubsystem > * Factory () const
 Factory getter. More...
 
- Public Member Functions inherited from VQwCloneable< VQwSubsystem >
virtual ~VQwCloneable ()
 Virtual destructor. More...
 
std::string GetClassName () const
 Get demangled name of this class. More...
 

Static Public Member Functions

static void DefineOptions (QwOptions &options)
 Define options function. More...
 
- Static Public Member Functions inherited from VQwSubsystem
static void DefineOptions ()
 Define options function (note: no virtual static functions in C++) More...
 
- Static Public Member Functions inherited from MQwCloneable< VQwSubsystem, QwMainCerenkovDetector >
static VQwSubsystemCreate (const std::string &name)
 Object creation. More...
 
static QwMainCerenkovDetectorCast (QwMainCerenkovDetector *type)
 Object dynamic cast. More...
 

Protected Member Functions

EQwPMTInstrumentType GetDetectorTypeID (TString name)
 
Int_t GetDetectorIndex (EQwPMTInstrumentType TypeID, TString name)
 
- Protected Member Functions inherited from VQwSubsystem
void UpdatePublishedValue (const TString &name, VQwHardwareChannel *data_channel)
 
void ClearAllBankRegistrations ()
 Clear all registration of ROC and Bank IDs for this subsystem. More...
 
virtual Int_t RegisterROCNumber (const UInt_t roc_id, const UInt_t bank_id=0)
 Tell the object that it will decode data from this ROC and sub-bank. More...
 
Int_t RegisterSubbank (const UInt_t bank_id)
 Tell the object that it will decode data from this sub-bank in the ROC currently open for registration. More...
 
Int_t GetSubbankIndex () const
 
Int_t GetSubbankIndex (const UInt_t roc_id, const UInt_t bank_id) const
 
void SetDataLoaded (Bool_t flag)
 
Int_t FindIndex (const std::vector< UInt_t > &myvec, const UInt_t value) const
 
Bool_t Compare (VQwSubsystem *source)
 
- Protected Member Functions inherited from MQwHistograms
 MQwHistograms ()
 Default constructor. More...
 
 MQwHistograms (const MQwHistograms &source)
 Copy constructor. More...
 
virtual ~MQwHistograms ()
 Virtual destructor. More...
 
virtual MQwHistogramsoperator= (const MQwHistograms &value)
 
void Fill_Pointer (TH1_ptr hist_ptr, Double_t value)
 
void AddHistogram (TH1 *h)
 Register a histogram. More...
 

Protected Attributes

Bool_t fDEBUG
 
std::vector< QwIntegrationPMTfIntegrationPMT
 
std::vector< QwCombinedPMTfCombinedPMT
 
std::vector
< QwMainCerenkovDetectorID
fMainDetID
 
QwBeamCharge fTargetCharge
 
QwBeamPosition fTargetX
 
QwBeamPosition fTargetY
 
QwBeamAngle fTargetXprime
 
QwBeamAngle fTargetYprime
 
QwBeamEnergy fTargetEnergy
 
Bool_t bIsExchangedDataValid
 
Bool_t bNormalization
 
- Protected Attributes inherited from VQwSubsystem
std::map< TString,
VQwHardwareChannel * > 
fPublishedInternalValues
 Map of published internal values. More...
 
std::vector< std::vector
< TString > > 
fPublishList
 List of parameters to be published (loaded at the channel map) More...
 
TString fSystemName
 Name of this subsystem. More...
 
UInt_t fEventTypeMask
 Mask of event types. More...
 
Bool_t fIsDataLoaded
 Has this subsystem gotten data to be processed? More...
 
std::vector< TString > fDetectorMapsNames
 
std::map< TString, TString > fDetectorMaps
 
Int_t fCurrentROC_ID
 ROC ID that is currently being processed. More...
 
Int_t fCurrentBank_ID
 Bank ID that is currently being processed. More...
 
std::vector< UInt_t > fROC_IDs
 Vector of ROC IDs associated with this subsystem. More...
 
std::vector< std::vector
< UInt_t > > 
fBank_IDs
 Vector of Bank IDs per ROC ID associated with this subsystem. More...
 
std::vector< QwSubsystemArray * > fArrays
 Vector of pointers to subsystem arrays that contain this subsystem. More...
 
- Protected Attributes inherited from MQwHistograms
std::vector< TH1_ptrfHistograms
 Histograms associated with this data element. More...
 

Private Member Functions

 QwMainCerenkovDetector ()
 Private default constructor (not implemented, will throw linker error on use) More...
 

Private Attributes

Int_t fMainDetErrorCount
 

Static Private Attributes

static const Bool_t bDEBUG =kFALSE
 

Friends

class QwCombinedPMT
 

Detailed Description

Definition at line 28 of file QwMainCerenkovDetector.h.

Constructor & Destructor Documentation

QwMainCerenkovDetector::QwMainCerenkovDetector ( )
private

Private default constructor (not implemented, will throw linker error on use)

QwMainCerenkovDetector::QwMainCerenkovDetector ( const TString &  name)
inline

Constructor with name.

Definition at line 44 of file QwMainCerenkovDetector.h.

References fTargetCharge, fTargetEnergy, fTargetX, fTargetXprime, fTargetY, and fTargetYprime.

45  : VQwSubsystem(name),VQwSubsystemParity(name),bNormalization(kFALSE)
46  {
47  fTargetCharge.InitializeChannel("q_targ","derived");
48  fTargetX.InitializeChannel("x_targ","derived");
49  fTargetY.InitializeChannel("y_targ","derived");
50  fTargetXprime.InitializeChannel("xp_targ","derived");
51  fTargetYprime.InitializeChannel("yp_targ","derived");
52  fTargetEnergy.InitializeChannel("e_targ","derived");
53  };
VQwSubsystemParity()
Private default constructor (not implemented, will throw linker error on use)
QwMainCerenkovDetector::QwMainCerenkovDetector ( const QwMainCerenkovDetector source)
inline

Copy constructor.

Definition at line 55 of file QwMainCerenkovDetector.h.

56  : VQwSubsystem(source),VQwSubsystemParity(source),
59  { }
std::vector< QwIntegrationPMT > fIntegrationPMT
std::vector< QwCombinedPMT > fCombinedPMT
VQwSubsystemParity()
Private default constructor (not implemented, will throw linker error on use)
virtual QwMainCerenkovDetector::~QwMainCerenkovDetector ( )
inlinevirtual

Virtual destructor.

Definition at line 61 of file QwMainCerenkovDetector.h.

61 { };

Member Function Documentation

void QwMainCerenkovDetector::AccumulateRunningSum ( VQwSubsystem value)
virtual

Update the running sums for devices.

Implements VQwSubsystemParity.

Definition at line 1184 of file QwMainCerenkovDetector.cc.

References Compare(), fCombinedPMT, and fIntegrationPMT.

1185 {
1186  if (Compare(value1)) {
1187  QwMainCerenkovDetector* value = dynamic_cast<QwMainCerenkovDetector*>(value1);
1188 
1189  for (size_t i = 0; i < fIntegrationPMT.size(); i++)
1191  for (size_t i = 0; i < fCombinedPMT.size(); i++)
1193  }
1194 }
std::vector< QwIntegrationPMT > fIntegrationPMT
std::vector< QwCombinedPMT > fCombinedPMT
Bool_t Compare(VQwSubsystem *source)
void AccumulateRunningSum(VQwSubsystem *value)
Update the running sums for devices.

+ Here is the call graph for this function:

Bool_t QwMainCerenkovDetector::ApplyHWChecks ( )
inline

Definition at line 150 of file QwMainCerenkovDetector.h.

References fIntegrationPMT.

150  {//Check for harware errors in the devices
151  Bool_t status = kTRUE;
152  for (size_t i=0; i<fIntegrationPMT.size(); i++){
153  status &= fIntegrationPMT.at(i).ApplyHWChecks();
154  }
155  return status;
156  };
std::vector< QwIntegrationPMT > fIntegrationPMT
Bool_t QwMainCerenkovDetector::ApplySingleEventCuts ( )
virtual

Apply the single event cuts.

Implements VQwSubsystemParity.

Definition at line 712 of file QwMainCerenkovDetector.cc.

References bDEBUG, fCombinedPMT, fIntegrationPMT, and fMainDetErrorCount.

713 {
714  Bool_t status=kTRUE;
715  for(size_t i=0;i<fIntegrationPMT.size();i++){
716  status &= fIntegrationPMT[i].ApplySingleEventCuts();
717  if(!status && bDEBUG) std::cout<<"******* QwMainCerenkovDetector::SingleEventCuts()->IntegrationPMT[ "<<i<<" , "<<fIntegrationPMT[i].GetElementName()<<" ] ******\n";
718  }
719  for(size_t i=0;i<fCombinedPMT.size();i++){
720  status &= fCombinedPMT[i].ApplySingleEventCuts();
721  if(!status && bDEBUG) std::cout<<"******* QwMainCerenkovDetector::SingleEventCuts()->CombinedPMT[ "<<i<<" , "<<fCombinedPMT[i].GetElementName()<<" ] ******\n";
722  }
723 
724 
725  if (!status)
726  fMainDetErrorCount++;//failed event counter for QwMainCerenkovDetector
727 
728  return status;
729 
730 
731 }
std::vector< QwIntegrationPMT > fIntegrationPMT
std::vector< QwCombinedPMT > fCombinedPMT
void QwMainCerenkovDetector::Blind ( const QwBlinder blinder)
virtual

Blind the asymmetry.

Blind the asymmetry

Parameters
blinderBlinder

Reimplemented from VQwSubsystemParity.

Definition at line 1212 of file QwMainCerenkovDetector.cc.

References fCombinedPMT, and fIntegrationPMT.

Referenced by Blind().

1213 {
1214  for (size_t i = 0; i < fIntegrationPMT.size(); i++)
1215  fIntegrationPMT[i].Blind(blinder);
1216  for (size_t i = 0; i < fCombinedPMT.size(); i++)
1217  fCombinedPMT[i].Blind(blinder);
1218 }
std::vector< QwIntegrationPMT > fIntegrationPMT
void Blind(const QwBlinder *blinder)
Blind the asymmetry.
std::vector< QwCombinedPMT > fCombinedPMT

+ Here is the caller graph for this function:

void QwMainCerenkovDetector::Blind ( const QwBlinder blinder,
const VQwSubsystemParity subsys 
)
virtual

Blind the difference using the yield.

Blind the difference using the yield

Parameters
blinderBlinder
subsysSubsystem
Todo:
TODO (wdc) At some point we should introduce const-correctness in the Compare() routine to ensure nothing funny happens. This const_casting is just an ugly stop-gap measure.

Reimplemented from VQwSubsystemParity.

Definition at line 1225 of file QwMainCerenkovDetector.cc.

References Blind(), Compare(), fCombinedPMT, and fIntegrationPMT.

1226 {
1227  /// \todo TODO (wdc) At some point we should introduce const-correctness in
1228  /// the Compare() routine to ensure nothing funny happens. This const_casting
1229  /// is just an ugly stop-gap measure.
1230  if (Compare(const_cast<VQwSubsystemParity*>(subsys))) {
1231 
1232  const QwMainCerenkovDetector* yield = dynamic_cast<const QwMainCerenkovDetector*>(subsys);
1233  if (yield == 0) return;
1234 
1235  for (size_t i = 0; i < fIntegrationPMT.size(); i++)
1236  fIntegrationPMT[i].Blind(blinder, yield->fIntegrationPMT[i]);
1237  for (size_t i = 0; i < fCombinedPMT.size(); i++)
1238  fCombinedPMT[i].Blind(blinder, yield->fCombinedPMT[i]);
1239  }
1240 }
std::vector< QwIntegrationPMT > fIntegrationPMT
void Blind(const QwBlinder *blinder)
Blind the asymmetry.
std::vector< QwCombinedPMT > fCombinedPMT
Bool_t Compare(VQwSubsystem *source)

+ Here is the call graph for this function:

void QwMainCerenkovDetector::CalculateRunningAverage ( )
virtual

Calculate the average for all good events.

Implements VQwSubsystemParity.

Definition at line 1173 of file QwMainCerenkovDetector.cc.

References fCombinedPMT, and fIntegrationPMT.

1174 {
1175  for (size_t i=0;i<fIntegrationPMT.size();i++)
1177 
1178  for (size_t i=0;i<fCombinedPMT.size();i++)
1180 
1181  return;
1182 }
std::vector< QwIntegrationPMT > fIntegrationPMT
std::vector< QwCombinedPMT > fCombinedPMT
void CalculateRunningAverage()
Calculate the average for all good events.
void QwMainCerenkovDetector::ClearEventData ( )
virtual

Implements VQwSubsystem.

Definition at line 571 of file QwMainCerenkovDetector.cc.

References fCombinedPMT, and fIntegrationPMT.

572 {
573  for (size_t i=0;i<fIntegrationPMT.size();i++){
574  fIntegrationPMT[i].ClearEventData();
575  }
576  for (size_t i=0;i<fCombinedPMT.size();i++)
578 
579  return;
580 }
std::vector< QwIntegrationPMT > fIntegrationPMT
std::vector< QwCombinedPMT > fCombinedPMT
Bool_t QwMainCerenkovDetector::Compare ( VQwSubsystem source)

Definition at line 1036 of file QwMainCerenkovDetector.cc.

References fCombinedPMT, and fIntegrationPMT.

Referenced by AccumulateRunningSum(), Blind(), DeaccumulateRunningSum(), Difference(), operator+=(), operator-=(), operator=(), Ratio(), Sum(), and UpdateErrorFlag().

1037 {
1038  // std::cout<<" Here in QwLumi::Compare \n";
1039 
1040  Bool_t res=kTRUE;
1041  if (typeid(*value)!=typeid(*this))
1042  {
1043  res=kFALSE;
1044  // std::cout<<" types are not ok \n";
1045  // std::cout<<" this is bypassed just for now but should be fixed eventually \n";
1046  }
1047  else
1048  {
1049  QwMainCerenkovDetector* input = dynamic_cast<QwMainCerenkovDetector*>(value);
1050  if (input->fIntegrationPMT.size()!=fIntegrationPMT.size() ||
1051  input->fCombinedPMT.size()!=fCombinedPMT.size() )
1052  {
1053  res=kFALSE;
1054  // std::cout<<" not the same number of channels \n";
1055  }
1056  }
1057  return res;
1058 }
std::vector< QwIntegrationPMT > fIntegrationPMT
std::vector< QwCombinedPMT > fCombinedPMT

+ Here is the caller graph for this function:

void QwMainCerenkovDetector::ConstructBranch ( TTree *  tree,
TString &  prefix 
)
virtual

Construct the branch and tree vector.

Implements VQwSubsystem.

Definition at line 982 of file QwMainCerenkovDetector.cc.

References fCombinedPMT, and fIntegrationPMT.

Referenced by ConstructBranch().

983 {
984  for (size_t i=0;i<fIntegrationPMT.size();i++)
985  fIntegrationPMT[i].ConstructBranch(tree, prefix);
986 
987  for (size_t i=0;i<fCombinedPMT.size();i++)
988  fCombinedPMT[i].ConstructBranch(tree, prefix);
989 
990  return;
991 }
void ConstructBranch(TTree *tree, TString &prefix)
Construct the branch and tree vector.
std::vector< QwIntegrationPMT > fIntegrationPMT
std::vector< QwCombinedPMT > fCombinedPMT

+ Here is the caller graph for this function:

void QwMainCerenkovDetector::ConstructBranch ( TTree *  tree,
TString &  prefix,
QwParameterFile trim_file 
)
virtual

Construct the branch and tree vector based on the trim file.

Implements VQwSubsystem.

Definition at line 993 of file QwMainCerenkovDetector.cc.

References ConstructBranch(), fCombinedPMT, QwParameterFile::FileHasModuleHeader(), fIntegrationPMT, QwParameterFile::ReadUntilNextModule(), and QwParameterFile::RewindToFileStart().

994 {
995  TString tmp;
996  QwParameterFile* nextmodule;
997  trim_file.RewindToFileStart();
998  tmp="QwIntegrationPMT";
999  trim_file.RewindToFileStart();
1000  if (trim_file.FileHasModuleHeader(tmp)){
1001  nextmodule=trim_file.ReadUntilNextModule();//This section contains sub modules and or channels to be included in the tree
1002  for (size_t i=0;i<fIntegrationPMT.size();i++)
1003 
1004  fIntegrationPMT[i].ConstructBranch(tree, prefix, *nextmodule);
1005  }
1006 
1007  tmp="QwCombinedPMT";
1008  trim_file.RewindToFileStart();
1009  if (trim_file.FileHasModuleHeader(tmp)){
1010  nextmodule=trim_file.ReadUntilNextModule();//This section contains sub modules and or channels to be included in the tree
1011  for (size_t i=0;i<fCombinedPMT.size();i++)
1012  fCombinedPMT[i].ConstructBranch(tree, prefix, *nextmodule );
1013  }
1014 
1015  return;
1016 }
void ConstructBranch(TTree *tree, TString &prefix)
Construct the branch and tree vector.
std::vector< QwIntegrationPMT > fIntegrationPMT
std::vector< QwCombinedPMT > fCombinedPMT
Bool_t FileHasModuleHeader(const std::string &secname)
QwParameterFile * ReadUntilNextModule(const bool add_current_line=false)

+ Here is the call graph for this function:

void QwMainCerenkovDetector::ConstructBranchAndVector ( TTree *  tree,
TString &  prefix,
std::vector< Double_t > &  values 
)
virtual

Construct the branch and tree vector.

Implements VQwSubsystem.

Definition at line 971 of file QwMainCerenkovDetector.cc.

References fCombinedPMT, and fIntegrationPMT.

972 {
973  for (size_t i=0;i<fIntegrationPMT.size();i++)
974  fIntegrationPMT[i].ConstructBranchAndVector(tree, prefix, values);
975 
976  for (size_t i=0;i<fCombinedPMT.size();i++)
977  fCombinedPMT[i].ConstructBranchAndVector(tree, prefix, values);
978 
979  return;
980 }
std::vector< QwIntegrationPMT > fIntegrationPMT
std::vector< QwCombinedPMT > fCombinedPMT
void ConstructBranchAndVector(TTree *tree, TString &prefix, std::vector< Double_t > &values)
Construct the branch and tree vector.
void QwMainCerenkovDetector::ConstructHistograms ( TDirectory *  folder)
inlinevirtual

Construct the histograms for this subsystem in a folder.

Reimplemented from VQwSubsystem.

Definition at line 100 of file QwMainCerenkovDetector.h.

References VQwSubsystem::ConstructHistograms().

100  {
101  TString tmpstr("");
102  ConstructHistograms(folder,tmpstr);
103  };
virtual void ConstructHistograms()
Construct the histograms for this subsystem.
Definition: VQwSubsystem.h:209

+ Here is the call graph for this function:

void QwMainCerenkovDetector::ConstructHistograms ( TDirectory *  folder,
TString &  prefix 
)
virtual

Construct the histograms for this subsystem in a folder with a prefix.

Implements VQwSubsystem.

Definition at line 948 of file QwMainCerenkovDetector.cc.

References VQwSubsystem::ConstructHistograms(), fCombinedPMT, and fIntegrationPMT.

949 {
950  for (size_t i=0;i<fIntegrationPMT.size();i++)
951  fIntegrationPMT[i].ConstructHistograms(folder,prefix);
952 
953  for (size_t i=0;i<fCombinedPMT.size();i++)
954  fCombinedPMT[i].ConstructHistograms(folder,prefix);
955  return;
956 }
std::vector< QwIntegrationPMT > fIntegrationPMT
virtual void ConstructHistograms()
Construct the histograms for this subsystem.
Definition: VQwSubsystem.h:209
std::vector< QwCombinedPMT > fCombinedPMT

+ Here is the call graph for this function:

void QwMainCerenkovDetector::DeaccumulateRunningSum ( VQwSubsystem value)
virtual

remove one entry from the running sums for devices

Implements VQwSubsystemParity.

Definition at line 1196 of file QwMainCerenkovDetector.cc.

References Compare(), fCombinedPMT, and fIntegrationPMT.

1196  {
1197  if (Compare(value1)) {
1198  QwMainCerenkovDetector* value = dynamic_cast<QwMainCerenkovDetector*>(value1);
1199 
1200  for (size_t i = 0; i < fIntegrationPMT.size(); i++)
1202  for (size_t i = 0; i < fCombinedPMT.size(); i++)
1204  }
1205 };
std::vector< QwIntegrationPMT > fIntegrationPMT
std::vector< QwCombinedPMT > fCombinedPMT
Bool_t Compare(VQwSubsystem *source)
void DeaccumulateRunningSum(VQwSubsystem *value)
remove one entry from the running sums for devices

+ Here is the call graph for this function:

void QwMainCerenkovDetector::DefineOptions ( QwOptions options)
static

Define options function.

Defines configuration options for QwEventBuffer class using QwOptions functionality.

Parameters
optionsOptions object

Definition at line 30 of file QwMainCerenkovDetector.cc.

References QwOptions::AddOptions(), and default_bool_value.

30  {
31  // Define the execution options
32  options.AddOptions()
33  ("QwMainCerenkovDetector.normalize",
34  po::value<bool>()->default_bool_value(true),
35  "Normalize the detectors by beam current");
36 }
#define default_bool_value(b)
Definition: QwOptions.h:51
po::options_description_easy_init AddOptions(const std::string &blockname="Specialized options")
Add an option to a named block or create new block.
Definition: QwOptions.h:164

+ Here is the call graph for this function:

void QwMainCerenkovDetector::Difference ( VQwSubsystem value1,
VQwSubsystem value2 
)
virtual

Implements VQwSubsystemParity.

Definition at line 1124 of file QwMainCerenkovDetector.cc.

References Compare().

1125 {
1126  if (Compare(value1)&&Compare(value2))
1127  {
1128  *this = value1;
1129  *this -= value2;
1130  }
1131 }
Bool_t Compare(VQwSubsystem *source)

+ Here is the call graph for this function:

void QwMainCerenkovDetector::DoNormalization ( Double_t  factor = 1.0)

Definition at line 1312 of file QwMainCerenkovDetector.cc.

References bIsExchangedDataValid, Qw::e, fTargetCharge, and Normalize().

Referenced by ProcessEvent_2().

1313 {
1315  {
1316  try
1317  {
1318  this->Normalize(&fTargetCharge);
1319  }
1320  catch (std::exception& e)
1321  {
1322  std::cerr << e.what() << std::endl;
1323  }
1324  }
1325 }
void Normalize(VQwDataElement *denom)
static const double e
Definition: QwUnits.h:91

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void QwMainCerenkovDetector::EncodeEventData ( std::vector< UInt_t > &  buffer)
virtual

Reimplemented from VQwSubsystem.

Definition at line 617 of file QwMainCerenkovDetector.cc.

References VQwSubsystem::fCurrentBank_ID, VQwSubsystem::fCurrentROC_ID, fIntegrationPMT, fMainDetID, and kQwIntegrationPMT.

618 {
619  std::vector<UInt_t> elements;
620  elements.clear();
621 
622  // Get all buffers in the order they are defined in the map file
623  for (size_t i = 0; i < fMainDetID.size(); i++)
624  {
625  // This is a QwIntegrationPMT
626  if (fMainDetID.at(i).fTypeID == kQwIntegrationPMT)
627  fIntegrationPMT[fMainDetID.at(i).fIndex].EncodeEventData(elements);
628  }
629 
630  // If there is element data, generate the subbank header
631  std::vector<UInt_t> subbankheader;
632  std::vector<UInt_t> rocheader;
633  if (elements.size() > 0)
634  {
635 
636  // Form CODA subbank header
637  subbankheader.clear();
638  subbankheader.push_back(elements.size() + 1); // subbank size
639  subbankheader.push_back((fCurrentBank_ID << 16) | (0x01 << 8) | (1 & 0xff));
640  // subbank tag | subbank type | event number
641 
642  // Form CODA bank/roc header
643  rocheader.clear();
644  rocheader.push_back(subbankheader.size() + elements.size() + 1); // bank/roc size
645  rocheader.push_back((fCurrentROC_ID << 16) | (0x10 << 8) | (1 & 0xff));
646  // bank tag == ROC | bank type | event number
647 
648  // Add bank header, subbank header and element data to output buffer
649  buffer.insert(buffer.end(), rocheader.begin(), rocheader.end());
650  buffer.insert(buffer.end(), subbankheader.begin(), subbankheader.end());
651  buffer.insert(buffer.end(), elements.begin(), elements.end());
652  }
653 }
std::vector< QwIntegrationPMT > fIntegrationPMT
std::vector< QwMainCerenkovDetectorID > fMainDetID
Int_t fCurrentROC_ID
ROC ID that is currently being processed.
Definition: VQwSubsystem.h:325
Int_t fCurrentBank_ID
Bank ID that is currently being processed.
Definition: VQwSubsystem.h:326
void QwMainCerenkovDetector::ExchangeProcessedData ( )
virtual

Exchange data between subsystems

Reimplemented from VQwSubsystem.

Definition at line 805 of file QwMainCerenkovDetector.cc.

References bDEBUG, bIsExchangedDataValid, bNormalization, QwLog::endl(), fTargetCharge, VQwSubsystem::GetSubsystemName(), QwError, QwWarning, and VQwSubsystem::RequestExternalValue().

806 {
807  //QwWarning << "QwMainCerenkovDetector::ExchangeProcessedData "<< QwLog::endl;
808  bIsExchangedDataValid = kTRUE;
809  if (bNormalization){
810  // Create a list of all variables that we need
811  // TODO This could be a static list to avoid repeated vector initializiations
812  /*
813  std::vector<VQwDataElement*> variable_list;
814  variable_list.push_back(&fTargetCharge);
815  variable_list.push_back(&fTargetX);
816  variable_list.push_back(&fTargetY);
817  variable_list.push_back(&fTargetXprime);
818  variable_list.push_back(&fTargetYprime);
819  variable_list.push_back(&fTargetEnergy);
820  */
821 
822  // Loop over all variables in the list
823  /*
824  //IMPORTANT NOTE ABOUT THE COMMENTED LOOP
825  //NAMES OF THE variable_list DEVICES WILL BE OVER WRITTEN BY ACTUAL NAMES OF DATA ELEMENTS THAT WE ARE READING FROM THE
826  //ROUTINE RequestExternalValue(variable->GetElementName(), variable). DO TRY THIS AT HOME!
827 
828 
829  std::vector<VQwDataElement*>::iterator variable_iter;
830  for (variable_iter = variable_list.begin(); variable_iter != variable_list.end(); variable_iter++){
831  VQwDataElement* variable = *variable_iter;
832  //QwWarning << "QwMainCerenkovDetector::ExchangeProcessedData for loop "<<variable->GetElementName()<< QwLog::endl;
833  if (RequestExternalValue(variable->GetElementName(), variable))
834  {
835  if (bDEBUG)
836  dynamic_cast<QwVQWK_Channel*>(variable)->PrintInfo();
837  //QwWarning << "QwMainCerenkovDetector::ExchangeProcessedData Found "<<variable->GetElementName()<< QwLog::endl;
838  }
839  else
840  {
841  bIsExchangedDataValid = kFALSE;
842  QwError << GetSubsystemName() << " could not get external value for "
843  << variable->GetElementName() << QwLog::endl;
844  }
845  } // end of loop over variables
846 
847  */
848 
849  if(RequestExternalValue("q_targ", &fTargetCharge)){
850  if (bDEBUG){
851  QwWarning << "QwMainCerenkovDetector::ExchangeProcessedData Found "<<fTargetCharge.GetElementName()<< QwLog::endl;
852  //QwWarning <<"****QwMainCerenkovDetector****"<< QwLog::endl;
853  (dynamic_cast<QwVQWK_Channel*>(&fTargetCharge))->PrintInfo();
854  }
855  }
856  else{
857  bIsExchangedDataValid = kFALSE;
858  QwError << GetSubsystemName() << " could not get external value for "
859  << fTargetCharge.GetElementName() << QwLog::endl;
860  }
861  /*
862  if(RequestExternalValue("x_targ", &fTargetX)){
863  if (bDEBUG){
864  dynamic_cast<QwVQWK_Channel*>(&fTargetX)->PrintInfo();
865  QwWarning << "QwMainCerenkovDetector::ExchangeProcessedData Found "<<fTargetX.GetElementName()<< QwLog::endl;
866  }
867  }else{
868  bIsExchangedDataValid = kFALSE;
869  QwError << GetSubsystemName() << " could not get external value for "
870  << fTargetX.GetElementName() << QwLog::endl;
871  }
872 
873  if(RequestExternalValue("y_targ", &fTargetY)){
874  if (bDEBUG){
875  dynamic_cast<QwVQWK_Channel*>(&fTargetY)->PrintInfo();
876  QwWarning << "QwMainCerenkovDetector::ExchangeProcessedData Found "<<fTargetY.GetElementName()<< QwLog::endl;
877  }
878  }else{
879  bIsExchangedDataValid = kFALSE;
880  QwError << GetSubsystemName() << " could not get external value for "
881  << fTargetY.GetElementName() << QwLog::endl;
882  }
883 
884  if(RequestExternalValue("xp_targ", &fTargetXprime)){
885  if (bDEBUG){
886  dynamic_cast<QwVQWK_Channel*>(&fTargetXprime)->PrintInfo();
887  QwWarning << "QwMainCerenkovDetector::ExchangeProcessedData Found "<<fTargetXprime.GetElementName()<< QwLog::endl;
888  }
889  }else{
890  bIsExchangedDataValid = kFALSE;
891  QwError << GetSubsystemName() << " could not get external value for "
892  << fTargetXprime.GetElementName() << QwLog::endl;
893  }
894 
895  if(RequestExternalValue("yp_targ", &fTargetYprime)){
896  if (bDEBUG){
897  dynamic_cast<QwVQWK_Channel*>(&fTargetYprime)->PrintInfo();
898  QwWarning << "QwMainCerenkovDetector::ExchangeProcessedData Found "<<fTargetYprime.GetElementName()<< QwLog::endl;
899  }
900  }else{
901  bIsExchangedDataValid = kFALSE;
902  QwError << GetSubsystemName() << " could not get external value for "
903  << fTargetYprime.GetElementName() << QwLog::endl;
904  }
905 
906  if(RequestExternalValue("e_targ", &fTargetEnergy)){
907  if (bDEBUG){
908  dynamic_cast<QwVQWK_Channel*>(&fTargetEnergy)->PrintInfo();
909  QwWarning << "QwMainCerenkovDetector::ExchangeProcessedData Found "<<fTargetEnergy.GetElementName()<< QwLog::endl;
910  }
911  }else{
912  bIsExchangedDataValid = kFALSE;
913  QwError << GetSubsystemName() << " could not get external value for "
914  << fTargetEnergy.GetElementName() << QwLog::endl;
915  }
916  */
917 
918 
919  }
920 }
static std::ostream & endl(std::ostream &)
End of the line.
Definition: QwLog.cc:299
Bool_t RequestExternalValue(const TString &name, VQwHardwareChannel *value) const
Request a named value which is owned by an external subsystem; the request will be handled by the par...
#define QwWarning
Predefined log drain for warnings.
Definition: QwLog.h:45
#define QwError
Predefined log drain for errors.
Definition: QwLog.h:40
TString GetSubsystemName() const
Definition: VQwSubsystem.h:93

+ Here is the call graph for this function:

void QwMainCerenkovDetector::FillDB ( QwParityDB db,
TString  type 
)
virtual

Fill the database.

Reimplemented from VQwSubsystemParity.

Definition at line 1327 of file QwMainCerenkovDetector.cc.

References QwDatabase::Connect(), QwDBInterface::DetermineMeasurementTypeID(), QwDatabase::Disconnect(), QwLog::endl(), fCombinedPMT, fIntegrationPMT, QwParityDB::GetAnalysisID(), Qw::kBoldRed, Qw::kGreen, Qw::kNormal, QwDatabase::Query(), and QwMessage.

1328 {
1329  Bool_t local_print_flag = false;
1330 
1331  if(local_print_flag) {
1332  QwMessage << " --------------------------------------------------------------- " << QwLog::endl;
1333  QwMessage << " QwMainCerenkovDetector::FillDB " << QwLog::endl;
1334  QwMessage << " --------------------------------------------------------------- " << QwLog::endl;
1335  }
1336 
1337  std::vector<QwDBInterface> interface;
1338  std::vector<QwParitySSQLS::md_data> entrylist;
1339 
1340  UInt_t analysis_id = db->GetAnalysisID();
1341 
1342  TString measurement_type;
1343  measurement_type = QwDBInterface::DetermineMeasurementTypeID(datatype);
1344 
1345  UInt_t i,j;
1346  i = j = 0;
1347  if(local_print_flag) QwMessage << QwColor(Qw::kGreen) << "IntegrationPMT" <<QwLog::endl;
1348 
1349  for(i=0; i<fIntegrationPMT.size(); i++) {
1350  interface.clear();
1351  interface = fIntegrationPMT[i].GetDBEntry();
1352  for(j=0; j<interface.size(); j++) {
1353  interface.at(j).SetAnalysisID( analysis_id );
1354  interface.at(j).SetMainDetectorID( db );
1355  interface.at(j).SetMeasurementTypeID( measurement_type );
1356  interface.at(j).PrintStatus( local_print_flag );
1357  interface.at(j).AddThisEntryToList( entrylist );
1358  }
1359  }
1360 
1361  if(local_print_flag) QwMessage << QwColor(Qw::kGreen) << "Combined PMT" <<QwLog::endl;
1362 
1363  for(i=0; i< fCombinedPMT.size(); i++)
1364  {
1365  interface.clear();
1366  interface = fCombinedPMT[i].GetDBEntry();
1367  for(j=0; j<interface.size(); j++) {
1368  interface.at(j).SetAnalysisID( analysis_id );
1369  interface.at(j).SetMainDetectorID( db );
1370  interface.at(j).SetMeasurementTypeID( measurement_type );
1371  interface.at(j).PrintStatus( local_print_flag );
1372  interface.at(j).AddThisEntryToList( entrylist );
1373  }
1374  }
1375  if(local_print_flag) {
1376  QwMessage << QwColor(Qw::kGreen) << "Entrylist Size : "
1377  << QwColor(Qw::kBoldRed) << entrylist.size()
1379  }
1380 
1381  db->Connect();
1382  // Check the entrylist size, if it isn't zero, start to query..
1383  if( entrylist.size() ) {
1384  mysqlpp::Query query= db->Query();
1385  query.insert(entrylist.begin(), entrylist.end());
1386  query.execute();
1387  }
1388  else {
1389  QwMessage << "QwMainCerenkovDetector::FillDB :: This is the case when the entrlylist contains nothing in "<< datatype.Data() << QwLog::endl;
1390  }
1391  db->Disconnect();
1392  return;
1393 }
#define QwMessage
Predefined log drain for regular messages.
Definition: QwLog.h:50
void Disconnect()
Definition: QwDatabase.h:59
Bool_t Connect()
Open a connection to the database using the predefined parameters.
Definition: QwDatabase.cc:175
std::vector< QwIntegrationPMT > fIntegrationPMT
UInt_t GetAnalysisID()
Definition: QwParityDB.h:71
std::vector< QwCombinedPMT > fCombinedPMT
mysqlpp::Query Query(const char *qstr=0)
Definition: QwDatabase.h:66
A color changing class for the output stream.
Definition: QwColor.h:98
static std::ostream & endl(std::ostream &)
End of the line.
Definition: QwLog.cc:299
static TString DetermineMeasurementTypeID(TString type, TString suffix="", Bool_t forcediffs=kFALSE)

+ Here is the call graph for this function:

void QwMainCerenkovDetector::FillErrDB ( QwParityDB db,
TString  datatype 
)
virtual

Reimplemented from VQwSubsystemParity.

Definition at line 1433 of file QwMainCerenkovDetector.cc.

References QwDatabase::Connect(), QwDatabase::Disconnect(), QwLog::endl(), fCombinedPMT, fIntegrationPMT, QwParityDB::GetAnalysisID(), Qw::kBoldRed, Qw::kGreen, Qw::kNormal, QwDatabase::Query(), and QwMessage.

1434 {
1435 
1436  Bool_t local_print_flag = false;
1437  if(local_print_flag){
1438  QwMessage << " --------------------------------------------------------------- " << QwLog::endl;
1439  QwMessage << " QwMainCerenkovDetectorID::FillErrDB " << QwLog::endl;
1440  QwMessage << " --------------------------------------------------------------- " << QwLog::endl;
1441  }
1442 
1443 
1444  std::vector<QwErrDBInterface> interface;
1445  std::vector<QwParitySSQLS::md_errors> entrylist;
1446 
1447  UInt_t analysis_id = db->GetAnalysisID();
1448 
1449  UInt_t i,j;
1450  i = j = 0;
1451  if(local_print_flag) QwMessage << QwColor(Qw::kGreen) << "IntegrationPMT" <<QwLog::endl;
1452 
1453  for(i=0; i<fIntegrationPMT.size(); i++) {
1454  interface.clear();
1455  interface = fIntegrationPMT[i].GetErrDBEntry();
1456  for(j=0; j<interface.size(); j++) {
1457  interface.at(j).SetAnalysisID ( analysis_id );
1458  interface.at(j).SetMainDetectorID ( db );
1459  interface.at(j).PrintStatus ( local_print_flag );
1460  interface.at(j).AddThisEntryToList( entrylist );
1461  }
1462  }
1463 
1464  if(local_print_flag) QwMessage << QwColor(Qw::kGreen) << "Combined PMT" <<QwLog::endl;
1465 
1466  for(i=0; i< fCombinedPMT.size(); i++)
1467  {
1468  interface.clear();
1469  interface = fCombinedPMT[i].GetErrDBEntry();
1470  for(j=0; j<interface.size(); j++) {
1471  interface.at(j).SetAnalysisID ( analysis_id );
1472  interface.at(j).SetMainDetectorID ( db );
1473  interface.at(j).PrintStatus ( local_print_flag );
1474  interface.at(j).AddThisEntryToList( entrylist );
1475  }
1476  }
1477  if(local_print_flag) {
1478  QwMessage << QwColor(Qw::kGreen) << "Entrylist Size : "
1479  << QwColor(Qw::kBoldRed) << entrylist.size()
1481  }
1482 
1483  db->Connect();
1484  // Check the entrylist size, if it isn't zero, start to query..
1485  if( entrylist.size() ) {
1486  mysqlpp::Query query= db->Query();
1487  query.insert(entrylist.begin(), entrylist.end());
1488  query.execute();
1489  }
1490  else {
1491  QwMessage << "QwMainCerenkovDetector::FillErrDB :: This is the case when the entrlylist contains nothing in "<< datatype.Data() << QwLog::endl;
1492  }
1493  db->Disconnect();
1494 
1495  return;
1496 };
#define QwMessage
Predefined log drain for regular messages.
Definition: QwLog.h:50
void Disconnect()
Definition: QwDatabase.h:59
Bool_t Connect()
Open a connection to the database using the predefined parameters.
Definition: QwDatabase.cc:175
std::vector< QwIntegrationPMT > fIntegrationPMT
UInt_t GetAnalysisID()
Definition: QwParityDB.h:71
std::vector< QwCombinedPMT > fCombinedPMT
mysqlpp::Query Query(const char *qstr=0)
Definition: QwDatabase.h:66
A color changing class for the output stream.
Definition: QwColor.h:98
static std::ostream & endl(std::ostream &)
End of the line.
Definition: QwLog.cc:299

+ Here is the call graph for this function:

void QwMainCerenkovDetector::FillHistograms ( )
virtual

Fill the histograms for this subsystem.

Implements VQwSubsystem.

Definition at line 959 of file QwMainCerenkovDetector.cc.

References fCombinedPMT, and fIntegrationPMT.

960 {
961  for (size_t i=0;i<fIntegrationPMT.size();i++)
963 
964  for (size_t i=0;i<fCombinedPMT.size();i++)
966 
967  return;
968 }
void FillHistograms()
Fill the histograms for this subsystem.
std::vector< QwIntegrationPMT > fIntegrationPMT
std::vector< QwCombinedPMT > fCombinedPMT
void QwMainCerenkovDetector::FillTreeVector ( std::vector< Double_t > &  values) const
virtual

Fill the tree vector.

Implements VQwSubsystem.

Definition at line 1018 of file QwMainCerenkovDetector.cc.

References fCombinedPMT, and fIntegrationPMT.

1019 {
1020  for (size_t i=0;i<fIntegrationPMT.size();i++)
1021  fIntegrationPMT[i].FillTreeVector(values);
1022 
1023  for (size_t i=0;i<fCombinedPMT.size();i++)
1024  fCombinedPMT[i].FillTreeVector(values);
1025 
1026  return;
1027 }
void FillTreeVector(std::vector< Double_t > &values) const
Fill the tree vector.
std::vector< QwIntegrationPMT > fIntegrationPMT
std::vector< QwCombinedPMT > fCombinedPMT
const QwIntegrationPMT * QwMainCerenkovDetector::GetChannel ( const TString  name) const

Definition at line 1030 of file QwMainCerenkovDetector.cc.

References GetIntegrationPMT().

Referenced by PublishInternalValues().

1031 {
1032  return GetIntegrationPMT(name);
1033 }
const QwIntegrationPMT * GetIntegrationPMT(const TString name) const

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

const QwCombinedPMT * QwMainCerenkovDetector::GetCombinedPMT ( const TString  name) const

Definition at line 1293 of file QwMainCerenkovDetector.cc.

References QwLog::endl(), fCombinedPMT, and QwMessage.

Referenced by PublishInternalValues().

1294 {
1295  TString tmpname = name;
1296  tmpname.ToLower();
1297  if (! fCombinedPMT.empty())
1298  {
1299  for (size_t i=0;i<fCombinedPMT.size();i++)
1300  {
1301  if (fCombinedPMT.at(i).GetElementName() == tmpname)
1302  {
1303  //std::cout<<"Get CombinedPMT "<<tmpname<<std::endl;
1304  return &(fCombinedPMT.at(i));
1305  }
1306  }
1307  }
1308  QwMessage << "QwMainCerenkovDetector::GetCombinedPMT: cannot find channel " << tmpname << QwLog::endl;
1309  return NULL;
1310 }
#define QwMessage
Predefined log drain for regular messages.
Definition: QwLog.h:50
std::vector< QwCombinedPMT > fCombinedPMT
static std::ostream & endl(std::ostream &)
End of the line.
Definition: QwLog.cc:299

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Int_t QwMainCerenkovDetector::GetDetectorIndex ( EQwPMTInstrumentType  TypeID,
TString  name 
)
protected

Definition at line 1248 of file QwMainCerenkovDetector.cc.

References fMainDetID.

Referenced by LoadChannelMap(), and LoadEventCuts().

1249 {
1250  Bool_t ldebug=kFALSE;
1251  if (ldebug)
1252  {
1253  std::cout<<"QwMainCerenkovDetector::GetDetectorIndex\n";
1254  std::cout<<"type_id=="<<type_id<<" name="<<name<<"\n";
1255  std::cout<<fMainDetID.size()<<" already registered detector\n";
1256  }
1257 
1258  Int_t result=-1;
1259  for (size_t i=0;i<fMainDetID.size();i++)
1260  {
1261  if (fMainDetID[i].fTypeID==type_id)
1262  if (fMainDetID[i].fdetectorname==name)
1263  {
1264  result=fMainDetID[i].fIndex;
1265  if (ldebug)
1266  std::cout<<"testing against ("<<fMainDetID[i].fTypeID
1267  <<","<<fMainDetID[i].fdetectorname<<")=>"<<result<<"\n";
1268  }
1269  }
1270 
1271  return result;
1272 }
std::vector< QwMainCerenkovDetectorID > fMainDetID

+ Here is the caller graph for this function:

EQwPMTInstrumentType QwMainCerenkovDetector::GetDetectorTypeID ( TString  name)
protected

Definition at line 1242 of file QwMainCerenkovDetector.cc.

References GetQwPMTInstrumentType().

Referenced by LoadChannelMap(), and LoadEventCuts().

1243 {
1244  return GetQwPMTInstrumentType(name);
1245 }
EQwPMTInstrumentType GetQwPMTInstrumentType(TString name)
Definition: QwTypes.cc:11

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

UInt_t QwMainCerenkovDetector::GetEventcutErrorFlag ( )
virtual

Return the error flag to the top level routines related to stability checks and ErrorFlag updates.

Implements VQwSubsystemParity.

Definition at line 734 of file QwMainCerenkovDetector.cc.

References fCombinedPMT, and fIntegrationPMT.

735 {
736  UInt_t ErrorFlag;
737  ErrorFlag=0;
738  for(size_t i=0;i<fIntegrationPMT.size();i++){
739  ErrorFlag |= fIntegrationPMT[i].GetEventcutErrorFlag();
740  }
741  for(size_t i=0;i<fCombinedPMT.size();i++){
742  ErrorFlag |= fCombinedPMT[i].GetEventcutErrorFlag();
743  }
744  return ErrorFlag;
745 }
std::vector< QwIntegrationPMT > fIntegrationPMT
std::vector< QwCombinedPMT > fCombinedPMT
const QwIntegrationPMT * QwMainCerenkovDetector::GetIntegrationPMT ( const TString  name) const

Definition at line 1274 of file QwMainCerenkovDetector.cc.

References QwLog::endl(), fIntegrationPMT, and QwMessage.

Referenced by GetChannel(), and PublishInternalValues().

1275 {
1276  TString tmpname = name;
1277  tmpname.ToLower();
1278  if (! fIntegrationPMT.empty())
1279  {
1280  for (size_t i=0;i<fIntegrationPMT.size();i++)
1281  {
1282  if (fIntegrationPMT.at(i).GetElementName() == tmpname)
1283  {
1284  //std::cout<<"Get IntegrationPMT "<<tmpname<<std::endl;
1285  return &(fIntegrationPMT.at(i));
1286  }
1287  }
1288  }
1289  QwMessage << "QwMainCerenkovDetector::GetIntegrationPMT: cannot find channel " << tmpname << QwLog::endl;
1290  return NULL;
1291 }
#define QwMessage
Predefined log drain for regular messages.
Definition: QwLog.h:50
std::vector< QwIntegrationPMT > fIntegrationPMT
static std::ostream & endl(std::ostream &)
End of the line.
Definition: QwLog.cc:299

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void QwMainCerenkovDetector::IncrementErrorCounters ( )
virtual

Increment the error counters.

Implements VQwSubsystemParity.

Definition at line 747 of file QwMainCerenkovDetector.cc.

References fCombinedPMT, and fIntegrationPMT.

748 {
749  for(size_t i=0;i<fIntegrationPMT.size();i++){
750  fIntegrationPMT[i].IncrementErrorCounters();
751  }
752  for(size_t i=0;i<fCombinedPMT.size();i++){
753  fCombinedPMT[i].IncrementErrorCounters();
754  }
755 }
std::vector< QwIntegrationPMT > fIntegrationPMT
std::vector< QwCombinedPMT > fCombinedPMT
Bool_t QwMainCerenkovDetector::IsGoodEvent ( )

Definition at line 565 of file QwMainCerenkovDetector.cc.

566 {
567  Bool_t test=kTRUE;
568  return test;
569 }
Int_t QwMainCerenkovDetector::LoadChannelMap ( TString  mapfile)
virtual

Mandatory map file definition.

Implements VQwSubsystem.

Definition at line 135 of file QwMainCerenkovDetector.cc.

References QwLog::endl(), QwMainCerenkovDetectorID::fCombinedChannelNames, fCombinedPMT, VQwSubsystem::fDetectorMaps, QwMainCerenkovDetectorID::fdetectorname, QwMainCerenkovDetectorID::fdetectortype, QwMainCerenkovDetectorID::fIndex, fIntegrationPMT, fMainDetID, QwMainCerenkovDetectorID::fmoduletype, VQwSubsystem::fPublishList, QwMainCerenkovDetectorID::fSubbankIndex, QwMainCerenkovDetectorID::fTypeID, QwMainCerenkovDetectorID::fWeight, QwMainCerenkovDetectorID::fWordInSubbank, QwVQWK_Channel::GetBufferOffset(), GetDetectorIndex(), GetDetectorTypeID(), QwParameterFile::GetNextToken(), VQwSubsystem::GetSubbankIndex(), VQwSubsystem::GetSubsystemName(), QwParameterFile::GetUInt(), kQwCombinedPMT, kQwIntegrationPMT, kQwUnknownPMT, QwMainCerenkovDetectorID::Print(), QwError, QwMessage, QwParameterFile::ReadNextLine(), QwParameterFile::ReadNextSection(), VQwSubsystem::RegisterROCNumber(), VQwSubsystem::RegisterSubbank(), QwCombinedPMT::SetBlindability(), QwIntegrationPMT::SetBlindability(), QwCombinedPMT::SetNormalizability(), QwIntegrationPMT::SetNormalizability(), QwParameterFile::TrimComment(), and QwParameterFile::TrimWhitespace().

136 {
137  Bool_t ldebug=kFALSE;
138 
139  std::vector<TString> combinedchannelnames;
140  std::vector<Double_t> weight;
141  Int_t currentrocread=0;
142  Int_t currentbankread=0;
143  Int_t wordsofar=0;
144  Int_t currentsubbankindex=-1;
145  Int_t sample_size=0;
146 
147 
148 
149  // Open the file
150  QwParameterFile mapstr(mapfile.Data());
151  TString varname, varvalue;
152 
153  fDetectorMaps.insert(mapstr.GetParamFileNameContents());
154  while (mapstr.ReadNextLine())
155  {
156  mapstr.TrimComment('!'); // Remove everything after a '!' character.
157  mapstr.TrimWhitespace(); // Get rid of leading and trailing spaces.
158  if (mapstr.LineIsEmpty()) continue;
159 
160  if (mapstr.HasVariablePair("=",varname,varvalue))
161  {
162  // This is a declaration line. Decode it.
163  varname.ToLower();
164  UInt_t value = QwParameterFile::GetUInt(varvalue);
165 
166  if (varname=="roc")
167  {
168  currentrocread=value;
169  RegisterROCNumber(value,0);
170  }
171  else if (varname=="bank")
172  {
173  currentbankread=value;
174  RegisterSubbank(value);
175  }
176  else if (varname=="sample_size")
177  {
178  sample_size=value;
179  }
180  }
181  else
182  {
183  Bool_t lineok = kTRUE;
184  TString keyword = "";
185  TString keyword2 = "";
186  TString modtype = "";
187  TString dettype = "";
188  TString namech = "";
189  Int_t modnum = 0;
190  Int_t channum = 0;
191 
192  modtype = mapstr.GetTypedNextToken<TString>(); // module type
193 
194  if (modtype == "VQWK")
195  {
196  modnum = mapstr.GetTypedNextToken<Int_t>(); //slot number
197  channum = mapstr.GetTypedNextToken<Int_t>(); //channel number
198  dettype = mapstr.GetTypedNextToken<TString>(); //type-purpose of the detector
199  dettype.ToLower();
200  namech = mapstr.GetTypedNextToken<TString>(); //name of the detector
201  namech.ToLower();
202 
203  keyword = mapstr.GetTypedNextToken<TString>();
204  keyword.ToLower();
205  keyword2 = mapstr.GetTypedNextToken<TString>();
206  keyword2.ToLower();
207  }
208  else if (modtype == "VPMT")
209  {
210  channum = mapstr.GetTypedNextToken<Int_t>(); //channel number
211  Int_t combinedchans = mapstr.GetTypedNextToken<Int_t>(); //number of combined channels
212  dettype = mapstr.GetTypedNextToken<TString>(); //type-purpose of the detector
213  dettype.ToLower();
214  namech = mapstr.GetTypedNextToken<TString>(); //name of the detector
215  namech.ToLower();
216  combinedchannelnames.clear();
217  for (int i=0; i<combinedchans; i++)
218  {
219  TString nameofcombinedchan = mapstr.GetTypedNextToken<TString>();
220  nameofcombinedchan.ToLower();
221  combinedchannelnames.push_back(nameofcombinedchan);
222  }
223  weight.clear();
224  for (int i=0; i<combinedchans; i++)
225  {
226  weight.push_back( mapstr.GetTypedNextToken<Double_t>());
227  }
228  keyword = mapstr.GetTypedNextToken<TString>();
229  keyword.ToLower();
230  keyword2 = mapstr.GetTypedNextToken<TString>();
231  keyword2.ToLower();
232  }
233 
234 
235  if (currentsubbankindex!=GetSubbankIndex(currentrocread,currentbankread))
236  {
237  currentsubbankindex=GetSubbankIndex(currentrocread,currentbankread);
238  wordsofar=0;
239  }
240 
241  QwMainCerenkovDetectorID localMainDetID;
242  localMainDetID.fdetectorname=namech;
243  localMainDetID.fmoduletype=modtype;
244  localMainDetID.fSubbankIndex=currentsubbankindex;
245  localMainDetID.fdetectortype=dettype;
246 
247  // localMainDetID.fWordInSubbank=wordsofar;
248  if (modtype=="VQWK"){
249  Int_t offset = QwVQWK_Channel::GetBufferOffset(modnum, channum);
250  if (offset>0){
251  localMainDetID.fWordInSubbank = wordsofar + offset;
252  }
253  }
254  else if (modtype=="VPMT")
255  {
256  localMainDetID.fCombinedChannelNames = combinedchannelnames;
257  localMainDetID.fWeight = weight;
258  //std::cout<<"Add in a combined channel"<<std::endl;
259  }
260  else
261  {
262  QwError << "QwMainCerenkovDetector::LoadChannelMap: Unknown module type: "
263  << modtype <<", the detector "<<namech<<" will not be decoded "
264  << QwLog::endl;
265  lineok=kFALSE;
266  continue;
267  }
268 
269  localMainDetID.fTypeID=GetDetectorTypeID(dettype);
270  if (localMainDetID.fTypeID==kQwUnknownPMT) {
271  QwError << "QwMainCerenkovDetector::LoadChannelMap: Unknown detector type: "
272  << dettype <<", the detector "<<namech<<" will not be decoded "
273  << QwLog::endl;
274  lineok=kFALSE;
275  continue;
276  }
277 
278  localMainDetID.fIndex= GetDetectorIndex(localMainDetID.fTypeID,
279  localMainDetID.fdetectorname);
280 
281  if (localMainDetID.fIndex==-1)
282  {
283  if (localMainDetID.fTypeID==kQwIntegrationPMT)
284  {
285  QwIntegrationPMT localIntegrationPMT(GetSubsystemName(),localMainDetID.fdetectorname);
286  if (keyword=="not_blindable"
287  || keyword2=="not_blindable")
288  localIntegrationPMT.SetBlindability(kFALSE);
289  else
290  localIntegrationPMT.SetBlindability(kTRUE);
291  if (keyword=="not_normalizable"
292  || keyword2=="not_normalizable")
293  localIntegrationPMT.SetNormalizability(kFALSE);
294  else
295  localIntegrationPMT.SetNormalizability(kTRUE);
296  fIntegrationPMT.push_back(localIntegrationPMT);
297  fIntegrationPMT[fIntegrationPMT.size()-1].SetDefaultSampleSize(sample_size);
298  localMainDetID.fIndex=fIntegrationPMT.size()-1;
299  }
300 
301  else if (localMainDetID.fTypeID==kQwCombinedPMT)
302  {
303  QwCombinedPMT localcombinedPMT(GetSubsystemName(),localMainDetID.fdetectorname);
304  if (keyword=="not_normalizable"
305  || keyword2=="not_normalizable")
306  localcombinedPMT.SetNormalizability(kFALSE);
307  else
308  localcombinedPMT.SetNormalizability(kTRUE);
309  if (keyword=="not_blindable"
310  || keyword2 =="not_blindable")
311  localcombinedPMT.SetBlindability(kFALSE);
312  else
313  localcombinedPMT.SetBlindability(kTRUE);
314  fCombinedPMT.push_back(localcombinedPMT);
315  fCombinedPMT[fCombinedPMT.size()-1].SetDefaultSampleSize(sample_size);
316  localMainDetID.fIndex=fCombinedPMT.size()-1;
317  }
318  }
319 
320  if (ldebug)
321  {
322  localMainDetID.Print();
323  std::cout<<"line ok=";
324  if (lineok) std::cout<<"TRUE"<<std::endl;
325  else
326  std::cout<<"FALSE"<<std::endl;
327  }
328 
329  if (lineok)
330  fMainDetID.push_back(localMainDetID);
331  }
332  }
333 
334 
335  //std::cout<<"linking combined channels"<<std::endl;
336 
337  for (size_t i=0; i<fMainDetID.size(); i++)
338  {
339  if (fMainDetID[i].fTypeID==kQwCombinedPMT)
340  {
341  Int_t ind = fMainDetID[i].fIndex;
342 
343  //check to see if all required channels are available
344  if (ldebug)
345  {
346  std::cout<<"fMainDetID[i].fCombinedChannelNames.size()="
347  <<fMainDetID[i].fCombinedChannelNames.size()<<std::endl<<"name list: ";
348  for (size_t n=0; n<fMainDetID[i].fCombinedChannelNames.size(); n++)
349  std::cout<<" "<<fMainDetID[i].fCombinedChannelNames[n];
350  std::cout<<std::endl;
351  }
352 
353  Int_t chanmatched=0;
354  for (size_t j=0; j<fMainDetID[i].fCombinedChannelNames.size(); j++)
355  {
356 
357  for (size_t k=0; k<fMainDetID.size(); k++)
358  {
359  if (fMainDetID[i].fCombinedChannelNames[j]==fMainDetID[k].fdetectorname)
360  {
361  if (ldebug)
362  std::cout<<"found a to-be-combined channel candidate"<<std::endl;
363  chanmatched ++;
364  break;
365  }
366  }
367  }
368 
369  if ((Int_t) fMainDetID[i].fCombinedChannelNames.size()==chanmatched)
370  {
371  for (size_t l=0; l<fMainDetID[i].fCombinedChannelNames.size(); l++)
372  {
373  Int_t ind_pmt = GetDetectorIndex(GetDetectorTypeID("integrationpmt"),
374  fMainDetID[i].fCombinedChannelNames[l]);
375 
376  fCombinedPMT[ind].Add(&fIntegrationPMT[ind_pmt],fMainDetID[i].fWeight[l]);
377  }
378  fCombinedPMT[ind].LinkChannel(fMainDetID[i].fdetectorname);
379  if (ldebug)
380  std::cout<<"linked a combined channel"<<std::endl;
381  }
382  else
383  {
384  std::cerr<<"cannot combine void channels for "<<fMainDetID[i].fdetectorname<<std::endl;
385  fMainDetID[i].fIndex = -1;
386  continue;
387  }
388  }
389  }
390 
391 
392  // Now load the variables to publish
393  mapstr.RewindToFileStart();
394  QwParameterFile *section;
395  std::vector<TString> publishinfo;
396  while ((section = mapstr.ReadNextSection(varvalue))) {
397  if (varvalue == "PUBLISH") {
398  fPublishList.clear();
399  while (section->ReadNextLine()) {
400  section->TrimComment(); // Remove everything after a comment character
401  section->TrimWhitespace(); // Get rid of leading and trailing spaces
402  for (int ii = 0; ii < 4; ii++) {
403  varvalue = section->GetNextToken().c_str();
404  if (varvalue.Length()) {
405  publishinfo.push_back(varvalue);
406  }
407  }
408  if (publishinfo.size() == 4)
409  fPublishList.push_back(publishinfo);
410  publishinfo.clear();
411  }
412  }
413  }
414  // Print list of variables to publish
415  QwMessage << "Variables to publish:" << QwLog::endl;
416  for (size_t jj = 0; jj < fPublishList.size(); jj++)
417  QwMessage << fPublishList.at(jj).at(0) << " " << fPublishList.at(jj).at(1) << " "
418  << fPublishList.at(jj).at(2) << " " << fPublishList.at(jj).at(3) << QwLog::endl;
419 
420  if (ldebug)
421  {
422  std::cout<<"Done with Load channel map\n";
423  for (size_t i=0;i<fMainDetID.size();i++)
424  if (fMainDetID[i].fIndex>=0)
425  fMainDetID[i].Print();
426  }
427  ldebug=kFALSE;
428  mapstr.Close(); // Close the file (ifstream)
429  return 0;
430 }
Int_t GetSubbankIndex() const
Definition: VQwSubsystem.h:303
#define QwMessage
Predefined log drain for regular messages.
Definition: QwLog.h:50
std::map< TString, TString > fDetectorMaps
Definition: VQwSubsystem.h:322
std::vector< Double_t > fWeight
static UInt_t GetUInt(const TString &varvalue)
std::string GetNextToken(const std::string &separatorchars)
Get next token as a string.
void TrimComment(const char commentchar)
std::vector< QwIntegrationPMT > fIntegrationPMT
EQwPMTInstrumentType GetDetectorTypeID(TString name)
std::vector< QwMainCerenkovDetectorID > fMainDetID
QwParameterFile * ReadNextSection(std::string &secname, const bool keep_header=false)
std::vector< QwCombinedPMT > fCombinedPMT
Bool_t ReadNextLine()
std::vector< std::vector< TString > > fPublishList
List of parameters to be published (loaded at the channel map)
Definition: VQwSubsystem.h:144
Int_t RegisterSubbank(const UInt_t bank_id)
Tell the object that it will decode data from this sub-bank in the ROC currently open for registratio...
virtual Int_t RegisterROCNumber(const UInt_t roc_id, const UInt_t bank_id=0)
Tell the object that it will decode data from this ROC and sub-bank.
static std::ostream & endl(std::ostream &)
End of the line.
Definition: QwLog.cc:299
std::vector< TString > fCombinedChannelNames
Int_t GetDetectorIndex(EQwPMTInstrumentType TypeID, TString name)
void TrimWhitespace(TString::EStripType head_tail=TString::kBoth)
static Int_t GetBufferOffset(Int_t moduleindex, Int_t channelindex)
#define QwError
Predefined log drain for errors.
Definition: QwLog.h:40
TString GetSubsystemName() const
Definition: VQwSubsystem.h:93

+ Here is the call graph for this function:

Int_t QwMainCerenkovDetector::LoadEventCuts ( TString  filename)
virtual

Load the event cuts file.

Implements VQwSubsystemParity.

Definition at line 433 of file QwMainCerenkovDetector.cc.

References QwLog::endl(), fCombinedPMT, VQwSubsystem::fDetectorMaps, fIntegrationPMT, fMainDetErrorCount, GetDetectorIndex(), GetDetectorTypeID(), GetGlobalErrorFlag(), GetQwPMTInstrumentTypeName(), QwParameterFile::GetUInt(), kQwCombinedPMT, kQwIntegrationPMT, QwMessage, and QwWarning.

434 {
435  Int_t eventcut_flag = 1;
436 
437  // Open the file
438  QwParameterFile mapstr(filename.Data());
439  fDetectorMaps.insert(mapstr.GetParamFileNameContents());
440  while (mapstr.ReadNextLine())
441  {
442  //std::cout<<"********* In the loop *************"<<std::endl;
443  mapstr.TrimComment('!'); // Remove everything after a '!' character.
444  mapstr.TrimWhitespace(); // Get rid of leading and trailing spaces.
445  if (mapstr.LineIsEmpty()) continue;
446  TString varname, varvalue;
447  if (mapstr.HasVariablePair("=",varname,varvalue))
448  {
449  if (varname=="EVENTCUTS")
450  {
451  //varname="";
452  eventcut_flag = QwParameterFile::GetUInt(varvalue);
453  //std::cout<<"EVENT CUT FLAG "<<eventcut_flag<<std::endl;
454  }
455  }
456  else
457  {
458  TString device_type = mapstr.GetTypedNextToken<TString>();
459  device_type.ToLower();
460  TString device_name = mapstr.GetTypedNextToken<TString>();
461  device_name.ToLower();
462  Int_t det_index = GetDetectorIndex(GetDetectorTypeID(device_type),device_name);
463  if (det_index == -1) {
464  QwWarning << " Device not found " << device_name << " of type " << device_type << QwLog::endl;
465  continue;
466  }
467 
468  if (device_type == GetQwPMTInstrumentTypeName(kQwIntegrationPMT)){
469  Double_t LLX = mapstr.GetTypedNextToken<Double_t>(); //lower limit for IntegrationPMT value
470  Double_t ULX = mapstr.GetTypedNextToken<Double_t>(); //upper limit for IntegrationPMT value
471  varvalue = mapstr.GetTypedNextToken<TString>();//global/local
472  varvalue.ToLower();
473  Double_t stabilitycut = mapstr.GetTypedNextToken<Double_t>();
474  QwMessage << "QwMainCerenkovDetector Error Code passing to QwIntegrationPMT " << GetGlobalErrorFlag(varvalue,eventcut_flag,stabilitycut) << QwLog::endl;
475 
476  //std::cout<<"*****************************"<<std::endl;
477  //std::cout<<" Type "<<device_type<<" Name "<<device_name<<" Index ["<<det_index <<"] "<<" device flag "<<check_flag<<std::endl;
478 
479  fIntegrationPMT[det_index].SetSingleEventCuts(GetGlobalErrorFlag(varvalue,eventcut_flag,stabilitycut),LLX,ULX,stabilitycut);
480  //std::cout<<"*****************************"<<std::endl;
481 
482  } else if (device_type == GetQwPMTInstrumentTypeName(kQwCombinedPMT)){
483  Double_t LLX = mapstr.GetTypedNextToken<Double_t>(); //lower limit for CombinedPMT value
484  Double_t ULX = mapstr.GetTypedNextToken<Double_t>(); //upper limit for CombinedPMT value
485  varvalue = mapstr.GetTypedNextToken<TString>();//global/local
486  varvalue.ToLower();
487  Double_t stabilitycut = mapstr.GetTypedNextToken<Double_t>();
488  QwMessage << "QwMainCerenkovDetector Error Code passing to QwCombinedPMT " << GetGlobalErrorFlag(varvalue,eventcut_flag,stabilitycut) << QwLog::endl;
489 
490  //std::cout<<"*****************************"<<std::endl;
491  //std::cout<<" Type "<<device_type<<" Name "<<device_name<<" Index ["<<det_index <<"] "<<" device flag "<<check_flag<<std::endl;
492 
493  fCombinedPMT[det_index].SetSingleEventCuts(GetGlobalErrorFlag(varvalue,eventcut_flag,stabilitycut),LLX,ULX,stabilitycut);
494  //std::cout<<"*****************************"<<std::endl;
495 
496  }
497 
498  }
499 
500  }
501  for (size_t i = 0; i < fIntegrationPMT.size(); i++)
502  fIntegrationPMT[i].SetEventCutMode(eventcut_flag);
503  for (size_t i = 0; i < fCombinedPMT.size(); i++)
504  fCombinedPMT[i].SetEventCutMode(eventcut_flag);
505 
506  fMainDetErrorCount = 0; //set the error counter to zero
507  mapstr.Close(); // Close the file (ifstream)
508  return 0;
509 }
#define QwMessage
Predefined log drain for regular messages.
Definition: QwLog.h:50
std::map< TString, TString > fDetectorMaps
Definition: VQwSubsystem.h:322
static UInt_t GetUInt(const TString &varvalue)
std::vector< QwIntegrationPMT > fIntegrationPMT
EQwPMTInstrumentType GetDetectorTypeID(TString name)
TString GetQwPMTInstrumentTypeName(EQwPMTInstrumentType type)
Definition: QwTypes.cc:76
std::vector< QwCombinedPMT > fCombinedPMT
static std::ostream & endl(std::ostream &)
End of the line.
Definition: QwLog.cc:299
Int_t GetDetectorIndex(EQwPMTInstrumentType TypeID, TString name)
#define QwWarning
Predefined log drain for warnings.
Definition: QwLog.h:45
UInt_t GetGlobalErrorFlag(TString evtype, Int_t evMode, Double_t stabilitycut)
Definition: QwTypes.cc:127

+ Here is the call graph for this function:

Int_t QwMainCerenkovDetector::LoadInputParameters ( TString  mapfile)
virtual

Mandatory parameter file definition.

Implements VQwSubsystem.

Definition at line 513 of file QwMainCerenkovDetector.cc.

References VQwSubsystem::fDetectorMaps, and fIntegrationPMT.

514 {
515  Bool_t ldebug=kFALSE;
516  TString varname;
517  Double_t varped;
518  Double_t varcal;
519  TString localname;
520 
521  Int_t lineread=0;
522 
523  QwParameterFile mapstr(pedestalfile.Data()); //Open the file
524  fDetectorMaps.insert(mapstr.GetParamFileNameContents());
525 
526  while (mapstr.ReadNextLine())
527  {
528  lineread+=1;
529  if (ldebug)std::cout<<" line read so far ="<<lineread<<"\n";
530  mapstr.TrimComment('!'); // Remove everything after a '!' character.
531  mapstr.TrimWhitespace(); // Get rid of leading and trailing spaces.
532  if (mapstr.LineIsEmpty()) continue;
533  else
534  {
535  varname = mapstr.GetTypedNextToken<TString>(); //name of the channel
536  varname.ToLower();
537  varname.Remove(TString::kBoth,' ');
538  varped= mapstr.GetTypedNextToken<Double_t>(); // value of the pedestal
539  varcal= mapstr.GetTypedNextToken<Double_t>(); // value of the calibration factor
540  if (ldebug) std::cout<<"inputs for channel "<<varname
541  <<": ped="<<varped<<": cal="<<varcal<<"\n";
542  Bool_t notfound=kTRUE;
543 
544  if (notfound)
545  for (size_t i=0;i<fIntegrationPMT.size();i++)
546  if (fIntegrationPMT[i].GetElementName()==varname)
547  {
548  fIntegrationPMT[i].SetPedestal(varped);
549  fIntegrationPMT[i].SetCalibrationFactor(varcal);
550  i=fIntegrationPMT.size()+1;
551  notfound=kFALSE;
552  i=fIntegrationPMT.size()+1;
553  }
554  }
555 
556  }
557  if (ldebug) std::cout<<" line read in the pedestal + cal file ="<<lineread<<" \n";
558 
559  ldebug=kFALSE;
560  mapstr.Close(); // Close the file (ifstream)
561  return 0;
562 }
std::map< TString, TString > fDetectorMaps
Definition: VQwSubsystem.h:322
std::vector< QwIntegrationPMT > fIntegrationPMT
void QwMainCerenkovDetector::Normalize ( VQwDataElement denom)

Definition at line 1163 of file QwMainCerenkovDetector.cc.

References fCombinedPMT, and fIntegrationPMT.

Referenced by DoNormalization().

1164 {
1165  for (size_t i = 0; i < fIntegrationPMT.size(); i++)
1166  fIntegrationPMT[i].Normalize(denom);
1167  for (size_t i = 0; i < fCombinedPMT.size(); i++)
1168  fCombinedPMT[i].Normalize(denom);
1169 }
void Normalize(VQwDataElement *denom)
std::vector< QwIntegrationPMT > fIntegrationPMT
std::vector< QwCombinedPMT > fCombinedPMT

+ Here is the caller graph for this function:

VQwSubsystem & QwMainCerenkovDetector::operator+= ( VQwSubsystem value)
virtual

Implements VQwSubsystemParity.

Definition at line 1079 of file QwMainCerenkovDetector.cc.

References Compare(), fCombinedPMT, and fIntegrationPMT.

1080 {
1081  if (Compare(value))
1082  {
1083  QwMainCerenkovDetector* input= dynamic_cast<QwMainCerenkovDetector*>(value) ;
1084 
1085  for (size_t i=0;i<input->fIntegrationPMT.size();i++)
1086  this->fIntegrationPMT[i]+=input->fIntegrationPMT[i];
1087 
1088  for (size_t i=0;i<input->fCombinedPMT.size();i++)
1089  this->fCombinedPMT[i]+=input->fCombinedPMT[i];
1090 
1091  }
1092  return *this;
1093 }
std::vector< QwIntegrationPMT > fIntegrationPMT
std::vector< QwCombinedPMT > fCombinedPMT
Bool_t Compare(VQwSubsystem *source)

+ Here is the call graph for this function:

VQwSubsystem & QwMainCerenkovDetector::operator-= ( VQwSubsystem value)
virtual

Implements VQwSubsystemParity.

Definition at line 1096 of file QwMainCerenkovDetector.cc.

References Compare(), fCombinedPMT, and fIntegrationPMT.

1097 {
1098 
1099  if (Compare(value))
1100  {
1101  QwMainCerenkovDetector* input= dynamic_cast<QwMainCerenkovDetector*>(value);
1102 
1103  for (size_t i=0;i<input->fIntegrationPMT.size();i++)
1104  this->fIntegrationPMT[i]-=input->fIntegrationPMT[i];
1105 
1106  for (size_t i=0;i<input->fCombinedPMT.size();i++)
1107  this->fCombinedPMT[i]-=input->fCombinedPMT[i];
1108 
1109  }
1110  return *this;
1111 }
std::vector< QwIntegrationPMT > fIntegrationPMT
std::vector< QwCombinedPMT > fCombinedPMT
Bool_t Compare(VQwSubsystem *source)

+ Here is the call graph for this function:

VQwSubsystem & QwMainCerenkovDetector::operator= ( VQwSubsystem value)
virtual

Assignment Note: Must be called at the beginning of all subsystems routine call to operator=(VQwSubsystem *value) by VQwSubsystem::operator=(value)

Implements VQwSubsystemParity.

Definition at line 1061 of file QwMainCerenkovDetector.cc.

References Compare(), fCombinedPMT, and fIntegrationPMT.

1062 {
1063  // std::cout<<" here in QwMainCerenkovDetector::operator= \n";
1064  if (Compare(value))
1065  {
1066 // VQwSubsystem::operator=(value);
1067  QwMainCerenkovDetector* input = dynamic_cast<QwMainCerenkovDetector*> (value);
1068 
1069  for (size_t i=0;i<input->fIntegrationPMT.size();i++)
1070  this->fIntegrationPMT[i]=input->fIntegrationPMT[i];
1071 
1072  for (size_t i=0;i<input->fCombinedPMT.size();i++)
1073  (this->fCombinedPMT[i])=(input->fCombinedPMT[i]);
1074  }
1075  return *this;
1076 }
std::vector< QwIntegrationPMT > fIntegrationPMT
std::vector< QwCombinedPMT > fCombinedPMT
Bool_t Compare(VQwSubsystem *source)

+ Here is the call graph for this function:

void QwMainCerenkovDetector::PrintDetectorID ( ) const

Definition at line 1419 of file QwMainCerenkovDetector.cc.

References fMainDetID.

1420 {
1421  for (size_t i=0;i<fMainDetID.size();i++)
1422  {
1423  std::cout<<"============================="<<std::endl;
1424  std::cout<<" Detector ID="<<i<<std::endl;
1425  fMainDetID[i].Print();
1426  }
1427  return;
1428 }
std::vector< QwMainCerenkovDetectorID > fMainDetID
void QwMainCerenkovDetector::PrintErrorCounters ( ) const
virtual

Report the number of events failed due to HW and event cut failures.

Implements VQwSubsystemParity.

Definition at line 758 of file QwMainCerenkovDetector.cc.

References QwLog::endl(), fCombinedPMT, fIntegrationPMT, QwVQWK_Channel::PrintErrorCounterHead(), QwVQWK_Channel::PrintErrorCounterTail(), and QwMessage.

759 {
760  QwMessage<<"*********QwMainCerenkovDetector Error Summary****************"<<QwLog::endl;
762  for(size_t i=0;i<fIntegrationPMT.size();i++){
763  //std::cout<<" IntegrationPMT ["<<i<<"] "<<std::endl;
764  fIntegrationPMT[i].PrintErrorCounters();
765  }
766  for(size_t i=0;i<fCombinedPMT.size();i++){
767  //std::cout<<" CombinedPMT ["<<i<<"] "<<std::endl;
768  fCombinedPMT[i].PrintErrorCounters();
769  }
771 }
#define QwMessage
Predefined log drain for regular messages.
Definition: QwLog.h:50
std::vector< QwIntegrationPMT > fIntegrationPMT
static void PrintErrorCounterHead()
std::vector< QwCombinedPMT > fCombinedPMT
static std::ostream & endl(std::ostream &)
End of the line.
Definition: QwLog.cc:299
static void PrintErrorCounterTail()

+ Here is the call graph for this function:

void QwMainCerenkovDetector::PrintInfo ( ) const
virtual

Print some information about the subsystem.

Reimplemented from VQwSubsystem.

Definition at line 1404 of file QwMainCerenkovDetector.cc.

References fCombinedPMT, fIntegrationPMT, and VQwSubsystem::fSystemName.

1405 {
1406  std::cout<<"Name of the subsystem ="<<fSystemName<<"\n";
1407 
1408  std::cout<<"there are "<<fIntegrationPMT.size()<<" IntegrationPMT \n";
1409  std::cout<<" "<<fCombinedPMT.size()<<" CombinedPMT \n";
1410 
1411  std::cout<<" Printing Running AVG and other channel info"<<std::endl;
1412 
1413  for (size_t i = 0; i < fIntegrationPMT.size(); i++)
1415  for (size_t i = 0; i < fCombinedPMT.size(); i++)
1416  fCombinedPMT[i].PrintInfo();
1417 }
std::vector< QwIntegrationPMT > fIntegrationPMT
std::vector< QwCombinedPMT > fCombinedPMT
TString fSystemName
Name of this subsystem.
Definition: VQwSubsystem.h:315
void PrintInfo() const
Print some information about the subsystem.
void QwMainCerenkovDetector::PrintValue ( ) const
virtual

Print values of all channels.

Reimplemented from VQwSubsystemParity.

Definition at line 1395 of file QwMainCerenkovDetector.cc.

References QwLog::endl(), fCombinedPMT, fIntegrationPMT, VQwSubsystem::GetSubsystemName(), and QwMessage.

1396 {
1397  QwMessage << "=== QwMainCerenkovDetector: " << GetSubsystemName() << " ===" << QwLog::endl;
1398  for (size_t i = 0; i < fIntegrationPMT.size(); i++)
1400  for (size_t i = 0; i < fCombinedPMT.size(); i++)
1401  fCombinedPMT[i].PrintValue();
1402 }
#define QwMessage
Predefined log drain for regular messages.
Definition: QwLog.h:50
std::vector< QwIntegrationPMT > fIntegrationPMT
std::vector< QwCombinedPMT > fCombinedPMT
void PrintValue() const
Print values of all channels.
static std::ostream & endl(std::ostream &)
End of the line.
Definition: QwLog.cc:299
TString GetSubsystemName() const
Definition: VQwSubsystem.h:93

+ Here is the call graph for this function:

Int_t QwMainCerenkovDetector::ProcessConfigurationBuffer ( const UInt_t  roc_id,
const UInt_t  bank_id,
UInt_t *  buffer,
UInt_t  num_words 
)
virtual

Implements VQwSubsystem.

Definition at line 657 of file QwMainCerenkovDetector.cc.

658 {
659 
660  /* Int_t index = GetSubbankIndex(roc_id,bank_id);
661  if (index>=0 && num_words>0){
662  // We want to process the configuration data for this ROC.
663  UInt_t words_read = 0;
664  for (size_t i = 0; i < fMainDetID.size(); i++) {
665  words_read += fIntegrationPMT[i].ProcessConfigurationBuffer(&(buffer[words_read]),
666  num_words-words_read);
667  }
668  }*/
669  return 0;
670 }
Int_t QwMainCerenkovDetector::ProcessEvBuffer ( const UInt_t  roc_id,
const UInt_t  bank_id,
UInt_t *  buffer,
UInt_t  num_words 
)
virtual

TODO: The non-event-type-aware ProcessEvBuffer routine should be replaced with the event-type-aware version.

Implements VQwSubsystem.

Definition at line 673 of file QwMainCerenkovDetector.cc.

References fIntegrationPMT, fMainDetID, VQwSubsystem::GetSubbankIndex(), and kQwIntegrationPMT.

674 {
675  Bool_t lkDEBUG=kFALSE;
676 
677  Int_t index = GetSubbankIndex(roc_id,bank_id);
678 
679  if (index>=0 && num_words>0)
680  {
681  // We want to process this ROC. Begin looping through the data.
682  if (lkDEBUG)
683  std::cout << "QwMainCerenkovDetector::ProcessEvBuffer: "
684  << "Begin processing ROC" << roc_id
685  << " and subbank "<<bank_id
686  << " number of words="<<num_words<<std::endl;
687 
688  for (size_t i=0;i<fMainDetID.size();i++)
689  {
690  if (fMainDetID[i].fSubbankIndex==index)
691  {
692 
693  if (fMainDetID[i].fTypeID == kQwIntegrationPMT)
694  {
695  if (lkDEBUG)
696  {
697  std::cout<<"found IntegrationPMT data for "<<fMainDetID[i].fdetectorname<<std::endl;
698  std::cout<<"word left to read in this buffer:"<<num_words-fMainDetID[i].fWordInSubbank<<std::endl;
699  }
700  fIntegrationPMT[fMainDetID[i].fIndex].ProcessEvBuffer(&(buffer[fMainDetID[i].fWordInSubbank]),
701  num_words-fMainDetID[i].fWordInSubbank);
702  }
703  }
704  }
705  }
706 
707  return 0;
708 }
Int_t GetSubbankIndex() const
Definition: VQwSubsystem.h:303
std::vector< QwIntegrationPMT > fIntegrationPMT
std::vector< QwMainCerenkovDetectorID > fMainDetID

+ Here is the call graph for this function:

void QwMainCerenkovDetector::ProcessEvent ( )
virtual

Implements VQwSubsystem.

Definition at line 787 of file QwMainCerenkovDetector.cc.

References fCombinedPMT, and fIntegrationPMT.

788 {
789  for (size_t i=0;i<fIntegrationPMT.size();i++)
791 
792  for (size_t i=0;i<fCombinedPMT.size();i++)
793  {
794  //std::cout<<"Process combination "<<i<<std::endl;
795  fCombinedPMT[i].ProcessEvent();
796 
797  }
798 
799  return;
800 }
std::vector< QwIntegrationPMT > fIntegrationPMT
std::vector< QwCombinedPMT > fCombinedPMT
void QwMainCerenkovDetector::ProcessEvent_2 ( )
virtual

Process the event data again, including data from other subsystems. Not all derived classes will require a second stage of event data processing.

Reimplemented from VQwSubsystem.

Definition at line 923 of file QwMainCerenkovDetector.cc.

References bDEBUG, bIsExchangedDataValid, bNormalization, DoNormalization(), QwLog::endl(), fTargetCharge, and QwWarning.

924 {
926  {
927  //data is valid, process it
928  if (bDEBUG)
929  {
930  Double_t pedestal = fTargetCharge.GetPedestal();
931  Double_t calfactor = fTargetCharge.GetCalibrationFactor();
932  Double_t volts = fTargetCharge.GetAverageVolts();
933  std::cout<<"QwMainCerenkovDetector::ProcessEvent_2(): processing with exchanged data"<<std::endl;
934  std::cout<<"pedestal, calfactor, average volts = "<<pedestal<<", "<<calfactor<<", "<<volts<<std::endl;
935  }
936 
937  if (bNormalization) this->DoNormalization();
938  }
939  else
940  {
941  QwWarning<<"QwMainCerenkovDetector::ProcessEvent_2(): could not get all external values."<<QwLog::endl;
942  }
943 }
void DoNormalization(Double_t factor=1.0)
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

+ Here is the call graph for this function:

void QwMainCerenkovDetector::ProcessOptions ( QwOptions options)
virtual

Loads the configuration options into this instance of QwMainCerenkovDetector from the QwOptions object.

Parameters
optionsOptions object

Reimplemented from VQwSubsystem.

Definition at line 45 of file QwMainCerenkovDetector.cc.

References bNormalization, QwLog::endl(), QwOptions::GetValue(), and QwWarning.

45  {
46  bNormalization = options.GetValue<bool>("QwMainCerenkovDetector.normalize");
47  if (! bNormalization){
48  QwWarning << "QwMainCerenkovDetector::ProcessOptions: "
49  << "Detector yields WILL NOT be normalized."
50  << QwLog::endl;
51  }
52 }
T GetValue(const std::string &key)
Get a templated value.
Definition: QwOptions.h:240
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

+ Here is the call graph for this function:

Bool_t QwMainCerenkovDetector::PublishInternalValues ( ) const
virtual

Publish internal values

Returns

Reimplemented from VQwSubsystem.

Definition at line 60 of file QwMainCerenkovDetector.cc.

References QwLog::endl(), VQwSubsystem::fPublishList, QwCombinedPMT::GetChannel(), QwIntegrationPMT::GetChannel(), GetChannel(), GetCombinedPMT(), GetIntegrationPMT(), VQwSubsystem::PublishInternalValue(), QwDebug, and QwError.

61 {
62  // Publish variables
63  Bool_t status = kTRUE;
64 
65  status = status && PublishInternalValue("qwk_md1neg", "qwk_md1neg", GetIntegrationPMT("qwk_md1neg")->GetChannel("qwk_md1neg"));
66  status = status && PublishInternalValue("qwk_md1pos", "qwk_md1pos", GetIntegrationPMT("qwk_md1pos")->GetChannel("qwk_md1pos"));
67  status = status && PublishInternalValue("qwk_md2neg", "qwk_md2neg", GetIntegrationPMT("qwk_md2neg")->GetChannel("qwk_md2neg"));
68  status = status && PublishInternalValue("qwk_md2pos", "qwk_md2pos", GetIntegrationPMT("qwk_md2pos")->GetChannel("qwk_md2pos"));
69  status = status && PublishInternalValue("qwk_md3neg", "qwk_md3neg", GetIntegrationPMT("qwk_md3neg")->GetChannel("qwk_md3neg"));
70  status = status && PublishInternalValue("qwk_md3pos", "qwk_md3pos", GetIntegrationPMT("qwk_md3pos")->GetChannel("qwk_md3pos"));
71  status = status && PublishInternalValue("qwk_md4neg", "qwk_md4neg", GetIntegrationPMT("qwk_md4neg")->GetChannel("qwk_md4neg"));
72  status = status && PublishInternalValue("qwk_md4pos", "qwk_md4pos", GetIntegrationPMT("qwk_md4pos")->GetChannel("qwk_md4pos"));
73  status = status && PublishInternalValue("qwk_md5neg", "qwk_md5neg", GetIntegrationPMT("qwk_md5neg")->GetChannel("qwk_md5neg"));
74  status = status && PublishInternalValue("qwk_md5pos", "qwk_md5pos", GetIntegrationPMT("qwk_md5pos")->GetChannel("qwk_md5pos"));
75  status = status && PublishInternalValue("qwk_md6neg", "qwk_md6neg", GetIntegrationPMT("qwk_md6neg")->GetChannel("qwk_md6neg"));
76  status = status && PublishInternalValue("qwk_md6pos", "qwk_md6pos", GetIntegrationPMT("qwk_md6pos")->GetChannel("qwk_md6pos"));
77  status = status && PublishInternalValue("qwk_md7neg", "qwk_md7neg", GetIntegrationPMT("qwk_md7neg")->GetChannel("qwk_md7neg"));
78  status = status && PublishInternalValue("qwk_md7pos", "qwk_md7pos", GetIntegrationPMT("qwk_md7pos")->GetChannel("qwk_md7pos"));
79  status = status && PublishInternalValue("qwk_md8neg", "qwk_md8neg", GetIntegrationPMT("qwk_md8neg")->GetChannel("qwk_md8neg"));
80  status = status && PublishInternalValue("qwk_md8pos", "qwk_md8pos", GetIntegrationPMT("qwk_md8pos")->GetChannel("qwk_md8pos"));
81  status = status && PublishInternalValue("qwk_md9neg", "qwk_md9neg", GetIntegrationPMT("qwk_md9neg")->GetChannel("qwk_md9neg"));
82  status = status && PublishInternalValue("qwk_md9pos", "qwk_md9pos", GetIntegrationPMT("qwk_md9pos")->GetChannel("qwk_md9pos"));
83 
84  status = status && PublishInternalValue("qwk_md1barsum","qwk_md1barsum", GetCombinedPMT("qwk_md1barsum")->GetChannel("qwk_md1barsum"));
85  status = status && PublishInternalValue("qwk_md2barsum","qwk_md2barsum", GetCombinedPMT("qwk_md2barsum")->GetChannel("qwk_md2barsum"));
86  status = status && PublishInternalValue("qwk_md3barsum","qwk_md3barsum", GetCombinedPMT("qwk_md3barsum")->GetChannel("qwk_md3barsum"));
87  status = status && PublishInternalValue("qwk_md4barsum","qwk_md4barsum", GetCombinedPMT("qwk_md4barsum")->GetChannel("qwk_md4barsum"));
88  status = status && PublishInternalValue("qwk_md5barsum","qwk_md5barsum", GetCombinedPMT("qwk_md5barsum")->GetChannel("qwk_md5barsum"));
89  status = status && PublishInternalValue("qwk_md6barsum","qwk_md6barsum", GetCombinedPMT("qwk_md6barsum")->GetChannel("qwk_md6barsum"));
90  status = status && PublishInternalValue("qwk_md7barsum","qwk_md7barsum", GetCombinedPMT("qwk_md7barsum")->GetChannel("qwk_md7barsum"));
91  status = status && PublishInternalValue("qwk_md8barsum","qwk_md8barsum", GetCombinedPMT("qwk_md8barsum")->GetChannel("qwk_md8barsum"));
92 
93  status = status && PublishInternalValue("qwk_mdallbars","qwk_mdallbars", GetCombinedPMT("qwk_mdallbars")->GetChannel("qwk_mdallbars"));
94 
95  return status;
96 
97 
98  // TODO:
99  // The variables should be published based on the parameter file.
100  // See QwBeamLine class for an implementation.
101 
102  // Publish variables through map file
103  // This should work with bcm, bpmstripline, bpmcavity, combo bpm and combo bcm
104  for (size_t pp = 0; pp < fPublishList.size(); pp++) {
105  TString publish_name = fPublishList.at(pp).at(0);
106  TString device_type = fPublishList.at(pp).at(1);
107  TString device_name = fPublishList.at(pp).at(2);
108  TString device_prop = fPublishList.at(pp).at(3);
109  device_type.ToLower();
110  device_prop.ToLower();
111 
112  const VQwHardwareChannel* tmp_channel;
113  if (device_type == "integrationpmt") {
114  tmp_channel = GetIntegrationPMT(device_name)->GetChannel(device_name);
115  } else if (device_type == "combinedpmt") {
116  tmp_channel = GetCombinedPMT(device_name)->GetChannel(device_name);
117  } else
118  QwError << "QwBeamLine::PublishInternalValues() error "<< QwLog::endl;
119 
120  if (tmp_channel == NULL) {
121  QwError << "QwBeamLine::PublishInternalValues(): " << publish_name << " not found" << QwLog::endl;
122  status |= kFALSE;
123  } else {
124  QwDebug << "QwBeamLine::PublishInternalValues(): " << publish_name << " found" << QwLog::endl;
125  }
126  status = status && PublishInternalValue(publish_name, publish_name, tmp_channel);
127 
128  }
129 
130  return status;
131 }
const QwIntegrationPMT * GetChannel(const TString name) const
const QwIntegrationPMT * GetIntegrationPMT(const TString name) const
#define QwDebug
Predefined log drain for debugging output.
Definition: QwLog.h:60
std::vector< std::vector< TString > > fPublishList
List of parameters to be published (loaded at the channel map)
Definition: VQwSubsystem.h:144
const QwCombinedPMT * GetCombinedPMT(const TString name) const
static std::ostream & endl(std::ostream &)
End of the line.
Definition: QwLog.cc:299
const QwVQWK_Channel * GetChannel(const TString name) const
Definition: QwCombinedPMT.h:48
Bool_t PublishInternalValue(const TString &name, const TString &desc, const VQwHardwareChannel *value) const
Publish a variable name to the parent subsystem array.
const QwVQWK_Channel * GetChannel(const TString name) const
#define QwError
Predefined log drain for errors.
Definition: QwLog.h:40

+ Here is the call graph for this function:

void QwMainCerenkovDetector::RandomizeEventData ( int  helicity = 0,
Double_t  time = 0.0 
)

Definition at line 606 of file QwMainCerenkovDetector.cc.

References fIntegrationPMT, fMainDetID, and kQwIntegrationPMT.

607 {
608  for (size_t i = 0; i < fMainDetID.size(); i++)
609  {
610  // This is a QwIntegrationPMT
611  if (fMainDetID.at(i).fTypeID == kQwIntegrationPMT)
612  fIntegrationPMT[fMainDetID.at(i).fIndex].RandomizeEventData(helicity, time);
613  }
614 
615 }
std::vector< QwIntegrationPMT > fIntegrationPMT
std::vector< QwMainCerenkovDetectorID > fMainDetID
void QwMainCerenkovDetector::Ratio ( VQwSubsystem numer,
VQwSubsystem denom 
)
virtual

Implements VQwSubsystemParity.

Definition at line 1133 of file QwMainCerenkovDetector.cc.

References Compare(), fCombinedPMT, and fIntegrationPMT.

1134 {
1135  if (Compare(numer)&&Compare(denom))
1136  {
1137  QwMainCerenkovDetector* innumer= dynamic_cast<QwMainCerenkovDetector*>(numer) ;
1138  QwMainCerenkovDetector* indenom= dynamic_cast<QwMainCerenkovDetector*>(denom) ;
1139 
1140  for (size_t i=0;i<innumer->fIntegrationPMT.size();i++)
1141  this->fIntegrationPMT[i].Ratio(innumer->fIntegrationPMT[i],indenom->fIntegrationPMT[i]);
1142 
1143  for (size_t i=0;i<innumer->fCombinedPMT.size();i++)
1144  this->fCombinedPMT[i].Ratio(innumer->fCombinedPMT[i],indenom->fCombinedPMT[i]);
1145 
1146  }
1147  return;
1148 }
std::vector< QwIntegrationPMT > fIntegrationPMT
std::vector< QwCombinedPMT > fCombinedPMT
Bool_t Compare(VQwSubsystem *source)
void Ratio(VQwSubsystem *numer, VQwSubsystem *denom)

+ Here is the call graph for this function:

void QwMainCerenkovDetector::Scale ( Double_t  factor)
virtual

Implements VQwSubsystemParity.

Definition at line 1151 of file QwMainCerenkovDetector.cc.

References fCombinedPMT, and fIntegrationPMT.

1152 {
1153  for (size_t i=0;i<fIntegrationPMT.size();i++)
1154  fIntegrationPMT[i].Scale(factor);
1155 
1156  for (size_t i=0;i<fCombinedPMT.size();i++)
1157  fCombinedPMT[i].Scale(factor);
1158 
1159  return;
1160 }
std::vector< QwIntegrationPMT > fIntegrationPMT
std::vector< QwCombinedPMT > fCombinedPMT
void QwMainCerenkovDetector::SetRandomEventAsymmetry ( Double_t  asymmetry)

Definition at line 595 of file QwMainCerenkovDetector.cc.

References fIntegrationPMT, fMainDetID, and kQwIntegrationPMT.

Referenced by main().

596 {
597  for (size_t i = 0; i < fMainDetID.size(); i++)
598  {
599  // This is a QwIntegrationPMT
600  if (fMainDetID.at(i).fTypeID == kQwIntegrationPMT)
601  fIntegrationPMT[fMainDetID.at(i).fIndex].SetRandomEventAsymmetry(asymmetry);
602  }
603 
604 }
std::vector< QwIntegrationPMT > fIntegrationPMT
std::vector< QwMainCerenkovDetectorID > fMainDetID

+ Here is the caller graph for this function:

void QwMainCerenkovDetector::SetRandomEventParameters ( Double_t  mean,
Double_t  sigma 
)

Definition at line 584 of file QwMainCerenkovDetector.cc.

References fIntegrationPMT, fMainDetID, and kQwIntegrationPMT.

Referenced by main().

585 {
586  for (size_t i = 0; i < fMainDetID.size(); i++)
587  {
588  // This is a QwIntegrationPMT
589  if (fMainDetID.at(i).fTypeID == kQwIntegrationPMT)
590  fIntegrationPMT[fMainDetID.at(i).fIndex].SetRandomEventParameters(mean, sigma);
591  }
592 
593 }
std::vector< QwIntegrationPMT > fIntegrationPMT
std::vector< QwMainCerenkovDetectorID > fMainDetID

+ Here is the caller graph for this function:

void QwMainCerenkovDetector::Sum ( VQwSubsystem value1,
VQwSubsystem value2 
)
virtual

Implements VQwSubsystemParity.

Definition at line 1115 of file QwMainCerenkovDetector.cc.

References Compare().

1116 {
1117  if (Compare(value1)&&Compare(value2))
1118  {
1119  *this = value1;
1120  *this += value2;
1121  }
1122 }
Bool_t Compare(VQwSubsystem *source)

+ Here is the call graph for this function:

void QwMainCerenkovDetector::UpdateErrorFlag ( const VQwSubsystem ev_error)
virtual

update the error flag in the subsystem level from the top level routines related to stability checks. This will uniquely update the errorflag at each channel based on the error flag in the corresponding channel in the ev_error subsystem

Implements VQwSubsystemParity.

Definition at line 773 of file QwMainCerenkovDetector.cc.

References Compare(), fCombinedPMT, fIntegrationPMT, and VQwSubsystemParity::UpdateErrorFlag().

773  {
774  VQwSubsystem* tmp = const_cast<VQwSubsystem*>(ev_error);
775  if(Compare(tmp)){
776  const QwMainCerenkovDetector* input = dynamic_cast<const QwMainCerenkovDetector*> (ev_error);
777 
778  for (size_t i=0;i<input->fIntegrationPMT.size();i++)
779  this->fIntegrationPMT[i].UpdateErrorFlag(&(input->fIntegrationPMT[i]));
780 
781  for (size_t i=0;i<input->fCombinedPMT.size();i++)
782  this->fCombinedPMT[i].UpdateErrorFlag(&(input->fCombinedPMT[i]));
783  }
784 };
virtual UInt_t UpdateErrorFlag()
Uses the error flags of contained data elements to update Returns the error flag to the top level rou...
std::vector< QwIntegrationPMT > fIntegrationPMT
std::vector< QwCombinedPMT > fCombinedPMT
Bool_t Compare(VQwSubsystem *source)
The pure virtual base class of all subsystems.
Definition: VQwSubsystem.h:59

+ Here is the call graph for this function:

void QwMainCerenkovDetector::WritePromptSummary ( QwPromptSummary ps,
TString  type 
)
virtual

Reimplemented from VQwSubsystemParity.

Definition at line 1500 of file QwMainCerenkovDetector.cc.

References QwLog::endl(), and QwMessage.

1501 {
1502 
1503  Bool_t local_print_flag = true;
1504  if(local_print_flag){
1505  QwMessage << " --------------------------------------------------------------- " << QwLog::endl;
1506  QwMessage << " QwMainCerenkovDetectorID::WritePromptSummary() " << QwLog::endl;
1507  QwMessage << " --------------------------------------------------------------- " << QwLog::endl;
1508  }
1509 
1510  // ps->PrintCSV();
1511 
1512  return;
1513 }
#define QwMessage
Predefined log drain for regular messages.
Definition: QwLog.h:50
static std::ostream & endl(std::ostream &)
End of the line.
Definition: QwLog.cc:299

+ Here is the call graph for this function:

Friends And Related Function Documentation

friend class QwCombinedPMT
friend

Definition at line 32 of file QwMainCerenkovDetector.h.

Field Documentation

const Bool_t QwMainCerenkovDetector::bDEBUG =kFALSE
staticprivate
Bool_t QwMainCerenkovDetector::bIsExchangedDataValid
protected
Bool_t QwMainCerenkovDetector::bNormalization
protected

Definition at line 188 of file QwMainCerenkovDetector.h.

Referenced by ExchangeProcessedData(), ProcessEvent_2(), and ProcessOptions().

Bool_t QwMainCerenkovDetector::fDEBUG
protected

Definition at line 165 of file QwMainCerenkovDetector.h.

Int_t QwMainCerenkovDetector::fMainDetErrorCount
private

Definition at line 193 of file QwMainCerenkovDetector.h.

Referenced by ApplySingleEventCuts(), and LoadEventCuts().

QwBeamCharge QwMainCerenkovDetector::fTargetCharge
protected
QwBeamEnergy QwMainCerenkovDetector::fTargetEnergy
protected

Definition at line 184 of file QwMainCerenkovDetector.h.

Referenced by QwMainCerenkovDetector().

QwBeamPosition QwMainCerenkovDetector::fTargetX
protected

Definition at line 180 of file QwMainCerenkovDetector.h.

Referenced by QwMainCerenkovDetector().

QwBeamAngle QwMainCerenkovDetector::fTargetXprime
protected

Definition at line 182 of file QwMainCerenkovDetector.h.

Referenced by QwMainCerenkovDetector().

QwBeamPosition QwMainCerenkovDetector::fTargetY
protected

Definition at line 181 of file QwMainCerenkovDetector.h.

Referenced by QwMainCerenkovDetector().

QwBeamAngle QwMainCerenkovDetector::fTargetYprime
protected

Definition at line 183 of file QwMainCerenkovDetector.h.

Referenced by QwMainCerenkovDetector().


The documentation for this class was generated from the following files: