58 vector<string>::const_iterator iTr =
trigSources.begin();
59 vector<string>::const_iterator trEnd =
trigSources.end();
60 vector<string>::const_iterator iHw =
hwSources.begin();
61 vector<string>::const_iterator hwEnd =
hwSources.end();
66 for (; iTr != trEnd; ++iTr){
68 for (; iHw != hwEnd; ++iHw){
71 for (
int wh=-2; wh<=2; ++wh){
72 for (
int sect=1; sect<=12; ++sect){
73 for (
int stat=1; stat<=4; ++stat){
110 for (vector<string>::const_iterator iHw =
hwSources.begin(); iHw !=
hwSources.end(); ++iHw){
113 for (
int stat=1; stat<=4; ++stat){
114 for (
int wh=-2; wh<=2; ++wh){
115 for (
int sect=1; sect<=12; ++sect){
117 int sector_id = (wh+3)+(sect-1)*5;
118 uint32_t indexCh = chId.
rawId();
121 TH2F * TrackPosvsAngle = getHisto<TH2F>(
dbe->
get(
getMEName(
"TrackPosvsAngle",
"Segment", chId)));
122 TH2F * TrackPosvsAngleandTrig = getHisto<TH2F>(
dbe->
get(
getMEName(
"TrackPosvsAngleandTrig",
"Segment", chId)));
123 TH2F * TrackPosvsAngleandTrigHHHL = getHisto<TH2F>(
dbe->
get(
getMEName(
"TrackPosvsAngleandTrigHHHL",
"Segment", chId)));
125 if (TrackPosvsAngle && TrackPosvsAngleandTrig && TrackPosvsAngleandTrigHHHL && TrackPosvsAngle->GetEntries()>1) {
143 std::map<std::string,MonitorElement*> *innerME = &(
secME[sector_id]);
144 TH1D* TrackPos = TrackPosvsAngle->ProjectionY();
145 TH1D*
TrackAngle = TrackPosvsAngle->ProjectionX();
146 TH1D* TrackPosandTrig = TrackPosvsAngleandTrig->ProjectionY();
147 TH1D* TrackAngleandTrig = TrackPosvsAngleandTrig->ProjectionX();
148 TH1D* TrackPosandTrigHHHL = TrackPosvsAngleandTrigHHHL->ProjectionY();
149 TH1D* TrackAngleandTrigHHHL = TrackPosvsAngleandTrigHHHL->ProjectionX();
150 float binEff = float(TrackPosandTrig->GetEntries())/TrackPos->GetEntries();
151 float binEffHHHL = float(TrackPosandTrigHHHL->GetEntries())/TrackPos->GetEntries();
152 float binErr =
sqrt(binEff*(1-binEff)/TrackPos->GetEntries());
153 float binErrHHHL =
sqrt(binEffHHHL*(1-binEffHHHL)/TrackPos->GetEntries());
157 globalEff->setBinError(stat,binErr);
159 innerME = &(
whME[wh]);
160 globalEff = innerME->find(
fullName(
"TrigEffPhi"))->second;
161 globalEff->setBinContent(sect,stat,binEff);
162 globalEff->setBinError(sect,stat,binErr);
163 globalEff = innerME->find(
fullName(
"TrigEffHHHLPhi"))->second;
164 globalEff->setBinContent(sect,stat,binEffHHHL);
165 globalEff->setBinError(sect,stat,binErrHHHL);
179 TH2F * TrackThetaPosvsAngle = getHisto<TH2F>(
dbe->
get(
getMEName(
"TrackThetaPosvsAngle",
"Segment", chId)));
180 TH2F * TrackThetaPosvsAngleandTrig = getHisto<TH2F>(
dbe->
get(
getMEName(
"TrackThetaPosvsAngleandTrig",
"Segment", chId)));
181 TH2F * TrackThetaPosvsAngleandTrigH = getHisto<TH2F>(
dbe->
get(
getMEName(
"TrackThetaPosvsAngleandTrigH",
"Segment", chId)));
183 if (TrackThetaPosvsAngle && TrackThetaPosvsAngleandTrig && TrackThetaPosvsAngleandTrigH && TrackThetaPosvsAngle->GetEntries()>1) {
201 std::map<std::string,MonitorElement*> *innerME = &(
secME[sector_id]);
202 TH1D* TrackThetaPos = TrackThetaPosvsAngle->ProjectionY();
203 TH1D* TrackThetaAngle = TrackThetaPosvsAngle->ProjectionX();
204 TH1D* TrackThetaPosandTrig = TrackThetaPosvsAngleandTrig->ProjectionY();
205 TH1D* TrackThetaAngleandTrig = TrackThetaPosvsAngleandTrig->ProjectionX();
206 TH1D* TrackThetaPosandTrigH = TrackThetaPosvsAngleandTrigH->ProjectionY();
207 TH1D* TrackThetaAngleandTrigH = TrackThetaPosvsAngleandTrigH->ProjectionX();
208 float binEff = float(TrackThetaPosandTrig->GetEntries())/TrackThetaPos->GetEntries();
209 float binErr =
sqrt(binEff*(1-binEff)/TrackThetaPos->GetEntries());
210 float binEffH = float(TrackThetaPosandTrigH->GetEntries())/TrackThetaPos->GetEntries();
211 float binErrH =
sqrt(binEffH*(1-binEffH)/TrackThetaPos->GetEntries());
215 globalEff->setBinError(stat,binErr);
217 innerME = &(
whME[wh]);
218 globalEff = innerME->find(
fullName(
"TrigEffTheta"))->second;
219 globalEff->setBinContent(sect,stat,binEff);
220 globalEff->setBinError(sect,stat,binErr);
221 globalEff = innerME->find(
fullName(
"TrigEffHTheta"))->second;
222 globalEff->setBinContent(sect,stat,binEffH);
223 globalEff->setBinError(sect,stat,binErrH);
230 makeEfficiencyME2D(TrackThetaPosvsAngleandTrig,TrackThetaPosvsAngle,innerME->find(
fullName(
"TrigEffPosvsAngleTheta"))->second);
231 makeEfficiencyME2D(TrackThetaPosvsAngleandTrigH,TrackThetaPosvsAngle,innerME->find(
fullName(
"TrigEffPosvsAngleHTheta"))->second);
246 efficiency->Divide(numerator,denominator,1,1,
"");
248 int nbins = efficiency->GetNbinsX();
251 float bineff = efficiency->GetBinContent(
bin);
253 if (denominator->GetBinContent(
bin)){
254 error =
sqrt(bineff*(1-bineff)/denominator->GetBinContent(
bin));
258 efficiency->SetBinContent(
bin,1.);
261 efficiency->SetBinError(
bin,error);
270 efficiency->Divide(numerator,denominator,1,1,
"");
272 int nbinsx = efficiency->GetNbinsX();
273 int nbinsy = efficiency->GetNbinsY();
274 for (
int binx=1; binx<=nbinsx; ++binx){
275 for (
int biny=1; biny<=nbinsy; ++biny){
277 float bineff = efficiency->GetBinContent(binx,biny);
279 if (denominator->GetBinContent(binx,biny)){
280 error =
sqrt(bineff*(1-bineff)/denominator->GetBinContent(binx,biny));
284 efficiency->SetBinContent(binx,biny,0.);
287 efficiency->SetBinError(binx,biny,error);
296 stringstream wheel; wheel << chambId.
wheel();
298 stringstream sector; sector << chambId.
sector();
302 string HistoName = fullType +
"_W" + wheel.str() +
"_Sec" + sector.str() +
"_St" + station.str();
305 "/Sector" + sector.str() +
306 "/Station" + station.str() +
"/Segment");
309 <<
"/Sector" << sector.str() <<
"/Station" << station.str() <<
"/Segment/" <<
HistoName;
312 uint32_t indexChId = chambId.
rawId();
313 if (htype.find(
"TrigEffAnglePhi") == 0){
314 chambME[indexChId][fullType] =
dbe->
book1D(HistoName.c_str(),
"Trigger efficiency vs angle of incidence (Phi)",16,-40.,40.);
316 else if (htype.find(
"TrigEffAngleHHHLPhi") == 0){
317 chambME[indexChId][fullType] =
dbe->
book1D(HistoName.c_str(),
"Trigger efficiency (HH/HL) vs angle of incidence (Phi)",16,-40.,40.);
319 else if (htype.find(
"TrigEffAngleTheta") == 0){
320 chambME[indexChId][fullType] =
dbe->
book1D(HistoName.c_str(),
"Trigger efficiency vs angle of incidence (Theta)",16,-40.,40.);
322 else if (htype.find(
"TrigEffAngleHTheta") == 0){
323 chambME[indexChId][fullType] =
dbe->
book1D(HistoName.c_str(),
"Trigger efficiency (H) vs angle of incidence (Theta)",16,-40.,40.);
325 else if (htype.find(
"TrigEffPosPhi") == 0 ){
331 else if (htype.find(
"TrigEffPosvsAnglePhi") == 0 ){
335 chambME[indexChId][fullType] =
dbe->
book2D(HistoName.c_str(),
"Trigger efficiency position vs angle (Phi)",16,-40.,40.,
nbins,
min,
max);
337 else if (htype.find(
"TrigEffPosvsAngleHHHLPhi") == 0 ){
341 chambME[indexChId][fullType] =
dbe->
book2D(HistoName.c_str(),
"Trigger efficiency (HH/HL) pos vs angle (Phi)",16,-40.,40.,
nbins,
min,
max);
343 else if (htype.find(
"TrigEffPosHHHLPhi") == 0 ){
349 else if (htype.find(
"TrigEffPosTheta") == 0){
355 else if (htype.find(
"TrigEffPosHTheta") == 0){
361 else if (htype.find(
"TrigEffPosvsAngleTheta") == 0 ){
367 else if (htype.find(
"TrigEffPosvsAngleHTheta") == 0 ){
371 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)