CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
EEPedestalOnlineTask.cc
Go to the documentation of this file.
1 /*
2  * \file EEPedestalOnlineTask.cc
3  *
4  * $Date: 2012/06/28 12:14:30 $
5  * $Revision: 1.38 $
6  * \author G. Della Ricca
7  *
8 */
9 
10 #include <iostream>
11 #include <fstream>
12 
15 
17 
19 
23 
25 
27 
29 
30  init_ = false;
31 
33 
34  prefixME_ = ps.getUntrackedParameter<std::string>("prefixME", "");
35 
36  subfolder_ = ps.getUntrackedParameter<std::string>("subfolder", "");
37 
38  enableCleanup_ = ps.getUntrackedParameter<bool>("enableCleanup", false);
39 
40  mergeRuns_ = ps.getUntrackedParameter<bool>("mergeRuns", false);
41 
42  EEDigiCollection_ = ps.getParameter<edm::InputTag>("EEDigiCollection");
43 
44  for (int i = 0; i < 18; i++) {
45  mePedMapG12_[i] = 0;
46  }
47 
48 }
49 
51 
52 }
53 
55 
56  ievt_ = 0;
57 
58  if ( dqmStore_ ) {
59  dqmStore_->setCurrentFolder(prefixME_ + "/EEPedestalOnlineTask");
60  dqmStore_->rmdir(prefixME_ + "/EEPedestalOnlineTask");
61  }
62 
63 }
64 
66 
67  Numbers::initGeometry(c, false);
68 
69  if ( ! mergeRuns_ ) this->reset();
70 
71 }
72 
74 
75 }
76 
78 
79  for (int i = 0; i < 18; i++) {
80  if ( mePedMapG12_[i] ) mePedMapG12_[i]->Reset();
81  }
82 
83 }
84 
86 
87  init_ = true;
88 
89  std::string name;
90  std::string dir;
91 
92  if ( dqmStore_ ) {
93  dir = prefixME_ + "/EEPedestalOnlineTask";
94  if(subfolder_.size())
95  dir += "/" + subfolder_;
96 
98 
99  dqmStore_->setCurrentFolder(dir + "/Gain12");
100  for (int i = 0; i < 18; i++) {
101  name = "EEPOT pedestal " + Numbers::sEE(i+1) + " G12";
102  mePedMapG12_[i] = dqmStore_->bookProfile2D(name, name, 50, Numbers::ix0EE(i+1)+0., Numbers::ix0EE(i+1)+50., 50, Numbers::iy0EE(i+1)+0., Numbers::iy0EE(i+1)+50., 4096, 0., 4096., "s");
103  mePedMapG12_[i]->setAxisTitle("ix", 1);
104  if ( i+1 >= 1 && i+1 <= 9 ) mePedMapG12_[i]->setAxisTitle("101-ix", 1);
105  mePedMapG12_[i]->setAxisTitle("iy", 2);
106  dqmStore_->tag(mePedMapG12_[i], i+1);
107  }
108 
109  }
110 
111 }
112 
114 
115  if ( ! init_ ) return;
116 
117  if ( dqmStore_ ) {
118  std::string dir = prefixME_ + "/EEPedestalOnlineTask";
119  if(subfolder_.size())
120  dir += "/" + subfolder_;
121 
123 
124  dqmStore_->setCurrentFolder(dir + "/Gain12");
125  for ( int i = 0; i < 18; i++ ) {
127  mePedMapG12_[i] = 0;
128  }
129 
130  }
131 
132  init_ = false;
133 
134 }
135 
137 
138  edm::LogInfo("EEPedestalOnlineTask") << "analyzed " << ievt_ << " events";
139 
140  if ( enableCleanup_ ) this->cleanup();
141 
142 }
143 
145 
146  if ( ! init_ ) this->setup();
147 
148  ievt_++;
149 
151 
152  if ( e.getByLabel(EEDigiCollection_, digis) ) {
153 
154  int need = digis->size();
155  LogDebug("EEPedestalOnlineTask") << "event " << ievt_ << " digi collection size " << need;
156 
157  for ( EEDigiCollection::const_iterator digiItr = digis->begin(); digiItr != digis->end(); ++digiItr ) {
158 
159  EEDetId id = digiItr->id();
160 
161  int ix = id.ix();
162  int iy = id.iy();
163 
164  int ism = Numbers::iSM( id );
165 
166  if ( ism >= 1 && ism <= 9 ) ix = 101 - ix;
167 
168  float xix = ix - 0.5;
169  float xiy = iy - 0.5;
170 
171  EEDataFrame dataframe = (*digiItr);
172 
173  int iMax(-1);
174  int maxADC(0);
175  for(int i(0); i < 10; i++){
176  if(dataframe.sample(i).gainId() != 1) break;
177  int adc(dataframe.sample(i).adc());
178  if(adc > maxADC){
179  maxADC = adc;
180  iMax = i;
181  }
182  }
183 
184  if(iMax != 5) continue;
185 
186  for (int i = 0; i < 3; i++) {
187 
188  int adc = dataframe.sample(i).adc();
189 
190  MonitorElement* mePedMap = 0;
191 
192  if ( dataframe.sample(i).gainId() == 1 ) mePedMap = mePedMapG12_[ism-1];
193  if ( dataframe.sample(i).gainId() == 2 ) mePedMap = 0;
194  if ( dataframe.sample(i).gainId() == 3 ) mePedMap = 0;
195 
196  float xval = float(adc);
197 
198  if ( mePedMap ) mePedMap->Fill(xix, xiy, xval);
199 
200  }
201 
202  }
203 
204  } else {
205 
206  edm::LogWarning("EEPedestalOnlineTask") << EEDigiCollection_ << " not available";
207 
208  }
209 
210 }
211 
int adc(sample_type sample)
get the ADC sample (12 bits)
#define LogDebug(id)
void analyze(const edm::Event &e, const edm::EventSetup &c)
Analyze.
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
static std::string sEE(const unsigned ism)
Definition: Numbers.cc:226
int i
Definition: DBlmapReader.cc:9
int ix() const
Definition: EEDetId.h:71
boost::transform_iterator< IterHelp, boost::counting_iterator< int > > const_iterator
void rmdir(const std::string &fullpath)
Definition: DQMStore.cc:2530
Some &quot;id&quot; conversions.
void beginRun(const edm::Run &r, const edm::EventSetup &c)
BeginRun.
void cleanup(void)
Cleanup.
EcalMGPASample sample(int i) const
Definition: EcalDataFrame.h:30
void endJob(void)
EndJob.
static int ix0EE(const unsigned ism)
Definition: Numbers.cc:773
EEPedestalOnlineTask(const edm::ParameterSet &ps)
Constructor.
int gainId() const
get the gainId (2 bits)
MonitorElement * mePedMapG12_[18]
static int iy0EE(const unsigned ism)
Definition: Numbers.cc:812
void Fill(long long x)
void tag(MonitorElement *me, unsigned int myTag)
Definition: DQMStore.cc:1354
void beginJob(void)
BeginJob.
void removeElement(const std::string &name)
Definition: DQMStore.cc:2572
std::string getName(Reflex::Type &cc)
Definition: ClassFiller.cc:18
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:356
static void initGeometry(const edm::EventSetup &setup, bool verbose=false)
Definition: Numbers.cc:50
void endRun(const edm::Run &r, const edm::EventSetup &c)
EndRun.
edm::InputTag EEDigiCollection_
virtual ~EEPedestalOnlineTask()
Destructor.
static unsigned iSM(const unsigned ism, const EcalSubdetector subdet)
Definition: Numbers.cc:246
dbl *** dir
Definition: mlp_gen.cc:35
int ism(int ieta, int iphi)
Definition: EcalPyUtils.cc:56
void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)
void Reset(void)
reset ME (ie. contents, errors, etc)
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:429
Definition: Run.h:33
int adc() const
get the ADC sample (12 bits)
MonitorElement * bookProfile2D(const char *name, const char *title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, int nchZ, double lowZ, double highZ, const char *option="s")
Definition: DQMStore.cc:1175