QwAnalysis
QwBeamMod Class Reference

#include <QwBeamMod.h>

+ Inheritance diagram for QwBeamMod:
+ Collaboration diagram for QwBeamMod:

Public Member Functions

 QwBeamMod (const TString &name)
 Constructor with name. More...
 
 QwBeamMod (const QwBeamMod &source)
 Copy constructor. More...
 
virtual ~QwBeamMod ()
 Virtual destructor. More...
 
void ProcessOptions (QwOptions &options)
 Process the command line options. More...
 
void AccumulateRunningSum (VQwSubsystem *)
 Update the running sums for devices. More...
 
void DeaccumulateRunningSum (VQwSubsystem *value)
 remove one entry from the running sums for devices More...
 
Int_t LoadChannelMap (TString mapfile)
 Mandatory map file definition. More...
 
Int_t LoadEventCuts (TString filename)
 Load the event cuts file. More...
 
Int_t LoadGeometry (TString mapfile)
 
Int_t LoadInputParameters (TString pedestalfile)
 Mandatory parameter file definition. 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 ()
 
void ProcessEvent ()
 
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...
 
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...
 
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 CalculateRunningAverage ()
 Calculate the average for all good events. More...
 
void PrintModChannelID ()
 
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_MPS (QwParityDB *db, TString datatype)
 Fill the database with MPS-based variables Note that most subsystems don't need to do this. More...
 
void FillDB (QwParityDB *db, TString datatype)
 Fill the database. More...
 
void FillErrDB (QwParityDB *db, TString datatype)
 
void WritePromptSummary (QwPromptSummary *ps, TString type)
 
Bool_t Compare (VQwSubsystem *source)
 
void Print ()
 
void AtEndOfEventLoop ()
 Perform actions at the end of the event loop. More...
 
void AnalyzeOpticsPlots ()
 
void ResizeOpticsDataContainers (Int_t)
 
void ClearVectors ()
 
Double_t GetAmplitudeSign (Double_t, Double_t, Double_t, Double_t)
 
- 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 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 PrintValue () const
 Print values of all channels. 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 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 RandomizeEventData (int helicity=0, double time=0.0)
 
virtual void EncodeEventData (std::vector< UInt_t > &buffer)
 
virtual void PrintInfo () const
 Print some information about the subsystem. More...
 
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...
 
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, QwBeamMod >
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...
 

Data Fields

std::vector< TString > fgModTypeNames
 

Protected Member Functions

Int_t GetDetectorTypeID (TString name)
 
Int_t GetDetectorIndex (Int_t 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

Int_t fTreeArrayIndex
 
std::vector< QwVQWK_ChannelfModChannel
 
std::vector< QwModChannelIDfModChannelID
 
std::vector< QwWordfWord
 
std::vector< std::pair< Int_t,
Int_t > > 
fWordsPerSubbank
 
- 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

 QwBeamMod ()
 

Private Attributes

UInt_t fFFB_Index
 
UInt_t fFFB_holdoff
 
UInt_t fFFB_holdoff_Counter
 
UInt_t fFFB_ErrorFlag
 
Bool_t fFFB_Flag
 
std::vector< TString > fMonitorNames
 
std::vector< QwVQWK_ChannelfMonitors
 
std::vector< Double_t > fBPMPosition
 
std::vector< std::vector
< Double_t > > 
fAmplitude
 
std::vector< std::vector
< Double_t > > 
fOffset
 
std::vector< std::vector
< Double_t > > 
fPhase
 
std::vector< std::vector
< Double_t > > 
fAmplitudeError
 
std::vector< std::vector
< Double_t > > 
fOffsetError
 
std::vector< std::vector
< Double_t > > 
fPhaseError
 
std::vector< std::vector
< Double_t > > 
fChisquare
 
std::vector< std::vector< Int_t > > fNFitPoints
 
Int_t fRampChannelIndex
 
Int_t fPatternWordIndex
 

Static Private Attributes

static const Bool_t bDEBUG =kFALSE
 
static const Int_t fNumberPatterns = 5
 

Additional Inherited Members

- 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, QwBeamMod >
static VQwSubsystemCreate (const std::string &name)
 Object creation. More...
 
static QwBeamModCast (QwBeamMod *type)
 Object dynamic cast. More...
 

Detailed Description

Definition at line 41 of file QwBeamMod.h.

Constructor & Destructor Documentation

QwBeamMod::QwBeamMod ( )
private
QwBeamMod::QwBeamMod ( const TString &  name)
inline

Constructor with name.

Definition at line 49 of file QwBeamMod.h.

References fFFB_Flag, fFFB_holdoff_Counter, fgModTypeNames, fPatternWordIndex, and fRampChannelIndex.

50  : VQwSubsystem(name),VQwSubsystemParity(name)
51  {
52  // these declaration need to be coherent with the enum vector EBeamInstrumentType
53  fgModTypeNames.push_back(""); // Need to define these wrt to our detector types.
54  fgModTypeNames.push_back("");
55  fgModTypeNames.push_back("");
56  fgModTypeNames.push_back("");
57  for(size_t i=0;i<fgModTypeNames.size();i++)
58  fgModTypeNames[i].ToLower();
60  fFFB_Flag=kTRUE;
61  fRampChannelIndex = -1;
62  fPatternWordIndex = -1;
63  };
Int_t fRampChannelIndex
Definition: QwBeamMod.h:190
UInt_t fFFB_holdoff_Counter
Definition: QwBeamMod.h:166
Bool_t fFFB_Flag
Definition: QwBeamMod.h:168
Int_t fPatternWordIndex
Definition: QwBeamMod.h:191
std::vector< TString > fgModTypeNames
Definition: QwBeamMod.h:72
VQwSubsystemParity()
Private default constructor (not implemented, will throw linker error on use)
QwBeamMod::QwBeamMod ( const QwBeamMod source)
inline

Copy constructor.

Definition at line 65 of file QwBeamMod.h.

66  : VQwSubsystem(source),VQwSubsystemParity(source),
67  fModChannel(source.fModChannel),fWord(source.fWord),
70  { }
std::vector< TString > fMonitorNames
Definition: QwBeamMod.h:175
std::vector< QwWord > fWord
Definition: QwBeamMod.h:157
std::vector< QwVQWK_Channel > fModChannel
Definition: QwBeamMod.h:155
std::vector< QwVQWK_Channel > fMonitors
Definition: QwBeamMod.h:176
std::vector< Double_t > fBPMPosition
Definition: QwBeamMod.h:177
VQwSubsystemParity()
Private default constructor (not implemented, will throw linker error on use)
virtual QwBeamMod::~QwBeamMod ( )
inlinevirtual

Virtual destructor.

Definition at line 72 of file QwBeamMod.h.

72 {};

Member Function Documentation

void QwBeamMod::AccumulateRunningSum ( VQwSubsystem value)
virtual

Update the running sums for devices.

Implements VQwSubsystemParity.

Definition at line 662 of file QwBeamMod.cc.

662 { }
void QwBeamMod::AnalyzeOpticsPlots ( )

Definition at line 827 of file QwBeamMod.cc.

References QwLog::endl(), fAmplitude, fAmplitudeError, fChisquare, MQwHistograms::fHistograms, fMonitorNames, fMonitors, fNFitPoints, fOffset, fOffsetError, fPhase, fPhaseError, GetAmplitudeSign(), QwDebug, and ResizeOpticsDataContainers().

Referenced by AtEndOfEventLoop().

828 {
829  // How to get the run info:
830  // UInt_t runnum = this->GetParent()->GetCodaRunNumber();
831  // UInt_t segnum = this->GetParent()->GetCodaSegmentNumber();
832 
833  TF1 *sine = new TF1("sine", "[0] + [1]*sin(TMath::DegToRad()*x + [2])", 5, 350);
834 
835  TCanvas *canvas = new TCanvas("canvas", "canvas", 5);
836 
837  //Double_t mean; // unused
838  Double_t amplitude;
839  Double_t phase;
840 
842 
843  canvas->cd();
844  for(size_t bpm = 0; bpm < fMonitors.size(); bpm++){
845 
846  for(size_t pattern = 0; pattern < 5; pattern++){
847  // Only do the fits if there are more than three entries.
848  if (fHistograms[5*bpm + pattern]->GetEntries()>3){
849  sine->SetParameters(fHistograms[5*bpm + pattern]->GetMean(), 0.10, 0);
850  sine->SetLineColor(2);
851  sine->SetParLimits(2, 0, TMath::Pi()*2 );
852  fHistograms[5*bpm + pattern]->Fit("sine","R B");
853 
854  //mean = sine->GetParameter(0); // unused
855  amplitude = TMath::Abs(sine->GetParameter(1));
856  phase = sine->GetParameter(2) * TMath::RadToDeg();
857 
858  amplitude *= GetAmplitudeSign(sine->Derivative(10),
859  sine->Derivative2(10),
860  sine->Derivative3(10),
861  sine->GetParameter(0));
862 
863  if(phase >= 180){
864  phase -= 180;
865 // amplitude = -amplitude;
866  } else if (phase < 0){
867  phase += 180;
868 // amplitude = -amplitude;
869  }
870  fOffset[bpm][pattern] = sine->GetParameter(0);
871  fAmplitude[bpm][pattern] = amplitude;
872  fPhase[bpm][pattern] = phase;
873  fOffsetError[bpm][pattern] = sine->GetParError(0);
874  fAmplitudeError[bpm][pattern] = sine->GetParError(1);
875  fPhaseError[bpm][pattern] = sine->GetParError(2);
876  fChisquare[bpm][pattern] = sine->GetChisquare();
877  fNFitPoints[bpm][pattern] = sine->GetNumberFitPoints();
878  } else {
879  QwDebug << "QwBeamMod can't fit [" << bpm << "][" << pattern
880  << "] because there are only "
881  << fHistograms[5*bpm + pattern]->GetEntries()
882  << " entries, and we need at least 3."
883  << QwLog::endl;
884  // No events in this histogram. Zero-out the fit results
885  fOffset[bpm][pattern] = 0.0;
886  fAmplitude[bpm][pattern] = 0.0;
887  fPhase[bpm][pattern] = 0.0;
888  fOffsetError[bpm][pattern] = 0.0;
889  fAmplitudeError[bpm][pattern] = 0.0;
890  fPhaseError[bpm][pattern] = 0.0;
891  fChisquare[bpm][pattern] = 0.0;
892  fNFitPoints[bpm][pattern] = 0;
893  }
894  }
895  }
896  delete canvas;
897  delete sine;
898 }
std::vector< std::vector< Double_t > > fAmplitude
Definition: QwBeamMod.h:179
std::vector< TString > fMonitorNames
Definition: QwBeamMod.h:175
std::vector< TH1_ptr > fHistograms
Histograms associated with this data element.
Definition: MQwHistograms.h:46
std::vector< std::vector< Double_t > > fPhaseError
Definition: QwBeamMod.h:185
void ResizeOpticsDataContainers(Int_t)
Definition: QwBeamMod.cc:804
std::vector< std::vector< Int_t > > fNFitPoints
Definition: QwBeamMod.h:188
#define QwDebug
Predefined log drain for debugging output.
Definition: QwLog.h:60
std::vector< std::vector< Double_t > > fChisquare
Definition: QwBeamMod.h:187
std::vector< QwVQWK_Channel > fMonitors
Definition: QwBeamMod.h:176
static std::ostream & endl(std::ostream &)
End of the line.
Definition: QwLog.cc:299
std::vector< std::vector< Double_t > > fOffset
Definition: QwBeamMod.h:180
std::vector< std::vector< Double_t > > fPhase
Definition: QwBeamMod.h:181
Double_t GetAmplitudeSign(Double_t, Double_t, Double_t, Double_t)
Definition: QwBeamMod.cc:900
std::vector< std::vector< Double_t > > fAmplitudeError
Definition: QwBeamMod.h:183
std::vector< std::vector< Double_t > > fOffsetError
Definition: QwBeamMod.h:184

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Bool_t QwBeamMod::ApplySingleEventCuts ( )
virtual

Apply the single event cuts.

Implements VQwSubsystemParity.

Definition at line 414 of file QwBeamMod.cc.

References bDEBUG, fFFB_ErrorFlag, fFFB_Flag, fFFB_holdoff, fFFB_holdoff_Counter, fFFB_Index, fModChannel, fWord, kBModErrorFlag, kBModFFBErrorFlag, kEventCutMode3, and kGlobalCut.

414  {
415 
416  Bool_t test_Mod=kTRUE;
417  Bool_t test_BCM1=kTRUE;
418 
419 
420  for(size_t i=0;i<fModChannel.size();i++){
421  //std::cout<<" BCM ["<<i<<"] "<<std::endl;
422  test_BCM1 = fModChannel[i].ApplySingleEventCuts();
423  test_Mod &= test_BCM1;
424  if(!test_BCM1 && bDEBUG) std::cout<<"******* QwBeamMod::SingleEventCuts()->BCM[ "<<i<<" , "<<fModChannel[i].GetElementName()<<" ] ******\n";
425  }
426 
427  if (fWord[fFFB_Index].fValue==8 && fFFB_Flag && fFFB_holdoff_Counter==0){
429  fFFB_Flag=kFALSE;
430 
431  }
435  if(fFFB_holdoff_Counter==0)
436  fFFB_Flag=kTRUE;
437  }else
438  fFFB_ErrorFlag=0;
439 
440 
441 
442  return test_Mod;
443 
444 }
UInt_t fFFB_ErrorFlag
Definition: QwBeamMod.h:167
UInt_t fFFB_holdoff_Counter
Definition: QwBeamMod.h:166
static const UInt_t kBModErrorFlag
Definition: QwTypes.h:172
UInt_t fFFB_holdoff
Definition: QwBeamMod.h:165
Bool_t fFFB_Flag
Definition: QwBeamMod.h:168
UInt_t fFFB_Index
Definition: QwBeamMod.h:164
static const Bool_t bDEBUG
Definition: QwBeamMod.h:169
std::vector< QwWord > fWord
Definition: QwBeamMod.h:157
std::vector< QwVQWK_Channel > fModChannel
Definition: QwBeamMod.h:155
static const UInt_t kEventCutMode3
Definition: QwTypes.h:173
static const UInt_t kGlobalCut
Definition: QwTypes.h:176
static const UInt_t kBModFFBErrorFlag
Definition: QwTypes.h:171
void QwBeamMod::AtEndOfEventLoop ( )
virtual

Perform actions at the end of the event loop.

Reimplemented from VQwSubsystem.

Definition at line 784 of file QwBeamMod.cc.

References AnalyzeOpticsPlots().

785 {
786 
788 
789 }
void AnalyzeOpticsPlots()
Definition: QwBeamMod.cc:827

+ Here is the call graph for this function:

void QwBeamMod::CalculateRunningAverage ( )
virtual

Calculate the average for all good events.

Implements VQwSubsystemParity.

Definition at line 660 of file QwBeamMod.cc.

660 { }
void QwBeamMod::ClearEventData ( )
virtual

Implements VQwSubsystem.

Definition at line 521 of file QwBeamMod.cc.

References fModChannel, and fWord.

522 {
523  for(size_t i=0;i<fModChannel.size();i++)
525 
526  for (size_t i=0;i<fWord.size();i++)
527  fWord[i].ClearEventData();
528 }
std::vector< QwWord > fWord
Definition: QwBeamMod.h:157
std::vector< QwVQWK_Channel > fModChannel
Definition: QwBeamMod.h:155
void ClearEventData()
Definition: QwBeamMod.cc:521
void QwBeamMod::ClearVectors ( )

Definition at line 791 of file QwBeamMod.cc.

References fAmplitude, fAmplitudeError, fChisquare, fNFitPoints, fOffset, fOffsetError, fPhase, and fPhaseError.

792 {
793  fOffset.clear();
794  fAmplitude.clear();
795  fPhase.clear();
796  fOffsetError.clear();
797  fAmplitudeError.clear();
798  fPhaseError.clear();
799  fChisquare.clear();
800  fNFitPoints.clear();
801 
802 }
std::vector< std::vector< Double_t > > fAmplitude
Definition: QwBeamMod.h:179
std::vector< std::vector< Double_t > > fPhaseError
Definition: QwBeamMod.h:185
std::vector< std::vector< Int_t > > fNFitPoints
Definition: QwBeamMod.h:188
std::vector< std::vector< Double_t > > fChisquare
Definition: QwBeamMod.h:187
std::vector< std::vector< Double_t > > fOffset
Definition: QwBeamMod.h:180
std::vector< std::vector< Double_t > > fPhase
Definition: QwBeamMod.h:181
std::vector< std::vector< Double_t > > fAmplitudeError
Definition: QwBeamMod.h:183
std::vector< std::vector< Double_t > > fOffsetError
Definition: QwBeamMod.h:184
Bool_t QwBeamMod::Compare ( VQwSubsystem source)

Definition at line 664 of file QwBeamMod.cc.

References fModChannel.

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

665 {
666  Bool_t res = kTRUE;
667  if(typeid(*value)!=typeid(*this))
668  {
669  res=kFALSE;
670  // std::cout<<" types are not ok \n";
671  // std::cout<<" this is bypassed just for now but should be fixed eventually \n";
672  }
673  else
674  {
675  QwBeamMod* input = dynamic_cast<QwBeamMod*>(value);
676 
677  if(input->fModChannel.size()!=fModChannel.size())
678  {
679  res=kFALSE;
680  // std::cout<<" not the same number of bcms \n";
681  }
682  }
683  return res;
684 }
std::vector< QwVQWK_Channel > fModChannel
Definition: QwBeamMod.h:155

+ Here is the caller graph for this function:

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

Construct the branch and tree vector.

Implements VQwSubsystem.

Definition at line 129 of file QwBeamMod.h.

129 { };
void QwBeamMod::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 130 of file QwBeamMod.h.

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

Construct the branch and tree vector.

Implements VQwSubsystem.

Definition at line 924 of file QwBeamMod.cc.

References fModChannel, fTreeArrayIndex, and fWord.

925 {
926  TString basename;
927 
928  for(size_t i = 0; i < fModChannel.size(); i++)
929  fModChannel[i].ConstructBranchAndVector(tree, prefix, values);
930 // for (size_t i=0;i<fWord.size();i++)
931 // fWord[i].ConstructBranchAndVector(tree, prefix, values);
932  fTreeArrayIndex = values.size();
933  for (size_t i=0; i<fWord.size(); i++)
934  {
935 // basename = fWord[i].fWordName;
936  basename = prefix+fWord[i].fWordName;
937  values.push_back(0.0);
938  tree->Branch(basename, &(values.back()), basename+"/D");
939  }
940 }
std::vector< QwWord > fWord
Definition: QwBeamMod.h:157
std::vector< QwVQWK_Channel > fModChannel
Definition: QwBeamMod.h:155
Int_t fTreeArrayIndex
Definition: QwBeamMod.h:152
void ConstructBranchAndVector(TTree *tree, TString &prefix, std::vector< Double_t > &values)
Construct the branch and tree vector.
Definition: QwBeamMod.cc:924
void QwBeamMod::ConstructHistograms ( TDirectory *  folder,
TString &  prefix 
)
virtual

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

Implements VQwSubsystem.

Definition at line 689 of file QwBeamMod.cc.

References QwHistogramHelper::Construct1DProf(), MQwHistograms::fHistograms, fModChannel, fMonitorNames, and gQwHists.

690 {
691  // Go to the specified folder
692  if (folder != NULL) folder->cd();
693 
694  // No histogram creation for asym, yield, diff, etc
695  if (prefix != "") return;
696 
697  TString basename;
698  for (size_t bpm = 0; bpm < fMonitorNames.size(); bpm++) {
699  // Find histogram with correct name
700  basename = TString("bmod_") + prefix + fMonitorNames[bpm];
701  fHistograms.push_back(gQwHists.Construct1DProf(basename + "_X"));
702  fHistograms.push_back(gQwHists.Construct1DProf(basename + "_Y"));
703  fHistograms.push_back(gQwHists.Construct1DProf(basename + "_E"));
704  fHistograms.push_back(gQwHists.Construct1DProf(basename + "_XP"));
705  fHistograms.push_back(gQwHists.Construct1DProf(basename + "_YP"));
706  }
707 
708  // Beam modulation correlations
709  for (size_t chan = 0; chan < fModChannel.size(); chan++) {
710  // Find histogram with correct name
711  basename = TString("bmod_") + prefix + fModChannel[chan].GetElementName();
712  fHistograms.push_back(gQwHists.Construct1DProf(basename + "_X"));
713  fHistograms.push_back(gQwHists.Construct1DProf(basename + "_Y"));
714  fHistograms.push_back(gQwHists.Construct1DProf(basename + "_E"));
715  fHistograms.push_back(gQwHists.Construct1DProf(basename + "_XP"));
716  fHistograms.push_back(gQwHists.Construct1DProf(basename + "_YP"));
717  }
718 
719  // Beam modulation channels
720  //for (size_t i = 0; i < fModChannel.size(); i++)
721  // fModChannel[i].ConstructHistograms(folder,prefix);
722 }
std::vector< TString > fMonitorNames
Definition: QwBeamMod.h:175
std::vector< TH1_ptr > fHistograms
Histograms associated with this data element.
Definition: MQwHistograms.h:46
std::vector< QwVQWK_Channel > fModChannel
Definition: QwBeamMod.h:155
QwHistogramHelper gQwHists
Globally defined instance of the QwHistogramHelper class.
TProfile * Construct1DProf(const TString &name_title)

+ Here is the call graph for this function:

void QwBeamMod::DeaccumulateRunningSum ( VQwSubsystem value)
inlinevirtual

remove one entry from the running sums for devices

Implements VQwSubsystemParity.

Definition at line 81 of file QwBeamMod.h.

81  {
82  };
void QwBeamMod::Difference ( VQwSubsystem value1,
VQwSubsystem value2 
)
virtual

Implements VQwSubsystemParity.

Definition at line 627 of file QwBeamMod.cc.

References Compare().

628 {
629  if(Compare(value1)&&Compare(value2))
630  {
631  *this = value1;
632  *this -= value2;
633  }
634 }
Bool_t Compare(VQwSubsystem *source)
Definition: QwBeamMod.cc:664

+ Here is the call graph for this function:

void QwBeamMod::ExchangeProcessedData ( )
virtual

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.

Reimplemented from VQwSubsystem.

Definition at line 494 of file QwBeamMod.cc.

References QwLog::endl(), fMonitorNames, fMonitors, QwError, and VQwSubsystem::RequestExternalValue().

495 {
496  // Make sure sizes are equal
497  if (fMonitorNames.size() != fMonitors.size())
498  QwError << "QwBeamMod: Sizes of fBPMnames and fBPMs do not match!" << QwLog::endl;
499  // Loop over BPMs
500  for (size_t bpm = 0; bpm < fMonitorNames.size(); bpm++) {
501  // Get references to external values
502  if (! RequestExternalValue(fMonitorNames[bpm],&fMonitors[bpm]))
503  QwError << "QwBeamMod: RequestExternalValue for " << fMonitorNames[bpm]
504  << " failed!" << QwLog::endl;
505  }
506 }
std::vector< TString > fMonitorNames
Definition: QwBeamMod.h:175
std::vector< QwVQWK_Channel > fMonitors
Definition: QwBeamMod.h:176
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 QwError
Predefined log drain for errors.
Definition: QwLog.h:40

+ Here is the call graph for this function:

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

Fill the database.

Reimplemented from VQwSubsystemParity.

Definition at line 1053 of file QwBeamMod.cc.

1054 {
1055  return;
1056 }
void QwBeamMod::FillDB_MPS ( QwParityDB db,
TString  type 
)
virtual

Fill the database with MPS-based variables Note that most subsystems don't need to do this.

Reimplemented from VQwSubsystemParity.

Definition at line 995 of file QwBeamMod.cc.

References QwDatabase::Connect(), QwDatabase::Disconnect(), QwLog::endl(), fAmplitude, fAmplitudeError, fChisquare, fMonitorNames, fMonitors, fNFitPoints, fOffset, fOffsetError, fPhase, fPhaseError, QwParityDB::GetAnalysisID(), QwParityDB::GetMonitorID(), Qw::kBoldRed, Qw::kGreen, Qw::kNormal, QwDatabase::Query(), and QwMessage.

996 {
997  Bool_t local_print_flag = false;
998 
999  if(local_print_flag) {
1000  QwMessage << " --------------------------------------------------------------- " << QwLog::endl;
1001  QwMessage << " QwBeamMod::FillDB_MPS " << QwLog::endl;
1002  QwMessage << " --------------------------------------------------------------- " << QwLog::endl;
1003  }
1004 
1005  std::vector<QwParitySSQLS::beam_optics> entrylist;
1006 
1007  QwParitySSQLS::beam_optics row;
1008 
1009  UInt_t analysis_id = db->GetAnalysisID();
1010 
1011  for(size_t bpm = 0; bpm < fMonitors.size(); bpm++){
1012  for(size_t pattern = 0; pattern < 5; pattern++){
1013  // Explicitly zero the beam optics ID to ensure a non-sensical default
1014  // is not picked up.
1015  row.beam_optics_id = 0;
1016  row.analysis_id = analysis_id;
1017  row.monitor_id = db->GetMonitorID(fMonitorNames[bpm].Data());
1018  row.modulation_type_id = pattern;
1019  row.n = fNFitPoints[bpm][pattern];
1020  row.offset = fOffset[bpm][pattern];
1021  row.amplitude = fAmplitude[bpm][pattern];
1022  row.phase = fPhase[bpm][pattern];
1023  row.o_error = fOffsetError[bpm][pattern];
1024  row.a_error = fAmplitudeError[bpm][pattern];
1025  row.p_error = fPhaseError[bpm][pattern];
1026  row.gof_para = fChisquare[bpm][pattern];
1027 
1028  entrylist.push_back(row);
1029  }
1030  }
1031 
1032  if(local_print_flag) {
1033  QwMessage << QwColor(Qw::kGreen) << "Entrylist Size : "
1034  << QwColor(Qw::kBoldRed) << entrylist.size()
1036  }
1037 
1038  db->Connect();
1039  // Check the entrylist size, if it isn't zero, start to query..
1040  if( entrylist.size() ) {
1041  mysqlpp::Query query= db->Query();
1042  query.insert(entrylist.begin(), entrylist.end());
1043  query.execute();
1044  }
1045  else {
1046  QwMessage << "QwBeamMod::FillDB_MPS :: Nothing to insert in database." << QwLog::endl;
1047  }
1048  db->Disconnect();
1049 
1050  return;
1051 }
#define QwMessage
Predefined log drain for regular messages.
Definition: QwLog.h:50
std::vector< std::vector< Double_t > > fAmplitude
Definition: QwBeamMod.h:179
UInt_t GetMonitorID(const string &name, Bool_t zero_id_is_error=kTRUE)
Definition: QwParityDB.cc:618
void Disconnect()
Definition: QwDatabase.h:59
std::vector< TString > fMonitorNames
Definition: QwBeamMod.h:175
Bool_t Connect()
Open a connection to the database using the predefined parameters.
Definition: QwDatabase.cc:175
std::vector< std::vector< Double_t > > fPhaseError
Definition: QwBeamMod.h:185
UInt_t GetAnalysisID()
Definition: QwParityDB.h:71
std::vector< std::vector< Int_t > > fNFitPoints
Definition: QwBeamMod.h:188
mysqlpp::Query Query(const char *qstr=0)
Definition: QwDatabase.h:66
std::vector< std::vector< Double_t > > fChisquare
Definition: QwBeamMod.h:187
std::vector< QwVQWK_Channel > fMonitors
Definition: QwBeamMod.h:176
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
std::vector< std::vector< Double_t > > fOffset
Definition: QwBeamMod.h:180
std::vector< std::vector< Double_t > > fPhase
Definition: QwBeamMod.h:181
std::vector< std::vector< Double_t > > fAmplitudeError
Definition: QwBeamMod.h:183
std::vector< std::vector< Double_t > > fOffsetError
Definition: QwBeamMod.h:184

+ Here is the call graph for this function:

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

Reimplemented from VQwSubsystemParity.

Definition at line 1058 of file QwBeamMod.cc.

1059 {
1060  return;
1061 }
void QwBeamMod::FillHistograms ( )
virtual

Fill the histograms for this subsystem.

Implements VQwSubsystem.

Definition at line 724 of file QwBeamMod.cc.

References MQwHistograms::fHistograms, fModChannel, fMonitors, fPatternWordIndex, fRampChannelIndex, fWord, and VQwSubsystem::HasDataLoaded().

Referenced by ProcessEvent_2().

725 {
726  // No data loaded
727  if (! HasDataLoaded()) return;
728 
729  // No histograms defined
730  if (fHistograms.size() == 0) return;
731 
732  // Beam modulation channels
733  //for (size_t i = 0; i < fModChannel.size(); i++)
734  // fModChannel[i].FillHistograms();
735 
736  // Do we have a ramp channel?
737  if (fRampChannelIndex < 0 || fRampChannelIndex > Int_t(fModChannel.size())) return;
738 
739  // Do we have a pattern word?
740  if (fPatternWordIndex < 0 || fPatternWordIndex > Int_t(fWord.size())) return;
741 
742  // Determine the ramp/phase
743  Double_t ramp = fModChannel[fRampChannelIndex].GetValue();
744  if (ramp < 0) return;
745 
746  // Determine the pattern number -- the pattern number for single coil is
747  // between [0, 4] so we need to check for this.
748  Int_t pattern = -1;
749 
750  if(fWord[fPatternWordIndex].fValue < 11 && fWord[fPatternWordIndex].fValue > 0)
751  pattern = fWord[fPatternWordIndex].fValue;
752  else
753  pattern = fWord[fPatternWordIndex].fValue - 11;
754 
755  if (pattern < 0 || pattern > 4) return;
756 
757  // Fill histograms for all BPMs and each of the modulation patterns
758  //
759  // Due to the the way the ADC averages the ramp signal we want to filter
760  // out events at the edged of the signal.
761  //
762  // Seperated the ramp cut here because it is ridiculously long...
763  //
764 
765  Double_t ramp_block_41 = fModChannel[fRampChannelIndex].GetValue(4) + fModChannel[fRampChannelIndex].GetValue(1);
766  Double_t ramp_block_32 = fModChannel[fRampChannelIndex].GetValue(3) + fModChannel[fRampChannelIndex].GetValue(2);
767  Double_t ramp_block = ramp_block_41 - ramp_block_32;
768 
769  // Require the difference between the block1/4 average and
770  // the block2/3 average to be within 5 degrees.
771  // In run 9636, the distribution of ramp_block has a sigma of 0.5 degrees.
772  if( ramp_block < 5.0 && ramp_block > -5.0 ){
773  for (size_t bpm = 0; bpm < fMonitors.size(); bpm++){
774  fHistograms[5 * bpm + pattern]->Fill(ramp,fMonitors[bpm].GetValue());
775  }
776 
777  // Beam modulation correlations
778  for (size_t chan = 0; chan < fModChannel.size(); chan++){
779  fHistograms[5 * (fMonitors.size() + chan) + pattern]->Fill(ramp,fModChannel[chan].GetValue());
780  }
781  }
782 }
Int_t fRampChannelIndex
Definition: QwBeamMod.h:190
std::vector< TH1_ptr > fHistograms
Histograms associated with this data element.
Definition: MQwHistograms.h:46
Bool_t HasDataLoaded() const
Definition: VQwSubsystem.h:94
std::vector< QwWord > fWord
Definition: QwBeamMod.h:157
std::vector< QwVQWK_Channel > fModChannel
Definition: QwBeamMod.h:155
std::vector< QwVQWK_Channel > fMonitors
Definition: QwBeamMod.h:176
Int_t fPatternWordIndex
Definition: QwBeamMod.h:191

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void QwBeamMod::FillTreeVector ( std::vector< Double_t > &  values) const
virtual

Fill the tree vector.

Implements VQwSubsystem.

Definition at line 942 of file QwBeamMod.cc.

References fModChannel, fTreeArrayIndex, and fWord.

943 {
944  size_t index = fTreeArrayIndex;
945 
946  for (size_t i = 0; i < fModChannel.size(); i++)
947  fModChannel[i].FillTreeVector(values);
948  for (size_t i = 0; i < fWord.size(); i++)
949  values[index++] = fWord[i].fValue;
950 }
std::vector< QwWord > fWord
Definition: QwBeamMod.h:157
std::vector< QwVQWK_Channel > fModChannel
Definition: QwBeamMod.h:155
Int_t fTreeArrayIndex
Definition: QwBeamMod.h:152
void FillTreeVector(std::vector< Double_t > &values) const
Fill the tree vector.
Definition: QwBeamMod.cc:942
Double_t QwBeamMod::GetAmplitudeSign ( Double_t  d1,
Double_t  d2,
Double_t  d3,
Double_t  fmean 
)

Definition at line 900 of file QwBeamMod.cc.

Referenced by AnalyzeOpticsPlots().

901 {
902 
903  Double_t sign = 0.0;
904 
905  if(d1 > 0.0 && d2 < 0.0) sign = 1.0;
906  else if(d1 == 0.0 && fmean > 0.0) sign = 1.0;
907  else if(d1 < 0.0 && d2 < 0.0) sign = 1.0;
908 
909  else if(d1 < 0.0 && d3 < 0) sign = 1.0;
910 
911  else if(d1 < 0.0 && d2 > 0.0) sign = -1.0;
912  else if(d1 == 0.0 && fmean < 0.0) sign = -1.0;
913  else if(d1 > 0.0 && d2 > 0.0) sign = -1.0;
914 
915  else if(d1 < 0.0 && d3 > 0) sign = -1.0;
916 
917  else
918  sign = 1.0;
919 
920  return(sign);
921 
922 }

+ Here is the caller graph for this function:

Int_t QwBeamMod::GetDetectorIndex ( Int_t  TypeID,
TString  name 
)
protected

Definition at line 541 of file QwBeamMod.cc.

References fModChannelID.

Referenced by LoadEventCuts().

542 {
543  Bool_t ldebug=kFALSE;
544  if(ldebug)
545  {
546  std::cout<<"QwBeamMod::GetDetectorIndex\n";
547  std::cout<<"type_id=="<<type_id<<" name="<<name<<"\n";
548  std::cout<<fModChannelID.size()<<" already registered detector\n";
549  }
550 
551  Int_t result=-1;
552  for(size_t i=0;i<fModChannelID.size();i++)
553  {
554 
555  if(fModChannelID[i].fmodulename==name)
556  result=fModChannelID[i].fIndex;
557  if(ldebug)
558  {
559  std::cout<<"testing against ("<<fModChannelID[i].fTypeID
560  <<","<<fModChannelID[i].fmodulename<<")=>"<<result<<"\n";
561  }
562  }
563 
564  return result;
565 }
std::vector< QwModChannelID > fModChannelID
Definition: QwBeamMod.h:156

+ Here is the caller graph for this function:

Int_t QwBeamMod::GetDetectorTypeID ( TString  name)
protected

Definition at line 531 of file QwBeamMod.cc.

References fgModTypeNames.

Referenced by LoadEventCuts().

532 {
533  Int_t result=-1;
534  for(size_t i=0;i<fgModTypeNames.size();i++)
535  if(name==fgModTypeNames[i])
536  {result=i;i=fgModTypeNames.size()+1;}
537  return result;
538 }
std::vector< TString > fgModTypeNames
Definition: QwBeamMod.h:72

+ Here is the caller graph for this function:

UInt_t QwBeamMod::GetEventcutErrorFlag ( )
virtual

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

Implements VQwSubsystemParity.

Definition at line 472 of file QwBeamMod.cc.

References fFFB_ErrorFlag, and fModChannel.

472  {//return the error flag
473  UInt_t ErrorFlag;
474  ErrorFlag=0;
475  for(size_t i=0;i<fModChannel.size();i++){
476  ErrorFlag |= fModChannel[i].GetEventcutErrorFlag();
477  }
478  ErrorFlag |= fFFB_ErrorFlag;
479  return ErrorFlag;
480 
481 }
UInt_t fFFB_ErrorFlag
Definition: QwBeamMod.h:167
std::vector< QwVQWK_Channel > fModChannel
Definition: QwBeamMod.h:155
void QwBeamMod::IncrementErrorCounters ( )
virtual

Increment the error counters.

Implements VQwSubsystemParity.

Definition at line 446 of file QwBeamMod.cc.

References fModChannel.

447 {
448  for(size_t i=0;i<fModChannel.size();i++){
449  fModChannel[i].IncrementErrorCounters();
450  }
451 }
std::vector< QwVQWK_Channel > fModChannel
Definition: QwBeamMod.h:155
Int_t QwBeamMod::LoadChannelMap ( TString  mapfile)
virtual

Mandatory map file definition.

Implements VQwSubsystem.

Definition at line 36 of file QwBeamMod.cc.

References QwLog::endl(), VQwSubsystem::fDetectorMaps, fFFB_Index, QwModChannelID::fIndex, fModChannel, fModChannelID, QwModChannelID::fmodulename, QwWord::fModuleType, fMonitorNames, fMonitors, fPatternWordIndex, fRampChannelIndex, QwWord::fSubbankIndex, fWord, QwWord::fWordInSubbank, QwWord::fWordName, fWordsPerSubbank, VQwSubsystem::GetSubbankIndex(), VQwSubsystem::GetSubsystemName(), QwVQWK_Channel::InitializeChannel(), Print(), QwModChannelID::Print(), QwDebug, QwMessage, QwWarning, QwParameterFile::ReadNextSection(), VQwSubsystem::RegisterROCNumber(), VQwSubsystem::RegisterSubbank(), and ResizeOpticsDataContainers().

37 {
38  Bool_t ldebug=kFALSE;
39 
40  Int_t currentrocread=0;
41  Int_t currentbankread=0;
42  Int_t wordsofar=0;
43  Int_t currentsubbankindex=-1;
44  Int_t sample_size=0;
45 
46  TString varname, varvalue;
47 
48  // Open the file
49  QwParameterFile mapstr(mapfile.Data());
50  fDetectorMaps.insert(mapstr.GetParamFileNameContents());
51  mapstr.EnableGreediness();
52  mapstr.SetCommentChars("!");
53  while (mapstr.ReadNextLine() && mapstr.SkipSection("Monitors"))
54  {
55  UInt_t value = 0;
56  if (mapstr.PopValue("roc",value)) {
57  currentrocread = value;
58  RegisterROCNumber(value,0);
59  fWordsPerSubbank.push_back( std::pair<Int_t, Int_t>(fWord.size(),fWord.size()));
60  }
61  if (mapstr.PopValue("bank",value)) {
62  currentbankread = value;
63  RegisterSubbank(value);
64  fWordsPerSubbank.push_back( std::pair<Int_t, Int_t>(fWord.size(),fWord.size()));
65  // std::cout<<"bank " << currentbankread <<std::endl;
66  }
67  if (mapstr.PopValue("sample_size",value)) {
68  sample_size = value;
69  }
70 
71  if (mapstr.HasVariablePair("=",varname,varvalue))
72  {
73  // This is a declaration line. Decode it.
74  varname.ToLower();
75  QwWarning << "QwBeamMod::LoadChannelMap: Unrecognized declaration "
76  << varname << " = " << varvalue << QwLog::endl;
77 
78  } else {
79  Bool_t lineok=kTRUE;
80  // Break this line into tokens to process it.
81  TString modtype = mapstr.GetTypedNextToken<TString>(); // module type
82  /* Int_t modnum = */ mapstr.GetTypedNextToken<Int_t>(); //slot number
83  /* Int_t channum = */ mapstr.GetTypedNextToken<Int_t>(); //channel number
84  // TString dettype = mapstr.GetTypedNextToken<TString>(); //type-purpose of the detector
85  // dettype.ToLower();
86  TString namech = mapstr.GetTypedNextToken<TString>(); //name of the detector
87  namech.ToLower();
88  TString keyword = mapstr.GetTypedNextToken<TString>();
89  keyword.ToLower();
90 
91 
92  if (currentsubbankindex != GetSubbankIndex(currentrocread,currentbankread))
93  {
94  currentsubbankindex = GetSubbankIndex(currentrocread,currentbankread);
95  wordsofar = 0;
96  }
97 
98 
99  QwModChannelID localModChannelID(currentsubbankindex, wordsofar,namech, modtype, this);
100 
101 
102  if(modtype=="VQWK")
103  {
104  wordsofar+=6;
105 
106  if (lineok){
107  QwVQWK_Channel localchan;
108  localchan.InitializeChannel(GetSubsystemName(),"QwBeamMod",localModChannelID.fmodulename,"raw");
109  fModChannel.push_back(localchan);
110  fModChannel[fModChannel.size()-1].SetDefaultSampleSize(sample_size);
111  localModChannelID.fIndex=fModChannel.size()-1;
112  fModChannelID.push_back(localModChannelID);
113 
114  // Store reference to ramp channel
115  if (localModChannelID.fmodulename == "ramp") {
116  fRampChannelIndex = fModChannel.size() - 1;
117  }
118  }
119 
120  if(ldebug)
121  {
122  localModChannelID.Print();
123  std::cout<<"line ok=";
124  if(lineok) std::cout<<"TRUE"<<std::endl;
125  else std::cout<<"FALSE"<<std::endl;
126  }
127  }
128 
129 
130  if(modtype == "WORD")
131  {
132  // std::cout << "Decoding QwWord :: " << namech << std::endl;
133 
134 
135  QwWord localword;
136  localword.fSubbankIndex=currentsubbankindex;
137  localword.fWordInSubbank=wordsofar;
138  wordsofar+=1;
139  // I assume that one data = one word here. But it is not always the case, for
140  // example the triumf adc gives 6 words per channel
141  localword.fModuleType=modtype;
142  localword.fWordName=namech;
143  //localword.fWordType=dettype; // FIXME dettype is undefined so commented this out
144  fWord.push_back(localword);
145 
146  // Store reference to pattern number
147  if (localword.fWordName == "bm_pattern_number") {
148  fPatternWordIndex = fWord.size() - 1;
149  }
150 
151  if(namech=="ffb_status")//save the location of this word to access this later
152  fFFB_Index=fWord.size()-1;
153 
154 
155  fWordsPerSubbank[currentsubbankindex].second = fWord.size();
156  QwDebug << "--" << namech << "--" << fWord.size()-1 << QwLog::endl;
157 
158  }
159  }
160  }
161  if(ldebug)
162  {
163  std::cout<<"Done with Load map channel \n";
164  for(size_t i=0;i<fModChannelID.size();i++)
165  fModChannelID[i].Print();
166 
167  for(size_t i=0;i<fWord.size();i++)
168  fWord[i].PrintID();
169  }
170 
171  // Now load the variables to monitor
172  mapstr.RewindToFileStart();
173  while (QwParameterFile *section = mapstr.ReadNextSection(varvalue)) {
174  if (varvalue == "Monitors") {
175  fMonitorNames.clear();
176  while (section->ReadNextLine()) {
177  section->TrimComment(); // Remove everything after a comment character
178  section->TrimWhitespace(); // Get rid of leading and trailing spaces
179  varvalue = section->GetTypedNextToken<TString>();
180  if (varvalue.Length() > 0) {
181  // Add names of monitor channels for each degree of freedom
182  //
183  //
184  // Consider whether or not the input monitor is a bpm or not. This should
185  // allow for usage of monitors other than bpms, .eg bcm{1,2}, lumi, pmtonl,..ect.
186  //
187 
188  if(varvalue.Contains("qwk_bpm", TString::kExact)){
189  fMonitorNames.push_back(Form("%sX",varvalue.Data()));
190  fMonitorNames.push_back(Form("%sY",varvalue.Data()));
191  }
192  else if(varvalue.Contains("target", TString::kExact)){
193  fMonitorNames.push_back(Form("%sX",varvalue.Data()));
194  fMonitorNames.push_back(Form("%sY",varvalue.Data()));
195  }
196  else{
197  fMonitorNames.push_back(varvalue);
198  }
199  }
200  }
201  }
202  delete section;
203  }
204  // Resize local version of the BPMs
205  QwVQWK_Channel dummy("dummy");
206  fMonitors.resize(fMonitorNames.size(),dummy);
208 
209  // Debug output
210  if (ldebug) {
211  QwMessage << "Done with loading monitor channels:" << QwLog::endl;
212  for (size_t i = 0; i < fMonitorNames.size(); i++)
213  QwMessage << fMonitorNames[i] << QwLog::endl;
214  }
215 
216  return 0;
217 }
Int_t GetSubbankIndex() const
Definition: VQwSubsystem.h:303
std::vector< std::pair< Int_t, Int_t > > fWordsPerSubbank
Definition: QwBeamMod.h:158
void Print()
Definition: QwBeamMod.cc:954
#define QwMessage
Predefined log drain for regular messages.
Definition: QwLog.h:50
std::map< TString, TString > fDetectorMaps
Definition: VQwSubsystem.h:322
Int_t fRampChannelIndex
Definition: QwBeamMod.h:190
Definition: QwWord.h:19
std::vector< TString > fMonitorNames
Definition: QwBeamMod.h:175
Int_t fWordInSubbank
Definition: QwWord.h:27
UInt_t fFFB_Index
Definition: QwBeamMod.h:164
void ResizeOpticsDataContainers(Int_t)
Definition: QwBeamMod.cc:804
std::vector< QwModChannelID > fModChannelID
Definition: QwBeamMod.h:156
QwParameterFile * ReadNextSection(std::string &secname, const bool keep_header=false)
std::vector< QwWord > fWord
Definition: QwBeamMod.h:157
#define QwDebug
Predefined log drain for debugging output.
Definition: QwLog.h:60
std::vector< QwVQWK_Channel > fModChannel
Definition: QwBeamMod.h:155
std::vector< QwVQWK_Channel > fMonitors
Definition: QwBeamMod.h:176
Int_t fSubbankIndex
Definition: QwWord.h:24
Int_t fPatternWordIndex
Definition: QwBeamMod.h:191
TString fModuleType
Definition: QwWord.h:28
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.
TString fWordName
Definition: QwWord.h:29
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
void InitializeChannel(TString name, TString datatosave)
Initialize the fields in this object.
TString GetSubsystemName() const
Definition: VQwSubsystem.h:93

+ Here is the call graph for this function:

Int_t QwBeamMod::LoadEventCuts ( TString  filename)
virtual

Load the event cuts file.

Implements VQwSubsystemParity.

Definition at line 244 of file QwBeamMod.cc.

References QwLog::endl(), VQwSubsystem::fDetectorMaps, fFFB_holdoff, fModChannel, GetDetectorIndex(), GetDetectorTypeID(), GetGlobalErrorFlag(), QwParameterFile::GetUInt(), kBModErrorFlag, kQwUnknownDeviceType, and QwMessage.

245 {
246  Int_t eventcut_flag = 1;
247 
248  // Open the file
249  QwParameterFile mapstr(filename.Data());
250  fDetectorMaps.insert(mapstr.GetParamFileNameContents());
251  fFFB_holdoff=0;//Default holdoff for the FFB pause
252  while (mapstr.ReadNextLine()){
253  //std::cout<<"********* In the loop *************"<<std::endl;
254  mapstr.TrimComment('!'); // Remove everything after a '!' character.
255  mapstr.TrimWhitespace(); // Get rid of leading and trailing spaces.
256  if (mapstr.LineIsEmpty()) continue;
257 
258  TString varname, varvalue;
259  if (mapstr.HasVariablePair("=",varname,varvalue)){
260  if (varname == "EVENTCUTS"){
261  eventcut_flag = QwParameterFile::GetUInt(varvalue);
262  //std::cout<<"EVENT CUT FLAG "<<eventcut_flag<<std::endl;
263  }
264  }
265  else{
266  TString device_type = mapstr.GetTypedNextToken<TString>();
267  device_type.ToLower();
268  TString device_name = mapstr.GetTypedNextToken<TString>();
269  device_name.ToLower();
270 
271 
272  if (device_type == "vqwk"){
273 
274  Double_t LLX = mapstr.GetTypedNextToken<Double_t>(); //lower limit for BCM value
275  Double_t ULX = mapstr.GetTypedNextToken<Double_t>(); //upper limit for BCM value
276  varvalue = mapstr.GetTypedNextToken<TString>();//global/loacal
277  varvalue.ToLower();
278  Double_t stabilitycut = mapstr.GetTypedNextToken<Double_t>();
279  QwMessage<<"QwBeamMod Error Code "<<GetGlobalErrorFlag(varvalue,eventcut_flag,stabilitycut)<<QwLog::endl;
280  Int_t det_index=GetDetectorIndex(GetDetectorTypeID(kQwUnknownDeviceType),device_name);
281  QwMessage << "*****************************" << QwLog::endl;
282  QwMessage << " Type " << device_type << " Name " << device_name << " Index [" << det_index << "] "
283  << " device flag " << eventcut_flag << QwLog::endl;
284  fModChannel[det_index].SetSingleEventCuts((GetGlobalErrorFlag(varvalue,eventcut_flag,stabilitycut)|kBModErrorFlag),LLX,ULX,stabilitycut);
285  QwMessage << "*****************************" << QwLog::endl;
286 
287  }
288  else if (device_type == "word" && device_name== "ffb_status"){
289  fFFB_holdoff=mapstr.GetTypedNextToken<UInt_t>();//Read the FFB OFF interval
290  }
291 
292  }
293 
294  }
295  //update the event cut ON/OFF for all the devices
296  //std::cout<<"EVENT CUT FLAG"<<eventcut_flag<<std::endl;
297  for (size_t i=0;i<fModChannel.size();i++)
298  fModChannel[i].SetEventCutMode(eventcut_flag);
299 
300  return 0;
301 }
#define QwMessage
Predefined log drain for regular messages.
Definition: QwLog.h:50
std::map< TString, TString > fDetectorMaps
Definition: VQwSubsystem.h:322
Int_t GetDetectorIndex(Int_t TypeID, TString name)
Definition: QwBeamMod.cc:541
static const UInt_t kBModErrorFlag
Definition: QwTypes.h:172
UInt_t fFFB_holdoff
Definition: QwBeamMod.h:165
static UInt_t GetUInt(const TString &varvalue)
Int_t GetDetectorTypeID(TString name)
Definition: QwBeamMod.cc:531
std::vector< QwVQWK_Channel > fModChannel
Definition: QwBeamMod.h:155
static std::ostream & endl(std::ostream &)
End of the line.
Definition: QwLog.cc:299
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 QwBeamMod::LoadGeometry ( TString  mapfile)
Int_t QwBeamMod::LoadInputParameters ( TString  mapfile)
virtual

Mandatory parameter file definition.

Implements VQwSubsystem.

Definition at line 305 of file QwBeamMod.cc.

References fModChannel, and QwParameterFile::TrimComment().

306 {
307  Bool_t ldebug=kFALSE;
308  TString varname;
309 
310  Int_t lineread=1;
311 
312  if(ldebug)std::cout<<"QwBeamMod::LoadInputParameters("<< pedestalfile<<")\n";
313 
314  QwParameterFile mapstr(pedestalfile.Data()); //Open the file
315  while (mapstr.ReadNextLine())
316  {
317  lineread+=1;
318  if(ldebug)std::cout<<" line read so far ="<<lineread<<"\n";
319  mapstr.TrimComment('!'); // Remove everything after a '!' character.
320  mapstr.TrimWhitespace(); // Get rid of leading and trailing spaces.
321  if (mapstr.LineIsEmpty()) continue;
322  else
323  {
324  TString varname = mapstr.GetTypedNextToken<TString>(); //name of the channel
325  varname.ToLower();
326  varname.Remove(TString::kBoth,' ');
327  Double_t varped = mapstr.GetTypedNextToken<Double_t>(); // value of the pedestal
328  Double_t varcal = mapstr.GetTypedNextToken<Double_t>(); // value of the calibration factor
329  /* Double_t varweight = */ mapstr.GetTypedNextToken<Double_t>(); // value of the statistical weight
330 
331  //if(ldebug) std::cout<<"inputs for channel "<<varname
332  // <<": ped="<<varped<<": cal="<<varcal<<": weight="<<varweight<<"\n";
333  for(size_t i=0;i<fModChannel.size();i++)
334  if(fModChannel[i].GetElementName()==varname)
335  {
336  fModChannel[i].SetPedestal(varped);
337  fModChannel[i].SetCalibrationFactor(varcal);
338  break;
339  }
340  }
341 
342  }
343  if(ldebug) std::cout<<" line read in the pedestal + cal file ="<<lineread<<" \n";
344 
345  ldebug=kFALSE;
346  return 0;
347 }
void TrimComment(const char commentchar)
std::vector< QwVQWK_Channel > fModChannel
Definition: QwBeamMod.h:155

+ Here is the call graph for this function:

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

Implements VQwSubsystemParity.

Definition at line 584 of file QwBeamMod.cc.

References Compare(), fFFB_ErrorFlag, and fModChannel.

585 {
586  if(Compare(value))
587  {
588  //QwBeamMod* input= (QwBeamMod*)value ;
589  QwBeamMod* input = dynamic_cast<QwBeamMod*>(value);
590 
591  for(size_t i=0;i<input->fModChannel.size();i++)
592  this->fModChannel[i]+=input->fModChannel[i];
593 // for(size_t i=0;i<input->fWord.size();i++)
594 // this->fWord[i]+=input->fWord[i];
595  this->fFFB_ErrorFlag |= input->fFFB_ErrorFlag;
596  }
597  return *this;
598 }
UInt_t fFFB_ErrorFlag
Definition: QwBeamMod.h:167
std::vector< QwVQWK_Channel > fModChannel
Definition: QwBeamMod.h:155
Bool_t Compare(VQwSubsystem *source)
Definition: QwBeamMod.cc:664

+ Here is the call graph for this function:

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

Implements VQwSubsystemParity.

Definition at line 600 of file QwBeamMod.cc.

References Compare(), fFFB_ErrorFlag, and fModChannel.

601 {
602 
603  if(Compare(value))
604  {
605  //QwBeamMod* input= (QwBeamMod*)value;
606  QwBeamMod* input = dynamic_cast<QwBeamMod*>(value);
607 
608  for(size_t i=0;i<input->fModChannel.size();i++)
609  this->fModChannel[i]-=input->fModChannel[i];
610 // for(size_t i=0;i<input->fWord.size();i++)
611 // this->fWord[i]-=input->fWord[i];
612  this->fFFB_ErrorFlag |= input->fFFB_ErrorFlag;
613 
614  }
615  return *this;
616 }
UInt_t fFFB_ErrorFlag
Definition: QwBeamMod.h:167
std::vector< QwVQWK_Channel > fModChannel
Definition: QwBeamMod.h:155
Bool_t Compare(VQwSubsystem *source)
Definition: QwBeamMod.cc:664

+ Here is the call graph for this function:

VQwSubsystem & QwBeamMod::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 567 of file QwBeamMod.cc.

References Compare(), fFFB_ErrorFlag, fModChannel, and fWord.

568 {
569  // std::cout<<" here in QwBeamMod::operator= \n";
570  if(Compare(value))
571  {
572 
573  QwBeamMod* input = dynamic_cast<QwBeamMod*>(value);
574 
575  for(size_t i=0;i<input->fModChannel.size();i++)
576  this->fModChannel[i]=input->fModChannel[i];
577  for(size_t i=0;i<input->fWord.size();i++)
578  this->fWord[i].fValue=input->fWord[i].fValue;
579  this->fFFB_ErrorFlag=input->fFFB_ErrorFlag;
580  }
581  return *this;
582 }
UInt_t fFFB_ErrorFlag
Definition: QwBeamMod.h:167
std::vector< QwWord > fWord
Definition: QwBeamMod.h:157
std::vector< QwVQWK_Channel > fModChannel
Definition: QwBeamMod.h:155
Bool_t Compare(VQwSubsystem *source)
Definition: QwBeamMod.cc:664

+ Here is the call graph for this function:

void QwBeamMod::Print ( )

Definition at line 954 of file QwBeamMod.cc.

References QwLog::endl(), fModChannel, VQwSubsystem::fSystemName, fWord, VQwSubsystemParity::PrintValue(), and QwMessage.

Referenced by LoadChannelMap().

955 {
956  QwMessage << "Name of the subsystem =" << fSystemName << QwLog::endl;
957 
958  QwMessage << "there are " << fModChannel.size() << " mods" << QwLog::endl;
959 
960  QwMessage << " Printing Running AVG and other channel info for fModChannel" << QwLog::endl;
961  for(size_t i=0;i<fModChannel.size();i++)
962  fModChannel[i].PrintValue();
963  for(size_t i=0;i<fWord.size();i++)
964  fWord[i].Print();
965 }
void Print()
Definition: QwBeamMod.cc:954
#define QwMessage
Predefined log drain for regular messages.
Definition: QwLog.h:50
virtual void PrintValue() const
Print values of all channels.
std::vector< QwWord > fWord
Definition: QwBeamMod.h:157
std::vector< QwVQWK_Channel > fModChannel
Definition: QwBeamMod.h:155
TString fSystemName
Name of this subsystem.
Definition: VQwSubsystem.h:315
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 QwBeamMod::PrintErrorCounters ( ) const
virtual

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

Implements VQwSubsystemParity.

Definition at line 453 of file QwBeamMod.cc.

References fModChannel, QwVQWK_Channel::PrintErrorCounterHead(), and QwVQWK_Channel::PrintErrorCounterTail().

453  {//inherited from the VQwSubsystemParity; this will display the error summary
454 
455  std::cout<<"*********QwBeamMod Error Summary****************"<<std::endl;
457  for(size_t i=0;i<fModChannel.size();i++){
458  fModChannel[i].PrintErrorCounters();
459  }
461 }
static void PrintErrorCounterHead()
std::vector< QwVQWK_Channel > fModChannel
Definition: QwBeamMod.h:155
static void PrintErrorCounterTail()

+ Here is the call graph for this function:

void QwBeamMod::PrintModChannelID ( )

Definition at line 967 of file QwBeamMod.cc.

References fModChannelID.

968 {
969  for (size_t i=0;i<fModChannelID.size();i++)
970  {
971  std::cout<<"============================="<<std::endl;
972  std::cout<<" Detector ID="<<i<<std::endl;
973  fModChannelID[i].Print();
974  }
975 }
std::vector< QwModChannelID > fModChannelID
Definition: QwBeamMod.h:156
Int_t QwBeamMod::ProcessConfigurationBuffer ( const UInt_t  roc_id,
const UInt_t  bank_id,
UInt_t *  buffer,
UInt_t  num_words 
)
virtual

Implements VQwSubsystem.

Definition at line 514 of file QwBeamMod.cc.

515 {
516  return 0;
517 }
Int_t QwBeamMod::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 350 of file QwBeamMod.cc.

References QwLog::endl(), fModChannel, fModChannelID, fWord, fWordsPerSubbank, VQwSubsystem::GetSubbankIndex(), QwDebug, QwMessage, QwWarning, and VQwSubsystem::SetDataLoaded().

351 {
352  Bool_t lkDEBUG=kFALSE;
353 
354  Int_t index = GetSubbankIndex(roc_id,bank_id);
355 
356  if (index>=0 && num_words>0){
357  // We want to process this ROC. Begin looping through the data.
358  if (lkDEBUG)
359  QwMessage << "QwBeamMod::ProcessEvBuffer: "
360  << "Begin processing ROC" << roc_id
361  << " and subbank "<<bank_id
362  << " number of words="<<num_words<<QwLog::endl;
363  if (buffer[0]==0xf0f0f0f0 && num_words%2==1){
364  buffer++;
365  if (lkDEBUG)
366  QwMessage << "QwBeamMod::ProcessEvBuffer: "
367  << "Skipped padding word 0xf0f0f0f0 at beginning of buffer."
368  << QwLog::endl;
369  }
370 
371  for(size_t i=0;i<fModChannelID.size();i++)
372  {
373  if(fModChannelID[i].fSubbankIndex==index)
374  {
375 
376  if (lkDEBUG)
377  {
378  std::cout<<"found modulation data for "<<fModChannelID[i].fmodulename<<std::endl;
379  std::cout<<"word left to read in this buffer:"<<num_words-fModChannelID[i].fWordInSubbank<<std::endl;
380  }
381  fModChannel[fModChannelID[i].fIndex]. // Instead of BCM this will become our data word.If we use detectorID we need to add a specific ID
382  ProcessEvBuffer(&(buffer[fModChannelID[i].fWordInSubbank]),
383  num_words-fModChannelID[i].fWordInSubbank);
384 
385  }
386  }
387 
388  for(Int_t i=fWordsPerSubbank[index].first; i<fWordsPerSubbank[index].second; i++) {
389  if(fWord[i].fWordInSubbank+1<= (Int_t) num_words) {
390  fWord[i].fValue=buffer[fWord[i].fWordInSubbank];
391  } else {
392  QwWarning << "QwBeamMod::ProcessEvBuffer: There is not enough word in the buffer to read data for "
393  << fWord[i].fWordName << QwLog::endl;
394  QwWarning << "QwBeamMod::ProcessEvBuffer: Words in this buffer:" << num_words
395  << " trying to read word number =" << fWord[i].fWordInSubbank << QwLog::endl;
396  }
397  }
398  if(lkDEBUG) {
399  QwDebug << "QwBeamMod::ProcessEvBuffer: Done with Processing this event" << QwLog::endl;
400  for(size_t i=0;i<fWord.size();i++) {
401  std::cout << " word number = " << i << " ";
402  fWord[i].Print();
403  }
404  }
405 
406  }
407  lkDEBUG=kFALSE;
408 
409  SetDataLoaded(kTRUE);
410 
411  return 0;
412 }
Int_t GetSubbankIndex() const
Definition: VQwSubsystem.h:303
std::vector< std::pair< Int_t, Int_t > > fWordsPerSubbank
Definition: QwBeamMod.h:158
#define QwMessage
Predefined log drain for regular messages.
Definition: QwLog.h:50
std::vector< QwModChannelID > fModChannelID
Definition: QwBeamMod.h:156
std::vector< QwWord > fWord
Definition: QwBeamMod.h:157
#define QwDebug
Predefined log drain for debugging output.
Definition: QwLog.h:60
std::vector< QwVQWK_Channel > fModChannel
Definition: QwBeamMod.h:155
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 v...
Definition: QwBeamMod.cc:350
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
void SetDataLoaded(Bool_t flag)
Definition: VQwSubsystem.h:305

+ Here is the call graph for this function:

void QwBeamMod::ProcessEvent ( )
virtual

Implements VQwSubsystem.

Definition at line 485 of file QwBeamMod.cc.

References fModChannel.

486 {
487  for (size_t i = 0; i < fModChannel.size(); i++) {
488  // First apply HW checks and update HW error flags.
489  fModChannel[i].ApplyHWChecks();
490  fModChannel[i].ProcessEvent();
491  }
492 }
std::vector< QwVQWK_Channel > fModChannel
Definition: QwBeamMod.h:155
void QwBeamMod::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 508 of file QwBeamMod.cc.

References FillHistograms().

509 {
510  // Fill histograms here to bypass event cuts
511  FillHistograms();
512 }
void FillHistograms()
Fill the histograms for this subsystem.
Definition: QwBeamMod.cc:724

+ Here is the call graph for this function:

void QwBeamMod::ProcessOptions ( QwOptions options)
virtual

Process the command line options.

Reimplemented from VQwSubsystem.

Definition at line 32 of file QwBeamMod.cc.

32  {
33  //Handle command line options
34 }
void QwBeamMod::Ratio ( VQwSubsystem numer,
VQwSubsystem denom 
)
virtual

Implements VQwSubsystemParity.

Definition at line 636 of file QwBeamMod.cc.

References Compare(), fModChannel, and fWord.

637 {
638  if(Compare(numer)&&Compare(denom))
639  {
640  //QwBeamMod* innumer= (QwBeamMod*)numer ;
641  QwBeamMod* innumer = dynamic_cast<QwBeamMod*>(numer);
642  //QwBeamMod* indenom= (QwBeamMod*)denom ;
643  QwBeamMod* indenom = dynamic_cast<QwBeamMod*>(denom);
644 
645  for(size_t i=0;i<innumer->fModChannel.size();i++)
646  this->fModChannel[i].Ratio(innumer->fModChannel[i],indenom->fModChannel[i]);
647  for(size_t i=0;i<innumer->fWord.size();i++)
648  this->fWord[i].fValue=innumer->fWord[i].fValue;
649 
650  }
651 }
void Ratio(VQwSubsystem *numer, VQwSubsystem *denom)
Definition: QwBeamMod.cc:636
std::vector< QwWord > fWord
Definition: QwBeamMod.h:157
std::vector< QwVQWK_Channel > fModChannel
Definition: QwBeamMod.h:155
Bool_t Compare(VQwSubsystem *source)
Definition: QwBeamMod.cc:664

+ Here is the call graph for this function:

void QwBeamMod::ResizeOpticsDataContainers ( Int_t  size)

Definition at line 804 of file QwBeamMod.cc.

References fAmplitude, fAmplitudeError, fChisquare, fNFitPoints, fNumberPatterns, fOffset, fOffsetError, fPhase, and fPhaseError.

Referenced by AnalyzeOpticsPlots(), and LoadChannelMap().

805 {
806  fOffset.resize(size);
807  fAmplitude.resize(size);
808  fPhase.resize(size);
809  fOffsetError.resize(size);
810  fAmplitudeError.resize(size);
811  fPhaseError.resize(size);
812  fChisquare.resize(size);
813  fNFitPoints.resize(size);
814 
815  for(Int_t i = 0; i < size; i++){
816  fOffset[i].resize(fNumberPatterns);
817  fAmplitude[i].resize(fNumberPatterns);
818  fPhase[i].resize(fNumberPatterns);
819  fOffsetError[i].resize(fNumberPatterns);
820  fAmplitudeError[i].resize(fNumberPatterns);
821  fPhaseError[i].resize(fNumberPatterns);
822  fChisquare[i].resize(fNumberPatterns);
823  fNFitPoints[i].resize(fNumberPatterns);
824  }
825 }
std::vector< std::vector< Double_t > > fAmplitude
Definition: QwBeamMod.h:179
static const Int_t fNumberPatterns
Definition: QwBeamMod.h:171
std::vector< std::vector< Double_t > > fPhaseError
Definition: QwBeamMod.h:185
std::vector< std::vector< Int_t > > fNFitPoints
Definition: QwBeamMod.h:188
std::vector< std::vector< Double_t > > fChisquare
Definition: QwBeamMod.h:187
std::vector< std::vector< Double_t > > fOffset
Definition: QwBeamMod.h:180
std::vector< std::vector< Double_t > > fPhase
Definition: QwBeamMod.h:181
std::vector< std::vector< Double_t > > fAmplitudeError
Definition: QwBeamMod.h:183
std::vector< std::vector< Double_t > > fOffsetError
Definition: QwBeamMod.h:184

+ Here is the caller graph for this function:

void QwBeamMod::Scale ( Double_t  factor)
virtual

Implements VQwSubsystemParity.

Definition at line 654 of file QwBeamMod.cc.

References fModChannel.

655 {
656  for(size_t i=0;i<fModChannel.size();i++)
657  fModChannel[i].Scale(factor);
658 }
void Scale(Double_t factor)
Definition: QwBeamMod.cc:654
std::vector< QwVQWK_Channel > fModChannel
Definition: QwBeamMod.h:155
void QwBeamMod::Sum ( VQwSubsystem value1,
VQwSubsystem value2 
)
virtual

Implements VQwSubsystemParity.

Definition at line 618 of file QwBeamMod.cc.

References Compare().

619 {
620  if(Compare(value1)&&Compare(value2))
621  {
622  *this = value1;
623  *this += value2;
624  }
625 }
Bool_t Compare(VQwSubsystem *source)
Definition: QwBeamMod.cc:664

+ Here is the call graph for this function:

void QwBeamMod::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 463 of file QwBeamMod.cc.

References fModChannel.

464 {
465  const QwBeamMod* input = dynamic_cast<const QwBeamMod*> (ev_error);
466 
467  for(size_t i=0;i<fModChannel.size();i++){
468  fModChannel[i].UpdateErrorFlag(input->fModChannel[i]);
469  }
470 }
std::vector< QwVQWK_Channel > fModChannel
Definition: QwBeamMod.h:155
void QwBeamMod::WritePromptSummary ( QwPromptSummary ps,
TString  type 
)
virtual

Reimplemented from VQwSubsystemParity.

Definition at line 1064 of file QwBeamMod.cc.

1065 {
1066  return;
1067 };

Field Documentation

const Bool_t QwBeamMod::bDEBUG =kFALSE
staticprivate

Definition at line 169 of file QwBeamMod.h.

Referenced by ApplySingleEventCuts().

std::vector<std::vector <Double_t> > QwBeamMod::fAmplitude
private
std::vector<std::vector <Double_t> > QwBeamMod::fAmplitudeError
private
std::vector<Double_t> QwBeamMod::fBPMPosition
private

Definition at line 177 of file QwBeamMod.h.

std::vector<std::vector <Double_t> > QwBeamMod::fChisquare
private
UInt_t QwBeamMod::fFFB_ErrorFlag
private
Bool_t QwBeamMod::fFFB_Flag
private

Definition at line 168 of file QwBeamMod.h.

Referenced by ApplySingleEventCuts(), and QwBeamMod().

UInt_t QwBeamMod::fFFB_holdoff
private

Definition at line 165 of file QwBeamMod.h.

Referenced by ApplySingleEventCuts(), and LoadEventCuts().

UInt_t QwBeamMod::fFFB_holdoff_Counter
private

Definition at line 166 of file QwBeamMod.h.

Referenced by ApplySingleEventCuts(), and QwBeamMod().

UInt_t QwBeamMod::fFFB_Index
private

Definition at line 164 of file QwBeamMod.h.

Referenced by ApplySingleEventCuts(), and LoadChannelMap().

std::vector<TString> QwBeamMod::fgModTypeNames

Definition at line 72 of file QwBeamMod.h.

Referenced by GetDetectorTypeID(), and QwBeamMod().

std::vector<QwModChannelID> QwBeamMod::fModChannelID
protected

Definition at line 156 of file QwBeamMod.h.

Referenced by GetDetectorIndex(), LoadChannelMap(), PrintModChannelID(), and ProcessEvBuffer().

std::vector<TString> QwBeamMod::fMonitorNames
private
std::vector<QwVQWK_Channel> QwBeamMod::fMonitors
private
std::vector<std::vector <Int_t> > QwBeamMod::fNFitPoints
private
const Int_t QwBeamMod::fNumberPatterns = 5
staticprivate

Definition at line 171 of file QwBeamMod.h.

Referenced by ResizeOpticsDataContainers().

std::vector<std::vector <Double_t> > QwBeamMod::fOffset
private
std::vector<std::vector <Double_t> > QwBeamMod::fOffsetError
private
Int_t QwBeamMod::fPatternWordIndex
private

Definition at line 191 of file QwBeamMod.h.

Referenced by FillHistograms(), LoadChannelMap(), and QwBeamMod().

std::vector<std::vector <Double_t> > QwBeamMod::fPhase
private
std::vector<std::vector <Double_t> > QwBeamMod::fPhaseError
private
Int_t QwBeamMod::fRampChannelIndex
private

Definition at line 190 of file QwBeamMod.h.

Referenced by FillHistograms(), LoadChannelMap(), and QwBeamMod().

Int_t QwBeamMod::fTreeArrayIndex
protected

Definition at line 152 of file QwBeamMod.h.

Referenced by ConstructBranchAndVector(), and FillTreeVector().

std::vector< std::pair<Int_t, Int_t> > QwBeamMod::fWordsPerSubbank
protected

Definition at line 158 of file QwBeamMod.h.

Referenced by LoadChannelMap(), and ProcessEvBuffer().


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