15 #endif //#ifdef _WITHGBATCH_
25 printf(
"In myStatus::myStatus\n");
34 printf(
"In myStatus::~myStatus\n");
42 printf(
"In myStatus::Clear\n");
63 printf(
"In myStatus::init\n");
73 printf(
"In myStatus::IsValidTime\n");
81 cout <<
" Abandon Second "<< endl;
90 printf(
"In myStatus::CodeRigidity\n");
96 int return_value=-9999;
97 int power_limit=(IsRigidity==
true)?7:8;
98 if(TMath::Abs(R) > pow(2.,power_limit)){
99 return_value=power_limit;
101 double log2r=(TMath::Abs(R)>=1)?log2(TMath::Abs(R)):0;
102 return_value=(int)log2r;
104 if(IsRigidity==
true){
105 return_value=(return_value<<1);
109 cout<<
" return_value = "<<return_value<<endl;
111 return (UShort_t) return_value;
116 printf(
"In myStatus::CodeCharge\n");
119 UShort_t return_value=0;
121 double remapped= Q*3.75;
122 if(remapped>=15) remapped=15;
123 return_value= (UShort_t)remapped;
129 printf(
"In myStatus::CodeBDT\n");
132 UShort_t return_value=0;
134 int sign=(BDT>0)?1:0;
135 double bdt_remapped= log2((1. - TMath::Abs(BDT))*128.);
136 return_value= (UShort_t)bdt_remapped;
143 printf(
"In myStatus::CodeLikeL\n");
146 UShort_t return_value=0;
148 if(LikeL<0)
return return_value;
149 double remapped= LikeL*7.5;
150 if(remapped>=15) remapped=15;
151 return_value= (UShort_t)remapped;
159 myStatusFiller::myStatusFiller(){
161 printf(
"In myStatusFiller::myStatusFiller\n");
168 myStatusFiller::~myStatusFiller(){
170 printf(
"In myStatusFiller::~myStatusFiller\n");
176 void myStatusFiller::Clear(Option_t* option){
178 printf(
"In myStatusFiller::Clear\n");
184 void myStatusFiller::init(){
186 printf(
"In myStatusFiller::init\n");
194 void myStatusFiller::Fill(
int i_part_max_r,
int i_part_max_qbh,
int i_part_max_e,
int i_part_max_r_trd){
196 printf(
"In myStatusFiller::Fill\n");
201 cout<<
" Event "<<mev->
Event<<
" Run "<<mev->
Run<<endl;
206 GeneralStatus=(UChar_t)IsValidTime();
211 GeneralStatus=(0<<1);
212 else if(nParticle>=1 && nParticle<=2)
213 GeneralStatus=(nParticle<<1);
215 GeneralStatus=(3<<1);
220 Double_t Rigidity_inn=0.;
221 Double_t Rigidity=0.;
228 AMSEventR *ev=AMSEventR::Head();
229 TrTrackR *trk=ev->pTrTrack(mtr->
i_myself);
231 int itrtrack_inn=trk->iTrTrackPar(1, 3, Refit);
233 Rigidity_inn=trk->GetRigidity(itrtrack_inn);
236 int itrtrack=trk->iTrTrackPar(1, 0, Refit);
238 Rigidity=trk->GetRigidity(itrtrack);
253 StoreRigidity(Rigidity_inn,
256 TrkCharge=(UChar_t)CodeCharge(InnerQ);
257 UChar_t q_remapped=(UChar_t) CodeCharge(QL1);
258 TrkCharge+=(UChar_t) (q_remapped<<4);
260 cout<<
" InnerQ = "<<InnerQ
262 <<(int)TrkCharge<<endl;
265 StoreDetectorAcceptance(i_part_max_r);
270 if(i_part_max_qbh>=0){
293 if(i_part_max_e>=0 ){
296 if (myecal && myecalplus) {
297 EcalInfo=(UChar_t) CodeRigidity(myecal->
EnergyD,
false);
298 UChar_t bdt_remapped=(UChar_t) CodeBDT(myecalplus->
BDT);
299 EcalInfo += (bdt_remapped<<4);
301 cout<<
" EnergyD = "<<myecal->
EnergyD<<
" "
302 <<
" BDT = "<<myecalplus->
BDT<<
" "<<(int)EcalInfo<<endl;
310 if(i_part_max_r_trd>=0){
313 LogLTrd=(UChar_t) CodeLikeL(mytrdplus->
LHR[0]);
314 UChar_t remapped=(UChar_t) CodeLikeL(mytrdplus->
LHR[1]);
315 LogLTrd += (remapped<<4);
317 cout<<
" TrdKLHR[0] = "<<mytrdplus->
LHR[0]<<
" "
318 <<
" TrdKLHR[1] = "<<mytrdplus->
LHR[1]
319 <<(int)LogLTrd<<endl;
327 void myStatusFiller::StoreRigidity(Double_t R_inn, Double_t R_max){
329 printf(
"In myStatusFiller::StoreRigidity\n");
333 UShort_t r_inn= CodeRigidity(R_inn);
334 UShort_t r_maxspan= CodeRigidity(R_max);
335 r_maxspan=(r_maxspan<<4);
337 Rigidity += r_maxspan;
339 cout<<
" Rigidity = "<<r_inn<<
" + ( "<<r_maxspan<<
" ) = "<<(int) Rigidity<<endl;
343 void myStatusFiller::StoreDetectorAcceptance(
int i_part_max_r){
347 if(i_part_max_r<0)
return;
352 AMSEventR *ev=AMSEventR::Head ();
353 TrTrackR *trk=ev->pTrTrack(mytrk->
i_myself);
360 trk->InterpolateLayerJ(i_layer,point,dir,0);
361 if (IsInsideLayer(i_layer,point,margin))
364 if(InTrdAcceptance(trk, mytrk->
kDef))
367 trk->Interpolate(66, point, dir, mytrk->
kDef);
368 if( TMath::Abs(point.x())<65 && TMath::Abs(point.y())<65)
372 trk->InterpolateLayerJ(i_layer,point,dir,0);
373 if (IsInsideLayer(i_layer,point,margin))
376 trk->Interpolate(-66, point, dir, mytrk->
kDef);
377 if( TMath::Abs(point.x())<65 && TMath::Abs(point.y())<65)
381 trk->InterpolateLayerJ(9,point,dir,0);
382 if (IsInsideLayer(9,point,margin))
385 AMSPoint APointTrackEntryEcal;
386 AMSDir ADirTrackEntryEcal;
387 trk->Interpolate(-142.79, APointTrackEntryEcal, ADirTrackEntryEcal, mytrk->
kDef);
389 AMSPoint APointTrackExitEcal;
390 AMSDir ADirTrackExitEcal;
391 trk->Interpolate(-160.00, APointTrackExitEcal, ADirTrackExitEcal, mytrk->
kDef);
393 if ( ( TMath::Abs(APointTrackEntryEcal.x())<35 && TMath::Abs(APointTrackEntryEcal.y())<35)
394 && ( TMath::Abs(APointTrackExitEcal.x())<35 && TMath::Abs(APointTrackExitEcal.y())<35)
404 bool myStatusFiller::IsInsideLayer(
int jlayer, AMSPoint point,
float margin) {
407 float tracker_planes_edges[9][4] = {
408 {-62.14, -47.40, 62.14, 47.40},
409 {-62.14, -40.10, 62.14, 40.10},
410 {-49.70, -43.75, 49.70, 43.75},
411 {-49.72, -43.75, 49.72, 43.75},
412 {-49.71, -36.45, 49.70, 36.45},
413 {-49.72, -36.45, 49.72, 36.45},
414 {-49.72, -43.75, 49.71, 43.75},
415 {-49.72, -43.75, 49.71, 43.75},
416 {-45.62, -29.48, 45.55, 29.53}
419 bool isinlayer =
false;
420 int ilayer = jlayer - 1;
421 if ( (point.x()>tracker_planes_edges[ilayer][0]+margin)&&
422 (point.x()<tracker_planes_edges[ilayer][2]-margin)&&
423 (point.y()>tracker_planes_edges[ilayer][1]+margin)&&
424 (point.y()<tracker_planes_edges[ilayer][3]-margin) ) {
425 if ((ilayer+1)==9) isinlayer =
true;
428 if ( (sqrt(point.x()*point.x()+point.y()*point.y())<
429 tracker_planes_edges[ilayer][2]-margin) )
437 bool myStatusFiller::InTrdAcceptance(TrTrackR* this_trk,
int id_maxspan){
440 if(!this_trk)
return true;
445 float AccepBottomX[] = {+40, +78, +78, +40, -40, -78, -78, -40, +40};
446 float AccepBottomY[] = {+76, +35, -35, -76, -76, -35, +35, +76, +76};
447 float TrdBottomZ = 86.725;
452 float TrdCenterZ = 0.5 * (141.825 + 86.725);
455 float AccepTopX[] = {-99.0,-89.0,-89.0,-78.7,-78.7,-67.8,-67.8,-57.7,-57.7, 57.7, 57.7, 67.8, 67.8, 78.7, 78.7, 89.0, 89.0, 99.0,
456 99.0, 89.0, 89.0, 78.7, 78.7, 67.8, 67.8, 57.7, 57.7,-57.7,-57.7,-67.8,-67.8,-78.7,-78.7,-89.0,-89.0,-99.0,-99.0};
457 float AccepTopY[] = { 54.5, 54.5, 62.5, 62.5, 74.0, 74.0, 84.0, 84.0, 95.3, 95.3, 84.0, 84.0, 74.0, 74.0, 62.5, 62.5, 54.5, 54.5,
458 -51.7,-51.7,-62.2,-62.2,-72.0,-72.0,-82.5,-82.5,-92.5,-92.5,-82.5,-82.5,-72.0,-72.0,-62.2,-62.2,-51.7,-51.7, 54.5};
459 float TrdTopZ = 141.825;
461 AMSPoint pTop, pCenter, pBottom;
462 AMSDir dTop, dCenter, dBottom;
464 this_trk->Interpolate(TrdBottomZ, pBottom, dBottom, id_maxspan);
465 this_trk->Interpolate(TrdCenterZ, pCenter, dCenter, id_maxspan);
466 this_trk->Interpolate(TrdTopZ, pTop, dTop, id_maxspan);
468 bool passTrdBottom = TMath::IsInside((
float)pBottom.x(), (float)pBottom.y(), nTrdBottom, AccepBottomX, AccepBottomY);
470 bool passTrdTop = TMath::IsInside((
float)pTop.x(), (float)pTop.y(), nTrdTop, AccepTopX, AccepTopY);
472 return (passTrdTop && passTrdBottom);
475 #endif //#ifdef _WITHGBATCH_