CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
CaloTowersReCreator.cc
Go to the documentation of this file.
6 
8  algo_(0.,0., false, false, false, false, 0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0., // thresholds cannot be reapplied
9  conf.getParameter<std::vector<double> >("EBGrid"),
10  conf.getParameter<std::vector<double> >("EBWeights"),
11  conf.getParameter<std::vector<double> >("EEGrid"),
12  conf.getParameter<std::vector<double> >("EEWeights"),
13  conf.getParameter<std::vector<double> >("HBGrid"),
14  conf.getParameter<std::vector<double> >("HBWeights"),
15  conf.getParameter<std::vector<double> >("HESGrid"),
16  conf.getParameter<std::vector<double> >("HESWeights"),
17  conf.getParameter<std::vector<double> >("HEDGrid"),
18  conf.getParameter<std::vector<double> >("HEDWeights"),
19  conf.getParameter<std::vector<double> >("HOGrid"),
20  conf.getParameter<std::vector<double> >("HOWeights"),
21  conf.getParameter<std::vector<double> >("HF1Grid"),
22  conf.getParameter<std::vector<double> >("HF1Weights"),
23  conf.getParameter<std::vector<double> >("HF2Grid"),
24  conf.getParameter<std::vector<double> >("HF2Weights"),
25  conf.getParameter<double>("EBWeight"),
26  conf.getParameter<double>("EEWeight"),
27  conf.getParameter<double>("HBWeight"),
28  conf.getParameter<double>("HESWeight"),
29  conf.getParameter<double>("HEDWeight"),
30  conf.getParameter<double>("HOWeight"),
31  conf.getParameter<double>("HF1Weight"),
32  conf.getParameter<double>("HF2Weight"),
33  0.,0.,0.,
34  conf.getParameter<bool>("UseHO"),
35  // (these have no effect on recreation: here for compatibility)
36  conf.getParameter<int>("MomConstrMethod"),
37  conf.getParameter<double>("MomHBDepth"),
38  conf.getParameter<double>("MomHEDepth"),
39  conf.getParameter<double>("MomEBDepth"),
40  conf.getParameter<double>("MomEEDepth")
41 
42  ),
43  allowMissingInputs_(false)
44 {
45  tok_calo_ = consumes<CaloTowerCollection>(conf.getParameter<edm::InputTag>("caloLabel"));
46 
47  EBEScale=conf.getParameter<double>("EBEScale");
48  EEEScale=conf.getParameter<double>("EEEScale");
49  HBEScale=conf.getParameter<double>("HBEScale");
50  HESEScale=conf.getParameter<double>("HESEScale");
51  HEDEScale=conf.getParameter<double>("HEDEScale");
52  HOEScale=conf.getParameter<double>("HOEScale");
53  HF1EScale=conf.getParameter<double>("HF1EScale");
54  HF2EScale=conf.getParameter<double>("HF2EScale");
55  if (ctEScales.instanceLabel=="") produces<CaloTowerCollection>();
56  else produces<CaloTowerCollection>(ctEScales.instanceLabel);
57  // two notes:
58  // 1) all this could go in a pset
59  // 2) not clear the instanceLabel thing
60 }
61 
63  // get the necessary event setup objects...
67  c.get<CaloGeometryRecord>().get(pG);
68  c.get<IdealGeometryRecord>().get(htopo);
69  c.get<IdealGeometryRecord>().get(cttopo);
70 
79  algo_.setGeometry(cttopo.product(),htopo.product(),pG.product());
80 
81  algo_.begin(); // clear the internal buffer
82 
83  // Step A/C: Get Inputs and process (repeatedly)
85  e.getByToken(tok_calo_,calt);
86 
87 /*
88  if (!calt.isValid()) {
89  // can't find it!
90  if (!allowMissingInputs_) {
91  *calt; // will throw the proper exception
92  }
93  } else {
94  algo_.process(*calt);
95  }
96 
97  // Step B: Create empty output
98  std::auto_ptr<CaloTowerCollection> prod(new CaloTowerCollection());
99 
100  // Step C: Process
101  algo_.finish(*prod);
102 
103  // Step D: Put into the event
104  if (ctEScales.instanceLabel=="") e.put(prod);
105  else e.put(prod,ctEScales.instanceLabel);
106 */
107 
108  // modified to rescale the CaloTowers directly
109  // without going through metatowers
110  // required for the algorithms that make use of individual
111  // crystal information
112 
113  if (!calt.isValid()) {
114  // can't find it!
115  if (!allowMissingInputs_) {
116  *calt; // will throw the proper exception
117  }
118  } else {
119  // Step B: Create empty output
120  std::auto_ptr<CaloTowerCollection> prod(new CaloTowerCollection());
121 
122  // step C: rescale (without going threough metataowers)
123  algo_.rescaleTowers(*calt, *prod);
124 
125  // Step D: Put into the event
126  if (ctEScales.instanceLabel=="") e.put(prod);
127  else e.put(prod,ctEScales.instanceLabel);
128  }
129 
130 }
131 
T getParameter(std::string const &) const
virtual void produce(edm::Event &e, const edm::EventSetup &c)
CaloTowersReCreator(const edm::ParameterSet &ps)
CaloTowersCreationAlgo algo_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:434
std::string instanceLabel
Definition: ctEScales.h:13
void rescaleTowers(const CaloTowerCollection &ctInput, CaloTowerCollection &ctResult)
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:116
edm::EDGetTokenT< CaloTowerCollection > tok_calo_
bool isValid() const
Definition: HandleBase.h:76
tuple conf
Definition: dbtoconf.py:185
const T & get() const
Definition: EventSetup.h:55
T const * product() const
Definition: ESHandle.h:62
edm::SortedCollection< CaloTower > CaloTowerCollection
Definition: CaloTowerFwd.h:15
volatile std::atomic< bool > shutdown_flag false
void setGeometry(const CaloTowerConstituentsMap *cttopo, const HcalTopology *htopo, const CaloGeometry *geo)