CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
SiStripDetInfoFileWriter Class Reference

#include <CalibTracker/SiStripCommon/src/SiStripDetInfoFileWriter.cc>

Inheritance diagram for SiStripDetInfoFileWriter:
edm::one::EDAnalyzer< edm::one::WatchRuns > edm::one::EDAnalyzerBase edm::EDConsumerBase

Public Member Functions

 SiStripDetInfoFileWriter (const edm::ParameterSet &)
 
 ~SiStripDetInfoFileWriter () override
 
- Public Member Functions inherited from edm::one::EDAnalyzer< edm::one::WatchRuns >
 EDAnalyzer ()=default
 
 EDAnalyzer (const EDAnalyzer &)=delete
 
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
const EDAnalyzeroperator= (const EDAnalyzer &)=delete
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
bool wantsInputProcessBlocks () const final
 
bool wantsProcessBlocks () 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
 
ESResolverIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESResolverIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex > const & esGetTokenRecordIndicesVector (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::array< std::vector< ModuleDescription const *> *, NumBranchTypes > &modulesAll, std::vector< ModuleProcessName > &modulesInPreviousProcesses, 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
 
void selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProductResolverIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Member Functions

void analyze (const edm::Event &, const edm::EventSetup &) override
 
void beginRun (const edm::Run &, const edm::EventSetup &iSetup) override
 
void endRun (const edm::Run &, const edm::EventSetup &iSetup) override
 

Private Attributes

std::string filePath_
 
std::ofstream outputFile_
 
edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecordtkGeomToken_
 

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)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< Bconsumes (edm::InputTag tag) noexcept
 
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 ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes ()
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag)
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
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)
 
void resetItemsToGetFrom (BranchType iType)
 

Detailed Description

Description: <one line="" class="" summary>="">

Implementation: <Notes on="" implementation>="">

Definition at line 35 of file SiStripDetInfoFileWriter.cc.

Constructor & Destructor Documentation

◆ SiStripDetInfoFileWriter()

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

Definition at line 54 of file SiStripDetInfoFileWriter.cc.

References edm::ParameterSet::getUntrackedParameter(), and AlCaHLTBitMon_QueryRunRegistry::string.

54  {
55  edm::LogInfo("SiStripDetInfoFileWriter::SiStripDetInfoFileWriter");
56 
57  filePath_ = iConfig.getUntrackedParameter<std::string>("FilePath", std::string("SiStripDetInfo.dat"));
58  tkGeomToken_ = esConsumes<edm::Transition::BeginRun>();
59 }
T getUntrackedParameter(std::string const &, T const &) const
Log< level::Info, false > LogInfo
edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > tkGeomToken_

◆ ~SiStripDetInfoFileWriter()

SiStripDetInfoFileWriter::~SiStripDetInfoFileWriter ( )
override

Definition at line 61 of file SiStripDetInfoFileWriter.cc.

61  {
62  edm::LogInfo("SiStripDetInfoFileWriter::~SiStripDetInfoFileWriter");
63 }
Log< level::Info, false > LogInfo

Member Function Documentation

◆ analyze()

void SiStripDetInfoFileWriter::analyze ( const edm::Event ,
const edm::EventSetup  
)
inlineoverrideprivatevirtual

Implements edm::one::EDAnalyzerBase.

Definition at line 42 of file SiStripDetInfoFileWriter.cc.

42 {};

◆ beginRun()

void SiStripDetInfoFileWriter::beginRun ( const edm::Run ,
const edm::EventSetup iSetup 
)
overrideprivate

Definition at line 65 of file SiStripDetInfoFileWriter.cc.

References Surface::bounds(), runTheMatrix::const, createTree::dd, GeomDet::geographicalId(), edm::EventSetup::getData(), StripTopology::nstrips(), nano_mu_digi_cff::rawId, GeomDet::specificSurface(), StripGeomDetUnit::specificTopology(), StripTopology::stripLength(), Bounds::thickness(), and Calorimetry_cff::thickness.

65  {
66  outputFile_.open(filePath_.c_str());
67 
68  if (outputFile_.is_open()) {
69  const auto& dd = iSetup.getData(tkGeomToken_);
70 
71  edm::LogInfo("SiStripDetInfoFileWriter::beginRun - got geometry ") << std::endl;
72 
73  edm::LogInfo("SiStripDetInfoFileWriter") << " There are " << dd.detUnits().size() << " detectors" << std::endl;
74 
75  for (const auto& it : dd.detUnits()) {
76  const StripGeomDetUnit* mit = dynamic_cast<StripGeomDetUnit const*>(it);
77 
78  if (mit != nullptr) {
79  uint32_t detid = (mit->geographicalId()).rawId();
80  double stripLength = mit->specificTopology().stripLength();
81  unsigned short numberOfAPVs = mit->specificTopology().nstrips() / 128;
82  float thickness = mit->specificSurface().bounds().thickness();
83 
84  if (numberOfAPVs < 1 || numberOfAPVs > 6) {
85  edm::LogError("SiStripDetInfoFileWriter")
86  << " Problem with Number of strips in detector.. " << mit->specificTopology().nstrips()
87  << "Will not write this entry to file" << endl;
88  continue;
89  }
90 
91  outputFile_ << detid << " " << numberOfAPVs << " " << stripLength << " " << thickness << "\n";
92  }
93  }
94  outputFile_.close();
95  } else {
96  edm::LogError("SiStripDetInfoFileWriter::beginRun - Unable to open file") << endl;
97  return;
98  }
99 }
virtual int nstrips() const =0
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
Definition: EventSetup.h:119
Log< level::Error, false > LogError
string dd
Definition: createTree.py:154
virtual float thickness() const =0
virtual float stripLength() const =0
virtual const StripTopology & specificTopology() const
Returns a reference to the strip proxy topology.
DetId geographicalId() const
The label of this GeomDet.
Definition: GeomDet.h:64
Log< level::Info, false > LogInfo
const Plane & specificSurface() const
Same as surface(), kept for backward compatibility.
Definition: GeomDet.h:40
edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > tkGeomToken_
const Bounds & bounds() const
Definition: Surface.h:87

◆ endRun()

void SiStripDetInfoFileWriter::endRun ( const edm::Run ,
const edm::EventSetup iSetup 
)
inlineoverrideprivate

Definition at line 43 of file SiStripDetInfoFileWriter.cc.

43 {};

Member Data Documentation

◆ filePath_

std::string SiStripDetInfoFileWriter::filePath_
private

Definition at line 47 of file SiStripDetInfoFileWriter.cc.

◆ outputFile_

std::ofstream SiStripDetInfoFileWriter::outputFile_
private

Definition at line 43 of file SiStripDetInfoFileWriter.cc.

◆ tkGeomToken_

edm::ESGetToken<TrackerGeometry, TrackerDigiGeometryRecord> SiStripDetInfoFileWriter::tkGeomToken_
private

Definition at line 48 of file SiStripDetInfoFileWriter.cc.