20 #include "hcategory.h"
53 Error (
"init()",
"Retrieve ZERO pointer for ParticleBtPar!");
89 for(Int_t vertex=0; vertex<
fNVertex; vertex++){
91 fPol2DMean[bin].push_back(
new TF2(Form(
"meanPol_%i_v%i",bin,vertex),
"x*x*x*[0]+x*x*[1]+x*[2]+y*y*[3]+y*[4]+[5]+y*(x*x*[6]+x*[7])",20.+3.3,86.,0+7.51,60.));
92 fPol2DSigma[bin].push_back(
new TF2(Form(
"sigmaPol_%i_v%i",bin,vertex),
"TMath::Power(x,3)*[0]+TMath::Power(x,2)*[1]+x*[2]+TMath::Power(y,4)*[3]+TMath::Power(y,3)*[4]+TMath::Power(y,2)*[5]+y*[6]+[7]+y*(x*x*[8]+x*[9]+[10]) + x*(y*y*y*[11]+y*y*[12])",20.+3.3,86,8+7.51,60.));
117 sec = (Int_t)address/10000;
118 row = (Int_t)(address-sec*10000)/100;
119 col = address-sec*10000-row*100;
120 sec = sec==6 ? 0 : sec;
157 if(phi>360 || (phi>=0 && phi < 60))
166 else if(phi >60 && phi<=300)
177 Float_t tmp = entry1;
207 Int_t sizeRichCal = catRichCal->getEntries();
212 for(Int_t l=0; l < sizeRichCal;l++){
256 for(Int_t i = 0; i <
fNSector ; i++ ){
276 vector <Int_t> ringMatrixVec;
279 address = 10000 * (sec ? sec : 6) + 100 * yPad + xPad;
284 if( TMath::Sqrt( TMath::Power(TMath::Abs(fSizeMatrix*0.5-posX),2) + TMath::Power(TMath::Abs(fSizeMatrix*0.5-posY),2) ) < (Float_t)fSizeMatrix/2. ){
285 ringMatrixVec.push_back(address+posY*100+posX);
306 Float_t candZ = cand->
getZ();
307 Float_t vertexZ = vertex.
getZ();
315 Double_t sigmaX0Seg0;
316 Double_t sigmaY0Seg0;
319 Double_t sigmaX0Next;
320 Double_t sigmaY0Next;
322 vector <Int_t> predictionVec;
329 if(vertexZ > -80. && vertexZ < 20.){
331 }
else if(candZ > -80. && candZ < 20.){
334 }
else if(candZ <= -80.){
370 Double_t posYCorr = richAngles.
zTheta2dX();
378 Double_t sigmaX[2] = {0.,0.};
379 Double_t sigmaY[2] = {0.,0.};
380 Double_t padX[2] = {0.,0.};
381 Double_t padY[2] = {0.,0.};
382 Int_t padXRound[2] = {0,0};
383 Int_t padYRound[2] = {0,0};
388 for( Int_t bin = 0; bin <
fNRingSeg; bin++ ) {
394 binPrev = fNRingSeg-1;
397 else if(bin==fNRingSeg-1){
398 binPrev = fNRingSeg-2;
414 sigmaX0Seg0 =
fRad2DegX[binPrev]*sigNum*sigmaSeg0;
415 sigmaY0Seg0 =
fRad2DegY[binPrev]*sigNum*sigmaSeg0;
419 sigmaX0Next =
fRad2DegX[binNext]*sigNum*sigmaNext;
420 sigmaY0Next =
fRad2DegY[binNext]*sigNum*sigmaNext;
423 radius = (radius + radiusSeg0 + radiusNext )/3.;
425 sigma = (sigma + sigmaSeg0 + sigmaNext )/3.;
426 sigmaX0 = (sigmaX0+ sigmaX0Seg0 + sigmaX0Next )/3.;
427 sigmaY0 = (sigmaY0+ sigmaY0Seg0 + sigmaY0Next )/3.;
431 if(bin==fNRingSeg-1 || bin==fNRingSeg-2 || bin==fNRingSeg-3){
434 sigmaX0Seg0 =
fRad2DegX[0]*sigNum*sigmaSeg0;
435 sigmaY0Seg0 =
fRad2DegY[0]*sigNum*sigmaSeg0;
437 radius = (radius + radiusSeg0 )/2.;
439 sigma = (sigma + sigmaSeg0 )/2.;
440 sigmaX0 = (sigmaX0+ sigmaX0Seg0)/2.;
441 sigmaY0 = (sigmaY0+ sigmaY0Seg0)/2.;
443 sigmaX0 = sigmaX0Seg0;
444 sigmaY0 = sigmaY0Seg0;
447 if(bin==0 || bin==1 || bin==2){
450 sigmaX0Seg0 =
fRad2DegX[fNRingSeg-1]*sigNum*sigmaSeg0;
451 sigmaY0Seg0 =
fRad2DegY[fNRingSeg-1]*sigNum*sigmaSeg0;
453 radius = (radius + radiusSeg0 )/2.;
455 sigma = (sigma + sigmaSeg0 )/2.;
456 sigmaX0 = (sigmaX0+ sigmaX0Seg0)/2.;
457 sigmaY0 = (sigmaY0+ sigmaY0Seg0)/2.;
459 sigmaX0 = sigmaX0Seg0;
460 sigmaY0 = sigmaY0Seg0;
465 sigmaX[0] =
fRad2DegX[bin]*radius-sigmaX0;
466 sigmaY[0] =
fRad2DegY[bin]*radius-sigmaY0;
467 sigmaX[1] =
fRad2DegX[bin]*radius+sigmaX0;
468 sigmaY[1] =
fRad2DegY[bin]*radius+sigmaY0;
471 padX[0] = richAngles.
x2xPad(posX+sigmaX[0]);
472 padY[0] = richAngles.
xy2yPad(posX+sigmaX[0],posY+sigmaY[0]);
473 padX[1] = richAngles.
x2xPad(posX+sigmaX[1]);
474 padY[1] = richAngles.
xy2yPad(posX+sigmaX[1],posY+sigmaY[1]);
478 padXRound[0] = TMath::Floor(padX[0]);
479 padXRound[1] = TMath::Floor(padX[1]);
480 padYRound[0] = TMath::Floor(padY[0]);
481 padYRound[1] = TMath::Floor(padY[1]);
485 while(padXRound[0] <= padXRound[1]){
487 while(padYRound[0] <= padYRound[1]){
488 address = 10000 * (sec ? sec : 6) + 100 * padYRound[0] + padXRound[0];
491 Bool_t kFound=kFALSE;
493 while(pred < predictionVec.size() && !kFound){
494 if(predictionVec[pred] == address)
500 predictionVec.push_back(address);
518 fillMatrix(TMath::Floor(xPad),TMath::Floor(yPad),sec);
521 predictionVec.clear();
522 predictionVec.push_back(-1);
545 Int_t padsFiredPred = 0;
546 Float_t chargeFired = 0;
547 Float_t chargeFiredPred = 0;
549 for(UInt_t i=0; i<
fRingMatrix[trackNo].size(); i++){
554 for(UInt_t k=0; k<
fPrediction[trackNo].size(); k++){
563 return (Float_t)chargeFiredPred/(Float_t)chargeFired;
626 Bool_t kOverflow = kFALSE;
628 Int_t prediction [128][128];
629 Int_t ringMatrix [128][128];
630 Int_t richHitAdd [1024];
631 Float_t richHitCharge [1024];
633 Float_t trackTheta [128];
634 Float_t trackPhi [128];
635 Int_t trackVertex [128];
636 Int_t trackSec [128];
637 Int_t trackPCandIdx [128];
639 Float_t posXCenter [128];
640 Float_t posYCenter [128];
644 for(Int_t i = 0; i < 128; i++ ){
645 for(Int_t j = 0; j < 128; j++ ){
646 prediction[i][j] = -1;
647 ringMatrix[i][j] = -1;
651 for(Int_t i = 0; i < 1024; i++ ){
653 richHitCharge[i] = -1.;
656 for(Int_t i = 0; i < 128; i++ ){
661 trackPCandIdx[i] = -1;
662 isGoodTrack[i] = kFALSE;
671 for(UInt_t j = 0; j <
fPrediction[i].size(); j++ ){
724 Int_t returnVal = 0 ;
725 for(UInt_t j = 0; j <
fPrediction[trackNo].size(); j++ ){
726 Bool_t hasHit = kFALSE;
733 cout <<
fPrediction[trackNo][j] <<
" - " <<
"["<< hasHit <<
"]" << endl;
745 Int_t plotCounter = 0 ;
749 if(sec[0] == sec[1]){
752 if(plotCounter%5 == 0)
764 for(Int_t i=0;i<6;i++) secUsed[0+i] = trackInSec[i];
765 Bool_t isNoisy = kFALSE;
766 for(Int_t i = 0; i <
fNSector; i++){
773 cout <<
"hparticlebtringf: Noisy RICH segment detected and removed" << endl;
vector< Int_t > fTrackSec
vector< Int_t > fTrackVertex
Float_t * getChargeThresMax()
vector< vector< Int_t > > fPrediction
Int_t getAddress(void) const
Float_t getSigmaRangeMax()
void fillPrediction(const HParticleCand *cand, HVertex &vertex, Bool_t isGoodTrack, const Bool_t doAngleCorr)
vector< vector< Int_t > > fRingMatrix
Int_t getTrackSec(Int_t trackNo)
vector< vector< Int_t > > fFiredPads
Float_t angles2x(const Float_t theta, const Float_t phi)
ClassImp(HParticleBtRingF) HParticleBtRingF
Float_t getVertexPosMin()
Float_t getThetaAngleMax()
void setPrediction(Int_t val[][128])
Float_t zTheta2dYPad(const Float_t z, const Float_t theta, const Float_t phi)
Float_t getThetaAngleMin()
vector< Float_t > fTrackTheta
HRuntimeDb * getRuntimeDb(void)
Int_t getRichSegBorderX()
vector< vector< TF2 * > > fPol2DSigma
Float_t angles2yPad(const Float_t theta, const Float_t phi)
vector< Float_t > fRichHitCharge
vector< Float_t > fRad2DegX
Float_t x2xPad(const Float_t x)
vector< Bool_t > fIsGoodTrack
Float_t getCharge(void) const
Float_t getVertexPosMax()
Float_t getPosXCenter(Int_t trackNo)
Int_t correctPhi(const Int_t sec, const Float_t phi)
static T * getObject(T *pout, Short_t num=-1, Int_t index=-1, Bool_t silent=kFALSE)
void fillRichCal(HCategory *catRichCal)
vector< Int_t > fRichHitAdd
Float_t zTheta2dY(const Float_t z, const Float_t theta, const Float_t phi)
Bool_t isGoodTrack(Int_t trackNo)
Float_t getPosYCenter(Int_t trackNo)
vector< Int_t > fTrackPCandIdx
vector< vector< TF2 * > > fPol2DMean
vector< Float_t > fRad2DegY
Float_t getTrackPhi(Int_t trackNo)
void setRichHitCharge(Float_t *val)
vector< Float_t > fTrackPhi
vector< Float_t > fRad2Deg
void setRingMatrix(Int_t val[][128])
Float_t getTrackTheta(Int_t trackNo)
Float_t * getPhiOffset2()
void addressToColRow(const Int_t address, Int_t &sec, Int_t &row, Int_t &col)
void setTrackVertex(Int_t *val)
vector< Float_t > fPosXCenter
void plotRichHit(Int_t trackNo)
HParSet * getContainer(const Text_t *)
void setTrackPhi(Float_t *val)
Bool_t getIsCleanedHigh(void) const
Float_t xy2yPad(const Float_t x, const Float_t y)
void setPosXCenter(Float_t *val)
Bool_t getIsCleanedSector(void) const
void setTrackTheta(Float_t *val)
void sortElements(Double_t &entry1, Double_t &entry2)
vector< Float_t > fPosYCenter
Float_t * getChargeThres()
void setIsGoodTrack(Bool_t *val)
Float_t getRingMatrix(const Int_t trackNo)
void fillMatrix(Int_t xPad, Int_t yPad, Int_t sec)
Int_t getRichSegBorderY()
Int_t getVertexNum(const Float_t vertex)
Float_t angles2y(const Float_t theta, const Float_t phi)
void setPosYCenter(Float_t *val)
void setTrackSec(Int_t *val)
Bool_t fillRingInfo(HParticleBtRingInfo *btRingInfo)
Float_t zTheta2dTheta(const Float_t z, const Float_t theta, const Float_t phi)
Int_t plotPrediction(Int_t trackNo)
Int_t getTrackVertex(Int_t trackNo)
Bool_t hasNoisyRichSeg(Bool_t *trackInSec)
Short_t getSector() const
static Bool_t alignRichRing(const Double_t theta, const Double_t phi, Double_t &thetaCor, Double_t &phiCor)
Double_t getTF2ParMean(Int_t ringSeg, Int_t vertex, Int_t par)
HParticleAngleCor fAngleCor
Float_t angles2xPad(const Float_t theta, const Float_t phi)
Float_t fChargeLimitMaximum[6]
void setRichHitAdd(Int_t *val)
Double_t getTF2ParSigma(Int_t ringSeg, Int_t vertex, Int_t par)
void setTrackPCandIdx(Int_t *val)