CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
HFRaddamTask.cc
Go to the documentation of this file.
1 
3 
4 using namespace hcaldqm;
5 using namespace hcaldqm::constants;
6 using namespace hcaldqm::filter;
7 
9  // List all the DetIds
10  _vDetIds.push_back(HcalDetId(HcalForward, -30, 35, 1));
11  _vDetIds.push_back(HcalDetId(HcalForward, -30, 71, 1));
12  _vDetIds.push_back(HcalDetId(HcalForward, -32, 15, 1));
13  _vDetIds.push_back(HcalDetId(HcalForward, -32, 51, 1));
14  _vDetIds.push_back(HcalDetId(HcalForward, -34, 35, 1));
15  _vDetIds.push_back(HcalDetId(HcalForward, -34, 71, 1));
16  _vDetIds.push_back(HcalDetId(HcalForward, -36, 15, 1));
17  _vDetIds.push_back(HcalDetId(HcalForward, -36, 51, 1));
18  _vDetIds.push_back(HcalDetId(HcalForward, -38, 35, 1));
19  _vDetIds.push_back(HcalDetId(HcalForward, -38, 71, 1));
20  _vDetIds.push_back(HcalDetId(HcalForward, -40, 15, 1));
21  _vDetIds.push_back(HcalDetId(HcalForward, -40, 51, 1));
22  _vDetIds.push_back(HcalDetId(HcalForward, -41, 35, 1));
23  _vDetIds.push_back(HcalDetId(HcalForward, -41, 71, 1));
24  _vDetIds.push_back(HcalDetId(HcalForward, -30, 15, 2));
25  _vDetIds.push_back(HcalDetId(HcalForward, -30, 51, 2));
26  _vDetIds.push_back(HcalDetId(HcalForward, -32, 35, 2));
27  _vDetIds.push_back(HcalDetId(HcalForward, -32, 71, 2));
28  _vDetIds.push_back(HcalDetId(HcalForward, -34, 15, 2));
29  _vDetIds.push_back(HcalDetId(HcalForward, -34, 51, 2));
30  _vDetIds.push_back(HcalDetId(HcalForward, -36, 35, 2));
31  _vDetIds.push_back(HcalDetId(HcalForward, -36, 71, 2));
32  _vDetIds.push_back(HcalDetId(HcalForward, -38, 15, 2));
33  _vDetIds.push_back(HcalDetId(HcalForward, -38, 51, 2));
34  _vDetIds.push_back(HcalDetId(HcalForward, -40, 35, 2));
35  _vDetIds.push_back(HcalDetId(HcalForward, -40, 71, 2));
36  _vDetIds.push_back(HcalDetId(HcalForward, -41, 15, 2));
37  _vDetIds.push_back(HcalDetId(HcalForward, -41, 51, 2));
38 
39  _vDetIds.push_back(HcalDetId(HcalForward, 30, 21, 1));
40  _vDetIds.push_back(HcalDetId(HcalForward, 30, 57, 1));
41  _vDetIds.push_back(HcalDetId(HcalForward, 32, 1, 1));
42  _vDetIds.push_back(HcalDetId(HcalForward, 32, 37, 1));
43  _vDetIds.push_back(HcalDetId(HcalForward, 34, 21, 1));
44  _vDetIds.push_back(HcalDetId(HcalForward, 34, 57, 1));
45  _vDetIds.push_back(HcalDetId(HcalForward, 36, 1, 1));
46  _vDetIds.push_back(HcalDetId(HcalForward, 36, 37, 1));
47  _vDetIds.push_back(HcalDetId(HcalForward, 38, 21, 1));
48  _vDetIds.push_back(HcalDetId(HcalForward, 38, 57, 1));
49  _vDetIds.push_back(HcalDetId(HcalForward, 40, 35, 1));
50  _vDetIds.push_back(HcalDetId(HcalForward, 40, 71, 1));
51  _vDetIds.push_back(HcalDetId(HcalForward, 41, 19, 1));
52  _vDetIds.push_back(HcalDetId(HcalForward, 41, 55, 1));
53  _vDetIds.push_back(HcalDetId(HcalForward, 30, 1, 2));
54  _vDetIds.push_back(HcalDetId(HcalForward, 30, 37, 2));
55  _vDetIds.push_back(HcalDetId(HcalForward, 32, 21, 2));
56  _vDetIds.push_back(HcalDetId(HcalForward, 32, 57, 2));
57  _vDetIds.push_back(HcalDetId(HcalForward, 34, 1, 2));
58  _vDetIds.push_back(HcalDetId(HcalForward, 34, 37, 2));
59  _vDetIds.push_back(HcalDetId(HcalForward, 36, 21, 2));
60  _vDetIds.push_back(HcalDetId(HcalForward, 36, 57, 2));
61  _vDetIds.push_back(HcalDetId(HcalForward, 38, 1, 2));
62  _vDetIds.push_back(HcalDetId(HcalForward, 38, 37, 2));
63  _vDetIds.push_back(HcalDetId(HcalForward, 40, 19, 2));
64  _vDetIds.push_back(HcalDetId(HcalForward, 40, 55, 2));
65  _vDetIds.push_back(HcalDetId(HcalForward, 41, 35, 2));
66  _vDetIds.push_back(HcalDetId(HcalForward, 41, 71, 2));
67 
68  // tags
69  _tagHF = ps.getUntrackedParameter<edm::InputTag>("tagHF", edm::InputTag("hcalDigis"));
70  _taguMN = ps.getUntrackedParameter<edm::InputTag>("taguMN", edm::InputTag("hcalDigis"));
71  _tokHF = consumes<HFDigiCollection>(_tagHF);
72  _tokuMN = consumes<HcalUMNioDigi>(_taguMN);
73 }
74 
76  // Initialize all the Single Containers
77  for (std::vector<HcalDetId>::const_iterator it = _vDetIds.begin(); it != _vDetIds.end(); ++it) {
79  "Shape",
82  }
83 
84  DQTask::bookHistograms(ib, r, es);
85  char aux[200];
86  for (unsigned int i = 0; i < _vDetIds.size(); i++) {
87  sprintf(aux, "ieta%diphi%dd%d", _vDetIds[i].ieta(), _vDetIds[i].iphi(), _vDetIds[i].depth());
88  _vcShape[i].book(ib, _subsystem, aux);
89  }
90 }
91 
92 /* virtual */ void HFRaddamTask::_process(edm::Event const& e, edm::EventSetup const& es) {
94  if (!e.getByToken(_tokHF, chf))
95  _logger.dqmthrow("Collection HFDigiCollection isn't avalaible" + _tagHF.label() + " " + _tagHF.instance());
96 
97  for (HFDigiCollection::const_iterator it = chf->begin(); it != chf->end(); ++it) {
98  const HFDataFrame digi = (const HFDataFrame)(*it);
99  for (unsigned int i = 0; i < _vDetIds.size(); i++)
100  if (digi.id() == _vDetIds[i]) {
101  for (int j = 0; j < digi.size(); j++)
102  _vcShape[i].fill(j, digi.sample(j).nominal_fC() - 2.5);
103  }
104  }
105 }
106 
107 /* virtual */ bool HFRaddamTask::_isApplicable(edm::Event const& e) {
108  if (_ptype == fOnline) {
110  if (!e.getByToken(_tokuMN, cumn))
111  return false;
112 
113  // event type check first
114  uint8_t eventType = cumn->eventType();
115  if (eventType != constants::EVENTTYPE_LASER)
116  return false;
117 
118  // check if this analysis task is of the right laser type
119  uint32_t laserType = cumn->valueUserWord(0);
120  if (laserType == constants::tHFRaddam)
121  return true;
122  } else {
123  // local, just return true as all the settings will be done in cfg
124  return true;
125  }
126 
127  return false;
128 }
129 
T getUntrackedParameter(std::string const &, T const &) const
int ib
Definition: cuy.py:661
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:539
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
std::vector< T >::const_iterator const_iterator
std::vector< hcaldqm::ContainerSingle1D > _vcShape
Definition: HFRaddamTask.h:44
example_stream void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
edm::InputTag _taguMN
Definition: HFRaddamTask.h:32
ProcessingType _ptype
Definition: DQModule.h:44
void _process(edm::Event const &, edm::EventSetup const &) override
Definition: HFRaddamTask.cc:92
void dqmthrow(std::string const &msg) const
Definition: Logger.h:12
constexpr int size() const
total number of samples in the digi
Definition: HFDataFrame.h:27
edm::EDGetTokenT< HcalUMNioDigi > _tokuMN
Definition: HFRaddamTask.h:34
Logger _logger
Definition: DQModule.h:55
std::string _name
Definition: DQModule.h:42
constexpr double nominal_fC() const
get the nominal FC (no calibrations applied)
Definition: HcalQIESample.h:45
edm::InputTag _tagHF
Definition: HFRaddamTask.h:31
void fill(std::map< std::string, TH1 * > &h, const std::string &s, double x)
uint8_t const EVENTTYPE_LASER
Definition: Constants.h:293
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
Definition: HFRaddamTask.cc:75
edm::EDGetTokenT< HFDigiCollection > _tokHF
Definition: HFRaddamTask.h:33
std::string const & label() const
Definition: InputTag.h:36
HFRaddamTask(edm::ParameterSet const &)
Definition: HFRaddamTask.cc:8
bool _isApplicable(edm::Event const &) override
std::string _subsystem
Definition: DQModule.h:49
constexpr HcalQIESample const & sample(int i) const
access a sample
Definition: HFDataFrame.h:40
std::string const & instance() const
Definition: InputTag.h:37
std::vector< HcalDetId > _vDetIds
Definition: HFRaddamTask.h:37
Definition: Run.h:45
constexpr HcalDetId const & id() const
Definition: HFDataFrame.h:23