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

updates for CPP low level hits #848

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
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
28 changes: 20 additions & 8 deletions src/libraries/FMWPC/DFMWPCHit_factory.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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.;
Expand Down Expand Up @@ -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<double> 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<double> fmwpc_timing_cuts;

Expand Down Expand Up @@ -263,8 +271,12 @@ jerror_t DFMWPCHit_factory::evnt(JEventLoop *loop, uint64_t eventnumber)

maxamp = maxamp - scaled_ped;
*/

if (maxamp<hit_threshold) {

// apply different thresholds to the amplitude and the integral
if (maxamp < hit_amp_threshold) {
continue;
}
if (digihit->pulse_integral < hit_int_threshold) {
continue;
}

Expand Down
3 changes: 2 additions & 1 deletion src/libraries/FMWPC/DFMWPCHit_factory.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ class DFMWPCHit_factory:public jana::JFactory<DFMWPCHit>{
// 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;
Expand Down
5 changes: 4 additions & 1 deletion src/libraries/HDDM/DEventSourceHDDM.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3009,7 +3009,10 @@ jerror_t DEventSourceHDDM::Extract_DFMWPCHit(hddm_s::HDDM *record, JFactory<DFM
hit->t = 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);
}

Expand Down
41 changes: 24 additions & 17 deletions src/libraries/HDDM/DEventWriterHDDM.cc
Original file line number Diff line number Diff line change
Expand Up @@ -833,34 +833,41 @@ bool DEventWriterHDDM::Write_HDDMEvent(JEventLoop* locEventLoop, string locOutpu
}
//=============================================FMWPC================================================
for(uint i=0;i<FMWPCHits.size();++i)
{
{
if(i==0)
{
{
hitv->addForwardMWPCs();
}
}
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->getFmwpcHitQs().begin()->setQ(FMWPCHits[i]->q);
fmwpchitit->addFmwpcDigiHits();
fmwpchitit->getFmwpcDigiHits().begin()->setAmp(FMWPCHits[i]->amp);
fmwpchitit->getFmwpcDigiHits().begin()->setPed(FMWPCHits[i]->ped);
fmwpchitit->getFmwpcDigiHits().begin()->setQf(FMWPCHits[i]->QF);

}


Expand Down
1 change: 1 addition & 0 deletions src/libraries/HDDM/event.xml
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,7 @@
</fmwpcTruthHit>
<fmwpcHit dE="float" maxOccurs="unbounded" t="float">
<fmwpcHitQ q="float" maxOccurs="unbounded"/>
<fmwpcDigiHit minOccurs="0" amp="float" qf="int" ped="float" />
</fmwpcHit>
</fmwpcChamber>
<fmwpcTruthPoint E="float" maxOccurs="unbounded" minOccurs="0" primary="boolean" ptype="int" px="float" py="float" pz="float" t="float" track="int" x="float" y="float" z="float">
Expand Down