CMS 3D CMS Logo

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

#include <DTNoiseCalibration.h>

Inheritance diagram for DTNoiseCalibration:
edm::EDAnalyzer

Classes

class  DTNoiseCalibration
 

Public Member Functions

void analyze (const edm::Event &e, const edm::EventSetup &c)
 
void beginJob ()
 
void beginRun (const edm::Run &run, const edm::EventSetup &setup)
 
 DTNoiseCalibration (const edm::ParameterSet &ps)
 Constructor. More...
 
void endJob ()
 
virtual ~DTNoiseCalibration ()
 Destructor. More...
 
- Public Member Functions inherited from edm::EDAnalyzer
 EDAnalyzer ()
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 

Private Member Functions

std::string getChamberName (const DTChamberId &) const
 
std::string getChannelName (const DTWireId &) const
 
std::string getLayerName (const DTLayerId &) const
 
std::string getSuperLayerName (const DTSuperLayerId &) const
 

Private Attributes

std::map< DTChamberId, TH1F * > chamberOccupancyVsLumiMap_
 
std::map< DTChamberId, TH1F * > chamberOccupancyVsTimeMap_
 
std::string dbLabel_
 
int defaultTtrig_
 
edm::InputTag digiLabel_
 
edm::ESHandle< DTGeometrydtGeom_
 
TH1F * hTDCTriggerWidth_
 
unsigned int lumiMax_
 
double maximumNoiseRate_
 
int nevents_
 
bool readDB_
 
TFile * rootFile_
 
time_t runBeginTime_
 
time_t runEndTime_
 
std::map< DTLayerId, TH1F * > theHistoOccupancyMap_
 
std::map< DTWireId, TH1F * > theHistoOccupancyVsLumiMap_
 
int timeWindowOffset_
 
double triggerWidth_
 
edm::ESHandle< DTTtrigtTrigMap_
 
bool useAbsoluteRate_
 
bool useTimeWindow_
 
std::vector< DTWireIdwireIdWithHisto_
 

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 Member Functions inherited from edm::EDAnalyzer
CurrentProcessingContext const * currentContext () const
 

Detailed Description

Definition at line 33 of file DTNoiseCalibration.h.

Constructor & Destructor Documentation

Constructor.

Definition at line 44 of file DTNoiseCalibration.cc.

References defaultTtrig_, edm::ParameterSet::exists(), edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), readDB_, rootFile_, dtTPAnalyzer_cfg::rootFileName, relativeConstraints::station, and wireIdWithHisto_.

44  :
45  digiLabel_( pset.getParameter<InputTag>("digiLabel") ),
46  useTimeWindow_( pset.getParameter<bool>("useTimeWindow") ),
47  triggerWidth_( pset.getParameter<double>("triggerWidth") ),
48  timeWindowOffset_( pset.getParameter<int>("timeWindowOffset") ),
49  maximumNoiseRate_( pset.getParameter<double>("maximumNoiseRate") ),
50  useAbsoluteRate_( pset.getParameter<bool>("useAbsoluteRate") ),
51  readDB_(true), defaultTtrig_(0),
52  dbLabel_( pset.getUntrackedParameter<string>("dbLabel", "") ),
53  //fastAnalysis_( pset.getParameter<bool>("fastAnalysis", true) ),
54  wireIdWithHisto_( std::vector<DTWireId>() ),
55  lumiMax_(3000)
56  {
57 
58  // Get the debug parameter for verbose output
59  //debug = ps.getUntrackedParameter<bool>("debug");
60  /*// The analysis type
61  // The wheel & sector interested for the time-dependent analysis
62  wh = ps.getUntrackedParameter<int>("wheel", 0);
63  sect = ps.getUntrackedParameter<int>("sector", 6);*/
64 
65  if( pset.exists("defaultTtrig") ){
66  readDB_ = false;
67  defaultTtrig_ = pset.getParameter<int>("defaultTtrig");
68  }
69 
70  if( pset.exists("cellsWithHisto") ){
71  vector<string> cellsWithHisto = pset.getParameter<vector<string> >("cellsWithHisto");
72  for(vector<string>::const_iterator cell = cellsWithHisto.begin(); cell != cellsWithHisto.end(); ++cell){
73  //FIXME: Use regex to check whether format is right
74  if( (*cell) != "" && (*cell) != "None"){
75  stringstream linestr;
76  int wheel,station,sector,sl,layer,wire;
77  linestr << (*cell);
78  linestr >> wheel >> station >> sector >> sl >> layer >> wire;
79  wireIdWithHisto_.push_back(DTWireId(wheel,station,sector,sl,layer,wire));
80  }
81  }
82  }
83 
84  // The root file which will contain the histos
85  string rootFileName = pset.getUntrackedParameter<string>("rootFileName","noise.root");
86  rootFile_ = new TFile(rootFileName.c_str(), "RECREATE");
87  rootFile_->cd();
88 }
edm::InputTag digiLabel_
std::vector< DTWireId > wireIdWithHisto_
DTNoiseCalibration::~DTNoiseCalibration ( )
virtual

Destructor.

Definition at line 418 of file DTNoiseCalibration.cc.

418  {
419  rootFile_->Close();
420 }

Member Function Documentation

void DTNoiseCalibration::analyze ( const edm::Event e,
const edm::EventSetup c 
)
virtual

Implements edm::EDAnalyzer.

Definition at line 120 of file DTNoiseCalibration.cc.

References DTSuperLayerId::chamberId(), DTTimeUnits::counts, edm::hlt::Exception, spr::find(), DTTopology::firstChannel(), gen::k, DTTopology::lastChannel(), LogTrace, edm::second(), ntuplemaker::status, edm::EventBase::time(), and edm::Timestamp::value().

120  {
121  ++nevents_;
122 
123  // Get the digis from the event
124  Handle<DTDigiCollection> dtdigis;
125  event.getByLabel(digiLabel_, dtdigis);
126 
127  /*TH1F *hOccupancyHisto;
128  TH2F *hEvtPerWireH;
129  string Histo2Name;*/
130 
131  //RunNumber_t runNumber = event.id().run();
132  time_t eventTime = time_t(event.time().value()>>32);
133  unsigned int lumiSection = event.luminosityBlock();
134 
135  // Loop over digis
137  for (dtLayerId_It=dtdigis->begin(); dtLayerId_It!=dtdigis->end(); ++dtLayerId_It){
138  // Define time window
139  float upperLimit = 0.;
140  if(useTimeWindow_){
141  if( readDB_ ){
142  float tTrig,tTrigRMS,kFactor;
143  DTSuperLayerId slId = ((*dtLayerId_It).first).superlayerId();
144  int status = tTrigMap_->get( slId, tTrig, tTrigRMS, kFactor, DTTimeUnits::counts );
145  if(status != 0) throw cms::Exception("DTNoiseCalibration") << "Could not find tTrig entry in DB for" << slId << endl;
146  upperLimit = tTrig - timeWindowOffset_;
147  } else {
148  upperLimit = defaultTtrig_ - timeWindowOffset_;
149  }
150  }
151 
152  double triggerWidth_s = 0.;
153  if(useTimeWindow_) triggerWidth_s = ( (upperLimit*25)/32 )/1e9;
154  else triggerWidth_s = double(triggerWidth_/1e9);
155  LogTrace("Calibration") << ((*dtLayerId_It).first).superlayerId() << " Trigger width (s): " << triggerWidth_s;
156 
157  for (DTDigiCollection::const_iterator digiIt = ((*dtLayerId_It).second).first;
158  digiIt!=((*dtLayerId_It).second).second; ++digiIt){
159 
160  //Check the TDC trigger width
161  int tdcTime = (*digiIt).countsTDC();
162  if( !useTimeWindow_ ){
163  if( ( ((float)tdcTime*25)/32 ) > triggerWidth_ ){
164  LogError("Calibration") << "Digi has a TDC time (ns) higher than the pre-defined TDC trigger width: " << ((float)tdcTime*25)/32;
165  continue;
166  }
167  }
168 
169  hTDCTriggerWidth_->Fill(tdcTime);
170 
171  if( useTimeWindow_ && tdcTime > upperLimit) continue;
172 
173  /*LogTrace("Calibration") << "TDC time (ns): " << ((float)tdcTime*25)/32
174  <<" --- trigger width (ns): " << ((float)upperLimit*25)/32;*/
175 
176  const DTLayerId dtLId = (*dtLayerId_It).first;
177  const DTTopology& dtTopo = dtGeom_->layer(dtLId)->specificTopology();
178  const int firstWire = dtTopo.firstChannel();
179  const int lastWire = dtTopo.lastChannel();
180  //const int nWires = dtTopo.channels();
181  const int nWires = lastWire - firstWire + 1;
182 
183  // Book the occupancy histos
184  if( theHistoOccupancyMap_.find(dtLId) == theHistoOccupancyMap_.end() ){
185  string histoName = "DigiOccupancy_" + getLayerName(dtLId);
186  rootFile_->cd();
187  TH1F* hOccupancyHisto = new TH1F(histoName.c_str(), histoName.c_str(), nWires, firstWire, lastWire+1);
188  LogTrace("Calibration") << " Created occupancy Histo: " << hOccupancyHisto->GetName();
189  theHistoOccupancyMap_[dtLId] = hOccupancyHisto;
190  }
191  theHistoOccupancyMap_[dtLId]->Fill( (*digiIt).wire(), 1./triggerWidth_s );
192 
193  // Histos vs lumi section
194  const DTChamberId dtChId = dtLId.chamberId();
195  if( chamberOccupancyVsLumiMap_.find(dtChId) == chamberOccupancyVsLumiMap_.end() ){
196  string histoName = "OccupancyVsLumi_" + getChamberName(dtChId);
197  rootFile_->cd();
198  TH1F* hOccupancyVsLumiHisto = new TH1F(histoName.c_str(), histoName.c_str(), lumiMax_, 0, lumiMax_);
199  LogTrace("Calibration") << " Created occupancy histo: " << hOccupancyVsLumiHisto->GetName();
200  chamberOccupancyVsLumiMap_[dtChId] = hOccupancyVsLumiHisto;
201  }
202  chamberOccupancyVsLumiMap_[dtChId]->Fill( lumiSection, 1./triggerWidth_s );
203 
204  const DTWireId wireId(dtLId, (*digiIt).wire());
205  if( find(wireIdWithHisto_.begin(),wireIdWithHisto_.end(),wireId) != wireIdWithHisto_.end() ){
206  if( theHistoOccupancyVsLumiMap_.find(wireId) == theHistoOccupancyVsLumiMap_.end() ){
207  string histoName = "OccupancyVsLumi_" + getChannelName(wireId);
208  rootFile_->cd();
209  TH1F* hOccupancyVsLumiHisto = new TH1F(histoName.c_str(), histoName.c_str(), lumiMax_, 0, lumiMax_);
210  LogTrace("Calibration") << " Created occupancy histo: " << hOccupancyVsLumiHisto->GetName();
211  theHistoOccupancyVsLumiMap_[wireId] = hOccupancyVsLumiHisto;
212  }
213  theHistoOccupancyVsLumiMap_[wireId]->Fill( lumiSection, 1./triggerWidth_s );
214  }
215 
216  // Histos vs time
217  if( chamberOccupancyVsTimeMap_.find(dtChId) == chamberOccupancyVsTimeMap_.end() ){
218  string histoName = "OccupancyVsTime_" + getChamberName(dtChId);
219  float secPerBin = 20.0;
220  unsigned int nBins = ( (unsigned int)(runEndTime_ - runBeginTime_) )/secPerBin;
221  rootFile_->cd();
222  TH1F* hOccupancyVsTimeHisto = new TH1F(histoName.c_str(), histoName.c_str(),
223  nBins, (unsigned int)runBeginTime_,
224  (unsigned int)runEndTime_);
225  for(int k = 0; k < hOccupancyVsTimeHisto->GetNbinsX(); ++k){
226  if( k%10 == 0 ){
227  unsigned int binLowEdge = hOccupancyVsTimeHisto->GetBinLowEdge(k+1);
228  time_t timeValue = time_t(binLowEdge);
229  hOccupancyVsTimeHisto->GetXaxis()->SetBinLabel( (k+1),ctime(&timeValue) );
230  }
231  }
232  size_t lastBin = hOccupancyVsTimeHisto->GetNbinsX();
233  unsigned int binUpperEdge = hOccupancyVsTimeHisto->GetBinLowEdge(lastBin) +
234  hOccupancyVsTimeHisto->GetBinWidth(lastBin);
235  time_t timeValue = time_t(binUpperEdge);
236  hOccupancyVsTimeHisto->GetXaxis()->SetBinLabel( (lastBin),ctime(&timeValue) );
237 
238  LogTrace("Calibration") << " Created occupancy histo: " << hOccupancyVsTimeHisto->GetName();
239  chamberOccupancyVsTimeMap_[dtChId] = hOccupancyVsTimeHisto;
240  }
241  chamberOccupancyVsTimeMap_[dtChId]->Fill( (unsigned int)eventTime, 1./triggerWidth_s );
242 
243  /*// Book the digi event plot every 1000 events if the analysis is not "fast" and if is the correct sector
244  if(!fastAnalysis &&
245  dtLId.superlayerId().chamberId().wheel()==wh &&
246  dtLId.superlayerId().chamberId().sector()==sect) {
247  if(theHistoEvtPerWireMap.find(dtLId) == theHistoEvtPerWireMap.end() ||
248  (theHistoEvtPerWireMap.find(dtLId) != theHistoEvtPerWireMap.end() &&
249  skippedPlot[dtLId] != counter)){
250  skippedPlot[dtLId] = counter;
251  stringstream toAppend; toAppend << counter;
252  Histo2Name = "DigiPerWirePerEvent_" + getLayerName(dtLId) + "_" + toAppend.str();
253  theFile->cd();
254  hEvtPerWireH = new TH2F(Histo2Name.c_str(), Histo2Name.c_str(), 1000,0.5,1000.5,nWires, firstWire, lastWire+1);
255  if(hEvtPerWireH){
256  if(debug)
257  cout << " New Histo with the number of digi per evt per wire: " << hEvtPerWireH->GetName() << endl;
258  theHistoEvtPerWireMap[dtLId]=hEvtPerWireH;
259  }
260  }
261  }*/
262  }
263  }
264 
265  /*//Fill the plot of the number of digi per event per wire
266  std::map<int,int > DigiPerWirePerEvent;
267  // LOOP OVER ALL THE CHAMBERS
268  vector<DTChamber*>::const_iterator ch_it = dtGeom->chambers().begin();
269  vector<DTChamber*>::const_iterator ch_end = dtGeom->chambers().end();
270  for (; ch_it != ch_end; ++ch_it) {
271  DTChamberId ch = (*ch_it)->id();
272  vector<const DTSuperLayer*>::const_iterator sl_it = (*ch_it)->superLayers().begin();
273  vector<const DTSuperLayer*>::const_iterator sl_end = (*ch_it)->superLayers().end();
274  // Loop over the SLs
275  for(; sl_it != sl_end; ++sl_it) {
276  DTSuperLayerId sl = (*sl_it)->id();
277  vector<const DTLayer*>::const_iterator l_it = (*sl_it)->layers().begin();
278  vector<const DTLayer*>::const_iterator l_end = (*sl_it)->layers().end();
279  // Loop over the Ls
280  for(; l_it != l_end; ++l_it) {
281  DTLayerId layerId = (*l_it)->id();
282 
283  // Get the number of wires
284  const DTTopology& dtTopo = dtGeom->layer(layerId)->specificTopology();
285  const int firstWire = dtTopo.firstChannel();
286  const int lastWire = dtTopo.lastChannel();
287 
288  if (theHistoEvtPerWireMap.find(layerId) != theHistoEvtPerWireMap.end() &&
289  skippedPlot[layerId] == counter) {
290 
291  for (int wire=firstWire; wire<=lastWire; wire++) {
292  DigiPerWirePerEvent[wire]= 0;
293  }
294  // loop over all the digis of the event
295  DTDigiCollection::Range layerDigi= dtdigis->get(layerId);
296  for (DTDigiCollection::const_iterator digi = layerDigi.first;
297  digi!=layerDigi.second;
298  ++digi){
299  if((cosmicRun && (*digi).countsTDC()<upperLimit) || (!cosmicRun))
300  DigiPerWirePerEvent[(*digi).wire()]+=1;
301  }
302  // fill the digi event histo
303  for (int wire=firstWire; wire<=lastWire; wire++) {
304  theFile->cd();
305  int histoEvents = nevents - (counter*1000);
306  theHistoEvtPerWireMap[layerId]->Fill(histoEvents,wire,DigiPerWirePerEvent[wire]);
307  }
308  }
309  } //Loop Ls
310  } //Loop SLs
311  } //Loop chambers
312 
313 
314  if(nevents % 1000 == 0) {
315  counter++;
316  // save the digis event plot on file
317  for(map<DTLayerId, TH2F* >::const_iterator lHisto = theHistoEvtPerWireMap.begin();
318  lHisto != theHistoEvtPerWireMap.end();
319  lHisto++) {
320  theFile->cd();
321  if((*lHisto).second)
322  (*lHisto).second->Write();
323  }
324  theHistoEvtPerWireMap.clear();
325  }*/
326 
327 }
edm::ESHandle< DTGeometry > dtGeom_
DTChamberId chamberId() const
Return the corresponding ChamberId.
edm::InputTag digiLabel_
std::vector< DTWireId > wireIdWithHisto_
std::map< DTLayerId, TH1F * > theHistoOccupancyMap_
std::string getChannelName(const DTWireId &) const
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:7
std::map< DTChamberId, TH1F * > chamberOccupancyVsTimeMap_
std::string getChamberName(const DTChamberId &) const
std::map< DTChamberId, TH1F * > chamberOccupancyVsLumiMap_
int firstChannel() const
Returns the wire number of the first wire.
Definition: DTTopology.h:80
std::string getLayerName(const DTLayerId &) const
std::map< DTWireId, TH1F * > theHistoOccupancyVsLumiMap_
U second(std::pair< T, U > const &p)
int lastChannel() const
Returns the wire number of the last wire.
Definition: DTTopology.h:82
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
#define LogTrace(id)
int k[5][pyjets_maxn]
std::vector< DigiType >::const_iterator const_iterator
tuple status
Definition: ntuplemaker.py:245
edm::ESHandle< DTTtrig > tTrigMap_
void DTNoiseCalibration::beginJob ( void  )
virtual

Reimplemented from edm::EDAnalyzer.

Definition at line 90 of file DTNoiseCalibration.cc.

90  {
91  LogVerbatim("Calibration") << "[DTNoiseCalibration]: Begin job";
92 
93  nevents_ = 0;
94 
95  TH1::SetDefaultSumw2(true);
96  int numBin = (triggerWidth_*32/25)/50;
97  hTDCTriggerWidth_ = new TH1F("TDC_Time_Distribution", "TDC_Time_Distribution", numBin, 0, triggerWidth_*32/25);
98 }
void DTNoiseCalibration::beginRun ( const edm::Run run,
const edm::EventSetup setup 
)
virtual

Reimplemented from edm::EDAnalyzer.

Definition at line 100 of file DTNoiseCalibration.cc.

References edm::RunBase::beginTime(), edm::RunBase::endTime(), edm::EventSetup::get(), and edm::Timestamp::value().

100  {
101 
102  // Get the DT Geometry
103  setup.get<MuonGeometryRecord>().get(dtGeom_);
104 
105  // tTrig
106  if( readDB_ ) setup.get<DTTtrigRcd>().get(dbLabel_,tTrigMap_);
107 
108  runBeginTime_ = time_t(run.beginTime().value()>>32);
109  runEndTime_ = time_t(run.endTime().value()>>32);
110  /*
111  nevents = 0;
112  counter = 0;
113 
114  // TDC time distribution
115  int numBin = (triggerWidth_*(32/25))/50;
116  hTDCTriggerWidth = new TH1F("TDC_Time_Distribution", "TDC_Time_Distribution", numBin, 0, triggerWidth_*(32/25));*/
117 
118 }
Timestamp const & endTime() const
Definition: RunBase.h:44
edm::ESHandle< DTGeometry > dtGeom_
TimeValue_t value() const
Definition: Timestamp.cc:72
const T & get() const
Definition: EventSetup.h:55
Timestamp const & beginTime() const
Definition: RunBase.h:43
edm::ESHandle< DTTtrig > tTrigMap_
void DTNoiseCalibration::endJob ( void  )
virtual

Reimplemented from edm::EDAnalyzer.

Definition at line 329 of file DTNoiseCalibration.cc.

References newFWLiteAna::bin, DTTopology::firstChannel(), DTTopology::lastChannel(), LogTrace, record, DTStatusFlag::setCellNoise(), and crabStatusFromReport::statusMap.

329  {
330 
331  //LogVerbatim("Calibration") << "[DTNoiseCalibration] endjob called!";
332  LogVerbatim("Calibration") << "[DTNoiseCalibration] Total number of events analyzed: " << nevents_;
333 
334  // Save the TDC digi plot
335  rootFile_->cd();
336  hTDCTriggerWidth_->Write();
337 
338  double normalization = 1./double(nevents_);
339 
340  for(map<DTWireId, TH1F*>::const_iterator wHisto = theHistoOccupancyVsLumiMap_.begin();
341  wHisto != theHistoOccupancyVsLumiMap_.end(); ++wHisto){
342  (*wHisto).second->Scale(normalization);
343  (*wHisto).second->Write();
344  }
345 
346  for(map<DTChamberId, TH1F*>::const_iterator chHisto = chamberOccupancyVsLumiMap_.begin();
347  chHisto != chamberOccupancyVsLumiMap_.end(); ++chHisto){
348  (*chHisto).second->Scale(normalization);
349  (*chHisto).second->Write();
350  }
351 
352  for(map<DTChamberId, TH1F*>::const_iterator chHisto = chamberOccupancyVsTimeMap_.begin();
353  chHisto != chamberOccupancyVsTimeMap_.end(); ++chHisto){
354  (*chHisto).second->Scale(normalization);
355  (*chHisto).second->Write();
356  }
357 
358  // Save on file the occupancy histos and write the list of noisy cells
360  for(map<DTLayerId, TH1F*>::const_iterator lHisto = theHistoOccupancyMap_.begin();
361  lHisto != theHistoOccupancyMap_.end();
362  ++lHisto){
363  /*double triggerWidth_s = 0.;
364  if( useTimeWindow_ ){
365  double triggerWidth_ns = 0.;
366  if( readDB_ ){
367  float tTrig, tTrigRMS, kFactor;
368  DTSuperLayerId slId = ((*lHisto).first).superlayerId();
369  int status = tTrigMap_->get( slId, tTrig, tTrigRMS, kFactor, DTTimeUnits::counts );
370  if(status != 0) throw cms::Exception("DTNoiseCalibration") << "Could not find tTrig entry in DB for" << slId << endl;
371  triggerWidth_ns = tTrig - timeWindowOffset_;
372  } else{
373  triggerWidth_ns = defaultTtrig_ - timeWindowOffset_;
374  }
375  triggerWidth_ns = (triggerWidth_ns*25)/32;
376  triggerWidth_s = triggerWidth_ns/1e9;
377  } else{
378  triggerWidth_s = double(triggerWidth_/1e9);
379  }
380  LogTrace("Calibration") << (*lHisto).second->GetName() << " trigger width (s): " << triggerWidth_s;*/
381 
382  //double normalization = 1./(nevents_*triggerWidth_s);
383  if((*lHisto).second){
384  (*lHisto).second->Scale(normalization);
385  rootFile_->cd();
386  (*lHisto).second->Write();
387  const DTTopology& dtTopo = dtGeom_->layer((*lHisto).first)->specificTopology();
388  const int firstWire = dtTopo.firstChannel();
389  const int lastWire = dtTopo.lastChannel();
390  //const int nWires = dtTopo.channels();
391  const int nWires = lastWire - firstWire + 1;
392  // Find average in layer
393  double averageRate = 0.;
394  for(int bin = 1; bin <= (*lHisto).second->GetNbinsX(); ++bin)
395  averageRate += (*lHisto).second->GetBinContent(bin);
396 
397  if(nWires) averageRate /= nWires;
398  LogTrace("Calibration") << " Average rate = " << averageRate;
399 
400  for(int i_wire = firstWire; i_wire <= lastWire; ++i_wire){
401  // From definition of "noisy cell"
402  int bin = i_wire - firstWire + 1;
403  double channelRate = (*lHisto).second->GetBinContent(bin);
404  double rateOffset = (useAbsoluteRate_) ? 0. : averageRate;
405  if( (channelRate - rateOffset) > maximumNoiseRate_ ){
406  DTWireId wireID((*lHisto).first, i_wire);
407  statusMap->setCellNoise(wireID,1);
408  LogVerbatim("Calibration") << ">>> Channel noisy: " << wireID;
409  }
410  }
411  }
412  }
413  LogVerbatim("Calibration") << "Writing noise map object to DB";
414  string record = "DTStatusFlagRcd";
415  DTCalibDBUtils::writeToDB<DTStatusFlag>(record, statusMap);
416 }
JetCorrectorParameters::Record record
Definition: classes.h:11
edm::ESHandle< DTGeometry > dtGeom_
std::map< DTLayerId, TH1F * > theHistoOccupancyMap_
std::map< DTChamberId, TH1F * > chamberOccupancyVsTimeMap_
std::map< DTChamberId, TH1F * > chamberOccupancyVsLumiMap_
int firstChannel() const
Returns the wire number of the first wire.
Definition: DTTopology.h:80
std::map< DTWireId, TH1F * > theHistoOccupancyVsLumiMap_
int lastChannel() const
Returns the wire number of the last wire.
Definition: DTTopology.h:82
int setCellNoise(int wheelId, int stationId, int sectorId, int slId, int layerId, int cellId, bool flag)
#define LogTrace(id)
string DTNoiseCalibration::getChamberName ( const DTChamberId dtChId) const
private

Definition at line 467 of file DTNoiseCalibration.cc.

References DTChamberId::sector(), DTChamberId::station(), relativeConstraints::station, and DTChamberId::wheel().

467  {
468 
469  stringstream wheel; wheel << dtChId.wheel();
470  stringstream station; station << dtChId.station();
471  stringstream sector; sector << dtChId.sector();
472 
473  string chamberName =
474  "W" + wheel.str()
475  + "_St" + station.str()
476  + "_Sec" + sector.str();
477 
478  return chamberName;
479 }
int sector() const
Definition: DTChamberId.h:63
int station() const
Return the station number.
Definition: DTChamberId.h:53
int wheel() const
Return the wheel number.
Definition: DTChamberId.h:47
string DTNoiseCalibration::getChannelName ( const DTWireId wId) const
private

Definition at line 422 of file DTNoiseCalibration.cc.

References DTLayerId::layer(), DTChamberId::sector(), DTChamberId::station(), DTSuperLayerId::superlayer(), DTChamberId::wheel(), and DTWireId::wire().

422  {
423  stringstream channelName;
424  channelName << "Wh" << wId.wheel() << "_St" << wId.station() << "_Sec" << wId.sector()
425  << "_SL" << wId.superlayer() << "_L" << wId.layer() << "_W"<< wId.wire();
426 
427  return channelName.str();
428 }
int layer() const
Return the layer number.
Definition: DTLayerId.h:55
int wire() const
Return the wire number.
Definition: DTWireId.h:58
int superlayer() const
Return the superlayer number (deprecated method name)
int sector() const
Definition: DTChamberId.h:63
int station() const
Return the station number.
Definition: DTChamberId.h:53
int wheel() const
Return the wheel number.
Definition: DTChamberId.h:47
string DTNoiseCalibration::getLayerName ( const DTLayerId lId) const
private

Definition at line 430 of file DTNoiseCalibration.cc.

References DTSuperLayerId::chamberId(), DTLayerId::layer(), DTChamberId::sector(), DTChamberId::station(), relativeConstraints::station, DTSuperLayerId::superlayer(), DTLayerId::superlayerId(), and DTChamberId::wheel().

430  {
431 
432  const DTSuperLayerId dtSLId = lId.superlayerId();
433  const DTChamberId dtChId = dtSLId.chamberId();
434  stringstream Layer; Layer << lId.layer();
435  stringstream superLayer; superLayer << dtSLId.superlayer();
436  stringstream wheel; wheel << dtChId.wheel();
437  stringstream station; station << dtChId.station();
438  stringstream sector; sector << dtChId.sector();
439 
440  string layerName =
441  "W" + wheel.str()
442  + "_St" + station.str()
443  + "_Sec" + sector.str()
444  + "_SL" + superLayer.str()
445  + "_L" + Layer.str();
446 
447  return layerName;
448 }
DTChamberId chamberId() const
Return the corresponding ChamberId.
int layer() const
Return the layer number.
Definition: DTLayerId.h:55
DTSuperLayerId superlayerId() const
Return the corresponding SuperLayerId.
Definition: DTLayerId.h:61
int superlayer() const
Return the superlayer number (deprecated method name)
int sector() const
Definition: DTChamberId.h:63
int station() const
Return the station number.
Definition: DTChamberId.h:53
int wheel() const
Return the wheel number.
Definition: DTChamberId.h:47
string DTNoiseCalibration::getSuperLayerName ( const DTSuperLayerId dtSLId) const
private

Definition at line 450 of file DTNoiseCalibration.cc.

References DTSuperLayerId::chamberId(), DTChamberId::sector(), DTChamberId::station(), relativeConstraints::station, DTSuperLayerId::superlayer(), and DTChamberId::wheel().

450  {
451 
452  const DTChamberId dtChId = dtSLId.chamberId();
453  stringstream superLayer; superLayer << dtSLId.superlayer();
454  stringstream wheel; wheel << dtChId.wheel();
455  stringstream station; station << dtChId.station();
456  stringstream sector; sector << dtChId.sector();
457 
458  string superLayerName =
459  "W" + wheel.str()
460  + "_St" + station.str()
461  + "_Sec" + sector.str()
462  + "_SL" + superLayer.str();
463 
464  return superLayerName;
465 }
DTChamberId chamberId() const
Return the corresponding ChamberId.
int superlayer() const
Return the superlayer number (deprecated method name)
int sector() const
Definition: DTChamberId.h:63
int station() const
Return the station number.
Definition: DTChamberId.h:53
int wheel() const
Return the wheel number.
Definition: DTChamberId.h:47

Member Data Documentation

std::map<DTChamberId, TH1F*> DTNoiseCalibration::chamberOccupancyVsLumiMap_
private

Definition at line 91 of file DTNoiseCalibration.h.

std::map<DTChamberId, TH1F*> DTNoiseCalibration::chamberOccupancyVsTimeMap_
private

Definition at line 93 of file DTNoiseCalibration.h.

std::string DTNoiseCalibration::dbLabel_
private

Definition at line 68 of file DTNoiseCalibration.h.

int DTNoiseCalibration::defaultTtrig_
private

Definition at line 67 of file DTNoiseCalibration.h.

Referenced by DTNoiseCalibration().

edm::InputTag DTNoiseCalibration::digiLabel_
private

Definition at line 55 of file DTNoiseCalibration.h.

edm::ESHandle<DTGeometry> DTNoiseCalibration::dtGeom_
private

Definition at line 79 of file DTNoiseCalibration.h.

TH1F* DTNoiseCalibration::hTDCTriggerWidth_
private

Definition at line 85 of file DTNoiseCalibration.h.

unsigned int DTNoiseCalibration::lumiMax_
private

Definition at line 71 of file DTNoiseCalibration.h.

double DTNoiseCalibration::maximumNoiseRate_
private

Definition at line 59 of file DTNoiseCalibration.h.

int DTNoiseCalibration::nevents_
private

Definition at line 73 of file DTNoiseCalibration.h.

bool DTNoiseCalibration::readDB_
private

Definition at line 66 of file DTNoiseCalibration.h.

Referenced by DTNoiseCalibration().

TFile* DTNoiseCalibration::rootFile_
private

Definition at line 83 of file DTNoiseCalibration.h.

Referenced by DTNoiseCalibration().

time_t DTNoiseCalibration::runBeginTime_
private

Definition at line 75 of file DTNoiseCalibration.h.

time_t DTNoiseCalibration::runEndTime_
private

Definition at line 76 of file DTNoiseCalibration.h.

std::map<DTLayerId, TH1F*> DTNoiseCalibration::theHistoOccupancyMap_
private

Definition at line 87 of file DTNoiseCalibration.h.

std::map<DTWireId, TH1F*> DTNoiseCalibration::theHistoOccupancyVsLumiMap_
private

Definition at line 89 of file DTNoiseCalibration.h.

int DTNoiseCalibration::timeWindowOffset_
private

Definition at line 58 of file DTNoiseCalibration.h.

double DTNoiseCalibration::triggerWidth_
private

Definition at line 57 of file DTNoiseCalibration.h.

edm::ESHandle<DTTtrig> DTNoiseCalibration::tTrigMap_
private

Definition at line 81 of file DTNoiseCalibration.h.

bool DTNoiseCalibration::useAbsoluteRate_
private

Definition at line 60 of file DTNoiseCalibration.h.

bool DTNoiseCalibration::useTimeWindow_
private

Definition at line 56 of file DTNoiseCalibration.h.

std::vector<DTWireId> DTNoiseCalibration::wireIdWithHisto_
private

Definition at line 70 of file DTNoiseCalibration.h.

Referenced by DTNoiseCalibration().