CMS 3D CMS Logo

L1TStage2BMTF.cc
Go to the documentation of this file.
1 /*
2  * \L1TStage2BMTF.cc
3  * \author Esmaeel Eskandari Tadavani
4  * \December 2015
5 /G.karathanasis
6 */
7 
9 
11  monitorDir(ps.getUntrackedParameter<std::string>("monitorDir","")),
12  bmtfSource(ps.getParameter<edm::InputTag>("bmtfSource")),
13  // bmtfSourceTwinMux1(ps.getParameter<edm::InputTag>("bmtfSourceTwinMux1")),
14  // bmtfSourceTwinMux2(ps.getParameter<edm::InputTag>("bmtfSourceTwinMux2")),
15  verbose(ps.getUntrackedParameter<bool>("verbose", false)),
16  kalman(ps.getUntrackedParameter<bool>("kalman", false)),
17  global_phi(-1000)
18 {
19  bmtfToken=consumes<l1t::RegionalMuonCandBxCollection>(ps.getParameter<edm::InputTag>("bmtfSource"));
20  // bmtfTokenTwinMux1 = consumes<L1MuDTChambThContainer>(ps.getParameter<edm::InputTag>("bmtfSourceTwinMux1"));
21  // bmtfTokenTwinMux2 = consumes<L1MuDTChambPhContainer>(ps.getParameter<edm::InputTag>("bmtfSourceTwinMux2"));
22 
23 }
24 
26 {
27 }
28 
29 void L1TStage2BMTF::dqmBeginRun(const edm::Run& iRrun, const edm::EventSetup& eveSetup)
30 {
31 }
32 
33 
34 void L1TStage2BMTF::bookHistograms(DQMStore::IBooker &ibooker, const edm::Run& iRun, const edm::EventSetup& eveSetup)
35 {
36  std::string histoPrefix = "bmtf";
37  if (kalman) {
38  histoPrefix = "kbmtf";
39  }
40 
41  int ptbins = 512;
42  int hwQual_bxbins = 20;
43  if (kalman) {
44  ptbins = 522;
45  hwQual_bxbins = 15;
46  }
47 
49  bmtf_hwEta = ibooker.book1D(histoPrefix+"_hwEta", "HW #eta", 461, -230.5, 230.5);
50  bmtf_hwLocalPhi = ibooker.book1D(histoPrefix+"_hwLocalPhi", "HW Local #phi", 201, -100.5, 100.5);
51  bmtf_hwGlobalPhi = ibooker.book1D(histoPrefix+"_hwGlobalPhi", "HW Global #phi", 576, -0.5, 575.5);
52  bmtf_hwPt = ibooker.book1D(histoPrefix+"_hwPt", "HW p_{T}", ptbins, -0.5, ptbins-0.5);
53  bmtf_hwQual= ibooker.book1D(histoPrefix+"_hwQual" , "HW Quality", 20, -0.5, 19.5);
54  bmtf_proc = ibooker.book1D(histoPrefix+"_proc" , "Processor", 12, -0.5, 11.5);
55 
56  bmtf_wedge_bx = ibooker.book2D(histoPrefix+"_wedge_bx", "Wedge vs BX", 12, -0.5, 11.5, 5, -2.5, 2.5);
57  bmtf_wedge_bx->setTitle(";Wedge; BX");
58  for (int bin = 1; bin < 13; ++bin) {
59  bmtf_wedge_bx->setBinLabel(bin, std::to_string(bin), 1);
60  }
61 
62  bmtf_hwEta_hwLocalPhi = ibooker.book2D(histoPrefix+"_hwEta_hwLocalPhi", "HW #eta vs HW Local #phi" , 461, -230.5, 230.5, 201, -100.5, 100.5);
63  bmtf_hwEta_hwLocalPhi->setTitle(";HW #eta; HW Local #phi");
64 
65  bmtf_hwEta_hwGlobalPhi = ibooker.book2D(histoPrefix+"_hwEta_hwGlobalPhi", "HW #eta vs HW Global #phi" , 100, -230.5, 230.5, 120, -0.5, 575.5);
66  bmtf_hwEta_hwGlobalPhi->setTitle(";HW #eta; HW Global #phi");
67 
68  bmtf_hwPt_hwEta = ibooker.book2D(histoPrefix+"_hwPt_hwEta" , "HW p_{T} vs HW #eta", 511, -0.5, 510.5, 461, -230.5, 230.5);
69  bmtf_hwPt_hwEta->setTitle(";HW p_{T}; HW #eta");
70 
71  bmtf_hwPt_hwLocalPhi = ibooker.book2D(histoPrefix+"_hwPt_hwLocalPhi" , "HW p_{T} vs HW Local #phi", 511, -0.5, 510.5, 201, -100.5, 100.5);
72  bmtf_hwPt_hwLocalPhi->setTitle(";HW p_{T}; HW Local #phi");
73 
74  bmtf_hwEta_bx = ibooker.book2D(histoPrefix+"_hwEta_bx" , "HW #eta vs BX" , 461, -230.5, 230.5, 5, -2.5, 2.5);
75  bmtf_hwEta_bx->setTitle(";HW #eta; BX");
76 
77  bmtf_hwLocalPhi_bx = ibooker.book2D(histoPrefix+"_hwLocalPhi_bx" , "HW Local #phi vs BX" , 201, -100.5, 100.5, 5, -2.5, 2.5);
78  bmtf_hwLocalPhi_bx->setTitle(";HW Local #phi; BX");
79 
80  bmtf_hwPt_bx = ibooker.book2D(histoPrefix+"_hwPt_bx" , "HW p_{T} vs BX" , 511, -0.5, 510.5, 5, -2.5, 2.5);
81  bmtf_hwPt_bx->setTitle(";HW p_{T}; BX");
82 
83  bmtf_hwQual_bx = ibooker.book2D(histoPrefix+"_hwQual_bx" , "HW Quality vs BX" , hwQual_bxbins, -0.5, hwQual_bxbins-0.5, 5, -2.5, 2.5);
84  bmtf_hwQual_bx->setTitle("; HW Quality; BX");
85 
86  bmtf_hwDXY = ibooker.book1D(histoPrefix+"_hwDXY", "HW DXY", 4, 0, 4);
87  bmtf_hwPt2 = ibooker.book1D(histoPrefix+"_hwPt2", "HW p_{T}2", 512, -0.5, 511.5);
88 
89  // bmtf_twinmuxInput_PhiBX = ibooker.book1D(histoPrefix+"_twinmuxInput_PhiBX" , "TwinMux Input Phi BX" , 5, -2.5, 2.5);
90  // bmtf_twinmuxInput_PhiPhi = ibooker.book1D(histoPrefix+"_twinmuxInput_PhiPhi" , "TwinMux Input Phi HW Phi" , 201, -100.5, 100.5);
91  // bmtf_twinmuxInput_PhiPhiB = ibooker.book1D(histoPrefix+"_twinmuxInput_PhiPhiB" , "TwinMux Input Phi HW PhiB" , 201, -100.5, 100.5);
92  // bmtf_twinmuxInput_PhiQual = ibooker.book1D(histoPrefix+"_twinmuxInput_PhiQual" , "TwinMux Input Phi HW Quality" , 20, -0.5, 19.5);
93  // bmtf_twinmuxInput_PhiStation = ibooker.book1D(histoPrefix+"_twinmuxInput_PhiStation" , "TwinMux Input Phi HW Station", 6, -1, 5);
94  // bmtf_twinmuxInput_PhiSector = ibooker.book1D(histoPrefix+"_twinmuxInput_PhiSector" , "TwinMux Input Phi HW Sector" , 14, -1, 13 );
95  // bmtf_twinmuxInput_PhiWheel = ibooker.book1D(histoPrefix+"_twinmuxInput_PhiWheel" , "TwinMux Input Phi HW Wheel" , 16 , -4, 4);
96  // bmtf_twinmuxInput_PhiTrSeg = ibooker.book1D(histoPrefix+"_twinmuxInput_PhiTrSeg" , "TwinMux Input Phi HW Track Segment" , 6, -1, 5 );
97  // bmtf_twinmuxInput_PhiWheel_PhiSector = ibooker.book2D(histoPrefix+"_twinmuxInput_PhiWheel_PhiSector" , "TwinMux Input Phi HW Wheel vs HW Sector", 16 , -4, 4, 14, -1, 13 );
98 
99  // bmtf_twinmuxInput_PhiWheel_PhiSector->setTitle("; TwinMux Input Phi HW Wheel; TwinMux Input Phi HW Sector");
100  // for (int bin = 1; bin < 5; ++bin) {
101  // bmtf_twinmuxInput_PhiWheel_PhiSector->setBinLabel(bin, "station"+std::to_string(bin), 1);
102  // bmtf_twinmuxInput_PhiTrSeg->setBinLabel(bin, "station"+std::to_string(bin), 1);
103  // }
104 
105  // bmtf_twinmuxInput_TheBX = ibooker.book1D(histoPrefix+"_twinmuxInput_TheBX" , "TwinMux Input The BX" , 5, -2.5, 2.5);
106  // bmtf_twinmuxInput_ThePhi= ibooker.book1D(histoPrefix+"_twinmuxInput_ThePhi" , "TwinMux Input The HW Phi" , 201, -100.5, 100.5);
107  // bmtf_twinmuxInput_ThePhiB = ibooker.book1D(histoPrefix+"_twinmuxInput_ThePhiB" , "TwinMux Input The HW PhiB" , 201, -100.5, 100.5);
108  // bmtf_twinmuxInput_TheQual = ibooker.book1D(histoPrefix+"_twinmuxInput_TheQual" , "TwinMux Input The HW Quality" , 20, -0.5, 19.5);
109  // bmtf_twinmuxInput_TheStation = ibooker.book1D(histoPrefix+"_twinmuxInput_TheStation" , "TwinMux Input The HW Station" , 6, -1, 5);
110  // bmtf_twinmuxInput_TheSector = ibooker.book1D(histoPrefix+"_twinmuxInput_TheSector" , "TwinMux Input The HW Sector" , 14, -1, 13 );
111  // bmtf_twinmuxInput_TheWheel = ibooker.book1D(histoPrefix+"_twinmuxInput_TheWheel" , "TwinMux Input The HW Wheel" , 16 , -4, 4);
112  // bmtf_twinmuxInput_TheTrSeg = ibooker.book1D(histoPrefix+"_twinmuxInput_TheTrSeg" , "TwinMux Input The HW Track Segment" , 6, -1, 5 );
113  // bmtf_twinmuxInput_TheWheel_TheSector = ibooker.book2D(histoPrefix+"_twinmuxInput_TheWheel_TheSector" , "TwinMux Input The HW Wheel vs HW Sector", 16 , -4, 4, 14, -1, 13);
114 
115  // bmtf_twinmuxInput_TheWheel_TheSector->setTitle("; TwinMux Input The HW Wheel; TwinMux Input The HW Sector");
116  // for (int bin = 1; bin < 5; ++bin) {
117  // bmtf_twinmuxInput_TheWheel_TheSector->setBinLabel(bin, "station"+std::to_string(bin), 1);
118  // bmtf_twinmuxInput_TheTrSeg->setBinLabel(bin, "station"+std::to_string(bin), 1);
119  // }
120 
121 }
122 
123 void L1TStage2BMTF::analyze(const edm::Event & eve, const edm::EventSetup & eveSetup)
124 {
125 
127  eve.getByToken(bmtfToken, bmtfMuon);
128 
129  // edm::Handle<L1MuDTChambThContainer> bmtfMuonTwinMux1;
130  // eve.getByToken(bmtfTokenTwinMux1, bmtfMuonTwinMux1);
131 
132  // edm::Handle<L1MuDTChambPhContainer> bmtfMuonTwinMux2;
133  // eve.getByToken(bmtfTokenTwinMux2, bmtfMuonTwinMux2);
134 
135  for(int itBX=bmtfMuon->getFirstBX(); itBX<=bmtfMuon->getLastBX(); ++itBX)
136  {
137  for(l1t::RegionalMuonCandBxCollection::const_iterator itMuon = bmtfMuon->begin(itBX); itMuon != bmtfMuon->end(itBX); ++itMuon)
138  {
139 
140  bmtf_hwEta->Fill(itMuon->hwEta());
141  bmtf_hwLocalPhi->Fill(itMuon->hwPhi());
142  bmtf_hwPt->Fill(itMuon->hwPt());
143  bmtf_hwQual->Fill(itMuon->hwQual());
144  bmtf_proc->Fill(itMuon->processor());
145 
146  bmtf_hwDXY->Fill(itMuon->hwDXY());
147  bmtf_hwPt2->Fill(itMuon->hwPt2());
148 
149  if (fabs(bmtfMuon->getLastBX()-bmtfMuon->getFirstBX())>3){
150  bmtf_wedge_bx->Fill(itMuon->processor(), itBX);
151  bmtf_hwEta_bx->Fill(itMuon->hwEta(), itBX);
152  bmtf_hwLocalPhi_bx->Fill(itMuon->hwPhi(), itBX);
153  bmtf_hwPt_bx->Fill(itMuon->hwPt(), itBX);
154  bmtf_hwQual_bx->Fill(itMuon->hwQual(), itBX);}
155 
156  bmtf_hwEta_hwLocalPhi->Fill(itMuon->hwEta(),itMuon->hwPhi());
157  bmtf_hwPt_hwEta->Fill(itMuon->hwPt(), itMuon->hwEta());
158  bmtf_hwPt_hwLocalPhi->Fill(itMuon->hwPt(), itMuon->hwPhi());
159 
160  /*if(itMuon->hwPhi()*0.010902>=0 && itMuon->hwPhi()*0.010902<=30)
161  global_phi = itMuon->hwPhi() + itMuon->processor()*30.;
162  if(itMuon->hwPhi()*0.010902<0)
163  global_phi = 30-itMuon->hwPhi() + (itMuon->processor()-1)*30.;
164  if(itMuon->hwPhi()*0.010902>30)
165  global_phi = itMuon->hwPhi()-30 + (itMuon->processor()+1)*30.;*/
166  global_phi= itMuon->hwPhi() + itMuon->processor()*48.-15;
167  if (global_phi<0) global_phi=576+global_phi;
168 
170  bmtf_hwEta_hwGlobalPhi->Fill(itMuon->hwEta(), global_phi);
171  }
172  }
173 
174  // for(L1MuDTChambThContainer::The_Container::const_iterator itMuon = bmtfMuonTwinMux1->getContainer()->begin(); itMuon != bmtfMuonTwinMux1->getContainer()->end(); ++itMuon)
175  // {
176 
177  // bmtf_twinmuxInput_TheBX->Fill(itMuon->bxNum());
178  // // bmtf_twinmuxInput_ThePhi->Fill(itMuon->phi());
179  // // bmtf_twinmuxInput_ThePhiB->Fill(itMuon->phiB());
180  // // bmtf_twinmuxInput_TheQual->Fill(itMuon->code());
181  // bmtf_twinmuxInput_TheStation->Fill(itMuon->stNum());
182  // bmtf_twinmuxInput_TheSector->Fill(itMuon->scNum());
183  // bmtf_twinmuxInput_TheWheel->Fill(itMuon->whNum());
184 
185  // for(int i = 1; i<=itMuon->stNum(); ++i)
186  // {
187  // // bmtf_twinmuxInput_TheTrSeg->Fill(itMuon->Ts2Tag());
188  // bmtf_twinmuxInput_TheWheel_TheSector->Fill(itMuon->whNum(), itMuon->scNum());
189  // }
190 
191  // }
192 
193  // for(L1MuDTChambPhContainer::Phi_Container::const_iterator itMuon = bmtfMuonTwinMux2->getContainer()->begin(); itMuon != bmtfMuonTwinMux2->getContainer()->end(); ++itMuon)
194  // {
195 
196  // bmtf_twinmuxInput_PhiBX->Fill(itMuon->bxNum());
197  // bmtf_twinmuxInput_PhiPhi->Fill(itMuon->phi());
198  // bmtf_twinmuxInput_PhiPhiB->Fill(itMuon->phiB());
199  // bmtf_twinmuxInput_PhiQual->Fill(itMuon->code());
200  // bmtf_twinmuxInput_PhiStation->Fill(itMuon->stNum());
201  // bmtf_twinmuxInput_PhiSector->Fill(itMuon->scNum());
202  // bmtf_twinmuxInput_PhiWheel->Fill(itMuon->whNum());
203 
204  // for(int i = 1; i<= itMuon->stNum() ; ++i)
205  // {
206  // bmtf_twinmuxInput_PhiTrSeg->Fill(itMuon->Ts2Tag());
207  // bmtf_twinmuxInput_PhiWheel_PhiSector->Fill(itMuon->whNum(), itMuon->scNum());
208  // }
209 
210 
211  // }
212 
213 }
214 
215 
216 
217 
218 
219 
220 
221 
const_iterator end(int bx) const
T getParameter(std::string const &) const
MonitorElement * bmtf_hwPt_hwLocalPhi
Definition: L1TStage2BMTF.h:95
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:517
MonitorElement * bmtf_hwEta_hwGlobalPhi
Definition: L1TStage2BMTF.h:92
std::string monitorDir
Definition: L1TStage2BMTF.h:72
L1TStage2BMTF(const edm::ParameterSet &ps)
MonitorElement * bmtf_hwEta_hwLocalPhi
Definition: L1TStage2BMTF.h:91
void setBinLabel(int bin, const std::string &label, int axis=1)
set bin label for x, y or z axis (axis=1, 2, 3 respectively)
void analyze(const edm::Event &, const edm::EventSetup &) override
edm::EDGetToken bmtfToken
Definition: L1TStage2BMTF.h:78
void Fill(long long x)
MonitorElement * bmtf_hwQual_bx
MonitorElement * bmtf_hwLocalPhi_bx
Definition: L1TStage2BMTF.h:98
void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:268
MonitorElement * book1D(Args &&...args)
Definition: DQMStore.h:106
MonitorElement * bmtf_hwGlobalPhi
Definition: L1TStage2BMTF.h:85
MonitorElement * bmtf_hwDXY
bin
set the eta bin as selection string.
void setTitle(const std::string &title)
set (ie. change) histogram/profile title
int getFirstBX() const
MonitorElement * bmtf_wedge_bx
Definition: L1TStage2BMTF.h:90
MonitorElement * book2D(Args &&...args)
Definition: DQMStore.h:109
void bookHistograms(DQMStore::IBooker &, const edm::Run &, const edm::EventSetup &) override
~L1TStage2BMTF() override
MonitorElement * bmtf_hwQual
Definition: L1TStage2BMTF.h:87
MonitorElement * bmtf_hwPt_hwEta
Definition: L1TStage2BMTF.h:94
HLT enums.
int getLastBX() const
MonitorElement * bmtf_hwPt_bx
Definition: L1TStage2BMTF.h:99
MonitorElement * bmtf_hwEta
Definition: L1TStage2BMTF.h:83
MonitorElement * bmtf_hwPt2
MonitorElement * bmtf_proc
Definition: L1TStage2BMTF.h:88
MonitorElement * bmtf_hwPt
Definition: L1TStage2BMTF.h:86
MonitorElement * bmtf_hwEta_bx
Definition: L1TStage2BMTF.h:97
const_iterator begin(int bx) const
MonitorElement * bmtf_hwLocalPhi
Definition: L1TStage2BMTF.h:84
Definition: Run.h:45
std::vector< RegionalMuonCand >::const_iterator const_iterator
Definition: BXVector.h:20
void dqmBeginRun(const edm::Run &, const edm::EventSetup &) override