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};
236 auto const j =
std::lower_bound(std::begin(bigYIndeces), std::end(bigYIndeces), binoffy);
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];
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();
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) {
int sector() const
Sector id: the group of chambers at same phi (and increasing r)
int station() const
Return the station number.
constexpr int station() const
uint16_t firstStrip() const
constexpr int region() const
TEveTrack * prepareTrack(const reco::Track &track, TEveTrackPropagator *propagator, const std::vector< TEveVector > &extraRefPoints=std::vector< TEveVector >())
int iphi() const
get the crystal iphi
std::string print(DetId detid) const
T const * product() const
float phase2PixelLocalY(const double mpy, const float *, const float *)
data_type const * const_iterator
constexpr int layer() const
constexpr int chamber() const
const_iterator end(bool update=false) const
void localSiStrip(short strip, float *localTop, float *localBottom, const float *pars, unsigned int id)
int ieta() const
get the crystal ieta
int tower_ieta() const
get the HCAL/trigger ieta of this crystal
float phase2PixelLocalX(const double mpx, const float *, const float *)
constexpr HcalSubdetector subdet() const
get the subdetector
const TrackerTopology * getTrackerTopology() const
int layer() const
Layer id: each chamber has six layers of chambers: layer 1 is the inner layer and layer 6 is the oute...
FWGeometry * getGeom() const
constexpr int ieta() const
get the cell ieta
const SiStripCluster * extractClusterFromTrackingRecHit(const TrackingRecHit *rh)
static const double MICRON
Tan< T >::type tan(const T &t)
constexpr int ring() const
math::XYZPoint Point
point in the space
void pushPixelHits(std::vector< TVector3 > &pixelPoints, const FWEventItem &iItem, const reco::Track &t)
const edm::EventBase * getEvent() const
int tower_iphi() const
get the HCAL/trigger iphi of this crystal
int subsector() const
SubSector id : some sectors are divided along the phi direction in subsectors (from 1 to 4 in Barrel...
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)
int region() const
Region id: 0 for Barrel Not in use, +/-1 For +/- Endcap.
float pixelLocalY(const double mpy, const float *)
boost::transform_iterator< IterHelp, const_IdIter > const_iterator
const FWGeometry * getGeom() const
DetId geographicalId() const
int chamber() const
Chamber id: it identifies a chamber in a ring it goes from 1 to 36.
int iphi() const
get the tower iphi
constexpr uint32_t rawId() const
get the raw id
bool get(ProductID const &, Handle< T > &) const
int ieta() const
get the tower ieta
int region() const
Region id: 0 for Barrel, +/-1 For +/- Endcap.
Pixel cluster – collection of neighboring pixels above threshold.
int wheel() const
Return the wheel number.
const_iterator find(id_type i, bool update=false) const
static int position[264][3]
std::string info(const DetId &)
static const std::string subdets[7]
void pushNearbyPixelHits(std::vector< TVector3 > &pixelPoints, const FWEventItem &iItem, const reco::Track &t)
math::XYZVector Vector
spatial vector
void pushPixelCluster(std::vector< TVector3 > &pixelPoints, const FWGeometry &geom, DetId id, const SiPixelCluster &c, const float *pars)
constexpr int iphi() const
get the cell iphi
void setupAddElement(TEveElement *el, TEveElement *parent, const FWEventItem *item, bool master, bool color)
*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
constexpr int depth() const
get the tower depth