test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
UCTCrate.cc
Go to the documentation of this file.
1 #include <iostream>
2 #include <stdlib.h>
3 #include <stdint.h>
4 
5 #include "UCTCrate.hh"
6 #include "UCTCard.hh"
7 #include "UCTGeometry.hh"
8 #include "UCTLogging.hh"
9 
10 UCTCrate::UCTCrate(uint32_t crt) :
11  crate(crt),
12  crateSummary(0) {
13  UCTGeometry g;
14  for(uint32_t card = 0; card < g.getNCards(); card++) {
15  cards.push_back(new UCTCard(crate, card));
16  }
17 }
18 
19 UCTCrate::~UCTCrate() {
20  for(uint32_t i = 0; i < cards.size(); i++) {
21  if(cards[i] != 0) delete cards[i];
22  }
23 }
24 
25 bool UCTCrate::process() {
26  crateSummary = 0;
27  for(uint32_t i = 0; i < cards.size(); i++) {
28  if(cards[i] != 0) {
29  cards[i]->process();
30  crateSummary += cards[i]->et();
31  }
32  }
33  return true;
34 }
35 
36 bool UCTCrate::clearEvent() {
37  crateSummary = 0;
38  for(uint32_t i = 0; i < cards.size(); i++) {
39  if(!cards[i]->clearEvent()) return false;
40  }
41  return true;
42 }
43 
44 bool UCTCrate::setECALData(UCTTowerIndex t, bool ecalFG, uint32_t ecalET) {
45  UCTGeometry g;
46  uint32_t i = g.getCard(t.first, t.second);
47  if(i > cards.size()) {
48  LOG_ERROR << "UCTCrate: Incorrect (caloEta, caloPhi) -- bailing" << std::endl;
49  exit(1);
50  }
51  return cards[i]->setECALData(t, ecalFG, ecalET);
52 }
53 
54 bool UCTCrate::setHCALData(UCTTowerIndex t, uint32_t hcalFB, uint32_t hcalET) {
55  UCTGeometry g;
56  uint32_t i = g.getCard(t.first, t.second);
57  if(i > cards.size()) {
58  LOG_ERROR << "UCTCrate: Incorrect (caloEta, caloPhi) -- bailing" << std::endl;
59  exit(1);
60  }
61  return cards[i]->setHCALData(t, hcalFB, hcalET);
62 }
63 
64 const UCTCard* UCTCrate::getCard(UCTTowerIndex t) const {
65  UCTGeometry g;
66  uint32_t i = g.getCard(t.first, t.second);
67  if(i > cards.size()) {
68  LOG_ERROR << "UCTCrate: Incorrect (caloEta, caloPhi) -- bailing" << std::endl;
69  exit(1);
70  }
71  return cards[i];
72 }
73 
74 std::ostream& operator<<(std::ostream& os, const UCTCrate& cr) {
75  if(cr.crateSummary > 0)
76  os << "UCTCrate: crate = " << cr.crate << "; Summary = " << cr.crateSummary << std::endl;
77  return os;
78 }
int i
Definition: DBlmapReader.cc:9
std::ostream & operator<<(std::ostream &out, const ALILine &li)
Definition: ALILine.cc:188
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e g
Definition: Activities.doc:4
tuple process
Definition: LaserDQM_cfg.py:3
#define LOG_ERROR
Definition: CSCDQM_Logger.h:41