70 edm::LogInfo(
"SiStripMonitorPedestals") <<
"SiStripMonitorPedestals " 71 <<
" Constructing....... ";
82 edm::LogInfo(
"SiStripMonitorPedestals") <<
"SiStripMonitorPedestals " 83 <<
" Destructing...... ";
99 edm::LogInfo(
"SiStripMonitorPedestals") <<
"SiStripMonitorPedestals::bookHistograms: " 100 <<
" Creating MEs for new Cabling ";
117 std::vector<uint32_t> SelectedDetIds;
132 edm::LogInfo(
"SiStripMonitorPedestals") <<
"SiStripMonitorPedestals::createMEs: " 133 <<
"Number of Detector Present in cabling " << SelectedDetIds.size();
135 for (std::vector<uint32_t>::const_iterator idetid = SelectedDetIds.begin(), iEnd = SelectedDetIds.end();
138 uint32_t detid = *idetid;
141 if (detid == 0 || detid == 0xFFFFFFFF) {
142 edm::LogError(
"SiStripMonitorPedestals") <<
"SiStripMonitorPedestals::createMEs: " 143 <<
"Wrong DetId !!!!!! " << detid <<
" Neglecting !!!!!! ";
150 if (apv_pairs < 1 || apv_pairs > 3) {
151 edm::LogError(
"SiStripMonitorPedestals") <<
"SiStripMonitorPedestals::createMEs: Wrong APV Pairs => detId " 152 << detid <<
" APV pairs " << apv_pairs <<
" Neglecting !!!!!! ";
155 unsigned int napvs = apv_pairs * 2;
156 unsigned int nStrip = napvs * 128;
187 hid = hidmanager.
createHistoId(
"PedestalFromCondDB",
"det", detid);
189 ibooker.
book1D(hid, hid, nStrip, 0.5, nStrip + 0.5);
191 (local_modmes.
PedsPerStripDB)->setAxisTitle(
"Pedestal from CondDB(ADC) vs Strip Number", 1);
193 hid = hidmanager.
createHistoId(
"NoiseFromCondDB",
"det", detid);
196 (local_modmes.
CMSubNoisePerStripDB)->setAxisTitle(
"CMSubNoise from CondDB(ADC) vs Strip Number", 1);
198 hid = hidmanager.
createHistoId(
"BadStripFlagCondDB",
"det", detid);
199 local_modmes.
BadStripsDB = ibooker.
book2D(hid, hid, nStrip, 0.5, nStrip + 0.5, 6, -0.5, 5.5);
201 (local_modmes.
BadStripsDB)->setAxisTitle(
"Strip Flag from CondDB(ADC) vs Strip Number", 1);
205 hid = hidmanager.
createHistoId(
"PedsPerStrip",
"det", detid);
208 (local_modmes.
PedsPerStrip)->setAxisTitle(
"Pedestal (ADC) vs Strip Number ", 1);
210 hid = hidmanager.
createHistoId(
"PedsDistribution",
"det", detid);
221 (local_modmes.
PedsDistribution)->setAxisTitle(
"Mean Pedestal Value (ADC)", 2);
223 hid = hidmanager.
createHistoId(
"PedsEvolution",
"det", detid);
234 (local_modmes.
PedsEvolution)->setAxisTitle(
"Iteration Number", 2);
237 hid = hidmanager.
createHistoId(
"CMSubNoisePerStrip",
"det", detid);
240 (local_modmes.
CMSubNoisePerStrip)->setAxisTitle(
"CMSubNoise (ADC) vs Strip Number", 1);
242 hid = hidmanager.
createHistoId(
"RawNoisePerStrip",
"det", detid);
245 (local_modmes.
RawNoisePerStrip)->setAxisTitle(
"RawNoise(ADC) vs Strip Number", 1);
247 hid = hidmanager.
createHistoId(
"CMSubNoiseProfile",
"det", detid);
250 (local_modmes.
CMSubNoiseProfile)->setAxisTitle(
"Mean of CMSubNoise (ADC) vs Strip Number", 1);
252 hid = hidmanager.
createHistoId(
"RawNoiseProfile",
"det", detid);
255 (local_modmes.
RawNoiseProfile)->setAxisTitle(
"Mean of RawNoise (ADC) vs Strip Number", 1);
258 local_modmes.
NoisyStrips = ibooker.
book2D(hid, hid, nStrip, 0.5, nStrip + 0.5, 6, -0.5, 5.5);
260 (local_modmes.
NoisyStrips)->setAxisTitle(
"Strip Number", 1);
261 (local_modmes.
NoisyStrips)->setAxisTitle(
"Flag Value", 2);
263 hid = hidmanager.
createHistoId(
"NoisyStripDistribution",
"det", detid);
269 hid = hidmanager.
createHistoId(
"CMDistribution",
"det", detid);
270 local_modmes.
CMDistribution = ibooker.
book2D(hid, hid, napvs, -0.5, napvs - 0.5, 150, -15., 15.);
272 (local_modmes.
CMDistribution)->setAxisTitle(
"Common Mode (ADC) vs APV Number", 1);
274 hid = hidmanager.
createHistoId(
"CMSlopeDistribution",
"det", detid);
281 PedMEs.insert(std::make_pair(detid, local_modmes));
285 <<
"SiStripMonitorPedestals::createMEs: Number of DETS used " <<
PedMEs.size();
290 <<
"SiStripMonitorPedestals::analyze: Run " << iEvent.
id().
run() <<
" Event " << iEvent.
id().
event();
311 for (std::map<uint32_t, ModMEs>::const_iterator
i =
PedMEs.begin();
i !=
PedMEs.end();
i++) {
312 uint32_t detid =
i->first;
313 ModMEs local_modmes =
i->second;
316 std::vector<edm::DetSet<SiStripRawDigi>>::const_iterator digis = digi_collection->find(detid);
317 if (digis == digi_collection->end() || digis->data.empty() || digis->data.size() > 768) {
318 if (digis == digi_collection->end()) {
319 edm::LogError(
"SiStripMonitorPedestals") <<
" SiStripMonitorPedestals::analyze: Event " <<
nEvTot_ <<
" DetId " 320 << detid <<
" at the end of Digi Collection!!!";
322 edm::LogError(
"SiStripMonitorPedestals") <<
" [SiStripMonitorPedestals::analyze: Event " <<
nEvTot_ <<
" DetId " 323 << detid <<
" # of Digis " << digis->data.size();
326 bool firstchannel(
true);
327 for (
unsigned int k = 0;
k < fed_conns.size();
k++) {
328 if (fed_conns[
k] && fed_conns[
k]->isConnected()) {
330 edm::LogError(
"SiStripMonitorPedestals") <<
" SiStripMonitorPedestals::analyze: Fed Id " 331 << fed_conns[
k]->fedId() <<
" Channel " << fed_conns[
k]->fedCh();
332 firstchannel =
false;
335 <<
" SiStripMonitorPedestals::analyze: Channel " << fed_conns[
k]->fedCh();
342 if (digis->data.empty()) {
343 edm::LogError(
"MonitorDigi_tmp") <<
"[SiStripRawDigiToRaw::createFedBuffers] Zero digis found!";
351 std::vector<float>
tmp;
357 for (std::vector<float>::const_iterator iped = tmp.begin(); iped != tmp.end(); iped++) {
358 int iapv =
int(ibin / numberCMBlocks);
364 std::vector<float>
tmp;
368 for (std::vector<float>::const_iterator it = tmp.begin(); it != tmp.end(); it++) {
377 std::vector<float>
tmp;
381 int numberOfApvs =
int(tmp.size() / 128.);
382 for (
int i = 0;
i < numberOfApvs;
i++) {
383 std::vector<float> myPedPerApv;
386 avarage = std::accumulate(myPedPerApv.begin(), myPedPerApv.end(), avarage);
387 avarage = avarage / 128.;
392 for (std::vector<float>::const_iterator iped = tmp.begin(); iped != tmp.end(); iped++) {
393 int napv =
int(ibin / 128.);
395 float last_value = (local_modmes.
PedsPerStrip)->getBinContent(ibin);
396 if (last_value != 0.) {
397 (local_modmes.
PedsPerStrip)->setBinContent(ibin, (static_cast<float>(*iped) + last_value) / 2.);
399 (local_modmes.
PedsPerStrip)->setBinContent(ibin, static_cast<float>(*iped));
409 for (std::vector<float>::const_iterator iped = tmp.begin(); iped != tmp.end(); iped++) {
414 if (last_value != 0.) {
415 (local_modmes.
CMSubNoisePerStrip)->setBinContent(ibin, (static_cast<float>(*iped) + last_value) / 2.);
426 for (std::vector<float>::const_iterator iped = tmp.begin(); iped != tmp.end(); iped++) {
428 (local_modmes.
RawNoiseProfile)->
Fill(static_cast<double>(ibin * 1.),
static_cast<float>(*iped));
430 if (last_value != 0.) {
431 (local_modmes.
RawNoisePerStrip)->setBinContent(ibin, (static_cast<float>(*iped) + last_value) / 2.);
433 (local_modmes.
RawNoisePerStrip)->setBinContent(ibin, static_cast<float>(*iped));
442 for (TkApvMask::MaskType::const_iterator iped = temp.begin(); iped != temp.end(); iped++) {
468 if (outputMEsInRootFile) {
478 edm::LogInfo(
"SiStripMonitorPedestals") <<
"SiStripMonitorPedestals::EndJob: " 485 std::map<uint32_t, ModMEs>::iterator
pos =
PedMEs.find(idet);
486 if (pos !=
PedMEs.end()) {
487 ModMEs mod_me = pos->second;
522 for (std::map<uint32_t, ModMEs>::const_iterator
i =
PedMEs.begin();
i !=
PedMEs.end();
i++) {
523 uint32_t detid =
i->first;
524 ModMEs local_modmes =
i->second;
525 edm::LogInfo(
"SiStripMonitorPedestals") <<
" SiStripMonitorPedestals::analyze: " 526 <<
" Get Ped/Noise/Bad Strips from CondDb for DetId " << detid;
533 for (
int istrip = 0; istrip < nStrip; ++istrip) {
538 edm::LogError(
"SiStripMonitorPedestals") <<
"[SiStripMonitorPedestals::analyze] cms::Exception accessing " 539 "SiStripPedestalsService_.getPedestal(" 540 << detid <<
"," << istrip <<
") : " 548 edm::LogError(
"SiStripMonitorPedestals") <<
"[SiStripMonitorPedestals::analyze] cms::Exception accessing " 549 "SiStripNoiseService_.getNoise(" 550 << detid <<
"," << istrip <<
") : " 558 edm::LogError(
"SiStripMonitorPedestals") <<
"[SiStripMonitorPedestals::analyze] cms::Exception accessing " 559 "SiStripNoiseService_.getDisable(" 560 << detid <<
"," << istrip <<
") : " std::vector< StripMaskType > MaskType
T getParameter(std::string const &) const
EventNumber_t event() const
void fillCondDBMEs(edm::EventSetup const &eSetup)
edm::ESHandle< SiStripDetCabling > detcabling
void addActiveDetectorsRawIds(std::vector< uint32_t > &) const
MonitorElement * RawNoiseProfile
MonitorElement * CMDistribution
MonitorElement * bookProfile(Args &&...args)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
void getPedestal(uint32_t det_id, int apvNumber, ApvAnalysis::PedestalType &peds)
bool IsStripBad(const uint32_t &detid, const short &strip) const
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)
char const * what() const override
std::pair< ContainerIterator, ContainerIterator > Range
MonitorElement * CMSubNoisePerStrip
static const std::string RunMode1
void getRawNoise(uint32_t det_id, int apvNumber, ApvAnalysis::PedestalType &noise)
void setDetectorFolder(uint32_t rawdetid, const TrackerTopology *tTopo)
float getPed(const uint16_t &strip, const Range &range) const
edm::ParameterSet pedsPSet_
const std::vector< const FedChannelConnection * > & getConnections(uint32_t det_id) const
~SiStripMonitorPedestals() override
MonitorElement * RawNoisePerStrip
edm::EDGetTokenT< edm::DetSetVector< SiStripRawDigi > > digiToken_
static float getNoise(uint16_t strip, const Range &range)
MonitorElement * PedsEvolution
#define DEFINE_FWK_MODULE(type)
MonitorElement * PedsPerStrip
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 &)
MonitorElement * book1D(Args &&...args)
void tag(MonitorElement *, unsigned int)
ApvAnalysisFactory * apvFactory_
MonitorElement * PedsDistribution
MonitorElement * CMSubNoiseProfile
void Reset()
reset ME (ie. contents, errors, etc)
void getCommonMode(uint32_t det_id, ApvAnalysis::PedestalType &tmp)
MonitorElement * CMSlopeDistribution
MonitorElement * PedsPerStripDB
MonitorElement * NoisyStripDistribution
MonitorElement * book2D(Args &&...args)
std::string createHistoId(std::string description, std::string id_type, uint32_t component_id)
MonitorElement * CMSubNoisePerStripDB
void save(std::string const &filename, std::string const &path="", std::string const &pattern="", std::string const &rewrite="", uint32_t run=0, uint32_t lumi=0, SaveReferenceTag ref=SaveWithReference, int minStatus=dqm::qstatus::STATUS_OK, std::string const &fileupdate="RECREATE")
const uint16_t nApvPairs(uint32_t det_id) const
std::vector< std::vector< double > > tmp
unsigned long long m_cacheID_
const Range getRange(const uint32_t detID) const
void endRun(edm::Run const &run, edm::EventSetup const &eSetup) override
const Range getRange(const uint32_t detID) const
std::pair< ContainerIterator, ContainerIterator > Range
static const std::string RunMode2
MonitorElement * BadStripsDB
std::string outPutFileName
const Range getRange(const uint32_t &detID) const
std::pair< ContainerIterator, ContainerIterator > Range
void createMEs(DQMStore::IBooker &, edm::EventSetup const &eSetup)
T const * product() const
void resetMEs(uint32_t idet)
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
std::map< uint32_t, ModMEs > PedMEs
MonitorElement * NoisyStrips