9 #include "TEveTrackPropagator.h" 10 #include "TEveStraightLineSet.h" 11 #include "TEveVSDStructs.h" 12 #include "TEveGeoNode.h" 63 static const double MICRON = 1./1000./1000.;
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) {
114 if( refStates[
i].valid )
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 );
132 if ( refStates[
i].valid )
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 static const int ROWS_PER_ROC = 80;
175 static const int BIG_PIX_PER_ROC_X = 1;
176 static const double PITCHX = 100*
MICRON;
181 xoffset = -( par[0] + BIG_PIX_PER_ROC_X * par[0] / ROWS_PER_ROC ) / 2. * PITCHX;
188 bool bigPixelsLayout = par[4];
190 int binoffx =
int(mpx);
191 double fractionX = mpx - binoffx;
192 double local_xpitch = xpitch;
194 if (bigPixelsLayout == 0) {
199 binoffx = binoffx + 2;
200 }
else if( binoffx == 80 ) {
202 local_xpitch = 2 * xpitch;
203 }
else if( binoffx == 79 ) {
204 binoffx = binoffx + 0;
205 local_xpitch = 2 * xpitch;
206 }
else if( binoffx >= 0 ) {
207 binoffx = binoffx + 0;
212 double lpX = double( binoffx * xpitch ) + fractionX * local_xpitch + xoffset;
228 static const double PITCHY = 150*
MICRON;
229 static const int BIG_PIX_PER_ROC_Y = 2;
230 static const int COLS_PER_ROC = 52;
235 yoffset = -( par[1] + BIG_PIX_PER_ROC_Y * par[1] / COLS_PER_ROC ) / 2. * PITCHY;
246 int binoffy =
int( mpy );
247 double fractionY = mpy - binoffy;
248 double local_pitchy = ypitch;
251 bool bigPixelsLayout = par[4];
252 if (bigPixelsLayout == 0) {
253 constexpr int bigYIndeces[]{0,51,52,103,104,155,156,207,208,259,260,311,312,363,364,415,416,511};
255 if (*
j==binoffy) local_pitchy *= 2 ;
256 binoffy += (
j-bigYIndeces);
260 double lpY = double( binoffy * ypitch ) + fractionY * local_pitchy + yoffset;
268 void localSiStrip(
short strip,
float* localTop,
float* localBottom,
const float* pars,
unsigned int id )
271 Float_t halfStripLength = pars[2] * 0.5;
273 Double_t localCenter[3] = { 0.0, 0.0, 0.0 };
274 localTop[1] = halfStripLength;
275 localBottom[1] = -halfStripLength;
281 Float_t stripAngle =
tan( pars[5] + strip * pars[6] );
282 Float_t
delta = halfStripLength * stripAngle;
283 localCenter[0] = pars[4] * stripAngle;
284 localTop[0] = localCenter[0] +
delta;
285 localBottom[0] = localCenter[0] -
delta;
287 else if( topology == 2 )
291 Float_t
offset = -pars[1] * 0.5 * pars[3];
292 localCenter[0] = strip * pars[3] +
offset;
293 localTop[0] = localCenter[0];
294 localBottom[0] = localCenter[0];
296 else if( topology == 3 )
299 <<
"did not expect TrapezoidalStripTopology of " 302 else if( pars[0] == 0 )
305 <<
"did not find StripTopology of " 317 el->CSCTakeAnyParentAsMaster();
318 el->SetPickable(
true);
323 el->CSCApplyMainColorToMatchingChildren();
324 el->CSCApplyMainTransparencyToMatchingChildren();
330 parent->AddElement(el);
339 if(
const SiStripRecHit2D* hit2D = dynamic_cast<const SiStripRecHit2D*>( rechit ))
343 cluster = hit2D->cluster().get();
347 if(
const SiStripRecHit1D* hit1D = dynamic_cast<const SiStripRecHit1D*>( rechit ))
351 cluster = hit1D->cluster().get();
364 if( addNearbyClusters )
375 allClusters = allClustersHandle.
product();
386 allClusters = allClustersHandle.
product();
395 unsigned int rawid = (*it)->geographicalId();
399 <<
"failed to get geometry of SiStripCluster with detid: " 400 << rawid << std::endl;
408 auto rechitRef = *it;
414 if( allClusters != 0 )
421 TEveStraightLineSet *scposition =
new TEveStraightLineSet;
422 scposition->SetDepthTest(
false );
423 scposition->SetPickable( kTRUE );
425 short firststrip = itc->firstStrip();
427 if( &*itc == cluster )
429 scposition->SetTitle( Form(
"Exact SiStripCluster from TrackingRecHit, first strip %d", firststrip ));
430 scposition->SetLineColor( kGreen );
434 scposition->SetTitle( Form(
"SiStripCluster, first strip %d", firststrip ));
435 scposition->SetLineColor( kRed );
438 float localTop[3] = { 0.0, 0.0, 0.0 };
439 float localBottom[3] = { 0.0, 0.0, 0.0 };
444 float globalBottom[3];
445 geom->
localToGlobal( rawid, localTop, globalTop, localBottom, globalBottom );
447 scposition->AddLine( globalTop[0], globalTop[1], globalTop[2],
448 globalBottom[0], globalBottom[1], globalBottom[2] );
456 TEveStraightLineSet *scposition =
new TEveStraightLineSet;
457 scposition->SetDepthTest(
false );
458 scposition->SetPickable( kTRUE );
459 scposition->SetTitle( Form(
"SiStripCluster, first strip %d", firststrip ));
461 float localTop[3] = { 0.0, 0.0, 0.0 };
462 float localBottom[3] = { 0.0, 0.0, 0.0 };
467 float globalBottom[3];
468 geom->
localToGlobal( rawid, localTop, globalTop, localBottom, globalBottom );
470 scposition->AddLine( globalTop[0], globalTop[1], globalTop[2],
471 globalBottom[0], globalBottom[1], globalBottom[2] );
476 else if( !rechit->
isValid() && ( rawid != 0 ))
478 if( allClusters != 0 )
481 if( itds != allClusters->
end())
486 short firststrip = itc->firstStrip();
488 TEveStraightLineSet *scposition =
new TEveStraightLineSet;
489 scposition->SetDepthTest(
false );
490 scposition->SetPickable( kTRUE );
491 scposition->SetTitle( Form(
"Lost SiStripCluster, first strip %d", firststrip ));
493 float localTop[3] = { 0.0, 0.0, 0.0 };
494 float localBottom[3] = { 0.0, 0.0, 0.0 };
499 float globalBottom[3];
500 geom->
localToGlobal( rawid, localTop, globalTop, localBottom, globalBottom );
502 scposition->AddLine( globalTop[0], globalTop[1], globalTop[2],
503 globalBottom[0], globalBottom[1], globalBottom[2] );
507 scposition->SetLineColor( kRed );
515 <<
"*ANOTHER* option possible: valid=" << rechit->
isValid()
516 <<
", rawid=" << rawid << std::endl;
536 allClusters = allClustersHandle.
product();
541 if( allClusters == 0 )
return;
549 DetId id = (*it)->geographicalId();
553 <<
"failed to get geometry of Tracker Det with raw id: " 554 <<
id.rawId() << std::endl;
560 unsigned int subdet = (
unsigned int)
id.subdetId();
565 hitCluster =
pixel->cluster().get();
567 if( itds != allClusters->
end())
572 if( &*itc != hitCluster )
591 double etaT = t.
eta();
601 DetId id = (*it)->geographicalId();
605 <<
"failed to get geometry of Tracker Det with raw id: " 606 <<
id.rawId() << std::endl;
612 unsigned int subdet = (
unsigned int)
id.subdetId();
642 <<
", row: " << row <<
", col: " << col
643 <<
", lx: " << lx <<
", ly: " << ly ;
645 float local[3] = { lx, ly, 0. };
648 TVector3 pb( global[0], global[1], global[2] );
649 pixelPoints.push_back( pb );
655 <<
" eta: " << pb.Eta()
656 <<
", phi: " << pb.Phi()
657 <<
" rho: " << pb.Pt() << std::endl;
664 std::ostringstream oss;
666 oss <<
"DetId: " <<
id.rawId() <<
"\n";
668 switch (
id.det() ) {
671 switch (
id.subdetId() ) {
706 switch (
id.subdetId() ) {
710 oss <<
"DT chamber (wheel, station, sector): " 711 << detId.
wheel() <<
", " 719 oss <<
"CSC chamber (endcap, station, ring, chamber, layer): " 722 << detId.
ring() <<
", " 730 oss <<
"RPC chamber ";
731 switch ( detId.
region() ) {
733 oss <<
"/ barrel / (wheel, station, sector, layer, subsector, roll): " 734 << detId.
ring() <<
", " 737 << detId.
layer() <<
", " 742 oss <<
"/ forward endcap / (wheel, station, sector, layer, subsector, roll): " 743 << detId.
ring() <<
", " 746 << detId.
layer() <<
", " 751 oss <<
"/ backward endcap / (wheel, station, sector, layer, subsector, roll): " 752 << detId.
ring() <<
", " 755 << detId.
layer() <<
", " 765 oss <<
"GEM chamber (region, station, ring, chamber, layer): " 768 << detId.
ring() <<
", " 776 oss <<
"ME0 chamber (region, chamber, layer): " 788 oss <<
"CaloTower (ieta, iphi): " 789 << detId.
ieta() <<
", " 795 switch (
id.subdetId() ) {
799 oss <<
"EcalBarrel (ieta, iphi, tower_ieta, tower_iphi): " 800 << detId.
ieta() <<
", " 801 << detId.
iphi() <<
", " 809 oss <<
"EcalEndcap (ix, iy, SuperCrystal, crystal, quadrant): " 810 << detId.
ix() <<
", " 811 << detId.
iy() <<
", " 812 << detId.
isc() <<
", " 813 << detId.
ic() <<
", " 818 oss <<
"EcalPreshower";
821 oss <<
"EcalTriggerTower";
824 oss <<
"EcalLaserPnDiode";
832 switch ( detId.
subdet() ) {
837 oss <<
"HcalBarrel ";
840 oss <<
"HcalEndcap ";
846 oss <<
"HcalForward ";
849 oss <<
"HcalTriggerTower ";
855 oss <<
"(ieta, iphi, depth):" 856 << detId.
ieta() <<
", " 857 << detId.
iphi() <<
", " 867 info(
const std::set<DetId>& idSet) {
869 for(std::set<DetId>::const_iterator
id = idSet.begin(), idEnd = idSet.end();
id != idEnd; ++
id)
878 info(
const std::vector<DetId>& idSet) {
880 for(std::vector<DetId>::const_iterator
id = idSet.begin(), idEnd = idSet.end();
id != idEnd; ++
id)
ClusterRef cluster() const
Master< F > master(const F &f)
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 >())
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
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
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
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)
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.
float pixelLocalX(const double mpx, const float *)
static Context * getInstance()
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
float pixelLocalY(const double mpy, const float *)
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)
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.