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 
62 // ------------ method called once each job just before starting event loop ------------
64 {
65 
66  if(dbe){
68  dbe->setCurrentFolder("SiStrip/BaselineValidator");
69 
70 
71  h1NumbadAPVsRes_ = dbe->book1D("ResAPVs",";#ResAPVs", 100, 1.0, 10001);
72  dbe->tag(h1NumbadAPVsRes_->getFullname(),1);
73 
74  h1ADC_vs_strip_ = dbe->book2D("ADCvsAPVs",";ADCvsAPVs", 768,-0.5,767.5, 1023, -0.5, 1022.5);
75  dbe->tag(h1ADC_vs_strip_->getFullname(),2);
76 
77 
78  }
79 
80  return;
81 
82 }
83 
85 {
86  /* edm::Handle<reco::TrackCollection> tracks;
87  e.getByLabel("hiSelectedTracks", tracks);
88 
89  int ntracks =0;
90  for (reco::TrackCollection::const_iterator track = tracks->begin(); track != tracks->end(); track++) {
91  ntracks++;
92 
93  }
94 */
95 
96 
98  // e.getByLabel(srcProcessedRawDigi_,moduleRawDigi);
99  e.getByToken( moduleRawDigiToken_, moduleRawDigi );
100  edm::DetSetVector<SiStripRawDigi>::const_iterator itRawDigis = moduleRawDigi->begin();
101 
102  // uint32_t Nmodule = moduleRawDigi->size();
103 
104  int NumResAPVs=0;
105  for (; itRawDigis != moduleRawDigi->end(); ++itRawDigis) {
106 
107 
108  edm::DetSet<SiStripRawDigi>::const_iterator itRaw = itRawDigis->begin();
109  int strip =0, totADC=0;
110 
111  for(;itRaw != itRawDigis->end(); ++itRaw, ++strip){
112 
113  float adc = itRaw->adc();
114  h1ADC_vs_strip_->Fill(strip,adc);
115 
116 
117 
118  totADC+= adc;
119 
120  if(strip%127 ==0){
121  if(totADC!= 0){
122  totADC =0;
123 
124  NumResAPVs++;
125 
126  }
127  }
128 
129  }
130 
131 
132  }
133 
135 
136  h1NumbadAPVsRes_->Fill(NumResAPVs);
137 
138 
139 
140 }
141 
142 
143 
144 // ------------ method called once each job just after ending the event loop ------------
145 void
147 
148  if (!outputFile_.empty() && createOutputFile_) {
149  dbe->save(outputFile_);
150  }
151 }
152 
153 //define this as a plug-in
155 
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 &)
virtual void analyze(const edm::Event &, const edm::EventSetup &)
iterator end()
Return the off-the-end iterator.
Definition: DetSetVector.h:356
tuple conf
Definition: dbtoconf.py:185
iterator begin()
Return an iterator to the first DetSet.
Definition: DetSetVector.h:341
collection_type::const_iterator const_iterator
Definition: DetSet.h:33
collection_type::const_iterator const_iterator
Definition: DetSetVector.h:106