Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 13:10:14

0001 
0002 #include "DQM/HcalTasks/interface/HFRaddamTask.h"
0003 
0004 using namespace hcaldqm;
0005 using namespace hcaldqm::constants;
0006 using namespace hcaldqm::filter;
0007 
0008 HFRaddamTask::HFRaddamTask(edm::ParameterSet const& ps) : DQTask(ps) {
0009   //    List all the DetIds
0010   _vDetIds.push_back(HcalDetId(HcalForward, -30, 35, 1));
0011   _vDetIds.push_back(HcalDetId(HcalForward, -30, 71, 1));
0012   _vDetIds.push_back(HcalDetId(HcalForward, -32, 15, 1));
0013   _vDetIds.push_back(HcalDetId(HcalForward, -32, 51, 1));
0014   _vDetIds.push_back(HcalDetId(HcalForward, -34, 35, 1));
0015   _vDetIds.push_back(HcalDetId(HcalForward, -34, 71, 1));
0016   _vDetIds.push_back(HcalDetId(HcalForward, -36, 15, 1));
0017   _vDetIds.push_back(HcalDetId(HcalForward, -36, 51, 1));
0018   _vDetIds.push_back(HcalDetId(HcalForward, -38, 35, 1));
0019   _vDetIds.push_back(HcalDetId(HcalForward, -38, 71, 1));
0020   _vDetIds.push_back(HcalDetId(HcalForward, -40, 15, 1));
0021   _vDetIds.push_back(HcalDetId(HcalForward, -40, 51, 1));
0022   _vDetIds.push_back(HcalDetId(HcalForward, -41, 35, 1));
0023   _vDetIds.push_back(HcalDetId(HcalForward, -41, 71, 1));
0024   _vDetIds.push_back(HcalDetId(HcalForward, -30, 15, 2));
0025   _vDetIds.push_back(HcalDetId(HcalForward, -30, 51, 2));
0026   _vDetIds.push_back(HcalDetId(HcalForward, -32, 35, 2));
0027   _vDetIds.push_back(HcalDetId(HcalForward, -32, 71, 2));
0028   _vDetIds.push_back(HcalDetId(HcalForward, -34, 15, 2));
0029   _vDetIds.push_back(HcalDetId(HcalForward, -34, 51, 2));
0030   _vDetIds.push_back(HcalDetId(HcalForward, -36, 35, 2));
0031   _vDetIds.push_back(HcalDetId(HcalForward, -36, 71, 2));
0032   _vDetIds.push_back(HcalDetId(HcalForward, -38, 15, 2));
0033   _vDetIds.push_back(HcalDetId(HcalForward, -38, 51, 2));
0034   _vDetIds.push_back(HcalDetId(HcalForward, -40, 35, 2));
0035   _vDetIds.push_back(HcalDetId(HcalForward, -40, 71, 2));
0036   _vDetIds.push_back(HcalDetId(HcalForward, -41, 15, 2));
0037   _vDetIds.push_back(HcalDetId(HcalForward, -41, 51, 2));
0038 
0039   _vDetIds.push_back(HcalDetId(HcalForward, 30, 21, 1));
0040   _vDetIds.push_back(HcalDetId(HcalForward, 30, 57, 1));
0041   _vDetIds.push_back(HcalDetId(HcalForward, 32, 1, 1));
0042   _vDetIds.push_back(HcalDetId(HcalForward, 32, 37, 1));
0043   _vDetIds.push_back(HcalDetId(HcalForward, 34, 21, 1));
0044   _vDetIds.push_back(HcalDetId(HcalForward, 34, 57, 1));
0045   _vDetIds.push_back(HcalDetId(HcalForward, 36, 1, 1));
0046   _vDetIds.push_back(HcalDetId(HcalForward, 36, 37, 1));
0047   _vDetIds.push_back(HcalDetId(HcalForward, 38, 21, 1));
0048   _vDetIds.push_back(HcalDetId(HcalForward, 38, 57, 1));
0049   _vDetIds.push_back(HcalDetId(HcalForward, 40, 35, 1));
0050   _vDetIds.push_back(HcalDetId(HcalForward, 40, 71, 1));
0051   _vDetIds.push_back(HcalDetId(HcalForward, 41, 19, 1));
0052   _vDetIds.push_back(HcalDetId(HcalForward, 41, 55, 1));
0053   _vDetIds.push_back(HcalDetId(HcalForward, 30, 1, 2));
0054   _vDetIds.push_back(HcalDetId(HcalForward, 30, 37, 2));
0055   _vDetIds.push_back(HcalDetId(HcalForward, 32, 21, 2));
0056   _vDetIds.push_back(HcalDetId(HcalForward, 32, 57, 2));
0057   _vDetIds.push_back(HcalDetId(HcalForward, 34, 1, 2));
0058   _vDetIds.push_back(HcalDetId(HcalForward, 34, 37, 2));
0059   _vDetIds.push_back(HcalDetId(HcalForward, 36, 21, 2));
0060   _vDetIds.push_back(HcalDetId(HcalForward, 36, 57, 2));
0061   _vDetIds.push_back(HcalDetId(HcalForward, 38, 1, 2));
0062   _vDetIds.push_back(HcalDetId(HcalForward, 38, 37, 2));
0063   _vDetIds.push_back(HcalDetId(HcalForward, 40, 19, 2));
0064   _vDetIds.push_back(HcalDetId(HcalForward, 40, 55, 2));
0065   _vDetIds.push_back(HcalDetId(HcalForward, 41, 35, 2));
0066   _vDetIds.push_back(HcalDetId(HcalForward, 41, 71, 2));
0067 
0068   //    tags
0069   _tagHF = ps.getUntrackedParameter<edm::InputTag>("tagHF", edm::InputTag("hcalDigis"));
0070   _taguMN = ps.getUntrackedParameter<edm::InputTag>("taguMN", edm::InputTag("hcalDigis"));
0071   _tokHF = consumes<HFDigiCollection>(_tagHF);
0072   _tokuMN = consumes<HcalUMNioDigi>(_taguMN);
0073 }
0074 
0075 /* virtual */ void HFRaddamTask::bookHistograms(DQMStore::IBooker& ib, edm::Run const& r, edm::EventSetup const& es) {
0076   //    Initialize all the Single Containers
0077   for (std::vector<HcalDetId>::const_iterator it = _vDetIds.begin(); it != _vDetIds.end(); ++it) {
0078     _vcShape.push_back(ContainerSingle1D(_name,
0079                                          "Shape",
0080                                          new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fTiming_TS),
0081                                          new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::ffC_3000)));
0082   }
0083 
0084   DQTask::bookHistograms(ib, r, es);
0085   char aux[200];
0086   for (unsigned int i = 0; i < _vDetIds.size(); i++) {
0087     sprintf(aux, "ieta%diphi%dd%d", _vDetIds[i].ieta(), _vDetIds[i].iphi(), _vDetIds[i].depth());
0088     _vcShape[i].book(ib, _subsystem, aux);
0089   }
0090 }
0091 
0092 /* virtual */ void HFRaddamTask::_process(edm::Event const& e, edm::EventSetup const& es) {
0093   edm::Handle<HFDigiCollection> chf;
0094   if (!e.getByToken(_tokHF, chf))
0095     _logger.dqmthrow("Collection HFDigiCollection isn't avalaible" + _tagHF.label() + " " + _tagHF.instance());
0096 
0097   for (HFDigiCollection::const_iterator it = chf->begin(); it != chf->end(); ++it) {
0098     const HFDataFrame digi = (const HFDataFrame)(*it);
0099     for (unsigned int i = 0; i < _vDetIds.size(); i++)
0100       if (digi.id() == _vDetIds[i]) {
0101         for (int j = 0; j < digi.size(); j++)
0102           _vcShape[i].fill(j, digi.sample(j).nominal_fC() - 2.5);
0103       }
0104   }
0105 }
0106 
0107 /* virtual */ bool HFRaddamTask::_isApplicable(edm::Event const& e) {
0108   if (_ptype == fOnline) {
0109     edm::Handle<HcalUMNioDigi> cumn;
0110     if (!e.getByToken(_tokuMN, cumn))
0111       return false;
0112 
0113     //  event type check first
0114     uint8_t eventType = cumn->eventType();
0115     if (eventType != constants::EVENTTYPE_LASER)
0116       return false;
0117 
0118     //  check if this analysis task is of the right laser type
0119     uint32_t laserType = cumn->valueUserWord(0);
0120     if (laserType == constants::tHFRaddam)
0121       return true;
0122   } else {
0123     //  local, just return true as all the settings will be done in cfg
0124     return true;
0125   }
0126 
0127   return false;
0128 }
0129 
0130 DEFINE_FWK_MODULE(HFRaddamTask);