Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:07:27

0001 #ifndef Container1D_h
0002 #define Container1D_h
0003 
0004 /*
0005  *      file:           Container1D.h
0006  *      Author:         Viktor Khristenko
0007  *
0008  *      Description:
0009  *              1D Container
0010  */
0011 #include "DQM/HcalCommon/interface/Container.h"
0012 #include "DQM/HcalCommon/interface/DetectorQuantity.h"
0013 #include "DQM/HcalCommon/interface/ElectronicsQuantity.h"
0014 #include "DQM/HcalCommon/interface/HashFilter.h"
0015 #include "DQM/HcalCommon/interface/HashMapper.h"
0016 #include "DQM/HcalCommon/interface/TrigTowerQuantity.h"
0017 #include "DQM/HcalCommon/interface/Utilities.h"
0018 #include "DQM/HcalCommon/interface/ValueQuantity.h"
0019 
0020 #include <string>
0021 #include <unordered_map>
0022 #include <vector>
0023 
0024 namespace hcaldqm {
0025   class Container1D : public Container {
0026   public:
0027     Container1D();
0028     //      Initialize Container
0029     //      @folder - folder name where to start saving - root.
0030     //      By default it will be the Task's name.
0031     //
0032     Container1D(std::string const &folder,
0033                 hashfunctions::HashType,
0034                 quantity::Quantity *,
0035                 quantity::Quantity *qy = new quantity::ValueQuantity(quantity::fN));
0036     ~Container1D() override;
0037 
0038     //      Initialize Container
0039     //      @folder - folder name where to save. Should already include the
0040     //      Tasks's name
0041     //      @nametitle - namebase of the name and of the title
0042     //
0043     virtual void initialize(std::string const &folder,
0044                             hashfunctions::HashType,
0045                             quantity::Quantity *,
0046                             quantity::Quantity *qy = new quantity::ValueQuantity(quantity::fN),
0047                             int debug = 0);
0048 
0049     //      @qname - to replace the QyvsQx naming
0050     virtual void initialize(std::string const &folder,
0051                             std::string const &qname,
0052                             hashfunctions::HashType,
0053                             quantity::Quantity *,
0054                             quantity::Quantity *qy = new quantity::ValueQuantity(quantity::fN),
0055                             int debug = 0);
0056     using Container::initialize;
0057 
0058     //      filling by hash
0059     virtual void fill(uint32_t);
0060     virtual void fill(uint32_t, int);
0061     virtual void fill(uint32_t, double);
0062     virtual void fill(uint32_t, int, double);
0063     virtual void fill(uint32_t, int, int);
0064     virtual void fill(uint32_t, double, double);
0065 
0066     //      using DetId as mapper
0067     virtual void fill(HcalDetId const &);
0068     virtual void fill(HcalDetId const &, int);
0069     virtual void fill(HcalDetId const &, double);
0070     virtual void fill(HcalDetId const &, int, double);
0071     virtual void fill(HcalDetId const &, int, int);
0072     virtual void fill(HcalDetId const &, double, double);
0073 
0074     virtual double getBinEntries(HcalDetId const &);
0075     virtual double getBinEntries(HcalDetId const &, int);
0076     virtual double getBinEntries(HcalDetId const &, double);
0077     virtual double getBinEntries(HcalDetId const &did, int x, int) { return getBinEntries(did, x); }
0078     virtual double getBinEntries(HcalDetId const &did, int x, double) { return getBinEntries(did, x); }
0079     virtual double getBinEntries(HcalDetId const &did, double x, double) { return getBinEntries(did, x); }
0080 
0081     virtual double getBinContent(HcalDetId const &);
0082     virtual double getBinContent(HcalDetId const &, int);
0083     virtual double getBinContent(HcalDetId const &, double);
0084     virtual double getBinContent(HcalDetId const &did, int x, int) { return getBinContent(did, x); }
0085     virtual double getBinContent(HcalDetId const &did, int x, double) { return getBinContent(did, x); }
0086     virtual double getBinContent(HcalDetId const &did, double x, double) { return getBinContent(did, x); }
0087     virtual double getMean(HcalDetId const &, int axis = 1);
0088     virtual double getRMS(HcalDetId const &, int axix = 1);
0089 
0090     virtual void setBinContent(HcalDetId const &, int);
0091     virtual void setBinContent(HcalDetId const &, double);
0092     virtual void setBinContent(HcalDetId const &, int, int);
0093     virtual void setBinContent(HcalDetId const &, int, double);
0094     virtual void setBinContent(HcalDetId const &, double, double);
0095     virtual void setBinContent(HcalDetId const &, double, int);
0096     virtual void setBinContent(HcalDetId const &id, int x, int y, int) { setBinContent(id, x, y); }
0097     virtual void setBinContent(HcalDetId const &id, int x, double y, int) { setBinContent(id, x, y); }
0098     virtual void setBinContent(HcalDetId const &id, double x, int y, int) { setBinContent(id, x, y); }
0099     virtual void setBinContent(HcalDetId const &id, double x, double y, int) { setBinContent(id, x, y); }
0100     virtual void setBinContent(HcalDetId const &id, int x, int y, double) { setBinContent(id, x, y); }
0101     virtual void setBinContent(HcalDetId const &id, int x, double y, double) { setBinContent(id, x, y); }
0102     virtual void setBinContent(HcalDetId const &id, double x, int y, double) { setBinContent(id, x, y); }
0103     virtual void setBinContent(HcalDetId const &id, double x, double y, double) { setBinContent(id, x, y); }
0104 
0105     //      using ElectronicsId
0106     virtual void fill(HcalElectronicsId const &);
0107     virtual void fill(HcalElectronicsId const &, int);
0108     virtual void fill(HcalElectronicsId const &, double);
0109     virtual void fill(HcalElectronicsId const &, int, double);
0110     virtual void fill(HcalElectronicsId const &, int, int);
0111     virtual void fill(HcalElectronicsId const &, double, double);
0112 
0113     virtual double getBinEntries(HcalElectronicsId const &);
0114     virtual double getBinEntries(HcalElectronicsId const &, int);
0115     virtual double getBinEntries(HcalElectronicsId const &, double);
0116     virtual double getBinEntries(HcalElectronicsId const &eid, int x, int) { return getBinEntries(eid, x); }
0117     virtual double getBinEntries(HcalElectronicsId const &eid, int x, double) { return getBinEntries(eid, x); }
0118     virtual double getBinEntries(HcalElectronicsId const &eid, double x, double) { return getBinEntries(eid, x); }
0119 
0120     virtual double getBinContent(HcalElectronicsId const &);
0121     virtual double getBinContent(HcalElectronicsId const &, int);
0122     virtual double getBinContent(HcalElectronicsId const &, double);
0123     virtual double getBinContent(HcalElectronicsId const &eid, int x, int) { return getBinContent(eid, x); }
0124     virtual double getBinContent(HcalElectronicsId const &eid, int x, double) { return getBinContent(eid, x); }
0125     virtual double getBinContent(HcalElectronicsId const &eid, double x, double) { return getBinContent(eid, x); }
0126     virtual double getMean(HcalElectronicsId const &, int axis = 1);
0127     virtual double getRMS(HcalElectronicsId const &, int axis = 1);
0128 
0129     virtual void setBinContent(HcalElectronicsId const &, int);
0130     virtual void setBinContent(HcalElectronicsId const &, double);
0131     virtual void setBinContent(HcalElectronicsId const &, int, int);
0132     virtual void setBinContent(HcalElectronicsId const &, int, double);
0133     virtual void setBinContent(HcalElectronicsId const &, double, double);
0134     virtual void setBinContent(HcalElectronicsId const &, double, int);
0135     virtual void setBinContent(HcalElectronicsId const &id, int x, int y, int) { setBinContent(id, x, y); }
0136     virtual void setBinContent(HcalElectronicsId const &id, int x, double y, int) { setBinContent(id, x, y); }
0137     virtual void setBinContent(HcalElectronicsId const &id, double x, int y, int) { setBinContent(id, x, y); }
0138     virtual void setBinContent(HcalElectronicsId const &id, double x, double y, int) { setBinContent(id, x, y); }
0139     virtual void setBinContent(HcalElectronicsId const &id, int x, int y, double) { setBinContent(id, x, y); }
0140     virtual void setBinContent(HcalElectronicsId const &id, int x, double y, double) { setBinContent(id, x, y); }
0141     virtual void setBinContent(HcalElectronicsId const &id, double x, int y, double) { setBinContent(id, x, y); }
0142     virtual void setBinContent(HcalElectronicsId const &id, double x, double y, double) { setBinContent(id, x, y); }
0143 
0144     //      using DetId as mapper
0145     virtual void fill(HcalTrigTowerDetId const &);
0146     virtual void fill(HcalTrigTowerDetId const &, int);
0147     virtual void fill(HcalTrigTowerDetId const &, double);
0148     virtual void fill(HcalTrigTowerDetId const &, int, double);
0149     virtual void fill(HcalTrigTowerDetId const &, int, int);
0150     virtual void fill(HcalTrigTowerDetId const &, double, double);
0151 
0152     virtual double getBinEntries(HcalTrigTowerDetId const &);
0153     virtual double getBinEntries(HcalTrigTowerDetId const &, int);
0154     virtual double getBinEntries(HcalTrigTowerDetId const &, double);
0155     virtual double getBinEntries(HcalTrigTowerDetId const &tid, int x, int) { return getBinEntries(tid, x); }
0156     virtual double getBinEntries(HcalTrigTowerDetId const &tid, int x, double) { return getBinEntries(tid, x); }
0157     virtual double getBinEntries(HcalTrigTowerDetId const &tid, double x, double) { return getBinEntries(tid, x); }
0158 
0159     virtual double getBinContent(HcalTrigTowerDetId const &);
0160     virtual double getBinContent(HcalTrigTowerDetId const &, int);
0161     virtual double getBinContent(HcalTrigTowerDetId const &, double);
0162     virtual double getBinContent(HcalTrigTowerDetId const &tid, int x, int) { return getBinContent(tid, x); }
0163     virtual double getBinContent(HcalTrigTowerDetId const &tid, int x, double) { return getBinContent(tid, x); }
0164     virtual double getBinContent(HcalTrigTowerDetId const &tid, double x, double) { return getBinContent(tid, x); }
0165     virtual double getMean(HcalTrigTowerDetId const &, int axis = 1);
0166     virtual double getRMS(HcalTrigTowerDetId const &, int axis = 1);
0167 
0168     virtual void setBinContent(HcalTrigTowerDetId const &, int);
0169     virtual void setBinContent(HcalTrigTowerDetId const &, double);
0170     virtual void setBinContent(HcalTrigTowerDetId const &, int, int);
0171     virtual void setBinContent(HcalTrigTowerDetId const &, int, double);
0172     virtual void setBinContent(HcalTrigTowerDetId const &, double, double);
0173     virtual void setBinContent(HcalTrigTowerDetId const &, double, int);
0174     virtual void setBinContent(HcalTrigTowerDetId const &id, int x, int y, int) { setBinContent(id, x, y); }
0175     virtual void setBinContent(HcalTrigTowerDetId const &id, int x, double y, int) { setBinContent(id, x, y); }
0176     virtual void setBinContent(HcalTrigTowerDetId const &id, double x, int y, int) { setBinContent(id, x, y); }
0177     virtual void setBinContent(HcalTrigTowerDetId const &id, double x, double y, int) { setBinContent(id, x, y); }
0178     virtual void setBinContent(HcalTrigTowerDetId const &id, int x, int y, double) { setBinContent(id, x, y); }
0179     virtual void setBinContent(HcalTrigTowerDetId const &id, int x, double y, double) { setBinContent(id, x, y); }
0180     virtual void setBinContent(HcalTrigTowerDetId const &id, double x, int y, double) { setBinContent(id, x, y); }
0181     virtual void setBinContent(HcalTrigTowerDetId const &id, double x, double y, double) { setBinContent(id, x, y); }
0182 
0183     //      booking using IBooker
0184     //      @aux - typically a cut or anything else
0185     //      @subsystem - subsystem under which to save
0186     //
0187     virtual void book(DQMStore::IBooker &,
0188                       HcalElectronicsMap const *,
0189                       std::string subsystem = "Hcal",
0190                       std::string aux = "");
0191     virtual void book(DQMStore::IBooker &,
0192                       HcalElectronicsMap const *,
0193                       filter::HashFilter const &,
0194                       std::string subsystem = "Hcal",
0195                       std::string aux = "");
0196 
0197     //      loading using DQMStore
0198     //      @DQMStore
0199     //      @emap
0200     //      @prepend - name to prepend to /<subsystem> - used when load
0201     //      a file to DQMStore without stripping and in case a name is
0202     //      appended
0203     //      @mode - if StripRunDirs - then there will be no Run Summary
0204     //      otherwise there is Run Summary folde. Used for retrieving
0205     //      MEs which were loaded into the DQM store from a file
0206     virtual void load(DQMStore::IGetter &,
0207                       HcalElectronicsMap const *,
0208                       std::string const &subsystem = "Hcal",
0209                       std::string const &aux = "");
0210     virtual void load(DQMStore::IGetter &,
0211                       HcalElectronicsMap const *,
0212                       filter::HashFilter const &,
0213                       std::string const &subsystem = "Hcal",
0214                       std::string const &aux = "");
0215 
0216     //      reset all the elements
0217     virtual void reset();
0218 
0219     //      print all the elements
0220     virtual void print();
0221 
0222     //      TO BE USED IN THE FUTURE!
0223     virtual void extendAxisRange(int);
0224 
0225     virtual void showOverflowX(bool showOverflow);
0226     virtual void showOverflowY(bool showOverflow);
0227 
0228   protected:
0229     virtual void customize(MonitorElement *);
0230 
0231     typedef std::unordered_map<uint32_t, MonitorElement *> MEMap;
0232     MEMap _mes;
0233     mapper::HashMapper _hashmap;
0234     quantity::Quantity *_qx;
0235     quantity::Quantity *_qy;
0236   };
0237 }  // namespace hcaldqm
0238 
0239 #endif