50 #include "StPmdDiscriminator.h"
51 #include "StPmdDiscriminatorMaker.h"
52 #include "StPmdDiscriminatorNN.h"
53 #include "StPmdUtil/StPmdCollection.h"
54 #include "StPmdUtil/StPmdDetector.h"
55 #include "StPmdUtil/StPmdClusterCollection.h"
56 #include "StPmdUtil/StPmdCluster.h"
57 #include "StNNCluster.h"
58 #include "StEventTypes.h"
61 Int_t EventProcessed=0;
62 Int_t EtaPhiArr_CPV[400][1400];
76 StPmdDiscriminatorMaker::~StPmdDiscriminatorMaker()
81 Int_t StPmdDiscriminatorMaker::Init()
84 return StMaker::Init();
89 mEdepPmd =
new TH1F(
"EdepPmd",
"Energy deposited",100,0.,0.02);
90 mEtaPmd =
new TH1F(
"EtaPmd",
"Eta Distribution",100,-6., 6.);
91 mPhiPmd =
new TH1F(
"PhiPmd",
"Phi Distribution",100,-3.14,3.14);
92 mMCPID =
new TH1F(
"McPID",
"Mc PID",11,-0.5,10.5);
93 mcpvmatched =
new TH1F(
"cpvmatched",
"CPV Matched",100,0,100.);
94 mEtadiff =
new TH1F(
"DeltaEta",
"Eta Difference",200,0.,200.);
95 mPhidiff =
new TH1F(
"DeltaPhi",
"Phi Difference",4000,0.,3000.);
96 mEtaPhi =
new TH2F(
"DeltaEtaDetaPhi",
"(Delta) Eta Phi Distribution",100,0,200.,4000,0.,3000.);
97 mClusterPID =
new TH1F(
"ClusterPID",
"ClusterPID based on matching",10,0.5,10.5);
98 mClusterEdepPID =
new TH1F(
"ClusterEdepPID",
"ClusterPID based on Edep",10,0.5,10.5);
99 mEdepVsPID =
new TH2F(
"EdepVsPID",
"PID based on Edep",100,0.,200.,100,0.,10.);
100 mNNoutput =
new TH1F(
"NNTrainOut",
"Training output from NN",100,0.,2.);
110 cout <<
"PMDDISC ***** Can not get StEvent pointer . sorry \n";
return kStErr;
114 clusterIn = GetDataSet(
"PmdSimulator");
119 pmd_det = cluster_hit->
detector(Int_t(0));
120 cpv_det = cluster_hit->
detector(Int_t(1));
126 for(Int_t d=0;d<2;d++){
127 StDetectorId pdet=
static_cast<StDetectorId
>(kPhmdCpvId+d);
130 if(d==1)cluscoll = detector->cluster();
131 if(d==0)cpvcluscoll = detector->cluster();
134 Int_t ret=PrepareInputforNN(pmd_det,cpv_det,cluscoll,cpvcluscoll);
138 if(d==1&&cluscoll)cout<<
"ncls "<<cluscoll->numberOfclusters()<<endl;
142 cout<<
"DISCMAKER*****"<<mApplyFlagNN<<endl;
146 discNN->setApplyFlag(1);
147 discNN->setDisMaker(
this);
151 discNN->Discriminate();
165 disc->SetEdepcut(0.0000063);
166 cout<<
"calling edep_disc "<<endl;
168 disc->Discriminate();
171 fillHistograms(pmd_det,cpv_det);
176 fillStEvent(cluster_hit,phmdcl);
193 if(clusters){nclust = clusters->
Nclusters();}
198 for(Int_t i=0; i<nclust ; i++)
203 Float_t edep=spmcl1->CluEdep();
204 Int_t PID=spmcl1->CluPID();
205 Int_t EdepPID=spmcl1->CluEdepPID();
207 mEdepVsPID->Fill(edep*1000000,Float_t(EdepPID));
218 cout<<
"prepareInput***"<<endl;
219 Double_t etapmd,phipmd,edeppmd;
220 Double_t etacpv,phicpv,edepcpv;
224 for(Int_t ibineta=0;ibineta<400;ibineta++){
225 for(Int_t ibinphi=0;ibinphi<1400;ibinphi++){
226 EtaPhiArr_CPV[ibineta][ibinphi]=-999;
235 Int_t Ncluster0=cluscoll->numberOfclusters();
238 const StSPtrVecPhmdCluster& pmdclusters= cluscoll->clusters();
239 const StSPtrVecPhmdCluster& cpvclusters= cpvcluscoll->clusters();
241 cout<<
"PMD cluster size "<<pmdclusters.size()<<endl;
242 cout<<
"CPV cluster size "<<cpvclusters.size()<<endl;
247 TIter nextCPV(clusters1->
Clusters());
249 for(Int_t icpv=0; icpv<nclust1 ; icpv++)
254 phicpv=spmcl2->CluPhi();
255 edepcpv=spmcl2->CluEdep();
257 if(fabs(etacpv)>2. && fabs(etacpv)<4.){etabin=Int_t((fabs(etacpv)-2)/mDeltaEta);}
258 if(fabs(phicpv)<3.14){phibin=Int_t((phicpv+3.14)/mDeltaPhi);}
259 EtaPhiArr_CPV[etabin][phibin]=icpv;
269 for(UInt_t i=0;i<pmdclusters.size();i++)
278 nncls->setPmdCluster(cl1);
285 if(fabs(etapmd)>2. && fabs(etapmd)<4.)etabin=Int_t((fabs(etapmd)-2)/mDeltaEta);
286 if(fabs(phipmd)<3.14)phibin=Int_t((phipmd+3.14)/mDeltaPhi);
288 for(Int_t ibineta=0;ibineta<400;ibineta++){
289 for(Int_t ibinphi=0;ibinphi<1400;ibinphi++){
290 if(EtaPhiArr_CPV[ibineta][ibinphi]!=-999 && EtaPhiArr_CPV[ibineta][ibinphi]!=0){
291 Float_t etadiff=abs(ibineta-etabin);
292 Float_t phidiff=abs(ibinphi-phibin);
293 mEtaPhi->Fill(etadiff,phidiff);
300 if(EtaPhiArr_CPV[etabin][phibin]!=-999){
301 Int_t index=EtaPhiArr_CPV[etabin][phibin];
305 spmcl1->setCluPID(8);
309 spmcl1->setCluPID(1);
315 NNContainer.push_back(nncls);
327 if(mApplyFlagNN!=1 && mTrainFlag==1){
329 discNN->setApplyFlag(0);
330 discNN->setDisMaker(
this);
333 discNN->Discriminate();
349 StDetectorId pdet=
static_cast<StDetectorId
>(kPhmdId);
354 const StSPtrVecPhmdCluster& pmdclusters= cluscoll->clusters();
358 int nclust_phmd=pmdclusters.size();
361 if(nclust==nclust_phmd)loopcls=nclust;
362 if(nclust<nclust_phmd)loopcls=nclust;
363 if(nclust>nclust_phmd)loopcls=nclust_phmd;
365 for(Int_t i=0; i<loopcls ; i++)
368 int edeppid=spmcl1->CluEdepPID();
371 if(cl1)cl1->setEnergyPid(edeppid);
StPmdDetector * detector(Int_t)
destructor
Int_t Nclusters() const
destructor
TH2F * mEtaPhi
1-D delts phi distribution
TObjArray * Clusters()
no. of clusters
void bookHistograms()
Setting Traininbg or testing flag.
virtual void Browse(TBrowser *b)
Browse this dataset (called by TBrowser).
Float_t CluEdep() const
cluster phi
TH1F * mcpvmatched
2-D CpvClusters vs Matched Clusters
Float_t CluPhi() const
cluster eta
TH1F * mPhiPmd
1-D Eta PMD
TH1F * mPhidiff
1-D delta eta distribution
TH1F * mClusterEdepPID
1-D plot for PID through Matching
void Browse(TBrowser *b)
Browse this dataset (called by TBrowser).
TH1F * mEtaPmd
1-D EDep Display for PMD
Int_t McCluPID() const
cluster PID based on CPV/PMD matching
TH2F * mEdepVsPID
1-D plot for PID through E-cut
TH1F * mEtadiff
1-D Phi PMD
Float_t CluEta() const
number of cells in the cluster as float
TH1F * mClusterPID
DeltaEta-DeltaPhi Distribution.
TH1F * mMCPID
1-D delts phi distribution
virtual TDataSet * Find(const char *path) const