50 LogVerbatim(
"DTNoiseTask") <<
"[DTNoiseTask]: Constructor"<<endl;
81 LogVerbatim(
"DTNoiseTask") <<
"[DTNoiseTask]: BeginJob"<<endl;
91 LogVerbatim(
"DTNoiseTask") <<
"[DTNoiseTask]: Begin of LS transition"<<endl;
105 std::map<DTChamberId, int> segmentsChId;
114 for (chamberId = all4DSegments->id_begin();
115 chamberId != all4DSegments->id_end();
117 segmentsChId[*chamberId]=1;
127 for (dtLayerId_It=dtdigis->begin(); dtLayerId_It!=dtdigis->end(); ++dtLayerId_It){
129 digiIt!=((*dtLayerId_It).second).
second; ++digiIt){
132 int tdcTime = (*digiIt).countsTDC();
135 tbHistos[(*dtLayerId_It).first.superlayerId()]->Fill(tdcTime);
136 if(tdcTime>upperLimit)
141 segmentsChId.find((*dtLayerId_It).first.superlayerId().chamberId())!=segmentsChId.end())
146 TH2F* noise_root =
noiseHistos[(*dtLayerId_It).first.superlayerId().chamberId()]->getTH2F();
147 double normalization=0;
148 if(
mapEvt.find((*dtLayerId_It).first.superlayerId().chamberId())!=
mapEvt.end()) {
149 LogVerbatim(
"DTNoiseTask") <<
" Last fill: # of events: "
150 <<
mapEvt[(*dtLayerId_It).first.superlayerId().chamberId()]
152 normalization = 1e-9*upperLimit*
mapEvt[(*dtLayerId_It).first.superlayerId().chamberId()];
154 noise_root->Scale(normalization);
156 int yBin=(*dtLayerId_It).first.layer()+(4*((*dtLayerId_It).first.superlayerId().superlayer()-1));
157 noise_root->Fill((*digiIt).wire(),yBin);
160 LogVerbatim(
"DTNoiseTask") << (*dtLayerId_It).first <<
" wire: " << (*digiIt).wire()
161 <<
" # counts: " << noise_root->GetBinContent((*digiIt).wire(),yBin)
162 <<
" Time interval: " << upperLimit
163 <<
" # of events: " <<
evtNumber << endl;;
164 normalization = double( 1e-9*upperLimit*
mapEvt[(*dtLayerId_It).first.superlayerId().chamberId()]);
166 noise_root->Scale(1./normalization);
168 << noise_root->GetBinContent((*digiIt).wire(),yBin) << endl;
182 stringstream wheel; wheel << chId.
wheel();
184 stringstream sector; sector << chId.
sector();
187 "/Sector" + sector.str());
190 string histoName = string(
"NoiseRate")
192 +
"_St" + station.str()
193 +
"_Sec" + sector.str() ;
195 LogVerbatim(
"DTNoiseTask") <<
"[DTNoiseTask]: booking chamber histo:"<<endl;
196 LogVerbatim(
"DTNoiseTask") <<
" folder "<<
"DT/05-Noise/Wheel" + wheel.str() +
198 "/Sector" + sector.str() +
"/"<<endl;
199 LogVerbatim(
"DTNoiseTask") <<
" histoName "<<histoName<<endl;
204 const vector<const DTSuperLayer*> superlayers = dtchamber->
superLayers();
207 for(vector<const DTSuperLayer*>::const_iterator sl = superlayers.begin();
208 sl != superlayers.end(); ++sl) {
209 vector<const DTLayer*> layers = (*sl)->layers();
210 for(vector<const DTLayer*>::const_iterator lay = layers.begin();
211 lay != layers.end(); ++lay) {
212 int nWires = (*lay)->specificTopology().channels();
213 if(nWires > nWires_max) nWires_max = nWires;
217 noiseHistos[chId] =
dbe->
book2D(histoName,
"Noise rate (Hz) per channel", nWires_max,1, nWires_max+1,12,1,13);
241 stringstream superlayer; superlayer << slId.
superlayer();
243 "/Station" + station.str() +
244 "/Sector" + sector.str());
247 string histoName = string(
"TimeBox")
249 +
"_St" + station.str()
250 +
"_Sec" + sector.str()
251 +
"_SL" + superlayer.str();
253 LogVerbatim(
"DTNoiseTask") <<
"[DTNoiseTask]: booking SL histo:"<<endl;
254 LogVerbatim(
"DTNoiseTask") <<
" folder "<<
"DT/05-Noise/Wheel" + wheel.str() +
255 "/Station" + station.str() +
256 "/Sector" + sector.str() +
"/" << endl;
257 LogVerbatim(
"DTNoiseTask") <<
" histoName "<<histoName<<endl;
266 LogVerbatim(
"DTNoiseTask") <<
"[DTNoiseTask]: Begin of run"<<endl;
276 vector<DTChamber*>::const_iterator ch_it =
dtGeom->chambers().begin();
277 vector<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 = 1e-9*upperLimit*
mapEvt[chId];
317 noise_root->Scale(normalization);
325 normalization = double( 1e-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
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)
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)