9 #include "TEveTrackPropagator.h"
10 #include "TEveStraightLineSet.h"
11 #include "TEveVSDStructs.h"
12 #include "TEveGeoNode.h"
57 static const double MICRON = 1./1000./10.;
70 TEveTrackPropagator* propagator,
71 const std::vector<TEveVector>& extraRefPoints )
76 std::vector<State> refStates;
78 refStates.push_back(
State(TEveVector(track.
vx(), track.
vy(), track.
vz()),
84 refStates.push_back(
State(TEveVector(v.x(), v.y(), v.z()), TEveVector(p.x(), p.y(), p.z())));
89 refStates.push_back(
State(TEveVector(v.x(), v.y(), v.z()), TEveVector(p.x(), p.y(), p.z())));
92 for( std::vector<TEveVector>::const_iterator
point = extraRefPoints.begin(), pointEnd = extraRefPoints.end();
109 if( refStates.front().valid ) {
110 t.fV = refStates.front().position;
111 t.fP = refStates.front().momentum;
112 TEveTrack* trk =
new TEveTrack( &t, propagator );
113 for(
unsigned int i(1);
i<refStates.size()-1; ++
i) {
115 trk->AddPathMark( TEvePathMark( TEvePathMark::kReference, refStates[
i].
position, refStates[
i].momentum ) );
117 trk->AddPathMark( TEvePathMark( TEvePathMark::kDaughter, refStates[
i].position ) );
119 if( refStates.size()>1 ) {
120 trk->AddPathMark( TEvePathMark( TEvePathMark::kDecay, refStates.back().position ) );
125 if( refStates.back().valid ) {
126 t.fSign = (-1)*track.
charge();
127 t.fV = refStates.back().position;
128 t.fP = refStates.back().momentum * (-1.0f);
129 TEveTrack* trk =
new TEveTrack( &t, propagator );
130 unsigned int i( refStates.size()-1 );
133 trk->AddPathMark( TEvePathMark( TEvePathMark::kReference, refStates[
i].
position, refStates[
i].momentum*(-1.0
f) ) );
135 trk->AddPathMark( TEvePathMark( TEvePathMark::kDaughter, refStates[
i].position ) );
137 if ( refStates.size()>1 ) {
138 trk->AddPathMark( TEvePathMark( TEvePathMark::kDecay, refStates.front().position ) );
144 while( i<refStates.size() && !refStates[
i].valid ) ++i;
145 assert( i < refStates.size() );
147 t.fV = refStates[
i].position;
148 t.fP = refStates[
i].momentum;
149 TEveTrack* trk =
new TEveTrack( &t, propagator );
150 for(
unsigned int j(i+1);
j<refStates.size()-1; ++
j ) {
151 if( refStates[i].
valid )
152 trk->AddPathMark( TEvePathMark( TEvePathMark::kReference, refStates[i].
position, refStates[i].momentum ) );
154 trk->AddPathMark( TEvePathMark( TEvePathMark::kDaughter, refStates[i].position ) );
156 if ( i < refStates.size() ) {
157 trk->AddPathMark( TEvePathMark( TEvePathMark::kDecay, refStates.back().position ) );
174 int binoffx = int(mpx);
175 double fractionX = mpx - binoffx;
176 double local_PITCHX =
PITCHX;
178 binoffx = binoffx + 2;
179 }
else if( binoffx == 80 ) {
181 local_PITCHX = 2 *
PITCHX;
182 }
else if( binoffx == 79 ) {
183 binoffx = binoffx + 0;
184 local_PITCHX = 2 *
PITCHX;
185 }
else if( binoffx >= 0 ) {
186 binoffx = binoffx + 0;
190 double lpX = double( binoffx *
PITCHX ) + fractionX * local_PITCHX + xoffset;
207 int binoffy = int( mpy );
208 double fractionY = mpy - binoffy;
209 double local_PITCHY =
PITCHY;
212 binoffy = binoffy+17;
213 }
else if( binoffy == 416 ) {
214 binoffy = binoffy + 16;
215 local_PITCHY = 2 *
PITCHY;
216 }
else if( binoffy == 415 ) {
217 binoffy = binoffy + 15;
218 local_PITCHY = 2 *
PITCHY;
219 }
else if( binoffy > 364 ) {
220 binoffy = binoffy + 15;
221 }
else if( binoffy == 364 ) {
222 binoffy = binoffy + 14;
223 local_PITCHY = 2 *
PITCHY;
224 }
else if( binoffy == 363 ) {
225 binoffy = binoffy + 13;
226 local_PITCHY = 2 *
PITCHY;
227 }
else if( binoffy > 312 ) {
228 binoffy = binoffy + 13;
229 }
else if( binoffy == 312 ) {
230 binoffy = binoffy + 12;
231 local_PITCHY = 2 *
PITCHY;
232 }
else if( binoffy == 311 ) {
233 binoffy = binoffy + 11;
234 local_PITCHY = 2 *
PITCHY;
235 }
else if( binoffy > 260 ) {
236 binoffy = binoffy + 11;
237 }
else if( binoffy == 260 ) {
238 binoffy = binoffy + 10;
239 local_PITCHY = 2 *
PITCHY;
240 }
else if( binoffy == 259 ) {
241 binoffy = binoffy + 9;
242 local_PITCHY = 2 *
PITCHY;
243 }
else if( binoffy > 208 ) {
244 binoffy = binoffy + 9;
245 }
else if(binoffy == 208 ) {
246 binoffy = binoffy + 8;
247 local_PITCHY = 2 *
PITCHY;
248 }
else if( binoffy == 207 ) {
249 binoffy = binoffy + 7;
250 local_PITCHY = 2 *
PITCHY;
251 }
else if( binoffy > 156 ) {
252 binoffy = binoffy + 7;
253 }
else if( binoffy == 156 ) {
254 binoffy = binoffy + 6;
255 local_PITCHY = 2 *
PITCHY;
256 }
else if( binoffy == 155 ) {
257 binoffy = binoffy + 5;
258 local_PITCHY = 2 *
PITCHY;
259 }
else if( binoffy > 104 ) {
260 binoffy = binoffy + 5;
261 }
else if( binoffy == 104 ) {
262 binoffy = binoffy + 4;
263 local_PITCHY = 2 *
PITCHY;
264 }
else if( binoffy == 103 ) {
265 binoffy = binoffy + 3;
266 local_PITCHY = 2 *
PITCHY;
267 }
else if( binoffy > 52 ) {
268 binoffy = binoffy + 3;
269 }
else if( binoffy == 52 ) {
270 binoffy = binoffy + 2;
271 local_PITCHY = 2 *
PITCHY;
272 }
else if( binoffy == 51 ) {
273 binoffy = binoffy + 1;
274 local_PITCHY = 2 *
PITCHY;
275 }
else if( binoffy > 0 ) {
277 }
else if( binoffy == 0 ) {
278 binoffy = binoffy + 0;
279 local_PITCHY = 2 *
PITCHY;
283 double lpY = double( binoffy *
PITCHY ) + fractionY * local_PITCHY + yoffset;
291 void localSiStrip(
short strip,
float* localTop,
float* localBottom,
const float* pars,
unsigned int id )
294 Float_t halfStripLength = pars[2] * 0.5;
296 Double_t localCenter[3] = { 0.0, 0.0, 0.0 };
297 localTop[1] = halfStripLength;
298 localBottom[1] = -halfStripLength;
304 Float_t stripAngle =
tan( pars[5] + strip * pars[6] );
305 Float_t
delta = halfStripLength * stripAngle;
306 localCenter[0] = pars[4] * stripAngle;
307 localTop[0] = localCenter[0] +
delta;
308 localBottom[0] = localCenter[0] -
delta;
310 else if( topology == 2 )
314 Float_t
offset = -pars[1] * 0.5 * pars[3];
315 localCenter[0] = strip * pars[3] +
offset;
316 localTop[0] = localCenter[0];
317 localBottom[0] = localCenter[0];
319 else if( topology == 3 )
322 <<
"did not expect TrapezoidalStripTopology of "
325 else if( pars[0] == 0 )
328 <<
"did not find StripTopology of "
340 el->CSCTakeAnyParentAsMaster();
341 el->SetPickable(
true);
346 el->CSCApplyMainColorToMatchingChildren();
347 el->CSCApplyMainTransparencyToMatchingChildren();
353 parent->AddElement(el);
362 if(
const SiStripRecHit2D* hit2D = dynamic_cast<const SiStripRecHit2D*>( rechit ))
366 cluster = hit2D->cluster().get();
370 if(
const SiStripRecHit1D* hit1D = dynamic_cast<const SiStripRecHit1D*>( rechit ))
374 cluster = hit1D->cluster().get();
387 if( addNearbyClusters )
391 if(
typeid( **it ) ==
typeid( SiStripRecHit2D ))
393 const SiStripRecHit2D &
hit =
static_cast<const SiStripRecHit2D &
>( **it );
394 if( hit.cluster().isNonnull() && hit.cluster().isAvailable())
396 allClusters = hit.cluster().product();
400 else if(
typeid( **it ) ==
typeid( SiStripRecHit1D ))
402 const SiStripRecHit1D &
hit =
static_cast<const SiStripRecHit1D &
>( **it );
403 if( hit.cluster().isNonnull() && hit.cluster().isAvailable())
405 allClusters = hit.cluster().product();
414 unsigned int rawid = (*it)->geographicalId();
418 <<
"failed to get geometry of SiStripCluster with detid: "
419 << rawid << std::endl;
433 if( allClusters != 0 )
440 TEveStraightLineSet *scposition =
new TEveStraightLineSet;
441 scposition->SetDepthTest(
false );
442 scposition->SetPickable( kTRUE );
444 short firststrip = itc->firstStrip();
446 if( &*itc == cluster )
448 scposition->SetTitle( Form(
"Exact SiStripCluster from TrackingRecHit, first strip %d", firststrip ));
449 scposition->SetLineColor( kGreen );
453 scposition->SetTitle( Form(
"SiStripCluster, first strip %d", firststrip ));
454 scposition->SetLineColor( kRed );
457 float localTop[3] = { 0.0, 0.0, 0.0 };
458 float localBottom[3] = { 0.0, 0.0, 0.0 };
463 float globalBottom[3];
464 geom->
localToGlobal( rawid, localTop, globalTop, localBottom, globalBottom );
466 scposition->AddLine( globalTop[0], globalTop[1], globalTop[2],
467 globalBottom[0], globalBottom[1], globalBottom[2] );
475 TEveStraightLineSet *scposition =
new TEveStraightLineSet;
476 scposition->SetDepthTest(
false );
477 scposition->SetPickable( kTRUE );
478 scposition->SetTitle( Form(
"SiStripCluster, first strip %d", firststrip ));
480 float localTop[3] = { 0.0, 0.0, 0.0 };
481 float localBottom[3] = { 0.0, 0.0, 0.0 };
486 float globalBottom[3];
487 geom->
localToGlobal( rawid, localTop, globalTop, localBottom, globalBottom );
489 scposition->AddLine( globalTop[0], globalTop[1], globalTop[2],
490 globalBottom[0], globalBottom[1], globalBottom[2] );
495 else if( !rechit->
isValid() && ( rawid != 0 ))
497 if( allClusters != 0 )
500 if( itds != allClusters->
end())
505 short firststrip = itc->firstStrip();
507 TEveStraightLineSet *scposition =
new TEveStraightLineSet;
508 scposition->SetDepthTest(
false );
509 scposition->SetPickable( kTRUE );
510 scposition->SetTitle( Form(
"Lost SiStripCluster, first strip %d", firststrip ));
512 float localTop[3] = { 0.0, 0.0, 0.0 };
513 float localBottom[3] = { 0.0, 0.0, 0.0 };
518 float globalBottom[3];
519 geom->
localToGlobal( rawid, localTop, globalTop, localBottom, globalBottom );
521 scposition->AddLine( globalTop[0], globalTop[1], globalTop[2],
522 globalBottom[0], globalBottom[1], globalBottom[2] );
526 scposition->SetLineColor( kRed );
534 <<
"*ANOTHER* option possible: valid=" << rechit->
isValid()
535 <<
", rawid=" << rawid << std::endl;
551 if( hit.cluster().isNonnull() && hit.cluster().isAvailable())
553 allClusters = hit.cluster().product();
558 if( allClusters == 0 )
return;
566 DetId id = (*it)->geographicalId();
570 <<
"failed to get geometry of Tracker Det with raw id: "
571 <<
id.rawId() << std::endl;
577 unsigned int subdet = (
unsigned int)
id.subdetId();
581 if(
const SiPixelRecHit* pixel = dynamic_cast<const SiPixelRecHit*>( rh ))
582 hitCluster = pixel->cluster().get();
584 if( itds != allClusters->
end())
589 if( &*itc != hitCluster )
608 double etaT = t.
eta();
618 DetId id = (*it)->geographicalId();
622 <<
"failed to get geometry of Tracker Det with raw id: "
623 <<
id.rawId() << std::endl;
629 unsigned int subdet = (
unsigned int)
id.subdetId();
636 if(
const SiPixelRecHit* pixel = dynamic_cast<const SiPixelRecHit*>( rh ))
653 int nrows = (int)pars[0];
654 int ncols = (int)pars[1];
659 <<
", row: " << row <<
", col: " << col
660 <<
", lx: " << lx <<
", ly: " << ly ;
662 float local[3] = { lx, ly, 0. };
665 TVector3 pb( global[0], global[1], global[2] );
666 pixelPoints.push_back( pb );
672 <<
" eta: " << pb.Eta()
673 <<
", phi: " << pb.Phi()
674 <<
" rho: " << pb.Pt() << std::endl;
681 std::ostringstream oss;
683 oss <<
"DetId: " <<
id.rawId() <<
"\n";
685 switch (
id.det() ) {
688 switch (
id.subdetId() ) {
723 switch (
id.subdetId() ) {
727 oss <<
"DT chamber (wheel, station, sector): "
728 << detId.
wheel() <<
", "
736 oss <<
"CSC chamber (endcap, station, ring, chamber, layer): "
739 << detId.
ring() <<
", "
747 oss <<
"RPC chamber ";
748 switch ( detId.
region() ) {
750 oss <<
"/ barrel / (wheel, station, sector, layer, subsector, roll): "
751 << detId.
ring() <<
", "
754 << detId.
layer() <<
", "
759 oss <<
"/ forward endcap / (wheel, station, sector, layer, subsector, roll): "
760 << detId.
ring() <<
", "
763 << detId.
layer() <<
", "
768 oss <<
"/ backward endcap / (wheel, station, sector, layer, subsector, roll): "
769 << detId.
ring() <<
", "
772 << detId.
layer() <<
", "
785 oss <<
"CaloTower (ieta, iphi): "
786 << detId.
ieta() <<
", "
792 switch (
id.subdetId() ) {
796 oss <<
"EcalBarrel (ieta, iphi, tower_ieta, tower_iphi): "
797 << detId.
ieta() <<
", "
798 << detId.
iphi() <<
", "
806 oss <<
"EcalEndcap (ix, iy, SuperCrystal, crystal, quadrant): "
807 << detId.
ix() <<
", "
808 << detId.
iy() <<
", "
809 << detId.
isc() <<
", "
810 << detId.
ic() <<
", "
815 oss <<
"EcalPreshower";
818 oss <<
"EcalTriggerTower";
821 oss <<
"EcalLaserPnDiode";
829 switch ( detId.
subdet() ) {
834 oss <<
"HcalBarrel ";
837 oss <<
"HcalEndcap ";
843 oss <<
"HcalForward ";
846 oss <<
"HcalTriggerTower ";
852 oss <<
"(ieta, iphi, depth):"
853 << detId.
ieta() <<
", "
854 << detId.
iphi() <<
", "
864 info(
const std::set<DetId>& idSet) {
866 for(std::set<DetId>::const_iterator
id = idSet.begin(), idEnd = idSet.end();
id != idEnd; ++id)
875 info(
const std::vector<DetId>& idSet) {
877 for(std::vector<DetId>::const_iterator
id = idSet.begin(), idEnd = idSet.end();
id != idEnd; ++id)
const FWDisplayProperties & defaultDisplayProperties() const
boost::transform_iterator< IterHelp, const_IdIter > const_iterator
const_iterator end(bool update=false) const
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
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
static int position[TOTALCHAMBERS][3]
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
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.
unsigned int offset(bool)
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 math::XYZVector & outerMomentum() const
momentum vector at the outermost hit position
bool outerOk() const
return true if the outermost hit is valid
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
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
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.