CMS 3D CMS Logo

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

Public Member Functions

 TKStatus (const edm::ParameterSet &)
 
- Public Member Functions inherited from edm::one::EDAnalyzer<>
 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)
 

Protected Member Functions

void analyze (const edm::Event &e, const edm::EventSetup &c) override
 
- 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)
 

Private Member Functions

void dumpTkDcsStatus (std::string const &, edm::RunNumber_t, std::array< bool, 6 > const &)
 

Private Attributes

const edm::EDGetTokenT< DCSRecorddcsRecordToken_
 
const edm::EDGetTokenT< DcsStatusCollectiondcsStatusToken_
 
std::string dcsTkFileName_
 
int lastlumi_ = -1
 

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)
 

Detailed Description

Definition at line 31 of file TKStatus.cc.

Constructor & Destructor Documentation

◆ TKStatus()

TKStatus::TKStatus ( const edm::ParameterSet ps)

Definition at line 50 of file TKStatus.cc.

References dcsTkFileName_, edm::ParameterSet::getParameter(), eostools::move(), and AlCaHLTBitMon_QueryRunRegistry::string.

51  : dcsStatusToken_(consumes<DcsStatusCollection>(edm::InputTag("scalersRawToDigi"))),
52  dcsRecordToken_(consumes<DCSRecord>(edm::InputTag("onlineMetaDataDigis"))) {
53  dcsTkFileName_ = ps.getParameter<edm::ParameterSet>("BeamFitter").getUntrackedParameter<std::string>("DIPFileName");
54  {
55  std::string tmpname = dcsTkFileName_;
56  tmpname.insert(dcsTkFileName_.length() - 4, "_TkStatus");
57  dcsTkFileName_ = std::move(tmpname);
58  }
59 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
const edm::EDGetTokenT< DcsStatusCollection > dcsStatusToken_
Definition: TKStatus.cc:42
std::string dcsTkFileName_
Definition: TKStatus.cc:41
const edm::EDGetTokenT< DCSRecord > dcsRecordToken_
Definition: TKStatus.cc:43
def move(src, dest)
Definition: eostools.py:511

Member Function Documentation

◆ analyze()

void TKStatus::analyze ( const edm::Event e,
const edm::EventSetup c 
)
overrideprotectedvirtual

Implements edm::one::EDAnalyzerBase.

Definition at line 62 of file TKStatus.cc.

References BPIX, DcsStatus::BPIX, DQMOffline_cff::dcsRecord, dcsRecordToken_, dcsStatusToken_, dcsTkFileName_, dumpTkDcsStatus(), MillePedeFileConverter_cfg::e, SectorBuilder_Fpix_cff::FPIX, DcsStatus::FPIX, iEvent, lastlumi_, mps_update::status, DetStateFilter::TECm, DcsStatus::TECm, DetStateFilter::TECp, DcsStatus::TECp, DetStateFilter::TIBTID, DcsStatus::TIBTID, SectorBuilder_Tob_cff::TOB, and DcsStatus::TOB.

62  {
63  int nthlumi = iEvent.luminosityBlock();
64  if (nthlumi > lastlumi_) { // check every LS
65  lastlumi_ = nthlumi;
66 
67  // Checking TK status
68  const auto& dcsStatus = iEvent.getHandle(dcsStatusToken_);
69  const auto& dcsRecord = iEvent.getHandle(dcsRecordToken_);
70 
71  std::array<bool, 6> dcsTk;
72  for (auto& e : dcsTk) {
73  e = true;
74  }
75 
76  // Check that the DCS information is available in some form
77  if (!dcsStatus.isValid() && !dcsRecord.isValid()) {
78  edm::LogWarning("TkStatus") << "DcsStatusCollection product with InputTag \"scalersRawToDigi\" not in event \n"
79  << "DCSRecord product with InputTag \"onlineMetaDataDigis\" not in event \n";
80  dumpTkDcsStatus(dcsTkFileName_, iEvent.run(), dcsTk);
81  return;
82  }
83 
84  if (dcsStatus.isValid() && (*dcsStatus).empty()) {
85  if (iEvent.eventAuxiliary().isRealData()) {
86  // This is the Data case for >= Run3, DCSStatus is available (unpacked), but empty
87  // because SCAL is not in data-taking. In this case we fall back to s/w FED 1022
88  if (dcsRecord.isValid()) {
89  edm::LogPrint("TkStatus") << "Using dcsRecord because dcsStatus is empty";
90  dcsTk[0] = (*dcsRecord).highVoltageReady(DCSRecord::Partition::BPIX);
91  dcsTk[1] = (*dcsRecord).highVoltageReady(DCSRecord::Partition::FPIX);
92  dcsTk[2] = (*dcsRecord).highVoltageReady(DCSRecord::Partition::TIBTID);
93  dcsTk[3] = (*dcsRecord).highVoltageReady(DCSRecord::Partition::TOB);
94  dcsTk[4] = (*dcsRecord).highVoltageReady(DCSRecord::Partition::TECp);
95  dcsTk[5] = (*dcsRecord).highVoltageReady(DCSRecord::Partition::TECm);
96  } else {
97  // DCS status is empty, and the DCS record is not available
98  edm::LogWarning("TkStatus") << "DCSRecord product with InputTag \"onlineMetaDataDigis\" empty \n";
99  dumpTkDcsStatus(dcsTkFileName_, iEvent.run(), dcsTk);
100  return;
101  }
102  } else {
103  // DCS status is empty, but it's not real data
104  edm::LogPrint("TkStatus") << "Running on MC";
105  dumpTkDcsStatus(dcsTkFileName_, iEvent.run(), dcsTk);
106  return;
107  }
108  } else {
109  // This is the case for <= Run2
110  edm::LogPrint("TkStatus") << "Using dcsStatus (Run 1 and Run 2 SCAL)";
111  for (auto const& status : *dcsStatus) {
112  if (!status.ready(DcsStatus::BPIX))
113  dcsTk[0] = false;
114  if (!status.ready(DcsStatus::FPIX))
115  dcsTk[1] = false;
116  if (!status.ready(DcsStatus::TIBTID))
117  dcsTk[2] = false;
118  if (!status.ready(DcsStatus::TOB))
119  dcsTk[3] = false;
120  if (!status.ready(DcsStatus::TECp))
121  dcsTk[4] = false;
122  if (!status.ready(DcsStatus::TECm))
123  dcsTk[5] = false;
124  }
125  }
126 
127  dumpTkDcsStatus(dcsTkFileName_, iEvent.run(), dcsTk);
128  }
129 }
int iEvent
Definition: GenABIO.cc:224
const edm::EDGetTokenT< DcsStatusCollection > dcsStatusToken_
Definition: TKStatus.cc:42
std::string dcsTkFileName_
Definition: TKStatus.cc:41
Log< level::Warning, true > LogPrint
const edm::EDGetTokenT< DCSRecord > dcsRecordToken_
Definition: TKStatus.cc:43
#define BPIX
Log< level::Warning, false > LogWarning
void dumpTkDcsStatus(std::string const &, edm::RunNumber_t, std::array< bool, 6 > const &)
Definition: TKStatus.cc:132
int lastlumi_
Definition: TKStatus.cc:45

◆ dumpTkDcsStatus()

void TKStatus::dumpTkDcsStatus ( std::string const &  fileName,
edm::RunNumber_t  runnum,
std::array< bool, 6 > const &  dcsTk 
)
private

Definition at line 132 of file TKStatus.cc.

References MillePedeFileConverter_cfg::fileName, L1TdeCSCTF_cfi::outFile, runnum, and mps_update::status.

Referenced by analyze().

132  {
133  std::ofstream outFile;
134 
135  outFile.open(fileName.c_str());
136  outFile << "BPIX " << (dcsTk[0] ? "On" : "Off") << std::endl;
137  outFile << "FPIX " << (dcsTk[1] ? "On" : "Off") << std::endl;
138  outFile << "TIBTID " << (dcsTk[2] ? "On" : "Off") << std::endl;
139  outFile << "TOB " << (dcsTk[3] ? "On" : "Off") << std::endl;
140  outFile << "TECp " << (dcsTk[4] ? "On" : "Off") << std::endl;
141  outFile << "TECm " << (dcsTk[5] ? "On" : "Off") << std::endl;
142  bool AllTkOn = true;
143  for (auto status : dcsTk) {
144  if (!status) {
145  AllTkOn = false;
146  break;
147  }
148  }
149  outFile << "WholeTrackerOn " << (AllTkOn ? "Yes" : "No") << std::endl;
150  outFile << "Runnumber " << runnum << std::endl;
151 
152  outFile.close();
153 }
int runnum

Member Data Documentation

◆ dcsRecordToken_

const edm::EDGetTokenT<DCSRecord> TKStatus::dcsRecordToken_
private

Definition at line 43 of file TKStatus.cc.

Referenced by analyze().

◆ dcsStatusToken_

const edm::EDGetTokenT<DcsStatusCollection> TKStatus::dcsStatusToken_
private

Definition at line 42 of file TKStatus.cc.

Referenced by analyze().

◆ dcsTkFileName_

std::string TKStatus::dcsTkFileName_
private

Definition at line 41 of file TKStatus.cc.

Referenced by analyze(), and TKStatus().

◆ lastlumi_

int TKStatus::lastlumi_ = -1
private

Definition at line 45 of file TKStatus.cc.

Referenced by analyze().