28 |
|
#include "FWCore/ParameterSet/interface/ParameterSet.h" |
29 |
|
#include "FWCore/Framework/interface/ESHandle.h" |
30 |
|
#include "FWCore/Utilities/interface/Exception.h" |
31 |
+ |
#include "DQMServices/Core/interface/DQMStore.h" |
32 |
+ |
#include "DQMServices/Core/interface/MonitorElement.h" |
33 |
+ |
#include "FWCore/ServiceRegistry/interface/Service.h" |
34 |
|
|
35 |
|
using namespace edm; |
36 |
|
|
136 |
|
|
137 |
|
|
138 |
|
// Create the root file |
139 |
< |
theFile = new TFile(theRootFileName.c_str(), "RECREATE"); |
140 |
< |
|
139 |
> |
// theFile = new TFile(theRootFileName.c_str(), "RECREATE"); |
140 |
> |
|
141 |
> |
theDQMStore = edm::Service<DQMStore>().operator->(); |
142 |
|
|
143 |
|
init=false; |
144 |
|
|
500 |
|
|
501 |
|
/* Destructor */ |
502 |
|
DTOfflineAnalyzer::~DTOfflineAnalyzer() { |
499 |
– |
theFile->cd(); |
503 |
|
if(doTrig)LabelTriggerMatrix(); // Trigger Matrix Labels |
504 |
< |
theFile->Write(); |
505 |
< |
theFile->Close(); |
504 |
> |
theDQMStore->rmdir("DT/DTOfflineAnalyzer");// theFile->cd(); |
505 |
> |
// theFile->Write(); |
506 |
> |
// theFile->Close(); |
507 |
|
} // end destructor ================================================================ |
508 |
|
|
509 |
|
// tools for trigger analysis.....============================================== |
554 |
|
|
555 |
|
// Labels for TriggerMatrix: |
556 |
|
|
557 |
< |
char * lab[]={"no trig"," ","MB1","MB2","MB3","MB4"," ","1 & 2","1 & 3","1 & 4","2 & 3","2 & 4", |
557 |
> |
string lab[]={"no trig"," ","MB1","MB2","MB3","MB4"," ","1 & 2","1 & 3","1 & 4","2 & 3","2 & 4", |
558 |
|
"3 & 4"," ","1 & 2 & 3","1 & 2 & 4","1 & 3 & 4","2 & 3 & 4"," ","1 & 2 & 3 & 4"}; |
559 |
|
for(int iw=0;iw<5;iw++){ |
560 |
|
if(doWheel[iw]){ |
561 |
|
for (int ise=1; ise<13; ise++) { |
562 |
|
stringstream hName; |
563 |
|
hName << "TriggerMatrix" << Whname[iw] << "_S" << ise ; |
564 |
< |
for (int ibin=1; ibin<21; ibin++) histo(hName.str())->GetXaxis()->SetBinLabel(ibin,lab[ibin-1]); |
564 |
> |
for (int ibin=1; ibin<21; ibin++) histo(hName.str())->GetXaxis()->SetBinLabel(ibin,(lab[ibin-1]).c_str()); |
565 |
|
} |
566 |
|
}} |
567 |
|
|
1316 |
|
for (int ise=0;ise<12;ise++) |
1317 |
|
for(int ist=0;ist<4;ist++) hasTr[iw][ise][ist]=false; |
1318 |
|
//bool SecthasTr[]={false,false,false,false,false,false,false,false,false,false,false,false}; |
1319 |
< |
bool SecthasTr[5][12]={false,false,false,false,false,false,false,false,false,false,false,false |
1320 |
< |
,false,false,false,false,false,false,false,false,false,false,false,false |
1321 |
< |
,false,false,false,false,false,false,false,false,false,false,false,false |
1322 |
< |
,false,false,false,false,false,false,false,false,false,false,false,false |
1323 |
< |
,false,false,false,false,false,false,false,false,false,false,false,false}; |
1319 |
> |
bool SecthasTr[5][12]={{false,false,false,false,false,false,false,false,false,false,false,false} |
1320 |
> |
,{false,false,false,false,false,false,false,false,false,false,false,false} |
1321 |
> |
,{false,false,false,false,false,false,false,false,false,false,false,false} |
1322 |
> |
,{false,false,false,false,false,false,false,false,false,false,false,false} |
1323 |
> |
,{false,false,false,false,false,false,false,false,false,false,false,false}}; |
1324 |
|
|
1325 |
|
int SCsect=0; int SCst=0; |
1326 |
|
|
1484 |
|
// utilities ########################################### |
1485 |
|
|
1486 |
|
TH1F* DTOfflineAnalyzer::histo(const string& name) const{ |
1487 |
< |
theFile->cd(); |
1488 |
< |
if (TH1F* h = dynamic_cast<TH1F*>(theFile->Get(name.c_str())) ) return h; |
1489 |
< |
else throw cms::Exception("DTOfflineAnalyzer") << " Not a TH1F " << name; |
1487 |
> |
MonitorElement* me = theDQMStore->get(("DT/DTOfflineAnalyzer/"+name).c_str()); |
1488 |
> |
if (!me) throw cms::Exception("DTOfflineAnalyzer") << " ME not existing " << name; |
1489 |
> |
TH1F* histo = me->getTH1F(); |
1490 |
> |
if (!histo)cms::Exception("DTOfflineAnalyzer") << " Not a TH1F " << name; |
1491 |
> |
return histo; |
1492 |
|
} |
1493 |
|
|
1494 |
|
TH2F* DTOfflineAnalyzer::histo2d(const string& name) const{ |
1495 |
< |
if (TH2F* h = dynamic_cast<TH2F*>(theFile->Get(name.c_str())) ) return h; |
1496 |
< |
else throw cms::Exception("DTOfflineAnalyzer") << " Not a TH2F " << name; |
1495 |
> |
MonitorElement* me = theDQMStore->get(("DT/DTOfflineAnalyzer/"+name).c_str()); |
1496 |
> |
if (!me) throw cms::Exception("DTOfflineAnalyzer") << " ME not existing " << name; |
1497 |
> |
TH2F* histo = me->getTH2F(); |
1498 |
> |
if (!histo)cms::Exception("DTOfflineAnalyzer") << " Not a TH2F " << name; |
1499 |
> |
return histo; |
1500 |
|
} |
1501 |
|
|
1502 |
|
bool DTOfflineAnalyzer::getLCT(LCTType t) const { |
1547 |
|
stringstream hTitle; |
1548 |
|
hName << name << suffix; |
1549 |
|
hTitle << title << suffix; |
1550 |
< |
TH1F * _h=new TH1F(hName.str().c_str(), hTitle.str().c_str(), nbin,binMin,binMax); |
1551 |
< |
_h->SetDirectory(theFile); // Needed when the input is a root file |
1550 |
> |
theDQMStore->setCurrentFolder("DT/DTOfflineAnalyzer"); |
1551 |
> |
theDQMStore->book1D(hName.str().c_str(), hTitle.str().c_str(), nbin,binMin,binMax); |
1552 |
> |
// TH1F * _h=new TH1F(hName.str().c_str(), hTitle.str().c_str(), nbin,binMin,binMax); |
1553 |
> |
// _h->SetDirectory(theFile); // Needed when the input is a root file |
1554 |
|
} |
1555 |
|
|
1556 |
|
void DTOfflineAnalyzer::createTH2F(const std::string& name, |
1566 |
|
stringstream hTitle; |
1567 |
|
hName << name << suffix; |
1568 |
|
hTitle << title << suffix; |
1569 |
< |
TH2F * _h=new TH2F(hName.str().c_str(), hTitle.str().c_str(), nBinX,binXMin,binXMax, nBinY,binYMin,binYMax); |
1570 |
< |
_h->SetDirectory(theFile); // Needed when the input is a root file |
1569 |
> |
theDQMStore->setCurrentFolder("DT/DTOfflineAnalyzer"); |
1570 |
> |
theDQMStore->book2D(hName.str().c_str(), hTitle.str().c_str(), nBinX,binXMin,binXMax, nBinY,binYMin,binYMax); |
1571 |
> |
// TH2F * _h=new TH2F(hName.str().c_str(), hTitle.str().c_str(), nBinX,binXMin,binXMax, nBinY,binYMin,binYMax); |
1572 |
> |
// _h->SetDirectory(theFile); // Needed when the input is a root file |
1573 |
|
} |
1574 |
|
|
1575 |
|
|