38 segment4DLabel_(pset.getParameter<edm::InputTag>(
"segment4DLabel")),
39 rootBaseDir_(pset.getUntrackedParameter<std::string>(
"rootBaseDir",
"DT/Residuals")) {
41 edm::LogVerbatim(
"Calibration") <<
"[DTResidualCalibration] Constructor called.";
44 rootFile_ =
new TFile(rootFileName.c_str(),
"RECREATE");
49 edm::LogVerbatim(
"Calibration") <<
"[DTResidualCalibration] Destructor called.";
53 TH1::SetDefaultSumw2(
true);
65 std::vector<DTChamber*>::const_iterator ch_it =
dtGeom_->
chambers().begin();
66 std::vector<DTChamber*>::const_iterator ch_end =
dtGeom_->
chambers().end();
67 for (; ch_it != ch_end; ++ch_it) {
69 std::vector<const DTSuperLayer*>::const_iterator sl_it = (*ch_it)->superLayers().begin();
70 std::vector<const DTSuperLayer*>::const_iterator sl_end = (*ch_it)->superLayers().end();
72 for(; sl_it != sl_end; ++sl_it) {
89 for(chamberIdIt = segment4Ds->id_begin(); chamberIdIt != segment4Ds->id_end(); ++chamberIdIt){
97 segment != range.second; ++segment){
99 LogTrace(
"Calibration") <<
"Segment local pos (in chamber RF): " << (*segment).localPosition()
100 <<
"\nSegment global pos: " << chamber->
toGlobal((*segment).localPosition());
102 if( !
select_(*segment, event, setup) )
continue;
105 std::vector<DTRecHit1D> recHits1D_S3;
107 if( (*segment).hasPhi() ){
110 std::copy(phiRecHits.begin(), phiRecHits.end(), back_inserter(recHits1D_S3));
113 if( (*segment).hasZed() ){
116 std::copy(zRecHits.begin(), zRecHits.end(), back_inserter(recHits1D_S3));
120 for(std::vector<DTRecHit1D>::const_iterator recHit1D = recHits1D_S3.begin();
121 recHit1D != recHits1D_S3.end(); ++recHit1D) {
122 const DTWireId wireId = recHit1D->wireId();
125 if(segmDistance > 2.1)
LogTrace(
"Calibration") <<
"WARNING: segment-wire distance: " << segmDistance;
126 else LogTrace(
"Calibration") <<
"segment-wire distance: " << segmDistance;
129 LogTrace(
"Calibration") <<
"Wire Id " << wireId <<
" residual on distance: " << residualOnDistance;
158 float segmDistance = -1;
159 if(sl == 1 || sl == 3) segmDistance = fabs(wirePosInChamber.
x() - segPosAtZWire.
x());
160 else if(sl == 2) segmDistance = fabs(segPosAtZWire.
y() - wirePosInChamber.
y());
167 edm::LogVerbatim(
"Calibration") <<
"[DTResidualCalibration] Writing histos to file.";
190 edm::LogVerbatim(
"Calibration") <<
"[DTResidualCalibration] Booking histos for SL: " << slId;
196 std::stringstream superLayerStr; superLayerStr << slId.
superlayer();
199 std::stringstream stepStr; stepStr <<
step;
201 std::string slHistoName =
202 "_STEP" + stepStr.str() +
203 "_W" + wheelStr.str() +
204 "_St" + stationStr.str() +
205 "_Sec" + sectorStr.str() +
206 "_SL" + superLayerStr.str();
211 edm::LogVerbatim(
"Calibration") <<
"Accessing " << (
"Wheel" + wheelStr.str());
212 TDirectory* wheelDir = baseDir->GetDirectory((
"Wheel" + wheelStr.str()).c_str());
213 if(!wheelDir) wheelDir = baseDir->mkdir((
"Wheel" + wheelStr.str()).c_str());
214 edm::LogVerbatim(
"Calibration") <<
"Accessing " << (
"Station" + stationStr.str());
215 TDirectory* stationDir = wheelDir->GetDirectory((
"Station" + stationStr.str()).c_str());
216 if(!stationDir) stationDir = wheelDir->mkdir((
"Station" + stationStr.str()).c_str());
217 edm::LogVerbatim(
"Calibration") <<
"Accessing " << (
"Sector" + sectorStr.str());
218 TDirectory* sectorDir = stationDir->GetDirectory((
"Sector" + sectorStr.str()).c_str());
219 if(!sectorDir) sectorDir = stationDir->mkdir((
"Sector" + sectorStr.str()).c_str());
230 std::vector<TH1F*> histosTH1F;
231 histosTH1F.push_back(
new TH1F((
"hResDist"+slHistoName).c_str(),
232 "Residuals on the distance from wire (rec_hit - segm_extr) (cm)",
234 std::vector<TH2F*> histosTH2F;
235 histosTH2F.push_back(
new TH2F((
"hResDistVsDist"+slHistoName).c_str(),
236 "Residuals on the dist. (cm) from wire (rec_hit - segm_extr) vs dist. (cm)",
237 100, 0, 2.5, 200, -0.4, 0.4));
245 float residualOnDistance) {
248 histosTH1F[0]->Fill(residualOnDistance);
249 histosTH2F[0]->Fill(distance, residualOnDistance);
T getUntrackedParameter(std::string const &, T const &) const
float wirePosition(int wireNumber) const
Returns the x position in the layer of a given wire number.
std::pair< const_iterator, const_iterator > range
iterator range
edm::InputTag segment4DLabel_
void fillHistos(DTSuperLayerId slId, float distance, float residualOnDistance)
void bookHistos(DTSuperLayerId slId)
DTResidualCalibration(const edm::ParameterSet &pset)
Constructor.
DTChamberId chamberId() const
Return the corresponding ChamberId.
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
virtual ~DTResidualCalibration()
Destructor.
LocalPoint toLocal(const GlobalPoint &gp) const
Conversion to the R.F. of the GeomDet.
DTSuperLayerId superlayerId() const
Return the corresponding SuperLayerId.
Geom::Theta< T > theta() const
void analyze(const edm::Event &event, const edm::EventSetup &setup)
const DTLayer * layer(DTLayerId id) const
Return a layer given its id.
virtual LocalVector localDirection() const
Local direction in Chamber frame.
void beginRun(const edm::Run &, const edm::EventSetup &)
C::const_iterator const_iterator
constant access iterator type
const DTTopology & specificTopology() const
std::map< DTSuperLayerId, std::vector< TH1F * > > histoMapTH1F_
Cos< T >::type cos(const T &t)
std::map< DTSuperLayerId, std::vector< TH2F * > > histoMapTH2F_
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
virtual LocalPoint localPosition() const
Local position in Chamber frame.
std::vector< DTRecHit1D > specificRecHits() const
Access to specific components.
const std::vector< DTChamber * > & chambers() const
Return a vector of all Chamber.
virtual LocalPoint localPosition() const
Return the 3-dimensional local position.
int wire() const
Return the wire number.
int superlayer() const
Return the superlayer number (deprecated method name)
float compute(const DTGeometry *, const DTRecHit1D &, const DTRecSegment4D &)
T const * product() const
const DTChamber * chamber(DTChamberId id) const
Return a DTChamber given its id.
const DTGeometry * dtGeom_
DTSegmentSelector select_
DTLayerId layerId() const
Return the corresponding LayerId.
float segmentToWireDistance(const DTRecHit1D &recHit1D, const DTRecSegment4D &segment)
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="")
DTWireId wireId() const
Return the wireId.