CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
SiStripSpyEventSummaryProducer.cc
Go to the documentation of this file.
1 //Class to produce a dummy SiStripEventSummary object so that spy channel data can be used with commissioning software.
2 //Run types which need additional parameters from the trigger FED buffer or DAQ registers are not supported.
3 //If an unsupported run type is used, an error message will be printed and parameters will be set to zero.
4 //Author: Nick Cripps
5 //Date: 10/05/2010
6 
22 #include <memory>
23 #include <string>
24 #include "boost/scoped_array.hpp"
25 #include "boost/cstdint.hpp"
26 
27 using edm::LogError;
28 using edm::LogWarning;
29 using edm::LogInfo;
30 
31 namespace sistrip {
32 
34  {
35  public:
37  virtual ~SpyEventSummaryProducer();
38  virtual void produce(edm::Event& event, const edm::EventSetup&) override;
39  private:
41  static const char* messageLabel_;
44  };
45 
46 }
47 
48 namespace sistrip {
49 
50  const char* SpyEventSummaryProducer::messageLabel_ = "SiStripSpyEventSummaryProducer";
51 
53  : rawDataTag_(config.getParameter<edm::InputTag>("RawDataTag")),
54  runType_(sistrip::RunType(config.getParameter<uint32_t>("RunType")))
55  {
56  produces<SiStripEventSummary>();
58  }
59 
61 
63  {
65 
66  //get the event number and Bx counter from the first valud FED buffer
68  event.getByLabel(rawDataTag_,rawDataHandle);
69  const FEDRawDataCollection& rawData = *rawDataHandle;
70  bool fedFound = false;
71  uint32_t fedEventNumber = 0;
72  uint32_t fedBxNumber = 0;
73  for (uint16_t fedId = sistrip::FED_ID_MIN; fedId <= sistrip::FED_ID_MAX; ++fedId) {
74  const FEDRawData& fedData = rawData.FEDData(fedId);
75  if (fedData.size() && fedData.data()) {
76  std::auto_ptr<sistrip::FEDBufferBase> pBuffer;
77  try {
78  pBuffer.reset(new sistrip::FEDBufferBase(fedData.data(),fedData.size()));
79  } catch (const cms::Exception& e) {
80  LogInfo(messageLabel_) << "Skipping FED " << fedId << " because of exception: " << e.what();
81  continue;
82  }
83  fedEventNumber = pBuffer->daqLvl1ID();
84  fedBxNumber = pBuffer->daqBXID();
85  fedFound = true;
86  break;
87  }
88  }
89  if (!fedFound) {
90  LogError(messageLabel_) << "No SiStrip FED data found in raw data.";
91  return;
92  }
93 
94  //create summary object
95  std::auto_ptr<SiStripEventSummary> pSummary(new SiStripEventSummary);
96  //set the trigger FED number to zero to indicate that it doesn't exist
97  pSummary->triggerFed(0);
98  //set the event number and Bx from the FED packets
99  pSummary->event(fedEventNumber);
100  pSummary->bx(fedBxNumber);
101  //create a fake trigger FED buffer to take comissioning parameters from
102  const int maxTriggerFedBufferSize = 84;
103  boost::scoped_array<uint32_t> fakeTriggerFedData(new uint32_t[maxTriggerFedBufferSize]);
104  for (uint8_t i=0; i<maxTriggerFedBufferSize; ++i) {
105  fakeTriggerFedData[i] = 0;
106  }
107  //set the FED readout mode to virgin raw
108  fakeTriggerFedData[15] = 1;
109  //set the spill number
110  fakeTriggerFedData[0] = 0;
111  //set the number of data senders
112  fakeTriggerFedData[20] = 1;
113  //set the run type
114  fakeTriggerFedData[10] = runType_;
115  //fill the summarry using trigger FED buffer with no data
116  pSummary->commissioningInfo(fakeTriggerFedData.get(),fedEventNumber);
117 
118  //store in event
119  event.put(pSummary);
120  }
121 
123  {
124  switch(runType_) {
126  case sistrip::PHYSICS:
127  case sistrip::PHYSICS_ZS:
128  case sistrip::PEDESTALS:
129  case sistrip::MULTI_MODE:
130  case sistrip::PEDS_ONLY:
131  case sistrip::NOISE:
135  break;
141  case sistrip::OPTO_SCAN:
142  case sistrip::APV_TIMING:
143  case sistrip::FED_TIMING:
144  case sistrip::FINE_DELAY:
150  case sistrip::VPSP_SCAN:
151  LogWarning(messageLabel_) << "Unsupported run type: " << runType_ << ". Parameters need to be set from real trigger FED. Parameters will be set to 0.";
152  break;
153  }
154  }
155 
156 }
157 
virtual char const * what() const
Definition: Exception.cc:141
int i
Definition: DBlmapReader.cc:9
static const uint16_t FED_ID_MIN
virtual void produce(edm::Event &event, const edm::EventSetup &) override
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
Constants and enumerated type for sistrip::RunType.
size_t size() const
Lenght of the data buffer in bytes.
Definition: FEDRawData.h:49
sistrip::SpyEventSummaryProducer SiStripSpyEventSummaryProducer
const FEDRawData & FEDData(int fedid) const
retrieve data for fed
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
SpyEventSummaryProducer(const edm::ParameterSet &config)
const unsigned char * data() const
Return a const pointer to the beginning of the data buffer.
Definition: FEDRawData.cc:29
static const uint16_t FED_ID_MAX