00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125
00126
00127
00128
00129
00130
00131
00132
00133
00134
00135
00136
00137
00138
00139
00140
00141
00142
00143
00144
00145
00146
00147
00148
00149
00150
00151
00152
00153
00154
00155
00156
00157
00158
00159
00160
00161
00162
00163
00164
00165
00166
00167
00168
00169
00170
00171
00172
00173
00174
00175
00176
00177
00178
00179
00180
00181
00182
00183
00184
00185 #include "StSsdPointMaker.h"
00186
00187 #include "TFile.h"
00188 #include "TH1.h"
00189 #include "TH2.h"
00190 #include "TDataSetIter.h"
00191 #include "StMessMgr.h"
00192 #include "TNtuple.h"
00193 #include "StSsdUtil/StSsdPoint.hh"
00194 #include "StSsdUtil/StSsdPackage.hh"
00195 #include "StSsdUtil/StSsdCluster.hh"
00196 #include "StSsdUtil/StSsdStripList.hh"
00197 #include "StSsdUtil/StSsdClusterList.hh"
00198 #include "StSsdUtil/StSsdPointList.hh"
00199 #include "StSsdUtil/StSsdPackageList.hh"
00200 #include "StSsdUtil/StSsdWafer.hh"
00201 #include "StSsdUtil/StSsdLadder.hh"
00202 #include "StSsdUtil/StSsdBarrel.hh"
00203 #include "StSsdUtil/StSsdStrip.hh"
00204 #include "tables/St_spa_strip_Table.h"
00205 #include "tables/St_ssdPedStrip_Table.h"
00206 #include "tables/St_scf_cluster_Table.h"
00207 #include "tables/St_scm_spt_Table.h"
00208 #include "tables/St_slsCtrl_Table.h"
00209 #include "tables/St_clusterControl_Table.h"
00210 #include "tables/St_ssdDimensions_Table.h"
00211 #include "tables/St_ssdConfiguration_Table.h"
00212 #include "tables/St_ssdWafersPosition_Table.h"
00213 #include "tables/St_ssdLaddersPosition_Table.h"
00214 #include "tables/St_ssdSectorsPosition_Table.h"
00215 #include "tables/St_ssdBarrelPosition_Table.h"
00216 #include "tables/St_ssdStripCalib_Table.h"
00217 #include "tables/St_ssdGainCalibWafer_Table.h"
00218 #include "tables/St_ssdNoise_Table.h"
00219 #include "tables/St_ssdWaferConfiguration_Table.h"
00220 #include "StEvent.h"
00221 #include "StSsdHitCollection.h"
00222 #include "StSsdDbMaker/StSsdDbMaker.h"
00223 #include "TMath.h"
00224 ClassImp(StSsdPointMaker)
00225
00226
00227 Int_t StSsdPointMaker::Init(){
00228 LOG_INFO << "Init() : Defining the histograms" << endm;
00229 if (IAttr(".histos")) {
00230 noisDisP = new TH1F("Noise_p","Noise Distribution",250,0,25);
00231 snRatioP = new TH1F("SN_p","Signal/Noise (p)",200,0,200);
00232 stpClusP = new TH1F("NumberOfStrips_p","Strips per Cluster",8,0,8);
00233 totChrgP = new TH1F("ChargeElectron_p","Total Cluster Charge",100,0,300000);
00234 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);
00235 ClusNvsClusP->SetXTitle("Number of p-Side Clusters");
00236 ClusNvsClusP->SetYTitle("Number of n-Side Clusters");
00237 noisDisN = new TH1F("Noise_n","Noise Distribution",250,0,25);
00238 snRatioN = new TH1F("SN_n","Signal/Noise",200,0,200);
00239 stpClusN = new TH1F("NumberOfStrips_n","Strips per Cluster",8,0,8);
00240 totChrgN = new TH1F("ChargeElectron_n","Total Cluster Charge",100,0,300000);
00241 ClustMapP = new TH2S("ClustMapP","Number of clusters on the p-side per wafer and ladder",20,0,20,16,0,16);
00242 ClustMapP->SetXTitle("Ladder id");
00243 ClustMapP->SetYTitle("Wafer id");
00244 ClustMapN = new TH2S("ClustMapN","Number of clusters on the n-side per wafer and ladder",20,0,20,16,0,16);
00245 ClustMapN->SetXTitle("Ladder id");
00246 ClustMapN->SetYTitle("Wafer id");
00247 MatchedClusterP = new TH2F("MatchedClusterP","#frac{# clusters matched}{# clusters reconstructed} , wafers on p-side",20,1,21,16,1,17);
00248 MatchedClusterP->SetXTitle("Ladder id");
00249 MatchedClusterP->SetYTitle("Wafer id");
00250 MatchedClusterN = new TH2F("MatchedClusterN","#frac{# clusters matched}{# clusters reconstructed} , wafers on n-side",20,1,21,16,1,17);
00251 MatchedClusterN->SetXTitle("Ladder id");
00252 MatchedClusterN->SetYTitle("Wafer id");
00253
00254 matchisto = new TH2S("matchingHisto","Matching Adc (1p-1n)",500,0,1000,500,0,1000);
00255 matchisto->SetXTitle("PSide ADC count");
00256 matchisto->SetYTitle("NSide ADC count");
00257 matchisto->SetZTitle("(1p-1n) hits");
00258
00259 matchisto->SetTitleOffset(2,"X");
00260 matchisto->SetTitleOffset(2,"Y");
00261
00262
00263 matchisto->SetLabelSize(0.03,"X");
00264 matchisto->SetLabelSize(0.03,"Y");
00265 matchisto->SetLabelSize(0.03,"Z");
00266
00267 matchisto->SetNdivisions(5,"X");
00268 matchisto->SetNdivisions(5,"Y");
00269 matchisto->SetNdivisions(10,"Z");
00270
00271 orthoproj = new TH1S("ProjectionOrtho","Perfect Matching Deviation",320,-80,80);
00272
00273 kind = new TH1S("kind","Kind of hits",11,0,11);
00274 kind->SetXTitle("kind");
00275 kind->SetYTitle("entries");
00276 kind->SetTitleOffset(2,"X");
00277 kind->SetTitleOffset(2,"Y");
00278
00279 TString Title;
00280 Char_t *Name = new Char_t[20];
00281 Title ="Matching Adc (1p-1n) for ladder";
00282 for(Int_t ii=0;ii<20;ii++)
00283 {
00284 Title = Form("Matching Adc (1p-1n) for ladder = %i",ii+1);
00285 sprintf(Name,"%s%d","matchingHisto_",ii);
00286 matchisto_[ii] = new TH2S(Name,Title,500,0,1000, 500, 0, 1000);
00287 matchisto_[ii]->SetXTitle("PSide ADC count");
00288 matchisto_[ii]->SetYTitle("NSide ADC count");
00289 matchisto_[ii]->SetZTitle("(1p-1n) hits");
00290 }
00291 if (Debug()>1) DeclareNtuple();
00292 }
00293 return StMaker::Init();
00294 }
00295
00296 Int_t StSsdPointMaker::InitRun(Int_t runumber) {
00297
00298
00299
00300
00301 mode= gStSsdDbMaker->GetMode();
00302 LOG_INFO <<"m_Mode = " << mode << endm;
00303 NEvent = 0;
00304 UseCalibration = 1;
00305 UseWaferConfig = 1;
00306 LOG_INFO<<Form("UseCalibration =%d UseWaferTable = %d",UseCalibration,UseWaferConfig)<<endm;
00307 St_slsCtrl* slsCtrlTable = (St_slsCtrl*) GetDataBase("Geometry/ssd/slsCtrl");
00308 if(! slsCtrlTable){LOG_ERROR << "InitRun : No access to slsCtrl table" << endm;}
00309 else {
00310 mDynamicControl = new StSsdDynamicControl();
00311 slsCtrl_st* control = (slsCtrl_st*) slsCtrlTable->GetTable();
00312 mDynamicControl -> setnElectronInAMip(control->nElectronInAMip);
00313 mDynamicControl -> setadcDynamic(control->adcDynamic);
00314 mDynamicControl -> seta128Dynamic(control->a128Dynamic);
00315 mDynamicControl -> setnbitEncoding(control->nbitEncoding);
00316 mDynamicControl -> setnstripInACluster(control->nstripInACluster);
00317 mDynamicControl -> setpairCreationEnergy(control->pairCreationEnergy);
00318 mDynamicControl -> setparDiffP(control->parDiffP);
00319 mDynamicControl -> setparDiffN(control->parDiffN);
00320 mDynamicControl -> setparIndRightP(control->parIndRightP);
00321 mDynamicControl -> setparIndRightN(control->parIndRightN);
00322 mDynamicControl -> setparIndLeftP(control->parIndLeftP);
00323 mDynamicControl -> setparIndLeftN(control->parIndLeftN);
00324 mDynamicControl -> setdaqCutValue(control->daqCutValue);
00325 mDynamicControl -> printParameters();
00326 }
00327 St_clusterControl* clusterCtrlTable = (St_clusterControl*) GetDataBase("Geometry/ssd/clusterControl");
00328 if (!clusterCtrlTable) {LOG_ERROR << "InitRun : No access to clusterControl table" << endm;}
00329 else {
00330 mClusterControl = new StSsdClusterControl();
00331 clusterControl_st *clusterCtrl = (clusterControl_st*) clusterCtrlTable->GetTable() ;
00332 mClusterControl -> setHighCut(clusterCtrl->highCut);
00333 mClusterControl -> setTestTolerance(clusterCtrl->testTolerance);
00334 mClusterControl -> setClusterTreat(clusterCtrl->clusterTreat);
00335 mClusterControl -> setAdcTolerance(clusterCtrl->adcTolerance);
00336 mClusterControl -> setMatchMean(clusterCtrl->matchMean);
00337 mClusterControl -> setMatchSigma(clusterCtrl->matchSigma);
00338 mClusterControl -> printParameters();
00339 }
00340 year = (GetDate()/10000)-2000;
00341 LOG_DEBUG <<Form("TimeStamp is %d Year is =%d\n",GetDate(),year)<<endm;
00342 switch(mode)
00343 {
00344 case 1: {
00345 m_noise2 = (St_ssdStripCalib*) GetDataBase("Calibrations/ssd/ssdStripCalib");
00346 if (!m_noise2) {LOG_ERROR << "InitRun : No access to ssdStripCalib - will use the default noise and pedestal values" << endm;}
00347 else {
00348 LOG_INFO<<"InitRun for simu : old Table (ssdStripCalib) is used"<<endm;
00349 }
00350 break;
00351 }
00352 case 0 :{
00353 if(year<7){
00354 m_noise2 = (St_ssdStripCalib*) GetDataBase("Calibrations/ssd/ssdStripCalib");
00355 if (!m_noise2) {LOG_ERROR << "InitRun : No access to ssdStripCalib - will use the default noise and pedestal values" << endm;}
00356 else {
00357 LOG_INFO<<"InitRun for real data : old Table(ssdStripCalib) is used"<<endm;
00358 }
00359 }
00360 else {
00361 m_noise3 = (St_ssdNoise*)GetDataBase("Calibrations/ssd/ssdNoise");
00362 if (!m_noise3) {LOG_ERROR << "InitRun : No access to ssdNoise - will use the default noise and pedestal values" << endm;}
00363 else{
00364 LOG_INFO << "InitRun for real data : new Table(ssdNoise) is used" << endm;}
00365 }
00366 break;
00367 }
00368 default : {printf("no real data nor simu");}
00369 }
00370 (UseCalibration==1)?FillCalibTable():FillDefaultCalibTable();
00371 (UseWaferConfig==1)?FillWaferTable():FillDefaultWaferTable();
00372
00373
00374
00375 for(Int_t ii=0 ;ii<20;ii++)
00376 {
00377 for(Int_t jj=0;jj<16;jj++)
00378 {
00379 ratioP[ii][jj] = 0;
00380 ratioN[ii][jj] = 0;
00381 }
00382 }
00383 return kStOk;
00384 }
00385
00386 void StSsdPointMaker::DeclareNtuple(){
00387 TFile *f = GetTFile();
00388 if (f){
00389 f->cd();
00390 string varlist2 = "pulseP:pulseN:ladder:wafer:case:xg:yg:zg:flag:idClusP:idClusN:position_0:position_1:xl:yl";
00391 mHitNtuple = new TNtuple("PhysNTuple","Physics Ntuple",varlist2.c_str());
00392 string varlist3 = "side:ladder:wafer:nstrip:snratio:noise:first_strip:TotAdc:FirstAdc:LastAdc:TotNoise";
00393 nHitNtuple = new TNtuple("ClusTuple","All Clusters stored",varlist3.c_str());
00394 string varlist4 = "side:ladder:wafer:nstrip:pedestal:signal:noise:snratio";
00395 qHitNtuple = new TNtuple("Strips","All Strips stored",varlist4.c_str());
00396 pHitNtuple = new TNtuple("ClustupleIn","Clusters in hits",varlist3.c_str());
00397 rHitNtuple = new TNtuple("StripsIn","Strips in hits",varlist4.c_str());
00398 }
00399 }
00400
00401 Int_t StSsdPointMaker::Make()
00402 {
00403 LOG_DEBUG << Form("Make : begin")<< endm;
00404
00405 Int_t res = 0;
00406 char* myLabel = new char[100];
00407 char* myTime = new char[100];
00408 char* myDate = new char[100];
00409 if (GetTime()<999)
00410 sprintf(myTime,"000%d",GetTime());
00411 else
00412 if ((GetTime()<9999)&&(GetTime()>999))
00413 sprintf(myTime,"00%d",GetTime());
00414 else
00415 if ((GetTime()<99999)&&(GetTime()>9999))
00416 sprintf(myTime,"0%d",GetTime());
00417 else
00418 sprintf(myTime,"%d",GetTime());
00419 sprintf(myDate,"%d%s",GetDate(),".");
00420 sprintf(myLabel,"%s%s",myDate,myTime);
00421
00422
00423 TDataSet *SpaStrip = GetDataSet("SpaStrip");
00424 if (! SpaStrip) {
00425 LOG_ERROR << "Make : no input data set, wrong chain option" << endm;
00426 return kStErr;
00427 }
00428 St_spa_strip *spa_strip = dynamic_cast<St_spa_strip *> (SpaStrip->Find("spa_strip"));
00429 St_ssdPedStrip *spa_ped_strip = dynamic_cast<St_ssdPedStrip *> (SpaStrip->Find("ssdPedStrip"));
00430
00431 if (!spa_strip || spa_strip->GetNRows()==0){
00432 {
00433 LOG_WARN << "Make : no input (fired strip for the SSD)"<<endm;
00434 LOG_WARN <<"Make : looking for a pedestal/noise tables"<<endm;
00435 }
00436 if (!spa_ped_strip || spa_ped_strip->GetNRows()==0) {
00437 LOG_WARN<<"Make : no pedestal/noise data..."<<endm;
00438 return kStWarn;
00439 }
00440 else
00441 { LOG_WARN<<"Make : pedestal/noise data found : "<<spa_ped_strip->GetNRows()<<endm;}
00442 }
00443
00444 St_scm_spt *scm_spt = new St_scm_spt("scm_spt",5000);
00445 m_DataSet->Add(scm_spt);
00446
00447 St_scf_cluster *scf_cluster = new St_scf_cluster("scf_cluster",5000);
00448 m_DataSet->Add(scf_cluster);
00449
00450 mCurrentEvent = (StEvent*) GetInputDS("StEvent");
00451 if(mCurrentEvent)
00452 {
00453 mSsdHitColl = mCurrentEvent->ssdHitCollection();
00454 if (!mSsdHitColl) {
00455 LOG_WARN << "Make : The SSD hit collection does not exist - creating a new one" << endm;
00456 mSsdHitColl = new StSsdHitCollection;
00457 mCurrentEvent->setSsdHitCollection(mSsdHitColl);
00458 }
00459 }
00460 else
00461 mSsdHitColl = 0;
00462
00463 LOG_INFO<<"#################################################"<<endm;
00464 LOG_INFO<<"#### START OF NEW SSD POINT MAKER ####"<<endm;
00465 LOG_INFO<<"#### SSD BARREL INITIALIZATION ####"<<endm;
00466 LOG_INFO<<"#### BEGIN INITIALIZATION ####"<<endm;
00467 StSsdBarrel *mySsd =gStSsdDbMaker->GetSsd();
00468 mySsd->setClusterControl(mClusterControl);
00469
00470 if((! spa_ped_strip || spa_ped_strip->GetNRows()==0) && (spa_strip->GetNRows()!=0))
00471 {
00472 Int_t stripTableSize = mySsd->readStripFromTable(spa_strip);
00473 LOG_INFO<<"#### NUMBER OF SPA STRIPS "<<stripTableSize<<" ####"<<endm;
00474 mySsd->sortListStrip();
00475 PrintStripSummary(mySsd);
00476 noiseTableSize = 0;
00477 noiseTableSize = ReadNoiseTable(mySsd,year);
00478 LOG_INFO<<"#### NUMBER OF DB ENTRIES "<<noiseTableSize<<" ####"<<endm;
00479 Int_t nClusterPerSide[2];
00480 nClusterPerSide[0] = 0;
00481 nClusterPerSide[1] = 0;
00482 mySsd->doSideClusterisation(nClusterPerSide,WafStatus);
00483 LOG_INFO<<"#### NUMBER OF CLUSTER P SIDE "<<nClusterPerSide[0]<<" ####"<<endm;
00484 LOG_INFO<<"#### NUMBER OF CLUSTER N SIDE "<<nClusterPerSide[1]<<" ####"<<endm;
00485 mySsd->sortListCluster();
00486 Int_t nClusterWritten = mySsd->writeClusterToTable(scf_cluster,spa_strip);
00487 LOG_INFO<<"#### -> "<<nClusterWritten<<" CLUSTERS WRITTEN INTO TABLE ####"<<endm;
00488 PrintClusterSummary(mySsd);
00489
00490
00491 makeScfCtrlHistograms(mySsd);
00492
00493 Int_t nPackage = mySsd->doClusterMatching(CalibArray);
00494 LOG_INFO<<"#### -> "<<nPackage<<" PACKAGES IN THE SSD ####"<<endm;
00495 mySsd->convertDigitToAnalog(mDynamicControl);
00496 mySsd->convertUFrameToOther();
00497 PrintPointSummary(mySsd);
00498
00499 if(Debug()){
00500 for(Int_t i=1;i<=20;i++)
00501 {
00502 for(Int_t j=1;j<=16;j++)
00503 {
00504
00505
00506
00507
00508 }
00509 }
00510 }
00511
00512 Int_t nSptWritten = 0;
00513 StMcEvent* mcEvent = 0;
00514 mcEvent = (StMcEvent*) GetDataSet("StMcEvent");
00515 if(mcEvent)
00516 {
00517 LOG_DEBUG << " mcEvent exists " << endm;
00518 nSptWritten = mySsd->writePointToContainer(scm_spt,mSsdHitColl,scf_cluster,spa_strip,mDynamicControl,mcEvent);
00519 }
00520 else{
00521 nSptWritten = mySsd->writePointToContainer(scm_spt,mSsdHitColl,scf_cluster);
00522 }
00523 LOG_INFO<<"#### -> "<<nSptWritten<<" HITS WRITTEN INTO TABLE ####"<<endm;
00524 if(mSsdHitColl){
00525 if (mSsdHitColl->numberOfHits()>0) {
00526 NEvent++;
00527 LOG_INFO<<"#### -> "<<mSsdHitColl->numberOfHits()<<" HITS WRITTEN INTO CONTAINER ####"<<endm;
00528 makeScmCtrlHistograms(mySsd);
00529 EvaluateEfficiency(mySsd);
00530 NormalizeEfficiency();
00531 scm_spt->Purge();
00532 }
00533 else {
00534 LOG_INFO<<" ######### NO SSD HITS WRITTEN INTO CONTAINER ####"<<endm;
00535 }
00536 }
00537 LOG_INFO<<"#### END OF SSD NEW POINT MAKER ####"<<endm;
00538 LOG_INFO<<"#################################################"<<endm;
00539 if(Debug() >1){
00540 if (qHitNtuple) WriteStripTuple(mySsd);
00541 if (nHitNtuple) WriteScfTuple(mySsd);
00542 if (mHitNtuple) WriteScmTuple(mySsd);
00543 if (rHitNtuple) WriteMatchedStrips(mySsd);
00544 if (pHitNtuple) WriteMatchedClusters(mySsd);
00545 }
00546 if (nSptWritten) res = kStOK;
00547 }
00548 else
00549 {
00550 if((spa_strip->GetNRows()==0)&&(spa_ped_strip && spa_ped_strip->GetNRows()!=0))
00551 {
00552 LOG_INFO <<"###### WRITING SSD PEDESTAL HISTOGRAMS##########"<<endm;
00553 if(year<7){
00554 mySsd->writeNoiseToFile(spa_ped_strip,myLabel);}
00555 else{mySsd->writeNewNoiseToFile3(spa_ped_strip,myLabel);
00556 printf("done\n");
00557 }
00558 }
00559 }
00560 mySsd->Reset();
00561 if(res!=kStOK){
00562 LOG_WARN <<"Make : no output" << endm;;
00563 return kStWarn;
00564 }
00565 return kStOK;
00566 }
00567
00568 void StSsdPointMaker::makeScfCtrlHistograms(StSsdBarrel *mySsd)
00569 {
00570
00571 Int_t found;
00572 Float_t convAdcToE = (mDynamicControl->getadcDynamic()*mDynamicControl->getnElectronInAMip())/(pow(2.0,mDynamicControl->getnbitEncoding()));
00573 found=0;
00574 Int_t ClustersP_tot = 0;
00575 Int_t ClustersN_tot = 0;
00576 Int_t pSize = 0;
00577 Int_t nSize = 0;
00578 for (Int_t i=0;i<20;i++)
00579 if (mySsd->isActiveLadder(i)>0) {
00580 for (Int_t j=0; j<mySsd->mLadders[i]->getWaferPerLadder();j++) {
00581 StSsdClusterList *pList = mySsd->mLadders[i]->mWafers[j]->getClusterP();
00582 pSize = pList->getSize();
00583 ClustersP_tot+= pSize;
00584 StSsdClusterList *nList = mySsd->mLadders[i]->mWafers[j]->getClusterN();
00585 nSize = nList->getSize();
00586 ClustersN_tot+= nSize;
00587 ClusNvsClusP->Fill(pSize,nSize);
00588 ClustMapP->Fill(i,j,pSize);
00589 ClustMapN->Fill(i,j,nSize);
00590 pSize = 0;
00591 nSize = 0;
00592 StSsdCluster *pClusterP = mySsd->mLadders[i]->mWafers[j]->getClusterP()->first();
00593 while (pClusterP)
00594 {
00595 stpClusP->Fill(pClusterP->getClusterSize());
00596 totChrgP->Fill(convAdcToE*pClusterP->getTotAdc());
00597 if (pClusterP->getClusterSize()>0)
00598 noisDisP->Fill(pClusterP->getTotNoise()/pClusterP->getClusterSize());
00599 if (pClusterP->getTotNoise()>0)
00600 snRatioP->Fill((pClusterP->getTotAdc()*pClusterP->getClusterSize())/pClusterP->getTotNoise());
00601 pClusterP = mySsd->mLadders[i]->mWafers[j]->getClusterP()->next(pClusterP);
00602 }
00603 StSsdCluster *pClusterN = mySsd->mLadders[i]->mWafers[j]->getClusterN()->first();
00604 while (pClusterN)
00605 {
00606 stpClusN->Fill(pClusterN->getClusterSize());
00607 totChrgN->Fill(convAdcToE*pClusterN->getTotAdc());
00608 noisDisN->Fill(pClusterN->getTotNoise()/(3e-33+pClusterN->getClusterSize()));
00609 snRatioN->Fill((pClusterN->getTotAdc()*pClusterN->getClusterSize())/(3e-33+pClusterN->getTotNoise()));
00610 pClusterN = mySsd->mLadders[i]->mWafers[j]->getClusterN()->next(pClusterN);
00611 }
00612 }
00613 }
00614 LOG_DEBUG <<"totclusters P="<<ClustersP_tot<<" totclusters N="<<ClustersN_tot<<endm;
00615 }
00616
00617
00618 void StSsdPointMaker::makeScmCtrlHistograms(StSsdBarrel *mySsd)
00619 {
00620
00621 Int_t found;
00622 Int_t conversion[11]={11,12,21,13,31,221,222,223,23,32,33};
00623 Float_t convMeVToAdc = (int)pow(2.0,mDynamicControl->getnbitEncoding())/(mDynamicControl->getpairCreationEnergy()*mDynamicControl->getadcDynamic()*mDynamicControl->getnElectronInAMip());
00624 found=0;
00625 for (Int_t i=0;i<20;i++)
00626 if (mySsd->isActiveLadder(i)>0) {
00627 for (Int_t j=0; j<mySsd->mLadders[i]->getWaferPerLadder();j++) {
00628 if (mySsd->mLadders[i]->mWafers[j]->getPoint()->getSize()==0) {
00629
00630 }
00631 else {
00632 StSsdPoint *pSpt = mySsd->mLadders[i]->mWafers[j]->getPoint()->first();
00633 while (pSpt){
00634 if (pSpt->getNMatched() == 11)
00635 {
00636 Float_t a = 0, b = 0;
00637 a = convMeVToAdc*(pSpt->getDe(0)+pSpt->getDe(1));
00638 b = convMeVToAdc*(pSpt->getDe(0)-pSpt->getDe(1));
00639 matchisto->Fill(a,b);
00640 orthoproj->Fill((b-a)/TMath::Sqrt(2.));
00641 matchisto_[i]->Fill(a,b);
00642 }
00643
00644 for(Int_t k=0;k<=11;k++)
00645 {
00646 if(pSpt->getNMatched()==conversion[k])
00647 {
00648 kind->Fill(k);
00649 }
00650 }
00651 pSpt = mySsd->mLadders[i]->mWafers[j]->getPoint()->next(pSpt);
00652 }
00653 }
00654 }
00655 }
00656 }
00657
00658
00659 void StSsdPointMaker::PrintStripSummary(StSsdBarrel *mySsd)
00660 {
00661 Int_t ladderCountN[20]={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0} ;
00662 Int_t ladderCountP[20]={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0} ;
00663 for (Int_t i=0;i<20;i++)
00664 if (mySsd->isActiveLadder(i)>0) {
00665 for (Int_t j=0; j<mySsd->mLadders[i]->getWaferPerLadder();j++) {
00666 ladderCountP[i]=ladderCountP[i]+mySsd->mLadders[i]->mWafers[j]->getStripP()->getSize();
00667 ladderCountN[i]=ladderCountN[i]+mySsd->mLadders[i]->mWafers[j]->getStripN()->getSize();
00668 }
00669 }
00670
00671 LOG_INFO <<"PrintStripSummary : Number of raw data in the SSD" << endm;
00672 LOG_INFO << "PrintStripSummary : Active Ladders : ";
00673 for (Int_t i=0;i<20;i++)
00674 if (mySsd->isActiveLadder(i)>0) {
00675 LOG_DEBUG.width(5);
00676 LOG_DEBUG<<i+1;
00677 }
00678
00679 LOG_DEBUG<<endm;
00680 LOG_INFO << "PrintStripSummary : Counts (p-side): ";
00681 for (Int_t i=0;i<20;i++)
00682 if (mySsd->isActiveLadder(i)>0) {
00683 LOG_DEBUG.width(5);
00684 LOG_DEBUG <<ladderCountP[i];
00685 }
00686 LOG_DEBUG<<endm;
00687 LOG_INFO << "PrintStripSummary : Counts (n-side): ";
00688 for (Int_t i=0;i<20;i++)
00689 if (mySsd->isActiveLadder(i)>0) {
00690 LOG_DEBUG.width(5);
00691 LOG_DEBUG <<ladderCountN[i];
00692 }
00693 LOG_DEBUG<<endm;
00694 }
00695
00696
00697 void StSsdPointMaker::debugUnPeu(StSsdBarrel *mySsd)
00698 {
00699 Int_t monladder,monwafer;
00700 monladder=7;
00701 monwafer=6;
00702 mySsd->debugUnPeu(monladder,monwafer);
00703 }
00704
00705
00706 void StSsdPointMaker::PrintClusterSummary(StSsdBarrel *mySsd)
00707 {
00708 Int_t ladderCountN[20]={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0} ;
00709 Int_t ladderCountP[20]={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0} ;
00710 for (Int_t i=0;i<20;i++)
00711 if (mySsd->isActiveLadder(i)>0) {
00712 for (Int_t j=0; j<mySsd->mLadders[i]->getWaferPerLadder();j++) {
00713 ladderCountP[i]=ladderCountP[i]+mySsd->mLadders[i]->mWafers[j]->getClusterP()->getSize();
00714 ladderCountN[i]=ladderCountN[i]+mySsd->mLadders[i]->mWafers[j]->getClusterN()->getSize();
00715 }
00716 }
00717
00718 LOG_INFO <<"PrintClusterSummary : Number of clusters in the SSD" << endm;
00719 LOG_INFO << "PrintClusterSummary : Active Ladders : ";
00720 for (Int_t i=0;i<20;i++)
00721 if (mySsd->isActiveLadder(i)>0) {
00722 LOG_DEBUG.width(5);
00723 LOG_DEBUG<<i+1;
00724 }
00725
00726 LOG_DEBUG<<endm;
00727 LOG_INFO << "PrintClusterSummary : Counts (p-side): ";
00728 for (Int_t i=0;i<20;i++)
00729 if (mySsd->isActiveLadder(i)>0) {
00730 LOG_DEBUG.width(5);
00731 LOG_DEBUG <<ladderCountP[i];
00732 }
00733 LOG_DEBUG<<endm;
00734 LOG_INFO << "PrintClusterSummary : Counts (n-side): ";
00735 for (Int_t i=0;i<20;i++)
00736 if (mySsd->isActiveLadder(i)>0) {
00737 LOG_DEBUG.width(5);
00738 LOG_DEBUG <<ladderCountN[i];
00739 }
00740 LOG_DEBUG<<endm;
00741 }
00742
00743 void StSsdPointMaker::PrintPointSummary(StSsdBarrel *mySsd)
00744 {
00745 Int_t ladderCount[20]={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0} ;
00746 Int_t ladderCount11[20]={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0} ;
00747 for (Int_t i=0;i<20;i++)
00748 if (mySsd->isActiveLadder(i)>0) {
00749 for (Int_t j=0; j<mySsd->mLadders[i]->getWaferPerLadder();j++) {
00750 ladderCount[i]=ladderCount[i]+mySsd->mLadders[i]->mWafers[j]->getPoint()->getSize();
00751 StSsdPoint *pSpt = mySsd->mLadders[i]->mWafers[j]->getPoint()->first();
00752 while (pSpt){
00753 if (pSpt->getNMatched()==11) ladderCount11[i]++;
00754 pSpt = mySsd->mLadders[i]->mWafers[j]->getPoint()->next(pSpt);
00755 }
00756 }
00757 }
00758
00759 LOG_INFO<<"PrintPointSummary : Number of hits in the SSD" << endm;
00760 LOG_INFO<< "PrintPointSummary : Active Ladders : ";
00761 for (Int_t i=0;i<20;i++)
00762 if (mySsd->isActiveLadder(i)>0) {
00763 LOG_DEBUG.width(5);
00764 LOG_DEBUG<<i+1;
00765 }
00766
00767 LOG_DEBUG<<endm;
00768 LOG_INFO << "PrintPointSummary : Counts : ";
00769 for (Int_t i=0;i<20;i++)
00770 if (mySsd->isActiveLadder(i)>0) {
00771 LOG_DEBUG.width(5);
00772 LOG_DEBUG <<ladderCount[i];
00773 }
00774 LOG_DEBUG<<endm;
00775 LOG_INFO << "PrintPointSummary : Counts (11) : ";
00776 for (Int_t i=0;i<20;i++)
00777 if (mySsd->isActiveLadder(i)>0) {
00778 LOG_DEBUG.width(5);
00779 LOG_DEBUG <<ladderCount11[i];
00780 }
00781 LOG_DEBUG<<endm;
00782 }
00783
00784 void StSsdPointMaker::WriteStripTuple(StSsdBarrel *mySsd)
00785 {
00786
00787 Int_t found=0; if(found){}
00788 for (Int_t i=0;i<20;i++)
00789 if (mySsd->isActiveLadder(i)>0) {
00790 for (Int_t j=0; j<mySsd->mLadders[i]->getWaferPerLadder();j++) {
00791 StSsdStrip *pStripP = mySsd->mLadders[i]->mWafers[j]->getStripP()->first();
00792 while (pStripP){
00793 Strips_hits[0] = 0;
00794 Strips_hits[1] = i+1;
00795 Strips_hits[2] = j+1;
00796 Strips_hits[3] = pStripP->getNStrip();
00797 Strips_hits[4] = pStripP->getPedestal();
00798 Strips_hits[5] = pStripP->getDigitSig();
00799 Strips_hits[6] = pStripP->getSigma();
00800 Strips_hits[7] = (float)(pStripP->getDigitSig()/pStripP->getSigma());
00801 qHitNtuple->Fill(Strips_hits);
00802 pStripP = mySsd->mLadders[i]->mWafers[j]->getStripP()->next(pStripP);
00803 }
00804 StSsdStrip *pStripN = mySsd->mLadders[i]->mWafers[j]->getStripN()->first();
00805 while (pStripN){
00806 Strips_hits[0] = 1;
00807 Strips_hits[1] = i+1;
00808 Strips_hits[2] = j+1;
00809 Strips_hits[3] = pStripN->getNStrip();
00810 Strips_hits[4] = pStripN->getPedestal();
00811 Strips_hits[5] = pStripN->getDigitSig();
00812 Strips_hits[6] = pStripN->getSigma();
00813 Strips_hits[7] = (float)(pStripN->getDigitSig()/pStripN->getSigma());
00814 qHitNtuple->Fill(Strips_hits);
00815 pStripN = mySsd->mLadders[i]->mWafers[j]->getStripN()->next(pStripN);
00816 }
00817 }
00818 }
00819 }
00820
00821
00822 void StSsdPointMaker::WriteScfTuple(StSsdBarrel *mySsd)
00823 {
00824
00825 Int_t found;
00826 found=0;
00827 for (Int_t i=0;i<20;i++)
00828 if (mySsd->isActiveLadder(i)>0) {
00829 for (Int_t j=0; j<mySsd->mLadders[i]->getWaferPerLadder();j++) {
00830 StSsdCluster *pClusterP = mySsd->mLadders[i]->mWafers[j]->getClusterP()->first();
00831 while (pClusterP)
00832 {
00833 ClusterNtuple[0] = 0;
00834 ClusterNtuple[1] = i+1;
00835 ClusterNtuple[2] = j+1;
00836 ClusterNtuple[3] = pClusterP->getClusterSize();
00837 ClusterNtuple[4] = ((pClusterP->getTotAdc()*pClusterP->getClusterSize())/pClusterP->getTotNoise());
00838 ClusterNtuple[5] = pClusterP->getTotNoise()/pClusterP->getClusterSize();
00839 ClusterNtuple[6] = pClusterP->getFirstStrip();
00840 ClusterNtuple[7] = pClusterP->getTotAdc();
00841 ClusterNtuple[8] = pClusterP->getFirstAdc();
00842 ClusterNtuple[9] = pClusterP->getLastAdc();
00843 ClusterNtuple[10]= pClusterP->getTotNoise();
00844 pClusterP = mySsd->mLadders[i]->mWafers[j]->getClusterP()->next(pClusterP);
00845 nHitNtuple->Fill(ClusterNtuple);
00846 }
00847 StSsdCluster *pClusterN = mySsd->mLadders[i]->mWafers[j]->getClusterN()->first();
00848 while (pClusterN)
00849 {
00850 ClusterNtuple[0] = 1;
00851 ClusterNtuple[1] = i+1;
00852 ClusterNtuple[2] = j+1;
00853 ClusterNtuple[3] = pClusterN->getClusterSize();
00854 ClusterNtuple[4] = ((pClusterN->getTotAdc()*pClusterN->getClusterSize())/pClusterN->getTotNoise());
00855 ClusterNtuple[5] = pClusterN->getTotNoise()/pClusterN->getClusterSize();
00856 ClusterNtuple[6] = pClusterN->getFirstStrip();
00857 ClusterNtuple[7] = pClusterN->getTotAdc();
00858 ClusterNtuple[8] = pClusterN->getFirstAdc();
00859 ClusterNtuple[9] = pClusterN->getLastAdc();
00860 ClusterNtuple[10]= pClusterN->getTotNoise();
00861 pClusterN = mySsd->mLadders[i]->mWafers[j]->getClusterN()->next(pClusterN);
00862 nHitNtuple->Fill(ClusterNtuple);
00863 }
00864 }
00865 }
00866 }
00867
00868 void StSsdPointMaker::WriteScmTuple(StSsdBarrel *mySsd)
00869 {
00870
00871 Int_t found;
00872 Int_t conversion[11]={11,12,21,13,31,221,222,223,23,32,33};
00873 Float_t convMeVToAdc = (int)pow(2.0,mDynamicControl->getnbitEncoding())/(mDynamicControl->getpairCreationEnergy()*mDynamicControl->getadcDynamic()*mDynamicControl->getnElectronInAMip());
00874 found=0;
00875 for (Int_t i=0;i<20;i++)
00876 if (mySsd->isActiveLadder(i)>0) {
00877 for (Int_t j=0; j<mySsd->mLadders[i]->getWaferPerLadder();j++) {
00878 if (mySsd->mLadders[i]->mWafers[j]->getPoint()->getSize()==0) {
00879 }
00880 else {
00881 StSsdPoint *pSpt = mySsd->mLadders[i]->mWafers[j]->getPoint()->first();
00882 while (pSpt){
00883 Float_t a = 0, b = 0;
00884 a = convMeVToAdc*(pSpt->getDe(0)+pSpt->getDe(1));
00885 b = convMeVToAdc*(pSpt->getDe(0)-pSpt->getDe(1));
00886 hitNtuple[0] = a;
00887 hitNtuple[1] = b;
00888 hitNtuple[2] = i+1;
00889 hitNtuple[3] = j+1;
00890 for(Int_t k=0;k<=11;k++)
00891 {
00892 if(pSpt->getNMatched()==conversion[k])
00893 {
00894 hitNtuple[4]=k;
00895 }
00896 }
00897 hitNtuple[5] = pSpt->getXg(0);
00898 hitNtuple[6] = pSpt->getXg(1);
00899 hitNtuple[7] = pSpt->getXg(2);
00900 hitNtuple[8] = pSpt->getFlag();
00901
00902 Int_t IdP = pSpt->getIdClusterP();
00903 Int_t IdN = pSpt->getIdClusterN();
00904
00905 StSsdClusterList *currentListP_j = mySsd->mLadders[i]->mWafers[j]->getClusterP();
00906 StSsdCluster *cluster_P_j = currentListP_j->first();
00907 while(cluster_P_j)
00908 {
00909 if(cluster_P_j->getNCluster()==IdP)
00910 break;
00911 cluster_P_j = currentListP_j->next(cluster_P_j);
00912 }
00913
00914 StSsdClusterList *currentListN_j = mySsd->mLadders[i]->mWafers[j]->getClusterN();
00915 StSsdCluster *cluster_N_j = currentListN_j->first();
00916 while(cluster_N_j)
00917 {
00918 if(cluster_N_j->getNCluster()==IdN)
00919 break;
00920 cluster_N_j = currentListN_j->next(cluster_N_j);
00921 }
00922
00923 hitNtuple[9] = cluster_P_j->getStripMean();
00924 hitNtuple[10]= cluster_N_j->getStripMean();
00925 hitNtuple[11] = pSpt->getPositionU(0);
00926 hitNtuple[12] = pSpt->getPositionU(1);
00927 hitNtuple[13] = pSpt->getXl(0);
00928 hitNtuple[14] = pSpt->getXl(1);
00929 mHitNtuple->Fill(hitNtuple);
00930 pSpt = mySsd->mLadders[i]->mWafers[j]->getPoint()->next(pSpt);
00931 }
00932 }
00933 }
00934 }
00935 }
00936
00937 void StSsdPointMaker::PrintStripDetails(StSsdBarrel *mySsd, Int_t mywafer)
00938 {
00939
00940 Int_t found = 0 ;
00941 LOG_DEBUG <<"PrintStripDetails() - Wafer "<<mywafer<< endm;
00942 for (Int_t i=0;i<20;i++)
00943 if (mySsd->isActiveLadder(i)>0) {
00944 for (Int_t j=0; j<mySsd->mLadders[i]->getWaferPerLadder();j++) {
00945 if (mySsd->mLadders[i]->mWafers[j]->getIdWafer()==mywafer) {
00946 found=1;
00947
00948 if (mySsd->mLadders[i]->mWafers[j]->getStripP()->getSize()==0) {
00949 LOG_DEBUG <<"PrintStripDetails() - No strip on the P-side of this wafer "<< endm;
00950 }
00951 else {
00952 LOG_DEBUG<<"PrintStripDetails() - "
00953 <<mySsd->mLadders[i]->mWafers[j]->getStripP()->getSize()<<" strip(s) on the P-side of this wafer "<< endm;
00954 LOG_DEBUG<<"PrintStripDetails() - Strip/Adc/Ped/Noise/Analog"<< endm;
00955 StSsdStrip *pStripP = mySsd->mLadders[i]->mWafers[j]->getStripP()->first();
00956 while (pStripP){
00957 LOG_DEBUG<<"PrintStripDetails() - "
00958 <<pStripP->getNStrip()<<" "
00959 <<pStripP->getDigitSig()<<" "
00960 <<pStripP->getPedestal()<<" "
00961 <<pStripP->getSigma()<<" "
00962 <<pStripP->getAnalogSig()<<" "
00963 <<endm;
00964 for(Int_t e=0;e<5;e++){printf("e=%d idMcHit=%d idMcTrack=%d\n",e,pStripP->getIdMcHit(e),pStripP->getIdMcTrack(e));}
00965 pStripP = mySsd->mLadders[i]->mWafers[j]->getStripP()->next(pStripP);
00966 }
00967 }
00968
00969 if (mySsd->mLadders[i]->mWafers[j]->getStripN()->getSize()==0) {
00970 LOG_DEBUG <<"PrintStripDetails() - No strip on the N-side of this wafer "<< endm;
00971 }
00972 else {
00973 LOG_DEBUG<<"PrintStripDetails() - "
00974 <<mySsd->mLadders[i]->mWafers[j]->getStripN()->getSize()<<" strip(s) on the N-side of this wafer "<< endm;
00975 LOG_DEBUG <<"StSsdPointMaker::PrintStripDetails() - Strip/Adc/Ped/Noise/Analog"<< endm;
00976 StSsdStrip *pStripN = mySsd->mLadders[i]->mWafers[j]->getStripN()->first();
00977 while (pStripN){
00978 LOG_DEBUG<<"PrintStripDetails() - "
00979 <<pStripN->getNStrip()<<" "
00980 <<pStripN->getDigitSig()<<" "
00981 <<pStripN->getPedestal()<<" "
00982 <<pStripN->getSigma()<<" "
00983 <<pStripN->getAnalogSig()<<" "
00984 <<endm;
00985 for(Int_t e=0;e<5;e++){printf("e=%d idMcHit=%d idMcTrack=%d\n",e,pStripN->getIdMcHit(e),pStripN->getIdMcTrack(e));}
00986 pStripN = mySsd->mLadders[i]->mWafers[j]->getStripN()->next(pStripN);
00987 }
00988 }
00989 }
00990 }
00991 }
00992 if (found==0) {LOG_DEBUG <<"PrintStripDetails() - Wafer not found !!!"<<endm;}
00993 }
00994
00995 void StSsdPointMaker::PrintClusterDetails(StSsdBarrel *mySsd, Int_t mywafer)
00996 {
00997
00998 Int_t found = 0;
00999 LOG_INFO <<"PrintClusterDetails() - Wafer "<<mywafer<< endm;
01000 for (Int_t i=0;i<20;i++)
01001 if (mySsd->isActiveLadder(i)>0) {
01002 for (Int_t j=0; j<mySsd->mLadders[i]->getWaferPerLadder();j++) {
01003 if (mySsd->mLadders[i]->mWafers[j]->getIdWafer()==mywafer) {
01004 found=1;
01005
01006 if (mySsd->mLadders[i]->mWafers[j]->getClusterP()->getSize()==0) {
01007 LOG_INFO <<"PrintClusterDetails() - No cluster on the P-side of this wafer "<< endm;
01008 }
01009 else {
01010 LOG_INFO<<"PrintClusterDetails() - "
01011 <<mySsd->mLadders[i]->mWafers[j]->getClusterP()->getSize()<<" cluster(s) on the P-side of this wafer "<< endm;
01012 LOG_INFO<<"PrintClusterDetails() - Cluster/Flag/Size/1st Strip/Strip Mean/TotAdc/1st Adc/Last Adc/TotNoise"<< endm;
01013 StSsdCluster *pClusterP = mySsd->mLadders[i]->mWafers[j]->getClusterP()->first();
01014 while (pClusterP){
01015 LOG_INFO<<"PrintClusterDetails() - "
01016 <<pClusterP->getNCluster()<<" "
01017 <<pClusterP->getFlag()<<" "
01018 <<pClusterP->getClusterSize()<<" "
01019 <<pClusterP->getFirstStrip()<<" "
01020 <<pClusterP->getStripMean()<<" "
01021 <<pClusterP->getTotAdc()<<" "
01022 <<pClusterP->getFirstAdc()<<" "
01023 <<pClusterP->getLastAdc()<<" "
01024 <<pClusterP->getTotNoise()<<" "
01025 <<endm;
01026 for(Int_t e=0;e<5;e++){printf("e=%d idMcHit=%d \n",e,pClusterP->getIdMcHit(e));}
01027 pClusterP = mySsd->mLadders[i]->mWafers[j]->getClusterP()->next(pClusterP);
01028 }
01029 }
01030
01031 if (mySsd->mLadders[i]->mWafers[j]->getClusterN()->getSize()==0) {
01032 LOG_INFO <<"PrintClusterDetails() - No cluster on the N-side of this wafer "<< endm;
01033 }
01034 else {
01035 LOG_INFO<<"PrintClusterDetails() - "
01036 <<mySsd->mLadders[i]->mWafers[j]->getClusterN()->getSize()<<" cluster(s) on the N-side of this wafer "<< endm;
01037 LOG_INFO<<"PrintClusterDetails() - Cluster/Flag/Size/1st Strip/Strip Mean/TotAdc/1st Adc/Last Adc/TotNoise"<< endm;
01038 StSsdCluster *pClusterN = mySsd->mLadders[i]->mWafers[j]->getClusterN()->first();
01039 while (pClusterN){
01040 LOG_INFO<<"PrintClusterDetails() - "
01041 <<pClusterN->getNCluster()<<" "
01042 <<pClusterN->getFlag()<<" "
01043 <<pClusterN->getClusterSize()<<" "
01044 <<pClusterN->getFirstStrip()<<" "
01045 <<pClusterN->getStripMean()<<" "
01046 <<pClusterN->getTotAdc()<<" "
01047 <<pClusterN->getFirstAdc()<<" "
01048 <<pClusterN->getLastAdc()<<" "
01049 <<pClusterN->getTotNoise()<<" "
01050 <<endm;
01051 for(Int_t e=0;e<5;e++){printf("e=%d idMcHit=%d \n",e,pClusterN->getIdMcHit(e));}
01052 pClusterN = mySsd->mLadders[i]->mWafers[j]->getClusterN()->next(pClusterN);
01053 }
01054 }
01055 }
01056 }
01057 }
01058 if (found==0){ LOG_INFO <<"PrintClusterDetails() - Wafer not found !!!"<<endm; }
01059 }
01060
01061
01062 void StSsdPointMaker::PrintPackageDetails(StSsdBarrel *mySsd, Int_t mywafer)
01063 {
01064
01065 Int_t found;
01066 found=0;
01067 LOG_INFO <<"PrintPackageDetails() - Wafer "<<mywafer<< endm;
01068 for (Int_t i=0;i<20;i++)
01069 if (mySsd->isActiveLadder(i)>0) {
01070 for (Int_t j=0; j<mySsd->mLadders[i]->getWaferPerLadder();j++) {
01071 if (mySsd->mLadders[i]->mWafers[j]->getIdWafer()==mywafer) {
01072 found=1;
01073 if (mySsd->mLadders[i]->mWafers[j]->getPackage()->getSize()==0) {
01074 LOG_INFO <<"PrintPackageDetails() - No package in this wafer "<< endm;
01075 }
01076 else {
01077 LOG_INFO <<"PrintPackageDetails() - "<<mySsd->mLadders[i]->mWafers[j]->getPackage()->getSize()<<" package(s) in this wafer "<< endm;
01078 LOG_INFO <<"PrintPackageDetails() - Package/Kind/Size"<< endm;
01079 StSsdPackage *pPack = mySsd->mLadders[i]->mWafers[j]->getPackage()->first();
01080 while (pPack){
01081 LOG_INFO<<"PrintPackageDetails() - "<<pPack->getNPackage()<<" "
01082 <<pPack->getKind()<<" "
01083 <<pPack->getSize()<<" "<<endm;
01084 for (Int_t k=0;k<pPack->getSize();k++) {
01085 LOG_INFO<<"PrintPackageDetails() - "<<k<<" "<<pPack->getMatched(k)<<" "<<pPack->getMatched(k)->getNCluster()<<endm;
01086 }
01087 pPack = mySsd->mLadders[i]->mWafers[j]->getPackage()->next(pPack);
01088 }
01089 }
01090 }
01091 }
01092 }
01093 if (found==0){ LOG_INFO <<"PrintPackageDetails() - Wafer not found !!!"<<endm;}
01094 }
01095
01096
01097 void StSsdPointMaker::PrintPointDetails(StSsdBarrel *mySsd, Int_t mywafer)
01098 {
01099
01100 Int_t found;
01101 found=0;
01102 Float_t convMeVToAdc = (int)pow(2.0,mDynamicControl->getnbitEncoding())/(mDynamicControl->getpairCreationEnergy()*mDynamicControl->getadcDynamic()*mDynamicControl->getnElectronInAMip());
01103 LOG_INFO <<"PrintPointDetails() - Wafer "<<mywafer<< endm;
01104 for (Int_t i=0;i<20;i++)
01105 if (mySsd->isActiveLadder(i)>0) {
01106 for (Int_t j=0; j<mySsd->mLadders[i]->getWaferPerLadder();j++) {
01107 if (mySsd->mLadders[i]->mWafers[j]->getIdWafer()==mywafer) {
01108 found=1;
01109 if (mySsd->mLadders[i]->mWafers[j]->getPoint()->getSize()==0) {
01110 LOG_INFO <<"PrintPointDetails() - No hit in this wafer "<< endm;
01111 }
01112 else {
01113 LOG_INFO<<"PrintPointDetails() - "<<mySsd->mLadders[i]->mWafers[j]->getPoint()->getSize()<<" hit(s) in this wafer "<< endm;
01114
01115 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;
01116 StSsdPoint *pSpt = mySsd->mLadders[i]->mWafers[j]->getPoint()->first();
01117 while (pSpt){
01118 Float_t a = 0, b = 0;
01119 a = convMeVToAdc*(pSpt->getDe(0)+pSpt->getDe(1));
01120 b = convMeVToAdc*(pSpt->getDe(0)-pSpt->getDe(1));
01121 LOG_INFO<<"PrintPointDetails() - "
01122 <<pSpt->getNPoint() <<" "
01123 <<pSpt->getFlag() <<" "
01124 <<pSpt->getNMatched() <<" "
01125 <<pSpt->getIdClusterP()<<" "
01126 <<pSpt->getIdClusterN()<<" "
01127 <<pSpt->getNMchit(0) <<" "
01128 <<pSpt->getNMchit(1) <<" "
01129 <<pSpt->getNMchit(2) <<" "
01130 <<pSpt->getNMchit(3) <<" "
01131 <<pSpt->getNMchit(4) <<" "
01132 <<pSpt->getXg(0) <<" "
01133 <<pSpt->getXg(1) <<" "
01134 <<pSpt->getXg(2) <<" "
01135 <<pSpt->getXl(0) <<" "
01136 <<pSpt->getXl(1) <<" "
01137 <<pSpt->getXl(2) <<" "
01138 <<a <<" "
01139 <<b <<" "
01140 <<endm;
01141 printf("pulseP =%f pulseN = %f\n",a,b);
01142 pSpt = mySsd->mLadders[i]->mWafers[j]->getPoint()->next(pSpt);
01143 }
01144 }
01145 }
01146 }
01147 }
01148 if (found==0) {LOG_INFO <<"PrintPointDetails() - Wafer not found !!!"<<endm; }
01149 }
01150
01151
01152 void StSsdPointMaker::PrintInfo()
01153 {
01154 if (Debug()) StMaker::PrintInfo();
01155 }
01156
01157 void StSsdPointMaker::Read_Strip(St_ssdStripCalib *strip_calib)
01158 {
01159 ssdStripCalib_st *noise = strip_calib->GetTable();
01160 Int_t mSsdLayer = 7;
01161 LOG_INFO << "Read_Strip : printing few pedestal/noise values " << endm;
01162 Int_t idWaf = 0;
01163 Int_t iWaf = 0;
01164 Int_t iLad = 0;
01165 Int_t iZero = 0;
01166 Int_t nStrip = 0;
01167 Int_t iSide = 0;
01168 Int_t iOver = 0;
01169 Int_t iUnder = 0;
01170 Int_t iGood = 0;
01171 for (Int_t i = 0 ; i < strip_calib->GetNRows(); i++)
01172 {
01173 if (noise[i].id>0 && noise[i].id<=76818620) {
01174 nStrip = (int)(noise[i].id/100000.);
01175 idWaf = noise[i].id-10000*((int)(noise[i].id/10000.));
01176 iWaf = (int)((idWaf - mSsdLayer*1000)/100 - 1);
01177 iLad = (int)(idWaf - mSsdLayer*1000 - (iWaf+1)*100 - 1);
01178 iSide = (noise[i].id - nStrip*100000 - idWaf)/10000;
01179 if (iLad==11 && iWaf==8 && nStrip <10) {
01180 LOG_DEBUG<<"ReadStrip: iLad,idWaf,nStrip,iSide,pedestal,rms = "<<iLad
01181 <<" "<<idWaf
01182 <<" "<<nStrip
01183 <<" "<<iSide
01184 <<" "<<(float)(noise[i].pedestals)
01185 <<" "<<(float)(noise[i].rms)<<endm;
01186 iGood++;
01187 }
01188 }
01189 else {
01190 if (noise[i].id<0) iUnder++;
01191 else {
01192 if (noise[i].id==0) iZero++;
01193 else iOver++;
01194 }
01195 }
01196 }
01197 LOG_INFO<<"ReadStrip: Number of rows in the table : "<<strip_calib->GetNRows()<<endm;
01198 LOG_INFO<<"ReadStrip: Number of good id : "<<iGood<<endm;
01199 LOG_INFO<<"ReadStrip: Number of id = 0 : "<<iZero<<endm;
01200 if (iUnder>0){
01201 LOG_WARN <<"ReadStrip: Number of underf : "<<iUnder<<endm;}
01202 if (iOver>0){
01203 LOG_WARN <<"ReadStrip: Number of overf : "<<iOver<<endm;}
01204 }
01205
01206
01207 void StSsdPointMaker::Read_Strip(St_ssdNoise *strip)
01208 {
01209 ssdNoise_st *noise = strip->GetTable();
01210 LOG_INFO << " ReadStrip : printing few pedestal/noise values "<< endm;
01211 Int_t mNWaferPerLadder = 16;
01212 Int_t iWaf = 0;
01213 Int_t iLad = 0;
01214 for (Int_t i = 0 ; i < strip->GetNRows(); i++)
01215 {
01216 iWaf = noise[i].id-(noise[i].id/mNWaferPerLadder)*mNWaferPerLadder;
01217 iLad = noise[i].id/16;
01218 Int_t idWaf = noise[i].id;
01219 if (idWaf==1)
01220 {
01221 for(Int_t nStrip=0;nStrip<10;nStrip++)
01222 {
01223 LOG_DEBUG<<"ReadStrip: iLad,idWaf,nStrip,rmsP,rmsN = "<<iLad+1
01224 <<" "<<idWaf+1
01225 <<" "<<nStrip
01226 <<" "<<(int)(noise[i].rmsp[nStrip])
01227 <<" "<<(int)(noise[i].rmsn[nStrip])<<endm;
01228 }
01229 }
01230 }
01231 LOG_INFO<<"ReadStrip: Number of rows in the table : "<<strip->GetNRows()<<endm;
01232 }
01233
01234
01235 void StSsdPointMaker::WriteMatchedStrips(StSsdBarrel *mySsd)
01236 {
01237
01238 Int_t found;
01239 found=0;
01240 for (Int_t i=0;i<20;i++)
01241 if (mySsd->isActiveLadder(i)>0) {
01242 for (Int_t j=0; j<mySsd->mLadders[i]->getWaferPerLadder();j++) {
01243 LOG_DEBUG << " in ladder= "<<i << " wafer = "<<j<<endm;
01244
01245 if (mySsd->mLadders[i]->mWafers[j]->getClusterP()->getSize()==0) {
01246 }
01247 else{
01248 LOG_DEBUG << " Size of the cluster P list = " << mySsd->mLadders[i]->mWafers[j]->getClusterP()->getSize()<<endm;
01249 StSsdCluster *pclusterP = mySsd->mLadders[i]->mWafers[j]->getClusterP()->first();
01250 while (pclusterP)
01251 {
01252 Int_t IdP = pclusterP->getNCluster();
01253
01254 if (mySsd->mLadders[i]->mWafers[j]->getPoint()->getSize()==0) {
01255 if (pclusterP!=mySsd->mLadders[i]->mWafers[j]->getClusterP()->last())
01256 pclusterP = mySsd->mLadders[i]->mWafers[j]->getClusterP()->next(pclusterP);
01257 }
01258 else {
01259 StSsdPoint *pSpt = mySsd->mLadders[i]->mWafers[j]->getPoint()->first();
01260 Int_t stop = 0;
01261 while ((pSpt)&&(stop==0)){
01262 if(IdP==pSpt->getIdClusterP())
01263 {
01264 StSsdStrip *pStripP = mySsd->mLadders[i]->mWafers[j]->getStripP()->first();
01265 StSsdStrip *pStripLastP = mySsd->mLadders[i]->mWafers[j]->getStripP()->last();
01266 while ((pStripP->getNStrip()!=pStripLastP->getNStrip())&&(pStripP->getNStrip()!=pclusterP->getFirstStrip())){
01267 pStripP = mySsd->mLadders[i]->mWafers[j]->getStripP()->next(pStripP);
01268 }
01269 Int_t stripInCluster = pclusterP->getClusterSize();
01270 Int_t k = 0;
01271 while(k<stripInCluster){
01272 LOG_DEBUG<<"PrintStripDetails() - "
01273 << k << " "
01274 <<pStripP->getNStrip()<<" "
01275 <<pStripP->getDigitSig()<<" "
01276 <<pStripP->getPedestal()<<" "
01277 <<pStripP->getSigma()<<" "
01278 <<endm;
01279 StripsIn[0] = 0;
01280 StripsIn[1] = i+1;
01281 StripsIn[2] = j+1;
01282 StripsIn[3] = pStripP->getNStrip();
01283 StripsIn[4] = pStripP->getPedestal();
01284 StripsIn[5] = pStripP->getDigitSig();
01285 StripsIn[6] = pStripP->getSigma();
01286 StripsIn[7] = (float)(pStripP->getDigitSig()/pStripP->getSigma());
01287 rHitNtuple->Fill(StripsIn);
01288 k++;
01289 stop=1;
01290 pStripP = mySsd->mLadders[i]->mWafers[j]->getStripP()->next(pStripP);
01291 }
01292 }
01293 pSpt = mySsd->mLadders[i]->mWafers[j]->getPoint()->next(pSpt);
01294 }
01295 }
01296 pclusterP = mySsd->mLadders[i]->mWafers[j]->getClusterP()->next(pclusterP);
01297 }
01298 }
01299 if (mySsd->mLadders[i]->mWafers[j]->getClusterP()->getSize()==0) {
01300 }
01301 else{
01302 LOG_DEBUG << " Size of the cluster N list = " << mySsd->mLadders[i]->mWafers[j]->getClusterN()->getSize()<<endm;
01303 StSsdCluster *pclusterN = mySsd->mLadders[i]->mWafers[j]->getClusterN()->first();
01304 while (pclusterN)
01305 {
01306 Int_t IdN = pclusterN->getNCluster();
01307 if (mySsd->mLadders[i]->mWafers[j]->getPoint()->getSize()==0) {
01308 if (pclusterN!=mySsd->mLadders[i]->mWafers[j]->getClusterN()->last())
01309 pclusterN = mySsd->mLadders[i]->mWafers[j]->getClusterN()->next(pclusterN);
01310 }
01311 else {
01312 StSsdPoint *pSpt = mySsd->mLadders[i]->mWafers[j]->getPoint()->first();
01313 Int_t stop = 0;
01314 while ((pSpt)&&(stop==0)){
01315 if(IdN==pSpt->getIdClusterN())
01316 {
01317 StSsdStrip *pStripN = mySsd->mLadders[i]->mWafers[j]->getStripN()->first();
01318 StSsdStrip *pStripLastN = mySsd->mLadders[i]->mWafers[j]->getStripN()->last();
01319 while ((pStripN->getNStrip()!=pStripLastN->getNStrip())&&(pStripN->getNStrip()!=pclusterN->getFirstStrip())){
01320 pStripN = mySsd->mLadders[i]->mWafers[j]->getStripN()->next(pStripN);
01321 }
01322 Int_t stripInClusterN = pclusterN->getClusterSize();
01323 Int_t kk = 0;
01324 while(kk<stripInClusterN){
01325 LOG_DEBUG<<"PrintStripDetails() - "
01326 << kk << " "
01327 <<pStripN->getNStrip()<<" "
01328 <<pStripN->getDigitSig()<<" "
01329 <<pStripN->getPedestal()<<" "
01330 <<pStripN->getSigma()<<" "
01331 <<endm;
01332 StripsIn[0] = 1;
01333 StripsIn[1] = i+1;
01334 StripsIn[2] = j+1;
01335 StripsIn[3] = pStripN->getNStrip();
01336 StripsIn[4] = pStripN->getPedestal();
01337 StripsIn[5] = pStripN->getDigitSig();
01338 StripsIn[6] = pStripN->getSigma();
01339 StripsIn[7] = (float)(pStripN->getDigitSig()/pStripN->getSigma());
01340 rHitNtuple->Fill(StripsIn);
01341 kk++;
01342 stop=1;
01343 pStripN = mySsd->mLadders[i]->mWafers[j]->getStripN()->next(pStripN);
01344 }
01345 }
01346 pSpt = mySsd->mLadders[i]->mWafers[j]->getPoint()->next(pSpt);
01347 }
01348 }
01349 pclusterN = mySsd->mLadders[i]->mWafers[j]->getClusterN()->next(pclusterN);
01350 }
01351 }
01352 }
01353 }
01354 }
01355
01356 void StSsdPointMaker::WriteMatchedClusters(StSsdBarrel *mySsd)
01357 {
01358
01359 Int_t found;
01360 found=0;
01361 Int_t clusP = 0;
01362 Int_t clusN = 0;
01363 for (Int_t i=0;i<20;i++)
01364 if (mySsd->isActiveLadder(i)>0) {
01365 for (Int_t j=0; j<mySsd->mLadders[i]->getWaferPerLadder();j++) {
01366 LOG_DEBUG << " in ladder= "<<i << " wafer = "<<j<<endm;
01367 if (mySsd->mLadders[i]->mWafers[j]->getClusterP()->getSize()==0) {
01368 }
01369 else{
01370 LOG_DEBUG << " Size of the cluster P list = " << mySsd->mLadders[i]->mWafers[j]->getClusterP()->getSize()<<endm;
01371 StSsdCluster *pclusterP = mySsd->mLadders[i]->mWafers[j]->getClusterP()->first();
01372 while (pclusterP)
01373 {
01374 LOG_DEBUG << " clusterId= " << pclusterP->getNCluster()<< endm;
01375 Int_t IdP = pclusterP->getNCluster();
01376 LOG_DEBUG << " we are looking for clusterId= " << pclusterP->getNCluster()<< endm;
01377 if (mySsd->mLadders[i]->mWafers[j]->getPoint()->getSize()==0) {
01378 pclusterP = mySsd->mLadders[i]->mWafers[j]->getClusterP()->next(pclusterP);
01379 }
01380 else {
01381 StSsdPoint *pSpt = mySsd->mLadders[i]->mWafers[j]->getPoint()->first();
01382 while (pSpt){
01383 if(IdP==pSpt->getIdClusterP())
01384 {
01385 clusP++;
01386 LOG_DEBUG << "ok found the corresponding hit to this cluster id = "<<pSpt->getIdClusterP()<<endm;
01387 ClustupleIn[0] = 0;
01388 ClustupleIn[1] = i+1;
01389 ClustupleIn[2] = j+1;
01390 ClustupleIn[3] = pclusterP->getClusterSize();
01391 ClustupleIn[4] = ((pclusterP->getTotAdc()*pclusterP->getClusterSize())/pclusterP->getTotNoise());
01392 ClustupleIn[5] = pclusterP->getTotNoise()/pclusterP->getClusterSize();
01393 ClustupleIn[6] = pclusterP->getFirstStrip();
01394 ClustupleIn[7] = pclusterP->getTotAdc();
01395 ClustupleIn[8] = pclusterP->getFirstAdc();
01396 ClustupleIn[9] = pclusterP->getLastAdc();
01397 ClustupleIn[10]= pclusterP->getTotNoise();
01398 pHitNtuple->Fill(ClustupleIn);
01399
01400 }
01401 pSpt = mySsd->mLadders[i]->mWafers[j]->getPoint()->next(pSpt);
01402 }
01403 pclusterP = mySsd->mLadders[i]->mWafers[j]->getClusterP()->next(pclusterP);
01404 }
01405 }
01406 clusP = 0;
01407 }
01408 if (mySsd->mLadders[i]->mWafers[j]->getClusterN()->getSize()==0) {
01409 }
01410 else{
01411 LOG_DEBUG << " Size of the cluster N list = " << mySsd->mLadders[i]->mWafers[j]->getClusterN()->getSize()<<endm;
01412 StSsdCluster *pclusterN = mySsd->mLadders[i]->mWafers[j]->getClusterN()->first();
01413 while (pclusterN)
01414 {
01415
01416 Int_t IdN = pclusterN->getNCluster();
01417
01418 if (mySsd->mLadders[i]->mWafers[j]->getPoint()->getSize()==0) {
01419 pclusterN = mySsd->mLadders[i]->mWafers[j]->getClusterN()->next(pclusterN);
01420 }
01421 else {
01422 StSsdPoint *pSpt = mySsd->mLadders[i]->mWafers[j]->getPoint()->first();
01423 while (pSpt){
01424 if(IdN==pSpt->getIdClusterN())
01425 {
01426 clusN++;
01427 LOG_DEBUG << "ok found the corresponding hit to this cluster id = "<<pSpt->getIdClusterN()<<endm;
01428 ClustupleIn[0] = 1;
01429 ClustupleIn[1] = i+1;
01430 ClustupleIn[2] = j+1;
01431 ClustupleIn[3] = pclusterN->getClusterSize();
01432 ClustupleIn[4] = ((pclusterN->getTotAdc()*pclusterN->getClusterSize())/pclusterN->getTotNoise());
01433 ClustupleIn[5] = pclusterN->getTotNoise()/pclusterN->getClusterSize();
01434 ClustupleIn[6] = pclusterN->getFirstStrip();
01435 ClustupleIn[7] = pclusterN->getTotAdc();
01436 ClustupleIn[8] = pclusterN->getFirstAdc();
01437 ClustupleIn[9] = pclusterN->getLastAdc();
01438 ClustupleIn[10]= pclusterN->getTotNoise();
01439 pHitNtuple->Fill(ClustupleIn);
01440
01441 }
01442 pSpt = mySsd->mLadders[i]->mWafers[j]->getPoint()->next(pSpt);
01443 }
01444 pclusterN = mySsd->mLadders[i]->mWafers[j]->getClusterN()->next(pclusterN);
01445 }
01446 }
01447 clusN = 0;
01448 }
01449 }
01450 }
01451 LOG_DEBUG << "Number of p-side clusters in hits = " << clusP << endm ;
01452 LOG_DEBUG << "Number of n-side clusters in hits = " << clusN << endm ;
01453 }
01454
01455 void StSsdPointMaker::EvaluateEfficiency(StSsdBarrel *mySsd)
01456 {
01457
01458 Int_t found;
01459 found=0;
01460 Int_t clusP = 0;
01461 Int_t clusN = 0;
01462 for (Int_t i=0;i<20;i++)
01463 if (mySsd->isActiveLadder(i)>0) {
01464 for (Int_t j=0; j<mySsd->mLadders[i]->getWaferPerLadder();j++) {
01465 if (mySsd->mLadders[i]->mWafers[j]->getClusterP()->getSize()==0) {
01466 }
01467 else{
01468 StSsdCluster *pclusterP = mySsd->mLadders[i]->mWafers[j]->getClusterP()->first();
01469 while (pclusterP)
01470 {
01471 Int_t IdP = pclusterP->getNCluster();
01472 if (mySsd->mLadders[i]->mWafers[j]->getPoint()->getSize()==0) {
01473 pclusterP = mySsd->mLadders[i]->mWafers[j]->getClusterP()->next(pclusterP);
01474 }
01475 else {
01476 StSsdPoint *pSpt = mySsd->mLadders[i]->mWafers[j]->getPoint()->first();
01477 while (pSpt){
01478 if(IdP==pSpt->getIdClusterP())
01479 {
01480 clusP++;
01481
01482 }
01483 pSpt = mySsd->mLadders[i]->mWafers[j]->getPoint()->next(pSpt);
01484 }
01485 pclusterP = mySsd->mLadders[i]->mWafers[j]->getClusterP()->next(pclusterP);
01486 }
01487 }
01488 ratioP[i][j]+=(float)clusP/mySsd->mLadders[i]->mWafers[j]->getClusterP()->getSize();
01489 clusP = 0;
01490 }
01491 if (mySsd->mLadders[i]->mWafers[j]->getClusterN()->getSize()==0) {
01492 }
01493 else{
01494 StSsdCluster *pclusterN = mySsd->mLadders[i]->mWafers[j]->getClusterN()->first();
01495 while (pclusterN)
01496 {
01497 Int_t IdN = pclusterN->getNCluster();
01498 if (mySsd->mLadders[i]->mWafers[j]->getPoint()->getSize()==0) {
01499 pclusterN = mySsd->mLadders[i]->mWafers[j]->getClusterN()->next(pclusterN);
01500 }
01501 else {
01502 StSsdPoint *pSpt = mySsd->mLadders[i]->mWafers[j]->getPoint()->first();
01503 while (pSpt){
01504 if(IdN==pSpt->getIdClusterN())
01505 {
01506 clusN++;
01507
01508 }
01509 pSpt = mySsd->mLadders[i]->mWafers[j]->getPoint()->next(pSpt);
01510 }
01511 pclusterN = mySsd->mLadders[i]->mWafers[j]->getClusterN()->next(pclusterN);
01512 }
01513 }
01514 ratioN[i][j]+=(float)clusN/mySsd->mLadders[i]->mWafers[j]->getClusterN()->getSize();
01515 clusN = 0;
01516 }
01517 }
01518 }
01519 }
01520
01521 void StSsdPointMaker::NormalizeEfficiency(){
01522 Double_t NClusP = 0;
01523 Double_t NClusN = 0;
01524 for(Int_t ii=0 ;ii< 20 ;ii++)
01525 {
01526 for(Int_t jj=0 ;jj<16;jj++)
01527 {
01528 NClusP = ratioP[ii][jj];
01529
01530 if(NEvent!=0){
01531 NClusP = NClusP/NEvent;
01532 MatchedClusterP->SetBinContent(ii+1,jj+1,NClusP);}
01533 NClusN = ratioN[ii][jj];
01534 if(NEvent!=0){
01535
01536 NClusN = NClusN/NEvent;
01537 MatchedClusterN->SetBinContent(ii+1,jj+1,NClusN);}
01538 }
01539 }
01540 }
01541
01542 void StSsdPointMaker::FillCalibTable(){
01543 mGain = (St_ssdGainCalibWafer*)GetDataBase("Calibrations/ssd/ssdGainCalibWafer");
01544 if(mGain){
01545 ssdGainCalibWafer_st *g = mGain->GetTable() ;
01546 Int_t size = mGain->GetNRows();
01547 LOG_INFO<<Form("Size of gain table = %d",mGain->GetNRows())<<endm;
01548 for(Int_t i=0; i<size;i++){
01549 LOG_DEBUG<<Form(" Print entry %d : ladder=%d gain =%lf wafer=%d",i,g[i].nLadder,g[i].nGain,g[i].nWafer)<<endm;
01550 CalibArray[i] = g[i].nGain;
01551 }
01552 }
01553 else {
01554 LOG_WARN << "InitRun : No access to Gain Calib - will use the default gain" << endm;
01555 LOG_WARN << "We will use the default table" <<endm;
01556 for(Int_t i=0; i<320;i++){
01557 CalibArray[i] = 1;
01558 }
01559 }
01560 }
01561
01562 void StSsdPointMaker::FillDefaultCalibTable(){
01563 LOG_INFO << " The calibration gain will not be used." << endm;
01564 for(Int_t i=0; i<320;i++){
01565 CalibArray[i] = 1;
01566
01567 }
01568 }
01569
01570 void StSsdPointMaker::FillWaferTable(){
01571 mWafConfig = (St_ssdWaferConfiguration*) GetDataBase("Calibrations/ssd/ssdWaferConfiguration");
01572 if(mWafConfig){
01573 ssdWaferConfiguration_st *g = mWafConfig->GetTable() ;
01574 Int_t size = mWafConfig->GetNRows();
01575 for(Int_t i=0; i<size;i++){
01576 LOG_DEBUG<<Form(" Print entry=%d : ladder=%d wafer=%d status=%d",i,g[i].nLadder,g[i].nWafer,g[i].nStatus)<<endm;
01577 WafStatus[g[i].nLadder][g[i].nWafer] = g[i].nStatus;
01578 }
01579 }
01580 else {
01581 LOG_WARN << "InitRun : No access to Wafer Config - will use the default wafer config" << endm;
01582 LOG_WARN << "We will use the default table" <<endm;
01583 for(Int_t i=0; i<20;i++){
01584 for(Int_t j=0; j<16;j++){
01585 WafStatus[i][j] = 1;
01586 }
01587 }
01588 }
01589 }
01590
01591 void StSsdPointMaker::FillDefaultWaferTable(){
01592 LOG_INFO << " The wafer configuration table will not be used." << endm;
01593 for(Int_t i=0; i<20;i++){
01594 for(Int_t j=0; i<16;j++){
01595 WafStatus[i][j] = 1;
01596 LOG_DEBUG << Form("wafer=%d gain=%f",i,CalibArray[i])<<endm;
01597 }
01598 }
01599 }
01600
01601
01602 Int_t StSsdPointMaker::ReadNoiseTable(StSsdBarrel *mySsd,Int_t year){
01603 Int_t noiseTableSize = 0;
01604
01605
01606 if((year<7)||(mode==1))
01607 {
01608 if (!m_noise2)
01609 {
01610 LOG_WARN << "Make : No pedestal and noise values (ssdStripCalib table missing), will use default values" <<endm;
01611 noiseTableSize = mySsd->readNoiseDefault(mDynamicControl);
01612 }
01613 else
01614 {
01615 if(Debug()) {Read_Strip(m_noise2);}
01616 noiseTableSize = mySsd->readNoiseFromTable(m_noise2,mDynamicControl);
01617 }
01618 }
01619 else if (year>=7){
01620 if(!m_noise3)
01621 {
01622 LOG_WARN << "Make : No pedestal and noise values (ssdNoise table missing), will use default values" << endm;
01623 noiseTableSize = mySsd->readNoiseDefault(mDynamicControl);
01624 }
01625 else
01626 if(m_noise3)
01627 {
01628 if (Debug()){Read_Strip(m_noise3);}
01629 noiseTableSize = mySsd->readNoiseFromTable(m_noise3,mDynamicControl);
01630 }
01631 }
01632 return noiseTableSize;
01633 }
01634
01635 Int_t StSsdPointMaker::Finish() {
01636 LOG_INFO << Form("Finish()") << endm;
01637 return kStOK;
01638 }
01639