#include <Validation/MuonRPCDigis/interface/RPCDigiValid.h>
Public Member Functions | |
RPCDigiValid (const edm::ParameterSet &ps) | |
~RPCDigiValid () | |
Protected Member Functions | |
void | analyze (const edm::Event &e, const edm::EventSetup &c) |
void | beginJob (const edm::EventSetup &c) |
void | endJob (void) |
Private Attributes | |
MonitorElement * | BxDist |
DQMStore * | dbe_ |
std::string | digiLabel |
std::string | outputFile_ |
MonitorElement * | Res |
MonitorElement * | ResWmin1 |
MonitorElement * | ResWmin2 |
MonitorElement * | ResWplu1 |
MonitorElement * | ResWplu2 |
MonitorElement * | ResWzer0 |
MonitorElement * | rzview |
MonitorElement * | StripProf |
MonitorElement * | xyview |
Definition at line 24 of file RPCDigiValid.h.
RPCDigiValid::RPCDigiValid | ( | const edm::ParameterSet & | ps | ) |
Definition at line 19 of file RPCDigiValid.cc.
References BxDist, dbe_, digiLabel, edm::ParameterSet::getUntrackedParameter(), outputFile_, Res, ResWmin1, ResWmin2, ResWplu1, ResWplu2, ResWzer0, rzview, StripProf, and xyview.
00019 :dbe_(0){ 00020 00021 digiLabel = ps.getUntrackedParameter<std::string>("digiLabel"); 00022 outputFile_ = ps.getUntrackedParameter<string>("outputFile", "rpcDigiValidPlots.root"); 00023 dbe_ = Service<DQMStore>().operator->(); 00024 00025 if ( dbe_ ) { 00026 dbe_->setCurrentFolder("RPCDigisV/RPCDigis"); 00027 00028 xyview = dbe_->book2D("X Vs Y View","X Vs Y View",1000, -700., 700., 1000, -700., 700.); 00029 rzview = dbe_->book2D("R Vs Z View","X Vs Y View",1000, -1100., 1100.,1000,0., 700.); 00030 Res = dbe_->book1D("Digi SimHit difference", "Digi SimHit Difference", 300, -8, 8); 00031 ResWmin2 = dbe_->book1D("W-2 Residuals", "Residuals for Wheel -2", 300, -8, 8); 00032 ResWmin1 = dbe_->book1D("W-1 Residuals", "Residuals for Wheel -1", 300, -8, 8); 00033 ResWzer0 = dbe_->book1D("W 0 Residuals", "Residuals for Wheel 0", 300, -8, 8); 00034 ResWplu1 = dbe_->book1D("W+1 Residuals", "Residuals for Wheel +1", 300, -8, 8); 00035 ResWplu2 = dbe_->book1D("W+2 Residuals", "Residuals for Wheel +2", 300, -8, 8); 00036 00037 BxDist = dbe_->book1D("Bunch Crossing", "Bunch Crossing", 20, -9.5, 9.5); 00038 StripProf = dbe_->book1D("Strip Profile", "Strip Profile", 100, 0, 100); 00039 } 00040 }
RPCDigiValid::~RPCDigiValid | ( | ) |
void RPCDigiValid::analyze | ( | const edm::Event & | e, | |
const edm::EventSetup & | c | |||
) | [protected, virtual] |
Implements edm::EDAnalyzer.
Definition at line 50 of file RPCDigiValid.cc.
References BxDist, RPCRoll::centreOfStrip(), digiLabel, MonitorElement::Fill(), edm::EventSetup::get(), p, PV3DBase< T, PVType, FrameType >::perp(), range, RPCDetId::region(), Res, ResWmin1, ResWmin2, ResWplu1, ResWplu2, ResWzer0, RPCDetId::ring(), rzview, StripProf, GeomDet::toGlobal(), PV3DBase< T, PVType, FrameType >::x(), x, xyview, PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().
00050 { 00051 00052 // cout << endl <<"--- [RPCDigiQuality] Analysing Event: #Run: " << event.id().run() 00053 // << " #Event: " << event.id().event() << endl; 00054 00055 // Get the RPC Geometry 00056 edm::ESHandle<RPCGeometry> rpcGeom; 00057 eventSetup.get<MuonGeometryRecord>().get(rpcGeom); 00058 00059 edm::Handle<PSimHitContainer> simHit; 00060 event.getByLabel("g4SimHits", "MuonRPCHits", simHit); 00061 00062 edm::Handle<RPCDigiCollection> rpcDigis; 00063 event.getByLabel(digiLabel, rpcDigis); 00064 00065 // Loop on simhits 00066 PSimHitContainer::const_iterator simIt; 00067 00068 //loop over Simhit 00069 std::map<RPCDetId, std::vector<double> > allsims; 00070 00071 for (simIt = simHit->begin(); simIt != simHit->end(); simIt++) { 00072 RPCDetId Rsid = (RPCDetId)(*simIt).detUnitId(); 00073 const RPCRoll* soll = dynamic_cast<const RPCRoll* >( rpcGeom->roll(Rsid)); 00074 int ptype = simIt->particleType(); 00075 00076 // std::cout <<"This is a Simhit with Parent "<<ptype<<std::endl; 00077 if (ptype == 13 || ptype == -13) { 00078 std::vector<double> buff; 00079 if (allsims.find(Rsid) != allsims.end() ){ 00080 buff= allsims[Rsid]; 00081 } 00082 buff.push_back(simIt->localPosition().x()); 00083 allsims[Rsid]=buff; 00084 } 00085 GlobalPoint p=soll->toGlobal(simIt->localPosition()); 00086 /* 00087 std::cout <<"Muon Position phi="<<p.phi() 00088 <<" R="<<p.perp() 00089 <<" z="<<p.z()<<std::endl; 00090 */ 00091 xyview->Fill(p.x(),p.y()); 00092 rzview->Fill(p.z(),p.perp()); 00093 00094 } 00095 //loop over Digis 00096 RPCDigiCollection::DigiRangeIterator detUnitIt; 00097 for (detUnitIt=rpcDigis->begin(); detUnitIt!=rpcDigis->end();++detUnitIt){ 00098 const RPCDetId Rsid = (*detUnitIt).first; 00099 const RPCRoll* roll = dynamic_cast<const RPCRoll* >( rpcGeom->roll(Rsid)); 00100 const RPCDigiCollection::Range& range = (*detUnitIt).second; 00101 std::vector<double> sims; 00102 if (allsims.find(Rsid) != allsims.end() ){ 00103 sims = allsims[Rsid]; 00104 } 00105 int ndigi=0; 00106 for (RPCDigiCollection::const_iterator digiIt = range.first; 00107 digiIt != range.second; ++digiIt){ 00108 StripProf->Fill(digiIt->strip()); 00109 BxDist->Fill(digiIt->bx()); 00110 ndigi++; 00111 } 00112 00113 00114 // std::cout<<" Number of Digi "<<ndigi<<" for "<<Rsid<<std::endl; 00115 00116 if (sims.size() == 1 && ndigi == 1){ 00117 double dis = roll->centreOfStrip(range.first->strip()).x()-sims[0]; 00118 Res->Fill(dis); 00119 00120 if (Rsid.region() == 0 ){ 00121 if (Rsid.ring() == -2) 00122 ResWmin2->Fill(dis); 00123 else if (Rsid.ring() == -1) 00124 ResWmin1->Fill(dis); 00125 else if (Rsid.ring() == 0) 00126 ResWzer0->Fill(dis); 00127 else if (Rsid.ring() == 1) 00128 ResWplu1->Fill(dis); 00129 else if (Rsid.ring() == 2) 00130 ResWplu2->Fill(dis); 00131 } 00132 } 00133 } 00134 }
void RPCDigiValid::beginJob | ( | const edm::EventSetup & | c | ) | [protected, virtual] |
Reimplemented from edm::EDAnalyzer.
Definition at line 46 of file RPCDigiValid.cc.
References dbe_, outputFile_, and DQMStore::save().
00046 { 00047 if ( outputFile_.size() != 0 && dbe_ ) dbe_->save(outputFile_); 00048 }
MonitorElement* RPCDigiValid::BxDist [private] |
DQMStore* RPCDigiValid::dbe_ [private] |
std::string RPCDigiValid::digiLabel [private] |
std::string RPCDigiValid::outputFile_ [private] |
MonitorElement* RPCDigiValid::Res [private] |
MonitorElement* RPCDigiValid::ResWmin1 [private] |
MonitorElement* RPCDigiValid::ResWmin2 [private] |
MonitorElement* RPCDigiValid::ResWplu1 [private] |
MonitorElement* RPCDigiValid::ResWplu2 [private] |
MonitorElement* RPCDigiValid::ResWzer0 [private] |
MonitorElement* RPCDigiValid::rzview [private] |
MonitorElement* RPCDigiValid::StripProf [private] |
MonitorElement* RPCDigiValid::xyview [private] |