Skip to content

Commit

Permalink
update of ZDC task for DQM
Browse files Browse the repository at this point in the history
  • Loading branch information
deguio committed Nov 8, 2016
1 parent 648c77e commit 9903a5b
Show file tree
Hide file tree
Showing 3 changed files with 77 additions and 72 deletions.
2 changes: 1 addition & 1 deletion DQM/HcalTasks/interface/ZDCTask.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class ZDCTask : public hcaldqm::DQTask

// tags
edm::InputTag _tagQIE10;
edm::EDGetTokenT<QIE10DigiCollection> _tokQIE10;
edm::EDGetTokenT<ZDCDigiCollection> _tokQIE10;

// cuts/constants from input
double _cut;
Expand Down
145 changes: 75 additions & 70 deletions DQM/HcalTasks/plugins/ZDCTask.cc
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ ZDCTask::ZDCTask(edm::ParameterSet const& ps):
// tags
_tagQIE10 = ps.getUntrackedParameter<edm::InputTag>("tagQIE10",
edm::InputTag("hcalDigis"));
_tokQIE10 = consumes<QIE10DigiCollection>(_tagQIE10);
_tokQIE10 = consumes<ZDCDigiCollection>(_tagQIE10);

// cuts
_cut = ps.getUntrackedParameter<double>("cut", 50.0);
Expand All @@ -33,87 +33,90 @@ ZDCTask::ZDCTask(edm::ParameterSet const& ps):
_emap = dbs->getHcalMapping();
std::vector<uint32_t> vhashC36;

// uhtr slot 6 is the uhtr to be used to read out qie10 coming from zdc
vhashC36.push_back(HcalElectronicsId(36, 6,
FIBER_uTCA_MIN1, FIBERCH_MIN, false).rawId());
// uhtr slot 6 is the uhtr to be used to read out qie10 coming from zdc
vhashC36.push_back(HcalElectronicsId(18, 8, FIBER_uTCA_MIN1, FIBERCH_MIN, false).rawId());
// vhashC36.push_back(HcalElectronicsId(36, 6, 11, FIBERCH_MIN, false).rawId());
// vhashC36.push_back(HcalElectronicsId(36, 6, 4, FIBERCH_MIN, false).rawId());
// vhashC36.push_back(HcalElectronicsId(36, 6, 5, FIBERCH_MIN, false).rawId());

_filter_C36.initialize(filter::fPreserver, hcaldqm::hashfunctions::fCrateSlot,
vhashC36);

// INITIALIZE what you need
_cShapeCut_EChannel.initialize(_name,
"ShapeCut", hcaldqm::hashfunctions::fEChannel,
new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fTiming_TS),
new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fQIE10fC_300000));
new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::ffC_10000));
_cShapeCut.initialize(_name,
"ShapeCut",
new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fTiming_TS),
new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fQIE10fC_300000));
new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::ffC_10000));
_cShape_EChannel.initialize(_name,
"Shape", hcaldqm::hashfunctions::fEChannel,
new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fTiming_TS),
new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fQIE10fC_300000));
new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::ffC_10000));
_cShape.initialize(_name,
"Shape",
new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fTiming_TS),
new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fQIE10fC_300000));

_cLETDCvsADC.initialize(_name, "LETDCvsADC",
new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fQIE10ADC_256),
new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fQIE10TDC_64),
new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true));
_cTETDCvsADC.initialize(_name, "TETDCvsADC",
new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fQIE10ADC_256),
new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fQIE10TDC_64),
new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true));
_cLETDC.initialize(_name, "LETDC",
new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fQIE10TDC_64),
new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true));
new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::ffC_10000));

// _cLETDCvsADC.initialize(_name, "LETDCvsADC",
// new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fQIE10ADC_256),
// new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fQIE10TDC_64),
// new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true));
// _cTETDCvsADC.initialize(_name, "TETDCvsADC",
// new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fQIE10ADC_256),
// new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fQIE10TDC_64),
// new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true));
// _cLETDC.initialize(_name, "LETDC",
// new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fQIE10TDC_64),
// new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true));
_cADC.initialize(_name, "ADC",
new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fQIE10ADC_256),
new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fADC_128),
new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true));

unsigned int nTS = _ptype==fLocal ? 10 : 6;
unsigned int nTS = 10;
for (unsigned int j=0; j<nTS; j++)
{
_cLETDCvsADC_EChannel[j].initialize(_name,
"LETDCvsADC", hcaldqm::hashfunctions::fEChannel,
new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fQIE10ADC_256),
new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fQIE10TDC_64),
new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true));
_cTETDCvsADC_EChannel[j].initialize(_name,
"TETDCvsADC", hcaldqm::hashfunctions::fEChannel,
new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fQIE10ADC_256),
new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fQIE10TDC_64),
new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true));
// _cLETDCvsADC_EChannel[j].initialize(_name,
// "LETDCvsADC", hcaldqm::hashfunctions::fEChannel,
// new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fQIE10ADC_256),
// new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fQIE10TDC_64),
// new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true));
// _cTETDCvsADC_EChannel[j].initialize(_name,
// "TETDCvsADC", hcaldqm::hashfunctions::fEChannel,
// new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fQIE10ADC_256),
// new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fQIE10TDC_64),
// new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true));
// _cLETDC_EChannel[j].initialize(_name,
// "LETDC", hcaldqm::hashfunctions::fEChannel,
// new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fQIE10TDC_64),
// new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true));
_cADC_EChannel[j].initialize(_name,
"ADC", hcaldqm::hashfunctions::fEChannel,
new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fQIE10ADC_256),
new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true));
_cLETDC_EChannel[j].initialize(_name,
"LETDC", hcaldqm::hashfunctions::fEChannel,
new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fQIE10TDC_64),
new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fADC_128),
new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true));
}

_cShapeCut_EChannel.book(ib, _emap, _filter_C36, _subsystem);
_cShapeCut_EChannel.book(ib, _emap, _subsystem);
_cShapeCut.book(ib, _subsystem);
_cShape_EChannel.book(ib, _emap, _filter_C36, _subsystem);
_cShape_EChannel.book(ib, _emap, _subsystem);
_cShape.book(ib, _subsystem);
_cLETDCvsADC.book(ib, _subsystem);
_cTETDCvsADC.book(ib, _subsystem);
_cLETDC.book(ib, _subsystem);
// _cLETDCvsADC.book(ib, _subsystem);
// _cTETDCvsADC.book(ib, _subsystem);
// _cLETDC.book(ib, _subsystem);
_cADC.book(ib, _subsystem);
for (unsigned int i=0; i<nTS; i++)
{
char aux[10];
sprintf(aux, "TS%d", i);
_cLETDCvsADC_EChannel[i].book(ib, _emap, _filter_C36, _subsystem, aux);
_cTETDCvsADC_EChannel[i].book(ib, _emap, _filter_C36, _subsystem, aux);
_cLETDC_EChannel[i].book(ib, _emap, _filter_C36, _subsystem, aux);
_cADC_EChannel[i].book(ib, _emap, _filter_C36, _subsystem, aux);
// _cLETDCvsADC_EChannel[i].book(ib, _emap, _filter_C36, _subsystem, aux);
// _cTETDCvsADC_EChannel[i].book(ib, _emap, _filter_C36, _subsystem, aux);
// _cLETDC_EChannel[i].book(ib, _emap, _filter_C36, _subsystem, aux);
_cADC_EChannel[i].book(ib, _emap, _subsystem, aux);
}

_ehashmap.initialize(_emap, electronicsmap::fD2EHashMap, _filter_C36);
_ehashmap.initialize(_emap, electronicsmap::fD2EHashMap);
}

/* virtual */ void ZDCTask::endLuminosityBlock(edm::LuminosityBlock const& lb,
Expand All @@ -127,45 +130,47 @@ ZDCTask::ZDCTask(edm::ParameterSet const& ps):
/* virtual */ void ZDCTask::_process(edm::Event const& e,
edm::EventSetup const&)
{
edm::Handle<QIE10DigiCollection> cqie10;
edm::Handle<ZDCDigiCollection> cqie10;
if (!e.getByToken(_tokQIE10, cqie10))
_logger.dqmthrow("Collection QIE10DigiCollection isn't available"
_logger.dqmthrow("Collection ZDCDigiCollection isn't available"
+ _tagQIE10.label() + " " + _tagQIE10.instance());


for (uint32_t i=0; i<cqie10->size(); i++)
{
QIE10DataFrame frame = static_cast<QIE10DataFrame>((*cqie10)[i]);
HcalElectronicsId eid = HcalElectronicsId(_ehashmap.lookup(frame.detid()));
if (_filter_C36.filter(eid)) continue;
{
ZDCDataFrame frame = static_cast<ZDCDataFrame>((*cqie10)[i]);
HcalElectronicsId eid = HcalElectronicsId(_emap->lookup(frame.id()));


//std::cout << eid.crateId() << " " << eid.slot() << " " << eid.fiberIndex() << " " << eid.fiberChanId() << std::endl;
//if (_filter_C36.filter(eid)) continue;

// compute the signal, ped subracted
double q = hcaldqm::utilities::sumQ_v10<QIE10DataFrame>(frame,
constants::adc2fC[_ped], 0, frame.samples()-1);
double q = hcaldqm::utilities::sumQ_v10<ZDCDataFrame>(frame,
constants::adc2fC[_ped], 0, frame.size()-1);

// iterate thru all TS and fill
for (int j=0; j<frame.samples(); j++)
for (int j=0; j<frame.size(); j++)
{
_cShape_EChannel.fill(eid, j,
constants::adc2fC[frame[j].adc()]);
_cShape.fill(j, constants::adc2fC[frame[j].adc()]);
_cShape_EChannel.fill(eid, j, frame[j].nominal_fC());
_cShape.fill(j, frame[j].nominal_fC());

// shapes are after the cut
if (q>_cut)
{
_cShapeCut_EChannel.fill(eid, j,
constants::adc2fC[frame[j].adc()]);
_cShapeCut.fill(j, constants::adc2fC[frame[j].adc()]);
_cShapeCut_EChannel.fill(eid, j, frame[j].nominal_fC());
_cShapeCut.fill(j, frame[j].nominal_fC());
}

// w/o a cut
_cLETDCvsADC_EChannel[j].fill(eid, frame[j].adc(),
frame[j].le_tdc());
_cLETDCvsADC.fill(frame[j].adc(), frame[j].le_tdc());
_cTETDCvsADC_EChannel[j].fill(eid, frame[j].adc(),
frame[j].te_tdc());
_cTETDCvsADC.fill(frame[j].adc(), frame[j].te_tdc());
_cLETDC_EChannel[j].fill(eid, frame[j].le_tdc());
_cLETDC.fill(frame[j].le_tdc());
// _cLETDCvsADC_EChannel[j].fill(eid, frame[j].adc(),
// frame[j].le_tdc());
// _cLETDCvsADC.fill(frame[j].adc(), frame[j].le_tdc());
// _cTETDCvsADC_EChannel[j].fill(eid, frame[j].adc(),
// frame[j].te_tdc());
// _cTETDCvsADC.fill(frame[j].adc(), frame[j].te_tdc());
// _cLETDC_EChannel[j].fill(eid, frame[j].le_tdc());
// _cLETDC.fill(frame[j].le_tdc());
_cADC_EChannel[j].fill(eid, frame[j].adc());
_cADC.fill(frame[j].adc());
}
Expand Down
2 changes: 1 addition & 1 deletion DQM/HcalTasks/python/ZDCTask.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
runkeyName = cms.untracked.string("pp_run"),

# tag
tagQIE10 = cms.untracked.InputTag("hcalDigis"),
tagQIE10 = cms.untracked.InputTag("castorDigis"),

# cuts,
cut = cms.untracked.double(20),
Expand Down

0 comments on commit 9903a5b

Please sign in to comment.