#include <DTResolutionAnalysisTask.h>
Public Member Functions | |
void | analyze (const edm::Event &event, const edm::EventSetup &setup) |
void | beginLuminosityBlock (edm::LuminosityBlock const &lumiSeg, edm::EventSetup const &context) |
To reset the MEs. | |
void | beginRun (const edm::Run &, const edm::EventSetup &) |
BeginRun. | |
DTResolutionAnalysisTask (const edm::ParameterSet &pset) | |
Constructor. | |
void | endJob () |
Endjob. | |
virtual | ~DTResolutionAnalysisTask () |
Destructor. | |
Private Member Functions | |
void | bookHistos (DTSuperLayerId slId) |
void | fillHistos (DTSuperLayerId slId, float distExtr, float residual) |
Private Attributes | |
edm::ESHandle< DTGeometry > | dtGeom |
std::map< DTSuperLayerId, std::vector< MonitorElement * > > | histosPerSL |
int | prescaleFactor |
int | resetCycle |
DQMStore * | theDbe |
std::string | theRecHits4DLabel |
std::string | topHistoFolder |
Definition at line 32 of file DTResolutionAnalysisTask.h.
DTResolutionAnalysisTask::DTResolutionAnalysisTask | ( | const edm::ParameterSet & | pset | ) |
Constructor.
Definition at line 38 of file DTResolutionAnalysisTask.cc.
References edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), ExpressReco_HICollisions_FallBack::prescaleFactor, and ExpressReco_HICollisions_FallBack::topHistoFolder.
{ edm::LogVerbatim ("DTDQM|DTMonitorModule|DTResolutionAnalysisTask") << "[DTResolutionAnalysisTask] Constructor called!" << endl; // the name of the 4D rec hits collection theRecHits4DLabel = pset.getParameter<string>("recHits4DLabel"); prescaleFactor = pset.getUntrackedParameter<int>("diagnosticPrescale", 1); resetCycle = pset.getUntrackedParameter<int>("ResetCycle", -1); // top folder for the histograms in DQMStore topHistoFolder = pset.getUntrackedParameter<string>("topHistoFolder","DT/02-Segments"); }
DTResolutionAnalysisTask::~DTResolutionAnalysisTask | ( | ) | [virtual] |
Destructor.
Definition at line 53 of file DTResolutionAnalysisTask.cc.
{ edm::LogVerbatim ("DTDQM|DTMonitorModule|DTResolutionAnalysisTask") << "[DTResolutionAnalysisTask] Destructor called!" << endl; }
void DTResolutionAnalysisTask::analyze | ( | const edm::Event & | event, |
const edm::EventSetup & | setup | ||
) | [virtual] |
Implements edm::EDAnalyzer.
Definition at line 111 of file DTResolutionAnalysisTask.cc.
References filterCSVwithJSON::copy, funct::cos(), edm::HandleBase::isValid(), DTWireId::layerId(), DTRecSegment2D::specificRecHits(), DTLayer::specificTopology(), DTChamber::superLayer(), DTSuperLayerId::superlayer(), DTLayerId::superlayerId(), GeomDet::toGlobal(), GeomDet::toLocal(), DTWireId::wire(), DTTopology::wirePosition(), PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().
{ edm::LogVerbatim ("DTDQM|DTMonitorModule|DTResolutionAnalysisTask") << "[DTResolutionAnalysisTask] Analyze #Run: " << event.id().run() << " #Event: " << event.id().event() << endl; // Get the 4D segment collection from the event edm::Handle<DTRecSegment4DCollection> all4DSegments; event.getByLabel(theRecHits4DLabel, all4DSegments); // check the validity of the collection if(!all4DSegments.isValid()) return; // Loop over all chambers containing a segment DTRecSegment4DCollection::id_iterator chamberId; for (chamberId = all4DSegments->id_begin(); chamberId != all4DSegments->id_end(); ++chamberId) { // Get the range for the corresponding ChamerId DTRecSegment4DCollection::range range = all4DSegments->get(*chamberId); // int nsegm = distance(range.first, range.second); //edm::LogVerbatim ("DTDQM|DTMonitorModule|DTResolutionAnalysisTask") << " Chamber: " << *chamberId << " has " << nsegm //<< " 4D segments" << endl; // Get the chamber const DTChamber* chamber = dtGeom->chamber(*chamberId); // Loop over the rechits of this ChamerId for (DTRecSegment4DCollection::const_iterator segment4D = range.first; segment4D!=range.second; ++segment4D) { //edm::LogVerbatim ("DTDQM|DTMonitorModule|DTResolutionAnalysisTask") << " == RecSegment dimension: " << (*segment4D).dimension() << endl; // If Statio != 4 skip RecHits with dimension != 4 // For the Station 4 consider 2D RecHits if((*chamberId).station() != 4 && (*segment4D).dimension() != 4) { edm::LogVerbatim ("DTDQM|DTMonitorModule|DTResolutionAnalysisTask") << "[DTResolutionAnalysisTask]***Warning: RecSegment dimension is not 4 but " << (*segment4D).dimension() << "!" << endl; continue; } else if((*chamberId).station() == 4 && (*segment4D).dimension() != 2) { edm::LogVerbatim ("DTDQM|DTMonitorModule|DTResolutionAnalysisTask") << "[DTResolutionAnalysisTask]***Warning: RecSegment dimension is not 2 but " << (*segment4D).dimension() << "!" << endl; continue; } // Get all 1D RecHits at step 3 within the 4D segment vector<DTRecHit1D> recHits1D_S3; // Get 1D RecHits at Step 3 and select only events with // 8 hits in phi and 4 hits in theta (if any) if((*segment4D).hasPhi()) { // has phi component const DTChamberRecSegment2D* phiSeg = (*segment4D).phiSegment(); vector<DTRecHit1D> phiRecHits = phiSeg->specificRecHits(); if(phiRecHits.size() != 8) { //edm::LogVerbatim ("DTDQM|DTMonitorModule|DTResolutionAnalysisTask") << "[DTResolutionAnalysisTask] Phi segments has: " << phiRecHits.size() //<< " hits" << endl; // FIXME: info output continue; } copy(phiRecHits.begin(), phiRecHits.end(), back_inserter(recHits1D_S3)); } else { //edm::LogVerbatim ("DTDQM|DTMonitorModule|DTResolutionAnalysisTask") << "[DTResolutionAnalysisTask] 4D segment has not phi component!" << endl; } if((*segment4D).hasZed()) { const DTSLRecSegment2D* zSeg = (*segment4D).zSegment(); vector<DTRecHit1D> zRecHits = zSeg->specificRecHits(); if(zRecHits.size() != 4) { //edm::LogVerbatim ("DTDQM|DTMonitorModule|DTResolutionAnalysisTask") << "[DTResolutionAnalysisTask] Theta segments has: " << zRecHits.size() //<< " hits, skipping" << endl; // FIXME: info output continue; } copy(zRecHits.begin(), zRecHits.end(), back_inserter(recHits1D_S3)); } // Loop over 1D RecHit inside 4D segment for(vector<DTRecHit1D>::const_iterator recHit1D = recHits1D_S3.begin(); recHit1D != recHits1D_S3.end(); recHit1D++) { const DTWireId wireId = (*recHit1D).wireId(); // Get the layer and the wire position const DTLayer* layer = chamber->superLayer(wireId.superlayerId())->layer(wireId.layerId()); float wireX = layer->specificTopology().wirePosition(wireId.wire()); // Distance of the 1D rechit from the wire float distRecHitToWire = fabs(wireX - (*recHit1D).localPosition().x()); // Extrapolate the segment to the z of the wire // Get wire position in chamber RF LocalPoint wirePosInLay(wireX,(*recHit1D).localPosition().y(),(*recHit1D).localPosition().z()); GlobalPoint wirePosGlob = layer->toGlobal(wirePosInLay); LocalPoint wirePosInChamber = chamber->toLocal(wirePosGlob); // Segment position at Wire z in chamber local frame LocalPoint segPosAtZWire = (*segment4D).localPosition() + (*segment4D).localDirection()*wirePosInChamber.z()/cos((*segment4D).localDirection().theta()); // Compute the distance of the segment from the wire int sl = wireId.superlayer(); double distSegmToWire = -1; if(sl == 1 || sl == 3) { // RPhi SL distSegmToWire = fabs(wirePosInChamber.x() - segPosAtZWire.x()); } else if(sl == 2) { // RZ SL distSegmToWire = fabs(wirePosInChamber.y() - segPosAtZWire.y()); } if(distSegmToWire > 2.1) edm::LogVerbatim ("DTDQM|DTMonitorModule|DTResolutionAnalysisTask") << " Warning: dist segment-wire: " << distSegmToWire << endl; double residual = distRecHitToWire - distSegmToWire; // FIXME: Fill the histos fillHistos(wireId.superlayerId(), distSegmToWire, residual); // edm::LogVerbatim ("DTDQM|DTMonitorModule|DTResolutionAnalysisTask") << " Dist. segment extrapolation - wire (cm): " << distSegmToWire << endl; //edm::LogVerbatim ("DTDQM|DTMonitorModule|DTResolutionAnalysisTask") << " Dist. RecHit - wire (cm): " << distRecHitToWire << endl; //edm::LogVerbatim ("DTDQM|DTMonitorModule|DTResolutionAnalysisTask") << " Residual (cm): " << residual << endl; }// End of loop over 1D RecHit inside 4D segment }// End of loop over the rechits of this ChamerId } // ----------------------------------------------------------------------------- }
void DTResolutionAnalysisTask::beginLuminosityBlock | ( | edm::LuminosityBlock const & | lumiSeg, |
edm::EventSetup const & | context | ||
) | [virtual] |
To reset the MEs.
Reimplemented from edm::EDAnalyzer.
Definition at line 85 of file DTResolutionAnalysisTask.cc.
References trackerHits::histo, i, edm::LuminosityBlockBase::id(), edm::LuminosityBlockID::luminosityBlock(), and findQualityFiles::size.
{ edm::LogVerbatim ("DTDQM|DTMonitorModule|DTResolutionAnalysisTask") << "[DTResolutionTask]: Begin of LS transition"<<endl; if(resetCycle != -1 && lumiSeg.id().luminosityBlock() % resetCycle == 0) { for(map<DTSuperLayerId, vector<MonitorElement*> > ::const_iterator histo = histosPerSL.begin(); histo != histosPerSL.end(); histo++) { int size = (*histo).second.size(); for(int i=0; i<size; i++){ (*histo).second[i]->Reset(); } } } }
void DTResolutionAnalysisTask::beginRun | ( | const edm::Run & | run, |
const edm::EventSetup & | setup | ||
) | [virtual] |
BeginRun.
Reimplemented from edm::EDAnalyzer.
Definition at line 59 of file DTResolutionAnalysisTask.cc.
References bookHistos(), chambers, edm::EventSetup::get(), cmsCodeRules::cppFunctionSkipper::operator, and DTChamberId::station().
{ // Get the DQM needed services theDbe = edm::Service<DQMStore>().operator->(); // theDbe->setCurrentFolder("DT/02-Segments"); // Get the DT Geometry setup.get<MuonGeometryRecord>().get(dtGeom); // Book the histograms vector<DTChamber*> chambers = dtGeom->chambers(); for(vector<DTChamber*>::const_iterator chamber = chambers.begin(); chamber != chambers.end(); ++chamber) { // Loop over all chambers DTChamberId dtChId = (*chamber)->id(); for(int sl = 1; sl <= 3; ++sl) { // Loop over SLs if(dtChId.station() == 4 && sl == 2) continue; const DTSuperLayerId dtSLId(dtChId,sl); bookHistos(dtSLId); } } }
void DTResolutionAnalysisTask::bookHistos | ( | DTSuperLayerId | slId | ) | [private] |
Definition at line 244 of file DTResolutionAnalysisTask.cc.
References combine::histos, DTChamberId::sector(), relativeConstraints::station, DTChamberId::station(), DTSuperLayerId::superlayer(), ExpressReco_HICollisions_FallBack::topHistoFolder, and DTChamberId::wheel().
{ edm::LogVerbatim ("DTDQM|DTMonitorModule|DTResolutionAnalysisTask") << " Booking histos for SL: " << slId << endl; // Compose the chamber name stringstream wheel; wheel << slId.wheel(); stringstream station; station << slId.station(); stringstream sector; sector << slId.sector(); stringstream superLayer; superLayer << slId.superlayer(); string slHistoName = "_W" + wheel.str() + "_St" + station.str() + "_Sec" + sector.str() + "_SL" + superLayer.str(); theDbe->setCurrentFolder(topHistoFolder + "/Wheel" + wheel.str() + "/Sector" + sector.str() + "/Station" + station.str()); // Create the monitor elements vector<MonitorElement *> histos; // Note hte order matters histos.push_back(theDbe->book1D("hResDist"+slHistoName, "Residuals on the distance from wire (rec_hit - segm_extr) (cm)", 200, -0.4, 0.4)); //FIXME: 2D plot removed to reduce the # of ME // histos.push_back(theDbe->book2D("hResDistVsDist"+slHistoName, // "Residuals on the distance (cm) from wire (rec_hit - segm_extr) vs distance (cm)", // 100, 0, 2.5, 200, -0.4, 0.4)); histosPerSL[slId] = histos; }
void DTResolutionAnalysisTask::endJob | ( | void | ) | [virtual] |
Endjob.
Reimplemented from edm::EDAnalyzer.
Definition at line 103 of file DTResolutionAnalysisTask.cc.
{ edm::LogVerbatim ("DTDQM|DTMonitorModule|DTResolutionAnalysisTask") << "[DTResolutionAnalysisTask] endjob called!"<<endl; }
void DTResolutionAnalysisTask::fillHistos | ( | DTSuperLayerId | slId, |
float | distExtr, | ||
float | residual | ||
) | [private] |
Definition at line 279 of file DTResolutionAnalysisTask.cc.
References combine::histos.
{ vector<MonitorElement *> histos = histosPerSL[slId]; histos[0]->Fill(residual); //FIXME: 2D plot removed to reduce the # of ME // histos[1]->Fill(distExtr, residual); }
Definition at line 58 of file DTResolutionAnalysisTask.h.
std::map<DTSuperLayerId, std::vector<MonitorElement*> > DTResolutionAnalysisTask::histosPerSL [private] |
Definition at line 73 of file DTResolutionAnalysisTask.h.
int DTResolutionAnalysisTask::prescaleFactor [private] |
Definition at line 60 of file DTResolutionAnalysisTask.h.
int DTResolutionAnalysisTask::resetCycle [private] |
Definition at line 61 of file DTResolutionAnalysisTask.h.
DQMStore* DTResolutionAnalysisTask::theDbe [private] |
Definition at line 56 of file DTResolutionAnalysisTask.h.
std::string DTResolutionAnalysisTask::theRecHits4DLabel [private] |
Definition at line 64 of file DTResolutionAnalysisTask.h.
std::string DTResolutionAnalysisTask::topHistoFolder [private] |
Definition at line 76 of file DTResolutionAnalysisTask.h.