24 writeHisto_ = parameterSet_.getUntrackedParameter<
bool>(
"writeHisto",
false);
26 outputDir_ = parameterSet_.getUntrackedParameter<
string>(
"outputDir",
".");
38 performanceSummary->setRunNumber(run.
run());
41 firstEventInRun =
true;
47 performanceSummary->setLuminosityBlock(luminosityBlock.
luminosityBlock());
53 if (firstEventInRun) {
54 firstEventInRun =
false;
56 performanceSummary->setTimeStamp(event.
time().
value());
66 performanceSummary->setNumberOfEvents(nEventsInRun);
69 fillPerformanceSummary();
73 ostringstream endRunOutputFile;
74 endRunOutputFile << outputDir_ <<
"/SiPixelHistoricInfoEDAClient_" << run.
run() <<
".root";
75 dbe_->save(endRunOutputFile.str());
82 ostringstream endJobOutputFile;
83 endJobOutputFile << outputDir_ <<
"/SiPixelHistoricInfoEDAClient_endJob.root";
84 dbe_->save(endJobOutputFile.str());
90 mapOfdetIDtoMEs.clear();
92 vector<string> listOfMEswithFullPath;
93 dbe_->getContents(listOfMEswithFullPath);
95 for (vector<string>::const_iterator iMEstr = listOfMEswithFullPath.begin();
96 iMEstr!=listOfMEswithFullPath.end(); iMEstr++) {
97 if (printDebug_)
cout << iMEstr->data() << endl;
99 size_t pathLength = iMEstr->find(
":",0);
100 string thePath = iMEstr->substr(0, pathLength);
101 string allHists = iMEstr->substr(pathLength+1);
103 if (thePath.find(
"Pixel",0)!=string::npos) {
104 if (thePath.find(
"Track",0)!=string::npos) {
105 uint32_t newMEdetID = 77;
106 if (thePath.find(
"On", 0)!=string::npos) newMEdetID = 78;
107 if (thePath.find(
"Off",0)!=string::npos) newMEdetID = 79;
109 size_t histnameLength;
111 histnameLength = allHists.find(
",",0);
113 if (histnameLength!=string::npos) {
114 theHist = allHists.substr(0, histnameLength);
115 allHists.erase(0, histnameLength+1);
117 else theHist = allHists;
119 string fullPathHist = thePath +
"/" + theHist;
122 if (mapOfdetIDtoMEs.find(newMEdetID)==mapOfdetIDtoMEs.end()) {
123 vector<MonitorElement*> newMEvector;
124 newMEvector.push_back(newME);
125 mapOfdetIDtoMEs.insert(make_pair(newMEdetID, newMEvector));
127 else (mapOfdetIDtoMEs.find(newMEdetID)->second).push_back(newME);
130 while (histnameLength!=string::npos);
133 size_t histnameLength;
135 histnameLength = allHists.find(
",",0);
137 if (histnameLength!=string::npos) {
138 theHist = allHists.substr(0, histnameLength);
139 allHists.erase(0, histnameLength+1);
141 else theHist = allHists;
143 string fullPathHist = thePath +
"/" + theHist;
146 uint32_t newMEdetID = histogramManager.getRawId(newME->
getName());
148 if (mapOfdetIDtoMEs.find(newMEdetID)==mapOfdetIDtoMEs.end()) {
149 vector<MonitorElement*> newMEvector;
150 newMEvector.push_back(newME);
151 mapOfdetIDtoMEs.insert(make_pair(newMEdetID, newMEvector));
153 else ((mapOfdetIDtoMEs.find(newMEdetID))->
second).push_back(newME);
156 while (histnameLength!=string::npos);
164 for (
map< uint32_t, vector<MonitorElement*> >::const_iterator iMEvec=mapOfdetIDtoMEs.begin();
165 iMEvec!=mapOfdetIDtoMEs.end(); iMEvec++) {
166 uint32_t theMEdetID = iMEvec->first;
167 vector<MonitorElement*> theMEvector = iMEvec->second;
170 cout << theMEdetID <<
":";
for (vector<MonitorElement*>::const_iterator iME = theMEvector.begin();
171 iME!=theMEvector.end(); iME++)
cout << (*iME)->getName() <<
",";
cout << endl;
173 for (vector<MonitorElement*>::const_iterator iME = theMEvector.begin(); iME!=theMEvector.end(); iME++) {
174 string theMEname = (*iME)->getName();
179 if (theMEname.find(
"errorType_siPixelDigis")!=string::npos) {
180 for (
int v=25;
v<40;
v++) {
181 int b = (*iME)->getTH1()->GetXaxis()->FindBin(
v);
182 performanceSummary->setRawDataErrorType(theMEdetID,
v-25, (*iME)->getBinContent(b));
187 else if (theMEdetID==77) {
188 if (theMEname.find(
"ntracks")!=string::npos && theMEname.find(
"InPixVol")==string::npos) {
189 float trkMean=0.0, trkRMS=0.0;
190 if ((*iME)->getBinContent(1)>0.0) {
191 trkMean = float((*iME)->getBinContent(3))/(*iME)->getBinContent(1);
192 trkRMS =
sqrt(trkMean*(trkMean+1.0)/(*iME)->getBinContent(1));
193 performanceSummary->setFractionOfTracks(80, trkMean, trkRMS);
195 trkMean = float((*iME)->getBinContent(4))/(*iME)->getBinContent(1);
196 trkRMS =
sqrt(trkMean*(trkMean+1.0)/(*iME)->getBinContent(1));
197 performanceSummary->setFractionOfTracks(81, trkMean, trkRMS);
201 else if (theMEdetID==78) {
202 if (theMEname.find(
"nclusters_siPixelClusters")!=string::npos) {
203 performanceSummary->setNumberOfOnTrackClusters(80, (*iME)->getBinContent(2));
204 performanceSummary->setNumberOfOnTrackClusters(81, (*iME)->getBinContent(3));
206 if (theMEname.find(
"charge_siPixelClusters_Barrel")!=string::npos) {
207 performanceSummary->setClusterChargeOnTrack(80, (*iME)->getMean(), (*iME)->getRMS());
209 if (theMEname.find(
"charge_siPixelClusters_Endcap")!=string::npos) {
210 performanceSummary->setClusterChargeOnTrack(81, (*iME)->getMean(), (*iME)->getRMS());
212 if (theMEname.find(
"size_siPixelClusters_Barrel")!=string::npos) {
213 performanceSummary->setClusterSizeOnTrack(80, (*iME)->getMean(), (*iME)->getRMS());
215 if (theMEname.find(
"size_siPixelClusters_Endcap")!=string::npos) {
216 performanceSummary->setClusterSizeOnTrack(81, (*iME)->getMean(), (*iME)->getRMS());
219 else if (theMEdetID==79) {
220 if (theMEname.find(
"nclusters_siPixelClusters")!=string::npos) {
221 performanceSummary->setNumberOfOffTrackClusters(80, (*iME)->getBinContent(2));
222 performanceSummary->setNumberOfOffTrackClusters(81, (*iME)->getBinContent(3));
224 if (theMEname.find(
"charge_siPixelClusters_Barrel")!=string::npos) {
225 performanceSummary->setClusterChargeOffTrack(80, (*iME)->getMean(), (*iME)->getRMS());
227 if (theMEname.find(
"charge_siPixelClusters_Endcap")!=string::npos) {
228 performanceSummary->setClusterChargeOffTrack(81, (*iME)->getMean(), (*iME)->getRMS());
230 if (theMEname.find(
"size_siPixelClusters_Barrel")!=string::npos) {
231 performanceSummary->setClusterSizeOffTrack(80, (*iME)->getMean(), (*iME)->getRMS());
233 if (theMEname.find(
"size_siPixelClusters_Endcap")!=string::npos) {
234 performanceSummary->setClusterSizeOffTrack(81, (*iME)->getMean(), (*iME)->getRMS());
239 if (theMEname.find(
"ndigis_siPixelDigis")!=string::npos) {
240 performanceSummary->setNumberOfDigis(theMEdetID, (*iME)->getMean(), (*iME)->getRMS(), (*iME)->getEntries()==0.0);
242 if (theMEname.find(
"adc_siPixelDigis")!=string::npos) {
243 performanceSummary->setADC(theMEdetID, (*iME)->getMean(), (*iME)->getRMS(), (*iME)->getEntries()==0.0);
246 if (theMEname.find(
"nclusters_siPixelClusters")!=string::npos) {
247 performanceSummary->setNumberOfClusters(theMEdetID, (*iME)->getMean(), (*iME)->getRMS(), (*iME)->getEntries()==0.0);
249 if (theMEname.find(
"charge_siPixelClusters")!=string::npos) {
250 performanceSummary->setClusterCharge(theMEdetID, (*iME)->getMean(), (*iME)->getRMS(), (*iME)->getEntries()==0.0);
252 if (theMEname.find(
"size_siPixelClusters")!=string::npos) {
253 performanceSummary->setClusterSize(theMEdetID, (*iME)->getMean(), (*iME)->getRMS(), (*iME)->getEntries()==0.0);
255 if (theMEname.find(
"sizeX_siPixelClusters")!=string::npos) {
256 performanceSummary->setClusterSizeX(theMEdetID, (*iME)->getMean(), (*iME)->getRMS(), (*iME)->getEntries()==0.0);
258 if (theMEname.find(
"sizeY_siPixelClusters")!=string::npos) {
259 performanceSummary->setClusterSizeY(theMEdetID, (*iME)->getMean(), (*iME)->getRMS(), (*iME)->getEntries()==0.0);
262 if (theMEname.find(
"nRecHits_siPixelRecHits")!=string::npos) {
263 performanceSummary->setNumberOfRecHits(theMEdetID, (*iME)->getMean(), (*iME)->getRMS(), (*iME)->getEntries()==0.0);
266 if (theMEname.find(
"residualX_siPixelTrackResiduals")!=string::npos) {
267 performanceSummary->setResidualX(theMEdetID, (*iME)->getMean(), (*iME)->getRMS(), (*iME)->getEntries()==0.0);
269 if (theMEname.find(
"residualY_siPixelTrackResiduals")!=string::npos) {
270 performanceSummary->setResidualY(theMEdetID, (*iME)->getMean(), (*iME)->getRMS(), (*iME)->getEntries()==0.0);
273 if (theMEname.find(
"hitmap_siPixelClusters")!=std::string::npos ||
274 theMEname.find(
"hitmap_siPixelDigis")!=std::string::npos) {
275 int nNoisyCells=0, nEmptyCells=0;
276 for (
int xBin=0; xBin<(*iME)->getNbinsX(); xBin++) {
278 if ((*iME)->getBinContent(xBin+1,
yBin+1)>0.01*(*iME)->getEntries()) nNoisyCells++;
279 if ((*iME)->getBinContent(xBin+1,
yBin+1)==.0 && (*iME)->getBinError(xBin+1,
yBin+1)==0.0) nEmptyCells++;
282 performanceSummary->setNumberOfNoisCells(theMEdetID,
float(nNoisyCells));
283 performanceSummary->setNumberOfDeadCells(theMEdetID,
float(nEmptyCells));
293 if (printDebug_) performanceSummary->printAll();
294 else performanceSummary->print();
295 cout <<
"SiPixelHistoricInfoEDAClient::writeDB()" << endl;
303 "SiPixelPerformanceSummaryRcd");
308 "SiPixelPerformanceSummaryRcd");
311 else LogError(
"writeDB") <<
"service unavailable" << endl;
void fillPerformanceSummary() const
virtual void endLuminosityBlock(const edm::LuminosityBlock &, const edm::EventSetup &)
T getUntrackedParameter(std::string const &, T const &) const
const std::string & getName(void) const
get name of ME
virtual void analyze(const edm::Event &, const edm::EventSetup &)
~SiPixelHistoricInfoEDAClient()
SiPixelHistoricInfoEDAClient(const edm::ParameterSet &)
LuminosityBlockNumber_t luminosityBlock() const
U second(std::pair< T, U > const &p)
void appendSinceTime(T *payloadObj, cond::Time_t sinceTime, const std::string &recordName, bool withlogging=false)
bool isNewTagRequest(const std::string &recordName)
virtual void beginLuminosityBlock(const edm::LuminosityBlock &, const edm::EventSetup &)
cond::Time_t beginOfTime() const
virtual void endRun(const edm::Run &, const edm::EventSetup &)
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
void createNewIOV(T *firstPayloadObj, cond::Time_t firstSinceTime, cond::Time_t firstTillTime, const std::string &recordName, bool withlogging=false)
virtual void beginRun(const edm::Run &, const edm::EventSetup &)
cond::Time_t endOfTime() const
cond::Time_t currentTime() const
TimeValue_t value() const
edm::Timestamp time() const
ParameterSet const & parameterSet(Provenance const &provenance)