#include <math.h>
#include "TVector3.h"
#include "hconstant.h"
#include "hrichcorrelator.h"
#include "hruntimedb.h"
#include "hevent.h"
#include "hspectrometer.h"
#include "hdetector.h"
#include "hcategory.h"
#include "hiterator.h"
#include "hmatrixcatiter.h"
#include "hrichhit.h"
#include "hrichhitfit.h"
#include "hmdcseg.h"
#include "htofhit.h"
#include "hshowerhittof.h"
#include "tofdef.h"
#include "hmdcdef.h"
#include "showertofinodef.h"
#include "showerdef.h"
#include "hdebug.h"
#include "hades.h"
#include "richdef.h"
#include "hhitmatch.h"
#include "hhitmatchheader.h"
#include "hlinearcategory.h"
#include "hgeomvector2.h"
#include "hrichutilfunc.h"
#include "hrichcorrelatorpar.h"
#include "hkicktrack.h"
#include "kickdef.h"
#include "heventheader.h"
#include <fstream>
ClassImp(HRichCorrelator)
HRichCorrelator::HRichCorrelator(const Text_t *name,const Text_t *title) :
HReconstructor(name,title)
{
}
HRichCorrelator::HRichCorrelator(const Text_t *name,const Text_t *title,const Char_t* filename, Bool_t style) :
HReconstructor(name,title)
{
pFileName = filename;
isComplex = style;
if (isComplex)
{
cout<<"******************************"<<endl;
cout<<" CORRELATOR in COMPLEX mode "<<endl;
cout<<"******************************"<<endl;
}
else
{
cout<<"******************************"<<endl;
cout<<" CORRELATOR in RICH-KICK mode "<<endl;
cout<<"******************************"<<endl;
}
}
HRichCorrelator::HRichCorrelator()
{
}
HRichCorrelator::~HRichCorrelator(void)
{
}
Bool_t HRichCorrelator::init() {
if (gHades) {
HEvent *event=gHades->getCurrentEvent();
HRuntimeDb *rtdb=gHades->getRuntimeDb();
HSpectrometer *spec=gHades->getSetup();
if (event && rtdb) {
HDetector *tof=spec->getDetector("Tof");
HDetector *shower = spec->getDetector("Shower");
HDetector *mdc = spec->getDetector("Mdc");
HDetector *rich = spec->getDetector("Rich");
HRichCorrelatorPar *pCorrPar =
(HRichCorrelatorPar*)rtdb->getContainer("RichCorrelatorParameters");
if (!pCorrPar)
{
pCorrPar = new HRichCorrelatorPar;
rtdb->addContainer(pCorrPar);
}
setCorrelationPar(pCorrPar);
if (!pCorrPar) return kFALSE;
if (rich) {
fRichPID=gHades->getCurrentEvent()->getCategory(catRichHit);
if (!fRichPID) {
Error("init()","no Rich hit category in input");
}
fRichIter = (HIterator*) fRichPID->MakeIterator();
pRichHitFitCat=gHades->getCurrentEvent()->getCategory(catRichHitFit);
if (!pRichHitFitCat){
Warning("init()","no Rich hit fit category in input");
}
if (pRichHitFitCat) pRichHitFitIter =
(HIterator*) pRichHitFitCat->MakeIterator();
else pRichHitFitIter=0;
pHitMatchCat=event->getCategory(catMatchHit);
if (!pHitMatchCat) {
pHitMatchCat=rich->buildCategory(catMatchHit);
if (!pHitMatchCat) {
Error("init","No HIT MATCH category defined");
return kFALSE;
}
else event->addCategory(catMatchHit, pHitMatchCat, "Rich");
}
pIterMatchHit = (HIterator*)getHitMatchCat()->MakeIterator("native");
pHitMatchHeaderCat=event->getCategory(catMatchHitHeader);
if (!pHitMatchHeaderCat) {
pHitMatchHeaderCat=rich->buildCategory(catMatchHitHeader);
if (!pHitMatchHeaderCat) {
Error("init","No HIT MATCH HEADER category defined");
return kFALSE;
}
else event->addCategory(catMatchHitHeader, pHitMatchHeaderCat
, "Rich");
}
pIterMatchHitHeader = (HIterator*)getHitMatchHeaderCat()
->MakeIterator("native");
}
if (mdc) {
fMdcSeg=event->getCategory(catMdcSeg);
if (!fMdcSeg) {
Error("init","No MDC segment category defined");
return kFALSE;
}
else fMdcSegIter=(HIterator *)fMdcSeg->MakeIterator();
}
if (tof) {
fTofHits=event->getCategory(catTofHit);
if (!fTofHits) {
fTofHits=tof->buildCategory(catTofHit);
if (!fTofHits) {
Error("init","No TOF input");
return kFALSE;
}
}
fTofIter=(HIterator *)fTofHits->MakeIterator();
}
if (shower) {
fShowerTofHits=event->getCategory(catShowerHitTof);
if (!fShowerTofHits) {
fShowerTofHits = shower->buildCategory(catShowerHitTof);
if (!fShowerTofHits) {
Error("init","No Shower input available");
return kFALSE;
}
}
fShowerTofIter = (HIterator *)fShowerTofHits->MakeIterator();
}
fKickTrackCat = gHades->getCurrentEvent()->getCategory(catKickTrack);
if (!fKickTrackCat) {
Error("init","KickTrack not found in input file");
return kFALSE;
}
iterTracks = (HIterator *)fKickTrackCat->MakeIterator("native");
} else {
Error ("init","! (event && rtdb)");
return kFALSE;
}
pFileOut = new TFile(pFileName.Data(),"RECREATE");
return kTRUE;
} else {
Error ("init","! (gHades)");
return kFALSE;
}
}
Bool_t HRichCorrelator::reinit()
{
HRichCorrelatorPar* pCorrPar = (HRichCorrelatorPar*)getCorrelationPar();
iniCuts();
iniSwitches();
iniCounters();
iniControlHistos();
pCorrPar -> printParam();
return kTRUE;
}
void HRichCorrelator::iniCounters()
{
nCounterProcessedNbEvents=0;
nCounterMin2Rings=0;
nCounterTotalNbRings=0;
nCounterRingsAbove45=0;
nCounterRingsBelow45=0;
nCounterEvtWritten=0;
nCounterRingsWritten=0;
nCounterNbRejectedRings=0;
nCounterRingsUnresMultHit=0;
nCounterEventsUnresMultHit=0;
nCounterRingsCorrMdc=0;
nCounterRingsCorrShower=0;
nCounterRingsCorrTof=0;
ngNbCorrObjs=0;
ngNb_RM=0;
ngNb_RT=0;
ngNb_RS=0;
ngNb_MT=0;
ngNb_MS=0;
ngNb_RcMcT=0;
ngNb_RcMcTcR=0;
ngNb_RMcTcR=0;
ngNb_RcMTcR=0;
ngNb_RcMcS=0;
ngNb_RcMcScR=0;
ngNb_RMcScR=0;
ngNb_RcMScR=0;
ngRTM=0;
ngRSM=0;
ngRichCnt=0;
ngMdcSegCnt=0;
ngShowerCnt=0;
ngTofCnt=0;
ngDRind=0;
ngDRichminRMind=0;
ngDRichminRTind=0;
ngDRichminRSind=0;
ngDRichminRMTind=0;
ngDRichminRMSind=0;
ngDRcMcTcRind=0;
ngDRcMcScRind=0;
ngDRcMTcRind=0;
ngDRcMScRind=0;
ngDRcMcTind=0;
ngDRcMcSind=0;
ngDRMcTcRind=0;
ngDRMcScRind=0;
ngDRMind=0;
ngDRTind=0;
ngDRSind=0;
ngDMTind=0;
ngDMSind=0;
ngDMind=0;
ngDTind=0;
ngDSind=0;
}
void HRichCorrelator::iniCuts()
{
HRichCorrelatorPar* pCorrPar = (HRichCorrelatorPar*)getCorrelationPar();
fMdcThetaCorrection = pCorrPar->getMdcThetaCorrection();
nSelectedSector = pCorrPar->getSelectedSector();
fRichMdcThetaCut = pCorrPar->getRichMdcThetaCut();
fRichMdcThetaMinCut = pCorrPar-> getRichMdcThetaMinCut();
fRichMdcThetaMaxCut = pCorrPar->getRichMdcThetaMaxCut();
fRichTofThetaCut = pCorrPar->getRichTofThetaCut();
fRichTofThetaMinCut = pCorrPar->getRichTofThetaMinCut();
fRichTofThetaMaxCut = pCorrPar->getRichTofThetaMaxCut();
fRichShowerThetaCut = pCorrPar->getRichShowerThetaCut();
fRichShowerThetaMinCut = pCorrPar->getRichShowerThetaMinCut();
fRichShowerThetaMaxCut = pCorrPar->getRichShowerThetaMaxCut();
fMdcTofThetaCut = pCorrPar->getMdcTofThetaCut();
fMdcTofThetaMinCut = pCorrPar->getMdcTofThetaMinCut();
fMdcTofThetaMaxCut = pCorrPar->getMdcTofThetaMaxCut();
fMdcShowerThetaCut = pCorrPar->getMdcShowerThetaCut();
fMdcShowerThetaMinCut = pCorrPar->getMdcShowerThetaMinCut();
fMdcShowerThetaMaxCut = pCorrPar->getMdcShowerThetaMaxCut();
fRichMdcPhiCut = pCorrPar->getRichMdcPhiCut();
fRichTofPhiCut = pCorrPar->getRichTofPhiCut();
fRichShowerPhiCut = pCorrPar->getRichShowerPhiCut();
fMdcTofPhiCut = pCorrPar->getMdcTofPhiCut();
fMdcShowerPhiCut = pCorrPar->getMdcShowerPhiCut();
fTofTofMinCut = pCorrPar->getTofTofMinCut();
fTofTofMaxCut = pCorrPar->getTofTofMaxCut();
fTofinoTofMinCut = pCorrPar->getTofinoTofMinCut();
fTofinoTofMaxCut = pCorrPar->getTofinoTofMaxCut();
fShowerAmplification = pCorrPar->getShowerAmplification();
nTofinoMultCut = pCorrPar->getTofinoMultCut();
nNbBinsForPatMat = 160;
nNbBinsForHouTra = 60;
nHouTraMax = 500;
nPatMatCut = pCorrPar->getRingPatMatCut();
nHouTraCut = pCorrPar->getRingHouTraCut();
nPadNrCut = pCorrPar->getRingPadNrCut();
nRingAmplCut = pCorrPar->getRingAmplCut();
nLocMax4Cut = pCorrPar->getRingLocMax4Cut();
}
void HRichCorrelator::iniSwitches(void)
{
HRichCorrelatorPar* pCorrPar = (HRichCorrelatorPar*)getCorrelationPar();
kShowerCond = pCorrPar->getShowerCond();
kIsNoCutOnTOFtof = pCorrPar->getTofSwitch();
kIsNoCutOnTOFINOtof = pCorrPar->getTofinoSwitch();
kSwitchOffRich = pCorrPar->getRichSwitch();
kRingQualityCut = pCorrPar->getRingQualitySwitch();
kTofinoMultCut = pCorrPar->getTofinoMultSwitch();
kMagnet = pCorrPar->getMagnetSwitch();
kNoSectorSelected = pCorrPar->getSectorSelectionSwitch();
}
void HRichCorrelator::iniControlHistos()
{
pHistArray = new TObjArray(130);
pHistRMTheta = new TH2D("Rich_Mdc_theta","Rich_Mdc_theta"
,90,0,90,90,0,90);
pHistArray->Add(pHistRMTheta);
pHistRMPhi = new TH2D("Rich_Mdc_phi","Rich_Mdc_phi"
,360,0,360,360,0,360);
pHistArray->Add(pHistRMPhi);
pHistDiffRMTheta1 = new TH1F("Rich_Mdc_theta_diff1","Rich_Mdc_theta_diff1"
,100,fRichMdcThetaMinCut-1,fRichMdcThetaMaxCut+1);
pHistArray->Add(pHistDiffRMTheta1);
pHistDiffRMPhi1 = new TH1F("Rich_Mdc_phi_diff1","Rich_Mdc_phi_diff1"
,100,-fRichMdcPhiCut-1,fRichMdcPhiCut+1);
pHistArray->Add(pHistDiffRMPhi1);
pHistDiffRMTheta2 = new TH1F("Rich_Mdc_theta_diff2","Rich_Mdc_theta_diff2"
,100,fRichMdcThetaMinCut-1,fRichMdcThetaMaxCut+1);
pHistArray->Add(pHistDiffRMTheta2);
pHistDiffRMPhi2 = new TH1F("Rich_Mdc_phi_diff2","Rich_Mdc_phi_diff2"
,100,-fRichMdcPhiCut-1,fRichMdcPhiCut+1);
pHistArray->Add(pHistDiffRMPhi2);
pHistDiffRMTheta3 = new TH1F("Rich_Mdc_theta_diff3","Rich_Mdc_theta_diff3"
,100,fRichMdcThetaMinCut-1,fRichMdcThetaMaxCut+1);
pHistArray->Add(pHistDiffRMTheta3);
pHistDiffRMPhi3 = new TH1F("Rich_Mdc_phi_diff3","Rich_Mdc_phi_diff3"
,100,-fRichMdcPhiCut-1,fRichMdcPhiCut+1);
pHistArray->Add(pHistDiffRMPhi3);
pHistDiffRMTheta4 = new TH1F("Rich_Mdc_theta_diff4","Rich_Mdc_theta_diff4"
,100,fRichMdcThetaMinCut-1,fRichMdcThetaMaxCut+1);
pHistArray->Add(pHistDiffRMTheta4);
pHistDiffRMPhi4 = new TH1F("Rich_Mdc_phi_diff4","Rich_Mdc_phi_diff4"
,100,-fRichMdcPhiCut-1,fRichMdcPhiCut+1);
pHistArray->Add(pHistDiffRMPhi4);
pHistDiffRMTheta5 = new TH1F("Rich_Mdc_theta_diff5","Rich_Mdc_theta_diff5"
,100,fRichMdcThetaMinCut-1,fRichMdcThetaMaxCut+1);
pHistArray->Add(pHistDiffRMTheta5);
pHistDiffRMPhi5 = new TH1F("Rich_Mdc_phi_diff5","Rich_Mdc_phi_diff5"
,100,-fRichMdcPhiCut-1,fRichMdcPhiCut+1);
pHistArray->Add(pHistDiffRMPhi5);
pHistDiffRMTheta6 = new TH1F("Rich_Mdc_theta_diff6","Rich_Mdc_theta_diff6"
,100,fRichMdcThetaMinCut-1,fRichMdcThetaMaxCut+1);
pHistArray->Add(pHistDiffRMTheta6);
pHistDiffRMPhi6 = new TH1F("Rich_Mdc_phi_diff6","Rich_Mdc_phi_diff6"
,100,-fRichMdcPhiCut-1,fRichMdcPhiCut+1);
pHistArray->Add(pHistDiffRMPhi6);
pHistRSTheta = new TH2D("Rich_Shower_theta","Rich_Shower_theta"
,90,0,90,90,0,90);
pHistArray->Add(pHistRSTheta);
pHistRSPhi = new TH2D("Rich_Shower_phi","Rich_Shower_phi"
,360,0,360,360,0,360);
pHistArray->Add(pHistRSPhi);
pHistDiffRSTheta1 = new TH1F("Rich_Shower_theta_diff1","Rich_Shower_theta_diff1"
,100,fRichShowerThetaMinCut-1,fRichShowerThetaMaxCut+1);
pHistArray->Add(pHistDiffRSTheta1);
pHistDiffRSPhi1 = new TH1F("Rich_Shower_phi_diff1","Rich_Shower_phi_diff1"
,100,-fRichShowerPhiCut-1,fRichShowerPhiCut+1);
pHistArray->Add(pHistDiffRSPhi1);
pHistDiffRSTheta2 = new TH1F("Rich_Shower_theta_diff2","Rich_Shower_theta_diff2"
,100,fRichShowerThetaMinCut-1,fRichShowerThetaMaxCut+1);
pHistArray->Add(pHistDiffRSTheta2);
pHistDiffRSPhi2 = new TH1F("Rich_Shower_phi_diff2","Rich_Shower_phi_diff2"
,100,-fRichShowerPhiCut-1,fRichShowerPhiCut+1);
pHistArray->Add(pHistDiffRSPhi2);
pHistDiffRSTheta3 = new TH1F("Rich_Shower_theta_diff3","Rich_Shower_theta_diff3"
,100,fRichShowerThetaMinCut-1,fRichShowerThetaMaxCut+1);
pHistArray->Add(pHistDiffRSTheta3);
pHistDiffRSPhi3 = new TH1F("Rich_Shower_phi_diff3","Rich_Shower_phi_diff3"
,100,-fRichShowerPhiCut-1,fRichShowerPhiCut+1);
pHistArray->Add(pHistDiffRSPhi3);
pHistDiffRSTheta4 = new TH1F("Rich_Shower_theta_diff4","Rich_Shower_theta_diff4"
,100,fRichShowerThetaMinCut-1,fRichShowerThetaMaxCut+1);
pHistArray->Add(pHistDiffRSTheta4);
pHistDiffRSPhi4 = new TH1F("Rich_Shower_phi_diff4","Rich_Shower_phi_diff4"
,100,-fRichShowerPhiCut-1,fRichShowerPhiCut+1);
pHistArray->Add(pHistDiffRSPhi4);
pHistDiffRSTheta5 = new TH1F("Rich_Shower_theta_diff5","Rich_Shower_theta_diff5"
,100,fRichShowerThetaMinCut-1,fRichShowerThetaMaxCut+1);
pHistArray->Add(pHistDiffRSTheta5);
pHistDiffRSPhi5 = new TH1F("Rich_Shower_phi_diff5","Rich_Shower_phi_diff5"
,100,-fRichShowerPhiCut-1,fRichShowerPhiCut+1);
pHistArray->Add(pHistDiffRSPhi5);
pHistDiffRSTheta6 = new TH1F("Rich_Shower_theta_diff6","Rich_Shower_theta_diff6"
,100,fRichShowerThetaMinCut-1,fRichShowerThetaMaxCut+1);
pHistArray->Add(pHistDiffRSTheta6);
pHistDiffRSPhi6 = new TH1F("Rich_Shower_phi_diff6","Rich_Shower_phi_diff6"
,100,-fRichShowerPhiCut-1,fRichShowerPhiCut+1);
pHistArray->Add(pHistDiffRSPhi6);
pHistRTTheta = new TH2D("Rich_Tof_theta","Rich_Tof_theta"
,90,0,90,90,0,90);
pHistArray->Add(pHistRTTheta);
pHistRTPhi = new TH2D("Rich_Tof_phi","Rich_Tof_phi"
,360,0,360,360,0,360);
pHistArray->Add(pHistRTTheta);
pHistDiffRTTheta1 = new TH1F("Rich_Tof_theta_diff1","Rich_Tof_theta_diff1"
,100,fRichTofThetaMinCut-1,fRichTofThetaMaxCut+1);
pHistArray->Add(pHistDiffRTTheta1);
pHistDiffRTPhi1 = new TH1F("Rich_Tof_phi_diff1","Rich_Tof_phi_diff1"
,100,-fRichTofPhiCut-1,fRichTofPhiCut+1);
pHistArray->Add(pHistDiffRTPhi1);
pHistDiffRTTheta2 = new TH1F("Rich_Tof_theta_diff2","Rich_Tof_theta_diff2"
,100,fRichTofThetaMinCut-1,fRichTofThetaMaxCut+1);
pHistArray->Add(pHistDiffRTTheta2);
pHistDiffRTPhi2 = new TH1F("Rich_Tof_phi_diff2","Rich_Tof_phi_diff2"
,100,-fRichTofPhiCut-1,fRichTofPhiCut+1);
pHistArray->Add(pHistDiffRTPhi2);
pHistDiffRTTheta3 = new TH1F("Rich_Tof_theta_diff3","Rich_Tof_theta_diff3"
,100,fRichTofThetaMinCut-1,fRichTofThetaMaxCut+1);
pHistArray->Add(pHistDiffRTTheta3);
pHistDiffRTPhi3 = new TH1F("Rich_Tof_phi_diff3","Rich_Tof_phi_diff3"
,100,-fRichTofPhiCut-1,fRichTofPhiCut+1);
pHistArray->Add(pHistDiffRTPhi3);
pHistDiffRTTheta4 = new TH1F("Rich_Tof_theta_diff4","Rich_Tof_theta_diff4"
,100,fRichTofThetaMinCut-1,fRichTofThetaMaxCut+1);
pHistArray->Add(pHistDiffRTTheta4);
pHistDiffRTPhi4 = new TH1F("Rich_Tof_phi_diff4","Rich_Tof_phi_diff4"
,100,-fRichTofPhiCut-1,fRichTofPhiCut+1);
pHistArray->Add(pHistDiffRTPhi4);
pHistDiffRTTheta5 = new TH1F("Rich_Tof_theta_diff5","Rich_Tof_theta_diff5"
,100,fRichTofThetaMinCut-1,fRichTofThetaMaxCut+1);
pHistArray->Add(pHistDiffRTTheta5);
pHistDiffRTPhi5 = new TH1F("Rich_Tof_phi_diff5","Rich_Tof_phi_diff5"
,100,-fRichTofPhiCut-1,fRichTofPhiCut+1);
pHistArray->Add(pHistDiffRTPhi5);
pHistDiffRTTheta6 = new TH1F("Rich_Tof_theta_diff6","Rich_Tof_theta_diff6"
,100,fRichTofThetaMinCut-1,fRichTofThetaMaxCut+1);
pHistArray->Add(pHistDiffRTTheta6);
pHistDiffRTPhi6 = new TH1F("Rich_Tof_phi_diff6","Rich_Tof_phi_diff6"
,100,-fRichTofPhiCut-1,fRichTofPhiCut+1);
pHistArray->Add(pHistDiffRTPhi6);
pHistMTTheta = new TH2D("Mdc_Tof_theta","Mdc_Tof_theta"
,90,0,90,90,0,90);
pHistArray->Add(pHistMTTheta);
pHistMTPhi = new TH2D("Mdc_Tof_phi","Mdc_Tof_phi"
,360,0,360,360,0,360);
pHistArray->Add(pHistMTPhi);
pHistDiffMTTheta1 = new TH1F("Mdc_Tof_theta_diff1","Mdc_Tof_theta_diff1"
,100,fMdcTofThetaMinCut-1,fMdcTofThetaMaxCut+1);
pHistArray->Add(pHistDiffMTTheta1);
pHistDiffMTPhi1 = new TH1F("Mdc_Tof_phi_diff1","Mdc_Tof_phi_diff1"
,100,-fMdcTofPhiCut-1,fMdcTofPhiCut+1);
pHistArray->Add(pHistDiffMTPhi1);
pHistDiffMTTheta2 = new TH1F("Mdc_Tof_theta_diff2","Mdc_Tof_theta_diff2"
,100,fMdcTofThetaMinCut-1,fMdcTofThetaMaxCut+1);
pHistArray->Add(pHistDiffMTTheta2);
pHistDiffMTPhi2 = new TH1F("Mdc_Tof_phi_diff2","Mdc_Tof_phi_diff2"
,100,-fMdcTofPhiCut-1,fMdcTofPhiCut+1);
pHistArray->Add(pHistDiffMTPhi2);
pHistDiffMTTheta3 = new TH1F("Mdc_Tof_theta_diff3","Mdc_Tof_theta_diff3"
,100,fMdcTofThetaMinCut-1,fMdcTofThetaMaxCut+1);
pHistArray->Add(pHistDiffMTTheta3);
pHistDiffMTPhi3 = new TH1F("Mdc_Tof_phi_diff3","Mdc_Tof_phi_diff3"
,100,-fMdcTofPhiCut-1,fMdcTofPhiCut+1);
pHistArray->Add(pHistDiffMTPhi3);
pHistDiffMTTheta4 = new TH1F("Mdc_Tof_theta_diff4","Mdc_Tof_theta_diff4"
,100,fMdcTofThetaMinCut-1,fMdcTofThetaMaxCut+1);
pHistArray->Add(pHistDiffMTTheta4);
pHistDiffMTPhi4 = new TH1F("Mdc_Tof_phi_diff4","Mdc_Tof_phi_diff4"
,100,-fMdcTofPhiCut-1,fMdcTofPhiCut+1);
pHistArray->Add(pHistDiffMTPhi4);
pHistDiffMTTheta5 = new TH1F("Mdc_Tof_theta_diff5","Mdc_Tof_theta_diff5"
,100,fMdcTofThetaMinCut-1,fMdcTofThetaMaxCut+1);
pHistArray->Add(pHistDiffMTTheta5);
pHistDiffMTPhi5 = new TH1F("Mdc_Tof_phi_diff5","Mdc_Tof_phi_diff5"
,100,-fMdcTofPhiCut-1,fMdcTofPhiCut+1);
pHistArray->Add(pHistDiffMTPhi5);
pHistDiffMTTheta6 = new TH1F("Mdc_Tof_theta_diff6","Mdc_Tof_theta_diff6"
,100,fMdcTofThetaMinCut-1,fMdcTofThetaMaxCut+1);
pHistArray->Add(pHistDiffMTTheta6);
pHistDiffMTPhi6 = new TH1F("Mdc_Tof_phi_diff6","Mdc_Tof_phi_diff6"
,100,-fMdcTofPhiCut-1,fMdcTofPhiCut+1);
pHistArray->Add(pHistDiffMTPhi6);
pHistMSTheta = new TH2D("Mdc_Shower_theta","Mdc_Shower_theta"
,90,0,90,90,0,90);
pHistArray->Add(pHistMSTheta);
pHistMSPhi = new TH2D("Mdc_Shower_phi","Mdc_Shower_phi"
,360,0,360,360,0,360);
pHistArray->Add(pHistMSPhi);
pHistDiffMSTheta1 = new TH1F("Mdc_Shower_theta_diff1","Mdc_Shower_theta_diff1"
,100,fMdcShowerThetaMinCut-1,fMdcShowerThetaCut);
pHistArray->Add(pHistDiffMSTheta1);
pHistDiffMSPhi1 = new TH1F("Mdc_Shower_phi_diff1","Mdc_Shower_phi_diff1"
,100,-fMdcShowerPhiCut-1,fMdcShowerPhiCut+1);
pHistArray->Add(pHistDiffMSPhi1);
pHistDiffMSTheta2 = new TH1F("Mdc_Shower_theta_diff2","Mdc_Shower_theta_diff2"
,100,fMdcShowerThetaMinCut-1,fMdcShowerThetaMaxCut+1);
pHistArray->Add(pHistDiffMSTheta2);
pHistDiffMSPhi2 = new TH1F("Mdc_Shower_phi_diff2","Mdc_Shower_phi_diff2"
,100,-fMdcShowerPhiCut-1,fMdcShowerPhiCut+1);
pHistArray->Add(pHistDiffMSPhi2);
pHistDiffMSTheta3 = new TH1F("Mdc_Shower_theta_diff3","Mdc_Shower_theta_diff3"
,100,fMdcShowerThetaMinCut-1,fMdcShowerThetaMaxCut+1);
pHistArray->Add(pHistDiffMSTheta3);
pHistDiffMSPhi3 = new TH1F("Mdc_Shower_phi_diff3","Mdc_Shower_phi_diff3"
,100,-fMdcShowerPhiCut-1,fMdcShowerPhiCut+1);
pHistArray->Add(pHistDiffMSPhi3);
pHistDiffMSTheta4 = new TH1F("Mdc_Shower_theta_diff4","Mdc_Shower_theta_diff4"
,100,fMdcShowerThetaMinCut-1,fMdcShowerThetaMaxCut+1);
pHistArray->Add(pHistDiffMSTheta4);
pHistDiffMSPhi4 = new TH1F("Mdc_Shower_phi_diff4","Mdc_Shower_phi_diff4"
,100,-fMdcShowerPhiCut-1,fMdcShowerPhiCut+1);
pHistArray->Add(pHistDiffMSPhi4);
pHistDiffMSTheta5 = new TH1F("Mdc_Shower_theta_diff5","Mdc_Shower_theta_diff5"
,100,fMdcShowerThetaMinCut-1,fMdcShowerThetaMaxCut+1);
pHistArray->Add(pHistDiffMSTheta5);
pHistDiffMSPhi5 = new TH1F("Mdc_Shower_phi_diff5","Mdc_Shower_phi_diff5"
,100,-fMdcShowerPhiCut-1,fMdcShowerPhiCut+1);
pHistArray->Add(pHistDiffMSPhi5);
pHistDiffMSTheta6 = new TH1F("Mdc_Shower_theta_diff6","Mdc_Shower_theta_diff6"
,100,fMdcShowerThetaMinCut-1,fMdcShowerThetaMaxCut+1);
pHistArray->Add(pHistDiffMSTheta6);
pHistDiffMSPhi6 = new TH1F("Mdc_Shower_phi_diff6","Mdc_Shower_phi_diff6"
,100,-fMdcShowerPhiCut-1,fMdcShowerPhiCut+1);
pHistArray->Add(pHistDiffMSPhi6);
pHistRMTRingHouTra = new TH1F("RMT_Hough","RMT_Hough"
,nNbBinsForHouTra,0,nHouTraMax);
pHistArray->Add(pHistRMTRingHouTra);
pHistRMTRingPatMat = new TH1F("RMT_PatMat","RMT_PatMat"
,nNbBinsForPatMat,0,800);
pHistArray->Add(pHistRMTRingPatMat);
pHistRMTRingAmplitude = new TH1F("RMT_Ampl","RMT_Ampl",100,0,1000);
pHistArray->Add(pHistRMTRingAmplitude);
pHistRMTRingPadNr = new TH1F("RMT_PadNr","RMT_PadNr",40,0,40);
pHistArray->Add(pHistRMTRingPadNr);
pHistRMTRingLocMax4 = new TH1F("RMT_LocMax4","RMT_LocMax4",15,0,15);
pHistArray->Add(pHistRMTRingLocMax4);
pHistRMTRingRadius = new TH1F("RMT_Radius","RMT_Radius",40,2,6);
pHistArray->Add(pHistRMTRingRadius);
pHistRMTRingCenterX = new TH1F("RMT_X","RMT_X",90,0,90);
pHistArray->Add(pHistRMTRingCenterX);
pHistRMTRingCenterY = new TH1F("RMT_Y","RMT_Y",90,0,90);
pHistArray->Add(pHistRMTRingCenterY);
pHistRMTRingTheta = new TH1F("RMT_Theta","RMT_Theta",90,0,90);
pHistArray->Add(pHistRMTRingTheta);
pHistRMTRingPhi = new TH1F("RMT_Phi","RMT_Phi",360,0,360);
pHistArray->Add(pHistRMTRingPhi);
pHistRMSRingHouTra = new TH1F("RMS_Hough","RMS_Hough"
,nNbBinsForHouTra,0,nHouTraMax);
pHistArray->Add(pHistRMSRingHouTra);
pHistRMSRingPatMat = new TH1F("RMS_PatMat","RMS_PatMat"
,nNbBinsForPatMat,0,800);
pHistArray->Add(pHistRMSRingPatMat);
pHistRMSRingAmplitude = new TH1F("RMS_Ampl","RMS_Ampl",100,0,1000);
pHistArray->Add(pHistRMSRingAmplitude);
pHistRMSRingPadNr = new TH1F("RMS_PadNr","RMS_PadNr",40,0,40);
pHistArray->Add(pHistRMSRingPadNr);
pHistRMSRingLocMax4 = new TH1F("RMS_LocMax4","RMS_LocMax4",15,0,15);
pHistArray->Add(pHistRMSRingLocMax4);
pHistRMSRingRadius = new TH1F("RMS_Radius","RMS_Radius",40,2,6);
pHistArray->Add(pHistRMSRingRadius);
pHistRMSRingCenterX = new TH1F("RMS_X","RMS_X",90,0,90);
pHistArray->Add(pHistRMSRingCenterX);
pHistRMSRingCenterY = new TH1F("RMS_Y","RMS_Y",90,0,90);
pHistArray->Add(pHistRMSRingCenterY);
pHistRMSRingTheta = new TH1F("RMS_Theta","RMS_Theta",90,0,90);
pHistArray->Add(pHistRMSRingTheta);
pHistRMSRingPhi = new TH1F("RMS_Phi","RMS_Phi",360,0,360);
pHistArray->Add(pHistRMSRingPhi);
pHistRMRingHouTra = new TH1F("RM_Hough","RM_Hough"
,nNbBinsForHouTra,0,nHouTraMax);
pHistArray->Add(pHistRMRingHouTra);
pHistRMRingPatMat = new TH1F("RM_PatMat","RM_PatMat"
,nNbBinsForPatMat,0,800);
pHistArray->Add(pHistRMRingPatMat);
pHistRMRingAmplitude = new TH1F("RM_Ampl","RM_Ampl",100,0,1000);
pHistArray->Add(pHistRMRingAmplitude);
pHistRMRingPadNr = new TH1F("RM_PadNr","RM_PadNr",40,0,40);
pHistArray->Add(pHistRMRingPadNr);
pHistRMRingLocMax4 = new TH1F("RM_LocMax4","RM_LocMax4",15,0,15);
pHistArray->Add(pHistRMRingLocMax4);
pHistRMRingRadius = new TH1F("RM_Radius","RM_Radius",40,2,6);
pHistArray->Add(pHistRMRingRadius);
pHistRMRingCenterX = new TH1F("RM_X","RM_X",90,0,90);
pHistArray->Add(pHistRMRingCenterX);
pHistRMRingCenterY = new TH1F("RM_Y","RM_Y",90,0,90);
pHistArray->Add(pHistRMRingCenterY);
pHistRMRingTheta = new TH1F("RM_Theta","RM_Theta",90,0,90);
pHistArray->Add(pHistRMRingTheta);
pHistRMRingPhi = new TH1F("RM_Phi","RM_Phi",360,0,360);
pHistArray->Add(pHistRMRingPhi);
pHistALLRingHouTra = new TH1F("ALL_Hough","ALL_Hough"
,nNbBinsForHouTra,0,nHouTraMax);
pHistArray->Add(pHistALLRingHouTra);
pHistALLRingPatMat = new TH1F("ALL_PatMat","ALL_PatMat"
,nNbBinsForPatMat,0,800);
pHistArray->Add(pHistALLRingPatMat);
pHistALLRingAmplitude = new TH1F("ALL_Ampl","ALL_Ampl",100,0,1000);
pHistArray->Add(pHistALLRingAmplitude);
pHistALLRingPadNr = new TH1F("ALL_PadNr","ALL_PadNr",40,0,40);
pHistArray->Add(pHistALLRingPadNr);
pHistALLRingLocMax4 = new TH1F("ALL_LocMax4","ALL_LocMax4",15,0,15);
pHistArray->Add(pHistALLRingLocMax4);
pHistALLRingRadius = new TH1F("ALL_Radius","ALL_Radius",40,2,6);
pHistArray->Add(pHistALLRingRadius);
pHistALLRingCenterX = new TH1F("ALL_X","ALL_X",90,0,90);
pHistArray->Add(pHistALLRingCenterX);
pHistALLRingCenterY = new TH1F("ALL_Y","ALL_Y",90,0,90);
pHistArray->Add(pHistALLRingCenterY);
pHistALLRingTheta = new TH1F("ALL_Theta","ALL_Theta",90,0,90);
pHistArray->Add(pHistALLRingTheta);
pHistALLRingPhi = new TH1F("ALL_Phi","ALL_Phi",360,0,360);
pHistArray->Add(pHistALLRingPhi);
pHistRMSRingHouTraTheta = new TH2D("RMS_HouTra_Theta","RMS_HouTra_Theta"
,90,0,90,nNbBinsForHouTra,0,nHouTraMax);
pHistArray->Add(pHistRMSRingHouTraTheta);
pHistRMTRingHouTraTheta = new TH2D("RMT_HouTra_Theta","RMT_HouTra_Theta"
,90,0,90,nNbBinsForHouTra,0,nHouTraMax);
pHistArray->Add(pHistRMTRingHouTraTheta);
pHistRMSRingPatMatTheta = new TH2D("RMS_PatMat_Theta","RMS_PatMat_Theta"
,90,0,90,nNbBinsForPatMat,0,800);
pHistArray->Add(pHistRMSRingPatMatTheta);
pHistRMTRingPatMatTheta = new TH2D("RMT_PatMat_Theta","RMT_PatMat_Theta"
,90,0,90,nNbBinsForPatMat,0,800);
pHistArray->Add(pHistRMTRingPatMatTheta);
pHistALLRingHouTraTheta = new TH2D("ALL_HouTra_Theta","ALL_HouTra_Theta"
,90,0,90,nNbBinsForHouTra,0,nHouTraMax);
pHistArray->Add(pHistALLRingHouTraTheta);
pHistALLRingPatMatTheta = new TH2D("ALL_PatMat_Theta","ALL_PatMat_Theta"
,90,0,90,nNbBinsForPatMat,0,800);
pHistArray->Add(pHistALLRingPatMatTheta);
pHistRMRingHouTraTheta = new TH2D("RM_HouTra_Theta","RM_HouTra_Theta"
,90,0,90,nNbBinsForHouTra,0,nHouTraMax);
pHistArray->Add(pHistRMRingHouTraTheta);
pHistRMRingPatMatTheta = new TH2D("RM_PatMat_Theta","RM_PatMat_Theta"
,90,0,90,nNbBinsForPatMat,0,800);
pHistArray->Add(pHistRMRingPatMatTheta);
pHistRMTRingAmplitudeTheta = new TH2D("RMT_Ampli_Theta","RMT_Ampli_Theta"
,90,0,90,100,0,1000);
pHistArray->Add(pHistRMTRingAmplitudeTheta);
pHistRMRingAmplitudeTheta = new TH2D("RM_Ampli_Theta","RM_Ampli_Theta"
,90,0,90,100,0,1000);
pHistArray->Add(pHistRMRingAmplitudeTheta);
pHistRMSRingAmplitudeTheta = new TH2D("RMS_Ampli_Theta","RMS_Ampli_Theta"
,90,0,90,100,0,1000);
pHistArray->Add(pHistRMSRingAmplitudeTheta);
pHistALLRingAmplitudeTheta = new TH2D("ALL_Ampli_Theta","ALL_Ampli_Theta"
,90,0,90,100,0,1000);
pHistArray->Add(pHistALLRingAmplitudeTheta);
pHistRMTRingPadNrTheta = new TH2D("RMT_PadNr_Theta","RMT_PadNr_Theta"
,90,0,90,40,0,40);
pHistArray->Add(pHistRMTRingPadNrTheta);
pHistRMRingPadNrTheta = new TH2D("RM_PadNr_Theta","RM_PadNr_Theta"
,90,0,90,40,0,40);
pHistArray->Add(pHistRMRingPadNrTheta);
pHistRMSRingPadNrTheta = new TH2D("RMS_PadNr_Theta","RMS_PadNr_Theta"
,90,0,90,40,0,40);
pHistArray->Add(pHistRMSRingPadNrTheta);
pHistALLRingPadNrTheta = new TH2D("ALL_PadNr_Theta","ALL_PadNr_Theta"
,90,0,90,40,0,40);
pHistArray->Add(pHistALLRingPadNrTheta);
pHistRMTRingLocMax4Theta = new TH2D("RMT_LocMax4_Theta","RMT_LocMax4_Theta"
,90,0,90,15,0,15);
pHistArray->Add(pHistRMTRingLocMax4Theta);
pHistRMRingLocMax4Theta = new TH2D("RM_LocMax4_Theta","RM_LocMax4_Theta"
,90,0,90,15,0,15);
pHistArray->Add(pHistRMRingLocMax4Theta);
pHistRMSRingLocMax4Theta = new TH2D("RMS_LocMax4_Theta","RMS_LocMax4_Theta"
,90,0,90,15,0,15);
pHistArray->Add(pHistRMSRingLocMax4Theta);
pHistALLRingLocMax4Theta = new TH2D("ALL_LocMax4_Theta","ALL_LocMax4_Theta"
,90,0,90,15,0,15);
pHistArray->Add(pHistALLRingLocMax4Theta);
}
void HRichCorrelator::incrementRingCount(HRichHit *pRichHit){
nCounterTotalNbRings++;
Float_t fRT = pRichHit->getTheta();
if (fRT>45.) nCounterRingsAbove45++;
else nCounterRingsBelow45++;
}
Int_t HRichCorrelator::execute()
{
if (isComplex)
{
HRichHit *pRichHit =0;
HTofHit *pTofHit =0;
HShowerHitTof *pShowerHitTof=0;
HMdcSeg *pMdcSeg =0;
fRichIter->Reset();
Int_t nTofObjCounter = 0;
fTofIter->Reset();
while((pTofHit = (HTofHit *)fTofIter->Next()))
{
nTofObjCounter++;
TObjArray *pRT = new TObjArray(5);
TObjArray *pMT = new TObjArray(5);
if ( kNoSectorSelected || isSelectedSector(pTofHit->getSector()))
{
if(!kSwitchOffRich)
{
fRichIter->Reset();
while((pRichHit = (HRichHit *)fRichIter->Next()))
{
if(isGoodRing(pRichHit))
{
if (nTofObjCounter==1)
{
fillALLRingHistos(pRichHit);
incrementRingCount(pRichHit);
}
if (isCorrelated(pRichHit,pTofHit))
{
HHitMatch *pHM = new HHitMatch();
fillHitMatch(pHM,pRichHit,pTofHit);
pRT->Add(pHM);
nCounterRingsCorrTof++;
}
}
}
}
fMdcSegIter->Reset();
while((pMdcSeg = (HMdcSeg *)fMdcSegIter->Next()))
{
if (isCorrelated(pMdcSeg,pTofHit))
{
if (pRT->GetLast()==-1)
{
HHitMatch *pHM = new HHitMatch();
fillHitMatch(pHM,pMdcSeg,pTofHit);
pMT->Add(pHM);
}
else
{
for (Int_t i=0;i<(pRT->GetLast()+1);i++)
{
if( ((HHitMatch*)(*pRT)[i])->getMdcInd()==-1)
{
fillHitMatch((HHitMatch*)(*pRT)[i],pMdcSeg,pTofHit);
}
else
{
HHitMatch *pHMcpy = new HHitMatch();
*pHMcpy = *((HHitMatch*)(*pRT)[i]);
fillHitMatch(pHMcpy,pMdcSeg,pTofHit);
pMT->Add(pHMcpy);
}
}
}
}
}
}
for (Int_t i=0;i<(pRT->GetLast()+1);i++)
{
HHitMatch* pHM = createHitMatch(((HHitMatch*)(*pRT)[i])->getSector());
*pHM = * ((HHitMatch*)(*pRT)[i]);
delete (HHitMatch*)(*pRT)[i];
}
delete pRT;
for (Int_t j=0;j<(pMT->GetLast()+1);j++)
{
HHitMatch* pHM = createHitMatch(((HHitMatch*)(*pMT)[j])->getSector());
*pHM = * ((HHitMatch*)(*pMT)[j]);
delete (HHitMatch*)(*pMT)[j];
}
delete pMT;
}
fShowerTofIter->Reset();
while((pShowerHitTof = (HShowerHitTof *)fShowerTofIter->Next()))
{
TObjArray* pRS = new TObjArray(5);
TObjArray* pMS = new TObjArray(5);
if ( kNoSectorSelected || isSelectedSector(pShowerHitTof->getSector()))
{
if(!kSwitchOffRich)
{
fRichIter->Reset();
while((pRichHit = (HRichHit *)fRichIter->Next()))
{
if (isGoodRing(pRichHit))
{
if (isCorrelated(pRichHit,pShowerHitTof))
{
HHitMatch *pHM = new HHitMatch();
fillHitMatch(pHM,pRichHit,pShowerHitTof);
pRS->Add(pHM);
nCounterRingsCorrShower++;
}
}
}
}
fMdcSegIter->Reset();
while((pMdcSeg = (HMdcSeg *)fMdcSegIter->Next()))
{
if (isCorrelated(pMdcSeg,pShowerHitTof))
{
if (pRS->GetLast()==-1)
{
HHitMatch* pHM = new HHitMatch();
fillHitMatch(pHM,pMdcSeg,pShowerHitTof);
pMS->Add(pHM);
}
else
{
for (Int_t i=0;i<(pRS->GetLast()+1);i++)
{
if (((HHitMatch*)(*pRS)[i])->getMdcInd()==-1)
{
fillHitMatch((HHitMatch*)(*pRS)[i],pMdcSeg,
pShowerHitTof);
}
else
{
HHitMatch *pHMcpy = new HHitMatch();
*pHMcpy = *((HHitMatch*)(*pRS)[i]);
fillHitMatch(pHMcpy,pMdcSeg,pShowerHitTof);
pMS->Add(pHMcpy);
}
}
}
}
}
}
for (Int_t i=0;i<(pRS->GetLast()+1);i++)
{
HHitMatch* pHM = createHitMatch(((HHitMatch*)(*pRS)[i])->getSector());
*pHM = * ((HHitMatch*)(*pRS)[i]);
delete (HHitMatch*)(*pRS)[i];
}
delete pRS;
for (Int_t j=0;j<(pMS->GetLast()+1);j++)
{
HHitMatch* pHM = createHitMatch(((HHitMatch*)(*pMS)[j])->getSector());
*pHM = * ((HHitMatch*)(*pMS)[j]);
delete (HHitMatch*)(*pMS)[j];
}
delete pMS;
}
if (!kSwitchOffRich){
Int_t nMaxNbRMCorrs = getRichHitCat()->getEntries()*
getMdcSegCat()->getEntries();
Int_t *nRichInd = new Int_t[nMaxNbRMCorrs];
Int_t *nMdcSegInd = new Int_t[nMaxNbRMCorrs];
Int_t *nUsedInd = new Int_t[nMaxNbRMCorrs];
for (Int_t i=0;i<nMaxNbRMCorrs;i++)
{
nRichInd[i]=-1;
nMdcSegInd[i]=-1;
nUsedInd[i]=-1;
}
Int_t nRMCorrCounter=0;
fRichIter->Reset();
while((pRichHit = (HRichHit *)fRichIter->Next()))
{
if (isGoodRing(pRichHit))
{
fMdcSegIter->Reset();
while((pMdcSeg = (HMdcSeg *)fMdcSegIter->Next()))
{
if(isCorrelated(pRichHit,pMdcSeg))
{
nRichInd[nRMCorrCounter]=getRichHitCat()
->getIndex(pRichHit);
nMdcSegInd[nRMCorrCounter]=getMdcSegCat()
->getIndex(pMdcSeg);
nUsedInd[nRMCorrCounter]=0;
nRMCorrCounter++;
}
}
}
}
HHitMatch *pHM=0;
Int_t nMdcHMInd,nRichHMInd;
nMdcHMInd=nRichHMInd=0;
pIterMatchHit->Reset();
while(( pHM= (HHitMatch *)pIterMatchHit->Next()))
{
nRichHMInd=pHM->getRichInd();
nMdcHMInd=pHM->getMdcInd();
if (nMdcHMInd>-1 && nRichHMInd>-1)
{
for (Int_t i=0;i<nMaxNbRMCorrs;i++)
{
if (nRichInd[i]==-1) break;
if (nRichInd[i]==nRichHMInd &&
nMdcSegInd[i]==nMdcHMInd )
{
pHM->setMatchedRichMdc(1);
nUsedInd[i]++;
}
}
}
else if (nMdcHMInd>-1 && nRichHMInd==-1)
{
for (Int_t i=0;i<nMaxNbRMCorrs;i++)
{
if (nMdcSegInd[i]==-1) break;
if (nMdcSegInd[i]==nMdcHMInd)
{
HRichHit* r =((HRichHit*)getRichHitCat()
->getObject(nRichInd[i]));
if(r) setRich(pHM,r);
pHM->setMatchedRichMdc(1);
nUsedInd[i]++;
}
}
}
else if (nMdcHMInd==-1 && nRichHMInd>-1)
{
for (Int_t i=0;i<nMaxNbRMCorrs;i++)
{
if (nRichInd[i]==-1) break;
if (nRichInd[i]==nRichHMInd)
{
HMdcSeg* m =((HMdcSeg*)getMdcSegCat()
->getObject(nMdcSegInd[i]));
if(m) setMdc(pHM,m);
pHM->setMatchedRichMdc(1);
nUsedInd[i]++;
}
}
}
}
for (Int_t i=0;i<nMaxNbRMCorrs;i++)
{
if (nUsedInd[i]==-1) break;
if (nUsedInd[i]==0)
{
HMdcSeg* m =((HMdcSeg*)getMdcSegCat()
->getObject(nMdcSegInd[i]));
HRichHit* r =((HRichHit*)getRichHitCat()
->getObject(nRichInd[i]));
HHitMatch* pHM = createHitMatch(r->getSector());
fillHitMatch(pHM,r,m);
}
}
delete nRichInd;
delete nMdcSegInd;
delete nUsedInd;
}
HHitMatchHeader *pHMH = createHitMatchHeader();
fillHitMatchHeader(pHMH);
matchKickTracks();
nCounterProcessedNbEvents++;
}
else
{
TObjArray *pRK = new TObjArray(5);
HKickTrack *kick = 0;
iterTracks->Reset();
while ((kick=(HKickTrack*) iterTracks->Next())!=0)
{
HRichHit *ring=0;
fRichIter->Reset();
while((ring = (HRichHit *)fRichIter->Next()))
{
if (isGoodRing(ring))
{
if (isCorrelated(ring,kick))
{
HHitMatch *pHM = new HHitMatch();
fillHitMatch(pHM,ring,kick);
pRK->Add(pHM);
}
}
}
}
for (Int_t i=0;i<(pRK->GetLast()+1);i++)
{
HHitMatch* pHM = createHitMatch(((HHitMatch*)(*pRK)[i])->getSector());
*pHM = * ((HHitMatch*)(*pRK)[i]);
delete (HHitMatch*)(*pRK)[i];
}
delete pRK;
}
HHitMatchHeader *pHMH = createHitMatchHeader();
fillHitMatchHeader(pHMH);
nCounterProcessedNbEvents++;
return kFALSE;
}
void HRichCorrelator::matchKickTracks()
{
Int_t nbKicktracks = getKickCat()->getEntries();
Int_t nbHitmatchs = getHitMatchCat()->getEntries();
Int_t* kicktmp = new Int_t[nbKicktracks];
Int_t* hitmtmp = new Int_t[nbHitmatchs];
for (Int_t i=0;i<nbKicktracks;i++) kicktmp[i]=-1;
for (Int_t j=0;j<nbHitmatchs;j++) hitmtmp[j]=-1;
HHitMatch *h=0;
pIterMatchHit->Reset();
while((h = (HHitMatch *)pIterMatchHit->Next()))
{
Int_t mh = h->getMdcInd();
Int_t th = h->getTofInd();
Int_t sh = h->getShowInd();
Int_t hsec = h->getSector();
HKickTrack *t = 0;
iterTracks->Reset();
while ((t=(HKickTrack*) iterTracks->Next())!=0)
{
Int_t mt = t->getSegment();
Int_t sys = t->getSystem();
Int_t metat = t->getOuterHitId();
Int_t tsec = t->getSector();
HLocation segLoc;
segLoc.set(3,tsec,0,mt);
Int_t trk_mdcseg_ind = ((HCategory*)getMdcSegCat())->getIndex(segLoc);
if (hsec==tsec && mh==trk_mdcseg_ind)
{
Int_t trk_tof_ind = -1;
Bool_t isMatched = kFALSE;
if (sys==0 && sh!=-1 && metat==sh) isMatched = kTRUE;
else if (sys>0 && th!=-1)
{
Int_t tof_sec=metat/1000;
Int_t tof_mod=(metat%1000)/100;
Int_t tof_cell=(metat%1000)%100;
HLocation fLoc;
fLoc.set(3,0,0,0);
fLoc[0]=tof_sec;
fLoc[1]=tof_mod;
fLoc[2]=tof_cell;
trk_tof_ind = ((HCategory *)getTofHitCat())->getIndex(fLoc);
if (th==trk_tof_ind) isMatched = kTRUE;
}
if (isMatched)
{
setKick(h,t);
Int_t kickind=getKickCat()->getIndex(t);
Int_t hitind =getHitMatchCat()->getIndex(h);
kicktmp[kickind]=1;
hitmtmp[hitind]=1;
break;
}
}
}
}
delete [] hitmtmp;
delete [] kicktmp;
}
Bool_t HRichCorrelator::delRichHit(TObjArray *t)
{
if (t)
{
for (Int_t i=0;i<(t->GetLast()+1);i++)
{
((TClonesArray*)((HLinearCategory*)getRichHitCat())->getCollection())
->Remove((HRichHit*)((*t)[i]));
((TClonesArray*)((HLinearCategory*)getRichHitCat())
->getCollection())->Compress();
nCounterNbRejectedRings++;
}
return kTRUE;
}
return kFALSE;
}
Bool_t HRichCorrelator::finalize() {
dumpCorrelationStatus();
return kTRUE;
}
HHitMatchHeader* HRichCorrelator::createHitMatchHeader()
{
HLocation loc;
loc.set(1,0);
HHitMatchHeader *pHMH = (HHitMatchHeader*)((HLinearCategory*)
getHitMatchHeaderCat())->getNewSlot(loc);
if (pHMH) pHMH = new(pHMH) HHitMatchHeader;
return pHMH;
}
Int_t HRichCorrelator::fillUniqueIndex(Int_t i,Int_t max,Int_t* iarr)
{
Int_t n=0;
do{
if(i==iarr[n]) return 0;
else if(iarr[n]==-2)
{
iarr[n]=i;
return n+1;
}
n++;
} while(n<max);
return 0;
}
Int_t HRichCorrelator::countDiscreteIndexes(Int_t *iarr,Int_t max)
{
Int_t n=0;
for(Int_t i=0;i<max;i++)
{
if(iarr[i]!=-2 && iarr[i]!=-1) n++;
else break;
}
return n;
}
void HRichCorrelator::fillHitMatchHeader(HHitMatchHeader *pHMH)
{
HRichHit *pRichHit =0;
HTofHit *pTofHit =0;
HShowerHitTof *pShowerHitTof=0;
HMdcSeg *pMdcSeg =0;
HHitMatch *pHM =0;
Int_t nRichCnt=0;
fRichIter->Reset();
while((pRichHit = (HRichHit *)fRichIter->Next())) nRichCnt++;
Int_t nTofCnt=0;
fTofIter->Reset();
while((pTofHit = (HTofHit *)fTofIter->Next())) nTofCnt++;
Int_t nMdcSegCnt=0;
fMdcSegIter->Reset();
while((pMdcSeg = (HMdcSeg *)fMdcSegIter->Next())) nMdcSegCnt++;
Int_t nShowerCnt=0;
fShowerTofIter->Reset();
while((pShowerHitTof=(HShowerHitTof *)fShowerTofIter->Next())) nShowerCnt++;
Int_t nNbCorrObjs=0;
pIterMatchHit->Reset();
while(( pHM= (HHitMatch *)pIterMatchHit->Next())) nNbCorrObjs++;
Int_t *tRind = new Int_t[nNbCorrObjs];
Int_t *tRichminRMind = new Int_t[nNbCorrObjs];
Int_t *tRichminRTind = new Int_t[nNbCorrObjs];
Int_t *tRichminRSind = new Int_t[nNbCorrObjs];
Int_t *tRichminRMTind = new Int_t[nNbCorrObjs];
Int_t *tRichminRMSind = new Int_t[nNbCorrObjs];
Int_t *tRcMcTcRind = new Int_t[nNbCorrObjs];
Int_t *tRcMcScRind = new Int_t[nNbCorrObjs];
Int_t *tRcMTcRind = new Int_t[nNbCorrObjs];
Int_t *tRcMScRind = new Int_t[nNbCorrObjs];
Int_t *tRcMcTind = new Int_t[nNbCorrObjs];
Int_t *tRcMcSind = new Int_t[nNbCorrObjs];
Int_t *tRMcTcRind = new Int_t[nNbCorrObjs];
Int_t *tRMcScRind = new Int_t[nNbCorrObjs];
Int_t *tRMind = new Int_t[nNbCorrObjs];
Int_t *tRTind = new Int_t[nNbCorrObjs];
Int_t *tRSind = new Int_t[nNbCorrObjs];
Int_t *tMTind = new Int_t[nNbCorrObjs];
Int_t *tMSind = new Int_t[nNbCorrObjs];
Int_t *tMind = new Int_t[nNbCorrObjs];
Int_t *tTind = new Int_t[nNbCorrObjs];
Int_t *tSind = new Int_t[nNbCorrObjs];
for (Int_t i=0;i<nNbCorrObjs;i++)
{
tRind[i]=tRichminRMind[i]=tRichminRTind[i]=tRichminRSind[i]=tRichminRMTind[i]=tRichminRMSind[i]=tRcMcTcRind[i]=tRcMcScRind[i]=tRcMTcRind[i]=tRcMScRind[i]=tRcMcTind[i]=tRcMcSind[i]=tRMcTcRind[i]=tRMcScRind[i]=tRMind[i]=tRTind[i]=tRSind[i]=tMTind[i]=tMSind[i]=tMind[i]=tTind[i]=tSind[i]=-2;
}
Int_t nlNb_RM=0;
Int_t nlNb_RT=0;
Int_t nlNb_RS=0;
Int_t nlNb_MT=0;
Int_t nlNb_MS=0;
Int_t nlNb_RcMcT=0;
Int_t nlNb_RcMcTcR=0;
Int_t nlNb_RMcTcR=0;
Int_t nlNb_RcMTcR=0;
Int_t nlNb_RcMcS=0;
Int_t nlNb_RcMcScR=0;
Int_t nlNb_RMcScR=0;
Int_t nlNb_RcMScR=0;
Int_t nRTM=0;
Int_t nRSM=0;
pIterMatchHit->Reset();
while(( pHM= (HHitMatch *)pIterMatchHit->Next()))
{
Int_t nRInd = pHM->getRichInd();
Int_t nMInd = pHM->getMdcInd();
Int_t nTInd = pHM->getTofInd();
Int_t nSInd = pHM->getShowInd();
Int_t tmp=0;
if(nRInd!=-1) tmp=fillUniqueIndex(nRInd,nNbCorrObjs,tRind);
if(nMInd!=-1) tmp=fillUniqueIndex(nMInd,nNbCorrObjs,tMind);
if(nTInd!=-1) tmp=fillUniqueIndex(nTInd,nNbCorrObjs,tTind);
if(nSInd!=-1) tmp=fillUniqueIndex(nSInd,nNbCorrObjs,tSind);
Int_t nRM = pHM->getMatchedRichMdc();
Int_t nRT = pHM->getMatchedRichTof();
Int_t nRS = pHM->getMatchedRichShower();
Int_t nMT = pHM->getMatchedMdcTof();
Int_t nMS = pHM->getMatchedMdcShower();
if (nRM==1 && nRInd!=-1) tmp=fillUniqueIndex(nRInd,nNbCorrObjs,tRichminRMind);
if (nRT==1 && nRInd!=-1) tmp=fillUniqueIndex(nRInd,nNbCorrObjs,tRichminRTind);
if (nRS==1 && nRInd!=-1) tmp=fillUniqueIndex(nRInd,nNbCorrObjs,tRichminRSind);
if (nRInd!=-1 && nTInd!=-1 && nMInd!=-1)
{
nRTM++;
tmp=fillUniqueIndex(nRInd,nNbCorrObjs,tRichminRMTind);
}
else if (nRInd!=-1 && nSInd!=-1 && nMInd!=-1)
{
nRSM++;
tmp=fillUniqueIndex(nRInd,nNbCorrObjs,tRichminRMSind);
}
if (nRInd!=-1 && nTInd!=-1 && nMInd!=-1 &&
nRM==1 && nRT==1 && nMT==1 )
{
nlNb_RcMcTcR++;
tmp=fillUniqueIndex(nRInd,nNbCorrObjs,tRcMcTcRind);
}
else if (nRInd!=-1 && nSInd!=-1 && nMInd!=-1 &&
nRM==1 && nRS==1 && nMS==1 )
{
nlNb_RcMcScR++;
tmp=fillUniqueIndex(nRInd,nNbCorrObjs,tRcMcScRind);
}
else if (nRInd!=-1 && nTInd!=-1 && nMInd!=-1 &&
nRM==1 && nRT==1)
{
nlNb_RcMTcR++;
tmp=fillUniqueIndex(nRInd,nNbCorrObjs,tRcMTcRind);
}
else if (nRInd!=-1 && nSInd!=-1 && nMInd!=-1 &&
nRM==1 && nRS==1)
{
nlNb_RcMScR++;
tmp=fillUniqueIndex(nRInd,nNbCorrObjs,tRcMScRind);
}
else if (nRInd!=-1 && nTInd!=-1 && nMInd!=-1 &&
nRM==1 && nMT==1)
{
nlNb_RcMcT++;
tmp=fillUniqueIndex(nRInd,nNbCorrObjs,tRcMcTind);
}
else if (nRInd!=-1 && nSInd!=-1 && nMInd!=-1 &&
nRM==1 && nMS==1)
{
nlNb_RcMcS++;
tmp=fillUniqueIndex(nRInd,nNbCorrObjs,tRcMcSind);
}
else if (nRInd!=-1 && nTInd!=-1 && nMInd!=-1 &&
nRT==1 && nMT==1)
{
nlNb_RMcTcR++;
tmp=fillUniqueIndex(nRInd,nNbCorrObjs,tRMcTcRind);
}
else if (nRInd!=-1 && nSInd!=-1 && nMInd!=-1 &&
nRS==1 && nMS==1)
{
nlNb_RMcScR++;
tmp=fillUniqueIndex(nRInd,nNbCorrObjs,tRMcScRind);
}
if (nRInd!=-1 && nMInd!=-1 && nTInd==-1 && nSInd==-1 &&
nRM==1)
{
nlNb_RM++;
tmp=fillUniqueIndex(nRInd,nNbCorrObjs,tRMind);
}
else if (nRInd!=-1 && nTInd!=-1 && nMInd==-1 && nSInd==-1 &&
nRT==1)
{
nlNb_RT++;
tmp=fillUniqueIndex(nRInd,nNbCorrObjs,tRTind);
}
else if (nRInd!=-1 && nSInd!=-1 && nMInd==-1 && nTInd==-1 &&
nRS==1)
{
nlNb_RS++;
tmp=fillUniqueIndex(nRInd,nNbCorrObjs,tRSind);
}
else if (nMInd!=-1 && nTInd!=-1 && nRInd==-1 && nSInd==-1 &&
nMT==1)
{
nlNb_MT++;
tmp=fillUniqueIndex(nMInd,nNbCorrObjs,tMTind);
}
else if (nMInd!=-1 && nSInd!=-1 && nRInd==-1 && nTInd==-1 &&
nMS==1)
{
nlNb_MS++;
tmp=fillUniqueIndex(nMInd,nNbCorrObjs,tMSind);
}
}
Int_t nDRind = countDiscreteIndexes(tRind,nNbCorrObjs);
Int_t nDRichminRMind = countDiscreteIndexes(tRichminRMind,nNbCorrObjs);
Int_t nDRichminRTind = countDiscreteIndexes(tRichminRTind,nNbCorrObjs);
Int_t nDRichminRSind = countDiscreteIndexes(tRichminRSind,nNbCorrObjs);
Int_t nDRichminRMTind = countDiscreteIndexes(tRichminRMTind,nNbCorrObjs);
Int_t nDRichminRMSind = countDiscreteIndexes(tRichminRMSind,nNbCorrObjs);
Int_t nDRcMcTcRind = countDiscreteIndexes(tRcMcTcRind,nNbCorrObjs);
Int_t nDRcMcScRind = countDiscreteIndexes(tRcMcScRind,nNbCorrObjs);
Int_t nDRcMTcRind = countDiscreteIndexes(tRcMTcRind,nNbCorrObjs);
Int_t nDRcMScRind = countDiscreteIndexes(tRcMScRind,nNbCorrObjs);
Int_t nDRcMcTind = countDiscreteIndexes(tRcMcTind,nNbCorrObjs);
Int_t nDRcMcSind = countDiscreteIndexes(tRcMcSind,nNbCorrObjs);
Int_t nDRMcTcRind = countDiscreteIndexes(tRMcTcRind,nNbCorrObjs);
Int_t nDRMcScRind = countDiscreteIndexes(tRMcScRind,nNbCorrObjs);
Int_t nDRMind = countDiscreteIndexes(tRMind,nNbCorrObjs);
Int_t nDRTind = countDiscreteIndexes(tRTind,nNbCorrObjs);
Int_t nDRSind = countDiscreteIndexes(tRSind,nNbCorrObjs);
Int_t nDMTind = countDiscreteIndexes(tMTind,nNbCorrObjs);
Int_t nDMSind = countDiscreteIndexes(tMSind,nNbCorrObjs);
Int_t nDMind = countDiscreteIndexes(tMind,nNbCorrObjs);
Int_t nDTind = countDiscreteIndexes(tTind,nNbCorrObjs);
Int_t nDSind = countDiscreteIndexes(tSind,nNbCorrObjs);
delete tRind ;
delete tRichminRMind ;
delete tRichminRTind ;
delete tRichminRSind ;
delete tRichminRMTind ;
delete tRichminRMSind ;
delete tRcMcTcRind ;
delete tRcMcScRind ;
delete tRcMTcRind ;
delete tRcMScRind ;
delete tRcMcTind ;
delete tRcMcSind ;
delete tRMcTcRind ;
delete tRMcScRind ;
delete tRMind ;
delete tRTind ;
delete tRSind ;
delete tMTind ;
delete tMSind ;
delete tMind ;
delete tTind ;
delete tSind ;
ngDRind+=nDRind;
ngDRichminRMind+=nDRichminRMind;
ngDRichminRTind+=nDRichminRTind;
ngDRichminRSind+=nDRichminRSind;
ngDRichminRMTind+=nDRichminRMTind;
ngDRichminRMSind+=nDRichminRMSind;
ngDRcMcTcRind+=nDRcMcTcRind;
ngDRcMcScRind+=nDRcMcScRind;
ngDRcMTcRind+=nDRcMTcRind;
ngDRcMScRind+=nDRcMScRind;
ngDRcMcTind+=nDRcMcTind;
ngDRcMcSind+=nDRcMcSind;
ngDRMcTcRind+=nDRMcTcRind;
ngDRMcScRind+=nDRMcScRind;
ngDRMind+=nDRMind;
ngDRTind+=nDRTind;
ngDRSind+=nDRSind;
ngDMTind+=nDMTind;
ngDMSind+=nDMSind;
ngDMind+=nDMind;
ngDTind+=nDTind;
ngDSind+=nDSind;
ngNbCorrObjs+=nNbCorrObjs;
pHMH->setNbCorrObjs(nNbCorrObjs);
pHMH->setNbRichHits(nRichCnt);
pHMH->setNbDiscreteRichHits(nDRind);
pHMH->setNbDiscreteRichRMHits(nDRichminRMind);
pHMH->setNbDiscreteRichonlyRMHits(nDRMind);
pHMH->setNbMdcSegHits(nMdcSegCnt);
pHMH->setNbDiscreteMdcSegHits(nDMind);
pHMH->setNbShowerHits(nShowerCnt);
pHMH->setNbDiscreteShowerHits(nDSind);
pHMH->setNbTofHits(nTofCnt);
pHMH->setNbDiscreteTofHits(nDTind);
ngRichCnt +=nRichCnt;
ngMdcSegCnt+=nMdcSegCnt;
ngShowerCnt+=nShowerCnt;
ngTofCnt +=nTofCnt;
ngNb_RM+=nlNb_RM;
pHMH->setNb_RM(nlNb_RM);
ngNb_RT+=nlNb_RT;
pHMH->setNb_RT(nlNb_RT);
ngNb_RS+=nlNb_RS;
pHMH->setNb_RS(nlNb_RS);
ngNb_MT+=nlNb_MT;
pHMH->setNb_MT(nlNb_MT);
ngNb_MS+=nlNb_MS;
pHMH->setNb_MS(nlNb_MS);
ngNb_RcMcT+=nlNb_RcMcT;
pHMH->setNb_RcMcT(nlNb_RcMcT);
ngNb_RcMcTcR+=nlNb_RcMcTcR;
pHMH->setNb_RcMcTcR(nlNb_RcMcTcR);
ngNb_RMcTcR+=nlNb_RMcTcR;
pHMH->setNb_RMcTcR(nlNb_RMcTcR);
ngNb_RcMTcR+=nlNb_RcMTcR;
pHMH->setNb_RcMTcR(nlNb_RcMTcR);
ngNb_RcMcS+=nlNb_RcMcS;
pHMH->setNb_RcMcS(nlNb_RcMcS);
ngNb_RcMcScR+=nlNb_RcMcScR;
pHMH->setNb_RcMcScR(nlNb_RcMcScR);
ngNb_RMcScR+=nlNb_RMcScR;
pHMH->setNb_RMcScR(nlNb_RMcScR);
ngNb_RcMScR+=nlNb_RcMScR;
pHMH->setNb_RcMScR(nlNb_RcMScR);
ngRTM+=nRTM;
pHMH->setNb_minRMT(nRTM);
ngRSM+=nRSM;
pHMH->setNb_minRMS(nRSM);
HVertex vrt = ((HEventHeader*)((HEvent*)gHades->getCurrentEvent())->getHeader())->getVertex();
pHMH->setEvtVrtX(vrt.getX());
pHMH->setEvtVrtY(vrt.getY());
pHMH->setEvtVrtZ(vrt.getZ());
}
HHitMatch* HRichCorrelator::createHitMatch(Int_t s)
{
HLocation loc;
loc.set(1,s);
HHitMatch *pHitMatch = (HHitMatch*)((HLinearCategory*)
getHitMatchCat())->getNewSlot(loc);
nCounterRingsWritten++;
if (pHitMatch!=NULL) pHitMatch = new(pHitMatch) HHitMatch;
return pHitMatch;
}
void HRichCorrelator::setRich(HHitMatch* m,HRichHit* r){
m->setRichPhi(r->getPhi());
m->setRichTheta(r->getTheta());
m->setRingCenterX(r->iRingX);
m->setRingCenterY(r->iRingY);
m->setRingPatMat(r->iRingPatMat);
m->setRingHouTra(r->iRingHouTra);
m->setRingAmplitude((Int_t) r->iRingAmplitude);
m->setRingPadNr((Int_t) r->iRingPadNr);
m->setRingLocalMax4((Int_t) r->iRingLocalMax4);
m->setCentroid(r->fRingCentroid);
m->setRingMaxClusterSize(r->getRingMaxClusterSize());
m->setRingMaxThrClusterSize(r->getRingMaxThrClusterSize());
m->setRingTestFlags(r->fTests);
m->setRadius(r->fRingRadius);
m->setRichInd(getRichHitCat()->getIndex(r));
if (pRichHitFitIter)
{
HRichHitFit *fit=0;
pRichHitFitIter->Reset();
while ((fit = (HRichHitFit*)pRichHitFitIter->Next()))
{
if (fit->getHitIndex() == m->getRichInd())
{
m->setRingFitNbCoords(fit->getNbCoords());
m->setRingFitRadius(fit->getFitRadius());
m->setRingFitVar(fit->getFitVar());
m->setRingFitTheta(fit->getFitCenterTheta());
m->setRingFitPhi(fit->getFitCenterPhi());
}
}
}
}
void HRichCorrelator::setKick(HHitMatch* m,HKickTrack* k){
Int_t mt = k->getSegment();
Int_t sys = k->getSystem();
Int_t metat = k->getOuterHitId();
Int_t tsec = k->getSector();
HLocation segLoc;
segLoc.set(3,tsec,0,mt);
HMdcSeg* mdcseg = (HMdcSeg*)((HCategory*)getMdcSegCat())->getObject(segLoc);
if (mdcseg) setMdc(m,mdcseg);
else Error("setKick","no MDC segment in kick track stored");
if (sys==0)
{
HShowerHitTof *sh = (HShowerHitTof*)((HCategory*)getShowerTofHitCat())->getObject(metat);
setShower(m,sh);
m->setMatchedMdcShower(1);
m->setMatchedRichShower(1);
}
else if (sys>0)
{
Int_t tof_sec=metat/1000;
Int_t tof_mod=(metat%1000)/100;
Int_t tof_cell=(metat%1000)%100;
HLocation fLoc;
fLoc.set(3,0,0,0);
fLoc[0]=tof_sec;
fLoc[1]=tof_mod;
fLoc[2]=tof_cell;
HTofHit *tof = (HTofHit *)((HCategory*)getTofHitCat())->getObject(fLoc);
setTof(m,tof);
m->setMatchedMdcTof(1);
m->setMatchedRichTof(1);
}
m->setKickMom(k->getP());
m->setKickMomT(k->getPTof());
m->setKickInd(getKickCat()->getIndex(k));
m->setKickCharge(k->getCharge());
Float_t px,py,pz,en,mass;
Float_t trackTheta,trackPhi;
px=py=pz=en=mass=trackTheta=trackPhi=0.;
HRichUtilFunc::rotateTrackToLab(k->getSector(),k->getTheta(),
k->getPhi(),trackTheta,trackPhi);
Double_t rad2deg = HConstant::rad2deg();
TVector3 tvec(sin(trackTheta/rad2deg)*
cos(trackPhi/rad2deg),
sin(trackTheta/rad2deg)*
sin(trackPhi/rad2deg),
cos(trackTheta/rad2deg));
px = tvec.X() * k->getP();
py = tvec.Y() * k->getP();
pz = tvec.Z() * k->getP();
mass = sqrt(k->getMass());
m->setKickMass(mass);
m->setKickBeta(k->getBeta());
en = sqrt( mass*mass + px*px + py*py + pz*pz );
TLorentzVector* v = ((TLorentzVector*)m->getLVec());
v->SetPxPyPzE(px,py,pz,en);
m->setKickQual(k->getQuality());
m->setKickPull(k->getPull());
}
void HRichCorrelator::setMdc(HHitMatch* m,HMdcSeg* mdc){
Float_t rad2deg = 180./TMath::Pi();
m->setMdcTheta(correctMdcSegTheta(mdc->getTheta()*rad2deg));
m->setMdcPhi(mdc->getPhi()*rad2deg+correctMdcSegPhi(mdc->getSec()));
m->setMdcClusterSize(mdc->getChi2());
m->setMdcClusterHit(mdc->getFlag());
m->setMdcFlagIO(mdc->getIOSeg());
m->setMdcInd(getMdcSegCat()->getIndex(mdc));
m->setMdcR(mdc->getR());
m->setMdcZ(mdc->getZ());
}
void HRichCorrelator::setTof(HHitMatch* m, HTofHit* t){
Float_t tt = 0.; t->getTheta(tt);
Float_t tp = 0.; t->getPhi(tp);
m->setTofTheta(tt);
m->setTofPhi(tp);
m->setTofTof(t->getTof());
m->setTofInd(getTofHitCat()->getIndex(t));
}
void HRichCorrelator::setShower(HHitMatch* m,HShowerHitTof* st){
Float_t dmmy= 0.;
Float_t stt = 0.;
Float_t stp = 0.;
st->getSphereCoord(&dmmy,&stp,&stt);
Float_t tof = st->getTof();
m->setShowerTheta(stt);
m->setShowerPhi(stp);
m->setTofinoTof(tof);
m->setShowerfSum0(st->getSum(0));
m->setShowerfSum1(st->getSum(1));
m->setShowerfSum2(st->getSum(2));
m->setTofinoMul(st->getTofinoMult());
m->setShowInd(getShowerTofHitCat()->getIndex(st));
}
void HRichCorrelator::fillHitMatch(HHitMatch* m, HRichHit* r, HKickTrack* k)
{
if((m->getRichInd())<0)
{
setRich(m,r);
}
if((m->getKickInd())<0)
{
setKick(m,k);
}
m->setMatchedRichKick(1);
m->setMatchedRichMdc(1);
m->setSector(r->getSector());
}
void HRichCorrelator::fillHitMatch(HHitMatch* m, HRichHit* r, HMdcSeg* mdc)
{
if((m->getRichInd())<0)
{
setRich(m,r);
}
if((m->getMdcInd())<0)
{
setMdc(m,mdc);
}
m->setMatchedRichMdc(1);
m->setSector(r->getSector());
}
void HRichCorrelator::fillHitMatch(HHitMatch* m, HMdcSeg* mdc, HShowerHitTof* st)
{
setMdc(m,mdc);
if(m->getShowInd()<0){
setShower(m,st);
}
m->setMatchedMdcShower(1);
if (st->getSector() == mdc->getSec()) m->setSector(st->getSector());
}
void HRichCorrelator::fillHitMatch(HHitMatch* m, HMdcSeg* mdc, HTofHit* t)
{
setMdc(m,mdc);
if(m->getTofInd()<0){
setTof(m,t);
}
m->setMatchedMdcTof(1);
if (t->getSector() == mdc->getSec()) m->setSector(t->getSector());
}
void HRichCorrelator::fillHitMatch(HHitMatch* m, HRichHit *r, HTofHit* t)
{
setRich(m,r);
if(m->getTofInd()<0){
setTof(m,t);
}
m->setMatchedRichTof(1);
if (t->getSector() == r->getSector()) m->setSector(t->getSector());
}
void HRichCorrelator::fillHitMatch(HHitMatch* m, HRichHit *r, HShowerHitTof* st)
{
if(m->getShowInd()<0){
setShower(m,st);
}
setRich(m,r);
m->setMatchedRichShower(1);
if (st->getSector() == r->getSector()) m->setSector(st->getSector());
}
void HRichCorrelator::fillALLRingHistos(HRichHit* h)
{
pHistALLRingHouTra->Fill(h->iRingHouTra);
pHistALLRingPatMat->Fill(h->iRingPatMat);
pHistALLRingAmplitude->Fill((Int_t) h->iRingAmplitude);
pHistALLRingPadNr->Fill((Int_t) h->iRingPadNr);
pHistALLRingLocMax4->Fill((Int_t) h->iRingLocalMax4);
pHistALLRingRadius->Fill(h->fRingRadius);
pHistALLRingCenterX->Fill(h->iRingX);
pHistALLRingCenterY->Fill(h->iRingY);
pHistALLRingTheta->Fill(h->getTheta());
pHistALLRingPhi->Fill(h->getPhi());
pHistALLRingHouTraTheta->Fill(h->getTheta(),h->iRingHouTra);
pHistALLRingPatMatTheta->Fill(h->getTheta(),h->iRingPatMat);
pHistALLRingAmplitudeTheta->Fill(h->getTheta(),h->iRingAmplitude);
pHistALLRingPadNrTheta->Fill(h->getTheta(),h->iRingPadNr);
pHistALLRingLocMax4Theta->Fill(h->getTheta(),h->iRingLocalMax4);
}
void HRichCorrelator::fillControlHistos(void)
{
HHitMatch *pHitMatch=0;
pIterMatchHit->Reset();
while((pHitMatch = (HHitMatch *)pIterMatchHit->Next()))
{
if (pHitMatch->getMatchedRichMdc()==1 &&
pHitMatch->getMatchedMdcTof()==1 )
{
pHistRMTRingHouTra->Fill(pHitMatch->getRingHouTra());
pHistRMTRingPatMat->Fill(pHitMatch->getRingPatMat());
pHistRMTRingAmplitude->Fill(pHitMatch->getRingAmplitude());
pHistRMTRingPadNr->Fill(pHitMatch->getRingPadNr());
pHistRMTRingLocMax4->Fill(pHitMatch->getRingLocalMax4());
pHistRMTRingRadius->Fill(pHitMatch->getRadius());
pHistRMTRingCenterX->Fill(pHitMatch->getRingCenterX());
pHistRMTRingCenterY->Fill(pHitMatch->getRingCenterY());
pHistRMTRingTheta->Fill(pHitMatch->getRichTheta());
pHistRMTRingPhi->Fill(pHitMatch->getRichPhi());
pHistRMTRingHouTraTheta->Fill(pHitMatch->getRichTheta(),
pHitMatch->getRingHouTra());
pHistRMTRingPatMatTheta->Fill(pHitMatch->getRichTheta(),
pHitMatch->getRingPatMat());
pHistRMTRingAmplitudeTheta->Fill(pHitMatch->getRichTheta(),
pHitMatch->getRingAmplitude());
pHistRMTRingPadNrTheta->Fill(pHitMatch->getRichTheta(),
pHitMatch->getRingPadNr());
pHistRMTRingLocMax4Theta->Fill(pHitMatch->getRichTheta(),
pHitMatch->getRingLocalMax4());
}
if (pHitMatch->getMatchedRichMdc()==1 &&
pHitMatch->getMatchedMdcShower()==1 )
{
pHistRMSRingHouTra->Fill(pHitMatch->getRingHouTra());
pHistRMSRingPatMat->Fill(pHitMatch->getRingPatMat());
pHistRMSRingAmplitude->Fill(pHitMatch->getRingAmplitude());
pHistRMSRingPadNr->Fill(pHitMatch->getRingPadNr());
pHistRMSRingLocMax4->Fill(pHitMatch->getRingLocalMax4());
pHistRMSRingRadius->Fill(pHitMatch->getRadius());
pHistRMSRingCenterX->Fill(pHitMatch->getRingCenterX());
pHistRMSRingCenterY->Fill(pHitMatch->getRingCenterY());
pHistRMSRingTheta->Fill(pHitMatch->getRichTheta());
pHistRMSRingPhi->Fill(pHitMatch->getRichPhi());
pHistRMSRingHouTraTheta->Fill(pHitMatch->getRichTheta(),
pHitMatch->getRingHouTra());
pHistRMSRingPatMatTheta->Fill(pHitMatch->getRichTheta(),
pHitMatch->getRingPatMat());
pHistRMSRingAmplitudeTheta->Fill(pHitMatch->getRichTheta(),
pHitMatch->getRingAmplitude());
pHistRMSRingPadNrTheta->Fill(pHitMatch->getRichTheta(),
pHitMatch->getRingPadNr());
pHistRMSRingLocMax4Theta->Fill(pHitMatch->getRichTheta(),
pHitMatch->getRingLocalMax4());
}
if (pHitMatch->getMatchedRichMdc()==1)
{
pHistRMTheta->Fill(pHitMatch->getRichTheta(),
pHitMatch->getMdcTheta());
pHistRMPhi->Fill(pHitMatch->getRichPhi(),
pHitMatch->getMdcPhi());
Int_t sec = pHitMatch->getSector();
Char_t *histname1 = new char[50];
sprintf(histname1,"Rich_Mdc_theta_diff%d",sec+1);
TH1F* h1 = ((TH1F*)(pHistArray->FindObject(histname1)));
if (h1) h1->Fill(pHitMatch->getRichTheta()-pHitMatch->getMdcTheta());
else cout<<h1<<" is a null pointer"<<endl;
delete histname1;
Char_t *histname2 = new char[50];
sprintf(histname2,"Rich_Mdc_phi_diff%d",sec+1);
h1 = ((TH1F*)(pHistArray->FindObject(histname2)));
if (h1) h1->Fill(pHitMatch->getRichPhi()-pHitMatch->getMdcPhi());
delete histname2;
pHistRMRingHouTra->Fill(pHitMatch->getRingHouTra());
pHistRMRingPatMat->Fill(pHitMatch->getRingPatMat());
pHistRMRingAmplitude->Fill(pHitMatch->getRingAmplitude());
pHistRMRingPadNr->Fill(pHitMatch->getRingPadNr());
pHistRMRingLocMax4->Fill(pHitMatch->getRingLocalMax4());
pHistRMRingRadius->Fill(pHitMatch->getRadius());
pHistRMRingCenterX->Fill(pHitMatch->getRingCenterX());
pHistRMRingCenterY->Fill(pHitMatch->getRingCenterY());
pHistRMRingTheta->Fill(pHitMatch->getRichTheta());
pHistRMRingPhi->Fill(pHitMatch->getRichPhi());
pHistRMRingHouTraTheta->Fill(pHitMatch->getRichTheta(),
pHitMatch->getRingHouTra());
pHistRMRingPatMatTheta->Fill(pHitMatch->getRichTheta(),
pHitMatch->getRingPatMat());
pHistRMRingAmplitudeTheta->Fill(pHitMatch->getRichTheta(),
pHitMatch->getRingAmplitude());
pHistRMRingPadNrTheta->Fill(pHitMatch->getRichTheta(),
pHitMatch->getRingPadNr());
pHistRMRingLocMax4Theta->Fill(pHitMatch->getRichTheta(),
pHitMatch->getRingLocalMax4());
}
if (pHitMatch->getMatchedRichTof()==1)
{
pHistRTTheta->Fill(pHitMatch->getRichTheta(),
pHitMatch->getTofTheta());
pHistRTPhi->Fill(pHitMatch->getRichPhi(),
pHitMatch->getTofPhi());
Int_t sec = pHitMatch->getSector();
Char_t *histname1 = new char[50];
sprintf(histname1,"Rich_Tof_theta_diff%d",sec+1);
TH1F *h1 = ((TH1F*)(pHistArray->FindObject(histname1)));
if (h1) h1->Fill(pHitMatch->getRichTheta()-pHitMatch->getTofTheta());
delete histname1;
Char_t *histname2 = new char[50];
sprintf(histname2,"Rich_Tof_phi_diff%d",sec+1);
h1 = ((TH1F*)(pHistArray->FindObject(histname2)));
if (h1) h1->Fill(pHitMatch->getRichPhi()-pHitMatch->getTofPhi());
delete histname2;
}
if (pHitMatch->getMatchedRichShower()==1)
{
pHistRSTheta->Fill(pHitMatch->getRichTheta(),
pHitMatch->getShowerTheta());
pHistRSPhi->Fill(pHitMatch->getRichPhi(),
pHitMatch->getShowerPhi());
Int_t sec = pHitMatch->getSector();
Char_t *histname1 = new char[50];
sprintf(histname1,"Rich_Shower_theta_diff%d",sec+1);
TH1F *h1 = ((TH1F*)(pHistArray->FindObject(histname1)));
if (h1) h1->Fill(pHitMatch->getRichTheta()-pHitMatch->getShowerTheta());
delete histname1;
Char_t *histname2 = new char[50];
sprintf(histname2,"Rich_Shower_phi_diff%d",sec+1);
h1 = ((TH1F*)(pHistArray->FindObject(histname2)));
if (h1) h1->Fill(pHitMatch->getRichPhi()-pHitMatch->getShowerPhi());
delete histname2;
}
if (pHitMatch->getMatchedMdcTof()==1)
{
pHistMTTheta->Fill(pHitMatch->getMdcTheta(),
pHitMatch->getTofTheta());
pHistMTPhi->Fill(pHitMatch->getMdcPhi(),
pHitMatch->getTofPhi());
Int_t sec = pHitMatch->getSector();
Char_t *histname1 = new char[50];
sprintf(histname1,"Mdc_Tof_theta_diff%d",sec+1);
TH1F *h1 = ((TH1F*)(pHistArray->FindObject(histname1)));
if (h1) h1->Fill(pHitMatch->getMdcTheta()-pHitMatch->getTofTheta());
delete histname1;
Char_t *histname2 = new char[50];
sprintf(histname2,"Mdc_Tof_phi_diff%d",sec+1);
h1 = ((TH1F*)(pHistArray->FindObject(histname2)));
if (h1) h1->Fill(pHitMatch->getMdcPhi()-pHitMatch->getTofPhi());
delete histname2;
}
if (pHitMatch->getMatchedMdcShower()==1)
{
pHistMSTheta->Fill(pHitMatch->getMdcTheta(),
pHitMatch->getShowerTheta());
pHistMSPhi->Fill(pHitMatch->getMdcPhi(),
pHitMatch->getShowerPhi());
Int_t sec = pHitMatch->getSector();
Char_t *histname1 = new char[50];
sprintf(histname1,"Mdc_Shower_theta_diff%d",sec+1);
TH1F *h1 = ((TH1F*)(pHistArray->FindObject(histname1)));
if (h1) h1->Fill(pHitMatch->getMdcTheta()-pHitMatch->getShowerTheta());
delete histname1;
Char_t *histname2 = new char[50];
sprintf(histname2,"Mdc_Shower_phi_diff%d",sec+1);
h1 = ((TH1F*)(pHistArray->FindObject(histname2)));
if (h1) h1->Fill(pHitMatch->getMdcPhi()-pHitMatch->getShowerPhi());
delete histname2;
}
}
}
Float_t HRichCorrelator::correctMdcSegPhi(Int_t s)
{
Float_t nMdcPhiCorr=0;
switch (s)
{
case 1:
nMdcPhiCorr=+60.;
break;
case 2:
nMdcPhiCorr=+120.;
break;
case 3:
nMdcPhiCorr=+180.;
break;
case 4:
nMdcPhiCorr=+240.;
break;
case 5:
nMdcPhiCorr=-60.;
break;
}
return nMdcPhiCorr;
}
Float_t HRichCorrelator::correctMdcSegTheta(Float_t th)
{
Float_t correctedTheta = th * fMdcThetaCorrection;
return correctedTheta;
}
Bool_t HRichCorrelator::isGoodRing(HRichHit* r){
if (kRingQualityCut)
{
if(r->getRingPatMat() >= nPatMatCut &&
r->getRingHouTra()>= nHouTraCut &&
r->getRingAmplitude() >= nRingAmplCut &&
r->getRingPadNr() >= nPadNrCut &&
r->getRingLocalMax4()>= nLocMax4Cut)
{
return kTRUE;
}
else
{
return kFALSE;
}
}
else return kTRUE;
}
Bool_t HRichCorrelator::isSelectedSector(Int_t n)
{
if (n == nSelectedSector) return kTRUE;
else return kFALSE;
}
Bool_t HRichCorrelator::isCorrelated(HRichHit* pRichHit,HKickTrack* pKickTrack)
{
Float_t rad2deg = 180./TMath::Pi();
Float_t kt,kp;
HRichUtilFunc::rotateTrackToLab(pKickTrack->getSector(),pKickTrack->getTheta(),
pKickTrack->getPhi(),kt,kp);
Int_t ks = pKickTrack->getSector();
Int_t rs = pRichHit->getSector();
Float_t rt = pRichHit->getTheta();
Float_t rp = pRichHit->getPhi();
Float_t etl1 = -3.38;
Float_t etl2 = -3.71;
Float_t etl3 = -3.96;
Float_t etl4 = -3.59;
Float_t etl5 = -3.97;
Float_t etl6 = -3.71;
Float_t etr1 = 4.1;
Float_t etr2 = 3.43;
Float_t etr3 = 3.96;
Float_t etr4 = 3.67;
Float_t etr5 = 2.81;
Float_t etr6 = 3.55;
Float_t epl1 = -1.63;
Float_t epl2 = -1.55;
Float_t epl3 = -2.02;
Float_t epl4 = -1.91;
Float_t epl5 = -1.74;
Float_t epl6 = -1.69;
Float_t epr1 = 1.97;
Float_t epr2 = 1.87;
Float_t epr3 = 1.94;
Float_t epr4 = 1.51;
Float_t epr5 = 1.62;
Float_t epr6 = 2.21;
Float_t fDeltaTheta = rt - kt;
Float_t fDeltaPhi = (rp - kp)*TMath::Sin(kt/rad2deg);
Float_t fRichMdcThetaMinCut = 0;
Float_t fRichMdcThetaMaxCut = 0;
Float_t fRichMdcPhiMinCut = 0;
Float_t fRichMdcPhiMaxCut = 0;
if (ks == rs)
{
if (ks==0)
{
fRichMdcThetaMinCut = etl1;
fRichMdcThetaMaxCut = etr1;
fRichMdcPhiMinCut = epl1;
fRichMdcPhiMaxCut = epr1;
}
if (ks==1)
{
fRichMdcThetaMinCut = etl2;
fRichMdcThetaMaxCut = etr2;
fRichMdcPhiMinCut = epl2;
fRichMdcPhiMaxCut = epr2;
}
if (ks==2)
{
fRichMdcThetaMinCut = etl3;
fRichMdcThetaMaxCut = etr3;
fRichMdcPhiMinCut = epl3;
fRichMdcPhiMaxCut = epr3;
}
if (ks==3)
{
fRichMdcThetaMinCut = etl4;
fRichMdcThetaMaxCut = etr4;
fRichMdcPhiMinCut = epl4;
fRichMdcPhiMaxCut = epr4;
}
if (ks==4)
{
fRichMdcThetaMinCut = etl5;
fRichMdcThetaMaxCut = etr5;
fRichMdcPhiMinCut = epl5;
fRichMdcPhiMaxCut = epr5;
}
if (ks==5)
{
fRichMdcThetaMinCut = etl6;
fRichMdcThetaMaxCut = etr6;
fRichMdcPhiMinCut = epl6;
fRichMdcPhiMaxCut = epr6;
}
}
else
{
return kFALSE;
}
if ( fRichMdcThetaMinCut<fDeltaTheta &&
fRichMdcThetaMaxCut>fDeltaTheta &&
fRichMdcPhiMinCut<fDeltaPhi &&
fRichMdcPhiMaxCut>fDeltaPhi )
{
return kTRUE;
}
return kFALSE;
}
Bool_t HRichCorrelator::isCorrelated(HRichHit* pRichHit,HMdcSeg* pMdcSeg)
{
Float_t rad2deg = 180./TMath::Pi();
Int_t rs = pRichHit->getSector();
Int_t ms = pMdcSeg->getSec();
Float_t rt = pRichHit->getTheta();
Float_t mt = correctMdcSegTheta(pMdcSeg->getTheta()*rad2deg);
Float_t rp = pRichHit->getPhi();
Float_t mp = (pMdcSeg->getPhi())*rad2deg + correctMdcSegPhi(ms);
if ( rs == ms)
{
Float_t fDeltaTheta = rt - mt;
if ( fRichMdcThetaMinCut<fDeltaTheta &&
fRichMdcThetaMaxCut>fDeltaTheta &&
(TMath::Abs(rp - mp))*TMath::Sin(pMdcSeg->getTheta()) < fRichMdcPhiCut )
{
return kTRUE;
}
}
return kFALSE;
}
Bool_t HRichCorrelator::isCorrelated(HRichHit* pRichHit, HHitMatch* pMatchHit)
{
Int_t rs = pRichHit->getSector();
Int_t ms = pMatchHit->getSector();
Float_t rt = pRichHit->getTheta();
Float_t mt = pMatchHit->getMdcTheta();
Float_t rp = pRichHit->getPhi();
Float_t mp = pMatchHit ->getMdcPhi();
if ( rs == ms)
{
Float_t fDeltaTheta = rt - mt;
if ( fRichMdcThetaMinCut < fDeltaTheta &&
fRichMdcThetaMaxCut > fDeltaTheta &&
TMath::Abs(rp - mp) < fRichMdcPhiCut )
{
return kTRUE;
}
}
return kFALSE;
}
Bool_t HRichCorrelator::isCorrelated(HRichHit* pRichHit,HTofHit* pTofHit)
{
Int_t rs = pRichHit->getSector();
Float_t rt = pRichHit->getTheta();
Float_t rp = pRichHit->getPhi();
Int_t ts = (Int_t) pTofHit->getSector();
Float_t tt = 0.; pTofHit->getTheta(tt);
Float_t tp = 0.; pTofHit->getPhi(tp);
Float_t tof = pTofHit->getTof();
if ( rs == ts)
{
if (kIsNoCutOnTOFtof || (tof>fTofTofMinCut && tof<fTofTofMaxCut))
{
if(kMagnet){
if (((TMath::Abs(rp - tp))*TMath::Sin(rt*TMath::Pi()/180.)) < fRichTofPhiCut)
{
return kTRUE;
}
}
else{
Float_t fDeltaTheta = rt - tt;
if ( fRichTofThetaMinCut < fDeltaTheta &&
fRichTofThetaMaxCut > fDeltaTheta &&
((TMath::Abs(rp - tp))*TMath::Sin(rt*TMath::Pi()/180.)) < fRichTofPhiCut )
{
return kTRUE;
}
}
}
}
return kFALSE;
}
Bool_t HRichCorrelator::isShower(HShowerHitTof* pSHT)
{
Int_t nModule=(Int_t) pSHT->getModule();
Float_t fSum0 = pSHT->getSum(0);
Float_t fSum1 = pSHT->getSum(1);
Float_t fSum2 = pSHT->getSum(2);
if (nModule==0)
{
if (fSum1/fSum0 > fShowerAmplification ||
fSum2/fSum0 > fShowerAmplification)
{
return kTRUE;
}
}
return kFALSE;
}
Bool_t HRichCorrelator::isCorrelated(HRichHit* pRichHit,HShowerHitTof* pShowerHitTof)
{
Int_t rs = pRichHit->getSector();
Float_t rt = pRichHit->getTheta();
Float_t rp = pRichHit->getPhi();
Int_t sts = (Int_t) pShowerHitTof->getSector();
Float_t dmmy= 0.;
Float_t stt = 0.;
Float_t stp = 0.;
pShowerHitTof->getSphereCoord(&dmmy,&stp,&stt);
Float_t tof = pShowerHitTof->getTof();
Int_t nTofinoMult = pShowerHitTof->getTofinoMult();
Bool_t kTofino = kFALSE;
if (kTofinoMultCut)
{
if (nTofinoMult==nTofinoMultCut) kTofino=kTRUE;
else kTofino=kFALSE;
}
else kTofino=kTRUE;
if ( rs == sts && kTofino)
{
if (kIsNoCutOnTOFINOtof ||
(tof>fTofinoTofMinCut && tof<fTofinoTofMaxCut))
{
if(kMagnet){
if ( (TMath::Abs(rp - stp)*TMath::Sin(rt*TMath::Pi()/180.)) < fRichShowerPhiCut )
{
if (kShowerCond)
{
if(isShower(pShowerHitTof)) return kTRUE;
else return kFALSE;
}
else return kTRUE;
}
}
else{
Float_t fDeltaTheta = rt - stt;
if ( fRichShowerThetaMinCut < fDeltaTheta &&
fRichShowerThetaMaxCut > fDeltaTheta &&
(TMath::Abs(rp - stp)*TMath::Sin(rt*TMath::Pi()/180.)) < fRichShowerPhiCut )
{
if (kShowerCond)
{
if(isShower(pShowerHitTof)) return kTRUE;
else return kFALSE;
}
else return kTRUE;
}
}
}
}
return kFALSE;
}
Bool_t HRichCorrelator::isCorrelated(HMdcSeg* pMdcSeg,HShowerHitTof* pShowerHitTof)
{
Float_t rad2deg = 180./TMath::Pi();
Int_t ms = pMdcSeg->getSec();
Float_t mt = correctMdcSegTheta(pMdcSeg->getTheta()*rad2deg);
Float_t mp = (pMdcSeg->getPhi())*rad2deg + correctMdcSegPhi(ms);
Int_t sts = (Int_t) pShowerHitTof->getSector();
Float_t dmmy= 0.;
Float_t stt = 0.;
Float_t stp = 0.;
pShowerHitTof->getSphereCoord(&dmmy,&stp,&stt);
Float_t tof = pShowerHitTof->getTof();
Int_t nTofinoMult = pShowerHitTof->getTofinoMult();
Bool_t kTofino = kFALSE;
if (kTofinoMultCut)
{
if (nTofinoMult==nTofinoMultCut) kTofino=kTRUE;
else kTofino=kFALSE;
}
else kTofino=kTRUE;
if ( ms == sts && kTofino)
{
if (kIsNoCutOnTOFINOtof ||
(tof>fTofinoTofMinCut && tof<fTofinoTofMaxCut))
{
if(kMagnet){
if ( (TMath::Abs(mp - stp)*TMath::Sin(pMdcSeg->getTheta())) < fMdcShowerPhiCut )
{
if (kShowerCond)
{
if(isShower(pShowerHitTof)) return kTRUE;
else return kFALSE;
}
else return kTRUE;
}
}
else{
Float_t fDeltaTheta = mt - stt;
if ( fMdcShowerThetaMinCut < fDeltaTheta &&
fMdcShowerThetaMaxCut > fDeltaTheta &&
(TMath::Abs(mp - stp)*TMath::Sin(pMdcSeg->getTheta())) < fMdcShowerPhiCut )
{
if (kShowerCond)
{
if(isShower(pShowerHitTof)) return kTRUE;
else return kFALSE;
}
else return kTRUE;
}
}
}
}
return kFALSE;
}
Bool_t HRichCorrelator::isCorrelated(HMdcSeg* pMdcSeg,HTofHit* pTofHit)
{
Float_t rad2deg = 180./TMath::Pi();
Int_t ms = pMdcSeg->getSec();
Float_t mt = correctMdcSegTheta(pMdcSeg->getTheta()*rad2deg);
Float_t mp = (pMdcSeg->getPhi())*rad2deg + correctMdcSegPhi(ms);
Int_t ts = (Int_t) pTofHit->getSector();
Float_t tt = 0.; pTofHit->getTheta(tt);
Float_t tp = 0.; pTofHit->getPhi(tp);
Float_t tof = pTofHit->getTof();
if ( ms == ts)
{
if (kIsNoCutOnTOFtof || (tof>fTofTofMinCut && tof<fTofTofMaxCut))
{
if(kMagnet){
if ((TMath::Abs(mp - tp)*TMath::Sin(pMdcSeg->getTheta())) < fMdcTofPhiCut )
{
return kTRUE;
}
}
else{
Float_t fDeltaTheta = mt - tt;
if ( fMdcTofThetaMinCut < fDeltaTheta &&
fMdcTofThetaMaxCut > fDeltaTheta &&
(TMath::Abs(mp - tp)*TMath::Sin(pMdcSeg->getTheta())) < fMdcTofPhiCut )
{
return kTRUE;
}
}
}
}
return kFALSE;
}
void HRichCorrelator::dumpCorrelationStatus()
{
cout<<"*******************************************"<<endl;
cout<<"*** INFORMATION ***************************"<<endl;
cout<<"*******************************************"<<endl;
cout<<"this status information belongs to the tree in ..."<<endl;
TFile *f = (TFile*) gHades->getOutputFile();
TString filename("testfile.stat");
if (f){
cout<<((TFile*)f)->GetName()<<endl;
filename = ((TFile*)gHades->getOutputFile())->GetName();
}
filename.Remove(filename.Length()-5, filename.Length());
filename.Append(".stat");
std::ofstream statusOut(filename.Data(),ios::out);
cout<<"Nb of evts processed : "<<nCounterProcessedNbEvents<<endl;
cout<<"Nb of tracklets created: "<<ngNbCorrObjs<<endl;
if(ngRichCnt>0) cout<<"Tot Nb of RICH hits : "<<ngRichCnt<<endl;
if(ngMdcSegCnt>0) cout<<"Tot Nb of MDCSEG hits : "<<ngMdcSegCnt<<endl;
if(ngTofCnt>0) cout<<"Tot Nb of TOF hits : "<<ngTofCnt<<endl;
if(ngShowerCnt>0) cout<<"Tot Nb of SHOWER hits : "<<ngShowerCnt<<endl;
if(ngDRind>0) cout<<"Nb of diff Rich hits : "<<ngDRind<<endl;
if(ngDMind>0) cout<<"Nb of diff Mdc hits : "<<ngDMind<<endl;
if(ngDTind>0) cout<<"Nb of diff Tof hits : "<<ngDTind<<endl;
if(ngDSind>0) cout<<"Nb of diff Shower hits : "<<ngDSind<<endl;
if(ngDRichminRMind>0) cout<<"Nb of diff Rich hits in min RM corr : "<<ngDRichminRMind<<endl;
if(ngDRichminRTind>0) cout<<"Nb of diff Rich hits in min RT corr : "<<ngDRichminRTind<<endl;
if(ngDRichminRSind>0) cout<<"Nb of diff Rich hits in min RS corr : "<<ngDRichminRSind<<endl;
if(ngDRichminRMTind>0) cout<<"Nb of diff Rich hits in min RMT index : "<<ngDRichminRMTind<<endl;
if(ngDRichminRMSind>0) cout<<"Nb of diff Rich hits in min RMS index : "<<ngDRichminRMSind<<endl;
if(ngDRcMcTcRind>0) cout<<"Nb of diff Rich hits in RM MT RT : "<<ngDRcMcTcRind<<endl;
if(ngDRcMcScRind>0) cout<<"Nb of diff Rich hits in RM MS RS : "<<ngDRcMcScRind<<endl;
if(ngDRcMTcRind>0) cout<<"Nb of diff Rich hits in RM RT : "<<ngDRcMTcRind<<endl;
if(ngDRcMScRind>0) cout<<"Nb of diff Rich hits in RM RS : "<<ngDRcMScRind<<endl;
if(ngDRcMcTind>0) cout<<"Nb of diff Rich hits in RM MT : "<<ngDRcMcTind<<endl;
if(ngDRcMcSind>0) cout<<"Nb of diff Rich hits in RM MS : "<<ngDRcMcSind<<endl;
if(ngDRMcTcRind>0) cout<<"Nb of diff Rich hits in MT RT : "<<ngDRMcTcRind <<endl;
if(ngDRMcScRind>0) cout<<"Nb of diff Rich hits in MS RS : "<<ngDRMcScRind<<endl;
if(ngDRMind>0) cout<<"Nb of diff Rich hits in only RM : "<<ngDRMind<<endl;
if(ngDRTind>0) cout<<"Nb of diff Rich hits in only RT : "<<ngDRTind<<endl;
if(ngDRSind>0) cout<<"Nb of diff Rich hits in only RS : "<<ngDRSind <<endl;
if(ngDMTind>0) cout<<"Nb of diff Mdc hits in only MT : "<<ngDMTind<<endl;
if(ngDMSind>0) cout<<"Nb of diff Mdc hits in only MS : "<<ngDMSind<<endl;
if(ngNb_RM>0) cout<<"Nb of only RM corr : "<<ngNb_RM<<endl;
if(ngNb_RT>0) cout<<"Nb of only RT corr : "<<ngNb_RT<<endl;
if(ngNb_RS>0) cout<<"Nb of only RS corr : "<<ngNb_RS<<endl;
if(ngNb_MT>0) cout<<"Nb of only MT corr : "<<ngNb_MT<<endl;
if(ngNb_MS>0) cout<<"Nb of only MS corr : "<<ngNb_MS<<endl;
if(ngRTM>0) cout<<"Nb of min RMT indexes in tracklet : "
<<ngRTM<<endl;
if(ngRSM>0) cout<<"Nb of min RMS indexes in tracklet : "
<<ngRSM<<endl;
if(ngNb_RcMcT>0) cout<<"Nb of exact RM MT corr : "<<ngNb_RcMcT<<endl;
if(ngNb_RcMcTcR>0) cout<<"Nb of exact RM MT RT corr : "<<ngNb_RcMcTcR<<endl;
if(ngNb_RMcTcR>0) cout<<"Nb of exact MT RT corr : "<<ngNb_RMcTcR<<endl;
if(ngNb_RcMTcR>0) cout<<"Nb of exact RM RT corr : "<<ngNb_RcMTcR<<endl;
if(ngNb_RcMcS>0) cout<<"Nb of exact RM MS corr : "<<ngNb_RcMcS<<endl;
if(ngNb_RcMcScR>0) cout<<"Nb of exact RM MS RS corr : "<<ngNb_RcMcScR<<endl;
if(ngNb_RMcScR>0) cout<<"Nb of exact MS RS corr : "<<ngNb_RMcScR<<endl;
if(ngNb_RcMScR>0) cout<<"Nb of exact RM RS corr : "<<ngNb_RcMScR<<endl;
statusOut<<"Nb of evts processed : "<<nCounterProcessedNbEvents<<endl;
statusOut<<"Nb of tracklets created: "<<ngNbCorrObjs<<endl;
if(ngRichCnt>0) statusOut<<"Tot Nb of RICH hits : "<<ngRichCnt<<endl;
if(ngMdcSegCnt>0) statusOut<<"Tot Nb of MDCSEG hits : "<<ngMdcSegCnt<<endl;
if(ngTofCnt>0) statusOut<<"Tot Nb of TOF hits : "<<ngTofCnt<<endl;
if(ngShowerCnt>0) statusOut<<"Tot Nb of SHOWER hits : "<<ngShowerCnt<<endl;
if(ngNb_RM>0) statusOut<<"Nb of only RM corr : "<<ngNb_RM<<endl;
if(ngNb_RT>0) statusOut<<"Nb of only RT corr : "<<ngNb_RT<<endl;
if(ngNb_RS>0) statusOut<<"Nb of only RS corr : "<<ngNb_RS<<endl;
if(ngNb_MT>0) statusOut<<"Nb of only MT corr : "<<ngNb_MT<<endl;
if(ngNb_MS>0) statusOut<<"Nb of only MS corr : "<<ngNb_MS<<endl;
if(ngRTM>0) statusOut<<"Nb of min RMT indexes in tracklet : "
<<ngRTM<<endl;
if(ngRSM>0) statusOut<<"Nb of min RMS indexes in tracklet : "
<<ngRSM<<endl;
if(ngNb_RcMcT>0) statusOut<<"Nb of exact RM MT corr : "<<ngNb_RcMcT<<endl;
if(ngNb_RcMcTcR>0) statusOut<<"Nb of exact RM MT RT corr : "<<ngNb_RcMcTcR<<endl;
if(ngNb_RMcTcR>0) statusOut<<"Nb of exact MT RT corr : "<<ngNb_RMcTcR<<endl;
if(ngNb_RcMTcR>0) statusOut<<"Nb of exact RM RT corr : "<<ngNb_RcMTcR<<endl;
if(ngNb_RcMcS>0) statusOut<<"Nb of exact RM MS corr : "<<ngNb_RcMcS<<endl;
if(ngNb_RcMcScR>0) statusOut<<"Nb of exact RM MS RS corr : "<<ngNb_RcMcScR<<endl;
if(ngNb_RMcScR>0) statusOut<<"Nb of exact MS RS corr : "<<ngNb_RMcScR<<endl;
if(ngNb_RcMScR>0) statusOut<<"Nb of exact RM RS corr : "<<ngNb_RcMScR<<endl;
}
TCanvas* HRichCorrelator::makeCanvas2()
{
TCanvas *canvas = new TCanvas("Correlation_Plots2","Correlation_Plots2",10,10,600,500);
canvas->Divide(4,3);
canvas->SetLogy();
canvas->cd(1);
pProfALLHTtheta->SetLineColor(2);
pProfALLHTtheta->SetMaximum(nHouTraMax);
pProfALLHTtheta->Draw();
pProfRMTHTtheta->SetLineColor(6);
pProfRMTHTtheta->Draw("same");
pProfRMHTtheta->SetLineColor(8);
pProfRMHTtheta->Draw("same");
pProfRMSHTtheta->SetLineColor(4);
pProfRMSHTtheta->Draw("same");
canvas->cd(2);
pProfALLPMtheta->SetLineColor(2);
pProfALLPMtheta->SetMaximum(800);
pProfALLPMtheta->Draw();
pProfRMTPMtheta->SetLineColor(6);
pProfRMTPMtheta->Draw("same");
pProfRMPMtheta->SetLineColor(8);
pProfRMPMtheta->Draw("same");
pProfRMSPMtheta->SetLineColor(4);
pProfRMSPMtheta->Draw("same");
canvas->cd(3);
pProfALLRingAmplitudeTheta->SetLineColor(2);
pProfALLRingAmplitudeTheta->SetMaximum(600);
pProfALLRingAmplitudeTheta->Draw();
pProfRMRingAmplitudeTheta->SetLineColor(8);
pProfRMRingAmplitudeTheta->Draw("same");
pProfRMSRingAmplitudeTheta->SetLineColor(4);
pProfRMSRingAmplitudeTheta->Draw("same");
pProfRMTRingAmplitudeTheta->SetLineColor(6);
pProfRMTRingAmplitudeTheta->Draw("same");
canvas->cd(4);
pProfALLLocMax4Theta->SetLineColor(2);
pProfALLLocMax4Theta->SetMaximum(15);
pProfALLLocMax4Theta->Draw();
pProfRMLocMax4Theta->SetLineColor(8);
pProfRMLocMax4Theta->Draw("same");
pProfRMSLocMax4Theta->SetLineColor(4);
pProfRMSLocMax4Theta->Draw("same");
pProfRMTLocMax4Theta->SetLineColor(6);
pProfRMTLocMax4Theta->Draw("same");
canvas->cd(5);
pProfALLPadNrTheta->SetLineColor(2);
pProfALLPadNrTheta->SetMaximum(40);
pProfALLPadNrTheta->Draw();
pProfRMPadNrTheta->SetLineColor(8);
pProfRMPadNrTheta->Draw("same");
pProfRMSPadNrTheta->SetLineColor(4);
pProfRMSPadNrTheta->Draw("same");
pProfRMTPadNrTheta->SetLineColor(6);
pProfRMTPadNrTheta->Draw("same");
canvas->cd(6);
pHistALLRingAmplitudeTheta->SetMarkerColor(2);
pHistALLRingAmplitudeTheta->Draw();
pHistRMRingAmplitudeTheta->SetMarkerColor(8);
pHistRMRingAmplitudeTheta->Draw("same");
canvas->cd(7);
pHistALLRingPadNrTheta->SetMarkerColor(2);
pHistALLRingPadNrTheta->Draw();
pHistRMRingPadNrTheta->SetMarkerColor(8);
pHistRMRingPadNrTheta->Draw("same");
canvas->cd(8);
pHistALLRingLocMax4Theta->SetMarkerColor(2);
pHistALLRingLocMax4Theta->Draw();
pHistRMRingLocMax4Theta->SetMarkerColor(8);
pHistRMRingLocMax4Theta->Draw("same");
canvas->cd(9);
pHistALLRingHouTraTheta->SetMarkerColor(2);
pHistALLRingHouTraTheta->Draw();
pHistRMRingHouTraTheta->SetMarkerColor(8);
pHistRMRingHouTraTheta->Draw("same");
canvas->cd(10);
pHistALLRingPatMatTheta->SetMarkerColor(2);
pHistALLRingPatMatTheta->Draw();
pHistRMRingPatMatTheta->SetMarkerColor(8);
pHistRMRingPatMatTheta->Draw("same");
canvas->Modified();
canvas->Update();
return canvas;
}
TCanvas* HRichCorrelator::makeCanvas1()
{
TCanvas *canvas = new TCanvas("Correlation_Plots1","Correlation_Plots1",10,10,600,500);
Int_t nLineWidth = 3;
canvas->Divide(3,3);
canvas->SetLogy();
canvas->cd(1);
gPad->SetLogy();
pHistALLRingHouTra->SetLineColor(2);
pHistALLRingHouTra->SetLineWidth(nLineWidth);
pHistALLRingHouTra->Draw();
pHistRMTRingHouTra->SetLineColor(6);
pHistRMTRingHouTra->SetLineWidth(nLineWidth);
pHistRMTRingHouTra->Draw("same");
pHistRMRingHouTra->SetLineColor(8);
pHistRMRingHouTra->SetLineWidth(nLineWidth);
pHistRMRingHouTra->Draw("same");
pHistRMSRingHouTra->SetLineColor(4);
pHistRMSRingHouTra->SetLineWidth(nLineWidth);
pHistRMSRingHouTra->Draw("same");
canvas->cd(2);
gPad->SetLogy();
pHistALLRingPatMat->SetLineColor(2);
pHistALLRingPatMat->SetLineWidth(nLineWidth);
pHistALLRingPatMat->Draw();
pHistRMTRingPatMat->SetLineColor(6);
pHistRMTRingPatMat->SetLineWidth(nLineWidth);
pHistRMTRingPatMat->Draw("same");
pHistRMRingPatMat->SetLineColor(8);
pHistRMRingPatMat->SetLineWidth(nLineWidth);
pHistRMRingPatMat->Draw("same");
pHistRMSRingPatMat->SetLineColor(4);
pHistRMSRingPatMat->SetLineWidth(nLineWidth);
pHistRMSRingPatMat->Draw("same");
canvas->cd(3);
gPad->SetLogy();
pHistALLRingAmplitude->SetLineColor(2);
pHistALLRingAmplitude->SetLineWidth(nLineWidth);
pHistALLRingAmplitude->Draw();
pHistRMTRingAmplitude->SetLineColor(6);
pHistRMTRingAmplitude->SetLineWidth(nLineWidth);
pHistRMTRingAmplitude->Draw("same");
pHistRMRingAmplitude->SetLineColor(8);
pHistRMRingAmplitude->SetLineWidth(nLineWidth);
pHistRMRingAmplitude->Draw("same");
pHistRMSRingAmplitude->SetLineColor(4);
pHistRMSRingAmplitude->SetLineWidth(nLineWidth);
pHistRMSRingAmplitude->Draw("same");
canvas->cd(4);
gPad->SetLogy();
pHistALLRingPadNr->SetLineColor(2);
pHistALLRingPadNr->SetLineWidth(nLineWidth);
pHistALLRingPadNr->Draw();
pHistRMTRingPadNr->SetLineColor(6);
pHistRMTRingPadNr->SetLineWidth(nLineWidth);
pHistRMTRingPadNr->Draw("same");
pHistRMRingPadNr->SetLineColor(8);
pHistRMRingPadNr->SetLineWidth(nLineWidth);
pHistRMRingPadNr->Draw("same");
pHistRMSRingPadNr->SetLineColor(4);
pHistRMSRingPadNr->SetLineWidth(nLineWidth);
pHistRMSRingPadNr->Draw("same");
canvas->cd(5);
gPad->SetLogy();
pHistALLRingLocMax4->SetLineColor(2);
pHistALLRingLocMax4->SetLineWidth(nLineWidth);
pHistALLRingLocMax4->Draw();
pHistRMTRingLocMax4->SetLineColor(6);
pHistRMTRingLocMax4->SetLineWidth(nLineWidth);
pHistRMTRingLocMax4->Draw("same");
pHistRMRingLocMax4->SetLineColor(8);
pHistRMRingLocMax4->SetLineWidth(nLineWidth);
pHistRMRingLocMax4->Draw("same");
pHistRMSRingLocMax4->SetLineColor(4);
pHistRMSRingLocMax4->SetLineWidth(nLineWidth);
pHistRMSRingLocMax4->Draw("same");
canvas->Modified();
canvas->Update();
return canvas;
}
Last change: Sat May 22 13:08:25 2010
Last generated: 2010-05-22 13:08
This page has been automatically generated. If you have any comments or suggestions about the page layout send a mail to ROOT support, or contact the developers with any questions or problems regarding ROOT.