4 #include "FairRootManager.h"
14 FairRootManager *fManager =FairRootManager::Instance();
37 std::cout <<
"InitStatus PndPidEmcBayesAssociatorTask::Init()" << std::endl;
39 FairRootManager *fManager =FairRootManager::Instance();
43 std::cout <<
"-I- PndPidEmcBayesAssociatorTask::Init: No PndPidCandidate array PidChargedCand there!" << std::endl;
52 std::cout <<
"-I- PndPidEmcBayesAssociatorTask::Init: Success!!" << std::endl;
60 TString fPath = getenv(
"VMCWORKDIR");
61 fPath +=
"/macro/params/";
63 printf(
"-I- PndPidEmcBayesAssociatorTask::SetupEnvironment:File used=%s",filename);
64 TFile* hfile1 =
new TFile (fullName);
66 fBayesEP[0] = (TH2D*)hfile1->Get(
"p.v.EP_proba_elecSpos");
67 fBayesTH[0] = (TH2D*)hfile1->Get(
"p.v.LAT_proba_elecSpos");
68 fBayesZZ[0] = (TH2D*)hfile1->Get(
"p.v.Z53_proba_elecSpos");
70 fBayesEP[1] = (TH2D*)hfile1->Get(
"p.v.EP_proba_muonSpos");
71 fBayesTH[1] = (TH2D*)hfile1->Get(
"p.v.LAT_proba_muonSpos");
72 fBayesZZ[1] = (TH2D*)hfile1->Get(
"p.v.Z53_proba_muonSpos");
74 fBayesEP[2] = (TH2D*)hfile1->Get(
"p.v.EP_proba_pionSpos");
75 fBayesTH[2] = (TH2D*)hfile1->Get(
"p.v.LAT_proba_pionSpos");
76 fBayesZZ[2] = (TH2D*)hfile1->Get(
"p.v.Z53_proba_pionSpos");
78 fBayesEP[3] = (TH2D*)hfile1->Get(
"p.v.EP_proba_kaonSpos");
79 fBayesTH[3] = (TH2D*)hfile1->Get(
"p.v.LAT_proba_kaonSpos");
80 fBayesZZ[3] = (TH2D*)hfile1->Get(
"p.v.Z53_proba_kaonSpos");
82 fBayesEP[4] = (TH2D*)hfile1->Get(
"p.v.EP_proba_protSpos");
83 fBayesTH[4] = (TH2D*)hfile1->Get(
"p.v.LAT_proba_protSpos");
84 fBayesZZ[4] = (TH2D*)hfile1->Get(
"p.v.Z53_proba_protSpos");
86 fBayesEP[5] = (TH2D*)hfile1->Get(
"p.v.EP_proba_elecSneg");
87 fBayesTH[5] = (TH2D*)hfile1->Get(
"p.v.LAT_proba_elecSneg");
88 fBayesZZ[5] = (TH2D*)hfile1->Get(
"p.v.Z53_proba_elecSneg");
90 fBayesEP[6] = (TH2D*)hfile1->Get(
"p.v.EP_proba_muonSneg");
91 fBayesTH[6] = (TH2D*)hfile1->Get(
"p.v.LAT_proba_muonSneg");
92 fBayesZZ[6] = (TH2D*)hfile1->Get(
"p.v.Z53_proba_muonSneg");
94 fBayesEP[7] = (TH2D*)hfile1->Get(
"p.v.EP_proba_pionSneg");
95 fBayesTH[7] = (TH2D*)hfile1->Get(
"p.v.LAT_proba_pionSneg");
96 fBayesZZ[7] = (TH2D*)hfile1->Get(
"p.v.Z53_proba_pionSneg");
98 fBayesEP[8] = (TH2D*)hfile1->Get(
"p.v.EP_proba_kaonSneg");
99 fBayesTH[8] = (TH2D*)hfile1->Get(
"p.v.LAT_proba_kaonSneg");
100 fBayesZZ[8] = (TH2D*)hfile1->Get(
"p.v.Z53_proba_kaonSneg");
102 fBayesEP[9] = (TH2D*)hfile1->Get(
"p.v.EP_proba_protSneg");
103 fBayesTH[9] = (TH2D*)hfile1->Get(
"p.v.LAT_proba_protSneg");
104 fBayesZZ[9] = (TH2D*)hfile1->Get(
"p.v.Z53_proba_protSneg");
115 if(
fVerbose>1) std::cout <<
"-I- Start PndPidEmcBayesAssociatorTask. "<<std::endl;
137 Int_t Charge = pidcand-> GetCharge();
146 Double_t pidth = radeg*pidTrack.Theta();
147 Double_t pidph = radeg*pidTrack.Phi();
154 GetPdf(pidp,pidth,pidph,z20,z53,lat,EP,Charge,proba);
156 std::cout <<
" proba in Pidmatch: " << proba[0] <<
" ";
157 std::cout << proba[1] <<
" " << proba[2] <<
" ";
158 std::cout << proba[3] <<
" " << proba[4] << std::endl;
193 Double_t lRange[7]={0.2, 5,-180, 0, 0, 0, 0};
194 Double_t uRange[7]={10 ,140, 180, 4, 5, 6, 2};
206 if(
fVerbose>1) std::cout <<
"ppin: " << pp << std::endl;
209 if( ppin<0.000001) ppin=0.000001;
210 if(z20in>0.999999) z20in=0.999999;
211 if(z53in<0.000001) z53in=0.000001;
212 if(LATin<0.000001) LATin=0.000001;
218 if(
fVerbose>1) std::cout <<
"pp: " << pp << std::endl;
223 if(pplook<lRange[0]) pplook=1.0001*lRange[0];
224 if(pplook>uRange[0]) pplook=0.9999*uRange[0];
225 if(th <lRange[1]) th =1.0001*lRange[1];
226 if(th >uRange[1]) th =0.9999*uRange[1];
227 if(ph <lRange[2]) ph =1.0001*lRange[2];
228 if(ph >uRange[2]) ph =0.9999*uRange[2];
229 if(Z20 <lRange[3]) Z20 =1.0001*lRange[3];
230 if(Z20 >uRange[3]) Z20 =0.9999*uRange[3];
231 if(Z53 <lRange[4]) Z53 =1.0001*lRange[4];
232 if(Z53 >uRange[4]) Z53 =0.9999*uRange[4];
233 if(LAT <lRange[5]) LAT =1.0001*lRange[5];
234 if(LAT >uRange[5]) LAT =0.9999*uRange[5];
235 if(EP <lRange[6]) EP =1.0001*lRange[6];
236 if(EP >uRange[6]) EP =0.9999*uRange[6];
237 if(
fVerbose>1) std::cout <<
"pplook: " << pplook << std::endl;
240 Int_t binxP = (
fBayesEP[0]->GetXaxis())->FindBin(pplook);
241 Int_t binyP = (
fBayesEP[0]->GetYaxis())->FindBin(EP);
242 Int_t binxT = (
fBayesTH[0]->GetXaxis())->FindBin(pplook);
243 Int_t binyT = (
fBayesTH[0]->GetYaxis())->FindBin(LAT);
244 Int_t binxZ = (
fBayesZZ[0]->GetXaxis())->FindBin(pplook);
245 Int_t binyZ = (
fBayesZZ[0]->GetYaxis())->FindBin(Z53);
252 std::cout <<
"pp: " << pp <<
" EP " << EP << std::endl;
253 std::cout <<
"probas: ";
259 for (Int_t k=0; k<5; k++){
261 PBayesE[k]=
fBayesEP[k]->GetBinContent(binxP,binyP);
262 PBayesL[k]=
fBayesTH[k]->GetBinContent(binxT,binyT);
263 PBayesZ[k]=
fBayesZZ[k]->GetBinContent(binxZ,binyZ);
264 PBayesB[k]=PBayesE[k]*PBayesL[k]*PBayesZ[k];
265 probasum+=PBayesB[k];
267 PBayesE[k]=
fBayesEP[k+5]->GetBinContent(binxP,binyP);
268 PBayesL[k]=
fBayesTH[k+5]->GetBinContent(binxT,binyT);
269 PBayesZ[k]=
fBayesZZ[k+5]->GetBinContent(binxZ,binyZ);
270 PBayesB[k]=PBayesE[k]*PBayesL[k]*PBayesZ[k];
271 probasum+=PBayesB[k];
273 PBayesB[k]=PBayesE[k]*PBayesL[k]*PBayesZ[k]/
274 (1-PBayesE[k])*(1-PBayesL[k])*(1-PBayesZ[k]);
275 if(
fVerbose>1) std::cout << PBayesZ[k] <<
" ";
280 for (Int_t k=0; k<5 ; k++){
282 proba[k]=PBayesB[k]/(1+PBayesB[k]);
292 FairRootManager::Instance()->
printf("RealTime=%f seconds, CpuTime=%f seconds\n", rtime, ctime)
Float_t GetEmcRawEnergy() const
virtual void SetParContainers()
virtual InitStatus Init()
void SetPionPdf(Double_t val)
void emc(Int_t nEvents=10, Char_t part[]="e-", Double_t momentum_min=1.0, Double_t momentum_max=1.0, Double_t theta_min=0, Double_t theta_max=180, Double_t phi_min=0, Double_t phi_max=360, Char_t OutputSimFile[]="sim_emc.root", Char_t OutputDatabaseFile[]="simparams.root", Char_t TransportModel[]="TGeant3", UInt_t seed=0, Bool_t savepoints=kFALSE, Bool_t savehits=kFALSE, Bool_t savewaves=kFALSE, Bool_t savedigis=kFALSE, Bool_t saveclusters=kTRUE, Bool_t savebumps=kTRUE)
PndPidEmcBayesAssociatorTask()
static T Sqrt(const T &x)
TClonesArray * fPidChargedProb
PndPidCandidate TCA for charged particles.
TLorentzVector GetLorentzVector() const
void SetKaonPdf(Double_t val)
void GetPdf(Double_t pp1, Double_t th1, Double_t ph1, Double_t z20, Double_t z53, Double_t LAT, Double_t EP1, Int_t charge, Double_t *proba)
static T Log10(const T &x)
TClonesArray * fPidChargedCand
void SetElectronPdf(Double_t val)
Int_t GetEmcIndex() const
void SetMuonPdf(Double_t val)
h_MC_angle SetTitle("MC truth: opening angle of #pi^{0}")
void DoPidMatch(PndPidCandidate *pidcand, PndPidProbability *prob)
Double_t GetEmcClusterZ53() const
Double_t GetEmcClusterLat() const
virtual void Exec(Option_t *option)
Double_t GetEmcClusterZ20() const
virtual ~PndPidEmcBayesAssociatorTask()
TString fTrackBranchNamePidHypo
PndPidProbability TCA for charged particles.
void SetProtonPdf(Double_t val)
void SetupEnvironment(char *filename)