CMS 3D CMS Logo

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

#include <EcalBxOrbitNumberGrapher.h>

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

Public Member Functions

 EcalBxOrbitNumberGrapher (const edm::ParameterSet &)
 
 ~EcalBxOrbitNumberGrapher () 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
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESProxyIndex > 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
 
bool registeredToConsumeMany (TypeID const &, 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::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Member Functions

void analyze (const edm::Event &, const edm::EventSetup &) override
 
void beginJob () override
 
void endJob () override
 
void initHists (int)
 

Private Attributes

TH1F * bxnumberPlot_
 
const edm::EDGetTokenT< EcalRawDataCollectiondigiProducer_
 
TFile * file
 
std::string fileName_
 
TH1F * numberofOrbitDiffPlot_
 
TH1F * orbitErrorBxDiffPlot_
 
TH1F * orbitErrorPlot_
 
int runNum_
 

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 ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
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: <one line="" class="" summary>="">

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

Definition at line 46 of file EcalBxOrbitNumberGrapher.h.

Constructor & Destructor Documentation

◆ EcalBxOrbitNumberGrapher()

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

Definition at line 38 of file EcalBxOrbitNumberGrapher.cc.

39  : digiProducer_(consumes<EcalRawDataCollection>(iConfig.getParameter<std::string>("RawDigis"))),
40  runNum_(-1),
41  fileName_(iConfig.getUntrackedParameter<std::string>("fileName", "ecalURechHitHists")) {}
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
const edm::EDGetTokenT< EcalRawDataCollection > digiProducer_
T getUntrackedParameter(std::string const &, T const &) const

◆ ~EcalBxOrbitNumberGrapher()

EcalBxOrbitNumberGrapher::~EcalBxOrbitNumberGrapher ( )
override

Definition at line 43 of file EcalBxOrbitNumberGrapher.cc.

43 {}

Member Function Documentation

◆ analyze()

void EcalBxOrbitNumberGrapher::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivatevirtual

Implements edm::one::EDAnalyzerBase.

Definition at line 50 of file EcalBxOrbitNumberGrapher.cc.

References edm::SortedCollection< T, SORT >::begin(), simKBmtfDigis_cfi::bx, bxnumberPlot_, digiProducer_, edm::SortedCollection< T, SORT >::end(), iEvent, edm::HandleBase::isValid(), numberofOrbitDiffPlot_, orbitErrorBxDiffPlot_, orbitErrorPlot_, and runNum_.

50  {
51  using namespace cms;
52  //int ievt = iEvent.id().event();
53  int orbit = -100;
54  int bx = -100;
55  int numorbiterrors = 0;
56  bool orbiterror = false;
57 
58  const edm::Handle<EcalRawDataCollection>& DCCHeaders = iEvent.getHandle(digiProducer_);
59  if (!DCCHeaders.isValid()) {
60  edm::LogError("BxOrbitNumber") << "can't get the product for EcalRawDataCollection";
61  }
62 
63  //-----------------BX STuff here
64  for (EcalRawDataCollection::const_iterator headerItr = DCCHeaders->begin(); headerItr != DCCHeaders->end();
65  ++headerItr) {
66  headerItr->getEventSettings();
67  int myorbit = headerItr->getOrbit();
68  int mybx = headerItr->getBX();
69 
70  if (orbit == -100) {
71  orbit = myorbit;
72  } else if (orbit != myorbit) {
73  edm::LogVerbatim("EcalTools") << " NOOOO This header has a conflicting orbit OTHER " << orbit << " new "
74  << myorbit;
75  orbiterror = true;
76  numorbiterrors++;
77  orbitErrorBxDiffPlot_->Fill(myorbit - orbit);
78  }
79 
80  if (bx == -100) {
81  bx = mybx;
82  } else if (bx != mybx) {
83  edm::LogVerbatim("EcalTools") << " NOOOO This header has a conflicting bx OTHER " << bx << " new " << mybx;
84  }
85  }
86 
87  if ((bx != -100) & (orbit != -100)) {
88  edm::LogVerbatim("EcalTools") << " Interesting event Orbit " << orbit << " BX " << bx;
89  bxnumberPlot_->Fill(bx);
90  if (orbiterror) {
91  orbitErrorPlot_->Fill(bx);
92  }
93  }
94  numberofOrbitDiffPlot_->Fill(numorbiterrors);
95 
96  if (runNum_ == -1) {
97  runNum_ = iEvent.id().run();
98  }
99 }
Log< level::Info, true > LogVerbatim
std::vector< T >::const_iterator const_iterator
const edm::EDGetTokenT< EcalRawDataCollection > digiProducer_
Log< level::Error, false > LogError
int iEvent
Definition: GenABIO.cc:224
const_iterator begin() const
Namespace of DDCMS conversion namespace.
const_iterator end() const
bool isValid() const
Definition: HandleBase.h:70

◆ beginJob()

void EcalBxOrbitNumberGrapher::beginJob ( )
overrideprivatevirtual

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 105 of file EcalBxOrbitNumberGrapher.cc.

References bxnumberPlot_, numberofOrbitDiffPlot_, orbitErrorBxDiffPlot_, and orbitErrorPlot_.

105  {
106  bxnumberPlot_ = new TH1F("bxnumber", "BX number of interexting events", 3600, 0., 3600.);
107  orbitErrorPlot_ = new TH1F("bxOfOrbitDiffs", "BX number of interexting events with orbit changes", 3600, 0., 3600.);
109  new TH1F("orbitErrorDiffPlot", "Orbit Difference of those HEADERS that have a difference", 20, -10., 10.);
110  numberofOrbitDiffPlot_ = new TH1F("numberOfOrbitDiffsPlot", "Number of Orbit Differences", 54, 0., 54.);
111 }

◆ endJob()

void EcalBxOrbitNumberGrapher::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 114 of file EcalBxOrbitNumberGrapher.cc.

References bxnumberPlot_, fileName_, numberofOrbitDiffPlot_, orbitErrorBxDiffPlot_, and orbitErrorPlot_.

Referenced by o2olib.O2ORunMgr::executeJob().

114  {
115  using namespace std;
116  fileName_ += ".bx.root";
117 
118  TFile root_file_(fileName_.c_str(), "RECREATE");
119 
120  bxnumberPlot_->Write();
121  orbitErrorPlot_->Write();
122  numberofOrbitDiffPlot_->Write();
123  orbitErrorBxDiffPlot_->Write();
124  root_file_.Close();
125 }

◆ initHists()

void EcalBxOrbitNumberGrapher::initHists ( int  FED)
private

Definition at line 102 of file EcalBxOrbitNumberGrapher.cc.

102 {}

Member Data Documentation

◆ bxnumberPlot_

TH1F* EcalBxOrbitNumberGrapher::bxnumberPlot_
private

Definition at line 63 of file EcalBxOrbitNumberGrapher.h.

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

◆ digiProducer_

const edm::EDGetTokenT<EcalRawDataCollection> EcalBxOrbitNumberGrapher::digiProducer_
private

Definition at line 59 of file EcalBxOrbitNumberGrapher.h.

Referenced by analyze().

◆ file

TFile* EcalBxOrbitNumberGrapher::file
private

◆ fileName_

std::string EcalBxOrbitNumberGrapher::fileName_
private

Definition at line 61 of file EcalBxOrbitNumberGrapher.h.

Referenced by endJob().

◆ numberofOrbitDiffPlot_

TH1F* EcalBxOrbitNumberGrapher::numberofOrbitDiffPlot_
private

Definition at line 66 of file EcalBxOrbitNumberGrapher.h.

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

◆ orbitErrorBxDiffPlot_

TH1F* EcalBxOrbitNumberGrapher::orbitErrorBxDiffPlot_
private

Definition at line 65 of file EcalBxOrbitNumberGrapher.h.

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

◆ orbitErrorPlot_

TH1F* EcalBxOrbitNumberGrapher::orbitErrorPlot_
private

Definition at line 64 of file EcalBxOrbitNumberGrapher.h.

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

◆ runNum_

int EcalBxOrbitNumberGrapher::runNum_
private

Definition at line 60 of file EcalBxOrbitNumberGrapher.h.

Referenced by analyze().