CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Classes | Public Member Functions | Private Member Functions | Private Attributes
SiStripCMMonitorPlugin Class Reference

#include <DQM/SiStripMonitorHardware/plugins/SiStripCMMonitor.cc>

Inheritance diagram for SiStripCMMonitorPlugin:
edm::EDAnalyzer edm::EDConsumerBase

Classes

struct  Statistics
 

Public Member Functions

 SiStripCMMonitorPlugin (const edm::ParameterSet &)
 
 ~SiStripCMMonitorPlugin ()
 
- Public Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 
- Public Member Functions inherited from edm::EDConsumerBase
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Member Functions

virtual void analyze (const edm::Event &, const edm::EventSetup &) override
 
virtual void beginJob () override
 
virtual void endJob () override
 
void fillMaps (uint32_t aDetId, unsigned short aChInModule, std::pair< uint16_t, uint16_t > aMedians)
 
void updateCabling (const edm::EventSetup &eventSetup)
 

Private Attributes

const SiStripFedCablingcabling_
 
uint32_t cablingCacheId_
 
CMHistograms cmHists_
 
std::map< unsigned int,
Statistics
CommonModes_
 
std::map< unsigned int,
Statistics
CommonModesAPV0minusAPV1_
 
bool doTkHistoMap_
 
DQMStoredqm_
 
std::string dqmStoreFileName_
 
unsigned int evt_
 
std::vector< unsigned int > fedIdVec_
 
bool fillAllDetailedHistograms_
 
bool fillWithEvtNum_
 
bool fillWithLocalEvtNum_
 
std::string folderName_
 
std::pair< uint16_t, uint16_t > prevMedians_ [FEDNumbering::MAXSiStripFEDID+1][sistrip::FEDCH_PER_FED]
 
unsigned int printDebug_
 
edm::InputTag rawDataTag_
 
edm::EDGetTokenT
< FEDRawDataCollection
rawDataToken_
 
bool writeDQMStore_
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
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 ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
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)
 

Detailed Description

Description: DQM source application to monitor common mode for SiStrip data

Definition at line 61 of file SiStripCMMonitor.cc.

Constructor & Destructor Documentation

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

Definition at line 127 of file SiStripCMMonitor.cc.

References cmHists_, CommonModes_, CommonModesAPV0minusAPV1_, doTkHistoMap_, dqmStoreFileName_, evt_, sistrip::FEDCH_PER_FED, fillAllDetailedHistograms_, fillWithEvtNum_, folderName_, LogTrace, FEDNumbering::MAXSiStripFEDID, FEDNumbering::MINSiStripFEDID, NULL, prevMedians_, printDebug_, rawDataTag_, rawDataToken_, and writeDQMStore_.

128  : rawDataTag_(iConfig.getUntrackedParameter<edm::InputTag>("RawDataTag",edm::InputTag("source",""))),
129  folderName_(iConfig.getUntrackedParameter<std::string>("HistogramFolderName","SiStrip/ReadoutView/CMMonitoring")),
130  fedIdVec_(iConfig.getUntrackedParameter<std::vector<unsigned int> >("FedIdVec")),
131  fillAllDetailedHistograms_(iConfig.getUntrackedParameter<bool>("FillAllDetailedHistograms",false)),
132  fillWithEvtNum_(iConfig.getUntrackedParameter<bool>("FillWithEventNumber",false)),
133  fillWithLocalEvtNum_(iConfig.getUntrackedParameter<bool>("FillWithLocalEventNumber",false)),
134  printDebug_(iConfig.getUntrackedParameter<unsigned int>("PrintDebugMessages",1)),
135  writeDQMStore_(iConfig.getUntrackedParameter<bool>("WriteDQMStore",false)),
136  dqmStoreFileName_(iConfig.getUntrackedParameter<std::string>("DQMStoreFileName","DQMStore.root")),
137  dqm_(0),
138  cablingCacheId_(0)
139 
140 {
141  rawDataToken_ = consumes<FEDRawDataCollection>(rawDataTag_);
142  //print config to debug log
143  std::ostringstream debugStream;
144  if (printDebug_>1) {
145  debugStream << "[SiStripCMMonitorPlugin]Configuration for SiStripCMMonitorPlugin: " << std::endl
146  << "[SiStripCMMonitorPlugin]\tRawDataTag: " << rawDataTag_ << std::endl
147  << "[SiStripCMMonitorPlugin]\tHistogramFolderName: " << folderName_ << std::endl
148  << "[SiStripCMMonitorPlugin]\tFillAllDetailedHistograms? " << (fillAllDetailedHistograms_ ? "yes" : "no") << std::endl
149  << "[SiStripCMMonitorPlugin]\tFillWithEventNumber?" << (fillWithEvtNum_ ? "yes" : "no") << std::endl
150  << "[SiStripCMMonitorPlugin]\tPrintDebugMessages? " << (printDebug_ ? "yes" : "no") << std::endl
151  << "[SiStripCMMonitorPlugin]\tWriteDQMStore? " << (writeDQMStore_ ? "yes" : "no") << std::endl;
152  if (writeDQMStore_) debugStream << "[SiStripCMMonitorPlugin]\tDQMStoreFileName: " << dqmStoreFileName_ << std::endl;
153  }
154 
155  std::ostringstream* pDebugStream = (printDebug_>1 ? &debugStream : NULL);
156 
157  cmHists_.initialise(iConfig,pDebugStream);
158 
159  doTkHistoMap_ = cmHists_.tkHistoMapEnabled();
160 
161  CommonModes_.clear();
163 
164  for (unsigned int fedId(FEDNumbering::MINSiStripFEDID); fedId <= FEDNumbering::MAXSiStripFEDID; fedId++){
165  for (unsigned int iCh(0); iCh<sistrip::FEDCH_PER_FED; iCh++){
166  prevMedians_[fedId][iCh] = std::pair<uint16_t,uint16_t>(0,0);
167  }
168  }
169 
170 
171  if (printDebug_) {
172  LogTrace("SiStripMonitorHardware") << debugStream.str();
173  }
174 
175  evt_ = 0;
176 
177 }
T getUntrackedParameter(std::string const &, T const &) const
std::pair< uint16_t, uint16_t > prevMedians_[FEDNumbering::MAXSiStripFEDID+1][sistrip::FEDCH_PER_FED]
#define NULL
Definition: scimark2.h:8
std::vector< unsigned int > fedIdVec_
std::map< unsigned int, Statistics > CommonModesAPV0minusAPV1_
edm::EDGetTokenT< FEDRawDataCollection > rawDataToken_
#define LogTrace(id)
std::map< unsigned int, Statistics > CommonModes_
static const uint16_t FEDCH_PER_FED
SiStripCMMonitorPlugin::~SiStripCMMonitorPlugin ( )

Definition at line 179 of file SiStripCMMonitor.cc.

180 {
181 }

Member Function Documentation

void SiStripCMMonitorPlugin::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivatevirtual

Implements edm::EDAnalyzer.

Definition at line 190 of file SiStripCMMonitor.cc.

References cabling_, cmHists_, sistrip::FEDChannel::cmMedian(), gather_cfg::cout, FEDRawData::data(), FedChannelConnection::detId(), edm::EventID::event(), evt_, sistrip::FEDCH_PER_FED, SiStripFedCabling::fedConnection(), FEDRawDataCollection::FEDData(), fillMaps(), fillWithEvtNum_, fillWithLocalEvtNum_, edm::EventSetup::get(), edm::Event::getByToken(), edm::EventBase::id(), sistrip::invalid32_, FedChannelConnection::isConnected(), sistrip::FEDChannel::length(), FEDNumbering::MAXSiStripFEDID, FEDNumbering::MINSiStripFEDID, FedChannelConnection::nApvPairs(), edm::EventBase::orbitNumber(), prevMedians_, printDebug_, edm::ESHandle< class >::product(), rawDataToken_, FEDRawData::size(), updateCabling(), and makeHLTPrescaleTable::values.

192 {
193  //Retrieve tracker topology from geometry
194  edm::ESHandle<TrackerTopology> tTopoHandle;
195  iSetup.get<IdealGeometryRecord>().get(tTopoHandle);
196  const TrackerTopology* const tTopo = tTopoHandle.product();
197 
198  //static bool firstEvent = true;
199  //static bool isBeingFilled = false;
200  //update cabling
201  updateCabling(iSetup);
202 
203  //get raw data
204  edm::Handle<FEDRawDataCollection> rawDataCollectionHandle;
205  // iEvent.getByLabel(rawDataTag_,rawDataCollectionHandle);
206  iEvent.getByToken(rawDataToken_,rawDataCollectionHandle);
207  const FEDRawDataCollection& rawDataCollection = *rawDataCollectionHandle;
208 
209  //FED errors
210  FEDErrors lFedErrors;
211 
212  //loop over siStrip FED IDs
213  for (unsigned int fedId = FEDNumbering::MINSiStripFEDID;
215  fedId++) {//loop over FED IDs
216  const FEDRawData& fedData = rawDataCollection.FEDData(fedId);
217 
218  //create an object to fill all errors
219  lFedErrors.initialiseFED(fedId,cabling_,tTopo);
220 
221  //Do detailed check
222  //first check if data exists
223  bool lDataExist = lFedErrors.checkDataPresent(fedData);
224  if (!lDataExist) {
225  continue;
226  }
227 
228  std::auto_ptr<const sistrip::FEDBuffer> buffer;
229 
230  if (!lFedErrors.fillFatalFEDErrors(fedData,0)) {
231  continue;
232  }
233  else {
234  //need to construct full object to go any further
235  buffer.reset(new sistrip::FEDBuffer(fedData.data(),fedData.size(),true));
236  bool channelLengthsOK = buffer->checkChannelLengthsMatchBufferLength();
237  bool channelPacketCodesOK = buffer->checkChannelPacketCodes();
238  bool feLengthsOK = buffer->checkFEUnitLengths();
239  if ( !channelLengthsOK ||
240  !channelPacketCodesOK ||
241  !feLengthsOK ) {
242  continue;
243  }
244  }
245 
246  std::ostringstream infoStream;
247 
248 
249  if (printDebug_ > 1) {
250  infoStream << " --- Processing FED #" << fedId << std::endl;
251  }
252 
253 
254  std::vector<CMHistograms::CMvalues> values;
255 
256  for (unsigned int iCh = 0;
257  iCh < sistrip::FEDCH_PER_FED;
258  iCh++) {//loop on channels
259 
260  const FedChannelConnection & lConnection = cabling_->fedConnection(fedId,iCh);
261  bool connected = lConnection.isConnected();
262 
263  //std::cout << "FedID " << fedId << ", ch " << iCh << ", nAPVPairs " << lConnection.nApvPairs() << " apvPairNumber " << lConnection.apvPairNumber() << std::endl;
264 
265  if (!connected) {
266  continue;
267  }
268 
269  uint32_t lDetId = lConnection.detId();
270  unsigned short nChInModule = lConnection.nApvPairs();
271 
272  if (!lDetId || lDetId == sistrip::invalid32_) continue;
273 
274  bool lFailUnpackerChannelCheck = !buffer->channelGood(iCh) && connected;
275 
276  if (lFailUnpackerChannelCheck) {
277  continue;
278  }
279 
280 
281  //short lAPVPair = lConnection.apvPairNumber();
282  //short lSubDet = DetId(lDetId).subdetId();
283 
284 // if (firstEvent){
285 // infoStream << "Subdet " << lSubDet << ", " ;
286 // if (lSubDet == 3) {
287 //
288 // infoStream << "TIB layer " << tTopo->tibLayer(lDetId) << ", fedID " << fedId << ", channel " << iCh << std::endl;
289 // }
290 // else if (lSubDet == 4) {
291 //
292 // infoStream << "TID side " << tTopo->tibSide(lDetId) << " wheel " << tTopo->tibWheel(lDetId) << ", ring " << tTopo->tibRing(lDetId) << ", fedID " << fedId << ", channel " << iCh << std::endl;
293 // }
294 // else if (lSubDet == 5) {
295 //
296 // infoStream << "TOB side " << tTopo->tibRod(lDetId)[0] << " layer " << tTopo->tibLayer(lDetId) << ", rod " << tTopo->tibRodNumber(lDetId) << ", fedID " << fedId << ", channel " << iCh << std::endl;
297 // }
298 // else if (lSubDet == 6) {
299 //
300 // infoStream << "TEC side " << tTopo->tibSide(lDetId) << " wheel " << tTopo->tibWheel(lDetId) << ", petal " << tTopo->tibPetalNumber(lDetId) << ", ring " << tTopo->tibRing(lDetId) << ", fedID " << fedId << ", channel " << iCh << std::endl;
301 // }
302 // isBeingFilled=true;
303 // }
304 
305  std::ostringstream lMode;
306  lMode << buffer->readoutMode();
307  if (printDebug_ > 1) {
308  static bool lFirst = true;
309  if (lFirst) {
310  std::cout << "Readout mode: " << lMode.str() << std::endl;
311  lFirst = false;
312  }
313 
314  }
315 
316  const sistrip::FEDChannel & lChannel = buffer->channel(iCh);
317  std::pair<uint16_t,uint16_t> medians = std::pair<uint16_t,uint16_t>(0,0);
318 
319  if (lMode.str().find("Zero suppressed") != lMode.str().npos && lMode.str().find("lite") == lMode.str().npos) medians = std::pair<uint16_t,uint16_t>(lChannel.cmMedian(0),lChannel.cmMedian(1));
320 
321  CMHistograms::CMvalues lVal;
322  lVal.ChannelID = iCh;
323  lVal.Medians = std::pair<uint16_t,uint16_t>(medians.first,medians.second);
324  lVal.PreviousMedians = prevMedians_[fedId][iCh];
325 
326 // if (medians.second-medians.first > 26){
327 // std::ostringstream info;
328 // if (medians.second-medians.first > 44) info << " --- Second bump: event " << iEvent.id().event() << ", FED/Channel " << fedId << "/" << iCh << ", delta=" << medians.second-medians.first << std::endl;
329 // else info << " --- First bump: event " << iEvent.id().event() << ", FED/Channel " << fedId << "/" << iCh << ", delta=" << medians.second-medians.first << std::endl;
330 // edm::LogVerbatim("SiStripMonitorHardware") << info.str();
331 // }
332 
333  if (printDebug_ > 1) {
334  if (lChannel.length() > 7) {
335  infoStream << "Medians for channel #" << iCh << " (length " << lChannel.length() << "): " << medians.first << ", " << medians.second << std::endl;
336  }
337  }
338 
339  values.push_back(lVal);
340 
341  //if (iEvent.id().event() > 1000)
342  fillMaps(lDetId,nChInModule,medians);
343 
344  prevMedians_[fedId][iCh] = std::pair<uint16_t,uint16_t>(medians.first,medians.second);
345 
346  }//loop on channels
347 
348  float lTime = 0;
349  if (fillWithEvtNum_) lTime = iEvent.id().event();
350  else if (fillWithLocalEvtNum_) lTime = evt_;//iEvent.id().event();
351  else lTime = iEvent.orbitNumber()/11223.;
352 
353  cmHists_.fillHistograms(values,lTime,fedId);
354 
355  //if (printDebug_ > 0 && isBeingFilled && firstEvent) edm::LogVerbatim("SiStripMonitorHardware") << infoStream.str();
356 
357 
358 
359  }//loop on FEDs
360 
361 
362  //if (isBeingFilled)
363  //firstEvent = false;
364 
365  evt_++;
366 
367 }//analyze method
EventNumber_t event() const
Definition: EventID.h:44
std::pair< uint16_t, uint16_t > prevMedians_[FEDNumbering::MAXSiStripFEDID+1][sistrip::FEDCH_PER_FED]
FedChannelConnection fedConnection(uint16_t fed_id, uint16_t fed_ch) const
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:434
static const uint32_t invalid32_
Definition: Constants.h:15
void fillMaps(uint32_t aDetId, unsigned short aChInModule, std::pair< uint16_t, uint16_t > aMedians)
size_t size() const
Lenght of the data buffer in bytes.
Definition: FEDRawData.h:47
uint16_t cmMedian(const uint8_t apvIndex) const
const FEDRawData & FEDData(int fedid) const
retrieve data for fed
void updateCabling(const edm::EventSetup &eventSetup)
const uint32_t & detId() const
Class containning control, module, detector and connection information, at the level of a FED channel...
edm::EDGetTokenT< FEDRawDataCollection > rawDataToken_
int orbitNumber() const
Definition: EventBase.h:63
const T & get() const
Definition: EventSetup.h:55
const uint16_t & nApvPairs() const
T const * product() const
Definition: ESHandle.h:62
const SiStripFedCabling * cabling_
edm::EventID id() const
Definition: EventBase.h:56
static const uint16_t FEDCH_PER_FED
const unsigned char * data() const
Return a const pointer to the beginning of the data buffer.
Definition: FEDRawData.cc:28
tuple cout
Definition: gather_cfg.py:121
void SiStripCMMonitorPlugin::beginJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 371 of file SiStripCMMonitor.cc.

References cmHists_, dqm_, fillAllDetailedHistograms_, folderName_, and DQMStore::setCurrentFolder().

372 {
373  //get DQM store
376 
377  cmHists_.bookTopLevelHistograms(dqm_);
378 
379  if (fillAllDetailedHistograms_) cmHists_.bookAllFEDHistograms();
380 
381 }
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:584
void SiStripCMMonitorPlugin::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 385 of file SiStripCMMonitor.cc.

References cmHists_, CommonModes_, CommonModesAPV0minusAPV1_, SiStripCMMonitorPlugin::Statistics::Counter, cond::rpcobgas::detid, doTkHistoMap_, dqm_, dqmStoreFileName_, SiStripCMMonitorPlugin::Statistics::Mean, timingPdfMaker::mean, python.rootplot.argparse::message, printDebug_, plotscripts::rms(), SiStripCMMonitorPlugin::Statistics::Rms, DQMStore::save(), mathSSE::sqrt(), and writeDQMStore_.

386 {
387 
388  if (doTkHistoMap_) {//if TkHistoMap is enabled
389  std::map<unsigned int,Statistics>::iterator fracIter;
390 
391  //int ele = 0;
392  //int nBadChannels = 0;
393  for (fracIter = CommonModes_.begin(); fracIter!=CommonModes_.end(); fracIter++){
394  uint32_t detid = fracIter->first;
395  //if ((fracIter->second).second != 0) {
396  //std::cout << "------ ele #" << ele << ", Frac for detid #" << detid << " = " <<(fracIter->second).second << "/" << (fracIter->second).first << std::endl;
397  //nBadChannels++;
398  //}
399  float mean = 0;
400  float rms = 0;
401  Statistics lStat = fracIter->second;
402  if (lStat.Counter > 0) mean = lStat.Mean/lStat.Counter;
403  if (lStat.Counter > 1) rms = sqrt(lStat.Rms/(lStat.Counter-1)-(mean*mean));
404  cmHists_.fillTkHistoMap(cmHists_.tkHistoMapPointer(0),detid,mean);
405  cmHists_.fillTkHistoMap(cmHists_.tkHistoMapPointer(1),detid,rms);
406 
407  if (printDebug_ > 1) {
408  std::ostringstream message;
409  message << "TkHistoMap CM: Detid " << detid << ", mean = " << mean << ", rms = " << rms << ", counter = " << lStat.Counter << std::endl;
410  edm::LogVerbatim("SiStripMonitorHardware") << message.str();
411  }
412 
413  //ele++;
414  }
415 
416  for (fracIter = CommonModesAPV0minusAPV1_.begin(); fracIter!=CommonModesAPV0minusAPV1_.end(); fracIter++){
417  uint32_t detid = fracIter->first;
418  //if ((fracIter->second).second != 0) {
419  //std::cout << "------ ele #" << ele << ", Frac for detid #" << detid << " = " <<(fracIter->second).second << "/" << (fracIter->second).first << std::endl;
420  //nBadChannels++;
421  //}
422  float mean = 0;
423  float rms = 0;
424  Statistics lStat = fracIter->second;
425  if (lStat.Counter > 0) mean = lStat.Mean/lStat.Counter;
426  if (lStat.Counter > 1) rms = sqrt(lStat.Rms/(lStat.Counter-1)-(mean*mean));
427  cmHists_.fillTkHistoMap(cmHists_.tkHistoMapPointer(2),detid,mean);
428  cmHists_.fillTkHistoMap(cmHists_.tkHistoMapPointer(3),detid,rms);
429 
430  if (printDebug_ > 1) {
431  std::ostringstream message;
432  message << "TkHistoMap APV0minusAPV1: Detid " << detid << ", mean = " << mean << ", rms = " << rms << ", counter = " << lStat.Counter << std::endl;
433  edm::LogVerbatim("SiStripMonitorHardware") << message.str();
434  }
435 
436  //ele++;
437  }
438 
439  }//if TkHistoMap is enabled
440 
442 }
std::map< unsigned int, Statistics > CommonModesAPV0minusAPV1_
T sqrt(T t)
Definition: SSEVec.h:48
void save(const std::string &filename, const std::string &path="", const std::string &pattern="", const std::string &rewrite="", const uint32_t run=0, SaveReferenceTag ref=SaveWithReference, int minStatus=dqm::qstatus::STATUS_OK, const std::string &fileupdate="RECREATE")
Definition: DQMStore.cc:2296
std::map< unsigned int, Statistics > CommonModes_
void SiStripCMMonitorPlugin::fillMaps ( uint32_t  aDetId,
unsigned short  aChInModule,
std::pair< uint16_t, uint16_t >  aMedians 
)
private

Definition at line 456 of file SiStripCMMonitor.cc.

References CommonModes_, CommonModesAPV0minusAPV1_, SiStripCMMonitorPlugin::Statistics::Counter, doTkHistoMap_, SiStripCMMonitorPlugin::Statistics::Mean, SiStripCMMonitorPlugin::Statistics::Rms, and edm::second().

Referenced by analyze().

457 {
458 
459  if (doTkHistoMap_){//if TkHistMap is enabled
460  std::pair<std::map<unsigned int,Statistics>::iterator,bool> alreadyThere[2];
461 
462  Statistics lStat;
463  lStat.Mean = (aMedians.first+aMedians.second)*1./(2*aChInModule);
464  lStat.Rms = (aMedians.first+aMedians.second)*(aMedians.first+aMedians.second)*1./(4*aChInModule);
465  lStat.Counter = 1./aChInModule;
466 
467  alreadyThere[0] = CommonModes_.insert(std::pair<unsigned int,Statistics>(aDetId,lStat));
468  if (!alreadyThere[0].second) {
469  ((alreadyThere[0].first)->second).Mean += (aMedians.first+aMedians.second)*1./(2*aChInModule);
470  ((alreadyThere[0].first)->second).Rms += (aMedians.first+aMedians.second)*(aMedians.first+aMedians.second)*1./(4*aChInModule);
471  ((alreadyThere[0].first)->second).Counter += 1./aChInModule;
472  }
473 
474  lStat.Mean = (aMedians.first-aMedians.second)*1./aChInModule;
475  lStat.Rms = (aMedians.first-aMedians.second)*(aMedians.first-aMedians.second)*1./aChInModule;
476  lStat.Counter = 1./aChInModule;
477 
478  alreadyThere[1] = CommonModesAPV0minusAPV1_.insert(std::pair<unsigned int,Statistics>(aDetId,lStat));
479  if (!alreadyThere[1].second) {
480  ((alreadyThere[1].first)->second).Mean += (aMedians.first-aMedians.second)*1./aChInModule;
481  ((alreadyThere[1].first)->second).Rms += (aMedians.first-aMedians.second)*(aMedians.first-aMedians.second)*1./aChInModule;
482  ((alreadyThere[1].first)->second).Counter += 1./aChInModule;
483  }
484 
485  }
486 
487 }
std::map< unsigned int, Statistics > CommonModesAPV0minusAPV1_
U second(std::pair< T, U > const &p)
std::map< unsigned int, Statistics > CommonModes_
void SiStripCMMonitorPlugin::updateCabling ( const edm::EventSetup eventSetup)
private

Definition at line 444 of file SiStripCMMonitor.cc.

References cabling_, cablingCacheId_, edm::EventSetup::get(), and edm::ESHandle< class >::product().

Referenced by analyze().

445 {
446  uint32_t currentCacheId = eventSetup.get<SiStripFedCablingRcd>().cacheIdentifier();
447  if (cablingCacheId_ != currentCacheId) {
448  edm::ESHandle<SiStripFedCabling> cablingHandle;
449  eventSetup.get<SiStripFedCablingRcd>().get(cablingHandle);
450  cabling_ = cablingHandle.product();
451  cablingCacheId_ = currentCacheId;
452  }
453 }
const T & get() const
Definition: EventSetup.h:55
T const * product() const
Definition: ESHandle.h:62
const SiStripFedCabling * cabling_

Member Data Documentation

const SiStripFedCabling* SiStripCMMonitorPlugin::cabling_
private

Definition at line 106 of file SiStripCMMonitor.cc.

Referenced by analyze(), and updateCabling().

uint32_t SiStripCMMonitorPlugin::cablingCacheId_
private

Definition at line 105 of file SiStripCMMonitor.cc.

Referenced by updateCabling().

CMHistograms SiStripCMMonitorPlugin::cmHists_
private

Definition at line 111 of file SiStripCMMonitor.cc.

Referenced by analyze(), beginJob(), endJob(), and SiStripCMMonitorPlugin().

std::map<unsigned int,Statistics> SiStripCMMonitorPlugin::CommonModes_
private

Definition at line 113 of file SiStripCMMonitor.cc.

Referenced by endJob(), fillMaps(), and SiStripCMMonitorPlugin().

std::map<unsigned int,Statistics> SiStripCMMonitorPlugin::CommonModesAPV0minusAPV1_
private

Definition at line 114 of file SiStripCMMonitor.cc.

Referenced by endJob(), fillMaps(), and SiStripCMMonitorPlugin().

bool SiStripCMMonitorPlugin::doTkHistoMap_
private

Definition at line 109 of file SiStripCMMonitor.cc.

Referenced by endJob(), fillMaps(), and SiStripCMMonitorPlugin().

DQMStore* SiStripCMMonitorPlugin::dqm_
private

Definition at line 103 of file SiStripCMMonitor.cc.

Referenced by beginJob(), and endJob().

std::string SiStripCMMonitorPlugin::dqmStoreFileName_
private

Definition at line 101 of file SiStripCMMonitor.cc.

Referenced by endJob(), and SiStripCMMonitorPlugin().

unsigned int SiStripCMMonitorPlugin::evt_
private

Definition at line 118 of file SiStripCMMonitor.cc.

Referenced by analyze(), and SiStripCMMonitorPlugin().

std::vector<unsigned int> SiStripCMMonitorPlugin::fedIdVec_
private

Definition at line 91 of file SiStripCMMonitor.cc.

bool SiStripCMMonitorPlugin::fillAllDetailedHistograms_
private

Definition at line 93 of file SiStripCMMonitor.cc.

Referenced by beginJob(), and SiStripCMMonitorPlugin().

bool SiStripCMMonitorPlugin::fillWithEvtNum_
private

Definition at line 95 of file SiStripCMMonitor.cc.

Referenced by analyze(), and SiStripCMMonitorPlugin().

bool SiStripCMMonitorPlugin::fillWithLocalEvtNum_
private

Definition at line 96 of file SiStripCMMonitor.cc.

Referenced by analyze().

std::string SiStripCMMonitorPlugin::folderName_
private

Definition at line 89 of file SiStripCMMonitor.cc.

Referenced by beginJob(), and SiStripCMMonitorPlugin().

std::pair<uint16_t,uint16_t> SiStripCMMonitorPlugin::prevMedians_[FEDNumbering::MAXSiStripFEDID+1][sistrip::FEDCH_PER_FED]
private

Definition at line 116 of file SiStripCMMonitor.cc.

Referenced by analyze(), and SiStripCMMonitorPlugin().

unsigned int SiStripCMMonitorPlugin::printDebug_
private

Definition at line 98 of file SiStripCMMonitor.cc.

Referenced by analyze(), endJob(), and SiStripCMMonitorPlugin().

edm::InputTag SiStripCMMonitorPlugin::rawDataTag_
private

Definition at line 86 of file SiStripCMMonitor.cc.

Referenced by SiStripCMMonitorPlugin().

edm::EDGetTokenT<FEDRawDataCollection> SiStripCMMonitorPlugin::rawDataToken_
private

Definition at line 87 of file SiStripCMMonitor.cc.

Referenced by analyze(), and SiStripCMMonitorPlugin().

bool SiStripCMMonitorPlugin::writeDQMStore_
private

Definition at line 100 of file SiStripCMMonitor.cc.

Referenced by endJob(), and SiStripCMMonitorPlugin().