39 setConfig(ps,
"DTTriggerEfficiency");
40 baseFolderDCC =
"DT/03-LocalTrigger-DCC/";
41 baseFolderDDU =
"DT/04-LocalTrigger-DDU/";
64 vector<string>::const_iterator iTr = trigSources.begin();
65 vector<string>::const_iterator trEnd = trigSources.end();
66 vector<string>::const_iterator iHw = hwSources.begin();
67 vector<string>::const_iterator hwEnd = hwSources.end();
71 if(
parameters.getUntrackedParameter<
bool>(
"staticBooking",
true)){
72 for (; iTr != trEnd; ++iTr){
74 for (; iHw != hwEnd; ++iHw){
79 for (
int wh=-2; wh<=2; ++wh){
81 for (
int sect=1; sect<=12; ++sect){
82 for (
int stat=1; stat<=4; ++stat){
84 bookChambHistos(chId,
"TrigEffPosvsAnglePhi",
"Segment");
85 bookChambHistos(chId,
"TrigEffPosvsAngleCorrPhi",
"Segment");
89 bookWheelHistos(wh,
"TrigEffPhi",
"");
90 bookWheelHistos(wh,
"TrigEffCorrPhi",
"");
102 for (vector<string>::const_iterator iTr = trigSources.begin(); iTr != trigSources.end(); ++iTr){
104 for (vector<string>::const_iterator iHw = hwSources.begin(); iHw != hwSources.end(); ++iHw){
107 if( globalEffDistr.find(
fullName(
"TrigEffPhi")) == globalEffDistr.end() ){
111 for (
int wh=-2; wh<=2; ++wh){
113 TH2F * TrigEffDenum = getHisto<TH2F>(dbe->get(getMEName(
"TrigEffDenum",
"Task",wh)));
114 TH2F * TrigEffNum = getHisto<TH2F>(dbe->get(getMEName(
"TrigEffNum",
"Task",wh)));
115 TH2F * TrigEffCorrNum = getHisto<TH2F>(dbe->get(getMEName(
"TrigEffCorrNum",
"Task",wh)));
117 if (TrigEffDenum && TrigEffNum && TrigEffCorrNum && TrigEffDenum->GetEntries()>1) {
119 if( whME[wh].
find(
fullName(
"TrigEffPhi")) == whME[wh].end() ){
120 bookWheelHistos(wh,
"TrigEffPhi",
"");
121 bookWheelHistos(wh,
"TrigEffCorrPhi",
"");
128 MonitorElement* Eff1DWh_TrigEffCorrPhi = (&(EffDistrPerWh[wh]))->find(
fullName(
"TrigEffCorrPhi"))->second;
133 makeEfficiencyME(TrigEffNum,TrigEffDenum,Eff2DWh_TrigEffPhi,Eff1DWh_TrigEffPhi,Eff1DAll_TrigEffPhi);
134 makeEfficiencyME(TrigEffCorrNum,TrigEffDenum,Eff2DWh_TrigEffCorrPhi,Eff1DWh_TrigEffCorrPhi,Eff1DAll_TrigEffCorrPhi);
139 for (
int stat=1; stat<=4; ++stat){
140 for (
int sect=1; sect<=12; ++sect){
142 uint32_t indexCh = chId.
rawId();
145 TH2F * TrackPosvsAngle = getHisto<TH2F>(dbe->get(getMEName(
"TrackPosvsAngle",
"Segment", chId)));
146 TH2F * TrackPosvsAngleAnyQual = getHisto<TH2F>(dbe->get(getMEName(
"TrackPosvsAngleAnyQual",
"Segment", chId)));
147 TH2F * TrackPosvsAngleCorr = getHisto<TH2F>(dbe->get(getMEName(
"TrackPosvsAngleCorr",
"Segment", chId)));
149 if (TrackPosvsAngle && TrackPosvsAngleAnyQual && TrackPosvsAngleCorr && TrackPosvsAngle->GetEntries()>1) {
151 if( chambME[indexCh].
find(
fullName(
"TrigEffAnglePhi")) == chambME[indexCh].end()){
152 bookChambHistos(chId,
"TrigEffPosvsAnglePhi",
"Segment");
153 bookChambHistos(chId,
"TrigEffPosvsAngleCorrPhi",
"Segment");
156 std::map<std::string,MonitorElement*> *innerME = &(chambME[indexCh]);
157 makeEfficiencyME(TrackPosvsAngleAnyQual,TrackPosvsAngle,innerME->find(
fullName(
"TrigEffPosvsAnglePhi"))->second);
158 makeEfficiencyME(TrackPosvsAngleCorr,TrackPosvsAngle,innerME->find(
fullName(
"TrigEffPosvsAngleCorrPhi"))->second);
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 result1DWh->
Fill(bineff);
184 result1D->
Fill(bineff);
186 if (denominator->GetBinContent(binx,biny)){
187 error =
sqrt(bineff*(1-bineff)/denominator->GetBinContent(binx,biny));
191 efficiency->SetBinContent(binx,biny,0.);
194 efficiency->SetBinError(binx,biny,error);
203 efficiency->Divide(numerator,denominator,1,1,
"");
205 int nbinsx = efficiency->GetNbinsX();
206 int nbinsy = efficiency->GetNbinsY();
207 for (
int binx=1; binx<=nbinsx; ++binx){
208 for (
int biny=1; biny<=nbinsy; ++biny){
210 float bineff = efficiency->GetBinContent(binx,biny);
212 if (denominator->GetBinContent(binx,biny)){
213 error =
sqrt(bineff*(1-bineff)/denominator->GetBinContent(binx,biny));
217 efficiency->SetBinContent(binx,biny,0.);
220 efficiency->SetBinError(binx,biny,error);
228 stringstream wheel; wheel << wh;
230 string folderName = topFolder(hwSource==
"DCC") + folder +
"/";
232 string histoname = sourceFolder + folderName
233 +
fullName(histoTag) +
"_W" + wheel.str();
242 bool isDCC = hwSource==
"DCC" ;
243 basedir = topFolder(isDCC);
246 basedir += folder +
"/" ;
248 dbe->setCurrentFolder(basedir);
251 string hname = fullTag +
"_All";
253 globalEffDistr[fullTag] = dbe->book1D(hname.c_str(),hname.c_str(),51,0.,1.02);
254 globalEffDistr[fullTag] ->setAxisTitle(
"Trig Eff",1);
260 stringstream wh; wh << wheel;
262 bool isDCC = hwSource==
"DCC" ;
263 if (hTag.find(
"Summary") != string::npos) {
264 basedir = topFolder(isDCC);
266 basedir = topFolder(isDCC) +
"Wheel" + wh.str() +
"/" ;
270 basedir += folder +
"/" ;
272 dbe->setCurrentFolder(basedir);
275 string hname = fullTag+
"_W" + wh.str();
277 string hnameAll = fullTag+
"_All_W" + wh.str();
279 LogTrace(
category()) <<
"[" << testName <<
"Test]: booking "<< basedir << hname;
281 (EffDistrPerWh[wheel])[fullTag] = dbe->book1D(hnameAll.c_str(),hnameAll.c_str(),51,0.,1.02);
283 if (hTag.find(
"Phi")!= string::npos ||
284 hTag.find(
"Summary") != string::npos ){
285 MonitorElement* me = dbe->book2D(hname.c_str(),hname.c_str(),12,1,13,4,1,5);
294 whME[wheel][fullTag] = me;
298 if (hTag.find(
"Theta") != string::npos){
299 MonitorElement* me =dbe->book2D(hname.c_str(),hname.c_str(),12,1,13,3,1,4);
307 whME[wheel][fullTag] = me;
315 stringstream wheel; wheel << chambId.
wheel();
317 stringstream sector; sector << chambId.
sector();
320 bool isDCC = hwSource==
"DCC" ;
321 string HistoName = fullType +
"_W" + wheel.str() +
"_Sec" + sector.str() +
"_St" + station.str();
323 dbe->setCurrentFolder(topFolder(isDCC) +
324 "Wheel" + wheel.str() +
325 "/Sector" + sector.str() +
326 "/Station" + station.str() +
329 LogTrace(
category()) <<
"[" << testName <<
"Test]: booking " + topFolder(isDCC) +
"Wheel" << wheel.str()
330 <<
"/Sector" << sector.str() <<
"/Station" << station.str() <<
"/" + folder +
"/" <<
HistoName;
333 uint32_t indexChId = chambId.
rawId();
336 trigGeomUtils->phiRange(chambId,min,max,nbins,20);
337 if (htype.find(
"TrigEffPosvsAnglePhi") == 0 ){
338 chambME[indexChId][fullType] = dbe->book2D(HistoName.c_str(),
"Trigger efficiency (any qual.) position vs angle (Phi)",12,-30.,30.,
nbins,
min,
max);
341 if (htype.find(
"TrigEffPosvsAngleCorrPhi") == 0 ){
342 chambME[indexChId][fullType] = dbe->book2D(HistoName.c_str(),
"Trigger efficiency (correlated) pos vs angle (Phi)",12,-30.,30.,
nbins,
min,
max);
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 bookWheelHistos(int wheel, std::string hTag, std::string folder)
Book the new MEs (for each wheel)
void bookChambHistos(DTChamberId chambId, std::string htype, std::string folder="")
Book the new MEs (for each chamber)
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 find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
void bookHistos(std::string hTag, std::string folder)
Book the new MEs (global)
virtual ~DTTriggerEfficiencyTest()
Destructor.
uint32_t rawId() const
get the raw id
U second(std::pair< T, U > const &p)
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 runClientDiagnostic()
DQM Client Diagnostic.
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)
EventID const & max(EventID const &lh, EventID const &rh)