Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 77714
b: "refs/heads/CMSSW_7_1_X"
c: b12ece9
h: "refs/heads/CMSSW_7_1_X"
v: v3
  • Loading branch information
Jeff Temple committed Nov 11, 2009
1 parent 27ce4ed commit b93eb44
Show file tree
Hide file tree
Showing 31 changed files with 2,192 additions and 1,867 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
---
refs/heads/gh-pages: 09c786f70121f131b3715aaf3464996502bbeb7e
"refs/heads/CMSSW_7_1_X": 228eba7142cc9c4bc802417dae2124ca7baf2cb0
"refs/heads/CMSSW_7_1_X": b12ece9efc78bf0001871e7ad87ad9676810ce1d
8 changes: 4 additions & 4 deletions trunk/DQM/HcalMonitorClient/interface/HcalBeamClient.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,18 @@ class HcalBeamClient : public HcalBaseClient {

void init(const edm::ParameterSet& ps, DQMStore* dbe, string clientName);

/// Analyze
/// Analyze
void analyze(void);

/// BeginJob
//void beginJob(const EventSetup& c);
void beginJob();
void beginJob(void);

/// EndJob
void endJob(void);

/// BeginRun
void beginRun(void);
//void beginRun(const EventSetup& c);
void beginRun();

/// EndRun
void endRun(void);
Expand Down
2 changes: 2 additions & 0 deletions trunk/DQM/HcalMonitorClient/interface/HcalMonitorClient.h
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ class HcalMonitorClient : public EDAnalyzer{

private:
void removeAllME(void);
void writeDBfile();
/********************************************************/
// The following member variables can be specified in //
// the configuration input file for the process. //
Expand Down Expand Up @@ -196,6 +197,7 @@ class HcalMonitorClient : public EDAnalyzer{

// myquality_ will store status values for each det ID I find
bool dump2database_;
std::string databasedir_;
std::map<HcalDetId, unsigned int> myquality_;
HcalChannelQuality* chanquality_;

Expand Down
9 changes: 5 additions & 4 deletions trunk/DQM/HcalMonitorClient/python/HcalMonitorClient_cfi.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
runningStandalone = cms.untracked.bool(False),
Online = cms.untracked.bool(False),

dump2database = cms.untracked.bool(False), # dumps channel status to text file
dump2database = cms.untracked.bool(False), # dumps channel status to text file
databasedir = cms.untracked.string(''),

# maximum number of lumi blocks to appear in some histograms
Nlumiblocks = cms.untracked.int32(1000),
Expand All @@ -18,8 +19,8 @@
MonitorDaemon = cms.untracked.bool(True),

# run actual client either every N events or M lumi blocks (or both)
diagnosticPrescaleEvt = cms.untracked.int32(200),
diagnosticPrescaleLS = cms.untracked.int32(-1),
diagnosticPrescaleEvt = cms.untracked.int32(-1),
diagnosticPrescaleLS = cms.untracked.int32(1),
resetFreqEvents = cms.untracked.int32(-1),
resetFreqLS = cms.untracked.int32(-1),

Expand Down Expand Up @@ -120,7 +121,6 @@ def setHcalClientValuesFromMonitor(client, origmonitor, debug=False):

client.Online = monitor.Online
client.Nlumiblocks = monitor.Nlumiblocks
client.dump2database = monitor.dump2database

# Beam Client
client.BeamClient = monitor.BeamMonitor
Expand Down Expand Up @@ -173,6 +173,7 @@ def setHcalClientValuesFromMonitor(client, origmonitor, debug=False):
print "HcalMonitorClient values from HcalMonitorModule: "
print "Debug = ", client.debug
print "Online = ", client.Online
print "Dump to database ? ", client.dump2database
print "Nlumiblocks = ", client.Nlumiblocks
print "showTiming = ", client.showTiming
print "PrescaleEvt = ", client.diagnosticPrescaleEvt
Expand Down
24 changes: 5 additions & 19 deletions trunk/DQM/HcalMonitorClient/src/HcalHotCellClient.cc
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,7 @@ void HcalHotCellClient::analyze(void)
void HcalHotCellClient::calculateProblems()
{
getHistograms();
double totalevents=0; // total events processed thus far
if (ievt_<=0) return;
int etabins=0, phibins=0, zside=0;
double problemvalue=0;

Expand All @@ -408,21 +408,7 @@ void HcalHotCellClient::calculateProblems()
for (unsigned int d=0;d<ProblemCellsByDepth.depth.size();++d)
{
if (ProblemCellsByDepth.depth[d]==0) continue;
// All tests have the same number of 'totalevents' stored in their
// underflow bins. As long as one test is being performed, grab value
// from that test. Otherwise, continue
if (hotclient_test_persistent_ && AbovePersistentThresholdCellsByDepth[d]!=0)
totalevents=AbovePersistentThresholdCellsByDepth[d]->GetBinContent(0);
else if (hotclient_test_pedestal_ && AbovePedestalHotCellsByDepth[d]!=0)
totalevents=AbovePedestalHotCellsByDepth[d]->GetBinContent(0);
else if (hotclient_test_neighbor_ && AboveNeighborsHotCellsByDepth[d]!=0)
totalevents=AboveNeighborsHotCellsByDepth[d]->GetBinContent(0);
else if (hotclient_test_energy_ && AboveEnergyThresholdCellsByDepth[d]!=0)
totalevents=AboveEnergyThresholdCellsByDepth[d]->GetBinContent(0);
else
continue;

if (totalevents==0) continue;

// get number of bins for problemcells
etabins=(ProblemCellsByDepth.depth[d]->getTH2F())->GetNbinsX();
phibins=(ProblemCellsByDepth.depth[d]->getTH2F())->GetNbinsY();
Expand All @@ -441,16 +427,16 @@ void HcalHotCellClient::calculateProblems()
problemvalue+=AboveNeighborsHotCellsByDepth[d]->GetBinContent(eta+1,phi+1);
if (hotclient_test_energy_)
problemvalue+=AboveEnergyThresholdCellsByDepth[d]->GetBinContent(eta+1,phi+1);
problemvalue = min(totalevents, problemvalue);
problemvalue = min((double)ievt_, problemvalue);
if (problemvalue==0) continue; // no problem found
zside=0;
if (d<2)
{
if (isHF(eta,d+1))
ieta<0 ? zside = -1 : zside= 1;
}
ProblemCellsByDepth.depth[d]->Fill(ieta+zside,phi+1,problemvalue/totalevents);
ProblemCells->Fill(ieta+zside,phi+1,problemvalue/totalevents);
ProblemCellsByDepth.depth[d]->Fill(ieta+zside,phi+1,problemvalue/ievt_);
ProblemCells->Fill(ieta+zside,phi+1,problemvalue/ievt_);
} // loop over phi
} // loop over eta
} //loop over d
Expand Down
100 changes: 56 additions & 44 deletions trunk/DQM/HcalMonitorClient/src/HcalMonitorClient.cc
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ void HcalMonitorClient::initialize(const ParameterSet& ps){
}

dump2database_ = ps.getUntrackedParameter<bool>("dump2database",false);
databasedir_ = ps.getUntrackedParameter<std::string>("databasedir","");

// clients' constructors
if( ps.getUntrackedParameter<bool>("SummaryClient", true) )
Expand Down Expand Up @@ -270,7 +271,7 @@ void HcalMonitorClient::beginRun(const Run& r, const EventSetup& c) {

if (debug_>0)
std::cout << endl<<"HcalMonitorClient: Standard beginRun() for run " << r.id().run() << endl<<endl;

myquality_.clear(); // remove old quality flag contents at the start of each run
if( summary_client_ ) summary_client_->beginRun();
if( dataformat_client_ ) dataformat_client_->beginRun();
if( digi_client_ ) digi_client_->beginRun();
Expand All @@ -290,7 +291,7 @@ void HcalMonitorClient::beginRun(const Run& r, const EventSetup& c) {
/////////////////////////////////////////////////////////

if (!dump2database_) return;

// Get current channel quality
edm::ESHandle<HcalChannelQuality> p;
c.get<HcalChannelQualityRcd>().get(p);
chanquality_= new HcalChannelQuality(*p.product());
Expand Down Expand Up @@ -356,48 +357,58 @@ void HcalMonitorClient::endRun(const Run& r, const EventSetup& c) {
if( detdiaglas_client_ ) detdiaglas_client_->endRun();
/////////////////////////////////////////////////////////
if( summary_client_) summary_client_->endRun();


// dumping to database

// need to add separate function to do this!!!

if (dump2database_)
writeDBfile();
return;
}

void HcalMonitorClient::writeDBfile()

{
if (!dump2database_) return;
if (debug_>0) std::cout <<"<HcalMonitorClient::writeDBfile> Writing file for database"<<endl;
std::vector<DetId> mydetids = chanquality_->getAllChannels();
HcalChannelQuality* newChanQual = new HcalChannelQuality();
for (unsigned int i=0;i<mydetids.size();++i)
{
if (debug_>0) std::cout <<"<HcalMonitorModule::endJob> Writing file for database"<<endl;
std::vector<DetId> mydetids = chanquality_->getAllChannels();
HcalChannelQuality* newChanQual = new HcalChannelQuality();
for (unsigned int i=0;i<mydetids.size();++i)
if (mydetids[i].det()!=DetId::Hcal) continue; // not hcal

HcalDetId id=mydetids[i];
// get original channel status item
const HcalChannelStatus* origstatus=chanquality_->getValues(mydetids[i]);
// make copy of status
HcalChannelStatus* mystatus=new HcalChannelStatus(origstatus->rawId(),origstatus->getValue());
// loop over myquality flags
if (myquality_.find(id)!=myquality_.end())
{
if (mydetids[i].det()!=DetId::Hcal) continue; // not hcal

HcalDetId id=mydetids[i];
// get original channel status item
const HcalChannelStatus* origstatus=chanquality_->getValues(mydetids[i]);
// make copy of status
HcalChannelStatus* mystatus=new HcalChannelStatus(origstatus->rawId(),origstatus->getValue());
// loop over myquality flags
if (myquality_.find(id)!=myquality_.end())
{

// check dead cells
if ((myquality_[id]>>HcalChannelStatus::HcalCellDead)&0x1)
mystatus->setBit(HcalChannelStatus::HcalCellDead);
else
mystatus->unsetBit(HcalChannelStatus::HcalCellDead);
// check hot cells
if ((myquality_[id]>>HcalChannelStatus::HcalCellHot)&0x1)
mystatus->setBit(HcalChannelStatus::HcalCellHot);
else
mystatus->unsetBit(HcalChannelStatus::HcalCellHot);
} // if (myquality_.find_...)
newChanQual->addValues(*mystatus);
} // for (unsigned int i=0;...)

// check dead cells
if ((myquality_[id]>>HcalChannelStatus::HcalCellDead)&0x1)
mystatus->setBit(HcalChannelStatus::HcalCellDead);
else
mystatus->unsetBit(HcalChannelStatus::HcalCellDead);
// check hot cells
if ((myquality_[id]>>HcalChannelStatus::HcalCellHot)&0x1)
mystatus->setBit(HcalChannelStatus::HcalCellHot);
else
mystatus->unsetBit(HcalChannelStatus::HcalCellHot);
} // if (myquality_.find_...)
newChanQual->addValues(*mystatus);
} // for (unsigned int i=0;...)
// Now dump out to text file
std::ostringstream file;
file <<"HcalDQMstatus_"<<irun_<<".txt";
std::ofstream outStream(file.str().c_str());
HcalDbASCIIIO::dumpObject (outStream, (*newChanQual));

} // if (dump2databse_)

}
std::ostringstream file;
if (databasedir_!="")
databasedir_=databasedir_+"/";
file <<databasedir_<<"HcalDQMstatus_"<<irun_<<".txt";
std::ofstream outStream(file.str().c_str());
HcalDbASCIIIO::dumpObject (outStream, (*newChanQual));
return;
} // HcalMonitorClient::writeDBfile()

//--------------------------------------------------------
void HcalMonitorClient::beginLuminosityBlock(const LuminosityBlock &l, const EventSetup &c)
Expand Down Expand Up @@ -465,18 +476,19 @@ void HcalMonitorClient::analyze(const Event& e, const edm::EventSetup& eventSetu
if( summary_client_ )
summary_client_->incrementCounters(); // All this does is increment a counter.

if ( runningStandalone_ || prescale()) return;

else analyze();
if (ievt_%50000==10000) writeDBfile(); // write to db every 50k events, starting with event 10000 -- add cfg values some day?
if ( runningStandalone_) return;

// run if we want to check individual events, and if this event isn't prescaled
if (prescaleEvt_>0 && !prescale())
analyze();
}


//--------------------------------------------------------
void HcalMonitorClient::analyze(){
if (debug_>0)
std::cout <<"<HcalMonitorClient> Entered HcalMonitorClient::analyze()"<<endl;

//nevt_++; // counter not currently displayed anywhere
if(debug_>1) std::cout<<"\nHcal Monitor Client heartbeat...."<<endl;

createTests();
Expand Down
2 changes: 1 addition & 1 deletion trunk/DQM/HcalMonitorClient/src/HcalSummaryClient.cc
Original file line number Diff line number Diff line change
Expand Up @@ -763,7 +763,7 @@ void HcalSummaryClient::analyze_subtask(SubTaskSummaryStatus &s)
me=dqmStore_->get(name.str().c_str());

if (!me && debug_>0)
std::cout <<"<HcalSummaryClient::analyze_subtask> CAN'T FIND HISTOGRAM WITH NAME: "<<name.str().c_str()<<std::endl;
std::cout <<"<HcalSummaryClient::analyze_subtask> CAN'T FIND HISTOGRAM WITH NAME: '"<<name.str().c_str()<<"'"<<std::endl;
else if (me)
{
hist=me->getTH2F();
Expand Down
Loading

0 comments on commit b93eb44

Please sign in to comment.