25#include "TStopwatch.h"
42 std::ostringstream stream;
47int main(
int argc,
char* argv[])
69 gQwOptions.SetConfigFile(
"qwmockdataanalysis.conf");
88 std::vector <QwDetectorArray*> detchannels;
89 std::vector <VQwSubsystem*> tempvector = detectors.
GetSubsystemByType(
"QwDetectorArray");
92 for (std::size_t i = 0; i < tempvector.size(); i++){
102 UInt_t runnumber_min = (UInt_t)
gQwOptions.GetIntValuePairFirst(
"run");
103 UInt_t runnumber_max = (UInt_t)
gQwOptions.GetIntValuePairLast(
"run");
104 for (UInt_t run = runnumber_min;
105 run <= runnumber_max;
116 TString filename = Form(
"%sQwMock_%u.log", eventbuffer.
GetDataDirectory().Data(), run);
119 std::cout <<
"Error: could not open ET stream!" << std::endl;
123 if (eventbuffer.
OpenDataFile(filename,
"W") != CODA_OK) {
124 std::cout <<
"Error: could not open file!" << std::endl;
138 unsigned int seed = 0x1234 ^ run;
143 if (
kDebug) std::cout <<
"Starting event loop..." << std::endl;
144 Int_t eventnumber_min =
gQwOptions.GetIntValuePairFirst(
"event");
145 Int_t eventnumber_max =
gQwOptions.GetIntValuePairLast(
"event");
148 if (abs(eventnumber_max - eventnumber_min) < 10)
149 QwWarning <<
"Only " << abs(eventnumber_max - eventnumber_min)
153 for (Int_t event = eventnumber_min;
event <= eventnumber_max;
event++) {
171 else std::cout <<
"?";
175 else std::cout <<
"(?) ";
195 for (std::size_t i = 0; i < detchannels.size(); i++){
196 detchannels[i]->ExchangeProcessedData();
197 detchannels[i]->RandomizeMollerEvent(myhelicity);
202 if (status != CODA_OK) {
208 constexpr int nevents =
kDebug ? 1000 : 10000;
209 if (event % nevents == 0) {
210 QwMessage <<
"Generated " <<
event <<
" events ";
212 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.
int main(int argc, char *argv[])
std::string stringify(int i)
static const bool kBeamTrips
static const int kMultiplet
Beamline subsystem containing BPMs, BCMs, and other beam monitoring devices.
Load the options for the parity subsystems.
void DefineOptionsParity(QwOptions &options)
Subsystem array container for parity analysis with asymmetry calculations.
Blinded detector array for PMT analysis.
Helicity state management and pattern recognition.
Detector array for PMT analysis with integration and combination.
Helicity pattern analysis and management.
static void Seed(uint seedval)
Seed the internal Random Variable.
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)