From f225d051d7dc00415617a22ad53021c05c4545bc Mon Sep 17 00:00:00 2001 From: Sean Dobbs Date: Thu, 10 Oct 2024 17:28:49 -0400 Subject: [PATCH 1/3] add handling of writing out all the appropriate fields for FMWPC hits --- src/libraries/FMWPC/DFMWPCHit_factory.cc | 25 +++++++++++---- src/libraries/FMWPC/DFMWPCHit_factory.h | 3 +- src/libraries/HDDM/DEventSourceHDDM.cc | 5 ++- src/libraries/HDDM/DEventWriterHDDM.cc | 41 ++++++++++++++---------- src/libraries/HDDM/event.xml | 9 +++--- 5 files changed, 53 insertions(+), 30 deletions(-) diff --git a/src/libraries/FMWPC/DFMWPCHit_factory.cc b/src/libraries/FMWPC/DFMWPCHit_factory.cc index 13dff0165..96b96a336 100644 --- a/src/libraries/FMWPC/DFMWPCHit_factory.cc +++ b/src/libraries/FMWPC/DFMWPCHit_factory.cc @@ -24,7 +24,8 @@ using namespace jana; jerror_t DFMWPCHit_factory::init(void) { - hit_threshold = 0.; + hit_amp_threshold = 0.; + hit_int_threshold = 0.; t_raw_min = -10000.; t_raw_max = 10000.; @@ -70,15 +71,22 @@ jerror_t DFMWPCHit_factory::brun(jana::JEventLoop *eventLoop, int32_t runnumber) if(print_messages) jout << "In DFMWPCHit_factory, loading constants..." << std::endl; - if (eventLoop->GetCalib("/FMWPC/hit_threshold", hit_threshold)){ - hit_threshold = 0.; + vector fmwpc_hit_thresholds; + + if (eventLoop->GetCalib("/FMWPC/hit_threshold", hit_amp_threshold)){ + hit_amp_threshold = 0.; + hit_int_threshold = 0.; jout << "Error loading /FMWPC/hit_threshold ! set default value to 0." << endl; } else { - jout << "FMWPC Hit Threshold: " << hit_threshold << endl; + hit_amp_threshold = fmwpc_hit_thresholds[0]; + hit_int_threshold = fmwpc_hit_thresholds[1]; + jout << "FMWPC Hit Thresholds: Amplitude = " << hit_amp_threshold << " Integral = " << hit_int_threshold << endl; } - gPARMS->SetDefaultParameter("FMWPC:FMWPC_HIT_THRESHOLD", hit_threshold, - "Remove FMWPC Hits with peak amplitudes smaller than FMWPC_HIT_THRESHOLD"); + gPARMS->SetDefaultParameter("FMWPC:FMWPC_hit_amp_threshold", hit_amp_threshold, + "Remove FMWPC Hits with peak amplitudes smaller than FMWPC_hit_amp_threshold"); + gPARMS->SetDefaultParameter("FMWPC:FMWPC_hit_int_threshold", hit_amp_threshold, + "Remove FMWPC Hits with total integral smaller than FMWPC_hit_int_threshold"); vector fmwpc_timing_cuts; @@ -264,7 +272,10 @@ jerror_t DFMWPCHit_factory::evnt(JEventLoop *loop, uint64_t eventnumber) maxamp = maxamp - scaled_ped; */ - if (maxamppulse_integral < hit_int_threshold) { /// ??? continue; } diff --git a/src/libraries/FMWPC/DFMWPCHit_factory.h b/src/libraries/FMWPC/DFMWPCHit_factory.h index 7c8da02eb..1d2a24366 100644 --- a/src/libraries/FMWPC/DFMWPCHit_factory.h +++ b/src/libraries/FMWPC/DFMWPCHit_factory.h @@ -29,7 +29,8 @@ class DFMWPCHit_factory:public jana::JFactory{ // const char* Tag(void){return "";} // hit threshold - double hit_threshold; + double hit_amp_threshold; + double hit_int_threshold; // timing cut limits double t_raw_min; diff --git a/src/libraries/HDDM/DEventSourceHDDM.cc b/src/libraries/HDDM/DEventSourceHDDM.cc index bcb492ae5..f79df5d3f 100644 --- a/src/libraries/HDDM/DEventSourceHDDM.cc +++ b/src/libraries/HDDM/DEventSourceHDDM.cc @@ -2987,7 +2987,10 @@ jerror_t DEventSourceHDDM::Extract_DFMWPCHit(hddm_s::HDDM *record, JFactoryt = iter->getT(); const hddm_s::FmwpcHitQList &charges=iter->getFmwpcHitQs(); hit->q = (charges.size()) ? charges.begin()->getQ() : 0.; - hit->amp = (charges.size()) ? hit->q/28.8 : 0.; // copied from CDC + const hddm_s::FmwpcDigiHitList &digis=iter->getFmwpcDigiHits(); + hit->amp = (digis.size()) ? digis.begin()->getAmp() : 0.; + hit->QF = (digis.size()) ? digis.begin()->getQf() : 0.; + hit->ped = (digis.size()) ? digis.begin()->getPed() : 0.; data.push_back(hit); } diff --git a/src/libraries/HDDM/DEventWriterHDDM.cc b/src/libraries/HDDM/DEventWriterHDDM.cc index ff62379da..40e09929f 100644 --- a/src/libraries/HDDM/DEventWriterHDDM.cc +++ b/src/libraries/HDDM/DEventWriterHDDM.cc @@ -833,34 +833,41 @@ bool DEventWriterHDDM::Write_HDDMEvent(JEventLoop* locEventLoop, string locOutpu } //=============================================FMWPC================================================ for(uint i=0;iaddForwardMWPCs(); - } + } bool foundChamber=false; hddm_s::FmwpcChamberList* FMWPC_ChamberList = &hitv->getForwardMWPC().getFmwpcChambers(); hddm_s::FmwpcChamberList::iterator FMWPC_ChamberIterator = FMWPC_ChamberList->begin(); for(FMWPC_ChamberIterator = FMWPC_ChamberList->begin(); FMWPC_ChamberIterator != FMWPC_ChamberList->end(); FMWPC_ChamberIterator++) - { - if(FMWPCHits[i]->layer == FMWPC_ChamberIterator->getLayer() && - FMWPCHits[i]->wire == FMWPC_ChamberIterator->getWire()) - { - foundChamber = true; - break; - } - } + { + if(FMWPCHits[i]->layer == FMWPC_ChamberIterator->getLayer() && + FMWPCHits[i]->wire == FMWPC_ChamberIterator->getWire()) + { + foundChamber = true; + break; + } + } if(foundChamber == false) - { - hitv->getForwardMWPC().addFmwpcChambers(); - FMWPC_ChamberIterator = FMWPC_ChamberList->end()-1; - FMWPC_ChamberIterator->setLayer(FMWPCHits[i]->layer); - FMWPC_ChamberIterator->setWire(FMWPCHits[i]->wire); - } + { + hitv->getForwardMWPC().addFmwpcChambers(); + FMWPC_ChamberIterator = FMWPC_ChamberList->end()-1; + FMWPC_ChamberIterator->setLayer(FMWPCHits[i]->layer); + FMWPC_ChamberIterator->setWire(FMWPCHits[i]->wire); + } FMWPC_ChamberIterator->addFmwpcHits(); hddm_s::FmwpcHitList* fmwpchitl=&FMWPC_ChamberIterator->getFmwpcHits(); hddm_s::FmwpcHitList::iterator fmwpchitit=fmwpchitl->end()-1; fmwpchitit->setT(FMWPCHits[i]->t); + fmwpchitit->addFmwpcHitQs(); + fmwpchitit->addFmwpcHitQs().begin()->setQ(FMWPCHits[i]->q); + fmwpchitit->addFmwpcDigiHits(); + fmwpchitit->addFmwpcDigiHits().begin()->setAmp(FMWPCHits[i]->amp); + fmwpchitit->addFmwpcDigiHits().begin()->setPed(FMWPCHits[i]->ped); + fmwpchitit->addFmwpcDigiHits().begin()->setQf(FMWPCHits[i]->QF); + } diff --git a/src/libraries/HDDM/event.xml b/src/libraries/HDDM/event.xml index 685882cb7..6d3a5f8c5 100644 --- a/src/libraries/HDDM/event.xml +++ b/src/libraries/HDDM/event.xml @@ -227,11 +227,12 @@ - - + + - - + + + From 08fce007088cb17c8ee5c667071bfcf9de4f9a66 Mon Sep 17 00:00:00 2001 From: Sean Dobbs Date: Wed, 23 Oct 2024 10:38:46 -0400 Subject: [PATCH 2/3] change comments --- src/libraries/FMWPC/DFMWPCHit_factory.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/libraries/FMWPC/DFMWPCHit_factory.cc b/src/libraries/FMWPC/DFMWPCHit_factory.cc index 96b96a336..b4186f2fb 100644 --- a/src/libraries/FMWPC/DFMWPCHit_factory.cc +++ b/src/libraries/FMWPC/DFMWPCHit_factory.cc @@ -271,11 +271,12 @@ jerror_t DFMWPCHit_factory::evnt(JEventLoop *loop, uint64_t eventnumber) maxamp = maxamp - scaled_ped; */ - + + // apply different thresholds to the amplitude and the integral if (maxamp < hit_amp_threshold) { continue; } - if (digihit->pulse_integral < hit_int_threshold) { /// ??? + if (digihit->pulse_integral < hit_int_threshold) { continue; } From d97555018b73db7f825282526c40267bf01572ac Mon Sep 17 00:00:00 2001 From: Sean Dobbs Date: Fri, 6 Dec 2024 14:23:13 -0500 Subject: [PATCH 3/3] call the correct functions --- src/libraries/HDDM/DEventWriterHDDM.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/libraries/HDDM/DEventWriterHDDM.cc b/src/libraries/HDDM/DEventWriterHDDM.cc index 40e09929f..9e259dbf2 100644 --- a/src/libraries/HDDM/DEventWriterHDDM.cc +++ b/src/libraries/HDDM/DEventWriterHDDM.cc @@ -862,11 +862,11 @@ bool DEventWriterHDDM::Write_HDDMEvent(JEventLoop* locEventLoop, string locOutpu hddm_s::FmwpcHitList::iterator fmwpchitit=fmwpchitl->end()-1; fmwpchitit->setT(FMWPCHits[i]->t); fmwpchitit->addFmwpcHitQs(); - fmwpchitit->addFmwpcHitQs().begin()->setQ(FMWPCHits[i]->q); + fmwpchitit->getFmwpcHitQs().begin()->setQ(FMWPCHits[i]->q); fmwpchitit->addFmwpcDigiHits(); - fmwpchitit->addFmwpcDigiHits().begin()->setAmp(FMWPCHits[i]->amp); - fmwpchitit->addFmwpcDigiHits().begin()->setPed(FMWPCHits[i]->ped); - fmwpchitit->addFmwpcDigiHits().begin()->setQf(FMWPCHits[i]->QF); + fmwpchitit->getFmwpcDigiHits().begin()->setAmp(FMWPCHits[i]->amp); + fmwpchitit->getFmwpcDigiHits().begin()->setPed(FMWPCHits[i]->ped); + fmwpchitit->getFmwpcDigiHits().begin()->setQf(FMWPCHits[i]->QF); }