116 LogTrace(
"Calibration") <<
"--- [DTVDriftCalibration] Event analysed #Run: " <<
event.id().run()
117 <<
" #Event: " <<
event.id().event();
122 stringstream linestr;
123 int selWheel, selStation, selSector;
125 linestr >> selWheel >> selStation >> selSector;
126 chosenChamberId =
DTChamberId(selWheel, selStation, selSector);
127 LogTrace(
"Calibration") <<
"chosen chamber " << chosenChamberId;
142 for (chamberIdIt = all4DSegments->id_begin(); chamberIdIt != all4DSegments->id_end(); ++chamberIdIt) {
145 LogTrace(
"Calibration") <<
"Chamber Id: " << *chamberIdIt;
156 if (!(*segment).hasZed() && !(*segment).hasPhi()) {
157 LogError(
"Calibration") <<
"4D segment without Z and Phi segments";
161 LogTrace(
"Calibration") <<
"Segment local pos (in chamber RF): " << (*segment).localPosition()
162 <<
"\nSegment global pos: " <<
chamber->toGlobal((*segment).localPosition());
169 map<DTSuperLayerId, vector<DTRecHit1D> > hitsBySLMap;
170 if ((*segment).hasPhi()) {
175 for (vector<DTRecHit1D>::const_iterator
hit = phiHits.begin();
hit != phiHits.end(); ++
hit) {
178 hitsBySLMap[slId].push_back(*
hit);
184 if ((*segment).hasZed()) {
187 zSeg2DPosInCham =
chamber->toLocal(sl->
toGlobal((*zSeg).localPosition()));
188 zSeg2DDirInCham =
chamber->toLocal(sl->
toGlobal((*zSeg).localDirection()));
192 LocalPoint segment4DLocalPos = (*segment).localPosition();
193 LocalVector segment4DLocalDir = (*segment).localDirection();
194 double chiSquare = ((*segment).chi2() / (*segment).degreesOfFreedom());
197 if ((*segment).hasPhi())
198 h2DSegmRPhi->
Fill(phiSeg2DPosInCham.
x(), phiSeg2DDirInCham.
x() / phiSeg2DDirInCham.
z());
199 if ((*segment).hasZed())
200 h2DSegmRZ->
Fill(zSeg2DPosInCham.
y(), zSeg2DDirInCham.
y() / zSeg2DDirInCham.
z());
202 if ((*segment).hasZed() && (*segment).hasPhi())
204 segment4DLocalPos.
y(),
205 atan(segment4DLocalDir.
x() / segment4DLocalDir.
z()) * 180. /
Geom::pi(),
206 atan(segment4DLocalDir.
y() / segment4DLocalDir.
z()) * 180. /
Geom::pi(),
208 else if ((*segment).hasPhi())
210 atan(segment4DLocalDir.
x() / segment4DLocalDir.
z()) * 180. /
Geom::pi());
211 else if ((*segment).hasZed())
212 LogWarning(
"Calibration") <<
"4d segment with only Z";
215 for (
map<
DTSuperLayerId, vector<DTRecHit1D> >::const_iterator slIdAndHits = hitsBySLMap.begin();
216 slIdAndHits != hitsBySLMap.end();
218 if (slIdAndHits->second.size() < 3)
223 DTTMax slSeg(slIdAndHits->second,
224 *(
chamber->superLayer(slIdAndHits->first)),
225 chamber->toGlobal((*segment).localDirection()),
226 chamber->toGlobal((*segment).localPosition()),
231 vector<const TMax*> tMaxes = slSeg.getTMax(slId);
235 if (cell ==
nullptr) {
236 TString
name = (((((TString)
"TMax" + (
long)slId.
wheel()) + (
long)slId.
station()) + (
long)slId.
sector()) +
238 cell =
new cellInfo(
name);
244 LogWarning(
"Calibration") <<
"[DTVDriftCalibration] ###Warning: the chosen granularity is not implemented " 245 "yet, only bySL available!";
int station() const
Return the station number.
const edm::ESGetToken< DTGeometry, MuonGeometryRecord > theDTGeomToken
std::pair< const_iterator, const_iterator > range
iterator range
LocalPoint localPosition() const override
local position in SL frame
int superLayer() const
Return the superlayer number.
LocalVector localDirection() const override
the local direction in SL frame
TMaxGranularity theGranularity
std::unique_ptr< DTTTrigBaseSync > theSync
void Fill(float x, float y, float phi, float theta, float impact)
void Fill(float pos, float localAngle)
Log< level::Error, false > LogError
C::const_iterator const_iterator
constant access iterator type
std::map< DTWireId, cellInfo * > theWireIdAndCellMap
edm::EDGetTokenT< DTRecSegment4DCollection > theRecHits4DToken
DTSuperLayerId superLayerId() const
The id of the superlayer on which reside the segment.
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
dtcalibration::Histograms histograms_
std::unique_ptr< DTSegmentSelector > select_
std::vector< DTRecHit1D > specificRecHits() const
Access to specific components.
std::string theCalibChamber
int wheel() const
Return the wheel number.
DTSuperLayerId superlayerId() const
Return the corresponding SuperLayerId.
Log< level::Warning, false > LogWarning
const DTChamber * chamber(const DTChamberId &id) const
Return a DTChamber given its id.
Geom::Theta< T > theta() const