9 #include "TEveTrackPropagator.h"
10 #include "TEveStraightLineSet.h"
11 #include "TEveVSDStructs.h"
12 #include "TEveGeoNode.h"
57 static const double MICRON = 1. / 1000. / 1000.;
64 const std::vector<TEveVector>& extraRefPoints) {
68 std::vector<State> refStates;
71 if (
track.extra().isAvailable()) {
72 if (
track.innerOk()) {
75 refStates.push_back(
State(TEveVector(
v.x(),
v.y(),
v.z()), TEveVector(
p.x(),
p.y(),
p.z())));
77 if (
track.outerOk()) {
80 refStates.push_back(
State(TEveVector(
v.x(),
v.y(),
v.z()), TEveVector(
p.x(),
p.y(),
p.z())));
83 for (std::vector<TEveVector>::const_iterator
point = extraRefPoints.begin(), pointEnd = extraRefPoints.end();
101 if (refStates.front().valid) {
102 t.fV = refStates.front().position;
103 t.fP = refStates.front().momentum;
105 for (
unsigned int i(1);
i < refStates.size() - 1; ++
i) {
107 trk->AddPathMark(TEvePathMark(TEvePathMark::kReference, refStates[
i].
position, refStates[
i].momentum));
109 trk->AddPathMark(TEvePathMark(TEvePathMark::kDaughter, refStates[
i].
position));
111 if (refStates.size() > 1) {
112 trk->AddPathMark(TEvePathMark(TEvePathMark::kDecay, refStates.back().position));
117 if (refStates.back().valid) {
118 t.fSign = (-1) *
track.charge();
119 t.fV = refStates.back().position;
120 t.fP = refStates.back().momentum * (-1.0f);
122 unsigned int i(refStates.size() - 1);
126 TEvePathMark(TEvePathMark::kReference, refStates[
i].
position, refStates[
i].momentum * (-1.0
f)));
128 trk->AddPathMark(TEvePathMark(TEvePathMark::kDaughter, refStates[
i].
position));
130 if (refStates.size() > 1) {
131 trk->AddPathMark(TEvePathMark(TEvePathMark::kDecay, refStates.front().position));
137 while (
i < refStates.size() && !refStates[
i].valid)
141 t.fV = refStates[
i].position;
142 t.fP = refStates[
i].momentum;
144 for (
unsigned int j(
i + 1);
j < refStates.size() - 1; ++
j) {
146 trk->AddPathMark(TEvePathMark(TEvePathMark::kReference, refStates[
i].
position, refStates[
i].momentum));
148 trk->AddPathMark(TEvePathMark(TEvePathMark::kDaughter, refStates[
i].
position));
150 if (
i < refStates.size()) {
151 trk->AddPathMark(TEvePathMark(TEvePathMark::kDecay, refStates.back().position));
164 static const int ROWS_PER_ROC = 80;
165 static const int BIG_PIX_PER_ROC_X = 1;
166 static const double PITCHX = 100 *
MICRON;
171 xoffset = -(par[0] + BIG_PIX_PER_ROC_X * par[0] / ROWS_PER_ROC) / 2. * PITCHX;
177 bool bigPixelsLayout = par[4];
179 int binoffx =
int(mpx);
180 double fractionX = mpx - binoffx;
181 double local_xpitch = xpitch;
183 if (bigPixelsLayout == 0) {
188 binoffx = binoffx + 2;
189 }
else if (binoffx == 80) {
190 binoffx = binoffx + 1;
191 local_xpitch = 2 * xpitch;
192 }
else if (binoffx == 79) {
193 binoffx = binoffx + 0;
194 local_xpitch = 2 * xpitch;
195 }
else if (binoffx >= 0) {
196 binoffx = binoffx + 0;
201 double lpX = double(binoffx * xpitch) + fractionX * local_xpitch +
xoffset;
213 static const double PITCHY = 150 *
MICRON;
214 static const int BIG_PIX_PER_ROC_Y = 2;
215 static const int COLS_PER_ROC = 52;
220 yoffset = -(par[1] + BIG_PIX_PER_ROC_Y * par[1] / COLS_PER_ROC) / 2. * PITCHY;
229 int binoffy =
int(mpy);
230 double fractionY = mpy - binoffy;
231 double local_pitchy = ypitch;
233 bool bigPixelsLayout = par[4];
234 if (bigPixelsLayout == 0) {
235 constexpr
int bigYIndeces[]{0, 51, 52, 103, 104, 155, 156, 207, 208, 259, 260, 311, 312, 363, 364, 415, 416, 511};
239 binoffy += (
j - bigYIndeces);
243 double lpY = double(binoffy * ypitch) + fractionY * local_pitchy +
yoffset;
251 return (-shape[1] + mpx * par[0]);
257 return (-shape[2] + mpy * par[1]);
263 void localSiStrip(
short strip,
float* localTop,
float* localBottom,
const float* pars,
unsigned int id) {
265 Float_t halfStripLength = pars[2] * 0.5;
267 Double_t localCenter[3] = {0.0, 0.0, 0.0};
268 localTop[1] = halfStripLength;
269 localBottom[1] = -halfStripLength;
275 Float_t stripAngle =
tan(pars[5] +
strip * pars[6]);
276 Float_t
delta = halfStripLength * stripAngle;
277 localCenter[0] = pars[4] * stripAngle;
278 localTop[0] = localCenter[0] +
delta;
279 localBottom[0] = localCenter[0] -
delta;
284 Float_t
offset = -pars[1] * 0.5 * pars[3];
286 localTop[0] = localCenter[0];
287 localBottom[0] = localCenter[0];
290 fwLog(
fwlog::kError) <<
"did not expect TrapezoidalStripTopology of " <<
id << std::endl;
291 }
else if (pars[0] == 0)
301 el->CSCTakeAnyParentAsMaster();
302 el->SetPickable(
true);
306 el->CSCApplyMainColorToMatchingChildren();
307 el->CSCApplyMainTransparencyToMatchingChildren();
308 el->SetMainColor(
item->defaultDisplayProperties().color());
309 assert((
item->defaultDisplayProperties().transparency() >= 0) &&
310 (
item->defaultDisplayProperties().transparency() <= 100));
311 el->SetMainTransparency(
item->defaultDisplayProperties().transparency());
321 if (
const SiStripRecHit2D* hit2D = dynamic_cast<const SiStripRecHit2D*>(rechit)) {
324 cluster = hit2D->cluster().get();
326 if (cluster ==
nullptr) {
327 if (
const SiStripRecHit1D* hit1D = dynamic_cast<const SiStripRecHit1D*>(rechit)) {
330 cluster = hit1D->cluster().get();
342 if (addNearbyClusters) {
344 const auto& rhs = *(*(it));
347 if (
hit.cluster().isNonnull() &&
hit.cluster().isAvailable()) {
350 allClusters = allClustersHandle.
product();
355 if (
hit.cluster().isNonnull() &&
hit.cluster().isAvailable()) {
358 allClusters = allClustersHandle.
product();
366 unsigned int rawid = (*it)->geographicalId();
367 if (!
geom->contains(rawid)) {
368 fwLog(
fwlog::kError) <<
"failed to get geometry of SiStripCluster with detid: " << rawid << std::endl;
373 const float* pars =
geom->getParameters(rawid);
376 auto rechitRef = *it;
381 if (allClusters !=
nullptr) {
385 edc = clustersOnThisDet.
end();
388 TEveStraightLineSet* scposition =
new TEveStraightLineSet;
389 scposition->SetDepthTest(
false);
390 scposition->SetPickable(kTRUE);
392 short firststrip = itc->firstStrip();
394 if (&*itc == cluster) {
395 scposition->SetTitle(Form(
"Exact SiStripCluster from TrackingRecHit, first strip %d", firststrip));
396 scposition->SetLineColor(kGreen);
398 scposition->SetTitle(Form(
"SiStripCluster, first strip %d", firststrip));
399 scposition->SetLineColor(kRed);
402 float localTop[3] = {0.0, 0.0, 0.0};
403 float localBottom[3] = {0.0, 0.0, 0.0};
408 float globalBottom[3];
409 geom->localToGlobal(rawid, localTop, globalTop, localBottom, globalBottom);
412 globalTop[0], globalTop[1], globalTop[2], globalBottom[0], globalBottom[1], globalBottom[2]);
418 TEveStraightLineSet* scposition =
new TEveStraightLineSet;
419 scposition->SetDepthTest(
false);
420 scposition->SetPickable(kTRUE);
421 scposition->SetTitle(Form(
"SiStripCluster, first strip %d", firststrip));
423 float localTop[3] = {0.0, 0.0, 0.0};
424 float localBottom[3] = {0.0, 0.0, 0.0};
429 float globalBottom[3];
430 geom->localToGlobal(rawid, localTop, globalTop, localBottom, globalBottom);
433 globalTop[0], globalTop[1], globalTop[2], globalBottom[0], globalBottom[1], globalBottom[2]);
437 }
else if (!rechit->
isValid() && (rawid != 0))
439 if (allClusters !=
nullptr) {
441 if (itds != allClusters->
end()) {
444 edc = clustersOnThisDet.
end();
447 short firststrip = itc->firstStrip();
449 TEveStraightLineSet* scposition =
new TEveStraightLineSet;
450 scposition->SetDepthTest(
false);
451 scposition->SetPickable(kTRUE);
452 scposition->SetTitle(Form(
"Lost SiStripCluster, first strip %d", firststrip));
454 float localTop[3] = {0.0, 0.0, 0.0};
455 float localBottom[3] = {0.0, 0.0, 0.0};
460 float globalBottom[3];
461 geom->localToGlobal(rawid, localTop, globalTop, localBottom, globalBottom);
464 globalTop[0], globalTop[1], globalTop[2], globalBottom[0], globalBottom[1], globalBottom[2]);
467 scposition->SetLineColor(kRed);
483 const auto& rhs = *(*(it));
486 if (
hit.cluster().isNonnull() &&
hit.cluster().isAvailable()) {
489 allClusters = allClustersHandle.
product();
494 if (allClusters ==
nullptr)
502 DetId id = (*it)->geographicalId();
503 if (!
geom->contains(
id)) {
504 fwLog(
fwlog::kError) <<
"failed to get geometry of Tracker Det with raw id: " <<
id.rawId() << std::endl;
510 unsigned int subdet = (
unsigned int)
id.subdetId();
516 hitCluster =
pixel->cluster().get();
518 if (itds != allClusters->
end()) {
521 edc = clustersOnThisDet.
end();
524 if (&*itc != hitCluster)
541 double etaT =
t.eta();
549 DetId id = (*it)->geographicalId();
550 if (!
geom->contains(
id)) {
551 fwLog(
fwlog::kError) <<
"failed to get geometry of Tracker Det with raw id: " <<
id.rawId() << std::endl;
557 unsigned int subdet = (
unsigned int)
id.subdetId();
575 double row =
c.minPixelRow();
576 double col =
c.minPixelCol();
587 float local[3] = {lx, ly, 0.};
590 TVector3 pb(global[0], global[1], global[2]);
591 pixelPoints.push_back(pb);
593 fwLog(
fwlog::kDebug) <<
" x: " << pb.X() <<
", y: " << pb.Y() <<
" z: " << pb.Z() <<
" eta: " << pb.Eta()
594 <<
", phi: " << pb.Phi() <<
" rho: " << pb.Pt() << std::endl;
600 std::ostringstream oss;
602 oss <<
"DetId: " <<
id.rawId() <<
"\n";
610 switch (
id.subdetId()) {
613 oss <<
"DT chamber (wheel, station, sector): " << detId.
wheel() <<
", " << detId.
station() <<
", "
618 oss <<
"CSC chamber (endcap, station, ring, chamber, layer): " << detId.
endcap() <<
", " << detId.
station()
619 <<
", " << detId.
ring() <<
", " << detId.
chamber() <<
", " << detId.
layer();
623 oss <<
"RPC chamber ";
626 oss <<
"/ barrel / (wheel, station, sector, layer, subsector, roll): " << detId.
ring() <<
", "
628 <<
", " << detId.
roll();
631 oss <<
"/ forward endcap / (wheel, station, sector, layer, subsector, roll): " << detId.
ring() <<
", "
633 <<
", " << detId.
roll();
636 oss <<
"/ backward endcap / (wheel, station, sector, layer, subsector, roll): " << detId.
ring() <<
", "
638 <<
", " << detId.
roll();
644 oss <<
"GEM chamber (region, station, ring, chamber, layer): " << detId.
region() <<
", " << detId.
station()
645 <<
", " << detId.
ring() <<
", " << detId.
chamber() <<
", " << detId.
layer();
649 oss <<
"ME0 chamber (region, chamber, layer): " << detId.
region() <<
", " << detId.
chamber() <<
", "
657 oss <<
"CaloTower (ieta, iphi): " << detId.
ieta() <<
", " << detId.
iphi();
661 switch (
id.subdetId()) {
664 oss <<
"EcalBarrel (ieta, iphi, tower_ieta, tower_iphi): " << detId.
ieta() <<
", " << detId.
iphi() <<
", "
669 oss <<
"EcalEndcap (ix, iy, SuperCrystal, crystal, quadrant): " << detId.
ix() <<
", " << detId.
iy() <<
", "
670 << detId.
isc() <<
", " << detId.
ic() <<
", " << detId.
iquadrant();
673 oss <<
"EcalPreshower";
676 oss <<
"EcalTriggerTower";
679 oss <<
"EcalLaserPnDiode";
691 oss <<
"HcalBarrel ";
694 oss <<
"HcalEndcap ";
700 oss <<
"HcalForward ";
703 oss <<
"HcalTriggerTower ";
709 oss <<
"(ieta, iphi, depth):" << detId.
ieta() <<
", " << detId.
iphi() <<
", " << detId.
depth();
718 for (std::set<DetId>::const_iterator
id = idSet.begin(), idEnd = idSet.end();
id != idEnd; ++
id) {
727 for (std::vector<DetId>::const_iterator
id = idSet.begin(), idEnd = idSet.end();
id != idEnd; ++
id) {