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

Plane-to-layer conversion in ROI refinement #331

Open
wenqiang-gu opened this issue Aug 20, 2024 · 1 comment
Open

Plane-to-layer conversion in ROI refinement #331

wenqiang-gu opened this issue Aug 20, 2024 · 1 comment

Comments

@wenqiang-gu
Copy link
Member

This issue is related to #322, where we convert "planeID" to "layerID" for PDHD APA1 inside OmnibusSigProc.

This trick works perfectly for the entire signal processing chain until recently I wanted to turn on MP2 ROI protection. Because MP2ROI uses a function anode->resolve(chid) to get "planeID", we need another conversion. Fortunately, it's the only place that the function anode->resolve() is used in ROI_refinement and ROI_formation.

// mp2: 2 plane protection based on cleaup ROI
void ROI_refinement::MP2ROI(const int target_plane, const IAnodePlane::pointer anode, const IAnodeFace::pointer face,
                            const std::map<int, int>& map_roichid_anodechid, ROI_formation& roi_form,
                            const double mp_th1, const double mp_th2,
                            const int tick_resolution, const int wire_resolution,
                            const int nbounds_layers)
{
...

    std::map<int, int> map_wireid_roichid[3];
    for (auto chident : anode->channels()) {  
        auto iplane = anode->resolve(chident).index(); // FIXME for PDHD APA1 !!!
        auto roichid = map_anodechid_roichid[chident];
        auto ch = anode->channel(chident);
        auto wires = ch->wires();
        for (auto wire : wires) {
            if (face->which() != wire->planeid().face()) continue;
            auto wireid = wire->index();
            map_wireid_roichid[iplane][wireid] = roichid;
        }
    }
...
}

@HaiwangYu do you think it's good to pass the conversion array to void ROI_refinement::MP2ROI()? e.g.,

void ROI_refinement::MP2ROI(const int target_plane, const IAnodePlane::pointer anode, const IAnodeFace::pointer face,
                            const std::map<int, int>& map_roichid_anodechid, ROI_formation& roi_form,
                            const double mp_th1, const double mp_th2,
                            const int tick_resolution, const int wire_resolution,
                            const int nbounds_layers,
                            const std::vector<int> iplane2ilayer={0,1,2})
{
...

    for (auto chident : anode->channels()) {  
        auto iplane = anode->resolve(chident).index(); 
        iplane = iplane2ilayer[iplane]; // do a conversion here, default setting is backwards compatible
        ..
    }

...
}
@wenqiang-gu
Copy link
Member Author

Submitted a PR #335

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant