//*--AUTHOR : Anar Rustamov //class fo calculation of spline parameters. //In case of 4 MDC we take points from each MDC(the senter of MDC), and calculate intersection of line formed with thiese points with fixed plane, and the later points are then taken as an input. //In case of three MDC the procedure is the same. //In case of META hit the third point is from the kickplane using namespace std; #include "hmagnetpar.h" #include "hmetamatchF.h" #include "hevent.h" #include "hcategory.h" #include "hiterator.h" #include "hspectrometer.h" #include "hruntimedb.h" #include "hmdcdetector.h" #include "hspecgeompar.h" #include "tofdef.h" #include "richdef.h" #include "triggerinfodef.h" #include "hmatrixcategory.h" #include "hbasetrack.h" #include "hmetamatch.h" #include "hgeomtransform.h" #include "hmdctrackddef.h" #include "hmdctrackgdef.h" #include "hmdcseg.h" #include "hkickplane2.h" #include "hmdctrkcand.h" #include "hmdctrackgspline.h" #include "hgeomvector.h" #include "hlocation.h" #include "hshowerhittoftrack.h" #include "hmdcgetcontainers.h" #include "htofhit.h" #include "htofcluster.h" #include "hrichhit.h" #include "hrichhitIPU.h" #include #include "TFile.h" #include "TNtuple.h" #include "hmdctrackgsplinecorr.h" #include "hgeantkine.h" #include "hlinkeddataobject.h" #include"hreconstructor.h" #include "hades.h" #include #include "hmdcsegsim.h" #include "hmdchitsim.h" #include "hfield.h" #include "hmdctrackgfieldpar.h" #include "hmdctrackgcorrpar.h" #include "hmatrixcatiter.h" #include "hgeantmdc.h" #include "TRandom.h" ClassImp(HMdcTrackGSplineCorr) HMdcTrackGSplineCorr::HMdcTrackGSplineCorr() { fCatMdc=0; fMdcIter=0; fCatKine=0; fMdcGeometry=0; fSpecGeometry=0; field=0; corr=0; for(Int_t s=0; s<6; s++) for(Int_t m=0; m<4; m++) for (Int_t l=0; l<7; l++) trLS[s][m][l]=0; SetFileName(); SetOutDir(); } HMdcTrackGSplineCorr::HMdcTrackGSplineCorr(const Text_t *name,const Text_t *title) : HReconstructor(name,title) { ismdc1234=kTRUE; fCatMdc=0; fMdcIter=0; fCatKine=0; fMdcGeometry=0; fSpecGeometry=0; field=0; corr=0; Spline=0; for(Int_t s=0; s<6; s++) for(Int_t m=0; m<4; m++) for (Int_t l=0; l<7; l++) trLS[s][m][l]=0; SetFileName(); SetOutDir(); } HMdcTrackGSplineCorr::~HMdcTrackGSplineCorr(void) { // if (fMdcIter) delete fMdcIter; // if (fKineIter) delete fKineIter; } void HMdcTrackGSplineCorr::SetFileName(TString cTemp) { fileName=cTemp; } void HMdcTrackGSplineCorr::SetOutDir(TString cTemp) { outDir=cTemp; } Bool_t HMdcTrackGSplineCorr::init(void) { //init(void) if(gHades) { // HMdcTrackGSpline *Spline=new HMdcTrackGSpline; nt4 = new TNtuple("nt4","nt4","theta:phi:pGeant:pRecon:pol:sec"); nt3 = new TNtuple("nt3","nt3","theta:phi:pGeant:pRecon:pol:sec"); HRuntimeDb *rtdb=gHades->getRuntimeDb(); HSpectrometer *spec=gHades->getSetup(); HEvent *event=gHades->getCurrentEvent(); if(rtdb && spec && event) { //HDetector *mdc=spec->getDetector("Mdc"); field=(HMdcTrackGFieldPar*)(rtdb->getContainer("MdcTrackGFieldPar")); corr=(HMdcTrackGCorrPar*)(rtdb->getContainer("MdcTrackGCorrPar")); fSpecGeometry = (HSpecGeomPar *)(rtdb->getContainer("SpecGeomPar")); fMdcGeometry=(HMdcGeomPar *)(rtdb->getContainer("MdcGeomPar")); pMagnet=(HMagnetPar*)(rtdb->getContainer("MagnetPar")); kickplane = HKickPlane2::getMDC3(); if(!kickplane) printf("YESSS DO IT!!!\n"); //************* fGetCont=HMdcGetContainers::getObject(); fGetCont->getMdcGeomPar(); fGetCont->getSpecGeomPar(); //*************** } fCatMdc=event->getCategory(catMdcGeantRaw); if (!fCatMdc) return kFALSE; fCatKine=event->getCategory(catGeantKine); if(!fCatKine) return kFALSE; fMdcIter=(HIterator*)fCatMdc->MakeIterator(); if(!fMdcIter) return kFALSE; fKineIter=(HIterator*)fCatKine->MakeIterator(); if(!fCatKine)return kFALSE; } //cout<<"INIT DONE"<getCorrScan(corrScan); //cout<<"R E I N I T0000000"<getCurrentEvent()->getHeader(); //for(Int_t i=0; i<6; i++) //tRans[i]=0; Spline=corr->getSPline(); Spline->setCorrScan(corrScan); //cout<<"R E I N I T111111"<initMiddleParams(Spline->takeMiddleParams(fGetCont,0,2)); //cout<<"R E I N I T111111"<setDataPointer(field->getPointer(),corr->getCorr1()); //cout<<"R E I N I T111111"<setKickPointer(kickplane); //cout<<"R E I N I T111111KICK"<getPolarity()>=0) { Spline->setMagnetScaling(pMagnet->getScalingFactor()); fScal=pMagnet->getScalingFactor(); } else { Spline->setMagnetScaling(pMagnet->getScalingFactor()*(-1.)); fScal=pMagnet->getScalingFactor()*(-1.); } //cout<<"R E I N I T"<Write(); nt3->Write(); f.Close(); return kTRUE; } Int_t HMdcTrackGSplineCorr::execute(void) { //cout<<"E X E C U T E"<Reset(); while((pGeantKine=(HGeantKine*)fKineIter->Next())!=0) { //loop over kine //cout<<"KINEYE GIRDIK"<getTotalMomentum(); pGeantKine->getMomentum(px,py,pz); phi=atan2(py,px)*180/acos(-1.); theta=acos(pz/pKine)*180/acos(-1.); pGeantKine->getParticle(tracknd,ID); Float_t xV,yV,zV; pGeantKine->getVertex(xV,yV,zV); // pGeantKine->setMdcCategory(fCatMdc); pGeantKine->resetMdcIter(); //cout<<"KINEYE GIRDIK22"<nextMdcHit()<nextMdcHit())!=0) { //loop over geant //cout<<"pGeantMdc "<getSector()==0 && pGeantMdc->getModule()==0 && pGeantMdc->getLayer()==6) { //ut<<"First point"<getSector()==0 &&pGeantMdc->getModule()==1 && pGeantMdc->getLayer()==5) { //ut<<"Second point"<getSector()==0 &&pGeantMdc->getModule()==2 && pGeantMdc->getLayer()==0) { // cout<<"Third point"<getSector()==0 &&pGeantMdc->getModule()==2 && pGeantMdc->getLayer()==6) { //flag3=1; if(!takePoint(pGeantMdc,POINT3Cham,p26,0,2,6)) continue; } if(pGeantMdc->getSector()==0 &&pGeantMdc->getModule()==3 && pGeantMdc->getLayer()==6) { // cout<<"Fourth point"<setZGlobal(zV); pRecon=Spline->calcMomentum(POINT,kTRUE,zV,4); //POINT[3]=POINT3Cham; calcChamber3Mode(POINT); POINT[3]=POINT3Cham; POINT[0]*=0.1; pRecon3Cham=Spline->calcMomentum(POINT,kTRUE,zV,3); //calculations in case of 3 chambers pGeant=p16; RadiusV=sqrt((POINT[1].getX()-POINT[0].getX())*(POINT[1].getX()-POINT[0].getX())+ (POINT[1].getY()-POINT[0].getY())*(POINT[1].getY()-POINT[0].getY())+ (POINT[1].getZ()-POINT[0].getZ())*(POINT[1].getZ()-POINT[0].getZ())); // theta=acos((POINT[1].getZ()-POINT[0].getZ())/RadiusV)*180/acos(-1.); // phi=atan2((POINT[1].getY()-POINT[0].getY()),(POINT[1].getX()-POINT[0].getX()))*180/acos(-1.); nt4->Fill(theta,phi,pGeant,pRecon,Spline->getPolarity(),pGeantMdc->getSector()); nt3->Fill(theta,phi,pGeant,pRecon3Cham,Spline->getPolarity(),pGeantMdc->getSector()); // cout<<"prec= "<