Skip to content

Commit a72e486

Browse files
committed
Add dark noise options to WCSimRootOptions
Add SaveOptionsToOutput() method to WCSimWCAddDarkNoise class Use it in WCSimEventAction Add Print() to WCSimRootOptions
1 parent 50e67df commit a72e486

6 files changed

+75
-10
lines changed

include/WCSimEventAction.hh

+1
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ private:
5353
G4String DigitizerChoice;
5454
G4String TriggerChoice;
5555
bool ConstructedDAQClasses;
56+
bool SavedDAQOptions;
5657
};
5758

5859

include/WCSimRootOptions.hh

+26-7
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,36 @@ class TDirectory;
1717

1818
class WCSimRootOptions : public TObject {
1919

20-
private:
21-
22-
2320
public:
2421

2522
WCSimRootOptions();
2623
virtual ~WCSimRootOptions();
27-
28-
// Sets and gets
29-
30-
24+
void Print();
25+
26+
//WCSimWCAddDarkNoise sets
27+
void SetPMTDarkRate(double iPMTDarkRate) {PMTDarkRate = iPMTDarkRate;}
28+
void SetConvRate(double iConvRate) {ConvRate = iConvRate;}
29+
void SetDarkHigh(double iDarkHigh) {DarkHigh = iDarkHigh;}
30+
void SetDarkLow(double iDarkLow) {DarkLow = iDarkLow;}
31+
void SetDarkWindow(double iDarkWindow) {DarkWindow = iDarkWindow;}
32+
void SetDarkMode(int iDarkMode) {DarkMode = iDarkMode;}
33+
//WCSimWCAddDarkNoise gets
34+
double GetPMTDarkRate() {return PMTDarkRate;}
35+
double GetConvRate() {return ConvRate;}
36+
double GetDarkHigh() {return DarkHigh;}
37+
double GetDarkLow() {return DarkLow;}
38+
double GetDarkWindow() {return DarkWindow;}
39+
int GetDarkMode() {return DarkMode;}
40+
41+
private:
42+
//WCSimWCAddDarkNoise
43+
double PMTDarkRate; // kHz
44+
double ConvRate; // kHz
45+
double DarkHigh; //ns
46+
double DarkLow; //ns
47+
double DarkWindow; //ns
48+
int DarkMode;
49+
3150
ClassDef(WCSimRootOptions,1) //WCSimRootEvent structure
3251
};
3352

include/WCSimWCAddDarkNoise.hh

+3-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
#include "G4VDigitizerModule.hh"
77
#include "WCSimWCDigi.hh"
88
#include "WCSimWCHit.hh"
9+
#include "WCSimRootOptions.hh"
910
#include "globals.hh"
1011
#include "Randomize.hh"
1112
#include <map>
@@ -32,7 +33,8 @@ public:
3233
void SetDarkHigh(int idarkhigh){DarkHigh = idarkhigh;}
3334
void SetDarkLow(int idarklow){DarkLow = idarklow;}
3435
void SetDarkWindow(int idarkwindow){DarkWindow = idarkwindow;}
35-
36+
void SaveOptionsToOutput(WCSimRootOptions * wcopt);
37+
3638
private:
3739
void ReInitialize() { ranges.clear(); result.clear();}
3840
void SetPMTDarkDefaults();

src/WCSimEventAction.cc

+17-2
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,8 @@ WCSimEventAction::WCSimEventAction(WCSimRunAction* myRun,
5959
WCSimPrimaryGeneratorAction* myGenerator)
6060
:runAction(myRun), generatorAction(myGenerator),
6161
detectorConstructor(myDetector),
62-
ConstructedDAQClasses(false)
62+
ConstructedDAQClasses(false),
63+
SavedDAQOptions(false)
6364
{
6465
DAQMessenger = new WCSimWCDAQMessenger(this);
6566

@@ -120,8 +121,13 @@ void WCSimEventAction::CreateDAQInstances()
120121

121122
void WCSimEventAction::BeginOfEventAction(const G4Event*)
122123
{
123-
if(!ConstructedDAQClasses)
124+
if(!ConstructedDAQClasses) {
124125
CreateDAQInstances();
126+
127+
//and save options in output file
128+
G4DigiManager* DMman = G4DigiManager::GetDMpointer();
129+
130+
}
125131
}
126132

127133
void WCSimEventAction::EndOfEventAction(const G4Event* evt)
@@ -393,6 +399,15 @@ void WCSimEventAction::EndOfEventAction(const G4Event* evt)
393399
WCDC_hits,
394400
WCDC);
395401

402+
//save DAQ options here. This ensures that when the user selects a default option
403+
// (e.g. with -99), the saved option value in the output reflects what was run
404+
if(!SavedDAQOptions) {
405+
WCSimRootOptions * wcsimopt = runAction->GetRootOptions();
406+
//Dark noise
407+
WCDNM->SaveOptionsToOutput(wcsimopt);
408+
409+
SavedDAQOptions = true;
410+
}
396411
}
397412

398413
G4int WCSimEventAction::WCSimEventFindStartingVolume(G4ThreeVector vtx)

src/WCSimRootOptions.cc

+18
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
11
////////////////////////////////////////////////////////////////////////
22

33
#include "TObject.h"
4+
#include <iostream>
45

56
#include "WCSimRootOptions.hh"
67

78
#ifndef REFLEX_DICTIONARY
89
ClassImp(WCSimRootOptions)
910
#endif
1011

12+
using std::endl;
13+
using std::cout;
14+
1115
//______________________________________________________________________________
1216
WCSimRootOptions::WCSimRootOptions()
1317
{
@@ -19,3 +23,17 @@ WCSimRootOptions::WCSimRootOptions()
1923
WCSimRootOptions::~WCSimRootOptions()
2024
{
2125
}
26+
27+
//______________________________________________________________________________
28+
void WCSimRootOptions::Print()
29+
{
30+
cout
31+
<< "Dark Noise options" << endl
32+
<< "\tPMTDarkRate: " << PMTDarkRate << " kHz" << endl
33+
<< "\tConvRate: " << ConvRate << " kHz" << endl
34+
<< "\tDarkHigh: " << DarkHigh << " ns" << endl
35+
<< "\tDarkLow: " << DarkLow << " ns" << endl
36+
<< "\tDarkWindow: " << DarkWindow << " ns" << endl
37+
<< "\tDarkMode: " << DarkMode << endl
38+
<< endl;
39+
}

src/WCSimWCAddDarkNoise.cc

+10
Original file line numberDiff line numberDiff line change
@@ -280,3 +280,13 @@ void WCSimWCAddDarkNoise::FindDarkNoiseRanges(WCSimWCDigitsCollection* WCHCPMT,
280280
//now we should have a vector of non-overlapping range pairs to pass to the
281281
//dark noise routine
282282
}
283+
284+
void WCSimWCAddDarkNoise::SaveOptionsToOutput(WCSimRootOptions * wcopt)
285+
{
286+
wcopt->SetPMTDarkRate(PMTDarkRate);
287+
wcopt->SetConvRate(ConvRate);
288+
wcopt->SetDarkHigh(DarkHigh);
289+
wcopt->SetDarkLow(DarkLow);
290+
wcopt->SetDarkWindow(DarkWindow);
291+
wcopt->SetDarkMode(DarkMode);
292+
}

0 commit comments

Comments
 (0)