Commit c07b98bb authored by Daniil Rastorguev's avatar Daniil Rastorguev
Browse files

CorryWriter: calculate coordinate offset just once

parent c21eba08
Loading
Loading
Loading
Loading
+8 −8
Original line number Diff line number Diff line
@@ -106,6 +106,14 @@ void CorryvreckanWriterModule::run(Event* event) {
    for(auto& message : pixel_messages) {

        auto detector_name = message->getDetector()->getName();

        // Calculate coordinate system offset for MC truth storage
        // Corryvreckan coordinates originate at the center of the matrix
        auto detector_model = message->getDetector()->getModel();
        auto pixel_size = detector_model->getPixelSize();
        ROOT::Math::XYZVector offset(pixel_size.X() / 2, pixel_size.Y() / 2, 0);
        offset -= detector_model->getMatrixSize() / 2;

        LOG(DEBUG) << "Received " << message->getData().size() << " pixel hits from detector " << detector_name;

        if(write_list_px_.find(detector_name) == write_list_px_.end()) {
@@ -157,14 +165,6 @@ void CorryvreckanWriterModule::run(Event* event) {
                continue;
            }

            // Calculate coordinate system offset
            // Corryvreckan coordinates originate at the center of the matrix

            auto detector_model = message->getDetector()->getModel();
            auto pixel_size = detector_model->getPixelSize();
            ROOT::Math::XYZVector offset(pixel_size.X() / 2, pixel_size.Y() / 2, 0);
            offset -= detector_model->getMatrixSize() / 2;

            // Get all associated particles
            auto mcp = apx_pixel.getMCParticles();
            LOG(DEBUG) << "Received " << mcp.size() << " Monte Carlo particles from pixel hit";