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.
9 
15 
16 using namespace std;
17 using namespace edm;
18 
20 
21  digiLabel = ps.getUntrackedParameter<std::string>("digiLabel");
22  outputFile_ = ps.getUntrackedParameter<string>("outputFile", "rpcDigiValidPlots.root");
24 
25  if ( dbe_ ) {
26  dbe_->setCurrentFolder("RPCDigisV/RPCDigis");
27 
28  xyview = dbe_->book2D("X_Vs_Y_View","X_Vs_Y_View",1000, -760., 760., 1000, -760., 760.);
29 
30  xyvDplu1 = dbe_->book2D("Dplu1_XvsY","Dplu1_XvsY",1000, -760., 760., 1000, -760., 760.);
31  xyvDplu2 = dbe_->book2D("Dplu2_XvsY","Dplu2_XvsY",1000, -760., 760., 1000, -760., 760.);
32  xyvDplu3 = dbe_->book2D("Dplu3_XvsY","Dplu3_XvsY",1000, -760., 760., 1000, -760., 760.);
33  xyvDmin1 = dbe_->book2D("Dmin1_XvsY","Dmin1_XvsY",1000, -760., 760., 1000, -760., 760.);
34  xyvDmin2 = dbe_->book2D("Dmin2_XvsY","Dmin2_XvsY",1000, -760., 760., 1000, -760., 760.);
35  xyvDmin3 = dbe_->book2D("Dmin3_XvsY","Dmin3_XvsY",1000, -760., 760., 1000, -760., 760.);
36 
37  rzview = dbe_->book2D("R_Vs_Z_View","R_Vs_Z_View",1000, -1100., 1100.,1000,0., 800.);
38  Res = dbe_->book1D("Digi_SimHit_difference", "Digi_SimHit_difference", 300, -8, 8);
39  ResWmin2 = dbe_->book1D("W_Min2_Residuals", "W_Min2_Residuals", 300, -8, 8);
40  ResWmin1 = dbe_->book1D("W_Min1_Residuals", "W_Min1_Residuals", 300, -8, 8);
41  ResWzer0 = dbe_->book1D("W_Zer0_Residuals", "W_Zer0_Residuals", 300, -8, 8);
42  ResWplu1 = dbe_->book1D("W_Plu1_Residuals", "W_Plu1_Residuals", 300, -8, 8);
43  ResWplu2 = dbe_->book1D("W_Plu2_Residuals", "W_Plu2_Residuals", 300, -8, 8);
44 
45  BxDist = dbe_->book1D("Bunch_Crossing", "Bunch_Crossing", 20, -10., 10.);
46  StripProf = dbe_->book1D("Strip_Profile", "Strip_Profile", 100, 0, 100);
47 
48  ResDmin1 = dbe_->book1D("Disk_Min1_Residuals", "Disk_Min1_Residuals", 300, -8, 8);
49  ResDmin2 = dbe_->book1D("Disk_Min2_Residuals", "Disk_Min2_Residuals", 300, -8, 8);
50  ResDmin3 = dbe_->book1D("Disk_Min3_Residuals", "Disk_Min3_Residuals", 300, -8, 8);
51  ResDplu1 = dbe_->book1D("Disk_Plu1_Residuals", "Disk_Plu1_Residuals", 300, -8, 8);
52  ResDplu2 = dbe_->book1D("Disk_Plu2_Residuals", "Disk_Plu2_Residuals", 300, -8, 8);
53  ResDplu3 = dbe_->book1D("Disk_Plu3_Residuals", "Disk_Plu3_Residuals", 300, -8, 8);
54 
55  }
56 }
57 
59 
61 
63  if ( outputFile_.size() != 0 && dbe_ ) dbe_->save(outputFile_);
64 }
65 
66 void RPCDigiValid::analyze(const Event& event, const EventSetup& eventSetup){
67 
68  // cout << endl <<"--- [RPCDigiQuality] Analysing Event: #Run: " << event.id().run()
69  // << " #Event: " << event.id().event() << endl;
70 
71  // Get the RPC Geometry
73  eventSetup.get<MuonGeometryRecord>().get(rpcGeom);
74 
76  event.getByLabel("g4SimHits", "MuonRPCHits", simHit);
77 
79  event.getByLabel(digiLabel, rpcDigis);
80 
81  // Loop on simhits
82  PSimHitContainer::const_iterator simIt;
83 
84  //loop over Simhit
85  std::map<RPCDetId, std::vector<double> > allsims;
86 
87  for (simIt = simHit->begin(); simIt != simHit->end(); simIt++) {
88  RPCDetId Rsid = (RPCDetId)(*simIt).detUnitId();
89  const RPCRoll* soll = dynamic_cast<const RPCRoll* >( rpcGeom->roll(Rsid));
90  int ptype = simIt->particleType();
91 
92  // std::cout <<"This is a Simhit with Parent "<<ptype<<std::endl;
93  if (ptype == 13 || ptype == -13) {
94  std::vector<double> buff;
95  if (allsims.find(Rsid) != allsims.end() ){
96  buff= allsims[Rsid];
97  }
98  buff.push_back(simIt->localPosition().x());
99  allsims[Rsid]=buff;
100  }
101  GlobalPoint p=soll->toGlobal(simIt->localPosition());
102  /*
103  std::cout <<"Muon Position phi="<<p.phi()
104  <<" R="<<p.perp()
105  <<" z="<<p.z()<<std::endl;
106  */
107 
108  double sim_x = p.x();
109  double sim_y = p.y();
110 
111  xyview->Fill(sim_x, sim_y);
112 
113  if (Rsid.region() == 0 ){
114  }
115  else if (Rsid.region() == (+1)){
116  if (Rsid.station() == 1)
117  xyvDplu1->Fill(sim_x, sim_y);
118  else if (Rsid.station() == 2)
119  xyvDplu2->Fill(sim_x, sim_y);
120  else if (Rsid.station() == 3)
121  xyvDplu3->Fill(sim_x, sim_y);
122  }
123  else if (Rsid.region() == (-1)){
124  if (Rsid.station() == 1)
125  xyvDmin1->Fill(sim_x, sim_y);
126  else if (Rsid.station() == 2)
127  xyvDmin2->Fill(sim_x, sim_y);
128  else if (Rsid.station() == 3)
129  xyvDmin3->Fill(sim_x, sim_y);
130  }
131 
132 
133 // xyview->Fill(p.x(),p.y());
134  rzview->Fill(p.z(),p.perp());
135 
136  }
137  //loop over Digis
139  for (detUnitIt=rpcDigis->begin(); detUnitIt!=rpcDigis->end();++detUnitIt){
140  const RPCDetId Rsid = (*detUnitIt).first;
141  const RPCRoll* roll = dynamic_cast<const RPCRoll* >( rpcGeom->roll(Rsid));
142  const RPCDigiCollection::Range& range = (*detUnitIt).second;
143  std::vector<double> sims;
144  if (allsims.find(Rsid) != allsims.end() ){
145  sims = allsims[Rsid];
146  }
147  int ndigi=0;
148  for (RPCDigiCollection::const_iterator digiIt = range.first;
149  digiIt != range.second; ++digiIt){
150  StripProf->Fill(digiIt->strip());
151  BxDist->Fill(digiIt->bx());
152  ndigi++;
153  }
154 
155 
156  // std::cout<<" Number of Digi "<<ndigi<<" for "<<Rsid<<std::endl;
157 
158  if (sims.size() == 1 && ndigi == 1){
159  double dis = roll->centreOfStrip(range.first->strip()).x()-sims[0];
160  Res->Fill(dis);
161 
162  if (Rsid.region() == 0 ){
163  if (Rsid.ring() == -2)
164  ResWmin2->Fill(dis);
165  else if (Rsid.ring() == -1)
166  ResWmin1->Fill(dis);
167  else if (Rsid.ring() == 0)
168  ResWzer0->Fill(dis);
169  else if (Rsid.ring() == 1)
170  ResWplu1->Fill(dis);
171  else if (Rsid.ring() == 2)
172  ResWplu2->Fill(dis);
173  }
174  else if (Rsid.region() == (+1)){
175  if (Rsid.station() == 1)
176  ResDplu1->Fill(dis);
177  else if (Rsid.station() == 2)
178  ResDplu2->Fill(dis);
179  else if (Rsid.station() == 3)
180  ResDplu3->Fill(dis);
181  }
182  else if (Rsid.region() == (-1)){
183  if (Rsid.station() == 1)
184  ResDmin1->Fill(dis);
185  else if (Rsid.station() == 2)
186  ResDmin2->Fill(dis);
187  else if (Rsid.station() == 3)
188  ResDmin3->Fill(dis);
189  }
190  }
191  }
192 }
T getUntrackedParameter(std::string const &, T const &) const
LocalPoint centreOfStrip(int strip) const
Definition: RPCRoll.cc:52
MonitorElement * xyvDmin2
Definition: RPCDigiValid.h:63
T perp() const
Definition: PV3DBase.h:71
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
Definition: GeomDet.h:47
void save(const std::string &filename, const std::string &path="", const std::string &pattern="", const std::string &rewrite="", SaveReferenceTag ref=SaveWithReference, int minStatus=dqm::qstatus::STATUS_OK, const std::string &fileupdate="RECREATE")
Definition: DQMStore.cc:2113
T y() const
Definition: PV3DBase.h:62
MonitorElement * ResWplu2
Definition: RPCDigiValid.h:45
RPCDigiValid(const edm::ParameterSet &ps)
Definition: RPCDigiValid.cc:19
DQMStore * dbe_
Definition: RPCDigiValid.h:66
MonitorElement * xyvDplu3
Definition: RPCDigiValid.h:60
MonitorElement * StripProf
Definition: RPCDigiValid.h:47
MonitorElement * Res
Definition: RPCDigiValid.h:40
void analyze(const edm::Event &e, const edm::EventSetup &c)
Definition: RPCDigiValid.cc:66
MonitorElement * ResWzer0
Definition: RPCDigiValid.h:43
std::string outputFile_
Definition: RPCDigiValid.h:67
void Fill(long long x)
MonitorElement * ResDmin3
Definition: RPCDigiValid.h:52
void endJob(void)
Definition: RPCDigiValid.cc:62
MonitorElement * ResWmin1
Definition: RPCDigiValid.h:42
MonitorElement * ResDplu3
Definition: RPCDigiValid.h:55
int ring() const
Definition: RPCDetId.h:76
MonitorElement * ResDmin1
Definition: RPCDigiValid.h:50
MonitorElement * ResWplu1
Definition: RPCDigiValid.h:44
T z() const
Definition: PV3DBase.h:63
MonitorElement * ResWmin2
Definition: RPCDigiValid.h:41
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 * ResDplu2
Definition: RPCDigiValid.h:54
DQMStore * dbe_
const T & get() const
Definition: EventSetup.h:55
MonitorElement * ResDmin2
Definition: RPCDigiValid.h:51
std::vector< DigiType >::const_iterator const_iterator
MonitorElement * BxDist
Definition: RPCDigiValid.h:46
std::pair< const_iterator, const_iterator > Range
std::string digiLabel
Definition: RPCDigiValid.h:68
MonitorElement * xyvDplu1
Definition: RPCDigiValid.h:58
MonitorElement * xyview
Definition: RPCDigiValid.h:38
MonitorElement * xyvDmin1
Definition: RPCDigiValid.h:62
MonitorElement * ResDplu1
Definition: RPCDigiValid.h:53
Definition: DDAxes.h:10
T x() const
Definition: PV3DBase.h:61
void beginJob()
Definition: RPCDigiValid.cc:60
MonitorElement * rzview
Definition: RPCDigiValid.h:39
MonitorElement * xyvDmin3
Definition: RPCDigiValid.h:64
MonitorElement * xyvDplu2
Definition: RPCDigiValid.h:59
int region() const
Region id: 0 for Barrel, +/-1 For +/- Endcap.
Definition: RPCDetId.h:67
int station() const
Definition: RPCDetId.h:100