25#include "TStopwatch.h"
42 std::ostringstream stream;
47int main(
int argc,
char* argv[])
69 gQwOptions.SetConfigFile(
"qwmockdataanalysis.conf");
104 std::vector <QwDetectorArray*> detchannels;
105 std::vector <VQwSubsystem*> tempvector = detectors.
GetSubsystemByType(
"QwDetectorArray");
108 for (std::size_t i = 0; i < tempvector.size(); i++){
152 std::mt19937 randomnessGenerator(999);
153 std::normal_distribution<double> normalDistribution;
154 auto normal = [&]() ->
double {
return normalDistribution(randomnessGenerator); };
161 TStopwatch stopwatch;
164 UInt_t runnumber_min = (UInt_t)
gQwOptions.GetIntValuePairFirst(
"run");
165 UInt_t runnumber_max = (UInt_t)
gQwOptions.GetIntValuePairLast(
"run");
166 for (UInt_t run = runnumber_min;
167 run <= runnumber_max;
171 randomnessGenerator.seed(run);
178 TString filename = Form(
"%sQwMock_%u.log", eventbuffer.
GetDataDirectory().Data(), run);
181 std::cout <<
"Error: could not open ET stream!" << std::endl;
185 if (eventbuffer.
OpenDataFile(filename,
"W") != CODA_OK) {
186 std::cout <<
"Error: could not open file!" << std::endl;
200 unsigned int seed = 0x1234 ^ run;
205 if (
kDebug) std::cout <<
"Starting event loop..." << std::endl;
206 Int_t eventnumber_min =
gQwOptions.GetIntValuePairFirst(
"event");
207 Int_t eventnumber_max =
gQwOptions.GetIntValuePairLast(
"event");
210 if (abs(eventnumber_max - eventnumber_min) < 10)
211 QwWarning <<
"Only " << abs(eventnumber_max - eventnumber_min)
215 for (Int_t event = eventnumber_min;
event <= eventnumber_max;
event++) {
233 else std::cout <<
"?";
237 else std::cout <<
"(?) ";
276 for (
int var = 0; var <
NVARS; var++) {
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];
299 for (std::size_t i = 0; i < detchannels.size(); i++){
300 detchannels[i]->ExchangeProcessedData();
301 detchannels[i]->RandomizeMollerEvent(myhelicity);
306 if (status != CODA_OK) {
312 constexpr int nevents =
kDebug ? 1000 : 10000;
313 if (event % nevents == 0) {
314 QwMessage <<
"Generated " <<
event <<
" events ";
316 QwMessage <<
"(" << stopwatch.RealTime()*1e3/nevents <<
" ms per event)";
const std::string getenv_safe_string(const char *name)
A logfile class, based on an identical class in the Hermes analyzer.
#define QwError
Predefined log drain for errors.
#define QwWarning
Predefined log drain for warnings.
#define QwMessage
Predefined log drain for regular messages.
Event buffer management for reading and processing CODA data.
Blinded detector array for PMT analysis.
Helicity state management and pattern recognition.
Subsystem array container for parity analysis with asymmetry calculations.
Detector array for PMT analysis with integration and combination.
Beamline subsystem containing BPMs, BCMs, and other beam monitoring devices.
Load the options for the parity subsystems.
void DefineOptionsParity(QwOptions &options)
Helicity pattern analysis and management.
int main(int argc, char *argv[])
std::string stringify(int i)
static const bool kBeamTrips
static const int kMultiplet
Event buffer management for reading and processing CODA data.
Int_t EncodeSubsystemData(QwSubsystemArray &subsystems)
const TString & GetDataDirectory() const
Int_t EncodePrestartEvent(int runnumber, int runtype=0)
void ProcessOptions(QwOptions &options)
Sets internal flags based on the QwOptions.
void ResetControlParameters()
Int_t OpenDataFile(UInt_t current_run, Short_t seg)
static std::ostream & endl(std::ostream &)
End of the line.
static void AppendToSearchPath(const TString &searchdir)
Add a directory to the search path.
virtual std::vector< VQwSubsystem * > GetSubsystemByType(const std::string &type)
Get the list of subsystems of the specified type.
void ProcessOptions(QwOptions &options)
Process configuration options (default behavior)
void RandomizeEventData(int helicity=0, double time=0.0)
Randomize the data in this event.
static void SetTripSeed(uint seedval)
Subsystem for managing arrays of PMT detectors with integration and combination.
Subsystem for helicity state management and pattern recognition.
UInt_t GetRandomSeedDelayed()
UInt_t GetRandomSeedActual()
Int_t GetHelicityActual()
void SetEventPatternPhase(Int_t event, Int_t pattern, Int_t phase)
void SetFirstBits(UInt_t nbits, UInt_t firstbits)
Int_t GetHelicityDelayed()
Subsystem array container specialized for parity analysis with asymmetry calculations.
VQwSubsystemParity * GetSubsystemByName(const TString &name) override
Get the subsystem with the specified name.
void LoadMockDataParameters(std::string mapfile)