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