70 edm::LogInfo(
"SiStripMonitorPedestals") <<
"SiStripMonitorPedestals " 71 <<
" Constructing....... ";
83 edm::LogInfo(
"SiStripMonitorPedestals") <<
"SiStripMonitorPedestals " 84 <<
" Destructing...... ";
98 edm::LogInfo(
"SiStripMonitorPedestals") <<
"SiStripMonitorPedestals::bookHistograms: " 99 <<
" Creating MEs for new Cabling ";
117 std::vector<uint32_t> SelectedDetIds;
130 edm::LogInfo(
"SiStripMonitorPedestals") <<
"SiStripMonitorPedestals::createMEs: " 131 <<
"Number of Detector Present in cabling " << SelectedDetIds.size();
133 for (std::vector<uint32_t>::const_iterator idetid=SelectedDetIds.begin(), iEnd=SelectedDetIds.end();idetid!=iEnd;++idetid){
135 uint32_t detid = *idetid;
138 if (detid == 0 || detid == 0xFFFFFFFF){
139 edm::LogError(
"SiStripMonitorPedestals") <<
"SiStripMonitorPedestals::createMEs: " 140 <<
"Wrong DetId !!!!!! " << detid <<
" Neglecting !!!!!! ";
147 if (apv_pairs < 1 || apv_pairs > 3) {
148 edm::LogError(
"SiStripMonitorPedestals") <<
"SiStripMonitorPedestals::createMEs: Wrong APV Pairs => detId " 149 << detid <<
" APV pairs " << apv_pairs <<
" Neglecting !!!!!! ";
152 unsigned int napvs = apv_pairs * 2;
153 unsigned int nStrip = napvs * 128;
183 hid = hidmanager.
createHistoId(
"PedestalFromCondDB",
"det", detid);
186 (local_modmes.
PedsPerStripDB)->setAxisTitle(
"Pedestal from CondDB(ADC) vs Strip Number",1);
188 hid = hidmanager.
createHistoId(
"NoiseFromCondDB",
"det", detid);
191 (local_modmes.
CMSubNoisePerStripDB)->setAxisTitle(
"CMSubNoise from CondDB(ADC) vs Strip Number",1);
193 hid = hidmanager.
createHistoId(
"BadStripFlagCondDB",
"det", detid);
194 local_modmes.
BadStripsDB = ibooker.
book2D(hid, hid, nStrip,0.5,nStrip+0.5,6,-0.5,5.5);
196 (local_modmes.
BadStripsDB)->setAxisTitle(
"Strip Flag from CondDB(ADC) vs Strip Number",1);
203 (local_modmes.
PedsPerStrip)->setAxisTitle(
"Pedestal (ADC) vs Strip Number ",1);
205 hid = hidmanager.
createHistoId(
"PedsDistribution",
"det", detid);
209 (local_modmes.
PedsDistribution)->setAxisTitle(
"Mean Pedestal Value (ADC)",2);
211 hid = hidmanager.
createHistoId(
"PedsEvolution",
"det", detid);
215 (local_modmes.
PedsEvolution)->setAxisTitle(
"Iteration Number",2);
218 hid = hidmanager.
createHistoId(
"CMSubNoisePerStrip",
"det", detid);
221 (local_modmes.
CMSubNoisePerStrip)->setAxisTitle(
"CMSubNoise (ADC) vs Strip Number",1);
223 hid = hidmanager.
createHistoId(
"RawNoisePerStrip",
"det", detid);
226 (local_modmes.
RawNoisePerStrip)->setAxisTitle(
"RawNoise(ADC) vs Strip Number",1);
228 hid = hidmanager.
createHistoId(
"CMSubNoiseProfile",
"det", detid);
231 (local_modmes.
CMSubNoiseProfile)->setAxisTitle(
"Mean of CMSubNoise (ADC) vs Strip Number",1);
233 hid = hidmanager.
createHistoId(
"RawNoiseProfile",
"det", detid);
236 (local_modmes.
RawNoiseProfile)->setAxisTitle(
"Mean of RawNoise (ADC) vs Strip Number",1);
239 local_modmes.
NoisyStrips = ibooker.
book2D(hid, hid, nStrip,0.5,nStrip+0.5,6,-0.5,5.5);
241 (local_modmes.
NoisyStrips)->setAxisTitle(
"Strip Number",1);
242 (local_modmes.
NoisyStrips)->setAxisTitle(
"Flag Value",2);
244 hid = hidmanager.
createHistoId(
"NoisyStripDistribution",
"det", detid);
250 hid = hidmanager.
createHistoId(
"CMDistribution",
"det", detid);
253 (local_modmes.
CMDistribution)->setAxisTitle(
"Common Mode (ADC) vs APV Number",1);
255 hid = hidmanager.
createHistoId(
"CMSlopeDistribution",
"det", detid);
263 PedMEs.insert( std::make_pair(detid, local_modmes));
267 edm::LogInfo(
"SiStripMonitorPedestals") <<
"SiStripMonitorPedestals::createMEs: Number of DETS used " 275 "SiStripMonitorPedestals::analyze: Run " <<
295 for (std::map<uint32_t, ModMEs >::const_iterator
i =
PedMEs.begin() ;
i!=
PedMEs.end() ;
i++) {
296 uint32_t detid =
i->first;
ModMEs local_modmes =
i->second;
298 std::vector< edm::DetSet<SiStripRawDigi> >::const_iterator digis = digi_collection->find( detid );
299 if (digis == digi_collection->end() ||
300 digis->data.empty() ||
301 digis->data.size() > 768) {
302 if (digis == digi_collection->end()) {
303 edm::LogError(
"SiStripMonitorPedestals") <<
" SiStripMonitorPedestals::analyze: Event " <<
nEvTot_ 304 <<
" DetId " << detid <<
" at the end of Digi Collection!!!";
306 edm::LogError(
"SiStripMonitorPedestals") <<
" [SiStripMonitorPedestals::analyze: Event " <<
nEvTot_ 307 <<
" DetId " << detid <<
" # of Digis " << digis->data.size() ;
310 bool firstchannel(
true);
311 for (
unsigned int k = 0;
k < fed_conns.size() ;
k++) {
312 if(fed_conns[
k] && fed_conns[
k]->isConnected()) {
314 edm::LogError(
"SiStripMonitorPedestals") <<
" SiStripMonitorPedestals::analyze: Fed Id " <<
315 fed_conns[
k]->fedId() <<
" Channel " << fed_conns[
k]->fedCh();
318 else edm::LogError(
"SiStripMonitorPedestals") <<
" SiStripMonitorPedestals::analyze: Channel " <<
319 fed_conns[
k]->fedCh();
326 if ( digis->data.empty() ) {
327 edm::LogError(
"MonitorDigi_tmp") <<
"[SiStripRawDigiToRaw::createFedBuffers] Zero digis found!";
335 std::vector<float>
tmp;
341 for (std::vector<float>::const_iterator iped=tmp.begin(); iped!=tmp.end();iped++) {
342 int iapv =
int (ibin/numberCMBlocks);
349 std::vector<float>
tmp;
353 for (std::vector<float>::const_iterator it=tmp.begin(); it!=tmp.end();it++) {
364 std::vector<float>
tmp;
368 int numberOfApvs =
int(tmp.size()/128.);
369 for(
int i=0;
i<numberOfApvs;
i++){
370 std::vector<float> myPedPerApv;
373 avarage = std::accumulate(myPedPerApv.begin(), myPedPerApv.end(), avarage);
374 avarage = avarage/128.;
380 for (std::vector<float>::const_iterator iped=tmp.begin(); iped!=tmp.end();iped++) {
381 int napv =
int(ibin / 128.);
383 float last_value = (local_modmes.
PedsPerStrip)->getBinContent(ibin);
384 if(last_value != 0.){
385 (local_modmes.
PedsPerStrip)->setBinContent(ibin,(static_cast<float>(*iped) + last_value)/2.);
387 (local_modmes.
PedsPerStrip)->setBinContent(ibin,static_cast<float>(*iped));
397 for (std::vector<float>::const_iterator iped=tmp.begin(); iped!=tmp.end();iped++) {
402 if(last_value != 0.){
403 (local_modmes.
CMSubNoisePerStrip)->setBinContent(ibin,(static_cast<float>(*iped)+last_value)/2.);
415 for (std::vector<float>::const_iterator iped=tmp.begin(); iped!=tmp.end();iped++) {
417 (local_modmes.
RawNoiseProfile)->
Fill(static_cast<double>(ibin*1.),
static_cast<float>(*iped));
419 if(last_value != 0.){
420 (local_modmes.
RawNoisePerStrip)->setBinContent(ibin,(static_cast<float>(*iped)+last_value)/2.);
422 (local_modmes.
RawNoisePerStrip)->setBinContent(ibin,static_cast<float>(*iped));
431 for (TkApvMask::MaskType::const_iterator iped=temp.begin(); iped!=temp.end();iped++) {
458 if (outputMEsInRootFile) {
468 edm::LogInfo(
"SiStripMonitorPedestals") <<
"SiStripMonitorPedestals::EndJob: " 475 std::map<uint32_t, ModMEs >::iterator
pos =
PedMEs.find(idet);
476 if (pos !=
PedMEs.end()) {
477 ModMEs mod_me = pos->second;
512 for (std::map<uint32_t, ModMEs >::const_iterator
i =
PedMEs.begin() ;
i!=
PedMEs.end() ;
i++) {
513 uint32_t detid =
i->first;
514 ModMEs local_modmes =
i->second;
515 edm::LogInfo(
"SiStripMonitorPedestals") <<
" SiStripMonitorPedestals::analyze: " <<
516 " Get Ped/Noise/Bad Strips from CondDb for DetId " << detid;
523 for(
int istrip=0;istrip<nStrip;++istrip){
529 edm::LogError(
"SiStripMonitorPedestals") <<
"[SiStripMonitorPedestals::analyze] cms::Exception accessing SiStripPedestalsService_.getPedestal("<<detid<<
","<<istrip<<
") : " <<
" " << e.
what() ;
537 edm::LogError(
"SiStripMonitorPedestals") <<
"[SiStripMonitorPedestals::analyze] cms::Exception accessing SiStripNoiseService_.getNoise("<<detid<<
","<<istrip<<
") : " <<
" " << e.
what() ;
546 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 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