10 #include "TEveTrackPropagator.h"
11 #include "TEveStraightLineSet.h"
12 #include "TEveVSDStructs.h"
13 #include "TEveGeoNode.h"
58 static const double MICRON = 1./1000./10.;
67 static const std::string
subdets[7] = {
"UNKNOWN",
"PXB",
"PXF",
"TIB",
"TID",
"TOB",
"TEC" };
72 const std::vector<TEveVector>& extraRefPoints )
77 std::vector<State> refStates;
79 refStates.push_back(
State(TEveVector(track.
vx(), track.
vy(), track.
vz()),
85 refStates.push_back(
State(TEveVector(v.x(), v.y(), v.z()), TEveVector(p.x(), p.y(), p.z())));
90 refStates.push_back(
State(TEveVector(v.x(), v.y(), v.z()), TEveVector(p.x(), p.y(), p.z())));
93 for( std::vector<TEveVector>::const_iterator
point = extraRefPoints.begin(), pointEnd = extraRefPoints.end();
110 if( refStates.front().valid ) {
111 t.fV = refStates.front().position;
112 t.fP = refStates.front().momentum;
113 TEveTrack* trk =
new TEveTrack( &t, propagator );
114 for(
unsigned int i(1);
i<refStates.size()-1; ++
i) {
116 trk->AddPathMark( TEvePathMark( TEvePathMark::kReference, refStates[
i].
position, refStates[
i].momentum ) );
118 trk->AddPathMark( TEvePathMark( TEvePathMark::kDaughter, refStates[
i].position ) );
120 if( refStates.size()>1 ) {
121 trk->AddPathMark( TEvePathMark( TEvePathMark::kDecay, refStates.back().position ) );
126 if( refStates.back().valid ) {
127 t.fSign = (-1)*track.
charge();
128 t.fV = refStates.back().position;
129 t.fP = refStates.back().momentum * (-1.0f);
130 TEveTrack* trk =
new TEveTrack( &t, propagator );
131 unsigned int i( refStates.size()-1 );
134 trk->AddPathMark( TEvePathMark( TEvePathMark::kReference, refStates[
i].
position, refStates[
i].momentum*(-1.0
f) ) );
136 trk->AddPathMark( TEvePathMark( TEvePathMark::kDaughter, refStates[
i].position ) );
138 if ( refStates.size()>1 ) {
139 trk->AddPathMark( TEvePathMark( TEvePathMark::kDecay, refStates.front().position ) );
145 while( i<refStates.size() && !refStates[
i].valid ) ++i;
146 assert( i < refStates.size() );
148 t.fV = refStates[
i].position;
149 t.fP = refStates[
i].momentum;
150 TEveTrack* trk =
new TEveTrack( &t, propagator );
151 for(
unsigned int j(i+1);
j<refStates.size()-1; ++
j ) {
152 if( refStates[i].
valid )
153 trk->AddPathMark( TEvePathMark( TEvePathMark::kReference, refStates[i].
position, refStates[i].momentum ) );
155 trk->AddPathMark( TEvePathMark( TEvePathMark::kDaughter, refStates[i].position ) );
157 if ( i < refStates.size() ) {
158 trk->AddPathMark( TEvePathMark( TEvePathMark::kDecay, refStates.back().position ) );
175 int binoffx = int(mpx);
176 double fractionX = mpx - binoffx;
177 double local_PITCHX =
PITCHX;
179 binoffx = binoffx + 2;
180 }
else if( binoffx == 80 ) {
182 local_PITCHX = 2 *
PITCHX;
183 }
else if( binoffx == 79 ) {
184 binoffx = binoffx + 0;
185 local_PITCHX = 2 *
PITCHX;
186 }
else if( binoffx >= 0 ) {
187 binoffx = binoffx + 0;
191 double lpX = double( binoffx *
PITCHX ) + fractionX * local_PITCHX + xoffset;
208 int binoffy = int( mpy );
209 double fractionY = mpy - binoffy;
210 double local_PITCHY =
PITCHY;
213 binoffy = binoffy+17;
214 }
else if( binoffy == 416 ) {
215 binoffy = binoffy + 16;
216 local_PITCHY = 2 *
PITCHY;
217 }
else if( binoffy == 415 ) {
218 binoffy = binoffy + 15;
219 local_PITCHY = 2 *
PITCHY;
220 }
else if( binoffy > 364 ) {
221 binoffy = binoffy + 15;
222 }
else if( binoffy == 364 ) {
223 binoffy = binoffy + 14;
224 local_PITCHY = 2 *
PITCHY;
225 }
else if( binoffy == 363 ) {
226 binoffy = binoffy + 13;
227 local_PITCHY = 2 *
PITCHY;
228 }
else if( binoffy > 312 ) {
229 binoffy = binoffy + 13;
230 }
else if( binoffy == 312 ) {
231 binoffy = binoffy + 12;
232 local_PITCHY = 2 *
PITCHY;
233 }
else if( binoffy == 311 ) {
234 binoffy = binoffy + 11;
235 local_PITCHY = 2 *
PITCHY;
236 }
else if( binoffy > 260 ) {
237 binoffy = binoffy + 11;
238 }
else if( binoffy == 260 ) {
239 binoffy = binoffy + 10;
240 local_PITCHY = 2 *
PITCHY;
241 }
else if( binoffy == 259 ) {
242 binoffy = binoffy + 9;
243 local_PITCHY = 2 *
PITCHY;
244 }
else if( binoffy > 208 ) {
245 binoffy = binoffy + 9;
246 }
else if(binoffy == 208 ) {
247 binoffy = binoffy + 8;
248 local_PITCHY = 2 *
PITCHY;
249 }
else if( binoffy == 207 ) {
250 binoffy = binoffy + 7;
251 local_PITCHY = 2 *
PITCHY;
252 }
else if( binoffy > 156 ) {
253 binoffy = binoffy + 7;
254 }
else if( binoffy == 156 ) {
255 binoffy = binoffy + 6;
256 local_PITCHY = 2 *
PITCHY;
257 }
else if( binoffy == 155 ) {
258 binoffy = binoffy + 5;
259 local_PITCHY = 2 *
PITCHY;
260 }
else if( binoffy > 104 ) {
261 binoffy = binoffy + 5;
262 }
else if( binoffy == 104 ) {
263 binoffy = binoffy + 4;
264 local_PITCHY = 2 *
PITCHY;
265 }
else if( binoffy == 103 ) {
266 binoffy = binoffy + 3;
267 local_PITCHY = 2 *
PITCHY;
268 }
else if( binoffy > 52 ) {
269 binoffy = binoffy + 3;
270 }
else if( binoffy == 52 ) {
271 binoffy = binoffy + 2;
272 local_PITCHY = 2 *
PITCHY;
273 }
else if( binoffy == 51 ) {
274 binoffy = binoffy + 1;
275 local_PITCHY = 2 *
PITCHY;
276 }
else if( binoffy > 0 ) {
278 }
else if( binoffy == 0 ) {
279 binoffy = binoffy + 0;
280 local_PITCHY = 2 *
PITCHY;
284 double lpY = double( binoffy *
PITCHY ) + fractionY * local_PITCHY + yoffset;
292 void localSiStrip(
short strip,
float* localTop,
float* localBottom,
const float* pars,
unsigned int id )
294 Float_t topology = pars[0];
295 Float_t halfStripLength = pars[2] * 0.5;
297 Double_t localCenter[3] = { 0.0, 0.0, 0.0 };
298 localTop[1] = halfStripLength;
299 localBottom[1] = -halfStripLength;
305 Float_t stripAngle =
tan( pars[5] + strip * pars[6] );
306 Float_t
delta = halfStripLength * stripAngle;
307 localCenter[0] = pars[4] * stripAngle;
308 localTop[0] = localCenter[0] +
delta;
309 localBottom[0] = localCenter[0] -
delta;
311 else if( topology == 2 )
315 Float_t
offset = -pars[1] * 0.5 * pars[3];
316 localCenter[0] = strip * pars[3] +
offset;
317 localTop[0] = localCenter[0];
318 localBottom[0] = localCenter[0];
320 else if( topology == 3 )
323 <<
"did not expect TrapezoidalStripTopology of "
326 else if( pars[0] == 0 )
329 <<
"did not find StripTopology of "
341 el->CSCTakeAnyParentAsMaster();
342 el->SetPickable(
true);
347 el->CSCApplyMainColorToMatchingChildren();
348 el->CSCApplyMainTransparencyToMatchingChildren();
354 parent->AddElement(el);
363 if(
const SiStripRecHit2D* hit2D = dynamic_cast<const SiStripRecHit2D*>( rechit ))
367 if( hit2D->cluster().isNonnull())
369 cluster = hit2D->cluster().get();
371 else if( hit2D->cluster_regional().isNonnull())
373 cluster = hit2D->cluster_regional().get();
382 if(
const SiStripRecHit1D* hit1D = dynamic_cast<const SiStripRecHit1D*>( rechit ))
386 if( hit1D->cluster().isNonnull())
388 cluster = hit1D->cluster().get();
390 else if( hit1D->cluster_regional().isNonnull())
392 cluster = hit1D->cluster_regional().get();
410 if( addNearbyClusters )
414 if(
typeid( **it ) ==
typeid( SiStripRecHit2D ))
416 const SiStripRecHit2D &
hit =
static_cast<const SiStripRecHit2D &
>( **it );
417 if( hit.cluster().isNonnull() && hit.cluster().isAvailable())
419 allClusters = hit.cluster().product();
423 else if(
typeid( **it ) ==
typeid( SiStripRecHit1D ))
425 const SiStripRecHit1D &
hit =
static_cast<const SiStripRecHit1D &
>( **it );
426 if( hit.cluster().isNonnull() && hit.cluster().isAvailable())
428 allClusters = hit.cluster().product();
437 unsigned int rawid = (*it)->geographicalId();
441 <<
"failed to get geometry of SiStripCluster with detid: "
442 << rawid << std::endl;
456 if( allClusters != 0 )
463 TEveStraightLineSet *scposition =
new TEveStraightLineSet;
464 scposition->SetDepthTest(
false );
465 scposition->SetPickable( kTRUE );
467 short firststrip = itc->firstStrip();
469 if( &*itc == cluster )
471 scposition->SetTitle( Form(
"Exact SiStripCluster from TrackingRecHit, first strip %d", firststrip ));
472 scposition->SetLineColor( kGreen );
476 scposition->SetTitle( Form(
"SiStripCluster, first strip %d", firststrip ));
477 scposition->SetLineColor( kRed );
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] );
498 TEveStraightLineSet *scposition =
new TEveStraightLineSet;
499 scposition->SetDepthTest(
false );
500 scposition->SetPickable( kTRUE );
501 scposition->SetTitle( Form(
"SiStripCluster, first strip %d", firststrip ));
503 float localTop[3] = { 0.0, 0.0, 0.0 };
504 float localBottom[3] = { 0.0, 0.0, 0.0 };
509 float globalBottom[3];
510 geom->
localToGlobal( rawid, localTop, globalTop, localBottom, globalBottom );
512 scposition->AddLine( globalTop[0], globalTop[1], globalTop[2],
513 globalBottom[0], globalBottom[1], globalBottom[2] );
518 else if( !rechit->
isValid() && ( rawid != 0 ))
520 if( allClusters != 0 )
523 if( itds != allClusters->
end())
528 short firststrip = itc->firstStrip();
530 TEveStraightLineSet *scposition =
new TEveStraightLineSet;
531 scposition->SetDepthTest(
false );
532 scposition->SetPickable( kTRUE );
533 scposition->SetTitle( Form(
"Lost SiStripCluster, first strip %d", firststrip ));
535 float localTop[3] = { 0.0, 0.0, 0.0 };
536 float localBottom[3] = { 0.0, 0.0, 0.0 };
541 float globalBottom[3];
542 geom->
localToGlobal( rawid, localTop, globalTop, localBottom, globalBottom );
544 scposition->AddLine( globalTop[0], globalTop[1], globalTop[2],
545 globalBottom[0], globalBottom[1], globalBottom[2] );
549 scposition->SetLineColor( kRed );
557 <<
"*ANOTHER* option possible: valid=" << rechit->
isValid()
558 <<
", rawid=" << rawid << std::endl;
574 if( hit.cluster().isNonnull() && hit.cluster().isAvailable())
576 allClusters = hit.cluster().product();
581 if( allClusters == 0 )
return;
589 DetId id = (*it)->geographicalId();
593 <<
"failed to get geometry of Tracker Det with raw id: "
594 <<
id.rawId() << std::endl;
600 unsigned int subdet = (
unsigned int)
id.subdetId();
604 if(
const SiPixelRecHit* pixel = dynamic_cast<const SiPixelRecHit*>( rh ))
605 hitCluster = pixel->cluster().get();
607 if( itds != allClusters->
end())
612 if( &*itc != hitCluster )
631 double etaT = t.
eta();
641 DetId id = (*it)->geographicalId();
645 <<
"failed to get geometry of Tracker Det with raw id: "
646 <<
id.rawId() << std::endl;
652 unsigned int subdet = (
unsigned int)
id.subdetId();
659 if(
const SiPixelRecHit* pixel = dynamic_cast<const SiPixelRecHit*>( rh ))
676 int nrows = (int)pars[0];
677 int ncols = (int)pars[1];
682 <<
", row: " << row <<
", col: " << col
683 <<
", lx: " << lx <<
", ly: " << ly ;
685 float local[3] = { lx, ly, 0. };
688 TVector3 pb( global[0], global[1], global[2] );
689 pixelPoints.push_back( pb );
695 <<
" eta: " << pb.Eta()
696 <<
", phi: " << pb.Phi()
697 <<
" rho: " << pb.Pt() << std::endl;
704 std::ostringstream oss;
706 oss <<
"DetId: " <<
id.rawId() <<
"\n";
708 switch (
id.det() ) {
711 switch (
id.subdetId() ) {
746 switch (
id.subdetId() ) {
750 oss <<
"DT chamber (wheel, station, sector): "
751 << detId.
wheel() <<
", "
759 oss <<
"CSC chamber (endcap, station, ring, chamber, layer): "
762 << detId.
ring() <<
", "
770 oss <<
"RPC chamber ";
771 switch ( detId.
region() ) {
773 oss <<
"/ barrel / (wheel, station, sector, layer, subsector, roll): "
774 << detId.
ring() <<
", "
777 << detId.
layer() <<
", "
782 oss <<
"/ forward endcap / (wheel, station, sector, layer, subsector, roll): "
783 << detId.
ring() <<
", "
786 << detId.
layer() <<
", "
791 oss <<
"/ backward endcap / (wheel, station, sector, layer, subsector, roll): "
792 << detId.
ring() <<
", "
795 << detId.
layer() <<
", "
808 oss <<
"CaloTower (ieta, iphi): "
809 << detId.
ieta() <<
", "
815 switch (
id.subdetId() ) {
819 oss <<
"EcalBarrel (ieta, iphi, tower_ieta, tower_iphi): "
820 << detId.
ieta() <<
", "
821 << detId.
iphi() <<
", "
829 oss <<
"EcalEndcap (ix, iy, SuperCrystal, crystal, quadrant): "
830 << detId.
ix() <<
", "
831 << detId.
iy() <<
", "
832 << detId.
isc() <<
", "
833 << detId.
ic() <<
", "
838 oss <<
"EcalPreshower";
841 oss <<
"EcalTriggerTower";
844 oss <<
"EcalLaserPnDiode";
852 switch ( detId.
subdet() ) {
857 oss <<
"HcalBarrel ";
860 oss <<
"HcalEndcap ";
866 oss <<
"HcalForward ";
869 oss <<
"HcalTriggerTower ";
875 oss <<
"(ieta, iphi, depth):"
876 << detId.
ieta() <<
", "
877 << detId.
iphi() <<
", "
887 info(
const std::set<DetId>& idSet) {
889 for(std::set<DetId>::const_iterator
id = idSet.begin(), idEnd = idSet.end();
id != idEnd; ++
id)
898 info(
const std::vector<DetId>& idSet) {
900 for(std::vector<DetId>::const_iterator
id = idSet.begin(), idEnd = idSet.end();
id != idEnd; ++
id)
Master< F > master(const F &f)
const FWDisplayProperties & defaultDisplayProperties() const
boost::transform_iterator< IterHelp, const_IdIter > const_iterator
unsigned int layer() const
layer id
HcalSubdetector subdet() const
get the subdetector
const TrackExtraRef & extra() const
reference to "extra" object
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
void localToGlobal(unsigned int id, const float *local, float *global) const
const_iterator find(id_type i) const
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
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
const_iterator end() const
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
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.