CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
RPCDigiValid.cc
Go to the documentation of this file.
6 
12 #include <cmath>
13 
14 using namespace std;
15 using namespace edm;
16 
18  dbe_(0)
19 {
20 
21 // Init the tokens for run data retrieval - stanislav
22 // ps.getUntackedParameter<InputTag> retrieves a InputTag from the configuration. The second param is default value
23 // module, instance and process labels may be passed in a single string if separated by colon ':'
24 // (@see the edm::InputTag constructor documentation)
25  simHitToken = consumes<PSimHitContainer>(ps.getUntrackedParameter<edm::InputTag >("simHitTag", edm::InputTag("g4SimHits:MuonRPCHits")));
26  rpcDigiToken = consumes<RPCDigiCollection>(ps.getUntrackedParameter<edm::InputTag>("rpcDigiTag", edm::InputTag("simMuonRPCDigis")));
27 
28  outputFile_ = ps.getUntrackedParameter<string> ("outputFile", "rpcDigiValidPlots.root");
30 }
31 
33 {
34 }
35 
36 
37 void RPCDigiValid::analyze(const Event& event, const EventSetup& eventSetup)
38 {
39 
40  // Get the RPC Geometry
42  eventSetup.get<MuonGeometryRecord> ().get(rpcGeom);
43 
46  event.getByToken(simHitToken, simHit);
47  event.getByToken(rpcDigiToken, rpcDigis);
48 
49  // Loop on simhits
50  PSimHitContainer::const_iterator simIt;
51 
52  //loop over Simhit
53  std::map<RPCDetId, std::vector<double> > allsims;
54 
55  for (simIt = simHit->begin(); simIt != simHit->end(); simIt++)
56  {
57  RPCDetId Rsid = (RPCDetId)(*simIt).detUnitId();
58  const RPCRoll* soll = dynamic_cast<const RPCRoll*> (rpcGeom->roll(Rsid));
59  int ptype = simIt->particleType();
60 
61  if (ptype == 13 || ptype == -13)
62  {
63 
64  std::vector<double> buff;
65  if (allsims.find(Rsid) != allsims.end())
66  {
67  buff = allsims[Rsid];
68  }
69 
70  buff.push_back(simIt->localPosition().x());
71 
72  allsims[Rsid] = buff;
73  }
74  GlobalPoint p = soll->toGlobal(simIt->localPosition());
75 
76  double sim_x = p.x();
77  double sim_y = p.y();
78 
79  xyview->Fill(sim_x, sim_y);
80 
81  if (Rsid.region() == (+1))
82  {
83  if (Rsid.station() == 4)
84  {
85  xyvDplu4->Fill(sim_x, sim_y);
86  }
87  }
88  else if (Rsid.region() == (-1))
89  {
90  if (Rsid.station() == 4)
91  {
92  xyvDmin4->Fill(sim_x, sim_y);
93  }
94  }
95  rzview->Fill(p.z(), p.perp());
96  }
97  //loop over Digis
99  for (detUnitIt = rpcDigis->begin(); detUnitIt != rpcDigis->end(); ++detUnitIt)
100  {
101  const RPCDetId Rsid = (*detUnitIt).first;
102  const RPCRoll* roll = dynamic_cast<const RPCRoll*> (rpcGeom->roll(Rsid));
103 
104  const RPCDigiCollection::Range& range = (*detUnitIt).second;
105  std::vector<double> sims;
106  if (allsims.find(Rsid) != allsims.end())
107  {
108  sims = allsims[Rsid];
109  }
110 
111  int ndigi=0;
112  for (RPCDigiCollection::const_iterator digiIt = range.first; digiIt != range.second; ++digiIt)
113  {
114  StripProf->Fill(digiIt->strip());
115  BxDist->Fill(digiIt->bx());
116  //bx for 4 endcaps
117  if (Rsid.region() == (+1))
118  {
119  if (Rsid.station() == 4)
120  BxDisc_4Plus->Fill(digiIt->bx());
121  }
122  else if (Rsid.region() == (-1))
123  {
124  if (Rsid.station() == 4)
125  BxDisc_4Min->Fill(digiIt->bx());
126  }
127  ndigi++;
128  }
129 
130  if (sims.size() == 0)
131  {
132  noiseCLS->Fill(ndigi);
133  if (Rsid.region() == 0)
134  {
135  noiseCLSBarrel->Fill(ndigi);
136  }
137  if (Rsid.region() == +1 || Rsid.region() == 1)
138  {
139  noiseCLSEndcaps->Fill(ndigi);
140  }
141  }
142  //CLS histos
143  if (Rsid.region() == 0)
144  {
145  clsBarrel->Fill(ndigi);
146  }
147  //endcap
148  if (Rsid.region() != 0)
149  {
150  if (Rsid.ring() == 2)
151  {
152  if (abs(Rsid.station()) == 1)
153  {
154  if (Rsid.roll() == 1)
155  CLS_Endcap_1_Ring2_A->Fill(ndigi);
156  if (Rsid.roll() == 2)
157  CLS_Endcap_1_Ring2_B->Fill(ndigi);
158  if (Rsid.roll() == 3)
159  CLS_Endcap_1_Ring2_C->Fill(ndigi);
160  }
161  if (abs(Rsid.station()) == 2 || abs(Rsid.station()) == 3)
162  {
163  if (Rsid.roll() == 1)
164  CLS_Endcap_23_Ring2_A->Fill(ndigi);
165  if (Rsid.roll() == 2)
166  CLS_Endcap_23_Ring2_B->Fill(ndigi);
167  if (Rsid.roll() == 3)
168  CLS_Endcap_23_Ring2_C->Fill(ndigi);
169  }
170  }
171  if (Rsid.ring() == 3)
172  {
173  if (Rsid.roll() == 1)
175  if (Rsid.roll() == 2)
177  if (Rsid.roll() == 3)
179  }
180  if (abs(Rsid.station()) == 4)
181  CLS_Endcap_4->Fill(ndigi);
182  }
183 
184  if (sims.size() == 1 && ndigi == 1)
185  {
186  double dis = roll->centreOfStrip(range.first->strip()).x() - sims[0];
187  Res->Fill(dis);
188 
189  if (Rsid.region() == 0)
190  {
191  if (Rsid.ring() == -2)
192  ResWmin2->Fill(dis);
193  else if (Rsid.ring() == -1)
194  ResWmin1->Fill(dis);
195  else if (Rsid.ring() == 0)
196  ResWzer0->Fill(dis);
197  else if (Rsid.ring() == 1)
198  ResWplu1->Fill(dis);
199  else if (Rsid.ring() == 2)
200  ResWplu2->Fill(dis);
201  //barrel layers
202  if (Rsid.station() == 1 && Rsid.layer() == 1)
203  ResLayer1_barrel->Fill(dis);
204  if (Rsid.station() == 1 && Rsid.layer() == 2)
205  ResLayer2_barrel->Fill(dis);
206  if (Rsid.station() == 2 && Rsid.layer() == 1)
207  ResLayer3_barrel->Fill(dis);
208  if (Rsid.station() == 2 && Rsid.layer() == 2)
209  ResLayer4_barrel->Fill(dis);
210  if (Rsid.station() == 3)
211  ResLayer5_barrel->Fill(dis);
212  if (Rsid.station() == 4)
213  ResLayer6_barrel->Fill(dis);
214  }
215  //endcap layers residuals
216  if (Rsid.region() != 0)
217  {
218  if (Rsid.ring() == 2)
219  {
220  if (abs(Rsid.station()) == 1)
221  {
222  if (Rsid.roll() == 1)
224  if (Rsid.roll() == 2)
226  if (Rsid.roll() == 3)
228  }
229  if (abs(Rsid.station()) == 2 || abs(Rsid.station()) == 3)
230  {
231  if (Rsid.roll() == 1)
233  if (Rsid.roll() == 2)
235  if (Rsid.roll() == 3)
237  }
238  }
239  if (Rsid.ring() == 3)
240  {
241  if (Rsid.roll() == 1)
243  if (Rsid.roll() == 2)
245  if (Rsid.roll() == 3)
247  }
248  }
249 
250  if (Rsid.region() == (+1))
251  {
252 
253  if (Rsid.station() == 1)
254  ResDplu1->Fill(dis);
255  else if (Rsid.station() == 2)
256  ResDplu2->Fill(dis);
257  else if (Rsid.station() == 3)
258  ResDplu3->Fill(dis);
259  else if (Rsid.station() == 4)
260  ResDplu4->Fill(dis);
261  }
262  if (Rsid.region() == (-1))
263  {
264 
265  if (Rsid.station() == 1)
266  ResDmin1->Fill(dis);
267  else if (Rsid.station() == 2)
268  ResDmin2->Fill(dis);
269  else if (Rsid.station() == 3)
270  ResDmin3->Fill(dis);
271  else if (Rsid.station() == 4)
272  ResDmin4->Fill(dis);
273  }
274  }
275  }
276 }
277 
279 {
280 }
281 
283 {
284  if (outputFile_.size() != 0 && dbe_)
286 
287 }
288 
290 {
291  if (dbe_)
292  {
293  dbe_->setCurrentFolder("RPCDigisV/RPCDigis");
294 
295  xyview = dbe_->book2D("X_Vs_Y_View", "X_Vs_Y_View", 155, -775., 775., 155, -775., 775.);
296 
297  xyvDplu4 = dbe_->book2D("Dplu4_XvsY", "Dplu4_XvsY", 155, -775., 775., 155, -775., 775.);
298  xyvDmin4 = dbe_->book2D("Dmin4_XvsY", "Dmin4_XvsY", 155, -775., 775., 155, -775., 775.);
299 
300  rzview = dbe_->book2D("R_Vs_Z_View", "R_Vs_Z_View", 216, -1080., 1080., 52, 260., 780.);
301  Res = dbe_->book1D("Digi_SimHit_difference", "Digi_SimHit_difference", 300, -8, 8);
302  ResWmin2 = dbe_->book1D("W_Min2_Residuals", "W_Min2_Residuals", 400, -8, 8);
303  ResWmin1 = dbe_->book1D("W_Min1_Residuals", "W_Min1_Residuals", 400, -8, 8);
304  ResWzer0 = dbe_->book1D("W_Zer0_Residuals", "W_Zer0_Residuals", 400, -8, 8);
305  ResWplu1 = dbe_->book1D("W_Plu1_Residuals", "W_Plu1_Residuals", 400, -8, 8);
306  ResWplu2 = dbe_->book1D("W_Plu2_Residuals", "W_Plu2_Residuals", 400, -8, 8);
307 
308  ResLayer1_barrel = dbe_->book1D("ResLayer1_barrel", "ResLayer1_barrel", 400, -8, 8);
309  ResLayer2_barrel = dbe_->book1D("ResLayer2_barrel", "ResLayer2_barrel", 400, -8, 8);
310  ResLayer3_barrel = dbe_->book1D("ResLayer3_barrel", "ResLayer3_barrel", 400, -8, 8);
311  ResLayer4_barrel = dbe_->book1D("ResLayer4_barrel", "ResLayer4_barrel", 400, -8, 8);
312  ResLayer5_barrel = dbe_->book1D("ResLayer5_barrel", "ResLayer5_barrel", 400, -8, 8);
313  ResLayer6_barrel = dbe_->book1D("ResLayer6_barrel", "ResLayer6_barrel", 400, -8, 8);
314 
315  BxDist = dbe_->book1D("Bunch_Crossing", "Bunch_Crossing", 20, -10., 10.);
316  StripProf = dbe_->book1D("Strip_Profile", "Strip_Profile", 100, 0, 100);
317 
318  BxDisc_4Plus = dbe_->book1D("BxDisc_4Plus", "BxDisc_4Plus", 20, -10., 10.);
319  BxDisc_4Min = dbe_->book1D("BxDisc_4Min", "BxDisc_4Min", 20, -10., 10.);
320 
321  //cls histos
322  noiseCLS = dbe_->book1D("noiseCLS", "noiseCLS", 10, 0.5, 10.5);
323  noiseCLSBarrel = dbe_->book1D("noiseCLSBarrel", "noiseCLSBarrel", 10, 0.5, 10.5);
324  noiseCLSEndcaps = dbe_->book1D("noiseCLSEndcaps", "noiseCLSEndcaps", 10, 0.5, 10.5);
325 
326  clsBarrel = dbe_->book1D("clsBarrel", "clsBarrel", 10, 0.5, 10.5);
327 
328  //endcap CLS
329  CLS_Endcap_1_Ring2_A = dbe_->book1D("CLS_Endcap_1_1Ring2_A", "CLS_Endcap_1_Ring2_A", 10, 0.5, 10.5);
330  CLS_Endcap_1_Ring2_B = dbe_->book1D("CLS_Endcap_1_1Ring2_B", "CLS_Endcap_1_Ring2_B", 10, 0.5, 10.5);
331  CLS_Endcap_1_Ring2_C = dbe_->book1D("CLS_Endcap_1_1Ring2_C", "CLS_Endcap_1_Ring2_C", 10, 0.5, 10.5);
332 
333  CLS_Endcap_23_Ring2_A = dbe_->book1D("CLS_Endcap_23_Ring2_A", "CLS_Endcap_23_Ring2_A", 10, 0.5, 10.5);
334  CLS_Endcap_23_Ring2_B = dbe_->book1D("CLS_Endcap_23_Ring2_B", "CLS_Endcap_23_Ring2_B", 10, 0.5, 10.5);
335  CLS_Endcap_23_Ring2_C = dbe_->book1D("CLS_Endcap_23_Ring2_C", "CLS_Endcap_23_Ring2_C", 10, 0.5, 10.5);
336 
337  CLS_Endcap_123_Ring3_A = dbe_->book1D("CLS_Endcap_123_Ring3_A", "CLS_Endcap_123_Ring3_A", 10, 0.5, 10.5);
338  CLS_Endcap_123_Ring3_B = dbe_->book1D("CLS_Endcap_123_Ring3_B", "CLS_Endcap_123_Ring3_B", 10, 0.5, 10.5);
339  CLS_Endcap_123_Ring3_C = dbe_->book1D("CLS_Endcap_123_Ring3_C", "CLS_Endcap_123_Ring3_C", 10, 0.5, 10.5);
340 
341  CLS_Endcap_4 = dbe_->book1D("CLS_Endcap_4", "CLS_Endcap_4", 10, 0.5, 10.5);
342 
343  //endcap residuals
344  ResDmin1 = dbe_->book1D("Disk_Min1_Residuals", "Disk_Min1_Residuals", 400, -8, 8);
345  ResDmin2 = dbe_->book1D("Disk_Min2_Residuals", "Disk_Min2_Residuals", 400, -8, 8);
346  ResDmin3 = dbe_->book1D("Disk_Min3_Residuals", "Disk_Min3_Residuals", 400, -8, 8);
347  ResDplu1 = dbe_->book1D("Disk_Plu1_Residuals", "Disk_Plu1_Residuals", 400, -8, 8);
348  ResDplu2 = dbe_->book1D("Disk_Plu2_Residuals", "Disk_Plu2_Residuals", 400, -8, 8);
349  ResDplu3 = dbe_->book1D("Disk_Plu3_Residuals", "Disk_Plu3_Residuals", 400, -8, 8);
350 
351  ResDmin4 = dbe_->book1D("Disk_Min4_Residuals", "Disk_Min4_Residuals", 400, -8, 8);
352  ResDplu4 = dbe_->book1D("Disk_Plu4_Residuals", "Disk_Plu4_Residuals", 400, -8, 8);
353 
354  Res_Endcap1_Ring2_A = dbe_->book1D("Res_Endcap1_Ring2_A", "Res_Endcap1_Ring2_A", 400, -8, 8);
355  Res_Endcap1_Ring2_B = dbe_->book1D("Res_Endcap1_Ring2_B", "Res_Endcap1_Ring2_B", 400, -8, 8);
356  Res_Endcap1_Ring2_C = dbe_->book1D("Res_Endcap1_Ring2_C", "Res_Endcap1_Ring2_C", 400, -8, 8);
357 
358  Res_Endcap23_Ring2_A = dbe_->book1D("Res_Endcap23_Ring2_A", "Res_Endcap23_Ring2_A", 400, -8, 8);
359  Res_Endcap23_Ring2_B = dbe_->book1D("Res_Endcap23_Ring2_B", "Res_Endcap23_Ring2_B", 400, -8, 8);
360  Res_Endcap23_Ring2_C = dbe_->book1D("Res_Endcap23_Ring2_C", "Res_Endcap23_Ring2_C", 400, -8, 8);
361 
362  Res_Endcap123_Ring3_A = dbe_->book1D("Res_Endcap123_Ring3_A", "Res_Endcap123_Ring3_A", 400, -8, 8);
363  Res_Endcap123_Ring3_B = dbe_->book1D("Res_Endcap123_Ring3_B", "Res_Endcap123_Ring3_B", 400, -8, 8);
364  Res_Endcap123_Ring3_C = dbe_->book1D("Res_Endcap123_Ring3_C", "Res_Endcap123_Ring3_C", 400, -8, 8);
365 
366  }//end dbe
367 }
368 
370 {
371 }
MonitorElement * CLS_Endcap_1_Ring2_A
Definition: RPCDigiValid.h:92
MonitorElement * CLS_Endcap_123_Ring3_A
Definition: RPCDigiValid.h:101
T getUntrackedParameter(std::string const &, T const &) const
MonitorElement * CLS_Endcap_1_Ring2_B
Definition: RPCDigiValid.h:93
LocalPoint centreOfStrip(int strip) const
Definition: RPCRoll.cc:52
MonitorElement * CLS_Endcap_23_Ring2_A
Definition: RPCDigiValid.h:96
T perp() const
Definition: PV3DBase.h:72
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
Definition: DQMStore.cc:942
MonitorElement * noiseCLSEndcaps
Definition: RPCDigiValid.h:86
MonitorElement * ResLayer6_barrel
Definition: RPCDigiValid.h:60
MonitorElement * Res_Endcap1_Ring2_A
Definition: RPCDigiValid.h:71
MonitorElement * Res_Endcap123_Ring3_A
Definition: RPCDigiValid.h:79
MonitorElement * ResLayer3_barrel
Definition: RPCDigiValid.h:57
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
Definition: GeomDet.h:47
T y() const
Definition: PV3DBase.h:63
MonitorElement * CLS_Endcap_4
Definition: RPCDigiValid.h:113
MonitorElement * ResWplu2
Definition: RPCDigiValid.h:50
RPCDigiValid(const edm::ParameterSet &ps)
Definition: RPCDigiValid.cc:17
DQMStore * dbe_
Definition: RPCDigiValid.h:115
MonitorElement * BxDisc_4Min
Definition: RPCDigiValid.h:110
MonitorElement * StripProf
Definition: RPCDigiValid.h:52
MonitorElement * Res
Definition: RPCDigiValid.h:45
void analyze(const edm::Event &e, const edm::EventSetup &c)
Definition: RPCDigiValid.cc:37
MonitorElement * ResWzer0
Definition: RPCDigiValid.h:48
std::string outputFile_
Definition: RPCDigiValid.h:116
void beginRun(edm::Run const &, edm::EventSetup const &)
void Fill(long long x)
MonitorElement * ResDmin3
Definition: RPCDigiValid.h:65
void endJob(void)
MonitorElement * ResLayer5_barrel
Definition: RPCDigiValid.h:59
MonitorElement * ResWmin1
Definition: RPCDigiValid.h:47
MonitorElement * ResLayer2_barrel
Definition: RPCDigiValid.h:56
int roll() const
Definition: RPCDetId.h:120
MonitorElement * ResDplu4
Definition: RPCDigiValid.h:108
MonitorElement * ResDplu3
Definition: RPCDigiValid.h:68
int ring() const
Definition: RPCDetId.h:72
MonitorElement * ResDmin1
Definition: RPCDigiValid.h:63
MonitorElement * ResWplu1
Definition: RPCDigiValid.h:49
T z() const
Definition: PV3DBase.h:64
MonitorElement * Res_Endcap123_Ring3_C
Definition: RPCDigiValid.h:81
MonitorElement * BxDisc_4Plus
Definition: RPCDigiValid.h:109
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
MonitorElement * Res_Endcap123_Ring3_B
Definition: RPCDigiValid.h:80
MonitorElement * CLS_Endcap_123_Ring3_B
Definition: RPCDigiValid.h:102
MonitorElement * ResWmin2
Definition: RPCDigiValid.h:46
MonitorElement * xyvDmin4
Definition: RPCDigiValid.h:112
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
MonitorElement * CLS_Endcap_1_Ring2_C
Definition: RPCDigiValid.h:94
MonitorElement * ResDplu2
Definition: RPCDigiValid.h:67
DQMStore * dbe_
MonitorElement * Res_Endcap23_Ring2_C
Definition: RPCDigiValid.h:77
MonitorElement * ResLayer1_barrel
Definition: RPCDigiValid.h:55
int layer() const
Definition: RPCDetId.h:108
MonitorElement * Res_Endcap1_Ring2_B
Definition: RPCDigiValid.h:72
const T & get() const
Definition: EventSetup.h:55
MonitorElement * noiseCLS
Definition: RPCDigiValid.h:84
MonitorElement * ResDmin2
Definition: RPCDigiValid.h:64
std::vector< RPCDigi >::const_iterator const_iterator
edm::EDGetTokenT< RPCDigiCollection > rpcDigiToken
Definition: RPCDigiValid.h:121
MonitorElement * Res_Endcap23_Ring2_A
Definition: RPCDigiValid.h:75
MonitorElement * BxDist
Definition: RPCDigiValid.h:51
MonitorElement * clsBarrel
Definition: RPCDigiValid.h:88
void save(const std::string &filename, const std::string &path="", const std::string &pattern="", const std::string &rewrite="", const uint32_t run=0, const uint32_t lumi=0, SaveReferenceTag ref=SaveWithReference, int minStatus=dqm::qstatus::STATUS_OK, const std::string &fileupdate="RECREATE", const bool resetMEsAfterWriting=false)
Definition: DQMStore.cc:2490
MonitorElement * ResDmin4
Definition: RPCDigiValid.h:107
MonitorElement * ResLayer4_barrel
Definition: RPCDigiValid.h:58
MonitorElement * CLS_Endcap_123_Ring3_C
Definition: RPCDigiValid.h:103
std::pair< const_iterator, const_iterator > Range
MonitorElement * xyview
Definition: RPCDigiValid.h:43
MonitorElement * ResDplu1
Definition: RPCDigiValid.h:66
edm::EDGetTokenT< edm::PSimHitContainer > simHitToken
Definition: RPCDigiValid.h:120
Definition: DDAxes.h:10
void endRun(edm::Run const &, edm::EventSetup const &)
MonitorElement * book2D(const char *name, const char *title, int nchX, double lowX, double highX, int nchY, double lowY, double highY)
Book 2D histogram.
Definition: DQMStore.cc:1070
MonitorElement * Res_Endcap23_Ring2_B
Definition: RPCDigiValid.h:76
T x() const
Definition: PV3DBase.h:62
MonitorElement * xyvDplu4
Definition: RPCDigiValid.h:111
MonitorElement * CLS_Endcap_23_Ring2_C
Definition: RPCDigiValid.h:98
MonitorElement * Res_Endcap1_Ring2_C
Definition: RPCDigiValid.h:73
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:655
Definition: Run.h:41
MonitorElement * CLS_Endcap_23_Ring2_B
Definition: RPCDigiValid.h:97
MonitorElement * rzview
Definition: RPCDigiValid.h:44
int region() const
Region id: 0 for Barrel, +/-1 For +/- Endcap.
Definition: RPCDetId.h:63
int station() const
Definition: RPCDetId.h:96
MonitorElement * noiseCLSBarrel
Definition: RPCDigiValid.h:85