CMS 3D CMS Logo

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Protected Member Functions | Private Attributes
DTTriggerEfficiencyTest Class Reference

#include <DTTriggerEfficiencyTest.h>

Inheritance diagram for DTTriggerEfficiencyTest:
DTLocalTriggerBaseTest edm::EDAnalyzer

Public Member Functions

 DTTriggerEfficiencyTest (const edm::ParameterSet &ps)
 Constructor. More...
 
virtual ~DTTriggerEfficiencyTest ()
 Destructor. More...
 
- Public Member Functions inherited from DTLocalTriggerBaseTest
 DTLocalTriggerBaseTest ()
 Constructor. More...
 
virtual ~DTLocalTriggerBaseTest ()
 Destructor. More...
 
- Public Member Functions inherited from edm::EDAnalyzer
 EDAnalyzer ()
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 

Protected Member Functions

void beginJob ()
 BeginJob. More...
 
void beginRun (const edm::Run &r, const edm::EventSetup &c)
 BeginRun. More...
 
void bookChambHistos (DTChamberId chambId, std::string htype, std::string folder="")
 Book the new MEs (for each chamber) More...
 
void makeEfficiencyME2D (TH2F *numerator, TH2F *denominator, MonitorElement *result)
 Compute 2D efficiency plots. More...
 
void runClientDiagnostic ()
 DQM Client Diagnostic. More...
 
- Protected Member Functions inherited from DTLocalTriggerBaseTest
void analyze (const edm::Event &e, const edm::EventSetup &c)
 Analyze. More...
 
void beginLuminosityBlock (edm::LuminosityBlock const &lumiSeg, edm::EventSetup const &context)
 Perform begin lumiblock operations. More...
 
void bookCmsHistos (std::string hTag, std::string folder="")
 Book the new MEs (CMS summary) More...
 
void bookSectorHistos (int wheel, int sector, std::string hTag, std::string folder="")
 Book the new MEs (for each sector) More...
 
void bookWheelHistos (int wheel, std::string hTag, std::string folder="")
 Book the new MEs (for each wheel) More...
 
std::string category ()
 Get message logger name. More...
 
void endJob ()
 EndJob. More...
 
void endLuminosityBlock (edm::LuminosityBlock const &lumiSeg, edm::EventSetup const &context)
 Perform client diagnostic in online. More...
 
void endRun (edm::Run const &run, edm::EventSetup const &context)
 Perform client diagnostic in offline. More...
 
std::string fullName (std::string htype)
 Create fullname from histo partial name. More...
 
template<class T >
TgetHisto (MonitorElement *me)
 Convert ME to Histogram fo type T. More...
 
std::string getMEName (std::string histoTag, std::string subfolder, const DTChamberId &chambid)
 Get the ME name (by chamber) More...
 
std::string getMEName (std::string histoTag, std::string subfolder, int wh)
 Get the ME name (by wheel) More...
 
std::pair< float, float > phiRange (const DTChamberId &id)
 Calculate phi range for histograms. More...
 
void setConfig (const edm::ParameterSet &ps, std::string name)
 Set configuration variables. More...
 
std::string & topFolder (bool isDCC)
 Get top folder name. More...
 
- Protected Member Functions inherited from edm::EDAnalyzer
CurrentProcessingContext const * currentContext () const
 

Private Attributes

std::map< uint32_t, std::map
< std::string, MonitorElement * > > 
chambME
 
bool detailedPlots
 
DTTrigGeomUtilstrigGeomUtils
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
typedef WorkerT< EDAnalyzerWorkerType
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
- Protected Attributes inherited from DTLocalTriggerBaseTest
std::string baseFolderDCC
 
std::string baseFolderDDU
 
std::map< std::string,
MonitorElement * > 
cmsME
 
DQMStoredbe
 
std::string hwSource
 
std::vector< std::string > hwSources
 
edm::ESHandle< DTGeometrymuonGeom
 
int nevents
 
unsigned int nLumiSegs
 
edm::ParameterSet parameters
 
int prescaleFactor
 
int run
 
bool runOnline
 
std::map< int, std::map
< std::string, MonitorElement * > > 
secME
 
std::string sourceFolder
 
std::string testName
 
std::string trigSource
 
std::vector< std::string > trigSources
 
std::map< int, std::map
< std::string, MonitorElement * > > 
whME
 

Detailed Description

Definition at line 20 of file DTTriggerEfficiencyTest.h.

Constructor & Destructor Documentation

DTTriggerEfficiencyTest::DTTriggerEfficiencyTest ( const edm::ParameterSet ps)

Constructor.

Definition at line 39 of file DTTriggerEfficiencyTest.cc.

References edm::ParameterSet::getUntrackedParameter().

39  {
40 
41  setConfig(ps,"DTTriggerEfficiency");
42  baseFolderDCC = "DT/03-LocalTrigger-DCC/";
43  baseFolderDDU = "DT/04-LocalTrigger-DDU/";
44  detailedPlots = ps.getUntrackedParameter<bool>("detailedAnalysis",true);
45 
46 }
T getUntrackedParameter(std::string const &, T const &) const
void setConfig(const edm::ParameterSet &ps, std::string name)
Set configuration variables.
DTTriggerEfficiencyTest::~DTTriggerEfficiencyTest ( )
virtual

Destructor.

Definition at line 49 of file DTTriggerEfficiencyTest.cc.

49  {
50 
51 }

Member Function Documentation

void DTTriggerEfficiencyTest::beginJob ( void  )
protectedvirtual

BeginJob.

Reimplemented from DTLocalTriggerBaseTest.

Definition at line 54 of file DTTriggerEfficiencyTest.cc.

References DTLocalTriggerBaseTest::beginJob().

54  {
55 
57 
58 }
void DTTriggerEfficiencyTest::beginRun ( const edm::Run r,
const edm::EventSetup c 
)
protectedvirtual

BeginRun.

Reimplemented from DTLocalTriggerBaseTest.

Definition at line 61 of file DTTriggerEfficiencyTest.cc.

References DTLocalTriggerBaseTest::beginRun(), and Parameters::parameters.

61  {
62 
65 
66  vector<string>::const_iterator iTr = trigSources.begin();
67  vector<string>::const_iterator trEnd = trigSources.end();
68  vector<string>::const_iterator iHw = hwSources.begin();
69  vector<string>::const_iterator hwEnd = hwSources.end();
70 
71 
72  //Booking
73  if(parameters.getUntrackedParameter<bool>("staticBooking", true)){
74  for (; iTr != trEnd; ++iTr){
75  trigSource = (*iTr);
76  for (; iHw != hwEnd; ++iHw){
77  hwSource = (*iHw);
78  // Loop over the TriggerUnits
79  for (int wh=-2; wh<=2; ++wh){
80  if (detailedPlots) {
81  for (int sect=1; sect<=12; ++sect){
82  for (int stat=1; stat<=4; ++stat){
83  DTChamberId chId(wh,stat,sect);
84  bookChambHistos(chId,"TrigEffPosvsAnglePhi","Segment");
85  bookChambHistos(chId,"TrigEffPosvsAngleCorrPhi","Segment");
86  }
87  }
88  }
89  bookWheelHistos(wh,"TrigEffPhi");
90  bookWheelHistos(wh,"TrigEffCorrPhi");
91  }
92  }
93  }
94  }
95 
96 }
T getUntrackedParameter(std::string const &, T const &) const
std::vector< std::string > trigSources
void bookChambHistos(DTChamberId chambId, std::string htype, std::string folder="")
Book the new MEs (for each chamber)
void beginRun(edm::Run const &run, edm::EventSetup const &context)
BeginRun.
edm::ESHandle< DTGeometry > muonGeom
void bookWheelHistos(int wheel, std::string hTag, std::string folder="")
Book the new MEs (for each wheel)
std::vector< std::string > hwSources
void DTTriggerEfficiencyTest::bookChambHistos ( DTChamberId  chambId,
std::string  htype,
std::string  folder = "" 
)
protected

Book the new MEs (for each chamber)

Definition at line 185 of file DTTriggerEfficiencyTest.cc.

References category(), newFWLiteAna::fullName, LogTrace, edm::max(), edm::min(), RecoTauCommonJetSelections_cfi::nbins, DetId::rawId(), DTChamberId::sector(), DTChamberId::station(), relativeConstraints::station, and DTChamberId::wheel().

185  {
186 
187  stringstream wheel; wheel << chambId.wheel();
188  stringstream station; station << chambId.station();
189  stringstream sector; sector << chambId.sector();
190 
191  string fullType = fullName(htype);
192  bool isDCC = hwSource=="DCC" ;
193  string HistoName = fullType + "_W" + wheel.str() + "_Sec" + sector.str() + "_St" + station.str();
194 
195  dbe->setCurrentFolder(topFolder(isDCC) +
196  "Wheel" + wheel.str() +
197  "/Sector" + sector.str() +
198  "/Station" + station.str() +
199  "/" + folder + "/");
200 
201  LogTrace(category()) << "[" << testName << "Test]: booking " + topFolder(isDCC) + "Wheel" << wheel.str()
202  <<"/Sector" << sector.str() << "/Station" << station.str() << "/" + folder + "/" << HistoName;
203 
204 
205  uint32_t indexChId = chambId.rawId();
206  float min, max;
207  int nbins;
208  trigGeomUtils->phiRange(chambId,min,max,nbins,20);
209  if (htype.find("TrigEffPosvsAnglePhi") == 0 ){
210  chambME[indexChId][fullType] = dbe->book2D(HistoName.c_str(),"Trigger efficiency (any qual.) position vs angle (Phi)",12,-30.,30.,nbins,min,max);
211  return;
212  }
213  if (htype.find("TrigEffPosvsAngleCorrPhi") == 0 ){
214  chambME[indexChId][fullType] = dbe->book2D(HistoName.c_str(),"Trigger efficiency (correlated) pos vs angle (Phi)",12,-30.,30.,nbins,min,max);
215  return;
216  }
217 
218 }
#define min(a, b)
Definition: mlp_lapack.h:161
std::map< uint32_t, std::map< std::string, MonitorElement * > > chambME
uint32_t rawId() const
get the raw id
Definition: DetId.h:45
const T & max(const T &a, const T &b)
#define LogTrace(id)
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.
std::string HistoName
int sector() const
Definition: DTChamberId.h:63
std::string & topFolder(bool isDCC)
Get top folder name.
int station() const
Return the station number.
Definition: DTChamberId.h:53
MonitorElement * book2D(const char *name, const char *title, int nchX, double lowX, double highX, int nchY, double lowY, double highY)
Book 2D histogram.
Definition: DQMStore.cc:642
int wheel() const
Return the wheel number.
Definition: DTChamberId.h:47
std::string fullName(std::string htype)
Create fullname from histo partial name.
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:232
void DTTriggerEfficiencyTest::makeEfficiencyME2D ( TH2F *  numerator,
TH2F *  denominator,
MonitorElement result 
)
protected

Compute 2D efficiency plots.

Definition at line 158 of file DTTriggerEfficiencyTest.cc.

References postValidation_cfi::efficiency, error, MonitorElement::getTH2F(), and mathSSE::sqrt().

158  {
159 
160  TH2F* efficiency = result->getTH2F();
161  efficiency->Divide(numerator,denominator,1,1,"");
162 
163  int nbinsx = efficiency->GetNbinsX();
164  int nbinsy = efficiency->GetNbinsY();
165  for (int binx=1; binx<=nbinsx; ++binx){
166  for (int biny=1; biny<=nbinsy; ++biny){
167  float error = 0;
168  float bineff = efficiency->GetBinContent(binx,biny);
169 
170  if (denominator->GetBinContent(binx,biny)){
171  error = sqrt(bineff*(1-bineff)/denominator->GetBinContent(binx,biny));
172  }
173  else {
174  error = 1;
175  efficiency->SetBinContent(binx,biny,0.);
176  }
177 
178  efficiency->SetBinError(binx,biny,error);
179  }
180  }
181 
182 }
T sqrt(T t)
Definition: SSEVec.h:28
TH2F * getTH2F(void) const
void DTTriggerEfficiencyTest::runClientDiagnostic ( )
protectedvirtual

DQM Client Diagnostic.

Implements DTLocalTriggerBaseTest.

Definition at line 99 of file DTTriggerEfficiencyTest.cc.

References spr::find(), newFWLiteAna::fullName, and DetId::rawId().

99  {
100 
101  // Loop over Trig & Hw sources
102  for (vector<string>::const_iterator iTr = trigSources.begin(); iTr != trigSources.end(); ++iTr){
103  trigSource = (*iTr);
104  for (vector<string>::const_iterator iHw = hwSources.begin(); iHw != hwSources.end(); ++iHw){
105  hwSource = (*iHw);
106  // Loop over the TriggerUnits
107  for (int wh=-2; wh<=2; ++wh){
108 
109  TH2F * TrigEffDenum = getHisto<TH2F>(dbe->get(getMEName("TrigEffDenum","",wh)));
110  TH2F * TrigEffNum = getHisto<TH2F>(dbe->get(getMEName("TrigEffNum","",wh)));
111  TH2F * TrigEffCorrNum = getHisto<TH2F>(dbe->get(getMEName("TrigEffCorrNum","",wh)));
112 
113  if (TrigEffDenum && TrigEffNum && TrigEffCorrNum && TrigEffDenum->GetEntries()>1) {
114 
115  if( whME[wh].find(fullName("TrigEffPhi")) == whME[wh].end() ){
116  bookWheelHistos(wh,"TrigEffPhi");
117  bookWheelHistos(wh,"TrigEffCorrPhi");
118  }
119  std::map<std::string,MonitorElement*> *innerME = &(whME[wh]);
120  makeEfficiencyME2D(TrigEffNum,TrigEffDenum,innerME->find(fullName("TrigEffPhi"))->second);
121  makeEfficiencyME2D(TrigEffCorrNum,TrigEffDenum,innerME->find(fullName("TrigEffCorrPhi"))->second);
122 
123  }
124 
125  if (detailedPlots) {
126  for (int stat=1; stat<=4; ++stat){
127  for (int sect=1; sect<=12; ++sect){
128  DTChamberId chId(wh,stat,sect);
129  uint32_t indexCh = chId.rawId();
130 
131  // Perform Efficiency analysis (Phi+Segments 2D)
132  TH2F * TrackPosvsAngle = getHisto<TH2F>(dbe->get(getMEName("TrackPosvsAngle","Segment", chId)));
133  TH2F * TrackPosvsAngleAnyQual = getHisto<TH2F>(dbe->get(getMEName("TrackPosvsAngleAnyQual","Segment", chId)));
134  TH2F * TrackPosvsAngleCorr = getHisto<TH2F>(dbe->get(getMEName("TrackPosvsAngleCorr","Segment", chId)));
135 
136  if (TrackPosvsAngle && TrackPosvsAngleAnyQual && TrackPosvsAngleCorr && TrackPosvsAngle->GetEntries()>1) {
137 
138  if( chambME[indexCh].find(fullName("TrigEffAnglePhi")) == chambME[indexCh].end()){
139  bookChambHistos(chId,"TrigEffPosvsAnglePhi","Segment");
140  bookChambHistos(chId,"TrigEffPosvsAngleCorrPhi","Segment");
141  }
142 
143  std::map<std::string,MonitorElement*> *innerME = &(chambME[indexCh]);
144  makeEfficiencyME2D(TrackPosvsAngleAnyQual,TrackPosvsAngle,innerME->find(fullName("TrigEffPosvsAnglePhi"))->second);
145  makeEfficiencyME2D(TrackPosvsAngleCorr,TrackPosvsAngle,innerME->find(fullName("TrigEffPosvsAngleCorrPhi"))->second);
146 
147  }
148  }
149  }
150  }
151  }
152 
153  }
154  }
155 
156 }
std::vector< std::string > trigSources
std::map< int, std::map< std::string, MonitorElement * > > whME
void bookChambHistos(DTChamberId chambId, std::string htype, std::string folder="")
Book the new MEs (for each chamber)
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:7
std::map< uint32_t, std::map< std::string, MonitorElement * > > chambME
void bookWheelHistos(int wheel, std::string hTag, std::string folder="")
Book the new MEs (for each wheel)
MonitorElement * get(const std::string &path) const
get ME from full pathname (e.g. &quot;my/long/dir/my_histo&quot;)
Definition: DQMStore.cc:1265
std::string getMEName(std::string histoTag, std::string subfolder, const DTChamberId &chambid)
Get the ME name (by chamber)
void makeEfficiencyME2D(TH2F *numerator, TH2F *denominator, MonitorElement *result)
Compute 2D efficiency plots.
std::vector< std::string > hwSources
std::string fullName(std::string htype)
Create fullname from histo partial name.

Member Data Documentation

std::map<uint32_t,std::map<std::string,MonitorElement*> > DTTriggerEfficiencyTest::chambME
private

Definition at line 51 of file DTTriggerEfficiencyTest.h.

bool DTTriggerEfficiencyTest::detailedPlots
private

Definition at line 53 of file DTTriggerEfficiencyTest.h.

DTTrigGeomUtils* DTTriggerEfficiencyTest::trigGeomUtils
private

Definition at line 52 of file DTTriggerEfficiencyTest.h.