CMS 3D CMS Logo

EcalBxOrbitNumberGrapher.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: EcalBxOrbitNumberGrapher
4 // Class: EcalBxOrbitNumberGrapher
5 //
13 //
14 // Original Author: Seth COOPER
15 // Created: Th Nov 22 5:46:22 CEST 2007
16 //
17 //
18 
20 
21 using namespace cms;
22 using namespace edm;
23 using namespace std;
24 
25 #include <iostream>
26 
27 //
28 // constants, enums and typedefs
29 //
30 
31 //
32 // static data member definitions
33 //
34 
35 //
36 // constructors and destructor
37 //
39  : digiProducer_(iConfig.getParameter<std::string>("RawDigis")),
40  runNum_(-1),
41  fileName_(iConfig.getUntrackedParameter<std::string>("fileName", std::string("ecalURechHitHists"))) {}
42 
44 
45 //
46 // member functions
47 //
48 
49 // ------------ method called to for each event ------------
51  using namespace edm;
52  using namespace cms;
53  //int ievt = iEvent.id().event();
54  int orbit = -100;
55  int bx = -100;
56  int numorbiterrors = 0;
57  bool orbiterror = false;
58 
60  iEvent.getByLabel(digiProducer_, DCCHeaders);
61  if (!DCCHeaders.isValid()) {
62  edm::LogError("BxOrbitNumber") << "can't get the product for EcalRawDataCollection";
63  }
64 
65  //-----------------BX STuff here
66  for (EcalRawDataCollection::const_iterator headerItr = DCCHeaders->begin(); headerItr != DCCHeaders->end();
67  ++headerItr) {
68  headerItr->getEventSettings();
69  int myorbit = headerItr->getOrbit();
70  int mybx = headerItr->getBX();
71 
72  if (orbit == -100) {
73  orbit = myorbit;
74  } else if (orbit != myorbit) {
75  std::cout << " NOOOO This header has a conflicting orbit OTHER " << orbit << " new " << myorbit << std::endl;
76  orbiterror = true;
77  numorbiterrors++;
78  orbitErrorBxDiffPlot_->Fill(myorbit - orbit);
79  }
80 
81  if (bx == -100) {
82  bx = mybx;
83  } else if (bx != mybx) {
84  std::cout << " NOOOO This header has a conflicting bx OTHER " << bx << " new " << mybx << std::endl;
85  }
86  //LogDebug("EcalTimingCosmic") << " Lambda " << lambda; //hmm... this isn't good, I should keep a record of the wavelength in the headers as an inactive SM might have a different wavelength for this field and make this not go through.
87  }
88 
89  if ((bx != -100) & (orbit != -100)) {
90  std::cout << " Interesting event Orbit " << orbit << " BX " << bx << std::endl;
91  bxnumberPlot_->Fill(bx);
92  if (orbiterror) {
93  orbitErrorPlot_->Fill(bx);
94  }
95  }
96  numberofOrbitDiffPlot_->Fill(numorbiterrors);
97 
98  if (runNum_ == -1) {
99  runNum_ = iEvent.id().run();
100  }
101 }
102 
103 // insert the hist map into the map keyed by FED number
105 
106 // ------------ method called once each job just before starting event loop ------------
108  bxnumberPlot_ = new TH1F("bxnumber", "BX number of interexting events", 3600, 0., 3600.);
109  orbitErrorPlot_ = new TH1F("bxOfOrbitDiffs", "BX number of interexting events with orbit changes", 3600, 0., 3600.);
111  new TH1F("orbitErrorDiffPlot", "Orbit Difference of those HEADERS that have a difference", 20, -10., 10.);
112  numberofOrbitDiffPlot_ = new TH1F("numberOfOrbitDiffsPlot", "Number of Orbit Differences", 54, 0., 54.);
113 }
114 
115 // ------------ method called once each job just after ending the event loop ------------
117  using namespace std;
118  fileName_ += ".bx.root";
119 
120  TFile root_file_(fileName_.c_str(), "RECREATE");
121 
122  bxnumberPlot_->Write();
123  orbitErrorPlot_->Write();
124  numberofOrbitDiffPlot_->Write();
125  orbitErrorBxDiffPlot_->Write();
126  root_file_.Close();
127 }
edm::SortedCollection::const_iterator
std::vector< T >::const_iterator const_iterator
Definition: SortedCollection.h:80
EcalBxOrbitNumberGrapher.h
EcalBxOrbitNumberGrapher::endJob
void endJob() override
Definition: EcalBxOrbitNumberGrapher.cc:116
edm
HLT enums.
Definition: AlignableModifier.h:19
EcalBxOrbitNumberGrapher::beginJob
void beginJob() override
Definition: EcalBxOrbitNumberGrapher.cc:107
gather_cfg.cout
cout
Definition: gather_cfg.py:144
l1GtPatternGenerator_cfi.bx
bx
Definition: l1GtPatternGenerator_cfi.py:18
EcalBxOrbitNumberGrapher::digiProducer_
std::string digiProducer_
Definition: EcalBxOrbitNumberGrapher.h:59
EcalBxOrbitNumberGrapher::orbitErrorBxDiffPlot_
TH1F * orbitErrorBxDiffPlot_
Definition: EcalBxOrbitNumberGrapher.h:65
edm::Handle
Definition: AssociativeIterator.h:50
EcalBxOrbitNumberGrapher::analyze
void analyze(const edm::Event &, const edm::EventSetup &) override
Definition: EcalBxOrbitNumberGrapher.cc:50
EcalBxOrbitNumberGrapher::initHists
void initHists(int)
Definition: EcalBxOrbitNumberGrapher.cc:104
edm::SortedCollection::begin
const_iterator begin() const
Definition: SortedCollection.h:262
EcalBxOrbitNumberGrapher::orbitErrorPlot_
TH1F * orbitErrorPlot_
Definition: EcalBxOrbitNumberGrapher.h:64
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
EcalBxOrbitNumberGrapher::numberofOrbitDiffPlot_
TH1F * numberofOrbitDiffPlot_
Definition: EcalBxOrbitNumberGrapher.h:66
edm::ParameterSet
Definition: ParameterSet.h:36
edm::LogError
Definition: MessageLogger.h:183
EcalBxOrbitNumberGrapher::fileName_
std::string fileName_
Definition: EcalBxOrbitNumberGrapher.h:61
edm::SortedCollection::end
const_iterator end() const
Definition: SortedCollection.h:267
EcalBxOrbitNumberGrapher::~EcalBxOrbitNumberGrapher
~EcalBxOrbitNumberGrapher() override
Definition: EcalBxOrbitNumberGrapher.cc:43
iEvent
int iEvent
Definition: GenABIO.cc:224
edm::EventSetup
Definition: EventSetup.h:57
EcalBxOrbitNumberGrapher::bxnumberPlot_
TH1F * bxnumberPlot_
Definition: EcalBxOrbitNumberGrapher.h:63
std
Definition: JetResolutionObject.h:76
EcalBxOrbitNumberGrapher::runNum_
int runNum_
Definition: EcalBxOrbitNumberGrapher.h:60
EcalBxOrbitNumberGrapher::EcalBxOrbitNumberGrapher
EcalBxOrbitNumberGrapher(const edm::ParameterSet &)
Definition: EcalBxOrbitNumberGrapher.cc:38
edm::HandleBase::isValid
bool isValid() const
Definition: HandleBase.h:70
edm::Event
Definition: Event.h:73
cms
Namespace of DDCMS conversion namespace.
Definition: ProducerAnalyzer.cc:21