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 /*#include "DataFormats/TrackReco/interface/Track.h"
23 #include "DataFormats/TrackCandidate/interface/TrackCandidateCollection.h"
24 #include "DataFormats/TrackCandidate/interface/TrackCandidate.h"
25 #include "DataFormats/TrackReco/interface/Track.h"
26 #include "DataFormats/TrackReco/interface/TrackFwd.h"
27 #include "DataFormats/VertexReco/interface/VertexFwd.h"
28 #include "DataFormats/VertexReco/interface/Vertex.h"
29 */
30 
31 //ROOT inclusion
32 #include "TH1F.h"
33 #include "TH2F.h"
34 #include "TString.h"
35 #include <cassert>
36 #include <fstream>
37 
38 class TFile;
39 
40 
41 
42 using namespace edm;
43 using namespace std;
44 
46 
47  srcProcessedRawDigi_ = conf.getParameter<edm::InputTag>( "srcProcessedRawDigi" );
48  // hiSelectedTracks = conf.getParameter<edm::InputTag>( "hiSelectedTracks" );
49  createOutputFile_ = conf.getUntrackedParameter<bool>("saveFile",false);
50  outputFile_ = conf.getParameter<std::string>("outputFile");
51  dbe = &*edm::Service<DQMStore>();
52  moduleRawDigiToken_ = consumes<edm::DetSetVector<SiStripRawDigi> >(conf.getParameter<edm::InputTag>( "srcProcessedRawDigi" ) );
53 
54 
55 
56 }
57 
59 {
60 }
61 
63 {
65  ibooker.setCurrentFolder("SiStrip/BaselineValidator");
66 
67  h1NumbadAPVsRes_ = ibooker.book1D("ResAPVs",";#ResAPVs", 100, 1.0, 10001);
68  //dbe->tag(h1NumbadAPVsRes_->getFullname(),1);
69  ibooker.tag(h1NumbadAPVsRes_,1);
70 
71  h1ADC_vs_strip_ = ibooker.book2D("ADCvsAPVs",";ADCvsAPVs", 768,-0.5,767.5, 1023, -0.5, 1022.5);
72  ibooker.tag(h1ADC_vs_strip_,2);
73 
74  return;
75 }
76 
77 // ------------ method called once each job just before starting event loop ------------
79 {
80 
81 }
82 
84 {
86  e.getByToken( moduleRawDigiToken_, moduleRawDigi );
87  edm::DetSetVector<SiStripRawDigi>::const_iterator itRawDigis = moduleRawDigi->begin();
88 
89  int NumResAPVs=0;
90  for (; itRawDigis != moduleRawDigi->end(); ++itRawDigis) {
91 
92 
94  int strip =0, totADC=0;
95 
96  for(;itRaw != itRawDigis->end(); ++itRaw, ++strip){
97 
98  float adc = itRaw->adc();
99  h1ADC_vs_strip_->Fill(strip,adc);
100 
101 
102 
103  totADC+= adc;
104 
105  if(strip%127 ==0){
106  if(totADC!= 0){
107  totADC =0;
108 
109  NumResAPVs++;
110 
111  }
112  }
113 
114  }
115 
116 
117  }
118 
120 
121  h1NumbadAPVsRes_->Fill(NumResAPVs);
122 
123 
124 
125 }
126 
127 
128 
129 // ------------ method called once each job just after ending the event loop ------------
130 void
132 
133  if (!outputFile_.empty() && createOutputFile_) {
134  dbe->save(outputFile_);
135  }
136 }
137 
138 //define this as a plug-in
140 
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:434
DEFINE_FWK_MODULE(HiMixingModule)
virtual void endJob()
analyzer loop
SiStripBaselineValidator(const edm::ParameterSet &)
MonitorElement * book1D(Args &&...args)
Definition: DQMStore.h:113
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:363
tuple conf
Definition: dbtoconf.py:185
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:274
MonitorElement * book2D(Args &&...args)
Definition: DQMStore.h:131
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
iterator begin()
Return an iterator to the first DetSet.
Definition: DetSetVector.h:348
collection_type::const_iterator const_iterator
Definition: DetSet.h:33
collection_type::const_iterator const_iterator
Definition: DetSetVector.h:106
Definition: Run.h:41