Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2023-10-25 09:43:09

0001 #ifndef SiPixel_SummationSpecification
0002 #define SiPixel_SummationSpecification
0003 // -*- C++ -*-
0004 //
0005 // Package:    SiPixelPhase1Common
0006 // Class:      SummationSpecification
0007 //
0008 // This class represents a sequence of steps that produce histograms by summing
0009 // up other histograms. This can be considered a domain-specific language for
0010 // DQM. This class has no intelligence, it just manages the "program". It is
0011 // not encapsulated, the structure is exposed.
0012 //
0013 // Original Author:  Marcel Schneider
0014 
0015 #include <vector>
0016 #include <string>
0017 
0018 #include "DQM/SiPixelPhase1Common/interface/GeometryInterface.h"
0019 
0020 struct SummationStep {
0021   // For step1, all the necessary information should be in the type and columns
0022   // to allow fill() to exectute it very quickly.
0023   // For step2 stuff (after the first SAVE), we can also keep strings, since
0024   // step2 will only be executed once by an executor.
0025   enum Type {
0026     NO_TYPE = 0,
0027     GROUPBY = 1,
0028     EXTEND_X = 2,
0029     EXTEND_Y = 3,
0030     COUNT = 4,
0031     REDUCE = 5,
0032     SAVE = 6,
0033     USE_X = 8,
0034     USE_Y = 9,
0035     USE_Z = 10,
0036     PROFILE = 11
0037   };
0038   Type type = NO_TYPE;
0039   // STAGE1 is DQM step1, STAGE2 step2. STAGE1_2 is somewhere in between, it runs
0040   // in the analyze()-method (step1) but does a sort of harvesting (per-event).
0041   // STAGE1_2 is for ndigis-like counters.
0042   // FIRST is the first group-by, which is special.
0043   enum Stage { NO_STAGE, FIRST, STAGE1, STAGE2 };
0044   Stage stage = NO_STAGE;
0045 
0046   int nbins{-1};
0047   int xmin{0};
0048   int xmax{0};
0049 
0050   std::vector<GeometryInterface::Column> columns;
0051 
0052   // more parameters. Not very elegant but good enough for step2.
0053   std::string arg;
0054 };
0055 
0056 struct SummationSpecification {
0057   std::vector<SummationStep> steps;
0058   SummationSpecification(){};
0059   SummationSpecification(edm::ParameterSet const&, GeometryInterface&);
0060 
0061   template <class stream, class GI>
0062   void dump(stream& out, GI& gi) {
0063     for (auto& s : steps) {
0064       out << "Step: type " << s.type << " stage " << s.stage << " col ";
0065       for (auto c : s.columns)
0066         out << gi.pretty(c) << " ";
0067       out << " arg " << s.arg << "\n";
0068     }
0069   }
0070 
0071 private:
0072   GeometryInterface::Column parse_columns(std::string name, GeometryInterface&);
0073 };
0074 
0075 #endif