68 #include "TStopwatch.h"
78 #include "StPmdUtil/StPmdGeom.h"
79 #include "StPmdClusterMaker.h"
80 #include "StPmdAbsClustering.h"
81 #include "StPmdClustering.h"
82 #include "StPmdUtil/StPmdDetector.h"
83 #include "StPmdUtil/StPmdModule.h"
84 #include "StPmdUtil/StPmdCollection.h"
85 #include "StPmdUtil/StPmdClusterCollection.h"
86 #include "StPmdUtil/StPmdCluster.h"
88 #include "StDbLib/StDbManager.hh"
89 #include "StDbLib/StDbTable.h"
90 #include "StDbLib/StDbConfigNode.hh"
93 #include "StEventTypes.h"
94 #include "StThreeVectorD.hh"
95 #include "StHelixD.hh"
96 #include "StPhysicalHelixD.hh"
97 #include "StThreeVector.hh"
99 #include "SystemOfUnits.h"
114 mOptCalibrate=kFALSE;
124 mOptRefineCluster=kFALSE;
126 cout<<
" Default options: mOptCalibrate = "<<mOptCalibrate<<
" mOptRefineCluster = "<<mOptRefineCluster<<
" mOptSimulate="<<mOptSimulate<<endl;
132 StPmdClusterMaker::~StPmdClusterMaker()
136 Int_t StPmdClusterMaker::Init()
139 if(mOptHist)bookHistograms();
141 return StMaker::Init();
145 Int_t StPmdClusterMaker::InitRun(Int_t runnr) {
147 if(Debug())cout<<
"StPmdClusterMaker::InitRun with run "<<runnr<<endl;
149 if(mOptCalibrate==kTRUE){
150 ReadCalibrationsConst();
152 cout<<
"Not reading the calibration Constants"<<endl;
155 return StMaker::InitRun(runnr);
160 void StPmdClusterMaker::bookHistograms()
162 mNclust=
new TH1F(
"Nclust",
"Nclust (no cut)",100,-0.5,100.5);
163 mNclust1=
new TH1F(
"Nclust1",
"Nclust (1MIP cut)",100,-0.5,100.5);
164 mNclust2=
new TH1F(
"Nclust2",
"Nclust (2MIP cut)",100,-0.5,100.5);
165 mNclust3=
new TH1F(
"Nclust3",
"Nclust (3MIP cut)",100,-0.5,100.5);
167 mSmPmdCluster =
new TH1F(
"Smno_pmd",
"SuperModule No",24,1.,24.);
168 mEdepPmdCluster =
new TH1F(
"EdepPmd",
"Energy deposited",10000,0.,10000);
172 mEtaPmdCluster =
new TH1F(
"EtaPmd",
"Eta Distribution",100,-4.,-2.);
173 mPhiPmdCluster =
new TH1F(
"PhiPmd",
"Phi Distribution",100,-3.14,3.14);
174 mPmdCluster =
new TH1F(
"PmdCluster",
" NCluster in PMD",100,0,5000);
175 mPhi2ModPmd =
new TH2F(
"Phi2ModPmd",
"Phi vs Mod",12,0.5,12.5,360,-3.14,3.14);
176 mHitVscluster =
new TH2F(
"Pmd_hitvsClus",
"Hit vsclusPMD",50,0.5,50.5,50,0.5,50.5);
179 mSmCpvCluster =
new TH1F(
"Smno_cpv",
"CPV SuperModule No",24,1.,24.);
180 mEdepCpvCluster =
new TH1F(
"EdepCpv",
"Cpv Energy deposited",5000,0.,5000.);
181 mNcellCpvCluster =
new TH1F(
"NcellCpv",
"No of Cellsper cls (CPV)",50,-0.5,49.5);
182 mEtaCpvCluster =
new TH1F(
"EtaCpv",
"Cpv Eta Distribution",100,-4.,-2.);
183 mPhiCpvCluster =
new TH1F(
"PhiCpv",
"Cpv Phi Distribution",100,-3.14,3.14);
184 mCpvCluster =
new TH1F(
"CPVCluster",
" NCluster in CPV",100,0,5000);
185 mXYCpvCluster =
new TH2F(
"CPV2D" ,
"CPV Cluster 2D", 400,-200.,200.,400,-200.,200.);
186 mXYPmdCluster =
new TH2F(
"PMD2D" ,
"PMD Cluster 2D", 400,-200.,200.,400,-200.,200.);
193 clusterIn = GetDataSet(
"PmdSimulator");
195 clusterIn = GetDataSet(
"pmdReader");
198 cout<<
" No Hit_dataset found, return "<<endl;
204 cout<<
" No PmdCollection found, return "<<endl;
218 cout<<
" Number of hits on CPV = "<<cpv_hits<<endl;
219 cout<<
" Number of hits on PMD = "<<pre_hits<<endl;
220 if((cpv_hits + pre_hits)>15000){
221 cout<<
" The number of hits on PMD are too large"<<endl;
222 cout<<
" The existing limit is 15000 hit on CPV+Pre"<<endl;
230 if(cpv_det && pmd_det){
235 Double_t adccutoff = (Double_t)(PMD_MIP*0.15);
237 clust1->SetAdcCutOff(adccutoff);
239 if(mOptCalibrate==kFALSE) {
240 clust1->SetAdcCutOff(7.0);
241 clust1->SetOptCalibrate(kFALSE);
244 if(mOptSimulate==kTRUE) {
245 cout<<
" Simulationflag is ON so the cutoff is set to 0.4"<<endl;
246 clust1->SetAdcCutOff(0.4);
247 clust1->SetOptSimulate(kTRUE);
249 if(mOptRefineCluster==kFALSE) {
250 cout<<
" Refined clustering is put off. (Default = ON)"<<endl;
251 clust1->SetOptRefineCluster(kFALSE);
257 cout<<
"ClusterMaker **, No StEvent Pointer "<<endl;
264 clust1->SetVertexPos(v);
269 for(Int_t d=0;d<2;d++)
280 cout<<
"clust1 not made"<<endl;
311 for(Int_t
id=1;
id<=12;
id++){
328 Int_t nclust_cpv = cpvclusters->
Nclusters();
334 for(Int_t i=0; i<nclust ; i++)
337 Float_t eta=spmcl1->CluEta();
338 Float_t phi=spmcl1->CluPhi();
339 Float_t edep=spmcl1->CluEdep();
340 Float_t sigmaL=spmcl1->CluSigmaL();
341 Float_t sigmaS=spmcl1->CluSigmaS();
342 Int_t mod=spmcl1->Module();
343 Float_t ncell=spmcl1->NumofMems();
344 Float_t xclu = spmcl1->CluX();
345 Float_t yclu = spmcl1->CluY();
360 TIter nextcpv(cpvclusters->
Clusters());
362 for(Int_t i=0; i<nclust_cpv ; i++)
365 Float_t eta=spmcl2->
CluEta();
366 Float_t phi=spmcl2->CluPhi();
367 Float_t edep=spmcl2->CluEdep();
368 Int_t mod=spmcl2->Module();
369 Float_t sigmaL=spmcl2->CluSigmaL();
370 Float_t sigmaS=spmcl2->CluSigmaS();
371 Float_t ncell1=spmcl2->NumofMems();
372 Float_t xclu = spmcl2->CluX();
373 Float_t yclu = spmcl2->CluY();
376 mSmCpvCluster->Fill(Float_t(mod));
398 cout<<
"Filling StEvent in ClusterMaker"<<endl;
403 cout<<
"ClusterMaker **, No StEvent Pointer "<<endl;
406 if(currevent)PmdCollection= currevent->phmdCollection();
409 StPhmdDetector* evtdet0 = PmdCollection->detector(StDetectorId(kPhmdId));
410 StPhmdDetector* evtdet1 = PmdCollection->detector(StDetectorId(kPhmdCpvId));
413 cluscollpmd->setClusterFinderId(1);
414 cluscollpmd->setClusterFinderParamVersion(1);
417 cluscollcpv->setClusterFinderId(1);
418 cluscollcpv->setClusterFinderParamVersion(1);
424 Int_t nclust_cpv = cpvclusters->
Nclusters();
429 evtdet0->setCluster(cluscollpmd);
435 for(Int_t i=0; i<nclust ; i++)
438 Float_t eta=spmcl1->CluEta();
439 Float_t phi=spmcl1->CluPhi();
440 Float_t edep=spmcl1->CluEdep();
441 Float_t sigmaL=spmcl1->CluSigmaL();
442 Float_t sigmaS=spmcl1->CluSigmaS();
443 Int_t tempL=Int_t(sigmaL*1000);
444 Int_t tempS=Int_t(sigmaS*1000);
445 Int_t SigInt=tempL*10000+tempS;
446 if(edep>2.5)clustmip1++;
447 if(edep>5.)clustmip2++;
448 if(edep>7.5)clustmip3++;
450 Int_t mod=spmcl1->Module();
451 Float_t ncell=spmcl1->NumofMems();
457 pcls->setModule(mod-1);
458 pcls->setNumberOfCells(Int_t(ncell));
463 pcls->setEnergy(edep);
464 pcls->setSigma((Float_t)SigInt);
467 cluscollpmd->addCluster(pcls);
470 mNclust->Fill(nclust);
480 evtdet1->setCluster(cluscollcpv);
481 TIter nextcpv(cpvclusters->
Clusters());
483 for(Int_t i=0; i<nclust_cpv ; i++)
486 Float_t eta=spmcl2->
CluEta();
487 Float_t phi=spmcl2->CluPhi();
488 Float_t edep=spmcl2->CluEdep();
489 Float_t sigmaL=spmcl2->CluSigmaL();
490 Float_t sigmaS=spmcl2->CluSigmaS();
491 Int_t tempL=Int_t(sigmaL*1000);
492 Int_t tempS=Int_t(sigmaS*1000);
493 Int_t SigInt=tempL*10000+tempS;
494 Int_t mod=spmcl2->Module();
495 Float_t ncell=spmcl2->NumofMems();
500 pcls->setModule(mod-1);
501 pcls->setNumberOfCells(Int_t(ncell));
506 pcls->setEnergy(edep);
507 pcls->setSigma(Float_t(SigInt));
508 cluscollcpv->addCluster(pcls);
512 cout<<
"Filled PMD StEvent in ClusterMaker"<<endl;
518 Bool_t StPmdClusterMaker::ReadCalibrationsConst()
520 if(Debug())cout<<
" I AM IN READCALIB "<<endl;
524 node->setVersion(
"SMChain");
527 TString DbName =
"Calibrations/pmd";
528 mDb=GetInputDB(DbName.Data());
530 if(!mDb)
return kFALSE;
533 for(Int_t ism=0;ism<24;ism++){
534 for(Int_t chain=0;chain<48;chain++){
535 SM_chain_factor[ism][chain]=0.;
539 St_pmdSMChain_GNF * tab = (St_pmdSMChain_GNF*) mDb->
Find(
"pmdSMChain_GNF");
541 cout<<
"No pmdSMChain_GNF DBTable. Stopping."<<endl;
548 pmdSMChain_GNF_st* smchain = tab->GetTable(64);
549 PMD_MIP = smchain->mpv_factor;
Int_t module_hit(Int_t)
module number
StPmdDetector * detector(Int_t)
destructor
Bool_t findPmdClusters2(StPmdDetector *)
for Pmd clusters
Int_t Nclusters() const
destructor
void FillHistograms(StPmdDetector *, StPmdDetector *)
booking histograms
TH1F * mEtaCpvCluster
cluster edep in Cpv
unsigned int numberOfHits() const
for adding hits to detector
TH1F * mCpvCluster
nclust vs. frac. edep in CpvPicoEventWrite(Bool_t flag=kFALSE);
TObjArray * Clusters()
no. of clusters
TH1F * mNclust1
supermodule no for Pmd
TH1F * mSigmaLCpvCluster
cluster edep in Cpv
TH1F * mSmPmdCluster
supermodule no for Pmd
TH2F * mXYPmdCluster
number of Pmd clusters
TH2F * mPhi2ModPmd
eta vs. phi in Pmd
TH1F * mPhiPmdCluster
cluster eta in Pmd
virtual void Browse(TBrowser *b)
Browse this dataset (called by TBrowser).
TH1F * mEdepCpvCluster
supermodule no for Cpv
TH2F * mHitVscluster
phi vs.mod in Pmd
TH1F * mEdepPmdCluster
supermodule no for Pmd
TH1F * mNcellPmdCluster
cluster SigmaS in Pmd
TH1F * mNcellCpvCluster
cluster SigmaS in Cpv
TH1F * mSigmaSCpvCluster
cluster SigmaL in Cpv
TH1F * mNclust2
supermodule no for Pmd
TH1F * mEtaPmdCluster
cluster edep in Pmd
static StDbManager * Instance()
strdup(..) is not ANSI
TH1F * mNclust3
supermodule no for Pmd
TH1F * mSigmaLPmdCluster
cluster edep in Pmd
TH1F * mPmdCluster
nclust vs. frac. edep in Pmd
TH2F * mXYCpvCluster
number of Cpv clusters
Float_t CluEta() const
number of cells in the cluster as float
TH1F * mSigmaSPmdCluster
cluster SigmaL in Pmd
TH1F * mPhiCpvCluster
cluster eta in Cpv
void FillStEvent(StPmdDetector *, StPmdDetector *)
virtual TDataSet * Find(const char *path) const