Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make FMWPC wire locations compatible with using cm as units #189

Merged
merged 2 commits into from
Apr 13, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions src/GlueXSensitiveDetectorFMWPC.cc
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,12 @@ double GlueXSensitiveDetectorFMWPC::TWO_HIT_TIME_RESOL = 400*ns;
// Minimum photoelectron count for a hit
double GlueXSensitiveDetectorFMWPC::THRESH_KEV = 0.;

// Coordinate of wire 0, transverse to wire direction
double GlueXSensitiveDetectorFMWPC::WIRE_OFFSET = -73*cm;

// Minimum photoelectron count for a hit
double GlueXSensitiveDetectorFMWPC::WIRE_PITCH = 1.0*cm;

int GlueXSensitiveDetectorFMWPC::instanceCount = 0;
G4Mutex GlueXSensitiveDetectorFMWPC::fMutex = G4MUTEX_INITIALIZER;

Expand Down Expand Up @@ -184,13 +190,19 @@ G4bool GlueXSensitiveDetectorFMWPC::ProcessHits(G4Step* step,
int wire = 0;
if (layer % 2 != 0) {
// Vertical wires
wire = floor(x[0] + 73.0);
wire = floor(x[0] - WIRE_OFFSET)/WIRE_PITCH;
}
else {
// Horizontal wires
wire = floor(x[1] + 73.0);
wire = floor(x[1] - WIRE_OFFSET)/WIRE_PITCH;
}
if (layer == 6) {
// Vertical wires
wire = floor(x[0] - WIRE_OFFSET)/WIRE_PITCH;
}

//cout<<"MWPC: layer/wire = "<<layer<<" / "<<wire<<endl;

if (wire < 1 || wire > 144)
return false;

Expand Down
2 changes: 2 additions & 0 deletions src/GlueXSensitiveDetectorFMWPC.hh
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ class GlueXSensitiveDetectorFMWPC : public G4VSensitiveDetector
static int MAX_HITS;
static double TWO_HIT_TIME_RESOL;
static double THRESH_KEV;
static double WIRE_OFFSET;
static double WIRE_PITCH;

static int instanceCount;
static G4Mutex fMutex;
Expand Down