CMS 3D CMS Logo

DTSegmentAnalysisTask Class Reference

DQM Analysis of 4D DT segments, it produces plots about:
More...

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

Inheritance diagram for DTSegmentAnalysisTask:

edm::EDAnalyzer

List of all members.

Public Member Functions

void analyze (const edm::Event &event, const edm::EventSetup &setup)
void beginJob (const edm::EventSetup &c)
 BeginJob.
void beginLuminosityBlock (edm::LuminosityBlock const &lumiSeg, edm::EventSetup const &eSetup)
 Summary.
 DTSegmentAnalysisTask (const edm::ParameterSet &pset)
 Constructor.
void endJob ()
 Endjob.
void endLuminosityBlock (edm::LuminosityBlock const &lumiSeg, edm::EventSetup const &eSetup)
virtual ~DTSegmentAnalysisTask ()
 Destructor.

Private Member Functions

void bookHistos (DTChamberId chamberId)
void fillHistos (DTChamberId chamberId, int nHits, float chi2)

Private Attributes

bool checkNoisyChannels
bool detailedAnalysis
edm::ESHandle< DTGeometrydtGeom
std::map< DTChamberId,
std::vector< MonitorElement * > > 
histosPerCh
std::map< int, std::map< int,
DTTimeEvolutionHisto * > > 
histoTimeEvol
DTTimeEvolutionHistohNevtPerLS
int nEventsInLS
int nLSTimeBin
int nTimeBins
edm::ParameterSet parameters
bool slideTimeBins
std::map< int, MonitorElement * > summaryHistos
DQMStoretheDbe
std::string theRecHits4DLabel


Detailed Description

DQM Analysis of 4D DT segments, it produces plots about:

Date
2008/11/24 09:14:07
Revision
1.9
Author:
G. Cerminara - INFN Torino

Definition at line 36 of file DTSegmentAnalysisTask.h.


Constructor & Destructor Documentation

DTSegmentAnalysisTask::DTSegmentAnalysisTask ( const edm::ParameterSet pset  ) 

Constructor.

Definition at line 43 of file DTSegmentAnalysisTask.cc.

References checkNoisyChannels, detailedAnalysis, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), nLSTimeBin, nTimeBins, slideTimeBins, theDbe, and theRecHits4DLabel.

00043                                                                         : nEventsInLS(0) {
00044 
00045   edm::LogVerbatim ("DTDQM|DTMonitorModule|DTSegmentAnalysisTask") << "[DTSegmentAnalysisTask] Constructor called!";
00046 
00047   // switch for detailed analysis
00048   detailedAnalysis = pset.getUntrackedParameter<bool>("detailedAnalysis","false");
00049   // the name of the 4D rec hits collection
00050   theRecHits4DLabel = pset.getParameter<string>("recHits4DLabel");
00051   // Get the map of noisy channels
00052   checkNoisyChannels = pset.getUntrackedParameter<bool>("checkNoisyChannels","false");
00053   // # of bins in the time histos
00054   nTimeBins = pset.getUntrackedParameter<int>("nTimeBins",100);
00055   // # of LS per bin in the time histos
00056   nLSTimeBin = pset.getUntrackedParameter<int>("nLSTimeBin",2);
00057   // switch on/off sliding bins in time histos
00058   slideTimeBins = pset.getUntrackedParameter<bool>("slideTimeBins",true);
00059 
00060   // Get the DQM needed services
00061   theDbe = edm::Service<DQMStore>().operator->();
00062 
00063  }

DTSegmentAnalysisTask::~DTSegmentAnalysisTask (  )  [virtual]

Destructor.

Definition at line 66 of file DTSegmentAnalysisTask.cc.

00066                                              {
00067     edm::LogVerbatim ("DTDQM|DTMonitorModule|DTSegmentAnalysisTask") << "[DTSegmentAnalysisTask] Destructor called!";
00068 }


Member Function Documentation

void DTSegmentAnalysisTask::analyze ( const edm::Event event,
const edm::EventSetup setup 
) [virtual]

Implements edm::EDAnalyzer.

Definition at line 119 of file DTSegmentAnalysisTask.cc.

References checkNoisyChannels, edm::EventID::event(), fillHistos(), edm::EventSetup::get(), edm::Event::id(), nEventsInLS, range, size, DTRecSegment2D::specificRecHits(), and theRecHits4DLabel.

00119                                                                                      {
00120   nEventsInLS++;
00121   edm::LogVerbatim ("DTDQM|DTMonitorModule|DTSegmentAnalysisTask") << "[DTSegmentAnalysisTask] Analyze #Run: " << event.id().run()
00122                                << " #Event: " << event.id().event();
00123   if(!(event.id().event()%1000))
00124     edm::LogVerbatim ("DTDQM|DTMonitorModule|DTSegmentAnalysisTask") << "[DTSegmentAnalysisTask] Analyze #Run: " << event.id().run()
00125                                  << " #Event: " << event.id().event();
00126   
00127   ESHandle<DTStatusFlag> statusMap;
00128   if(checkNoisyChannels) {
00129     setup.get<DTStatusFlagRcd>().get(statusMap);
00130   } 
00131 
00132 
00133   // -- 4D segment analysis  -----------------------------------------------------
00134   
00135   // Get the 4D segment collection from the event
00136   edm::Handle<DTRecSegment4DCollection> all4DSegments;
00137   event.getByLabel(theRecHits4DLabel, all4DSegments);
00138   
00139   // Loop over all chambers containing a segment
00140   DTRecSegment4DCollection::id_iterator chamberId;
00141   for (chamberId = all4DSegments->id_begin();
00142        chamberId != all4DSegments->id_end();
00143        ++chamberId){
00144     // Get the range for the corresponding ChamerId
00145     DTRecSegment4DCollection::range  range = all4DSegments->get(*chamberId);
00146 
00147     edm::LogVerbatim ("DTDQM|DTMonitorModule|DTSegmentAnalysisTask") << "   Chamber: " << *chamberId << " has " << distance(range.first, range.second)
00148                                  << " 4D segments";
00149 
00150     // Loop over the rechits of this ChamerId
00151     for (DTRecSegment4DCollection::const_iterator segment4D = range.first;
00152          segment4D!=range.second;
00153            ++segment4D){
00154 
00155       //FOR NOISY CHANNELS////////////////////////////////
00156      bool segmNoisy = false;
00157      if(checkNoisyChannels) {
00158        
00159        if((*segment4D).hasPhi()){
00160          const DTChamberRecSegment2D* phiSeg = (*segment4D).phiSegment();
00161          vector<DTRecHit1D> phiHits = phiSeg->specificRecHits();
00162          map<DTSuperLayerId,vector<DTRecHit1D> > hitsBySLMap; 
00163          for(vector<DTRecHit1D>::const_iterator hit = phiHits.begin();
00164              hit != phiHits.end(); ++hit) {
00165            DTWireId wireId = (*hit).wireId();
00166            
00167            // Check for noisy channels to skip them
00168            bool isNoisy = false;
00169            bool isFEMasked = false;
00170            bool isTDCMasked = false;
00171            bool isTrigMask = false;
00172            bool isDead = false;
00173            bool isNohv = false;
00174            statusMap->cellStatus(wireId, isNoisy, isFEMasked, isTDCMasked, isTrigMask, isDead, isNohv);
00175            if(isNoisy) {
00176              edm::LogVerbatim ("DTDQM|DTMonitorModule|DTSegmentAnalysisTask") << "Wire: " << wireId << " is noisy, skipping!";
00177              segmNoisy = true;
00178            }      
00179          }
00180        }
00181        
00182        if((*segment4D).hasZed()) {
00183          const DTSLRecSegment2D* zSeg = (*segment4D).zSegment();  // zSeg lives in the SL RF
00184          // Check for noisy channels to skip them
00185          vector<DTRecHit1D> zHits = zSeg->specificRecHits();
00186          for(vector<DTRecHit1D>::const_iterator hit = zHits.begin();
00187              hit != zHits.end(); ++hit) {
00188            DTWireId wireId = (*hit).wireId();
00189            bool isNoisy = false;
00190            bool isFEMasked = false;
00191            bool isTDCMasked = false;
00192            bool isTrigMask = false;
00193            bool isDead = false;
00194            bool isNohv = false;
00195            statusMap->cellStatus(wireId, isNoisy, isFEMasked, isTDCMasked, isTrigMask, isDead, isNohv);
00196            if(isNoisy) {
00197              edm::LogVerbatim ("DTDQM|DTMonitorModule|DTSegmentAnalysisTask") << "Wire: " << wireId << " is noisy, skipping!";
00198              segmNoisy = true;
00199            }     
00200          }
00201        } 
00202 
00203      } // end of switch on noisy channels
00204      if (segmNoisy) {
00205        edm::LogVerbatim ("DTDQM|DTMonitorModule|DTSegmentAnalysisTask")<<"skipping the segment: it contains noisy cells";
00206        continue;
00207      }
00208      //END FOR NOISY CHANNELS////////////////////////////////
00209       
00210      int nHits=0;
00211      LocalPoint segment4DLocalPos = (*segment4D).localPosition();
00212      LocalVector segment4DLocalDirection = (*segment4D).localDirection();
00213      if((*segment4D).hasPhi())
00214        nHits = (((*segment4D).phiSegment())->specificRecHits()).size();
00215      if((*segment4D).hasZed()) 
00216        nHits = nHits + ((((*segment4D).zSegment())->specificRecHits()).size());
00217       
00218      fillHistos(*chamberId,
00219                 nHits,
00220                 (*segment4D).chi2()/(*segment4D).degreesOfFreedom());
00221     }
00222   }
00223 
00224   // -----------------------------------------------------------------------------
00225 }

void DTSegmentAnalysisTask::beginJob ( const edm::EventSetup c  )  [virtual]

BeginJob.

Reimplemented from edm::EDAnalyzer.

Definition at line 71 of file DTSegmentAnalysisTask.cc.

References bookHistos(), muonGeometry::chambers, dtGeom, edm::EventSetup::get(), histoTimeEvol, hNevtPerLS, nLSTimeBin, nTimeBins, DQMStore::setCurrentFolder(), slideTimeBins, theDbe, and muonGeometry::wheel.

00071                                                                 { 
00072 
00073    // Get the DT Geometry
00074   context.get<MuonGeometryRecord>().get(dtGeom);
00075 
00076   // loop over all the DT chambers & book the histos
00077   vector<DTChamber*> chambers = dtGeom->chambers();
00078   vector<DTChamber*>::const_iterator ch_it = chambers.begin();
00079   vector<DTChamber*>::const_iterator ch_end = chambers.end();
00080   for (; ch_it != ch_end; ++ch_it) {
00081     bookHistos((*ch_it)->id());
00082   }
00083 
00084   // book sector time-evolution histos
00085   int modeTimeHisto = 0;
00086   if(!slideTimeBins) modeTimeHisto = 1;
00087   for(int wheel = -2; wheel != 3; ++wheel) { // loop over wheels
00088     for(int sector = 1; sector <= 12; ++sector) { // loop over sectors
00089       stringstream wheelstr; wheelstr << wheel; 
00090       stringstream sectorstr; sectorstr << sector;
00091       string sectorHistoName = "NSegmPerEvent_W" + wheelstr.str()
00092         + "_Sec" + sectorstr.str();
00093       string sectorHistoTitle = "# segm. W" + wheelstr.str() + " Sect." + sectorstr.str();
00094 
00095       theDbe->setCurrentFolder("DT/02-Segments/Wheel" + wheelstr.str() +
00096                                "/Sector" + sectorstr.str());
00097       histoTimeEvol[wheel][sector] = new DTTimeEvolutionHisto(&(*theDbe),sectorHistoName,sectorHistoTitle,
00098                                                               nTimeBins,nLSTimeBin,slideTimeBins,modeTimeHisto);
00099     }
00100   }
00101 
00102   theDbe->setCurrentFolder("DT/EventInfo/");
00103 
00104   hNevtPerLS = new DTTimeEvolutionHisto(&(*theDbe),"NevtPerLS","# evt.",nTimeBins,nLSTimeBin,slideTimeBins,2);
00105 
00106 }

void DTSegmentAnalysisTask::beginLuminosityBlock ( edm::LuminosityBlock const &  lumiSeg,
edm::EventSetup const &  eSetup 
) [virtual]

Summary.

Reimplemented from edm::EDAnalyzer.

Definition at line 323 of file DTSegmentAnalysisTask.cc.

References nEventsInLS.

00323                                                                                                          {
00324   nEventsInLS = 0;
00325 }

void DTSegmentAnalysisTask::bookHistos ( DTChamberId  chamberId  )  [private]

Definition at line 229 of file DTSegmentAnalysisTask.cc.

References DQMStore::book1D(), DQMStore::book2D(), detailedAnalysis, combine::histos, histosPerCh, DTChamberId::sector(), DQMStore::setCurrentFolder(), DTChamberId::station(), summaryHistos, theDbe, muonGeometry::wheel, and DTChamberId::wheel().

Referenced by beginJob().

00229                                                             {
00230 
00231   edm::LogVerbatim ("DTDQM|DTMonitorModule|DTSegmentAnalysisTask") << "   Booking histos for chamber: " << chamberId;
00232 
00233 
00234   // Compose the chamber name
00235   stringstream wheel; wheel << chamberId.wheel();       
00236   stringstream station; station << chamberId.station(); 
00237   stringstream sector; sector << chamberId.sector();
00238   
00239   string chamberHistoName =
00240     "_W" + wheel.str() +
00241     "_St" + station.str() +
00242     "_Sec" + sector.str();
00243   
00244 
00245   for(int wh=-2; wh<=2; wh++){
00246     stringstream wheel; wheel << wh;
00247     theDbe->setCurrentFolder("DT/02-Segments/Wheel" + wheel.str());
00248     string histoName =  "numberOfSegments_W" + wheel.str();
00249     summaryHistos[wh] = theDbe->book2D(histoName.c_str(),histoName.c_str(),12,1,13,4,1,5);
00250     summaryHistos[wh]->setAxisTitle("Sector",1);
00251     summaryHistos[wh]->setBinLabel(1,"1",1);
00252     summaryHistos[wh]->setBinLabel(2,"2",1);
00253     summaryHistos[wh]->setBinLabel(3,"3",1);
00254     summaryHistos[wh]->setBinLabel(4,"4",1);
00255     summaryHistos[wh]->setBinLabel(5,"5",1);
00256     summaryHistos[wh]->setBinLabel(6,"6",1);
00257     summaryHistos[wh]->setBinLabel(7,"7",1);
00258     summaryHistos[wh]->setBinLabel(8,"8",1);
00259     summaryHistos[wh]->setBinLabel(9,"9",1);
00260     summaryHistos[wh]->setBinLabel(10,"10",1);
00261     summaryHistos[wh]->setBinLabel(11,"11",1);
00262     summaryHistos[wh]->setBinLabel(12,"12",1);
00263     summaryHistos[wh]->setBinLabel(1,"MB1",2);
00264     summaryHistos[wh]->setBinLabel(2,"MB2",2);
00265     summaryHistos[wh]->setBinLabel(3,"MB3",2);
00266     summaryHistos[wh]->setBinLabel(4,"MB4",2);  
00267   }
00268 
00269 
00270   theDbe->setCurrentFolder("DT/02-Segments/Wheel" + wheel.str() +
00271                            "/Sector" + sector.str() +
00272                            "/Station" + station.str());
00273 
00274   // Create the monitor elements
00275   vector<MonitorElement *> histos;
00276   histos.push_back(theDbe->book1D("h4DSegmNHits"+chamberHistoName,
00277                                   "# of hits per segment",
00278                                   16, 0.5, 16.5));
00279   if(detailedAnalysis){
00280     histos.push_back(theDbe->book1D("h4DChi2"+chamberHistoName,
00281                                     "4D Segment reduced Chi2",
00282                                     20, 0, 20));
00283   }
00284   histosPerCh[chamberId] = histos;
00285 }

void DTSegmentAnalysisTask::endJob ( void   )  [virtual]

Endjob.

Reimplemented from edm::EDAnalyzer.

Definition at line 109 of file DTSegmentAnalysisTask.cc.

00109                                    {
00110  
00111   edm::LogVerbatim ("DTDQM|DTMonitorModule|DTSegmentAnalysisTask") <<"[DTSegmentAnalysisTask] endjob called!";
00112 
00113   //theDbe->save("testMonitoring.root");
00114 
00115 }

void DTSegmentAnalysisTask::endLuminosityBlock ( edm::LuminosityBlock const &  lumiSeg,
edm::EventSetup const &  eSetup 
) [virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 311 of file DTSegmentAnalysisTask.cc.

References histoTimeEvol, hNevtPerLS, edm::LuminosityBlock::luminosityBlock(), nEventsInLS, DTTimeEvolutionHisto::updateTimeSlot(), and muonGeometry::wheel.

00311                                                                                                        {
00312 
00313   hNevtPerLS->updateTimeSlot(lumiSeg.luminosityBlock(), nEventsInLS);
00314  // book sector time-evolution histos
00315   for(int wheel = -2; wheel != 3; ++wheel) {
00316     for(int sector = 1; sector <= 12; ++sector) {
00317       histoTimeEvol[wheel][sector]->updateTimeSlot(lumiSeg.luminosityBlock(), nEventsInLS);
00318     }
00319   }
00320 }

void DTSegmentAnalysisTask::fillHistos ( DTChamberId  chamberId,
int  nHits,
float  chi2 
) [private]

Definition at line 289 of file DTSegmentAnalysisTask.cc.

References detailedAnalysis, combine::histos, histosPerCh, histoTimeEvol, DTChamberId::sector(), DTChamberId::station(), summaryHistos, and DTChamberId::wheel().

Referenced by analyze().

00291                                                {
00292   int sector = chamberId.sector();
00293   if(chamberId.sector()==13) {
00294     sector = 4;
00295   } else if(chamberId.sector()==14) {
00296      sector = 10;
00297   }
00298 
00299   summaryHistos[chamberId.wheel()]->Fill(sector,chamberId.station());
00300   histoTimeEvol[chamberId.wheel()][sector]->accumulateValueTimeSlot(1);
00301 
00302   vector<MonitorElement *> histos =  histosPerCh[chamberId];                          
00303   histos[0]->Fill(nHits);
00304   if(detailedAnalysis){
00305     histos[1]->Fill(chi2);
00306   }
00307 
00308 }


Member Data Documentation

bool DTSegmentAnalysisTask::checkNoisyChannels [private]

Definition at line 74 of file DTSegmentAnalysisTask.h.

Referenced by analyze(), and DTSegmentAnalysisTask().

bool DTSegmentAnalysisTask::detailedAnalysis [private]

Definition at line 65 of file DTSegmentAnalysisTask.h.

Referenced by bookHistos(), DTSegmentAnalysisTask(), and fillHistos().

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

Definition at line 68 of file DTSegmentAnalysisTask.h.

Referenced by beginJob().

std::map<DTChamberId, std::vector<MonitorElement*> > DTSegmentAnalysisTask::histosPerCh [private]

Definition at line 86 of file DTSegmentAnalysisTask.h.

Referenced by bookHistos(), and fillHistos().

std::map<int, std::map<int, DTTimeEvolutionHisto*> > DTSegmentAnalysisTask::histoTimeEvol [private]

Definition at line 88 of file DTSegmentAnalysisTask.h.

Referenced by beginJob(), endLuminosityBlock(), and fillHistos().

DTTimeEvolutionHisto* DTSegmentAnalysisTask::hNevtPerLS [private]

Definition at line 91 of file DTSegmentAnalysisTask.h.

Referenced by beginJob(), and endLuminosityBlock().

int DTSegmentAnalysisTask::nEventsInLS [private]

Definition at line 90 of file DTSegmentAnalysisTask.h.

Referenced by analyze(), beginLuminosityBlock(), and endLuminosityBlock().

int DTSegmentAnalysisTask::nLSTimeBin [private]

Definition at line 96 of file DTSegmentAnalysisTask.h.

Referenced by beginJob(), and DTSegmentAnalysisTask().

int DTSegmentAnalysisTask::nTimeBins [private]

Definition at line 94 of file DTSegmentAnalysisTask.h.

Referenced by beginJob(), and DTSegmentAnalysisTask().

edm::ParameterSet DTSegmentAnalysisTask::parameters [private]

Definition at line 76 of file DTSegmentAnalysisTask.h.

bool DTSegmentAnalysisTask::slideTimeBins [private]

Definition at line 98 of file DTSegmentAnalysisTask.h.

Referenced by beginJob(), and DTSegmentAnalysisTask().

std::map< int, MonitorElement* > DTSegmentAnalysisTask::summaryHistos [private]

Definition at line 87 of file DTSegmentAnalysisTask.h.

Referenced by bookHistos(), and fillHistos().

DQMStore* DTSegmentAnalysisTask::theDbe [private]

Definition at line 62 of file DTSegmentAnalysisTask.h.

Referenced by beginJob(), bookHistos(), and DTSegmentAnalysisTask().

std::string DTSegmentAnalysisTask::theRecHits4DLabel [private]

Definition at line 71 of file DTSegmentAnalysisTask.h.

Referenced by analyze(), and DTSegmentAnalysisTask().


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