8 #include "TClonesArray.h"
9 #include "TGeoManager.h"
10 #include "FairRootManager.h"
11 #include "FairGeoNode.h"
15 #include "../tracking/riemannfit/PndRiemannHit.h"
19 #include "RhoTools/TEventShape.h"
25 #include "FairRunAna.h"
26 #include "FairRuntimeDb.h"
34 FairTask(
"Ideal PndSciT Hit Producer"),
evt(0),friemann(false),fLHcut(false),fScFtime(1.), fstt(false) {
40 histo =
new TH2F(
"h1",
"h1",300,-2,2,300,0,10);
41 histpi =
new TH2F(
"h",
"h",300,0,1.5,300,0,10);
42 histk =
new TH2F(
"hk",
"hk",200,0,2,200,0,1.5);
43 histp =
new TH2F(
"hp",
"hp",300,0,1.5,300,0,10);
45 map1 =
new TH2F(
"h2",
"h2",3000,0,30,3000,0,1);
46 map2 =
new TH2F(
"h3",
"h3",100,-4,4,100,-4,4);
47 map3 =
new TH2F(
"h4",
"h4",100,-4,4,100,-4,4);
48 map4 =
new TH2F(
"h5",
"h5",100,-4,4,100,-4,4);
50 Dpi1 =
new TH1F(
"hpi1",
"hpi1",300,0,2.);
51 Dpi2 =
new TH1F(
"hpi2",
"hpi2",300,0,40.);
52 Dp2 =
new TH1F(
"hp2",
"hp2",300,0,2);
53 Dpix =
new TH1F(
"hpix",
"hpix",300,0,2.);
77 {InitStatus stat=kERROR;
86 FairRootManager* ioman = FairRootManager::Instance();
90 std::cout <<
"-E- PndSciTAnaIdeal::Init: "
91 <<
"RootManager not instantiated!" << std::endl;
100 std::cout <<
"-W- PndSciTAnaIdeal::Init: "
101 <<
"No SciTPoint array!" << std::endl;
108 fmcArray=(TClonesArray*) ioman->GetObject(
"MCTrack");
111 std::cout <<
"-W- PndSciTAnaIdeal::Init: "
112 <<
"No SciTPoint array!" << std::endl;
119 std::cout <<
"-I- PndSciTAnaIdeal: Intialisation successfull" << std::endl;
135 std::cout <<
"**** PndSciTAnaIdeal::Exec *****" <<
evt<<std::endl;
141 TVector3
vecs,
pos,vecsV,vecsc,posV,momV;
148 Double_t mult,timeSciT,timeFib,time,Ssci,Stof,length,bet;
151 Double_t sigt,sigL,sigt1,sigL1,
x,
y,
z,sigx,sigy,sigz;
153 timeSciT=0.;timeFib=0.;x=0.;gam=0.;
154 Stof=0.;Ssci=0.;R =0.;sigx=sigt=sigL=sigt1=sigL1=0.;
158 std::vector<unsigned int> tpchits;
159 std::vector<unsigned int> scifhits;
160 std::vector<unsigned int> tofhits;
161 std::vector<Double_t> reltime;
169 unsigned int detId, sfdetId ,fhitId,lhitId,
170 n,det,
hit,tpdetid,tphitid;
173 detId = fhitId = lhitId =n =sfdetId =det=hit=-1;
177 PndSciTMassTrig* trig =
new PndSciTMassTrig();
188 for (Int_t iPoint = 0; iPoint <
ntrack; iPoint++)
192 if (track==0)
continue;
210 if(mctruth==0)
continue;
230 else{ q=TDatabasePDG::Instance()->GetParticle(mcpdg)->Charge()/3.;
235 sfHit->Position(pos1);
249 TVectorT<double> dVec = RT->
orig();
258 Phi =
GetDPhi(param,pos1,pos2);
266 TVector2 centre(x0, y0);
269 TVector2 pivot(-x0, -y0);
270 TVector2 pnt2(pos2.X() -
x0,pos2.Y() -
y0);
271 Double_t phi2 = pnt2.DeltaPhi(pivot);
274 fvecp.SetXYZ(-pT*
sin(phi2+fi0),pT*
cos(phi2+fi0),pT*tanL);
287 if(
friemann)x = (0.3*RT->
r()*0.01)/sinth;
292 R =
fabs(momV.Perp()/0.3*q);
295 sigx = r->Gaus(0,0.01* momV.Mag());
300 te = tk = tp = tmu = tpi = 0;
301 Le = Lp = Lmu = Lpi = Lk = 0;
303 event = Hit->GetEventID();
306 else if(
fScFtime>=0.08) sigt = gRandom->Gaus(0,0.08);
307 timeSciT = Hit->GetTime();
310 Stof = Hit->GetLength();
312 sigL = r->Gaus(0,0.01*Stof);
322 Ssci = sfHit->GetLength();
324 sigL1 = r->Gaus(0,0.01*Ssci);
327 timeFib= sfHit->GetTime();
330 else sigt1 = gRandom->Gaus(0,
fScFtime);
333 time=
fabs(timeSciT-timeFib);
336 length =
fabs(Stof-Ssci);
340 bet = (length*0.01)/(0.3*time);
344 else m = x*
sqrt(((0.09*time*time)/(length*0.01*length*0.01))-1.);
357 else lv.SetXYZT(momV.x(),momV.y(), momV.z(),
m);
359 tk = ((length*0.01)/0.3)*
sqrt(((0.490*0.490)/(x*x))+1.);
360 tpi = ((length*0.01)/0.3)*
sqrt(((0.139*0.139)/(x*x))+1.);
361 tp = ((length*0.01)/0.3)*
sqrt(((0.938*0.938)/(x*x))+1.);
362 tmu = ((length*0.01)/0.3)*
sqrt(((0.105*0.105)/(x*x))+1.);
363 te = ((length*0.01)/0.3)*
sqrt(((0.0005*0.0005)/(x*x))+1.);
401 }
else gam= 1./
sqrt(1.-(bet*bet));
403 if(
fLHcut){
if(Lk>0.4)++kaon;
405 if(mcpdg==321)++kaon;
409 histo->Fill(charg*x,m/x);
410 if(q<0)
histp->Fill(x,m/x);
411 if(q>0)
histpi->Fill(x,m/x);
417 if(q<0)
Dpi1->Fill(m);
439 else micro->SetTrackLength(length);
442 micro->SetSciTStopTime(time);
443 micro->SetSciTM2(m*m);
444 micro->SetPionPidLH(Lpi);
445 micro->SetKaonPidLH(Lk);
446 micro->SetProtonPidLH(Lp);
447 micro->SetMuonPidLH(Lmu);
448 micro->SetElectronPidLH(Le);
455 new ((*fTrigArray)[
count])PndSciTMassTrig(event,kaon);
458 std::cout<<
"evt "<<
evt<<
" k "<<kaon<<std::endl;
460 std::cout<<
" entries of PndSciTMassTrig "<<
fTrigArray->GetEntriesFast()<<std::endl;
461 std::cout<<
" entries of PndSciTMicro "<<
fMicroCandidates->GetEntriesFast()<<std::endl;
471 std::cout<<
" tof trig -> si "<<
event<<
" "<<stg->
GetEventID()<<std::endl;
473 for(Int_t iHypHit=0;iHypHit<nhyp;++iHypHit)
481 TVector3 dposLocal(0.01,0.01,0.05);
521 cout<<
" -I PndHyp::FinishRun():closing and deleting fFile fEvt "<<endl;
532 for (Int_t ihit = 0; ihit <
nhit; ihit++)
539 std::cout<<
" it "<<Hit->
GetEventID()<<
" ev "<<ev<<endl;
555 Dpix->Fill(vecs.Mag());
557 for (Int_t
i=0;
i<ntr;
i++){
563 Energy =
sqrt(pv.Mag2()+(mf*mf));
568 P.SetPxPyPzE(pv.x(),pv.y(),pv.z(),Energy);
569 V.SetX( pos.x()); V.SetY(pos.y()); V.SetZ(pos.z());
576 THParticle fparticle(pid,1,ev,0,mf,AI,ZI,LI,P,V);
603 double sigx=gRandom->Gaus(0,0.01);
604 double sigy=gRandom->Gaus(0,0.01);
605 double sigz=gRandom->Gaus(0,0.005);
607 double x = pos.x() + sigx;
608 double y = pos.y() + sigy;
609 double z = pos.z() + sigz;
624 posLab[0]=pos.x(); posLab[1]=pos.y(); posLab[2]=pos.z();
627 pos.SetXYZ(posSens[0],posSens[1],posSens[2]);
631 posSens[0]=pos.x(); posSens[1]=pos.y(); posSens[2]=pos.z();
633 pos.SetXYZ(posLab[0],posLab[1],posLab[2]);
642 unsigned int detId, hitId;
644 TVector3
pos(0.,0.,0.);
645 TVector3 dpos(0.,0.,0.);
652 else if (detId == 2){
653 myHit = (FairMCPoint*)
fTpcArray->At(hitId);
655 else if (detId == 3){
662 hit.
setXYZ(myHit->GetX(),myHit->GetY(),myHit->GetZ());
682 (
fQ>0 ? Q=1.: Q=-1.);
684 TVector2 centre(x0, y0);
687 TVector3 pivot(-x0, -y0,0.);
691 TVector3 pnt1(v1.X() -
x0,v1.Y() -
y0,0.);
693 TVector3 pnt2(v2.X() -
x0, v2.Y() -
y0,0.);
695 Double_t cosPhi1 = (pnt1*pivot)/(pnt1.Mag()*pivot.Mag());
696 Double_t cosPhi2 = (pnt2*pivot)/(pnt2.Mag()*pivot.Mag());
700 if(cosPhi1 >=0.) phi1=
acos(cosPhi1);
702 if(cosPhi2 >=0.) phi2=
acos(cosPhi2);
705 if(phi2-phi1>0) DPhi= (phi2-phi1);
706 if(phi2-phi1<0) DPhi = (phi2-phi1);
722 if(ion>1000000000&&(ion<1010000000))
732 if((ion>1010000000||ion>1020000000))
747 TFile*
file = FairRootManager::Instance()->GetOutFile();
749 file->mkdir(
"tof_trig");
750 file->cd(
"tof_trig");
friend F32vec4 acos(const F32vec4 &a)
void SetTrackIndex(int idx)
void MomentumIn(TVector3 &mom)
PndHypPoint * fCurrentHypPoint
friend F32vec4 cos(const F32vec4 &a)
TClonesArray * fTrackCandArray
PndHypGeoHandling * fGeoH
void smearLocal(TVector3 &pos)
virtual void Exec(Option_t *opt)
friend F32vec4 sqrt(const F32vec4 &a)
void GetFragment(Int_t primGen)
static T Sqrt(const T &x)
friend F32vec4 sin(const F32vec4 &a)
virtual void SetParContainers()
unsigned int getNHits() const
TVector3 GetMomentum() const
void InitTransMat()
Input file name.
TClonesArray * fPointArray
Int_t GetVolumeID() const
TGeoManager * gGeoManager
void SetFirstHit(TVector3 &pos)
void setDXYZ(double dx, double dy, double dz)
TClonesArray * fsciFPointArray
PndRiemannTrack * GetRiemannTrack(GFTrackCand *cand)
void PositionIn(TVector3 &pos)
TString GetPath(TString id)
for a given ID the path is returned
void getHit(unsigned int i, unsigned int &detId, unsigned int &hitId) const
Get detector ID and cluster index (hitId) for hit number i.
Double_t GetDPhi(Double_t *par, TVector3 &v1, TVector3 &v2)
void setXYZ(double x, double y, double z)
TGeoHMatrix * fCurrentTransMat
TClonesArray * fTrigArray
void refit(bool withErrorCalc=true)
Track candidate – a list of cluster indices.
TClonesArray * fSTPointArray
TClonesArray * fHPointArray
const Char_t * fFileName
Gives Access to the Statistical decay products.
friend F32vec4 fabs(const F32vec4 &a)
void PositionOut(TVector3 &pos)
int hit(Int_t nEvents=0, TString inFile="sim.root", TString parFile="par.root", TString inDigi="digi.root", TString outFile="hit.root", Int_t timeBased=0)
Int_t GetChargeIon(Int_t ion)
TClonesArray * fMicroCandidates
void GetAZH(Int_t ion, Int_t &AI, Int_t &ZI, Int_t &L)
void GetData(Int_t tr, TVector3 &p, Int_t &pid, Double_t &mass)
search fragment in event
TClonesArray * fHitOutputArray
void smear(TVector3 &pos, TVector3 &dpos)
TString GetDetName() const
virtual InitStatus ReInit()
void szFit(bool withErrorCalc=true)
void addHit(PndRiemannHit &hit)
void SetLastHit(TVector3 &pos)
void SetSciTEventCorr(Int_t ev, Int_t mult)
virtual InitStatus Init()
Int_t GetMotherID() const