CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Attributes
SolidsForOnline Class Reference
Inheritance diagram for SolidsForOnline:
edm::EDAnalyzer edm::EDConsumerBase

Public Member Functions

virtual void analyze (const edm::Event &, const edm::EventSetup &)
 
virtual void beginRun (const edm::Run &, const edm::EventSetup &)
 
 SolidsForOnline (const edm::ParameterSet &)
 
 ~SolidsForOnline ()
 
- Public Member Functions inherited from edm::EDAnalyzer
 EDAnalyzer ()
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 
- Public Member Functions inherited from edm::EDConsumerBase
 EDConsumerBase ()
 
ProductHolderIndex indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndex > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndex > &) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Attributes

std::string filename_
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
typedef WorkerT< EDAnalyzerWorkerType
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
- Protected Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
CurrentProcessingContext const * currentContext () const
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

Definition at line 22 of file SolidsForOnline.cc.

Constructor & Destructor Documentation

SolidsForOnline::SolidsForOnline ( const edm::ParameterSet iConfig)
explicit

Definition at line 37 of file SolidsForOnline.cc.

37 { }
SolidsForOnline::~SolidsForOnline ( )

Definition at line 40 of file SolidsForOnline.cc.

40 { }

Member Function Documentation

void SolidsForOnline::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
)
virtual

Implements edm::EDAnalyzer.

Definition at line 42 of file SolidsForOnline.cc.

References gather_cfg::cout.

42  {
43  std::cout << "analyze does nothing" << std::endl;
44 }
tuple cout
Definition: gather_cfg.py:121
void SolidsForOnline::beginRun ( const edm::Run ,
const edm::EventSetup iSetup 
)
virtual

Reimplemented from edm::EDAnalyzer.

Definition at line 46 of file SolidsForOnline.cc.

References DDTrap::alpha1(), DDTrap::alpha2(), DDPseudoTrap::atMinusZ(), DDBase< DDName, DDI::Solid * >::begin(), gather_cfg::cout, DDTruncTubs::cutAtDelta(), DDTruncTubs::cutAtStart(), DDTruncTubs::cutInside(), dd_not_init, ddbox, ddcons, ddintersection, ddpolycone_rrz, ddpolycone_rz, ddpolyhedra_rrz, ddpolyhedra_rz, ddpseudotrap, ddreflected, ddshapeless, ddsubtraction, ddtorus, ddtrap, ddtrunctubs, ddtubs, ddunion, DDTruncTubs::deltaPhi(), DDPolycone::deltaPhi(), DDPolyhedra::deltaPhi(), DDTubs::deltaPhi(), DDCons::deltaPhi(), DDTorus::deltaPhi(), DDBase< DDName, DDI::Solid * >::end(), edm::hlt::Exception, edm::EventSetup::get(), DDCompactView::graph(), DDBox::halfX(), DDBox::halfY(), DDTrap::halfZ(), DDPseudoTrap::halfZ(), DDBox::halfZ(), DDSolidShapesName::name(), DDBase< N, C >::name(), DDTrap::phi(), DDCons::phiFrom(), DDPseudoTrap::radius(), DDTruncTubs::rIn(), DDTubs::rIn(), DDCons::rInMinusZ(), DDCons::rInPlusZ(), DDTorus::rMax(), DDTorus::rMin(), DDBooleanSolid::rotation(), DDTruncTubs::rOut(), DDTubs::rOut(), DDCons::rOutMinusZ(), DDCons::rOutPlusZ(), DDTorus::rTorus(), DDSolid::shape(), DDPolyhedra::sides(), DDBooleanSolid::solidA(), DDBooleanSolid::solidB(), DDTruncTubs::startPhi(), DDPolycone::startPhi(), DDPolyhedra::startPhi(), DDTubs::startPhi(), DDTorus::startPhi(), AlCaHLTBitMon_QueryRunRegistry::string, DDTrap::theta(), DDBooleanSolid::translation(), DDReflectionSolid::unreflected(), DDTrap::x1(), DDPseudoTrap::x1(), DDTrap::x2(), DDPseudoTrap::x2(), DDTrap::x3(), DDTrap::x4(), DDTrap::y1(), DDPseudoTrap::y1(), DDTrap::y2(), DDPseudoTrap::y2(), DDTruncTubs::zHalf(), DDTubs::zhalf(), and DDCons::zhalf().

46  {
47 
48 // TRD1 and Trapezoid can be in the same files.
49 
50  std::string solidsFileName("SOLIDS.dat"); //added by Jie Chen
51  std::string boxFileName("BOXES.dat");
52 
53  std::string tubesFileName("TUBES.dat");
54  std::string polyHedraFileName("POLYHEDRAS.dat");
55  std::string polyConeFileName("POLYCONES.dat");
56  std::string conesFileName("CONES.dat");
57  std::string pseudoTrapFileName("PSEUDOTRAPEZOIDS.dat");
58  std::string trapFileName("TRAPEZOIDS.dat");
59  std::string boolSolidsFileName("BOOLEANSOLIDS.dat");
60  std::string reflectionSolidsFileName("REFLECTIONSOLIDS.dat");
61  std::string torusFileName("TORUS.dat");
62 
63  std::ofstream solidsOS(solidsFileName.c_str());
64  std::ofstream boxOS(boxFileName.c_str());
65  std::ofstream tubeOS(tubesFileName.c_str());
66  std::ofstream polyHOS(polyHedraFileName.c_str());
67  std::ofstream polyCOS(polyConeFileName.c_str());
68  std::ofstream coneOS(conesFileName.c_str());
69  std::ofstream ptrapOS(pseudoTrapFileName.c_str());
70  std::ofstream trapOS(trapFileName.c_str());
71  std::ofstream boolOS(boolSolidsFileName.c_str());
72  std::ofstream reflectionOS(reflectionSolidsFileName.c_str());
73  std::ofstream torusOS(torusFileName.c_str());
74 
75  std::cout << "SolidsForOnline Analyzer..." << std::endl;
76 
78 
79  iSetup.get<IdealGeometryRecord>().get( "", pDD );
80 
81  const DDCompactView & cpv = *pDD;
82  DDCompactView::graph_type gra = cpv.graph();
83 
84  DDSolid::iterator<DDSolid> sit(DDSolid::begin()), sed(DDSolid::end());
85  for (; sit != sed; ++sit) {
86  if (! sit->isDefined().second) continue;
87  const DDSolid& solid = *sit;
89  solidsOS<<solid.name()<<","<<DDSolidShapesName::name(solid.shape())
90  << std::endl;
91 
92 
93  switch (solid.shape())
94  {
95  case ddunion:
96  {
97  //for bool solid
98  DDBooleanSolid boolSolid(solid);
99  boolOS << boolSolid.name() << "," ;
100  boolOS << "U";
101  boolOS << "," << boolSolid.translation().x()
102  << "," << boolSolid.translation().y()
103  << "," << boolSolid.translation().z()
104  << "," << boolSolid.solidA().name()
105  << "," << boolSolid.solidB().name()
106  << "," << boolSolid.rotation().name()
107  << std::endl;
108 
109  break;
110  }
111  case ddsubtraction:
112  {
113  DDBooleanSolid boolSolid(solid);
114  boolOS << boolSolid.name() << "," ;
115  boolOS << "S";
116  boolOS << "," << boolSolid.translation().x()
117  << "," << boolSolid.translation().y()
118  << "," << boolSolid.translation().z()
119  << "," << boolSolid.solidA().name()
120  << "," << boolSolid.solidB().name()
121  << "," << boolSolid.rotation().name()
122  << std::endl;
123  break;
124  }
125  case ddintersection:
126  {
127 
128  //for bool solid
129  DDBooleanSolid boolSolid(solid);
130  // if translation is == identity there are no parameters.
131  // if there is no rotation the name will be ":"
132  //std::string rotName = boolSolid.rotation().toString();
133  //if (rotName == ":") {
134  // rotName = "rotations:UNIT";
135  //}
136  boolOS << boolSolid.name() << "," ;
137  boolOS << "I";
138  boolOS << "," << boolSolid.translation().x()
139  << "," << boolSolid.translation().y()
140  << "," << boolSolid.translation().z()
141  << "," << boolSolid.solidA().name()
142  << "," << boolSolid.solidB().name()
143  << "," << boolSolid.rotation().name()
144  << std::endl;
145 
146  break;
147 
148  }
149  case ddreflected:
150  {
151  DDReflectionSolid reflection(solid);
152  reflectionOS<<reflection.name()<<","
153  <<reflection.unreflected().name()
154  <<std::endl;
155  break;
156  }
157  case ddbox:
158  {
159  DDBox box(solid);
160  //std::cout<<"box shape is"<<solid.shape()<<std::endl;
161  boxOS<<box.name()<<",";
162  boxOS<<2.0*box.halfX()<<","<<2.0*box.halfY()<<","<<2.0*box.halfZ()<<std::endl;
163  break;
164  }
165 
166  case ddpseudotrap:
167  {
168  DDPseudoTrap pseudoTrap(solid);
169 
170  ptrapOS<<pseudoTrap.name() <<",";
171  ptrapOS<<pseudoTrap.x1() <<","<<pseudoTrap.x2() <<","
172  <<pseudoTrap.halfZ()*2. <<","<<pseudoTrap.y1() <<","
173  <<pseudoTrap.y2() <<","<<pseudoTrap.radius()<<","
174  <<pseudoTrap.atMinusZ()
175  << std::endl;
176 
177  break;
178  }
179 
180  case ddtubs:
181  {
182  //same as ddtrunctubs, Tube element is simply a Tube Section
183  //with the angle going from zero to 360 degrees.
184  //cutAtStart, cutAtDelta, and cutInside. are all zero
185  //then they are tubes
186  DDTubs tubs(solid);
187  tubeOS<<tubs.name()<<","<<tubs.rIn()<<","
188  <<tubs.rOut()<<","<<tubs.zhalf()*2.0<<","
189  <<tubs.startPhi()<<","<<tubs.deltaPhi()<<","
190  <<"0"<<","<<"0"<<","
191  <<"0"
192  <<std::endl;
193 
194  break;
195  }
196  case ddtrap: // trd1s is included into this case
197  {
198  DDTrap trap(solid);
199  trapOS<<trap.name()<<",";
200  trapOS<<trap.alpha1()<<","<<trap.alpha2()<<","
201  <<trap.x1()<<","<<trap.x2()<<","
202  <<trap.halfZ()*2.0<<","<<trap.y1()<<","
203  <<trap.y2()<<","
204  <<trap.phi()<<","<<trap.theta()<<","
205  <<trap.x3()<<","<<trap.x4()
206  <<std::endl;
207  break;
208  }
209  case ddcons:
210  {
211  DDCons cons(solid);
212  coneOS<<cons.name()<<","<<cons.zhalf()*2.0<<","
213  <<cons.rInMinusZ()<<","
214  <<cons.rOutMinusZ()<<","<<cons.rInPlusZ()<<","
215  <<cons.rOutPlusZ()<<","<<cons.phiFrom()<<","
216  <<cons.deltaPhi()
217  <<std::endl;
218 
219  break;
220  }
221 
222  case ddpolycone_rz:
223  {
224  //rz_zs=rz if it's ddpolycone_rz
225  DDPolycone polyCone(solid);
226  polyCOS<<polyCone.name()<<","<<polyCone.startPhi()
227  <<","<<polyCone.deltaPhi()<<","<<"RZ"
228  <<std::endl;
229  break;
230  }
231  case ddpolyhedra_rz:
232  {
233  DDPolyhedra polyHedra(solid);
234  polyHOS<<polyHedra.name()<<",";
235  polyHOS<<polyHedra.sides()<<","<<polyHedra.startPhi()
236  <<","<<polyHedra.deltaPhi()<<","<<"RZ"
237  <<std::endl;
238  break;
239  }
240  case ddpolycone_rrz:{
241  //rz_zs=zs if it's ddpolycone_rrz
242  DDPolycone polyCone(solid);
243  polyCOS<<polyCone.name()<<","<<polyCone.startPhi()
244  <<","<<polyCone.deltaPhi()<<","<<"ZS"
245  <<std::endl;
246  break;
247  }
248  case ddpolyhedra_rrz:
249  {
250 
251  DDPolyhedra polyHedra(solid);
252  polyHOS<<polyHedra.name()<<",";
253  polyHOS<<polyHedra.sides()<<","<<polyHedra.startPhi()
254  <<","<<polyHedra.deltaPhi()<<","<<"ZS"
255  <<std::endl;
256  break;
257  }
258 
259  case ddtrunctubs:{
260 
261  DDTruncTubs tubs(solid);
262  tubeOS<<tubs.name()<<","<<tubs.rIn()<<","
263  <<tubs.rOut()<<","<<tubs.zHalf()*2.0<<","
264  <<tubs.startPhi()<<","<<tubs.deltaPhi()<<","
265  <<tubs.cutAtStart()<<","<<tubs.cutAtDelta()<<","
266  <<tubs.cutInside()
267  <<std::endl;
268  break;
269  }
270 
271  case ddtorus: {
272  DDTorus torus(solid);
273  torusOS<<torus.name()<<","<<torus.rMin()<<","
274  <<torus.rMax()<<","<<torus.rTorus()<<","
275  <<torus.startPhi()<<","<<torus.deltaPhi()
276  <<std::endl;
277  break;
278  }
279 
280  case ddshapeless:{
281  // DDShapelessSolid shapeless(solid);
282  //shapelessOS<<shapeless.name()
283  // <<std::endl;
284 
285 // return new PSolid( solid.toString(), solid.parameters()
286 // , solid.shape() );
287  break;
288  }
289  case dd_not_init:
290  default:
291  throw cms::Exception("DDException") << "DDDToPersFactory::solid(...) either not inited or no such solid.";
292  break;
293  }
294 
295 
296  }
297  solidsOS.close();
298  boxOS.close();
299 
300  tubeOS.close();
301  polyHOS.close();
302  polyCOS.close();
303  coneOS.close();
304  ptrapOS.close();
305  trapOS.close();
306  boolOS.close();
307  reflectionOS.close();
308 }
A truncated tube section.
Definition: DDSolid.h:132
const N & name() const
Definition: DDBase.h:82
const graph_type & graph() const
Provides read-only access to the data structure of the compact-view.
type of data representation of DDCompactView
Definition: DDCompactView.h:77
A DDSolid represents the shape of a part.
Definition: DDSolid.h:35
static const char * name(DDSolidShape s)
Definition: DDSolidShapes.h:21
Interface to a Trapezoid.
Definition: DDSolid.h:77
DDSolidShape shape(void) const
The type of the solid.
Definition: DDSolid.cc:144
Interface to a Box.
Definition: DDSolid.h:162
const T & get() const
Definition: EventSetup.h:55
static DDI::Store< DDName, DDI::Solid * >::iterator begin()
Definition: DDBase.h:70
tuple cout
Definition: gather_cfg.py:121
static DDI::Store< DDName, DDI::Solid * >::iterator end()
Definition: DDBase.h:69

Member Data Documentation

std::string SolidsForOnline::filename_
private

Definition at line 34 of file SolidsForOnline.cc.