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 )
369 allClusters = allClustersHandle.
product();
380 allClusters = allClustersHandle.
product();
389 unsigned int rawid = (*it)->geographicalId();
393 <<
"failed to get geometry of SiStripCluster with detid: " 394 << rawid << std::endl;
402 auto rechitRef = *it;
408 if( allClusters !=
nullptr )
415 TEveStraightLineSet *scposition =
new TEveStraightLineSet;
416 scposition->SetDepthTest(
false );
417 scposition->SetPickable( kTRUE );
419 short firststrip = itc->firstStrip();
421 if( &*itc == cluster )
423 scposition->SetTitle( Form(
"Exact SiStripCluster from TrackingRecHit, first strip %d", firststrip ));
424 scposition->SetLineColor( kGreen );
428 scposition->SetTitle( Form(
"SiStripCluster, first strip %d", firststrip ));
429 scposition->SetLineColor( kRed );
432 float localTop[3] = { 0.0, 0.0, 0.0 };
433 float localBottom[3] = { 0.0, 0.0, 0.0 };
438 float globalBottom[3];
439 geom->
localToGlobal( rawid, localTop, globalTop, localBottom, globalBottom );
441 scposition->AddLine( globalTop[0], globalTop[1], globalTop[2],
442 globalBottom[0], globalBottom[1], globalBottom[2] );
450 TEveStraightLineSet *scposition =
new TEveStraightLineSet;
451 scposition->SetDepthTest(
false );
452 scposition->SetPickable( kTRUE );
453 scposition->SetTitle( Form(
"SiStripCluster, first strip %d", firststrip ));
455 float localTop[3] = { 0.0, 0.0, 0.0 };
456 float localBottom[3] = { 0.0, 0.0, 0.0 };
461 float globalBottom[3];
462 geom->
localToGlobal( rawid, localTop, globalTop, localBottom, globalBottom );
464 scposition->AddLine( globalTop[0], globalTop[1], globalTop[2],
465 globalBottom[0], globalBottom[1], globalBottom[2] );
470 else if( !rechit->
isValid() && ( rawid != 0 ))
472 if( allClusters !=
nullptr )
475 if( itds != allClusters->
end())
480 short firststrip = itc->firstStrip();
482 TEveStraightLineSet *scposition =
new TEveStraightLineSet;
483 scposition->SetDepthTest(
false );
484 scposition->SetPickable( kTRUE );
485 scposition->SetTitle( Form(
"Lost SiStripCluster, first strip %d", firststrip ));
487 float localTop[3] = { 0.0, 0.0, 0.0 };
488 float localBottom[3] = { 0.0, 0.0, 0.0 };
493 float globalBottom[3];
494 geom->
localToGlobal( rawid, localTop, globalTop, localBottom, globalBottom );
496 scposition->AddLine( globalTop[0], globalTop[1], globalTop[2],
497 globalBottom[0], globalBottom[1], globalBottom[2] );
501 scposition->SetLineColor( kRed );
509 <<
"*ANOTHER* option possible: valid=" << rechit->
isValid()
510 <<
", rawid=" << rawid << std::endl;
530 allClusters = allClustersHandle.
product();
535 if( allClusters ==
nullptr )
return;
543 DetId id = (*it)->geographicalId();
547 <<
"failed to get geometry of Tracker Det with raw id: " 548 <<
id.rawId() << std::endl;
554 unsigned int subdet = (
unsigned int)
id.subdetId();
559 hitCluster =
pixel->cluster().get();
561 if( itds != allClusters->
end())
566 if( &*itc != hitCluster )
585 double etaT = t.
eta();
595 DetId id = (*it)->geographicalId();
599 <<
"failed to get geometry of Tracker Det with raw id: " 600 <<
id.rawId() << std::endl;
606 unsigned int subdet = (
unsigned int)
id.subdetId();
636 <<
", row: " << row <<
", col: " << col
637 <<
", lx: " << lx <<
", ly: " << ly ;
639 float local[3] = { lx, ly, 0. };
642 TVector3 pb( global[0], global[1], global[2] );
643 pixelPoints.push_back( pb );
649 <<
" eta: " << pb.Eta()
650 <<
", phi: " << pb.Phi()
651 <<
" rho: " << pb.Pt() << std::endl;
658 std::ostringstream oss;
660 oss <<
"DetId: " <<
id.rawId() <<
"\n";
662 switch (
id.det() ) {
669 switch (
id.subdetId() ) {
673 oss <<
"DT chamber (wheel, station, sector): " 674 << detId.
wheel() <<
", " 682 oss <<
"CSC chamber (endcap, station, ring, chamber, layer): " 685 << detId.
ring() <<
", " 693 oss <<
"RPC chamber ";
694 switch ( detId.
region() ) {
696 oss <<
"/ barrel / (wheel, station, sector, layer, subsector, roll): " 697 << detId.
ring() <<
", " 700 << detId.
layer() <<
", " 705 oss <<
"/ forward endcap / (wheel, station, sector, layer, subsector, roll): " 706 << detId.
ring() <<
", " 709 << detId.
layer() <<
", " 714 oss <<
"/ backward endcap / (wheel, station, sector, layer, subsector, roll): " 715 << detId.
ring() <<
", " 718 << detId.
layer() <<
", " 728 oss <<
"GEM chamber (region, station, ring, chamber, layer): " 731 << detId.
ring() <<
", " 739 oss <<
"ME0 chamber (region, chamber, layer): " 751 oss <<
"CaloTower (ieta, iphi): " 752 << detId.
ieta() <<
", " 758 switch (
id.subdetId() ) {
762 oss <<
"EcalBarrel (ieta, iphi, tower_ieta, tower_iphi): " 763 << detId.
ieta() <<
", " 764 << detId.
iphi() <<
", " 772 oss <<
"EcalEndcap (ix, iy, SuperCrystal, crystal, quadrant): " 773 << detId.
ix() <<
", " 774 << detId.
iy() <<
", " 775 << detId.
isc() <<
", " 776 << detId.
ic() <<
", " 781 oss <<
"EcalPreshower";
784 oss <<
"EcalTriggerTower";
787 oss <<
"EcalLaserPnDiode";
795 switch ( detId.
subdet() ) {
800 oss <<
"HcalBarrel ";
803 oss <<
"HcalEndcap ";
809 oss <<
"HcalForward ";
812 oss <<
"HcalTriggerTower ";
818 oss <<
"(ieta, iphi, depth):" 819 << detId.
ieta() <<
", " 820 << detId.
iphi() <<
", " 830 info(
const std::set<DetId>& idSet) {
832 for(std::set<DetId>::const_iterator
id = idSet.begin(), idEnd = idSet.end();
id != idEnd; ++
id)
841 info(
const std::vector<DetId>& idSet) {
843 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
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
uint32_t rawId() const
get the raw id
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.