JAPAn
Just Another Parity Analyzer
Loading...
Searching...
No Matches
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
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
56 fHelicityBitPlus=kTRUE;
57 fHelicityBitMinus=kFALSE;
59
60 return;
61}
62
64 {
65 for (size_t i=0;i<fWord.size();i++)
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 generator 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}
#define REGISTER_SUBSYSTEM_FACTORY(A)
Definition QwFactory.h:270
Fake helicity generator using pregenerated random seeds.
Helicity source that generates a reproducible sequence from seeds.
Bool_t IsGoodHelicity() override
UInt_t GetRandbit(UInt_t &ranseed) override
Bool_t CollectRandBits() override
void ClearEventData() override
void ProcessEvent() override
Int_t fPatternNumberOld
Definition QwHelicity.h:229
Int_t kPatternCounter
Definition QwHelicity.h:223
Int_t fPatternNumber
Definition QwHelicity.h:229
Int_t kMpsCounter
Definition QwHelicity.h:223
Int_t fDelayedPatternPolarity
Reported polarity of the current pattern.
Definition QwHelicity.h:232
Int_t fMaxPatternPhase
Definition QwHelicity.h:269
Int_t fHelicityDelayed
Definition QwHelicity.h:234
Int_t fPatternPhaseNumberOld
Definition QwHelicity.h:228
Int_t fPatternPhaseNumber
Definition QwHelicity.h:228
std::vector< QwWord > fWord
Definition QwHelicity.h:205
static const Int_t kUndefinedHelicity
Definition QwHelicity.h:256
Int_t kPatternPhase
Definition QwHelicity.h:223
UInt_t iseed_Actual
Definition QwHelicity.h:263
UInt_t iseed_Delayed
Definition QwHelicity.h:264
Bool_t fGoodHelicity
Definition QwHelicity.h:242
Bool_t fHelicityBitPlus
Definition QwHelicity.h:240
Bool_t fHelicityBitMinus
Definition QwHelicity.h:241
Int_t fEventNumberOld
Definition QwHelicity.h:227
Int_t fHelicityActual
Definition QwHelicity.h:234
UInt_t GetRandbit24(UInt_t &ranseed)
Int_t fActualPatternPolarity
True polarity of the current pattern.
Definition QwHelicity.h:231
Int_t fEventNumber
Definition QwHelicity.h:227
void PredictHelicity()