test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
GctErrorAnalyzer.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: GctErrorAnalyzer
4 // Class: GctErrorAnalyzer
5 //
13 //
14 // Original Author: Jad Marrouche
15 // Created: Wed May 20 14:19:23 CEST 2009
16 //
17 //
18 
19 // system include files
20 #include <memory>
21 
22 // user include files
31 //TFile maker include
33 //ROOT includes
34 #include "TH1.h"
35 #include "TH2.h"
36 #include "TAxis.h"
37 //RCT and GCT DataFormat Collections
40 //GctErrorAnalyzer includes
47 //STL includes
48 #include <string>
49 #include <vector>
50 #include <sstream>
51 #include <algorithm>
52 
53 //
54 // class declaration
55 //
56 
58 
59 private:
63  void plotRCTRegions(const edm::Handle<L1CaloRegionCollection> &caloRegions);
71  static bool sortJets (const jetData &jet1, const jetData &jet2); //define this as static as it doesn't need a GctErrorAnalyzer object
82  template<class T> bool checkCollections(const T &collection, const unsigned int &constraint, const std::string &label);
83 
84 public:
85  explicit GctErrorAnalyzer(const edm::ParameterSet&);
87 
88 private:
89  virtual void beginJob() override ;
90  virtual void analyze(const edm::Event&, const edm::EventSetup&) override;
91  virtual void endJob() override ;
92 
93  // ----------member data ---------------------------
94  //the following flags select what we'd like to plot and whether or not we want error information
95  bool doRCT_;
96  bool doEg_;
99  bool doJets_;
103  bool doHF_;
113  //the following flags configure whether or not we want multiple BX behaviour for
114  //1. RCT regions
115  //2. Emulator output
116  //3. Hardware output
117  bool doRCTMBx_;
118  bool doEmuMBx_;
119  bool doGCTMBx_;
120  //the following values select the definition of the "triggered" Bx i.e. where to define Bx=0
124  //the following flags contain the location of the hardware and emulator digis
127  //the following is a string which dictates whether or not we want to use the lab or full system parameters
129 
130  //the following declares a struct to hold the MBX Info to make it easy to pass the information around
132 
133  // histograms
134  //RCT Regions
136  //isoEg
141  //Global Error Histograms
146  //nonIsoEg
151  //Global Error Histograms
156  //cenJet
161  //Global Error Histograms
166  //tauJet
171  //Global Error Histograms
176  //forJet
181  //Global Error Histograms
186  //intJet
188  TH1I *intJetE_Et_;
189  TH1I *intJetE_Of_;
194  //ringSums
198  //bitcounts
202  //totalEt
206  //ET GlobalError Histograms
207  //TH1I *totalEtD_GlobalError_, *totalEtE_GlobalError_;
208  //TH1I *totalEtD_GlobalError_Of_, *totalEtE_GlobalError_Of_;
209  //totalHt
213  //HT GlobalError Histograms
214  //TH1I *totalHtD_GlobalError_, *totalHtE_GlobalError_;
215  //TH1I *totalHtD_GlobalError_Of_, *totalHtE_GlobalError_Of_;
216  //missingET
221  //missingHT
228 
229  //error flags to decide whether or not to print debug info
241 
242  //Directories - put this here because we want to
243  //add directories dynamically to this folder
244  //depending on the errors we find
245  std::vector<TFileDirectory> errorHistCat;
246 
247  //the event number
248  unsigned int eventNumber;
249 
250  const unsigned int * RCT_REGION_QUANTA;
251 
252 };
253 
254 //
255 // constants, enums and typedefs
256 // use in conjunction with the templated bits
263 //
264 // static data member definitions
265 //
266 
267 //
268 // constructors and destructor
269 //
271  doRCT_( iConfig.getUntrackedParameter<bool>("doRCT", true) ),
272  doEg_( iConfig.getUntrackedParameter<bool>("doEg", true) ),
273  doIsoDebug_( iConfig.getUntrackedParameter<bool>("doIsoDebug", true) ),
274  doNonIsoDebug_( iConfig.getUntrackedParameter<bool>("doNonIsoDebug", true) ),
275  doJets_( iConfig.getUntrackedParameter<bool>("doJets", true) ),
276  doCenJetsDebug_( iConfig.getUntrackedParameter<bool>("doCenJetsDebug", true) ),
277  doTauJetsDebug_( iConfig.getUntrackedParameter<bool>("doTauJetsDebug", true) ),
278  doForJetsDebug_( iConfig.getUntrackedParameter<bool>("doForJetsDebug", true) ),
279  doHF_( iConfig.getUntrackedParameter<bool>("doHF", true) ),
280  doRingSumDebug_( iConfig.getUntrackedParameter<bool>("doRingSumDebug", true) ),
281  doBitCountDebug_( iConfig.getUntrackedParameter<bool>("doBitCountDebug", true) ),
282  doTotalEnergySums_( iConfig.getUntrackedParameter<bool>("doTotalEnergySums", true) ),
283  doTotalEtDebug_( iConfig.getUntrackedParameter<bool>("doTotalEtDebug", true) ),
284  doTotalHtDebug_( iConfig.getUntrackedParameter<bool>("doTotalHtDebug", true) ),
285  doMissingEnergySums_( iConfig.getUntrackedParameter<bool>("doMissingEnergySums", true) ),
286  doMissingETDebug_( iConfig.getUntrackedParameter<bool>("doMissingETDebug", true) ),
287  doMissingHTDebug_( iConfig.getUntrackedParameter<bool>("doMissingHTDebug", true) ),
288  doExtraMissingHTDebug_( iConfig.getUntrackedParameter<bool>("doExtraMissingHTDebug", false) ),
289  doRCTMBx_( iConfig.getUntrackedParameter<bool>("doRCTMBx", false)),
290  doEmuMBx_( iConfig.getUntrackedParameter<bool>("doEmuMBx", false)),
291  doGCTMBx_( iConfig.getUntrackedParameter<bool>("doGCTMBx", false)),
292  RCTTrigBx_( iConfig.getUntrackedParameter<int>("RCTTrigBx", 0)),
293  EmuTrigBx_( iConfig.getUntrackedParameter<int>("EmuTrigBx", 0)),
294  GCTTrigBx_( iConfig.getUntrackedParameter<int>("GCTTrigBx", 0)),
295  dataTag_( iConfig.getUntrackedParameter<edm::InputTag>("dataTag", edm::InputTag("gctDigis")) ),
296  emuTag_( iConfig.getUntrackedParameter<edm::InputTag>("emuTag", edm::InputTag("gctEmuDigis")) ),
297  useSys_( iConfig.getUntrackedParameter<std::string>("useSys","P5"))
298 {
299  //now do what ever initialization is needed
300  //make the root file
302 
303  //to try to make this look more elegant
304  //make a string for each folder we'd like for the Data and Emulator Histograms
305  std::vector<std::string> quantities;
306  quantities.push_back("IsoEm");
307  quantities.push_back("NonIsoEM");
308  quantities.push_back("CenJets");
309  quantities.push_back("TauJets");
310  quantities.push_back("ForJets");
311  quantities.push_back("HFRingSums");
312  quantities.push_back("HFBitCounts");
313  quantities.push_back("TotalESums");
314  quantities.push_back("MissingESums");
315 
316  //make the Emulator Histogram directory
317  TFileDirectory emuHist = fs->mkdir("EmulatorHistograms");
318  std::vector<TFileDirectory> emuHistCat;
319 
320  //make the Data Histogram directory
321  TFileDirectory dataHist = fs->mkdir("DataHistograms");
322  std::vector<TFileDirectory> dataHistCat;
323 
324  //make the ErrorFlags directory
325  TFileDirectory errorHistFlags = fs->mkdir("ErrorHistograms_Flags");
326 
327  //make the ErrorDebug directory
328  TFileDirectory errorHistDetails = fs->mkdir("ErrorHistograms_Details");
329 
330  for(unsigned int i=0;i<quantities.size();i++) {
331  //fill the data and emulator folders with the directories
332  emuHistCat.push_back(emuHist.mkdir(quantities.at(i)));
333  dataHistCat.push_back(dataHist.mkdir(quantities.at(i)));
334  }
335 
336  //add a folder for RCT Regions - which only exist in data
337  dataHistCat.push_back(dataHist.mkdir("RCTRegions"));
338  //and add a folder for the Intermediate Jets - which only exist in emulator
339  emuHistCat.push_back(emuHist.mkdir("IntJets"));
340 
341  //Fill the ErrorDebug folder with the directories
342  errorHistCat.push_back(errorHistDetails.mkdir("EM"));
343  errorHistCat.push_back(errorHistDetails.mkdir("Jets"));
344  errorHistCat.push_back(errorHistDetails.mkdir("HF"));
345  errorHistCat.push_back(errorHistDetails.mkdir("TotalE"));
346  errorHistCat.push_back(errorHistDetails.mkdir("MissingE"));
347 
348  //BOOK HISTOGRAMS
349  RCT_EtEtaPhi_ = dataHistCat.at(9).make<TH2I>("RCT_EtEtaPhi", "RCT_EtEtaPhi;#eta (GCT Units);#phi (GCT Units)", 22, -0.5, 21.5, 18, -0.5, 17.5);
350  RCT_TvEtaPhi_ = dataHistCat.at(9).make<TH2I>("RCT_TvEtaPhi", "RCT_TvEtaPhi;#eta (GCT Units);#phi (GCT Units)", 22, -0.5, 21.5, 18, -0.5, 17.5);
351  RCT_FgEtaPhi_ = dataHistCat.at(9).make<TH2I>("RCT_FgEtaPhi", "RCT_FgEtaPhi;#eta (GCT Units);#phi (GCT Units)", 22, -0.5, 21.5, 18, -0.5, 17.5);
352  RCT_OfEtaPhi_ = dataHistCat.at(9).make<TH2I>("RCT_OfEtEtaPhi", "RCT_OfEtaPhi;#eta (GCT Units);#phi (GCT Units)", 22, -0.5, 21.5, 18, -0.5, 17.5);
353  //isoEg
354  isoEgD_Rank_ = dataHistCat.at(0).make<TH1I>("isoEgD_Rank", "isoEgD_Rank;Rank;Number of Events", 64, -0.5, 63.5);
355  isoEgE_Rank_ = emuHistCat.at(0).make<TH1I>("isoEgE_Rank", "isoEgE_Rank;Rank;Number of Events", 64, -0.5, 63.5);
356  isoEgD_EtEtaPhi_ = dataHistCat.at(0).make<TH2I>("isoEgD_EtEtaPhi", "isoEgD_EtEtaPhi;#eta (GCT Units);#phi(GCT Units)", 22, -0.5, 21.5, 18, -0.5, 17.5);
357  isoEgE_EtEtaPhi_ = emuHistCat.at(0).make<TH2I>("isoEgE_EtEtaPhi", "isoEgE_EtEtaPhi;#eta (GCT Units);#phi (GCT Units)", 22, -0.5, 21.5, 18, -0.5, 17.5);
358  isoEgD_OccEtaPhi_ = dataHistCat.at(0).make<TH2I>("isoEgD_OccEtaPhi", "isoEgD_OccEtaPhi;#eta (GCT Units);#phi (GCT Units)", 22, -0.5, 21.5, 18, -0.5, 17.5);
359  isoEgE_OccEtaPhi_ = emuHistCat.at(0).make<TH2I>("isoEgE_OccEtaPhi", "isoEgE_OccEtaPhi;#eta (GCT Units);#phi (GCT Units)", 22, -0.5, 21.5, 18, -0.5, 17.5);
360  isoEg_errorFlag_ = errorHistFlags.make<TH1I>("isoEg_errorFlag", "isoEg_errorFlag;Status;Number of Candidates", 3, -0.5, 2.5);
361  //Global isoEg Error
362  isoEgD_GlobalError_Rank_ = errorHistCat.at(0).make<TH1I>("isoEgD_GlobalError_Rank", "isoEgD_GlobalError_Rank;Rank;Number of Events", 64, -0.5, 63.5);
363  isoEgE_GlobalError_Rank_ = errorHistCat.at(0).make<TH1I>("isoEgE_GlobalError_Rank", "isoEgE_GlobalError_Rank;Rank;Number of Events", 64, -0.5, 63.5);
364  isoEgD_GlobalError_EtEtaPhi_ = errorHistCat.at(0).make<TH2I>("isoEgD_GlobalError_EtEtaPhi", "isoEgD_GlobalError_EtEtaPhi", 22, -0.5, 21.5, 18, -0.5, 17.5);
365  isoEgE_GlobalError_EtEtaPhi_ = errorHistCat.at(0).make<TH2I>("isoEgE_GlobalError_EtEtaPhi", "isoEgE_GlobalError_EtEtaPhi", 22, -0.5, 21.5, 18, -0.5, 17.5);
366  //nonIsoEg
367  nonIsoEgD_Rank_ = dataHistCat.at(1).make<TH1I>("nonIsoEgD_Rank", "nonIsoEgD_Rank;Rank;Number of Events", 64, -0.5, 63.5);
368  nonIsoEgE_Rank_ = emuHistCat.at(1).make<TH1I>("nonIsoEgE_Rank", "nonIsoEgE_Rank;Rank;Number of Events", 64, -0.5, 63.5);
369  nonIsoEgD_EtEtaPhi_ = dataHistCat.at(1).make<TH2I>("nonIsoEgD_EtEtaPhi", "nonIsoEgD_EtEtaPhi;#eta (GCT Units);#phi(GCT Units)", 22, -0.5, 21.5, 18, -0.5, 17.5);
370  nonIsoEgE_EtEtaPhi_ = emuHistCat.at(1).make<TH2I>("nonIsoEgE_EtEtaPhi", "nonIsoEgE_EtEtaPhi;#eta (GCT Units);#phi (GCT Units)", 22, -0.5, 21.5, 18, -0.5, 17.5);
371  nonIsoEgD_OccEtaPhi_ = dataHistCat.at(1).make<TH2I>("nonIsoEgD_OccEtaPhi", "nonIsoEgD_OccEtaPhi;#eta (GCT Units);#phi (GCT Units)", 22, -0.5, 21.5, 18, -0.5, 17.5);
372  nonIsoEgE_OccEtaPhi_ = emuHistCat.at(1).make<TH2I>("nonIsoEgE_OccEtaPhi", "nonIsoEgE_OccEtaPhi;#eta (GCT Units);#phi (GCT Units)", 22, -0.5, 21.5, 18, -0.5, 17.5);
373  nonIsoEg_errorFlag_ = errorHistFlags.make<TH1I>("nonIsoEg_errorFlag", "nonIsoEg_errorFlag;Status;Number of Candidates", 3, -0.5, 2.5);
374  //Global nonIsoEg Error
375  nonIsoEgD_GlobalError_Rank_ = errorHistCat.at(0).make<TH1I>("nonIsoEgD_GlobalError_Rank", "nonIsoEgD_GlobalError_Rank;Rank;Number of Events", 64, -0.5, 63.5);
376  nonIsoEgE_GlobalError_Rank_ = errorHistCat.at(0).make<TH1I>("nonIsoEgE_GlobalError_Rank", "nonIsoEgE_GlobalError_Rank;Rank;Number of Events", 64, -0.5, 63.5);
377  nonIsoEgD_GlobalError_EtEtaPhi_ = errorHistCat.at(0).make<TH2I>("nonIsoEgD_GlobalError_EtEtaPhi", "nonIsoEgD_GlobalError_EtEtaPhi", 22, -0.5, 21.5, 18, -0.5, 17.5);
378  nonIsoEgE_GlobalError_EtEtaPhi_ = errorHistCat.at(0).make<TH2I>("nonIsoEgE_GlobalError_EtEtaPhi", "nonIsoEgE_GlobalError_EtEtaPhi", 22, -0.5, 21.5, 18, -0.5, 17.5);
379  //CenJets
380  cenJetD_Rank_ = dataHistCat.at(2).make<TH1I>("cenJetD_Rank", "cenJetD_Rank;Rank;Number of Events", 64, -0.5, 63.5);
381  cenJetE_Rank_ = emuHistCat.at(2).make<TH1I>("cenJetE_Rank", "cenJetE_Rank;Rank;Number of Events", 64, -0.5, 63.5);
382  cenJetD_EtEtaPhi_ = dataHistCat.at(2).make<TH2I>("cenJetD_EtEtaPhi", "cenJetD_EtEtaPhi;#eta (GCT Units);#phi (GCT Units)", 22, -0.5, 21.5, 18, -0.5, 17.5);
383  cenJetE_EtEtaPhi_ = emuHistCat.at(2).make<TH2I>("cenJetE_EtEtaPhi", "cenJetE_EtEtaPhi;#eta (GCT Units);#phi (GCT Units)", 22, -0.5, 21.5, 18, -0.5, 17.5);
384  cenJetD_OccEtaPhi_ = dataHistCat.at(2).make<TH2I>("cenJetD_OccEtaPhi", "cenJetD_OccEtaPhi;#eta (GCT Units);#phi (GCT Units)", 22, -0.5, 21.5, 18, -0.5, 17.5);
385  cenJetE_OccEtaPhi_ = emuHistCat.at(2).make<TH2I>("cenJetE_OccEtaPhi", "cenJetE_OccEtaPhi;#eta (GCT Units);#phi (GCT Units)", 22, -0.5, 21.5, 18, -0.5, 17.5);
386  cenJet_errorFlag_ = errorHistFlags.make<TH1I>("cenJet_errorFlag", "cenJet_errorFlag;Status;Number of Candidates", 3, -0.5, 2.5);
387  //Global CenJet Error
388  cenJetD_GlobalError_Rank_ = errorHistCat.at(1).make<TH1I>("cenJetD_GlobalError_Rank", "cenJetD_GlobalError_Rank", 64, -0.5, 63.5);
389  cenJetE_GlobalError_Rank_ = errorHistCat.at(1).make<TH1I>("cenJetE_GlobalError_Rank", "cenJetE_GlobalError_Rank", 64, -0.5, 63.5);
390  cenJetD_GlobalError_EtEtaPhi_ = errorHistCat.at(1).make<TH2I>("cenJetD_GlobalError_EtEtaPhi", "cenJetD_GlobalError_EtEtaPhi", 22, -0.5, 21.5, 18, -0.5, 17.5);
391  cenJetE_GlobalError_EtEtaPhi_ = errorHistCat.at(1).make<TH2I>("cenJetE_GlobalError_EtEtaPhi", "cenJetE_GlobalError_EtEtaPhi", 22, -0.5, 21.5, 18, -0.5, 17.5);
392  //TauJets
393  tauJetD_Rank_ = dataHistCat.at(3).make<TH1I>("tauJetD_Rank", "tauJetD_Rank;Rank;Number of Events", 64, -0.5, 63.5);
394  tauJetE_Rank_ = emuHistCat.at(3).make<TH1I>("tauJetE_Rank", "tauJetE_Rank;Rank;Number of Events", 64, -0.5, 63.5);
395  tauJetD_EtEtaPhi_ = dataHistCat.at(3).make<TH2I>("tauJetD_EtEtaPhi", "tauJetD_EtEtaPhi;#eta (GCT Units);#phi (GCT Units)", 22, -0.5, 21.5, 18, -0.5, 17.5);
396  tauJetE_EtEtaPhi_ = emuHistCat.at(3).make<TH2I>("tauJetE_EtEtaPhi", "tauJetE_EtEtaPhi;#eta (GCT Units);#phi (GCT Units)", 22, -0.5, 21.5, 18, -0.5, 17.5);
397  tauJetD_OccEtaPhi_ = dataHistCat.at(3).make<TH2I>("tauJetD_OccEtaPhi", "tauJetD_OccEtaPhi;#eta (GCT Units);#phi (GCT Units)", 22, -0.5, 21.5, 18, -0.5, 17.5);
398  tauJetE_OccEtaPhi_ = emuHistCat.at(3).make<TH2I>("tauJetE_OccEtaPhi", "tauJetE_OccEtaPhi;#eta (GCT Units);#phi (GCT Units)", 22, -0.5, 21.5, 18, -0.5, 17.5);
399  tauJet_errorFlag_ = errorHistFlags.make<TH1I>("tauJet_errorFlag", "tauJet_errorFlag;Status;Number of Candidates", 3, -0.5, 2.5);
400  //Global TauJet Error
401  tauJetD_GlobalError_Rank_ = errorHistCat.at(1).make<TH1I>("tauJetD_GlobalError_Rank", "tauJetD_GlobalError_Rank", 64, -0.5, 63.5);
402  tauJetE_GlobalError_Rank_ = errorHistCat.at(1).make<TH1I>("tauJetE_GlobalError_Rank", "tauJetE_GlobalError_Rank", 64, -0.5, 63.5);
403  tauJetD_GlobalError_EtEtaPhi_ = errorHistCat.at(1).make<TH2I>("tauJetD_GlobalError_EtEtaPhi", "tauJetD_GlobalError_EtEtaPhi", 22, -0.5, 21.5, 18, -0.5, 17.5);
404  tauJetE_GlobalError_EtEtaPhi_ = errorHistCat.at(1).make<TH2I>("tauJetE_GlobalError_EtEtaPhi", "tauJetE_GlobalError_EtEtaPhi", 22, -0.5, 21.5, 18, -0.5, 17.5);
405  //ForJets
406  forJetD_Rank_ = dataHistCat.at(4).make<TH1I>("forJetD_Rank", "forJetD_Rank;Rank;Number of Events", 64, -0.5, 63.5);
407  forJetE_Rank_ = emuHistCat.at(4).make<TH1I>("forJetE_Rank", "forJetE_Rank;Rank;Number of Events", 64, -0.5, 63.5);
408  forJetD_EtEtaPhi_ = dataHistCat.at(4).make<TH2I>("forJetD_EtEtaPhi", "forJetD_EtEtaPhi;#eta (GCT Units);#phi (GCT Units)", 22, -0.5, 21.5, 18, -0.5, 17.5);
409  forJetE_EtEtaPhi_ = emuHistCat.at(4).make<TH2I>("forJetE_EtEtaPhi", "forJetE_EtEtaPhi;#eta (GCT Units);#phi (GCT Units)", 22, -0.5, 21.5, 18, -0.5, 17.5);
410  forJetD_OccEtaPhi_ = dataHistCat.at(4).make<TH2I>("forJetD_OccEtaPhi", "forJetD_OccEtaPhi;#eta (GCT Units);#phi (GCT Units)", 22, -0.5, 21.5, 18, -0.5, 17.5);
411  forJetE_OccEtaPhi_ = emuHistCat.at(4).make<TH2I>("forJetE_OccEtaPhi", "forJetE_OccEtaPhi;#eta (GCT Units);#phi (GCT Units)", 22, -0.5, 21.5, 18, -0.5, 17.5);
412  forJet_errorFlag_ = errorHistFlags.make<TH1I>("forJet_errorFlag", "forJet_errorFlag;Status;Number of Candidates", 3, -0.5, 2.5);
413  //Global ForJet Error
414  forJetD_GlobalError_Rank_ = errorHistCat.at(1).make<TH1I>("forJetD_GlobalError_Rank", "forJetD_GlobalError_Rank", 64, -0.5, 63.5);
415  forJetE_GlobalError_Rank_ = errorHistCat.at(1).make<TH1I>("forJetE_GlobalError_Rank", "forJetE_GlobalError_Rank", 64, -0.5, 63.5);
416  forJetD_GlobalError_EtEtaPhi_ = errorHistCat.at(1).make<TH2I>("forJetD_GlobalError_EtEtaPhi", "forJetD_GlobalError_EtEtaPhi", 22, -0.5, 21.5, 18, -0.5, 17.5);
417  forJetE_GlobalError_EtEtaPhi_ = errorHistCat.at(1).make<TH2I>("forJetE_GlobalError_EtEtaPhi", "forJetE_GlobalError_EtEtaPhi", 22, -0.5, 21.5, 18, -0.5, 17.5);
418  //IntJets
419  intJetEtEtaPhiE_ = emuHistCat.at(9).make<TH2I>("intJetEtEtaPhiE_", "intJetEtEtaPhiE_;#eta (GCT Units);#phi (GCT Units)", 22, -0.5, 21.5, 18, -0.5, 17.5);
420  intJetE_Et_ = emuHistCat.at(9).make<TH1I>("intJetE_Et", "intJetE_Et;E_{T};Number of Events", 1024, -0.5, 1023.5);
421  intJetE_Of_ = emuHistCat.at(9).make<TH1I>("intJetE_Of", "intJetE_Of;Overflow Bit Status;Number of Events", 2, -0.5, 1.5);
422  intJetE_Jet1Et_ = emuHistCat.at(9).make<TH1I>("intJetE_Jet1Et", "intJetE_Jet1Et;E_{T};Number of Events", 1024, -0.5, 1023.5);
423  intJetE_Jet2Et_ = emuHistCat.at(9).make<TH1I>("intJetE_Jet2Et", "intJetE_Jet2Et;E_{T};Number of Events", 1024, -0.5, 1023.5);
424  intJetE_Jet3Et_ = emuHistCat.at(9).make<TH1I>("intJetE_Jet3Et", "intJetE_Jet3Et;E_{T};Number of Events", 1024, -0.5, 1023.5);
425  intJetE_Jet4Et_ = emuHistCat.at(9).make<TH1I>("intJetE_Jet4Et", "intJetE_Jet4Et;E_{T};Number of Events", 1024, -0.5, 1023.5);
426  //HFRing Sums
427  hfRingSumD_1pos_ = dataHistCat.at(5).make<TH1I>("hfRingSumD_1+", "hfRingSumD_1+;Rank;Number of Events", 8, -0.5, 7.5);
428  hfRingSumD_1neg_ = dataHistCat.at(5).make<TH1I>("hfRingSumD_1-", "hfRingSumD_1-;Rank;Number of Events", 8, -0.5, 7.5);
429  hfRingSumD_2pos_ = dataHistCat.at(5).make<TH1I>("hfRingSumD_2+", "hfRingSumD_2+;Rank;Number of Events", 8, -0.5, 7.5);
430  hfRingSumD_2neg_ = dataHistCat.at(5).make<TH1I>("hfRingSumD_2-", "hfRingSumD_2-;Rank;Number of Events", 8, -0.5, 7.5);
431  hfRingSumE_1pos_ = emuHistCat.at(5).make<TH1I>("hfRingSumE_1+", "hfRingSumE_1+;Rank;Number of Events", 8, -0.5, 7.5);
432  hfRingSumE_1neg_ = emuHistCat.at(5).make<TH1I>("hfRingSumE_1-", "hfRingSumE_1-;Rank;Number of Events", 8, -0.5, 7.5);
433  hfRingSumE_2pos_ = emuHistCat.at(5).make<TH1I>("hfRingSumE_2+", "hfRingSumE_2+;Rank;Number of Events", 8, -0.5, 7.5);
434  hfRingSumE_2neg_ = emuHistCat.at(5).make<TH1I>("hfRingSumE_2-", "hfRingSumE_2-;Rank;Number of Events", 8, -0.5, 7.5);
435  hfRingSum_errorFlag_ = errorHistFlags.make<TH1I>("hfRingSum_errorFlag","hfRingSum_errorFlag;Status;Number of Candidates",2,-0.5,1.5);
436  //HFRing BitCounts
437  hfBitCountD_1pos_ = dataHistCat.at(6).make<TH1I>("hfBitCountD_1+", "hfBitCountD_1+;Rank;Number of Events", 8, -0.5, 7.5);
438  hfBitCountD_1neg_ = dataHistCat.at(6).make<TH1I>("hfBitCountD_1-", "hfBitCountD_1-;Rank;Number of Events", 8, -0.5, 7.5);
439  hfBitCountD_2pos_ = dataHistCat.at(6).make<TH1I>("hfBitCountD_2+", "hfBitCountD_2+;Rank;Number of Events", 8, -0.5, 7.5);
440  hfBitCountD_2neg_ = dataHistCat.at(6).make<TH1I>("hfBitCountD_2-", "hfBitCountD_2-;Rank;Number of Events", 8, -0.5, 7.5);
441  hfBitCountE_1pos_ = emuHistCat.at(6).make<TH1I>("hfBitCountE_1+", "hfBitCountE_1+;Rank;Number of Events", 8, -0.5, 7.5);
442  hfBitCountE_1neg_ = emuHistCat.at(6).make<TH1I>("hfBitCountE_1-", "hfBitCountE_1-;Rank;Number of Events", 8, -0.5, 7.5);
443  hfBitCountE_2pos_ = emuHistCat.at(6).make<TH1I>("hfBitCountE_2+", "hfBitCountE_2+;Rank;Number of Events", 8, -0.5, 7.5);
444  hfBitCountE_2neg_ = emuHistCat.at(6).make<TH1I>("hfBitCountE_2-", "hfBitCountE_2-;Rank;Number of Events", 8, -0.5, 7.5);
445  hfBitCount_errorFlag_ = errorHistFlags.make<TH1I>("hfBitCount_errorFlag","hfBitCount_errorFlag;Status;Number of Candidates",2,-0.5,1.5);
446  //Total ET
447  totalEtD_ = dataHistCat.at(7).make<TH1I>("totalEtD", "totalEtD;E_{T};Number of Events", 2048, -0.5, 2047.5);
448  totalEtD_Of_ = dataHistCat.at(7).make<TH1I>("totalEtD_Of", "totalEtD_Of;Overflow Bit Status;Number of Events", 2, -0.5, 1.5);
449  totalEtE_ = emuHistCat.at(7).make<TH1I>("totalEtE", "totalEtE;E_{T};Number of Events", 2048, -0.5, 2047.5);
450  totalEtE_Of_ = emuHistCat.at(7).make<TH1I>("totalEtE_Of", "totalEtE_Of;Overflow Bit Status;Number of Events", 2, -0.5, 1.5);
451  totalEt_errorFlag_ = errorHistFlags.make<TH1I>("totalEt_errorFlag","totalEt_errorFlag;Status;Number of Candidates",2,-0.5,1.5);
452  //Book the Global ET Error histograms in the errorHistCat
453  //totalEtD_GlobalError_ = errorHistCat.at(3).make<TH1I>("totalEtD_GlobalError", "totalEtD_GlobalError;E_{T};Number of Events", 1024, -0.5, 1023.5);
454  //totalEtE_GlobalError_ = errorHistCat.at(3).make<TH1I>("totalEtE_GlobalError", "totalEtE_GlobalError;E_{T};Number of Events", 1024, -0.5, 1023.5);
455  //totalEtD_GlobalError_Of_ = errorHistCat.at(3).make<TH1I>("totalEtD_GlobalError_Of", "totalEtD_GlobalError_Of;Overflow Bit Status;Number of Events", 2, -0.5, 1.5);
456  //totalEtE_GlobalError_Of_ = errorHistCat.at(3).make<TH1I>("totalEtE_GlobalError_Of", "totalEtE_GlobalError_Of;Overflow Bit Status;Number of Events", 2, -0.5, 1.5);
457  //Total HT
458  totalHtD_ = dataHistCat.at(7).make<TH1I>("totalHtD", "totalHtD;H_{T};Number of Events", 2048, -0.5, 2047.5);
459  totalHtD_Of_ = dataHistCat.at(7).make<TH1I>("totalHtD_Of", "totalHtD_Of;Overflow Bit Status;Number of Events", 2, -0.5, 1.5);
460  totalHtE_ = emuHistCat.at(7).make<TH1I>("totalHtE", "totalHtE;H_{T};Number of Events", 2048, -0.5, 2047.5);
461  totalHtE_Of_ = emuHistCat.at(7).make<TH1I>("totalHtE_Of", "totalHtE_Of;Overflow Bit Status;Number of Events", 2, -0.5, 1.5);
462  totalHt_errorFlag_ = errorHistFlags.make<TH1I>("totalHt_errorFlag","totalHt_errorFlag;Status;Number of Candidates",2,-0.5,1.5);
463  //Book the Global HT Error histograms in the errorHistCat
464  //totalHtD_GlobalError_ = errorHistCat.at(3).make<TH1I>("totalHtD_GlobalError", "totalHtD_GlobalError;E_{T};Number of Events", 1024, -0.5, 1023.5);
465  //totalHtE_GlobalError_ = errorHistCat.at(3).make<TH1I>("totalHtE_GlobalError", "totalHtE_GlobalError;E_{T};Number of Events", 1024, -0.5, 1023.5);
466  //totalHtD_GlobalError_Of_ = errorHistCat.at(3).make<TH1I>("totalHtD_GlobalError_Of", "totalHtD_GlobalError_Of;Overflow Bit Status;Number of Events", 2, -0.5, 1.5);
467  //totalHtE_GlobalError_Of_ = errorHistCat.at(3).make<TH1I>("totalHtE_GlobalError_Of", "totalHtE_GlobalError_Of;Overflow Bit Status;Number of Events", 2, -0.5, 1.5);
468  //MissingEt
469  missingEtD_ = dataHistCat.at(8).make<TH1I>("missingEtD", "missingEtD;Missing E_{T};Number of Events", 1024, -0.5, 1023.5);
470  missingEtD_Of_ = dataHistCat.at(8).make<TH1I>("missingEtD_Of", "missingEtD_Of;Overflow Bit Status;Number of Events", 2, -0.5, 1.5);
471  missingEtD_Phi_ = dataHistCat.at(8).make<TH1I>("missingEtD_Phi", "missingEtD_Phi;Missing E_{T} #phi;Number of Events", 72, -0.5, 71.5);
472  missingEtE_ = emuHistCat.at(8).make<TH1I>("missingEtE", "missingEtE;Missing E_{T};Number of Events", 1024, -0.5, 1023.5);
473  missingEtE_Of_ = emuHistCat.at(8).make<TH1I>("missingEtE_Of", "missingEtE_Of;Overflow Bit Status;Number of Events", 2, -0.5, 1.5);
474  missingEtE_Phi_ = emuHistCat.at(8).make<TH1I>("missingEtE_Phi", "missingEtE_Phi;Missing E_{T} #phi;Number of Events", 72, -0.5, 71.5);
475  missingEt_errorFlag_ = errorHistFlags.make<TH1I>("missingEt_errorFlag","missingEt_errorFlag;Status;Number of Candidates",4,-0.5,3.5);
476  //MissingHt
477  missingHtD_ = dataHistCat.at(8).make<TH1I>("missingHtD", "missingHtD;Missing H_{T};Number of Events", 1024, -0.5, 1023.5);
478  missingHtD_Of_ = dataHistCat.at(8).make<TH1I>("missingHtD_Of", "missingHtD_Of;Overflow Bit Status;Number of Events", 2, -0.5, 1.5);
479  missingHtD_Phi_ = dataHistCat.at(8).make<TH1I>("missingHtD_Phi", "missingHtD_Phi;Missing H_{T} #phi;Number of Events", 72, -0.5, 71.5);
480  missingHtE_ = emuHistCat.at(8).make<TH1I>("missingHtE", "missingHtE;Missing H_{T};Number of Events", 1024, -0.5, 1023.5);
481  missingHtE_Of_ = emuHistCat.at(8).make<TH1I>("missingHtE_Of", "missingHtE_Of;Overflow Bit Status;Number of Events", 2, -0.5, 1.5);
482  missingHtE_Phi_ = emuHistCat.at(8).make<TH1I>("missingHtE_Phi", "missingHtE_Phi;Missing H_{T} #phi;Number of Events", 72, -0.5, 71.5);
483  missingHt_errorFlag_ = errorHistFlags.make<TH1I>("missingHt_errorFlag","missingHt_errorFlag;Status;Number of Candidates",4,-0.5,3.5);
484  //Additional MissingHt Debug histograms
485  missingHtD_HtXPosLeaf1 = dataHistCat.at(8).make<TH1I>("missingHtD_HtXPosLeaf1", "missingHtD;Missing H_{T} X PosLeaf1;Number of Events", 4096, -2048.5, 2047.5);
486  missingHtD_HtXPosLeaf2 = dataHistCat.at(8).make<TH1I>("missingHtD_HtXPosLeaf2", "missingHtD;Missing H_{T} X PosLeaf2;Number of Events", 4096, -2048.5, 2047.5);
487  missingHtD_HtXPosLeaf3 = dataHistCat.at(8).make<TH1I>("missingHtD_HtXPosLeaf3", "missingHtD;Missing H_{T} X PosLeaf3;Number of Events", 4096, -2048.5, 2047.5);
488  missingHtD_HtXNegLeaf1 = dataHistCat.at(8).make<TH1I>("missingHtD_HtXNegLeaf1", "missingHtD;Missing H_{T} X NegLeaf1;Number of Events", 4096, -2048.5, 2047.5);
489  missingHtD_HtXNegLeaf2 = dataHistCat.at(8).make<TH1I>("missingHtD_HtXNegLeaf2", "missingHtD;Missing H_{T} X NegLeaf2;Number of Events", 4096, -2048.5, 2047.5);
490  missingHtD_HtXNegLeaf3 = dataHistCat.at(8).make<TH1I>("missingHtD_HtXNegLeaf3", "missingHtD;Missing H_{T} X NegLeaf3;Number of Events", 4096, -2048.5, 2047.5);
491 
492  missingHtD_HtYPosLeaf1 = dataHistCat.at(8).make<TH1I>("missingHtD_HtYPosLeaf1", "missingHtD;Missing H_{T} Y PosLeaf1;Number of Events", 4096, -2048.5, 2047.5);
493  missingHtD_HtYPosLeaf2 = dataHistCat.at(8).make<TH1I>("missingHtD_HtYPosLeaf2", "missingHtD;Missing H_{T} Y PosLeaf2;Number of Events", 4096, -2048.5, 2047.5);
494  missingHtD_HtYPosLeaf3 = dataHistCat.at(8).make<TH1I>("missingHtD_HtYPosLeaf3", "missingHtD;Missing H_{T} Y PosLeaf3;Number of Events", 4096, -2048.5, 2047.5);
495  missingHtD_HtYNegLeaf1 = dataHistCat.at(8).make<TH1I>("missingHtD_HtYNegLeaf1", "missingHtD;Missing H_{T} Y NegLeaf1;Number of Events", 4096, -2048.5, 2047.5);
496  missingHtD_HtYNegLeaf2 = dataHistCat.at(8).make<TH1I>("missingHtD_HtYNegLeaf2", "missingHtD;Missing H_{T} Y NegLeaf2;Number of Events", 4096, -2048.5, 2047.5);
497  missingHtD_HtYNegLeaf3 = dataHistCat.at(8).make<TH1I>("missingHtD_HtYNegLeaf3", "missingHtD;Missing H_{T} Y NegLeaf3;Number of Events", 4096, -2048.5, 2047.5);
498 
499  //Annotate the labels of the error flags
500  //For the electrons and jets
501  std::vector<std::string> errorFlagLabels;
502  errorFlagLabels.push_back("Matched");
503  errorFlagLabels.push_back("Unmatched Data Cand");
504  errorFlagLabels.push_back("Unmatched Emul Cand");
505 
506  for(unsigned int i=0;i<errorFlagLabels.size();i++) {
507  isoEg_errorFlag_->GetXaxis()->SetBinLabel(i+1,errorFlagLabels.at(i).c_str());
508  nonIsoEg_errorFlag_->GetXaxis()->SetBinLabel(i+1,errorFlagLabels.at(i).c_str());
509  cenJet_errorFlag_->GetXaxis()->SetBinLabel(i+1,errorFlagLabels.at(i).c_str());
510  tauJet_errorFlag_->GetXaxis()->SetBinLabel(i+1,errorFlagLabels.at(i).c_str());
511  forJet_errorFlag_->GetXaxis()->SetBinLabel(i+1,errorFlagLabels.at(i).c_str());
512  }
513  errorFlagLabels.clear();
514 
515  //For the Total Energy Sums and HF
516  errorFlagLabels.push_back("Matched");
517  errorFlagLabels.push_back("Unmatched");
518 
519  for(unsigned int i=0;i<errorFlagLabels.size();i++) {
520  hfRingSum_errorFlag_->GetXaxis()->SetBinLabel(i+1,errorFlagLabels.at(i).c_str());
521  hfBitCount_errorFlag_->GetXaxis()->SetBinLabel(i+1,errorFlagLabels.at(i).c_str());
522  totalEt_errorFlag_->GetXaxis()->SetBinLabel(i+1,errorFlagLabels.at(i).c_str());
523  totalHt_errorFlag_->GetXaxis()->SetBinLabel(i+1,errorFlagLabels.at(i).c_str());
524  }
525  errorFlagLabels.clear();
526 
527  //For the Missing Energy Sums
528  errorFlagLabels.push_back("Matched");
529  errorFlagLabels.push_back("Matched Mag");
530  errorFlagLabels.push_back("Matched Phi");
531  errorFlagLabels.push_back("Unmatched");
532 
533  for(unsigned int i=0;i<errorFlagLabels.size();i++) {
534  missingEt_errorFlag_->GetXaxis()->SetBinLabel(i+1,errorFlagLabels.at(i).c_str());
535  missingHt_errorFlag_->GetXaxis()->SetBinLabel(i+1,errorFlagLabels.at(i).c_str());
536  }
537 
538  //initialise - set all flags to false as they will be set on an event-by-event basis
539  isIsoError=0;
540  isNonIsoError=0;
541  isCenJetError=0;
542  isTauJetError=0;
543  isForJetError=0;
544  isRingSumError=0;
545  isBitCountError=0;
546  isTotalEError=0;
547  isTotalHError=0;
548  isMissingEError=0;
549  isMissingHError=0;
550 
551  //fill the struct of MBXinformation. It is easier to pass this information to the respective functions as used below this way
555 
556  //set the parameters according to the system chosen
557  if(useSys_ == "P5") {
559  }
560  else if(useSys_ == "Lab") {
562  }
563  else {
564  edm::LogWarning("ChosenSystem") << " " << "The system you chose to use (" << useSys_ << ") was not recognised. Defaulting to the full system geometry";
566  }
567 
568 }
569 
570 
572 {
573 
574  // do anything here that needs to be done at desctruction time
575  // (e.g. close files, deallocate resources etc.)
576 
577 }
578 
579 
580 //
581 // member functions
582 //
583 
584 // ------------ method called to for each event ------------
585 void
587 {
588  using namespace edm;
589  using namespace std;
590 
591  Handle<L1CaloRegionCollection> caloRegions;
592  Handle<L1CaloEmCollection> emRegions;
593 
598 
605 
607 
610 
613 
616 
619 
622 
625 
627 
628  //we need this for all user cases...
629  iEvent.getByLabel(dataTag_.label(), caloRegions);
630 
631  //in order to allow the debug folders to have a unique name (so that when jobs are split in crab, we can merge)
632  //use the eventnum in the folder name
633  eventNumber = iEvent.id().event();
634 
635  if(doRCT_) {
636  if(checkCollections(caloRegions, *RCT_REGION_QUANTA, "RCT CaloRegions")) plotRCTRegions(caloRegions);
637  }
638 
639  if(doEg_) {
640  iEvent.getByLabel(dataTag_.label(),"nonIsoEm", nonIsoEgD);
641  iEvent.getByLabel(emuTag_.label(), "nonIsoEm", nonIsoEgE);
642 
643  iEvent.getByLabel(dataTag_.label(), "isoEm", isoEgD);
644  iEvent.getByLabel(emuTag_.label(), "isoEm", isoEgE);
645 
646  isIsoError=0;
647  isNonIsoError=0;
648 
649  if(checkCollections(isoEgD, GCT_OBJECT_QUANTA, "Iso e/g Data") && checkCollections(isoEgE, GCT_OBJECT_QUANTA, "Iso e/g Emulator")) {
650  plotIsoEm(isoEgD, isoEgE);
651  compareEG isoCompare(isoEgD, isoEgE, MBxInfo);
653  }
654 
655  if(checkCollections(nonIsoEgD, GCT_OBJECT_QUANTA, "NonIso e/g Data") && checkCollections(nonIsoEgE, GCT_OBJECT_QUANTA, "NonIso e/g Emulator")) {
656  plotNonIsoEm(nonIsoEgD, nonIsoEgE);
657  compareEG nonIsoCompare(nonIsoEgD, nonIsoEgE, MBxInfo);
659  }
660 
662  iEvent.getByLabel(dataTag_.label(), emRegions);
663  if(checkCollections(emRegions, RCT_EM_OBJECT_QUANTA, "RCT EMRegions")) plotEGErrors(isoEgD, isoEgE, nonIsoEgD, nonIsoEgE, emRegions);
664  }
665  }
666 
667  if(doJets_) {
668  iEvent.getByLabel(emuTag_.label(), "cenJets", cenJetsE);
669  iEvent.getByLabel(dataTag_.label(), "cenJets", cenJetsD);
670 
671  iEvent.getByLabel(emuTag_.label(), "forJets", forJetsE);
672  iEvent.getByLabel(dataTag_.label(), "forJets", forJetsD);
673 
674  iEvent.getByLabel(emuTag_.label(), "tauJets", tauJetsE);
675  iEvent.getByLabel(dataTag_.label(), "tauJets", tauJetsD);
676 
677  iEvent.getByLabel(emuTag_.label(), intJetsE);
678 
679  isCenJetError=0;
680  isTauJetError=0;
681  isForJetError=0;
682 
683  //Central Jets
684  if(checkCollections(cenJetsD, GCT_OBJECT_QUANTA, "Central Jets Data") && checkCollections(cenJetsE, GCT_OBJECT_QUANTA, "Central Jets Emulator")) {
685  plotCenJets(cenJetsD, cenJetsE);
686  compareJets cenJetsCompare(cenJetsD, cenJetsE, MBxInfo);
688  }
689 
690  //Tau Jets
691  if(checkCollections(tauJetsD, GCT_OBJECT_QUANTA, "Tau Jets Data") && checkCollections(tauJetsE, GCT_OBJECT_QUANTA, "Tau Jets Emulator")) {
692  plotTauJets(tauJetsD, tauJetsE);
693  compareJets tauJetsCompare(tauJetsD, tauJetsE, MBxInfo);
695  }
696 
697  //For Jets
698  if(checkCollections(forJetsD, GCT_OBJECT_QUANTA, "Forward Jets Data") && checkCollections(forJetsE, GCT_OBJECT_QUANTA, "Forward Jets Emulator")) {
699  plotForJets(forJetsD, forJetsE);
700  compareJets forJetsCompare(forJetsD, forJetsE, MBxInfo);
702  }
703 
704  //Emulator Intermediate Jets
705  if(checkCollections(intJetsE, NUM_INT_JETS, "Intermediate Jets Emulator")) plotIntJets(intJetsE);
706 
708  plotJetErrors(cenJetsD, cenJetsE, tauJetsD, tauJetsE, forJetsD, forJetsE, caloRegions);
709  }
710  }
711 
712  if(doHF_) {
713  iEvent.getByLabel(dataTag_.label(), hfRingSumsD);
714  iEvent.getByLabel(emuTag_.label(), hfRingSumsE);
715 
716  iEvent.getByLabel(dataTag_.label(), hfBitCountsD);
717  iEvent.getByLabel(emuTag_.label(), hfBitCountsE);
718 
719  isRingSumError=0;
720  isBitCountError=0;
721 
722  if(checkCollections(hfRingSumsD, GCT_SUMS_QUANTA, "HF Ring Sums Data") && checkCollections(hfRingSumsE, GCT_SUMS_QUANTA, "HF Ring Sums Emulator")) {
723  plotHFRingSums(hfRingSumsD, hfRingSumsE);
724  compareRingSums HFRingSums(hfRingSumsD, hfRingSumsE, MBxInfo);
726  }
727 
728  if(checkCollections(hfBitCountsD, GCT_SUMS_QUANTA, "HF Bit Counts Data") && checkCollections(hfBitCountsE, GCT_SUMS_QUANTA, "HF Bit Counts Emulator")) {
729  plotHFBitCounts(hfBitCountsD, hfBitCountsE);
730  compareBitCounts HFBitCounts(hfBitCountsD, hfBitCountsE, MBxInfo);
732  }
733 
735  plotHFErrors(hfRingSumsD, hfRingSumsE, hfBitCountsD, hfBitCountsE, caloRegions);
736  }
737  }
738 
739  if(doTotalEnergySums_) {
740  iEvent.getByLabel(dataTag_.label(), totalEtD);
741  iEvent.getByLabel(emuTag_.label(), totalEtE);
742 
743  iEvent.getByLabel(dataTag_.label(), totalHtD);
744  iEvent.getByLabel(emuTag_.label(), totalHtE);
745 
746  isTotalEError=0;
747  isTotalHError=0;
748 
749  if(checkCollections(totalEtD, GCT_SUMS_QUANTA, "Total Et Data") && checkCollections(totalEtE, GCT_SUMS_QUANTA, "Total Et Emulator")) {
750  plotTotalE(totalEtD, totalEtE);
751  compareTotalE compareET(totalEtD, totalEtE, MBxInfo);
753  }
754 
755  if(checkCollections(totalHtD, GCT_SUMS_QUANTA, "Total Ht Data") && checkCollections(totalHtE, GCT_SUMS_QUANTA, "Total Ht Emulator")) {
756  plotTotalH(totalHtD, totalHtE);
757  compareTotalH compareHT(totalHtD, totalHtE, MBxInfo);
759  }
760 
762  plotTotalEErrors(totalEtD, totalEtE, totalHtD, totalHtE, caloRegions);
763  }
764 
765  }
766 
768 
769  iEvent.getByLabel(dataTag_.label(), missingEtD);
770  iEvent.getByLabel(emuTag_.label(), missingEtE);
771 
772  iEvent.getByLabel(dataTag_.label(), missingHtD);
773  iEvent.getByLabel(emuTag_.label(), missingHtE);
774 
775  isMissingEError=0;
776  isMissingHError=0;
777 
778  if(checkCollections(missingEtD, GCT_SUMS_QUANTA, "Missing Et Data") && checkCollections(missingEtE, GCT_SUMS_QUANTA, "Missing Et Emulator")) {
779  plotMissingEt(missingEtD, missingEtE);
780  compareMissingE compareMET(missingEtD, missingEtE, MBxInfo);
782  }
783 
784  if(checkCollections(missingHtD, GCT_SUMS_QUANTA, "Missing Ht Data") && checkCollections(missingHtE, GCT_SUMS_QUANTA, "Missing Ht Emulator")) {
785  plotMissingHt(missingHtD, missingHtE);
786  compareMissingH compareMHT(missingHtD, missingHtE, MBxInfo);
788 
789  //added 19/03/2010 for intermediate information on MissingHt quantities in the data
791  iEvent.getByLabel(dataTag_.label(), "", intHtMissD);
792  if(checkCollections(intHtMissD, GCT_INT_HTMISS_QUANTA, "Internal Missing Ht Data")) {
793  for(unsigned int i=0; i<intHtMissD->size(); i++) {
794  if(doGCTMBx_ || intHtMissD->at(i).bx() == GCTTrigBx_) {
795  if(!intHtMissD->at(i).overflow()) {
796  //the capBlock 0x301 is the input pipeline at the wheel for positive eta, whereas 0x701 is for negative eta
797  if(intHtMissD->at(i).capBlock() == 0x301 && intHtMissD->at(i).capIndex() == 0 && intHtMissD->at(i).isThereHtx()) missingHtD_HtXPosLeaf1->Fill(intHtMissD->at(i).htx());
798  if(intHtMissD->at(i).capBlock() == 0x301 && intHtMissD->at(i).capIndex() == 1 && intHtMissD->at(i).isThereHtx()) missingHtD_HtXPosLeaf2->Fill(intHtMissD->at(i).htx());
799  if(intHtMissD->at(i).capBlock() == 0x301 && intHtMissD->at(i).capIndex() == 2 && intHtMissD->at(i).isThereHtx()) missingHtD_HtXPosLeaf3->Fill(intHtMissD->at(i).htx());
800  if(intHtMissD->at(i).capBlock() == 0x701 && intHtMissD->at(i).capIndex() == 0 && intHtMissD->at(i).isThereHtx()) missingHtD_HtXNegLeaf1->Fill(intHtMissD->at(i).htx());
801  if(intHtMissD->at(i).capBlock() == 0x701 && intHtMissD->at(i).capIndex() == 1 && intHtMissD->at(i).isThereHtx()) missingHtD_HtXNegLeaf2->Fill(intHtMissD->at(i).htx());
802  if(intHtMissD->at(i).capBlock() == 0x701 && intHtMissD->at(i).capIndex() == 2 && intHtMissD->at(i).isThereHtx()) missingHtD_HtXNegLeaf3->Fill(intHtMissD->at(i).htx());
803 
804  if(intHtMissD->at(i).capBlock() == 0x301 && intHtMissD->at(i).capIndex() == 0 && intHtMissD->at(i).isThereHty()) missingHtD_HtYPosLeaf1->Fill(intHtMissD->at(i).hty());
805  if(intHtMissD->at(i).capBlock() == 0x301 && intHtMissD->at(i).capIndex() == 1 && intHtMissD->at(i).isThereHty()) missingHtD_HtYPosLeaf2->Fill(intHtMissD->at(i).hty());
806  if(intHtMissD->at(i).capBlock() == 0x301 && intHtMissD->at(i).capIndex() == 2 && intHtMissD->at(i).isThereHty()) missingHtD_HtYPosLeaf3->Fill(intHtMissD->at(i).hty());
807  if(intHtMissD->at(i).capBlock() == 0x701 && intHtMissD->at(i).capIndex() == 0 && intHtMissD->at(i).isThereHty()) missingHtD_HtYNegLeaf1->Fill(intHtMissD->at(i).hty());
808  if(intHtMissD->at(i).capBlock() == 0x701 && intHtMissD->at(i).capIndex() == 1 && intHtMissD->at(i).isThereHty()) missingHtD_HtYNegLeaf2->Fill(intHtMissD->at(i).hty());
809  if(intHtMissD->at(i).capBlock() == 0x701 && intHtMissD->at(i).capIndex() == 2 && intHtMissD->at(i).isThereHty()) missingHtD_HtYNegLeaf3->Fill(intHtMissD->at(i).hty());
810  }
811  }
812  }
813  }
814  }
815  }
816 
818  plotMissingEErrors(missingEtD, missingEtE, missingHtD, missingHtE, caloRegions, intJetsE, intHtMissD);
819  }
820 
821  }
822 
823 }
824 
825 
826 // ------------ method called once each job just before starting event loop ------------
827 void
829 {
830 }
831 
832 // ------------ method called once each job just after ending the event loop ------------
833 void
835 }
836 
837 void
839  //if more than one Bx is readout per event, then caloRegions->size() will be some multiple of 396
840  for(unsigned int i=0;i < caloRegions->size();i++) {
841  //if the RCTMBx flag is set to true, write out all the info into the same histogram
842  //otherwise only the RCTTrigBx will be written out - could skip (RCT_REGION_QUANTA-1) events here to speed things up...
843  if(doRCTMBx_ || caloRegions->at(i).bx() == RCTTrigBx_) {
844  if(caloRegions->at(i).et()>0) RCT_EtEtaPhi_->Fill(caloRegions->at(i).gctEta(),caloRegions->at(i).gctPhi(),caloRegions->at(i).et());
845  if(caloRegions->at(i).tauVeto()) RCT_TvEtaPhi_->Fill(caloRegions->at(i).gctEta(),caloRegions->at(i).gctPhi());
846  if(caloRegions->at(i).fineGrain()) RCT_FgEtaPhi_->Fill(caloRegions->at(i).gctEta(),caloRegions->at(i).gctPhi());
847  if(caloRegions->at(i).overFlow()) RCT_OfEtaPhi_->Fill(caloRegions->at(i).gctEta(),caloRegions->at(i).gctPhi());
848  }
849  }
850 }
851 
852 void
854  //loop over all the data candidates - if multiple bx, then this should be a multiple of GCT_OBJECT_QUANTA
855  for (unsigned int i=0; i < isoEgD->size(); i++) {
856  //if the GCTMBx flag is set, plot all Bx for this quantity, otherwise only plot Bx = GCTTrigBx_
857  if(doGCTMBx_ || isoEgD->at(i).bx() == GCTTrigBx_) {
858  isoEgD_Rank_->Fill(isoEgD->at(i).rank());
859  if(isoEgD->at(i).rank()>0) {
860  isoEgD_EtEtaPhi_->Fill(isoEgD->at(i).regionId().ieta(), isoEgD->at(i).regionId().iphi(), isoEgD->at(i).rank());
861  isoEgD_OccEtaPhi_->Fill(isoEgD->at(i).regionId().ieta(), isoEgD->at(i).regionId().iphi());
862  }
863  }
864  }
865  //now repeat for the emulator candidates
866  for(unsigned int i=0; i < isoEgE->size(); i++) {
867  if(doEmuMBx_ || isoEgE->at(i).bx() == EmuTrigBx_) {
868  isoEgE_Rank_->Fill(isoEgE->at(i).rank());
869  if(isoEgE->at(i).rank()>0) {
870  isoEgE_EtEtaPhi_->Fill(isoEgE->at(i).regionId().ieta(), isoEgE->at(i).regionId().iphi(), isoEgE->at(i).rank());
871  isoEgE_OccEtaPhi_->Fill(isoEgE->at(i).regionId().ieta(), isoEgE->at(i).regionId().iphi());
872  }
873  }
874  }
875 }
876 
877 void
879  //loop over all the data candidates - if multiple bx, then this should be a multiple of GCT_OBJECT_QUANTA
880  for (unsigned int i=0; i < nonIsoEgD->size(); i++) {
881  //if the GCTMBx flag is set, plot all Bx for this quantity, otherwise only plot Bx = GCTTrigBx_
882  if(doGCTMBx_ || nonIsoEgD->at(i).bx() == GCTTrigBx_) {
883  nonIsoEgD_Rank_->Fill(nonIsoEgD->at(i).rank());
884  if(nonIsoEgD->at(i).rank()>0) {
885  nonIsoEgD_EtEtaPhi_->Fill(nonIsoEgD->at(i).regionId().ieta(), nonIsoEgD->at(i).regionId().iphi(), nonIsoEgD->at(i).rank());
886  nonIsoEgD_OccEtaPhi_->Fill(nonIsoEgD->at(i).regionId().ieta(), nonIsoEgD->at(i).regionId().iphi());
887  }
888  }
889  }
890  //now repeat for the emulator candidates
891  for(unsigned int i=0; i < nonIsoEgE->size(); i++) {
892  if(doEmuMBx_ || nonIsoEgE->at(i).bx() == EmuTrigBx_) {
893  nonIsoEgE_Rank_->Fill(nonIsoEgE->at(i).rank());
894  if(nonIsoEgE->at(i).rank()>0) {
895  nonIsoEgE_EtEtaPhi_->Fill(nonIsoEgE->at(i).regionId().ieta(), nonIsoEgE->at(i).regionId().iphi(), nonIsoEgE->at(i).rank());
896  nonIsoEgE_OccEtaPhi_->Fill(nonIsoEgE->at(i).regionId().ieta(), nonIsoEgE->at(i).regionId().iphi());
897  }
898  }
899  }
900 }
901 
902 void
904 
905  std::string errorDirName = "err_";
906  if(isIsoError) errorDirName.append("I");
907  if(isNonIsoError) errorDirName.append("N");
908  std::stringstream caseNumber;
909  caseNumber << eventNumber;
910  errorDirName.append(caseNumber.str());
911  TFileDirectory errorDir = errorHistCat.at(0).mkdir(errorDirName);
912 
913  TH2I *errorEmRegionIsoEtEtaPhi_ = errorDir.make<TH2I>("errorEmRegionIsoEtEtaPhi", "errorEmRegionIsoEtEtaPhi;#eta (GCT Units);#phi (GCT Units)",22, -0.5, 21.5, 18, -0.5, 17.5);
914  TH2I *errorEmRegionNonIsoEtEtaPhi_ = errorDir.make<TH2I>("errorEmRegionNonIsoEtEtaPhi", "errorEmRegionNonIsoEtEtaPhi;#eta (GCT Units);#phi (GCT Units)",22, -0.5, 21.5, 18, -0.5, 17.5);
915  TH2I *errorIsoEtEtaPhiD_ = errorDir.make<TH2I>("errorIsoEtEtaPhiD", "errorIsoEtEtaPhiD;#eta (GCT Units);#phi (GCT Units)",22, -0.5, 21.5, 18, -0.5, 17.5);
916  TH2I *errorNonIsoEtEtaPhiD_ = errorDir.make<TH2I>("errorNonIsoEtEtaPhiD", "errorNonIsoEtEtaPhiD;#eta (GCT Units);#phi (GCT Units)",22, -0.5, 21.5, 18, -0.5, 17.5);
917  TH2I *errorIsoEtEtaPhiE_ = errorDir.make<TH2I>("errorIsoEtEtaPhiE", "errorIsoEtEtaPhiE;#eta (GCT Units);#phi (GCT Units)",22, -0.5, 21.5, 18, -0.5, 17.5);
918  TH2I *errorNonIsoEtEtaPhiE_ = errorDir.make<TH2I>("errorNonIsoEtEtaPhiE", "errorNonIsoEtEtaPhiE;#eta (GCT Units);#phi (GCT Units)",22, -0.5, 21.5, 18, -0.5, 17.5);
919 
920  //fill the EM input collection
921  //should only fill the correct bx for emRegions - and since this is showing an error in the comparison, we should plot the input to this comparison i.e. Bx=RCTTrigBx
922  //this assumes that comparison is done on the central Bx i.e. RctBx=0 corresponds to GctBx=0, and EmuBx=0 takes RctBx=0
923  for(unsigned int i=0;i < emRegions->size();i++) {
924  if(emRegions->at(i).bx() == RCTTrigBx_) {
925  if(emRegions->at(i).isolated()) {
926  if(emRegions->at(i).rank()>0) errorEmRegionIsoEtEtaPhi_->Fill(emRegions->at(i).regionId().ieta(),emRegions->at(i).regionId().iphi(),emRegions->at(i).rank());
927  }
928  else{
929  if(emRegions->at(i).rank()>0) errorEmRegionNonIsoEtEtaPhi_->Fill(emRegions->at(i).regionId().ieta(),emRegions->at(i).regionId().iphi(),emRegions->at(i).rank());
930  }
931  }
932  }
933 
934  //no need to have the rank plot, because you can't have two electrons in the same place (eta,phi), in the same event...
935  //in this case, since we're actually comparing the GCTTrigBx_ with the EmuTrigBx_, we plot these individually
936  for(unsigned int i=0; i < isoEgD->size(); i++) {
937  if(isoEgD->at(i).bx() == GCTTrigBx_) {
938  if(isoEgD->at(i).rank()>0) errorIsoEtEtaPhiD_->Fill(isoEgD->at(i).regionId().ieta(),isoEgD->at(i).regionId().iphi(),isoEgD->at(i).rank());
939  }
940  }
941  for(unsigned int i=0; i < nonIsoEgD->size(); i++) {
942  if(nonIsoEgD->at(i).bx() == GCTTrigBx_) {
943  if(nonIsoEgD->at(i).rank()>0) errorNonIsoEtEtaPhiD_->Fill(nonIsoEgD->at(i).regionId().ieta(),nonIsoEgD->at(i).regionId().iphi(),nonIsoEgD->at(i).rank());
944  }
945  }
946 
947  //now for the emulator candidates
948  for(unsigned int i=0; i < isoEgE->size(); i++) {
949  if(isoEgE->at(i).bx() == EmuTrigBx_) {
950  if(isoEgE->at(i).rank()>0) errorIsoEtEtaPhiE_->Fill(isoEgE->at(i).regionId().ieta(),isoEgE->at(i).regionId().iphi(),isoEgE->at(i).rank());
951  }
952  }
953  for(unsigned int i=0; i < nonIsoEgE->size(); i++) {
954  if(nonIsoEgE->at(i).bx() == EmuTrigBx_) {
955  if(nonIsoEgE->at(i).rank()>0) errorNonIsoEtEtaPhiE_->Fill(nonIsoEgE->at(i).regionId().ieta(),nonIsoEgE->at(i).regionId().iphi(),nonIsoEgE->at(i).rank());
956  }
957  }
958 }
959 
960 void
962 
963  for (unsigned int i=0; i < cenJetsD->size(); i++) {
964  if(doGCTMBx_ || cenJetsD->at(i).bx() == GCTTrigBx_) {
965  cenJetD_Rank_->Fill(cenJetsD->at(i).rank());
966  if(cenJetsD->at(i).rank()>0) {
967  cenJetD_EtEtaPhi_->Fill(cenJetsD->at(i).regionId().ieta(),cenJetsD->at(i).regionId().iphi(),cenJetsD->at(i).rank());
968  cenJetD_OccEtaPhi_->Fill(cenJetsD->at(i).regionId().ieta(),cenJetsD->at(i).regionId().iphi());
969  }
970  }
971  }
972 
973  for(unsigned int i=0; i < cenJetsE->size(); i++) {
974  if(doEmuMBx_ || cenJetsE->at(i).bx() == EmuTrigBx_) {
975  cenJetE_Rank_->Fill(cenJetsE->at(i).rank());
976  if(cenJetsE->at(i).rank()>0) {
977  cenJetE_EtEtaPhi_->Fill(cenJetsE->at(i).regionId().ieta(),cenJetsE->at(i).regionId().iphi(),cenJetsE->at(i).rank());
978  cenJetE_OccEtaPhi_->Fill(cenJetsE->at(i).regionId().ieta(),cenJetsE->at(i).regionId().iphi());
979  }
980  }
981  }
982 }
983 
984 void
986 
987  for (unsigned int i=0; i < tauJetsD->size(); i++) {
988  if(doGCTMBx_ || tauJetsD->at(i).bx() == GCTTrigBx_) {
989  tauJetD_Rank_->Fill(tauJetsD->at(i).rank());
990  if(tauJetsD->at(i).rank()>0) {
991  tauJetD_EtEtaPhi_->Fill(tauJetsD->at(i).regionId().ieta(),tauJetsD->at(i).regionId().iphi(),tauJetsD->at(i).rank());
992  tauJetD_OccEtaPhi_->Fill(tauJetsD->at(i).regionId().ieta(),tauJetsD->at(i).regionId().iphi());
993  }
994  }
995  }
996 
997  for(unsigned int i=0; i < tauJetsE->size(); i++) {
998  if(doEmuMBx_ || tauJetsE->at(i).bx() == EmuTrigBx_) {
999  tauJetE_Rank_->Fill(tauJetsE->at(i).rank());
1000  if(tauJetsE->at(i).rank()>0) {
1001  tauJetE_EtEtaPhi_->Fill(tauJetsE->at(i).regionId().ieta(),tauJetsE->at(i).regionId().iphi(),tauJetsE->at(i).rank());
1002  tauJetE_OccEtaPhi_->Fill(tauJetsE->at(i).regionId().ieta(),tauJetsE->at(i).regionId().iphi());
1003  }
1004  }
1005  }
1006 }
1007 
1008 void
1010 
1011  for (unsigned int i=0; i < forJetsD->size(); i++) {
1012  if(doGCTMBx_ || forJetsD->at(i).bx() == GCTTrigBx_) {
1013  forJetD_Rank_->Fill(forJetsD->at(i).rank());
1014  if(forJetsD->at(i).rank()>0) {
1015  forJetD_EtEtaPhi_->Fill(forJetsD->at(i).regionId().ieta(),forJetsD->at(i).regionId().iphi(),forJetsD->at(i).rank());
1016  forJetD_OccEtaPhi_->Fill(forJetsD->at(i).regionId().ieta(),forJetsD->at(i).regionId().iphi());
1017  }
1018  }
1019  }
1020 
1021  for(unsigned int i=0; i < forJetsE->size(); i++) {
1022  if(doEmuMBx_ || forJetsE->at(i).bx() == EmuTrigBx_) {
1023  forJetE_Rank_->Fill(forJetsE->at(i).rank());
1024  if(forJetsE->at(i).rank()>0) {
1025  forJetE_EtEtaPhi_->Fill(forJetsE->at(i).regionId().ieta(),forJetsE->at(i).regionId().iphi(),forJetsE->at(i).rank());
1026  forJetE_OccEtaPhi_->Fill(forJetsE->at(i).regionId().ieta(),forJetsE->at(i).regionId().iphi());
1027  }
1028  }
1029  }
1030 }
1031 
1032 void
1034 
1035  jetData intJet;
1036  std::vector<jetData> intJetCollection(NUM_INT_JETS); //define fixed size for the vector to avoid reallocation (i.e. max size possible)
1037 
1038  //since we don't read out the intermediate (i.e. leaf card) jets, we can only plot the emulator distributions
1039  //the 1st-4th jet Et will prove useful in understanding and motivating cuts on individual jets in HT and MHT.
1040  for(unsigned int i=0; i < intJetsE->size(); i++) {
1041 
1042  if(doEmuMBx_ || intJetsE->at(i).bx() == EmuTrigBx_) {
1043 
1044  //the intermediate jets are not sorted in terms of Et so
1045  //in order to do this independently of the data format,
1046  //copy to a user defined struct and sort that way
1047  intJet.et = intJetsE->at(i).et();
1048  intJet.phi = intJetsE->at(i).phi();
1049  intJet.eta = intJetsE->at(i).eta();
1050  intJetCollection.at(i % NUM_INT_JETS) = intJet;
1051 
1052  //remember, if the event has 1 overflowed jet, then we fill the internal jet dist overflow histogram
1053  //and skip the event - there is no point looking at the leading jet distributions etc for an event
1054  //with an overflowed jet - this will imply HT, ET, MET and MHT all overflow too.
1055  if(intJetsE->at(i).oflow()) {
1056  intJetE_Of_->Fill(intJetsE->at(i).oflow());
1057  return;
1058  }
1059 
1060  //plot the (et,eta,phi) distribution of the intermediate jets (for non-zero et)
1061  if(intJetsE->at(i).et()) intJetEtEtaPhiE_->Fill(intJetsE->at(i).regionId().ieta(),intJetsE->at(i).regionId().iphi(),intJetsE->at(i).et());
1062 
1063  }
1064  }
1065 
1066  //if we get this far, there are no jets with an overflow bit so fill the overflow histogram and
1067  //sort the intJetCollection according to the rule defined in sortJets (i.e. largest et first)
1068  intJetE_Of_->Fill(0);
1069  std::sort(intJetCollection.begin(), intJetCollection.end(), sortJets);
1070 
1071  std::vector<TH1I *> leadingJetDist(4);
1072  leadingJetDist.at(0) = intJetE_Jet1Et_;
1073  leadingJetDist.at(1) = intJetE_Jet2Et_;
1074  leadingJetDist.at(2) = intJetE_Jet3Et_;
1075  leadingJetDist.at(3) = intJetE_Jet4Et_;
1076 
1077  unsigned int i=0;
1078  unsigned int j=0;
1079  unsigned int currentEt=0;
1080  while(intJetCollection.at(i).et > 0) {
1081 
1082  if(j < leadingJetDist.size()) {
1083  if(i == 0) {
1084  leadingJetDist.at(j)->Fill(intJetCollection.at(i).et);
1085  currentEt = intJetCollection.at(i).et;
1086  j++;
1087  } else {
1088  if(intJetCollection.at(i).et < currentEt) {
1089  leadingJetDist.at(j)->Fill(intJetCollection.at(i).et);
1090  currentEt = intJetCollection.at(i).et;
1091  j++;
1092  }
1093  }
1094  }
1095 
1096  intJetE_Et_->Fill(intJetCollection.at(i).et);
1097  i++;
1098  }
1099  return;
1100 
1101 }
1102 
1103 bool
1104 GctErrorAnalyzer::sortJets(const jetData &jet1, const jetData &jet2) {
1105  return jet1.et > jet2.et;
1106 }
1107 
1108 template<class T>
1109 bool
1111 
1112  //unfortunately, the dataformats are not consistent with the name() method (i.e. some have it, others don't)
1113  //and a typeof() function doesn't exist in ANSI C++, so to identify the templated type, we pass a std::string
1114 
1115  if(!collection.isValid()) {
1116  edm::LogWarning("DataNotFound") << " Could not find " << label << " label";
1117  return false;
1118  }
1119  if(collection->size() % constraint != 0 || collection->size() == 0) {
1120  edm::LogWarning("CollectionSizeError") << " " << label << " collection size is " << collection->size() << ", expected multiple of " << constraint;
1121  return false;
1122  }
1123 
1124  return true;
1125 }
1126 
1127 void
1129 
1130  std::string errorDirName = "err_";
1131  if(isCenJetError) errorDirName.append("C");
1132  if(isTauJetError) errorDirName.append("T");
1133  if(isForJetError) errorDirName.append("F");
1134  std::stringstream caseNumber;
1135  caseNumber << eventNumber;
1136  errorDirName.append(caseNumber.str());
1137  TFileDirectory errorDir = errorHistCat.at(1).mkdir(errorDirName);
1138 
1139  TH2I *errorRegionEtEtaPhi_ = errorDir.make<TH2I>("errorRegionEtEtaPhi", "errorRegionEtEtaPhi;#eta (GCT Units);#phi (GCT Units)", 22, -0.5, 21.5, 18, -0.5, 17.5);
1140  TH2I *errorRegionTvEtaPhi_ = errorDir.make<TH2I>("errorRegionTvEtaPhi", "errorRegionTvEtaPhi;#eta (GCT Units);#phi (GCT Units)", 22, -0.5, 21.5, 18, -0.5, 17.5);
1141  TH2I *errorRegionOfEtaPhi_ = errorDir.make<TH2I>("errorRegionOfEtaPhi", "errorRegionOfEtaPhi;#eta (GCT Units);#phi (GCT Units)", 22, -0.5, 21.5, 18, -0.5, 17.5);
1142 
1143  //make sure to only plot the caloRegion bx which corresponds to the data vs emulator comparison
1144  for(unsigned int i=0;i<caloRegions->size();i++) {
1145  if(caloRegions->at(i).bx() == RCTTrigBx_) {
1146  if(caloRegions->at(i).et()>0) errorRegionEtEtaPhi_->Fill(caloRegions->at(i).gctEta(),caloRegions->at(i).gctPhi(),caloRegions->at(i).et());
1147  if(caloRegions->at(i).tauVeto()) errorRegionTvEtaPhi_->Fill(caloRegions->at(i).gctEta(),caloRegions->at(i).gctPhi());
1148  if(caloRegions->at(i).overFlow()) errorRegionOfEtaPhi_->Fill(caloRegions->at(i).gctEta(),caloRegions->at(i).gctPhi());
1149  }
1150  }
1151 
1152  TH2I *cenJet_errorEtEtaPhiData_ = errorDir.make<TH2I>("cenJet_errorEtEtaPhiData", "cenJet_errorEtEtaPhiData;#eta (GCT Units);#phi (GCT Units)", 22, -0.5, 21.5, 18, -0.5, 17.5);
1153  TH2I *cenJet_errorEtEtaPhiEmu_ = errorDir.make<TH2I>("cenJet_errorEtEtaPhiEmu", "cenJet_errorEtEtaPhiEmu;#eta (GCT Units);#phi (GCT Units)", 22, -0.5, 21.5, 18, -0.5, 17.5);
1154  TH2I *tauJet_errorEtEtaPhiData_ = errorDir.make<TH2I>("tauJet_errorEtEtaPhiData", "tauJet_errorEtEtaPhiData;#eta (GCT Units);#phi (GCT Units)", 22, -0.5, 21.5, 18, -0.5, 17.5);
1155  TH2I *tauJet_errorEtEtaPhiEmu_ = errorDir.make<TH2I>("tauJet_errorEtEtaPhiEmu", "tauJet_errorEtEtaPhiEmu;#eta (GCT Units);#phi (GCT Units)", 22, -0.5, 21.5, 18, -0.5, 17.5);
1156  TH2I *forJet_errorEtEtaPhiData_ = errorDir.make<TH2I>("forJet_errorEtEtaPhiData", "forJet_errorEtEtaPhiData;#eta (GCT Units);#phi (GCT Units)", 22, -0.5, 21.5, 18, -0.5, 17.5);
1157  TH2I *forJet_errorEtEtaPhiEmu_ = errorDir.make<TH2I>("forJet_errorEtEtaPhiEmu", "forJet_errorEtEtaPhiEmu;#eta (GCT Units);#phi (GCT Units)", 22, -0.5, 21.5, 18, -0.5, 17.5);
1158 
1159  //first plot the data candiates for the Trigger Bx that this error corresponds to
1160  for(unsigned int i=0; i < cenJetsD->size(); i++) {
1161  if(cenJetsD->at(i).bx() == GCTTrigBx_) {
1162  if(cenJetsD->at(i).rank()>0) cenJet_errorEtEtaPhiData_->Fill(cenJetsD->at(i).regionId().ieta(),cenJetsD->at(i).regionId().iphi(),cenJetsD->at(i).rank());
1163  }
1164  }
1165  for(unsigned int i=0; i < tauJetsD->size(); i++) {
1166  if(tauJetsD->at(i).bx() == GCTTrigBx_) {
1167  if(tauJetsD->at(i).rank()>0) tauJet_errorEtEtaPhiData_->Fill(tauJetsD->at(i).regionId().ieta(),tauJetsD->at(i).regionId().iphi(),tauJetsD->at(i).rank());
1168  }
1169  }
1170  for(unsigned int i=0; i < forJetsD->size(); i++) {
1171  if(forJetsD->at(i).bx() == GCTTrigBx_) {
1172  if(forJetsD->at(i).rank()>0) forJet_errorEtEtaPhiData_->Fill(forJetsD->at(i).regionId().ieta(),forJetsD->at(i).regionId().iphi(),forJetsD->at(i).rank());
1173  }
1174  }
1175 
1176  //now the emulator candidates
1177  for(unsigned int i=0; i < cenJetsE->size(); i++) {
1178  if(cenJetsE->at(i).bx() == EmuTrigBx_) {
1179  if(cenJetsE->at(i).rank()>0) cenJet_errorEtEtaPhiEmu_->Fill(cenJetsE->at(i).regionId().ieta(),cenJetsE->at(i).regionId().iphi(),cenJetsE->at(i).rank());
1180  }
1181  }
1182  for(unsigned int i=0; i < tauJetsE->size(); i++) {
1183  if(tauJetsE->at(i).bx() == EmuTrigBx_) {
1184  if(tauJetsE->at(i).rank()>0) tauJet_errorEtEtaPhiEmu_->Fill(tauJetsE->at(i).regionId().ieta(),tauJetsE->at(i).regionId().iphi(),tauJetsE->at(i).rank());
1185  }
1186  }
1187  for(unsigned int i=0; i < forJetsE->size(); i++) {
1188  if(forJetsE->at(i).bx() == EmuTrigBx_) {
1189  if(forJetsE->at(i).rank()>0) forJet_errorEtEtaPhiEmu_->Fill(forJetsE->at(i).regionId().ieta(),forJetsE->at(i).regionId().iphi(),forJetsE->at(i).rank());
1190  }
1191  }
1192 
1193 }
1194 
1195 void
1197 
1198  for(unsigned int i=0; i < hfRingSumsD->size(); i++) {
1199  if(doGCTMBx_ || hfRingSumsD->at(i).bx() == GCTTrigBx_) {
1200  //there are 4 rings - just fill the histograms
1201  hfRingSumD_1pos_->Fill(hfRingSumsD->at(i).etSum(0));
1202  hfRingSumD_1neg_->Fill(hfRingSumsD->at(i).etSum(1));
1203  hfRingSumD_2pos_->Fill(hfRingSumsD->at(i).etSum(2));
1204  hfRingSumD_2neg_->Fill(hfRingSumsD->at(i).etSum(3));
1205  }
1206  }
1207 
1208  for(unsigned int i=0; i < hfRingSumsE->size(); i++) {
1209  if(doEmuMBx_ || hfRingSumsE->at(i).bx() == EmuTrigBx_) {
1210  hfRingSumE_1pos_->Fill(hfRingSumsE->at(i).etSum(0));
1211  hfRingSumE_1neg_->Fill(hfRingSumsE->at(i).etSum(1));
1212  hfRingSumE_2pos_->Fill(hfRingSumsE->at(i).etSum(2));
1213  hfRingSumE_2neg_->Fill(hfRingSumsE->at(i).etSum(3));
1214  }
1215  }
1216 }
1217 
1218 void
1220 
1221  for(unsigned int i=0; i < hfBitCountsD->size(); i++) {
1222  if(doGCTMBx_ || hfBitCountsD->at(i).bx() == GCTTrigBx_) {
1223  //there are 4 rings - just fill the histograms
1224  hfBitCountD_1pos_->Fill(hfBitCountsD->at(i).bitCount(0));
1225  hfBitCountD_1neg_->Fill(hfBitCountsD->at(i).bitCount(1));
1226  hfBitCountD_2pos_->Fill(hfBitCountsD->at(i).bitCount(2));
1227  hfBitCountD_2neg_->Fill(hfBitCountsD->at(i).bitCount(3));
1228  }
1229  }
1230  for(unsigned int i=0; i < hfBitCountsE->size(); i++) {
1231  if(doEmuMBx_ || hfBitCountsE->at(i).bx() == EmuTrigBx_) {
1232  hfBitCountE_1pos_->Fill(hfBitCountsE->at(i).bitCount(0));
1233  hfBitCountE_1neg_->Fill(hfBitCountsE->at(i).bitCount(1));
1234  hfBitCountE_2pos_->Fill(hfBitCountsE->at(i).bitCount(2));
1235  hfBitCountE_2neg_->Fill(hfBitCountsE->at(i).bitCount(3));
1236  }
1237  }
1238 }
1239 
1240 void
1242 
1243  std::string errorDirName = "err_";
1244  if(isRingSumError) errorDirName.append("R");
1245  if(isBitCountError) errorDirName.append("B");
1246  std::stringstream caseNumber;
1247  caseNumber << eventNumber;
1248  errorDirName.append(caseNumber.str());
1249  TFileDirectory errorDir = errorHistCat.at(2).mkdir(errorDirName);
1250 
1251  TH2I *errorRegionEtEtaPhi_ = errorDir.make<TH2I>("errorRegionEtEtaPhi", "errorRegionEtEtaPhi;#eta (GCT Units);#phi (GCT Units)", 22, -0.5, 21.5, 18, -0.5, 17.5);
1252  TH2I *errorRegionFgEtaPhi_ = errorDir.make<TH2I>("errorRegionFgEtaPhi", "errorRegionFgEtaPhi;#eta (GCT Units);#phi (GCT Units)", 22, -0.5, 21.5, 18, -0.5, 17.5);
1253  TH2I *errorRegionOfEtaPhi_ = errorDir.make<TH2I>("errorRegionOfEtaPhi", "errorRegionOfEtaPhi;#eta (GCT Units);#phi (GCT Units)", 22, -0.5, 21.5, 18, -0.5, 17.5);
1254 
1255  TH1I *errorHFRingSumD_1pos_ = errorDir.make<TH1I>("errorHFRingSumD_1+", "errorHFRingSumD_1+;Rank;Number of Events", 8, -0.5, 7.5);
1256  TH1I *errorHFRingSumD_2pos_ = errorDir.make<TH1I>("errorHFRingSumD_2+", "errorHFRingSumD_2+;Rank;Number of Events", 8, -0.5, 7.5);
1257  TH1I *errorHFRingSumD_1neg_ = errorDir.make<TH1I>("errorHFRingSumD_1-", "errorHFRingSumD_1-;Rank;Number of Events", 8, -0.5, 7.5);
1258  TH1I *errorHFRingSumD_2neg_ = errorDir.make<TH1I>("errorHFRingSumD_2-", "errorHFRingSumD_2-;Rank;Number of Events", 8, -0.5, 7.5);
1259  TH1I *errorHFRingSumE_1pos_ = errorDir.make<TH1I>("errorHFRingSumE_1+", "errorHFRingSumE_1+;Rank;Number of Events", 8, -0.5, 7.5);
1260  TH1I *errorHFRingSumE_2pos_ = errorDir.make<TH1I>("errorHFRingSumE_2+", "errorHFRingSumE_2+;Rank;Number of Events", 8, -0.5, 7.5);
1261  TH1I *errorHFRingSumE_1neg_ = errorDir.make<TH1I>("errorHFRingSumE_1-", "errorHFRingSumE_1-;Rank;Number of Events", 8, -0.5, 7.5);
1262  TH1I *errorHFRingSumE_2neg_ = errorDir.make<TH1I>("errorHFRingSumE_2-", "errorHFRingSumE_2-;Rank;Number of Events", 8, -0.5, 7.5);
1263 
1264  TH1I *errorHFBitCountD_1pos_ = errorDir.make<TH1I>("errorHFBitCountD_1+", "errorHFBitCountD_1+;Rank;Number of Events", 8, -0.5, 7.5);
1265  TH1I *errorHFBitCountD_2pos_ = errorDir.make<TH1I>("errorHFBitCountD_2+", "errorHFBitCountD_2+;Rank;Number of Events", 8, -0.5, 7.5);
1266  TH1I *errorHFBitCountD_1neg_ = errorDir.make<TH1I>("errorHFBitCountD_1-", "errorHFBitCountD_1-;Rank;Number of Events", 8, -0.5, 7.5);
1267  TH1I *errorHFBitCountD_2neg_ = errorDir.make<TH1I>("errorHFBitCountD_2-", "errorHFBitCountD_2-;Rank;Number of Events", 8, -0.5, 7.5);
1268  TH1I *errorHFBitCountE_1pos_ = errorDir.make<TH1I>("errorHFBitCountE_1+", "errorHFBitCountE_1+;Rank;Number of Events", 8, -0.5, 7.5);
1269  TH1I *errorHFBitCountE_2pos_ = errorDir.make<TH1I>("errorHFBitCountE_2+", "errorHFBitCountE_2+;Rank;Number of Events", 8, -0.5, 7.5);
1270  TH1I *errorHFBitCountE_1neg_ = errorDir.make<TH1I>("errorHFBitCountE_1-", "errorHFBitCountE_1-;Rank;Number of Events", 8, -0.5, 7.5);
1271  TH1I *errorHFBitCountE_2neg_ = errorDir.make<TH1I>("errorHFBitCountE_2-", "errorHFBitCountE_2-;Rank;Number of Events", 8, -0.5, 7.5);
1272 
1273  for(unsigned int i=0;i<caloRegions->size();i++) {
1274  if(caloRegions->at(i).bx() == RCTTrigBx_) {
1275  if(caloRegions->at(i).et()>0) errorRegionEtEtaPhi_->Fill(caloRegions->at(i).gctEta(),caloRegions->at(i).gctPhi(),caloRegions->at(i).et());
1276  if(caloRegions->at(i).fineGrain()) errorRegionFgEtaPhi_->Fill(caloRegions->at(i).gctEta(),caloRegions->at(i).gctPhi());
1277  if(caloRegions->at(i).overFlow()) errorRegionOfEtaPhi_->Fill(caloRegions->at(i).gctEta(),caloRegions->at(i).gctPhi());
1278  }
1279  }
1280 
1281  for(unsigned int i=0; i < hfRingSumsD->size(); i++) {
1282  if(hfRingSumsD->at(i).bx() == GCTTrigBx_) {
1283  errorHFRingSumD_1pos_->Fill(hfRingSumsD->at(i).etSum(0));
1284  errorHFRingSumD_1neg_->Fill(hfRingSumsD->at(i).etSum(1));
1285  errorHFRingSumD_2pos_->Fill(hfRingSumsD->at(i).etSum(2));
1286  errorHFRingSumD_2neg_->Fill(hfRingSumsD->at(i).etSum(3));
1287  }
1288  }
1289  for(unsigned int i=0; i < hfRingSumsE->size(); i++) {
1290  if(hfRingSumsE->at(i).bx() == EmuTrigBx_) {
1291  errorHFRingSumE_1pos_->Fill(hfRingSumsE->at(i).etSum(0));
1292  errorHFRingSumE_1neg_->Fill(hfRingSumsE->at(i).etSum(1));
1293  errorHFRingSumE_2pos_->Fill(hfRingSumsE->at(i).etSum(2));
1294  errorHFRingSumE_2neg_->Fill(hfRingSumsE->at(i).etSum(3));
1295  }
1296  }
1297 
1298  for(unsigned int i=0; i < hfBitCountsD->size(); i++) {
1299  if(hfBitCountsD->at(i).bx() == GCTTrigBx_) {
1300  errorHFBitCountD_1pos_->Fill(hfBitCountsD->at(i).bitCount(0));
1301  errorHFBitCountD_1neg_->Fill(hfBitCountsD->at(i).bitCount(1));
1302  errorHFBitCountD_2pos_->Fill(hfBitCountsD->at(i).bitCount(2));
1303  errorHFBitCountD_2neg_->Fill(hfBitCountsD->at(i).bitCount(3));
1304  }
1305  }
1306  for(unsigned int i=0; i < hfBitCountsE->size(); i++) {
1307  if(hfBitCountsE->at(i).bx() == EmuTrigBx_) {
1308  errorHFBitCountE_1pos_->Fill(hfBitCountsE->at(i).bitCount(0));
1309  errorHFBitCountE_1neg_->Fill(hfBitCountsE->at(i).bitCount(1));
1310  errorHFBitCountE_2pos_->Fill(hfBitCountsE->at(i).bitCount(2));
1311  errorHFBitCountE_2neg_->Fill(hfBitCountsE->at(i).bitCount(3));
1312  }
1313  }
1314 }
1315 
1316 void
1318 
1319  for(unsigned int i=0; i < totalEtD->size(); i++) {
1320  if(doGCTMBx_ || totalEtD->at(i).bx() == GCTTrigBx_) {
1321  totalEtD_Of_->Fill(totalEtD->at(i).overFlow());
1322  if(!totalEtD->at(i).overFlow()) totalEtD_->Fill(totalEtD->at(i).et());
1323  }
1324  }
1325  for(unsigned int i=0; i < totalEtE->size(); i++) {
1326  if(doEmuMBx_ || totalEtE->at(i).bx() == EmuTrigBx_) {
1327  totalEtE_Of_->Fill(totalEtE->at(i).overFlow());
1328  if(!totalEtE->at(i).overFlow()) totalEtE_->Fill(totalEtE->at(i).et());
1329  }
1330  }
1331 }
1332 
1333 void
1335 
1336  for(unsigned int i=0; i < totalHtD->size(); i++) {
1337  if(doGCTMBx_ || totalHtD->at(i).bx() == GCTTrigBx_) {
1338  totalHtD_Of_->Fill(totalHtD->at(i).overFlow());
1339  if(!totalHtD->at(i).overFlow()) totalHtD_->Fill(totalHtD->at(i).et());
1340  }
1341  }
1342  for(unsigned int i=0; i < totalHtE->size(); i++) {
1343  if(doEmuMBx_ || totalHtE->at(i).bx() == EmuTrigBx_) {
1344  totalHtE_Of_->Fill(totalHtE->at(i).overFlow());
1345  if(!totalHtE->at(i).overFlow()) totalHtE_->Fill(totalHtE->at(i).et());
1346  }
1347  }
1348 }
1349 
1350 void
1352 
1353  std::string errorDirName = "err_";
1354  if(isTotalEError) errorDirName.append("E");
1355  if(isTotalHError) errorDirName.append("H");
1356  std::stringstream caseNumber;
1357  caseNumber << eventNumber;
1358  errorDirName.append(caseNumber.str());
1359  TFileDirectory errorDir = errorHistCat.at(3).mkdir(errorDirName);
1360 
1361  TH2I *errorRegionEtEtaPhi_ = errorDir.make<TH2I>("errorRegionEtEtaPhi", "errorRegionEtEtaPhi;#eta (GCT Units);#phi (GCT Units)", 22, -0.5, 21.5, 18, -0.5, 17.5);
1362  TH2I *errorRegionOfEtaPhi_ = errorDir.make<TH2I>("errorRegionOfEtaPhi", "errorRegionOfEtaPhi;#eta (GCT Units);#phi (GCT Units)", 22, -0.5, 21.5, 18, -0.5, 17.5);
1363  TH1I *errorTotalEtD_ = errorDir.make<TH1I>("errorTotalEtD", "errorTotalEtD;E_{T};Number of Events", 1024, -0.5, 1023.5);
1364  TH1I *errorTotalEtD_Of_ = errorDir.make<TH1I>("errorTotalEtD_Of", "errorTotalEtD_Of;Overflow Bit Status;Number of Events", 2, -0.5, 1.5);
1365  TH1I *errorTotalEtE_ = errorDir.make<TH1I>("errorTotalEtE", "errorTotalEtE;E_{T};Number of Events", 1024, -0.5, 1023.5);
1366  TH1I *errorTotalEtE_Of_ = errorDir.make<TH1I>("errorTotalEtE_Of", "errorTotalEtE_Of;Overflow Bit Status;Number of Events", 2, -0.5, 1.5);
1367  TH1I *errorTotalHtD_ = errorDir.make<TH1I>("errorTotalHtD", "errorTotalHtD;E_{T};Number of Events", 1024, -0.5, 1023.5);
1368  TH1I *errorTotalHtD_Of_ = errorDir.make<TH1I>("errorTotalHtD_Of", "errorTotalHtD_Of;Overflow Bit Status;Number of Events", 2, -0.5, 1.5);
1369  TH1I *errorTotalHtE_ = errorDir.make<TH1I>("errorTotalHtE", "errorTotalHtE;E_{T};Number of Events", 1024, -0.5, 1023.5);
1370  TH1I *errorTotalHtE_Of_ = errorDir.make<TH1I>("errorTotalHtE_Of", "errorTotalHtE_Of;Overflow Bit Status;Number of Events", 2, -0.5, 1.5);
1371 
1372  //plot the region ET and OF bits
1373  for(unsigned int i=0;i<caloRegions->size();i++) {
1374  if(caloRegions->at(i).bx() == RCTTrigBx_) {
1375  if(caloRegions->at(i).et()>0) errorRegionEtEtaPhi_->Fill(caloRegions->at(i).gctEta(),caloRegions->at(i).gctPhi(),caloRegions->at(i).et());
1376  if(caloRegions->at(i).overFlow()) errorRegionOfEtaPhi_->Fill(caloRegions->at(i).gctEta(),caloRegions->at(i).gctPhi());
1377  }
1378  }
1379  //now plot the error ET
1380  for(unsigned int i=0; i < totalEtD->size(); i++) {
1381  if(totalEtD->at(i).bx() == GCTTrigBx_) {
1382  errorTotalEtD_Of_->Fill(totalEtD->at(i).overFlow());
1383  if(!totalEtD->at(i).overFlow()) errorTotalEtD_->Fill(totalEtD->at(i).et());
1384  }
1385  }
1386  for(unsigned int i=0; i < totalEtE->size(); i++) {
1387  if(totalEtE->at(i).bx() == EmuTrigBx_) {
1388  errorTotalEtE_Of_->Fill(totalEtE->at(i).overFlow());
1389  if(!totalEtE->at(i).overFlow()) errorTotalEtE_->Fill(totalEtE->at(i).et());
1390  }
1391  }
1392  //and now the error HT
1393  for(unsigned int i=0; i < totalHtD->size(); i++) {
1394  if(totalHtD->at(i).bx() == GCTTrigBx_) {
1395  errorTotalHtD_Of_->Fill(totalHtD->at(i).overFlow());
1396  if(!totalHtD->at(i).overFlow()) errorTotalHtD_->Fill(totalHtD->at(i).et());
1397  }
1398  }
1399  for(unsigned int i=0; i < totalHtE->size(); i++) {
1400  if(totalHtE->at(i).bx() == EmuTrigBx_) {
1401  errorTotalHtE_Of_->Fill(totalHtE->at(i).overFlow());
1402  if(!totalHtE->at(i).overFlow()) errorTotalHtE_->Fill(totalHtE->at(i).et());
1403  }
1404  }
1405 }
1406 
1407 void
1409 
1410  for(unsigned int i=0; i < missingEtD->size(); i++) {
1411  if(doGCTMBx_ || missingEtD->at(i).bx() == GCTTrigBx_) {
1412  missingEtD_Of_->Fill(missingEtD->at(i).overFlow());
1413  if(!missingEtD->at(i).overFlow() && missingEtD->at(i).et()>0) {
1414  missingEtD_->Fill(missingEtD->at(i).et());
1415  missingEtD_Phi_->Fill(missingEtD->at(i).phi());
1416  }
1417  }
1418  }
1419 
1420  for(unsigned int i=0; i < missingEtE->size(); i++) {
1421  if(doEmuMBx_ || missingEtE->at(i).bx() == EmuTrigBx_) {
1422  missingEtE_Of_->Fill(missingEtE->at(i).overFlow());
1423  if(!missingEtE->at(i).overFlow() && missingEtE->at(i).et()) {
1424  missingEtE_->Fill(missingEtE->at(i).et());
1425  missingEtE_Phi_->Fill(missingEtE->at(i).phi());
1426  }
1427  }
1428  }
1429 }
1430 
1431 void
1433 
1434  for(unsigned int i=0; i < missingHtD->size(); i++) {
1435  if(doGCTMBx_ || missingHtD->at(i).bx() == GCTTrigBx_) {
1436  missingHtD_Of_->Fill(missingHtD->at(i).overFlow());
1437  if(!missingHtD->at(i).overFlow() && missingHtD->at(i).et()>0) {
1438  missingHtD_->Fill(missingHtD->at(i).et());
1439  missingHtD_Phi_->Fill(missingHtD->at(i).phi());
1440  }
1441  }
1442  }
1443 
1444  for(unsigned int i=0; i < missingHtE->size(); i++) {
1445  if(doEmuMBx_ || missingHtE->at(i).bx() == EmuTrigBx_) {
1446  missingHtE_Of_->Fill(missingHtE->at(i).overFlow());
1447  if(!missingHtE->at(i).overFlow() && missingHtE->at(i).et()>0) {
1448  missingHtE_->Fill(missingHtE->at(i).et());
1449  missingHtE_Phi_->Fill(missingHtE->at(i).phi());
1450  }
1451  }
1452  }
1453 }
1454 
1455 void
1457 
1458  std::string errorDirName = "err_";
1459  if(isMissingEError) errorDirName.append("E");
1460  if(isMissingHError) errorDirName.append("H");
1461 
1462  //added 05.03.2010 to highlight overflow errors in the missing energy sum calculation
1463  for(unsigned int i=0; i < missingHtE->size(); i++) {
1464  if(missingHtE->at(i).bx() == EmuTrigBx_) {
1465  for(unsigned int j=0; j < missingHtD->size(); j++) {
1466  if(missingHtD->at(j).bx() == GCTTrigBx_) {
1467  if(missingHtD->at(j).overFlow() != missingHtE->at(i).overFlow()) errorDirName.append("O");
1468  }
1469  }
1470  }
1471  }
1472 
1473  std::stringstream caseNumber;
1474  caseNumber << eventNumber;
1475  errorDirName.append(caseNumber.str());
1476  TFileDirectory errorDir = errorHistCat.at(4).mkdir(errorDirName);
1477 
1478  TH2I *errorRegionEtEtaPhi_ = errorDir.make<TH2I>("errorRegionEtEtaPhi", "errorRegionEtEtaPhi;#eta (GCT Units);#phi (GCT Units)", 22, -0.5, 21.5, 18, -0.5, 17.5);
1479  TH2I *errorRegionOfEtaPhi_ = errorDir.make<TH2I>("errorRegionOfEtaPhi", "errorRegionOfEtaPhi;#eta (GCT Units);#phi (GCT Units)", 22, -0.5, 21.5, 18, -0.5, 17.5);
1480  TH1I *errorMissingEtD_ = errorDir.make<TH1I>("errorMissingEtD", "errorMissingEtD;E_{T};Number of Events", 1024, -0.5, 1023.5);
1481  TH1I *errorMissingEtD_Of_ = errorDir.make<TH1I>("errorMissingEtD_Of", "errorMissingEtD_Of;Overflow Bit Status;Number of Events", 2, -0.5, 1.5);
1482  TH1I *errorMissingEtD_Phi_= errorDir.make<TH1I>("errorMissingEtD_Phi", "errorMissingEtD_Phi;Missing E_{T} #phi;Number of Events", 72, -0.5, 71.5);
1483  TH1I *errorMissingEtE_ = errorDir.make<TH1I>("errorMissingEtE", "errorMissingEtE;E_{T};Number of Events", 1024, -0.5, 1023.5);
1484  TH1I *errorMissingEtE_Of_ = errorDir.make<TH1I>("errorMissingEtE_Of", "errorMissingEtE_Of;Overflow Bit Status;Number of Events", 2, -0.5, 1.5);
1485  TH1I *errorMissingEtE_Phi_ = errorDir.make<TH1I>("errorMissingEtE_Phi", "errorMissingEtE_Phi;Missing E_{T} #phi;Number of Events", 72, -0.5, 71.5);
1486  TH1I *errorMissingHtD_ = errorDir.make<TH1I>("errorMissingHtD", "errorMissingHtD;H_{T};Number of Events", 1024, -0.5, 1023.5);
1487  TH1I *errorMissingHtD_Of_ = errorDir.make<TH1I>("errorMissingHtD_Of", "errorMissingHtD_Of;Overflow Bit Status;Number of Events", 2, -0.5, 1.5);
1488  TH1I *errorMissingHtD_Phi_= errorDir.make<TH1I>("errorMissingHtD_Phi", "errorMissingHtD_Phi;Missing H_{T} #phi;Number of Events", 72, -0.5, 71.5);
1489  TH1I *errorMissingHtE_ = errorDir.make<TH1I>("errorMissingHtE", "errorMissingHtE;H_{T};Number of Events", 1024, -0.5, 1023.5);
1490  TH1I *errorMissingHtE_Of_ = errorDir.make<TH1I>("errorMissingHtE_Of", "errorMissingHtE_Of;Overflow Bit Status;Number of Events", 2, -0.5, 1.5);
1491  TH1I *errorMissingHtE_Phi_ = errorDir.make<TH1I>("errorMissingHtE_Phi", "errorMissingHtE_Phi;Missing H_{T} #phi;Number of Events", 72, -0.5, 71.5);
1492 
1493  //Added 19.03.2010 to provide additional information in the case of missingHt failures
1494  //1. The MHT from both wheel inputs (i.e. the leaf cards)
1495  //2. The emulator jet et,eta,phi for all jets found in an event
1497  if(checkCollections(intMissingHtD, GCT_INT_HTMISS_QUANTA, "Internal Missing Ht Data")) {
1498 
1499  TH1I *errorMissingHtD_HtXPosLeaf1 = errorDir.make<TH1I>("errorMissingHtD_HtXPosLeaf1", "missingHtD;Missing H_{T} X PosLeaf1;Number of Events", 4096, -2048.5, 2047.5);
1500  TH1I *errorMissingHtD_HtXPosLeaf2 = errorDir.make<TH1I>("errorMissingHtD_HtXPosLeaf2", "missingHtD;Missing H_{T} X PosLeaf2;Number of Events", 4096, -2048.5, 2047.5);
1501  TH1I *errorMissingHtD_HtXPosLeaf3 = errorDir.make<TH1I>("errorMissingHtD_HtXPosLeaf3", "missingHtD;Missing H_{T} X PosLeaf3;Number of Events", 4096, -2048.5, 2047.5);
1502  TH1I *errorMissingHtD_HtXNegLeaf1 = errorDir.make<TH1I>("errorMissingHtD_HtXNegLeaf1", "missingHtD;Missing H_{T} X NegLeaf1;Number of Events", 4096, -2048.5, 2047.5);
1503  TH1I *errorMissingHtD_HtXNegLeaf2 = errorDir.make<TH1I>("errorMissingHtD_HtXNegLeaf2", "missingHtD;Missing H_{T} X NegLeaf2;Number of Events", 4096, -2048.5, 2047.5);
1504  TH1I *errorMissingHtD_HtXNegLeaf3 = errorDir.make<TH1I>("errorMissingHtD_HtXNegLeaf3", "missingHtD;Missing H_{T} X NegLeaf3;Number of Events", 4096, -2048.5, 2047.5);
1505 
1506  TH1I *errorMissingHtD_HtYPosLeaf1 = errorDir.make<TH1I>("errorMissingHtD_HtYPosLeaf1", "missingHtD;Missing H_{T} Y PosLeaf1;Number of Events", 4096, -2048.5, 2047.5);
1507  TH1I *errorMissingHtD_HtYPosLeaf2 = errorDir.make<TH1I>("errorMissingHtD_HtYPosLeaf2", "missingHtD;Missing H_{T} Y PosLeaf2;Number of Events", 4096, -2048.5, 2047.5);
1508  TH1I *errorMissingHtD_HtYPosLeaf3 = errorDir.make<TH1I>("errorMissingHtD_HtYPosLeaf3", "missingHtD;Missing H_{T} Y PosLeaf3;Number of Events", 4096, -2048.5, 2047.5);
1509  TH1I *errorMissingHtD_HtYNegLeaf1 = errorDir.make<TH1I>("errorMissingHtD_HtYNegLeaf1", "missingHtD;Missing H_{T} Y NegLeaf1;Number of Events", 4096, -2048.5, 2047.5);
1510  TH1I *errorMissingHtD_HtYNegLeaf2 = errorDir.make<TH1I>("errorMissingHtD_HtYNegLeaf2", "missingHtD;Missing H_{T} Y NegLeaf2;Number of Events", 4096, -2048.5, 2047.5);
1511  TH1I *errorMissingHtD_HtYNegLeaf3 = errorDir.make<TH1I>("errorMissingHtD_HtYNegLeaf3", "missingHtD;Missing H_{T} Y NegLeaf3;Number of Events", 4096, -2048.5, 2047.5);
1512 
1513  for(unsigned int i=0; i<intMissingHtD->size(); i++) {
1514  if(intMissingHtD->at(i).bx() == GCTTrigBx_) {
1515  if(!intMissingHtD->at(i).overflow()) {
1516 
1517  if(intMissingHtD->at(i).capBlock() == 0x301 && intMissingHtD->at(i).capIndex() == 0 && intMissingHtD->at(i).isThereHtx()) errorMissingHtD_HtXPosLeaf1->Fill(intMissingHtD->at(i).htx());
1518  if(intMissingHtD->at(i).capBlock() == 0x301 && intMissingHtD->at(i).capIndex() == 1 && intMissingHtD->at(i).isThereHtx()) errorMissingHtD_HtXPosLeaf2->Fill(intMissingHtD->at(i).htx());
1519  if(intMissingHtD->at(i).capBlock() == 0x301 && intMissingHtD->at(i).capIndex() == 2 && intMissingHtD->at(i).isThereHtx()) errorMissingHtD_HtXPosLeaf3->Fill(intMissingHtD->at(i).htx());
1520  if(intMissingHtD->at(i).capBlock() == 0x701 && intMissingHtD->at(i).capIndex() == 0 && intMissingHtD->at(i).isThereHtx()) errorMissingHtD_HtXNegLeaf1->Fill(intMissingHtD->at(i).htx());
1521  if(intMissingHtD->at(i).capBlock() == 0x701 && intMissingHtD->at(i).capIndex() == 1 && intMissingHtD->at(i).isThereHtx()) errorMissingHtD_HtXNegLeaf2->Fill(intMissingHtD->at(i).htx());
1522  if(intMissingHtD->at(i).capBlock() == 0x701 && intMissingHtD->at(i).capIndex() == 2 && intMissingHtD->at(i).isThereHtx()) errorMissingHtD_HtXNegLeaf3->Fill(intMissingHtD->at(i).htx());
1523 
1524  if(intMissingHtD->at(i).capBlock() == 0x301 && intMissingHtD->at(i).capIndex() == 0 && intMissingHtD->at(i).isThereHty()) errorMissingHtD_HtYPosLeaf1->Fill(intMissingHtD->at(i).hty());
1525  if(intMissingHtD->at(i).capBlock() == 0x301 && intMissingHtD->at(i).capIndex() == 1 && intMissingHtD->at(i).isThereHty()) errorMissingHtD_HtYPosLeaf2->Fill(intMissingHtD->at(i).hty());
1526  if(intMissingHtD->at(i).capBlock() == 0x301 && intMissingHtD->at(i).capIndex() == 2 && intMissingHtD->at(i).isThereHty()) errorMissingHtD_HtYPosLeaf3->Fill(intMissingHtD->at(i).hty());
1527  if(intMissingHtD->at(i).capBlock() == 0x701 && intMissingHtD->at(i).capIndex() == 0 && intMissingHtD->at(i).isThereHty()) errorMissingHtD_HtYNegLeaf1->Fill(intMissingHtD->at(i).hty());
1528  if(intMissingHtD->at(i).capBlock() == 0x701 && intMissingHtD->at(i).capIndex() == 1 && intMissingHtD->at(i).isThereHty()) errorMissingHtD_HtYNegLeaf2->Fill(intMissingHtD->at(i).hty());
1529  if(intMissingHtD->at(i).capBlock() == 0x701 && intMissingHtD->at(i).capIndex() == 2 && intMissingHtD->at(i).isThereHty()) errorMissingHtD_HtYNegLeaf3->Fill(intMissingHtD->at(i).hty());
1530  }
1531  }
1532  }
1533  }
1534  }
1535 
1536  if(checkCollections(intJetsE, NUM_INT_JETS, "Intermediate Jets Emulator")) {
1537  TH2I *errorIntJetsE_EtEtaPhi = errorDir.make<TH2I>("errorIntJetsE_EtEtaPhi", "errorIntJetsE_EtEtaPhi;#eta (GCT Units);#phi (GCT Units)", 22, -0.5, 21.5, 18, -0.5, 17.5);
1538 
1539  for(unsigned int i=0; i < intJetsE->size(); i++) {
1540  if(intJetsE->at(i).bx() == EmuTrigBx_) {
1541  if(!intJetsE->at(i).oflow() && intJetsE->at(i).et()) errorIntJetsE_EtEtaPhi->Fill(intJetsE->at(i).regionId().ieta(),intJetsE->at(i).regionId().iphi(),intJetsE->at(i).et());
1542  }
1543  }
1544  }
1545 
1546  for(unsigned int i=0;i<caloRegions->size();i++) {
1547  if(caloRegions->at(i).bx() == RCTTrigBx_) {
1548  if(caloRegions->at(i).et()>0) errorRegionEtEtaPhi_->Fill(caloRegions->at(i).gctEta(),caloRegions->at(i).gctPhi(),caloRegions->at(i).et());
1549  if(caloRegions->at(i).overFlow()) errorRegionOfEtaPhi_->Fill(caloRegions->at(i).gctEta(),caloRegions->at(i).gctPhi());
1550  }
1551  }
1552 
1553  //plot the data candidates relating to this mismatch
1554  for(unsigned int i=0; i < missingEtD->size(); i++) {
1555  if(missingEtD->at(i).bx() == GCTTrigBx_) {
1556  errorMissingEtD_Of_->Fill(missingEtD->at(i).overFlow());
1557  if(!missingEtD->at(i).overFlow()) {
1558  errorMissingEtD_->Fill(missingEtD->at(i).et());
1559  errorMissingEtD_Phi_->Fill(missingEtD->at(i).phi());
1560  }
1561  }
1562  }
1563  for(unsigned int i=0; i < missingHtD->size(); i++) {
1564  if(missingHtD->at(i).bx() == GCTTrigBx_) {
1565  errorMissingHtD_Of_->Fill(missingHtD->at(i).overFlow());
1566  if(!missingHtD->at(i).overFlow()) {
1567  errorMissingHtD_->Fill(missingHtD->at(i).et());
1568  errorMissingHtD_Phi_->Fill(missingHtD->at(i).phi());
1569  }
1570  }
1571  }
1572  //and now for the emulator candidates
1573  for(unsigned int i=0; i < missingEtE->size(); i++) {
1574  if(missingEtE->at(i).bx() == EmuTrigBx_) {
1575  errorMissingEtE_Of_->Fill(missingEtE->at(i).overFlow());
1576  if(!missingEtE->at(i).overFlow()) {
1577  errorMissingEtE_->Fill(missingEtE->at(i).et());
1578  errorMissingEtE_Phi_->Fill(missingEtE->at(i).phi());
1579  }
1580  }
1581  }
1582  for(unsigned int i=0; i < missingHtE->size(); i++) {
1583  if(missingHtE->at(i).bx() == EmuTrigBx_) {
1584  errorMissingHtE_Of_->Fill(missingHtE->at(i).overFlow());
1585  if(!missingHtE->at(i).overFlow()) { //to see what values the emulator outputs despite the o/f bit being set comment out this statement
1586  errorMissingHtE_->Fill(missingHtE->at(i).et());
1587  errorMissingHtE_Phi_->Fill(missingHtE->at(i).phi());
1588  }
1589  }
1590  }
1591 }
1592 
1593 //define this as a plug-in
void plotHFErrors(const edm::Handle< L1GctHFRingEtSumsCollection > &hfRingSumsD, const edm::Handle< L1GctHFRingEtSumsCollection > &hfRingSumsE, const edm::Handle< L1GctHFBitCountsCollection > &hfBitCountsD, const edm::Handle< L1GctHFBitCountsCollection > &hfBitCountsE, const edm::Handle< L1CaloRegionCollection > &caloRegions)
unsigned int eventNumber
EventNumber_t event() const
Definition: EventID.h:41
int i
Definition: DBlmapReader.cc:9
TH1I * tauJetD_GlobalError_Rank_
void plotMissingHt(const edm::Handle< L1GctHtMissCollection > &missingHtD, const edm::Handle< L1GctHtMissCollection > &missingHtE)
bool doCompare(TH1I *errorFlag_hist_)
GctErrorAnalyzerMBxInfo MBxInfo
TH1I * nonIsoEgE_GlobalError_Rank_
TH2I * isoEgD_GlobalError_EtEtaPhi_
virtual void endJob() override
TH2I * forJetE_GlobalError_EtEtaPhi_
void plotHFBitCounts(const edm::Handle< L1GctHFBitCountsCollection > &hfBitCountsD, const edm::Handle< L1GctHFBitCountsCollection > &hfBitCountsE)
TH2I * cenJetD_GlobalError_EtEtaPhi_
const unsigned int GCT_SUMS_QUANTA
static bool sortJets(const jetData &jet1, const jetData &jet2)
void plotForJets(const edm::Handle< L1GctJetCandCollection > &data, const edm::Handle< L1GctJetCandCollection > &emu)
virtual void beginJob() override
void plotJetErrors(const edm::Handle< L1GctJetCandCollection > &cendata, const edm::Handle< L1GctJetCandCollection > &cenemu, const edm::Handle< L1GctJetCandCollection > &taudata, const edm::Handle< L1GctJetCandCollection > &tauemu, const edm::Handle< L1GctJetCandCollection > &fordata, const edm::Handle< L1GctJetCandCollection > &foremu, const edm::Handle< L1CaloRegionCollection > &regions)
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
compareMissingEnergySums< edm::Handle< L1GctHtMissCollection > > compareMissingH
TH1I * nonIsoEgD_GlobalError_Rank_
TH2I * cenJetE_GlobalError_EtEtaPhi_
void plotCenJets(const edm::Handle< L1GctJetCandCollection > &data, const edm::Handle< L1GctJetCandCollection > &emu)
compareCands< edm::Handle< L1GctEmCandCollection > > compareEG
bool doCompare(TH1I *errorFlag_hist_)
virtual void analyze(const edm::Event &, const edm::EventSetup &) override
bool doCompare(TH1I *errorFlag_hist_, TH1I *mismatchD_Rank, TH2I *mismatchD_EtEtaPhi, TH1I *mismatchE_Rank, TH2I *mismatchE_EtEtaPhi)
Definition: compareCands.h:50
void plotTotalH(const edm::Handle< L1GctEtHadCollection > &totalHtD, const edm::Handle< L1GctEtHadCollection > &totalHtE)
TH2I * forJetD_GlobalError_EtEtaPhi_
const unsigned int RCT_REGION_QUANTA_LAB
compareTotalEnergySums< edm::Handle< L1GctEtTotalCollection > > compareTotalE
void plotEGErrors(const edm::Handle< L1GctEmCandCollection > &dataiso, const edm::Handle< L1GctEmCandCollection > &emuiso, const edm::Handle< L1GctEmCandCollection > &datanoniso, const edm::Handle< L1GctEmCandCollection > &emunoniso, const edm::Handle< L1CaloEmCollection > &regions)
void plotTotalE(const edm::Handle< L1GctEtTotalCollection > &totalEtD, const edm::Handle< L1GctEtTotalCollection > &totalEtE)
int iEvent
Definition: GenABIO.cc:230
void plotTotalEErrors(const edm::Handle< L1GctEtTotalCollection > &totalEtD, const edm::Handle< L1GctEtTotalCollection > &totalEtE, const edm::Handle< L1GctEtHadCollection > &totalHtD, const edm::Handle< L1GctEtHadCollection > &totalHtE, const edm::Handle< L1CaloRegionCollection > &caloRegions)
void plotIsoEm(const edm::Handle< L1GctEmCandCollection > &data, const edm::Handle< L1GctEmCandCollection > &emu)
void plotNonIsoEm(const edm::Handle< L1GctEmCandCollection > &data, const edm::Handle< L1GctEmCandCollection > &emu)
GctErrorAnalyzer operator=(const GctErrorAnalyzer &)
compareCands< edm::Handle< L1GctJetCandCollection > > compareJets
void plotTauJets(const edm::Handle< L1GctJetCandCollection > &data, const edm::Handle< L1GctJetCandCollection > &emu)
compareTotalEnergySums< edm::Handle< L1GctEtHadCollection > > compareTotalH
void plotHFRingSums(const edm::Handle< L1GctHFRingEtSumsCollection > &data, const edm::Handle< L1GctHFRingEtSumsCollection > &emu)
int j
Definition: DBlmapReader.cc:9
void plotRCTRegions(const edm::Handle< L1CaloRegionCollection > &caloRegions)
TH1I * cenJetE_GlobalError_Rank_
void plotIntJets(const edm::Handle< L1GctInternJetDataCollection > &emu)
T * make(const Args &...args) const
make new ROOT object
edm::InputTag emuTag_
const unsigned int GCT_OBJECT_QUANTA
compareMissingEnergySums< edm::Handle< L1GctEtMissCollection > > compareMissingE
const unsigned int RCT_EM_OBJECT_QUANTA
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:418
TH2I * tauJetE_GlobalError_EtEtaPhi_
TH2I * nonIsoEgE_GlobalError_EtEtaPhi_
TH1I * forJetE_GlobalError_Rank_
TFileDirectory mkdir(const std::string &dir, const std::string &descr="")
create a new subdirectory
Definition: TFileService.h:69
TFileDirectory mkdir(const std::string &dir, const std::string &descr="")
create a new subdirectory
void plotMissingEt(const edm::Handle< L1GctEtMissCollection > &missingEtD, const edm::Handle< L1GctEtMissCollection > &missingEtE)
void plotMissingEErrors(const edm::Handle< L1GctEtMissCollection > &missingEtD, const edm::Handle< L1GctEtMissCollection > &missingEtE, const edm::Handle< L1GctHtMissCollection > &missingHtD, const edm::Handle< L1GctHtMissCollection > &missingHtE, edm::Handle< L1CaloRegionCollection > &caloRegions, const edm::Handle< L1GctInternJetDataCollection > &intjetsemu, const edm::Handle< L1GctInternHtMissCollection > intMissingHtD)
TH1I * cenJetD_GlobalError_Rank_
TH2I * isoEgE_GlobalError_EtEtaPhi_
edm::InputTag dataTag_
bool checkCollections(const T &collection, const unsigned int &constraint, const std::string &label)
std::string const & label() const
Definition: InputTag.h:36
edm::EventID id() const
Definition: EventBase.h:59
TH1I * forJetD_GlobalError_Rank_
std::vector< TFileDirectory > errorHistCat
const unsigned int RCT_REGION_QUANTA_P5
TH1I * tauJetE_GlobalError_Rank_
const unsigned int NUM_INT_JETS
TH2I * nonIsoEgD_GlobalError_EtEtaPhi_
bool doCompare(TH1I *errorFlag_hist_)
volatile std::atomic< bool > shutdown_flag false
const unsigned int GCT_INT_HTMISS_QUANTA
long double T
TH2I * tauJetD_GlobalError_EtEtaPhi_
bool doCompare(TH1I *errorFlag_hist_)
const unsigned int * RCT_REGION_QUANTA