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;
264 return (-shape[1] + mpx * par[0]);
272 return (-shape[2] + mpy * par[1]);
278 void localSiStrip(
short strip,
float* localTop,
float* localBottom,
const float* pars,
unsigned int id )
281 Float_t halfStripLength = pars[2] * 0.5;
283 Double_t localCenter[3] = { 0.0, 0.0, 0.0 };
284 localTop[1] = halfStripLength;
285 localBottom[1] = -halfStripLength;
291 Float_t stripAngle =
tan( pars[5] + strip * pars[6] );
292 Float_t
delta = halfStripLength * stripAngle;
293 localCenter[0] = pars[4] * stripAngle;
294 localTop[0] = localCenter[0] +
delta;
295 localBottom[0] = localCenter[0] -
delta;
297 else if( topology == 2 )
301 Float_t
offset = -pars[1] * 0.5 * pars[3];
302 localCenter[0] = strip * pars[3] +
offset;
303 localTop[0] = localCenter[0];
304 localBottom[0] = localCenter[0];
306 else if( topology == 3 )
309 <<
"did not expect TrapezoidalStripTopology of " 312 else if( pars[0] == 0 )
315 <<
"did not find StripTopology of " 327 el->CSCTakeAnyParentAsMaster();
328 el->SetPickable(
true);
333 el->CSCApplyMainColorToMatchingChildren();
334 el->CSCApplyMainTransparencyToMatchingChildren();
340 parent->AddElement(el);
349 if(
const SiStripRecHit2D* hit2D = dynamic_cast<const SiStripRecHit2D*>( rechit ))
353 cluster = hit2D->cluster().get();
355 if( cluster ==
nullptr )
357 if(
const SiStripRecHit1D* hit1D = dynamic_cast<const SiStripRecHit1D*>( rechit ))
361 cluster = hit1D->cluster().get();
374 if( addNearbyClusters )
378 const auto & rhs = *(*(it));
386 allClusters = allClustersHandle.
product();
397 allClusters = allClustersHandle.
product();
406 unsigned int rawid = (*it)->geographicalId();
410 <<
"failed to get geometry of SiStripCluster with detid: " 411 << rawid << std::endl;
419 auto rechitRef = *it;
425 if( allClusters !=
nullptr )
432 TEveStraightLineSet *scposition =
new TEveStraightLineSet;
433 scposition->SetDepthTest(
false );
434 scposition->SetPickable( kTRUE );
436 short firststrip = itc->firstStrip();
438 if( &*itc == cluster )
440 scposition->SetTitle( Form(
"Exact SiStripCluster from TrackingRecHit, first strip %d", firststrip ));
441 scposition->SetLineColor( kGreen );
445 scposition->SetTitle( Form(
"SiStripCluster, first strip %d", firststrip ));
446 scposition->SetLineColor( kRed );
449 float localTop[3] = { 0.0, 0.0, 0.0 };
450 float localBottom[3] = { 0.0, 0.0, 0.0 };
455 float globalBottom[3];
456 geom->
localToGlobal( rawid, localTop, globalTop, localBottom, globalBottom );
458 scposition->AddLine( globalTop[0], globalTop[1], globalTop[2],
459 globalBottom[0], globalBottom[1], globalBottom[2] );
467 TEveStraightLineSet *scposition =
new TEveStraightLineSet;
468 scposition->SetDepthTest(
false );
469 scposition->SetPickable( kTRUE );
470 scposition->SetTitle( Form(
"SiStripCluster, first strip %d", firststrip ));
472 float localTop[3] = { 0.0, 0.0, 0.0 };
473 float localBottom[3] = { 0.0, 0.0, 0.0 };
478 float globalBottom[3];
479 geom->
localToGlobal( rawid, localTop, globalTop, localBottom, globalBottom );
481 scposition->AddLine( globalTop[0], globalTop[1], globalTop[2],
482 globalBottom[0], globalBottom[1], globalBottom[2] );
487 else if( !rechit->
isValid() && ( rawid != 0 ))
489 if( allClusters !=
nullptr )
492 if( itds != allClusters->
end())
497 short firststrip = itc->firstStrip();
499 TEveStraightLineSet *scposition =
new TEveStraightLineSet;
500 scposition->SetDepthTest(
false );
501 scposition->SetPickable( kTRUE );
502 scposition->SetTitle( Form(
"Lost SiStripCluster, first strip %d", firststrip ));
504 float localTop[3] = { 0.0, 0.0, 0.0 };
505 float localBottom[3] = { 0.0, 0.0, 0.0 };
510 float globalBottom[3];
511 geom->
localToGlobal( rawid, localTop, globalTop, localBottom, globalBottom );
513 scposition->AddLine( globalTop[0], globalTop[1], globalTop[2],
514 globalBottom[0], globalBottom[1], globalBottom[2] );
518 scposition->SetLineColor( kRed );
526 <<
"*ANOTHER* option possible: valid=" << rechit->
isValid()
527 <<
", rawid=" << rawid << std::endl;
540 const auto & rhs = *(*(it));
548 allClusters = allClustersHandle.
product();
553 if( allClusters ==
nullptr )
return;
561 DetId id = (*it)->geographicalId();
565 <<
"failed to get geometry of Tracker Det with raw id: " 566 <<
id.rawId() << std::endl;
572 unsigned int subdet = (
unsigned int)
id.subdetId();
577 hitCluster =
pixel->cluster().get();
579 if( itds != allClusters->
end())
584 if( &*itc != hitCluster )
603 double etaT = t.
eta();
613 DetId id = (*it)->geographicalId();
617 <<
"failed to get geometry of Tracker Det with raw id: " 618 <<
id.rawId() << std::endl;
624 unsigned int subdet = (
unsigned int)
id.subdetId();
654 <<
", row: " << row <<
", col: " << col
655 <<
", lx: " << lx <<
", ly: " << ly ;
657 float local[3] = { lx, ly, 0. };
660 TVector3 pb( global[0], global[1], global[2] );
661 pixelPoints.push_back( pb );
667 <<
" eta: " << pb.Eta()
668 <<
", phi: " << pb.Phi()
669 <<
" rho: " << pb.Pt() << std::endl;
676 std::ostringstream oss;
678 oss <<
"DetId: " <<
id.rawId() <<
"\n";
680 switch (
id.det() ) {
687 switch (
id.subdetId() ) {
691 oss <<
"DT chamber (wheel, station, sector): " 692 << detId.
wheel() <<
", " 700 oss <<
"CSC chamber (endcap, station, ring, chamber, layer): " 703 << detId.
ring() <<
", " 711 oss <<
"RPC chamber ";
712 switch ( detId.
region() ) {
714 oss <<
"/ barrel / (wheel, station, sector, layer, subsector, roll): " 715 << detId.
ring() <<
", " 718 << detId.
layer() <<
", " 723 oss <<
"/ forward endcap / (wheel, station, sector, layer, subsector, roll): " 724 << detId.
ring() <<
", " 727 << detId.
layer() <<
", " 732 oss <<
"/ backward endcap / (wheel, station, sector, layer, subsector, roll): " 733 << detId.
ring() <<
", " 736 << detId.
layer() <<
", " 746 oss <<
"GEM chamber (region, station, ring, chamber, layer): " 749 << detId.
ring() <<
", " 757 oss <<
"ME0 chamber (region, chamber, layer): " 769 oss <<
"CaloTower (ieta, iphi): " 770 << detId.
ieta() <<
", " 776 switch (
id.subdetId() ) {
780 oss <<
"EcalBarrel (ieta, iphi, tower_ieta, tower_iphi): " 781 << detId.
ieta() <<
", " 782 << detId.
iphi() <<
", " 790 oss <<
"EcalEndcap (ix, iy, SuperCrystal, crystal, quadrant): " 791 << detId.
ix() <<
", " 792 << detId.
iy() <<
", " 793 << detId.
isc() <<
", " 794 << detId.
ic() <<
", " 799 oss <<
"EcalPreshower";
802 oss <<
"EcalTriggerTower";
805 oss <<
"EcalLaserPnDiode";
813 switch ( detId.
subdet() ) {
818 oss <<
"HcalBarrel ";
821 oss <<
"HcalEndcap ";
827 oss <<
"HcalForward ";
830 oss <<
"HcalTriggerTower ";
836 oss <<
"(ieta, iphi, depth):" 837 << detId.
ieta() <<
", " 838 << detId.
iphi() <<
", " 848 info(
const std::set<DetId>& idSet) {
850 for(std::set<DetId>::const_iterator
id = idSet.begin(), idEnd = idSet.end();
id != idEnd; ++
id)
859 info(
const std::vector<DetId>& idSet) {
861 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
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
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
float phase2PixelLocalX(const double mpx, const float *, const float *)
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.