53 pedsPSet_(iConfig.getParameter<edm::
ParameterSet>(
"PedestalsPSet")),
67 edm::LogInfo(
"SiStripMonitorPedestals") <<
"SiStripMonitorPedestals "
68 <<
" Constructing....... ";
77 noiseToken_ = esConsumes<edm::Transition::BeginRun>();
86 edm::LogInfo(
"SiStripMonitorPedestals") <<
"SiStripMonitorPedestals "
87 <<
" Destructing...... ";
101 edm::LogInfo(
"SiStripMonitorPedestals") <<
"SiStripMonitorPedestals::bookHistograms: "
102 <<
" Creating MEs for new Cabling ";
116 std::vector<uint32_t> SelectedDetIds;
131 edm::LogInfo(
"SiStripMonitorPedestals") <<
"SiStripMonitorPedestals::createMEs: "
132 <<
"Number of Detector Present in cabling " << SelectedDetIds.size();
134 for (std::vector<uint32_t>::const_iterator idetid = SelectedDetIds.begin(), iEnd = SelectedDetIds.end();
137 uint32_t detid = *idetid;
140 if (detid == 0 || detid == 0xFFFFFFFF) {
141 edm::LogError(
"SiStripMonitorPedestals") <<
"SiStripMonitorPedestals::createMEs: "
142 <<
"Wrong DetId !!!!!! " << detid <<
" Neglecting !!!!!! ";
149 if (apv_pairs < 1 || apv_pairs > 3) {
150 edm::LogError(
"SiStripMonitorPedestals") <<
"SiStripMonitorPedestals::createMEs: Wrong APV Pairs => detId "
151 << detid <<
" APV pairs " << apv_pairs <<
" Neglecting !!!!!! ";
154 unsigned int napvs = apv_pairs * 2;
155 unsigned int nStrip = napvs * 128;
186 hid = hidmanager.
createHistoId(
"PedestalFromCondDB",
"det", detid);
188 ibooker.
book1D(hid, hid, nStrip, 0.5, nStrip + 0.5);
189 (local_modmes.
PedsPerStripDB)->setAxisTitle(
"Pedestal from CondDB(ADC) vs Strip Number", 1);
191 hid = hidmanager.
createHistoId(
"NoiseFromCondDB",
"det", detid);
193 (local_modmes.
CMSubNoisePerStripDB)->setAxisTitle(
"CMSubNoise from CondDB(ADC) vs Strip Number", 1);
195 hid = hidmanager.
createHistoId(
"BadStripFlagCondDB",
"det", detid);
196 local_modmes.
BadStripsDB = ibooker.
book2D(hid, hid, nStrip, 0.5, nStrip + 0.5, 6, -0.5, 5.5);
197 (local_modmes.
BadStripsDB)->setAxisTitle(
"Strip Flag from CondDB(ADC) vs Strip Number", 1);
201 hid = hidmanager.
createHistoId(
"PedsPerStrip",
"det", detid);
203 (local_modmes.
PedsPerStrip)->setAxisTitle(
"Pedestal (ADC) vs Strip Number ", 1);
205 hid = hidmanager.
createHistoId(
"PedsDistribution",
"det", detid);
215 (local_modmes.
PedsDistribution)->setAxisTitle(
"Mean Pedestal Value (ADC)", 2);
217 hid = hidmanager.
createHistoId(
"PedsEvolution",
"det", detid);
227 (local_modmes.
PedsEvolution)->setAxisTitle(
"Iteration Number", 2);
230 hid = hidmanager.
createHistoId(
"CMSubNoisePerStrip",
"det", detid);
232 (local_modmes.
CMSubNoisePerStrip)->setAxisTitle(
"CMSubNoise (ADC) vs Strip Number", 1);
234 hid = hidmanager.
createHistoId(
"RawNoisePerStrip",
"det", detid);
236 (local_modmes.
RawNoisePerStrip)->setAxisTitle(
"RawNoise(ADC) vs Strip Number", 1);
238 hid = hidmanager.
createHistoId(
"CMSubNoiseProfile",
"det", detid);
240 (local_modmes.
CMSubNoiseProfile)->setAxisTitle(
"Mean of CMSubNoise (ADC) vs Strip Number", 1);
242 hid = hidmanager.
createHistoId(
"RawNoiseProfile",
"det", detid);
244 (local_modmes.
RawNoiseProfile)->setAxisTitle(
"Mean of RawNoise (ADC) vs Strip Number", 1);
247 local_modmes.
NoisyStrips = ibooker.
book2D(hid, hid, nStrip, 0.5, nStrip + 0.5, 6, -0.5, 5.5);
248 (local_modmes.
NoisyStrips)->setAxisTitle(
"Strip Number", 1);
249 (local_modmes.
NoisyStrips)->setAxisTitle(
"Flag Value", 2);
251 hid = hidmanager.
createHistoId(
"NoisyStripDistribution",
"det", detid);
256 hid = hidmanager.
createHistoId(
"CMDistribution",
"det", detid);
257 local_modmes.
CMDistribution = ibooker.
book2D(hid, hid, napvs, -0.5, napvs - 0.5, 150, -15., 15.);
258 (local_modmes.
CMDistribution)->setAxisTitle(
"Common Mode (ADC) vs APV Number", 1);
260 hid = hidmanager.
createHistoId(
"CMSlopeDistribution",
"det", detid);
266 PedMEs.insert(std::make_pair(detid, local_modmes));
270 <<
"SiStripMonitorPedestals::createMEs: Number of DETS used " <<
PedMEs.size();
275 <<
"SiStripMonitorPedestals::analyze: Run " << iEvent.
id().
run() <<
" Event " << iEvent.
id().
event();
296 for (std::map<uint32_t, ModMEs>::const_iterator
i =
PedMEs.begin();
i !=
PedMEs.end();
i++) {
297 uint32_t detid =
i->first;
298 ModMEs local_modmes =
i->second;
301 std::vector<edm::DetSet<SiStripRawDigi>>::const_iterator digis = digi_collection->find(detid);
302 if (digis == digi_collection->end() || digis->data.empty() || digis->data.size() > 768) {
303 if (digis == digi_collection->end()) {
304 edm::LogError(
"SiStripMonitorPedestals") <<
" SiStripMonitorPedestals::analyze: Event " <<
nEvTot_ <<
" DetId "
305 << detid <<
" at the end of Digi Collection!!!";
307 edm::LogError(
"SiStripMonitorPedestals") <<
" [SiStripMonitorPedestals::analyze: Event " <<
nEvTot_ <<
" DetId "
308 << detid <<
" # of Digis " << digis->data.size();
311 bool firstchannel(
true);
312 for (
unsigned int k = 0;
k < fed_conns.size();
k++) {
313 if (fed_conns[
k] && fed_conns[
k]->isConnected()) {
315 edm::LogError(
"SiStripMonitorPedestals") <<
" SiStripMonitorPedestals::analyze: Fed Id "
316 << fed_conns[
k]->fedId() <<
" Channel " << fed_conns[
k]->fedCh();
317 firstchannel =
false;
320 <<
" SiStripMonitorPedestals::analyze: Channel " << fed_conns[
k]->fedCh();
327 if (digis->data.empty()) {
328 edm::LogError(
"MonitorDigi_tmp") <<
"[SiStripRawDigiToRaw::createFedBuffers] Zero digis found!";
336 std::vector<float>
tmp;
340 int numberCMBlocks = int(128. / NumCMstripsInGroup_);
342 for (std::vector<float>::const_iterator iped = tmp.begin(); iped != tmp.end(); iped++) {
343 int iapv = int(ibin / numberCMBlocks);
349 std::vector<float>
tmp;
353 for (std::vector<float>::const_iterator it = tmp.begin(); it != tmp.end(); it++) {
362 std::vector<float>
tmp;
366 int numberOfApvs = int(tmp.size() / 128.);
367 for (
int i = 0;
i < numberOfApvs;
i++) {
368 std::vector<float> myPedPerApv;
371 avarage = std::accumulate(myPedPerApv.begin(), myPedPerApv.end(), avarage);
372 avarage = avarage / 128.;
377 for (std::vector<float>::const_iterator iped = tmp.begin(); iped != tmp.end(); iped++) {
378 int napv = int(ibin / 128.);
380 float last_value = (local_modmes.
PedsPerStrip)->getBinContent(ibin);
381 if (last_value != 0.) {
382 (local_modmes.
PedsPerStrip)->setBinContent(ibin, (static_cast<float>(*iped) + last_value) / 2.);
384 (local_modmes.
PedsPerStrip)->setBinContent(ibin, static_cast<float>(*iped));
394 for (std::vector<float>::const_iterator iped = tmp.begin(); iped != tmp.end(); iped++) {
399 if (last_value != 0.) {
400 (local_modmes.
CMSubNoisePerStrip)->setBinContent(ibin, (static_cast<float>(*iped) + last_value) / 2.);
411 for (std::vector<float>::const_iterator iped = tmp.begin(); iped != tmp.end(); iped++) {
413 (local_modmes.
RawNoiseProfile)->
Fill(static_cast<double>(ibin * 1.),
static_cast<float>(*iped));
415 if (last_value != 0.) {
416 (local_modmes.
RawNoisePerStrip)->setBinContent(ibin, (static_cast<float>(*iped) + last_value) / 2.);
418 (local_modmes.
RawNoisePerStrip)->setBinContent(ibin, static_cast<float>(*iped));
427 for (TkApvMask::MaskType::const_iterator iped = temp.begin(); iped != temp.end(); iped++) {
453 if (outputMEsInRootFile) {
462 edm::LogInfo(
"SiStripMonitorPedestals") <<
"SiStripMonitorPedestals::EndJob: "
469 std::map<uint32_t, ModMEs>::iterator pos =
PedMEs.find(idet);
470 if (pos !=
PedMEs.end()) {
471 ModMEs mod_me = pos->second;
500 for (std::map<uint32_t, ModMEs>::const_iterator
i =
PedMEs.begin();
i !=
PedMEs.end();
i++) {
501 uint32_t detid =
i->first;
502 ModMEs local_modmes =
i->second;
503 edm::LogInfo(
"SiStripMonitorPedestals") <<
" SiStripMonitorPedestals::analyze: "
504 <<
" Get Ped/Noise/Bad Strips from CondDb for DetId " << detid;
511 for (
int istrip = 0; istrip < nStrip; ++istrip) {
516 edm::LogError(
"SiStripMonitorPedestals") <<
"[SiStripMonitorPedestals::analyze] cms::Exception accessing "
517 "SiStripPedestalsService_.getPedestal("
518 << detid <<
"," << istrip <<
") : "
526 edm::LogError(
"SiStripMonitorPedestals") <<
"[SiStripMonitorPedestals::analyze] cms::Exception accessing "
527 "SiStripNoiseService_.getNoise("
528 << detid <<
"," << istrip <<
") : "
536 edm::LogError(
"SiStripMonitorPedestals") <<
"[SiStripMonitorPedestals::analyze] cms::Exception accessing "
537 "SiStripNoiseService_.getDisable("
538 << detid <<
"," << istrip <<
") : "
std::vector< StripMaskType > MaskType
EventNumber_t event() const
void fillCondDBMEs(edm::EventSetup const &eSetup)
void addActiveDetectorsRawIds(std::vector< uint32_t > &) const
edm::ESGetToken< SiStripQuality, SiStripQualityRcd > qualityToken_
MonitorElement * RawNoiseProfile
MonitorElement * CMDistribution
bool getByToken(EDGetToken token, Handle< PROD > &result) const
void getPedestal(uint32_t det_id, int apvNumber, ApvAnalysis::PedestalType &peds)
#define DEFINE_FWK_MODULE(type)
void getCommonModeSlope(uint32_t det_id, ApvAnalysis::PedestalType &tmp)
void getNoise(uint32_t det_id, int apvNumber, ApvAnalysis::PedestalType &noise)
void update(uint32_t det_id, const edm::DetSet< SiStripRawDigi > &in)
void getMask(uint32_t det_id, TkApvMask::MaskType &tmp)
const SiStripDetCabling * detcabling
std::pair< ContainerIterator, ContainerIterator > Range
MonitorElement * CMSubNoisePerStrip
Log< level::Error, false > LogError
edm::ESGetToken< SiStripNoises, SiStripNoisesRcd > noiseToken_
static const std::string RunMode1
void getRawNoise(uint32_t det_id, int apvNumber, ApvAnalysis::PedestalType &noise)
void setDetectorFolder(uint32_t rawdetid, const TrackerTopology *tTopo)
edm::ParameterSet pedsPSet_
bool getData(T &iHolder) const
const std::vector< const FedChannelConnection * > & getConnections(uint32_t det_id) const
virtual void Reset()
Remove all data from the ME, keept the empty histogram with all its settings.
~SiStripMonitorPedestals() override
MonitorElement * RawNoisePerStrip
edm::EDGetTokenT< edm::DetSetVector< SiStripRawDigi > > digiToken_
MonitorElement * PedsEvolution
MonitorElement * PedsPerStrip
MonitorElement * bookProfile(TString const &name, TString const &title, int nchX, double lowX, double highX, int, double lowY, double highY, char const *option="s", FUNC onbooking=NOOP())
void Fill(HcalDetId &id, double val, std::vector< TH2F > &depth)
void analyze(const edm::Event &, const edm::EventSetup &) override
static const std::string RunMode3
bool instantiateApvs(uint32_t det_id, int numberOfApvs)
SiStripMonitorPedestals(const edm::ParameterSet &)
edm::ESGetToken< SiStripPedestals, SiStripPedestalsRcd > pedestalToken_
char const * what() const noexceptoverride
ApvAnalysisFactory * apvFactory_
MonitorElement * PedsDistribution
MonitorElement * CMSubNoiseProfile
edm::ESGetToken< SiStripDetCabling, SiStripDetCablingRcd > detCablingToken_
void getCommonMode(uint32_t det_id, ApvAnalysis::PedestalType &tmp)
MonitorElement * CMSlopeDistribution
MonitorElement * PedsPerStripDB
SiStripHistoId hidmanager
Log< level::Info, false > LogInfo
MonitorElement * NoisyStripDistribution
std::string createHistoId(std::string description, std::string id_type, uint32_t component_id)
MonitorElement * book2D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, FUNC onbooking=NOOP())
T getParameter(std::string const &) const
SiStripFolderOrganizer folder_organizer
MonitorElement * CMSubNoisePerStripDB
bool check(const edm::EventSetup &iSetup)
const uint16_t nApvPairs(uint32_t det_id) const
DQM_DEPRECATED void save(std::string const &filename, std::string const &path="")
std::pair< ContainerIterator, ContainerIterator > Range
static const std::string RunMode2
MonitorElement * BadStripsDB
std::string outPutFileName
std::pair< ContainerIterator, ContainerIterator > Range
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
void createMEs(DQMStore::IBooker &, edm::EventSetup const &eSetup)
void dqmEndRun(edm::Run const &run, edm::EventSetup const &eSetup) override
void resetMEs(uint32_t idet)
edm::ESWatcher< SiStripDetCablingRcd > detCablingWatcher_
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
std::map< uint32_t, ModMEs > PedMEs
edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > tTopoToken_
MonitorElement * NoisyStrips