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;
75 refStates.push_back(
State(TEveVector(v.x(), v.y(), v.z()), TEveVector(p.x(), p.y(), p.z())));
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;
104 TEveTrack* trk =
new TEveTrack(&t, propagator);
105 for (
unsigned int i(1);
i < refStates.size() - 1; ++
i) {
106 if (refStates[
i].valid)
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);
121 TEveTrack* trk =
new TEveTrack(&t, propagator);
122 unsigned int i(refStates.size() - 1);
124 if (refStates[
i].valid)
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)
139 assert(i < refStates.size());
141 t.fV = refStates[
i].position;
142 t.fP = refStates[
i].momentum;
143 TEveTrack* trk =
new TEveTrack(&t, propagator);
144 for (
unsigned int j(i + 1);
j < refStates.size() - 1; ++
j) {
145 if (refStates[i].valid)
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) {
264 Float_t topology = pars[0];
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;
280 }
else if (topology == 2)
284 Float_t
offset = -pars[1] * 0.5 * pars[3];
285 localCenter[0] = strip * pars[3] +
offset;
286 localTop[0] = localCenter[0];
287 localBottom[0] = localCenter[0];
288 }
else if (topology == 3)
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();
313 parent->AddElement(el);
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));
350 allClusters = allClustersHandle.
product();
358 allClusters = allClustersHandle.
product();
366 unsigned int rawid = (*it)->geographicalId();
368 fwLog(
fwlog::kError) <<
"failed to get geometry of SiStripCluster with detid: " << rawid << std::endl;
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));
489 allClusters = allClustersHandle.
product();
494 if (allClusters ==
nullptr)
502 DetId id = (*it)->geographicalId();
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();
543 fwLog(
fwlog::kDebug) <<
"Track eta: " << etaT <<
", vz: " << vz <<
", dz: " << dz << std::endl;
549 DetId id = (*it)->geographicalId();
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();
585 fwLog(
fwlog::kDebug) <<
", row: " << row <<
", col: " << col <<
", lx: " << lx <<
", ly: " << ly;
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) {
ClusterRef cluster() const
Master< F > master(const F &f)
const FWDisplayProperties & defaultDisplayProperties() const
const_iterator end(bool update=false) const
const edm::EventSetup & c
bool isNonnull() const
Checks for non-null.
uint16_t *__restrict__ id
const TrackExtraRef & extra() const
reference to "extra" object
TEveTrack * prepareTrack(const reco::Track &track, TEveTrackPropagator *propagator, const std::vector< TEveVector > &extraRefPoints=std::vector< TEveVector >())
int tower_ieta() const
get the HCAL/trigger ieta of this crystal
const float * getParameters(unsigned int id) const
bool get(ProductID const &, Handle< T > &) const
int tower_iphi() const
get the HCAL/trigger iphi of this crystal
constexpr uint32_t rawId() const
get the raw id
float phase2PixelLocalY(const double mpy, const float *, const float *)
bool innerOk() const
return true if the innermost hit is valid
uint16_t firstStrip() const
data_type const * const_iterator
double px() const
x coordinate of momentum vector
const math::XYZPoint & outerPosition() const
position of the outermost hit
std::string print(DetId detid) const
ProductID id() const
Accessor for product ID.
void localSiStrip(short strip, float *localTop, float *localBottom, const float *pars, unsigned int id)
int iphi() const
get the crystal iphi
const math::XYZPoint & innerPosition() const
position of the innermost hit
float phase2PixelLocalX(const double mpx, const float *, const float *)
constexpr HcalSubdetector subdet() const
get the subdetector
Char_t transparency() const
int chamber() const
Chamber id: it identifies a chamber in a ring it goes from 1 to 36.
double eta() const
pseudorapidity of momentum vector
constexpr int iphi() const
get the cell iphi
double pt() const
track transverse momentum
constexpr int region() const
const SiStripCluster * extractClusterFromTrackingRecHit(const TrackingRecHit *rh)
static const double MICRON
void localToGlobal(unsigned int id, const float *local, float *global, bool translatep=true) const
int iphi() const
get the tower iphi
Tan< T >::type tan(const T &t)
constexpr int ieta() const
get the cell ieta
ClusterRef cluster() const
bool contains(unsigned int id) const
int ieta() const
get the crystal ieta
math::XYZPoint Point
point in the space
void pushPixelHits(std::vector< TVector3 > &pixelPoints, const FWEventItem &iItem, const reco::Track &t)
trackingRecHit_iterator recHitsBegin() const
Iterator to first hit on the track.
float pixelLocalX(const double mpx, const float *)
static Context * getInstance()
void addSiStripClusters(const FWEventItem *iItem, const reco::Track &t, class TEveElement *tList, bool addNearbyClusters, bool master)
double pz() const
z coordinate of momentum vector
double dz() const
dz parameter (= dsz/cos(lambda)). This is the track z0 w.r.t (0,0,0) only if the refPoint is close to...
float pixelLocalY(const double mpy, const float *)
boost::transform_iterator< IterHelp, const_IdIter > const_iterator
double vz() const
z coordinate of the reference point on track
const edm::EventBase * getEvent() const
const math::XYZVector & outerMomentum() const
momentum vector at the outermost hit position
T const * product() const
bool outerOk() const
return true if the outermost hit is valid
constexpr int chamber() const
constexpr int ring() const
constexpr int layer() const
ClusterRef cluster() const
int region() const
Region id: 0 for Barrel Not in use, +/-1 For +/- Endcap.
constexpr int station() const
int sector() const
Sector id: the group of chambers at same phi (and increasing r)
const_iterator find(id_type i, bool update=false) const
int subsector() const
SubSector id : some sectors are divided along the phi direction in subsectors (from 1 to 4 in Barrel...
Pixel cluster – collection of neighboring pixels above threshold.
double vy() const
y coordinate of the reference point on track
__host__ __device__ constexpr RandomIt lower_bound(RandomIt first, RandomIt last, const T &value, Compare comp={})
const math::XYZVector & innerMomentum() const
momentum vector at the innermost hit position
static int position[264][3]
std::string info(const DetId &)
int charge() const
track electric charge
int layer() const
Layer id: each chamber has six layers of chambers: layer 1 is the inner layer and layer 6 is the oute...
const TrackerTopology * getTrackerTopology() const
DetId geographicalId() const
constexpr int depth() const
get the tower depth
int ieta() const
get the tower ieta
int station() const
Return the station number.
int wheel() const
Return the wheel number.
static const std::string subdets[7]
void pushNearbyPixelHits(std::vector< TVector3 > &pixelPoints, const FWEventItem &iItem, const reco::Track &t)
math::XYZVector Vector
spatial vector
FWGeometry * getGeom() const
void pushPixelCluster(std::vector< TVector3 > &pixelPoints, const FWGeometry &geom, DetId id, const SiPixelCluster &c, const float *pars)
void setupAddElement(TEveElement *el, TEveElement *parent, const FWEventItem *item, bool master, bool color)
const FWGeometry * getGeom() const
*vegas h *****************************************************used in the default bin number in original ***version of VEGAS is ***a higher bin number might help to derive a more precise ***grade subtle point
double py() const
y coordinate of momentum vector
double vx() const
x coordinate of the reference point on track
trackingRecHit_iterator recHitsEnd() const
Iterator to last hit on the track.
int region() const
Region id: 0 for Barrel, +/-1 For +/- Endcap.