CMS 3D CMS Logo

SiStripBaselineValidator.cc
Go to the documentation of this file.
1 // Original Author: Ivan Amos Cali
2 // Created: Mon Jul 28 14:10:52 CEST 2008
3 //
4 //
5 
6 
7 // system include files
8 #include <memory>
9 #include <iostream>
10 
11 // user include files
21 
22 
23 //ROOT inclusion
24 #include "TH1F.h"
25 #include "TH2F.h"
26 #include "TString.h"
27 #include <cassert>
28 #include <fstream>
29 
30 class TFile;
31 
32 
33 
34 using namespace edm;
35 using namespace std;
36 
38 
39  srcProcessedRawDigi_ = conf.getParameter<edm::InputTag>( "srcProcessedRawDigi" );
40  moduleRawDigiToken_ = consumes<edm::DetSetVector<SiStripDigi> >(conf.getParameter<edm::InputTag>( "srcProcessedRawDigi" ) );
41 }
42 
44 {
45 }
46 
48 {
50  ibooker.setCurrentFolder("SiStrip/BaselineValidator");
51 
52  h1NumbadAPVsRes_ = ibooker.book1D("ResAPVs",";#ResAPVs", 100, 1.0, 10001);
53  ibooker.tag(h1NumbadAPVsRes_,1);
54 
55  h1ADC_vs_strip_ = ibooker.book2D("ADCvsAPVs",";ADCvsAPVs", 768,-0.5,767.5, 1023, -0.5, 1022.5);
56  ibooker.tag(h1ADC_vs_strip_,2);
57 
58  return;
59 }
60 
62 {
64  e.getByToken( moduleRawDigiToken_, moduleRawDigi );
65  edm::DetSetVector<SiStripDigi>::const_iterator itRawDigis = moduleRawDigi->begin();
66 
67  int NumResAPVs=0;
68  for (; itRawDigis != moduleRawDigi->end(); ++itRawDigis) {
69 
70 
71  edm::DetSet<SiStripDigi>::const_iterator itRaw = itRawDigis->begin();
72  int strip =0, totStripAPV=0, apv=0,prevapv=itRaw->strip()/128;
73 
74  for(;itRaw != itRawDigis->end(); ++itRaw){
75 
76  strip=itRaw->strip();
77  apv=strip/128;
78  float adc = itRaw->adc();
79  h1ADC_vs_strip_->Fill(strip,adc);
80 
81  if(prevapv!=apv){
82  if(totStripAPV>64){
83  NumResAPVs++;
84  }
85  prevapv=apv;
86  totStripAPV=0;
87  }
88  if(adc>0) ++totStripAPV;
89 
90 
91  }
92  if(totStripAPV>64){
93  NumResAPVs++;
94  }
95 
96  }
97 
99 
100  h1NumbadAPVsRes_->Fill(NumResAPVs);
101 
102 
103 
104 }
105 
106 //define this as a plug-in
108 
T getParameter(std::string const &) const
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:517
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:268
SiStripBaselineValidator(const edm::ParameterSet &)
MonitorElement * book1D(Args &&...args)
Definition: DQMStore.h:106
void tag(MonitorElement *, unsigned int)
Definition: DQMStore.cc:283
constexpr int adc(sample_type sample)
get the ADC sample (12 bits)
iterator end()
Return the off-the-end iterator.
Definition: DetSetVector.h:361
void analyze(const edm::Event &, const edm::EventSetup &) override
MonitorElement * book2D(Args &&...args)
Definition: DQMStore.h:109
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
HLT enums.
iterator begin()
Return an iterator to the first DetSet.
Definition: DetSetVector.h:346
collection_type::const_iterator const_iterator
Definition: DetSet.h:33
collection_type::const_iterator const_iterator
Definition: DetSetVector.h:104
Definition: Run.h:45