CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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  createOutputFile_ = conf.getUntrackedParameter<bool>("saveFile",false);
41  outputFile_ = conf.getParameter<std::string>("outputFile");
42  dbe = &*edm::Service<DQMStore>();
43  moduleRawDigiToken_ = consumes<edm::DetSetVector<SiStripRawDigi> >(conf.getParameter<edm::InputTag>( "srcProcessedRawDigi" ) );
44 
45 
46 
47 }
48 
50 {
51 }
52 
54 {
56  ibooker.setCurrentFolder("SiStrip/BaselineValidator");
57 
58  h1NumbadAPVsRes_ = ibooker.book1D("ResAPVs",";#ResAPVs", 100, 1.0, 10001);
59  //dbe->tag(h1NumbadAPVsRes_->getFullname(),1);
60  ibooker.tag(h1NumbadAPVsRes_,1);
61 
62  h1ADC_vs_strip_ = ibooker.book2D("ADCvsAPVs",";ADCvsAPVs", 768,-0.5,767.5, 1023, -0.5, 1022.5);
63  ibooker.tag(h1ADC_vs_strip_,2);
64 
65  return;
66 }
67 
68 // ------------ method called once each job just before starting event loop ------------
70 {
71 
72 }
73 
75 {
77  e.getByToken( moduleRawDigiToken_, moduleRawDigi );
78  edm::DetSetVector<SiStripRawDigi>::const_iterator itRawDigis = moduleRawDigi->begin();
79 
80  int NumResAPVs=0;
81  for (; itRawDigis != moduleRawDigi->end(); ++itRawDigis) {
82 
83 
85  int strip =0, totADC=0;
86 
87  for(;itRaw != itRawDigis->end(); ++itRaw, ++strip){
88 
89  float adc = itRaw->adc();
90  h1ADC_vs_strip_->Fill(strip,adc);
91 
92 
93 
94  totADC+= adc;
95 
96  if(strip%127 ==0){
97  if(totADC!= 0){
98  totADC =0;
99 
100  NumResAPVs++;
101 
102  }
103  }
104 
105  }
106 
107 
108  }
109 
111 
112  h1NumbadAPVsRes_->Fill(NumResAPVs);
113 
114 
115 
116 }
117 
118 
119 
120 // ------------ method called once each job just after ending the event loop ------------
121 void
123 
124  if (!outputFile_.empty() && createOutputFile_) {
125  dbe->save(outputFile_);
126  }
127 }
128 
129 //define this as a plug-in
131 
int adc(sample_type sample)
get the ADC sample (12 bits)
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:449
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
virtual void endJob()
analyzer loop
SiStripBaselineValidator(const edm::ParameterSet &)
MonitorElement * book1D(Args &&...args)
Definition: DQMStore.h:115
virtual void analyze(const edm::Event &, const edm::EventSetup &)
void tag(MonitorElement *, unsigned int)
Definition: DQMStore.cc:286
iterator end()
Return the off-the-end iterator.
Definition: DetSetVector.h:365
tuple conf
Definition: dbtoconf.py:185
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:274
MonitorElement * book2D(Args &&...args)
Definition: DQMStore.h:133
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
iterator begin()
Return an iterator to the first DetSet.
Definition: DetSetVector.h:350
collection_type::const_iterator const_iterator
Definition: DetSet.h:33
collection_type::const_iterator const_iterator
Definition: DetSetVector.h:108
Definition: Run.h:41