70 edm::LogInfo(
"SiStripMonitorPedestals") <<
"SiStripMonitorPedestals " 71 <<
" Constructing....... ";
83 edm::LogInfo(
"SiStripMonitorPedestals") <<
"SiStripMonitorPedestals " 84 <<
" Destructing...... ";
103 edm::LogInfo(
"SiStripMonitorPedestals") <<
"SiStripMonitorPedestals::bookHistograms: " 104 <<
" Creating MEs for new Cabling ";
122 std::vector<uint32_t> SelectedDetIds;
135 edm::LogInfo(
"SiStripMonitorPedestals") <<
"SiStripMonitorPedestals::createMEs: " 136 <<
"Number of Detector Present in cabling " << SelectedDetIds.size();
138 for (std::vector<uint32_t>::const_iterator idetid=SelectedDetIds.begin(), iEnd=SelectedDetIds.end();idetid!=iEnd;++idetid){
140 uint32_t detid = *idetid;
143 if (detid == 0 || detid == 0xFFFFFFFF){
144 edm::LogError(
"SiStripMonitorPedestals") <<
"SiStripMonitorPedestals::createMEs: " 145 <<
"Wrong DetId !!!!!! " << detid <<
" Neglecting !!!!!! ";
152 if (apv_pairs < 1 || apv_pairs > 3) {
153 edm::LogError(
"SiStripMonitorPedestals") <<
"SiStripMonitorPedestals::createMEs: Wrong APV Pairs => detId " 154 << detid <<
" APV pairs " << apv_pairs <<
" Neglecting !!!!!! ";
157 unsigned int napvs = apv_pairs * 2;
158 unsigned int nStrip = napvs * 128;
188 hid = hidmanager.
createHistoId(
"PedestalFromCondDB",
"det", detid);
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);
208 (local_modmes.
PedsPerStrip)->setAxisTitle(
"Pedestal (ADC) vs Strip Number ",1);
210 hid = hidmanager.
createHistoId(
"PedsDistribution",
"det", detid);
214 (local_modmes.
PedsDistribution)->setAxisTitle(
"Mean Pedestal Value (ADC)",2);
216 hid = hidmanager.
createHistoId(
"PedsEvolution",
"det", detid);
220 (local_modmes.
PedsEvolution)->setAxisTitle(
"Iteration Number",2);
223 hid = hidmanager.
createHistoId(
"CMSubNoisePerStrip",
"det", detid);
226 (local_modmes.
CMSubNoisePerStrip)->setAxisTitle(
"CMSubNoise (ADC) vs Strip Number",1);
228 hid = hidmanager.
createHistoId(
"RawNoisePerStrip",
"det", detid);
231 (local_modmes.
RawNoisePerStrip)->setAxisTitle(
"RawNoise(ADC) vs Strip Number",1);
233 hid = hidmanager.
createHistoId(
"CMSubNoiseProfile",
"det", detid);
236 (local_modmes.
CMSubNoiseProfile)->setAxisTitle(
"Mean of CMSubNoise (ADC) vs Strip Number",1);
238 hid = hidmanager.
createHistoId(
"RawNoiseProfile",
"det", detid);
241 (local_modmes.
RawNoiseProfile)->setAxisTitle(
"Mean of RawNoise (ADC) vs Strip Number",1);
244 local_modmes.
NoisyStrips = ibooker.
book2D(hid, hid, nStrip,0.5,nStrip+0.5,6,-0.5,5.5);
246 (local_modmes.
NoisyStrips)->setAxisTitle(
"Strip Number",1);
247 (local_modmes.
NoisyStrips)->setAxisTitle(
"Flag Value",2);
249 hid = hidmanager.
createHistoId(
"NoisyStripDistribution",
"det", detid);
255 hid = hidmanager.
createHistoId(
"CMDistribution",
"det", detid);
258 (local_modmes.
CMDistribution)->setAxisTitle(
"Common Mode (ADC) vs APV Number",1);
260 hid = hidmanager.
createHistoId(
"CMSlopeDistribution",
"det", detid);
268 PedMEs.insert( std::make_pair(detid, local_modmes));
272 edm::LogInfo(
"SiStripMonitorPedestals") <<
"SiStripMonitorPedestals::createMEs: Number of DETS used " 280 "SiStripMonitorPedestals::analyze: Run " <<
300 for (std::map<uint32_t, ModMEs >::const_iterator
i =
PedMEs.begin() ;
i!=
PedMEs.end() ;
i++) {
301 uint32_t detid =
i->first;
ModMEs local_modmes =
i->second;
303 std::vector< edm::DetSet<SiStripRawDigi> >::const_iterator digis = digi_collection->find( detid );
304 if (digis == digi_collection->end() ||
305 digis->data.empty() ||
306 digis->data.size() > 768) {
307 if (digis == digi_collection->end()) {
308 edm::LogError(
"SiStripMonitorPedestals") <<
" SiStripMonitorPedestals::analyze: Event " <<
nEvTot_ 309 <<
" DetId " << detid <<
" at the end of Digi Collection!!!";
311 edm::LogError(
"SiStripMonitorPedestals") <<
" [SiStripMonitorPedestals::analyze: Event " <<
nEvTot_ 312 <<
" DetId " << detid <<
" # of Digis " << digis->data.size() ;
315 bool firstchannel(
true);
316 for (
unsigned int k = 0;
k < fed_conns.size() ;
k++) {
317 if(fed_conns[
k] && fed_conns[
k]->isConnected()) {
319 edm::LogError(
"SiStripMonitorPedestals") <<
" SiStripMonitorPedestals::analyze: Fed Id " <<
320 fed_conns[
k]->fedId() <<
" Channel " << fed_conns[
k]->fedCh();
323 else edm::LogError(
"SiStripMonitorPedestals") <<
" SiStripMonitorPedestals::analyze: Channel " <<
324 fed_conns[
k]->fedCh();
331 if ( digis->data.empty() ) {
332 edm::LogError(
"MonitorDigi_tmp") <<
"[SiStripRawDigiToRaw::createFedBuffers] Zero digis found!";
340 std::vector<float>
tmp;
346 for (std::vector<float>::const_iterator iped=tmp.begin(); iped!=tmp.end();iped++) {
347 int iapv =
int (ibin/numberCMBlocks);
354 std::vector<float>
tmp;
358 for (std::vector<float>::const_iterator it=tmp.begin(); it!=tmp.end();it++) {
369 std::vector<float>
tmp;
373 int numberOfApvs =
int(tmp.size()/128.);
374 for(
int i=0;
i<numberOfApvs;
i++){
375 std::vector<float> myPedPerApv;
378 avarage = accumulate(myPedPerApv.begin(), myPedPerApv.end(), avarage);
379 avarage = avarage/128.;
385 for (std::vector<float>::const_iterator iped=tmp.begin(); iped!=tmp.end();iped++) {
386 int napv =
int(ibin / 128.);
388 float last_value = (local_modmes.
PedsPerStrip)->getBinContent(ibin);
389 if(last_value != 0.){
390 (local_modmes.
PedsPerStrip)->setBinContent(ibin,(static_cast<float>(*iped) + last_value)/2.);
392 (local_modmes.
PedsPerStrip)->setBinContent(ibin,static_cast<float>(*iped));
402 for (std::vector<float>::const_iterator iped=tmp.begin(); iped!=tmp.end();iped++) {
407 if(last_value != 0.){
408 (local_modmes.
CMSubNoisePerStrip)->setBinContent(ibin,(static_cast<float>(*iped)+last_value)/2.);
420 for (std::vector<float>::const_iterator iped=tmp.begin(); iped!=tmp.end();iped++) {
422 (local_modmes.
RawNoiseProfile)->
Fill(static_cast<double>(ibin*1.),
static_cast<float>(*iped));
424 if(last_value != 0.){
425 (local_modmes.
RawNoisePerStrip)->setBinContent(ibin,(static_cast<float>(*iped)+last_value)/2.);
427 (local_modmes.
RawNoisePerStrip)->setBinContent(ibin,static_cast<float>(*iped));
436 for (TkApvMask::MaskType::const_iterator iped=temp.begin(); iped!=temp.end();iped++) {
463 if (outputMEsInRootFile) {
473 edm::LogInfo(
"SiStripMonitorPedestals") <<
"SiStripMonitorPedestals::EndJob: " 480 std::map<uint32_t, ModMEs >::iterator
pos =
PedMEs.find(idet);
481 if (pos !=
PedMEs.end()) {
482 ModMEs mod_me = pos->second;
517 for (std::map<uint32_t, ModMEs >::const_iterator
i =
PedMEs.begin() ;
i!=
PedMEs.end() ;
i++) {
518 uint32_t detid =
i->first;
519 ModMEs local_modmes =
i->second;
520 edm::LogInfo(
"SiStripMonitorPedestals") <<
" SiStripMonitorPedestals::analyze: " <<
521 " Get Ped/Noise/Bad Strips from CondDb for DetId " << detid;
528 for(
int istrip=0;istrip<nStrip;++istrip){
534 edm::LogError(
"SiStripMonitorPedestals") <<
"[SiStripMonitorPedestals::analyze] cms::Exception accessing SiStripPedestalsService_.getPedestal("<<detid<<
","<<istrip<<
") : " <<
" " << e.
what() ;
542 edm::LogError(
"SiStripMonitorPedestals") <<
"[SiStripMonitorPedestals::analyze] cms::Exception accessing SiStripNoiseService_.getNoise("<<detid<<
","<<istrip<<
") : " <<
" " << e.
what() ;
551 edm::LogError(
"SiStripMonitorPedestals") <<
"[SiStripMonitorPedestals::analyze] cms::Exception accessing SiStripNoiseService_.getDisable("<<detid<<
","<<istrip<<
") : " <<
" " << e.
what() ;
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)
#define DEFINE_FWK_MODULE(type)
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
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 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
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
void save(const std::string &filename, const std::string &path="", const std::string &pattern="", const std::string &rewrite="", const uint32_t run=0, const uint32_t lumi=0, SaveReferenceTag ref=SaveWithReference, int minStatus=dqm::qstatus::STATUS_OK, const std::string &fileupdate="RECREATE", const bool resetMEsAfterWriting=false)
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)
void Reset(void)
reset ME (ie. contents, errors, etc)
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