CMS 3D CMS Logo

RPCGeometryServTest.cc
Go to the documentation of this file.
1 
6 #include <memory>
7 #include <fstream>
9 
15 
21 
23 
24 #include <string>
25 #include <cmath>
26 #include <vector>
27 #include <map>
28 #include <iomanip>
29 #include <set>
30 
31 using namespace std;
32 
34  : dashedLineWidth_(104), dashedLine_(std::string(dashedLineWidth_, '-')), myName_("RPCGeometryServTest") {
35  std::cout << "======================== Opening output file" << std::endl;
36 }
37 
39 
42  iSetup.get<MuonGeometryRecord>().get(pDD);
43 
44  std::cout << myName() << ": Analyzer..." << std::endl;
45  std::cout << "start " << dashedLine_ << std::endl;
46 
47  std::cout << " Geometry node for RPCGeom is " << &(*pDD) << std::endl;
48  cout << " I have " << pDD->detTypes().size() << " detTypes" << endl;
49  cout << " I have " << pDD->detUnits().size() << " detUnits" << endl;
50  cout << " I have " << pDD->dets().size() << " dets" << endl;
51  cout << " I have " << pDD->rolls().size() << " rolls" << endl;
52  cout << " I have " << pDD->chambers().size() << " chambers" << endl;
53 
54  std::cout << myName() << ": Begin iteration over geometry..." << std::endl;
55  std::cout << "iter " << dashedLine_ << std::endl;
56 
57  int iRPCCHcount = 0;
58  LocalPoint a(0., 0., 0.);
59  for (TrackingGeometry::DetContainer::const_iterator it = pDD->dets().begin(); it != pDD->dets().end(); it++) {
60  //----------------------- RPCCHAMBER TEST ---------------------------
61 
62  if (dynamic_cast<const RPCChamber*>(*it) != nullptr) {
63  ++iRPCCHcount;
64  const RPCChamber* ch = dynamic_cast<const RPCChamber*>(*it);
65 
66  std::vector<const RPCRoll*> rollsRaf = (ch->rolls());
67  for (std::vector<const RPCRoll*>::iterator r = rollsRaf.begin(); r != rollsRaf.end(); ++r) {
68  std::cout << dashedLine_ << " NEW ROLL" << std::endl;
69  std::cout << "Region = " << (*r)->id().region() << " Ring = " << (*r)->id().ring()
70  << " Station = " << (*r)->id().station() << " Sector = " << (*r)->id().sector()
71  << " Layer = " << (*r)->id().layer() << " Subsector = " << (*r)->id().subsector()
72  << " Roll = " << (*r)->id().roll() << std::endl;
73  RPCGeomServ s((*r)->id());
74  GlobalPoint g = (*r)->toGlobal(a);
75  std::cout << s.name() << " eta partition " << s.eta_partition() << " nroll=" << ch->nrolls() << " z=" << g.z()
76  << " phi=" << g.phi() << " R=" << g.perp() << std::endl;
77 
78  if ((*r)->id().region() == 0) {
79  if (barzranges.find(s.eta_partition()) != barzranges.end()) {
80  std::pair<double, double> cic = barzranges.find(s.eta_partition())->second;
81  double cmin = cic.first;
82  double cmax = cic.second;
83  if (g.z() < cmin)
84  cmin = g.z();
85  if (g.z() > cmax)
86  cmax = g.z();
87  std::pair<double, double> cic2(cmin, cmax);
88  barzranges[s.eta_partition()] = cic2;
89  } else {
90  std::pair<double, double> cic(g.z(), g.z());
91  barzranges[s.eta_partition()] = cic;
92  }
93  } else if ((*r)->id().region() == +1) {
94  if (forRranges.find(s.eta_partition()) != forRranges.end()) {
95  std::pair<double, double> cic = forRranges.find(s.eta_partition())->second;
96  double cmin = cic.first;
97  double cmax = cic.second;
98  if (g.perp() < cmin)
99  cmin = g.perp();
100  if (g.perp() > cmax)
101  cmax = g.perp();
102  std::pair<double, double> cic2(cmin, cmax);
103  forRranges[s.eta_partition()] = cic2;
104  } else {
105  std::pair<double, double> cic(g.perp(), g.perp());
106  forRranges[s.eta_partition()] = cic;
107  }
108  } else if ((*r)->id().region() == -1) {
109  if (bacRranges.find(s.eta_partition()) != bacRranges.end()) {
110  std::pair<double, double> cic = bacRranges.find(s.eta_partition())->second;
111  double cmin = cic.first;
112  double cmax = cic.second;
113  if (g.perp() < cmin)
114  cmin = g.perp();
115  if (g.perp() > cmax)
116  cmax = g.perp();
117  std::pair<double, double> cic2(cmin, cmax);
118  bacRranges[s.eta_partition()] = cic2;
119  } else {
120  std::pair<double, double> cic(g.perp(), g.perp());
121  bacRranges[s.eta_partition()] = cic;
122  }
123  }
124  }
125  }
126  }
127 
128  std::cout << std::endl;
129  std::map<int, std::pair<double, double> >::iterator ieta;
130 
131  for (ieta = bacRranges.begin(); ieta != bacRranges.end(); ieta++) {
132  std::cout << " Eta " << ieta->first << " Radii = ( " << ieta->second.first << ", " << ieta->second.second << ")"
133  << std::endl;
134  }
135 
136  for (ieta = barzranges.begin(); ieta != barzranges.end(); ieta++) {
137  std::cout << " Eta " << ieta->first << " Z = ( " << ieta->second.first << ", " << ieta->second.second << ")"
138  << std::endl;
139  }
140 
141  for (ieta = forRranges.begin(); ieta != forRranges.end(); ieta++) {
142  std::cout << " Eta " << ieta->first << " Radii = ( " << ieta->second.first << ", " << ieta->second.second << ")"
143  << std::endl;
144  }
145 
146  std::cout << dashedLine_ << " end" << std::endl;
147 }
RPCChamber::nrolls
int nrolls() const
Retunr numbers of rolls.
Definition: RPCChamber.cc:42
RPCGeomServ
Definition: RPCGeomServ.h:8
RPCGeometryServTest::bacRranges
std::map< int, std::pair< double, double > > bacRranges
Definition: RPCGeometryServTest.h:45
ESHandle.h
RPCGeometryServTest::analyze
void analyze(const edm::Event &, const edm::EventSetup &) override
Definition: RPCGeometryServTest.cc:40
gather_cfg.cout
cout
Definition: gather_cfg.py:144
RPCGeometry::detTypes
const DetTypeContainer & detTypes() const override
Return a vector of all det types.
Definition: RPCGeometry.cc:20
edm::second
U second(std::pair< T, U > const &p)
Definition: ParameterSet.cc:222
RPCGeometry::detUnits
const DetContainer & detUnits() const override
Returm a vector of all GeomDet.
Definition: RPCGeometry.cc:22
EDAnalyzer.h
RPCChamber::rolls
const std::vector< const RPCRoll * > & rolls() const
Return the Rolls.
Definition: RPCChamber.cc:40
RPCChamber
Definition: RPCChamber.h:19
RPCGeometry::chambers
const std::vector< const RPCChamber * > & chambers() const
Return a vector of all RPC chambers.
Definition: RPCGeometry.cc:42
RectangularStripTopology.h
RPCGeomServ.h
alignCSCRings.s
s
Definition: alignCSCRings.py:92
edm::EventSetup::get
T get() const
Definition: EventSetup.h:87
RPCGeometryServTest::barzranges
std::map< int, std::pair< double, double > > barzranges
Definition: RPCGeometryServTest.h:43
edm::ESHandle< RPCGeometry >
Point3DBase< float, LocalTag >
RPCGeometry::dets
const DetContainer & dets() const override
Returm a vector of all GeomDet (including all GeomDetUnits)
Definition: RPCGeometry.cc:24
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
RPCGeometryServTest::dashedLine_
const std::string dashedLine_
Definition: RPCGeometryServTest.h:41
RPCGeometryServTest.h
LEDCalibrationChannels.ieta
ieta
Definition: LEDCalibrationChannels.py:63
edm::ParameterSet
Definition: ParameterSet.h:47
a
double a
Definition: hdecay.h:119
Event.h
iEvent
int iEvent
Definition: GenABIO.cc:224
edm::EventSetup
Definition: EventSetup.h:58
get
#define get
RPCGeometryServTest::~RPCGeometryServTest
~RPCGeometryServTest() override
Definition: RPCGeometryServTest.cc:38
alignCSCRings.r
r
Definition: alignCSCRings.py:93
std
Definition: JetResolutionObject.h:76
TrapezoidalStripTopology.h
Frameworkfwd.h
EventSetup.h
RPCGeometryServTest::RPCGeometryServTest
RPCGeometryServTest(const edm::ParameterSet &pset)
Definition: RPCGeometryServTest.cc:33
RPCGeometry::rolls
const std::vector< const RPCRoll * > & rolls() const
Return a vector of all RPC rolls.
Definition: RPCGeometry.cc:44
ParameterSet.h
MuonGeometryRecord.h
edm::Event
Definition: Event.h:73
MuonGeometryRecord
Definition: MuonGeometryRecord.h:34
RPCGeometryServTest::forRranges
std::map< int, std::pair< double, double > > forRranges
Definition: RPCGeometryServTest.h:44
RPCGeometry.h
g
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e g
Definition: Activities.doc:4
RPCGeometryServTest::myName
const std::string & myName()
Definition: RPCGeometryServTest.h:37