CMS 3D CMS Logo

L1ABCDebugger.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: SiStripTools
4 // Class: L1ABCDebugger
5 //
13 //
14 // Original Author: Andrea Venturi
15 // Created: Tue Jul 19 11:56:00 CEST 2009
16 //
17 //
18 
19 
20 // system include files
21 #include <memory>
22 
23 // user include files
24 #include "TH2F.h"
25 #include "TProfile.h"
27 
28 #include <vector>
29 #include <string>
30 
33 
37 
40 
42 
44 //
45 // class decleration
46 //
47 
49  public:
50  explicit L1ABCDebugger(const edm::ParameterSet&);
51  ~L1ABCDebugger() override;
52 
53 
54 private:
55  void beginJob() override ;
56  void analyze(const edm::Event&, const edm::EventSetup&) override;
57  void beginRun(const edm::Run&, const edm::EventSetup&) override;
58  void endJob() override ;
59 
60  // ----------member data ---------------------------
61 
63  const unsigned int m_maxLS;
64  const unsigned int m_LSfrac;
65 
67 
68  TH2F** m_hoffsets;
69  TProfile** m_horboffvsorb;
70  TProfile** m_hbxoffvsorb;
71 
72 
73 };
74 
75 //
76 // constants, enums and typedefs
77 //
78 
79 //
80 // static data member definitions
81 //
82 
83 //
84 // constructors and destructor
85 //
87  m_l1abccollectionToken(consumes<L1AcceptBunchCrossingCollection>(iConfig.getParameter<edm::InputTag>("l1ABCCollection"))),
88  m_maxLS(iConfig.getUntrackedParameter<unsigned int>("maxLSBeforeRebin",250)),
89  m_LSfrac(iConfig.getUntrackedParameter<unsigned int>("startingLSFraction",16)),
91 {
92  //now do what ever initialization is needed
93 
94  m_hoffsets = m_rhm.makeTH2F("offsets","Orbit vs BX offsets between SCAL and Event",2*3564+1,-3564.5,3564.5,201,-100.5,100.5);
95  m_horboffvsorb = m_rhm.makeTProfile("orboffvsorb","SCAL Orbit offset vs orbit number",m_LSfrac*m_maxLS,0,m_maxLS*262144);
96  m_hbxoffvsorb = m_rhm.makeTProfile("bxoffvsorb","SCAL BX offset vs orbit number",m_LSfrac*m_maxLS,0,m_maxLS*262144);
97 
98 }
99 
100 
102 {
103 
104  // do anything here that needs to be done at desctruction time
105  // (e.g. close files, deallocate resources etc.)
106 
107 }
108 
109 
110 //
111 // member functions
112 //
113 
114 // ------------ method called to for each event ------------
115 void
117 {
118  using namespace edm;
119 
122 
123  // offset computation
124  for(L1AcceptBunchCrossingCollection::const_iterator l1abc=pIn->begin();l1abc!=pIn->end();++l1abc) {
125  if(l1abc->l1AcceptOffset()==0) {
126  if(m_hoffsets && *m_hoffsets)
127  (*m_hoffsets)->Fill((int)l1abc->bunchCrossing()-(int)iEvent.bunchCrossing(),
128  (long long)l1abc->orbitNumber()-(long long)iEvent.orbitNumber());
130  (*m_horboffvsorb)->Fill(iEvent.orbitNumber(),(long long)l1abc->orbitNumber()-(long long)iEvent.orbitNumber());
132  (*m_hbxoffvsorb)->Fill(iEvent.orbitNumber(),(int)l1abc->bunchCrossing()-(int)iEvent.bunchCrossing());
133  }
134  }
135 
136 
137  // dump of L1ABC collection
138 
139  edm::LogInfo("L1ABCDebug") << "Dump of L1AcceptBunchCrossing Collection for event in orbit "
140  << iEvent.orbitNumber() << " and BX " << iEvent.bunchCrossing();
141 
142  for(L1AcceptBunchCrossingCollection::const_iterator l1abc=pIn->begin();l1abc!=pIn->end();++l1abc) {
143  edm::LogVerbatim("L1ABCDebug") << *l1abc;
144  }
145 
146 }
147 
148 void
149 L1ABCDebugger::beginRun(const edm::Run& iRun, const edm::EventSetup& iSetup) {
150 
151  m_rhm.beginRun(iRun);
152 
153  if(m_hoffsets && *m_hoffsets) {
154  (*m_hoffsets)->GetXaxis()->SetTitle("#Delta BX (SCAL-Event)"); (*m_hoffsets)->GetYaxis()->SetTitle("#Delta orbit (SCAL-Event)");
155  }
157  (*m_horboffvsorb)->GetXaxis()->SetTitle("Orbit"); (*m_horboffvsorb)->GetYaxis()->SetTitle("#Delta orbit (SCAL-Event)");
158  (*m_horboffvsorb)->SetCanExtend(TH1::kXaxis);
159  }
160  if(m_hbxoffvsorb && *m_hbxoffvsorb) {
161  (*m_hbxoffvsorb)->GetXaxis()->SetTitle("Orbit"); (*m_hbxoffvsorb)->GetYaxis()->SetTitle("#Delta BX (SCAL-Event)");
162  (*m_hbxoffvsorb)->SetCanExtend(TH1::kXaxis);
163  }
164 
165 
166 }
167 // ------------ method called once each job just before starting event loop ------------
168 void
170 {
171 
172 }
173 
174 // ------------ method called once each job just after ending the event loop ------------
175 void
177 {
178 }
179 
180 
181 //define this as a plug-in
TH2F ** m_hoffsets
const unsigned int m_maxLS
~L1ABCDebugger() override
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:519
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
RunHistogramManager m_rhm
int bunchCrossing() const
Definition: EventBase.h:66
edm::EDGetTokenT< L1AcceptBunchCrossingCollection > m_l1abccollectionToken
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
void analyze(const edm::Event &, const edm::EventSetup &) override
const unsigned int m_LSfrac
int iEvent
Definition: GenABIO.cc:230
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
TProfile ** m_hbxoffvsorb
TProfile ** makeTProfile(const char *name, const char *title, const unsigned int nbinx, const double xmin, const double xmax)
L1ABCDebugger(const edm::ParameterSet &)
std::vector< L1AcceptBunchCrossing > L1AcceptBunchCrossingCollection
int orbitNumber() const
Definition: EventBase.h:67
void endJob() override
void beginJob() override
void beginRun(const edm::Run &iRun)
HLT enums.
TProfile ** m_horboffvsorb
TH2F ** makeTH2F(const char *name, const char *title, const unsigned int nbinx, const double xmin, const double xmax, const unsigned int nbiny, const double ymin, const double ymax)
Definition: Run.h:43
void beginRun(const edm::Run &, const edm::EventSetup &) override