00001 #include "RecoLocalCalo/CaloTowersCreator/src/CaloTowersReCreator.h"
00002 #include "Geometry/CaloGeometry/interface/CaloGeometry.h"
00003 #include "Geometry/Records/interface/CaloGeometryRecord.h"
00004 #include "FWCore/Framework/interface/ESHandle.h"
00005 #include "RecoLocalCalo/CaloTowersCreator/interface/ctEScales.h"
00006
00007 CaloTowersReCreator::CaloTowersReCreator(const edm::ParameterSet& conf) :
00008 algo_(0.,0., false, false, false, false, 0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,
00009 conf.getParameter<std::vector<double> >("EBGrid"),
00010 conf.getParameter<std::vector<double> >("EBWeights"),
00011 conf.getParameter<std::vector<double> >("EEGrid"),
00012 conf.getParameter<std::vector<double> >("EEWeights"),
00013 conf.getParameter<std::vector<double> >("HBGrid"),
00014 conf.getParameter<std::vector<double> >("HBWeights"),
00015 conf.getParameter<std::vector<double> >("HESGrid"),
00016 conf.getParameter<std::vector<double> >("HESWeights"),
00017 conf.getParameter<std::vector<double> >("HEDGrid"),
00018 conf.getParameter<std::vector<double> >("HEDWeights"),
00019 conf.getParameter<std::vector<double> >("HOGrid"),
00020 conf.getParameter<std::vector<double> >("HOWeights"),
00021 conf.getParameter<std::vector<double> >("HF1Grid"),
00022 conf.getParameter<std::vector<double> >("HF1Weights"),
00023 conf.getParameter<std::vector<double> >("HF2Grid"),
00024 conf.getParameter<std::vector<double> >("HF2Weights"),
00025 conf.getParameter<double>("EBWeight"),
00026 conf.getParameter<double>("EEWeight"),
00027 conf.getParameter<double>("HBWeight"),
00028 conf.getParameter<double>("HESWeight"),
00029 conf.getParameter<double>("HEDWeight"),
00030 conf.getParameter<double>("HOWeight"),
00031 conf.getParameter<double>("HF1Weight"),
00032 conf.getParameter<double>("HF2Weight"),
00033 0.,0.,0.,
00034 conf.getParameter<bool>("UseHO"),
00035
00036 conf.getParameter<int>("MomConstrMethod"),
00037 conf.getParameter<double>("MomHBDepth"),
00038 conf.getParameter<double>("MomHEDepth"),
00039 conf.getParameter<double>("MomEBDepth"),
00040 conf.getParameter<double>("MomEEDepth")
00041
00042 ),
00043 caloLabel_(conf.getParameter<edm::InputTag>("caloLabel")),
00044 allowMissingInputs_(false)
00045 {
00046 EBEScale=conf.getParameter<double>("EBEScale");
00047 EEEScale=conf.getParameter<double>("EEEScale");
00048 HBEScale=conf.getParameter<double>("HBEScale");
00049 HESEScale=conf.getParameter<double>("HESEScale");
00050 HEDEScale=conf.getParameter<double>("HEDEScale");
00051 HOEScale=conf.getParameter<double>("HOEScale");
00052 HF1EScale=conf.getParameter<double>("HF1EScale");
00053 HF2EScale=conf.getParameter<double>("HF2EScale");
00054 if (ctEScales.instanceLabel=="") produces<CaloTowerCollection>();
00055 else produces<CaloTowerCollection>(ctEScales.instanceLabel);
00056
00057
00058
00059 }
00060
00061 void CaloTowersReCreator::produce(edm::Event& e, const edm::EventSetup& c) {
00062
00063 edm::ESHandle<CaloGeometry> pG;
00064 edm::ESHandle<HcalTopology> htopo;
00065 edm::ESHandle<CaloTowerConstituentsMap> cttopo;
00066 c.get<CaloGeometryRecord>().get(pG);
00067 c.get<IdealGeometryRecord>().get(htopo);
00068 c.get<IdealGeometryRecord>().get(cttopo);
00069
00070 algo_.setEBEScale(EBEScale);
00071 algo_.setEEEScale(EEEScale);
00072 algo_.setHBEScale(HBEScale);
00073 algo_.setHESEScale(HESEScale);
00074 algo_.setHEDEScale(HEDEScale);
00075 algo_.setHOEScale(HOEScale);
00076 algo_.setHF1EScale(HF1EScale);
00077 algo_.setHF2EScale(HF2EScale);
00078 algo_.setGeometry(cttopo.product(),htopo.product(),pG.product());
00079
00080 algo_.begin();
00081
00082
00083 edm::Handle<CaloTowerCollection> calt;
00084 e.getByLabel(caloLabel_,calt);
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110
00111
00112 if (!calt.isValid()) {
00113
00114 if (!allowMissingInputs_) {
00115 *calt;
00116 }
00117 } else {
00118
00119 std::auto_ptr<CaloTowerCollection> prod(new CaloTowerCollection());
00120
00121
00122 algo_.rescaleTowers(*calt, *prod);
00123
00124
00125 if (ctEScales.instanceLabel=="") e.put(prod);
00126 else e.put(prod,ctEScales.instanceLabel);
00127 }
00128
00129 }
00130