43 LogVerbatim(
"DTNoiseTask") <<
"[DTNoiseTask]: Constructor"<<endl;
76 LogVerbatim(
"DTNoiseTask") <<
"[DTNoiseTask]: BeginJob"<<endl;
86 LogVerbatim(
"DTNoiseTask") <<
"[DTNoiseTask]: Begin of LS transition"<<endl;
102 std::map<DTChamberId, int> segmentsChId;
110 DTRecSegment4DCollection::id_iterator chamberId;
111 for (chamberId = all4DSegments->id_begin();
112 chamberId != all4DSegments->id_end();
114 segmentsChId[*chamberId]=1;
124 for (dtLayerId_It=dtdigis->begin(); dtLayerId_It!=dtdigis->end(); ++dtLayerId_It){
126 digiIt!=((*dtLayerId_It).second).
second; ++digiIt){
129 int tdcTime = (*digiIt).countsTDC();
132 tbHistos[(*dtLayerId_It).first.superlayerId()]->Fill(tdcTime);
133 if(tdcTime>upperLimit)
138 segmentsChId.find((*dtLayerId_It).first.superlayerId().chamberId())!=segmentsChId.end())
143 TH2F* noise_root =
noiseHistos[(*dtLayerId_It).first.superlayerId().chamberId()]->getTH2F();
144 double normalization=0;
145 if(
mapEvt.find((*dtLayerId_It).first.superlayerId().chamberId())!=
mapEvt.end()) {
146 LogVerbatim(
"DTNoiseTask") <<
" Last fill: # of events: "
147 <<
mapEvt[(*dtLayerId_It).first.superlayerId().chamberId()]
149 normalization = 1e-9*upperLimit*
mapEvt[(*dtLayerId_It).first.superlayerId().chamberId()];
151 noise_root->Scale(normalization);
153 int yBin=(*dtLayerId_It).first.layer()+(4*((*dtLayerId_It).first.superlayerId().superlayer()-1));
154 noise_root->Fill((*digiIt).wire(),
yBin);
157 LogVerbatim(
"DTNoiseTask") << (*dtLayerId_It).first <<
" wire: " << (*digiIt).wire()
158 <<
" # counts: " << noise_root->GetBinContent((*digiIt).wire(),
yBin)
159 <<
" Time interval: " << upperLimit
160 <<
" # of events: " <<
evtNumber << endl;;
161 normalization = double( 1e-9*upperLimit*
mapEvt[(*dtLayerId_It).first.superlayerId().chamberId()]);
163 noise_root->Scale(1./normalization);
165 << noise_root->GetBinContent((*digiIt).wire(),
yBin) << endl;
179 stringstream wheel; wheel << chId.
wheel();
181 stringstream sector; sector << chId.
sector();
182 dbe->setCurrentFolder(
"DT/05-Noise/Wheel" + wheel.str() +
184 "/Sector" + sector.str());
189 +
"_St" + station.str()
190 +
"_Sec" + sector.str() ;
192 LogVerbatim(
"DTNoiseTask") <<
"[DTNoiseTask]: booking chamber histo:"<<endl;
193 LogVerbatim(
"DTNoiseTask") <<
" folder "<<
"DT/05-Noise/Wheel" + wheel.str() +
195 "/Sector" + sector.str() +
"/"<<endl;
196 LogVerbatim(
"DTNoiseTask") <<
" histoName "<<histoName<<endl;
201 const vector<const DTSuperLayer*> superlayers = dtchamber->
superLayers();
204 for(vector<const DTSuperLayer*>::const_iterator sl = superlayers.begin();
205 sl != superlayers.end(); ++sl) {
206 vector<const DTLayer*>
layers = (*sl)->layers();
207 for(vector<const DTLayer*>::const_iterator lay = layers.begin();
208 lay != layers.end(); ++lay) {
209 int nWires = (*lay)->specificTopology().channels();
210 if(nWires > nWires_max) nWires_max = nWires;
214 noiseHistos[chId] =
dbe->book2D(histoName,
"Noise rate (Hz) per channel", nWires_max,1, nWires_max+1,12,1,13);
238 stringstream superlayer; superlayer << slId.
superlayer();
239 dbe->setCurrentFolder(
"DT/05-Noise/Wheel" + wheel.str() +
240 "/Station" + station.str() +
241 "/Sector" + sector.str());
246 +
"_St" + station.str()
247 +
"_Sec" + sector.str()
248 +
"_SL" + superlayer.str();
250 LogVerbatim(
"DTNoiseTask") <<
"[DTNoiseTask]: booking SL histo:"<<endl;
251 LogVerbatim(
"DTNoiseTask") <<
" folder "<<
"DT/05-Noise/Wheel" + wheel.str() +
252 "/Station" + station.str() +
253 "/Sector" + sector.str() +
"/" << endl;
254 LogVerbatim(
"DTNoiseTask") <<
" histoName "<<histoName<<endl;
256 tbHistos[slId] =
dbe->book1D(histoName,
"Time Box (TDC counts)", 1000, 0, 6000);
263 LogVerbatim(
"DTNoiseTask") <<
"[DTNoiseTask]: Begin of run"<<endl;
272 dbe->setCurrentFolder(
"DT/EventInfo/Counters");
276 vector<const DTChamber*>::const_iterator ch_it =
dtGeom->chambers().begin();
277 vector<const DTChamber*>::const_iterator ch_end =
dtGeom->chambers().end();
278 for (; ch_it != ch_end; ++ch_it) {
282 vector<const DTSuperLayer*>::const_iterator sl_it = (*ch_it)->superLayers().begin();
283 vector<const DTSuperLayer*>::const_iterator sl_end = (*ch_it)->superLayers().end();
285 for(; sl_it != sl_end; ++sl_it) {
289 float tTrig, tTrigRMS, kFactor;
303 LogVerbatim(
"DTNoiseTask") <<
"[DTNoiseTask]: End LS, update rates in all histos" << endl;
306 for(map<DTChamberId, MonitorElement*>::const_iterator meAndChamber =
noiseHistos.begin();
307 meAndChamber !=
noiseHistos.end(); ++meAndChamber) {
309 TH2F* noise_root = (*meAndChamber).second->getTH2F();
312 double normalization=0;
314 LogVerbatim(
"DTNoiseTask") <<
" Ch: " << chId <<
" Last fill: # of events: " <<
mapEvt[chId] << endl;
315 normalization = 1
e-9*upperLimit*
mapEvt[chId];
317 noise_root->Scale(normalization);
325 normalization = double( 1
e-9*upperLimit*
evtNumber);
326 noise_root->Scale(1./normalization);
T getParameter(std::string const &) const
std::map< DTChamberId, int > mapEvt
T getUntrackedParameter(std::string const &, T const &) const
std::vector< LayerSetAndLayers > layers(const SeedingLayerSetsHits &sets)
virtual ~DTNoiseTask()
Destructor.
bool getByToken(EDGetToken token, Handle< PROD > &result) const
DTChamberId chamberId() const
Return the corresponding ChamberId.
void endLuminosityBlock(const edm::LuminosityBlock &lumiSeg, const edm::EventSetup &setup)
MonitorElement * nEventMonitor
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.
edm::EDGetTokenT< DTRecSegment4DCollection > recHits4DToken_
void beginRun(const edm::Run &, const edm::EventSetup &)
edm::EDGetTokenT< DTDigiCollection > dtDigiToken_
std::map< DTSuperLayerId, MonitorElement * > tbHistos
int superlayer() const
Return the superlayer number (deprecated method name)
std::map< DTChamberId, double > tTrigStMap
std::vector< DTDigi >::const_iterator const_iterator
DTNoiseTask(const edm::ParameterSet &ps)
Constructor.
std::map< DTChamberId, MonitorElement * > noiseHistos
int station() const
Return the station number.
int wheel() const
Return the wheel number.
void setup(std::vector< TH2F > &depth, std::string name, std::string units="")
void bookHistos(DTChamberId chId)