test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
VpspScanTask.cc
Go to the documentation of this file.
7 #include <algorithm>
8 
9 using namespace sistrip;
10 
11 // -----------------------------------------------------------------------------
12 //
14  const FedChannelConnection& conn ) :
15  CommissioningTask( dqm, conn, "VpspScanTask" ),
16  vpsp_()
17 {}
18 
19 // -----------------------------------------------------------------------------
20 //
22 }
23 
24 // -----------------------------------------------------------------------------
25 //
27 
28  uint16_t nbins = 60;
29 
31 
32  vpsp_.resize(2);
33  for ( uint16_t iapv = 0; iapv < 2; iapv++ ) {
34  if ( connection().i2cAddr(iapv) ) {
35 
36  std::stringstream extra_info;
37  extra_info << sistrip::apv_ << iapv;
38 
42  fedKey(),
44  connection().lldChannel(),
45  extra_info.str() ).title();
46 
47  vpsp_[iapv].histo( dqm()->bookProfile( title, title,
48  nbins, -0.5, nbins*1.-0.5,
49  1025, 0., 1025. ) );
50 
51  vpsp_[iapv].vNumOfEntries_.resize(nbins,0);
52  vpsp_[iapv].vSumOfContents_.resize(nbins,0);
53  vpsp_[iapv].vSumOfSquares_.resize(nbins,0);
54 
55  }
56  }
57 
58 }
59 
60 // -----------------------------------------------------------------------------
61 //
63  const edm::DetSet<SiStripRawDigi>& digis ) {
64 
65  // Retrieve VPSP setting and CCU channel
66  uint32_t vpsp = const_cast<SiStripEventSummary&>(summary).vpsp();
67  uint32_t ccu_chan = const_cast<SiStripEventSummary&>(summary).vpspCcuChan();
68 
69  // Check CCU channel from EventSummary is consistent with this module
70  if ( SiStripFecKey( fecKey() ).ccuChan() != ccu_chan ) { return; }
71 
72  if ( digis.data.size() != 256 ) {
74  << "[VpspScanTask::" << __func__ << "]"
75  << " Unexpected number of digis! "
76  << digis.data.size();
77  return;
78  }
79 
80  // Fill histo with baseline(calc'ed from median value of data)
81  for ( uint16_t iapv = 0; iapv < 2; iapv++ ) {
82 
83  if ( vpsp >= vpsp_[iapv].vNumOfEntries_.size() ) {
85  << "[VpspScanTask::" << __func__ << "]"
86  << " Unexpected VPSP value! " << vpsp;
87  return;
88  }
89 
90  std::vector<uint16_t> baseline;
91  baseline.reserve(128);
92  for ( uint16_t idigi = 128*iapv; idigi < 128*(iapv+1); idigi++ ) {
93  baseline.push_back( digis.data[idigi].adc() );
94  }
95  sort( baseline.begin(), baseline.end() );
96  uint16_t index = baseline.size()%2 ? baseline.size()/2 : baseline.size()/2-1;
97 
98  if ( !baseline.empty() ) {
99  updateHistoSet( vpsp_[iapv], vpsp, baseline[index] );
100  }
101 
102  }
103 
104 }
105 
106 // -----------------------------------------------------------------------------
107 //
109  for ( uint32_t iapv = 0; iapv < vpsp_.size(); iapv++ ) {
110  updateHistoSet( vpsp_[iapv] );
111  }
112 }
113 
114 
Utility class that holds histogram title.
std::vector< HistoSet > vpsp_
Definition: VpspScanTask.h:23
virtual void fill(const SiStripEventSummary &, const edm::DetSet< SiStripRawDigi > &)
Definition: VpspScanTask.cc:62
virtual void book()
Definition: VpspScanTask.cc:26
static const char mlDqmSource_[]
Utility class that identifies a position within the strip tracker control structure, down to the level of an APV25.
Definition: SiStripFecKey.h:45
void updateHistoSet(HistoSet &, const uint32_t &bin, const float &value)
virtual ~VpspScanTask()
Definition: VpspScanTask.cc:21
virtual void update()
Class containning control, module, detector and connection information, at the level of a FED channel...
static const char apv_[]
DQMStore *const dqm() const
VpspScanTask(DQMStore *, const FedChannelConnection &)
Definition: VpspScanTask.cc:13
collection_type data
Definition: DetSet.h:78
const uint32_t & fedKey() const
const FedChannelConnection & connection() const
tuple conn
Definition: results_mgr.py:53
const uint32_t & fecKey() const