60 vector<string>::const_iterator iTr =
trigSources.begin();
61 vector<string>::const_iterator trEnd =
trigSources.end();
62 vector<string>::const_iterator iHw =
hwSources.begin();
63 vector<string>::const_iterator hwEnd =
hwSources.end();
68 for (; iTr != trEnd; ++iTr){
70 for (; iHw != hwEnd; ++iHw){
73 for (
int wh=-2; wh<=2; ++wh){
74 for (
int sect=1; sect<=12; ++sect){
75 for (
int stat=1; stat<=4; ++stat){
112 for (vector<string>::const_iterator iHw =
hwSources.begin(); iHw !=
hwSources.end(); ++iHw){
115 for (
int stat=1; stat<=4; ++stat){
116 for (
int wh=-2; wh<=2; ++wh){
117 for (
int sect=1; sect<=12; ++sect){
119 int sector_id = (wh+3)+(sect-1)*5;
120 uint32_t indexCh = chId.
rawId();
123 TH2F * TrackPosvsAngle = getHisto<TH2F>(
dbe->
get(
getMEName(
"TrackPosvsAngle",
"Segment", chId)));
124 TH2F * TrackPosvsAngleandTrig = getHisto<TH2F>(
dbe->
get(
getMEName(
"TrackPosvsAngleandTrig",
"Segment", chId)));
125 TH2F * TrackPosvsAngleandTrigHHHL = getHisto<TH2F>(
dbe->
get(
getMEName(
"TrackPosvsAngleandTrigHHHL",
"Segment", chId)));
127 if (TrackPosvsAngle && TrackPosvsAngleandTrig && TrackPosvsAngleandTrigHHHL && TrackPosvsAngle->GetEntries()>1) {
145 std::map<std::string,MonitorElement*> *innerME = &(
secME[sector_id]);
146 TH1D* TrackPos = TrackPosvsAngle->ProjectionY();
147 TH1D*
TrackAngle = TrackPosvsAngle->ProjectionX();
148 TH1D* TrackPosandTrig = TrackPosvsAngleandTrig->ProjectionY();
149 TH1D* TrackAngleandTrig = TrackPosvsAngleandTrig->ProjectionX();
150 TH1D* TrackPosandTrigHHHL = TrackPosvsAngleandTrigHHHL->ProjectionY();
151 TH1D* TrackAngleandTrigHHHL = TrackPosvsAngleandTrigHHHL->ProjectionX();
152 float binEff = float(TrackPosandTrig->GetEntries())/TrackPos->GetEntries();
153 float binEffHHHL = float(TrackPosandTrigHHHL->GetEntries())/TrackPos->GetEntries();
154 float binErr =
sqrt(binEff*(1-binEff)/TrackPos->GetEntries());
155 float binErrHHHL =
sqrt(binEffHHHL*(1-binEffHHHL)/TrackPos->GetEntries());
159 globalEff->setBinError(stat,binErr);
161 innerME = &(
whME[wh]);
162 globalEff = innerME->find(
fullName(
"TrigEffPhi"))->second;
163 globalEff->setBinContent(sect,stat,binEff);
164 globalEff->setBinError(sect,stat,binErr);
165 globalEff = innerME->find(
fullName(
"TrigEffHHHLPhi"))->second;
166 globalEff->setBinContent(sect,stat,binEffHHHL);
167 globalEff->setBinError(sect,stat,binErrHHHL);
181 TH2F * TrackThetaPosvsAngle = getHisto<TH2F>(
dbe->
get(
getMEName(
"TrackThetaPosvsAngle",
"Segment", chId)));
182 TH2F * TrackThetaPosvsAngleandTrig = getHisto<TH2F>(
dbe->
get(
getMEName(
"TrackThetaPosvsAngleandTrig",
"Segment", chId)));
183 TH2F * TrackThetaPosvsAngleandTrigH = getHisto<TH2F>(
dbe->
get(
getMEName(
"TrackThetaPosvsAngleandTrigH",
"Segment", chId)));
185 if (TrackThetaPosvsAngle && TrackThetaPosvsAngleandTrig && TrackThetaPosvsAngleandTrigH && TrackThetaPosvsAngle->GetEntries()>1) {
203 std::map<std::string,MonitorElement*> *innerME = &(
secME[sector_id]);
204 TH1D* TrackThetaPos = TrackThetaPosvsAngle->ProjectionY();
205 TH1D* TrackThetaAngle = TrackThetaPosvsAngle->ProjectionX();
206 TH1D* TrackThetaPosandTrig = TrackThetaPosvsAngleandTrig->ProjectionY();
207 TH1D* TrackThetaAngleandTrig = TrackThetaPosvsAngleandTrig->ProjectionX();
208 TH1D* TrackThetaPosandTrigH = TrackThetaPosvsAngleandTrigH->ProjectionY();
209 TH1D* TrackThetaAngleandTrigH = TrackThetaPosvsAngleandTrigH->ProjectionX();
210 float binEff = float(TrackThetaPosandTrig->GetEntries())/TrackThetaPos->GetEntries();
211 float binErr =
sqrt(binEff*(1-binEff)/TrackThetaPos->GetEntries());
212 float binEffH = float(TrackThetaPosandTrigH->GetEntries())/TrackThetaPos->GetEntries();
213 float binErrH =
sqrt(binEffH*(1-binEffH)/TrackThetaPos->GetEntries());
217 globalEff->setBinError(stat,binErr);
219 innerME = &(
whME[wh]);
220 globalEff = innerME->find(
fullName(
"TrigEffTheta"))->second;
221 globalEff->setBinContent(sect,stat,binEff);
222 globalEff->setBinError(sect,stat,binErr);
223 globalEff = innerME->find(
fullName(
"TrigEffHTheta"))->second;
224 globalEff->setBinContent(sect,stat,binEffH);
225 globalEff->setBinError(sect,stat,binErrH);
232 makeEfficiencyME2D(TrackThetaPosvsAngleandTrig,TrackThetaPosvsAngle,innerME->find(
fullName(
"TrigEffPosvsAngleTheta"))->second);
233 makeEfficiencyME2D(TrackThetaPosvsAngleandTrigH,TrackThetaPosvsAngle,innerME->find(
fullName(
"TrigEffPosvsAngleHTheta"))->second);
248 efficiency->Divide(numerator,denominator,1,1,
"");
250 int nbins = efficiency->GetNbinsX();
253 float bineff = efficiency->GetBinContent(
bin);
255 if (denominator->GetBinContent(
bin)){
256 error =
sqrt(bineff*(1-bineff)/denominator->GetBinContent(
bin));
260 efficiency->SetBinContent(
bin,1.);
263 efficiency->SetBinError(
bin,error);
272 efficiency->Divide(numerator,denominator,1,1,
"");
274 int nbinsx = efficiency->GetNbinsX();
275 int nbinsy = efficiency->GetNbinsY();
276 for (
int binx=1; binx<=nbinsx; ++binx){
277 for (
int biny=1; biny<=nbinsy; ++biny){
279 float bineff = efficiency->GetBinContent(binx,biny);
281 if (denominator->GetBinContent(binx,biny)){
282 error =
sqrt(bineff*(1-bineff)/denominator->GetBinContent(binx,biny));
286 efficiency->SetBinContent(binx,biny,0.);
289 efficiency->SetBinError(binx,biny,error);
298 stringstream wheel; wheel << chambId.
wheel();
300 stringstream sector; sector << chambId.
sector();
304 string HistoName = fullType +
"_W" + wheel.str() +
"_Sec" + sector.str() +
"_St" + station.str();
307 "/Sector" + sector.str() +
308 "/Station" + station.str() +
"/Segment");
311 <<
"/Sector" << sector.str() <<
"/Station" << station.str() <<
"/Segment/" <<
HistoName;
314 uint32_t indexChId = chambId.
rawId();
315 if (htype.find(
"TrigEffAnglePhi") == 0){
316 chambME[indexChId][fullType] =
dbe->
book1D(HistoName.c_str(),
"Trigger efficiency vs angle of incidence (Phi)",16,-40.,40.);
318 else if (htype.find(
"TrigEffAngleHHHLPhi") == 0){
319 chambME[indexChId][fullType] =
dbe->
book1D(HistoName.c_str(),
"Trigger efficiency (HH/HL) vs angle of incidence (Phi)",16,-40.,40.);
321 else if (htype.find(
"TrigEffAngleTheta") == 0){
322 chambME[indexChId][fullType] =
dbe->
book1D(HistoName.c_str(),
"Trigger efficiency vs angle of incidence (Theta)",16,-40.,40.);
324 else if (htype.find(
"TrigEffAngleHTheta") == 0){
325 chambME[indexChId][fullType] =
dbe->
book1D(HistoName.c_str(),
"Trigger efficiency (H) vs angle of incidence (Theta)",16,-40.,40.);
327 else if (htype.find(
"TrigEffPosPhi") == 0 ){
333 else if (htype.find(
"TrigEffPosvsAnglePhi") == 0 ){
337 chambME[indexChId][fullType] =
dbe->
book2D(HistoName.c_str(),
"Trigger efficiency position vs angle (Phi)",16,-40.,40.,
nbins,
min,
max);
339 else if (htype.find(
"TrigEffPosvsAngleHHHLPhi") == 0 ){
343 chambME[indexChId][fullType] =
dbe->
book2D(HistoName.c_str(),
"Trigger efficiency (HH/HL) pos vs angle (Phi)",16,-40.,40.,
nbins,
min,
max);
345 else if (htype.find(
"TrigEffPosHHHLPhi") == 0 ){
351 else if (htype.find(
"TrigEffPosTheta") == 0){
357 else if (htype.find(
"TrigEffPosHTheta") == 0){
363 else if (htype.find(
"TrigEffPosvsAngleTheta") == 0 ){
369 else if (htype.find(
"TrigEffPosvsAngleHTheta") == 0 ){
373 chambME[indexChId][fullType] =
dbe->
book2D(HistoName.c_str(),
"Trigger efficiency (H) pos vs angle (Theta)",16,-40.,40.,
nbins,
min,
max);
void bookChambHistos(DTChamberId chambId, std::string htype)
Book the new MEs (for each chamber)
std::map< int, std::map< std::string, MonitorElement * > > secME
T getUntrackedParameter(std::string const &, T const &) const
std::vector< std::string > trigSources
void setBinContent(int binx, double content)
set content of bin (1-D)
void thetaRange(const DTChamberId &id, float &min, float &max, int &nbins, float step=15)
Compute theta range in local chamber coordinates.
std::map< int, std::map< std::string, MonitorElement * > > whME
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
void makeEfficiencyME(TH1D *numerator, TH1D *denominator, MonitorElement *result)
Compute efficiency plots.
DTTrigGeomUtils * trigGeomUtils
std::string baseFolderDCC
void beginRun(const edm::Run &r, const edm::EventSetup &c)
BeginRun.
void makeEfficiencyME2D(TH2F *numerator, TH2F *denominator, MonitorElement *result)
Compute 2D efficiency plots.
std::string baseFolderDDU
void beginRun(edm::Run const &run, edm::EventSetup const &context)
BeginRun.
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
edm::ESHandle< DTGeometry > muonGeom
uint32_t rawId() const
get the raw id
void bookWheelHistos(int wheel, std::string hTag, std::string folder="")
Book the new MEs (for each wheel)
void bookSectorHistos(int wheel, int sector, std::string hTag, std::string folder="")
Book the new MEs (for each sector)
std::map< uint32_t, std::map< std::string, MonitorElement * > > chambME
const T & max(const T &a, const T &b)
MonitorElement * get(const std::string &path) const
get ME from full pathname (e.g. "my/long/dir/my_histo")
DTLocalTriggerEfficiencyTest(const edm::ParameterSet &ps)
Constructor.
std::string category()
Get message logger name.
void phiRange(const DTChamberId &id, float &min, float &max, int &nbins, float step=15)
Compute phi range in local chamber coordinates.
edm::ParameterSet parameters
void runClientDiagnostic()
DQM Client Diagnostic.
TH1F * getTH1F(void) const
std::string getMEName(std::string histoTag, std::string subfolder, const DTChamberId &chambid)
Get the ME name (by chamber)
std::string & topFolder(bool isDCC)
Get top folder name.
void setConfig(const edm::ParameterSet &ps, std::string name)
Set configuration variables.
int station() const
Return the station number.
TH2F * getTH2F(void) const
std::vector< std::string > hwSources
MonitorElement * book2D(const char *name, const char *title, int nchX, double lowX, double highX, int nchY, double lowY, double highY)
Book 2D histogram.
virtual ~DTLocalTriggerEfficiencyTest()
Destructor.
int wheel() const
Return the wheel number.
std::string fullName(std::string htype)
Create fullname from histo partial name.
void setCurrentFolder(const std::string &fullpath)