9 #include "TEveTrackPropagator.h" 10 #include "TEveStraightLineSet.h" 11 #include "TEveVSDStructs.h" 12 #include "TEveGeoNode.h" 57 static const double MICRON = 1./1000./1000.;
65 const std::vector<TEveVector>& extraRefPoints )
70 std::vector<State> refStates;
72 refStates.push_back(
State(TEveVector(track.
vx(), track.
vy(), track.
vz()),
78 refStates.push_back(
State(TEveVector(v.x(), v.y(), v.z()), TEveVector(p.x(), p.y(), p.z())));
83 refStates.push_back(
State(TEveVector(v.x(), v.y(), v.z()), TEveVector(p.x(), p.y(), p.z())));
86 for( std::vector<TEveVector>::const_iterator
point = extraRefPoints.begin(), pointEnd = extraRefPoints.end();
103 if( refStates.front().valid ) {
104 t.fV = refStates.front().position;
105 t.fP = refStates.front().momentum;
106 TEveTrack* trk =
new TEveTrack( &t, propagator );
107 for(
unsigned int i(1);
i<refStates.size()-1; ++
i) {
108 if( refStates[
i].valid )
109 trk->AddPathMark( TEvePathMark( TEvePathMark::kReference, refStates[
i].
position, refStates[
i].momentum ) );
111 trk->AddPathMark( TEvePathMark( TEvePathMark::kDaughter, refStates[
i].position ) );
113 if( refStates.size()>1 ) {
114 trk->AddPathMark( TEvePathMark( TEvePathMark::kDecay, refStates.back().position ) );
119 if( refStates.back().valid ) {
120 t.fSign = (-1)*track.
charge();
121 t.fV = refStates.back().position;
122 t.fP = refStates.back().momentum * (-1.0f);
123 TEveTrack* trk =
new TEveTrack( &t, propagator );
124 unsigned int i( refStates.size()-1 );
126 if ( refStates[
i].valid )
127 trk->AddPathMark( TEvePathMark( TEvePathMark::kReference, refStates[
i].
position, refStates[
i].momentum*(-1.0
f) ) );
129 trk->AddPathMark( TEvePathMark( TEvePathMark::kDaughter, refStates[
i].position ) );
131 if ( refStates.size()>1 ) {
132 trk->AddPathMark( TEvePathMark( TEvePathMark::kDecay, refStates.front().position ) );
138 while( i<refStates.size() && !refStates[
i].valid ) ++i;
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 ) );
168 static const int ROWS_PER_ROC = 80;
169 static const int BIG_PIX_PER_ROC_X = 1;
170 static const double PITCHX = 100*
MICRON;
175 xoffset = -( par[0] + BIG_PIX_PER_ROC_X * par[0] / ROWS_PER_ROC ) / 2. * PITCHX;
182 bool bigPixelsLayout = par[4];
184 int binoffx =
int(mpx);
185 double fractionX = mpx - binoffx;
186 double local_xpitch = xpitch;
188 if (bigPixelsLayout == 0) {
193 binoffx = binoffx + 2;
194 }
else if( binoffx == 80 ) {
196 local_xpitch = 2 * xpitch;
197 }
else if( binoffx == 79 ) {
198 binoffx = binoffx + 0;
199 local_xpitch = 2 * xpitch;
200 }
else if( binoffx >= 0 ) {
201 binoffx = binoffx + 0;
206 double lpX = double( binoffx * xpitch ) + fractionX * local_xpitch + xoffset;
222 static const double PITCHY = 150*
MICRON;
223 static const int BIG_PIX_PER_ROC_Y = 2;
224 static const int COLS_PER_ROC = 52;
229 yoffset = -( par[1] + BIG_PIX_PER_ROC_Y * par[1] / COLS_PER_ROC ) / 2. * PITCHY;
240 int binoffy =
int( mpy );
241 double fractionY = mpy - binoffy;
242 double local_pitchy = ypitch;
245 bool bigPixelsLayout = par[4];
246 if (bigPixelsLayout == 0) {
247 constexpr int bigYIndeces[]{0,51,52,103,104,155,156,207,208,259,260,311,312,363,364,415,416,511};
248 auto const j = std::lower_bound(
std::begin(bigYIndeces),
std::end(bigYIndeces),binoffy);
249 if (*j==binoffy) local_pitchy *= 2 ;
250 binoffy += (j-bigYIndeces);
254 double lpY = double( binoffy * ypitch ) + fractionY * local_pitchy + yoffset;
262 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;
281 else if( topology == 2 )
285 Float_t
offset = -pars[1] * 0.5 * pars[3];
286 localCenter[0] = strip * pars[3] +
offset;
287 localTop[0] = localCenter[0];
288 localBottom[0] = localCenter[0];
290 else if( topology == 3 )
293 <<
"did not expect TrapezoidalStripTopology of " 296 else if( pars[0] == 0 )
299 <<
"did not find StripTopology of " 311 el->CSCTakeAnyParentAsMaster();
312 el->SetPickable(
true);
317 el->CSCApplyMainColorToMatchingChildren();
318 el->CSCApplyMainTransparencyToMatchingChildren();
324 parent->AddElement(el);
333 if(
const SiStripRecHit2D* hit2D = dynamic_cast<const SiStripRecHit2D*>( rechit ))
337 cluster = hit2D->cluster().get();
339 if( cluster ==
nullptr )
341 if(
const SiStripRecHit1D* hit1D = dynamic_cast<const SiStripRecHit1D*>( rechit ))
345 cluster = hit1D->cluster().get();
358 if( addNearbyClusters )
362 const auto & rhs = *(*(it));
370 allClusters = allClustersHandle.
product();
381 allClusters = allClustersHandle.
product();
390 unsigned int rawid = (*it)->geographicalId();
394 <<
"failed to get geometry of SiStripCluster with detid: " 395 << rawid << std::endl;
403 auto rechitRef = *it;
409 if( allClusters !=
nullptr )
416 TEveStraightLineSet *scposition =
new TEveStraightLineSet;
417 scposition->SetDepthTest(
false );
418 scposition->SetPickable( kTRUE );
420 short firststrip = itc->firstStrip();
422 if( &*itc == cluster )
424 scposition->SetTitle( Form(
"Exact SiStripCluster from TrackingRecHit, first strip %d", firststrip ));
425 scposition->SetLineColor( kGreen );
429 scposition->SetTitle( Form(
"SiStripCluster, first strip %d", firststrip ));
430 scposition->SetLineColor( kRed );
433 float localTop[3] = { 0.0, 0.0, 0.0 };
434 float localBottom[3] = { 0.0, 0.0, 0.0 };
439 float globalBottom[3];
440 geom->
localToGlobal( rawid, localTop, globalTop, localBottom, globalBottom );
442 scposition->AddLine( globalTop[0], globalTop[1], globalTop[2],
443 globalBottom[0], globalBottom[1], globalBottom[2] );
451 TEveStraightLineSet *scposition =
new TEveStraightLineSet;
452 scposition->SetDepthTest(
false );
453 scposition->SetPickable( kTRUE );
454 scposition->SetTitle( Form(
"SiStripCluster, first strip %d", firststrip ));
456 float localTop[3] = { 0.0, 0.0, 0.0 };
457 float localBottom[3] = { 0.0, 0.0, 0.0 };
462 float globalBottom[3];
463 geom->
localToGlobal( rawid, localTop, globalTop, localBottom, globalBottom );
465 scposition->AddLine( globalTop[0], globalTop[1], globalTop[2],
466 globalBottom[0], globalBottom[1], globalBottom[2] );
471 else if( !rechit->
isValid() && ( rawid != 0 ))
473 if( allClusters !=
nullptr )
476 if( itds != allClusters->
end())
481 short firststrip = itc->firstStrip();
483 TEveStraightLineSet *scposition =
new TEveStraightLineSet;
484 scposition->SetDepthTest(
false );
485 scposition->SetPickable( kTRUE );
486 scposition->SetTitle( Form(
"Lost SiStripCluster, first strip %d", firststrip ));
488 float localTop[3] = { 0.0, 0.0, 0.0 };
489 float localBottom[3] = { 0.0, 0.0, 0.0 };
494 float globalBottom[3];
495 geom->
localToGlobal( rawid, localTop, globalTop, localBottom, globalBottom );
497 scposition->AddLine( globalTop[0], globalTop[1], globalTop[2],
498 globalBottom[0], globalBottom[1], globalBottom[2] );
502 scposition->SetLineColor( kRed );
510 <<
"*ANOTHER* option possible: valid=" << rechit->
isValid()
511 <<
", rawid=" << rawid << std::endl;
524 const auto & rhs = *(*(it));
532 allClusters = allClustersHandle.
product();
537 if( allClusters ==
nullptr )
return;
545 DetId id = (*it)->geographicalId();
549 <<
"failed to get geometry of Tracker Det with raw id: " 550 <<
id.rawId() << std::endl;
556 unsigned int subdet = (
unsigned int)
id.subdetId();
561 hitCluster =
pixel->cluster().get();
563 if( itds != allClusters->
end())
568 if( &*itc != hitCluster )
587 double etaT = t.
eta();
597 DetId id = (*it)->geographicalId();
601 <<
"failed to get geometry of Tracker Det with raw id: " 602 <<
id.rawId() << std::endl;
608 unsigned int subdet = (
unsigned int)
id.subdetId();
638 <<
", row: " << row <<
", col: " << col
639 <<
", lx: " << lx <<
", ly: " << ly ;
641 float local[3] = { lx, ly, 0. };
644 TVector3 pb( global[0], global[1], global[2] );
645 pixelPoints.push_back( pb );
651 <<
" eta: " << pb.Eta()
652 <<
", phi: " << pb.Phi()
653 <<
" rho: " << pb.Pt() << std::endl;
660 std::ostringstream oss;
662 oss <<
"DetId: " <<
id.rawId() <<
"\n";
664 switch (
id.det() ) {
671 switch (
id.subdetId() ) {
675 oss <<
"DT chamber (wheel, station, sector): " 676 << detId.
wheel() <<
", " 684 oss <<
"CSC chamber (endcap, station, ring, chamber, layer): " 687 << detId.
ring() <<
", " 695 oss <<
"RPC chamber ";
696 switch ( detId.
region() ) {
698 oss <<
"/ barrel / (wheel, station, sector, layer, subsector, roll): " 699 << detId.
ring() <<
", " 702 << detId.
layer() <<
", " 707 oss <<
"/ forward endcap / (wheel, station, sector, layer, subsector, roll): " 708 << detId.
ring() <<
", " 711 << detId.
layer() <<
", " 716 oss <<
"/ backward endcap / (wheel, station, sector, layer, subsector, roll): " 717 << detId.
ring() <<
", " 720 << detId.
layer() <<
", " 730 oss <<
"GEM chamber (region, station, ring, chamber, layer): " 733 << detId.
ring() <<
", " 741 oss <<
"ME0 chamber (region, chamber, layer): " 753 oss <<
"CaloTower (ieta, iphi): " 754 << detId.
ieta() <<
", " 760 switch (
id.subdetId() ) {
764 oss <<
"EcalBarrel (ieta, iphi, tower_ieta, tower_iphi): " 765 << detId.
ieta() <<
", " 766 << detId.
iphi() <<
", " 774 oss <<
"EcalEndcap (ix, iy, SuperCrystal, crystal, quadrant): " 775 << detId.
ix() <<
", " 776 << detId.
iy() <<
", " 777 << detId.
isc() <<
", " 778 << detId.
ic() <<
", " 783 oss <<
"EcalPreshower";
786 oss <<
"EcalTriggerTower";
789 oss <<
"EcalLaserPnDiode";
797 switch ( detId.
subdet() ) {
802 oss <<
"HcalBarrel ";
805 oss <<
"HcalEndcap ";
811 oss <<
"HcalForward ";
814 oss <<
"HcalTriggerTower ";
820 oss <<
"(ieta, iphi, depth):" 821 << detId.
ieta() <<
", " 822 << detId.
iphi() <<
", " 832 info(
const std::set<DetId>& idSet) {
834 for(std::set<DetId>::const_iterator
id = idSet.begin(), idEnd = idSet.end();
id != idEnd; ++
id)
843 info(
const std::vector<DetId>& idSet) {
845 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
boost::transform_iterator< IterHelp, const_IdIter > const_iterator
const_iterator end(bool update=false) const
bool isNonnull() const
Checks for non-null.
HcalSubdetector subdet() const
get the subdetector
const TrackExtraRef & extra() const
reference to "extra" object
CaloTopology const * topology(0)
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
const FWGeometry * getGeom() const
int tower_iphi() const
get the HCAL/trigger iphi of this crystal
constexpr uint32_t rawId() const
get the raw id
bool innerOk() const
return true if the innermost hit is valid
uint16_t firstStrip() const
data_type const * const_iterator
int chamber() const
Chamber id: it identifies a chamber in a ring it goes from 1 to 36.
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
int depth() const
get the tower depth
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
double pt() const
track transverse momentum
const SiStripCluster * extractClusterFromTrackingRecHit(const TrackingRecHit *rh)
static const double MICRON
int layer() const
Layer id: each station have two layers of chambers: layer 1 is the inner chamber and layer 2 is the o...
int ieta() const
get the cell ieta
void localToGlobal(unsigned int id, const float *local, float *global, bool translatep=true) const
int iphi() const
get the tower iphi
int station() const
Station id : the station is the pair of chambers at same disk.
Tan< T >::type tan(const T &t)
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.
int region() const
Region id: 0 for Barrel Not in use, +/-1 For +/- Endcap.
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...
int iphi() const
get the cell iphi
float pixelLocalY(const double mpy, const float *)
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
ClusterRef cluster() const
int region() const
Region id: 0 for Barrel Not in use, +/-1 For +/- Endcap.
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
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
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
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.