1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
|
// -*- C++ -*-
//
// Package: EcalBxOrbitNumberGrapher
// Class: EcalBxOrbitNumberGrapher
//
/**\class EcalBxOrbitNumberGrapher EcalBxOrbitNumberGrapher.cc
Description: <one line class summary>
Implementation:
<Notes on implementation>
*/
//
// Original Author: Seth COOPER
// Created: Th Nov 22 5:46:22 CEST 2007
//
//
#include "CaloOnlineTools/EcalTools/plugins/EcalBxOrbitNumberGrapher.h"
using namespace cms;
using namespace edm;
using namespace std;
#include <iostream>
//
// constants, enums and typedefs
//
//
// static data member definitions
//
//
// constructors and destructor
//
EcalBxOrbitNumberGrapher::EcalBxOrbitNumberGrapher(const edm::ParameterSet& iConfig)
: digiProducer_(consumes<EcalRawDataCollection>(iConfig.getParameter<std::string>("RawDigis"))),
runNum_(-1),
fileName_(iConfig.getUntrackedParameter<std::string>("fileName", "ecalURechHitHists")) {}
EcalBxOrbitNumberGrapher::~EcalBxOrbitNumberGrapher() {}
//
// member functions
//
// ------------ method called to for each event ------------
void EcalBxOrbitNumberGrapher::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) {
using namespace cms;
//int ievt = iEvent.id().event();
int orbit = -100;
int bx = -100;
int numorbiterrors = 0;
bool orbiterror = false;
const edm::Handle<EcalRawDataCollection>& DCCHeaders = iEvent.getHandle(digiProducer_);
if (!DCCHeaders.isValid()) {
edm::LogError("BxOrbitNumber") << "can't get the product for EcalRawDataCollection";
}
//-----------------BX STuff here
for (EcalRawDataCollection::const_iterator headerItr = DCCHeaders->begin(); headerItr != DCCHeaders->end();
++headerItr) {
headerItr->getEventSettings();
int myorbit = headerItr->getOrbit();
int mybx = headerItr->getBX();
if (orbit == -100) {
orbit = myorbit;
} else if (orbit != myorbit) {
edm::LogVerbatim("EcalTools") << " NOOOO This header has a conflicting orbit OTHER " << orbit << " new "
<< myorbit;
orbiterror = true;
numorbiterrors++;
orbitErrorBxDiffPlot_->Fill(myorbit - orbit);
}
if (bx == -100) {
bx = mybx;
} else if (bx != mybx) {
edm::LogVerbatim("EcalTools") << " NOOOO This header has a conflicting bx OTHER " << bx << " new " << mybx;
}
}
if ((bx != -100) & (orbit != -100)) {
edm::LogVerbatim("EcalTools") << " Interesting event Orbit " << orbit << " BX " << bx;
bxnumberPlot_->Fill(bx);
if (orbiterror) {
orbitErrorPlot_->Fill(bx);
}
}
numberofOrbitDiffPlot_->Fill(numorbiterrors);
if (runNum_ == -1) {
runNum_ = iEvent.id().run();
}
}
// insert the hist map into the map keyed by FED number
void EcalBxOrbitNumberGrapher::initHists(int FED) {}
// ------------ method called once each job just before starting event loop ------------
void EcalBxOrbitNumberGrapher::beginJob() {
bxnumberPlot_ = new TH1F("bxnumber", "BX number of interexting events", 3600, 0., 3600.);
orbitErrorPlot_ = new TH1F("bxOfOrbitDiffs", "BX number of interexting events with orbit changes", 3600, 0., 3600.);
orbitErrorBxDiffPlot_ =
new TH1F("orbitErrorDiffPlot", "Orbit Difference of those HEADERS that have a difference", 20, -10., 10.);
numberofOrbitDiffPlot_ = new TH1F("numberOfOrbitDiffsPlot", "Number of Orbit Differences", 54, 0., 54.);
}
// ------------ method called once each job just after ending the event loop ------------
void EcalBxOrbitNumberGrapher::endJob() {
using namespace std;
fileName_ += ".bx.root";
TFile root_file_(fileName_.c_str(), "RECREATE");
bxnumberPlot_->Write();
orbitErrorPlot_->Write();
numberofOrbitDiffPlot_->Write();
orbitErrorBxDiffPlot_->Write();
root_file_.Close();
}
|