CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions
GeometricDetLoader Class Reference

#include <GeometricDetLoader.h>

Inheritance diagram for GeometricDetLoader:
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 beginJob () override
 
void beginRun (edm::Run const &iEvent, edm::EventSetup const &) override
 
void endJob () override
 
void endRun (edm::Run const &iEvent, edm::EventSetup const &) override
 
 GeometricDetLoader (const edm::ParameterSet &iConfig)
 
 ~GeometricDetLoader ()
 
- 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 14 of file GeometricDetLoader.h.

Constructor & Destructor Documentation

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

Definition at line 26 of file GeometricDetLoader.cc.

References gather_cfg::cout.

27 {
28  std::cout<<"GeometricDetLoader::GeometricDetLoader"<<std::endl;
29 }
GeometricDetLoader::~GeometricDetLoader ( )

Definition at line 31 of file GeometricDetLoader.cc.

References gather_cfg::cout.

32 {
33  std::cout<<"GeometricDetLoader::~GeometricDetLoader"<<std::endl;
34 }

Member Function Documentation

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

Implements edm::one::EDAnalyzerBase.

Definition at line 22 of file GeometricDetLoader.h.

22 {}
void GeometricDetLoader::beginJob ( void  )
inlineoverridevirtual

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 20 of file GeometricDetLoader.h.

References beginRun(), and iEvent.

20 {}
void GeometricDetLoader::beginRun ( edm::Run const &  iEvent,
edm::EventSetup const &  es 
)
override

Definition at line 37 of file GeometricDetLoader.cc.

References cond::service::PoolDBOutputService::beginOfTime(), GeometricDet::components(), KineDebug3::count(), gather_cfg::cout, 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 beginJob().

38 {
39  std::cout<<"GeometricDetLoader::beginJob"<<std::endl;
40  PGeometricDet* pgd = new PGeometricDet;
42  if( !mydbservice.isAvailable() ){
43  std::cout<<"PoolDBOutputService unavailable"<<std::endl;
44  return;
45  }
48  es.get<IdealGeometryRecord>().get( pDD );
49  es.get<IdealGeometryRecord>().get( rDD );
50  const GeometricDet* tracker = &(*rDD);
51 
52  // so now I have the tracker itself. loop over all its components to store them.
53  putOne(tracker, pgd, 0);
54  std::vector<const GeometricDet*> tc = tracker->components();
55  std::cout <<"Tracker has " << tc.size() << " components." << std::endl; //, lets go through them." << std::endl;
56  std::vector<const GeometricDet*>::const_iterator git = tc.begin();
57  std::vector<const GeometricDet*>::const_iterator egit = tc.end();
58  int count=0;
59  int lev = 1;
60  for (; git!= egit; ++git) { // one level below "tracker"
61  putOne(*git, pgd, lev);
62  std::vector<const GeometricDet*> inone = (*git)->components();
63  // << ctste.name((*git)->type())
64  // std::cout << lev << " type " << (*git)->type() << " " << int((*git)->geographicalId()) << std::endl; // << " has " << inone.size() << " components." << std::endl;
65  if ( inone.size() == 0 ) ++count;
66  std::vector<const GeometricDet*>::const_iterator git2 = inone.begin();
67  std::vector<const GeometricDet*>::const_iterator egit2 = inone.end();
68  ++lev;
69  for (; git2 != egit2; ++git2) { // level 2
70  putOne(*git2, pgd, lev);
71  std::vector<const GeometricDet*> intwo= (*git2)->components();
72  // std::cout << lev << "\ttype " << (*git2)->type() << " " << int((*git2)->geographicalId()) << std::endl; // << " has " << intwo.size() << " components." << std::endl;
73  if ( intwo.size() == 0 ) ++count;
74  std::vector<const GeometricDet*>::const_iterator git3 = intwo.begin();
75  std::vector<const GeometricDet*>::const_iterator egit3 = intwo.end();
76  ++lev;
77  for (; git3 != egit3; ++git3) { // level 3
78  putOne(*git3, pgd, lev);
79  std::vector<const GeometricDet*> inthree= (*git3)->components();
80  // std::cout << lev << "\t\ttype " << (*git3)->type() << " " << int((*git3)->geographicalId()) << std::endl; // << " has " << inthree.size() << " components." << std::endl;
81  if ( inthree.size() == 0 ) ++count;
82  std::vector<const GeometricDet*>::const_iterator git4 = inthree.begin();
83  std::vector<const GeometricDet*>::const_iterator egit4 = inthree.end();
84  ++lev;
85  for (; git4 != egit4; ++git4) { //level 4
86  putOne(*git4, pgd, lev);
87  std::vector<const GeometricDet*> infour= (*git4)->components();
88  // std::cout << lev << "\t\t\ttype " << (*git4)->type() << " " << int((*git4)->geographicalId()) << std::endl; // << " has " << infour.size() << " components." << std::endl;
89  if ( infour.size() == 0 ) ++count;
90  std::vector<const GeometricDet*>::const_iterator git5 = infour.begin();
91  std::vector<const GeometricDet*>::const_iterator egit5 = infour.end();
92  ++lev;
93  for (; git5 != egit5; ++git5) { // level 5
94  putOne(*git5, pgd, lev);
95  std::vector<const GeometricDet*> infive= (*git5)->components();
96  // std::cout << lev << "\t\t\t\ttype " << (*git5)->type() << " " << int((*git5)->geographicalId()) << std::endl; // << " has " << infive.size() << " components." << std::endl;
97  if ( infive.size() == 0 ) ++count;
98  std::vector<const GeometricDet*>::const_iterator git6 = infive.begin();
99  std::vector<const GeometricDet*>::const_iterator egit6 = infive.end();
100  ++lev;
101  for (; git6 != egit6; ++git6) { //level 6
102  putOne(*git6, pgd, lev);
103  std::vector<const GeometricDet*> insix= (*git6)->components();
104  // std::cout << lev << "\t\t\t\t\ttype " << (*git6)->type() << " " << int((*git6)->geographicalId()) << std::endl; // << " has " << insix.size() << " components." << std::endl;
105  if ( insix.size() == 0 ) ++count;
106  } // level 6
107  --lev;
108  } // level 5
109  --lev;
110  } // level 4
111  --lev;
112  } //level 3
113  --lev;
114  } // level 2
115  --lev;
116  }
117  std::vector<const GeometricDet*> modules = tracker->deepComponents();
118  std::cout << " No. of Tracker components \"deepComponents\" = " << modules.size() << std::endl;
119  std::cout << " Counted # of lowest \"leaves\" = " << count << std::endl;
120  if ( mydbservice->isNewTagRequest("PGeometricDetRcd") ) {
121  mydbservice->createNewIOV<PGeometricDet>( pgd
122  , mydbservice->beginOfTime()
123  , mydbservice->endOfTime()
124  , "PGeometricDetRcd");
125  } else {
126  std::cout << "PGeometricDetRcd Tag is already present." << std::endl;
127  }
128 }
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 GeometricDetLoader::endJob ( void  )
inlineoverridevirtual

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 24 of file GeometricDetLoader.h.

References putOne().

24 {}
void GeometricDetLoader::endRun ( edm::Run const &  iEvent,
edm::EventSetup const &   
)
inlineoverride

Definition at line 23 of file GeometricDetLoader.h.

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

Definition at line 130 of file GeometricDetLoader.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::_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::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 endJob().

130  {
131 
132 // std::cout << "putting name: " << gd->name().name();
133 // std::cout << " gid: " << gd->geographicalID();
134 // std::cout << " type: " << gd->type() << std::endl;
135 // std::cout << "shape = " << gd->shape()<<"; name = "<<gd->name().name()<<"; parameter number = "<<gd->params().size()<<std::endl;
136  PGeometricDet::Item item;
137  DDTranslation tran = gd->translation();
138  DDRotationMatrix rot = gd->rotation();
139  DD3Vector x, y, z;
140  rot.GetComponents(x, y, z);
141  item._name = gd->name().name();
142  item._level = lev;
143  item._x = tran.X();
144  item._y = tran.Y();
145  item._z = tran.Z();
146  item._phi = gd->phi();
147  item._rho = gd->rho();
148  item._a11 = x.X();
149  item._a12 = y.X();
150  item._a13 = z.X();
151  item._a21 = x.Y();
152  item._a22 = y.Y();
153  item._a23 = z.Y();
154  item._a31 = x.Z();
155  item._a32 = y.Z();
156  item._a33 = z.Z();
157  item._shape = gd->shape();
158  item._type = gd->type();
159  if(gd->shape()==1){
160  item._params0=gd->params()[0];
161  item._params1=gd->params()[1];
162  item._params2=gd->params()[2];
163  item._params3=0;
164  item._params4=0;
165  item._params5=0;
166  item._params6=0;
167  item._params7=0;
168  item._params8=0;
169  item._params9=0;
170  item._params10=0;
171  }else if(gd->shape()==3){
172  item._params0=gd->params()[0];
173  item._params1=gd->params()[1];
174  item._params2=gd->params()[2];
175  item._params3=gd->params()[3];
176  item._params4=gd->params()[4];
177  item._params5=gd->params()[5];
178  item._params6=gd->params()[6];
179  item._params7=gd->params()[7];
180  item._params8=gd->params()[8];
181  item._params9=gd->params()[9];
182  item._params10=gd->params()[10];
183  }else{
184  item._params0=0;
185  item._params1=0;
186  item._params2=0;
187  item._params3=0;
188  item._params4=0;
189  item._params5=0;
190  item._params6=0;
191  item._params7=0;
192  item._params8=0;
193  item._params9=0;
194  item._params10=0;
195  }
196  item._geographicalID = gd->geographicalID();
197  // FIXME: These are moved to PGeometricDetExtra:
198  //item._volume = gd->volume();
199  //item._density = gd->density();
200  //item._weight = gd->weight();
201  //item._copy = gd->copyno();
202  //item._material = gd->material();
203  item._radLength = gd->radLength();
204  item._xi = gd->xi();
205  item._pixROCRows = gd->pixROCRows();
206  item._pixROCCols = gd->pixROCCols();
207  item._pixROCx = gd->pixROCx();
208  item._pixROCy = gd->pixROCy();
209  item._stereo = gd->stereo();
210  item._siliconAPVNum = gd->siliconAPVNum();
211  pgd->pgeomdets_.push_back ( item );
212 }
double pixROCy() const
Definition: GeometricDet.h:276
double radLength() const
Definition: GeometricDet.h:253
DDSolidShape const & shape() const
Definition: GeometricDet.h:138
std::vector< Item > pgeomdets_
Definition: PGeometricDet.h:50
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
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
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