Skip to content

Commit

Permalink
Merge pull request #212 from JeffersonLab/overlapping_hodo_micro_rang…
Browse files Browse the repository at this point in the history
…es_rtj

* add support for overlapping microscope and hodoscope energy ranges …
  • Loading branch information
eltonssmith authored Apr 12, 2022
2 parents 782a4cb + 5fa48a6 commit 74535a7
Showing 1 changed file with 16 additions and 15 deletions.
31 changes: 16 additions & 15 deletions src/GlueXPseudoDetectorTAG.cc
Original file line number Diff line number Diff line change
Expand Up @@ -120,29 +120,30 @@ int GlueXPseudoDetectorTAG::addTaggerPhoton(const G4Event *event,

int micro_channel = -1;
int hodo_channel = -1;
double E = energy;
double micro_energy = energy;
double hodo_energy = energy;

if (E < MICRO_LIMITS_ERANGE[0] && E > MICRO_LIMITS_ERANGE[1]) {
int i = MICRO_NCHANNELS * (E - MICRO_LIMITS_ERANGE[0]) /
if (energy < MICRO_LIMITS_ERANGE[0] && energy > MICRO_LIMITS_ERANGE[1]) {
int i = MICRO_NCHANNELS * (energy - MICRO_LIMITS_ERANGE[0]) /
(MICRO_LIMITS_ERANGE[1] - MICRO_LIMITS_ERANGE[0]);
while (E < MICRO_CHANNEL_EMIN[i] || MICRO_CHANNEL_EMIN[i] < 1.)
while (energy < MICRO_CHANNEL_EMIN[i] || MICRO_CHANNEL_EMIN[i] < 1.)
++i;
while (E > MICRO_CHANNEL_EMAX[i] || MICRO_CHANNEL_EMAX[i] < 1.)
while (energy > MICRO_CHANNEL_EMAX[i] || MICRO_CHANNEL_EMAX[i] < 1.)
--i;
if (E >= MICRO_CHANNEL_EMIN[i] && E <= MICRO_CHANNEL_EMAX[i]) {
E = (MICRO_CHANNEL_EMIN[i] + MICRO_CHANNEL_EMAX[i]) / 2;
if (energy >= MICRO_CHANNEL_EMIN[i] && energy <= MICRO_CHANNEL_EMAX[i]) {
micro_energy = (MICRO_CHANNEL_EMIN[i] + MICRO_CHANNEL_EMAX[i]) / 2;
micro_channel = MICRO_CHANNEL_NUMBER[i];
}
}
else if (E < HODO_LIMITS_ERANGE[0] && E > HODO_LIMITS_ERANGE[1]) {
int i = HODO_NCHANNELS * (E - HODO_LIMITS_ERANGE[0]) /
if (energy < HODO_LIMITS_ERANGE[0] && energy > HODO_LIMITS_ERANGE[1]) {
int i = HODO_NCHANNELS * (energy - HODO_LIMITS_ERANGE[0]) /
(HODO_LIMITS_ERANGE[1] - HODO_LIMITS_ERANGE[0]);
while (E < HODO_CHANNEL_EMIN[i] || HODO_CHANNEL_EMIN[i] < 1.)
while (energy < HODO_CHANNEL_EMIN[i] || HODO_CHANNEL_EMIN[i] < 1.)
++i;
while (E > HODO_CHANNEL_EMAX[i] || HODO_CHANNEL_EMAX[i] < 1.)
while (energy > HODO_CHANNEL_EMAX[i] || HODO_CHANNEL_EMAX[i] < 1.)
--i;
if (E >= HODO_CHANNEL_EMIN[i] && E <= HODO_CHANNEL_EMAX[i]) {
E = (HODO_CHANNEL_EMIN[i] + HODO_CHANNEL_EMAX[i]) / 2;
if (energy >= HODO_CHANNEL_EMIN[i] && energy <= HODO_CHANNEL_EMAX[i]) {
hodo_energy = (HODO_CHANNEL_EMIN[i] + HODO_CHANNEL_EMAX[i]) / 2;
hodo_channel = HODO_CHANNEL_NUMBER[i];
}
}
Expand Down Expand Up @@ -187,7 +188,7 @@ int GlueXPseudoDetectorTAG::addTaggerPhoton(const G4Event *event,
citer = columns.begin();
citer->setColumn(micro_channel);
citer->setRow(0);
citer->setE(E/GeV);
citer->setE(micro_energy/GeV);
}
hddm_s::TaggerTruthHitList hits = citer->getTaggerTruthHits();
hddm_s::TaggerTruthHitList::iterator hiter;
Expand Down Expand Up @@ -236,7 +237,7 @@ int GlueXPseudoDetectorTAG::addTaggerPhoton(const G4Event *event,
counters = tagger.addHodoChannels();
citer = counters.begin();
citer->setCounterId(hodo_channel);
citer->setE(E/GeV);
citer->setE(hodo_energy/GeV);
}
hddm_s::TaggerTruthHitList hits = citer->getTaggerTruthHits();
hddm_s::TaggerTruthHitList::iterator hiter;
Expand Down

0 comments on commit 74535a7

Please sign in to comment.