22 printf(
"In myRichRingPlus::myRichRingPlus\n");
31 printf(
"In myRichRingPlus::~myRichRingPlus\n");
38 printf(
"In myRichRingPlus::Clear\n");
44 JustOneRichParticle =
false;
45 TheCorrectTrack =
false;
47 FiducialVolumeLoose =
false;
48 FiducialVolumeTight =
false;
49 EnoughUsedHitsInRing =
false;
50 NoMirroredPhotons =
false;
51 EnoughExpetedHitsInRing =
false;
52 GoodRingProbability =
false;
53 RingWidthSmallEnough =
false;
54 EnoghPMTsInEvent =
false;
55 EnoughPMTsInEventForRing =
false;
56 EnoughPhotoElectronsWRTCollected =
false;
57 BetaDiscrepancy =
false;
64 fill_n(AMSTrPars, 5, -999999);
65 fill_n(TrRadPos, 3, -999999);
66 fill_n(TrPMTPos, 3, -999999);
67 BetaConsistency = -999999;
68 _betaCorrection = -999999;
69 PhotoElectrons = -999999;
70 ExpectedPhotoElectrons = -999999;
72 PMTChargeConsistency = -999999;
73 _PmtCorrectionsFailed = -999999;
75 CollectedPhotoElectrons = -999999;
77 ChargeCorrections=
false;
81 BetaExpectedResolution = -999999;
82 BetaExpectedRms = -999999;
83 ChargeExpectedResolution = -999999;
84 ChargeExpectedRms = -999999;
87 fill_n(mindist, 2, -999999);
88 fill_n(empoint, 3, -999999);
89 fill_n(emdir, 2, -999999);
90 fill_n(nphoel,2, -999999);
91 fill_n(betam,2, -999999);
92 fill_n(npmthits,2, -999999);
93 fill_n(npmts,2, -999999);
102 printf(
"In myRichRingPlus::init\n");
116 Int_t richrec(TrTrackR
const*, AMSPoint&, AMSDir& , AMSPoint & ,
double* ,
int* ,
int* ,
double* );
124 static Double_t betaWidth(RichRingR* ring);
125 static int getPMTs(
bool countCrossed=
true);
126 static int getPMTsForRing(RichRingR* ring);
127 static float getCollectedPhotoElectrons();
128 static Double_t GetDistanceToTileBorder(Double_t x, Double_t y);
129 static int GetTileNumber(Double_t x,Double_t y);
132 myRichRingPlusFiller::myRichRingPlusFiller(){
134 printf(
"In myRichRingPlusFiller::myRichRingPlusFiller\n");
141 myRichRingPlusFiller::~myRichRingPlusFiller(){
143 printf(
"In myRichRingPlusFiller::~myRichRingPlusFiller\n");
151 void myRichRingPlusFiller::Clear(Option_t* option){
153 printf(
"In myRichRingPlusFiller::Clear\n");
162 void myRichRingPlusFiller::init(){
164 printf(
"In myRichRingPlusFiller::init\n");
172 void myRichRingPlusFiller::Fill(RichRingR* _ring, ParticleR* pp){
174 printf(
"In myRichRingPlusFiller::Fill\n");
183 if (pp->RichParticles<=1) JustOneRichParticle=
true;
185 if (ring->pTrTrack() && ring->pTrTrack()==pp->pTrTrack()) TheCorrectTrack=
true;
187 if (ring->IsClean()) _IsClean=
true;
190 Double_t r2=ring->TrRadPos[0]*ring->TrRadPos[0]+ring->TrRadPos[1]*ring->TrRadPos[1];
192 if (r2<=60*60) FiducialVolumeLoose=
true;
194 Double_t dist=GetDistanceToTileBorder(ring->TrRadPos[0], ring->TrRadPos[1]);
196 if (dist>0.5) FiducialVolumeTight=
true;
198 if (ring->Used>3) EnoughUsedHitsInRing=
true;
200 if (ring->UsedM==0) NoMirroredPhotons=
true;
202 if (ring->NpExp>2) EnoughExpetedHitsInRing=
true;
204 if (ring->Prob>0.1) GoodRingProbability=
true;
206 if (ring->RingWidth(
false)<3) RingWidthSmallEnough=
true;
209 if (getPMTs()>4) EnoghPMTsInEvent=
true;
211 if(getPMTsForRing(ring)>2) EnoughPMTsInEventForRing=
true;
213 if(ring->getPhotoElectrons()>0.5*getCollectedPhotoElectrons()) EnoughPhotoElectronsWRTCollected=
true;
215 if (pp->pRichRingB()) {
216 if(fabs(pp->RichBetasDiscrepancy())<1e-3) BetaDiscrepancy=
true;
226 Prob = ring->getProb();
227 copy_n( ring->AMSTrPars, 5,AMSTrPars);
228 copy_n( ring->TrRadPos , 3,TrRadPos);
229 copy_n( ring->TrPMTPos , 3,TrPMTPos);
230 BetaConsistency = ring->getBetaConsistency();
231 _betaCorrection = ring->betaCorrection();
232 PhotoElectrons = ring->getPhotoElectrons();
233 ExpectedPhotoElectrons = ring->getExpectedPhotoElectrons();
234 PMTs = ring->getPMTs();
235 PMTChargeConsistency = ring->getPMTChargeConsistency();
236 _PmtCorrectionsFailed = ring->PmtCorrectionsFailed();
237 TileIndex = ring->getTileIndex();
238 CollectedPhotoElectrons = RichHitR::getCollectedPhotoElectrons();
239 UsedHits = ring->getUsedHits(
true);
241 ChargeCorrections = ring->buildChargeCorrections();
243 _RingWidth = ring->RingWidth();
244 BetaExpectedResolution = ring->getBetaExpectedResolution();
245 BetaExpectedRms = ring->getBetaExpectedRms();
246 ChargeExpectedResolution= ring->getChargeExpectedResolution();
247 ChargeExpectedRms = ring->getChargeExpectedRms();
254 Double_t mindist[2], empoint[3], emdir[2];
259 kind = richrec( pp->pTrTrack(), emp, emd, dist_p, nphoel, npmthits, npmts, betam);
264 emdir[0]=emd.gettheta();
265 emdir[1]=emd.getphi();
266 mindist[0]=dist_p.x();
267 mindist[1]=dist_p.y();
279 Double_t betaWidth(RichRingR* ring){
282 for(
int i=0;i<10;i++){
284 Double_t w=ring->UsedWindow[i]-(i>0?ring->UsedWindow[i-1]:0);
286 sum+=(0.5+i)*(0.5+i)*w;
289 return sqrt(2*sum/weight);
292 int GetTileNumber(Double_t x, Double_t y){
297 cout<<
"GetTileNumber returns a nonsensical value: "<<endl
298 <<
" x="<<x<<
" y="<<y<<
" nx= "<<nx<<
" ny="<<ny<<
" tile="<<tile<<endl;
304 Double_t GetDistanceToTileBorder(Double_t x, Double_t y){
307 return tile_width/2-(fabs(dx+dy)/2+fabs(dx-dy)/2);
310 int getPMTs(
bool countCrossed){
311 AMSEventR*
event = AMSEventR::Head();
314 for(
int i=0;i<680;counted[i++]=
false);
316 for(
int i=0;i<
event->nRichHit();i++){
317 RichHitR *hit=
event->pRichHit(i);
319 if(!countCrossed && hit->IsCrossed())
continue;
320 int pmt=hit->Channel/16;
321 if(counted[pmt])
continue;
328 int getPMTsForRing(RichRingR* ring){
329 AMSEventR*
event = AMSEventR::Head();
332 for(
int i=0;i<680;counted[i++]=
false);
334 for(
int i=0;i<ring->Used;i++){
335 RichHitR *hit=
event->pRichHit(ring->iRichHit(i));
337 if(hit->IsCrossed())
continue;
338 int pmt=hit->Channel/16;
339 if(counted[pmt])
continue;
346 float getCollectedPhotoElectrons(){
347 AMSEventR*
event = AMSEventR::Head();
350 for(
int i=0;i<
event->nRichHit();i++){
351 RichHitR *hit=
event->pRichHit(i);
353 if(hit->IsCrossed())
continue;
359 #endif //#ifdef _WITHGBATCH_