/* This file is part of MAUS: http://micewww.pp.rl.ac.uk:8080/projects/maus * * MAUS is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * MAUS is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with MAUS. If not, see . * */ /** @class MapCppTrackerMCCalibratedNoise * * Simulate noise in the tracker electronics. */ #ifndef _COMPONENTS_MAP_MapCppTrackerMCCalibratedNoise_H_ #define _COMPONENTS_MAP_MapCppTrackerMCCalibratedNoise_H_ // C headers #include #include #include // C++ headers #include #include #include #include #include "TH1D.h" // MAUS headers #include "Config/MiceModule.hh" #include "Utils/Exception.hh" #include "Utils/Squeak.hh" #include "src/common_cpp/Utils/CppErrorHandler.hh" #include "src/common_cpp/Utils/Globals.hh" #include "src/common_cpp/Globals/GlobalsManager.hh" #include "src/common_cpp/DataStructure/SciFiNoiseHit.hh" #include "src/common_cpp/DataStructure/MCEvent.hh" #include "src/common_cpp/DataStructure/Spill.hh" #include "src/common_cpp/API/MapBase.hh" #include "src/common_cpp/JsonCppProcessors/SpillProcessor.hh" #include "src/common_cpp/Recon/SciFi/RealDataDigitization.hh" namespace MAUS { class MapCppTrackerMCCalibratedNoise : public MapBase { public: /** Constructor - initialises pointers to NULL */ MapCppTrackerMCCalibratedNoise(); /** Constructor - deletes any allocated memory */ ~MapCppTrackerMCCalibratedNoise(); private: /** Sets up the worker */ void _birth(const std::string& argJsonConfigDocument); /** Shuts down the worker */ void _death(); /** @brief Process Data object * * Receive a structure with SciFi digits and returns * a structure with simulated noise digits added */ void _process(Data* data) const; /** @brief Simulates dark count * * Check each SciFi channel for Dark PEs * adds results to SciFiDigits */ private: int calc_uid(int chan_ro, int bank) const { return chan_ro + (bank*128); } int calc_chan_id(int tracker, int station, int plane, int channel) const { \ return channel + 217*plane + 217*3*(station-1) + 217*3*5*tracker; } bool _load_calibrations(std::string, std::string, std::string); std::pair _calculateNPE(int, int, int, int) const; int _calculatePlotID(int, int, int) const; std::string _calibrationNoiseFilename; std::vector _calibrationNoiseData; std::vector< std::pair > _calibration; double _npe_scaling_factor; double _rate_scaling_factor; // MapCppMCNoise setup containers /// This will contain the configuration Json::Value* _configJSON; /// This will contain the root value before parsing std::string argJsonConfigDocument; /// This will contain all SciFi elements in MICE std::vector SF_modules; }; } // end namespace #endif