13#include <boost/random.hpp>
43 std::ostringstream stream;
48int main(
int argc,
char* argv[])
70 gQwOptions.SetConfigFile(
"qwmockdataanalysis.conf");
105 std::vector <QwDetectorArray*> detchannels;
106 std::vector <VQwSubsystem*> tempvector = detectors.
GetSubsystemByType(
"QwDetectorArray");
109 for (std::size_t i = 0; i < tempvector.size(); i++){
153 boost::mt19937 randomnessGenerator(999);
154 boost::normal_distribution<double> normalDistribution;
155 boost::variate_generator
156 < boost::mt19937, boost::normal_distribution<double> >
157 normal(randomnessGenerator, normalDistribution);
166 UInt_t runnumber_min = (UInt_t)
gQwOptions.GetIntValuePairFirst(
"run");
167 UInt_t runnumber_max = (UInt_t)
gQwOptions.GetIntValuePairLast(
"run");
168 for (UInt_t run = runnumber_min;
169 run <= runnumber_max;
178 TString filename = Form(
"%sQwMock_%u.log", eventbuffer.
GetDataDirectory().Data(), run);
179 if (eventbuffer.
OpenDataFile(filename,
"W") != CODA_OK) {
180 std::cout <<
"Error: could not open file!" << std::endl;
193 unsigned int seed = 0x1234 ^ run;
198 if (
kDebug) std::cout <<
"Starting event loop..." << std::endl;
199 Int_t eventnumber_min =
gQwOptions.GetIntValuePairFirst(
"event");
200 Int_t eventnumber_max =
gQwOptions.GetIntValuePairLast(
"event");
203 if (abs(eventnumber_max - eventnumber_min) < 10)
204 QwWarning <<
"Only " << abs(eventnumber_max - eventnumber_min)
208 for (Int_t event = eventnumber_min;
event <= eventnumber_max;
event++) {
226 else std::cout <<
"?";
230 else std::cout <<
"(?) ";
269 for (
int var = 0; var <
NVARS; var++) {
274 C[0][0] = 1.0; C[0][1] = 0.5; C[0][2] = 0.5;
275 C[1][0] = 0.0; C[1][1] = 1.32288; C[1][2] = 0.03780;
276 C[2][0] = 0.0; C[2][1] = 0.0; C[2][2] = 1.11739;
277 for (
int i = 0; i <
NVARS; i++)
278 for (
int j = 0; j <
NVARS; j++)
279 x[i] += C[j][i] * z[j];
292 for (std::size_t i = 0; i < detchannels.size(); i++){
293 detchannels[i]->ExchangeProcessedData();
294 detchannels[i]->RandomizeMollerEvent(myhelicity);
301 if ((
kDebug && event % 1000 == 0)
302 || event % 10000 == 0)
303 std::cout <<
"Generated " <<
event <<
" events." << std::endl;
const std::string getenv_safe_string(const char *name)
A logfile class, based on an identical class in the Hermes analyzer.
#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.
void SetFirstBits(UInt_t nbits, UInt_t firstbits)
Int_t GetHelicityDelayed()
UInt_t GetRandomSeedDelayed()
void SetEventPatternPhase(Int_t event, Int_t pattern, Int_t phase)
UInt_t GetRandomSeedActual()
Int_t GetHelicityActual()
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)