211 #include "StSsdPointMaker.h"
216 #include "TDataSetIter.h"
217 #include "StMessMgr.h"
219 #include "StSsdUtil/StSsdPoint.hh"
220 #include "StSsdUtil/StSsdPackage.hh"
221 #include "StSsdUtil/StSsdCluster.hh"
222 #include "StSsdUtil/StSsdStripList.hh"
223 #include "StSsdUtil/StSsdClusterList.hh"
224 #include "StSsdUtil/StSsdPointList.hh"
225 #include "StSsdUtil/StSsdPackageList.hh"
226 #include "StSsdUtil/StSsdWafer.hh"
227 #include "StSsdUtil/StSsdLadder.hh"
228 #include "StSsdUtil/StSsdBarrel.hh"
229 #include "StSsdUtil/StSsdStrip.hh"
230 #include "tables/St_spa_strip_Table.h"
231 #include "tables/St_ssdPedStrip_Table.h"
232 #include "tables/St_scf_cluster_Table.h"
233 #include "tables/St_scm_spt_Table.h"
234 #include "tables/St_slsCtrl_Table.h"
235 #include "tables/St_clusterControl_Table.h"
236 #include "tables/St_ssdDimensions_Table.h"
237 #include "tables/St_ssdConfiguration_Table.h"
238 #include "tables/St_ssdWafersPosition_Table.h"
239 #include "tables/St_ssdLaddersPosition_Table.h"
240 #include "tables/St_ssdSectorsPosition_Table.h"
241 #include "tables/St_ssdBarrelPosition_Table.h"
242 #include "tables/St_ssdStripCalib_Table.h"
243 #include "tables/St_ssdGainCalibWafer_Table.h"
244 #include "tables/St_ssdNoise_Table.h"
245 #include "tables/St_ssdWaferConfiguration_Table.h"
247 #include "StSsdHitCollection.h"
248 #include "StSsdDbMaker/StSsdDbMaker.h"
253 Int_t StSsdPointMaker::Init(){
254 LOG_INFO <<
"Init() : Defining the histograms" << endm;
255 noisDisP =
new TH1F(
"Noise_p",
"Noise Distribution",250,0,25);
256 snRatioP =
new TH1F(
"SN_p",
"Signal/Noise (p)",200,0,200);
257 stpClusP =
new TH1F(
"NumberOfStrips_p",
"Strips per Cluster",8,0,8);
258 totChrgP =
new TH1F(
"ChargeElectron_p",
"Total Cluster Charge",100,0,300000);
259 ClusNvsClusP =
new TH2S(
"ClusNvsClusP",
"Number of clusters on the n-side vs Number of clusters on the p-side",200,0,200,200,0,200);
262 noisDisN =
new TH1F(
"Noise_n",
"Noise Distribution",250,0,25);
263 snRatioN =
new TH1F(
"SN_n",
"Signal/Noise",200,0,200);
264 stpClusN =
new TH1F(
"NumberOfStrips_n",
"Strips per Cluster",8,0,8);
265 totChrgN =
new TH1F(
"ChargeElectron_n",
"Total Cluster Charge",100,0,300000);
266 ClustMapP =
new TH2S(
"ClustMapP",
"Number of clusters on the p-side per wafer and ladder",20,0,20,16,0,16);
269 ClustMapN =
new TH2S(
"ClustMapN",
"Number of clusters on the n-side per wafer and ladder",20,0,20,16,0,16);
272 MatchedClusterP =
new TH2F(
"MatchedClusterP",
"#frac{# clusters matched}{# clusters reconstructed} , wafers on p-side",20,1,21,16,1,17);
273 MatchedClusterP->SetXTitle(
"Ladder id");
274 MatchedClusterP->SetYTitle(
"Wafer id");
275 MatchedClusterN =
new TH2F(
"MatchedClusterN",
"#frac{# clusters matched}{# clusters reconstructed} , wafers on n-side",20,1,21,16,1,17);
276 MatchedClusterN->SetXTitle(
"Ladder id");
277 MatchedClusterN->SetYTitle(
"Wafer id");
279 matchisto =
new TH2S(
"matchingHisto",
"Matching Adc (1p-1n)",500,0,1000,500,0,1000);
280 matchisto->SetXTitle(
"PSide ADC count");
281 matchisto->SetYTitle(
"NSide ADC count");
282 matchisto->SetZTitle(
"(1p-1n) hits");
284 matchisto->SetTitleOffset(2,
"X");
285 matchisto->SetTitleOffset(2,
"Y");
288 matchisto->SetLabelSize(0.03,
"X");
289 matchisto->SetLabelSize(0.03,
"Y");
290 matchisto->SetLabelSize(0.03,
"Z");
292 matchisto->SetNdivisions(5,
"X");
293 matchisto->SetNdivisions(5,
"Y");
294 matchisto->SetNdivisions(10,
"Z");
296 orthoproj =
new TH1S(
"ProjectionOrtho",
"Perfect Matching Deviation",320,-80,80);
298 kind =
new TH1S(
"kind",
"Kind of hits",11,0,11);
299 kind->SetXTitle(
"kind");
300 kind->SetYTitle(
"entries");
301 kind->SetTitleOffset(2,
"X");
302 kind->SetTitleOffset(2,
"Y");
305 Char_t *Name =
new Char_t[20];
306 Title =
"Matching Adc (1p-1n) for ladder";
307 for(Int_t ii=0;ii<20;ii++) {
308 Title = Form(
"Matching Adc (1p-1n) for ladder = %i",ii+1);
309 sprintf(Name,
"%s%d",
"matchingHisto_",ii);
310 matchisto_[ii] =
new TH2S(Name,Title,500,0,1000, 500, 0, 1000);
315 if (Debug()>1) DeclareNtuple();
316 return StMaker::Init();
319 Int_t StSsdPointMaker::InitRun(Int_t runumber) {
324 mode= gStSsdDbMaker->GetMode();
325 LOG_INFO <<
"m_Mode = " << mode << endm;
329 LOG_INFO<<Form(
"UseCalibration =%d UseWaferTable = %d",UseCalibration,UseWaferConfig)<<endm;
330 St_slsCtrl* slsCtrlTable = (St_slsCtrl*) GetDataBase(
"Geometry/ssd/slsCtrl");
331 if(! slsCtrlTable){LOG_ERROR <<
"InitRun : No access to slsCtrl table" << endm;}
334 slsCtrl_st* control = (slsCtrl_st*) slsCtrlTable->GetTable();
335 mDynamicControl -> setnElectronInAMip(control->nElectronInAMip);
336 mDynamicControl -> setadcDynamic(control->adcDynamic);
337 mDynamicControl -> seta128Dynamic(control->a128Dynamic);
338 mDynamicControl -> setnbitEncoding(control->nbitEncoding);
339 mDynamicControl -> setnstripInACluster(control->nstripInACluster);
340 mDynamicControl -> setpairCreationEnergy(control->pairCreationEnergy);
341 mDynamicControl -> setparDiffP(control->parDiffP);
342 mDynamicControl -> setparDiffN(control->parDiffN);
343 mDynamicControl -> setparIndRightP(control->parIndRightP);
344 mDynamicControl -> setparIndRightN(control->parIndRightN);
345 mDynamicControl -> setparIndLeftP(control->parIndLeftP);
346 mDynamicControl -> setparIndLeftN(control->parIndLeftN);
347 mDynamicControl -> setdaqCutValue(control->daqCutValue);
348 mDynamicControl -> printParameters();
350 St_clusterControl* clusterCtrlTable = (St_clusterControl*) GetDataBase(
"Geometry/ssd/clusterControl");
351 if (!clusterCtrlTable) {LOG_ERROR <<
"InitRun : No access to clusterControl table" << endm;}
354 clusterControl_st *clusterCtrl = (clusterControl_st*) clusterCtrlTable->GetTable() ;
355 mClusterControl -> setHighCut(clusterCtrl->highCut);
356 mClusterControl -> setTestTolerance(clusterCtrl->testTolerance);
357 mClusterControl -> setClusterTreat(clusterCtrl->clusterTreat);
358 mClusterControl -> setAdcTolerance(clusterCtrl->adcTolerance);
359 mClusterControl -> setMatchMean(clusterCtrl->matchMean);
360 mClusterControl -> setMatchSigma(clusterCtrl->matchSigma);
361 mClusterControl -> printParameters();
363 year = (GetDate()/10000)-2000;
364 LOG_DEBUG <<Form(
"TimeStamp is %d Year is =%d\n",GetDate(),year)<<endm;
368 m_noise2 = (St_ssdStripCalib*) GetDataBase(
"Calibrations/ssd/ssdStripCalib");
369 if (!m_noise2) {LOG_ERROR <<
"InitRun : No access to ssdStripCalib - will use the default noise and pedestal values" << endm;}
371 LOG_INFO<<
"InitRun for simu : old Table (ssdStripCalib) is used"<<endm;
377 m_noise2 = (St_ssdStripCalib*) GetDataBase(
"Calibrations/ssd/ssdStripCalib");
378 if (!m_noise2) {LOG_ERROR <<
"InitRun : No access to ssdStripCalib - will use the default noise and pedestal values" << endm;}
380 LOG_INFO<<
"InitRun for real data : old Table(ssdStripCalib) is used"<<endm;
384 m_noise3 = (St_ssdNoise*)GetDataBase(
"Calibrations/ssd/ssdNoise");
385 if (!m_noise3) {LOG_ERROR <<
"InitRun : No access to ssdNoise - will use the default noise and pedestal values" << endm;}
387 LOG_INFO <<
"InitRun for real data : new Table(ssdNoise) is used" << endm;}
391 default : {printf(
"no real data nor simu");}
393 (UseCalibration==1)?FillCalibTable():FillDefaultCalibTable();
394 (UseWaferConfig==1)?FillWaferTable():FillDefaultWaferTable();
398 for(Int_t ii=0 ;ii<20;ii++)
400 for(Int_t jj=0;jj<16;jj++)
409 void StSsdPointMaker::DeclareNtuple(){
410 TFile *f = GetTFile();
413 string varlist2 =
"pulseP:pulseN:ladder:wafer:case:xg:yg:zg:flag:idClusP:idClusN:position_0:position_1:xl:yl";
414 mHitNtuple =
new TNtuple(
"PhysNTuple",
"Physics Ntuple",varlist2.c_str());
415 string varlist3 =
"side:ladder:wafer:nstrip:snratio:noise:first_strip:TotAdc:FirstAdc:LastAdc:TotNoise";
416 nHitNtuple =
new TNtuple(
"ClusTuple",
"All Clusters stored",varlist3.c_str());
417 string varlist4 =
"side:ladder:wafer:nstrip:pedestal:signal:noise:snratio";
418 qHitNtuple =
new TNtuple(
"Strips",
"All Strips stored",varlist4.c_str());
419 pHitNtuple =
new TNtuple(
"ClustupleIn",
"Clusters in hits",varlist3.c_str());
420 rHitNtuple =
new TNtuple(
"StripsIn",
"Strips in hits",varlist4.c_str());
426 LOG_DEBUG << Form(
"Make : begin")<< endm;
433 sprintf(myTime,
"000%d",GetTime());
435 if ((GetTime()<9999)&&(GetTime()>999))
436 sprintf(myTime,
"00%d",GetTime());
438 if ((GetTime()<99999)&&(GetTime()>9999))
439 sprintf(myTime,
"0%d",GetTime());
441 sprintf(myTime,
"%d",GetTime());
442 sprintf(myDate,
"%d%s",GetDate(),
".");
443 sprintf(myLabel,
"%s%s",myDate,myTime);
446 TDataSet *SpaStrip = GetDataSet(
"SpaStrip");
448 LOG_ERROR <<
"Make : no input data set, wrong chain option" << endm;
451 St_spa_strip *spa_strip =
dynamic_cast<St_spa_strip *
> (SpaStrip->
Find(
"spa_strip"));
452 St_ssdPedStrip *spa_ped_strip =
dynamic_cast<St_ssdPedStrip *
> (SpaStrip->
Find(
"ssdPedStrip"));
454 if (!spa_strip || spa_strip->GetNRows()==0){
456 LOG_WARN <<
"Make : no input (fired strip for the SSD)"<<endm;
457 LOG_WARN <<
"Make : looking for a pedestal/noise tables"<<endm;
459 if (!spa_ped_strip || spa_ped_strip->GetNRows()==0) {
460 LOG_WARN<<
"Make : no pedestal/noise data..."<<endm;
464 { LOG_WARN<<
"Make : pedestal/noise data found : "<<spa_ped_strip->GetNRows()<<endm;}
467 St_scm_spt *scm_spt =
new St_scm_spt(
"scm_spt",5000);
470 St_scf_cluster *scf_cluster =
new St_scf_cluster(
"scf_cluster",5000);
473 mCurrentEvent = (
StEvent*) GetInputDS(
"StEvent");
476 mSsdHitColl = mCurrentEvent->ssdHitCollection();
478 LOG_WARN <<
"Make : The SSD hit collection does not exist - creating a new one" << endm;
480 mCurrentEvent->setSsdHitCollection(mSsdHitColl);
486 LOG_INFO<<
"#################################################"<<endm;
487 LOG_INFO<<
"#### START OF NEW SSD POINT MAKER ####"<<endm;
488 LOG_INFO<<
"#### SSD BARREL INITIALIZATION ####"<<endm;
489 LOG_INFO<<
"#### BEGIN INITIALIZATION ####"<<endm;
491 mySsd->setClusterControl(mClusterControl);
493 if((! spa_ped_strip || spa_ped_strip->GetNRows()==0) && (spa_strip->GetNRows()!=0))
495 Int_t stripTableSize = mySsd->readStripFromTable(spa_strip);
496 LOG_INFO<<
"#### NUMBER OF SPA STRIPS "<<stripTableSize<<
" ####"<<endm;
497 mySsd->sortListStrip();
498 PrintStripSummary(mySsd);
500 noiseTableSize = ReadNoiseTable(mySsd,year);
501 LOG_INFO<<
"#### NUMBER OF DB ENTRIES "<<noiseTableSize<<
" ####"<<endm;
502 Int_t nClusterPerSide[2];
503 nClusterPerSide[0] = 0;
504 nClusterPerSide[1] = 0;
505 mySsd->doSideClusterisation(nClusterPerSide,WafStatus);
506 LOG_INFO<<
"#### NUMBER OF CLUSTER P SIDE "<<nClusterPerSide[0]<<
" ####"<<endm;
507 LOG_INFO<<
"#### NUMBER OF CLUSTER N SIDE "<<nClusterPerSide[1]<<
" ####"<<endm;
508 mySsd->sortListCluster();
509 Int_t nClusterWritten = mySsd->writeClusterToTable(scf_cluster,spa_strip);
510 LOG_INFO<<
"#### -> "<<nClusterWritten<<
" CLUSTERS WRITTEN INTO TABLE ####"<<endm;
511 PrintClusterSummary(mySsd);
514 makeScfCtrlHistograms(mySsd);
516 Int_t nPackage = mySsd->doClusterMatching(CalibArray);
517 LOG_INFO<<
"#### -> "<<nPackage<<
" PACKAGES IN THE SSD ####"<<endm;
518 mySsd->convertDigitToAnalog(mDynamicControl);
519 mySsd->convertUFrameToOther();
520 PrintPointSummary(mySsd);
523 for(Int_t i=1;i<=20;i++)
525 for(Int_t j=1;j<=16;j++)
535 Int_t nSptWritten = 0;
537 mcEvent = (
StMcEvent*) GetDataSet(
"StMcEvent");
540 LOG_DEBUG <<
" mcEvent exists " << endm;
541 nSptWritten = mySsd->writePointToContainer(scm_spt,mSsdHitColl,scf_cluster,spa_strip,mDynamicControl,mcEvent);
544 nSptWritten = mySsd->writePointToContainer(scm_spt,mSsdHitColl,scf_cluster);
546 LOG_INFO<<
"#### -> "<<nSptWritten<<
" HITS WRITTEN INTO TABLE ####"<<endm;
548 if (mSsdHitColl->numberOfHits()>0) {
550 LOG_INFO<<
"#### -> "<<mSsdHitColl->numberOfHits()<<
" HITS WRITTEN INTO CONTAINER ####"<<endm;
551 makeScmCtrlHistograms(mySsd);
552 EvaluateEfficiency(mySsd);
553 NormalizeEfficiency();
557 LOG_INFO<<
" ######### NO SSD HITS WRITTEN INTO CONTAINER ####"<<endm;
560 LOG_INFO<<
"#### END OF SSD NEW POINT MAKER ####"<<endm;
561 LOG_INFO<<
"#################################################"<<endm;
563 if (qHitNtuple) WriteStripTuple(mySsd);
564 if (nHitNtuple) WriteScfTuple(mySsd);
565 if (mHitNtuple) WriteScmTuple(mySsd);
566 if (rHitNtuple) WriteMatchedStrips(mySsd);
567 if (pHitNtuple) WriteMatchedClusters(mySsd);
569 if (nSptWritten) res =
kStOK;
573 if((spa_strip->GetNRows()==0)&&(spa_ped_strip && spa_ped_strip->GetNRows()!=0))
575 LOG_INFO <<
"###### WRITING SSD PEDESTAL HISTOGRAMS##########"<<endm;
577 mySsd->writeNoiseToFile(spa_ped_strip,myLabel);}
578 else{mySsd->writeNewNoiseToFile3(spa_ped_strip,myLabel);
586 LOG_WARN <<
"Make : no output" << endm;;
592 void StSsdPointMaker::makeScfCtrlHistograms(
StSsdBarrel *mySsd)
595 Float_t convAdcToE = (mDynamicControl->getadcDynamic()*mDynamicControl->getnElectronInAMip())/(pow(2.0,mDynamicControl->getnbitEncoding()));
596 Int_t ClustersP_tot = 0;
597 Int_t ClustersN_tot = 0;
600 for (Int_t i=0;i<20;i++)
601 if (mySsd->isActiveLadder(i)>0) {
602 for (Int_t j=0; j<mySsd->mLadders[i]->getWaferPerLadder();j++) {
604 pSize = pList->getSize();
605 ClustersP_tot+= pSize;
607 nSize = nList->getSize();
608 ClustersN_tot+= nSize;
617 stpClusP->Fill(pClusterP->getClusterSize());
618 totChrgP->Fill(convAdcToE*pClusterP->getTotAdc());
619 if (pClusterP->getClusterSize()>0)
620 noisDisP->Fill(pClusterP->getTotNoise()/pClusterP->getClusterSize());
621 if (pClusterP->getTotNoise()>0)
622 snRatioP->Fill((pClusterP->getTotAdc()*pClusterP->getClusterSize())/pClusterP->getTotNoise());
623 pClusterP = mySsd->mLadders[i]->mWafers[j]->
getClusterP()->next(pClusterP);
628 stpClusN->Fill(pClusterN->getClusterSize());
629 totChrgN->Fill(convAdcToE*pClusterN->getTotAdc());
630 noisDisN->Fill(pClusterN->getTotNoise()/(3e-33+pClusterN->getClusterSize()));
631 snRatioN->Fill((pClusterN->getTotAdc()*pClusterN->getClusterSize())/(3e-33+pClusterN->getTotNoise()));
632 pClusterN = mySsd->mLadders[i]->mWafers[j]->
getClusterN()->next(pClusterN);
636 LOG_DEBUG <<
"totclusters P="<<ClustersP_tot<<
" totclusters N="<<ClustersN_tot<<endm;
640 void StSsdPointMaker::makeScmCtrlHistograms(
StSsdBarrel *mySsd)
643 Int_t conversion[11]={11,12,21,13,31,221,222,223,23,32,33};
644 Float_t convMeVToAdc = (int)pow(2.0,mDynamicControl->getnbitEncoding())/(mDynamicControl->getpairCreationEnergy()*mDynamicControl->getadcDynamic()*mDynamicControl->getnElectronInAMip());
645 for (Int_t i=0;i<20;i++)
646 if (mySsd->isActiveLadder(i)>0) {
647 for (Int_t j=0; j<mySsd->mLadders[i]->getWaferPerLadder();j++) {
648 if (mySsd->mLadders[i]->mWafers[j]->
getPoint()->getSize()==0) {
654 if (pSpt->getNMatched() == 11)
656 Float_t a = 0, b = 0;
657 a = convMeVToAdc*(pSpt->getDe(0)+pSpt->getDe(1));
658 b = convMeVToAdc*(pSpt->getDe(0)-pSpt->getDe(1));
659 matchisto->Fill(a,b);
664 for(Int_t k=0;k<11;k++)
666 if(pSpt->getNMatched()==conversion[k])
671 pSpt = mySsd->mLadders[i]->mWafers[j]->
getPoint()->next(pSpt);
679 void StSsdPointMaker::PrintStripSummary(
StSsdBarrel *mySsd)
681 Int_t ladderCountN[20]={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0} ;
682 Int_t ladderCountP[20]={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0} ;
683 for (Int_t i=0;i<20;i++)
684 if (mySsd->isActiveLadder(i)>0) {
685 for (Int_t j=0; j<mySsd->mLadders[i]->getWaferPerLadder();j++) {
686 ladderCountP[i]=ladderCountP[i]+mySsd->mLadders[i]->mWafers[j]->
getStripP()->getSize();
687 ladderCountN[i]=ladderCountN[i]+mySsd->mLadders[i]->mWafers[j]->
getStripN()->getSize();
691 LOG_INFO <<
"PrintStripSummary : Number of raw data in the SSD" << endm;
692 LOG_INFO <<
"PrintStripSummary : Active Ladders : ";
693 for (Int_t i=0;i<20;i++)
694 if (mySsd->isActiveLadder(i)>0) {
700 LOG_INFO <<
"PrintStripSummary : Counts (p-side): ";
701 for (Int_t i=0;i<20;i++)
702 if (mySsd->isActiveLadder(i)>0) {
704 LOG_DEBUG <<ladderCountP[i];
707 LOG_INFO <<
"PrintStripSummary : Counts (n-side): ";
708 for (Int_t i=0;i<20;i++)
709 if (mySsd->isActiveLadder(i)>0) {
711 LOG_DEBUG <<ladderCountN[i];
717 void StSsdPointMaker::debugUnPeu(
StSsdBarrel *mySsd)
719 Int_t monladder,monwafer;
722 mySsd->debugUnPeu(monladder,monwafer);
726 void StSsdPointMaker::PrintClusterSummary(
StSsdBarrel *mySsd)
728 Int_t ladderCountN[20]={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0} ;
729 Int_t ladderCountP[20]={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0} ;
730 for (Int_t i=0;i<20;i++)
731 if (mySsd->isActiveLadder(i)>0) {
732 for (Int_t j=0; j<mySsd->mLadders[i]->getWaferPerLadder();j++) {
733 ladderCountP[i]=ladderCountP[i]+mySsd->mLadders[i]->mWafers[j]->
getClusterP()->getSize();
734 ladderCountN[i]=ladderCountN[i]+mySsd->mLadders[i]->mWafers[j]->
getClusterN()->getSize();
738 LOG_INFO <<
"PrintClusterSummary : Number of clusters in the SSD" << endm;
739 LOG_INFO <<
"PrintClusterSummary : Active Ladders : ";
740 for (Int_t i=0;i<20;i++)
741 if (mySsd->isActiveLadder(i)>0) {
747 LOG_INFO <<
"PrintClusterSummary : Counts (p-side): ";
748 for (Int_t i=0;i<20;i++)
749 if (mySsd->isActiveLadder(i)>0) {
751 LOG_DEBUG <<ladderCountP[i];
754 LOG_INFO <<
"PrintClusterSummary : Counts (n-side): ";
755 for (Int_t i=0;i<20;i++)
756 if (mySsd->isActiveLadder(i)>0) {
758 LOG_DEBUG <<ladderCountN[i];
763 void StSsdPointMaker::PrintPointSummary(
StSsdBarrel *mySsd)
765 Int_t ladderCount[20]={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0} ;
766 Int_t ladderCount11[20]={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0} ;
767 for (Int_t i=0;i<20;i++)
768 if (mySsd->isActiveLadder(i)>0) {
769 for (Int_t j=0; j<mySsd->mLadders[i]->getWaferPerLadder();j++) {
770 ladderCount[i]=ladderCount[i]+mySsd->mLadders[i]->mWafers[j]->
getPoint()->getSize();
773 if (pSpt->getNMatched()==11) ladderCount11[i]++;
774 pSpt = mySsd->mLadders[i]->mWafers[j]->
getPoint()->next(pSpt);
779 LOG_INFO<<
"PrintPointSummary : Number of hits in the SSD" << endm;
780 LOG_INFO<<
"PrintPointSummary : Active Ladders : ";
781 for (Int_t i=0;i<20;i++)
782 if (mySsd->isActiveLadder(i)>0) {
788 LOG_INFO <<
"PrintPointSummary : Counts : ";
789 for (Int_t i=0;i<20;i++)
790 if (mySsd->isActiveLadder(i)>0) {
792 LOG_DEBUG <<ladderCount[i];
795 LOG_INFO <<
"PrintPointSummary : Counts (11) : ";
796 for (Int_t i=0;i<20;i++)
797 if (mySsd->isActiveLadder(i)>0) {
799 LOG_DEBUG <<ladderCount11[i];
804 void StSsdPointMaker::WriteStripTuple(
StSsdBarrel *mySsd)
807 for (Int_t i=0;i<20;i++)
808 if (mySsd->isActiveLadder(i)>0) {
809 for (Int_t j=0; j<mySsd->mLadders[i]->getWaferPerLadder();j++) {
813 Strips_hits[1] = i+1;
814 Strips_hits[2] = j+1;
815 Strips_hits[3] = pStripP->getNStrip();
816 Strips_hits[4] = pStripP->getPedestal();
817 Strips_hits[5] = pStripP->getDigitSig();
818 Strips_hits[6] = pStripP->getSigma();
819 Strips_hits[7] = (float)(pStripP->getDigitSig()/pStripP->getSigma());
820 qHitNtuple->Fill(Strips_hits);
821 pStripP = mySsd->mLadders[i]->mWafers[j]->
getStripP()->next(pStripP);
826 Strips_hits[1] = i+1;
827 Strips_hits[2] = j+1;
828 Strips_hits[3] = pStripN->getNStrip();
829 Strips_hits[4] = pStripN->getPedestal();
830 Strips_hits[5] = pStripN->getDigitSig();
831 Strips_hits[6] = pStripN->getSigma();
832 Strips_hits[7] = (float)(pStripN->getDigitSig()/pStripN->getSigma());
833 qHitNtuple->Fill(Strips_hits);
834 pStripN = mySsd->mLadders[i]->mWafers[j]->
getStripN()->next(pStripN);
841 void StSsdPointMaker::WriteScfTuple(
StSsdBarrel *mySsd)
844 for (Int_t i=0;i<20;i++)
845 if (mySsd->isActiveLadder(i)>0) {
846 for (Int_t j=0; j<mySsd->mLadders[i]->getWaferPerLadder();j++) {
850 ClusterNtuple[0] = 0;
851 ClusterNtuple[1] = i+1;
852 ClusterNtuple[2] = j+1;
853 ClusterNtuple[3] = pClusterP->getClusterSize();
854 ClusterNtuple[4] = ((pClusterP->getTotAdc()*pClusterP->getClusterSize())/pClusterP->getTotNoise());
855 ClusterNtuple[5] = pClusterP->getTotNoise()/pClusterP->getClusterSize();
856 ClusterNtuple[6] = pClusterP->getFirstStrip();
857 ClusterNtuple[7] = pClusterP->getTotAdc();
858 ClusterNtuple[8] = pClusterP->getFirstAdc();
859 ClusterNtuple[9] = pClusterP->getLastAdc();
860 ClusterNtuple[10]= pClusterP->getTotNoise();
861 pClusterP = mySsd->mLadders[i]->mWafers[j]->
getClusterP()->next(pClusterP);
862 nHitNtuple->Fill(ClusterNtuple);
867 ClusterNtuple[0] = 1;
868 ClusterNtuple[1] = i+1;
869 ClusterNtuple[2] = j+1;
870 ClusterNtuple[3] = pClusterN->getClusterSize();
871 ClusterNtuple[4] = ((pClusterN->getTotAdc()*pClusterN->getClusterSize())/pClusterN->getTotNoise());
872 ClusterNtuple[5] = pClusterN->getTotNoise()/pClusterN->getClusterSize();
873 ClusterNtuple[6] = pClusterN->getFirstStrip();
874 ClusterNtuple[7] = pClusterN->getTotAdc();
875 ClusterNtuple[8] = pClusterN->getFirstAdc();
876 ClusterNtuple[9] = pClusterN->getLastAdc();
877 ClusterNtuple[10]= pClusterN->getTotNoise();
878 pClusterN = mySsd->mLadders[i]->mWafers[j]->
getClusterN()->next(pClusterN);
879 nHitNtuple->Fill(ClusterNtuple);
885 void StSsdPointMaker::WriteScmTuple(
StSsdBarrel *mySsd)
888 Int_t conversion[11]={11,12,21,13,31,221,222,223,23,32,33};
889 Float_t convMeVToAdc = (int)pow(2.0,mDynamicControl->getnbitEncoding())/(mDynamicControl->getpairCreationEnergy()*mDynamicControl->getadcDynamic()*mDynamicControl->getnElectronInAMip());
890 for (Int_t i=0;i<20;i++)
891 if (mySsd->isActiveLadder(i)>0) {
892 for (Int_t j=0; j<mySsd->mLadders[i]->getWaferPerLadder();j++) {
893 if (mySsd->mLadders[i]->mWafers[j]->
getPoint()->getSize()==0) {
898 Float_t a = 0, b = 0;
899 a = convMeVToAdc*(pSpt->getDe(0)+pSpt->getDe(1));
900 b = convMeVToAdc*(pSpt->getDe(0)-pSpt->getDe(1));
905 for(Int_t k=0;k<11;k++)
907 if(pSpt->getNMatched()==conversion[k])
912 hitNtuple[5] = pSpt->getXg(0);
913 hitNtuple[6] = pSpt->getXg(1);
914 hitNtuple[7] = pSpt->getXg(2);
915 hitNtuple[8] = pSpt->getFlag();
917 Int_t IdP = pSpt->getIdClusterP();
918 Int_t IdN = pSpt->getIdClusterN();
924 if(cluster_P_j->getNCluster()==IdP)
926 cluster_P_j = currentListP_j->next(cluster_P_j);
933 if(cluster_N_j->getNCluster()==IdN)
935 cluster_N_j = currentListN_j->next(cluster_N_j);
938 hitNtuple[9] = cluster_P_j->getStripMean();
939 hitNtuple[10]= cluster_N_j->getStripMean();
940 hitNtuple[11] = pSpt->getPositionU(0);
941 hitNtuple[12] = pSpt->getPositionU(1);
942 hitNtuple[13] = pSpt->getXl(0);
943 hitNtuple[14] = pSpt->getXl(1);
944 mHitNtuple->Fill(hitNtuple);
945 pSpt = mySsd->mLadders[i]->mWafers[j]->
getPoint()->next(pSpt);
952 void StSsdPointMaker::PrintStripDetails(
StSsdBarrel *mySsd, Int_t mywafer)
956 LOG_DEBUG <<
"PrintStripDetails() - Wafer "<<mywafer<< endm;
957 for (Int_t i=0;i<20;i++)
958 if (mySsd->isActiveLadder(i)>0) {
959 for (Int_t j=0; j<mySsd->mLadders[i]->getWaferPerLadder();j++) {
960 if (mySsd->mLadders[i]->mWafers[j]->getIdWafer()==mywafer) {
963 if (mySsd->mLadders[i]->mWafers[j]->
getStripP()->getSize()==0) {
964 LOG_DEBUG <<
"PrintStripDetails() - No strip on the P-side of this wafer "<< endm;
967 LOG_DEBUG<<
"PrintStripDetails() - "
968 <<mySsd->mLadders[i]->mWafers[j]->
getStripP()->getSize()<<
" strip(s) on the P-side of this wafer "<< endm;
969 LOG_DEBUG<<
"PrintStripDetails() - Strip/Adc/Ped/Noise/Analog"<< endm;
972 LOG_DEBUG<<
"PrintStripDetails() - "
973 <<pStripP->getNStrip()<<
" "
974 <<pStripP->getDigitSig()<<
" "
975 <<pStripP->getPedestal()<<
" "
976 <<pStripP->getSigma()<<
" "
977 <<pStripP->getAnalogSig()<<
" "
979 for(Int_t e=0;e<5;e++){printf(
"e=%d idMcHit=%d idMcTrack=%d\n",e,pStripP->getIdMcHit(e),pStripP->getIdMcTrack(e));}
980 pStripP = mySsd->mLadders[i]->mWafers[j]->
getStripP()->next(pStripP);
984 if (mySsd->mLadders[i]->mWafers[j]->
getStripN()->getSize()==0) {
985 LOG_DEBUG <<
"PrintStripDetails() - No strip on the N-side of this wafer "<< endm;
988 LOG_DEBUG<<
"PrintStripDetails() - "
989 <<mySsd->mLadders[i]->mWafers[j]->
getStripN()->getSize()<<
" strip(s) on the N-side of this wafer "<< endm;
990 LOG_DEBUG <<
"StSsdPointMaker::PrintStripDetails() - Strip/Adc/Ped/Noise/Analog"<< endm;
993 LOG_DEBUG<<
"PrintStripDetails() - "
994 <<pStripN->getNStrip()<<
" "
995 <<pStripN->getDigitSig()<<
" "
996 <<pStripN->getPedestal()<<
" "
997 <<pStripN->getSigma()<<
" "
998 <<pStripN->getAnalogSig()<<
" "
1000 for(Int_t e=0;e<5;e++){printf(
"e=%d idMcHit=%d idMcTrack=%d\n",e,pStripN->getIdMcHit(e),pStripN->getIdMcTrack(e));}
1001 pStripN = mySsd->mLadders[i]->mWafers[j]->
getStripN()->next(pStripN);
1007 if (found==0) {LOG_DEBUG <<
"PrintStripDetails() - Wafer not found !!!"<<endm;}
1010 void StSsdPointMaker::PrintClusterDetails(
StSsdBarrel *mySsd, Int_t mywafer)
1014 LOG_INFO <<
"PrintClusterDetails() - Wafer "<<mywafer<< endm;
1015 for (Int_t i=0;i<20;i++)
1016 if (mySsd->isActiveLadder(i)>0) {
1017 for (Int_t j=0; j<mySsd->mLadders[i]->getWaferPerLadder();j++) {
1018 if (mySsd->mLadders[i]->mWafers[j]->getIdWafer()==mywafer) {
1021 if (mySsd->mLadders[i]->mWafers[j]->
getClusterP()->getSize()==0) {
1022 LOG_INFO <<
"PrintClusterDetails() - No cluster on the P-side of this wafer "<< endm;
1025 LOG_INFO<<
"PrintClusterDetails() - "
1026 <<mySsd->mLadders[i]->mWafers[j]->
getClusterP()->getSize()<<
" cluster(s) on the P-side of this wafer "<< endm;
1027 LOG_INFO<<
"PrintClusterDetails() - Cluster/Flag/Size/1st Strip/Strip Mean/TotAdc/1st Adc/Last Adc/TotNoise"<< endm;
1030 LOG_INFO<<
"PrintClusterDetails() - "
1031 <<pClusterP->getNCluster()<<
" "
1032 <<pClusterP->getFlag()<<
" "
1033 <<pClusterP->getClusterSize()<<
" "
1034 <<pClusterP->getFirstStrip()<<
" "
1035 <<pClusterP->getStripMean()<<
" "
1036 <<pClusterP->getTotAdc()<<
" "
1037 <<pClusterP->getFirstAdc()<<
" "
1038 <<pClusterP->getLastAdc()<<
" "
1039 <<pClusterP->getTotNoise()<<
" "
1041 for(Int_t e=0;e<5;e++){printf(
"e=%d idMcHit=%d \n",e,pClusterP->getIdMcHit(e));}
1042 pClusterP = mySsd->mLadders[i]->mWafers[j]->
getClusterP()->next(pClusterP);
1046 if (mySsd->mLadders[i]->mWafers[j]->
getClusterN()->getSize()==0) {
1047 LOG_INFO <<
"PrintClusterDetails() - No cluster on the N-side of this wafer "<< endm;
1050 LOG_INFO<<
"PrintClusterDetails() - "
1051 <<mySsd->mLadders[i]->mWafers[j]->
getClusterN()->getSize()<<
" cluster(s) on the N-side of this wafer "<< endm;
1052 LOG_INFO<<
"PrintClusterDetails() - Cluster/Flag/Size/1st Strip/Strip Mean/TotAdc/1st Adc/Last Adc/TotNoise"<< endm;
1055 LOG_INFO<<
"PrintClusterDetails() - "
1056 <<pClusterN->getNCluster()<<
" "
1057 <<pClusterN->getFlag()<<
" "
1058 <<pClusterN->getClusterSize()<<
" "
1059 <<pClusterN->getFirstStrip()<<
" "
1060 <<pClusterN->getStripMean()<<
" "
1061 <<pClusterN->getTotAdc()<<
" "
1062 <<pClusterN->getFirstAdc()<<
" "
1063 <<pClusterN->getLastAdc()<<
" "
1064 <<pClusterN->getTotNoise()<<
" "
1066 for(Int_t e=0;e<5;e++){printf(
"e=%d idMcHit=%d \n",e,pClusterN->getIdMcHit(e));}
1067 pClusterN = mySsd->mLadders[i]->mWafers[j]->
getClusterN()->next(pClusterN);
1073 if (found==0){ LOG_INFO <<
"PrintClusterDetails() - Wafer not found !!!"<<endm; }
1077 void StSsdPointMaker::PrintPackageDetails(
StSsdBarrel *mySsd, Int_t mywafer)
1082 LOG_INFO <<
"PrintPackageDetails() - Wafer "<<mywafer<< endm;
1083 for (Int_t i=0;i<20;i++)
1084 if (mySsd->isActiveLadder(i)>0) {
1085 for (Int_t j=0; j<mySsd->mLadders[i]->getWaferPerLadder();j++) {
1086 if (mySsd->mLadders[i]->mWafers[j]->getIdWafer()==mywafer) {
1088 if (mySsd->mLadders[i]->mWafers[j]->
getPackage()->getSize()==0) {
1089 LOG_INFO <<
"PrintPackageDetails() - No package in this wafer "<< endm;
1092 LOG_INFO <<
"PrintPackageDetails() - "<<mySsd->mLadders[i]->mWafers[j]->
getPackage()->getSize()<<
" package(s) in this wafer "<< endm;
1093 LOG_INFO <<
"PrintPackageDetails() - Package/Kind/Size"<< endm;
1096 LOG_INFO<<
"PrintPackageDetails() - "<<pPack->getNPackage()<<
" "
1097 <<pPack->getKind()<<
" "
1098 <<pPack->getSize()<<
" "<<endm;
1099 for (Int_t k=0;k<pPack->getSize();k++) {
1100 LOG_INFO<<
"PrintPackageDetails() - "<<k<<
" "<<pPack->getMatched(k)<<
" "<<pPack->getMatched(k)->getNCluster()<<endm;
1102 pPack = mySsd->mLadders[i]->mWafers[j]->
getPackage()->next(pPack);
1108 if (found==0){ LOG_INFO <<
"PrintPackageDetails() - Wafer not found !!!"<<endm;}
1112 void StSsdPointMaker::PrintPointDetails(
StSsdBarrel *mySsd, Int_t mywafer)
1117 Float_t convMeVToAdc = (int)pow(2.0,mDynamicControl->getnbitEncoding())/(mDynamicControl->getpairCreationEnergy()*mDynamicControl->getadcDynamic()*mDynamicControl->getnElectronInAMip());
1118 LOG_INFO <<
"PrintPointDetails() - Wafer "<<mywafer<< endm;
1119 for (Int_t i=0;i<20;i++)
1120 if (mySsd->isActiveLadder(i)>0) {
1121 for (Int_t j=0; j<mySsd->mLadders[i]->getWaferPerLadder();j++) {
1122 if (mySsd->mLadders[i]->mWafers[j]->getIdWafer()==mywafer) {
1124 if (mySsd->mLadders[i]->mWafers[j]->
getPoint()->getSize()==0) {
1125 LOG_INFO <<
"PrintPointDetails() - No hit in this wafer "<< endm;
1128 LOG_INFO<<
"PrintPointDetails() - "<<mySsd->mLadders[i]->mWafers[j]->
getPoint()->getSize()<<
" hit(s) in this wafer "<< endm;
1130 LOG_INFO<<
"PrintPointDetails() - Hit/Flag/NMatched/IdClusP/IdClusN/idMcHit[0]/idMcHit[1]/idMcHit[2]/idMcHit[3]/idMcHit[4]/Xg[0]/Xg[1]/Xg[2]/Xl[0]/Xl[1]/Xl[2]/a/b"<<endm;
1133 Float_t a = 0, b = 0;
1134 a = convMeVToAdc*(pSpt->getDe(0)+pSpt->getDe(1));
1135 b = convMeVToAdc*(pSpt->getDe(0)-pSpt->getDe(1));
1136 LOG_INFO<<
"PrintPointDetails() - "
1137 <<pSpt->getNPoint() <<
" "
1138 <<pSpt->getFlag() <<
" "
1139 <<pSpt->getNMatched() <<
" "
1140 <<pSpt->getIdClusterP()<<
" "
1141 <<pSpt->getIdClusterN()<<
" "
1142 <<pSpt->getNMchit(0) <<
" "
1143 <<pSpt->getNMchit(1) <<
" "
1144 <<pSpt->getNMchit(2) <<
" "
1145 <<pSpt->getNMchit(3) <<
" "
1146 <<pSpt->getNMchit(4) <<
" "
1147 <<pSpt->getXg(0) <<
" "
1148 <<pSpt->getXg(1) <<
" "
1149 <<pSpt->getXg(2) <<
" "
1150 <<pSpt->getXl(0) <<
" "
1151 <<pSpt->getXl(1) <<
" "
1152 <<pSpt->getXl(2) <<
" "
1156 printf(
"pulseP =%f pulseN = %f\n",a,b);
1157 pSpt = mySsd->mLadders[i]->mWafers[j]->
getPoint()->next(pSpt);
1163 if (found==0) {LOG_INFO <<
"PrintPointDetails() - Wafer not found !!!"<<endm; }
1167 void StSsdPointMaker::PrintInfo()
1169 if (Debug()) StMaker::PrintInfo();
1172 void StSsdPointMaker::Read_Strip(St_ssdStripCalib *strip_calib)
1174 ssdStripCalib_st *noise = strip_calib->GetTable();
1175 Int_t mSsdLayer = 7;
1176 LOG_INFO <<
"Read_Strip : printing few pedestal/noise values " << endm;
1186 for (Int_t i = 0 ; i < strip_calib->GetNRows(); i++)
1188 if (noise[i].
id>0 && noise[i].
id<=76818620) {
1189 nStrip = (int)(noise[i].
id/100000.);
1190 idWaf = noise[i].id-10000*((int)(noise[i].
id/10000.));
1191 iWaf = (int)((idWaf - mSsdLayer*1000)/100 - 1);
1192 iLad = (int)(idWaf - mSsdLayer*1000 - (iWaf+1)*100 - 1);
1193 iSide = (noise[i].id - nStrip*100000 - idWaf)/10000;
1194 if (iLad==11 && iWaf==8 && nStrip <10) {
1195 LOG_DEBUG<<
"ReadStrip: iLad,idWaf,nStrip,iSide,pedestal,rms = "<<iLad
1199 <<
" "<<(float)(noise[i].pedestals)
1200 <<
" "<<(float)(noise[i].rms)<<endm;
1205 if (noise[i].
id<0) iUnder++;
1207 if (noise[i].
id==0) iZero++;
1212 LOG_INFO<<
"ReadStrip: Number of rows in the table : "<<strip_calib->GetNRows()<<endm;
1213 LOG_INFO<<
"ReadStrip: Number of good id : "<<iGood<<endm;
1214 LOG_INFO<<
"ReadStrip: Number of id = 0 : "<<iZero<<endm;
1216 LOG_WARN <<
"ReadStrip: Number of underf : "<<iUnder<<endm;}
1218 LOG_WARN <<
"ReadStrip: Number of overf : "<<iOver<<endm;}
1222 void StSsdPointMaker::Read_Strip(St_ssdNoise *strip)
1224 ssdNoise_st *noise = strip->GetTable();
1225 LOG_INFO <<
" ReadStrip : printing few pedestal/noise values "<< endm;
1227 for (Int_t i = 0 ; i < strip->GetNRows(); i++)
1229 iLad = noise[i].id/16;
1230 Int_t idWaf = noise[i].id;
1233 for(Int_t nStrip=0;nStrip<10;nStrip++)
1235 LOG_DEBUG<<
"ReadStrip: iLad,idWaf,nStrip,rmsP,rmsN = "<<iLad+1
1238 <<
" "<<(int)(noise[i].rmsp[nStrip])
1239 <<
" "<<(int)(noise[i].rmsn[nStrip])<<endm;
1243 LOG_INFO<<
"ReadStrip: Number of rows in the table : "<<strip->GetNRows()<<endm;
1247 void StSsdPointMaker::WriteMatchedStrips(
StSsdBarrel *mySsd)
1250 for (Int_t i=0;i<20;i++)
1251 if (mySsd->isActiveLadder(i)>0) {
1252 for (Int_t j=0; j<mySsd->mLadders[i]->getWaferPerLadder();j++) {
1253 LOG_DEBUG <<
" in ladder= "<<i <<
" wafer = "<<j<<endm;
1255 if (mySsd->mLadders[i]->mWafers[j]->
getClusterP()->getSize()==0) {
1258 LOG_DEBUG <<
" Size of the cluster P list = " << mySsd->mLadders[i]->mWafers[j]->
getClusterP()->getSize()<<endm;
1262 Int_t IdP = pclusterP->getNCluster();
1264 if (mySsd->mLadders[i]->mWafers[j]->
getPoint()->getSize()==0) {
1265 if (pclusterP!=mySsd->mLadders[i]->mWafers[j]->
getClusterP()->last())
1266 pclusterP = mySsd->mLadders[i]->mWafers[j]->
getClusterP()->next(pclusterP);
1271 while ((pSpt)&&(stop==0)){
1272 if(IdP==pSpt->getIdClusterP())
1276 while ((pStripP->getNStrip()!=pStripLastP->getNStrip())&&(pStripP->getNStrip()!=pclusterP->getFirstStrip())){
1277 pStripP = mySsd->mLadders[i]->mWafers[j]->
getStripP()->next(pStripP);
1279 Int_t stripInCluster = pclusterP->getClusterSize();
1281 while(k<stripInCluster){
1282 LOG_DEBUG<<
"PrintStripDetails() - "
1284 <<pStripP->getNStrip()<<
" "
1285 <<pStripP->getDigitSig()<<
" "
1286 <<pStripP->getPedestal()<<
" "
1287 <<pStripP->getSigma()<<
" "
1292 StripsIn[3] = pStripP->getNStrip();
1293 StripsIn[4] = pStripP->getPedestal();
1294 StripsIn[5] = pStripP->getDigitSig();
1295 StripsIn[6] = pStripP->getSigma();
1296 StripsIn[7] = (float)(pStripP->getDigitSig()/pStripP->getSigma());
1297 rHitNtuple->Fill(StripsIn);
1300 pStripP = mySsd->mLadders[i]->mWafers[j]->
getStripP()->next(pStripP);
1303 pSpt = mySsd->mLadders[i]->mWafers[j]->
getPoint()->next(pSpt);
1306 pclusterP = mySsd->mLadders[i]->mWafers[j]->
getClusterP()->next(pclusterP);
1309 if (mySsd->mLadders[i]->mWafers[j]->
getClusterP()->getSize()==0) {
1312 LOG_DEBUG <<
" Size of the cluster N list = " << mySsd->mLadders[i]->mWafers[j]->
getClusterN()->getSize()<<endm;
1316 Int_t IdN = pclusterN->getNCluster();
1317 if (mySsd->mLadders[i]->mWafers[j]->
getPoint()->getSize()==0) {
1318 if (pclusterN!=mySsd->mLadders[i]->mWafers[j]->
getClusterN()->last())
1319 pclusterN = mySsd->mLadders[i]->mWafers[j]->
getClusterN()->next(pclusterN);
1324 while ((pSpt)&&(stop==0)){
1325 if(IdN==pSpt->getIdClusterN())
1329 while ((pStripN->getNStrip()!=pStripLastN->getNStrip())&&(pStripN->getNStrip()!=pclusterN->getFirstStrip())){
1330 pStripN = mySsd->mLadders[i]->mWafers[j]->
getStripN()->next(pStripN);
1332 Int_t stripInClusterN = pclusterN->getClusterSize();
1334 while(kk<stripInClusterN){
1335 LOG_DEBUG<<
"PrintStripDetails() - "
1337 <<pStripN->getNStrip()<<
" "
1338 <<pStripN->getDigitSig()<<
" "
1339 <<pStripN->getPedestal()<<
" "
1340 <<pStripN->getSigma()<<
" "
1345 StripsIn[3] = pStripN->getNStrip();
1346 StripsIn[4] = pStripN->getPedestal();
1347 StripsIn[5] = pStripN->getDigitSig();
1348 StripsIn[6] = pStripN->getSigma();
1349 StripsIn[7] = (float)(pStripN->getDigitSig()/pStripN->getSigma());
1350 rHitNtuple->Fill(StripsIn);
1353 pStripN = mySsd->mLadders[i]->mWafers[j]->
getStripN()->next(pStripN);
1356 pSpt = mySsd->mLadders[i]->mWafers[j]->
getPoint()->next(pSpt);
1359 pclusterN = mySsd->mLadders[i]->mWafers[j]->
getClusterN()->next(pclusterN);
1366 void StSsdPointMaker::WriteMatchedClusters(
StSsdBarrel *mySsd)
1371 for (Int_t i=0;i<20;i++)
1372 if (mySsd->isActiveLadder(i)>0) {
1373 for (Int_t j=0; j<mySsd->mLadders[i]->getWaferPerLadder();j++) {
1374 LOG_DEBUG <<
" in ladder= "<<i <<
" wafer = "<<j<<endm;
1375 if (mySsd->mLadders[i]->mWafers[j]->
getClusterP()->getSize()==0) {
1378 LOG_DEBUG <<
" Size of the cluster P list = " << mySsd->mLadders[i]->mWafers[j]->
getClusterP()->getSize()<<endm;
1382 LOG_DEBUG <<
" clusterId= " << pclusterP->getNCluster()<< endm;
1383 Int_t IdP = pclusterP->getNCluster();
1384 LOG_DEBUG <<
" we are looking for clusterId= " << pclusterP->getNCluster()<< endm;
1385 if (mySsd->mLadders[i]->mWafers[j]->
getPoint()->getSize()==0) {
1386 pclusterP = mySsd->mLadders[i]->mWafers[j]->
getClusterP()->next(pclusterP);
1391 if(IdP==pSpt->getIdClusterP())
1394 LOG_DEBUG <<
"ok found the corresponding hit to this cluster id = "<<pSpt->getIdClusterP()<<endm;
1396 ClustupleIn[1] = i+1;
1397 ClustupleIn[2] = j+1;
1398 ClustupleIn[3] = pclusterP->getClusterSize();
1399 ClustupleIn[4] = ((pclusterP->getTotAdc()*pclusterP->getClusterSize())/pclusterP->getTotNoise());
1400 ClustupleIn[5] = pclusterP->getTotNoise()/pclusterP->getClusterSize();
1401 ClustupleIn[6] = pclusterP->getFirstStrip();
1402 ClustupleIn[7] = pclusterP->getTotAdc();
1403 ClustupleIn[8] = pclusterP->getFirstAdc();
1404 ClustupleIn[9] = pclusterP->getLastAdc();
1405 ClustupleIn[10]= pclusterP->getTotNoise();
1406 pHitNtuple->Fill(ClustupleIn);
1409 pSpt = mySsd->mLadders[i]->mWafers[j]->
getPoint()->next(pSpt);
1411 pclusterP = mySsd->mLadders[i]->mWafers[j]->
getClusterP()->next(pclusterP);
1416 if (mySsd->mLadders[i]->mWafers[j]->
getClusterN()->getSize()==0) {
1419 LOG_DEBUG <<
" Size of the cluster N list = " << mySsd->mLadders[i]->mWafers[j]->
getClusterN()->getSize()<<endm;
1424 Int_t IdN = pclusterN->getNCluster();
1426 if (mySsd->mLadders[i]->mWafers[j]->
getPoint()->getSize()==0) {
1427 pclusterN = mySsd->mLadders[i]->mWafers[j]->
getClusterN()->next(pclusterN);
1432 if(IdN==pSpt->getIdClusterN())
1435 LOG_DEBUG <<
"ok found the corresponding hit to this cluster id = "<<pSpt->getIdClusterN()<<endm;
1437 ClustupleIn[1] = i+1;
1438 ClustupleIn[2] = j+1;
1439 ClustupleIn[3] = pclusterN->getClusterSize();
1440 ClustupleIn[4] = ((pclusterN->getTotAdc()*pclusterN->getClusterSize())/pclusterN->getTotNoise());
1441 ClustupleIn[5] = pclusterN->getTotNoise()/pclusterN->getClusterSize();
1442 ClustupleIn[6] = pclusterN->getFirstStrip();
1443 ClustupleIn[7] = pclusterN->getTotAdc();
1444 ClustupleIn[8] = pclusterN->getFirstAdc();
1445 ClustupleIn[9] = pclusterN->getLastAdc();
1446 ClustupleIn[10]= pclusterN->getTotNoise();
1447 pHitNtuple->Fill(ClustupleIn);
1450 pSpt = mySsd->mLadders[i]->mWafers[j]->
getPoint()->next(pSpt);
1452 pclusterN = mySsd->mLadders[i]->mWafers[j]->
getClusterN()->next(pclusterN);
1459 LOG_DEBUG <<
"Number of p-side clusters in hits = " << clusP << endm ;
1460 LOG_DEBUG <<
"Number of n-side clusters in hits = " << clusN << endm ;
1463 void StSsdPointMaker::EvaluateEfficiency(
StSsdBarrel *mySsd)
1468 for (Int_t i=0;i<20;i++)
1469 if (mySsd->isActiveLadder(i)>0) {
1470 for (Int_t j=0; j<mySsd->mLadders[i]->getWaferPerLadder();j++) {
1471 if (mySsd->mLadders[i]->mWafers[j]->
getClusterP()->getSize()==0) {
1477 Int_t IdP = pclusterP->getNCluster();
1478 if (mySsd->mLadders[i]->mWafers[j]->
getPoint()->getSize()==0) {
1479 pclusterP = mySsd->mLadders[i]->mWafers[j]->
getClusterP()->next(pclusterP);
1484 if(IdP==pSpt->getIdClusterP())
1489 pSpt = mySsd->mLadders[i]->mWafers[j]->
getPoint()->next(pSpt);
1491 pclusterP = mySsd->mLadders[i]->mWafers[j]->
getClusterP()->next(pclusterP);
1494 ratioP[i][j]+=(float)clusP/mySsd->mLadders[i]->mWafers[j]->
getClusterP()->getSize();
1497 if (mySsd->mLadders[i]->mWafers[j]->
getClusterN()->getSize()==0) {
1503 Int_t IdN = pclusterN->getNCluster();
1504 if (mySsd->mLadders[i]->mWafers[j]->
getPoint()->getSize()==0) {
1505 pclusterN = mySsd->mLadders[i]->mWafers[j]->
getClusterN()->next(pclusterN);
1510 if(IdN==pSpt->getIdClusterN())
1515 pSpt = mySsd->mLadders[i]->mWafers[j]->
getPoint()->next(pSpt);
1517 pclusterN = mySsd->mLadders[i]->mWafers[j]->
getClusterN()->next(pclusterN);
1520 ratioN[i][j]+=(float)clusN/mySsd->mLadders[i]->mWafers[j]->
getClusterN()->getSize();
1527 void StSsdPointMaker::NormalizeEfficiency(){
1528 Double_t NClusP = 0;
1529 Double_t NClusN = 0;
1530 for(Int_t ii=0 ;ii< 20 ;ii++)
1532 for(Int_t jj=0 ;jj<16;jj++)
1534 NClusP = ratioP[ii][jj];
1537 NClusP = NClusP/NEvent;
1538 MatchedClusterP->SetBinContent(ii+1,jj+1,NClusP);}
1539 NClusN = ratioN[ii][jj];
1542 NClusN = NClusN/NEvent;
1543 MatchedClusterN->SetBinContent(ii+1,jj+1,NClusN);}
1548 void StSsdPointMaker::FillCalibTable(){
1549 mGain = (St_ssdGainCalibWafer*)GetDataBase(
"Calibrations/ssd/ssdGainCalibWafer");
1551 ssdGainCalibWafer_st *g = mGain->GetTable() ;
1552 Int_t size = mGain->GetNRows();
1553 LOG_INFO<<Form(
"Size of gain table = %d",(
int)mGain->GetNRows())<<endm;
1554 for(Int_t i=0; i<size;i++){
1555 LOG_DEBUG<<Form(
" Print entry %d : ladder=%d gain =%lf wafer=%d",i,g[i].nLadder,g[i].nGain,g[i].nWafer)<<endm;
1556 CalibArray[i] = g[i].nGain;
1560 LOG_WARN <<
"InitRun : No access to Gain Calib - will use the default gain" << endm;
1561 LOG_WARN <<
"We will use the default table" <<endm;
1562 for(Int_t i=0; i<320;i++){
1568 void StSsdPointMaker::FillDefaultCalibTable(){
1569 LOG_INFO <<
" The calibration gain will not be used." << endm;
1570 for(Int_t i=0; i<320;i++){
1576 void StSsdPointMaker::FillWaferTable(){
1577 mWafConfig = (St_ssdWaferConfiguration*) GetDataBase(
"Calibrations/ssd/ssdWaferConfiguration");
1579 ssdWaferConfiguration_st *g = mWafConfig->GetTable() ;
1580 Int_t size = mWafConfig->GetNRows();
1581 for(Int_t i=0; i<size;i++){
1582 LOG_DEBUG<<Form(
" Print entry=%d : ladder=%d wafer=%d status=%d",i,g[i].nLadder,g[i].nWafer,g[i].nStatus)<<endm;
1583 WafStatus[g[i].nLadder][g[i].nWafer] = g[i].nStatus;
1587 LOG_WARN <<
"InitRun : No access to Wafer Config - will use the default wafer config" << endm;
1588 LOG_WARN <<
"We will use the default table" <<endm;
1589 for(Int_t i=0; i<20;i++){
1590 for(Int_t j=0; j<16;j++){
1591 WafStatus[i][j] = 1;
1597 void StSsdPointMaker::FillDefaultWaferTable(){
1598 LOG_INFO <<
" The wafer configuration table will not be used." << endm;
1599 for(Int_t i=0; i<20;i++){
1600 for(Int_t j=0; j<16;j++){
1601 WafStatus[i][j] = 1;
1602 LOG_DEBUG << Form(
"wafer=%d gain=%f",i,CalibArray[i])<<endm;
1608 Int_t StSsdPointMaker::ReadNoiseTable(
StSsdBarrel *mySsd,Int_t year){
1609 Int_t noiseTableSize = 0;
1612 if((year<7)||(mode==1))
1616 LOG_WARN <<
"Make : No pedestal and noise values (ssdStripCalib table missing), will use default values" <<endm;
1617 noiseTableSize = mySsd->readNoiseDefault(mDynamicControl);
1621 if(Debug()) {Read_Strip(m_noise2);}
1628 LOG_WARN <<
"Make : No pedestal and noise values (ssdNoise table missing), will use default values" << endm;
1629 noiseTableSize = mySsd->readNoiseDefault(mDynamicControl);
1634 if (Debug()){Read_Strip(m_noise3);}
1638 return noiseTableSize;
1642 LOG_INFO << Form(
"Finish()") << endm;
StSsdPointList * getPoint()
Returns the point list attached to this wafer.
TH2S * ClustMapN
Map of number of clusters on the p-side ladders.
StSsdStripList * getStripP()
Returns the P-side strip list attached to this wafer.
TH1S * orthoproj
(1p-1n) packages control matching.
TH1F * noisDisN
p-side distribution of cluster total charge.
virtual void AddData(TDataSet *data, const char *dir=".data")
User methods.
TH1F * snRatioN
n-side distribution of noise.
StSsdStripList * getStripN()
Returns the N-side strip list attached to this wafer.
TH1F * stpClusP
p-side distribution of signal to noise ratio.
TH1F * totChrgN
n-side distribution of strips per cluster.
TH1S * kind
orthonormal projection and perfect matching deviation.
TH2S * ClustMapP
p-side clusters entries vs n-side clusters entries
TH1F * totChrgP
p-side distribution of strips per cluster.
TH1F * snRatioP
p-side distribution of noise.
Int_t readNoiseFromTable(St_sdm_calib_db *spa_noise, StSsdDynamicControl *dynamicControl)
TH2S * ClusNvsClusP
n-side distribution of cluster total charge.
StSsdPackageList * getPackage()
Returns the package list attached to this wafer.
StSsdClusterList * getClusterN()
Returns the N-side cluster list attached to this wafer.
StSsdClusterList * getClusterP()
Returns the P-side cluster list attached to this wafer.
TH2S * matchisto_[20]
kind of hits –>see StSsdWafer for definition
Event data structure to hold all information from a Monte Carlo simulation. This class is the interfa...
virtual TDataSet * Find(const char *path) const
TH1F * stpClusN
n-side distribution of signal to noise ratio.