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();
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;
59 const std::vector<uint8_t> & amplitudes = projectedHit->cluster()->amplitudes();
60 mono.
charge = accumulate(amplitudes.begin(), amplitudes.end(), 0);
62 for(
unsigned int i=0;
i<amplitudes.size();
i++){
if(amplitudes[
i]>=254)mono.
NSaturating++;}
64 mono.
detId= projectedHit->originalId();
67 }
else if(
const SiStripRecHit2D* singleHit=dynamic_cast<const SiStripRecHit2D*>(recHit)){
68 if(!useStrip)
continue;
75 const std::vector<uint8_t> & amplitudes = singleHit->cluster()->amplitudes();
76 mono.
charge = accumulate(amplitudes.begin(), amplitudes.end(), 0);
78 for(
unsigned int i=0;
i<amplitudes.size();
i++){
if(amplitudes[
i]>=254)mono.
NSaturating++;}
80 mono.
detId= singleHit->geographicalId();
83 }
else if(
const SiStripRecHit1D* single1DHit=dynamic_cast<const SiStripRecHit1D*>(recHit)){
84 if(!useStrip)
continue;
91 const std::vector<uint8_t> & amplitudes = single1DHit->cluster()->amplitudes();
92 mono.
charge = accumulate(amplitudes.begin(), amplitudes.end(), 0);
94 for(
unsigned int i=0;
i<amplitudes.size();
i++){
if(amplitudes[
i]>=254)mono.
NSaturating++;}
96 mono.
detId= single1DHit->geographicalId();
100 }
else if(
const SiPixelRecHit* pixelHit=dynamic_cast<const SiPixelRecHit*>(recHit)){
101 if(!usePixel)
continue;
108 pixel.
charge = pixelHit->cluster()->charge();
110 pixel.
detId= pixelHit->geographicalId();
111 hits.push_back(pixel);
124 size_t n = hits.size();
125 for(
size_t i = 0;
i<
n;
i ++)
129 return (n>0)?
pow(result/n,1./expo):0.;
138 Int_t NofMax=0; Int_t recur255=1; Int_t recur254=1;
139 bool MaxOnStart=
false;
bool MaxInMiddle=
false, MaxOnEnd =
false;
142 if(ampls.size()!=1 && ((ampls[0]>ampls[1])
143 || (ampls.size()>2 && ampls[0]==ampls[1] && ampls[1]>ampls[2] && ampls[0]!=254 && ampls[0]!=255)
144 || (ampls.size()==2 && ampls[0]==ampls[1] && ampls[0]!=254 && ampls[0]!=255)) ){
145 NofMax=NofMax+1; MaxOnStart=
true; }
149 for (
unsigned int i =1;
i < ampls.size()-1;
i++) {
150 if( (ampls[
i]>ampls[
i-1] && ampls[
i]>ampls[
i+1])
151 || (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) ){
152 NofMax=NofMax+1; MaxInMiddle=
true; MaxPos=
i;
154 if(ampls[
i]==255 && ampls[
i]==ampls[
i-1]) {
156 MaxPos=
i-(recur255/2);
157 if(ampls[
i]>ampls[
i+1]){NofMax=NofMax+1;MaxInMiddle=
true;}
159 if(ampls[
i]==254 && ampls[
i]==ampls[
i-1]) {
161 MaxPos=
i-(recur254/2);
162 if(ampls[
i]>ampls[
i+1]){NofMax=NofMax+1;MaxInMiddle=
true;}
168 if(ampls[ampls.size()-1]>ampls[ampls.size()-2]
169 || (ampls.size()>2 && ampls[ampls.size()-1]==ampls[ampls.size()-2] && ampls[ampls.size()-2]>ampls[ampls.size()-3] )
170 || ampls[ampls.size()-1]==255){
171 NofMax=NofMax+1; MaxOnEnd=
true; }
174 if(ampls.size()==1){ NofMax=1;}
192 bool shapecdtn=
false;
195 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;
197 Float_t coeff1=1.7; Float_t coeff2=2.0;
198 Float_t coeffn=0.10; Float_t coeffnn=0.02; Float_t noise=4.0;
202 if(MaxOnStart==
true){
203 C_M=(Float_t)ampls[0]; C_D=(Float_t)ampls[1];
204 if(ampls.size()<3) shapecdtn=
true ;
205 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;}
206 else if(ampls.size()>3){ C_Dn=(Float_t)ampls[2]; C_Dnn=(Float_t)ampls[3] ;
207 if((C_Dn<=coeff1*coeffn*C_D+coeff2*coeffnn*C_M+2*noise || C_D==255)
208 && C_Dnn<=coeff1*coeffn*C_Dn+coeff2*coeffnn*C_D+2*noise){
214 C_M=(Float_t)ampls[ampls.size()-1]; C_D=(Float_t)ampls[ampls.size()-2];
215 if(ampls.size()<3) shapecdtn=
true ;
216 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;}
217 else if(ampls.size()>3){C_Dn=(Float_t)ampls[ampls.size()-3] ; C_Dnn=(Float_t)ampls[ampls.size()-4] ;
218 if((C_Dn<=coeff1*coeffn*C_D+coeff2*coeffnn*C_M+2*noise || C_D==255)
219 && C_Dnn<=coeff1*coeffn*C_Dn+coeff2*coeffnn*C_D+2*noise){
224 if(MaxInMiddle==
true){
225 C_M=(Float_t)ampls[MaxPos];
226 int LeftOfMaxPos=MaxPos-1;
if(LeftOfMaxPos<=0)LeftOfMaxPos=0;
227 int RightOfMaxPos=MaxPos+1;
if(RightOfMaxPos>=(
int)ampls.size())RightOfMaxPos=ampls.size()-1;
229 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;}
230 if(C_Mn<coeff1*coeffn*C_M+coeff2*coeffnn*C_D+2*noise || C_M==255){
231 if(ampls.size()==3) shapecdtn=
true ;
232 else if(ampls.size()>3){
234 if(ampls.size()-CDPos-1==0){
237 if(ampls.size()-CDPos-1==1){
238 C_Dn=(Float_t)ampls[CDPos+1];
241 if(ampls.size()-CDPos-1>1){
242 C_Dn=(Float_t)ampls[CDPos+1];
243 C_Dnn=(Float_t)ampls[CDPos+2];
246 C_Mnn=(Float_t)ampls[MaxPos-2];
248 else if(MaxPos<2) C_Mnn=0;
255 C_Dn=(Float_t)ampls[0];
259 C_Dn=(Float_t)ampls[CDPos-1];
260 C_Dnn=(Float_t)ampls[CDPos-2];
262 if(ampls.size()-LeftOfMaxPos>1 && MaxPos+2<(int)(ampls.size())-1){
263 C_Mnn=(Float_t)ampls[MaxPos+2];
266 if((C_Dn<=coeff1*coeffn*C_D+coeff2*coeffnn*C_M+2*noise || C_D==255)
267 && C_Mnn<=coeff1*coeffn*C_Mn+coeff2*coeffnn*C_M+2*noise
268 && C_Dnn<=coeff1*coeffn*C_Dn+coeff2*coeffnn*C_D+2*noise) {
276 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)