9 #include "TEveTrackPropagator.h"
10 #include "TEveStraightLineSet.h"
11 #include "TEveVSDStructs.h"
12 #include "TEveGeoNode.h"
57 static const double MICRON = 1./1000./10.;
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 )
293 Float_t topology = pars[0];
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 if( hit2D->cluster().isNonnull())
368 cluster = hit2D->cluster().get();
370 else if( hit2D->cluster_regional().isNonnull())
372 cluster = hit2D->cluster_regional().get();
381 if(
const SiStripRecHit1D* hit1D = dynamic_cast<const SiStripRecHit1D*>( rechit ))
385 if( hit1D->cluster().isNonnull())
387 cluster = hit1D->cluster().get();
389 else if( hit1D->cluster_regional().isNonnull())
391 cluster = hit1D->cluster_regional().get();
409 if( addNearbyClusters )
413 if(
typeid( **it ) ==
typeid( SiStripRecHit2D ))
415 const SiStripRecHit2D &
hit =
static_cast<const SiStripRecHit2D &
>( **it );
416 if( hit.cluster().isNonnull() && hit.cluster().isAvailable())
418 allClusters = hit.cluster().product();
422 else if(
typeid( **it ) ==
typeid( SiStripRecHit1D ))
424 const SiStripRecHit1D &
hit =
static_cast<const SiStripRecHit1D &
>( **it );
425 if( hit.cluster().isNonnull() && hit.cluster().isAvailable())
427 allClusters = hit.cluster().product();
436 unsigned int rawid = (*it)->geographicalId();
440 <<
"failed to get geometry of SiStripCluster with detid: "
441 << rawid << std::endl;
455 if( allClusters != 0 )
462 TEveStraightLineSet *scposition =
new TEveStraightLineSet;
463 scposition->SetDepthTest(
false );
464 scposition->SetPickable( kTRUE );
466 short firststrip = itc->firstStrip();
468 if( &*itc == cluster )
470 scposition->SetTitle( Form(
"Exact SiStripCluster from TrackingRecHit, first strip %d", firststrip ));
471 scposition->SetLineColor( kGreen );
475 scposition->SetTitle( Form(
"SiStripCluster, first strip %d", firststrip ));
476 scposition->SetLineColor( kRed );
479 float localTop[3] = { 0.0, 0.0, 0.0 };
480 float localBottom[3] = { 0.0, 0.0, 0.0 };
485 float globalBottom[3];
486 geom->
localToGlobal( rawid, localTop, globalTop, localBottom, globalBottom );
488 scposition->AddLine( globalTop[0], globalTop[1], globalTop[2],
489 globalBottom[0], globalBottom[1], globalBottom[2] );
497 TEveStraightLineSet *scposition =
new TEveStraightLineSet;
498 scposition->SetDepthTest(
false );
499 scposition->SetPickable( kTRUE );
500 scposition->SetTitle( Form(
"SiStripCluster, first strip %d", firststrip ));
502 float localTop[3] = { 0.0, 0.0, 0.0 };
503 float localBottom[3] = { 0.0, 0.0, 0.0 };
508 float globalBottom[3];
509 geom->
localToGlobal( rawid, localTop, globalTop, localBottom, globalBottom );
511 scposition->AddLine( globalTop[0], globalTop[1], globalTop[2],
512 globalBottom[0], globalBottom[1], globalBottom[2] );
517 else if( !rechit->
isValid() && ( rawid != 0 ))
519 if( allClusters != 0 )
522 if( itds != allClusters->
end())
527 short firststrip = itc->firstStrip();
529 TEveStraightLineSet *scposition =
new TEveStraightLineSet;
530 scposition->SetDepthTest(
false );
531 scposition->SetPickable( kTRUE );
532 scposition->SetTitle( Form(
"Lost SiStripCluster, first strip %d", firststrip ));
534 float localTop[3] = { 0.0, 0.0, 0.0 };
535 float localBottom[3] = { 0.0, 0.0, 0.0 };
540 float globalBottom[3];
541 geom->
localToGlobal( rawid, localTop, globalTop, localBottom, globalBottom );
543 scposition->AddLine( globalTop[0], globalTop[1], globalTop[2],
544 globalBottom[0], globalBottom[1], globalBottom[2] );
548 scposition->SetLineColor( kRed );
556 <<
"*ANOTHER* option possible: valid=" << rechit->
isValid()
557 <<
", rawid=" << rawid << std::endl;
573 if( hit.cluster().isNonnull() && hit.cluster().isAvailable())
575 allClusters = hit.cluster().product();
580 if( allClusters == 0 )
return;
588 DetId id = (*it)->geographicalId();
592 <<
"failed to get geometry of Tracker Det with raw id: "
593 <<
id.rawId() << std::endl;
599 unsigned int subdet = (
unsigned int)
id.subdetId();
603 if(
const SiPixelRecHit* pixel = dynamic_cast<const SiPixelRecHit*>( rh ))
604 hitCluster = pixel->cluster().get();
606 if( itds != allClusters->
end())
611 if( &*itc != hitCluster )
630 double etaT = t.
eta();
640 DetId id = (*it)->geographicalId();
644 <<
"failed to get geometry of Tracker Det with raw id: "
645 <<
id.rawId() << std::endl;
651 unsigned int subdet = (
unsigned int)
id.subdetId();
658 if(
const SiPixelRecHit* pixel = dynamic_cast<const SiPixelRecHit*>( rh ))
675 int nrows = (int)pars[0];
676 int ncols = (int)pars[1];
681 <<
", row: " << row <<
", col: " << col
682 <<
", lx: " << lx <<
", ly: " << ly ;
684 float local[3] = { lx, ly, 0. };
687 TVector3 pb( global[0], global[1], global[2] );
688 pixelPoints.push_back( pb );
694 <<
" eta: " << pb.Eta()
695 <<
", phi: " << pb.Phi()
696 <<
" rho: " << pb.Pt() << std::endl;
703 std::ostringstream oss;
705 oss <<
"DetId: " <<
id.rawId() <<
"\n";
707 switch (
id.det() ) {
710 switch (
id.subdetId() ) {
745 switch (
id.subdetId() ) {
749 oss <<
"DT chamber (wheel, station, sector): "
750 << detId.
wheel() <<
", "
758 oss <<
"CSC chamber (endcap, station, ring, chamber, layer): "
761 << detId.
ring() <<
", "
769 oss <<
"RPC chamber ";
770 switch ( detId.
region() ) {
772 oss <<
"/ barrel / (wheel, station, sector, layer, subsector, roll): "
773 << detId.
ring() <<
", "
776 << detId.
layer() <<
", "
781 oss <<
"/ forward endcap / (wheel, station, sector, layer, subsector, roll): "
782 << detId.
ring() <<
", "
785 << detId.
layer() <<
", "
790 oss <<
"/ backward endcap / (wheel, station, sector, layer, subsector, roll): "
791 << detId.
ring() <<
", "
794 << detId.
layer() <<
", "
807 oss <<
"CaloTower (ieta, iphi): "
808 << detId.
ieta() <<
", "
814 switch (
id.subdetId() ) {
818 oss <<
"EcalBarrel (ieta, iphi, tower_ieta, tower_iphi): "
819 << detId.
ieta() <<
", "
820 << detId.
iphi() <<
", "
828 oss <<
"EcalEndcap (ix, iy, SuperCrystal, crystal, quadrant): "
829 << detId.
ix() <<
", "
830 << detId.
iy() <<
", "
831 << detId.
isc() <<
", "
832 << detId.
ic() <<
", "
837 oss <<
"EcalPreshower";
840 oss <<
"EcalTriggerTower";
843 oss <<
"EcalLaserPnDiode";
851 switch ( detId.
subdet() ) {
856 oss <<
"HcalBarrel ";
859 oss <<
"HcalEndcap ";
865 oss <<
"HcalForward ";
868 oss <<
"HcalTriggerTower ";
874 oss <<
"(ieta, iphi, depth):"
875 << detId.
ieta() <<
", "
876 << detId.
iphi() <<
", "
886 info(
const std::set<DetId>& idSet) {
888 for(std::set<DetId>::const_iterator
id = idSet.begin(), idEnd = idSet.end();
id != idEnd; ++id)
897 info(
const std::vector<DetId>& idSet) {
899 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
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
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
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
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.