CMS 3D CMS Logo

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

#include <SiStripApvGainReader.h>

Inheritance diagram for SiStripApvGainReader:
edm::EDAnalyzer edm::EDConsumerBase

Public Member Functions

void analyze (const edm::Event &, const edm::EventSetup &) override
 
 SiStripApvGainReader (const edm::ParameterSet &)
 
 ~SiStripApvGainReader () override
 
- Public Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
SerialTaskQueueglobalLuminosityBlocksQueue ()
 
SerialTaskQueueglobalRunsQueue ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
 ~EDAnalyzer () 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 &&)=default
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESProxyIndex > 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
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
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 Attributes

int apvId_ = 0
 
int detId_ = 0
 
std::string formatedOutput_
 
edm::Service< TFileServicefs_
 
double gain_ = 0
 
edm::ESGetToken< SiStripGain, SiStripGainRcdgainToken_
 
uint32_t gainType_
 
int id_ = 0
 
bool printdebug_
 
TTree * tree_ = nullptr
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
static bool wantsGlobalLuminosityBlocks ()
 
static bool wantsGlobalRuns ()
 
static bool wantsInputProcessBlocks ()
 
static bool wantsProcessBlocks ()
 
static bool wantsStreamLuminosityBlocks ()
 
static bool wantsStreamRuns ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< B > consumes (edm::InputTag tag) noexcept
 
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<Transition Tr = Transition::Event>
constexpr auto esConsumes () noexcept
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag) noexcept
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 

Detailed Description

Definition at line 27 of file SiStripApvGainReader.h.

Constructor & Destructor Documentation

◆ SiStripApvGainReader()

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

Definition at line 13 of file SiStripApvGainReader.cc.

14  : printdebug_(iConfig.getUntrackedParameter<bool>("printDebug", true)),
15  formatedOutput_(iConfig.getUntrackedParameter<std::string>("outputFile", "")),
16  gainType_(iConfig.getUntrackedParameter<uint32_t>("gainType", 1)),
18  if (fs_.isAvailable()) {
19  tree_ = fs_->make<TTree>("Gains", "Gains");
20 
21  tree_->Branch("Index", &id_, "Index/I");
22  tree_->Branch("DetId", &detId_, "DetId/I");
23  tree_->Branch("APVId", &apvId_, "APVId/I");
24  tree_->Branch("Gain", &gain_, "Gain/D");
25  }
26 }

References apvId_, detId_, fs_, gain_, id_, edm::Service< T >::isAvailable(), TFileService::make(), and tree_.

◆ ~SiStripApvGainReader()

SiStripApvGainReader::~SiStripApvGainReader ( )
override

Definition at line 28 of file SiStripApvGainReader.cc.

28 {}

Member Function Documentation

◆ analyze()

void SiStripApvGainReader::analyze ( const edm::Event e,
const edm::EventSetup iSetup 
)
overridevirtual

Implements edm::EDAnalyzer.

Definition at line 30 of file SiStripApvGainReader.cc.

30  {
31  const auto& stripApvGain = iSetup.getData(gainToken_);
32  edm::LogInfo("SiStripApvGainReader") << "[SiStripApvGainReader::analyze] End Reading SiStripApvGain" << std::endl;
33  std::vector<uint32_t> detid;
34  stripApvGain.getDetIds(detid);
35  edm::LogInfo("Number of detids ") << detid.size() << std::endl;
36 
37  FILE* pFile = nullptr;
38  if (!formatedOutput_.empty())
39  pFile = fopen(formatedOutput_.c_str(), "w");
40  for (size_t id = 0; id < detid.size(); id++) {
41  SiStripApvGain::Range range = stripApvGain.getRange(detid[id], gainType_);
42  if (printdebug_) {
43  int apv = 0;
44  for (int it = 0; it < range.second - range.first; it++) {
45  edm::LogInfo("SiStripApvGainReader")
46  << "detid " << detid[id] << " \t " << apv++ << " \t " << stripApvGain.getApvGain(it, range) << std::endl;
47  id_++;
48 
49  if (tree_) {
50  detId_ = detid[id];
51  apvId_ = apv;
52  gain_ = stripApvGain.getApvGain(it, range);
53  tree_->Fill();
54  }
55  }
56  }
57 
58  if (pFile) {
59  fprintf(pFile, "%i ", detid[id]);
60  for (int it = 0; it < range.second - range.first; it++) {
61  fprintf(pFile, "%f ", stripApvGain.getApvGain(it, range));
62  }
63  fprintf(pFile, "\n");
64  }
65  }
66 
67  if (pFile)
68  fclose(pFile);
69 }

References apvId_, detId_, formatedOutput_, gain_, gainToken_, gainType_, edm::EventSetup::getData(), triggerObjects_cff::id, id_, printdebug_, FastTimerService_cff::range, and tree_.

Member Data Documentation

◆ apvId_

int SiStripApvGainReader::apvId_ = 0
private

Definition at line 41 of file SiStripApvGainReader.h.

Referenced by analyze(), and SiStripApvGainReader().

◆ detId_

int SiStripApvGainReader::detId_ = 0
private

Definition at line 41 of file SiStripApvGainReader.h.

Referenced by analyze(), and SiStripApvGainReader().

◆ formatedOutput_

std::string SiStripApvGainReader::formatedOutput_
private

Definition at line 36 of file SiStripApvGainReader.h.

Referenced by analyze().

◆ fs_

edm::Service<TFileService> SiStripApvGainReader::fs_
private

Definition at line 39 of file SiStripApvGainReader.h.

Referenced by SiStripApvGainReader().

◆ gain_

double SiStripApvGainReader::gain_ = 0
private

Definition at line 42 of file SiStripApvGainReader.h.

Referenced by analyze(), and SiStripApvGainReader().

◆ gainToken_

edm::ESGetToken<SiStripGain, SiStripGainRcd> SiStripApvGainReader::gainToken_
private

Definition at line 38 of file SiStripApvGainReader.h.

Referenced by analyze().

◆ gainType_

uint32_t SiStripApvGainReader::gainType_
private

Definition at line 37 of file SiStripApvGainReader.h.

Referenced by analyze().

◆ id_

int SiStripApvGainReader::id_ = 0
private

Definition at line 41 of file SiStripApvGainReader.h.

Referenced by analyze(), and SiStripApvGainReader().

◆ printdebug_

bool SiStripApvGainReader::printdebug_
private

Definition at line 35 of file SiStripApvGainReader.h.

Referenced by analyze().

◆ tree_

TTree* SiStripApvGainReader::tree_ = nullptr
private

Definition at line 40 of file SiStripApvGainReader.h.

Referenced by analyze(), and SiStripApvGainReader().

SiStripApvGainReader::gainToken_
edm::ESGetToken< SiStripGain, SiStripGainRcd > gainToken_
Definition: SiStripApvGainReader.h:38
FastTimerService_cff.range
range
Definition: FastTimerService_cff.py:34
SiStripApvGainReader::id_
int id_
Definition: SiStripApvGainReader.h:41
SiStripApvGainReader::tree_
TTree * tree_
Definition: SiStripApvGainReader.h:40
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
edm::LogInfo
Log< level::Info, false > LogInfo
Definition: MessageLogger.h:125
edm::Service::isAvailable
bool isAvailable() const
Definition: Service.h:40
SiStripApvGainReader::gain_
double gain_
Definition: SiStripApvGainReader.h:42
SiStripApvGainReader::gainType_
uint32_t gainType_
Definition: SiStripApvGainReader.h:37
SiStripApvGainReader::detId_
int detId_
Definition: SiStripApvGainReader.h:41
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::EventSetup::getData
bool getData(T &iHolder) const
Definition: EventSetup.h:127
SiStripApvGainReader::formatedOutput_
std::string formatedOutput_
Definition: SiStripApvGainReader.h:36
triggerObjects_cff.id
id
Definition: triggerObjects_cff.py:29
SiStripApvGain::Range
std::pair< ContainerIterator, ContainerIterator > Range
Definition: SiStripApvGain.h:28
SiStripApvGainReader::apvId_
int apvId_
Definition: SiStripApvGainReader.h:41
edm::EDConsumerBase::esConsumes
auto esConsumes()
Definition: EDConsumerBase.h:202
SiStripApvGainReader::printdebug_
bool printdebug_
Definition: SiStripApvGainReader.h:35
TFileService::make
T * make(const Args &... args) const
make new ROOT object
Definition: TFileService.h:64
SiStripApvGainReader::fs_
edm::Service< TFileService > fs_
Definition: SiStripApvGainReader.h:39