QwAnalysis
QwFakeHelicity.cc
Go to the documentation of this file.
1 /**********************************************************\
2 * File: QwFakeHelicity.C *
3 * *
4 * Author: B.Waidyawansa *
5 * Time-stamp:03-06-2010 *
6 \**********************************************************/
7 
8 
9 
10 #include "QwFakeHelicity.h"
11 
12 // Register this subsystem with the factory
14 
15 
17 {
18  fGoodHelicity = kTRUE;
19  return fGoodHelicity;
20 
21 }
22 
24 {
25 
26  Bool_t fake_the_counters=kFALSE;
27 
28  // First get the information from the Input Register. Even though there are no helicity
29  // information we can still get the MPS, Pattern SYNC and Pattern phase.
30 
32  // When we don't have the pattern information in the input register, fake them.
33  if(fake_the_counters){
34  if (fEventNumber == 1){ // first pattern
35  fPatternNumber = 0;
37  }
38  else if (fPatternPhaseNumber == fMaxPatternPhase){ // end of a pattern
41  }
42  else {
45  }
46  }
47 
48  // When we do have the pattern information in the inputregister, use thm.
49  if( !fake_the_counters ){
52  }
53 
54 
55  fHelicityActual=0;
56  fHelicityBitPlus=kTRUE;
57  fHelicityBitMinus=kFALSE;
59 
60  return;
61 }
62 
64  {
65  for (size_t i=0;i<fWord.size();i++)
66  fWord[i].ClearEventData();
67 
68  //reset data
72 
73  //clear data
75  fHelicityBitPlus = kFALSE;
76  fHelicityBitMinus = kFALSE;
77  return;
78  }
79 
80  UInt_t QwFakeHelicity::GetRandbit(UInt_t& ranseed){
81  Bool_t status = false;
82  status = GetRandbit24(ranseed);
83  return status;
84  }
85 
87  {
88  static Bool_t firsttimethrough = kTRUE;
89 
90  Bool_t ldebug = kFALSE;
91  UInt_t ranseed = 0x2535D5&0xFFFFFF; //put a mask.
92 
93  /**The value of the radseed was picked up from the studies
94  Buddhini did on the 24 bit helicity generater back in 2008.
95  */
96  // A modification to set the random seeds that are usually generated by the first 24 patterns.
97  if(! firsttimethrough){
98  return kTRUE;
99  } else{
100  firsttimethrough = kFALSE;
101  fGoodHelicity = kFALSE; //reset before prediction begins
102  iseed_Delayed = ranseed;
103  // Go 24 patterns back to get the reported helicity at this event
104  for(UInt_t i=0;i<24;i++)
107 
109  for(Int_t i=0; i<8; i++)
112  }
113 
114  if(ldebug) std::cout<<"QwFakeHelicity::CollectRandBits24 => Done collecting ...\n";
115  return kTRUE;
116 
117 }
Int_t fEventNumber
Definition: QwHelicity.h:194
UInt_t GetRandbit24(UInt_t &ranseed)
Definition: QwHelicity.cc:1484
void PredictHelicity()
Definition: QwHelicity.cc:1849
Int_t fPatternNumberOld
Definition: QwHelicity.h:196
Bool_t IsGoodHelicity()
static const Int_t kUndefinedHelicity
Definition: QwHelicity.h:223
Int_t fDelayedPatternPolarity
Reported polarity of the current pattern.
Definition: QwHelicity.h:199
Int_t fMinPatternPhase
Int_t fMaxPatternPhase
Definition: QwHelicity.h:236
Int_t fEventNumberOld
Definition: QwHelicity.h:194
Int_t fActualPatternPolarity
True polarity of the current pattern.
Definition: QwHelicity.h:198
Int_t kMpsCounter
Definition: QwHelicity.h:190
Int_t fHelicityDelayed
Definition: QwHelicity.h:201
Bool_t fHelicityBitMinus
Definition: QwHelicity.h:208
Int_t kPatternCounter
Definition: QwHelicity.h:190
std::vector< QwWord > fWord
Definition: QwHelicity.h:172
UInt_t iseed_Delayed
Definition: QwHelicity.h:231
Bool_t CollectRandBits()
UInt_t GetRandbit(UInt_t &ranseed)
Bool_t fHelicityBitPlus
Definition: QwHelicity.h:207
Int_t fPatternPhaseNumber
Definition: QwHelicity.h:195
UInt_t iseed_Actual
Definition: QwHelicity.h:230
Int_t fHelicityActual
Definition: QwHelicity.h:201
Int_t fPatternNumber
Definition: QwHelicity.h:196
Int_t kPatternPhase
Definition: QwHelicity.h:190
#define RegisterSubsystemFactory(A)
Definition: QwFactory.h:230
Bool_t fGoodHelicity
Definition: QwHelicity.h:209
Int_t fPatternPhaseNumberOld
Definition: QwHelicity.h:195