Go to the documentation of this file.00001
00006 #include <memory>
00007 #include <fstream>
00008 #include <FWCore/Framework/interface/Frameworkfwd.h>
00009
00010 #include <FWCore/Framework/interface/EDAnalyzer.h>
00011 #include <FWCore/Framework/interface/Event.h>
00012 #include <FWCore/Framework/interface/EventSetup.h>
00013 #include <FWCore/Framework/interface/ESHandle.h>
00014 #include <FWCore/ParameterSet/interface/ParameterSet.h>
00015
00016 #include "Geometry/RPCGeometry/interface/RPCGeometry.h"
00017 #include "Geometry/RPCGeometry/interface/RPCGeomServ.h"
00018 #include <Geometry/Records/interface/MuonGeometryRecord.h>
00019 #include <Geometry/CommonTopologies/interface/RectangularStripTopology.h>
00020 #include <Geometry/CommonTopologies/interface/TrapezoidalStripTopology.h>
00021
00022 #include <string>
00023 #include <cmath>
00024 #include <vector>
00025 #include <map>
00026 #include <iomanip>
00027 #include <set>
00028
00029 using namespace std;
00030
00031 class RPCGeometryServTest : public edm::EDAnalyzer {
00032
00033 public:
00034 RPCGeometryServTest( const edm::ParameterSet& pset);
00035
00036 ~RPCGeometryServTest();
00037
00038 virtual void analyze( const edm::Event&, const edm::EventSetup& );
00039
00040 const std::string& myName() { return myName_;}
00041
00042 private:
00043
00044 const int dashedLineWidth_;
00045 const std::string dashedLine_;
00046 const std::string myName_;
00047 std::map<int, std::pair<double, double> > barzranges;
00048 std::map<int, std::pair<double, double> > forRranges;
00049 std::map<int, std::pair<double, double> > bacRranges;
00050 };
00051
00052 RPCGeometryServTest::RPCGeometryServTest( const edm::ParameterSet& iConfig )
00053 : dashedLineWidth_(104), dashedLine_( std::string(dashedLineWidth_, '-') ),
00054 myName_( "RPCGeometryServTest" )
00055 {
00056 std::cout <<"======================== Opening output file"<< std::endl;
00057 }
00058
00059
00060 RPCGeometryServTest::~RPCGeometryServTest()
00061 {
00062 }
00063
00064 void
00065 RPCGeometryServTest::analyze( const edm::Event& iEvent, const edm::EventSetup& iSetup )
00066 {
00067 edm::ESHandle<RPCGeometry> pDD;
00068 iSetup.get<MuonGeometryRecord>().get( pDD );
00069
00070 std::cout << myName() << ": Analyzer..." << std::endl;
00071 std::cout << "start " << dashedLine_ << std::endl;
00072
00073
00074 std::cout << " Geometry node for RPCGeom is " << &(*pDD) << std::endl;
00075 cout << " I have "<<pDD->detTypes().size() << " detTypes" << endl;
00076 cout << " I have "<<pDD->detUnits().size() << " detUnits" << endl;
00077 cout << " I have "<<pDD->dets().size() << " dets" << endl;
00078 cout << " I have "<<pDD->rolls().size() << " rolls" << endl;
00079 cout << " I have "<<pDD->chambers().size() << " chambers" << endl;
00080
00081 std::cout << myName() << ": Begin iteration over geometry..." << std::endl;
00082 std::cout << "iter " << dashedLine_ << std::endl;
00083
00084
00085
00086 int iRPCCHcount = 0;
00087 LocalPoint a(0.,0.,0.);
00088 for(TrackingGeometry::DetContainer::const_iterator it =
00089 pDD->dets().begin(); it != pDD->dets().end(); it++){
00090
00091
00092
00093 if( dynamic_cast< RPCChamber* >( *it ) != 0 ){
00094 ++iRPCCHcount;
00095 RPCChamber* ch = dynamic_cast< RPCChamber* >( *it );
00096 RPCDetId detId=ch->id();
00097
00098 std::vector< const RPCRoll*> rollsRaf = (ch->rolls());
00099 for(std::vector<const RPCRoll*>::iterator r = rollsRaf.begin();
00100 r != rollsRaf.end(); ++r){
00101 std::cout << dashedLine_ << " NEW ROLL" << std::endl;
00102 std::cout<<"Region = "<<(*r)->id().region()
00103 <<" Ring = "<<(*r)->id().ring()
00104 <<" Station = "<<(*r)->id().station()
00105 <<" Sector = "<<(*r)->id().sector()
00106 <<" Layer = "<<(*r)->id().layer()
00107 <<" Subsector = "<<(*r)->id().subsector()
00108 <<" Roll = "<<(*r)->id().roll()<<std::endl;
00109 RPCGeomServ s( (*r)->id());
00110 GlobalPoint g= (*r)->toGlobal(a);
00111 std::cout <<s.name()<<" eta partition "<<s.eta_partition()<< " nroll="<<ch->nrolls()
00112 <<" z="<<g.z()<<" phi="<<g.phi()<<" R="<<g.perp()
00113 <<std::endl;
00114
00115 if((*r)->id().region() == 0 ){
00116 if (barzranges.find(s.eta_partition()) != barzranges.end()){
00117 std::pair<double, double> cic=barzranges.find(s.eta_partition())->second;
00118 double cmin = cic.first;
00119 double cmax = cic.second;
00120 if (g.z()<cmin)
00121 cmin = g.z();
00122 if (g.z()>cmax)
00123 cmax = g.z();
00124 std::pair<double,double> cic2(cmin,cmax);
00125 barzranges[s.eta_partition()]=cic2;
00126 }else{
00127 std::pair<double, double> cic(g.z(),g.z());
00128 barzranges[s.eta_partition()]=cic;
00129 }
00130 }
00131 else if((*r)->id().region() == +1 ){
00132 if (forRranges.find(s.eta_partition()) != forRranges.end()){
00133 std::pair<double, double> cic=forRranges.find(s.eta_partition())->second;
00134 double cmin = cic.first;
00135 double cmax = cic.second;
00136 if (g.perp()<cmin)
00137 cmin = g.perp();
00138 if (g.perp()>cmax)
00139 cmax = g.perp();
00140 std::pair<double,double> cic2(cmin,cmax);
00141 forRranges[s.eta_partition()]=cic2;
00142 }else{
00143 std::pair<double, double> cic(g.perp(),g.perp());
00144 forRranges[s.eta_partition()]=cic;
00145 }
00146 }
00147 else if((*r)->id().region() == -1 ){
00148 if (bacRranges.find(s.eta_partition()) != bacRranges.end()){
00149 std::pair<double, double> cic=bacRranges.find(s.eta_partition())->second;
00150 double cmin = cic.first;
00151 double cmax = cic.second;
00152 if (g.perp()<cmin)
00153 cmin = g.perp();
00154 if (g.perp()>cmax)
00155 cmax = g.perp();
00156 std::pair<double,double> cic2(cmin,cmax);
00157 bacRranges[s.eta_partition()]=cic2;
00158 }else{
00159 std::pair<double, double> cic(g.perp(),g.perp());
00160 bacRranges[s.eta_partition()]=cic;
00161 }
00162 }
00163 }
00164 }
00165 }
00166
00167 std::cout <<std::endl;
00168 std::map<int, std::pair<double, double> >::iterator ieta;
00169
00170 for (ieta=bacRranges.begin(); ieta != bacRranges.end(); ieta++){
00171 std::cout <<" Eta "<<ieta->first<<" Radii = ( "<<ieta->second.first
00172 <<", "<<ieta->second.second<<")"<<std::endl;
00173 }
00174
00175 for (ieta=barzranges.begin(); ieta != barzranges.end(); ieta++){
00176 std::cout <<" Eta "<<ieta->first<<" Z = ( "<<ieta->second.first
00177 <<", "<<ieta->second.second<<")"<<std::endl;
00178 }
00179
00180 for (ieta=forRranges.begin(); ieta != forRranges.end(); ieta++){
00181 std::cout <<" Eta "<<ieta->first<<" Radii = ( "<<ieta->second.first
00182 <<", "<<ieta->second.second<<")"<<std::endl;
00183 }
00184
00185
00186 std::cout << dashedLine_ << " end" << std::endl;
00187 }
00188
00189
00190 #include <FWCore/Framework/interface/MakerMacros.h>
00191 DEFINE_FWK_MODULE(RPCGeometryServTest);