9 #include "TEveTrackPropagator.h"
10 #include "TEveStraightLineSet.h"
11 #include "TEveVSDStructs.h"
12 #include "TEveGeoNode.h"
63 static const double MICRON = 1./1000./10.;
77 const std::vector<TEveVector>& extraRefPoints )
82 std::vector<State> refStates;
84 refStates.push_back(
State(TEveVector(track.
vx(), track.
vy(), track.
vz()),
90 refStates.push_back(
State(TEveVector(v.x(), v.y(), v.z()), TEveVector(p.x(), p.y(), p.z())));
95 refStates.push_back(
State(TEveVector(v.x(), v.y(), v.z()), TEveVector(p.x(), p.y(), p.z())));
98 for( std::vector<TEveVector>::const_iterator
point = extraRefPoints.begin(), pointEnd = extraRefPoints.end();
115 if( refStates.front().valid ) {
116 t.fV = refStates.front().position;
117 t.fP = refStates.front().momentum;
118 TEveTrack* trk =
new TEveTrack( &t, propagator );
119 for(
unsigned int i(1);
i<refStates.size()-1; ++
i) {
120 if( refStates[
i].valid )
121 trk->AddPathMark( TEvePathMark( TEvePathMark::kReference, refStates[
i].
position, refStates[
i].momentum ) );
123 trk->AddPathMark( TEvePathMark( TEvePathMark::kDaughter, refStates[
i].position ) );
125 if( refStates.size()>1 ) {
126 trk->AddPathMark( TEvePathMark( TEvePathMark::kDecay, refStates.back().position ) );
131 if( refStates.back().valid ) {
132 t.fSign = (-1)*track.
charge();
133 t.fV = refStates.back().position;
134 t.fP = refStates.back().momentum * (-1.0f);
135 TEveTrack* trk =
new TEveTrack( &t, propagator );
136 unsigned int i( refStates.size()-1 );
138 if ( refStates[
i].valid )
139 trk->AddPathMark( TEvePathMark( TEvePathMark::kReference, refStates[
i].
position, refStates[
i].momentum*(-1.0
f) ) );
141 trk->AddPathMark( TEvePathMark( TEvePathMark::kDaughter, refStates[
i].position ) );
143 if ( refStates.size()>1 ) {
144 trk->AddPathMark( TEvePathMark( TEvePathMark::kDecay, refStates.front().position ) );
150 while( i<refStates.size() && !refStates[
i].valid ) ++i;
151 assert( i < refStates.size() );
153 t.fV = refStates[
i].position;
154 t.fP = refStates[
i].momentum;
155 TEveTrack* trk =
new TEveTrack( &t, propagator );
156 for(
unsigned int j(i+1);
j<refStates.size()-1; ++
j ) {
157 if( refStates[i].valid )
158 trk->AddPathMark( TEvePathMark( TEvePathMark::kReference, refStates[i].
position, refStates[i].momentum ) );
160 trk->AddPathMark( TEvePathMark( TEvePathMark::kDaughter, refStates[i].position ) );
162 if ( i < refStates.size() ) {
163 trk->AddPathMark( TEvePathMark( TEvePathMark::kDecay, refStates.back().position ) );
180 int binoffx = int(mpx);
181 double fractionX = mpx - binoffx;
182 double local_PITCHX =
PITCHX;
184 binoffx = binoffx + 2;
185 }
else if( binoffx == 80 ) {
187 local_PITCHX = 2 *
PITCHX;
188 }
else if( binoffx == 79 ) {
189 binoffx = binoffx + 0;
190 local_PITCHX = 2 *
PITCHX;
191 }
else if( binoffx >= 0 ) {
192 binoffx = binoffx + 0;
196 double lpX = double( binoffx *
PITCHX ) + fractionX * local_PITCHX + xoffset;
213 int binoffy = int( mpy );
214 double fractionY = mpy - binoffy;
215 double local_PITCHY =
PITCHY;
218 binoffy = binoffy+17;
219 }
else if( binoffy == 416 ) {
220 binoffy = binoffy + 16;
221 local_PITCHY = 2 *
PITCHY;
222 }
else if( binoffy == 415 ) {
223 binoffy = binoffy + 15;
224 local_PITCHY = 2 *
PITCHY;
225 }
else if( binoffy > 364 ) {
226 binoffy = binoffy + 15;
227 }
else if( binoffy == 364 ) {
228 binoffy = binoffy + 14;
229 local_PITCHY = 2 *
PITCHY;
230 }
else if( binoffy == 363 ) {
231 binoffy = binoffy + 13;
232 local_PITCHY = 2 *
PITCHY;
233 }
else if( binoffy > 312 ) {
234 binoffy = binoffy + 13;
235 }
else if( binoffy == 312 ) {
236 binoffy = binoffy + 12;
237 local_PITCHY = 2 *
PITCHY;
238 }
else if( binoffy == 311 ) {
239 binoffy = binoffy + 11;
240 local_PITCHY = 2 *
PITCHY;
241 }
else if( binoffy > 260 ) {
242 binoffy = binoffy + 11;
243 }
else if( binoffy == 260 ) {
244 binoffy = binoffy + 10;
245 local_PITCHY = 2 *
PITCHY;
246 }
else if( binoffy == 259 ) {
247 binoffy = binoffy + 9;
248 local_PITCHY = 2 *
PITCHY;
249 }
else if( binoffy > 208 ) {
250 binoffy = binoffy + 9;
251 }
else if(binoffy == 208 ) {
252 binoffy = binoffy + 8;
253 local_PITCHY = 2 *
PITCHY;
254 }
else if( binoffy == 207 ) {
255 binoffy = binoffy + 7;
256 local_PITCHY = 2 *
PITCHY;
257 }
else if( binoffy > 156 ) {
258 binoffy = binoffy + 7;
259 }
else if( binoffy == 156 ) {
260 binoffy = binoffy + 6;
261 local_PITCHY = 2 *
PITCHY;
262 }
else if( binoffy == 155 ) {
263 binoffy = binoffy + 5;
264 local_PITCHY = 2 *
PITCHY;
265 }
else if( binoffy > 104 ) {
266 binoffy = binoffy + 5;
267 }
else if( binoffy == 104 ) {
268 binoffy = binoffy + 4;
269 local_PITCHY = 2 *
PITCHY;
270 }
else if( binoffy == 103 ) {
271 binoffy = binoffy + 3;
272 local_PITCHY = 2 *
PITCHY;
273 }
else if( binoffy > 52 ) {
274 binoffy = binoffy + 3;
275 }
else if( binoffy == 52 ) {
276 binoffy = binoffy + 2;
277 local_PITCHY = 2 *
PITCHY;
278 }
else if( binoffy == 51 ) {
279 binoffy = binoffy + 1;
280 local_PITCHY = 2 *
PITCHY;
281 }
else if( binoffy > 0 ) {
283 }
else if( binoffy == 0 ) {
284 binoffy = binoffy + 0;
285 local_PITCHY = 2 *
PITCHY;
289 double lpY = double( binoffy *
PITCHY ) + fractionY * local_PITCHY + yoffset;
297 void localSiStrip(
short strip,
float* localTop,
float* localBottom,
const float* pars,
unsigned int id )
300 Float_t halfStripLength = pars[2] * 0.5;
302 Double_t localCenter[3] = { 0.0, 0.0, 0.0 };
303 localTop[1] = halfStripLength;
304 localBottom[1] = -halfStripLength;
310 Float_t stripAngle =
tan( pars[5] + strip * pars[6] );
311 Float_t
delta = halfStripLength * stripAngle;
312 localCenter[0] = pars[4] * stripAngle;
313 localTop[0] = localCenter[0] +
delta;
314 localBottom[0] = localCenter[0] -
delta;
316 else if( topology == 2 )
320 Float_t
offset = -pars[1] * 0.5 * pars[3];
321 localCenter[0] = strip * pars[3] +
offset;
322 localTop[0] = localCenter[0];
323 localBottom[0] = localCenter[0];
325 else if( topology == 3 )
328 <<
"did not expect TrapezoidalStripTopology of "
331 else if( pars[0] == 0 )
334 <<
"did not find StripTopology of "
346 el->CSCTakeAnyParentAsMaster();
347 el->SetPickable(
true);
352 el->CSCApplyMainColorToMatchingChildren();
353 el->CSCApplyMainTransparencyToMatchingChildren();
359 parent->AddElement(el);
368 if(
const SiStripRecHit2D* hit2D = dynamic_cast<const SiStripRecHit2D*>( rechit ))
372 cluster = hit2D->cluster().get();
376 if(
const SiStripRecHit1D* hit1D = dynamic_cast<const SiStripRecHit1D*>( rechit ))
380 cluster = hit1D->cluster().get();
393 if( addNearbyClusters )
404 allClusters = allClustersHandle.
product();
415 allClusters = allClustersHandle.
product();
424 unsigned int rawid = (*it)->geographicalId();
428 <<
"failed to get geometry of SiStripCluster with detid: "
429 << rawid << std::endl;
437 auto rechitRef = *it;
443 if( allClusters != 0 )
450 TEveStraightLineSet *scposition =
new TEveStraightLineSet;
451 scposition->SetDepthTest(
false );
452 scposition->SetPickable( kTRUE );
454 short firststrip = itc->firstStrip();
456 if( &*itc == cluster )
458 scposition->SetTitle( Form(
"Exact SiStripCluster from TrackingRecHit, first strip %d", firststrip ));
459 scposition->SetLineColor( kGreen );
463 scposition->SetTitle( Form(
"SiStripCluster, first strip %d", firststrip ));
464 scposition->SetLineColor( kRed );
467 float localTop[3] = { 0.0, 0.0, 0.0 };
468 float localBottom[3] = { 0.0, 0.0, 0.0 };
473 float globalBottom[3];
474 geom->
localToGlobal( rawid, localTop, globalTop, localBottom, globalBottom );
476 scposition->AddLine( globalTop[0], globalTop[1], globalTop[2],
477 globalBottom[0], globalBottom[1], globalBottom[2] );
485 TEveStraightLineSet *scposition =
new TEveStraightLineSet;
486 scposition->SetDepthTest(
false );
487 scposition->SetPickable( kTRUE );
488 scposition->SetTitle( Form(
"SiStripCluster, first strip %d", firststrip ));
490 float localTop[3] = { 0.0, 0.0, 0.0 };
491 float localBottom[3] = { 0.0, 0.0, 0.0 };
496 float globalBottom[3];
497 geom->
localToGlobal( rawid, localTop, globalTop, localBottom, globalBottom );
499 scposition->AddLine( globalTop[0], globalTop[1], globalTop[2],
500 globalBottom[0], globalBottom[1], globalBottom[2] );
505 else if( !rechit->
isValid() && ( rawid != 0 ))
507 if( allClusters != 0 )
510 if( itds != allClusters->
end())
515 short firststrip = itc->firstStrip();
517 TEveStraightLineSet *scposition =
new TEveStraightLineSet;
518 scposition->SetDepthTest(
false );
519 scposition->SetPickable( kTRUE );
520 scposition->SetTitle( Form(
"Lost SiStripCluster, first strip %d", firststrip ));
522 float localTop[3] = { 0.0, 0.0, 0.0 };
523 float localBottom[3] = { 0.0, 0.0, 0.0 };
528 float globalBottom[3];
529 geom->
localToGlobal( rawid, localTop, globalTop, localBottom, globalBottom );
531 scposition->AddLine( globalTop[0], globalTop[1], globalTop[2],
532 globalBottom[0], globalBottom[1], globalBottom[2] );
536 scposition->SetLineColor( kRed );
544 <<
"*ANOTHER* option possible: valid=" << rechit->
isValid()
545 <<
", rawid=" << rawid << std::endl;
565 allClusters = allClustersHandle.
product();
570 if( allClusters == 0 )
return;
578 DetId id = (*it)->geographicalId();
582 <<
"failed to get geometry of Tracker Det with raw id: "
583 <<
id.rawId() << std::endl;
589 unsigned int subdet = (
unsigned int)
id.subdetId();
593 if(
const SiPixelRecHit* pixel = dynamic_cast<const SiPixelRecHit*>( rh ))
594 hitCluster = pixel->cluster().get();
596 if( itds != allClusters->
end())
601 if( &*itc != hitCluster )
620 double etaT = t.
eta();
630 DetId id = (*it)->geographicalId();
634 <<
"failed to get geometry of Tracker Det with raw id: "
635 <<
id.rawId() << std::endl;
641 unsigned int subdet = (
unsigned int)
id.subdetId();
648 if(
const SiPixelRecHit* pixel = dynamic_cast<const SiPixelRecHit*>( rh ))
665 int nrows = (int)pars[0];
666 int ncols = (int)pars[1];
671 <<
", row: " << row <<
", col: " << col
672 <<
", lx: " << lx <<
", ly: " << ly ;
674 float local[3] = { lx, ly, 0. };
677 TVector3 pb( global[0], global[1], global[2] );
678 pixelPoints.push_back( pb );
684 <<
" eta: " << pb.Eta()
685 <<
", phi: " << pb.Phi()
686 <<
" rho: " << pb.Pt() << std::endl;
693 std::ostringstream oss;
695 oss <<
"DetId: " <<
id.rawId() <<
"\n";
697 switch (
id.det() ) {
700 switch (
id.subdetId() ) {
735 switch (
id.subdetId() ) {
739 oss <<
"DT chamber (wheel, station, sector): "
740 << detId.
wheel() <<
", "
748 oss <<
"CSC chamber (endcap, station, ring, chamber, layer): "
751 << detId.
ring() <<
", "
759 oss <<
"RPC chamber ";
760 switch ( detId.
region() ) {
762 oss <<
"/ barrel / (wheel, station, sector, layer, subsector, roll): "
763 << detId.
ring() <<
", "
766 << detId.
layer() <<
", "
771 oss <<
"/ forward endcap / (wheel, station, sector, layer, subsector, roll): "
772 << detId.
ring() <<
", "
775 << detId.
layer() <<
", "
780 oss <<
"/ backward endcap / (wheel, station, sector, layer, subsector, roll): "
781 << detId.
ring() <<
", "
784 << detId.
layer() <<
", "
794 oss <<
"GEM chamber (region, station, ring, chamber, layer): "
797 << detId.
ring() <<
", "
805 oss <<
"ME0 chamber (region, chamber, layer): "
817 oss <<
"CaloTower (ieta, iphi): "
818 << detId.
ieta() <<
", "
824 switch (
id.subdetId() ) {
828 oss <<
"EcalBarrel (ieta, iphi, tower_ieta, tower_iphi): "
829 << detId.
ieta() <<
", "
830 << detId.
iphi() <<
", "
838 oss <<
"EcalEndcap (ix, iy, SuperCrystal, crystal, quadrant): "
839 << detId.
ix() <<
", "
840 << detId.
iy() <<
", "
841 << detId.
isc() <<
", "
842 << detId.
ic() <<
", "
847 oss <<
"EcalPreshower";
850 oss <<
"EcalTriggerTower";
853 oss <<
"EcalLaserPnDiode";
861 switch ( detId.
subdet() ) {
866 oss <<
"HcalBarrel ";
869 oss <<
"HcalEndcap ";
875 oss <<
"HcalForward ";
878 oss <<
"HcalTriggerTower ";
884 oss <<
"(ieta, iphi, depth):"
885 << detId.
ieta() <<
", "
886 << detId.
iphi() <<
", "
896 info(
const std::set<DetId>& idSet) {
898 for(std::set<DetId>::const_iterator
id = idSet.begin(), idEnd = idSet.end();
id != idEnd; ++id)
907 info(
const std::vector<DetId>& idSet) {
909 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
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
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
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)
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.
int region() const
Region id: 0 for Barrel Not in use, +/-1 For +/- Endcap.
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
int region() const
Region id: 0 for Barrel Not in use, +/-1 For +/- Endcap.
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
int layer() const
Layer id: each chamber has six layers of chambers: layer 1 is the inner layer and layer 6 is the oute...
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.