CMS 3D CMS Logo

CaloTowersReCreator.cc
Go to the documentation of this file.
1 
6 
18 
20 public:
21  explicit CaloTowersReCreator(const edm::ParameterSet& ps);
22  ~CaloTowersReCreator() override {}
23  void produce(edm::Event& e, const edm::EventSetup& c) override;
24  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
27 
28 private:
36 };
37 
40 
42  : algo_(0.,
43  0.,
44  false,
45  false,
46  false,
47  false,
48  0.,
49  0.,
50  0.,
51  0.,
52  0.,
53  0.,
54  0.,
55  0.,
56  0.,
57  0.,
58  0.,
59  0.,
60  0.,
61  0.,
62  0., // thresholds cannot be reapplied
63  conf.getParameter<std::vector<double> >("EBGrid"),
64  conf.getParameter<std::vector<double> >("EBWeights"),
65  conf.getParameter<std::vector<double> >("EEGrid"),
66  conf.getParameter<std::vector<double> >("EEWeights"),
67  conf.getParameter<std::vector<double> >("HBGrid"),
68  conf.getParameter<std::vector<double> >("HBWeights"),
69  conf.getParameter<std::vector<double> >("HESGrid"),
70  conf.getParameter<std::vector<double> >("HESWeights"),
71  conf.getParameter<std::vector<double> >("HEDGrid"),
72  conf.getParameter<std::vector<double> >("HEDWeights"),
73  conf.getParameter<std::vector<double> >("HOGrid"),
74  conf.getParameter<std::vector<double> >("HOWeights"),
75  conf.getParameter<std::vector<double> >("HF1Grid"),
76  conf.getParameter<std::vector<double> >("HF1Weights"),
77  conf.getParameter<std::vector<double> >("HF2Grid"),
78  conf.getParameter<std::vector<double> >("HF2Weights"),
79  conf.getParameter<double>("EBWeight"),
80  conf.getParameter<double>("EEWeight"),
81  conf.getParameter<double>("HBWeight"),
82  conf.getParameter<double>("HESWeight"),
83  conf.getParameter<double>("HEDWeight"),
84  conf.getParameter<double>("HOWeight"),
85  conf.getParameter<double>("HF1Weight"),
86  conf.getParameter<double>("HF2Weight"),
87  0.,
88  0.,
89  0.,
90  conf.getParameter<bool>("UseHO"),
91  // (these have no effect on recreation: here for compatibility)
92  conf.getParameter<int>("MomConstrMethod"),
93  conf.getParameter<double>("MomHBDepth"),
94  conf.getParameter<double>("MomHEDepth"),
95  conf.getParameter<double>("MomEBDepth"),
96  conf.getParameter<double>("MomEEDepth"),
97  conf.getParameter<int>("HcalPhase")),
98  allowMissingInputs_(false) {
99  tok_calo_ = consumes<CaloTowerCollection>(conf.getParameter<edm::InputTag>("caloLabel"));
100  tok_geom_ = esConsumes<CaloGeometry, CaloGeometryRecord>();
101  tok_topo_ = esConsumes<HcalTopology, HcalRecNumberingRecord>();
102  tok_cttopo_ = esConsumes<CaloTowerTopology, HcalRecNumberingRecord>();
103  tok_ctmap_ = esConsumes<CaloTowerConstituentsMap, CaloGeometryRecord>();
104 
105  EBEScale = conf.getParameter<double>("EBEScale");
106  EEEScale = conf.getParameter<double>("EEEScale");
107  HBEScale = conf.getParameter<double>("HBEScale");
108  HESEScale = conf.getParameter<double>("HESEScale");
109  HEDEScale = conf.getParameter<double>("HEDEScale");
110  HOEScale = conf.getParameter<double>("HOEScale");
111  HF1EScale = conf.getParameter<double>("HF1EScale");
112  HF2EScale = conf.getParameter<double>("HF2EScale");
113  // two notes:
114  // 1) all this could go in a pset
115  // 2) not clear the instanceLabel thing
116 
117  produces<CaloTowerCollection>();
118 }
119 
121  // get the necessary event setup objects...
122  edm::ESHandle<CaloGeometry> pG = c.getHandle(tok_geom_);
123  edm::ESHandle<HcalTopology> htopo = c.getHandle(tok_topo_);
124  edm::ESHandle<CaloTowerTopology> cttopo = c.getHandle(tok_cttopo_);
126 
135  algo_.setGeometry(cttopo.product(), ctmap.product(), htopo.product(), pG.product());
136 
137  algo_.begin(); // clear the internal buffer
138 
139  // Step A/C: Get Inputs and process (repeatedly)
141  e.getByToken(tok_calo_, calt);
142 
143  // modified to rescale the CaloTowers directly
144  // without going through metatowers
145  // required for the algorithms that make use of individual
146  // crystal information
147 
148  if (!calt.isValid()) {
149  // can't find it!
150  if (!allowMissingInputs_) {
151  *calt; // will throw the proper exception
152  }
153  } else {
154  // Step B: Create empty output
155  auto prod = std::make_unique<CaloTowerCollection>();
156 
157  // step C: rescale (without going threough metataowers)
158  algo_.rescaleTowers(*calt, *prod);
159 
160  // Step D: Put into the event
161  e.put(std::move(prod));
162  }
163 }
164 
167  desc.add<double>("EBWeight", 1.0);
168  desc.add<double>("HBEScale", 50.0);
169  desc.add<double>("HEDWeight", 1.0);
170  desc.add<double>("EEWeight", 1.0);
171  desc.add<double>("HF1Weight", 1.0);
172  desc.add<double>("HOWeight", 1.0);
173  desc.add<double>("HESWeight", 1.0);
174  desc.add<double>("HF2Weight", 1.0);
175  desc.add<double>("HESEScale", 50.0);
176  desc.add<double>("HEDEScale", 50.0);
177  desc.add<double>("EBEScale", 50.0);
178  desc.add<double>("HBWeight", 1.0);
179  desc.add<double>("EEEScale", 50.0);
180  desc.add<double>("MomHBDepth", 0.2);
181  desc.add<double>("MomHEDepth", 0.4);
182  desc.add<double>("MomEBDepth", 0.3);
183  desc.add<double>("MomEEDepth", 0.0);
184  desc.add<std::vector<double> >("HBGrid", {0.0, 2.0, 4.0, 5.0, 9.0, 20.0, 30.0, 50.0, 100.0, 1000.0});
185  desc.add<std::vector<double> >("EEWeights", {0.51, 1.39, 1.71, 2.37, 2.32, 2.2, 2.1, 1.98, 1.8});
186  desc.add<std::vector<double> >("HF2Weights", {1.0, 1.0, 1.0, 1.0, 1.0});
187  desc.add<std::vector<double> >("HOWeights", {1.0, 1.0, 1.0, 1.0, 1.0});
188  desc.add<std::vector<double> >("EEGrid", {2.0, 4.0, 5.0, 9.0, 20.0, 30.0, 50.0, 100.0, 300.0});
189  desc.add<std::vector<double> >("HBWeights", {2.0, 1.86, 1.69, 1.55, 1.37, 1.19, 1.13, 1.11, 1.09, 1.0});
190  desc.add<std::vector<double> >("HF2Grid", {-1.0, 1.0, 10.0, 100.0, 1000.0});
191  desc.add<std::vector<double> >("HEDWeights", {1.7, 1.57, 1.54, 1.49, 1.41, 1.26, 1.19, 1.15, 1.12, 1.0});
192  desc.add<std::vector<double> >("HF1Grid", {-1.0, 1.0, 10.0, 100.0, 1000.0});
193  desc.add<std::vector<double> >("EBWeights", {0.86, 1.47, 1.66, 2.01, 1.98, 1.86, 1.83, 1.74, 1.65});
194  desc.add<std::vector<double> >("HF1Weights", {1.0, 1.0, 1.0, 1.0, 1.0});
195  desc.add<std::vector<double> >("HESGrid", {0.0, 2.0, 4.0, 5.0, 9.0, 20.0, 30.0, 50.0, 100.0, 1000.0});
196  desc.add<std::vector<double> >("HESWeights", {1.7, 1.57, 1.54, 1.49, 1.41, 1.26, 1.19, 1.15, 1.12, 1.0});
197  desc.add<std::vector<double> >("HEDGrid", {0.0, 2.0, 4.0, 5.0, 9.0, 20.0, 30.0, 50.0, 100.0, 1000.0});
198  desc.add<std::vector<double> >("HOGrid", {-1.0, 1.0, 10.0, 100.0, 1000.0});
199  desc.add<std::vector<double> >("EBGrid", {2.0, 4.0, 5.0, 9.0, 20.0, 30.0, 50.0, 100.0, 300.0});
200  desc.add<edm::InputTag>("caloLabel", edm::InputTag("calotowermaker"));
201  desc.add<int>("MomConstrMethod", 1);
202  desc.add<int>("HcalPhase", 0);
203 
204  descriptions.addDefault(desc);
205 }
edm::ESGetToken< CaloTowerConstituentsMap, CaloGeometryRecord > tok_ctmap_
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
CaloTowersReCreator(const edm::ParameterSet &ps)
CaloTowersCreationAlgo algo_
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
void setGeometry(const CaloTowerTopology *cttopo, const CaloTowerConstituentsMap *ctmap, const HcalTopology *htopo, const CaloGeometry *geo)
T const * product() const
Definition: ESHandle.h:86
void addDefault(ParameterSetDescription const &psetDescription)
void rescaleTowers(const CaloTowerCollection &ctInput, CaloTowerCollection &ctResult)
edm::EDGetTokenT< CaloTowerCollection > tok_calo_
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
edm::ESGetToken< HcalTopology, HcalRecNumberingRecord > tok_topo_
edm::ESGetToken< CaloTowerTopology, HcalRecNumberingRecord > tok_cttopo_
edm::ESGetToken< CaloGeometry, CaloGeometryRecord > tok_geom_
void produce(edm::Event &e, const edm::EventSetup &c) override
bool isValid() const
Definition: HandleBase.h:70
def move(src, dest)
Definition: eostools.py:511