9 #include "TEveTrackPropagator.h"
10 #include "TEveStraightLineSet.h"
11 #include "TEveVSDStructs.h"
12 #include "TEveGeoNode.h"
61 static const double MICRON = 1./1000./10.;
75 const std::vector<TEveVector>& extraRefPoints )
80 std::vector<State> refStates;
82 refStates.push_back(
State(TEveVector(track.
vx(), track.
vy(), track.
vz()),
88 refStates.push_back(
State(TEveVector(v.x(), v.y(), v.z()), TEveVector(p.x(), p.y(), p.z())));
93 refStates.push_back(
State(TEveVector(v.x(), v.y(), v.z()), TEveVector(p.x(), p.y(), p.z())));
96 for( std::vector<TEveVector>::const_iterator
point = extraRefPoints.begin(), pointEnd = extraRefPoints.end();
113 if( refStates.front().valid ) {
114 t.fV = refStates.front().position;
115 t.fP = refStates.front().momentum;
116 TEveTrack* trk =
new TEveTrack( &t, propagator );
117 for(
unsigned int i(1);
i<refStates.size()-1; ++
i) {
119 trk->AddPathMark( TEvePathMark( TEvePathMark::kReference, refStates[
i].
position, refStates[
i].momentum ) );
121 trk->AddPathMark( TEvePathMark( TEvePathMark::kDaughter, refStates[
i].position ) );
123 if( refStates.size()>1 ) {
124 trk->AddPathMark( TEvePathMark( TEvePathMark::kDecay, refStates.back().position ) );
129 if( refStates.back().valid ) {
130 t.fSign = (-1)*track.
charge();
131 t.fV = refStates.back().position;
132 t.fP = refStates.back().momentum * (-1.0f);
133 TEveTrack* trk =
new TEveTrack( &t, propagator );
134 unsigned int i( refStates.size()-1 );
137 trk->AddPathMark( TEvePathMark( TEvePathMark::kReference, refStates[
i].
position, refStates[
i].momentum*(-1.0
f) ) );
139 trk->AddPathMark( TEvePathMark( TEvePathMark::kDaughter, refStates[
i].position ) );
141 if ( refStates.size()>1 ) {
142 trk->AddPathMark( TEvePathMark( TEvePathMark::kDecay, refStates.front().position ) );
148 while( i<refStates.size() && !refStates[
i].valid ) ++i;
149 assert( i < refStates.size() );
151 t.fV = refStates[
i].position;
152 t.fP = refStates[
i].momentum;
153 TEveTrack* trk =
new TEveTrack( &t, propagator );
154 for(
unsigned int j(i+1);
j<refStates.size()-1; ++
j ) {
155 if( refStates[i].
valid )
156 trk->AddPathMark( TEvePathMark( TEvePathMark::kReference, refStates[i].
position, refStates[i].momentum ) );
158 trk->AddPathMark( TEvePathMark( TEvePathMark::kDaughter, refStates[i].position ) );
160 if ( i < refStates.size() ) {
161 trk->AddPathMark( TEvePathMark( TEvePathMark::kDecay, refStates.back().position ) );
178 int binoffx = int(mpx);
179 double fractionX = mpx - binoffx;
180 double local_PITCHX =
PITCHX;
182 binoffx = binoffx + 2;
183 }
else if( binoffx == 80 ) {
185 local_PITCHX = 2 *
PITCHX;
186 }
else if( binoffx == 79 ) {
187 binoffx = binoffx + 0;
188 local_PITCHX = 2 *
PITCHX;
189 }
else if( binoffx >= 0 ) {
190 binoffx = binoffx + 0;
194 double lpX = double( binoffx *
PITCHX ) + fractionX * local_PITCHX + xoffset;
211 int binoffy = int( mpy );
212 double fractionY = mpy - binoffy;
213 double local_PITCHY =
PITCHY;
216 binoffy = binoffy+17;
217 }
else if( binoffy == 416 ) {
218 binoffy = binoffy + 16;
219 local_PITCHY = 2 *
PITCHY;
220 }
else if( binoffy == 415 ) {
221 binoffy = binoffy + 15;
222 local_PITCHY = 2 *
PITCHY;
223 }
else if( binoffy > 364 ) {
224 binoffy = binoffy + 15;
225 }
else if( binoffy == 364 ) {
226 binoffy = binoffy + 14;
227 local_PITCHY = 2 *
PITCHY;
228 }
else if( binoffy == 363 ) {
229 binoffy = binoffy + 13;
230 local_PITCHY = 2 *
PITCHY;
231 }
else if( binoffy > 312 ) {
232 binoffy = binoffy + 13;
233 }
else if( binoffy == 312 ) {
234 binoffy = binoffy + 12;
235 local_PITCHY = 2 *
PITCHY;
236 }
else if( binoffy == 311 ) {
237 binoffy = binoffy + 11;
238 local_PITCHY = 2 *
PITCHY;
239 }
else if( binoffy > 260 ) {
240 binoffy = binoffy + 11;
241 }
else if( binoffy == 260 ) {
242 binoffy = binoffy + 10;
243 local_PITCHY = 2 *
PITCHY;
244 }
else if( binoffy == 259 ) {
245 binoffy = binoffy + 9;
246 local_PITCHY = 2 *
PITCHY;
247 }
else if( binoffy > 208 ) {
248 binoffy = binoffy + 9;
249 }
else if(binoffy == 208 ) {
250 binoffy = binoffy + 8;
251 local_PITCHY = 2 *
PITCHY;
252 }
else if( binoffy == 207 ) {
253 binoffy = binoffy + 7;
254 local_PITCHY = 2 *
PITCHY;
255 }
else if( binoffy > 156 ) {
256 binoffy = binoffy + 7;
257 }
else if( binoffy == 156 ) {
258 binoffy = binoffy + 6;
259 local_PITCHY = 2 *
PITCHY;
260 }
else if( binoffy == 155 ) {
261 binoffy = binoffy + 5;
262 local_PITCHY = 2 *
PITCHY;
263 }
else if( binoffy > 104 ) {
264 binoffy = binoffy + 5;
265 }
else if( binoffy == 104 ) {
266 binoffy = binoffy + 4;
267 local_PITCHY = 2 *
PITCHY;
268 }
else if( binoffy == 103 ) {
269 binoffy = binoffy + 3;
270 local_PITCHY = 2 *
PITCHY;
271 }
else if( binoffy > 52 ) {
272 binoffy = binoffy + 3;
273 }
else if( binoffy == 52 ) {
274 binoffy = binoffy + 2;
275 local_PITCHY = 2 *
PITCHY;
276 }
else if( binoffy == 51 ) {
277 binoffy = binoffy + 1;
278 local_PITCHY = 2 *
PITCHY;
279 }
else if( binoffy > 0 ) {
281 }
else if( binoffy == 0 ) {
282 binoffy = binoffy + 0;
283 local_PITCHY = 2 *
PITCHY;
287 double lpY = double( binoffy *
PITCHY ) + fractionY * local_PITCHY + yoffset;
295 void localSiStrip(
short strip,
float* localTop,
float* localBottom,
const float* pars,
unsigned int id )
298 Float_t halfStripLength = pars[2] * 0.5;
300 Double_t localCenter[3] = { 0.0, 0.0, 0.0 };
301 localTop[1] = halfStripLength;
302 localBottom[1] = -halfStripLength;
308 Float_t stripAngle =
tan( pars[5] + strip * pars[6] );
309 Float_t
delta = halfStripLength * stripAngle;
310 localCenter[0] = pars[4] * stripAngle;
311 localTop[0] = localCenter[0] +
delta;
312 localBottom[0] = localCenter[0] -
delta;
314 else if( topology == 2 )
318 Float_t
offset = -pars[1] * 0.5 * pars[3];
319 localCenter[0] = strip * pars[3] +
offset;
320 localTop[0] = localCenter[0];
321 localBottom[0] = localCenter[0];
323 else if( topology == 3 )
326 <<
"did not expect TrapezoidalStripTopology of "
329 else if( pars[0] == 0 )
332 <<
"did not find StripTopology of "
344 el->CSCTakeAnyParentAsMaster();
345 el->SetPickable(
true);
350 el->CSCApplyMainColorToMatchingChildren();
351 el->CSCApplyMainTransparencyToMatchingChildren();
357 parent->AddElement(el);
366 if(
const SiStripRecHit2D* hit2D = dynamic_cast<const SiStripRecHit2D*>( rechit ))
370 cluster = hit2D->cluster().get();
374 if(
const SiStripRecHit1D* hit1D = dynamic_cast<const SiStripRecHit1D*>( rechit ))
378 cluster = hit1D->cluster().get();
391 if( addNearbyClusters )
402 allClusters = allClustersHandle.
product();
413 allClusters = allClustersHandle.
product();
422 unsigned int rawid = (*it)->geographicalId();
426 <<
"failed to get geometry of SiStripCluster with detid: "
427 << rawid << std::endl;
435 auto rechitRef = *it;
441 if( allClusters != 0 )
448 TEveStraightLineSet *scposition =
new TEveStraightLineSet;
449 scposition->SetDepthTest(
false );
450 scposition->SetPickable( kTRUE );
452 short firststrip = itc->firstStrip();
454 if( &*itc == cluster )
456 scposition->SetTitle( Form(
"Exact SiStripCluster from TrackingRecHit, first strip %d", firststrip ));
457 scposition->SetLineColor( kGreen );
461 scposition->SetTitle( Form(
"SiStripCluster, first strip %d", firststrip ));
462 scposition->SetLineColor( kRed );
465 float localTop[3] = { 0.0, 0.0, 0.0 };
466 float localBottom[3] = { 0.0, 0.0, 0.0 };
471 float globalBottom[3];
472 geom->
localToGlobal( rawid, localTop, globalTop, localBottom, globalBottom );
474 scposition->AddLine( globalTop[0], globalTop[1], globalTop[2],
475 globalBottom[0], globalBottom[1], globalBottom[2] );
483 TEveStraightLineSet *scposition =
new TEveStraightLineSet;
484 scposition->SetDepthTest(
false );
485 scposition->SetPickable( kTRUE );
486 scposition->SetTitle( Form(
"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] );
503 else if( !rechit->
isValid() && ( rawid != 0 ))
505 if( allClusters != 0 )
508 if( itds != allClusters->
end())
513 short firststrip = itc->firstStrip();
515 TEveStraightLineSet *scposition =
new TEveStraightLineSet;
516 scposition->SetDepthTest(
false );
517 scposition->SetPickable( kTRUE );
518 scposition->SetTitle( Form(
"Lost SiStripCluster, first strip %d", firststrip ));
520 float localTop[3] = { 0.0, 0.0, 0.0 };
521 float localBottom[3] = { 0.0, 0.0, 0.0 };
526 float globalBottom[3];
527 geom->
localToGlobal( rawid, localTop, globalTop, localBottom, globalBottom );
529 scposition->AddLine( globalTop[0], globalTop[1], globalTop[2],
530 globalBottom[0], globalBottom[1], globalBottom[2] );
534 scposition->SetLineColor( kRed );
542 <<
"*ANOTHER* option possible: valid=" << rechit->
isValid()
543 <<
", rawid=" << rawid << std::endl;
563 allClusters = allClustersHandle.
product();
568 if( allClusters == 0 )
return;
576 DetId id = (*it)->geographicalId();
580 <<
"failed to get geometry of Tracker Det with raw id: "
581 <<
id.rawId() << std::endl;
587 unsigned int subdet = (
unsigned int)
id.subdetId();
591 if(
const SiPixelRecHit* pixel = dynamic_cast<const SiPixelRecHit*>( rh ))
592 hitCluster = pixel->cluster().get();
594 if( itds != allClusters->
end())
599 if( &*itc != hitCluster )
618 double etaT = t.
eta();
628 DetId id = (*it)->geographicalId();
632 <<
"failed to get geometry of Tracker Det with raw id: "
633 <<
id.rawId() << std::endl;
639 unsigned int subdet = (
unsigned int)
id.subdetId();
646 if(
const SiPixelRecHit* pixel = dynamic_cast<const SiPixelRecHit*>( rh ))
663 int nrows = (int)pars[0];
664 int ncols = (int)pars[1];
669 <<
", row: " << row <<
", col: " << col
670 <<
", lx: " << lx <<
", ly: " << ly ;
672 float local[3] = { lx, ly, 0. };
675 TVector3 pb( global[0], global[1], global[2] );
676 pixelPoints.push_back( pb );
682 <<
" eta: " << pb.Eta()
683 <<
", phi: " << pb.Phi()
684 <<
" rho: " << pb.Pt() << std::endl;
691 std::ostringstream oss;
693 oss <<
"DetId: " <<
id.rawId() <<
"\n";
695 switch (
id.det() ) {
698 switch (
id.subdetId() ) {
733 switch (
id.subdetId() ) {
737 oss <<
"DT chamber (wheel, station, sector): "
738 << detId.
wheel() <<
", "
746 oss <<
"CSC chamber (endcap, station, ring, chamber, layer): "
749 << detId.
ring() <<
", "
757 oss <<
"RPC chamber ";
758 switch ( detId.
region() ) {
760 oss <<
"/ barrel / (wheel, station, sector, layer, subsector, roll): "
761 << detId.
ring() <<
", "
764 << detId.
layer() <<
", "
769 oss <<
"/ forward endcap / (wheel, station, sector, layer, subsector, roll): "
770 << detId.
ring() <<
", "
773 << detId.
layer() <<
", "
778 oss <<
"/ backward endcap / (wheel, station, sector, layer, subsector, roll): "
779 << detId.
ring() <<
", "
782 << detId.
layer() <<
", "
795 oss <<
"CaloTower (ieta, iphi): "
796 << detId.
ieta() <<
", "
802 switch (
id.subdetId() ) {
806 oss <<
"EcalBarrel (ieta, iphi, tower_ieta, tower_iphi): "
807 << detId.
ieta() <<
", "
808 << detId.
iphi() <<
", "
816 oss <<
"EcalEndcap (ix, iy, SuperCrystal, crystal, quadrant): "
817 << detId.
ix() <<
", "
818 << detId.
iy() <<
", "
819 << detId.
isc() <<
", "
820 << detId.
ic() <<
", "
825 oss <<
"EcalPreshower";
828 oss <<
"EcalTriggerTower";
831 oss <<
"EcalLaserPnDiode";
839 switch ( detId.
subdet() ) {
844 oss <<
"HcalBarrel ";
847 oss <<
"HcalEndcap ";
853 oss <<
"HcalForward ";
856 oss <<
"HcalTriggerTower ";
862 oss <<
"(ieta, iphi, depth):"
863 << detId.
ieta() <<
", "
864 << detId.
iphi() <<
", "
874 info(
const std::set<DetId>& idSet) {
876 for(std::set<DetId>::const_iterator
id = idSet.begin(), idEnd = idSet.end();
id != idEnd; ++id)
885 info(
const std::vector<DetId>& idSet) {
887 for(std::vector<DetId>::const_iterator
id = idSet.begin(), idEnd = idSet.end();
id != idEnd; ++id)
ClusterRef cluster() const
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.
unsigned int layer() const
layer id
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 >())
float pixelLocalY(const double mpy, const int m_ncols)
static const int COLS_PER_ROC
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
static const int BIG_PIX_PER_ROC_Y
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
ProductID id() const
Accessor for product ID.
unsigned int layer() const
layer id
static const int ROWS_PER_ROC
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
static const double PITCHX
static const int BIG_PIX_PER_ROC_X
int depth() const
get the tower depth
Char_t transparency() const
double eta() const
pseudorapidity of momentum vector
double pt() const
track transverse momentum
const SiStripCluster * extractClusterFromTrackingRecHit(const TrackingRecHit *rh)
static const double MICRON
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
Tan< T >::type tan(const T &t)
static const double PITCHY
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.
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
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
unsigned int wheel() const
wheel id
int sector() const
Sector id: the group of chambers at same phi (and increasing r)
unsigned int layer() const
layer id
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
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)
float pixelLocalX(const double mpx, const int m_nrows)
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
TrackingRecHitCollection::base::const_iterator trackingRecHit_iterator
iterator over a vector of reference to TrackingRecHit in the same collection
double vx() const
x coordinate of the reference point on track
unsigned int wheel() const
wheel id
trackingRecHit_iterator recHitsEnd() const
Iterator to last hit on the track.
int region() const
Region id: 0 for Barrel, +/-1 For +/- Endcap.