Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 11:59:50

0001 // -*- C++ -*-
0002 //
0003 // Package:    CalibTracker/SiStripDCS/test/Synchronization
0004 // Class:      SyncDCSO2O
0005 //
0006 /**\class SyncDCSO2O SyncDCSO2O.cc
0007 
0008  Description: Produces a histogram with the digi occupancy vs time and the change of payload.
0009 
0010 */
0011 //
0012 // Original Author:  Marco DE MATTIA
0013 //         Created:  Tue Feb  9 15:38:18 CET 2010
0014 //
0015 //
0016 
0017 // system include files
0018 #include <memory>
0019 
0020 // user include files
0021 #include "FWCore/Framework/interface/Frameworkfwd.h"
0022 #include "FWCore/Framework/interface/one/EDAnalyzer.h"
0023 
0024 #include "FWCore/Framework/interface/Event.h"
0025 #include "FWCore/Framework/interface/MakerMacros.h"
0026 
0027 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0028 
0029 #include "DataFormats/Common/interface/DetSetNew.h"
0030 #include "DataFormats/Common/interface/DetSetVectorNew.h"
0031 #include "DataFormats/Common/interface/DetSetVector.h"
0032 #include "DataFormats/SiStripDigi/interface/SiStripDigi.h"
0033 
0034 #include "CondFormats/SiStripObjects/interface/SiStripDetVOff.h"
0035 #include "CondFormats/DataRecord/interface/SiStripCondDataRecords.h"
0036 
0037 #include <vector>
0038 
0039 #include "TH1F.h"
0040 #include "TGraph.h"
0041 
0042 class SyncDCSO2O : public edm::one::EDAnalyzer<> {
0043 public:
0044   explicit SyncDCSO2O(const edm::ParameterSet&);
0045   ~SyncDCSO2O();
0046 
0047 private:
0048   virtual void beginJob();
0049   virtual void analyze(const edm::Event&, const edm::EventSetup&);
0050   virtual void endJob();
0051 
0052   void getDigis(const edm::Event& iEvent);
0053   /// Build TGraphs with quantity vs time
0054   TGraph* buildGraph(TH1F* histo, Float_t* timeArray);
0055 
0056   // ----------member data ---------------------------
0057   const edm::ESGetToken<SiStripDetVOff, SiStripDetVOffRcd> dcsToken_;
0058   edm::Handle<edm::DetSetVector<SiStripDigi> > digiDetsetVector_[4];
0059   typedef std::vector<edm::ParameterSet> Parameters;
0060   Parameters digiProducersList_;
0061 
0062   struct TimeInfo {
0063     TimeInfo(unsigned long long inputTime,
0064              unsigned int inputDigiOccupancy,
0065              unsigned int inputDigiOccupancyWithMasking,
0066              unsigned int inputHVoff)
0067         : time(inputTime),
0068           digiOccupancy(inputDigiOccupancy),
0069           digiOccupancyWithMasking(inputDigiOccupancyWithMasking),
0070           HVoff(inputHVoff) {}
0071 
0072     unsigned long long time;
0073     unsigned int digiOccupancy;
0074     unsigned int digiOccupancyWithMasking;
0075     unsigned int HVoff;
0076   };
0077 
0078   struct SortByTime {
0079     bool operator()(const TimeInfo& timeInfo1, const TimeInfo& timeInfo2) { return (timeInfo1.time < timeInfo2.time); }
0080   };
0081 
0082   std::vector<TimeInfo> timeInfo_;
0083 };