CMS 3D CMS Logo

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