42 setConfig(ps,
"DTTriggerEfficiency");
43 baseFolderDCC =
"DT/03-LocalTrigger-DCC/";
44 baseFolderDDU =
"DT/04-LocalTrigger-DDU/";
70 for (vector<string>::const_iterator iTr = trigSources.begin(); iTr != trigSources.end(); ++iTr){
72 for (vector<string>::const_iterator iHw = hwSources.begin(); iHw != hwSources.end(); ++iHw){
75 if( globalEffDistr.find(
fullName(
"TrigEffPhi")) == globalEffDistr.end() ){
80 for (
int wh=-2; wh<=2; ++wh){
82 TH2F * TrigEffDenum = getHisto<TH2F>(igetter.
get(getMEName(
"TrigEffDenum",
"Task",wh)));
83 TH2F * TrigEffNum = getHisto<TH2F>(igetter.
get(getMEName(
"TrigEffNum",
"Task",wh)));
84 TH2F * TrigEffCorrNum = getHisto<TH2F>(igetter.
get(getMEName(
"TrigEffCorrNum",
"Task",wh)));
86 if (TrigEffDenum && TrigEffNum && TrigEffCorrNum && TrigEffDenum->GetEntries()>1) {
88 if( whME[wh].
find(
fullName(
"TrigEffPhi")) == whME[wh].end() ){
90 bookWheelHistos(ibooker,wh,
"TrigEffPhi",
"");
91 bookWheelHistos(ibooker,wh,
"TrigEffCorrPhi",
"");
103 makeEfficiencyME(TrigEffNum,TrigEffDenum,Eff2DWh_TrigEffPhi,Eff1DWh_TrigEffPhi,Eff1DAll_TrigEffPhi);
104 makeEfficiencyME(TrigEffCorrNum,TrigEffDenum,Eff2DWh_TrigEffCorrPhi,Eff1DWh_TrigEffCorrPhi,Eff1DAll_TrigEffCorrPhi);
109 for (
int stat=1; stat<=4; ++stat){
110 for (
int sect=1; sect<=12; ++sect){
112 uint32_t indexCh = chId.
rawId();
116 TH2F * TrackPosvsAngle = getHisto<TH2F>(igetter.
get(getMEName(
"TrackPosvsAngle",
"Segment", chId)));
117 TH2F * TrackPosvsAngleAnyQual = getHisto<TH2F>(igetter.
get(getMEName(
"TrackPosvsAngleAnyQual",
"Segment", chId)));
118 TH2F * TrackPosvsAngleCorr = getHisto<TH2F>(igetter.
get(getMEName(
"TrackPosvsAngleCorr",
"Segment", chId)));
120 if (TrackPosvsAngle && TrackPosvsAngleAnyQual && TrackPosvsAngleCorr && TrackPosvsAngle->GetEntries()>1) {
122 if( chambME[indexCh].
find(
fullName(
"TrigEffAnglePhi")) == chambME[indexCh].end()){
123 bookChambHistos(ibooker,chId,
"TrigEffPosvsAnglePhi",
"Segment");
124 bookChambHistos(ibooker,chId,
"TrigEffPosvsAngleCorrPhi",
"Segment");
127 std::map<std::string,MonitorElement*> *innerME = &(chambME[indexCh]);
128 makeEfficiencyME(TrackPosvsAngleAnyQual,TrackPosvsAngle,innerME->find(
fullName(
"TrigEffPosvsAnglePhi"))->second);
129 makeEfficiencyME(TrackPosvsAngleCorr,TrackPosvsAngle,innerME->find(
fullName(
"TrigEffPosvsAngleCorrPhi"))->second);
145 efficiency->Divide(numerator,denominator,1,1,
"");
147 int nbinsx = efficiency->GetNbinsX();
148 int nbinsy = efficiency->GetNbinsY();
149 for (
int binx=1; binx<=nbinsx; ++binx){
150 for (
int biny=1; biny<=nbinsy; ++biny){
152 float bineff = efficiency->GetBinContent(binx,biny);
154 result1DWh->
Fill(bineff);
155 result1D->
Fill(bineff);
157 if (denominator->GetBinContent(binx,biny)){
158 error =
sqrt(bineff*(1-bineff)/denominator->GetBinContent(binx,biny));
162 efficiency->SetBinContent(binx,biny,0.);
165 efficiency->SetBinError(binx,biny,error);
174 efficiency->Divide(numerator,denominator,1,1,
"");
176 int nbinsx = efficiency->GetNbinsX();
177 int nbinsy = efficiency->GetNbinsY();
178 for (
int binx=1; binx<=nbinsx; ++binx){
179 for (
int biny=1; biny<=nbinsy; ++biny){
181 float bineff = efficiency->GetBinContent(binx,biny);
183 if (denominator->GetBinContent(binx,biny)){
184 error =
sqrt(bineff*(1-bineff)/denominator->GetBinContent(binx,biny));
188 efficiency->SetBinContent(binx,biny,0.);
191 efficiency->SetBinError(binx,biny,error);
199 stringstream wheel; wheel << wh;
201 string folderName = topFolder(hwSource==
"DCC") + folder +
"/";
203 string histoname = sourceFolder + folderName
204 +
fullName(histoTag) +
"_W" + wheel.str();
213 bool isDCC = hwSource==
"DCC" ;
214 basedir = topFolder(isDCC);
217 basedir += folder +
"/" ;
223 string hname = fullTag +
"_All";
225 globalEffDistr[fullTag] = ibooker.
book1D(hname.c_str(),hname.c_str(),51,0.,1.02);
232 stringstream wh; wh << wheel;
234 bool isDCC = hwSource==
"DCC" ;
235 if (hTag.find(
"Summary") != string::npos) {
236 basedir = topFolder(isDCC);
238 basedir = topFolder(isDCC) +
"Wheel" + wh.str() +
"/" ;
242 basedir += folder +
"/" ;
248 string hname = fullTag+
"_W" + wh.str();
250 string hnameAll = fullTag+
"_All_W" + wh.str();
252 LogTrace(
category()) <<
"[" << testName <<
"Test]: booking "<< basedir << hname;
254 (EffDistrPerWh[wheel])[fullTag] = ibooker.
book1D(hnameAll.c_str(),hnameAll.c_str(),51,0.,1.02);
256 if (hTag.find(
"Phi")!= string::npos ||
257 hTag.find(
"Summary") != string::npos ){
268 whME[wheel][fullTag] = me;
272 if (hTag.find(
"Theta") != string::npos){
282 whME[wheel][fullTag] = me;
289 string htype,
string folder) {
291 stringstream wheel; wheel << chambId.
wheel();
293 stringstream sector; sector << chambId.
sector();
296 bool isDCC = hwSource==
"DCC" ;
297 string HistoName = fullType +
"_W" + wheel.str() +
"_Sec" + sector.str() +
"_St" + station.str();
300 "Wheel" + wheel.str() +
301 "/Sector" + sector.str() +
302 "/Station" + station.str() +
305 LogTrace(
category()) <<
"[" << testName <<
"Test]: booking " + topFolder(isDCC) +
"Wheel" << wheel.str()
306 <<
"/Sector" << sector.str() <<
"/Station" << station.str() <<
"/" + folder +
"/" <<
HistoName;
309 uint32_t indexChId = chambId.
rawId();
312 trigGeomUtils->phiRange(chambId,min,max,nbins,20);
313 if (htype.find(
"TrigEffPosvsAnglePhi") == 0 ){
315 chambME[indexChId][fullType] = ibooker.
book2D(HistoName.c_str(),
"Trigger efficiency (any qual.) position vs angle (Phi)",12,-30.,30.,
nbins,
min,
max);
318 if (htype.find(
"TrigEffPosvsAngleCorrPhi") == 0 ){
320 chambME[indexChId][fullType] = ibooker.
book2D(HistoName.c_str(),
"Trigger efficiency (correlated) pos vs angle (Phi)",12,-30.,30.,
nbins,
min,
max);
330 vector<string>::const_iterator iTr = trigSources.begin();
331 vector<string>::const_iterator trEnd = trigSources.end();
332 vector<string>::const_iterator iHw = hwSources.begin();
333 vector<string>::const_iterator hwEnd = hwSources.end();
337 if(
parameters.getUntrackedParameter<
bool>(
"staticBooking",
true)){
338 for (; iTr != trEnd; ++iTr){
340 for (; iHw != hwEnd; ++iHw){
346 for (
int wh=-2; wh<=2; ++wh){
348 for (
int sect=1; sect<=12; ++sect){
349 for (
int stat=1; stat<=4; ++stat){
352 bookChambHistos(ibooker,chId,
"TrigEffPosvsAnglePhi",
"Segment");
353 bookChambHistos(ibooker,chId,
"TrigEffPosvsAngleCorrPhi",
"Segment");
358 bookWheelHistos(ibooker,wh,
"TrigEffPhi",
"");
359 bookWheelHistos(ibooker,wh,
"TrigEffCorrPhi",
"");
void makeEfficiencyME(TH2F *numerator, TH2F *denominator, MonitorElement *result2DWh, MonitorElement *result1DWh, MonitorElement *result1D)
Compute 1D/2D efficiency plots.
T getUntrackedParameter(std::string const &, T const &) const
void dqmEndJob(DQMStore::IBooker &, DQMStore::IGetter &)
void dqmEndLuminosityBlock(DQMStore::IBooker &, DQMStore::IGetter &, edm::LuminosityBlock const &, edm::EventSetup const &)
Perform client diagnostic in online.
MonitorElement * get(const std::string &path)
void setBinLabel(int bin, const std::string &label, int axis=1)
set bin label for x, y or z axis (axis=1, 2, 3 respectively)
void beginRun(edm::Run const &run, edm::EventSetup const &context)
BeginRun.
void beginRun(const edm::Run &r, const edm::EventSetup &c)
BeginRun.
DTTriggerEfficiencyTest(const edm::ParameterSet &ps)
Constructor.
void bookWheelHistos(DQMStore::IBooker &ibooker, int wheel, std::string hTag, std::string folder)
Book the new MEs (for each wheel)
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
void runClientDiagnostic(DQMStore::IBooker &, DQMStore::IGetter &)
DQM Client Diagnostic.
virtual ~DTTriggerEfficiencyTest()
Destructor.
uint32_t rawId() const
get the raw id
U second(std::pair< T, U > const &p)
void bookChambHistos(DQMStore::IBooker &ibooker, DTChamberId chambId, std::string htype, std::string folder="")
Book the new MEs (for each chamber)
MonitorElement * book1D(Args &&...args)
std::string getMEName(std::string histoTag, std::string folder, int wh)
Get the ME name (by wheel)
EventID const & min(EventID const &lh, EventID const &rh)
void setCurrentFolder(const std::string &fullpath)
MonitorElement * book2D(Args &&...args)
int station() const
Return the station number.
TH2F * getTH2F(void) const
int wheel() const
Return the wheel number.
void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)
void bookHistos(DQMStore::IBooker &ibooker, std::string hTag, std::string folder)
Book the new MEs (global)
EventID const & max(EventID const &lh, EventID const &rh)