CMS 3D CMS Logo

RPCGeometryServTest.cc
Go to the documentation of this file.
1 
6 #include <memory>
7 #include <fstream>
14 
15 #include <cmath>
16 #include <vector>
17 #include <iomanip>
18 #include <set>
19 
20 using namespace std;
21 
23  : dashedLineWidth_(104), dashedLine_(std::string(dashedLineWidth_, '-')), myName_("RPCGeometryServTest") {
24  std::cout << "======================== Opening output file" << std::endl;
26 }
27 
29 
31  const auto& pDD = iSetup.getHandle(rpcGeomToken_);
32 
33  std::cout << myName() << ": Analyzer..." << std::endl;
34  std::cout << "start " << dashedLine_ << std::endl;
35 
36  std::cout << " Geometry node for RPCGeom is " << &(*pDD) << std::endl;
37  cout << " I have " << pDD->detTypes().size() << " detTypes" << endl;
38  cout << " I have " << pDD->detUnits().size() << " detUnits" << endl;
39  cout << " I have " << pDD->dets().size() << " dets" << endl;
40  cout << " I have " << pDD->rolls().size() << " rolls" << endl;
41  cout << " I have " << pDD->chambers().size() << " chambers" << endl;
42 
43  std::cout << myName() << ": Begin iteration over geometry..." << std::endl;
44  std::cout << "iter " << dashedLine_ << std::endl;
45 
46  int iRPCCHcount = 0;
47  LocalPoint a(0., 0., 0.);
48  for (TrackingGeometry::DetContainer::const_iterator it = pDD->dets().begin(); it != pDD->dets().end(); it++) {
49  //----------------------- RPCCHAMBER TEST ---------------------------
50 
51  if (dynamic_cast<const RPCChamber*>(*it) != nullptr) {
52  ++iRPCCHcount;
53  const RPCChamber* ch = dynamic_cast<const RPCChamber*>(*it);
54 
55  std::vector<const RPCRoll*> rollsRaf = (ch->rolls());
56  for (std::vector<const RPCRoll*>::iterator r = rollsRaf.begin(); r != rollsRaf.end(); ++r) {
57  std::cout << dashedLine_ << " NEW ROLL" << std::endl;
58  std::cout << "Region = " << (*r)->id().region() << " Ring = " << (*r)->id().ring()
59  << " Station = " << (*r)->id().station() << " Sector = " << (*r)->id().sector()
60  << " Layer = " << (*r)->id().layer() << " Subsector = " << (*r)->id().subsector()
61  << " Roll = " << (*r)->id().roll() << std::endl;
62  RPCGeomServ s((*r)->id());
63  GlobalPoint g = (*r)->toGlobal(a);
64  std::cout << s.name() << " eta partition " << s.eta_partition() << " nroll=" << ch->nrolls() << " z=" << g.z()
65  << " phi=" << g.phi() << " R=" << g.perp() << std::endl;
66 
67  if ((*r)->id().region() == 0) {
68  if (barzranges.find(s.eta_partition()) != barzranges.end()) {
69  std::pair<double, double> cic = barzranges.find(s.eta_partition())->second;
70  double cmin = cic.first;
71  double cmax = cic.second;
72  if (g.z() < cmin)
73  cmin = g.z();
74  if (g.z() > cmax)
75  cmax = g.z();
76  std::pair<double, double> cic2(cmin, cmax);
77  barzranges[s.eta_partition()] = cic2;
78  } else {
79  std::pair<double, double> cic(g.z(), g.z());
80  barzranges[s.eta_partition()] = cic;
81  }
82  } else if ((*r)->id().region() == +1) {
83  if (forRranges.find(s.eta_partition()) != forRranges.end()) {
84  std::pair<double, double> cic = forRranges.find(s.eta_partition())->second;
85  double cmin = cic.first;
86  double cmax = cic.second;
87  if (g.perp() < cmin)
88  cmin = g.perp();
89  if (g.perp() > cmax)
90  cmax = g.perp();
91  std::pair<double, double> cic2(cmin, cmax);
92  forRranges[s.eta_partition()] = cic2;
93  } else {
94  std::pair<double, double> cic(g.perp(), g.perp());
95  forRranges[s.eta_partition()] = cic;
96  }
97  } else if ((*r)->id().region() == -1) {
98  if (bacRranges.find(s.eta_partition()) != bacRranges.end()) {
99  std::pair<double, double> cic = bacRranges.find(s.eta_partition())->second;
100  double cmin = cic.first;
101  double cmax = cic.second;
102  if (g.perp() < cmin)
103  cmin = g.perp();
104  if (g.perp() > cmax)
105  cmax = g.perp();
106  std::pair<double, double> cic2(cmin, cmax);
107  bacRranges[s.eta_partition()] = cic2;
108  } else {
109  std::pair<double, double> cic(g.perp(), g.perp());
110  bacRranges[s.eta_partition()] = cic;
111  }
112  }
113  }
114  }
115  }
116 
117  std::cout << std::endl;
118  std::map<int, std::pair<double, double> >::iterator ieta;
119 
120  for (ieta = bacRranges.begin(); ieta != bacRranges.end(); ieta++) {
121  std::cout << " Eta " << ieta->first << " Radii = ( " << ieta->second.first << ", " << ieta->second.second << ")"
122  << std::endl;
123  }
124 
125  for (ieta = barzranges.begin(); ieta != barzranges.end(); ieta++) {
126  std::cout << " Eta " << ieta->first << " Z = ( " << ieta->second.first << ", " << ieta->second.second << ")"
127  << std::endl;
128  }
129 
130  for (ieta = forRranges.begin(); ieta != forRranges.end(); ieta++) {
131  std::cout << " Eta " << ieta->first << " Radii = ( " << ieta->second.first << ", " << ieta->second.second << ")"
132  << std::endl;
133  }
134 
135  std::cout << dashedLine_ << " end" << std::endl;
136 }
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:32
RPCGeometryServTest::analyze
void analyze(const edm::Event &, const edm::EventSetup &) override
Definition: RPCGeometryServTest.cc:30
gather_cfg.cout
cout
Definition: gather_cfg.py:144
edm::second
U second(std::pair< T, U > const &p)
Definition: ParameterSet.cc:222
RPCChamber::rolls
const std::vector< const RPCRoll * > & rolls() const
Return the Rolls.
Definition: RPCChamber.cc:40
RPCChamber
Definition: RPCChamber.h:19
RectangularStripTopology.h
RPCGeomServ.h
alignCSCRings.s
s
Definition: alignCSCRings.py:92
RPCGeometryServTest::barzranges
std::map< int, std::pair< double, double > > barzranges
Definition: RPCGeometryServTest.h:30
Point3DBase< float, LocalTag >
RPCGeometryServTest::dashedLine_
const std::string dashedLine_
Definition: RPCGeometryServTest.h:28
RPCGeometryServTest.h
LEDCalibrationChannels.ieta
ieta
Definition: LEDCalibrationChannels.py:63
edm::ParameterSet
Definition: ParameterSet.h:47
a
double a
Definition: hdecay.h:119
RPCGeometryServTest::rpcGeomToken_
edm::ESGetToken< RPCGeometry, MuonGeometryRecord > rpcGeomToken_
Definition: RPCGeometryServTest.h:33
iEvent
int iEvent
Definition: GenABIO.cc:224
edm::EventSetup::getHandle
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:155
edm::EventSetup
Definition: EventSetup.h:58
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
RPCGeometryServTest::~RPCGeometryServTest
~RPCGeometryServTest() override
Definition: RPCGeometryServTest.cc:28
alignCSCRings.r
r
Definition: alignCSCRings.py:93
std
Definition: JetResolutionObject.h:76
TrapezoidalStripTopology.h
edm::EDConsumerBase::esConsumes
auto esConsumes()
Definition: EDConsumerBase.h:206
RPCGeometryServTest::RPCGeometryServTest
RPCGeometryServTest(const edm::ParameterSet &pset)
Definition: RPCGeometryServTest.cc:22
MuonGeometryRecord.h
edm::Event
Definition: Event.h:73
RPCGeometryServTest::forRranges
std::map< int, std::pair< double, double > > forRranges
Definition: RPCGeometryServTest.h:31
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:24