StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StSstPointMaker.cxx
1 //$Id: StSstPointMaker.cxx,v 1.3 2017/04/26 20:17:45 perev Exp $
2 //
3 //$Log: StSstPointMaker.cxx,v $
4 //Revision 1.3 2017/04/26 20:17:45 perev
5 //Hide m_DataSet
6 //
7 //Revision 1.2 2016/05/27 15:20:38 bouchet
8 //coverity DEAD_CODE fixed ; cleanup cout
9 //
10 //Revision 1.1 2015/06/23 16:29:04 jeromel
11 //Version of the SSD code for the SST - strated revision 1
12 //
13 //Revision 1.16 2015/06/18 22:29:29 bouchet
14 //CPP-CHECK : C-style coding ; cleanup : removed unused libraries and variables ; init ctor ; replace ROOT types by C++ types
15 //
16 //Revision 1.15 2015/06/10 14:06:58 bouchet
17 //reflect changes in StSstDbMaker : slsCtrl table retrieved from StSstDbMaker
18 //
19 //Revision 1.14 2015/05/23 20:53:13 bouchet
20 //writePointToContainer() needs StSstDynamicControl for ADC hit calculation
21 //
22 //Revision 1.13 2015/05/15 18:33:05 bouchet
23 //possible infinite loop fixed
24 //
25 //Revision 1.12 2015/05/08 14:16:32 bouchet
26 //typo ssd --> sst for sstStripCalib path in DB ; cosmetic
27 //
28 //Revision 1.11 2015/05/02 15:36:27 bouchet
29 //StSstBarrel object is cleared at the end of the current event ONLY if StSstTupleMaker is not in the chain
30 //
31 //Revision 1.10 2015/05/01 19:11:09 bouchet
32 //cleanup
33 //
34 //Revision 1.9 2015/04/30 18:16:46 bouchet
35 //add protection against null spa_strip, some cosmetics and cleanup
36 //
37 //Revision 1.7 2015/04/28 15:59:54 bouchet
38 //remove old methods, update ctor, update methods to fill gain calib and wafer status, cleanup
39 //
40 //Revision 1.6 2015/04/27 14:07:38 bouchet
41 //remove mode member from sstStripCalib (was first version) ; cleanup
42 //
43 //Revision 1.5 2015/04/26 17:56:36 bouchet
44 //ChipGain calibration methods removed ; cleanup
45 //
46 //Revision 1.4 2015/04/21 22:05:48 bouchet
47 //prototype methods to use sstGainCalibChip, remove unused arrays, typos ssd -> sst, print the # of events processed by the maker
48 //
49 //Revision 1.2 2015/04/20 19:02:34 bouchet
50 //remove spa_strip (unused) when writing points to container
51 //
52 //Revision 1.1 2015/04/19 18:52:10 bouchet
53 //initial commit ; SST classes only
54 //
55 //fork from the SSD code, move along - see history therein
56 #include "StSstPointMaker.h"
57 #include "TDataSetIter.h"
58 #include "StMessMgr.h"
59 #include "StSstUtil/StSstPoint.hh"
60 #include "StSstUtil/StSstPackage.hh"
61 #include "StSstUtil/StSstCluster.hh"
62 #include "StSstUtil/StSstStripList.hh"
63 #include "StSstUtil/StSstClusterList.hh"
64 #include "StSstUtil/StSstPointList.hh"
65 #include "StSstUtil/StSstPackageList.hh"
66 #include "StSstUtil/StSstWafer.hh"
67 #include "StSstUtil/StSstLadder.hh"
68 #include "StSstUtil/StSstBarrel.hh"
69 #include "StSstUtil/StSstStrip.hh"
70 #include "tables/St_spa_strip_Table.h"
71 #include "tables/St_scf_cluster_Table.h"
72 #include "tables/St_scm_spt_Table.h"
73 #include "tables/St_sstSlsCtrl_Table.h"
74 #include "tables/St_sstClusterControl_Table.h"
75 #include "tables/St_sstDimensions_Table.h"
76 #include "tables/St_sstStripCalib_Table.h"
77 #include "tables/St_sstGainCalibWafer_Table.h"
78 #include "tables/St_sstNoise_Table.h"
79 #include "tables/St_sstWaferConfiguration_Table.h"
80 #include "StEvent.h"
81 #include "StSstHitCollection.h"
82 #include "StSsdDbMaker/StSsdDbMaker.h"
83 #include "StSsdDbMaker/StSstDbMaker.h"
84 #include "StSstUtil/StSstConsts.h"
85 #include "TMath.h"
86 ClassImp(StSstPointMaker);
87 
88 StSstPointMaker::StSstPointMaker(const char *name):
89  StMaker(name), mGain(0), mWafConfig(0), mPedRmsData(0),
90  mCtrl(0), mClusterCtrl(0),
91  mDynamicControl(0), mClusterControl(0)
92 {
93  memset(mCalibArray,0,sizeof(mCalibArray));
94  memset(mWaferStatus,0,sizeof(mWaferStatus));
95  mEventCounter =0;
96 }
97 //_____________________________________________________________________________
98 Int_t StSstPointMaker::Init(){
99  return StMaker::Init();
100 }
101 //_____________________________________________________________________________
102 Int_t StSstPointMaker::InitRun(int runumber) {
103  mCtrl = gStSstDbMaker->getSlsCtrl();
104  if(!mCtrl){LOG_ERROR << "InitRun : No access to slsCtrl table" << endm;}
105  else {
106  mDynamicControl = new StSstDynamicControl();
107  mDynamicControl -> setnElectronInAMip(mCtrl->nElectronInAMip);
108  mDynamicControl -> setadcDynamic(mCtrl->adcDynamic);
109  mDynamicControl -> seta128Dynamic(mCtrl->a128Dynamic);
110  mDynamicControl -> setnbitEncoding(mCtrl->nbitEncoding);
111  mDynamicControl -> setnstripInACluster(mCtrl->nstripInACluster);
112  mDynamicControl -> setpairCreationEnergy(mCtrl->pairCreationEnergy);
113  mDynamicControl -> setparDiffP(mCtrl->parDiffP);
114  mDynamicControl -> setparDiffN(mCtrl->parDiffN);
115  mDynamicControl -> setparIndRightP(mCtrl->parIndRightP);
116  mDynamicControl -> setparIndRightN(mCtrl->parIndRightN);
117  mDynamicControl -> setparIndLeftP(mCtrl->parIndLeftP);
118  mDynamicControl -> setparIndLeftN(mCtrl->parIndLeftN);
119  mDynamicControl -> setdaqCutValue(mCtrl->daqCutValue);
120  mDynamicControl -> printParameters();
121  }
122  mClusterCtrl = ((St_sstClusterControl *) GetInputDB("Geometry/sst/sstClusterControl"))->GetTable();
123  if (!mClusterCtrl) {LOG_ERROR << "InitRun : No access to clusterControl table" << endm;}
124  else {
125  mClusterControl = new StSstClusterControl();
126  mClusterControl -> setHighCut(mClusterCtrl->highCut);
127  mClusterControl -> setTestTolerance(mClusterCtrl->testTolerance);
128  mClusterControl -> setClusterTreat(mClusterCtrl->clusterTreat);
129  mClusterControl -> setAdcTolerance(mClusterCtrl->adcTolerance);
130  mClusterControl -> setMatchMean(mClusterCtrl->matchMean);
131  mClusterControl -> setMatchSigma(mClusterCtrl->matchSigma);
132  mClusterControl -> printParameters();
133  }
134 
135  St_sstStripCalib *mPedRms = (St_sstStripCalib*) GetDataBase("Calibrations/sst/sstStripCalib");
136  if (!mPedRms) {LOG_ERROR << "InitRun : No access to sstStripCalib - will use the default noise and pedestal values" << endm;}
137  else {
138  LOG_INFO<<"InitRun for : (sstStripCalib) is used"<<endm;
139  mPedRmsData = mPedRms->GetTable();
140  std::cout << " size of sstStripTable : " << mPedRms->GetSize() << std::endl;
141  }
142 
143  FillCalibTable();
144  FillWaferTable();
145 
146  return kStOk;
147 }
148 //_____________________________________________________________________________
150 {
151  int res = 0;
152  TDataSet *SpaStrip = GetDataSet("sst_raw");
153 
154  if(! SpaStrip) {
155  LOG_ERROR << "no input data set, wrong chain option" << endm;
156  return kStErr;
157  }
158  St_spa_strip *spa_strip = dynamic_cast<St_spa_strip *> (SpaStrip->Find("spa_strip"));
159 
160  if(!spa_strip || spa_strip->GetNRows()==0){
161  LOG_WARN << "no input (fired strip for the SST)"<<endm;
162  }
163 
164  St_scm_spt *scm_spt = new St_scm_spt("scm_spt",5000);
165  AddData(scm_spt);
166 
167  St_scf_cluster *scf_cluster = new St_scf_cluster("scf_cluster",5000);//09/13
168  AddData(scf_cluster);
169 
170  StEvent *pEvent = (StEvent*) GetInputDS("StEvent");
171  // StSstHitCollection *sstHitCollection;
172  if (!pEvent) {
173  LOG_ERROR << "StSstPointMaker::Make(): There is no StEvent " << endm;
174  return kStErr;
175  }
176  StSstHitCollection *sstHitCollection = pEvent->sstHitCollection();
177  if (!sstHitCollection){
178  LOG_WARN << "The SST hit collection does not exist - creating a new one" << endm;
179  sstHitCollection = new StSstHitCollection;
180  pEvent->setSstHitCollection(sstHitCollection);
181  }
182  LOG_INFO<<"#################################################"<<endm;
183  LOG_INFO<<"#### START OF NEW SST POINT MAKER ####"<<endm;
184  LOG_INFO<<"#### SST BARREL INITIALIZATION ####"<<endm;
185  LOG_INFO<<"#### BEGIN INITIALIZATION ####"<<endm;
186  StSstBarrel *mySst =gStSstDbMaker->getSst();
187  mySst->setClusterControl(mClusterControl);
188  //The full SST object is built only if we are processing physics data
189  if(spa_strip && spa_strip->GetNRows()!=0){
190  int stripTableSize = mySst->readStripFromTable(spa_strip);
191  LOG_INFO<<"#### NUMBER OF SPA STRIPS "<<stripTableSize<<" ####"<<endm;
192  mySst->sortListStrip();
193  //PrintStripSummary(mySst);
194  LOG_INFO<<"#### NUMBER OF DB ENTRIES "<< ReadNoiseTable(mySst) <<" ####"<<endm;
195  int nClusterPerSide[2]={0,0};
196  mySst->doSideClusterisation(nClusterPerSide,mWaferStatus);
197  LOG_INFO<<"#### NUMBER OF CLUSTER P SIDE "<<nClusterPerSide[0]<<" ####"<<endm;
198  LOG_INFO<<"#### NUMBER OF CLUSTER N SIDE "<<nClusterPerSide[1]<<" ####"<<endm;
199  mySst->sortListCluster();
200  int nClusterWritten = mySst->writeClusterToTable(scf_cluster,spa_strip);
201  LOG_INFO<<"#### -> "<<nClusterWritten<<" CLUSTERS WRITTEN INTO TABLE ####"<<endm;
202  //PrintClusterSummary(mySst);
203  //PrintStripDetails(mySst,8310);
204  //PrintClusterDetails(mySst,8310);
205  //debugUnPeu(mySst);
206  int nPackage = mySst->doClusterMatching(mCalibArray);
207  LOG_INFO<<"#### -> "<<nPackage<<" PACKAGES IN THE SST ####"<<endm;
208  mySst->convertDigitToAnalog(mDynamicControl);
209  mySst->convertUFrameToOther();
210  //PrintPointSummary(mySst);
211 
212  //get McEvent here
213  int nSptWritten = 0;
214  StMcEvent* mcEvent = 0;
215  mcEvent = (StMcEvent*) GetDataSet("StMcEvent");
216  if(mcEvent){
217  LOG_DEBUG << " mcEvent exists " << endm;
218  nSptWritten = mySst->writePointToContainer(scm_spt,sstHitCollection,scf_cluster,mDynamicControl,mcEvent);
219  }
220  else{
221  nSptWritten = mySst->writePointToContainer(scm_spt,sstHitCollection,scf_cluster,mDynamicControl);
222  }
223  LOG_INFO<<"#### -> "<<nSptWritten<<" HITS WRITTEN INTO TABLE ####"<<endm;
224  if(sstHitCollection){
225  if (sstHitCollection->numberOfHits()>0){
226  mEventCounter++;
227  LOG_INFO<<"#### -> "<<sstHitCollection->numberOfHits()<<" HITS WRITTEN INTO CONTAINER ####"<<endm;
228  //clean data stream
229  scf_cluster->Purge();
230  scm_spt->Purge();
231  }
232  else {
233  LOG_INFO<<" ######### NO SST HITS WRITTEN INTO CONTAINER ####"<<endm;
234  }
235  }
236  LOG_INFO<<"#### END OF SST NEW POINT MAKER ####"<<endm;
237  LOG_INFO<<"#################################################"<<endm;
238  if (nSptWritten) res = kStOK;
239  }
240  if (!GetMaker("SstTuple")) {
241  //do not delete mySst object since it should be used in StSstMyMONMaker
242  mySst->Reset();
243  }
244  if(res!=kStOK){
245  LOG_WARN <<"Make : no output" << endm;
246  return kStWarn;
247  }
248  return kStOK;
249 }
250 //_____________________________________________________________________________
251 
252 void StSstPointMaker::PrintStripSummary(StSstBarrel *mySst)
253 {
254  int ladderCountN[20]={0};
255  int ladderCountP[20]={0};
256  for (int i=0;i<20;i++)
257  if (mySst->isActiveLadder(i)>0) {
258  for (int j=0; j<mySst->mLadders[i]->getWaferPerLadder();j++) {
259  ladderCountP[i]=ladderCountP[i]+mySst->mLadders[i]->mWafers[j]->getStripP()->getSize();
260  ladderCountN[i]=ladderCountN[i]+mySst->mLadders[i]->mWafers[j]->getStripN()->getSize();
261  }
262  }
263 
264  LOG_INFO <<"PrintStripSummary : Number of raw data in the SST" << endm;
265  LOG_INFO <<"PrintStripSummary : Active Ladders : " << endm;
266  for (int i=0;i<20;i++)
267  if (mySst->isActiveLadder(i)>0) {
268  LOG_DEBUG.width(5);
269  LOG_DEBUG<<i+1;
270  }
271 
272  LOG_DEBUG<<endm;
273  LOG_INFO << "PrintStripSummary : Counts (p-side): " << endm;
274  for (int i=0;i<20;i++)
275  if (mySst->isActiveLadder(i)>0) {
276  LOG_DEBUG.width(5);
277  LOG_DEBUG <<ladderCountP[i];
278  }
279  LOG_DEBUG<<endm;
280  LOG_INFO << "PrintStripSummary : Counts (n-side): " << endm;
281  for (int i=0;i<20;i++)
282  if (mySst->isActiveLadder(i)>0) {
283  LOG_DEBUG.width(5);
284  LOG_DEBUG <<ladderCountN[i];
285  }
286  LOG_DEBUG<<endm;
287 }
288 
289 //_____________________________________________________________________________
290 void StSstPointMaker::debugUnPeu(StSstBarrel *mySst)
291 {
292  int monladder,monwafer;
293  monladder=7;
294  monwafer=6;
295  mySst->debugUnPeu(monladder,monwafer);
296 }
297 
298 //_____________________________________________________________________________
299 void StSstPointMaker::PrintClusterSummary(StSstBarrel *mySst)
300 {
301  int ladderCountN[20]={0};
302  int ladderCountP[20]={0};
303  for (int i=0;i<20;i++)
304  if (mySst->isActiveLadder(i)>0) {
305  for (int j=0; j<mySst->mLadders[i]->getWaferPerLadder();j++) {
306  ladderCountP[i]=ladderCountP[i]+mySst->mLadders[i]->mWafers[j]->getClusterP()->getSize();
307  ladderCountN[i]=ladderCountN[i]+mySst->mLadders[i]->mWafers[j]->getClusterN()->getSize();
308  }
309  }
310 
311  LOG_INFO <<"PrintClusterSummary : Number of clusters in the SST" << endm;
312  LOG_INFO << "PrintClusterSummary : Active Ladders : " << endm;
313  for (int i=0;i<20;i++)
314  if (mySst->isActiveLadder(i)>0) {
315  LOG_DEBUG.width(5);
316  LOG_DEBUG<<i+1;
317  }
318 
319  LOG_DEBUG<<endm;
320  LOG_INFO << "PrintClusterSummary : Counts (p-side): " << endm;
321  for (int i=0;i<20;i++)
322  if (mySst->isActiveLadder(i)>0) {
323  LOG_DEBUG.width(5);
324  LOG_DEBUG <<ladderCountP[i];
325  }
326  LOG_DEBUG<<endm;
327  LOG_INFO << "PrintClusterSummary : Counts (n-side): " << endm;
328  for (int i=0;i<20;i++)
329  if (mySst->isActiveLadder(i)>0) {
330  LOG_DEBUG.width(5);
331  LOG_DEBUG <<ladderCountN[i];
332  }
333  LOG_DEBUG<<endm;
334 }
335 //_____________________________________________________________________________
336 void StSstPointMaker::PrintPointSummary(StSstBarrel *mySst)
337 {
338  int ladderCount[20]={0};
339  int ladderCount11[20]={0};
340  for (int i=0;i<20;i++)
341  if (mySst->isActiveLadder(i)>0) {
342  for (int j=0; j<mySst->mLadders[i]->getWaferPerLadder();j++) {
343  ladderCount[i]=ladderCount[i]+mySst->mLadders[i]->mWafers[j]->getPoint()->getSize();
344  StSstPoint *pSpt = mySst->mLadders[i]->mWafers[j]->getPoint()->first();
345  while (pSpt){
346  if (pSpt->getNMatched()==11) ladderCount11[i]++;
347  pSpt = mySst->mLadders[i]->mWafers[j]->getPoint()->next(pSpt);
348  }
349  }
350  }
351 
352  LOG_INFO<<"PrintPointSummary : Number of hits in the SST" << endm;
353  LOG_INFO<< "PrintPointSummary : Active Ladders : " << endm;
354  for (int i=0;i<20;i++)
355  if (mySst->isActiveLadder(i)>0) {
356  LOG_DEBUG.width(5);
357  LOG_DEBUG<<i+1;
358  }
359 
360  LOG_DEBUG<<endm;
361  LOG_INFO << "PrintPointSummary : Counts : " << endm;
362  for (int i=0;i<20;i++)
363  if (mySst->isActiveLadder(i)>0) {
364  LOG_DEBUG.width(5);
365  LOG_DEBUG <<ladderCount[i];
366  }
367  LOG_DEBUG<<endm;
368  LOG_INFO << "PrintPointSummary : Counts (11) : " << endm;
369  for (int i=0;i<20;i++)
370  if (mySst->isActiveLadder(i)>0) {
371  LOG_DEBUG.width(5);
372  LOG_DEBUG <<ladderCount11[i];
373  }
374  LOG_DEBUG<<endm;
375 }
376 //_____________________________________________________________________________
377 void StSstPointMaker::PrintStripDetails(StSstBarrel *mySst, int mywafer)
378 {
379  int found = 0 ;
380  LOG_DEBUG <<"PrintStripDetails() - Wafer "<<mywafer<< endm;
381  for (int i=0;i<20;i++)
382  if (mySst->isActiveLadder(i)>0) {
383  for (int j=0; j<mySst->mLadders[i]->getWaferPerLadder();j++) {
384  if (mySst->mLadders[i]->mWafers[j]->getIdWafer()==mywafer) {
385  found=1;
386  //Looking for the P-side strip informations
387  if (mySst->mLadders[i]->mWafers[j]->getStripP()->getSize()==0) {
388  LOG_DEBUG <<"PrintStripDetails() - No strip on the P-side of this wafer "<< endm;
389  }
390  else {
391  LOG_DEBUG<<"PrintStripDetails() - "
392  <<mySst->mLadders[i]->mWafers[j]->getStripP()->getSize()<<" strip(s) on the P-side of this wafer "<< endm;
393  LOG_DEBUG<<"PrintStripDetails() - Strip/Adc/Ped/Noise/Analog"<< endm;
394  StSstStrip *pStripP = mySst->mLadders[i]->mWafers[j]->getStripP()->first();
395  while (pStripP){
396  LOG_DEBUG<<"PrintStripDetails() - "
397  <<pStripP->getNStrip()<<" "
398  <<pStripP->getDigitSig()<<" "
399  <<pStripP->getPedestal()<<" "
400  <<pStripP->getSigma()<<" "
401  <<pStripP->getAnalogSig()<<" "
402  <<endm;
403  for(int e=0;e<5;e++){printf("e=%d idMcHit=%d idMcTrack=%d\n",e,pStripP->getIdMcHit(e),pStripP->getIdMcTrack(e));}
404  pStripP = mySst->mLadders[i]->mWafers[j]->getStripP()->next(pStripP);
405  }
406  }
407  //Looking for the N-side strip informations
408  if (mySst->mLadders[i]->mWafers[j]->getStripN()->getSize()==0) {
409  LOG_DEBUG <<"PrintStripDetails() - No strip on the N-side of this wafer "<< endm;
410  }
411  else {
412  LOG_DEBUG<<"PrintStripDetails() - "
413  <<mySst->mLadders[i]->mWafers[j]->getStripN()->getSize()<<" strip(s) on the N-side of this wafer "<< endm;
414  LOG_DEBUG <<"StSstPointMaker::PrintStripDetails() - Strip/Adc/Ped/Noise/Analog"<< endm;
415  StSstStrip *pStripN = mySst->mLadders[i]->mWafers[j]->getStripN()->first();
416  while (pStripN){
417  LOG_DEBUG<<"PrintStripDetails() - "
418  <<pStripN->getNStrip()<<" "
419  <<pStripN->getDigitSig()<<" "
420  <<pStripN->getPedestal()<<" "
421  <<pStripN->getSigma()<<" "
422  <<pStripN->getAnalogSig()<<" "
423  <<endm;
424  for(int e=0;e<5;e++){printf("e=%d idMcHit=%d idMcTrack=%d\n",e,pStripN->getIdMcHit(e),pStripN->getIdMcTrack(e));}
425  pStripN = mySst->mLadders[i]->mWafers[j]->getStripN()->next(pStripN);
426  }
427  }
428  }
429  }
430  }
431  if (found==0) {LOG_DEBUG <<"PrintStripDetails() - Wafer not found !!!"<<endm;}
432 }
433 //_____________________________________________________________________________
434 void StSstPointMaker::PrintClusterDetails(StSstBarrel *mySst, int mywafer)
435 {
436  int found = 0;
437  LOG_INFO <<"PrintClusterDetails() - Wafer "<<mywafer<< endm;
438  for (int i=0;i<20;i++)
439  if (mySst->isActiveLadder(i)>0) {
440  for (int j=0; j<mySst->mLadders[i]->getWaferPerLadder();j++) {
441  if (mySst->mLadders[i]->mWafers[j]->getIdWafer()==mywafer) {
442  found=1;
443  //Looking for the P-side cluster informations
444  if (mySst->mLadders[i]->mWafers[j]->getClusterP()->getSize()==0) {
445  LOG_INFO <<"PrintClusterDetails() - No cluster on the P-side of this wafer "<< endm;
446  }
447  else {
448  LOG_INFO<<"PrintClusterDetails() - "
449  <<mySst->mLadders[i]->mWafers[j]->getClusterP()->getSize()<<" cluster(s) on the P-side of this wafer "<< endm;
450  LOG_INFO<<"PrintClusterDetails() - Cluster/Flag/Size/1st Strip/Strip Mean/TotAdc/1st Adc/Last Adc/TotNoise"<< endm;
451  StSstCluster *pClusterP = mySst->mLadders[i]->mWafers[j]->getClusterP()->first();
452  while (pClusterP){
453  LOG_INFO<<"PrintClusterDetails() - "
454  <<pClusterP->getNCluster()<<" "
455  <<pClusterP->getFlag()<<" "
456  <<pClusterP->getClusterSize()<<" "
457  <<pClusterP->getFirstStrip()<<" "
458  <<pClusterP->getStripMean()<<" "
459  <<pClusterP->getTotAdc()<<" "
460  <<pClusterP->getFirstAdc()<<" "
461  <<pClusterP->getLastAdc()<<" "
462  <<pClusterP->getTotNoise()<<" "
463  <<endm;
464  for(int e=0;e<5;e++){printf("e=%d idMcHit=%d \n",e,pClusterP->getIdMcHit(e));}
465  pClusterP = mySst->mLadders[i]->mWafers[j]->getClusterP()->next(pClusterP);
466  }
467  }
468  //Looking for the N-side cluster informations
469  if (mySst->mLadders[i]->mWafers[j]->getClusterN()->getSize()==0) {
470  LOG_INFO <<"PrintClusterDetails() - No cluster on the N-side of this wafer "<< endm;
471  }
472  else {
473  LOG_INFO<<"PrintClusterDetails() - "
474  <<mySst->mLadders[i]->mWafers[j]->getClusterN()->getSize()<<" cluster(s) on the N-side of this wafer "<< endm;
475  LOG_INFO<<"PrintClusterDetails() - Cluster/Flag/Size/1st Strip/Strip Mean/TotAdc/1st Adc/Last Adc/TotNoise"<< endm;
476  StSstCluster *pClusterN = mySst->mLadders[i]->mWafers[j]->getClusterN()->first();
477  while (pClusterN){
478  LOG_INFO<<"PrintClusterDetails() - "
479  <<pClusterN->getNCluster()<<" "
480  <<pClusterN->getFlag()<<" "
481  <<pClusterN->getClusterSize()<<" "
482  <<pClusterN->getFirstStrip()<<" "
483  <<pClusterN->getStripMean()<<" "
484  <<pClusterN->getTotAdc()<<" "
485  <<pClusterN->getFirstAdc()<<" "
486  <<pClusterN->getLastAdc()<<" "
487  <<pClusterN->getTotNoise()<<" "
488  <<endm;
489  for(int e=0;e<5;e++){printf("e=%d idMcHit=%d \n",e,pClusterN->getIdMcHit(e));}
490  pClusterN = mySst->mLadders[i]->mWafers[j]->getClusterN()->next(pClusterN);
491  }
492  }
493  }
494  }
495  }
496  if (found==0){ LOG_INFO <<"PrintClusterDetails() - Wafer not found !!!"<<endm; }
497 }
498 
499 //_____________________________________________________________________________
500 void StSstPointMaker::PrintPackageDetails(StSstBarrel *mySst, int mywafer)
501 {
502  int found = 0;
503  LOG_INFO <<"PrintPackageDetails() - Wafer "<<mywafer<< endm;
504  for (int i=0;i<20;i++)
505  if (mySst->isActiveLadder(i)>0) {
506  for (int j=0; j<mySst->mLadders[i]->getWaferPerLadder();j++) {
507  if (mySst->mLadders[i]->mWafers[j]->getIdWafer()==mywafer) {
508  found=1;
509  if (mySst->mLadders[i]->mWafers[j]->getPackage()->getSize()==0) {
510  LOG_INFO <<"PrintPackageDetails() - No package in this wafer "<< endm;
511  }
512  else {
513  LOG_INFO <<"PrintPackageDetails() - "<<mySst->mLadders[i]->mWafers[j]->getPackage()->getSize()<<" package(s) in this wafer "<< endm;
514  LOG_INFO <<"PrintPackageDetails() - Package/Kind/Size"<< endm;
515  StSstPackage *pPack = mySst->mLadders[i]->mWafers[j]->getPackage()->first();
516  while (pPack){
517  LOG_INFO<<"PrintPackageDetails() - "<<pPack->getNPackage()<<" "
518  <<pPack->getKind()<<" "
519  <<pPack->getSize()<<" "<<endm;
520  for (int k=0;k<pPack->getSize();k++) {
521  LOG_INFO<<"PrintPackageDetails() - "<<k<<" "<<pPack->getMatched(k)<<" "<<pPack->getMatched(k)->getNCluster()<<endm;
522  }
523  pPack = mySst->mLadders[i]->mWafers[j]->getPackage()->next(pPack);
524  }
525  }
526  }
527  }
528  }
529  if (found==0){ LOG_INFO <<"PrintPackageDetails() - Wafer not found !!!"<<endm;}
530 }
531 
532 //_____________________________________________________________________________
533 void StSstPointMaker::PrintPointDetails(StSstBarrel *mySst, int mywafer)
534 {
535  int found = 0;
536  float convMeVToAdc = (int)pow(2.0,mDynamicControl->getnbitEncoding())/(mDynamicControl->getpairCreationEnergy()*mDynamicControl->getadcDynamic()*mDynamicControl->getnElectronInAMip());
537  LOG_INFO <<"PrintPointDetails() - Wafer "<<mywafer<< endm;
538  for (int i=0;i<20;i++)
539  if (mySst->isActiveLadder(i)>0) {
540  for (int j=0; j<mySst->mLadders[i]->getWaferPerLadder();j++) {
541  if (mySst->mLadders[i]->mWafers[j]->getIdWafer()==mywafer) {
542  found=1;
543  if (mySst->mLadders[i]->mWafers[j]->getPoint()->getSize()==0) {
544  LOG_INFO <<"PrintPointDetails() - No hit in this wafer "<< endm;
545  }
546  else {
547  LOG_INFO<<"PrintPointDetails() - "<<mySst->mLadders[i]->mWafers[j]->getPoint()->getSize()<<" hit(s) in this wafer "<< endm;
548 
549  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;
550  StSstPoint *pSpt = mySst->mLadders[i]->mWafers[j]->getPoint()->first();
551  while (pSpt){
552  float a = 0, b = 0;
553  a = convMeVToAdc*(pSpt->getDe(0)+pSpt->getDe(1));
554  b = convMeVToAdc*(pSpt->getDe(0)-pSpt->getDe(1));
555  LOG_INFO<<"PrintPointDetails() - "
556  <<pSpt->getNPoint() <<" "
557  <<pSpt->getFlag() <<" "
558  <<pSpt->getNMatched() <<" "
559  <<pSpt->getIdClusterP()<<" "
560  <<pSpt->getIdClusterN()<<" "
561  <<pSpt->getNMchit(0) <<" "
562  <<pSpt->getNMchit(1) <<" "
563  <<pSpt->getNMchit(2) <<" "
564  <<pSpt->getNMchit(3) <<" "
565  <<pSpt->getNMchit(4) <<" "
566  <<pSpt->getXg(0) <<" "
567  <<pSpt->getXg(1) <<" "
568  <<pSpt->getXg(2) <<" "
569  <<pSpt->getXl(0) <<" "
570  <<pSpt->getXl(1) <<" "
571  <<pSpt->getXl(2) <<" "
572  <<a <<" "
573  <<b <<" "
574  <<endm;
575  printf("pulseP =%f pulseN = %f\n",a,b);
576  pSpt = mySst->mLadders[i]->mWafers[j]->getPoint()->next(pSpt);
577  }
578  }
579  }
580  }
581  }
582  if (found==0) {LOG_INFO <<"PrintPointDetails() - Wafer not found !!!"<<endm; }
583 }
584 //_____________________________________________________________________________
585 void StSstPointMaker::PrintInfo()
586 {
587  if (Debug()) StMaker::PrintInfo();
588 }
589 //_____________________________________________________________________________
590 void StSstPointMaker::FillCalibTable(){
591  mGain = ((St_sstGainCalibWafer*)GetDataBase("Calibrations/sst/sstGainCalibWafer"))->GetTable();
592  if(mGain){
593  for(int i=0; i<320;i++){
594  LOG_DEBUG<< " ladder : " << i/16
595  << " wafer : " << i%16
596  << " status : " << mGain[0].nGain[i] << endm;
597  mCalibArray[i] = mGain[0].nGain[i];
598  }
599  }
600  else {
601  LOG_WARN << "InitRun : No access to Gain Calib - will use the default gain" << endm;
602  LOG_WARN << "We will use the default table" <<endm;
603  for(int i=0; i<320;i++){
604  mCalibArray[i] = 1;
605  }
606  }
607 }
608 //_____________________________________________________________________________
609 void StSstPointMaker::FillWaferTable(){
610  mWafConfig = ((St_sstWaferConfiguration*) GetDataBase("Geometry/sst/sstWaferConfiguration"))->GetTable();
611  if(mWafConfig){
612  for(int i=0; i<320;i++){
613  LOG_DEBUG<< " ladder : " << i/16
614  << " wafer : " << i%16
615  << " status : " << (int)mWafConfig[0].nStatus[i] << endm;
616  mWaferStatus[i/16][i%16] = (int)mWafConfig[0].nStatus[i];
617  }
618  }
619  else {
620  LOG_WARN << "InitRun : No access to Wafer Config - will use the default wafer config" << endm;
621  LOG_WARN << "We will use the default table" <<endm;
622  for(int i=0; i<20;i++){
623  for(int j=0; j<16;j++){
624  mWaferStatus[i][j] = 1;
625  }
626  }
627  }
628 }
629 //_____________________________________________________________________________
630 Int_t StSstPointMaker::ReadNoiseTable(StSstBarrel *mySst){
631  int noiseTableSize = 0;
632  if(!mPedRmsData){
633  LOG_WARN << "Make : No pedestal and noise values (sstStripCalib table missing), will use default values" <<endm;
634  noiseTableSize = mySst->readNoiseDefault(mDynamicControl);
635  }
636  else{
637  //temporary
638  noiseTableSize = mySst->readNoiseFromTable(mPedRmsData,mDynamicControl);
639  }
640  return noiseTableSize;
641 }
642 //____________________________________________________________________________
644  LOG_INFO << "StSstPointMaker : Finish() with " << mEventCounter <<" processed" << endm;
645  return kStOK;
646 }
647 
virtual void AddData(TDataSet *data, const char *dir=".data")
User methods.
Definition: StMaker.cxx:332
virtual Int_t Make()
StSstClusterList * getClusterP()
Returns the P-side cluster list attached to this wafer.
Definition: StSstWafer.hh:72
Int_t readNoiseFromTable(St_sdm_calib_db *spa_noise, StSstDynamicControl *dynamicControl)
Definition: StSstBarrel.cc:286
StSstStripList * getStripP()
Returns the P-side strip list attached to this wafer.
Definition: StSstWafer.hh:77
virtual Int_t Finish()
Definition: Stypes.h:42
Definition: Stypes.h:40
StSstPointList * getPoint()
Returns the point list attached to this wafer.
Definition: StSstWafer.hh:80
StSstClusterList * getClusterN()
Returns the N-side cluster list attached to this wafer.
Definition: StSstWafer.hh:73
StSstPackageList * getPackage()
Returns the package list attached to this wafer.
Definition: StSstWafer.hh:79
Definition: Stypes.h:44
Event data structure to hold all information from a Monte Carlo simulation. This class is the interfa...
Definition: StMcEvent.hh:169
Definition: Stypes.h:41
StSstStripList * getStripN()
Returns the N-side strip list attached to this wafer.
Definition: StSstWafer.hh:78
virtual TDataSet * Find(const char *path) const
Definition: TDataSet.cxx:362