CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Types | Public Member Functions | Public Attributes | Private Attributes
EcalPedestalHistory Class Reference

#include <EcalPedestalHistory.h>

Inheritance diagram for EcalPedestalHistory:
edm::one::EDAnalyzer< edm::one::WatchRuns > edm::one::EDAnalyzerBase edm::EDConsumerBase

Public Types

enum  { kChannels = 75848, kEBChannels = 61200, kEEChannels = 14648 }
 
enum  { kGains = 3, kFirstGainId = 1 }
 
- Public Types inherited from edm::one::EDAnalyzerBase
typedef EDAnalyzerBase ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 

Public Member Functions

void analyze (const edm::Event &, const edm::EventSetup &) override
 
void beginJob () override
 
void beginRun (edm::Run const &, edm::EventSetup const &) override
 
 EcalPedestalHistory (const edm::ParameterSet &)
 
void endJob () override
 
void endRun (edm::Run const &, edm::EventSetup const &) override
 
 ~EcalPedestalHistory () override
 
- Public Member Functions inherited from edm::one::EDAnalyzer< edm::one::WatchRuns >
 EDAnalyzer ()=default
 
 EDAnalyzer (const EDAnalyzer &)=delete
 
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
const EDAnalyzeroperator= (const EDAnalyzer &)=delete
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
bool wantsInputProcessBlocks () const final
 
bool wantsProcessBlocks () const final
 
- Public Member Functions inherited from edm::one::EDAnalyzerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzerBase ()
 
ModuleDescription const & moduleDescription () const
 
bool wantsStreamLuminosityBlocks () const
 
bool wantsStreamRuns () const
 
 ~EDAnalyzerBase () override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESProxyIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex >
const & 
esGetTokenRecordIndicesVector (edm::Transition iTrans) const
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector
< ProductResolverIndexAndSkipBit >
const & 
itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::array< std::vector< ModuleDescription const * > *, NumBranchTypes > &modulesAll, std::vector< ModuleProcessName > &modulesInPreviousProcesses, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Public Attributes

EcalCondDBInterfaceeconn
 

Private Attributes

unsigned int cnt_evt_
 
std::string ECALType_
 
unsigned int m_firstRun
 
std::string m_gentag
 
unsigned int m_lastRun
 
std::string m_location
 
std::string m_locationsource
 
std::string m_name
 
std::string m_pass
 
std::string m_sid
 
std::string m_user
 
std::vector< int > maskedChannels_
 
std::vector< int > maskedEEChannels_
 
int runnumber_
 
std::string runType_
 
unsigned int startevent_
 

Additional Inherited Members

- Static Public Member Functions inherited from edm::one::EDAnalyzerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< Bconsumes (edm::InputTag tag) noexcept
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes ()
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag)
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
void resetItemsToGetFrom (BranchType iType)
 

Detailed Description

Description: <one line="" class="" summary>="">

Implementation: <Notes on="" implementation>="">

Definition at line 44 of file EcalPedestalHistory.h.

Member Enumeration Documentation

anonymous enum
Enumerator
kChannels 
kEBChannels 
kEEChannels 

Definition at line 55 of file EcalPedestalHistory.h.

anonymous enum
Enumerator
kGains 
kFirstGainId 

Definition at line 56 of file EcalPedestalHistory.h.

Constructor & Destructor Documentation

EcalPedestalHistory::EcalPedestalHistory ( const edm::ParameterSet iConfig)
explicit

Definition at line 51 of file EcalPedestalHistory.cc.

References gather_cfg::cout, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), and AlCaHLTBitMon_QueryRunRegistry::string.

51  {
52  //====================================================================
53  //now do what ever initialization is needed
54  // EBDigiCollection_ = iConfig.getParameter<edm::InputTag>("EBDigiCollection");
55  runnumber_ = iConfig.getUntrackedParameter<int>("runnumber", -1);
56  ECALType_ = iConfig.getParameter<std::string>("ECALType");
57  runType_ = iConfig.getParameter<std::string>("runType");
58  startevent_ = iConfig.getUntrackedParameter<unsigned int>("startevent", 1);
59 
60  std::cout << "EcalPedestals Source handler constructor\n" << std::endl;
61  m_firstRun = static_cast<unsigned int>(atoi(iConfig.getParameter<std::string>("firstRun").c_str()));
62  m_lastRun = static_cast<unsigned int>(atoi(iConfig.getParameter<std::string>("lastRun").c_str()));
63  m_sid = iConfig.getParameter<std::string>("OnlineDBSID");
64  m_user = iConfig.getParameter<std::string>("OnlineDBUser");
65  m_pass = iConfig.getParameter<std::string>("OnlineDBPassword");
66  m_locationsource = iConfig.getParameter<std::string>("LocationSource");
67  m_location = iConfig.getParameter<std::string>("Location");
68  m_gentag = iConfig.getParameter<std::string>("GenTag");
69  std::cout << m_sid << "/" << m_user << "/" << m_pass << "/" << m_location << "/" << m_gentag << std::endl;
70 
71  vector<int> listDefaults;
72  listDefaults.push_back(-1);
73 
74  cnt_evt_ = 0;
75  // cout << "Exiting constructor" << endl;
76 } //constructor
T getUntrackedParameter(std::string const &, T const &) const
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
tuple cout
Definition: gather_cfg.py:144
EcalPedestalHistory::~EcalPedestalHistory ( )
override

Definition at line 79 of file EcalPedestalHistory.cc.

References gather_cfg::cout.

79  {
80  //========================================================================
81  cout << "ANALYSIS FINISHED" << endl;
82 } //destructor
tuple cout
Definition: gather_cfg.py:144

Member Function Documentation

void EcalPedestalHistory::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
)
overridevirtual

Implements edm::one::EDAnalyzerBase.

Definition at line 380 of file EcalPedestalHistory.cc.

References gather_cfg::cout, kEBChannels, and kEEChannels.

380  {
381  //========================================================================
382 
383  if (cnt_evt_ == 0) {
384  if (ECALType_ == "EB" || ECALType_ == "EA") {
385  cout << " Barrel data : nb channels " << kEBChannels << endl;
386  } else if (ECALType_ == "EE" || ECALType_ == "EA") {
387  cout << " End cap data : nb channels " << kEEChannels << endl;
388  } else {
389  cout << " strange ECALtype : " << ECALType_ << " abort " << endl;
390  return;
391  }
392  /*
393  int NbOfmaskedChannels = maskedChannels_.size();
394  cout << " Nb masked EB channels " << NbOfmaskedChannels << endl;
395  for (vector<int>::iterator iter = maskedChannels_.begin(); iter != maskedChannels_.end(); ++iter)
396  cout<< " : masked channel " << *(iter) << endl;
397  NbOfmaskedChannels = maskedEEChannels_.size();
398  cout << " Nb masked EE channels " << NbOfmaskedChannels << endl;
399  for (vector<int>::iterator iter = maskedEEChannels_.begin(); iter != maskedEEChannels_.end(); ++iter)
400  cout<< " : masked channel " << *(iter) << endl;
401  */
402  }
403  cnt_evt_++;
404 
405 } //analyze
tuple cout
Definition: gather_cfg.py:144
void EcalPedestalHistory::beginJob ( void  )
overridevirtual

========================================================================

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 364 of file EcalPedestalHistory.cc.

364  {
366 
367 } //beginJob
void EcalPedestalHistory::beginRun ( edm::Run const &  ,
edm::EventSetup const &  c 
)
override

========================================================================

Definition at line 85 of file EcalPedestalHistory.cc.

References gather_cfg::cout, test_db_connect::econn, Exception, validate-o2o-wbm::f, EcalLogicID::getID1(), EcalLogicID::getID2(), EcalLogicID::getID3(), EcalLogicID::getName(), MonPedestalsDat::getPedMeanG1(), MonPedestalsDat::getPedMeanG12(), MonPedestalsDat::getPedMeanG6(), MonPedestalsDat::getPedRMSG1(), MonPedestalsDat::getPedRMSG12(), MonPedestalsDat::getPedRMSG6(), MonRunList::getRuns(), EBDetId::hashedIndex(), EEDetId::hashedIndex(), EBDetId::ieta(), EBDetId::iphi(), EEDetId::ix(), EEDetId::iy(), kChannels, kEBChannels, kEEChannels, Mean, test_db_connect::my_locdef, test_db_connect::my_rundef, AlCaHLTBitMon_ParallelJobs::p, mps_fire::result, RMS, RunTag::setGeneralTag(), MonRunTag::setGeneralTag(), LocationDef::setLocation(), RunTag::setLocationDef(), MonVersionDef::setMonitoringVersion(), MonRunList::setMonRunTag(), MonRunTag::setMonVersionDef(), MonRunList::setRunTag(), RunTypeDef::setRunType(), RunTag::setRunTypeDef(), EBDetId::SMCRYSTALMODE, EBDetId::unhashIndex(), EEDetId::unhashIndex(), EEDetId::validDetId(), and EEDetId::zside().

85  {
87 
88  cout << "Entering beginRun" << endl;
89  /* do not use any tag...
90  edm::ESHandle<EcalChannelStatus> pChannelStatus;
91  c.get<EcalChannelStatusRcd>().get(pChannelStatus);
92  const EcalChannelStatus* chStatus = pChannelStatus.product();
93  EcalChannelStatusMap::const_iterator chit;
94  for (int iChannel = 0; iChannel < kEBChannels; iChannel++) {
95  EBDetId id = EBDetId::unhashIndex(iChannel);
96  chit = chStatus->getMap().find(id.rawId());
97  if( chit != chStatus->getMap().end() ) {
98  EcalChannelStatusCode ch_code = (*chit);
99  uint16_t statusCode = ch_code.getStatusCode() & 31;
100  if(statusCode == 1 || (statusCode > 7 && statusCode < 12))
101  maskedChannels_.push_back(iChannel);
102  }
103  }
104  for (int iChannel = 0; iChannel < kEEChannels; iChannel++) {
105  EEDetId id = EEDetId::unhashIndex(iChannel);
106  chit = chStatus->getMap().find(id.rawId());
107  if( chit != chStatus->getMap().end() ) {
108  EcalChannelStatusCode ch_code = (*chit);
109  uint16_t statusCode = ch_code.getStatusCode() & 31;
110  if(statusCode == 1 || (statusCode > 7 && statusCode < 12))
111  maskedEEChannels_.push_back(iChannel);
112  }
113  }
114  */
115  TH1F** hMean = new TH1F*[15];
116  TH1F** hRMS = new TH1F*[15];
117  TFile f("PedHist.root", "RECREATE");
118 
119  typedef struct {
120  int iChannel;
121  int ix;
122  int iy;
123  int iz;
124  } Chan_t;
125  Chan_t Chan;
126  Chan.iChannel = -1;
127  Chan.ix = -1;
128  Chan.iy = -1;
129  Chan.iz = -1;
130 
131  TTree* tPedChan = new TTree("PedChan", "Channels"); // Output tree for channels
132  tPedChan->Branch("Channels", &Chan.iChannel, "iChannel/I");
133  tPedChan->Branch("x", &Chan.ix, "ix/I");
134  tPedChan->Branch("y", &Chan.iy, "iy/I");
135  tPedChan->Branch("z", &Chan.iz, "iz/I");
136  for (int iChannel = 0; iChannel < kEBChannels; iChannel++) {
137  Chan.iChannel = iChannel;
138  EBDetId myEBDetId = EBDetId::unhashIndex(iChannel);
139  Chan.ix = myEBDetId.ieta(); // -85:-1,1:85
140  Chan.iy = myEBDetId.iphi(); // 1:360
141  Chan.iz = 0;
142  if (iChannel % 10000 == 0)
143  cout << " EB channel " << iChannel << " eta " << Chan.ix << " phi " << Chan.iy << endl;
144  tPedChan->Fill();
145  }
146  for (int iChannel = 0; iChannel < kEEChannels; iChannel++) {
147  Chan.iChannel = iChannel;
148  EEDetId myEEDetId = EEDetId::unhashIndex(iChannel);
149  Chan.ix = myEEDetId.ix();
150  Chan.iy = myEEDetId.iy();
151  Chan.iz = myEEDetId.zside();
152  if (iChannel % 1000 == 0)
153  cout << " EE channel " << iChannel << " x " << Chan.ix << " y " << Chan.iy << " z " << Chan.iz << endl;
154  tPedChan->Fill();
155  }
156  tPedChan->Write();
157  tPedChan->Print();
158 
159  typedef struct {
160  int Run;
161  double Mean[kChannels];
162  double RMS[kChannels];
163  } Ped_t;
164  Ped_t PedVal;
165  PedVal.Run = -1; // initialization
166  for (int iChannel = 0; iChannel < kChannels; iChannel++) {
167  PedVal.Mean[iChannel] = -1.;
168  PedVal.RMS[iChannel] = -1.;
169  }
170  TTree* tPedHist = new TTree("PedHist", "Pedestal History"); // Output tree for pedestal mean/rms
171  tPedHist->Branch("Pedestals", &PedVal.Run, "Run/I");
172  tPedHist->Branch("Mean", PedVal.Mean, "Mean[75848]/D");
173  tPedHist->Branch("RMS", PedVal.RMS, "RMS[75848]/D");
174 
175  // here we retrieve all the runs after the last from online DB
176  std::cout << "Retrieving run list from ONLINE DB ... " << std::endl;
178  std::cout << "Connection done" << std::endl;
179  if (!econn) {
180  std::cout << " Problem with OMDS: connection parameters " << m_sid << "/" << m_user << "/" << m_pass << std::endl;
181  throw cms::Exception("OMDS not available");
182  }
183 
184  // these are the online conditions DB classes
185  RunList my_runlist;
186  RunTag my_runtag;
189 
190  my_locdef.setLocation(m_location);
191  my_rundef.setRunType("PEDESTAL");
192  my_runtag.setLocationDef(my_locdef);
193  my_runtag.setRunTypeDef(my_rundef);
194  my_runtag.setGeneralTag(m_gentag);
195 
196  // here we retrieve the Monitoring run records
197  MonVersionDef monverdef;
198  monverdef.setMonitoringVersion("test01");
199  MonRunTag mon_tag;
200  // mon_tag.setGeneralTag("CMSSW");
201  mon_tag.setGeneralTag("CMSSW-offline-private");
202  mon_tag.setMonVersionDef(monverdef);
203  MonRunList mon_list;
204  mon_list.setMonRunTag(mon_tag);
205  mon_list.setRunTag(my_runtag);
206  // mon_list=econn->fetchMonRunList(my_runtag, mon_tag);
207  unsigned int min_run = 0, max_since = 0;
208  if (m_firstRun < max_since) {
209  min_run = max_since + 1; // we have to add 1 to the last transferred one
210  } else {
211  min_run = m_firstRun;
212  }
213 
214  unsigned int max_run = m_lastRun;
215  mon_list = econn->fetchMonRunList(my_runtag, mon_tag, min_run, max_run);
216 
217  std::vector<MonRunIOV> mon_run_vec = mon_list.getRuns();
218  int mon_runs = mon_run_vec.size();
219  std::cout << "number of Mon runs is : " << mon_runs << std::endl;
220 
221  if (mon_runs > 0) {
222  int NbChan = 0;
223  for (int iChannel = 0; iChannel < kEBChannels; iChannel++) {
224  if (iChannel % 10000 == 1) {
225  hMean[NbChan] = new TH1F(Form("Mean_%i", NbChan), Form("Mean EB %i", iChannel), mon_runs, 0., mon_runs);
226  hRMS[NbChan] = new TH1F(Form("RMS_%i", NbChan), Form("RMS EB %i", iChannel), mon_runs, 0., mon_runs);
227  NbChan++;
228  }
229  }
230  for (int iChannel = 0; iChannel < kEEChannels; iChannel++) {
231  if (iChannel % 2000 == 1) {
232  hMean[NbChan] = new TH1F(Form("Mean_%i", NbChan), Form("Mean EE %i", iChannel), mon_runs, 0., mon_runs);
233  hRMS[NbChan] = new TH1F(Form("RMS_%i", NbChan), Form("RMS EE %i", iChannel), mon_runs, 0., mon_runs);
234  NbChan++;
235  }
236  }
237 
238  // int krmax = std::min(mon_runs, 30);
239  int krmax = mon_runs;
240  for (int kr = 0; kr < krmax; kr++) {
241  std::cout << "-kr------: " << kr << std::endl;
242 
243  unsigned int irun = static_cast<unsigned int>(mon_run_vec[kr].getRunIOV().getRunNumber());
244  std::cout << "retrieve the data for run number: " << irun << std::endl;
245  if (mon_run_vec[kr].getSubRunNumber() <= 1) {
246  // retrieve the data for a given run
247  RunIOV runiov_prime = mon_run_vec[kr].getRunIOV();
248  // retrieve the pedestals from OMDS for this run
249  std::map<EcalLogicID, MonPedestalsDat> dataset_mon;
250  econn->fetchDataSet(&dataset_mon, &mon_run_vec[kr]);
251  std::cout << "OMDS record for run " << irun << " is made of " << dataset_mon.size() << std::endl;
252  int nEB = 0, nEE = 0, nEBbad = 0, nEEbad = 0;
253  typedef std::map<EcalLogicID, MonPedestalsDat>::const_iterator CImon;
254  EcalLogicID ecid_xt;
255  MonPedestalsDat rd_ped;
256 
257  // this to validate ...
258  int nbad = 0;
259  for (CImon p = dataset_mon.begin(); p != dataset_mon.end(); p++) {
260  ecid_xt = p->first;
261  rd_ped = p->second;
262  int sm_num = ecid_xt.getID1();
263  int xt_num = ecid_xt.getID2();
264  int yt_num = ecid_xt.getID3();
265 
266  //checkPedestal
267  bool result = true;
268  if (rd_ped.getPedRMSG12() > 3 || rd_ped.getPedRMSG12() <= 0 || rd_ped.getPedRMSG6() > 2 ||
269  rd_ped.getPedRMSG12() <= 0 || rd_ped.getPedRMSG1() > 1 || rd_ped.getPedRMSG1() <= 0 ||
270  rd_ped.getPedMeanG12() > 300 || rd_ped.getPedMeanG12() <= 100 || rd_ped.getPedMeanG6() > 300 ||
271  rd_ped.getPedMeanG6() <= 100 || rd_ped.getPedMeanG1() > 300 || rd_ped.getPedMeanG6() <= 100)
272  result = false;
273 
274  // here we check and count how many bad channels we have
275  if (!result) {
276  nbad++;
277  if (nbad < 10)
278  std::cout << "BAD LIST: channel " << sm_num << "/" << xt_num << "/" << yt_num << "ped/rms "
279  << rd_ped.getPedMeanG12() << "/" << rd_ped.getPedRMSG12() << std::endl;
280  }
281  if (ecid_xt.getName() == "EB_crystal_number") {
282  nEB++;
283  if (!result)
284  nEBbad++;
285  } else {
286  nEE++;
287  if (!result)
288  nEEbad++;
289  }
290  } // end loop over pedestal data
291  // ok or bad? A bad run is for more than 5% bad channels
292 
293  // if(nbad<(dataset_mon.size()*0.1)){
294  if (nbad < (dataset_mon.size() * 0.05) &&
295  (nEB > 10200 || nEE > 2460)) { // this is good run, fill histo and tree
296  PedVal.Run = irun;
297  int NbChan = 0;
298  for (CImon p = dataset_mon.begin(); p != dataset_mon.end(); p++) {
299  ecid_xt = p->first;
300  rd_ped = p->second;
301  int sm_num = ecid_xt.getID1();
302  int xt_num = ecid_xt.getID2();
303  int yt_num = ecid_xt.getID3();
304 
305  if (ecid_xt.getName() == "EB_crystal_number") { // Barrel
306  EBDetId ebdetid(sm_num, xt_num, EBDetId::SMCRYSTALMODE);
307  int iChannel = ebdetid.hashedIndex();
308  if (iChannel < 0 || iChannel > 61200)
309  cout << " SM " << sm_num << " Chan in SM " << xt_num << " IChannel " << iChannel << endl;
310  if (iChannel % 10000 == 1) {
311  hMean[NbChan]->Fill(kr, rd_ped.getPedMeanG12());
312  hRMS[NbChan]->Fill(kr, rd_ped.getPedRMSG12());
313  NbChan++;
314  }
315  PedVal.Mean[iChannel] = rd_ped.getPedMeanG12();
316  PedVal.RMS[iChannel] = rd_ped.getPedRMSG12();
317  if (iChannel % 10000 == 0)
318  cout << " channel " << iChannel << " mean " << PedVal.Mean[iChannel] << " RMS " << PedVal.RMS[iChannel]
319  << endl;
320  } else { // Endcaps
321  if (EEDetId::validDetId(xt_num, yt_num, sm_num)) {
322  EEDetId eedetid(xt_num, yt_num, sm_num);
323  int iChannel = eedetid.hashedIndex();
324  if (iChannel < 0 || iChannel > 14648)
325  cout << " x " << sm_num << " y " << xt_num << " z " << yt_num << " IChannel " << iChannel << endl;
326  if (iChannel % 2000 == 1) {
327  hMean[NbChan]->Fill(kr, rd_ped.getPedMeanG12());
328  hRMS[NbChan]->Fill(kr, rd_ped.getPedRMSG12());
329  NbChan++;
330  }
331  int iChanEE = kEBChannels + iChannel;
332  // cout << " channel EE " << iChanEE << endl;
333  PedVal.Mean[iChanEE] = rd_ped.getPedMeanG12();
334  PedVal.RMS[iChanEE] = rd_ped.getPedRMSG12();
335  } // valid ee Id
336  } // Endcaps
337  } // loop over channels
338  tPedHist->Fill();
339  cout << " We got a good run " << irun << endl;
340  } // good run
341  } // mon_run_vec
342  } // loop over all runs
343  } // number of runs > 0
344  cout << "Exiting beginRun" << endl;
345  for (int NbChan = 0; NbChan < 15; NbChan++) {
346  if (hMean[NbChan]->GetEntries() > 0.) { // save only when filled!
347  hMean[NbChan]->Write();
348  hRMS[NbChan]->Write();
349  }
350  }
351  tPedHist->Write();
352  tPedHist->Print();
353  f.Close();
354 
355 } //beginRun
void setRunTypeDef(const RunTypeDef &runTypeDef)
Definition: RunTag.cc:42
int ix() const
Definition: EEDetId.h:77
Definition: RunTag.h:13
float getPedRMSG1() const
MonRunList fetchMonRunList(const RunTag &tag, const MonRunTag &monruntag) noexcept(false)
static EEDetId unhashIndex(int hi)
Definition: EEDetId.cc:65
void setGeneralTag(std::string tag)
Definition: MonRunTag.cc:21
void fetchDataSet(std::map< EcalLogicID, DATT > *fillMap, IOVT *iov) noexcept(false)
void setRunTag(const RunTag &tag)
Definition: MonRunList.cc:18
tuple result
Definition: mps_fire.py:311
int getID2() const
Definition: EcalLogicID.cc:32
int iphi() const
get the crystal iphi
Definition: EBDetId.h:51
std::string getName() const
Definition: EcalLogicID.cc:26
float getPedMeanG12() const
float getPedRMSG12() const
int zside() const
Definition: EEDetId.h:71
int getID1() const
Definition: EcalLogicID.cc:30
int iy() const
Definition: EEDetId.h:83
int ieta() const
get the crystal ieta
Definition: EBDetId.h:49
void setMonVersionDef(const MonVersionDef &ver)
Definition: MonRunTag.cc:30
void setLocationDef(const LocationDef &locDef)
Definition: RunTag.cc:33
std::vector< MonRunIOV > getRuns()
Definition: MonRunList.cc:32
void setRunType(std::string runtype)
Definition: RunTypeDef.cc:21
static bool validDetId(int crystal_ix, int crystal_iy, int iz)
Definition: EEDetId.h:248
void setMonRunTag(const MonRunTag &tag)
Definition: MonRunList.cc:23
float getPedMeanG1() const
void setMonitoringVersion(std::string ver)
static EBDetId unhashIndex(int hi)
get a DetId from a compact index for arrays
Definition: EBDetId.h:110
float getPedMeanG6() const
void setLocation(std::string loc)
Definition: LocationDef.cc:20
tuple cout
Definition: gather_cfg.py:144
int getID3() const
Definition: EcalLogicID.cc:34
void setGeneralTag(std::string tag)
Definition: RunTag.cc:24
static const int SMCRYSTALMODE
Definition: EBDetId.h:159
Definition: RunIOV.h:13
float getPedRMSG6() const
EcalCondDBInterface * econn
void EcalPedestalHistory::endJob ( void  )
overridevirtual

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 370 of file EcalPedestalHistory.cc.

370  {
371  //========================================================================
372 
373 } //endJob
void EcalPedestalHistory::endRun ( edm::Run const &  ,
edm::EventSetup const &  c 
)
override

Definition at line 358 of file EcalPedestalHistory.cc.

358  {
359  //========================================================================
360 
361 } //endRun

Member Data Documentation

unsigned int EcalPedestalHistory::cnt_evt_
private

Definition at line 60 of file EcalPedestalHistory.h.

std::string EcalPedestalHistory::ECALType_
private

Definition at line 61 of file EcalPedestalHistory.h.

EcalCondDBInterface* EcalPedestalHistory::econn

Definition at line 53 of file EcalPedestalHistory.h.

unsigned int EcalPedestalHistory::m_firstRun
private

Definition at line 66 of file EcalPedestalHistory.h.

std::string EcalPedestalHistory::m_gentag
private

Definition at line 69 of file EcalPedestalHistory.h.

unsigned int EcalPedestalHistory::m_lastRun
private

Definition at line 67 of file EcalPedestalHistory.h.

std::string EcalPedestalHistory::m_location
private

Definition at line 68 of file EcalPedestalHistory.h.

std::string EcalPedestalHistory::m_locationsource
private

Definition at line 73 of file EcalPedestalHistory.h.

std::string EcalPedestalHistory::m_name
private

Definition at line 74 of file EcalPedestalHistory.h.

std::string EcalPedestalHistory::m_pass
private

Definition at line 72 of file EcalPedestalHistory.h.

std::string EcalPedestalHistory::m_sid
private

Definition at line 70 of file EcalPedestalHistory.h.

std::string EcalPedestalHistory::m_user
private

Definition at line 71 of file EcalPedestalHistory.h.

std::vector<int> EcalPedestalHistory::maskedChannels_
private

Definition at line 64 of file EcalPedestalHistory.h.

std::vector<int> EcalPedestalHistory::maskedEEChannels_
private

Definition at line 65 of file EcalPedestalHistory.h.

int EcalPedestalHistory::runnumber_
private

Definition at line 59 of file EcalPedestalHistory.h.

std::string EcalPedestalHistory::runType_
private

Definition at line 62 of file EcalPedestalHistory.h.

unsigned int EcalPedestalHistory::startevent_
private

Definition at line 63 of file EcalPedestalHistory.h.