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 // $Id: SiStripBaselineValidator.cc,v 1.3 2011/11/02 00:39:33 gowdy Exp $
4 //
5 //
6 
7 
8 // system include files
9 #include <memory>
10 #include <iostream>
11 
12 // user include files
25 
26 /*#include "DataFormats/TrackReco/interface/Track.h"
27 #include "DataFormats/TrackCandidate/interface/TrackCandidateCollection.h"
28 #include "DataFormats/TrackCandidate/interface/TrackCandidate.h"
29 #include "DataFormats/TrackReco/interface/Track.h"
30 #include "DataFormats/TrackReco/interface/TrackFwd.h"
31 #include "DataFormats/VertexReco/interface/VertexFwd.h"
32 #include "DataFormats/VertexReco/interface/Vertex.h"
33 */
34 
35 //ROOT inclusion
36 #include "TH1F.h"
37 #include "TH2F.h"
38 #include "TString.h"
39 #include "assert.h"
40 #include <fstream>
41 
42 class TFile;
43 
44 
45 
46 using namespace edm;
47 using namespace std;
48 
50 
51  srcProcessedRawDigi_ = conf.getParameter<edm::InputTag>( "srcProcessedRawDigi" );
52  // hiSelectedTracks = conf.getParameter<edm::InputTag>( "hiSelectedTracks" );
53  createOutputFile_ = conf.getUntrackedParameter<bool>("saveFile",false);
54  outputFile_ = conf.getParameter<std::string>("outputFile");
55  dbe = &*edm::Service<DQMStore>();
56 
57 
58 
59 
60 }
61 
63 {
64 }
65 
66 // ------------ method called once each job just before starting event loop ------------
68 {
69 
70  if(dbe){
72  dbe->setCurrentFolder("SiStrip/BaselineValidator");
73 
74 
75  h1NumbadAPVsRes_ = dbe->book1D("ResAPVs",";#ResAPVs", 100, 1.0, 10001);
76  dbe->tag(h1NumbadAPVsRes_->getFullname(),1);
77 
78  h1ADC_vs_strip_ = dbe->book2D("ADCvsAPVs",";ADCvsAPVs", 768,-0.5,767.5, 1023, -0.5, 1022.5);
79  dbe->tag(h1ADC_vs_strip_->getFullname(),2);
80 
81 
82  }
83 
84  return;
85 
86 }
87 
89 {
90  /* edm::Handle<reco::TrackCollection> tracks;
91  e.getByLabel("hiSelectedTracks", tracks);
92 
93  int ntracks =0;
94  for (reco::TrackCollection::const_iterator track = tracks->begin(); track != tracks->end(); track++) {
95  ntracks++;
96 
97  }
98 */
99 
100 
102  e.getByLabel(srcProcessedRawDigi_,moduleRawDigi);
103  edm::DetSetVector<SiStripRawDigi>::const_iterator itRawDigis = moduleRawDigi->begin();
104 
105  // uint32_t Nmodule = moduleRawDigi->size();
106 
107  int NumResAPVs=0;
108  for (; itRawDigis != moduleRawDigi->end(); ++itRawDigis) {
109 
110 
111  edm::DetSet<SiStripRawDigi>::const_iterator itRaw = itRawDigis->begin();
112  int strip =0, totADC=0;
113 
114  for(;itRaw != itRawDigis->end(); ++itRaw, ++strip){
115 
116  float adc = itRaw->adc();
117  h1ADC_vs_strip_->Fill(strip,adc);
118 
119 
120 
121  totADC+= adc;
122 
123  if(strip%127 ==0){
124  if(totADC!= 0){
125  totADC =0;
126 
127  NumResAPVs++;
128 
129  }
130  }
131 
132  }
133 
134 
135  }
136 
138 
139  h1NumbadAPVsRes_->Fill(NumResAPVs);
140 
141 
142 
143 }
144 
145 
146 
147 // ------------ method called once each job just after ending the event loop ------------
148 void
150 
151  if (!outputFile_.empty() && createOutputFile_) {
152  dbe->save(outputFile_);
153  }
154 }
155 
156 //define this as a plug-in
158 
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
void strip(std::string &input, const std::string &blanks=" \n\t")
Definition: stringTools.cc:16
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
virtual void endJob()
analyzer loop
SiStripBaselineValidator(const edm::ParameterSet &)
virtual void analyze(const edm::Event &, const edm::EventSetup &)
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:356
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:34
collection_type::const_iterator const_iterator
Definition: DetSetVector.h:106