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 Member Functions | Private Attributes
DTLocalTriggerLutTest Class Reference

#include <DTLocalTriggerLutTest.h>

Inheritance diagram for DTLocalTriggerLutTest:
DTLocalTriggerBaseTest edm::EDAnalyzer

Public Member Functions

 DTLocalTriggerLutTest (const edm::ParameterSet &ps)
 Constructor. More...
 
virtual ~DTLocalTriggerLutTest ()
 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 runClientDiagnostic ()
 Run client analysis. 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="", bool isGlb=false)
 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 Member Functions

void fillWhPlot (MonitorElement *plot, int sect, int stat, float value, bool lessIsBest=true)
 Fill summary plots managing double MB4 chambers. More...
 
int performLutTest (double mean, double RMS, double thresholdMean, double thresholdRMS)
 Perform Lut Test logical operations. More...
 

Private Attributes

bool doCorrStudy
 
double thresholdPhibMean
 
double thresholdPhibRMS
 
double thresholdPhiMean
 
double thresholdPhiRMS
 

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)
 
static void prevalidate (ConfigurationDescriptions &)
 
- 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 DTLocalTriggerLutTest.h.

Constructor & Destructor Documentation

DTLocalTriggerLutTest::DTLocalTriggerLutTest ( const edm::ParameterSet ps)

Constructor.

Definition at line 36 of file DTLocalTriggerLutTest.cc.

References edm::ParameterSet::getUntrackedParameter().

36  {
37 
38  setConfig(ps,"DTLocalTriggerLut");
39  baseFolderDCC = "DT/03-LocalTrigger-DCC/";
40  baseFolderDDU = "DT/04-LocalTrigger-DDU/";
41  thresholdPhiMean = ps.getUntrackedParameter<double>("thresholdPhiMean",1.5);
42  thresholdPhiRMS = ps.getUntrackedParameter<double>("thresholdPhiRMS",.5);
43  thresholdPhibMean = ps.getUntrackedParameter<double>("thresholdPhibMean",1.5);
44  thresholdPhibRMS = ps.getUntrackedParameter<double>("thresholdPhibRMS",.8);
45  doCorrStudy = ps.getUntrackedParameter<bool>("doCorrelationStudy",false);
46 
47 
48 }
T getUntrackedParameter(std::string const &, T const &) const
void setConfig(const edm::ParameterSet &ps, std::string name)
Set configuration variables.
DTLocalTriggerLutTest::~DTLocalTriggerLutTest ( )
virtual

Destructor.

Definition at line 51 of file DTLocalTriggerLutTest.cc.

51  {
52 
53 }

Member Function Documentation

void DTLocalTriggerLutTest::beginJob ( void  )
protectedvirtual

BeginJob.

Reimplemented from DTLocalTriggerBaseTest.

Definition at line 56 of file DTLocalTriggerLutTest.cc.

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

56  {
57 
59 
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();
64 
65  //Booking
66  if(parameters.getUntrackedParameter<bool>("staticBooking", true)){
67  for (; iTr != trEnd; ++iTr){
68  trigSource = (*iTr);
69  for (; iHw != hwEnd; ++iHw){
70  hwSource = (*iHw);
71  // Loop over the TriggerUnits
72  for (int wh=-2; wh<=2; ++wh){
73  bookWheelHistos(wh,"PhiResidualMean");
74  bookWheelHistos(wh,"PhiResidualRMS");
75  bookWheelHistos(wh,"PhibResidualMean");
76  bookWheelHistos(wh,"PhibResidualRMS");
77  if (doCorrStudy) {
78  bookWheelHistos(wh,"PhiTkvsTrigSlope");
79  bookWheelHistos(wh,"PhiTkvsTrigIntercept");
80  bookWheelHistos(wh,"PhiTkvsTrigCorr");
81  bookWheelHistos(wh,"PhibTkvsTrigSlope");
82  bookWheelHistos(wh,"PhibTkvsTrigIntercept");
83  bookWheelHistos(wh,"PhibTkvsTrigCorr");
84  }
85  }
86  }
87  }
88  }
89 
90  // Summary test histo booking (only static)
91  for (iTr = trigSources.begin(); iTr != trEnd; ++iTr){
92  trigSource = (*iTr);
93  for (iHw = hwSources.begin(); iHw != hwSources.end(); ++iHw){
94  hwSource = (*iHw);
95  // Loop over the TriggerUnits
96  for (int wh=-2; wh<=2; ++wh){
97  bookWheelHistos(wh,"PhiLutSummary");
98  bookWheelHistos(wh,"PhibLutSummary");
99  }
100  bookCmsHistos("PhiLutSummary");
101  bookCmsHistos("PhibLutSummary");
102  }
103  }
104 
105 }
T getUntrackedParameter(std::string const &, T const &) const
std::vector< std::string > trigSources
void bookCmsHistos(std::string hTag, std::string folder="", bool isGlb=false)
Book the new MEs (CMS summary)
void bookWheelHistos(int wheel, std::string hTag, std::string folder="")
Book the new MEs (for each wheel)
std::vector< std::string > hwSources
void DTLocalTriggerLutTest::beginRun ( const edm::Run r,
const edm::EventSetup c 
)
protectedvirtual

BeginRun.

Reimplemented from DTLocalTriggerBaseTest.

Definition at line 108 of file DTLocalTriggerLutTest.cc.

References DTLocalTriggerBaseTest::beginRun().

108  {
109 
111 
112 }
void beginRun(edm::Run const &run, edm::EventSetup const &context)
BeginRun.
void DTLocalTriggerLutTest::fillWhPlot ( MonitorElement plot,
int  sect,
int  stat,
float  value,
bool  lessIsBest = true 
)
private

Fill summary plots managing double MB4 chambers.

Definition at line 333 of file DTLocalTriggerLutTest.cc.

References MonitorElement::getBinContent(), and MonitorElement::setBinContent().

333  {
334 
335  if (sect>12) {
336  int scsect = sect==13 ? 4 : 10;
337  if ( (fabs(value)>fabs(plot->getBinContent(scsect,stat)))==lessIsBest) {
338  plot->setBinContent(scsect,stat,value);
339  }
340  }
341  else {
342  plot->setBinContent(sect,stat,value);
343  }
344 
345  return;
346 
347 }
void setBinContent(int binx, double content)
set content of bin (1-D)
double getBinContent(int binx) const
get content of bin (1-D)
int DTLocalTriggerLutTest::performLutTest ( double  mean,
double  RMS,
double  thresholdMean,
double  thresholdRMS 
)
private

Perform Lut Test logical operations.

Definition at line 324 of file DTLocalTriggerLutTest.cc.

324  {
325 
326  bool meanErr = fabs(mean)>thresholdMean;
327  bool rmsErr = RMS>thresholdRMS;
328 
329  return (meanErr || rmsErr) ? 2+(meanErr!=rmsErr) : 0 ;
330 
331 }
void DTLocalTriggerLutTest::runClientDiagnostic ( )
protectedvirtual

Run client analysis.

Implements DTLocalTriggerBaseTest.

Definition at line 115 of file DTLocalTriggerLutTest.cc.

References python.rootplot.argparse::category, spr::find(), newFWLiteAna::fullName, edm::second(), and DTChamberId::wheel().

115  {
116 
117  // Loop over Trig & Hw sources
118  for (vector<string>::const_iterator iTr = trigSources.begin(); iTr != trigSources.end(); ++iTr){
119  trigSource = (*iTr);
120  for (vector<string>::const_iterator iHw = hwSources.begin(); iHw != hwSources.end(); ++iHw){
121  hwSource = (*iHw);
122  vector<DTChamber*>::const_iterator chIt = muonGeom->chambers().begin();
123  vector<DTChamber*>::const_iterator chEnd = muonGeom->chambers().end();
124  for (; chIt != chEnd; ++chIt) {
125  DTChamberId chId((*chIt)->id());
126  int wh = chId.wheel();
127  int sect = chId.sector();
128  int stat = chId.station();
129 
130 
131  if (doCorrStudy) {
132  // Perform Correlation Plots analysis (DCC + segment Phi)
133  TH2F * TrackPhitkvsPhitrig = getHisto<TH2F>(dbe->get(getMEName("PhitkvsPhitrig","Segment", chId)));
134 
135  if (TrackPhitkvsPhitrig && TrackPhitkvsPhitrig->GetEntries()>10) {
136 
137  // Fill client histos
138  if( whME[wh].find(fullName("PhiTkvsTrigCorr")) == whME[wh].end() ){
139  bookWheelHistos(wh,"PhiTkvsTrigSlope");
140  bookWheelHistos(wh,"PhiTkvsTrigIntercept");
141  bookWheelHistos(wh,"PhiTkvsTrigCorr");
142  }
143 
144  TProfile* PhitkvsPhitrigProf = TrackPhitkvsPhitrig->ProfileX();
145  double phiInt = 0;
146  double phiSlope = 0;
147  double phiCorr = 0;
148  try {
149  PhitkvsPhitrigProf->Fit("pol1","CQO");
150  TF1 *ffPhi= PhitkvsPhitrigProf->GetFunction("pol1");
151  if (ffPhi) {
152  phiInt = ffPhi->GetParameter(0);
153  phiSlope = ffPhi->GetParameter(1);
154  phiCorr = TrackPhitkvsPhitrig->GetCorrelationFactor();
155  }
156  } catch (...) {
157  edm::LogError(category()) << "[" << testName << "Test]: Error fitting PhitkvsPhitrig for Wheel " << wh
158  <<" Sector " << sect << " Station " << stat;
159  }
160 
161  std::map<std::string,MonitorElement*> &innerME = whME[wh];
162  fillWhPlot(innerME.find(fullName("PhiTkvsTrigSlope"))->second,sect,stat,phiSlope-1);
163  fillWhPlot(innerME.find(fullName("PhiTkvsTrigIntercept"))->second,sect,stat,phiInt);
164  fillWhPlot(innerME.find(fullName("PhiTkvsTrigCorr"))->second,sect,stat,phiCorr,false);
165 
166  }
167 
168  // Perform Correlation Plots analysis (DCC + segment Phib)
169  TH2F * TrackPhibtkvsPhibtrig = getHisto<TH2F>(dbe->get(getMEName("PhibtkvsPhibtrig","Segment", chId)));
170 
171  if (stat != 3 && TrackPhibtkvsPhibtrig && TrackPhibtkvsPhibtrig->GetEntries()>10) {// station 3 has no meaningful MB3 phi bending information
172 
173  // Fill client histos
174  if( whME[wh].find(fullName("PhibTkvsTrigCorr")) == whME[wh].end() ){
175  bookWheelHistos(wh,"PhibTkvsTrigSlope");
176  bookWheelHistos(wh,"PhibTkvsTrigIntercept");
177  bookWheelHistos(wh,"PhibTkvsTrigCorr");
178  }
179 
180  TProfile* PhibtkvsPhibtrigProf = TrackPhibtkvsPhibtrig->ProfileX();
181  double phibInt = 0;
182  double phibSlope = 0;
183  double phibCorr = 0;
184  try {
185  PhibtkvsPhibtrigProf->Fit("pol1","CQO");
186  TF1 *ffPhib= PhibtkvsPhibtrigProf->GetFunction("pol1");
187  if (ffPhib) {
188  phibInt = ffPhib->GetParameter(0);
189  phibSlope = ffPhib->GetParameter(1);
190  phibCorr = TrackPhibtkvsPhibtrig->GetCorrelationFactor();
191  }
192  } catch (...) {
193  edm::LogError(category()) << "[" << testName << "Test]: Error fitting PhibtkvsPhibtrig for Wheel " << wh
194  <<" Sector " << sect << " Station " << stat;
195  }
196 
197  std::map<std::string,MonitorElement*> &innerME = whME[wh];
198  fillWhPlot(innerME.find(fullName("PhibTkvsTrigSlope"))->second,sect,stat,phibSlope-1);
199  fillWhPlot(innerME.find(fullName("PhibTkvsTrigIntercept"))->second,sect,stat,phibInt);
200  fillWhPlot(innerME.find(fullName("PhibTkvsTrigCorr"))->second,sect,stat,phibCorr,false);
201 
202  }
203 
204  }
205 
206  // Make Phi Residual Summary
207  TH1F * PhiResidual = getHisto<TH1F>(dbe->get(getMEName("PhiResidual","Segment", chId)));
208  int phiSummary = 1;
209 
210  if (PhiResidual && PhiResidual->GetEffectiveEntries()>10) {
211 
212  // Fill client histos
213  if( whME[wh].find(fullName("PhiResidualMean")) == whME[wh].end() ){
214  bookWheelHistos(wh,"PhiResidualMean");
215  bookWheelHistos(wh,"PhiResidualRMS");
216  }
217 
218  double peak = PhiResidual->GetBinCenter(PhiResidual->GetMaximumBin());
219  double phiMean = 0;
220  double phiRMS = 0;
221  try {
222  PhiResidual->Fit("gaus","CQO","",peak-5,peak+5);
223  TF1 *ffPhi = PhiResidual->GetFunction("gaus");
224  if ( ffPhi ) {
225  phiMean = ffPhi->GetParameter(1);
226  phiRMS = ffPhi->GetParameter(2);
227  }
228  } catch (...) {
229  edm::LogError(category()) << "[" << testName << "Test]: Error fitting PhiResidual for Wheel " << wh
230  <<" Sector " << sect << " Station " << stat;
231  }
232 
233  std::map<std::string,MonitorElement*> &innerME = whME[wh];
234  fillWhPlot(innerME.find(fullName("PhiResidualMean"))->second,sect,stat,phiMean);
235  fillWhPlot(innerME.find(fullName("PhiResidualRMS"))->second,sect,stat,phiRMS);
236 
237  phiSummary = performLutTest(phiMean,phiRMS,thresholdPhiMean,thresholdPhiRMS);
238 
239  }
240  fillWhPlot(whME[wh].find(fullName("PhiLutSummary"))->second,sect,stat,phiSummary);
241 
242  // Make Phib Residual Summary
243  TH1F * PhibResidual = getHisto<TH1F>(dbe->get(getMEName("PhibResidual","Segment", chId)));
244  int phibSummary = stat==3 ? 0 : 1; // station 3 has no meaningful MB3 phi bending information
245 
246  if (stat != 3 && PhibResidual && PhibResidual->GetEffectiveEntries()>10) {// station 3 has no meaningful MB3 phi bending information
247 
248  // Fill client histos
249  if( whME[wh].find(fullName("PhibResidualMean")) == whME[wh].end() ){
250  bookWheelHistos(wh,"PhibResidualMean");
251  bookWheelHistos(wh,"PhibResidualRMS");
252  }
253 
254  double peak = PhibResidual->GetBinCenter(PhibResidual->GetMaximumBin());
255  double phibMean = 0;
256  double phibRMS = 0;
257  try {
258  PhibResidual->Fit("gaus","CQO","",peak-5,peak+5);
259  TF1 *ffPhib = PhibResidual->GetFunction("gaus");
260  if ( ffPhib ) {
261  phibMean = ffPhib->GetParameter(1);
262  phibRMS = ffPhib->GetParameter(2);
263  }
264  } catch (...) {
265  edm::LogError(category()) << "[" << testName << "Test]: Error fitting PhibResidual for Wheel " << wh
266  <<" Sector " << sect << " Station " << stat;
267  }
268 
269  std::map<std::string,MonitorElement*> &innerME = whME[wh];
270  fillWhPlot(innerME.find(fullName("PhibResidualMean"))->second,sect,stat,phibMean);
271  fillWhPlot(innerME.find(fullName("PhibResidualRMS"))->second,sect,stat,phibRMS);
272 
273  phibSummary = performLutTest(phibMean,phibRMS,thresholdPhibMean,thresholdPhibRMS);
274 
275  }
276  fillWhPlot(whME[wh].find(fullName("PhibLutSummary"))->second,sect,stat,phibSummary);
277 
278  }
279  }
280  }
281 
282  // Barrel Summary Plots
283  for (vector<string>::const_iterator iTr = trigSources.begin(); iTr != trigSources.end(); ++iTr){
284  trigSource = (*iTr);
285  for (vector<string>::const_iterator iHw = hwSources.begin(); iHw != hwSources.end(); ++iHw){
286  hwSource = (*iHw);
287  for (int wh=-2; wh<=2; ++wh){
288  std::map<std::string,MonitorElement*> *innerME = &(whME[wh]);
289 
290  TH2F* phiWhSummary = getHisto<TH2F>(innerME->find(fullName("PhiLutSummary"))->second);
291  TH2F* phibWhSummary = getHisto<TH2F>(innerME->find(fullName("PhibLutSummary"))->second);
292  for (int sect=1; sect<=12; ++sect){
293  int phiErr = 0;
294  int phibErr = 0;
295  int phiNoData = 0;
296  int phibNoData = 0;
297  for (int stat=1; stat<=4; ++stat){
298  switch (static_cast<int>(phiWhSummary->GetBinContent(sect,stat))) {
299  case 1:
300  phiNoData++;
301  case 2:
302  case 3:
303  phiErr++;
304  }
305  switch (static_cast<int>(phibWhSummary->GetBinContent(sect,stat))) {
306  case 1:
307  phibNoData++;
308  case 2:
309  case 3:
310  phibErr++;
311  }
312  }
313  if (phiNoData == 4) phiErr = 5;
314  if (phibNoData == 3) phibErr = 5; // MB3 has no phib information
315  cmsME.find(fullName("PhiLutSummary"))->second->setBinContent(sect,wh+3,phiErr);
316  cmsME.find(fullName("PhibLutSummary"))->second->setBinContent(sect,wh+3,phibErr);
317  }
318  }
319  }
320  }
321 
322 }
std::vector< std::string > trigSources
std::map< int, std::map< std::string, MonitorElement * > > whME
int performLutTest(double mean, double RMS, double thresholdMean, double thresholdRMS)
Perform Lut Test logical operations.
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:7
edm::ESHandle< DTGeometry > muonGeom
void fillWhPlot(MonitorElement *plot, int sect, int stat, float value, bool lessIsBest=true)
Fill summary plots managing double MB4 chambers.
U second(std::pair< T, U > const &p)
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:1468
std::string category()
Get message logger name.
std::string getMEName(std::string histoTag, std::string subfolder, const DTChamberId &chambid)
Get the ME name (by chamber)
std::map< std::string, MonitorElement * > cmsME
std::vector< std::string > hwSources
int wheel() const
Return the wheel number.
Definition: DTChamberId.h:47
std::string fullName(std::string htype)
Create fullname from histo partial name.

Member Data Documentation

bool DTLocalTriggerLutTest::doCorrStudy
private

Definition at line 52 of file DTLocalTriggerLutTest.h.

double DTLocalTriggerLutTest::thresholdPhibMean
private

Definition at line 50 of file DTLocalTriggerLutTest.h.

double DTLocalTriggerLutTest::thresholdPhibRMS
private

Definition at line 51 of file DTLocalTriggerLutTest.h.

double DTLocalTriggerLutTest::thresholdPhiMean
private

Definition at line 50 of file DTLocalTriggerLutTest.h.

double DTLocalTriggerLutTest::thresholdPhiRMS
private

Definition at line 51 of file DTLocalTriggerLutTest.h.