15 const vector<TrajectoryMeasurement> & measurements = trajectory->measurements();
16 for(vector<TrajectoryMeasurement>::const_iterator it = measurements.begin(); it!=measurements.end(); it++){
20 if( !trajState.
isValid())
continue;
25 double cosine = trackDirection.
z()/trackDirection.mag();
27 if(
const SiStripMatchedRecHit2D* matchedHit=dynamic_cast<const SiStripMatchedRecHit2D*>(recHit)){
28 if(!useStrip)
continue;
35 const std::vector<uint8_t> & amplitudes = matchedHit->monoCluster().amplitudes();
36 mono.
charge = accumulate(amplitudes.begin(), amplitudes.end(), 0);
38 for(
unsigned int i=0;
i<amplitudes.size();
i++){
if(amplitudes[
i]>=254)mono.
NSaturating++;}
40 const std::vector<uint8_t> & amplitudesSt = matchedHit->stereoCluster().amplitudes();
41 stereo.
charge = accumulate(amplitudesSt.begin(), amplitudesSt.end(), 0);
43 for(
unsigned int i=0;
i<amplitudes.size();
i++){
if(amplitudes[
i]>=254)stereo.
NSaturating++;}
45 mono.
detId= matchedHit->monoId();
46 stereo.
detId= matchedHit->stereoId();
49 hits.push_back(stereo);
52 if(!useStrip)
continue;
54 const SiStripRecHit2D* singleHit=&(projectedHit->originalHit());
60 const std::vector<uint8_t> & amplitudes = singleHit->cluster()->amplitudes();
61 mono.
charge = accumulate(amplitudes.begin(), amplitudes.end(), 0);
63 for(
unsigned int i=0;
i<amplitudes.size();
i++){
if(amplitudes[
i]>=254)mono.
NSaturating++;}
65 mono.
detId= singleHit->geographicalId();
68 }
else if(
const SiStripRecHit2D* singleHit=dynamic_cast<const SiStripRecHit2D*>(recHit)){
69 if(!useStrip)
continue;
76 const std::vector<uint8_t> & amplitudes = singleHit->cluster()->amplitudes();
77 mono.
charge = accumulate(amplitudes.begin(), amplitudes.end(), 0);
79 for(
unsigned int i=0;
i<amplitudes.size();
i++){
if(amplitudes[
i]>=254)mono.
NSaturating++;}
81 mono.
detId= singleHit->geographicalId();
84 }
else if(
const SiStripRecHit1D* single1DHit=dynamic_cast<const SiStripRecHit1D*>(recHit)){
85 if(!useStrip)
continue;
92 const std::vector<uint8_t> & amplitudes = single1DHit->cluster()->amplitudes();
93 mono.
charge = accumulate(amplitudes.begin(), amplitudes.end(), 0);
95 for(
unsigned int i=0;
i<amplitudes.size();
i++){
if(amplitudes[
i]>=254)mono.
NSaturating++;}
97 mono.
detId= single1DHit->geographicalId();
101 }
else if(
const SiPixelRecHit* pixelHit=dynamic_cast<const SiPixelRecHit*>(recHit)){
102 if(!usePixel)
continue;
109 pixel.
charge = pixelHit->cluster()->charge();
111 pixel.
detId= pixelHit->geographicalId();
112 hits.push_back(pixel);
125 size_t n = hits.size();
126 for(
size_t i = 0;
i<
n;
i ++)
130 return (n>0)?
pow(result/n,1./expo):0.;
139 Int_t NofMax=0; Int_t recur255=1; Int_t recur254=1;
140 bool MaxOnStart=
false;
bool MaxInMiddle=
false, MaxOnEnd =
false;
143 if(ampls.size()!=1 && ((ampls[0]>ampls[1])
144 || (ampls.size()>2 && ampls[0]==ampls[1] && ampls[1]>ampls[2] && ampls[0]!=254 && ampls[0]!=255)
145 || (ampls.size()==2 && ampls[0]==ampls[1] && ampls[0]!=254 && ampls[0]!=255)) ){
146 NofMax=NofMax+1; MaxOnStart=
true; }
150 for (
unsigned int i =1;
i < ampls.size()-1;
i++) {
151 if( (ampls[
i]>ampls[
i-1] && ampls[
i]>ampls[
i+1])
152 || (ampls.size()>3 &&
i>0 &&
i<ampls.size()-2 && ampls[
i]==ampls[
i+1] && ampls[
i]>ampls[
i-1] && ampls[
i]>ampls[
i+2] && ampls[
i]!=254 && ampls[
i]!=255) ){
153 NofMax=NofMax+1; MaxInMiddle=
true; MaxPos=
i;
155 if(ampls[
i]==255 && ampls[
i]==ampls[
i-1]) {
157 MaxPos=
i-(recur255/2);
158 if(ampls[
i]>ampls[
i+1]){NofMax=NofMax+1;MaxInMiddle=
true;}
160 if(ampls[
i]==254 && ampls[
i]==ampls[
i-1]) {
162 MaxPos=
i-(recur254/2);
163 if(ampls[
i]>ampls[
i+1]){NofMax=NofMax+1;MaxInMiddle=
true;}
169 if(ampls[ampls.size()-1]>ampls[ampls.size()-2]
170 || (ampls.size()>2 && ampls[ampls.size()-1]==ampls[ampls.size()-2] && ampls[ampls.size()-2]>ampls[ampls.size()-3] )
171 || ampls[ampls.size()-1]==255){
172 NofMax=NofMax+1; MaxOnEnd=
true; }
175 if(ampls.size()==1){ NofMax=1;}
193 bool shapecdtn=
false;
196 Float_t C_M=0.0; Float_t C_D=0.0; Float_t C_Mn=10000; Float_t C_Dn=10000; Float_t C_Mnn=10000; Float_t C_Dnn=10000;
198 Float_t coeff1=1.7; Float_t coeff2=2.0;
199 Float_t coeffn=0.10; Float_t coeffnn=0.02; Float_t noise=4.0;
203 if(MaxOnStart==
true){
204 C_M=(Float_t)ampls[0]; C_D=(Float_t)ampls[1];
205 if(ampls.size()<3) shapecdtn=
true ;
206 else if(ampls.size()==3){C_Dn=(Float_t)ampls[2] ;
if(C_Dn<=coeff1*coeffn*C_D+coeff2*coeffnn*C_M+2*noise || C_D==255) shapecdtn=
true;}
207 else if(ampls.size()>3){ C_Dn=(Float_t)ampls[2]; C_Dnn=(Float_t)ampls[3] ;
208 if((C_Dn<=coeff1*coeffn*C_D+coeff2*coeffnn*C_M+2*noise || C_D==255)
209 && C_Dnn<=coeff1*coeffn*C_Dn+coeff2*coeffnn*C_D+2*noise){
215 C_M=(Float_t)ampls[ampls.size()-1]; C_D=(Float_t)ampls[ampls.size()-2];
216 if(ampls.size()<3) shapecdtn=
true ;
217 else if(ampls.size()==3){C_Dn=(Float_t)ampls[0] ;
if(C_Dn<=coeff1*coeffn*C_D+coeff2*coeffnn*C_M+2*noise || C_D==255) shapecdtn=
true;}
218 else if(ampls.size()>3){C_Dn=(Float_t)ampls[ampls.size()-3] ; C_Dnn=(Float_t)ampls[ampls.size()-4] ;
219 if((C_Dn<=coeff1*coeffn*C_D+coeff2*coeffnn*C_M+2*noise || C_D==255)
220 && C_Dnn<=coeff1*coeffn*C_Dn+coeff2*coeffnn*C_D+2*noise){
225 if(MaxInMiddle==
true){
226 C_M=(Float_t)ampls[MaxPos];
227 int LeftOfMaxPos=MaxPos-1;
if(LeftOfMaxPos<=0)LeftOfMaxPos=0;
228 int RightOfMaxPos=MaxPos+1;
if(RightOfMaxPos>=(
int)ampls.size())RightOfMaxPos=ampls.size()-1;
230 if(ampls[LeftOfMaxPos]<ampls[RightOfMaxPos]){ C_D=(Float_t)ampls[RightOfMaxPos]; C_Mn=(Float_t)ampls[LeftOfMaxPos];CDPos=RightOfMaxPos;}
else{ C_D=(Float_t)ampls[LeftOfMaxPos]; C_Mn=(Float_t)ampls[RightOfMaxPos];CDPos=LeftOfMaxPos;}
231 if(C_Mn<coeff1*coeffn*C_M+coeff2*coeffnn*C_D+2*noise || C_M==255){
232 if(ampls.size()==3) shapecdtn=
true ;
233 else if(ampls.size()>3){
235 if(ampls.size()-CDPos-1==0){
238 if(ampls.size()-CDPos-1==1){
239 C_Dn=(Float_t)ampls[CDPos+1];
242 if(ampls.size()-CDPos-1>1){
243 C_Dn=(Float_t)ampls[CDPos+1];
244 C_Dnn=(Float_t)ampls[CDPos+2];
247 C_Mnn=(Float_t)ampls[MaxPos-2];
249 else if(MaxPos<2) C_Mnn=0;
256 C_Dn=(Float_t)ampls[0];
260 C_Dn=(Float_t)ampls[CDPos-1];
261 C_Dnn=(Float_t)ampls[CDPos-2];
263 if(ampls.size()-LeftOfMaxPos>1 && MaxPos+2<(int)(ampls.size())-1){
264 C_Mnn=(Float_t)ampls[MaxPos+2];
267 if((C_Dn<=coeff1*coeffn*C_D+coeff2*coeffnn*C_M+2*noise || C_D==255)
268 && C_Mnn<=coeff1*coeffn*C_Mn+coeff2*coeffnn*C_M+2*noise
269 && C_Dnn<=coeff1*coeffn*C_Dn+coeff2*coeffnn*C_D+2*noise) {
277 if(ampls.size()==1){shapecdtn=
true;}
LocalVector localDirection() const
std::vector< DeDxHit > DeDxHitCollection
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< float >, ROOT::Math::LocalCoordinateSystemTag > LocalVector
vector in local coordinate system
Power< A, B >::type pow(const A &a, const B &b)