Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:09:50

0001 #ifndef DQMOFFLINE_TRIGGER_EGHLTMONELEMMGREBEE
0002 #define DQMOFFLINE_TRIGGER_EGHLTMONELEMMGREBEE
0003 
0004 //struct: MonElemMgrEBEE (Monitor Element Manger Barrel and Endcap)
0005 //
0006 //author: Sam Harper (July 2008)
0007 //
0008 //WARNING: interface is NOT final, please dont use this class for now without clearing it with me
0009 //         as I will change it and possibly break all your code
0010 //
0011 //aim:  a monitor element which seperates transparently the objects into barrel and endcap
0012 //
0013 //implimentation: class simply has two MonElemMangers, one for endcap electrons, one for barrel electrons
0014 //                and fills them approprately. It assumes that the class passed in has a detEta function
0015 //                and uses 1.5 as the barrel,endcap descriminate
0016 //
0017 //
0018 
0019 #include <cmath>
0020 
0021 #include "DQMOffline/Trigger/interface/EgHLTMonElemManager.h"
0022 
0023 namespace egHLT {
0024   template <class T, typename varType>
0025   class MonElemMgrEBEE : public MonElemManagerBase<T> {
0026   private:
0027     MonElemManager<T, varType> barrel_;
0028     MonElemManager<T, varType> endcap_;
0029 
0030   public:
0031     MonElemMgrEBEE(DQMStore::IBooker& iBooker,
0032                    const std::string& name,
0033                    const std::string& title,
0034                    int nrBins,
0035                    float min,
0036                    float max,
0037                    varType (T::*varFunc)() const)
0038         : barrel_(iBooker, name + "_eb", "Barrel " + title, nrBins, min, max, varFunc),
0039           endcap_(iBooker, name + "_ee", "Endcap " + title, nrBins, min, max, varFunc) {}
0040 
0041     ~MonElemMgrEBEE() override = default;
0042 
0043     void fill(const T& obj, float weight) override;
0044   };
0045 
0046   template <class T, typename varType>
0047   void MonElemMgrEBEE<T, varType>::fill(const T& obj, float weight) {
0048     if (std::fabs(obj.detEta()) < 1.5)
0049       barrel_.fill(obj, weight);
0050     else
0051       endcap_.fill(obj, weight);
0052   }
0053 
0054   template <class T, typename varTypeX, typename varTypeY>
0055   class MonElemMgr2DEBEE : public MonElemManagerBase<T> {
0056   private:
0057     MonElemManager2D<T, varTypeX, varTypeY> barrel_;
0058     MonElemManager2D<T, varTypeX, varTypeY> endcap_;
0059 
0060   public:
0061     MonElemMgr2DEBEE(DQMStore::IBooker& iBooker,
0062                      const std::string& name,
0063                      const std::string& title,
0064                      int nrBinsX,
0065                      double xMin,
0066                      double xMax,
0067                      int nrBinsY,
0068                      double yMin,
0069                      double yMax,
0070                      varTypeX (T::*varFuncX)() const,
0071                      varTypeY (T::*varFuncY)() const)
0072         : barrel_(
0073               iBooker, name + "_eb", "Barrel " + title, nrBinsX, xMin, xMax, nrBinsY, yMin, yMax, varFuncX, varFuncY),
0074           endcap_(
0075               iBooker, name + "_ee", "Endcap " + title, nrBinsX, xMin, xMax, nrBinsY, yMin, yMax, varFuncX, varFuncY) {}
0076 
0077     ~MonElemMgr2DEBEE() = default;
0078 
0079     void fill(const T& obj, float weight);
0080   };
0081 
0082   template <class T, typename varTypeX, typename varTypeY>
0083   void MonElemMgr2DEBEE<T, varTypeX, varTypeY>::fill(const T& obj, float weight) {
0084     if (fabs(obj.detEta()) < 1.5)
0085       barrel_.fill(obj, weight);
0086     else
0087       endcap_.fill(obj, weight);
0088   }
0089 }  // namespace egHLT
0090 #endif