@@ -80,26 +80,10 @@ int main(int argc, char* argv[])
8080 QwHelicity* helicity = dynamic_cast <QwHelicity*>(detectors.GetSubsystemByName (" Helicity Info" ));
8181 if (! helicity) QwWarning << " No helicity subsystem defined!" << QwLog::endl;
8282
83- // Possible scenarios:
84- // - everything is random, no correlations at all, no asymmetries at all
85- // - variations in the mean of position, current, yield over the course of
86- // a run (linearly with run number, change mean/sigma as function of event
87- // number)
88- // - one parameter has a helicity-correlated asymmetry, every other parameter
89- // is random and independently distributed
90- // - two parameters have independent helicity-correlated asymmetries
91- // - two parameters have correlated helicity-correlated asymmetries
92- // - beam modulation
9383
9484 // Get the beamline channels we want to correlate
9585 detectors.LoadMockDataParameters (" mock_parameters_list.map" );
9686
97- // -----------------------------------------------------------------------------------------------
98- // Get the main detector channels we want to correlate
99- // QwDetectorArray* maindetector =
100- // dynamic_cast<QwDetectorArray*>(detectors.GetSubsystemByName("Main Detector"));
101- // if (! maindetector) QwWarning << "No main detector subsystem defined!" << QwLog::endl;
102-
10387 // new vectors for GetSubsystemByType
10488 std::vector <QwDetectorArray*> detchannels;
10589 std::vector <VQwSubsystem*> tempvector = detectors.GetSubsystemByType (" QwDetectorArray" );
@@ -111,52 +95,6 @@ int main(int argc, char* argv[])
11195 // return detchannels;
11296 }
11397
114- /*
115- if(1==2){
116- Double_t bar_mean = 2.0e4;
117- Double_t bar_sigma = 3.0e2;
118- Double_t bar_asym = 4.0e-4;
119- maindetector->SetRandomEventParameters(bar_mean, bar_sigma);
120- maindetector->SetRandomEventAsymmetry(bar_asym);
121- // Specific values
122- // disabled, wdc, 2010-07-23
123- maindetector->GetIntegrationPMT("MD2Neg")->SetRandomEventAsymmetry(2.0e-2);
124- maindetector->GetIntegrationPMT("MD2Pos")->SetRandomEventAsymmetry(2.0e-2);
125- maindetector->GetIntegrationPMT("MD3Neg")->SetRandomEventAsymmetry(3.0e-3);
126- maindetector->GetIntegrationPMT("MD3Pos")->SetRandomEventAsymmetry(3.0e-3);
127- maindetector->GetIntegrationPMT("MD4Neg")->SetRandomEventAsymmetry(4.0e-4);
128- maindetector->GetIntegrationPMT("MD4Pos")->SetRandomEventAsymmetry(4.0e-4);
129- maindetector->GetIntegrationPMT("MD5Neg")->SetRandomEventAsymmetry(5.0e-5);
130- maindetector->GetIntegrationPMT("MD5Pos")->SetRandomEventAsymmetry(5.0e-5);
131- maindetector->GetIntegrationPMT("MD6Neg")->SetRandomEventAsymmetry(6.0e-6);
132- maindetector->GetIntegrationPMT("MD6Pos")->SetRandomEventAsymmetry(6.0e-6);
133- maindetector->GetIntegrationPMT("MD7Neg")->SetRandomEventAsymmetry(7.0e-7);
134- maindetector->GetIntegrationPMT("MD7Pos")->SetRandomEventAsymmetry(7.0e-7);
135- maindetector->GetIntegrationPMT("MD8Neg")->SetRandomEventAsymmetry(8.0e-8);
136- maindetector->GetIntegrationPMT("MD8Pos")->SetRandomEventAsymmetry(8.0e-8);
137-
138- // Set a asymmetric helicity asymmetry on one of the bars
139- maindetector->GetIntegrationPMT("MD1Neg")->SetRandomEventAsymmetry(5.0e-5);
140- maindetector->GetIntegrationPMT("MD1Pos")->SetRandomEventAsymmetry(-5.0e-5);
141-
142- // Set a drift component (amplitude, phase, frequency)
143- maindetector->GetIntegrationPMT("MD3Neg")->AddRandomEventDriftParameters(3.0e6, 0, 60*Qw::Hz);
144- maindetector->GetIntegrationPMT("MD3Neg")->AddRandomEventDriftParameters(6.0e5, 0, 120*Qw::Hz);
145- maindetector->GetIntegrationPMT("MD3Neg")->AddRandomEventDriftParameters(4.5e5, 0, 240*Qw::Hz);
146-
147- } //end if(1==2)
148- */
149-
150-
151- // Initialize randomness provider and distribution
152- std::mt19937 randomnessGenerator (999 ); // Mersenne twister with seed (see below)
153- std::normal_distribution<double > normalDistribution;
154- auto normal = [&]() -> double { return normalDistribution (randomnessGenerator); };
155- // WARNING: This variate_generator will return the SAME random values as the
156- // variate_generator in QwVQWK_Channel when used with the same default seed!
157- // Therefore you really should give an explicitly different seed for the
158- // mt19937 randomness generator.
159-
16098 // Initialize the stopwatch
16199 TStopwatch stopwatch;
162100
@@ -168,7 +106,7 @@ if(1==2){
168106 run++) {
169107
170108 // Set the random seed for this run
171- randomnessGenerator. seed (run);
109+ MQwMockable::Seed (run);
172110 QwCombinedBCM<QwVQWK_Channel>::SetTripSeed (0x56781234 ^ (run*run));
173111
174112 // Open new output file
@@ -249,48 +187,6 @@ if(1==2){
249187 int myhelicity = helicity->GetHelicityActual () ? +1 : -1 ;
250188 // std::cout << myhelicity << std::endl;
251189
252- // Secondly introduce correlations between variables
253- //
254- // N-dimensional correlated normal random variables:
255- // X = C' * Z
256- // with
257- // X correlated and normally distributed,
258- // Z independent and normally distributed,
259- // C the Cholesky decomposition of the positive-definite covariance matrix
260- // (C should probably be calculated offline)
261- //
262- /* Sigma =
263- 1.00000 0.50000 0.50000
264- 0.50000 2.00000 0.30000
265- 0.50000 0.30000 1.50000
266-
267- C =
268- 1.00000 0.50000 0.50000
269- 0.00000 1.32288 0.03780
270- 0.00000 0.00000 1.11739
271-
272- Sigma = C' * C
273- */
274- double z[NVARS], x[NVARS];
275- double C[NVARS][NVARS];
276- for (int var = 0 ; var < NVARS; var++) {
277- x[var] = 0.0 ;
278- z[var] = normal ();
279- C[var][var] = 1.0 ;
280- }
281- C[0 ][0 ] = 1.0 ; C[0 ][1 ] = 0.5 ; C[0 ][2 ] = 0.5 ;
282- C[1 ][0 ] = 0.0 ; C[1 ][1 ] = 1.32288 ; C[1 ][2 ] = 0.03780 ;
283- C[2 ][0 ] = 0.0 ; C[2 ][1 ] = 0.0 ; C[2 ][2 ] = 1.11739 ;
284- for (int i = 0 ; i < NVARS; i++)
285- for (int j = 0 ; j < NVARS; j++)
286- x[i] += C[j][i] * z[j];
287-
288- // Assign to data elements
289- // maindetector->GetChannel("MD2Neg")->SetExternalRandomVariable(x[0]);
290- // lumidetector->GetChannel("dlumi1")->SetExternalRandomVariable(x[1]);
291- // beamline->GetBCM("qwk_bcm0l07")->SetExternalRandomVariable(x[2]);
292-
293-
294190 // Randomize data for this event
295191 detectors.RandomizeEventData (myhelicity, time);
296192// detectors.ProcessEvent();
0 commit comments