CMS 3D CMS Logo

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, int fwv) :
11  crate(crt),
12  crateSummary(0),
13  fwVersion(fwv) {
14  UCTGeometry g;
15  for(uint32_t card = 0; card < g.getNCards(); card++) {
16  cards.push_back(new UCTCard(crate, card, fwVersion));
17  }
18 }
19 
20 UCTCrate::~UCTCrate() {
21  for(uint32_t i = 0; i < cards.size(); i++) {
22  if(cards[i] != 0) delete cards[i];
23  }
24 }
25 
26 bool UCTCrate::process() {
27  crateSummary = 0;
28  for(uint32_t i = 0; i < cards.size(); i++) {
29  if(cards[i] != 0) {
30  cards[i]->process();
31  crateSummary += cards[i]->et();
32  }
33  }
34  return true;
35 }
36 
37 bool UCTCrate::clearEvent() {
38  crateSummary = 0;
39  for(uint32_t i = 0; i < cards.size(); i++) {
40  if(!cards[i]->clearEvent()) return false;
41  }
42  return true;
43 }
44 
45 bool UCTCrate::setECALData(UCTTowerIndex t, bool ecalFG, uint32_t ecalET) {
46  UCTGeometry g;
47  uint32_t i = g.getCard(t.first, t.second);
48  if(i > cards.size()) {
49  LOG_ERROR << "UCTCrate: Incorrect (caloEta, caloPhi) -- bailing" << std::endl;
50  exit(1);
51  }
52  return cards[i]->setECALData(t, ecalFG, ecalET);
53 }
54 
55 bool UCTCrate::setHCALData(UCTTowerIndex t, uint32_t hcalFB, uint32_t hcalET) {
56  UCTGeometry g;
57  uint32_t i = g.getCard(t.first, t.second);
58  if(i > cards.size()) {
59  LOG_ERROR << "UCTCrate: Incorrect (caloEta, caloPhi) -- bailing" << std::endl;
60  exit(1);
61  }
62  return cards[i]->setHCALData(t, hcalFB, hcalET);
63 }
64 
65 const UCTCard* UCTCrate::getCard(UCTTowerIndex t) const {
66  UCTGeometry g;
67  uint32_t i = g.getCard(t.first, t.second);
68  if(i > cards.size()) {
69  LOG_ERROR << "UCTCrate: Incorrect (caloEta, caloPhi) -- bailing" << std::endl;
70  exit(1);
71  }
72  return cards[i];
73 }
74 
75 std::ostream& operator<<(std::ostream& os, const UCTCrate& cr) {
76  if(cr.crateSummary > 0)
77  os << "UCTCrate: crate = " << cr.crate << "; Summary = " << cr.crateSummary << std::endl;
78  return os;
79 }
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
std::ostream & operator<<(std::ostream &os, const UCTCrate &cr)
Definition: UCTCrate.cc:75
#define LOG_ERROR
Definition: CSCDQM_Logger.h:41