38 segment4DLabel_(pset.getParameter<edm::InputTag>(
"segment4DLabel")),
39 rootBaseDir_(pset.getUntrackedParameter<std::
string>(
"rootBaseDir",
"DT/Residuals")),
40 detailedAnalysis_(pset.getUntrackedParameter<bool>(
"detailedAnalysis",
false)) {
42 edm::LogVerbatim(
"Calibration") <<
"[DTResidualCalibration] Constructor called.";
45 rootFile_ =
new TFile(rootFileName.c_str(),
"RECREATE");
50 edm::LogVerbatim(
"Calibration") <<
"[DTResidualCalibration] Destructor called.";
54 TH1::SetDefaultSumw2(
true);
66 std::vector<DTChamber*>::const_iterator ch_it =
dtGeom_->
chambers().begin();
67 std::vector<DTChamber*>::const_iterator ch_end =
dtGeom_->
chambers().end();
68 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) {
76 std::vector<const DTLayer*>::const_iterator layer_it = (*sl_it)->layers().begin();
77 std::vector<const DTLayer*>::const_iterator layer_end = (*sl_it)->layers().end();
78 for(; layer_it != layer_end; ++layer_it) {
97 for(chamberIdIt = segment4Ds->id_begin(); chamberIdIt != segment4Ds->id_end(); ++chamberIdIt){
105 segment != range.second; ++segment){
107 LogTrace(
"Calibration") <<
"Segment local pos (in chamber RF): " << (*segment).localPosition()
108 <<
"\nSegment global pos: " << chamber->
toGlobal((*segment).localPosition());
110 if( !
select_(*segment, event, setup) )
continue;
113 std::vector<DTRecHit1D> recHits1D_S3;
115 if( (*segment).hasPhi() ){
118 std::copy(phiRecHits.begin(), phiRecHits.end(), back_inserter(recHits1D_S3));
121 if( (*segment).hasZed() ){
124 std::copy(zRecHits.begin(), zRecHits.end(), back_inserter(recHits1D_S3));
128 for(std::vector<DTRecHit1D>::const_iterator recHit1D = recHits1D_S3.begin();
129 recHit1D != recHits1D_S3.end(); ++recHit1D) {
130 const DTWireId wireId = recHit1D->wireId();
133 if(segmDistance > 2.1)
LogTrace(
"Calibration") <<
"WARNING: segment-wire distance: " << segmDistance;
134 else LogTrace(
"Calibration") <<
"segment-wire distance: " << segmDistance;
137 LogTrace(
"Calibration") <<
"Wire Id " << wireId <<
" residual on distance: " << residualOnDistance;
167 float segmDistance = -1;
168 if(sl == 1 || sl == 3) segmDistance = fabs(wirePosInChamber.
x() - segPosAtZWire.
x());
169 else if(sl == 2) segmDistance = fabs(segPosAtZWire.
y() - wirePosInChamber.
y());
176 edm::LogVerbatim(
"Calibration") <<
"[DTResidualCalibration] Writing histos to file.";
199 edm::LogVerbatim(
"Calibration") <<
"[DTResidualCalibration] Booking histos for SL: " << slId;
205 std::stringstream superLayerStr; superLayerStr << slId.
superlayer();
208 std::stringstream stepStr; stepStr <<
step;
211 "_STEP" + stepStr.str() +
212 "_W" + wheelStr.str() +
213 "_St" + stationStr.str() +
214 "_Sec" + sectorStr.str() +
215 "_SL" + superLayerStr.str();
220 edm::LogVerbatim(
"Calibration") <<
"Accessing " << (
"Wheel" + wheelStr.str());
221 TDirectory* wheelDir = baseDir->GetDirectory((
"Wheel" + wheelStr.str()).c_str());
222 if(!wheelDir) wheelDir = baseDir->mkdir((
"Wheel" + wheelStr.str()).c_str());
223 edm::LogVerbatim(
"Calibration") <<
"Accessing " << (
"Station" + stationStr.str());
224 TDirectory* stationDir = wheelDir->GetDirectory((
"Station" + stationStr.str()).c_str());
225 if(!stationDir) stationDir = wheelDir->mkdir((
"Station" + stationStr.str()).c_str());
226 edm::LogVerbatim(
"Calibration") <<
"Accessing " << (
"Sector" + sectorStr.str());
227 TDirectory* sectorDir = stationDir->GetDirectory((
"Sector" + sectorStr.str()).c_str());
228 if(!sectorDir) sectorDir = stationDir->mkdir((
"Sector" + sectorStr.str()).c_str());
239 std::vector<TH1F*> histosTH1F;
240 histosTH1F.push_back(
new TH1F((
"hResDist"+slHistoName).c_str(),
241 "Residuals on the distance from wire (rec_hit - segm_extr) (cm)",
243 std::vector<TH2F*> histosTH2F;
244 histosTH2F.push_back(
new TH2F((
"hResDistVsDist"+slHistoName).c_str(),
245 "Residuals on the dist. (cm) from wire (rec_hit - segm_extr) vs dist. (cm)",
246 100, 0, 2.5, 200, -0.4, 0.4));
255 edm::LogVerbatim(
"Calibration") <<
"[DTResidualCalibration] Booking histos for layer: " << layerId;
261 std::stringstream superLayerStr; superLayerStr << layerId.
superlayer();
262 std::stringstream layerStr; layerStr << layerId.
layer();
265 std::stringstream stepStr; stepStr <<
step;
268 "_STEP" + stepStr.str() +
269 "_W" + wheelStr.str() +
270 "_St" + stationStr.str() +
271 "_Sec" + sectorStr.str() +
272 "_SL" + superLayerStr.str() +
273 "_Layer" + layerStr.str();
278 edm::LogVerbatim(
"Calibration") <<
"Accessing " << (
"Wheel" + wheelStr.str());
279 TDirectory* wheelDir = baseDir->GetDirectory((
"Wheel" + wheelStr.str()).c_str());
280 if(!wheelDir) wheelDir = baseDir->mkdir((
"Wheel" + wheelStr.str()).c_str());
281 edm::LogVerbatim(
"Calibration") <<
"Accessing " << (
"Station" + stationStr.str());
282 TDirectory* stationDir = wheelDir->GetDirectory((
"Station" + stationStr.str()).c_str());
283 if(!stationDir) stationDir = wheelDir->mkdir((
"Station" + stationStr.str()).c_str());
284 edm::LogVerbatim(
"Calibration") <<
"Accessing " << (
"Sector" + sectorStr.str());
285 TDirectory* sectorDir = stationDir->GetDirectory((
"Sector" + sectorStr.str()).c_str());
286 if(!sectorDir) sectorDir = stationDir->mkdir((
"Sector" + sectorStr.str()).c_str());
287 edm::LogVerbatim(
"Calibration") <<
"Accessing " << (
"SL" + superLayerStr.str());
288 TDirectory* superLayerDir = sectorDir->GetDirectory((
"SL" + superLayerStr.str()).c_str());
289 if(!superLayerDir) superLayerDir = sectorDir->mkdir((
"SL" + superLayerStr.str()).c_str());
293 std::vector<TH1F*> histosTH1F;
294 histosTH1F.push_back(
new TH1F((
"hResDist"+layerHistoName).c_str(),
295 "Residuals on the distance from wire (rec_hit - segm_extr) (cm)",
297 std::vector<TH2F*> histosTH2F;
298 histosTH2F.push_back(
new TH2F((
"hResDistVsDist"+layerHistoName).c_str(),
299 "Residuals on the dist. (cm) from wire (rec_hit - segm_extr) vs dist. (cm)",
300 100, 0, 2.5, 200, -0.4, 0.4));
308 float residualOnDistance) {
311 histosTH1F[0]->Fill(residualOnDistance);
312 histosTH2F[0]->Fill(distance, residualOnDistance);
318 float residualOnDistance) {
321 histosTH1F[0]->Fill(residualOnDistance);
322 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)
std::map< DTLayerId, std::vector< TH1F * > > histoMapPerLayerTH1F_
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.
int layer() const
Return the layer number.
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_
std::map< DTLayerId, std::vector< TH2F * > > histoMapPerLayerTH2F_
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.