QwAnalysis
QwComptonPhotonDetector Class Reference

Class for the analysis of Compton photon detector data. More...

#include <QwComptonPhotonDetector.h>

+ Inheritance diagram for QwComptonPhotonDetector:
+ Collaboration diagram for QwComptonPhotonDetector:

Public Member Functions

 QwComptonPhotonDetector (TString name)
 Constructor with name. More...
 
 QwComptonPhotonDetector (const QwComptonPhotonDetector &source)
 Copy constructor. More...
 
virtual ~QwComptonPhotonDetector ()
 Virtual destructor. More...
 
void ProcessOptions (QwOptions &options)
 Process the command line options. More...
 
Int_t LoadChannelMap (TString mapfile)
 
Int_t LoadInputParameters (TString pedestalfile)
 
Int_t LoadEventCuts (TString &filename)
 
Bool_t SingleEventCuts ()
 
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)
 
void ClearEventData ()
 
void ProcessEvent ()
 
Bool_t IsGoodEvent ()
 
void RandomizeEventData (int helicity=0)
 
void EncodeEventData (std::vector< UInt_t > &buffer)
 
VQwSubsystemoperator= (VQwSubsystem *value)
 
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)
 
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...
 
Bool_t CheckRunningAverages (Bool_t)
 
void AccumulateRunningSum (VQwSubsystem *value)
 
void DeaccumulateRunningSum (VQwSubsystem *value)
 remove one entry from the running sums for devices More...
 
void CalculateRunningAverage ()
 
void ConstructHistograms (TDirectory *folder, TString &prefix)
 
void FillHistograms ()
 
void ConstructTree (TDirectory *folder, TString &prefix)
 
void FillTree ()
 
void DeleteTree ()
 
void ConstructBranchAndVector (TTree *tree, TString &prefix, std::vector< Double_t > &values)
 
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
 
Bool_t Compare (VQwSubsystem *source)
 
Bool_t CompareADC (VQwSubsystem *source)
 
Bool_t CompareTDC (VQwSubsystem *source)
 
Bool_t CompareQDC (VQwSubsystem *source)
 
void PrintValue () const
 
void PrintInfo () const
 
QwSIS3320_ChannelGetSIS3320Channel (const TString name)
 
- 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 void FillDB (QwParityDB *db, TString type)
 Fill the database. More...
 
virtual void FillErrDB (QwParityDB *db, TString type)
 
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 void Blind (const QwBlinder *blinder)
 Blind the asymmetry of this subsystem. More...
 
virtual void Blind (const QwBlinder *blinder, const VQwSubsystemParity *subsys)
 Blind the difference of this subsystem. More...
 
virtual void WritePromptSummary (QwPromptSummary *ps, TString type)
 
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 PublishInternalValues () const
 Publish all variables of the subsystem. 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 ExchangeProcessedData ()
 Request processed data from other subsystems for internal use in the second event processing stage. Not all derived classes will require data from other subsystems. More...
 
virtual 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...
 
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 (TDirectory *folder)
 Construct the histograms for this subsystem in a folder. 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...
 
- Public Member Functions inherited from MQwHistograms
void ShareHistograms (const MQwHistograms *source)
 Share histogram pointers between objects. More...
 
- Public Member Functions inherited from MQwV775TDC
 MQwV775TDC ()
 
 ~MQwV775TDC ()
 
void DecodeTDCWord (UInt_t &word, const UInt_t roc_id=0)
 
Bool_t IsValidDataword ()
 
Bool_t IsHeaderword ()
 
UInt_t GetTDCSlotNumber ()
 
UInt_t GetTDCChannelNumber ()
 
UInt_t GetTDCData ()
 
UInt_t GetTDCMaxChannels ()
 
UInt_t GetTDCEventNumber ()
 
UInt_t GetTDCTriggerTime ()
 
void SetReferenceParameters (Double_t mindiff, Double_t maxdiff, Double_t offset, Double_t shift)
 
Double_t SubtractReference (Double_t rawtime, Double_t reftime)
 
Bool_t CheckDataIntegrity (const UInt_t roc_id, UInt_t *buffer, UInt_t num_words)
 
void PrintTDCHeader (Bool_t flag)
 
void PrintTDCData (Bool_t flag)
 
- Public Member Functions inherited from MQwCloneable< VQwSubsystem, QwComptonPhotonDetector >
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)
 
- 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, QwComptonPhotonDetector >
static VQwSubsystemCreate (const std::string &name)
 Object creation. More...
 
static QwComptonPhotonDetectorCast (QwComptonPhotonDetector *type)
 Object dynamic cast. More...
 

Protected Types

enum  ChannelType_t { kUnknown, kSamplingADC, kIntegratingADC, kIntegratingTDC }
 Mapping from ROC/subbank to channel type. More...
 
typedef std::map< Int_t,
std::vector< std::vector
< Int_t > > > 
SamplingADC_Mapping_t
 List of sampling ADC channels. More...
 
typedef std::map< Int_t,
std::vector< std::vector
< Int_t > > > 
IntegratingADC_Mapping_t
 List of integrating QDC channels. More...
 
typedef std::map< Int_t,
std::vector< std::vector
< Int_t > > > 
IntegratingTDC_Mapping_t
 List of integrating TDC channels. More...
 

Protected Attributes

TTree * fTree
 Expert tree. More...
 
Int_t fTree_fNEvents
 Expert tree fields. More...
 
std::map< Int_t, ChannelType_tfMapping
 
SamplingADC_Mapping_t fSamplingADC_Mapping
 
std::vector< QwSIS3320_ChannelfSamplingADC
 
IntegratingADC_Mapping_t fMultiQDC_Mapping
 
std::vector< QwPMT_ChannelfMultiQDC_Channel
 
std::vector< std::vector
< QwPMT_Channel > > 
fMultiQDC_Events
 
IntegratingTDC_Mapping_t fMultiTDC_Mapping
 
std::vector< QwPMT_ChannelfMultiTDC_Channel
 
std::vector< std::vector
< QwPMT_Channel > > 
fMultiTDC_Events
 
- 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

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

Private Attributes

Int_t fGoodEventCount
 

Static Private Attributes

static const Bool_t kDebug = kTRUE
 

Additional Inherited Members

- 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...
 

Detailed Description

Class for the analysis of Compton photon detector data.

Author
W. Deconinck
Date
2009-09-04 18:06:23

The QwComptonPhotonDetector class is defined as a parity subsystem that contains all data modules of the photon detector (SIS3320, V775, V792). It reads in a channel map and pedestal file, and defines the histograms and output trees.

Definition at line 32 of file QwComptonPhotonDetector.h.

Member Typedef Documentation

typedef std::map< Int_t, std::vector< std::vector< Int_t > > > QwComptonPhotonDetector::IntegratingADC_Mapping_t
protected

List of integrating QDC channels.

Definition at line 142 of file QwComptonPhotonDetector.h.

typedef std::map< Int_t, std::vector< std::vector< Int_t > > > QwComptonPhotonDetector::IntegratingTDC_Mapping_t
protected

List of integrating TDC channels.

Definition at line 148 of file QwComptonPhotonDetector.h.

typedef std::map< Int_t, std::vector <std::vector <Int_t> > > QwComptonPhotonDetector::SamplingADC_Mapping_t
protected

List of sampling ADC channels.

Definition at line 137 of file QwComptonPhotonDetector.h.

Member Enumeration Documentation

Constructor & Destructor Documentation

QwComptonPhotonDetector::QwComptonPhotonDetector ( )
private

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

QwComptonPhotonDetector::QwComptonPhotonDetector ( TString  name)
inline

Constructor with name.

Definition at line 44 of file QwComptonPhotonDetector.h.

44 : VQwSubsystem(name), VQwSubsystemParity(name) { };
VQwSubsystemParity()
Private default constructor (not implemented, will throw linker error on use)
QwComptonPhotonDetector::QwComptonPhotonDetector ( const QwComptonPhotonDetector source)
inline

Copy constructor.

Definition at line 46 of file QwComptonPhotonDetector.h.

47  : VQwSubsystem(source),VQwSubsystemParity(source),
48  fSamplingADC(source.fSamplingADC),
51  { }
std::vector< QwPMT_Channel > fMultiTDC_Channel
std::vector< QwPMT_Channel > fMultiQDC_Channel
std::vector< QwSIS3320_Channel > fSamplingADC
VQwSubsystemParity()
Private default constructor (not implemented, will throw linker error on use)
virtual QwComptonPhotonDetector::~QwComptonPhotonDetector ( )
inlinevirtual

Virtual destructor.

Definition at line 53 of file QwComptonPhotonDetector.h.

53 { };

Member Function Documentation

void QwComptonPhotonDetector::AccumulateRunningSum ( VQwSubsystem value)
virtual

Accumulate the running sum

Implements VQwSubsystemParity.

Definition at line 641 of file QwComptonPhotonDetector.cc.

References Compare(), and fGoodEventCount.

642 {
643  if (Compare(value)) {
644  fGoodEventCount++;
645  *this += value;
646  }
647 }
Bool_t Compare(VQwSubsystem *source)

+ Here is the call graph for this function:

Bool_t QwComptonPhotonDetector::ApplySingleEventCuts ( )
inlinevirtual

Apply the single event cuts.

Implements VQwSubsystemParity.

Definition at line 84 of file QwComptonPhotonDetector.h.

84 { return kTRUE; };
void QwComptonPhotonDetector::CalculateRunningAverage ( )
virtual

Normalize the running sum

Implements VQwSubsystemParity.

Definition at line 652 of file QwComptonPhotonDetector.cc.

References fGoodEventCount, and Scale().

653 {
654  if (fGoodEventCount <= 0) {
655  Scale(0);
656  } else {
657  Scale(1.0/fGoodEventCount);
658  }
659 }

+ Here is the call graph for this function:

Bool_t QwComptonPhotonDetector::CheckRunningAverages ( Bool_t  )
inline

Definition at line 92 of file QwComptonPhotonDetector.h.

92 { return kTRUE; };
void QwComptonPhotonDetector::ClearEventData ( )
virtual

Clear the event data in this subsystem

Implements VQwSubsystem.

Definition at line 514 of file QwComptonPhotonDetector.cc.

References fGoodEventCount, fMultiQDC_Channel, fMultiTDC_Channel, and fSamplingADC.

515 {
516  // Clear all sampling ADC channels
517  for (size_t i = 0; i < fSamplingADC.size(); i++)
519 
520  // Clear all TDC and QDC channels
521  for (size_t i = 0; i < fMultiTDC_Channel.size(); i++)
523  for (size_t i = 0; i < fMultiQDC_Channel.size(); i++)
525 
526  fGoodEventCount = 0;
527 }
std::vector< QwPMT_Channel > fMultiTDC_Channel
std::vector< QwPMT_Channel > fMultiQDC_Channel
std::vector< QwSIS3320_Channel > fSamplingADC
Bool_t QwComptonPhotonDetector::Compare ( VQwSubsystem value)

Compare two QwComptonPhotonDetector objects

Parameters
valueObject to compare with
Returns
kTRUE if the object is equal

Definition at line 666 of file QwComptonPhotonDetector.cc.

References fMultiQDC_Channel, fMultiTDC_Channel, and fSamplingADC.

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

667 {
668  // Immediately fail on null objects
669  if (value == 0) return kFALSE;
670 
671  // Continue testing on actual object
672  Bool_t result = kTRUE;
673  if (typeid(*value) != typeid(*this)) {
674  result = kFALSE;
675 
676  } else {
677  QwComptonPhotonDetector* input = dynamic_cast<QwComptonPhotonDetector*> (value);
678  if (input->fSamplingADC.size() != fSamplingADC.size()) {
679  result = kFALSE;
680  } else {
681  if (input->fMultiTDC_Channel.size() != fMultiTDC_Channel.size()) {
682  result = kFALSE;
683  } else {
684  if (input->fMultiQDC_Channel.size() != fMultiQDC_Channel.size()) {
685  result = kFALSE;
686  }
687  }
688  }
689  }
690  return result;
691 }
std::vector< QwPMT_Channel > fMultiTDC_Channel
std::vector< QwPMT_Channel > fMultiQDC_Channel
std::vector< QwSIS3320_Channel > fSamplingADC
Class for the analysis of Compton photon detector data.

+ Here is the caller graph for this function:

Bool_t QwComptonPhotonDetector::CompareADC ( VQwSubsystem value)

Compare two QwComptonPhotonDetector ADC objects

Parameters
valueObject to compare with
Returns
kTRUE if the object is equal

Definition at line 698 of file QwComptonPhotonDetector.cc.

References fSamplingADC.

Referenced by operator=().

699 {
700  // Immediately fail on null objects
701  if (value == 0) return kFALSE;
702 
703  // Continue testing on actual object
704  Bool_t result = kTRUE;
705  if (typeid(*value) != typeid(*this)) {
706  result = kFALSE;
707 
708  } else {
709  QwComptonPhotonDetector* input = dynamic_cast<QwComptonPhotonDetector*> (value);
710  if (input->fSamplingADC.size() != fSamplingADC.size()) {
711  result = kFALSE;
712  }
713  }
714  return result;
715 }
std::vector< QwSIS3320_Channel > fSamplingADC
Class for the analysis of Compton photon detector data.

+ Here is the caller graph for this function:

Bool_t QwComptonPhotonDetector::CompareQDC ( VQwSubsystem value)

Compare two QwComptonPhotonDetector QDC objects

Parameters
valueObject to compare with
Returns
kTRUE if the object is equal

Definition at line 746 of file QwComptonPhotonDetector.cc.

References fMultiQDC_Channel.

Referenced by operator=().

747 {
748  // Immediately fail on null objects
749  if (value == 0) return kFALSE;
750 
751  // Continue testing on actual object
752  Bool_t result = kTRUE;
753  if (typeid(*value) != typeid(*this)) {
754  result = kFALSE;
755 
756  } else {
757  QwComptonPhotonDetector* input = dynamic_cast<QwComptonPhotonDetector*> (value);
758  if (input->fMultiQDC_Channel.size() != fMultiQDC_Channel.size()) {
759  result = kFALSE;
760  }
761  }
762  return result;
763 }
std::vector< QwPMT_Channel > fMultiQDC_Channel
Class for the analysis of Compton photon detector data.

+ Here is the caller graph for this function:

Bool_t QwComptonPhotonDetector::CompareTDC ( VQwSubsystem value)

Compare two QwComptonPhotonDetector TDC objects

Parameters
valueObject to compare with
Returns
kTRUE if the object is equal

Definition at line 722 of file QwComptonPhotonDetector.cc.

References fMultiTDC_Channel.

Referenced by operator=().

723 {
724  // Immediately fail on null objects
725  if (value == 0) return kFALSE;
726 
727  // Continue testing on actual object
728  Bool_t result = kTRUE;
729  if (typeid(*value) != typeid(*this)) {
730  result = kFALSE;
731 
732  } else {
733  QwComptonPhotonDetector* input = dynamic_cast<QwComptonPhotonDetector*> (value);
734  if (input->fMultiTDC_Channel.size() != fMultiTDC_Channel.size()) {
735  result = kFALSE;
736  }
737  }
738  return result;
739 }
std::vector< QwPMT_Channel > fMultiTDC_Channel
Class for the analysis of Compton photon detector data.

+ Here is the caller graph for this function:

void QwComptonPhotonDetector::ConstructBranch ( TTree *  tree,
TString &  prefix 
)
inlinevirtual

Construct the branch and tree vector.

Implements VQwSubsystem.

Definition at line 111 of file QwComptonPhotonDetector.h.

111 { };
void QwComptonPhotonDetector::ConstructBranch ( TTree *  tree,
TString &  prefix,
QwParameterFile trim_file 
)
inlinevirtual

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

Implements VQwSubsystem.

Definition at line 112 of file QwComptonPhotonDetector.h.

112 { };
void QwComptonPhotonDetector::ConstructBranchAndVector ( TTree *  tree,
TString &  prefix,
std::vector< Double_t > &  values 
)
virtual

Construct the tree

Parameters
treePointer to the tree in which the branches will be created
prefixPrefix with information about the type of histogram
values

Implements VQwSubsystem.

Definition at line 830 of file QwComptonPhotonDetector.cc.

References fMultiQDC_Channel, fMultiTDC_Channel, and fSamplingADC.

831 {
832  for (size_t i = 0; i < fSamplingADC.size(); i++)
833  fSamplingADC[i].ConstructBranchAndVector(tree, prefix, values);
834  for (size_t i = 0; i < fMultiTDC_Channel.size(); i++)
835  fMultiTDC_Channel[i].ConstructBranchAndVector(tree, prefix, values);
836  for (size_t i = 0; i < fMultiQDC_Channel.size(); i++)
837  fMultiQDC_Channel[i].ConstructBranchAndVector(tree, prefix, values);
838 }
std::vector< QwPMT_Channel > fMultiTDC_Channel
std::vector< QwPMT_Channel > fMultiQDC_Channel
void ConstructBranchAndVector(TTree *tree, TString &prefix, std::vector< Double_t > &values)
std::vector< QwSIS3320_Channel > fSamplingADC
void QwComptonPhotonDetector::ConstructHistograms ( TDirectory *  folder,
TString &  prefix 
)
virtual

Construct the histograms

Parameters
folderFolder in which the histograms will be created
prefixPrefix with information about the type of histogram

Implements VQwSubsystem.

Definition at line 770 of file QwComptonPhotonDetector.cc.

References VQwSubsystem::ConstructHistograms(), fMultiQDC_Channel, fMultiTDC_Channel, and fSamplingADC.

771 {
772  for (size_t i = 0; i < fSamplingADC.size(); i++)
773  fSamplingADC[i].ConstructHistograms(folder, prefix);
774  for (size_t i = 0; i < fMultiTDC_Channel.size(); i++)
775  fMultiTDC_Channel[i].ConstructHistograms(folder,prefix);
776  for (size_t i = 0; i < fMultiQDC_Channel.size(); i++)
777  fMultiQDC_Channel[i].ConstructHistograms(folder,prefix);
778 }
std::vector< QwPMT_Channel > fMultiTDC_Channel
std::vector< QwPMT_Channel > fMultiQDC_Channel
virtual void ConstructHistograms()
Construct the histograms for this subsystem.
Definition: VQwSubsystem.h:209
std::vector< QwSIS3320_Channel > fSamplingADC

+ Here is the call graph for this function:

void QwComptonPhotonDetector::ConstructTree ( TDirectory *  folder,
TString &  prefix 
)
virtual

Construct the tree

Parameters
folderFolder in which the tree will be created
prefixPrefix with information about the type of histogram

Reimplemented from VQwSubsystem.

Definition at line 798 of file QwComptonPhotonDetector.cc.

References fTree, and fTree_fNEvents.

799 {
800  folder->cd();
801  fTree = new TTree("ComptonPhoton", "Compton Photon Detector");
802  fTree->Branch("nevents",&fTree_fNEvents,"nevents/I");
803 }
Int_t fTree_fNEvents
Expert tree fields.
void QwComptonPhotonDetector::DeaccumulateRunningSum ( VQwSubsystem value)
inlinevirtual

remove one entry from the running sums for devices

Implements VQwSubsystemParity.

Definition at line 96 of file QwComptonPhotonDetector.h.

96  {
97  };
void QwComptonPhotonDetector::DefineOptions ( QwOptions options)
static

Definition at line 31 of file QwComptonPhotonDetector.cc.

32 {
33  // Define command line options
34 }
void QwComptonPhotonDetector::DeleteTree ( )
virtual

Delete the tree

Reimplemented from VQwSubsystem.

Definition at line 808 of file QwComptonPhotonDetector.cc.

References fTree.

809 {
810  delete fTree;
811 }
void QwComptonPhotonDetector::Difference ( VQwSubsystem value1,
VQwSubsystem value2 
)
virtual

Difference

Parameters
value1First value
value2Second value

Implements VQwSubsystemParity.

Definition at line 605 of file QwComptonPhotonDetector.cc.

References Compare().

606 {
607  if (Compare(value1) && Compare(value2)) {
608  *this = value1;
609  *this -= value2;
610  }
611 }
Bool_t Compare(VQwSubsystem *source)

+ Here is the call graph for this function:

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

Encode this event into a CODA buffer

Parameters
bufferBuffer to append data to

Reimplemented from VQwSubsystem.

Definition at line 300 of file QwComptonPhotonDetector.cc.

References VQwSubsystem::fCurrentBank_ID, VQwSubsystem::fCurrentROC_ID, and fSamplingADC.

301 {
302  std::vector<UInt_t> elements;
303  elements.clear();
304 
305  // Get all buffers in the order they are defined in the map file
306  for (size_t i = 0; i < fSamplingADC.size(); i++)
307  fSamplingADC[i].EncodeEventData(elements);
308 
309  // If there is element data, generate the subbank header
310  std::vector<UInt_t> subbankheader;
311  std::vector<UInt_t> rocheader;
312  if (elements.size() > 0) {
313 
314  // Form CODA subbank header
315  subbankheader.clear();
316  subbankheader.push_back(elements.size() + 1); // subbank size
317  subbankheader.push_back((fCurrentBank_ID << 16) | (0x01 << 8) | (1 & 0xff));
318  // subbank tag | subbank type | event number
319 
320  // Form CODA bank/roc header
321  rocheader.clear();
322  rocheader.push_back(subbankheader.size() + elements.size() + 1); // bank/roc size
323  rocheader.push_back((fCurrentROC_ID << 16) | (0x10 << 8) | (1 & 0xff));
324  // bank tag == ROC | bank type | event number
325 
326  // Add bank header, subbank header and element data to output buffer
327  buffer.insert(buffer.end(), rocheader.begin(), rocheader.end());
328  buffer.insert(buffer.end(), subbankheader.begin(), subbankheader.end());
329  buffer.insert(buffer.end(), elements.begin(), elements.end());
330  }
331 }
void EncodeEventData(std::vector< UInt_t > &buffer)
std::vector< QwSIS3320_Channel > fSamplingADC
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 QwComptonPhotonDetector::FillHistograms ( )
virtual

Fill the histograms with data

Implements VQwSubsystem.

Definition at line 783 of file QwComptonPhotonDetector.cc.

References fMultiQDC_Channel, fMultiTDC_Channel, and fSamplingADC.

784 {
785  for (size_t i = 0; i < fSamplingADC.size(); i++)
787  for (size_t i = 0; i < fMultiTDC_Channel.size(); i++)
789  for (size_t i = 0; i < fMultiQDC_Channel.size(); i++)
791 }
std::vector< QwPMT_Channel > fMultiTDC_Channel
std::vector< QwPMT_Channel > fMultiQDC_Channel
std::vector< QwSIS3320_Channel > fSamplingADC
void QwComptonPhotonDetector::FillTree ( )
virtual

Fill the tree with data

Reimplemented from VQwSubsystem.

Definition at line 816 of file QwComptonPhotonDetector.cc.

References fSamplingADC, fTree, and fTree_fNEvents.

817 {
818  for (size_t i = 0; i < fSamplingADC.size(); i++) {
819  fTree_fNEvents = fSamplingADC[i].GetNumberOfEvents();
820  fTree->Fill();
821  }
822 }
Int_t fTree_fNEvents
Expert tree fields.
std::vector< QwSIS3320_Channel > fSamplingADC
void QwComptonPhotonDetector::FillTreeVector ( std::vector< Double_t > &  values) const
virtual

Fill the tree with data

Parameters
values

Implements VQwSubsystem.

Definition at line 844 of file QwComptonPhotonDetector.cc.

References fMultiQDC_Channel, fMultiTDC_Channel, and fSamplingADC.

845 {
846  for (size_t i = 0; i < fSamplingADC.size(); i++)
847  fSamplingADC[i].FillTreeVector(values);
848  for (size_t i = 0; i < fMultiTDC_Channel.size(); i++)
850  for (size_t i = 0; i < fMultiQDC_Channel.size(); i++)
852 }
std::vector< QwPMT_Channel > fMultiTDC_Channel
std::vector< QwPMT_Channel > fMultiQDC_Channel
std::vector< QwSIS3320_Channel > fSamplingADC
void FillTreeVector(std::vector< Double_t > &values) const
UInt_t QwComptonPhotonDetector::GetEventcutErrorFlag ( )
inlinevirtual

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

Implements VQwSubsystemParity.

Definition at line 87 of file QwComptonPhotonDetector.h.

87 { return 0; };
QwSIS3320_Channel * QwComptonPhotonDetector::GetSIS3320Channel ( const TString  name)

Get the SIS3320 channel for this photon detector

Parameters
nameName of the SIS3320 channel
Returns
Pointer to the SIS3320 channel

Definition at line 897 of file QwComptonPhotonDetector.cc.

References fSamplingADC.

898 {
899  if (! fSamplingADC.empty()) {
900  for (std::vector<QwSIS3320_Channel>::iterator adc = fSamplingADC.begin(); adc != fSamplingADC.end(); ++adc) {
901  if (adc->GetElementName() == name) {
902  return &(*adc);
903  }
904  }
905  }
906  return 0;
907 }
std::vector< QwSIS3320_Channel > fSamplingADC
void QwComptonPhotonDetector::IncrementErrorCounters ( )
inlinevirtual

Increment the error counters.

Implements VQwSubsystemParity.

Definition at line 85 of file QwComptonPhotonDetector.h.

85 {};
Bool_t QwComptonPhotonDetector::IsGoodEvent ( )

Check whether this is a good event

Returns
True if the event is good

Definition at line 495 of file QwComptonPhotonDetector.cc.

References fSamplingADC.

Referenced by SingleEventCuts().

496 {
497  Bool_t test = kTRUE;
498 
499  for(size_t i=0;i<fSamplingADC.size();i++)
500  test &= fSamplingADC[i].IsGoodEvent();
501 // for(size_t i=0;i<fMultiTDC_Channel.size();i++)
502 // test &= fMultiTDC_Channel[i].IsGoodEvent();
503 // for(size_t i=0;i<fMultiQDC_Channel.size();i++)
504 // test &= fMultiQDC_Channel[i].IsGoodEvent();
505 
506  if (!test) std::cerr << "This is not a good event!" << std::endl;
507  return test;
508 }
std::vector< QwSIS3320_Channel > fSamplingADC

+ Here is the caller graph for this function:

Int_t QwComptonPhotonDetector::LoadChannelMap ( TString  mapfile)
virtual

Load the channel map

Parameters
mapfileMap file
Returns
Zero if successful

Implements VQwSubsystem.

Definition at line 46 of file QwComptonPhotonDetector.cc.

References QwLog::endl(), VQwSubsystem::fDetectorMaps, fMapping, fMultiQDC_Channel, fMultiQDC_Mapping, fMultiTDC_Channel, fMultiTDC_Mapping, fSamplingADC, fSamplingADC_Mapping, VQwSubsystem::GetSubbankIndex(), QwParameterFile::GetUInt(), kIntegratingADC, kIntegratingTDC, kSamplingADC, QwMessage, VQwSubsystem::RegisterROCNumber(), and VQwSubsystem::RegisterSubbank().

47 {
48  Int_t subbank = -1; // subbank index
49  Int_t current_roc_id = -1; // current ROC id
50  Int_t current_bank_id = -1; // current bank id
51 
52  Int_t current_logical_accum = 0;
53  std::vector<TString> name;
54  std::vector<std::vector<TString> > accums;
55  std::vector<std::vector<Double_t> > weights;
56 
57  // Open the file
58  QwParameterFile mapstr(mapfile.Data());
59  fDetectorMaps.insert(mapstr.GetParamFileNameContents());
60 
61  while (mapstr.ReadNextLine()) {
62  mapstr.TrimComment(); // Remove everything after a comment character
63  mapstr.TrimWhitespace(); // Get rid of leading and trailing whitespace
64  if (mapstr.LineIsEmpty()) continue;
65 
66  TString varname, varvalue;
67  if (mapstr.HasVariablePair("=",varname,varvalue)) {
68  // This is a declaration line. Decode it.
69  varname.ToLower();
70 
71  if (varname == "roc") {
72  current_roc_id = QwParameterFile::GetUInt(varvalue);
73  RegisterROCNumber(current_roc_id,0);
74 
75  } else if (varname == "bank") {
76  current_bank_id = QwParameterFile::GetUInt(varvalue);
77  RegisterSubbank(current_bank_id);
78  subbank = GetSubbankIndex(current_roc_id,current_bank_id);
79 
80  } else if (varname == "begin") {
81  // Add new logical accumulator
82  name.resize(current_logical_accum+1);
83  accums.resize(current_logical_accum+1);
84  weights.resize(current_logical_accum+1);
85  // Read to end of this block
86  while(mapstr.ReadNextLine()) {
87  mapstr.TrimComment(); // Remove everything after a comment character
88  mapstr.TrimWhitespace(); // Get rid of leading and trailing whitespace
89  if (mapstr.LineIsEmpty()) continue;
90 
91  // Loop over block
92  if (mapstr.HasVariablePair("=",varname,varvalue)) {
93  varname.ToLower();
94  if (varname == "end") {
95  current_logical_accum++;
96  break;
97  } else if (varname == "name") {
98  name[current_logical_accum] = varvalue;
99  }
100  } else {
101  accums[current_logical_accum].push_back(mapstr.GetTypedNextToken<TString>());
102  weights[current_logical_accum].push_back(mapstr.GetTypedNextToken<Double_t>());
103  }
104  }
105  }
106 
107  } else {
108  // Break this line into tokens to process it.
109  TString modtype = mapstr.GetTypedNextToken<TString>();
110  UInt_t modnum = mapstr.GetTypedNextToken<UInt_t>();
111  UInt_t channum = mapstr.GetTypedNextToken<UInt_t>();
112  TString dettype = mapstr.GetTypedNextToken<TString>();
113  TString name = mapstr.GetTypedNextToken<TString>();
114  modtype.ToUpper();
115  dettype.ToUpper();
116 
117  // Push a new record into the element array
118  if (modtype == "SIS3320") {
119  // Register data channel type
120  fMapping[subbank] = kSamplingADC;
121  // Increase module mapping size
122  if (modnum >= fSamplingADC_Mapping[subbank].size())
123  fSamplingADC_Mapping[subbank].resize(modnum+1);
124  // Increase channel mapping size
125  if (channum >= fSamplingADC_Mapping[subbank].at(modnum).size())
126  fSamplingADC_Mapping[subbank].at(modnum).resize(channum+1,-1);
127  // Search whether this module/channel is already registered
128  for (SamplingADC_Mapping_t::iterator iter = fSamplingADC_Mapping.begin();
129  iter != fSamplingADC_Mapping.end(); iter++) {
130  if (iter->first != subbank &&
131  iter->second.size() > modnum &&
132  iter->second.at(modnum).size() > channum &&
133  iter->second.at(modnum).at(channum) >= 0) {
134  QwMessage << "Connecting SIS3320 " << name << "/" << dettype
135  << std::hex
136  << " in ROC 0x" << current_roc_id << ", bank 0x" << current_bank_id
137  << std::dec
138  << " to existing SIS3320." << QwLog::endl;
139  fSamplingADC_Mapping[subbank].at(modnum).at(channum) =
140  iter->second.at(modnum).at(channum);
141  }
142  }
143  // Register new SIS3320
144  if (fSamplingADC_Mapping[subbank].at(modnum).at(channum) < 0) {
145  QwMessage << "Registering SIS3320 " << name << "/" << dettype
146  << std::hex
147  << " in ROC 0x" << current_roc_id << ", bank 0x" << current_bank_id
148  << std::dec
149  << " at mod " << modnum << ", chan " << channum
150  << QwLog::endl;
151  UInt_t index = fSamplingADC.size();
152  fSamplingADC_Mapping[subbank].at(modnum).at(channum) = index;
153  fSamplingADC.push_back(QwSIS3320_Channel(channum, name));
154  fSamplingADC.at(index).SetNumberOfAccumulators(6);
155  fSamplingADC.at(index).InitializeChannel(channum, name);
156  }
157 
158  } else if (modtype == "V792") {
159  // Register data channel type
160  fMapping[subbank] = kIntegratingADC;
161  // Add to mapping
162  if (modnum >= fMultiQDC_Mapping[subbank].size())
163  fMultiQDC_Mapping[subbank].resize(modnum+1);
164  if (channum >= fMultiQDC_Mapping[subbank].at(modnum).size())
165  fMultiQDC_Mapping[subbank].at(modnum).resize(channum+1,-1);
166  // Add scaler channel
167  if (fMultiQDC_Mapping[subbank].at(modnum).at(channum) < 0) {
168  QwMessage << "Registering V792 " << name
169  << std::hex
170  << " in ROC 0x" << current_roc_id << ", bank 0x" << current_bank_id
171  << std::dec
172  << " at mod " << modnum << ", chan " << channum
173  << QwLog::endl;
174  UInt_t index = fMultiQDC_Channel.size();
175  fMultiQDC_Mapping[subbank].at(modnum).at(channum) = index;
176  fMultiQDC_Channel.push_back(QwPMT_Channel(name));
177  fMultiQDC_Channel.at(index).SetModule(modnum);
178  fMultiQDC_Channel.at(index).SetSubbankID(current_bank_id);
179  }
180 
181  } else if (modtype == "V775") {
182  // Register data channel type
183  fMapping[subbank] = kIntegratingTDC;
184  // Add to mapping
185  if (modnum >= fMultiTDC_Mapping[subbank].size())
186  fMultiTDC_Mapping[subbank].resize(modnum+1);
187  if (channum >= fMultiTDC_Mapping[subbank].at(modnum).size())
188  fMultiTDC_Mapping[subbank].at(modnum).resize(channum+1,-1);
189  // Add scaler channel
190  if (fMultiTDC_Mapping[subbank].at(modnum).at(channum) < 0) {
191  QwMessage << "Registering V775 " << name
192  << std::hex
193  << " in ROC 0x" << current_roc_id << ", bank 0x" << current_bank_id
194  << std::dec
195  << " at mod " << modnum << ", chan " << channum
196  << QwLog::endl;
197  UInt_t index = fMultiTDC_Channel.size();
198  fMultiTDC_Mapping[subbank].at(modnum).at(channum) = index;
199  fMultiTDC_Channel.push_back(QwPMT_Channel(name));
200  fMultiTDC_Channel.at(index).SetModule(modnum);
201  fMultiTDC_Channel.at(index).SetSubbankID(current_bank_id);
202  }
203 
204  } // end of switch by modtype
205 
206  } // end of if for token line
207  } // end of while over parameter file
208 
209  // Now create the logical accumulators
210  for (size_t logical = 0; logical < name.size(); logical++) {
211  for (size_t adc = 0; adc < fSamplingADC.size(); adc++) {
212  fSamplingADC[adc].AddLogicalAccumulator(name[logical],accums[logical],weights[logical]);
213  }
214  }
215 
216  return 0;
217 }
Int_t GetSubbankIndex() const
Definition: VQwSubsystem.h:303
#define QwMessage
Predefined log drain for regular messages.
Definition: QwLog.h:50
std::vector< QwPMT_Channel > fMultiTDC_Channel
std::map< TString, TString > fDetectorMaps
Definition: VQwSubsystem.h:322
Class for the decoding of the SIS3320 sampling ADC data.
std::vector< QwPMT_Channel > fMultiQDC_Channel
static UInt_t GetUInt(const TString &varvalue)
std::map< Int_t, ChannelType_t > fMapping
IntegratingTDC_Mapping_t fMultiTDC_Mapping
std::vector< QwSIS3320_Channel > fSamplingADC
SamplingADC_Mapping_t fSamplingADC_Mapping
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
IntegratingADC_Mapping_t fMultiQDC_Mapping

+ Here is the call graph for this function:

Int_t QwComptonPhotonDetector::LoadEventCuts ( TString &  filename)

Load the event cuts

Parameters
filenameEvent cuts file
Returns
Zero if successful

Definition at line 224 of file QwComptonPhotonDetector.cc.

225 {
226  return 0;
227 }
Int_t QwComptonPhotonDetector::LoadEventCuts ( TString  filename)
inlinevirtual

Load the event cuts file.

Implements VQwSubsystemParity.

Definition at line 83 of file QwComptonPhotonDetector.h.

83 { return 0; };
Int_t QwComptonPhotonDetector::LoadInputParameters ( TString  pedestalfile)
virtual

Load the input parameters

Parameters
pedestalfileInput parameters file
Returns
Zero if successful

Implements VQwSubsystem.

Definition at line 234 of file QwComptonPhotonDetector.cc.

References QwLog::endl(), VQwSubsystem::fDetectorMaps, fSamplingADC, QwMessage, and QwVerbose.

235 {
236  // Open the file
237  QwParameterFile mapstr(pedestalfile.Data());
238  fDetectorMaps.insert(mapstr.GetParamFileNameContents());
239  while (mapstr.ReadNextLine()) {
240  mapstr.TrimComment(); // Remove everything after a comment character
241  mapstr.TrimWhitespace(); // Get rid of leading and trailing spaces
242 
243  TString varname = "";
244  Double_t varped = 0.0;
245  Double_t varcal = 1.0;
246 
247  if (mapstr.LineIsEmpty()) continue;
248  else {
249  varname = mapstr.GetTypedNextToken<TString>(); // name of the channel
250  varname.ToLower();
251  varname.Remove(TString::kBoth,' ');
252  varped = mapstr.GetTypedNextToken<Double_t>(); // value of the pedestal
253  varcal = mapstr.GetTypedNextToken<Double_t>(); // value of the calibration factor
254  QwVerbose << varname << ": " << QwLog::endl;
255  }
256 
257  Bool_t found = kFALSE;
258  for (size_t i = 0; i < fSamplingADC.size() && !found; i++) {
259  TString localname = fSamplingADC[i].GetElementName();
260  localname.ToLower();
261  if (localname == varname) {
262  QwMessage << "Setting pedestal and calibration of sampling ADC " << localname
263  << " to " << varped << " and " << varcal << "." << QwLog::endl;
264  fSamplingADC[i].SetPedestal(varped);
265  fSamplingADC[i].SetCalibrationFactor(varcal);
266  found = kTRUE;
267  }
268  } // end of loop over all sampling ADC channels
269 
270  } // end of loop reading all lines of the pedestal file
271 
272  return 0;
273 }
#define QwMessage
Predefined log drain for regular messages.
Definition: QwLog.h:50
std::map< TString, TString > fDetectorMaps
Definition: VQwSubsystem.h:322
#define QwVerbose
Predefined log drain for verbose messages.
Definition: QwLog.h:55
std::vector< QwSIS3320_Channel > fSamplingADC
static std::ostream & endl(std::ostream &)
End of the line.
Definition: QwLog.cc:299

+ Here is the call graph for this function:

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

Addition-assignment operator

Parameters
valueRight-hand side
Returns
Left-hand side

Implements VQwSubsystemParity.

Definition at line 562 of file QwComptonPhotonDetector.cc.

References Compare(), and fSamplingADC.

563 {
564  if (Compare(value)) {
565  QwComptonPhotonDetector* input = dynamic_cast<QwComptonPhotonDetector*>(value);
566  for (size_t i = 0; i < input->fSamplingADC.size(); i++)
567  this->fSamplingADC[i] += input->fSamplingADC[i];
568  }
569  return *this;
570 }
Bool_t Compare(VQwSubsystem *source)
std::vector< QwSIS3320_Channel > fSamplingADC
Class for the analysis of Compton photon detector data.

+ Here is the call graph for this function:

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

Subtraction-assignment operator

Parameters
valueRight-hand side
Returns
Left-hand side

Implements VQwSubsystemParity.

Definition at line 577 of file QwComptonPhotonDetector.cc.

References Compare(), and fSamplingADC.

578 {
579  if (Compare(value)) {
580  QwComptonPhotonDetector* input = dynamic_cast<QwComptonPhotonDetector*> (value);
581  for (size_t i = 0; i < input->fSamplingADC.size(); i++)
582  this->fSamplingADC[i] -= input->fSamplingADC[i];
583  }
584  return *this;
585 }
Bool_t Compare(VQwSubsystem *source)
std::vector< QwSIS3320_Channel > fSamplingADC
Class for the analysis of Compton photon detector data.

+ Here is the call graph for this function:

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

Assignment operator

Parameters
valueRight-hand side
Returns
Left-hand side

Implements VQwSubsystemParity.

Definition at line 534 of file QwComptonPhotonDetector.cc.

References CompareADC(), CompareQDC(), CompareTDC(), fMultiQDC_Channel, fMultiTDC_Channel, and fSamplingADC.

535 {
536  if (CompareADC(value)) {
537  QwComptonPhotonDetector* input = dynamic_cast<QwComptonPhotonDetector*>(value);
538  for (size_t i = 0; i < input->fSamplingADC.size(); i++)
539  this->fSamplingADC[i] = input->fSamplingADC[i];
540  }
541 
542  if (CompareTDC(value)) {
543  QwComptonPhotonDetector* input = dynamic_cast<QwComptonPhotonDetector*>(value);
544  for (size_t i = 0; i < input->fMultiTDC_Channel.size();i++)
545  this->fMultiTDC_Channel[i] = input->fMultiTDC_Channel[i];
546  }
547 
548  if (CompareQDC(value)) {
549  QwComptonPhotonDetector* input = dynamic_cast<QwComptonPhotonDetector*>(value);
550  for (size_t i = 0; i < input->fMultiQDC_Channel.size();i++)
551  this->fMultiQDC_Channel[i] = input->fMultiQDC_Channel[i];
552  }
553 
554  return *this;
555 }
std::vector< QwPMT_Channel > fMultiTDC_Channel
std::vector< QwPMT_Channel > fMultiQDC_Channel
Bool_t CompareQDC(VQwSubsystem *source)
std::vector< QwSIS3320_Channel > fSamplingADC
Bool_t CompareADC(VQwSubsystem *source)
Class for the analysis of Compton photon detector data.
Bool_t CompareTDC(VQwSubsystem *source)

+ Here is the call graph for this function:

void QwComptonPhotonDetector::PrintErrorCounters ( ) const
inlinevirtual

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

Implements VQwSubsystemParity.

Definition at line 86 of file QwComptonPhotonDetector.h.

86 {};
void QwComptonPhotonDetector::PrintInfo ( ) const
virtual

Print some debugging output for the subcomponents

Reimplemented from VQwSubsystem.

Definition at line 870 of file QwComptonPhotonDetector.cc.

References QwLog::endl(), fMultiQDC_Channel, fMultiTDC_Channel, fSamplingADC, VQwSubsystem::PrintInfo(), and QwOut.

871 {
873 
874  QwOut << " there are " << fSamplingADC.size() << " sampling ADCs" << QwLog::endl;
875  QwOut << " there are " << fMultiTDC_Channel.size() << " integrating TDCs" << QwLog::endl;
876  QwOut << " there are " << fMultiQDC_Channel.size() << " integrating ADCs" << QwLog::endl;
877 
878  for (size_t i = 0; i < fSamplingADC.size(); i++) {
879  QwOut << " sampling ADC " << i << ":";
880  fSamplingADC[i].PrintInfo();
881  }
882  for (size_t i = 0; i < fMultiTDC_Channel.size(); i++) {
883  QwOut << " integrating TDC " << i << ":";
884  fMultiTDC_Channel[i].PrintInfo();
885  }
886  for (size_t i = 0; i < fMultiQDC_Channel.size(); i++) {
887  QwOut << " integrating ADC " << i << ":";
888  fMultiQDC_Channel[i].PrintInfo();
889  }
890 }
std::vector< QwPMT_Channel > fMultiTDC_Channel
#define QwOut
Predefined log drain for explicit output.
Definition: QwLog.h:35
std::vector< QwPMT_Channel > fMultiQDC_Channel
virtual void PrintInfo() const
Print some information about the subsystem.
std::vector< QwSIS3320_Channel > fSamplingADC
static std::ostream & endl(std::ostream &)
End of the line.
Definition: QwLog.cc:299

+ Here is the call graph for this function:

void QwComptonPhotonDetector::PrintValue ( ) const
virtual

Print the value for the subcomponents

Reimplemented from VQwSubsystemParity.

Definition at line 857 of file QwComptonPhotonDetector.cc.

References fMultiQDC_Channel, fMultiTDC_Channel, and fSamplingADC.

858 {
859  for (size_t i = 0; i < fSamplingADC.size(); i++)
861  for (size_t i = 0; i < fMultiTDC_Channel.size(); i++)
863  for (size_t i = 0; i < fMultiQDC_Channel.size(); i++)
865 }
std::vector< QwPMT_Channel > fMultiTDC_Channel
std::vector< QwPMT_Channel > fMultiQDC_Channel
std::vector< QwSIS3320_Channel > fSamplingADC
Int_t QwComptonPhotonDetector::ProcessConfigurationBuffer ( const UInt_t  roc_id,
const UInt_t  bank_id,
UInt_t *  buffer,
UInt_t  num_words 
)
virtual

Process the configuration buffer for this subsystem

Parameters
roc_idROC ID
bank_idSubbank ID
bufferBuffer to read from
num_wordsNumber of words left in buffer
Returns
Number of words read

Implements VQwSubsystem.

Definition at line 485 of file QwComptonPhotonDetector.cc.

486 {
487  return 0;
488 }
Int_t QwComptonPhotonDetector::ProcessEvBuffer ( const UInt_t  roc_id,
const UInt_t  bank_id,
UInt_t *  buffer,
UInt_t  num_words 
)
virtual

Process the event buffer for this subsystem

Parameters
roc_idROC ID
bank_idSubbank ID
bufferBuffer to read from
num_wordsNumber of words left in buffer
Returns
Number of words read

Implements VQwSubsystem.

Definition at line 342 of file QwComptonPhotonDetector.cc.

References MQwV775TDC::DecodeTDCWord(), QwLog::endl(), fMapping, fMultiQDC_Channel, fMultiQDC_Mapping, fMultiTDC_Channel, fMultiTDC_Mapping, fSamplingADC, fSamplingADC_Mapping, VQwSubsystem::GetSubbankIndex(), MQwV775TDC::GetTDCChannelNumber(), MQwV775TDC::GetTDCData(), MQwV775TDC::IsValidDataword(), kIntegratingADC, kIntegratingTDC, kSamplingADC, kUnknown, QwDebug, and QwError.

343 {
344  UInt_t words_read = 0;
345 
346  // Get the subbank index (or -1 when no match)
347  Int_t subbank = GetSubbankIndex(roc_id, bank_id);
348 
349  if (subbank >= 0 && num_words > 0) {
350 
351  // We want to process this ROC. Begin looping through the data.
352 
353  switch (fMapping[subbank]) {
354 
355  // Sampling ADCs
356  case kSamplingADC:
357  {
358  for (size_t modnum = 0; modnum < fSamplingADC_Mapping[subbank].size(); modnum++) {
359  for (size_t channum = 0; channum < fSamplingADC_Mapping[subbank].at(modnum).size(); channum++) {
360  Int_t index = fSamplingADC_Mapping[subbank].at(modnum).at(channum);
361  if (index >= 0) {
362  words_read += fSamplingADC[index].ProcessEvBuffer(&(buffer[words_read]), num_words - words_read);
363  }
364  }
365  }
366  break;
367  }
368 
369  // Integrating ADCs and TDCs
370  case kIntegratingADC:
371  case kIntegratingTDC:
372  {
373  // Read header word
374  UInt_t header = buffer[words_read++];
375  if ((header & 0xbad00dc0) == 0xbad00dc0)
376  break; // Bad ADC/TDC
377 
378  // Parse number of events
379  //UInt_t num_events = 0;
380  //if ((header & 0xda000dc0) == 0xda000dc0)
381  // num_events = (buffer[0] & 0x00FF0000) >> 16;
382  // TODO Multihit functionality
383 
384  // Loop over buffered events
385  for (size_t i = words_read; i < num_words; i++) {
386 
387  // Decode this word as a V775 TDC / V792 QDC word
388  DecodeTDCWord(buffer[i]);
389 
390  // Is this a valid V775 TDC / V792 QDC data word?
391  if (! IsValidDataword()) continue;
392 
393  // Is there an QDC channel registered for this slot and channel?
394  for (size_t modnum = 0; modnum < fMultiQDC_Mapping[subbank].size(); modnum++) {
395  UInt_t channum = GetTDCChannelNumber();
396  if (channum < fMultiQDC_Mapping[subbank].at(modnum).size()) {
397  Int_t index = fMultiQDC_Mapping[subbank].at(modnum).at(channum);
398  if (index >= 0) {
399  fMultiQDC_Channel.at(index).SetValue(GetTDCData());
400  QwDebug << "QDC " << std::hex << subbank << " "
401  << modnum << "," << channum << ": " << std::dec
402  << GetTDCData() << QwLog::endl;
403  }
404  }
405  }
406 
407  // Is there an TDC channel registered for this slot and channel?
408  for (size_t modnum = 0; modnum < fMultiTDC_Mapping[subbank].size(); modnum++) {
409  UInt_t channum = GetTDCChannelNumber();
410  if (channum < fMultiTDC_Mapping[subbank].at(channum).size()) {
411  Int_t index = fMultiTDC_Mapping[subbank].at(modnum).at(channum);
412  if (index >= 0) {
413  fMultiTDC_Channel.at(index).SetValue(GetTDCData());
414  QwDebug << "TDC " << std::hex << subbank << " "
415  << modnum << "," << channum << ": " << std::dec
416  << GetTDCData() << QwLog::endl;
417  }
418  }
419  }
420 
421  } // end of loop over buffered events
422 
423  words_read = num_words;
424  break;
425  }
426 
427  // Unknown data channel type
428  case kUnknown:
429  default:
430  {
431  QwError << "QwComptonPhotonDetector: Unknown data channel type" << QwLog::endl;
432  break;
433  }
434  }
435 
436  // Check for leftover words
437  if (num_words != words_read) {
438  QwError << "QwComptonPhotonDetector: There were "
439  << num_words - words_read
440  << " leftover words after decoding everything we recognize"
441  << std::hex
442  << " in ROC " << roc_id << ", bank " << bank_id << "."
443  << std::dec
444  << QwLog::endl;
445  }
446  }
447 
448  return words_read;
449 }
Int_t GetSubbankIndex() const
Definition: VQwSubsystem.h:303
std::vector< QwPMT_Channel > fMultiTDC_Channel
std::vector< QwPMT_Channel > fMultiQDC_Channel
UInt_t GetTDCChannelNumber()
Definition: MQwV775TDC.h:43
UInt_t GetTDCData()
Definition: MQwV775TDC.h:44
std::map< Int_t, ChannelType_t > fMapping
IntegratingTDC_Mapping_t fMultiTDC_Mapping
#define QwDebug
Predefined log drain for debugging output.
Definition: QwLog.h:60
void DecodeTDCWord(UInt_t &word, const UInt_t roc_id=0)
Definition: MQwV775TDC.cc:53
std::vector< QwSIS3320_Channel > fSamplingADC
SamplingADC_Mapping_t fSamplingADC_Mapping
static std::ostream & endl(std::ostream &)
End of the line.
Definition: QwLog.cc:299
IntegratingADC_Mapping_t fMultiQDC_Mapping
Bool_t IsValidDataword()
Definition: MQwV775TDC.h:39
#define QwError
Predefined log drain for errors.
Definition: QwLog.h:40

+ Here is the call graph for this function:

void QwComptonPhotonDetector::ProcessEvent ( )
virtual

Process this event

Implements VQwSubsystem.

Definition at line 466 of file QwComptonPhotonDetector.cc.

References fMultiQDC_Channel, fMultiTDC_Channel, and fSamplingADC.

467 {
468  for (size_t i = 0; i < fSamplingADC.size(); i++)
470  for (size_t i = 0; i < fMultiTDC_Channel.size(); i++)
472  for (size_t i = 0; i < fMultiQDC_Channel.size(); i++)
474 }
std::vector< QwPMT_Channel > fMultiTDC_Channel
std::vector< QwPMT_Channel > fMultiQDC_Channel
std::vector< QwSIS3320_Channel > fSamplingADC
void QwComptonPhotonDetector::ProcessOptions ( QwOptions options)
virtual

Process the command line options.

Reimplemented from VQwSubsystem.

Definition at line 36 of file QwComptonPhotonDetector.cc.

37 {
38  // Handle command line options
39 }
void QwComptonPhotonDetector::RandomizeEventData ( int  helicity = 0)

Randomize this event with the given helicity

Parameters
helicityHelicity of this event (default is zero)

Definition at line 280 of file QwComptonPhotonDetector.cc.

References fSamplingADC.

281 {
282  // Randomize all gQwSIS3320 buffers
283  for (size_t i = 0; i < fSamplingADC.size(); i++)
284  fSamplingADC[i].RandomizeEventData(helicity);
285 
286  // Randomize all MQwV775TDC buffers
287  //for (size_t i = 0; i < fMultiTDC_Channel.size(); i++)
288  // fMultiTDC_Channel[i].RandomizeEventData(helicity);
289 
290  // Randomize all MQwV792ADC buffers
291  //for (size_t i = 0; i < fMultiQDC_Channel.size(); i++)
292  // fMultiQDC_Channel[i].RandomizeEventData(helicity);
293 }
void RandomizeEventData(int helicity=0)
std::vector< QwSIS3320_Channel > fSamplingADC
void QwComptonPhotonDetector::Ratio ( VQwSubsystem numer,
VQwSubsystem denom 
)
virtual

Determine the ratio of two photon detectors

Parameters
numerNumerator
denomDenominator

Implements VQwSubsystemParity.

Definition at line 618 of file QwComptonPhotonDetector.cc.

References Compare(), and fSamplingADC.

619 {
620  if (Compare(numer) && Compare(denom)) {
621  QwComptonPhotonDetector* innumer = dynamic_cast<QwComptonPhotonDetector*> (numer);
622  QwComptonPhotonDetector* indenom = dynamic_cast<QwComptonPhotonDetector*> (denom);
623  for (size_t i = 0; i < innumer->fSamplingADC.size(); i++)
624  this->fSamplingADC[i].Ratio(innumer->fSamplingADC[i], indenom->fSamplingADC[i]);
625  }
626 }
void Ratio(VQwSubsystem *numer, VQwSubsystem *denom)
Bool_t Compare(VQwSubsystem *source)
std::vector< QwSIS3320_Channel > fSamplingADC
Class for the analysis of Compton photon detector data.

+ Here is the call graph for this function:

void QwComptonPhotonDetector::Scale ( Double_t  factor)
virtual

Scale the photon detector

Parameters
factorScale factor

Implements VQwSubsystemParity.

Definition at line 632 of file QwComptonPhotonDetector.cc.

References fSamplingADC.

Referenced by CalculateRunningAverage().

633 {
634  for (size_t i = 0; i < fSamplingADC.size(); i++)
635  fSamplingADC[i].Scale(factor);
636 }
std::vector< QwSIS3320_Channel > fSamplingADC

+ Here is the caller graph for this function:

Bool_t QwComptonPhotonDetector::SingleEventCuts ( )

Process the single event cuts

Returns

Definition at line 456 of file QwComptonPhotonDetector.cc.

References QwLog::endl(), IsGoodEvent(), and QwDebug.

457 {
458  QwDebug << "QwComptonPhotonDetector::SingleEventCuts()" << QwLog::endl;
459  return IsGoodEvent();
460 }
#define QwDebug
Predefined log drain for debugging output.
Definition: QwLog.h:60
static std::ostream & endl(std::ostream &)
End of the line.
Definition: QwLog.cc:299

+ Here is the call graph for this function:

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

Summation

Parameters
value1First value
value2Second value

Implements VQwSubsystemParity.

Definition at line 592 of file QwComptonPhotonDetector.cc.

References Compare().

593 {
594  if (Compare(value1) && Compare(value2)) {
595  *this = value1;
596  *this += value2;
597  }
598 }
Bool_t Compare(VQwSubsystem *source)

+ Here is the call graph for this function:

void QwComptonPhotonDetector::UpdateErrorFlag ( const VQwSubsystem ev_error)
inlinevirtual

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 90 of file QwComptonPhotonDetector.h.

90  {
91  };

Field Documentation

Int_t QwComptonPhotonDetector::fGoodEventCount
private
std::map< Int_t, ChannelType_t > QwComptonPhotonDetector::fMapping
protected

Definition at line 134 of file QwComptonPhotonDetector.h.

Referenced by LoadChannelMap(), and ProcessEvBuffer().

std::vector< std::vector< QwPMT_Channel > > QwComptonPhotonDetector::fMultiQDC_Events
protected

Definition at line 145 of file QwComptonPhotonDetector.h.

IntegratingADC_Mapping_t QwComptonPhotonDetector::fMultiQDC_Mapping
protected

Definition at line 143 of file QwComptonPhotonDetector.h.

Referenced by LoadChannelMap(), and ProcessEvBuffer().

std::vector< std::vector< QwPMT_Channel > > QwComptonPhotonDetector::fMultiTDC_Events
protected

Definition at line 151 of file QwComptonPhotonDetector.h.

IntegratingTDC_Mapping_t QwComptonPhotonDetector::fMultiTDC_Mapping
protected

Definition at line 149 of file QwComptonPhotonDetector.h.

Referenced by LoadChannelMap(), and ProcessEvBuffer().

SamplingADC_Mapping_t QwComptonPhotonDetector::fSamplingADC_Mapping
protected

Definition at line 138 of file QwComptonPhotonDetector.h.

Referenced by LoadChannelMap(), and ProcessEvBuffer().

TTree* QwComptonPhotonDetector::fTree
protected

Expert tree.

Definition at line 128 of file QwComptonPhotonDetector.h.

Referenced by ConstructTree(), DeleteTree(), and FillTree().

Int_t QwComptonPhotonDetector::fTree_fNEvents
protected

Expert tree fields.

Definition at line 130 of file QwComptonPhotonDetector.h.

Referenced by ConstructTree(), and FillTree().

const Bool_t QwComptonPhotonDetector::kDebug = kTRUE
staticprivate

Definition at line 158 of file QwComptonPhotonDetector.h.


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