CMS 3D CMS Logo

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

#include <GeometricTimingDetLoader.h>

Inheritance diagram for GeometricTimingDetLoader:
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
 
 GeometricTimingDetLoader (const edm::ParameterSet &iConfig)
 
 ~GeometricTimingDetLoader () override
 
- Public Member Functions inherited from edm::one::EDAnalyzer< edm::one::WatchRuns >
 EDAnalyzer ()=default
 
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
- Public Member Functions inherited from edm::one::EDAnalyzerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzerBase ()
 
ModuleDescription const & moduleDescription () const
 
bool wantsStreamLuminosityBlocks () const
 
bool wantsStreamRuns () const
 
 ~EDAnalyzerBase () override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
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
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Member Functions

void putOne (const GeometricTimingDet *gd, PGeometricTimingDet *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 ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
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 GeometricTimingDetLoader.h.

Constructor & Destructor Documentation

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

Definition at line 26 of file GeometricTimingDetLoader.cc.

References LogDebug.

27 {
28  LogDebug("GeometricTimingDetLoader")
29  <<"GeometricTimingDetLoader::GeometricTimingDetLoader"<<std::endl;
30 }
#define LogDebug(id)
GeometricTimingDetLoader::~GeometricTimingDetLoader ( )
override

Definition at line 32 of file GeometricTimingDetLoader.cc.

References LogDebug.

33 {
34  LogDebug("GeometricTimingDetLoader")
35  <<"GeometricTimingDetLoader::~GeometricTimingDetLoader"<<std::endl;
36 }
#define LogDebug(id)

Member Function Documentation

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

Implements edm::one::EDAnalyzerBase.

Definition at line 22 of file GeometricTimingDetLoader.h.

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

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 20 of file GeometricTimingDetLoader.h.

References beginRun(), and iEvent.

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

Definition at line 39 of file GeometricTimingDetLoader.cc.

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

Referenced by beginJob().

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

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 24 of file GeometricTimingDetLoader.h.

References putOne().

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

Definition at line 23 of file GeometricTimingDetLoader.h.

23 {}
void GeometricTimingDetLoader::putOne ( const GeometricTimingDet gd,
PGeometricTimingDet pgd,
int  lev 
)
private

Definition at line 132 of file GeometricTimingDetLoader.cc.

References PGeometricTimingDet::Item::a11_, PGeometricTimingDet::Item::a12_, PGeometricTimingDet::Item::a13_, PGeometricTimingDet::Item::a21_, PGeometricTimingDet::Item::a22_, PGeometricTimingDet::Item::a23_, PGeometricTimingDet::Item::a31_, PGeometricTimingDet::Item::a32_, PGeometricTimingDet::Item::a33_, ddbox, ddtrap, DEFINE_FWK_MODULE, GeometricTimingDet::geographicalID(), PGeometricTimingDet::Item::geographicalID_, PGeometricTimingDet::Item::level_, DDName::name(), GeometricTimingDet::name(), PGeometricTimingDet::Item::name_, GeometricTimingDet::params(), PGeometricTimingDet::Item::params_0, PGeometricTimingDet::Item::params_1, PGeometricTimingDet::Item::params_10, PGeometricTimingDet::Item::params_2, PGeometricTimingDet::Item::params_3, PGeometricTimingDet::Item::params_4, PGeometricTimingDet::Item::params_5, PGeometricTimingDet::Item::params_6, PGeometricTimingDet::Item::params_7, PGeometricTimingDet::Item::params_8, PGeometricTimingDet::Item::params_9, PGeometricTimingDet::pgeomdets_, GeometricTimingDet::phi(), PGeometricTimingDet::Item::phi_, GeometricTimingDet::pixROCCols(), PGeometricTimingDet::Item::pixROCCols_, GeometricTimingDet::pixROCRows(), PGeometricTimingDet::Item::pixROCRows_, GeometricTimingDet::pixROCx(), PGeometricTimingDet::Item::pixROCx_, GeometricTimingDet::pixROCy(), PGeometricTimingDet::Item::pixROCy_, GeometricTimingDet::radLength(), PGeometricTimingDet::Item::radLength_, GeometricTimingDet::rho(), PGeometricTimingDet::Item::rho_, makeMuonMisalignmentScenario::rot, GeometricTimingDet::rotation(), GeometricTimingDet::shape(), PGeometricTimingDet::Item::shape_, GeometricTimingDet::siliconAPVNum(), PGeometricTimingDet::Item::siliconAPVNum_, GeometricTimingDet::stereo(), PGeometricTimingDet::Item::stereo_, GeometricTimingDet::translation(), GeometricTimingDet::type(), PGeometricTimingDet::Item::type_, x, PGeometricTimingDet::Item::x_, GeometricTimingDet::xi(), PGeometricTimingDet::Item::xi_, y, PGeometricTimingDet::Item::y_, z, and PGeometricTimingDet::Item::z_.

Referenced by beginRun(), and endJob().

132  {
133 
134 // std::cout << "putting name: " << gd->name().name();
135 // std::cout << " gid: " << gd->geographicalID();
136 // std::cout << " type: " << gd->type() << std::endl;
137 // std::cout << "shape = " << gd->shape()<<"; name = "<<gd->name().name()<<"; parameter number = "<<gd->params().size()<<std::endl;
139  const DDTranslation& tran = gd->translation();
140  const DDRotationMatrix& rot = gd->rotation();
141  DD3Vector x, y, z;
142  rot.GetComponents(x, y, z);
143  item.name_ = gd->name().name();
144  item.level_ = lev;
145  item.x_ = tran.X();
146  item.y_ = tran.Y();
147  item.z_ = tran.Z();
148  item.phi_ = gd->phi();
149  item.rho_ = gd->rho();
150  item.a11_ = x.X();
151  item.a12_ = y.X();
152  item.a13_ = z.X();
153  item.a21_ = x.Y();
154  item.a22_ = y.Y();
155  item.a23_ = z.Y();
156  item.a31_ = x.Z();
157  item.a32_ = y.Z();
158  item.a33_ = z.Z();
159  item.shape_ = static_cast<int>(gd->shape());
160  item.type_ = gd->type();
161  if(gd->shape()==DDSolidShape::ddbox){
162  item.params_0=gd->params()[0];
163  item.params_1=gd->params()[1];
164  item.params_2=gd->params()[2];
165  item.params_3=0;
166  item.params_4=0;
167  item.params_5=0;
168  item.params_6=0;
169  item.params_7=0;
170  item.params_8=0;
171  item.params_9=0;
172  item.params_10=0;
173  }else if(gd->shape()==DDSolidShape::ddtrap){
174  item.params_0=gd->params()[0];
175  item.params_1=gd->params()[1];
176  item.params_2=gd->params()[2];
177  item.params_3=gd->params()[3];
178  item.params_4=gd->params()[4];
179  item.params_5=gd->params()[5];
180  item.params_6=gd->params()[6];
181  item.params_7=gd->params()[7];
182  item.params_8=gd->params()[8];
183  item.params_9=gd->params()[9];
184  item.params_10=gd->params()[10];
185  }else{
186  item.params_0=0;
187  item.params_1=0;
188  item.params_2=0;
189  item.params_3=0;
190  item.params_4=0;
191  item.params_5=0;
192  item.params_6=0;
193  item.params_7=0;
194  item.params_8=0;
195  item.params_9=0;
196  item.params_10=0;
197  }
198  item.geographicalID_ = gd->geographicalID();
199  // FIXME: These are moved to PGeometricTimingDetExtra:
200  //item.volume_ = gd->volume();
201  //item.density_ = gd->density();
202  //item.weight_ = gd->weight();
203  //item.copy_ = gd->copyno();
204  //item.material_ = gd->material();
205  item.radLength_ = gd->radLength();
206  item.xi_ = gd->xi();
207  item.pixROCRows_ = gd->pixROCRows();
208  item.pixROCCols_ = gd->pixROCCols();
209  item.pixROCx_ = gd->pixROCx();
210  item.pixROCy_ = gd->pixROCy();
211  item.stereo_ = gd->stereo();
212  item.siliconAPVNum_ = gd->siliconAPVNum();
213  pgd->pgeomdets_.push_back ( item );
214 }
ROOT::Math::Rotation3D DDRotationMatrix
A DDRotationMatrix is currently implemented with a ROOT Rotation3D.
GeometricTimingEnumType type() const
double siliconAPVNum() const
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DDTranslation
Definition: DDTranslation.h:7
double pixROCCols() const
std::vector< Item > pgeomdets_
double radLength() const
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
double pixROCRows() const
DetId geographicalID() const
std::vector< double > const & params() const
DDName const & name() const
double pixROCx() const
DDRotationMatrix const & rotation() const
DDSolidShape const & shape() const
double pixROCy() const
const std::string & name() const
Returns the name.
Definition: DDName.cc:53