Skip to content
Snippets Groups Projects
AnalysisTimingATLASpix.h 4.95 KiB
Newer Older
 * @brief Definition of [AnalysisTimingATLASpix] module
 *
 * @copyright Copyright (c) 2018-2020 CERN and the Corryvreckan authors.
 * This software is distributed under the terms of the MIT License, copied verbatim in the file "LICENSE.md".
 * In applying this license, CERN does not waive the privileges and immunities granted to it by virtue of its status as an
 * Intergovernmental Organization or submit itself to any jurisdiction.
 * *
 * Refer to the User's Manual for more details.
 */

#include <iostream>
#include "TGraphErrors.h"
#include "TH1F.h"
#include "TH2F.h"
#include "TProfile2D.h"
#include "core/module/Module.hpp"

namespace corryvreckan {
    /** @ingroup Modules
     * @brief Module to do function
     *
     * More detailed explanation of module
     */
    class AnalysisTimingATLASpix : public Module {

    public:
        /**
         * @brief Constructor for this unique module
         * @param config Configuration object for this module as retrieved from the steering file
         * @param detector Pointer to the detector for this module instance
         */
        AnalysisTimingATLASpix(Configuration config, std::shared_ptr<Detector> detector);
        void initialise();
        StatusCode run(std::shared_ptr<Clipboard> clipboard);
        void finalise();

    private:
        std::shared_ptr<Detector> m_detector;

        // timing correction functions:
        void correctClusterTimestamp(Cluster*, int mode);

        // 1D histograms:
        TH1F* hTrackCorrelationTime;
        TH1F* hTrackCorrelationTimeAssoc;
        TH1F* hTrackCorrelationTime_rowCorr;
        TH1F* hTrackCorrelationTime_rowAndTWCorr;
        TH1F* hTrackCorrelationTime_rowAndTWCorr_l25;
        TH1F* hTrackCorrelationTime_rowAndTWCorr_l40;
        TH1F* hTrackCorrelationTime_rowAndTWCorr_g40;
        TH2F* hTrackCorrelationTimeAssocVsTime;
        TH2F* hTrackCorrelationTimeVsCol; // control plot only
        TH2F* hTrackCorrelationTimeVsRow;
        TH2F* hTrackCorrelationTimeVsRow_1px;
        TH2F* hTrackCorrelationTimeVsRow_npx;
        TH2F* hTrackCorrelationTimeVsRow_rowCorr;
        TH2F* hTrackCorrelationTimeVsTot;
        TH2F* hTrackCorrelationTimeVsTot_1px;
        TH2F* hTrackCorrelationTimeVsTot_npx;
        TH2F* hTrackCorrelationTimeVsTot_rowCorr;
        TH2F* hTrackCorrelationTimeVsTot_rowCorr_1px;
        TH2F* hTrackCorrelationTimeVsTot_rowCorr_npx;
        TH2F* hTrackCorrelationTimeVsRow_rowAndTWCorr;
        TH2F* hTrackCorrelationTimeVsTot_rowAndTWCorr;
        TProfile2D* hPixelTrackCorrelationTimeMap;

        TH2F* hClusterSizeVsTot_Assoc;

        TH2F* hHitMapAssoc;
        // Control Plots for "left/right tail" and "main peak" of time correlation
        TH2F* hInPixelMap_rightTail;
        TH2F* hInPixelMap_mainPeak;
        TH1F* hTot_leftTail_1px;
        TH1F* hTot_rightTail_1px;
        TH1F* hTot_mainPeak_1px;

        // TGraphErrors:
        TGraphErrors* gTimeCorrelationVsRow;
        TGraphErrors* gTimeCorrelationVsTot_rowCorr;
        TGraphErrors* gTimeCorrelationVsTot_rowCorr_1px;
        TGraphErrors* gTimeCorrelationVsTot_rowCorr_npx;

        TGraphErrors* gRowCorr;
        TGraphErrors* gTimeWalkCorr;

        // Member Variables:
        std::string m_DUT;
        double m_chi2ndofCut;
        double m_timeCutFrameEdge;
        int m_highTotCut; // for pixel->tot()
        int m_lowTotCut;  // for pixel->tot()
        double m_timingTailCut;
        std::string m_correctionFile_timewalk;
        std::string m_correctionGraph_timewalk;
        bool m_calcCorrections;
        bool m_pointwise_correction_row;
        bool m_pointwise_correction_timewalk;
        int m_totBinExample;

        int total_tracks_uncut;
        int tracks_afterChi2Cut;
        int tracks_hasIntercept;
        int tracks_isWithinROI;
        int tracks_afterMasking;
        int total_tracks;
        int matched_tracks;
        int tracks_afterClusterSizeCut;
    };

} // namespace corryvreckan