CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions
PGeometricDetBuilder Class Reference
Inheritance diagram for PGeometricDetBuilder:
edm::one::EDAnalyzer< edm::one::WatchRuns > edm::one::EDAnalyzerBase edm::EDConsumerBase

Public Member Functions

void analyze (edm::Event const &iEvent, edm::EventSetup const &) override
 
void beginRun (edm::Run const &iEvent, edm::EventSetup const &) override
 
void endRun (edm::Run const &iEvent, edm::EventSetup const &) override
 
 PGeometricDetBuilder (const edm::ParameterSet &)
 
- Public Member Functions inherited from edm::one::EDAnalyzer< edm::one::WatchRuns >
 EDAnalyzer ()=default
 
- Public Member Functions inherited from edm::one::EDAnalyzerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzerBase ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDAnalyzerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Member Functions

void putOne (const GeometricDet *gd, PGeometricDet *pgd, int lev)
 

Additional Inherited Members

- Public Types inherited from edm::one::EDAnalyzerBase
typedef EDAnalyzerBase ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::one::EDAnalyzerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- 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 18 of file PGeometricDetBuilder.cc.

Constructor & Destructor Documentation

PGeometricDetBuilder::PGeometricDetBuilder ( const edm::ParameterSet )
inline

Definition at line 22 of file PGeometricDetBuilder.cc.

References beginRun(), and iEvent.

22 {}

Member Function Documentation

void PGeometricDetBuilder::analyze ( edm::Event const &  iEvent,
edm::EventSetup const &   
)
inlineoverridevirtual

Implements edm::one::EDAnalyzerBase.

Definition at line 25 of file PGeometricDetBuilder.cc.

25 {}
void PGeometricDetBuilder::beginRun ( edm::Run const &  iEvent,
edm::EventSetup const &   
)
override

Definition at line 32 of file PGeometricDetBuilder.cc.

References cond::service::PoolDBOutputService::beginOfTime(), GeometricDet::components(), KineDebug3::count(), cond::service::PoolDBOutputService::createNewIOV(), GeometricDet::deepComponents(), cond::service::PoolDBOutputService::endOfTime(), edm::EventSetup::get(), edm::Service< T >::isAvailable(), cond::service::PoolDBOutputService::isNewTagRequest(), putOne(), and mixOne_simraw_on_sim_cfi::tracker.

Referenced by PGeometricDetBuilder().

33 {
34  PGeometricDet* pgd = new PGeometricDet;
36  if( !mydbservice.isAvailable() ){
37  edm::LogError("PGeometricDetBuilder")<<"PoolDBOutputService unavailable";
38  return;
39  }
42  es.get<IdealGeometryRecord>().get( pDD );
43  es.get<IdealGeometryRecord>().get( rDD );
44  const GeometricDet* tracker = &(*rDD);
45 
46  // so now I have the tracker itself. loop over all its components to store them.
47  putOne(tracker, pgd, 0);
48  std::vector<const GeometricDet*> tc = tracker->components();
49  std::vector<const GeometricDet*>::const_iterator git = tc.begin();
50  std::vector<const GeometricDet*>::const_iterator egit = tc.end();
51  int count=0;
52  int lev = 1;
53  for (; git!= egit; ++git) { // one level below "tracker"
54  putOne(*git, pgd, lev);
55  std::vector<const GeometricDet*> inone = (*git)->components();
56  if ( inone.size() == 0 ) ++count;
57  std::vector<const GeometricDet*>::const_iterator git2 = inone.begin();
58  std::vector<const GeometricDet*>::const_iterator egit2 = inone.end();
59  ++lev;
60  for (; git2 != egit2; ++git2) { // level 2
61  putOne(*git2, pgd, lev);
62  std::vector<const GeometricDet*> intwo= (*git2)->components();
63  if ( intwo.size() == 0 ) ++count;
64  std::vector<const GeometricDet*>::const_iterator git3 = intwo.begin();
65  std::vector<const GeometricDet*>::const_iterator egit3 = intwo.end();
66  ++lev;
67  for (; git3 != egit3; ++git3) { // level 3
68  putOne(*git3, pgd, lev);
69  std::vector<const GeometricDet*> inthree= (*git3)->components();
70  if ( inthree.size() == 0 ) ++count;
71  std::vector<const GeometricDet*>::const_iterator git4 = inthree.begin();
72  std::vector<const GeometricDet*>::const_iterator egit4 = inthree.end();
73  ++lev;
74  for (; git4 != egit4; ++git4) { //level 4
75  putOne(*git4, pgd, lev);
76  std::vector<const GeometricDet*> infour= (*git4)->components();
77  if ( infour.size() == 0 ) ++count;
78  std::vector<const GeometricDet*>::const_iterator git5 = infour.begin();
79  std::vector<const GeometricDet*>::const_iterator egit5 = infour.end();
80  ++lev;
81  for (; git5 != egit5; ++git5) { // level 5
82  putOne(*git5, pgd, lev);
83  std::vector<const GeometricDet*> infive= (*git5)->components();
84  if ( infive.size() == 0 ) ++count;
85  std::vector<const GeometricDet*>::const_iterator git6 = infive.begin();
86  std::vector<const GeometricDet*>::const_iterator egit6 = infive.end();
87  ++lev;
88  for (; git6 != egit6; ++git6) { //level 6
89  putOne(*git6, pgd, lev);
90  std::vector<const GeometricDet*> insix= (*git6)->components();
91  if ( insix.size() == 0 ) ++count;
92  } // level 6
93  --lev;
94  } // level 5
95  --lev;
96  } // level 4
97  --lev;
98  } //level 3
99  --lev;
100  } // level 2
101  --lev;
102  }
103  std::vector<const GeometricDet*> modules = tracker->deepComponents();
104  if ( mydbservice->isNewTagRequest("IdealGeometryRecord") ) {
105  mydbservice->createNewIOV<PGeometricDet>( pgd,mydbservice->beginOfTime(),mydbservice->endOfTime(),"IdealGeometryRecord");
106  } else {
107  edm::LogError("PGeometricDetBuilder")<<"PGeometricDetBuilder Tag already present";
108  }
109 }
ConstGeometricDetContainer & components()
Definition: GeometricDet.h:176
bool isNewTagRequest(const std::string &recordName)
bool isAvailable() const
Definition: Service.h:46
void createNewIOV(T *firstPayloadObj, cond::Time_t firstSinceTime, cond::Time_t firstTillTime, const std::string &recordName, bool withlogging=false)
void putOne(const GeometricDet *gd, PGeometricDet *pgd, int lev)
ConstGeometricDetContainer deepComponents() const
void PGeometricDetBuilder::endRun ( edm::Run const &  iEvent,
edm::EventSetup const &   
)
inlineoverride

Definition at line 26 of file PGeometricDetBuilder.cc.

References putOne().

26 {}
void PGeometricDetBuilder::putOne ( const GeometricDet gd,
PGeometricDet pgd,
int  lev 
)
private

Definition at line 111 of file PGeometricDetBuilder.cc.

References PGeometricDet::Item::_a11, PGeometricDet::Item::_a12, PGeometricDet::Item::_a13, PGeometricDet::Item::_a21, PGeometricDet::Item::_a22, PGeometricDet::Item::_a23, PGeometricDet::Item::_a31, PGeometricDet::Item::_a32, PGeometricDet::Item::_a33, PGeometricDet::Item::_geographicalID, PGeometricDet::Item::_level, PGeometricDet::Item::_name, PGeometricDet::Item::_ns, PGeometricDet::Item::_nt0, PGeometricDet::Item::_nt1, PGeometricDet::Item::_nt10, PGeometricDet::Item::_nt2, PGeometricDet::Item::_nt3, PGeometricDet::Item::_nt4, PGeometricDet::Item::_nt5, PGeometricDet::Item::_nt6, PGeometricDet::Item::_nt7, PGeometricDet::Item::_nt8, PGeometricDet::Item::_nt9, PGeometricDet::Item::_numnt, PGeometricDet::Item::_params0, PGeometricDet::Item::_params1, PGeometricDet::Item::_params10, PGeometricDet::Item::_params2, PGeometricDet::Item::_params3, PGeometricDet::Item::_params4, PGeometricDet::Item::_params5, PGeometricDet::Item::_params6, PGeometricDet::Item::_params7, PGeometricDet::Item::_params8, PGeometricDet::Item::_params9, PGeometricDet::Item::_phi, PGeometricDet::Item::_pixROCCols, PGeometricDet::Item::_pixROCRows, PGeometricDet::Item::_pixROCx, PGeometricDet::Item::_pixROCy, PGeometricDet::Item::_radLength, PGeometricDet::Item::_rho, PGeometricDet::Item::_shape, PGeometricDet::Item::_siliconAPVNum, PGeometricDet::Item::_stereo, PGeometricDet::Item::_type, PGeometricDet::Item::_x, PGeometricDet::Item::_xi, PGeometricDet::Item::_y, PGeometricDet::Item::_z, DEFINE_FWK_MODULE, GeometricDet::geographicalID(), DDName::name(), GeometricDet::name(), GeometricDet::navType(), DDName::ns(), nt, GeometricDet::params(), PGeometricDet::pgeomdets_, GeometricDet::phi(), GeometricDet::pixROCCols(), GeometricDet::pixROCRows(), GeometricDet::pixROCx(), GeometricDet::pixROCy(), GeometricDet::radLength(), GeometricDet::rho(), makeMuonMisalignmentScenario::rot, GeometricDet::rotation(), GeometricDet::shape(), GeometricDet::siliconAPVNum(), GeometricDet::stereo(), GeometricDet::translation(), GeometricDet::type(), x, GeometricDet::xi(), y, and z.

Referenced by beginRun(), and endRun().

111  {
112 
113  PGeometricDet::Item item;
114  DDTranslation tran = gd->translation();
115  DDRotationMatrix rot = gd->rotation();
116  DD3Vector x, y, z;
117  rot.GetComponents(x, y, z);
118  item._name = gd->name().name();
119  item._ns = gd->name().ns();
120  item._level = lev;
121  item._x = tran.X();
122  item._y = tran.Y();
123  item._z = tran.Z();
124  item._phi = gd->phi();
125  item._rho = gd->rho();
126  item._a11 = x.X();
127  item._a12 = y.X();
128  item._a13 = z.X();
129  item._a21 = x.Y();
130  item._a22 = y.Y();
131  item._a23 = z.Y();
132  item._a31 = x.Z();
133  item._a32 = y.Z();
134  item._a33 = z.Z();
135  item._shape = gd->shape();
136  item._type = gd->type();
137  if(gd->shape()==1){
138  item._params0=gd->params()[0];
139  item._params1=gd->params()[1];
140  item._params2=gd->params()[2];
141  item._params3=0;
142  item._params4=0;
143  item._params5=0;
144  item._params6=0;
145  item._params7=0;
146  item._params8=0;
147  item._params9=0;
148  item._params10=0;
149  }else if(gd->shape()==3){
150  item._params0=gd->params()[0];
151  item._params1=gd->params()[1];
152  item._params2=gd->params()[2];
153  item._params3=gd->params()[3];
154  item._params4=gd->params()[4];
155  item._params5=gd->params()[5];
156  item._params6=gd->params()[6];
157  item._params7=gd->params()[7];
158  item._params8=gd->params()[8];
159  item._params9=gd->params()[9];
160  item._params10=gd->params()[10];
161  }else{
162  item._params0=0;
163  item._params1=0;
164  item._params2=0;
165  item._params3=0;
166  item._params4=0;
167  item._params5=0;
168  item._params6=0;
169  item._params7=0;
170  item._params8=0;
171  item._params9=0;
172  item._params10=0;
173  }
174  item._geographicalID = gd->geographicalID();
175  item._radLength = gd->radLength();
176  item._xi = gd->xi();
177  item._pixROCRows = gd->pixROCRows();
178  item._pixROCCols = gd->pixROCCols();
179  item._pixROCx = gd->pixROCx();
180  item._pixROCy = gd->pixROCy();
181  item._stereo = gd->stereo();
182  item._siliconAPVNum = gd->siliconAPVNum();
183 
184  GeometricDet::nav_type const & nt = gd->navType();
185  size_t nts = nt.size();
186  item._numnt = nts;
187  std::vector<int> tempnt(nt.begin(),nt.end());
188  for ( size_t extrant = nt.size(); extrant < 11; ++extrant ) {
189  tempnt.push_back(-1);
190  }
191  item._nt0 = tempnt[0];
192  item._nt1 = tempnt[1];
193  item._nt2 = tempnt[2];
194  item._nt3 = tempnt[3];
195  item._nt4 = tempnt[4];
196  item._nt5 = tempnt[5];
197  item._nt6 = tempnt[6];
198  item._nt7 = tempnt[7];
199  item._nt8 = tempnt[8];
200  item._nt9 = tempnt[9];
201  item._nt10 = tempnt[10];
202 
203  pgd->pgeomdets_.push_back ( item );
204 }
double pixROCy() const
Definition: GeometricDet.h:276
double radLength() const
Definition: GeometricDet.h:253
nav_type const & navType() const
Definition: GeometricDet.h:151
DDSolidShape const & shape() const
Definition: GeometricDet.h:138
std::vector< Item > pgeomdets_
Definition: PGeometricDet.h:50
const std::string & ns() const
Returns the namespace.
Definition: DDName.cc:104
DetId geographicalID() const
Definition: GeometricDet.h:208
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DDTranslation
Definition: DDTranslation.h:7
std::vector< double > const & params() const
Definition: GeometricDet.h:165
DDName const & name() const
Definition: GeometricDet.h:146
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DD3Vector
A DD Translation is currently implemented with Root Vector3D.
Definition: DDTranslation.h:6
DDTranslation const & translation() const
Definition: GeometricDet.h:125
double pixROCCols() const
Definition: GeometricDet.h:268
DDRotationMatrix const & rotation() const
Definition: GeometricDet.h:121
int nt
Definition: AMPTWrapper.h:32
double xi() const
Definition: GeometricDet.h:257
double pixROCx() const
Definition: GeometricDet.h:272
double phi() const
Definition: GeometricDet.h:129
double siliconAPVNum() const
Definition: GeometricDet.h:288
DDExpandedView::nav_type nav_type
Definition: GeometricDet.h:44
bool stereo() const
Definition: GeometricDet.h:284
double pixROCRows() const
Definition: GeometricDet.h:264
ROOT::Math::Rotation3D DDRotationMatrix
A DDRotationMatrix is currently implemented with a ROOT Rotation3D.
const std::string & name() const
Returns the name.
Definition: DDName.cc:90
GeometricEnumType type() const
Definition: GeometricDet.h:142
double rho() const
Definition: GeometricDet.h:133