CMS 3D CMS Logo

Public Member Functions | Public Attributes | Private Attributes

CaloTowersReCreator Class Reference

#include <CaloTowersReCreator.h>

Inheritance diagram for CaloTowersReCreator:
edm::EDProducer edm::ProducerBase edm::ProductRegistryHelper

List of all members.

Public Member Functions

 CaloTowersReCreator (const edm::ParameterSet &ps)
virtual void produce (edm::Event &e, const edm::EventSetup &c)
virtual ~CaloTowersReCreator ()

Public Attributes

double EBEScale
double EEEScale
double HBEScale
double HEDEScale
double HESEScale
double HF1EScale
double HF2EScale
double HOEScale

Private Attributes

CaloTowersCreationAlgo algo_
bool allowMissingInputs_
edm::InputTag caloLabel_

Detailed Description

Date:
2007/03/31 18:38:51
Revision:
1.1

Definition at line 21 of file CaloTowersReCreator.h.


Constructor & Destructor Documentation

CaloTowersReCreator::CaloTowersReCreator ( const edm::ParameterSet ps) [explicit]

Definition at line 7 of file CaloTowersReCreator.cc.

References EBEScale, EEEScale, edm::ParameterSet::getParameter(), HBEScale, HEDEScale, HESEScale, HF1EScale, HF2EScale, HOEScale, and ctEScales::instanceLabel.

                                                                    : 
  algo_(0.,0., false, false, false, false, 0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0., // thresholds cannot be reapplied
        conf.getParameter<std::vector<double> >("EBGrid"),
        conf.getParameter<std::vector<double> >("EBWeights"),
        conf.getParameter<std::vector<double> >("EEGrid"),
        conf.getParameter<std::vector<double> >("EEWeights"),
        conf.getParameter<std::vector<double> >("HBGrid"),
        conf.getParameter<std::vector<double> >("HBWeights"),
        conf.getParameter<std::vector<double> >("HESGrid"),
        conf.getParameter<std::vector<double> >("HESWeights"),
        conf.getParameter<std::vector<double> >("HEDGrid"),
        conf.getParameter<std::vector<double> >("HEDWeights"),
        conf.getParameter<std::vector<double> >("HOGrid"),
        conf.getParameter<std::vector<double> >("HOWeights"),
        conf.getParameter<std::vector<double> >("HF1Grid"),
        conf.getParameter<std::vector<double> >("HF1Weights"),
        conf.getParameter<std::vector<double> >("HF2Grid"),
        conf.getParameter<std::vector<double> >("HF2Weights"),
        conf.getParameter<double>("EBWeight"),
        conf.getParameter<double>("EEWeight"),
        conf.getParameter<double>("HBWeight"),
        conf.getParameter<double>("HESWeight"),
        conf.getParameter<double>("HEDWeight"),
        conf.getParameter<double>("HOWeight"),
        conf.getParameter<double>("HF1Weight"),
        conf.getParameter<double>("HF2Weight"),
        0.,0.,0.,
        conf.getParameter<bool>("UseHO"),
        // (these have no effect on recreation: here for compatibility)
        conf.getParameter<int>("MomConstrMethod"),
        conf.getParameter<double>("MomHBDepth"),
        conf.getParameter<double>("MomHEDepth"),
        conf.getParameter<double>("MomEBDepth"),
        conf.getParameter<double>("MomEEDepth")

        ),
  caloLabel_(conf.getParameter<edm::InputTag>("caloLabel")),
  allowMissingInputs_(false)
{
  EBEScale=conf.getParameter<double>("EBEScale");
  EEEScale=conf.getParameter<double>("EEEScale");
  HBEScale=conf.getParameter<double>("HBEScale");
  HESEScale=conf.getParameter<double>("HESEScale");
  HEDEScale=conf.getParameter<double>("HEDEScale");
  HOEScale=conf.getParameter<double>("HOEScale");
  HF1EScale=conf.getParameter<double>("HF1EScale");
  HF2EScale=conf.getParameter<double>("HF2EScale");
  if (ctEScales.instanceLabel=="") produces<CaloTowerCollection>();
  else produces<CaloTowerCollection>(ctEScales.instanceLabel);
  //  two notes:
  //  1) all this could go in a pset
  //  2) not clear the instanceLabel thing
}
virtual CaloTowersReCreator::~CaloTowersReCreator ( ) [inline, virtual]

Definition at line 24 of file CaloTowersReCreator.h.

{ }

Member Function Documentation

void CaloTowersReCreator::produce ( edm::Event e,
const edm::EventSetup c 
) [virtual]

Implements edm::EDProducer.

Definition at line 61 of file CaloTowersReCreator.cc.

References algo_, allowMissingInputs_, CaloTowersCreationAlgo::begin(), caloLabel_, EBEScale, EEEScale, edm::EventSetup::get(), edm::Event::getByLabel(), HBEScale, HEDEScale, HESEScale, HF1EScale, HF2EScale, HOEScale, ctEScales::instanceLabel, edm::HandleBase::isValid(), CrabTask::prod, edm::ESHandle< T >::product(), edm::Event::put(), CaloTowersCreationAlgo::rescaleTowers(), CaloTowersCreationAlgo::setEBEScale(), CaloTowersCreationAlgo::setEEEScale(), CaloTowersCreationAlgo::setGeometry(), CaloTowersCreationAlgo::setHBEScale(), CaloTowersCreationAlgo::setHEDEScale(), CaloTowersCreationAlgo::setHESEScale(), CaloTowersCreationAlgo::setHF1EScale(), CaloTowersCreationAlgo::setHF2EScale(), and CaloTowersCreationAlgo::setHOEScale().

                                                                     {
  // get the necessary event setup objects...
  edm::ESHandle<CaloGeometry> pG;
  edm::ESHandle<HcalTopology> htopo;
  edm::ESHandle<CaloTowerConstituentsMap> cttopo;
  c.get<CaloGeometryRecord>().get(pG);
  c.get<IdealGeometryRecord>().get(htopo);
  c.get<IdealGeometryRecord>().get(cttopo);
 
  algo_.setEBEScale(EBEScale);
  algo_.setEEEScale(EEEScale);
  algo_.setHBEScale(HBEScale);
  algo_.setHESEScale(HESEScale);
  algo_.setHEDEScale(HEDEScale);
  algo_.setHOEScale(HOEScale);
  algo_.setHF1EScale(HF1EScale);
  algo_.setHF2EScale(HF2EScale);
  algo_.setGeometry(cttopo.product(),htopo.product(),pG.product());

  algo_.begin(); // clear the internal buffer
  
  // Step A/C: Get Inputs and process (repeatedly)
  edm::Handle<CaloTowerCollection> calt;
  e.getByLabel(caloLabel_,calt);

/*
  if (!calt.isValid()) {
    // can't find it!
    if (!allowMissingInputs_) {
      *calt;  // will throw the proper exception
    }
  } else {
    algo_.process(*calt);
  }

  // Step B: Create empty output
  std::auto_ptr<CaloTowerCollection> prod(new CaloTowerCollection());

  // Step C: Process
  algo_.finish(*prod);

  // Step D: Put into the event
  if (ctEScales.instanceLabel=="") e.put(prod);
  else e.put(prod,ctEScales.instanceLabel);
*/

  // modified to rescale the CaloTowers directly
  // without going through metatowers
  // required for the algorithms that make use of individual
  // crystal information

  if (!calt.isValid()) {
    // can't find it!
    if (!allowMissingInputs_) {
      *calt;  // will throw the proper exception
    }
  } else {
    // Step B: Create empty output
    std::auto_ptr<CaloTowerCollection> prod(new CaloTowerCollection());

    // step C: rescale (without going threough metataowers)
    algo_.rescaleTowers(*calt, *prod);

    // Step D: Put into the event
    if (ctEScales.instanceLabel=="") e.put(prod);
    else e.put(prod,ctEScales.instanceLabel);
  }

}

Member Data Documentation

Definition at line 29 of file CaloTowersReCreator.h.

Referenced by produce().

Definition at line 31 of file CaloTowersReCreator.h.

Referenced by produce().

Definition at line 30 of file CaloTowersReCreator.h.

Referenced by produce().

Definition at line 26 of file CaloTowersReCreator.h.

Referenced by CaloTowersReCreator(), and produce().

Definition at line 26 of file CaloTowersReCreator.h.

Referenced by CaloTowersReCreator(), and produce().

Definition at line 26 of file CaloTowersReCreator.h.

Referenced by CaloTowersReCreator(), and produce().

Definition at line 27 of file CaloTowersReCreator.h.

Referenced by CaloTowersReCreator(), and produce().

Definition at line 26 of file CaloTowersReCreator.h.

Referenced by CaloTowersReCreator(), and produce().

Definition at line 27 of file CaloTowersReCreator.h.

Referenced by CaloTowersReCreator(), and produce().

Definition at line 27 of file CaloTowersReCreator.h.

Referenced by CaloTowersReCreator(), and produce().

Definition at line 27 of file CaloTowersReCreator.h.

Referenced by CaloTowersReCreator(), and produce().