ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/grimes/L1Menu/interface/l1menu/TriggerRatePlot.h
Revision: 1.4
Committed: Fri Jun 28 14:30:07 2013 UTC (11 years, 10 months ago) by grimes
Content type: text/plain
Branch: MAIN
Changes since 1.3: +7 -4 lines
Log Message:
Added ICachedTrigger to speed up processing

File Contents

# User Rev Content
1 grimes 1.1 #ifndef l1menu_TriggerRatePlot_h
2     #define l1menu_TriggerRatePlot_h
3    
4     #include <memory>
5     #include <string>
6    
7     //
8     // Forward declarations
9     //
10     class TH1;
11     namespace l1menu
12     {
13     class ITrigger;
14 grimes 1.4 class L1TriggerDPGEvent;
15 grimes 1.2 class ReducedMenuSample;
16 grimes 1.4 class ReducedEvent;
17     class ISample;
18 grimes 1.1 }
19    
20    
21     namespace l1menu
22     {
23     /** @brief Class that plots trigger rates versus threshold.
24     *
25     * @author Mark Grimes (mark.grimes@bristol.ac.uk)
26     * @date 24/May/2013
27     */
28     class TriggerRatePlot
29     {
30     public:
31     /** @brief Constructor that sets the trigger to plot for, the histogram to plot into, and the trigger parameter to vary.
32     *
33     * Note that the title of the histogram is modified to record the state of the trigger (all other parameters).
34     *
35     * @param[in] trigger The trigger that the plot will be created for. The trigger should be set exactly as you want
36     * the plots made for it, e.g. with the correct eta cuts already set. The other thresholds are
37     * not modified so you should set these to zero beforehand if that's what you want. The trigger
38     * is copied so these cannot be changed afterwards.
39     * @param[in] pHistogram The root histogram to fill with the rates. This should be set up with the required binning
40     * beforehand. The title is changed to record the trigger name, version, parameter plotted against
41     * and other parameter values.
42     * @param[in] versusParameter The trigger parameter to plot along the x-axis. Defaults to "threshold1".
43     */
44     TriggerRatePlot( const l1menu::ITrigger& trigger, std::unique_ptr<TH1> pHistogram, const std::string versusParameter="threshold1" );
45 grimes 1.2 TriggerRatePlot( l1menu::TriggerRatePlot& otherTriggerRatePlot ) = delete;
46     TriggerRatePlot& operator=( l1menu::TriggerRatePlot& otherTriggerRatePlot ) = delete;
47 grimes 1.1
48     /** @brief Explicit rvalue constructor to allow moving of TriggerRatePlot objects. */
49     TriggerRatePlot( l1menu::TriggerRatePlot&& otherTriggerRatePlot ) noexcept;
50     /** @brief Explicit rvalue assignment operator to allow moving of TriggerRatePlot objects. */
51     TriggerRatePlot& operator=( l1menu::TriggerRatePlot&& otherTriggerRatePlot ) noexcept;
52    
53     virtual ~TriggerRatePlot();
54 grimes 1.4 void addEvent( const l1menu::L1TriggerDPGEvent& event );
55 grimes 1.2
56     void initiateForReducedSample( const l1menu::ReducedMenuSample& sample );
57 grimes 1.4 void addEvent( const l1menu::ReducedEvent& event );
58    
59     void addSample( const l1menu::ISample& sample );
60 grimes 1.1
61 grimes 1.3 /** @brief Returns the trigger being used to create the plot. */
62     const l1menu::ITrigger& getTrigger() const;
63    
64 grimes 1.1 /** @brief Returns the internal pointer to the root histogram. Ownership is retained by TriggerRatePlot. */
65     TH1* getPlot();
66    
67     /** @brief Tells TriggerRatePlot to relinquish ownership of the internal root histogram. A pointer to the
68     * histogram is also returned.
69     *
70     * Note that the pointer is still held so that further operations on this object are still valid,
71     * just that the TH1 won't be deleted when the instance goes out of scope. */
72     TH1* relinquishOwnershipOfPlot();
73     protected:
74     std::unique_ptr<l1menu::ITrigger> pTrigger_;
75     std::unique_ptr<TH1> pHistogram_;
76     /// The parameter to plot against, usually "threshold1";
77     std::string versusParameter_;
78 grimes 1.2 /// Pointer to the versusParameter_ reference in pTrigger_ to avoid expensive string comparison look ups
79     float* pParameter_;
80 grimes 1.1 /// Flag to say whether the histogram should be deleted when this instance goes out of scope.
81     bool histogramOwnedByMe_;
82     };
83     }
84     #endif