CMS 3D CMS Logo

SiStripDCSStatus.cc
Go to the documentation of this file.
5 
7 
10 
11 // FED cabling and numbering
14 
18 
20 #include <iostream>
21 
22 //
23 // -- Constructor
24 //
26  : TIBTIDinDAQ(false),
27  TOBinDAQ(false),
28  TECFinDAQ(false),
29  TECBinDAQ(false),
30  trackerAbsent(false),
31  rawdataAbsent(true),
32  initialised(false) {
33  dcsStatusToken_ = iC.consumes<DcsStatusCollection>(edm::InputTag("scalersRawToDigi"));
34  dcsRecordToken_ = iC.consumes<DCSRecord>(edm::InputTag("onlineMetaDataDigis"));
35  rawDataToken_ = iC.consumes<FEDRawDataCollection>(edm::InputTag("rawDataCollector"));
38 }
39 //
40 // -- Get State
41 //
43  bool retVal = true;
44  if (!initialised)
45  initialise(e, eSetup);
46 
48  e.getByToken(dcsStatusToken_, dcsStatus);
49 
51  e.getByToken(dcsRecordToken_, dcsRecord);
52 
53  bool statusTIBTID(true), statusTOB(true), statusTECF(true), statusTECB(true);
54  bool dcsTIBTID(true), dcsTOB(true), dcsTECF(true), dcsTECB(true);
55 
56  if (trackerAbsent || (!dcsStatus.isValid() && !dcsRecord.isValid())) {
57  return retVal;
58  }
59 
60  if ((*dcsStatus).empty()) {
61  if (e.eventAuxiliary().isRealData()) {
62  dcsTIBTID = (*dcsRecord).highVoltageReady(DCSRecord::Partition::TIBTID);
63  dcsTOB = (*dcsRecord).highVoltageReady(DCSRecord::Partition::TOB);
64  dcsTECF = (*dcsRecord).highVoltageReady(DCSRecord::Partition::TECp);
65  dcsTECB = (*dcsRecord).highVoltageReady(DCSRecord::Partition::TECm);
66  } else {
67  return retVal;
68  }
69  } else {
70  dcsTIBTID = ((*dcsStatus)[0].ready(DcsStatus::TIBTID));
71  dcsTOB = ((*dcsStatus)[0].ready(DcsStatus::TOB));
72  dcsTECF = ((*dcsStatus)[0].ready(DcsStatus::TECp));
73  dcsTECB = ((*dcsStatus)[0].ready(DcsStatus::TECm));
74  }
75 
76  if (rawdataAbsent) {
77  statusTIBTID = dcsTIBTID;
78  statusTOB = dcsTOB;
79  statusTECF = dcsTECF;
80  statusTECB = dcsTECB;
81  } else {
82  if (TIBTIDinDAQ && !dcsTIBTID)
83  statusTIBTID = false;
84  if (TOBinDAQ && !dcsTOB)
85  statusTOB = false;
86  if (TECFinDAQ && !dcsTECF)
87  statusTECF = false;
88  if (TECBinDAQ && !dcsTECB)
89  statusTECB = false;
90  }
91 
92  LogDebug("SiStripDCSStatus") << " SiStripDCSStatus :: Detectors in DAQ (TIBTID, TOB, TEC+ TEC-)" << TIBTIDinDAQ << " "
93  << TOBinDAQ << " " << TECFinDAQ << " " << TECBinDAQ << std::endl;
94  LogDebug("SiStripDCSStatus") << " SiStripDCSStatus :: Detectors in ON (TIBTID, TOB, TEC+ TEC-)" << dcsTIBTID << " "
95  << dcsTOB << " " << dcsTECF << " " << dcsTECB << std::endl;
96 
97  LogDebug("SiStripDCSStatus") << " SiStripDCSStatus :: Final Flags (TIBTID, TOB, TEC+ TEC-)" << statusTIBTID << " "
98  << statusTOB << " " << statusTECF << " " << statusTECB << std::endl;
99  if (statusTIBTID && statusTOB && statusTECF && statusTECB)
100  retVal = true;
101  else
102  retVal = false;
103  LogDebug("SiStripDCSStatus") << " Return Value " << retVal;
104  return retVal;
105 }
106 //
107 // -- initialise
108 //
110  //Retrieve tracker topology from geometry
111  const auto& tTopo = eSetup.getData(tTopoToken_);
112  const auto& fedCabling_ = eSetup.getData(fedCablingToken_);
113 
114  auto connectedFEDs = fedCabling_.fedIds();
115 
116  edm::Handle<FEDRawDataCollection> rawDataHandle;
117  // e.getByLabel("source", rawDataHandle);
118  e.getByToken(rawDataToken_, rawDataHandle);
119 
120  if (!rawDataHandle.isValid()) {
121  rawdataAbsent = true;
122  return;
123  }
124 
125  rawdataAbsent = false;
126  const FEDRawDataCollection& rawDataCollection = *rawDataHandle;
127  for (std::vector<unsigned short>::const_iterator ifed = connectedFEDs.begin(); ifed != connectedFEDs.end(); ifed++) {
128  auto fedChannels = fedCabling_.fedConnections(*ifed);
129  if (!(rawDataCollection.FEDData(*ifed).size()) || !(rawDataCollection.FEDData(*ifed).data()))
130  continue;
131  // Check Modules Connected
132  for (std::vector<FedChannelConnection>::const_iterator iconn = fedChannels.begin(); iconn < fedChannels.end();
133  iconn++) {
134  if (!iconn->isConnected())
135  continue;
136  uint32_t detId = iconn->detId();
137  StripSubdetector subdet(detId);
138  if ((subdet.subdetId() == StripSubdetector::TIB) || (subdet.subdetId() == StripSubdetector::TID)) {
139  TIBTIDinDAQ = true;
140  break;
141  } else if (subdet.subdetId() == StripSubdetector::TOB) {
142  TOBinDAQ = true;
143  break;
144  } else if (subdet.subdetId() == StripSubdetector::TEC) {
145  if (tTopo.tecSide(detId) == 2)
146  TECFinDAQ = true;
147  else if (tTopo.tecSide(detId) == 1)
148  TECBinDAQ = true;
149  break;
150  }
151  }
153  break;
154  }
155  initialised = true;
156  if (!TIBTIDinDAQ && !TOBinDAQ && !TECFinDAQ && !TECBinDAQ)
157  trackerAbsent = true;
158 }
FEDNumbering.h
Handle.h
SiStripDCSStatus::TECFinDAQ
bool TECFinDAQ
Definition: SiStripDCSStatus.h:29
MessageLogger.h
funct::false
false
Definition: Factorize.h:34
DcsStatus::TIBTID
Definition: DcsStatus.h:51
SiStripDCSStatus::fedCablingToken_
edm::ESGetToken< SiStripFedCabling, SiStripFedCablingRcd > fedCablingToken_
Definition: SiStripDCSStatus.h:38
SiStripDCSStatus::SiStripDCSStatus
SiStripDCSStatus(edm::ConsumesCollector &&iC)
Definition: SiStripDCSStatus.h:21
ESHandle.h
FEDRawDataCollection
Definition: FEDRawDataCollection.h:18
SiStripDCSStatus.h
TrackerTopology
Definition: TrackerTopology.h:16
StripSubdetector
Definition: StripSubdetector.h:12
SiStripFedCabling.h
DCSRecord
Class to contain DCS information from soft FED 1022.
Definition: DCSRecord.h:20
SiStripDCSStatus::initialise
void initialise(edm::Event const &e, edm::EventSetup const &eSetup)
Definition: SiStripDCSStatus.cc:109
SiStripFedCabling
Contains cabling info at the device level, including DetId, APV pair numbers, hardware addresses,...
Definition: SiStripFedCabling.h:25
FEDRawData.h
edm::ConsumesCollector::esConsumes
auto esConsumes()
Definition: ConsumesCollector.h:86
edm::Handle
Definition: AssociativeIterator.h:50
SiStripDCSStatus::rawdataAbsent
bool rawdataAbsent
Definition: SiStripDCSStatus.h:31
FEDRawData::data
const unsigned char * data() const
Return a const pointer to the beginning of the data buffer.
Definition: FEDRawData.cc:24
TrackerTopology.h
SiStripFedCablingRcd
Definition: SiStripCondDataRecords.h:22
TrackerTopologyRcd.h
SiStripDCSStatus::dcsStatusToken_
edm::EDGetTokenT< DcsStatusCollection > dcsStatusToken_
Definition: SiStripDCSStatus.h:34
DcsStatus::TECm
Definition: DcsStatus.h:54
edm::ConsumesCollector::consumes
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
Definition: ConsumesCollector.h:49
StripSubdetector::TIB
static constexpr auto TIB
Definition: StripSubdetector.h:16
SiStripDCSStatus::TIBTIDinDAQ
bool TIBTIDinDAQ
Definition: SiStripDCSStatus.h:29
FEDRawDataCollection::FEDData
const FEDRawData & FEDData(int fedid) const
retrieve data for fed
Definition: FEDRawDataCollection.cc:19
DetId::subdetId
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum)
Definition: DetId.h:48
funct::true
true
Definition: Factorize.h:173
HLT_2018_cff.InputTag
InputTag
Definition: HLT_2018_cff.py:79016
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:670
SiStripCondDataRecords.h
SiStripDCSStatus::TOBinDAQ
bool TOBinDAQ
Definition: SiStripDCSStatus.h:29
Event.h
SiStripDCSStatus::tTopoToken_
edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > tTopoToken_
Definition: SiStripDCSStatus.h:37
SiStripDCSStatus::trackerAbsent
bool trackerAbsent
Definition: SiStripDCSStatus.h:30
DQMOffline_cff.dcsRecord
dcsRecord
Definition: DQMOffline_cff.py:27
SiStripDCSStatus::TECBinDAQ
bool TECBinDAQ
Definition: SiStripDCSStatus.h:29
edm::EventSetup
Definition: EventSetup.h:57
DcsStatus::TECp
Definition: DcsStatus.h:53
FEDRawData::size
size_t size() const
Lenght of the data buffer in bytes.
Definition: FEDRawData.h:45
edm::EventSetup::getData
bool getData(T &iHolder) const
Definition: EventSetup.h:113
SiStripDCSStatus::getStatus
bool getStatus(edm::Event const &e, edm::EventSetup const &eSetup)
Definition: SiStripDCSStatus.cc:42
DcsStatus::TOB
Definition: DcsStatus.h:52
SiStripDCSStatus::rawDataToken_
edm::EDGetTokenT< FEDRawDataCollection > rawDataToken_
Definition: SiStripDCSStatus.h:35
StripSubdetector::TEC
static constexpr auto TEC
Definition: StripSubdetector.h:19
StripSubdetector::TOB
static constexpr auto TOB
Definition: StripSubdetector.h:18
EventSetup.h
SiStripDCSStatus::dcsRecordToken_
edm::EDGetTokenT< DCSRecord > dcsRecordToken_
Definition: SiStripDCSStatus.h:36
TrackerTopologyRcd
Definition: TrackerTopologyRcd.h:10
edm::HandleBase::isValid
bool isValid() const
Definition: HandleBase.h:70
edm::Event
Definition: Event.h:73
SectorBuilder_Tob_cff.TOB
TOB
Definition: SectorBuilder_Tob_cff.py:16
SiStripDCSStatus::initialised
bool initialised
Definition: SiStripDCSStatus.h:32
DcsStatusCollection
std::vector< DcsStatus > DcsStatusCollection
Definition: DcsStatus.h:110
StripSubdetector.h
edm::ConsumesCollector
Definition: ConsumesCollector.h:39
StripSubdetector::TID
static constexpr auto TID
Definition: StripSubdetector.h:17
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37