50 LogVerbatim(
"DTNoiseTask") <<
"[DTNoiseTask]: Constructor"<<endl;
81 LogVerbatim(
"DTNoiseTask") <<
"[DTNoiseTask]: BeginJob"<<endl;
91 LogVerbatim(
"DTNoiseTask") <<
"[DTNoiseTask]: Begin of LS transition"<<endl;
107 std::map<DTChamberId, int> segmentsChId;
116 for (chamberId = all4DSegments->id_begin();
117 chamberId != all4DSegments->id_end();
119 segmentsChId[*chamberId]=1;
129 for (dtLayerId_It=dtdigis->begin(); dtLayerId_It!=dtdigis->end(); ++dtLayerId_It){
131 digiIt!=((*dtLayerId_It).second).
second; ++digiIt){
134 int tdcTime = (*digiIt).countsTDC();
137 tbHistos[(*dtLayerId_It).first.superlayerId()]->Fill(tdcTime);
138 if(tdcTime>upperLimit)
143 segmentsChId.find((*dtLayerId_It).first.superlayerId().chamberId())!=segmentsChId.end())
148 TH2F* noise_root =
noiseHistos[(*dtLayerId_It).first.superlayerId().chamberId()]->getTH2F();
149 double normalization=0;
150 if(
mapEvt.find((*dtLayerId_It).first.superlayerId().chamberId())!=
mapEvt.end()) {
151 LogVerbatim(
"DTNoiseTask") <<
" Last fill: # of events: "
152 <<
mapEvt[(*dtLayerId_It).first.superlayerId().chamberId()]
154 normalization = 1e-9*upperLimit*
mapEvt[(*dtLayerId_It).first.superlayerId().chamberId()];
156 noise_root->Scale(normalization);
158 int yBin=(*dtLayerId_It).first.layer()+(4*((*dtLayerId_It).first.superlayerId().superlayer()-1));
159 noise_root->Fill((*digiIt).wire(),yBin);
162 LogVerbatim(
"DTNoiseTask") << (*dtLayerId_It).first <<
" wire: " << (*digiIt).wire()
163 <<
" # counts: " << noise_root->GetBinContent((*digiIt).wire(),yBin)
164 <<
" Time interval: " << upperLimit
165 <<
" # of events: " <<
evtNumber << endl;;
166 normalization = double( 1e-9*upperLimit*
mapEvt[(*dtLayerId_It).first.superlayerId().chamberId()]);
168 noise_root->Scale(1./normalization);
170 << noise_root->GetBinContent((*digiIt).wire(),yBin) << endl;
184 stringstream wheel; wheel << chId.
wheel();
186 stringstream sector; sector << chId.
sector();
189 "/Sector" + sector.str());
192 string histoName = string(
"NoiseRate")
194 +
"_St" + station.str()
195 +
"_Sec" + sector.str() ;
197 LogVerbatim(
"DTNoiseTask") <<
"[DTNoiseTask]: booking chamber histo:"<<endl;
198 LogVerbatim(
"DTNoiseTask") <<
" folder "<<
"DT/05-Noise/Wheel" + wheel.str() +
200 "/Sector" + sector.str() +
"/"<<endl;
201 LogVerbatim(
"DTNoiseTask") <<
" histoName "<<histoName<<endl;
206 const vector<const DTSuperLayer*> superlayers = dtchamber->
superLayers();
209 for(vector<const DTSuperLayer*>::const_iterator sl = superlayers.begin();
210 sl != superlayers.end(); ++sl) {
211 vector<const DTLayer*> layers = (*sl)->layers();
212 for(vector<const DTLayer*>::const_iterator lay = layers.begin();
213 lay != layers.end(); ++lay) {
214 int nWires = (*lay)->specificTopology().channels();
215 if(nWires > nWires_max) nWires_max = nWires;
219 noiseHistos[chId] =
dbe->
book2D(histoName,
"Noise rate (Hz) per channel", nWires_max,1, nWires_max+1,12,1,13);
243 stringstream superlayer; superlayer << slId.
superlayer();
245 "/Station" + station.str() +
246 "/Sector" + sector.str());
249 string histoName = string(
"TimeBox")
251 +
"_St" + station.str()
252 +
"_Sec" + sector.str()
253 +
"_SL" + superlayer.str();
255 LogVerbatim(
"DTNoiseTask") <<
"[DTNoiseTask]: booking SL histo:"<<endl;
256 LogVerbatim(
"DTNoiseTask") <<
" folder "<<
"DT/05-Noise/Wheel" + wheel.str() +
257 "/Station" + station.str() +
258 "/Sector" + sector.str() +
"/" << endl;
259 LogVerbatim(
"DTNoiseTask") <<
" histoName "<<histoName<<endl;
268 LogVerbatim(
"DTNoiseTask") <<
"[DTNoiseTask]: Begin of run"<<endl;
281 vector<DTChamber*>::const_iterator ch_it =
dtGeom->chambers().begin();
282 vector<DTChamber*>::const_iterator ch_end =
dtGeom->chambers().end();
283 for (; ch_it != ch_end; ++ch_it) {
287 vector<const DTSuperLayer*>::const_iterator sl_it = (*ch_it)->superLayers().begin();
288 vector<const DTSuperLayer*>::const_iterator sl_end = (*ch_it)->superLayers().end();
290 for(; sl_it != sl_end; ++sl_it) {
294 float tTrig, tTrigRMS, kFactor;
308 LogVerbatim(
"DTNoiseTask") <<
"[DTNoiseTask]: End LS, update rates in all histos" << endl;
311 for(map<DTChamberId, MonitorElement*>::const_iterator meAndChamber =
noiseHistos.begin();
312 meAndChamber !=
noiseHistos.end(); ++meAndChamber) {
314 TH2F* noise_root = (*meAndChamber).second->getTH2F();
317 double normalization=0;
319 LogVerbatim(
"DTNoiseTask") <<
" Ch: " << chId <<
" Last fill: # of events: " <<
mapEvt[chId] << endl;
320 normalization = 1
e-9*upperLimit*
mapEvt[chId];
322 noise_root->Scale(normalization);
330 normalization = double( 1
e-9*upperLimit*
evtNumber);
331 noise_root->Scale(1./normalization);
T getParameter(std::string const &) const
std::map< DTChamberId, int > mapEvt
T getUntrackedParameter(std::string const &, T const &) const
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
edm::InputTag dtDigiLabel
virtual ~DTNoiseTask()
Destructor.
DTChamberId chamberId() const
Return the corresponding ChamberId.
void endLuminosityBlock(const edm::LuminosityBlock &lumiSeg, const edm::EventSetup &setup)
MonitorElement * nEventMonitor
MonitorElement * bookFloat(const char *name)
Book float.
void beginLuminosityBlock(const edm::LuminosityBlock &lumiSeg, const edm::EventSetup &context)
To reset the MEs.
U second(std::pair< T, U > const &p)
edm::ESHandle< DTGeometry > dtGeom
void analyze(const edm::Event &e, const edm::EventSetup &c)
Analyze.
const std::vector< const DTSuperLayer * > & superLayers() const
Return the superlayers in the chamber.
void beginRun(const edm::Run &, const edm::EventSetup &)
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
std::map< DTSuperLayerId, MonitorElement * > tbHistos
int superlayer() const
Return the superlayer number (deprecated method name)
std::map< DTChamberId, double > tTrigStMap
std::vector< DigiType >::const_iterator const_iterator
DTNoiseTask(const edm::ParameterSet &ps)
Constructor.
std::map< DTChamberId, MonitorElement * > noiseHistos
int station() const
Return the station number.
MonitorElement * book2D(const char *name, const char *title, int nchX, double lowX, double highX, int nchY, double lowY, double highY)
Book 2D histogram.
int wheel() const
Return the wheel number.
std::string theRecHits4DLabel
void setup(std::vector< TH2F > &depth, std::string name, std::string units="")
void bookHistos(DTChamberId chId)
void setCurrentFolder(const std::string &fullpath)