CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
PedsOnlyTask.cc
Go to the documentation of this file.
10 
12 
13 using namespace sistrip;
14 
15 // -----------------------------------------------------------------------------
16 //
18  const FedChannelConnection &rCONN)
19  : CommissioningTask( dqm, rCONN, "PedsOnlyTask")
20 {
21  //@@ NOT GUARANTEED TO BE THREAD SAFE!
22  pApvFactory_ = edm::Service<ApvFactoryService>().operator->()->getApvFactory();
23 
25  << "[PedsOnlyTask::" << __func__ << "]"
26  << " Constructing object...";
27 }
28 
29 // -----------------------------------------------------------------------------
30 //
32 {
34  << "[PedsOnlyTask::" << __func__ << "]"
35  << " Destructing object...";
36 
37  // Have to delete pApvFactory_ manually even though we didn't create it
38  // ourself. :(
39  if( pApvFactory_) { delete pApvFactory_; }
40 }
41 
42 // -----------------------------------------------------------------------------
43 //
45 {
46  LogTrace( mlDqmSource_) << "[PedsOnlyTask::" << __func__ << "]";
47 
48  const uint16_t nBINS = 256;
49 
50  {
51  // Pedestals
55  fedKey(),
57  connection().lldChannel(),
59 
60  HistoSet oHSet;
61  oHSet.isProfile_ = true;
62 
63  oHSet.vNumOfEntries_.resize( nBINS, 0);
64  oHSet.vSumOfContents_.resize( nBINS, 0);
65  oHSet.vSumOfSquares_.resize( nBINS, 0);
66 
67  oHSet.histo( dqm()->bookProfile( title, title,
68  nBINS, -0.5, nBINS * 1. - 0.5,
69  1025, 0., 1025.) );
70 
71  peds_.push_back( oHSet);
72  }
73 
74  {
75  // Raw Noise
79  fedKey(),
81  connection().lldChannel(),
83 
84  HistoSet oHSet;
85  oHSet.isProfile_ = true;
86 
87  oHSet.vNumOfEntries_.resize( nBINS, 0);
88  oHSet.vSumOfContents_.resize( nBINS, 0);
89  oHSet.vSumOfSquares_.resize( nBINS, 0);
90 
91  oHSet.histo( dqm()->bookProfile( title, title,
92  nBINS, -0.5, nBINS * 1. - 0.5,
93  1025, 0., 1025.) );
94 
95  peds_.push_back( oHSet);
96  }
97 
99  connection().nApvs());
100 }
101 
102 // -----------------------------------------------------------------------------
103 //
105  const edm::DetSet<SiStripRawDigi> &rDigis )
106 {
107  pApvFactory_->updatePair( connection().detId(),
108  connection().apvPairNumber(),
109  rDigis);
110 }
111 
112 // -----------------------------------------------------------------------------
113 //
115 {
116  static UpdateTProfile updateTProfile;
117 
118  TProfile *pedsProf = ExtractTObject<TProfile>().extract( peds_[0].histo() );
119  TProfile *noiseProf = ExtractTObject<TProfile>().extract( peds_[1].histo() );
120 
121  for( uint16_t nLclApv = 2 * connection().apvPairNumber(),
122  nMaxLclApv = nLclApv + 2;
123  nMaxLclApv > nLclApv;
124  ++nLclApv)
125  {
126  ApvAnalysis::PedestalType lclPedestals;
127  ApvAnalysis::PedestalType lclNoises;
128 
129  pApvFactory_->getPedestal( connection().detId(), nLclApv, lclPedestals);
130  pApvFactory_->getRawNoise( connection().detId(), nLclApv, lclNoises );
131 
132  const uint16_t nSTART_BIN = 128 * ( nLclApv % 2);
133 
134  for( uint16_t nBin = 0,
135  nAbsBin = nSTART_BIN + nBin + 1;
136  128 > nBin;
137  ++nBin, ++nAbsBin)
138  {
139  updateTProfile.setBinContent( pedsProf, nAbsBin, 5,
140  lclPedestals[nBin], lclNoises[nBin]);
141  updateTProfile.setBinContent( noiseProf, nAbsBin, 5,
142  lclNoises[nBin], 0);
143  } // End loop over BINs
144  } // End loop over Local Apvs
145 }
146 // -----------------------------------------------------------------------------
std::vector< float > vNumOfEntries_
std::vector< float > PedestalType
Definition: ApvAnalysis.h:48
static const char rawNoise_[]
Utility class that holds histogram title.
const std::string & title() const
void getPedestal(uint32_t det_id, int apvNumber, ApvAnalysis::PedestalType &peds)
static const char mlDqmSource_[]
uint16_t apvPairNumber() const
std::vector< float > vSumOfContents_
void getRawNoise(uint32_t det_id, int apvNumber, ApvAnalysis::PedestalType &noise)
void updatePair(uint32_t det_id, size_t apvPair, const edm::DetSet< SiStripRawDigi > &in)
Class containning control, module, detector and connection information, at the level of a FED channel...
virtual void update()
bool instantiateApvs(uint32_t det_id, int numberOfApvs)
std::vector< HistoSet > peds_
Definition: PedsOnlyTask.h:31
virtual void fill(const SiStripEventSummary &, const edm::DetSet< SiStripRawDigi > &)
static void setBinContent(TProfile *const profile, const uint32_t &bin, const double &entries, const double &mean, const double &spread)
#define LogTrace(id)
int extract(std::vector< int > *output, const std::string &dati)
static const char pedestals_[]
DQMStore *const dqm() const
ApvAnalysisFactory * pApvFactory_
Definition: PedsOnlyTask.h:33
void histo(MonitorElement *)
PedsOnlyTask(DQMStore *, const FedChannelConnection &)
Definition: PedsOnlyTask.cc:17
const uint32_t & fedKey() const
std::vector< double > vSumOfSquares_
const FedChannelConnection & connection() const
virtual void book()
Definition: PedsOnlyTask.cc:44
virtual ~PedsOnlyTask()
Definition: PedsOnlyTask.cc:31