CMS 3D CMS Logo

DTNoiseTask Class Reference

No description available. More...

#include <DQM/DTMonitorModule/src/DTNoiseTask.h>

Inheritance diagram for DTNoiseTask:

edm::EDAnalyzer

List of all members.

Public Member Functions

 DTNoiseTask (const edm::ParameterSet &ps)
 Constructor.
virtual ~DTNoiseTask ()
 Destructor.

Protected Member Functions

void analyze (const edm::Event &e, const edm::EventSetup &c)
 Analyze.
void beginJob (const edm::EventSetup &c)
 BeginJob.
void beginLuminosityBlock (const edm::LuminosityBlock &lumiSeg, const edm::EventSetup &context)
 To reset the MEs.
void beginRun (const edm::Run &, const edm::EventSetup &)
void endJob ()
 Endjob.

Private Member Functions

void bookHistos (DTSuperLayerId slId)
void bookHistos (DTChamberId chId)

Private Attributes

DQMStoredbe
bool doSegmentVeto
bool doTimeBoxHistos
edm::InputTag dtDigiLabel
edm::ESHandle< DTGeometrydtGeom
int evtNumber
std::map< DTChamberId, intmapEvt
std::map< DTChamberId,
MonitorElement * > 
noiseHistos
std::map< DTSuperLayerId,
MonitorElement * > 
tbHistos
std::string theRecHits4DLabel
std::map< DTChamberId, double > tTrigStMap


Detailed Description

No description available.

Date
2008/07/09 14:13:12
Revision
1.5
Authors:
G. Mila , G. Cerminara - INFN Torino

Definition at line 32 of file DTNoiseTask.h.


Constructor & Destructor Documentation

DTNoiseTask::DTNoiseTask ( const edm::ParameterSet ps  ) 

Constructor.

Definition at line 46 of file DTNoiseTask.cc.

References dbe, doSegmentVeto, doTimeBoxHistos, dtDigiLabel, lat::endl(), edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), and theRecHits4DLabel.

00046                                                : evtNumber(0) {
00047 
00048    LogVerbatim("DTNoiseTask") << "[DTNoiseTask]: Constructor"<<endl;
00049 
00050   dbe = edm::Service<DQMStore>().operator->();
00051 
00052   //switch for timeBox booking
00053   doTimeBoxHistos = ps.getUntrackedParameter<bool>("doTbHistos", false);
00054   
00055   // The label to retrieve the digis 
00056   dtDigiLabel = ps.getParameter<InputTag>("dtDigiLabel");
00057 
00058   // the name of the 4D rec hits collection
00059   theRecHits4DLabel = ps.getParameter<string>("recHits4DLabel");
00060   
00061   //switch for segment veto
00062   doSegmentVeto = ps.getUntrackedParameter<bool>("doSegmentVeto", false);
00063 
00064 }

DTNoiseTask::~DTNoiseTask (  )  [virtual]

Destructor.

Definition at line 69 of file DTNoiseTask.cc.

00069 {}


Member Function Documentation

void DTNoiseTask::analyze ( const edm::Event e,
const edm::EventSetup c 
) [protected, virtual]

Analyze.

Implements edm::EDAnalyzer.

Definition at line 93 of file DTNoiseTask.cc.

References doSegmentVeto, doTimeBoxHistos, dtDigiLabel, lat::endl(), evtNumber, edm::Event::getByLabel(), mapEvt, noiseHistos, edm::second(), tbHistos, theRecHits4DLabel, and tTrigStMap.

00093                                                                    {
00094 
00095   evtNumber++;
00096   if(evtNumber%1000==0)
00097      LogVerbatim("DTNoiseTask") <<"[DTNoiseTask]: Analyzing evt number :"<<evtNumber<<endl;
00098 
00099   // map of the chambers with at least 1 segment
00100   std::map<DTChamberId, int> segmentsChId;
00101 
00102   // Get the 4D segment collection from the event
00103   edm::Handle<DTRecSegment4DCollection> all4DSegments;
00104   e.getByLabel(theRecHits4DLabel, all4DSegments);
00105   
00106   // Loop over all chambers containing a segment and look for the number of segments
00107   DTRecSegment4DCollection::id_iterator chamberId;
00108   for (chamberId = all4DSegments->id_begin();
00109        chamberId != all4DSegments->id_end();
00110        ++chamberId){
00111     segmentsChId[*chamberId]=1;
00112   }
00113  
00114   // Get the digis from the event
00115   edm::Handle<DTDigiCollection> dtdigis;
00116   e.getByLabel(dtDigiLabel, dtdigis);
00117   
00118   // LOOP OVER ALL THE DIGIS OF THE EVENT
00119   DTDigiCollection::DigiRangeIterator dtLayerId_It;
00120   for (dtLayerId_It=dtdigis->begin(); dtLayerId_It!=dtdigis->end(); ++dtLayerId_It){
00121     for (DTDigiCollection::const_iterator digiIt = ((*dtLayerId_It).second).first;
00122          digiIt!=((*dtLayerId_It).second).second; ++digiIt){
00123   
00124       //Check the TDC trigger width
00125       int tdcTime = (*digiIt).countsTDC();
00126       double upperLimit = tTrigStMap[(*dtLayerId_It).first.superlayerId().chamberId()]-200.;
00127       if(doTimeBoxHistos)
00128         tbHistos[(*dtLayerId_It).first.superlayerId()]->Fill(tdcTime);
00129       if(tdcTime>upperLimit)
00130         continue;
00131 
00132       //Check the chamber has no 4D segments (optional)
00133       if(doSegmentVeto &&
00134          segmentsChId.find((*dtLayerId_It).first.superlayerId().chamberId())!=segmentsChId.end())
00135         continue;
00136 
00137       // fill the occupancy histo
00138       TH2F* noise_root = noiseHistos[(*dtLayerId_It).first.superlayerId().chamberId()]->getTH2F();
00139       double normalization=0;
00140       if(mapEvt.find((*dtLayerId_It).first.superlayerId().chamberId())!=mapEvt.end()){
00141         LogVerbatim("DTNoiseTask")  << " Last fill: # of events: "
00142                                     << mapEvt[(*dtLayerId_It).first.superlayerId().chamberId()]
00143                                     << endl;
00144         normalization =  1e-9*upperLimit*mapEvt[(*dtLayerId_It).first.superlayerId().chamberId()];
00145         noise_root->Scale(normalization);
00146       }
00147       int yBin=(*dtLayerId_It).first.layer()+(4*((*dtLayerId_It).first.superlayerId().superlayer()-1));
00148       noise_root->Fill((*digiIt).wire(),yBin);
00149       // normalize the occupancy histo
00150       mapEvt[(*dtLayerId_It).first.superlayerId().chamberId()] = evtNumber;
00151       LogVerbatim("DTNoiseTask")  << (*dtLayerId_It).first << " wire: " << (*digiIt).wire()
00152                                   << " # counts: " << noise_root->GetBinContent((*digiIt).wire(),yBin)
00153                                   << " Time interval: " << upperLimit
00154                                   << " # of events: " << evtNumber << endl;;
00155       normalization = double( 1e-9*upperLimit*mapEvt[(*dtLayerId_It).first.superlayerId().chamberId()]);
00156       noise_root->Scale(1./normalization);
00157       LogVerbatim("DTNoiseTask")  << "    noise rate: "
00158                                   << noise_root->GetBinContent((*digiIt).wire(),yBin) << endl;
00159     }
00160   }
00161 }

void DTNoiseTask::beginJob ( const edm::EventSetup c  )  [protected, virtual]

BeginJob.

Reimplemented from edm::EDAnalyzer.

Definition at line 74 of file DTNoiseTask.cc.

References lat::endl().

00074                                                      {
00075 
00076    LogVerbatim("DTNoiseTask") << "[DTNoiseTask]: BeginJob"<<endl;
00077 
00078 }

void DTNoiseTask::beginLuminosityBlock ( const edm::LuminosityBlock lumiSeg,
const edm::EventSetup context 
) [protected, virtual]

To reset the MEs.

Reimplemented from edm::EDAnalyzer.

Definition at line 83 of file DTNoiseTask.cc.

References lat::endl().

00084                                                                      {
00085 
00086    LogVerbatim("DTNoiseTask") <<"[DTNoiseTask]: Begin of LS transition"<<endl;
00087 
00088 }

void DTNoiseTask::beginRun ( const edm::Run run,
const edm::EventSetup setup 
) [protected, virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 254 of file DTNoiseTask.cc.

References bookHistos(), doTimeBoxHistos, dtGeom, lat::endl(), edm::EventSetup::get(), DTTimeUnits::ns, and tTrigStMap.

00254                                                                   {
00255 
00256   LogVerbatim("DTNoiseTask") <<"[DTNoiseTask]: Begin of run"<<endl;
00257 
00258   // tTrig Map
00259   edm::ESHandle<DTTtrig> tTrigMap;
00260   setup.get<DTTtrigRcd>().get(tTrigMap);
00261 
00262   // get the geometry
00263   setup.get<MuonGeometryRecord>().get(dtGeom);
00264 
00265   // Loop over all the chambers          
00266   vector<DTChamber*>::const_iterator ch_it = dtGeom->chambers().begin();         
00267   vector<DTChamber*>::const_iterator ch_end = dtGeom->chambers().end();          
00268   for (; ch_it != ch_end; ++ch_it) {     
00269     DTChamberId chId = (*ch_it)->id();
00270     // histo booking
00271     bookHistos(chId);
00272     vector<const DTSuperLayer*>::const_iterator sl_it = (*ch_it)->superLayers().begin();         
00273     vector<const DTSuperLayer*>::const_iterator sl_end = (*ch_it)->superLayers().end();          
00274     // Loop over the SLs         
00275     for(; sl_it != sl_end; ++sl_it) { 
00276       DTSuperLayerId slId = (*sl_it)->id();
00277       if(doTimeBoxHistos)
00278         bookHistos(slId);
00279       float tTrig, tTrigRMS;
00280       tTrigMap->get(slId, tTrig, tTrigRMS,DTTimeUnits::ns);
00281       // tTrig mapping per station
00282       // check that the ttrig is the lowest of the 3 SLs
00283       if(tTrigStMap.find(chId)==tTrigStMap.end() || 
00284          (tTrigStMap.find(chId)!=tTrigStMap.end() && tTrig < tTrigStMap[chId]))
00285         tTrigStMap[chId] = tTrig;
00286     }
00287   }
00288 
00289 
00290 }

void DTNoiseTask::bookHistos ( DTSuperLayerId  slId  )  [private]

Definition at line 225 of file DTNoiseTask.cc.

References DQMStore::book1D(), DTSuperLayerId::chamberId(), dbe, lat::endl(), DTChamberId::sector(), DQMStore::setCurrentFolder(), DTChamberId::station(), DTSuperLayerId::superlayer(), tbHistos, muonGeometry::wheel, and DTChamberId::wheel().

00225                                                 {
00226 
00227   // set the folder
00228   stringstream wheel; wheel << slId.chamberId().wheel();        
00229   stringstream station; station << slId.chamberId().station();  
00230   stringstream sector; sector << slId.chamberId().sector();     
00231   stringstream superlayer; superlayer << slId.superlayer();
00232   dbe->setCurrentFolder("DT/04-Noise/Wheel" + wheel.str() +
00233                         "/Station" + station.str() +
00234                         "/Sector" + sector.str());
00235 
00236   // Build the histo name
00237   string histoName = string("TimeBox")
00238     + "_W" + wheel.str() 
00239     + "_St" + station.str() 
00240     + "_Sec" + sector.str()
00241     + "_SL" + superlayer.str();
00242   
00243    LogVerbatim("DTNoiseTask") <<"[DTNoiseTask]: booking SL histo:"<<endl;
00244    LogVerbatim("DTNoiseTask") <<"              folder "<< "DT/04-Noise/Wheel" + wheel.str() +
00245     "/Station" + station.str() +
00246     "/Sector" + sector.str() + "/" << endl; 
00247    LogVerbatim("DTNoiseTask") <<"              histoName "<<histoName<<endl;
00248 
00249   tbHistos[slId] = dbe->book1D(histoName,"Time Box (TDC counts)", 1000, 0, 6000);
00250 
00251 }

void DTNoiseTask::bookHistos ( DTChamberId  chId  )  [private]

Definition at line 169 of file DTNoiseTask.cc.

References DQMStore::book2D(), dbe, dtGeom, lat::endl(), layers, noiseHistos, DTChamberId::sector(), DQMStore::setCurrentFolder(), sl, DTChamberId::station(), DTChamber::superLayers(), muonGeometry::wheel, and DTChamberId::wheel().

Referenced by beginRun().

00169                                              {
00170 
00171   // set the folder
00172   stringstream wheel; wheel << chId.wheel();    
00173   stringstream station; station << chId.station();      
00174   stringstream sector; sector << chId.sector(); 
00175   dbe->setCurrentFolder("DT/04-Noise/Wheel" + wheel.str() +
00176 //                      "/Station" + station.str() +
00177                         "/Sector" + sector.str());
00178 
00179   // Build the histo name
00180   string histoName = string("NoiseRate")
00181     + "_W" + wheel.str() 
00182     + "_St" + station.str() 
00183     + "_Sec" + sector.str() ;
00184   
00185    LogVerbatim("DTNoiseTask") << "[DTNoiseTask]: booking chamber histo:"<<endl;
00186    LogVerbatim("DTNoiseTask") << "              folder "<< "DT/04-Noise/Wheel" + wheel.str() +
00187 //     "/Station" + station.str() +
00188     "/Sector" + sector.str() + "/"<<endl; 
00189    LogVerbatim("DTNoiseTask") << "              histoName "<<histoName<<endl;
00190 
00191   // Get the chamber from the geometry
00192   int nWires_max = 0;
00193   const DTChamber* dtchamber = dtGeom->chamber(chId);
00194   const vector<const DTSuperLayer*> superlayers = dtchamber->superLayers();
00195 
00196   // Loop over layers and find the max # of wires
00197   for(vector<const DTSuperLayer*>::const_iterator sl = superlayers.begin();
00198       sl != superlayers.end(); ++sl) { // loop over SLs
00199     vector<const DTLayer*> layers = (*sl)->layers();
00200     for(vector<const DTLayer*>::const_iterator lay = layers.begin();
00201         lay != layers.end(); ++lay) { // loop over layers
00202       int nWires = (*lay)->specificTopology().channels();
00203       if(nWires > nWires_max) nWires_max = nWires;
00204     }
00205   }
00206 
00207   noiseHistos[chId] = dbe->book2D(histoName,"Noise rate (Hz) per channel", nWires_max,1, nWires_max+1,12,1,13);
00208   noiseHistos[chId]->setAxisTitle("wire number",1);
00209   noiseHistos[chId]->setBinLabel(1,"SL1-L1",2);
00210   noiseHistos[chId]->setBinLabel(2,"SL1-L2",2);
00211   noiseHistos[chId]->setBinLabel(3,"SL1-L3",2);
00212   noiseHistos[chId]->setBinLabel(4,"SL1-L4",2);
00213   noiseHistos[chId]->setBinLabel(5,"SL2-L1",2);
00214   noiseHistos[chId]->setBinLabel(6,"SL2-L2",2);
00215   noiseHistos[chId]->setBinLabel(7,"SL2-L3",2);
00216   noiseHistos[chId]->setBinLabel(8,"SL2-L4",2);
00217   noiseHistos[chId]->setBinLabel(9,"SL3-L1",2);
00218   noiseHistos[chId]->setBinLabel(10,"SL3-L2",2);
00219   noiseHistos[chId]->setBinLabel(11,"SL3-L3",2);
00220   noiseHistos[chId]->setBinLabel(12,"SL3-L4",2);
00221 
00222 }

void DTNoiseTask::endJob ( void   )  [protected, virtual]

Endjob.

Reimplemented from edm::EDAnalyzer.

Definition at line 166 of file DTNoiseTask.cc.

00166 {}


Member Data Documentation

DQMStore* DTNoiseTask::dbe [private]

Definition at line 73 of file DTNoiseTask.h.

Referenced by bookHistos(), and DTNoiseTask().

bool DTNoiseTask::doSegmentVeto [private]

Definition at line 71 of file DTNoiseTask.h.

Referenced by analyze(), and DTNoiseTask().

bool DTNoiseTask::doTimeBoxHistos [private]

Definition at line 67 of file DTNoiseTask.h.

Referenced by analyze(), beginRun(), and DTNoiseTask().

edm::InputTag DTNoiseTask::dtDigiLabel [private]

Definition at line 63 of file DTNoiseTask.h.

Referenced by analyze(), and DTNoiseTask().

edm::ESHandle<DTGeometry> DTNoiseTask::dtGeom [private]

Definition at line 74 of file DTNoiseTask.h.

Referenced by beginRun(), and bookHistos().

int DTNoiseTask::evtNumber [private]

Definition at line 65 of file DTNoiseTask.h.

Referenced by analyze().

std::map<DTChamberId, int> DTNoiseTask::mapEvt [private]

Definition at line 83 of file DTNoiseTask.h.

Referenced by analyze().

std::map<DTChamberId, MonitorElement*> DTNoiseTask::noiseHistos [private]

Definition at line 80 of file DTNoiseTask.h.

Referenced by analyze(), and bookHistos().

std::map<DTSuperLayerId, MonitorElement*> DTNoiseTask::tbHistos [private]

Definition at line 86 of file DTNoiseTask.h.

Referenced by analyze(), and bookHistos().

std::string DTNoiseTask::theRecHits4DLabel [private]

Definition at line 69 of file DTNoiseTask.h.

Referenced by analyze(), and DTNoiseTask().

std::map<DTChamberId, double> DTNoiseTask::tTrigStMap [private]

Definition at line 77 of file DTNoiseTask.h.

Referenced by analyze(), and beginRun().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:18:58 2009 for CMSSW by  doxygen 1.5.4