CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
SiStripDCSStatus.cc
Go to the documentation of this file.
5 
8 
12 
13 // FED cabling and numbering
16 
22 
24 #include <iostream>
25 
26 //
27 // -- Constructor
28 //
30  TIBTIDinDAQ(false),
31  TOBinDAQ(false),
32  TECFinDAQ(false),
33  TECBinDAQ(false),
34  trackerAbsent(false),
35  rawdataAbsent(true),
36  initialised(false) {
37 }
38 //
39 // -- Destructor
40 //
42 }
43 //
44 // -- Get State
45 //
47 
48  bool retVal = true;
49  if (!initialised) initialise(e, eSetup);
50 
52  e.getByLabel("scalersRawToDigi", dcsStatus);
53  if ( trackerAbsent || !dcsStatus.isValid()) return retVal;
54  if ((*dcsStatus).size() == 0) return retVal;
55 
56  statusTIBTID = true;
57  statusTOB = true;
58  statusTECF = true;
59  statusTECB = true;
60 
61  bool dcsTIBTID = ((*dcsStatus)[0].ready(DcsStatus::TIBTID));
62  bool dcsTOB = ((*dcsStatus)[0].ready(DcsStatus::TOB));
63  bool dcsTECF = ((*dcsStatus)[0].ready(DcsStatus::TECp));
64  bool dcsTECB = ((*dcsStatus)[0].ready(DcsStatus::TECm));
65  if (rawdataAbsent) {
66  statusTIBTID = dcsTIBTID;
67  statusTOB = dcsTOB;
68  statusTECF = dcsTECF;
69  statusTECB = dcsTECB;
70  } else {
71  if ( TIBTIDinDAQ && !dcsTIBTID ) statusTIBTID = false;
72  if ( TOBinDAQ && !dcsTOB ) statusTOB = false;
73  if ( TECFinDAQ && !dcsTECF ) statusTECF = false;
74  if ( TECBinDAQ && !dcsTECB ) statusTECB = false;
75  }
76 
77  LogDebug("SiStripDCSStatus") << " SiStripDCSStatus :: Detectors in DAQ (TIBTID, TOB, TEC+ TEC-)"
78  << TIBTIDinDAQ << " "
79  << TOBinDAQ << " "
80  << TECFinDAQ << " "
81  << TECBinDAQ << std::endl;
82  LogDebug("SiStripDCSStatus") << " SiStripDCSStatus :: Detectors in ON (TIBTID, TOB, TEC+ TEC-)"
83  << dcsTIBTID << " "
84  << dcsTOB << " "
85  << dcsTECF << " "
86  << dcsTECB << std::endl;
87 
88  LogDebug("SiStripDCSStatus") << " SiStripDCSStatus :: Final Flags (TIBTID, TOB, TEC+ TEC-)"
89  << statusTIBTID << " "
90  << statusTOB << " "
91  << statusTECF << " "
92  << statusTECB << std::endl;
93  if (statusTIBTID && statusTOB && statusTECF && statusTECB) retVal = true;
94  else retVal = false;
95  LogDebug("SiStripDCSStatus") << " Return Value " << retVal ;
96  return retVal;
97 }
98 //
99 // -- initialise
100 //
102 
104  eSetup.get<SiStripFedCablingRcd>().get(fedCabling_);
105  const std::vector<uint16_t>& connectedFEDs = fedCabling_->feds();
106 
107  edm::Handle<FEDRawDataCollection> rawDataHandle;
108  e.getByLabel("source", rawDataHandle);
109 
110  if ( !rawDataHandle.isValid() ) {
111  rawdataAbsent = true;
112  return;
113  }
114 
115  rawdataAbsent = false;
116  const FEDRawDataCollection& rawDataCollection = *rawDataHandle;
117  for(std::vector<unsigned short>::const_iterator ifed = connectedFEDs.begin(); ifed != connectedFEDs.end(); ifed++){
118  const std::vector<FedChannelConnection> fedChannels = fedCabling_->connections( *ifed );
119  if (!(rawDataCollection.FEDData(*ifed).size()) || !(rawDataCollection.FEDData(*ifed).data()) ) continue;
120  // Check Modules Connected
121  for (std::vector<FedChannelConnection>::const_iterator iconn = fedChannels.begin();
122  iconn < fedChannels.end(); iconn++){
123  if (!iconn->isConnected()) continue;
124  uint32_t detId = iconn->detId();
125  StripSubdetector subdet(detId);
126  if ( (subdet.subdetId() == StripSubdetector::TIB) || (subdet.subdetId() == StripSubdetector::TID)) {
127  TIBTIDinDAQ = true;
128  break;
129  } else if (subdet.subdetId() == StripSubdetector::TOB) {
130  TOBinDAQ = true;
131  break;
132  } else if (subdet.subdetId() == StripSubdetector::TEC) {
133  if (TECDetId(detId).side() == 2) TECFinDAQ = true;
134  else if (TECDetId(detId).side() == 1) TECBinDAQ = true;
135  break;
136  }
137  }
138  if (TIBTIDinDAQ && TOBinDAQ && TECFinDAQ && TECBinDAQ) break;
139  }
140  initialised = true;
141  if (!TIBTIDinDAQ && !TOBinDAQ && !TECFinDAQ && !TECBinDAQ) trackerAbsent = true;
142 }
#define LogDebug(id)
size_t size() const
Lenght of the data buffer in bytes.
Definition: FEDRawData.h:49
unsigned int side() const
positive or negative id
Definition: TECDetId.h:47
bool getStatus(edm::Event const &e, edm::EventSetup const &eSetup)
const FEDRawData & FEDData(int fedid) const
retrieve data for fed
bool isValid() const
Definition: HandleBase.h:76
int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:39
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:356
void initialise(edm::Event const &e, edm::EventSetup const &eSetup)
const T & get() const
Definition: EventSetup.h:55
const unsigned char * data() const
Return a const pointer to the beginning of the data buffer.
Definition: FEDRawData.cc:29