Skip to content

Commit

Permalink
backport of cms-sw#9242
Browse files Browse the repository at this point in the history
  • Loading branch information
rrabadan committed Jul 16, 2015
1 parent 700833f commit 34dc182
Show file tree
Hide file tree
Showing 7 changed files with 115 additions and 18 deletions.
23 changes: 23 additions & 0 deletions DQM/SiStripMonitorClient/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,26 @@ This script produces a root file and png files of the occupancy plots of the mod
https://cmsweb.cern.ch/dqm/offline/data/browse/ROOT/OfflineData/

To access the DQM file a valid certificate and key has to be provided to the script

#### TkMap_ script_ automatic_DB
`TkMap_script_automatic_DB.sh <Dataset_type> <runNumber>`

The script produces a set of png trackerMaps, a list of the bad components found by the prompt calibration loop as well as lists of the modules which are BAD from quality tests and modules with the largest digi, cluster, off trackcluster occupancy for the `<Dataset_type>`specified by `<runNumber>`. The `<Dataset_type>`and `<runNumber>`must match the names used in this site: https://cmsweb.cern.ch/dqm/offline/data/browse/ROOT/OfflineData/

##SiStripOfflineDQM

Configure the TrackerMaps to be created by the SiStrip Offline DQM Client using `"TkMapOptions"`. VPSet. The clientloops over the entries of ` "TkMapOptions" ` and generates the trackerMap specified by the string `mapName`. The mapName menu is:

-QTestAlarm
-FractionOfBadChannels
-NumberOfCluster
-NumberOfDigi
-NumberOfOfffTrackCluster
-NumberOfOnTrackCluster
-StoNCorrOnTrack
-NApvShots
-MedianChargeApvShots

In case `mapName=QTestAlarm`, the client fills the tracker Map with QTest Alarms and SiStripQuality bad modules, it also produces a text file with the number of bad modules and a list of bad modules per partition. In all other cases the tracker Map is filled from Histograms.

Create a sorted list of the N modules with the largest digi, cluster, off track cluster occupancy when the corresponding tracker maps are produced by setting `TopModules` as True in the corresponding entry in `"TkMapOptions"`. To choose the number of modules to be sort use int parameter `numberTopModules`.
3 changes: 2 additions & 1 deletion DQM/SiStripMonitorClient/data/index_template_TKMap.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ <H1>Analysis of run RunNumber </H1>
<LI><A href="QTestAlarm.png">Modules which are BAD from quality tests</a> (<A href="QTestAlarm_fed.png">FED view</a>, <A href="fedmap.html">interactive</a>) (<A href="QTestAlarm_psu.png">PSU view</a>, <A href="psumap.html">interactive</a>)
<LI><A href="QualityTest_runRunNumber.txt">List of Modules which are BAD from quality tests</a>
(<A href="QualityTestOBSOLETE_runRunNumber.txt">obsolete version</a>)
<LI><A href="ModuleDifference_RunNumber.txt">Difference in the list of bad modules compared with previous run - text</a>
<LI><A href="ModuleDifference_RunNumber.txt">Difference in the list of bad modules compared with previous run - text</a>
<LI><A href="TopModulesList.log">List of the modules with the highest values</a>
<LI><A href="FractionOfBadChannels.png">FED errors per modules</a>
<LI><A href="NumberOfDigi.png">Number of digis per module</a>
<LI><A href="NumberOfCluster.png">Number of clusters per module</a>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ <H1>Analysis of run RunNumber </H1>
<LI><A href="QualityTest_runRunNumber.txt">List of Modules which are BAD from quality tests</a>
(<A href="QualityTestOBSOLETE_runRunNumber.txt">obsolete version</a>)
<LI><A href="ModuleDifference_RunNumber.txt">Difference in the list of bad modules compared with previous run - text</a>
<LI><A href="TopModulesList.log">List of the modules with the highest values</a>
<LI><A href="FractionOfBadChannels.png">FED errors per module</a>
<LI><A href="NumberOfDigi.png">Number of digis per module</a>
<LI><A href="NumberOfCluster.png">Number of clusters per module</a>
Expand Down
8 changes: 6 additions & 2 deletions DQM/SiStripMonitorClient/interface/SiStripTrackerMapCreator.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,14 @@ class SiStripTrackerMapCreator {

void paintTkMapFromAlarm(uint32_t det_id, const TrackerTopology* tTopo,
DQMStore* dqm_store, bool isBad=false, std::map<unsigned int,std::string>* badmodmap=0);
void paintTkMapFromHistogram(DQMStore* dqm_store, MonitorElement* me, std::string& map_type);
void setTkMapFromHistogram(DQMStore* dqm_store, std::string& htype);
void paintTkMapFromHistogram(DQMStore* dqm_store, MonitorElement* me, std::string& map_type, std::vector<std::pair<float,uint32_t> >* topNmodVec);
void setTkMapFromHistogram(DQMStore* dqm_store, std::string& htype, const edm::EventSetup& eSetup);
void setTkMapFromAlarm(DQMStore* dqm_store, const edm::EventSetup& eSetup);
void setTkMapRange(std::string& map_type);
void setTkMapRangeOffline();
uint16_t getDetectorFlagAndComment(DQMStore* dqm_store, uint32_t det_id, const TrackerTopology* tTopo, std::ostringstream& comment);
void printBadModuleList(std::map<unsigned int,std::string>* badmodmap, const edm::EventSetup& eSetup);
void printTopModules(std::vector<std::pair<float,uint32_t> >* topNmodVec, const edm::EventSetup& eSetup);

TrackerMap* trackerMap_;
std::string tkMapName_;
Expand All @@ -64,5 +65,8 @@ class SiStripTrackerMapCreator {
uint32_t cached_detid;
int16_t cached_layer;
TkLayerMap::XYbin cached_XYbin;
bool topModules;
int32_t numTopModules;
std::string topModLabel;
};
#endif
5 changes: 3 additions & 2 deletions DQM/SiStripMonitorClient/scripts/TkMap_script_automatic_DB.sh
Original file line number Diff line number Diff line change
Expand Up @@ -192,8 +192,9 @@ do
rm -f *.xml
rm -f *svg

# mkdir -p /data/users/event_display/${DataLocalDir}/${dest}/${nnn}/${Run_numb}/$thisDataset 2> /dev/null
# mkdir -p /data/users/event_display/${DataLocalDir}/${dest}/${nnn}/${Run_numb}/$thisDataset #2> /dev/null
# cp -r ${Run_numb}/$thisDataset /data/users/event_display/Data2011/${dest}/${nnn}/${Run_numb}/
# cp -r ${Run_numb}/$thisDataset /data/users/event_display/${DataLocalDir}/${dest}/${nnn}/${Run_numb}/$thisDataset
ssh cctrack@vocms061 "mkdir -p /data/users/event_display/${DataLocalDir}/${dest}/${nnn}/${Run_numb}/$thisDataset 2> /dev/null"
scp -r * cctrack@vocms061:/data/users/event_display/${DataLocalDir}/${dest}/${nnn}/${Run_numb}/$thisDataset

Expand All @@ -206,4 +207,4 @@ do
#done with loop over thisDataset
done

done
done
75 changes: 69 additions & 6 deletions DQM/SiStripMonitorClient/src/SiStripTrackerMapCreator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ void SiStripTrackerMapCreator::create(const edm::ParameterSet & tkmapPset,
*/
} else {
trackerMap_->fill_all_blank();
setTkMapFromHistogram(dqm_store, map_type);
setTkMapFromHistogram(dqm_store, map_type, eSetup);
setTkMapRange(map_type);
}
trackerMap_->printonline();
Expand Down Expand Up @@ -151,11 +151,26 @@ void SiStripTrackerMapCreator::createForOffline(const edm::ParameterSet & tkmapP
std::string tmap_title = " Tracker Map from " + map_type;
trackerMap_->setTitle(tmap_title);

if(tkmapPset.exists("TopModules"))
topModules=tkmapPset.getUntrackedParameter<bool>("TopModules");
else
topModules=false;

if(tkmapPset.exists("numberTopModules"))
numTopModules=tkmapPset.getUntrackedParameter<int32_t>("numberTopModules");
else
numTopModules = 20;

if (tkmapPset.exists("topModLabel"))
topModLabel=tkmapPset.getUntrackedParameter<int32_t>("topModLabel");
else
topModLabel = " top Modules " + map_type;

if (map_type == "QTestAlarm") {
setTkMapFromAlarm(dqm_store, eSetup);
}
else {
setTkMapFromHistogram(dqm_store, map_type);
setTkMapFromHistogram(dqm_store, map_type, eSetup);
}
// if not overwitten by manual configuration min=0 and max= mean value * meanToMaxFactor_
setTkMapRangeOffline();
Expand Down Expand Up @@ -335,7 +350,7 @@ void SiStripTrackerMapCreator::paintTkMapFromAlarm(uint32_t det_id, const Tracke

//
// -- Paint Tracker Map from TkHistoMap Histograms
void SiStripTrackerMapCreator::setTkMapFromHistogram(DQMStore* dqm_store, std::string& htype) {
void SiStripTrackerMapCreator::setTkMapFromHistogram(DQMStore* dqm_store, std::string& htype, const edm::EventSetup& eSetup) {
dqm_store->cd();

std::string mdir = "MechanicalView";
Expand All @@ -353,6 +368,7 @@ void SiStripTrackerMapCreator::setTkMapFromHistogram(DQMStore* dqm_store, std::s
nDet = 0;
tkMapMax_ = 0.0;
tkMapMin_ = 0.0;
std::vector<std::pair<float,uint32_t> >* topNmodVec = new std::vector<std::pair<float,uint32_t> >;

for (std::vector<std::string>::const_iterator it = subdet_folder.begin(); it != subdet_folder.end(); it++) {
std::string dname = mechanicalview_dir + "/" + (*it);
Expand All @@ -377,14 +393,56 @@ void SiStripTrackerMapCreator::setTkMapFromHistogram(DQMStore* dqm_store, std::s
}
}
if (tkhmap_me != 0) {
paintTkMapFromHistogram(dqm_store,tkhmap_me, htype);
if (topModules){
paintTkMapFromHistogram(dqm_store,tkhmap_me, htype, topNmodVec);
}
else paintTkMapFromHistogram(dqm_store,tkhmap_me, htype, 0);
}
}
dqm_store->cd(mechanicalview_dir);
}
dqm_store->cd();
if (topModules) printTopModules(topNmodVec, eSetup);
delete topNmodVec;
}

void SiStripTrackerMapCreator::printTopModules(std::vector<std::pair<float,uint32_t> >* topNmodVec, const edm::EventSetup& eSetup){
//, const edm::EventSetup& eSetup

//////////////Retrieve tracker topology from geometry
edm::ESHandle<TrackerTopology> tTopoHandle;
eSetup.get<IdealGeometryRecord>().get(tTopoHandle);
const TrackerTopology* const tTopo = tTopoHandle.product();

std::sort(topNmodVec->rbegin(), topNmodVec->rend());
topNmodVec->resize(numTopModules);

edm::LogVerbatim("TopModules") << topModLabel;
edm::LogVerbatim("TopModules") << "------------------------------------------------------";

for (std::vector<std::pair<float, uint32_t> >::const_iterator itNmod = topNmodVec->begin(); itNmod != topNmodVec->end(); itNmod++){
std::pair<float, uint32_t> aPair=(*itNmod);
uint32_t det_id = aPair.second;
std::ostringstream comment;
std::string subdetector;
SiStripDetId ssdetid(aPair.second);
if(ssdetid.subDetector()==SiStripDetId::TIB) subdetector = "TIB ";
if(ssdetid.subDetector()==SiStripDetId::TID){
if(tTopo->tidSide(ssdetid)==1) subdetector = "TID/MINUS ";
if(tTopo->tidSide(ssdetid)==2) subdetector = "TID/PLUS ";
}
if(ssdetid.subDetector()==SiStripDetId::TOB) subdetector = "TOB ";
if(ssdetid.subDetector()==SiStripDetId::TEC){
if(tTopo->tecSide(ssdetid)==1) subdetector = "TEC/MINUS ";
if(tTopo->tecSide(ssdetid)==2) subdetector = "TEC/PLUS ";
}
uint16_t flag = getDetectorFlagAndComment(0, det_id, tTopo, comment);
if (flag == 0) edm::LogVerbatim("TopModules") << subdetector << comment.str() << " value: "<< aPair.first;
}
edm::LogVerbatim("TopModules") << "------------------------------------------------------";
}
void SiStripTrackerMapCreator::paintTkMapFromHistogram(DQMStore* dqm_store, MonitorElement* me, std::string& htype) {

void SiStripTrackerMapCreator::paintTkMapFromHistogram(DQMStore* dqm_store, MonitorElement* me, std::string& htype, std::vector<std::pair<float, uint32_t> >* topNmodVec) {

// edm::ESHandle<SiStripQuality> ssq;

Expand Down Expand Up @@ -426,6 +484,11 @@ void SiStripTrackerMapCreator::paintTkMapFromHistogram(DQMStore* dqm_store, Moni
trackerMap_->fill_current_val(det_id, fval);
}
tkMapMax_ += fval;
if(topNmodVec){
//std::ostringstream ss; ss << fval;
auto detPair = std::make_pair(fval,det_id);
topNmodVec->push_back(detPair);
}
}
}
}
Expand Down Expand Up @@ -482,7 +545,7 @@ uint16_t SiStripTrackerMapCreator::getDetectorFlagAndComment(DQMStore* dqm_store
if(conns.size()==1) { comment << " "; }
if(conns.size()==2) { comment << " "; }
// }

if(!dqm_store) return flag;
// get PSU channel corresponding to the det_id
/*
comment << " PSU: ";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,13 @@
options.parseArguments()

process.MessageLogger = cms.Service("MessageLogger",
destinations = cms.untracked.vstring('cout','cerr','PCLBadComponents','QTBadModules'), #Reader, cout
destinations = cms.untracked.vstring('cout','cerr','PCLBadComponents','QTBadModules','TopModulesList'), #Reader, cout
categories = cms.untracked.vstring('SiStripQualityStatistics',
'BadModuleList',
'TkMapParameters',
'TkMapToBeSaved',
'PSUMapToBeSaved'), #Reader, cout
'PSUMapToBeSaved',
'TopModules'), #Reader, cout
debugModules = cms.untracked.vstring('siStripDigis',
'siStripClusters',
'siStripZeroSuppression',
Expand All @@ -53,7 +54,11 @@
QTBadModules = cms.untracked.PSet(threshold = cms.untracked.string('INFO'),
default = cms.untracked.PSet(limit=cms.untracked.int32(0)),
BadModuleList = cms.untracked.PSet(limit=cms.untracked.int32(100000))
)
),
TopModulesList = cms.untracked.PSet(threshold = cms.untracked.string('INFO'),
default = cms.untracked.PSet(limit=cms.untracked.int32(0)),
TopModules = cms.untracked.PSet(limit=cms.untracked.int32(100000))
)

)

Expand All @@ -73,7 +78,6 @@
process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_condDBv2_cff')
from Configuration.AlCa.GlobalTag_condDBv2 import GlobalTag
process.GlobalTag = GlobalTag(process.GlobalTag, options.globalTag, '')

# loading TrackerTopologyEP via GeometryDB (since 62x)
process.load('Configuration.StandardSequences.GeometryDB_cff')

Expand Down Expand Up @@ -103,9 +107,9 @@
TkMapOptions = cms.untracked.VPSet(
cms.PSet(mapName=cms.untracked.string('QTestAlarm'),fedMap=cms.untracked.bool(True),useSSQuality=cms.untracked.bool(True),ssqLabel=cms.untracked.string(""),psuMap=cms.untracked.bool(True),loadLVCabling=cms.untracked.bool(True),mapMax=cms.untracked.double(1.)),
cms.PSet(mapName=cms.untracked.string('FractionOfBadChannels'),mapMax=cms.untracked.double(-1.),logScale=cms.untracked.bool(True)),
cms.PSet(mapName=cms.untracked.string('NumberOfCluster')),
cms.PSet(mapName=cms.untracked.string('NumberOfDigi')),
cms.PSet(mapName=cms.untracked.string('NumberOfOfffTrackCluster')),
cms.PSet(mapName=cms.untracked.string('NumberOfCluster'),TopModules=cms.untracked.bool(True),numberTopModules=cms.untracked.int32(20)),
cms.PSet(mapName=cms.untracked.string('NumberOfDigi'),TopModules=cms.untracked.bool(True)),
cms.PSet(mapName=cms.untracked.string('NumberOfOfffTrackCluster'),TopModules=cms.untracked.bool(True)),
cms.PSet(mapName=cms.untracked.string('NumberOfOfffTrackCluster'),mapSuffix=cms.untracked.string("_autoscale"),mapMax=cms.untracked.double(-1.)),
cms.PSet(mapName=cms.untracked.string('NumberOfOnTrackCluster')),
cms.PSet(mapName=cms.untracked.string('StoNCorrOnTrack')),
Expand Down

0 comments on commit 34dc182

Please sign in to comment.