CMS 3D CMS Logo

L1GctValidation.cc
Go to the documentation of this file.
2 
6 
9 
11 
13 
14 #include <cmath>
15 
17  : m_gctinp_tag(iConfig.getUntrackedParameter<edm::InputTag>("rctInputTag", edm::InputTag("rctDigis"))),
18  m_energy_tag(iConfig.getUntrackedParameter<edm::InputTag>("gctInputTag", edm::InputTag("gctDigis"))),
20  m_htMissScaleToken(esConsumes<L1CaloEtScale, L1HtMissScaleRcd>()),
21  m_hfRingEtScaleToken(esConsumes<L1CaloEtScale, L1HfRingEtScaleRcd>()) {
22  usesResource(TFileService::kSharedResource);
23 }
24 
26  // do anything here that needs to be done at desctruction time
27  // (e.g. close files, deallocate resources etc.)
28 }
29 
30 //
31 // member functions
32 //
33 
34 // ------------ method called to for each event ------------
36  using namespace edm;
37 
38  // Get the scales from the event setup
40 
41  double lsbForEt = jfPars.product()->getRgnEtLsbGeV();
42  double lsbForHt = jfPars.product()->getHtLsbGeV();
43 
44  unsigned httJetThreshold = static_cast<int>(jfPars.product()->getHtJetEtThresholdGeV() / lsbForHt);
45  unsigned htmJetThreshold = static_cast<int>(jfPars.product()->getMHtJetEtThresholdGeV() / lsbForHt);
46 
49 
50  // Get the Gct energy sums from the event
52  iEvent.getByLabel(m_energy_tag, sumEtColl);
54  iEvent.getByLabel(m_energy_tag, sumHtColl);
56  iEvent.getByLabel(m_energy_tag, missEtColl);
58  iEvent.getByLabel(m_energy_tag, missHtColl);
59 
60  // Get the input calo regions from the event (for checking MEt)
62  iEvent.getByLabel(m_gctinp_tag, inputColl);
63 
64  // Get the internal jet data from the event (for checking Ht)
65  Handle<L1GctInternJetDataCollection> internalJetsColl;
66  iEvent.getByLabel(m_energy_tag, internalJetsColl);
67 
68  double etTot = 0.0;
69  for (L1GctEtTotalCollection::const_iterator jbx = sumEtColl->begin(); jbx != sumEtColl->end(); jbx++) {
70  if (jbx->bx() == 0) {
71  etTot = static_cast<double>(jbx->et());
72  }
73  }
74 
75  double etHad = 0.0;
76  for (L1GctEtHadCollection::const_iterator jbx = sumHtColl->begin(); jbx != sumHtColl->end(); jbx++) {
77  if (jbx->bx() == 0) {
78  etHad = static_cast<double>(jbx->et());
79  }
80  }
81 
82  double etMiss = 0.0;
83  double etMAng = 0.0;
84  for (L1GctEtMissCollection::const_iterator jbx = missEtColl->begin(); jbx != missEtColl->end(); jbx++) {
85  if (jbx->bx() == 0) {
86  etMiss = static_cast<double>(jbx->et());
87  int phibin = jbx->phi();
88  if (phibin >= 36)
89  phibin -= 72;
90  double etMPhi = static_cast<double>(phibin);
91 
92  etMAng = (etMPhi + 0.5) * M_PI / 36.;
93  }
94  }
95 
96  double etTotFromRegions = 0.0;
97  double exTotFromRegions = 0.0;
98  double eyTotFromRegions = 0.0;
99  for (L1CaloRegionCollection::const_iterator jrg = inputColl->begin(); jrg != inputColl->end(); jrg++) {
100  if (jrg->bx() == 0) {
101  double rgEt = static_cast<double>(jrg->et()) * lsbForEt;
102  double rgPhibin = static_cast<double>(jrg->id().iphi());
103  double rgPh = (rgPhibin + 0.5) * M_PI / 9.;
104 
105  etTotFromRegions += rgEt;
106  exTotFromRegions += rgEt * cos(rgPh);
107  eyTotFromRegions += rgEt * sin(rgPh);
108  }
109  }
110 
111  double htMissGct = 0.0;
112  double htMissAng = 0.0;
113  double htMissGeV = 0.0;
114  for (L1GctHtMissCollection::const_iterator jbx = missHtColl->begin(); jbx != missHtColl->end(); jbx++) {
115  if (jbx->bx() == 0) {
116  htMissGct = static_cast<double>(jbx->et());
117  htMissGeV = htMissScale->et(jbx->et());
118  int phibin = jbx->phi();
119  if (phibin >= 9)
120  phibin -= 18;
121  double htMPhi = static_cast<double>(phibin);
122  htMissAng = (htMPhi + 0.5) * M_PI / 9.;
123  }
124  }
125 
126  double htFromJets = 0.0;
127  double hxFromJets = 0.0;
128  double hyFromJets = 0.0;
129  for (L1GctInternJetDataCollection::const_iterator jet = internalJetsColl->begin(); jet != internalJetsColl->end();
130  jet++) {
131  if (jet->bx() == 0 && !jet->empty()) {
132  unsigned jetEtGct = jet->et();
133  double jetEt = static_cast<double>(jetEtGct);
134  int phibin = jet->regionId().iphi();
135  if (phibin >= 9)
136  phibin -= 18;
137  // The phi bin centres are at 0, 20, 40, ... degrees
138  double jetAng = (static_cast<double>(phibin)) * M_PI / 9.;
139  if (jetEtGct > httJetThreshold) {
140  htFromJets += jetEt;
141  }
142  if (jetEtGct > htmJetThreshold) {
143  hxFromJets += jetEt * cos(jetAng);
144  hyFromJets += jetEt * sin(jetAng);
145  }
146  }
147  }
148 
149  double dPhiMetMht = deltaPhi(etMAng, htMissAng);
150 
151  theSumEtInLsb->Fill(etTot);
152  theSumHtInLsb->Fill(etHad);
153  theMissEtInLsb->Fill(etMiss);
154  theMissHtInLsb->Fill(htMissGct);
155  theSumEtInGeV->Fill(etTot * lsbForEt);
156  theSumHtInGeV->Fill(etHad * lsbForHt);
157  theMissEtInGeV->Fill(etMiss * lsbForEt);
158  theMissEtAngle->Fill(etMAng);
159  theMissEtVector->Fill(etMiss * lsbForEt * cos(etMAng), etMiss * lsbForEt * sin(etMAng));
160  if (htMissGct < 126.5) {
161  theMissHtInGeV->Fill(htMissGeV);
162  theMissHtAngle->Fill(htMissAng);
163  theMissHtVector->Fill(htMissGeV * cos(htMissAng), htMissGeV * sin(htMissAng));
164  }
165 
166  theSumEtVsInputRegions->Fill(etTot * lsbForEt, etTotFromRegions);
167  theMissEtMagVsInputRegions->Fill(etMiss * lsbForEt,
168  sqrt(exTotFromRegions * exTotFromRegions + eyTotFromRegions * eyTotFromRegions));
169  theMissEtAngleVsInputRegions->Fill(etMAng, atan2(-eyTotFromRegions, -exTotFromRegions));
170  theMissHtMagVsInputRegions->Fill(htMissGeV,
171  sqrt(exTotFromRegions * exTotFromRegions + eyTotFromRegions * eyTotFromRegions));
172 
173  theMissEtVsMissHt->Fill(etMiss * lsbForEt, htMissGeV);
174  theMissEtVsMissHtAngle->Fill(etMAng, htMissAng);
175  theDPhiVsMissEt->Fill(dPhiMetMht, etMiss * lsbForEt);
176  theDPhiVsMissHt->Fill(dPhiMetMht, htMissGeV);
177 
178  theHtVsInternalJetsSum->Fill(etHad * lsbForHt, htFromJets * lsbForHt);
179  if (htMissGct < 126.5) {
180  theMissHtVsInternalJetsSum->Fill(htMissGeV, sqrt(hxFromJets * hxFromJets + hyFromJets * hyFromJets) * lsbForHt);
181  theMissHtPhiVsInternalJetsSum->Fill(htMissAng, atan2(-hyFromJets, -hxFromJets));
182  theMissHxVsInternalJetsSum->Fill(htMissGeV * cos(htMissAng), hxFromJets * lsbForHt);
183  theMissHyVsInternalJetsSum->Fill(htMissGeV * sin(htMissAng), hyFromJets * lsbForHt);
184  }
185 
186  // Get minbias trigger quantities from HF
189  iEvent.getByLabel(m_energy_tag, HFEtSumsColl);
190  iEvent.getByLabel(m_energy_tag, HFCountsColl);
191 
192  for (L1GctHFRingEtSumsCollection::const_iterator es = HFEtSumsColl->begin(); es != HFEtSumsColl->end(); es++) {
193  if (es->bx() == 0) {
194  theHfRing0EtSumPositiveEta->Fill(hfRingEtScale->et(es->etSum(0)));
195  theHfRing0EtSumNegativeEta->Fill(hfRingEtScale->et(es->etSum(1)));
196  theHfRing1EtSumPositiveEta->Fill(hfRingEtScale->et(es->etSum(2)));
197  theHfRing1EtSumNegativeEta->Fill(hfRingEtScale->et(es->etSum(3)));
198  }
199  }
200 
201  for (L1GctHFBitCountsCollection::const_iterator bc = HFCountsColl->begin(); bc != HFCountsColl->end(); bc++) {
202  if (bc->bx() == 0) {
203  theHfRing0CountPositiveEta->Fill(bc->bitCount(0));
204  theHfRing0CountNegativeEta->Fill(bc->bitCount(1));
205  theHfRing1CountPositiveEta->Fill(bc->bitCount(2));
206  theHfRing1CountNegativeEta->Fill(bc->bitCount(3));
207  }
208  }
209 }
210 
211 // ------------ method called once each job just before starting event loop ------------
214 
215  TFileDirectory dir0 = fs->mkdir("L1GctEtSums");
216 
217  theSumEtInLsb = dir0.make<TH1F>("SumEtInLsb", "Total Et (GCT units)", 128, 0., 2048.);
218  theSumHtInLsb = dir0.make<TH1F>("SumHtInLsb", "Total Ht (GCT units)", 128, 0., 2048.);
219  theMissEtInLsb = dir0.make<TH1F>("MissEtInLsb", "Missing Et magnitude (GCT units)", 128, 0., 1024.);
220  theMissHtInLsb = dir0.make<TH1F>("MissHtInLsb", "Missing Ht magnitude (GCT units)", 128, 0., 127.);
221  theSumEtInGeV = dir0.make<TH1F>("SumEtInGeV", "Total Et (in GeV)", 100, 0., 1000.);
222  theSumHtInGeV = dir0.make<TH1F>("SumHtInGeV", "Total Ht (in GeV)", 100, 0., 1000.);
223  theMissEtInGeV = dir0.make<TH1F>("MissEtInGeV", "Missing Et magnitude (in GeV)", 100, 0., 500.);
224  theMissEtAngle = dir0.make<TH1F>("MissEtAngle", "Missing Et angle", 72, -M_PI, M_PI);
225  theMissEtVector = dir0.make<TH2F>("MissEtVector", "Missing Ex vs Missing Ey", 100, -100., 100., 100, -100., 100.);
226  theMissHtInGeV = dir0.make<TH1F>("MissHtInGeV", "Missing Ht magnitude (in GeV)", 100, 0., 500.);
227  theMissHtAngle = dir0.make<TH1F>("MissHtAngle", "Missing Ht angle", 72, -M_PI, M_PI);
228  theMissHtVector = dir0.make<TH2F>("MissHtVector", "Missing Hx vs Missing Hy", 100, -100., 100., 100, -100., 100.);
230  dir0.make<TH2F>("SumEtVsInputRegions", "Total Et vs sum of input regions", 100, 0., 1000., 100, 0., 1000.);
231  theMissEtMagVsInputRegions = dir0.make<TH2F>(
232  "MissEtMagVsInputRegions", "Missing Et magnitude vs sum of input regions", 100, 0., 500., 100, 0., 500.);
233  theMissEtAngleVsInputRegions = dir0.make<TH2F>(
234  "MissEtAngleVsInputRegions", "Missing Et angle vs sum of input regions", 72, -M_PI, M_PI, 72, -M_PI, M_PI);
235  theMissHtMagVsInputRegions = dir0.make<TH2F>(
236  "MissHtMagVsInputRegions", "Missing Ht magnitude vs sum of input regions", 100, 0., 500., 100, 0., 500.);
237  theMissEtVsMissHt = dir0.make<TH2F>("MissEtVsMissHt", "Missing Et vs Missing Ht", 100, 0., 500., 100, 0., 500.);
238  theMissEtVsMissHtAngle = dir0.make<TH2F>(
239  "MissEtVsMissHtAngle", "Angle correlation Missing Et vs Missing Ht", 72, -M_PI, M_PI, 72, -M_PI, M_PI);
241  dir0.make<TH2F>("theDPhiVsMissEt", "Angle difference MET-MHT vs MET magnitude", 72, -M_PI, M_PI, 100, 0., 500.);
243  dir0.make<TH2F>("theDPhiVsMissHt", "Angle difference MET-MHT vs MHT magnitude", 72, -M_PI, M_PI, 100, 0., 500.);
244 
245  theHtVsInternalJetsSum = dir0.make<TH2F>(
246  "HtVsInternalJetsSum", "Ht vs scalar sum of jet Et values (in GeV)", 128, 0., 2048., 128, 0., 2048.);
247  theMissHtVsInternalJetsSum = dir0.make<TH2F>(
248  "MissHtVsInternalJetsSum", "Missing Ht vs vector sum of jet Et values (in GeV)", 128, 0., 512., 128, 0., 512.);
249  theMissHtPhiVsInternalJetsSum = dir0.make<TH2F>("MissHtPhiVsInternalJetsSum",
250  "Angle correlation Missing Ht vs vector sum of jet Et values",
251  72,
252  -M_PI,
253  M_PI,
254  72,
255  -M_PI,
256  M_PI);
257  theMissHxVsInternalJetsSum = dir0.make<TH2F>("MissHxVsInternalJetsSum",
258  "Missing Ht x component vs sum of jet Et values (in GeV)",
259  128,
260  -256.,
261  256.,
262  128,
263  -256.,
264  256.);
265  theMissHyVsInternalJetsSum = dir0.make<TH2F>("MissHyVsInternalJetsSum",
266  "Missing Ht y component vs sum of jet Et values (in GeV)",
267  128,
268  -256.,
269  256.,
270  128,
271  -256.,
272  256.);
273 
274  TFileDirectory dir1 = fs->mkdir("L1GctHfSumsAndJetCounts");
275 
276  // Minimum bias triggers from Hf inner rings
277  theHfRing0EtSumPositiveEta = dir1.make<TH1F>("HfRing0EtSumPositiveEta", "Hf Inner Ring0 Et eta+", 60, 0., 30.);
278  theHfRing0EtSumNegativeEta = dir1.make<TH1F>("HfRing0EtSumNegativeEta", "Hf Inner Ring0 Et eta-", 60, 0., 30.);
279  theHfRing1EtSumPositiveEta = dir1.make<TH1F>("HfRing1EtSumPositiveEta", "Hf Inner Ring1 Et eta+", 60, 0., 30.);
280  theHfRing1EtSumNegativeEta = dir1.make<TH1F>("HfRing1EtSumNegativeEta", "Hf Inner Ring1 Et eta-", 60, 0., 30.);
281  theHfRing0CountPositiveEta = dir1.make<TH1F>("HfRing0CountPositiveEta", "Hf Threshold bits Ring0 eta+", 20, 0., 20.);
282  theHfRing0CountNegativeEta = dir1.make<TH1F>("HfRing0CountNegativeEta", "Hf Threshold bits Ring0 eta-", 20, 0., 20.);
283  theHfRing1CountPositiveEta = dir1.make<TH1F>("HfRing1CountPositiveEta", "Hf Threshold bits Ring1 eta+", 20, 0., 20.);
284  theHfRing1CountNegativeEta = dir1.make<TH1F>("HfRing1CountNegativeEta", "Hf Threshold bits Ring1 eta-", 20, 0., 20.);
285 }
286 
287 // ------------ method called once each job just after ending the event loop ------------
289 
static const std::string kSharedResource
Definition: TFileService.h:76
TH1F * theHfRing1EtSumPositiveEta
TH2F * theMissHxVsInternalJetsSum
TH2F * theMissHtVsInternalJetsSum
ESGetTokenH3DDVariant esConsumes(std::string const &Record, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
double getRgnEtLsbGeV() const
void endJob() override
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
TH2F * theHtVsInternalJetsSum
L1GctValidation(const edm::ParameterSet &)
double getHtJetEtThresholdGeV() const
edm::ESGetToken< L1CaloEtScale, L1HtMissScaleRcd > m_htMissScaleToken
TH2F * theMissHyVsInternalJetsSum
TH2F * theMissEtVsMissHt
TH1F * theHfRing1CountPositiveEta
T * make(const Args &...args) const
make new ROOT object
TH1F * theHfRing0EtSumPositiveEta
int iEvent
Definition: GenABIO.cc:224
T const * product() const
Definition: ESHandle.h:86
TH1F * theHfRing0CountNegativeEta
double et(const uint16_t rank) const
convert from rank to physically meaningful quantity
T sqrt(T t)
Definition: SSEVec.h:19
edm::ESGetToken< L1GctJetFinderParams, L1GctJetFinderParamsRcd > m_jfParsToken
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
TH2F * theSumEtVsInputRegions
edm::InputTag m_energy_tag
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
TH2F * theMissEtAngleVsInputRegions
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:130
TH1F * theHfRing1EtSumNegativeEta
edm::InputTag m_gctinp_tag
#define M_PI
TH1F * theHfRing1CountNegativeEta
void beginJob() override
void analyze(const edm::Event &, const edm::EventSetup &) override
~L1GctValidation() override
HLT enums.
edm::ESGetToken< L1CaloEtScale, L1HfRingEtScaleRcd > m_hfRingEtScaleToken
TH1F * theHfRing0CountPositiveEta
TH2F * theMissHtPhiVsInternalJetsSum
TH1F * theHfRing0EtSumNegativeEta
TH2F * theMissEtVsMissHtAngle
TH2F * theMissEtMagVsInputRegions
double getMHtJetEtThresholdGeV() const
TH2F * theMissHtMagVsInputRegions