CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
miscalibExample Class Reference

#include <Calibration/EcalCalibAlgos/src/miscalibExample.cc>

Inheritance diagram for miscalibExample:
edm::one::EDAnalyzer<> edm::one::EDAnalyzerBase edm::EDConsumerBase

Public Member Functions

void analyze (const edm::Event &, const edm::EventSetup &) override
 
void beginJob () override
 
void endJob () override
 
 miscalibExample (const edm::ParameterSet &)
 
 ~miscalibExample () override
 
- Public Member Functions inherited from edm::one::EDAnalyzer<>
 EDAnalyzer ()=default
 
 EDAnalyzer (const EDAnalyzer &)=delete
 
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
const EDAnalyzeroperator= (const EDAnalyzer &)=delete
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
bool wantsInputProcessBlocks () const final
 
bool wantsProcessBlocks () const final
 
- Public Member Functions inherited from edm::one::EDAnalyzerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzerBase ()
 
ModuleDescription const & moduleDescription () const
 
bool wantsStreamLuminosityBlocks () const
 
bool wantsStreamRuns () const
 
 ~EDAnalyzerBase () override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ESResolverIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESResolverIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex > const & esGetTokenRecordIndicesVector (edm::Transition iTrans) const
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::array< std::vector< ModuleDescription const *> *, NumBranchTypes > &modulesAll, std::vector< ModuleProcessName > &modulesInPreviousProcesses, ProductRegistry const &preg, std::map< std::string, ModuleDescription const *> const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
void selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProductResolverIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Attributes

const std::string correctedHybridSuperClusterCollection_
 
const std::string correctedHybridSuperClusterProducer_
 
const edm::EDGetTokenT< reco::SuperClusterCollectioncorrectedHybridSuperClusterToken_
 
int read_events
 
const std::string rootfile_
 
TH1F * scEnergy
 

Additional Inherited Members

- Public Types inherited from edm::one::EDAnalyzerBase
typedef EDAnalyzerBase ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::one::EDAnalyzerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< Bconsumes (edm::InputTag tag) noexcept
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes ()
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag)
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
void resetItemsToGetFrom (BranchType iType)
 

Detailed Description

Description: Analyzer to fetch collection of objects from event and make simple plots

Implementation: \

Author
: Lorenzo Agostino, September 2006

Description: Perform single electron calibration (tested on TB data only).

Implementation: <Notes on="" implementation>="">

Definition at line 36 of file miscalibExample.h.

Constructor & Destructor Documentation

◆ miscalibExample()

miscalibExample::miscalibExample ( const edm::ParameterSet iConfig)
explicit

Definition at line 32 of file miscalibExample.cc.

References edm::ParameterSet::getUntrackedParameter(), and AlCaHLTBitMon_QueryRunRegistry::string.

33  : rootfile_{iConfig.getUntrackedParameter<std::string>("rootfile", "ecalSimpleTBanalysis.root")},
34  correctedHybridSuperClusterProducer_{iConfig.getParameter<std::string>("correctedHybridSuperClusterProducer")},
36  iConfig.getParameter<std::string>("correctedHybridSuperClusterCollection")},
37  correctedHybridSuperClusterToken_{consumes<reco::SuperClusterCollection>(
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
const std::string correctedHybridSuperClusterProducer_
const std::string correctedHybridSuperClusterCollection_
T getUntrackedParameter(std::string const &, T const &) const
const std::string rootfile_
const edm::EDGetTokenT< reco::SuperClusterCollection > correctedHybridSuperClusterToken_

◆ ~miscalibExample()

miscalibExample::~miscalibExample ( )
override

Definition at line 40 of file miscalibExample.cc.

40 {}

Member Function Documentation

◆ analyze()

void miscalibExample::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
)
overridevirtual

Implements edm::one::EDAnalyzerBase.

Definition at line 68 of file miscalibExample.cc.

References correctedHybridSuperClusterCollection_, correctedHybridSuperClusters_cfi::correctedHybridSuperClusters, correctedHybridSuperClusterToken_, iEvent, edm::HandleBase::isValid(), edm::Handle< T >::product(), read_events, and scEnergy.

68  {
69  //=================================================================================
70  using namespace edm;
71  using namespace std;
72 
73  read_events++;
74 
75  // Get hybrid super clusters after energy correction
76 
77  Handle<reco::SuperClusterCollection> pCorrectedHybridSuperClusters;
78 
79  iEvent.getByToken(correctedHybridSuperClusterToken_, pCorrectedHybridSuperClusters);
80 
81  if (!pCorrectedHybridSuperClusters.isValid()) {
82  LogError("EgammaSimpleAnalyzer") << "Error! can't get collection with label "
84  }
85  const reco::SuperClusterCollection* correctedHybridSuperClusters = pCorrectedHybridSuperClusters.product();
86 
87  reco::SuperClusterCollection::const_iterator superClusterIt;
88  for (superClusterIt = correctedHybridSuperClusters->begin(); superClusterIt != correctedHybridSuperClusters->end();
89  superClusterIt++) {
90  scEnergy->Fill(superClusterIt->energy());
91  }
92 }
T const * product() const
Definition: Handle.h:70
Log< level::Error, false > LogError
const std::string correctedHybridSuperClusterCollection_
int iEvent
Definition: GenABIO.cc:224
std::vector< SuperCluster > SuperClusterCollection
collection of SuperCluser objectr
const edm::EDGetTokenT< reco::SuperClusterCollection > correctedHybridSuperClusterToken_
bool isValid() const
Definition: HandleBase.h:70
HLT enums.

◆ beginJob()

void miscalibExample::beginJob ( )
overridevirtual

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 43 of file miscalibExample.cc.

References read_events, and scEnergy.

43  {
44  //========================================================================
45 
46  // Book histograms
47  scEnergy = new TH1F("scEnergy", "SuperCluster energy", 100, 20., 80.);
48  read_events = 0;
49 }

◆ endJob()

void miscalibExample::endJob ( void  )
overridevirtual

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 52 of file miscalibExample.cc.

References gather_cfg::cout, f, read_events, rootfile_, and scEnergy.

Referenced by o2olib.O2ORunMgr::executeJob().

52  {
53  //========================================================================
54 
55  std::cout << "************* STATISTICS **************" << std::endl;
56  std::cout << "Read Events: " << read_events << std::endl;
57 
59 
60  TFile f(rootfile_.c_str(), "RECREATE");
61 
62  scEnergy->Write();
63  f.Close();
64  delete scEnergy;
65 }
double f[11][100]
const std::string rootfile_

Member Data Documentation

◆ correctedHybridSuperClusterCollection_

const std::string miscalibExample::correctedHybridSuperClusterCollection_
private

Definition at line 49 of file miscalibExample.h.

Referenced by analyze().

◆ correctedHybridSuperClusterProducer_

const std::string miscalibExample::correctedHybridSuperClusterProducer_
private

Definition at line 48 of file miscalibExample.h.

◆ correctedHybridSuperClusterToken_

const edm::EDGetTokenT<reco::SuperClusterCollection> miscalibExample::correctedHybridSuperClusterToken_
private

Definition at line 51 of file miscalibExample.h.

Referenced by analyze().

◆ read_events

int miscalibExample::read_events
private

Definition at line 50 of file miscalibExample.h.

Referenced by analyze(), beginJob(), and endJob().

◆ rootfile_

const std::string miscalibExample::rootfile_
private

Definition at line 47 of file miscalibExample.h.

Referenced by endJob().

◆ scEnergy

TH1F* miscalibExample::scEnergy
private

Definition at line 53 of file miscalibExample.h.

Referenced by analyze(), beginJob(), and endJob().