606 bool cluster_was_successfully_split =
false;
610 std::vector<SimHitIdpr> associatedIdpr;
614 size_t splittableClusterSize = 0;
615 splittableClusterSize = associatedIdpr.size();
616 std::vector<uint8_t> amp = clust->
amplitudes();
617 int clusiz = amp.size();
618 associatedIdpr.clear();
624 if ( ( splittableClusterSize > 1 && amp.size() > 2 ) &&
625 ( (
int)ssdid.moduleGeometry() == 1 ||
626 (int)ssdid.moduleGeometry() == 2 ||
627 (int)ssdid.moduleGeometry() == 3 ||
628 (int)ssdid.moduleGeometry() == 4 ) )
634 int last = first + clusiz;
635 uint16_t rawAmpl = 0, currentAmpl = 0;
637 std::vector<uint16_t> tmp1, tmp2;
639 std::vector<int> firstStrip;
640 std::vector<bool> trackInStrip;
641 std::vector<unsigned int> trackID;
642 std::vector<float> trackFraction;
643 std::vector< std::vector<uint16_t> > trackAmp;
644 unsigned int currentChannel( 9999 );
645 unsigned int thisTrackID = 0;
652 linkiter != link_detset.
data.end(); linkiter++)
654 if ( (
int)(linkiter->channel()) >= first && (
int)(linkiter->channel()) < last )
656 int stripIdx = (int)linkiter->channel()-
first;
657 rawAmpl = (uint16_t)(amp[stripIdx]);
661 if ( linkiter->channel() != currentChannel )
666 for (
size_t i=0;
i<trackID.size(); ++
i)
668 if ( trackInStrip[
i] )
670 if ( ( thisAmpl=currentAmpl ) < 254 )
671 thisAmpl =
min( uint16_t(253),
max(uint16_t(0), (uint16_t)(currentAmpl*trackFraction[i]+0.5)) );
672 trackAmp[
i].push_back( thisAmpl );
675 trackFraction[
i] = 0;
676 trackInStrip[
i] =
false;
679 currentChannel = linkiter->channel();
680 currentAmpl = rawAmpl;
684 thisTrackID = linkiter->SimTrackId();
687 bool newTrack =
true;
688 int thisTrackIdx = 9999;
690 for (
size_t i=0; i<trackID.size(); ++
i)
692 if ( trackID[i] == thisTrackID )
701 trackInStrip.push_back(
false);
702 trackID.push_back(thisTrackID);
703 firstStrip.push_back(currentChannel);
704 std::vector<uint16_t> ampTmp;
705 trackAmp.push_back(ampTmp);
706 trackFraction.push_back(0);
707 thisTrackIdx = trackID.size()-1;
710 trackInStrip[thisTrackIdx] =
true;
711 trackFraction[thisTrackIdx] += linkiter->fraction();
712 currentAmpl = rawAmpl;
720 std::vector<SiStripCluster> newCluster;
724 for (
size_t i=0; i < trackID.size(); ++
i)
726 if ( trackInStrip[i] )
728 if ( ( thisAmpl=rawAmpl ) < 254 )
729 thisAmpl =
min(uint16_t(253),
max(uint16_t(0), (uint16_t)(rawAmpl*trackFraction[i]+0.5)));
732 trackAmp[
i].push_back( thisAmpl );
740 trackAmp[i].
end() ) );
745 for (
size_t i=0; i<newCluster.size(); ++
i )
749 float clusterAmp = 0.0;
750 for (
size_t j=0;
j<trackAmp[
i].size(); ++
j )
751 clusterAmp += (
float)(trackAmp[
i])[
j];
753 if ( clusterAmp > 0.0 && firstStrip[i] != 9999 && trackAmp[i].
size() > 0 )
763 cluster_was_successfully_split =
true;
782 if ( !cluster_was_successfully_split )
789 bool cluster_was_successfully_split =
false;
793 if ( theStripCluster )
801 if ( (
int)theStripCluster->
amplitudes().size() <= 1 ||
802 ( (int)ssdid.moduleGeometry() != 1 &&
803 (int)ssdid.moduleGeometry() != 2 &&
804 (int)ssdid.moduleGeometry() != 3 &&
805 (int)ssdid.moduleGeometry() != 4 ) )
822 int is_stereo = (int)( ssdid.stereo() );
824 if ( ssdid.moduleGeometry() == 1 )
831 else if ( ssdid.moduleGeometry() == 2 )
835 else if ( ssdid.moduleGeometry() == 3 )
839 else if ( ssdid.moduleGeometry() == 4 )
849 <<
"\nERROR: Wrong strip teplate ID. Should only use templates for IB1, IB2, OB1 and OB2 !!!" <<
"\n\n";
857 float cotalpha_ = -99999.9;
858 float cotbeta_ = -99999.9;
864 float xcenter = theStripCluster->
barycenter();
872 <<
"\nERROR: Wrong stripDet !!! " <<
"\n\n";
892 float gp_mod =
sqrt( gp.x()*gp.x() + gp.y()*gp.y() + gp.z()*gp.z() );
893 float gpx = gp.x()/gp_mod;
894 float gpy = gp.y()/gp_mod;
895 float gpz = gp.z()/gp_mod;
907 float gv_dot_gvx = gv.
x()*gvx.
x() + gv.y()*gvx.
y() + gv.z()*gvx.
z();
908 float gv_dot_gvy = gv.x()*gvy.
x() + gv.y()*gvy.
y() + gv.z()*gvy.
z();
909 float gv_dot_gvz = gv.x()*gvz.
x() + gv.y()*gvz.
y() + gv.z()*gvz.
z();
915 cotalpha_ = gv_dot_gvx / gv_dot_gvz;
916 cotbeta_ = gv_dot_gvy / gv_dot_gvz;
928 std::vector<TrackAndState> vec_tracks_states =
c.tracks;
930 if ( (
int)vec_tracks_states.size() > 0 )
935 int index_max_pt = -99999;
936 float max_pt = -99999.9;
938 for (
int i=0; i<(int)vec_tracks_states.size(); ++
i )
940 const reco::Track* one_track = vec_tracks_states[
i].track;
942 if ( one_track->
pt() > max_pt )
945 max_pt = one_track->
pt();
957 float locx = localDir.
x();
958 float locy = localDir.
y();
959 float locz = localDir.
z();
964 cotalpha_ = locx/locz;
965 cotbeta_ = locy/locz;
980 float strip_cluster_charge = 0.0;
981 std::vector<float> vec_cluster_charge;
982 vec_cluster_charge.clear();
983 int cluster_size = (int)( (theStripCluster->
amplitudes()).
size() );
985 int cluster_charge = 0;
986 for (
int i=0; i<cluster_size; ++
i)
988 float current_strip_charge = (float)( (theStripCluster->
amplitudes())[i] );
990 strip_cluster_charge += current_strip_charge;
991 vec_cluster_charge.push_back( current_strip_charge );
993 cluster_charge +=current_strip_charge;
1000 int strip_templQbin_ = strip_templ_.qbin( ID, cotalpha_, cotbeta_, strip_cluster_charge );
1002 if ( strip_templQbin_ < 0 || strip_templQbin_ > 5 )
1009 if ( strip_templQbin_ != 0 )
1022 uint16_t first_strip = theStripCluster->
firstStrip();
1025 float locBy = lbfield.
y();
1028 float stripTemplXrec1_ = -99999.9;
1029 float stripTemplXrec2_ = -99999.9;
1030 float stripTemplSigmaX_ = -99999.9;
1031 float stripTemplProbX_ = -99999.9;
1032 int stripTemplQbin_ = -99999;
1033 float stripTemplProbQ_ = -99999.9;
1053 cotalpha_, cotbeta_,
1066 stripTemplXrec1_ += 2*strip_templ_.xsize();
1067 stripTemplXrec2_ += 2*strip_templ_.xsize();
1084 cluster_was_successfully_split =
true;
1086 std::vector<float> strip_cluster1;
1087 std::vector<float> strip_cluster2;
1089 strip_cluster1.clear();
1090 strip_cluster2.clear();
1095 strip_cluster1.push_back(0.0);
1096 strip_cluster2.push_back(0.0);
1102 strip_templ_.interpolate(ID, cotalpha_, cotbeta_, locBy);
1103 strip_templ_.sxtemp(stripTemplXrec1_, strip_cluster1);
1104 strip_templ_.sxtemp(stripTemplXrec2_, strip_cluster2);
1108 vector<SiStripDigi> vecSiStripDigi1;
1109 vecSiStripDigi1.clear();
1110 int strip_cluster1_size = (int)strip_cluster1.size();
1111 for (
int i=2; i<strip_cluster1_size; ++
i)
1113 if ( strip_cluster1[i] > 0.0 )
1115 SiStripDigi current_digi1( first_strip + i-2, strip_cluster1[i] );
1117 vecSiStripDigi1.push_back( current_digi1 );
1123 vector<SiStripDigi> vecSiStripDigi2;
1124 vecSiStripDigi2.clear();
1125 int strip_cluster2_size = (int)strip_cluster2.size();
1126 for (
int i=2; i<strip_cluster2_size; ++
i)
1128 if ( strip_cluster2[i] > 0.0 )
1130 SiStripDigi current_digi2( first_strip + i-2, strip_cluster2[i] );
1132 vecSiStripDigi2.push_back( current_digi2 );
1139 std::vector<SiStripDigi>::const_iterator SiStripDigiIterBegin1 = vecSiStripDigi1.begin();
1140 std::vector<SiStripDigi>::const_iterator SiStripDigiIterEnd1 = vecSiStripDigi1.end();
1141 std::pair<std::vector<SiStripDigi>::const_iterator,
1142 std::vector<SiStripDigi>::const_iterator> SiStripDigiRange1
1143 = make_pair(SiStripDigiIterBegin1, SiStripDigiIterEnd1);
1151 std::vector<SiStripDigi>::const_iterator SiStripDigiIterBegin2 = vecSiStripDigi2.begin();
1152 std::vector<SiStripDigi>::const_iterator SiStripDigiIterEnd2 = vecSiStripDigi2.end();
1153 std::pair<std::vector<SiStripDigi>::const_iterator,
1154 std::vector<SiStripDigi>::const_iterator> SiStripDigiRange2
1155 = make_pair(SiStripDigiIterBegin2, SiStripDigiIterEnd2);
1167 if ( SiStripDigiIterBegin1 != SiStripDigiIterEnd1 )
1172 cl1.setSplitClusterError( stripTemplSigmaX_ );
1176 if ( (
int)cl1.amplitudes().size() <= 0 )
1179 <<
"\nERROR: (1) Wrong split cluster of size = " << (int)cl1.amplitudes().size() <<
"\n\n";
1184 if ( SiStripDigiIterBegin2 != SiStripDigiIterEnd2 )
1188 cl2.setSplitClusterError( stripTemplSigmaX_ );
1191 if ( (
int)
cl2.amplitudes().size() <= 0 )
1194 <<
"\nERROR: (2) Wrong split cluster of size = " << (int)
cl2.amplitudes().size() <<
"\n\n";
1210 if ( !cluster_was_successfully_split )
1217 <<
"\nERROR: This is not a SiStripCluster !!!" <<
"\n\n";
GlobalPoint toGlobal(const Point2DBase< Scalar, LocalTag > lp) const
void push_back(data_type const &d)
const LocalTrajectoryParameters & localParameters() const
void associateSimpleRecHitCluster(const SiStripCluster *clust, const uint32_t &detID, std::vector< SimHitIdpr > &simtrackid) const
uint16_t firstStrip() const
LocalVector toLocal(const reco::Track::Vector &v, const Surface &s)
virtual const StripTopology & specificTopology() const
Returns a reference to the strip proxy topology.
const Plane & surface() const
The nominal surface of the GeomDet.
uint32_t rawId() const
get the raw id
edm::ESHandle< MagneticField > magfield_
double pt() const
track transverse momentum
edm::ESHandle< GlobalTrackingGeometry > geometry_
LocalVector momentum() const
Momentum vector in the local frame.
A Digi for the silicon strip detector, containing both strip and adc information, and suitable for st...
TrackerHitAssociator * hitAssociator
edm::Handle< edm::DetSetVector< StripDigiSimLink > > stripdigisimlink
Detector identifier class for the strip tracker.
std::vector< SiStripTemplateStore > theStripTemp_
int StripTempSplit(int id, float cotalpha, float cotbeta, float locBy, int speed, std::vector< float > &cluster, SiStripTemplate &templ, float &xrec1, float &xrec2, float &sigmax, float &prob2x, int &q2bin, float &prob2Q)
virtual LocalPoint localPosition(float strip) const =0
collection_type::const_iterator const_iterator
collection_type::const_iterator const_iterator
const PositionType & position() const
tuple size
Write out results.
const std::vector< uint8_t > & amplitudes() const