StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StSvtClusterAnalysisMaker.cxx
1 /***************************************************************************
2  *
3  * $Id: StSvtClusterAnalysisMaker.cxx,v 1.33 2016/04/21 01:34:53 perev Exp $
4  *
5  * Author:
6  ***************************************************************************
7  *
8  * Description: Cluster Analysis Maker class
9  *
10  ***************************************************************************
11  *
12  * $Log: StSvtClusterAnalysisMaker.cxx,v $
13  * Revision 1.33 2016/04/21 01:34:53 perev
14  * Remove dangerous delete
15  *
16  * Revision 1.32 2007/07/12 20:06:49 fisyak
17  * Move initialization to IntRun from Init, empty GetSvtDriftCurve, clean up
18  *
19  * Revision 1.31 2007/04/28 17:57:04 perev
20  * Redundant StChain.h removed
21  *
22  * Revision 1.30 2007/03/21 17:22:58 fisyak
23  * Ivan Kotov's drift velocities, use TGeoHMatrix for coordinate transformation
24  *
25  * Revision 1.29 2005/08/04 04:06:08 perev
26  * clear of collection added
27  *
28  * Revision 1.28 2005/07/23 03:37:33 perev
29  * IdTruth + Cleanup
30  *
31  * Revision 1.27 2004/03/18 04:02:56 caines
32  * Remove from global scope variables used in debug mode as they shouldnt be there and caused erratic behaviour
33  *
34  * Revision 1.26 2004/01/27 02:31:47 perev
35  * LeakOff
36  *
37  * Revision 1.25 2003/09/02 17:59:06 perev
38  * gcc 3.2 updates + WarnOff
39  *
40  * Revision 1.24 2003/04/30 20:38:45 perev
41  * Warnings cleanup. Modified lines marked VP
42  *
43  * Revision 1.23 2003/01/28 20:28:00 munhoz
44  * new filters for clusters
45  *
46  * Revision 1.22 2002/05/09 16:55:40 munhoz
47  * add reading bad anodes from DB
48  *
49  * Revision 1.21 2002/05/08 16:03:52 caines
50  * Fix again memory leak - accidentally pput back in data has to be a const() not data()
51  *
52  * Revision 1.20 2002/04/25 20:34:50 caines
53  * Pass bad anode information into cluster fitter
54  *
55  * Revision 1.17 2002/01/05 21:45:18 caines
56  * Inlcude t0 correction in hit
57  *
58  * Revision 1.16 2001/09/22 01:07:09 caines
59  * Fixes now that AddData() is cleared everyevent
60  *
61  * Revision 1.15 2001/09/16 22:09:28 caines
62  * Add extra checks for when SVT isnt in every event
63  *
64  * Revision 1.14 2001/08/07 20:52:15 caines
65  * Implement better packing of svt hardware and charge values
66  *
67  * Revision 1.13 2001/07/19 20:42:20 caines
68  * Add Reset functions
69  *
70  * Revision 1.12 2001/05/04 14:20:05 caines
71  * Improved historgramming
72  *
73  * Revision 1.11 2001/04/25 18:37:28 perev
74  * HPcorrs
75  *
76  * Revision 1.10 2001/03/22 20:46:53 caines
77  * Comment out some of the QA histograms
78  *
79  * Revision 1.9 2001/02/18 00:10:48 caines
80  * Improve and use StSvtConfig
81  *
82  * Revision 1.8 2000/11/30 20:43:17 caines
83  * Use database
84  *
85  * Revision 1.7 2000/10/31 16:20:57 caines
86  * Added more functions to make the code more readable
87  *
88  * Revision 1.6 2000/09/14 22:17:57 caines
89  * Put back in flagging hot anodes and timebuckets
90  *
91  * Revision 1.5 2000/08/29 22:46:26 caines
92  * Fixed some memory leaks
93  *
94  * Revision 1.4 2000/08/21 13:06:58 caines
95  * Much improved hit finding and fitting
96  *
97  * Revision 1.3 2000/07/16 22:32:54 caines
98  * Fills spacepoint table correctly
99  *
100  * Revision 1.2 2000/07/13 14:50:49 caines
101  * Improvements on not saving single pixels
102  *
103  * Revision 1.1 2000/07/06 03:50:33 caines
104  * First version of cluster finder and fitter
105  *
106  **************************************************************************/
107 
108 #include "Stiostream.h"
109 
110 #include "St_DataSetIter.h"
111 #include "TObjectSet.h"
112 #include "TH1.h"
113 #include "TH2.h"
114 #include "TNtuple.h"
115 #include "TFile.h"
116 
117 #include "StMessMgr.h"
118 #include "StSvtClassLibrary/StSvtHybridCollection.hh"
119 #include "StSvtClassLibrary/StSvtHybridData.hh"
120 #include "StSvtClassLibrary/StSvtHybridPixels.hh"
121 #include "StSvtClassLibrary/StSvtData.hh"
122 #include "StSvtClassLibrary/StSvtHybridBadAnodes.hh"
123 #include "StSequence.hh"
124 #include "StSvtAnalysis.hh"
125 #include "StSvtAnalysedHybridClusters.hh"
126 #include "StSvtClusterAnalysisMaker.h"
127 #include "StSvtSeqAdjMaker/StSvtSeqAdjMaker.h"
128 
129 
130 //___________________________________________________________________________________________
131 StSvtClusterAnalysisMaker::StSvtClusterAnalysisMaker(const char *name) : StMaker(name)
132 {
133  mSvtAdjEvent = NULL;
134 
135  mHybridRawData = NULL;
136  mHybridAdjData = NULL;
137  mHybridPixelData = NULL;
138 
139  mSvtBadAnode = NULL;
140  mSvtBadAnodeSet = NULL;
141 
142  mSvtRawEventColl = NULL;
143  mSvtClusterColl = NULL;
144  mSvtPixelColl = NULL;
145  mSvtAnalColl = NULL;
146 
147  mSvtAnalysis = NULL;
148  mSvtHit = NULL;
149  mSvtAnalClusters = NULL;
150 
151  mNumOfClusters = 0;
152  mTotNumOfClusters = 0;
153  mTotNumOfGoodClusters = 0;
154  mTotNumOfBadClusters = 0;
155 
156  for(int i = 0; i < 128; i++)
157  for(int j = 0; j < 240; j++)
158  adcArray[i + j*128] = 0.0;
159 
160  m_n_seq =0;
161  m_sumADC =0;
162  m_sumADC_all =0;
163  m_nClust =0;
164  m_time_anode_clu=0;
165  m_time_anode_raw=0;
166  m_SumADCvsTime =0;
167  m_PeakADCvsTime =0;
168 }
169 
170 //____________________________________________________________________________________________
171 StSvtClusterAnalysisMaker::~StSvtClusterAnalysisMaker()
172 {
173  /*VP delete mSvtAnalClusters; */ mSvtAnalClusters=0;
174  mSvtAnalColl =0;
175  delete mSvtAnalysis; mSvtAnalysis =0;
176 
177  delete m_n_seq;
178  delete m_sumADC_all;
179  delete m_nClust;
180  delete m_SumADCvsTime;
181  delete m_PeakADCvsTime;
182 
183  for (int i=0; i<mTotalNumberOfHybrids;i++) {
184  if (m_time_anode_raw) delete m_time_anode_raw[i];
185  if (m_time_anode_clu) delete m_time_anode_clu[i];
186  if (m_sumADC) delete m_sumADC[i];
187  }
188  delete [] m_time_anode_raw;
189  delete [] m_time_anode_clu;
190  delete [] m_sumADC;
191 }
192 //_____________________________________________________________________________________________
193 Int_t StSvtClusterAnalysisMaker::InitRun(int runumber)
194 {
195  if( Debug()) gMessMgr->Debug() <<"In StSvtClusterAnalysisMaker::Init()"
196  << GetName() <<endm;
197 
198  mNoEvents=0;
199 
200 
201  GetSvtRawEvent();
202  GetSvtEvent();
203  GetSvtCluster();
204  SetSvtAnalysis();
205 
206 
207  mTotalNumberOfHybrids = mSvtRawEventColl->getTotalNumberOfHybrids();
208 
209  if (Debug()) hfile = new TFile("myrootfile_clus.root","RECREATE","Demo ROOT file");
210 
211  CreateClusterHist(mTotalNumberOfHybrids);
212 
213  St_DataSet* dataSet;
214  dataSet = GetDataSet("StSvtBadAnodes");
215  if (dataSet)
216  mSvtBadAnodeSet = (StSvtHybridCollection*)(dataSet->GetObject());
217 
218  mSvtAnalysis = new StSvtAnalysis(mTotalNumberOfHybrids);
219 
220  mSvtAnalysis->LoadAnodeGains();
221 
222  return StMaker::InitRun(runumber);
223 
224 }
225 
226 //__________________________________________________________________________________________________
227 
228 Int_t StSvtClusterAnalysisMaker::GetSvtRawEvent()
229 {
230  St_DataSet *dataSet;
231 
232  dataSet = GetDataSet("StSvtRawData");
233  if( !dataSet) return kStWarn;
234  mSvtRawEventColl = (StSvtHybridCollection*)(dataSet->GetObject());
235  if( !mSvtRawEventColl) return kStWarn;
236 
237  return kStOK;
238 }
239 //__________________________________________________________________________________________________
240 
241 Int_t StSvtClusterAnalysisMaker::GetSvtEvent()
242 {
243  St_DataSet *dataSet;
244 
245  dataSet = GetDataSet("StSvtData");
246  mSvtAdjEvent = (StSvtData*)(dataSet->GetObject());
247 
248  return kStOK;
249 }
250 
251 //__________________________________________________________________________________________________
252 
253 Int_t StSvtClusterAnalysisMaker::GetSvtCluster()
254 {
255  St_DataSet *dataSet;
256 
257  dataSet = GetDataSet("StSvtCluster");
258  if( !dataSet) return kStWarn;
259  mSvtClusterColl = (StSvtHybridCollection*)(dataSet->GetObject());
260  if( !mSvtClusterColl) return kStWarn;
261  return kStOK;
262 }
263 
264 //__________________________________________________________________________________________________
265 
266 Int_t StSvtClusterAnalysisMaker::GetSvtPixels()
267 {
268 
269  St_DataSet *dataSet;
270 
271  dataSet = GetDataSet("StSvtPixels");
272  assert(dataSet);
273  mSvtPixelColl = (StSvtHybridCollection*)(dataSet->GetObject());
274  assert(mSvtPixelColl);
275 
276  return kStOK;
277 }
278 
279 //__________________________________________________________________________________________________
280 Int_t StSvtClusterAnalysisMaker::SetSvtAnalysis()
281 {
282  mSvtAnalSet = new St_ObjectSet("StSvtAnalResults");
283  // AddData(mSvtAnalSet);
284  AddConst(mSvtAnalSet);
285  SetOutput(mSvtAnalSet); //Declare for output
286 
287  mSvtAnalColl = new StSvtHybridCollection(mSvtAdjEvent->getConfiguration());
288  //cout<<"mSvtAnalColl = "<<mSvtAnalColl<<endl;
289  mSvtAnalSet->SetObject(mSvtAnalColl);
290 
291  return kStOK;
292 }
293 
294 
295 //__________________________________________________________________________________________________
296 
297 
298 Int_t StSvtClusterAnalysisMaker::CreateClusterHist(Int_t tNuOfHyb)
299 {
300 
301  // Create Histograms
302  m_n_seq = new TH1F("NSeqClust","No. Pixels on cluster",100,0.,300.);
303  m_nClust = new TH2F("NClust","No. clusters per event",1000,0.,1000.,100,0.,3000.);
304  m_SumADCvsTime = new TH2F("SumAdcVsTime" ,"Time bucket vs Sum ADC",128,0.,128.,1000,0,100);
305  m_PeakADCvsTime = new TH2F("PeakAdcVsTime" ,"Time bucket vs PeakADC",128,0.,128.,50,0,50);
306  m_sumADC_all = new TH1F("SumADCall","Sum of ADC counts in cluster",500,0,500);
307  m_time_anode_clu = new TH2F*[tNuOfHyb]; memset(m_time_anode_clu,0,tNuOfHyb*sizeof(void*));
308  m_time_anode_raw = new TH2F*[tNuOfHyb]; memset(m_time_anode_raw,0,tNuOfHyb*sizeof(void*));
309  m_sumADC = new TH1F*[tNuOfHyb]; memset(m_sumADC ,0,tNuOfHyb*sizeof(void*));
310 
311  // if(Debug()) ntpl = new TNtuple("ntpl","All hits","hy:charge:time:anode:flag:peakadc:num_pix:num_ano:wid_time:wid_ano:myflag:event:barrel:ladder:wafer");
312 
313  if(Debug()){
314  char title1[20];
315  char titleraw[20];
316  char titleadc[20];
317  char title2[4];
318  char* title3;
319  char* titlerawc;
320  char* titleadcc;
321  for (int barrel = 1;barrel <= mSvtRawEventColl->getNumberOfBarrels();barrel++) {
322  for (int ladder = 1;ladder <= mSvtRawEventColl->getNumberOfLadders(barrel);ladder++) {
323  for (int wafer = 1;wafer <= mSvtRawEventColl->getNumberOfWafers(barrel);wafer++) {
324  for (int hybrid = 1;hybrid <= mSvtRawEventColl->getNumberOfHybrids();hybrid++) {
325 
326  int index = mSvtRawEventColl->getHybridIndex(barrel,ladder,wafer,hybrid);
327  if(index < 0) continue;
328  sprintf(title1,"TimAnodecluster");
329  sprintf(titleraw,"TimAnodeRaw");
330  sprintf(titleadc,"ADC");
331  sprintf(title2,"%d", index);
332  title3 = strcat(title1,title2);
333  titlerawc = strcat(titleraw,title2);
334  titleadcc = strcat(titleadc,title2);
335  m_time_anode_clu[index] = new TH2F(title3 ,"Time bucket vs anode",240,0.5,240.5,129,-0.5,128.5);
336  m_time_anode_raw[index] = new TH2F(titlerawc ,"Time bucket vs anode",240,0.5,240.5,129,-0.5,128.5);
337  m_sumADC[index] = new TH1F(titleadcc,"Sum of ADC counts in cluster",200,0,200);
338  }
339  }
340  }
341  }
342  }
343 
344 
345  return kStOK;
346 }
347 
348 
349 //_______________________________________________________________________________________________
350 
352 {
353 
354  if (Debug()) gMessMgr->Debug() << "In StSvtClusterAnalysisMaker::Make() ..."
355  << GetName() << endm;
356 
357  if( GetSvtRawEvent()){
358  gMessMgr->Warning() << " StSvtClusterAnalysisMaker::Make :No SVT RAW data " << endm;
359  return kStWarn;
360  }
361  if( GetSvtEvent()){
362  gMessMgr->Warning() << " StSvtClusterAnalysisMaker::Make :No SVT seq data " << endm;
363  return kStWarn;
364  }
365  if( GetSvtCluster()){
366  gMessMgr->Warning() << " StSvtClusterAnalysisMaker::Make :No SVT cluster data " << endm;
367  return kStWarn;
368  }
369 
370  //SetSvtAnalysis();
371  mNoEvents++;
372 
373  SetClusterAnalysis();
374  if( Debug()) MakeHistograms();
375 
376  return kStOK;
377 
378 }
379 
380 //___________________________________________________________________________________________________
381 
382 Int_t StSvtClusterAnalysisMaker::SetClusterAnalysis()
383 {
384  int index =0;
385  float T0Jitter;
386 
387  StSvtSeqAdjMaker* StSvtSeqMaker = (StSvtSeqAdjMaker*)GetMaker("SvtSeqAdj");
388 
389  for(int barrel = 1;barrel <= mSvtAdjEvent->getNumberOfBarrels();barrel++) {
390  //cout<<mSvtAdjEvent->getNumberOfBarrels()<<endl;
391  for (int ladder = 1;ladder <= mSvtAdjEvent->getNumberOfLadders(barrel);ladder++) {
392  //cout<<mSvtAdjEvent->getNumberOfLadders(barrel)<<endl;
393  for (int wafer = 1;wafer <= mSvtAdjEvent->getNumberOfWafers(barrel);wafer++) {
394  // cout<<mSvtAdjEvent->getNumberOfWafers(barrel)<<endl;
395  for (int hybrid = 1;hybrid <=mSvtAdjEvent->getNumberOfHybrids();hybrid++){
396  //cout<<mSvtAdjEvent->getNumberOfHybrids()<<endl;
397 
398  index = mSvtAdjEvent->getHybridIndex(barrel,ladder,wafer,hybrid);
399  if(index < 0) continue;
400 
401  mHybridAdjData = (StSvtHybridData *)mSvtAdjEvent->at(index);
402  if( !mHybridAdjData) continue;
403  // Adjust recorded phase for each hybrid into frcation of a
404  // time bucket
405  T0Jitter = (float)(mHybridAdjData->getTimeZero());
406  if( T0Jitter < 4. && T0Jitter > 2.){
407  T0Jitter = 0.;
408  }
409  else if( T0Jitter < 5. && T0Jitter > 3.){
410  T0Jitter = 3. - (8./3.);
411  }
412  else if( T0Jitter < 6. && T0Jitter > 4.){
413  T0Jitter = 6. - ( 2.*8./3.);
414  }
415 
416  mHybridCluster = (StSvtHybridCluster*)mSvtClusterColl->at(index);
417  if (! mHybridCluster) continue;
418  mHybridRawData = (StSvtHybridData *)mSvtRawEventColl->at(index);
419  if (! mHybridRawData) continue;
420  mNumOfClusters = mHybridCluster->getNumberOfClusters();
421 
422  mSvtBadAnode=0;
423  if( mSvtBadAnodeSet) mSvtBadAnode = (StSvtHybridBadAnodes*)mSvtBadAnodeSet->at(index);
424  mSvtAnalysis->SetPointers(mHybridAdjData,mHybridRawData,
425  mHybridCluster,mSvtBadAnode,
426  mSvtAdjEvent->getTotalNumberOfHybrids(),
427  StSvtSeqMaker->GetPedOffset());
428  mSvtAnalysis->SetHybIndex(index);
429  mSvtAnalysis->FirstAndLastAnodes();
430  mSvtAnalysis->CluFirstTimeBin();
431  mSvtAnalysis->CluLastTimeBin();
432  mSvtAnalysis->MomentAnalysis();
433  mSvtAnalysis->updateTruth();
434  // mSvtAnalysis->SetBadAnTb(mNumOfClusters); //note I dont look at decon here
435 
436 
437  mSvtAnalClusters = (StSvtAnalysedHybridClusters*) mSvtAnalColl->at(index);
438 
439  if( mSvtAnalClusters){
440  delete mSvtAnalClusters;
441  mSvtAnalColl->at(index) = 0;
442  }
443  mSvtAnalClusters = new StSvtAnalysedHybridClusters(barrel, ladder, wafer, hybrid);
444 
445  mSvtAnalClusters->setMembers(mSvtAnalysis->GetnSvtClu(),
446  mSvtAdjEvent->getProperHybridIndex(
447  barrel,ladder,wafer,hybrid));
448  mSvtAnalClusters->setSvtHit(mSvtAnalysis,T0Jitter);
449  mSvtAnalColl->put_at(mSvtAnalClusters,index);
450 
451  // Fill hitograms and ntuples.
452  for( int clu=0; clu<mSvtAnalysis->GetnSvtClu(); clu++){
453  //if( mSvtAnalysis->GetCluFlag(clu) < 4){
454  if(Debug() && m_sumADC[index]) m_sumADC[index]->Fill(mSvtAnalysis->GetCluCharge(clu));
455  m_SumADCvsTime->Fill((float)mSvtAnalysis->GetMeanClusterTimeBin(clu),(float)mSvtAnalysis->GetCluCharge(clu));
456 
457  m_PeakADCvsTime->Fill((float)mSvtAnalysis->GetMeanClusterTimeBin(clu),(float)mSvtAnalysis->GetCluPeakAdc(clu));
458 
459  m_n_seq->Fill(mSvtAnalysis->GetCluNumPixels(clu));
460  m_sumADC_all->Fill((float)mSvtAnalysis->GetCluCharge(clu));
461  //if(Debug()) ntpl->Fill(index,(float)mSvtAnalysis->GetCluCharge(clu),(float)mSvtAnalysis->GetMeanClusterTimeBin(clu),(float)mSvtAnalysis->GetMeanClusterAnode(clu),(float)mSvtAnalysis->GetCluFlag(clu),(float)mSvtAnalysis->GetCluPeakAdc(clu),(float)mSvtAnalysis->GetCluNumPixels(clu),(float)mSvtAnalysis->GetCluNumAnodes(clu),(float)mSvtAnalysis->GetSecondMomClusterTimeBin(clu),(float)mSvtAnalysis->GetSecondMomClusterAnode(clu),(float)mSvtAnalysis->return_oneortwoanode_flag(clu),(float)mNoEvents,(float)barrel,(float)ladder,(float)wafer);
462  //}
463  }
464 
465  }
466  }
467  }
468  }
469  //printClusterInfo();
470 
471  //GetPixelData();
472  return kStOK;
473 }
474 
475 //___________________________________________________________________________________________________
476 void StSvtClusterAnalysisMaker::printClusterInfo()
477 {
478 
479  int index = 0;
480  mTotNumOfGoodClusters = 0;
481  mTotNumOfBadClusters = 0;
482 
483  for(int barrel = 1;barrel <= mSvtAdjEvent->getNumberOfBarrels();barrel++) {
484  //cout<<mSvtEvent->getNumberOfBarrels()<<endl;
485  for (int ladder = 1;ladder <= mSvtAdjEvent->getNumberOfLadders(barrel);ladder++) {
486  //cout<<mSvtEvent->getNumberOfLadders(barrel)<<endl;
487  for (int wafer = 1;wafer <= mSvtAdjEvent->getNumberOfWafers(barrel);wafer++) {
488  // cout<<mSvtEvent->getNumberOfWafers(barrel)<<endl;
489  for (int hybrid = 1;hybrid <=mSvtAdjEvent->getNumberOfHybrids();hybrid++){
490  //cout<<mSvtEvent->getNumberOfHybrids()<<endl;
491 
492  index = mSvtAnalColl->getHybridIndex(barrel,ladder,wafer,hybrid);
493  if(index < 0) continue;
494 
495  if(index == 8 || index == 9 || index == 12 || index == 13)
496  {
497  mSvtAnalClusters = (StSvtAnalysedHybridClusters*)mSvtAnalColl->getObject(barrel,ladder,wafer,hybrid);
498 
499  mNumOfClusters = mSvtAnalClusters->numOfHits();
500  mSvtHit = mSvtAnalClusters->svtHit();
501 
502  for(int i = 0; i < mNumOfClusters; i++)
503  {
504  int flag = mSvtHit[i].flag();
505  if(flag == 0)
506  {
507  ++mTotNumOfGoodClusters;
508  }
509  }
510 
511  }
512  } //barrel loop
513  } //ladder loop
514  } //wafer loop
515  } // hybrid loop
516 
517 
518 }
519 
520 
521 //___________________________________________________________________________________________________
522 
523 
524 Int_t StSvtClusterAnalysisMaker::GetRawData(int index)
525 {
526  int* anodeList;
527  int numOfAnodes,numOfSeq,seqStart;
528  unsigned char* adc;
529  StSequence* svtSequence;
530 
531  numOfAnodes = mHybridRawData->getAnodeList(anodeList);
532 
533  //cout<<"numOfAnodes for hybrid index"<<index<<" = "<<numOfAnodes<<endl;
534 
535  int counter = 0;
536 
537  int an = 0;
538  int seq = 0, mseq = 0;
539  do
540  {
541  while(an + 1)
542  {
543  if(an < numOfAnodes)
544  {
545  mHybridRawData->getListSequences(an,numOfSeq,svtSequence);
546  seqStart = svtSequence[seq].startTimeBin;
547  adc = svtSequence[seq].firstAdc;
548  //cout<<(int)adc[seqStart + mseq] - 100<<" ";
549  ++an;
550  }
551  else if(an == numOfAnodes)
552  an = -1;
553  }
554 
555  cout<<"\n\n";
556  an = 0;
557  ++mseq;
558 
559  } while(!an && seqStart + mseq < 128);
560 
561 
562  cout<<"\n\n";
563 
564  cout<<"numOfSeq for hybrid index"<<index<<" = "<<counter<<endl;
565 
566  return kStOK;
567 }
568 
569 //___________________________________________________________________________________________________
570 
571 Int_t StSvtClusterAnalysisMaker::GetPixelData(int index)
572 {
573  cout<<"hybrid index: "<<index<<endl;
574  cout<<"\n";
575 
576  for(int tim = 0; tim < 128; tim++)
577  {
578  cout<<"\n";
579  for(int an = 1; an <= 240; an++)
580  {
581  if(an < 30)
582  cout<<"Pixel"<<"["<<an - 1<<"]"<<"["<<tim<<"] = "<< mHybridPixelData->getPixelContent(an,tim)<<endl;
583  }
584  }
585 
586  return kStOK;
587 }
588 
589 //____________________________________________________________________________
590 
591 
592 void StSvtClusterAnalysisMaker::MakeHistograms(){
593 
594  int mSequence;
595  int listAn, actualAn,seq,stTimeBin,len;
596 
597  unsigned char* adc;
598 
599  int index = 0;
600 
601  StSequence* svtSequence;
602  StSvtClusterMemberInfo** tempMemberInfo;
603 
604  int TotalClusters=0;
605 
606  for(int barrel = 1;barrel <= mSvtAdjEvent->getNumberOfBarrels();barrel++) {
607  for(int ladder = 1;ladder <= mSvtAdjEvent->getNumberOfLadders(barrel);ladder++) {
608  for(int wafer = 1;wafer <= mSvtAdjEvent->getNumberOfWafers(barrel);wafer++) {
609  for(int hybrid = 1;hybrid <=mSvtAdjEvent->getNumberOfHybrids();hybrid++){
610 
611  index = mSvtAdjEvent->getHybridIndex(barrel,ladder,wafer,hybrid);
612  if(index < 0) continue;
613 
614  //Reset histogram each event
615 
616  m_time_anode_clu[index]->Reset();
617  m_time_anode_raw[index]->Reset();
618 
619  mHybridAdjData = (StSvtHybridData *)mSvtAdjEvent->at(index);
620  if( !mHybridAdjData) continue;
621  mHybridCluster = (StSvtHybridCluster*)mSvtClusterColl->at(index);
622  if ( !mHybridCluster) continue;
623  mNumOfClusters = mHybridCluster->getNumberOfClusters();
624 
625  TotalClusters+=mNumOfClusters;
626  gMessMgr->Message()<<"numOfClusters = "<<mNumOfClusters << " For index = " << index<< " " ;
627 
628  tempMemberInfo = new StSvtClusterMemberInfo*[mNumOfClusters];
629 
630  for(int clu = 0; clu < mNumOfClusters; clu++)
631  {
632 
633  mTotNumOfClusters += mNumOfClusters;
634 
635  tempMemberInfo[clu] = mHybridCluster->getCluMemInfo(clu);
636  mNumOfMembers = mHybridCluster->getNumberOfMembers(clu);
637 
638 
639 
640  for(int mem = 0; mem < mNumOfMembers; mem++)
641  {
642  listAn = tempMemberInfo[clu][mem].listAnode;
643  seq = tempMemberInfo[clu][mem].seq;
644  actualAn = tempMemberInfo[clu][mem].actualAnode; //actual anode
645  mHybridAdjData->getListSequences(listAn,mSequence,svtSequence);
646 
647 
648  stTimeBin =svtSequence[seq].startTimeBin;
649  len = svtSequence[seq].length;
650  adc = svtSequence[seq].firstAdc;
651 
652 
653  int count=0;
654  for(int k = 0; k < len ; k++)
655  {
656  count = (int) adc[k];
657  m_time_anode_clu[index]->Fill(actualAn,stTimeBin + k,count);
658  m_time_anode_raw[index]->Fill(actualAn,stTimeBin + k,count);
659  }
660  }
661  }
662  delete [] tempMemberInfo;
663  } //hybrid loop
664  } //wafer loop
665  } //ladder loop
666  } //barrel loop
667 
668 
669  gMessMgr->Message()<< " Found " << TotalClusters << " clusters."<< endm;
670 
671  m_nClust->Fill((float)mNoEvents,(float)TotalClusters);
672 }
673 //____________________________________________________________________________
674 Int_t StSvtClusterAnalysisMaker::Reset(){
675 
676  //VP delete mSvtAnalClusters;
677  mSvtAnalSet->SetObject(0); // delete mSvtAnalColl;
678  delete mSvtAnalysis;
679 
680  mSvtAdjEvent = NULL;
681 
682  mHybridRawData = NULL;
683  mHybridAdjData = NULL;
684  mHybridPixelData = NULL;
685 
686  mSvtRawEventColl = NULL;
687  mSvtClusterColl = NULL;
688  mSvtPixelColl = NULL;
689  mSvtAnalColl = NULL;
690 
691  mSvtAnalysis = NULL;
692  mSvtHit = NULL;
693  mSvtAnalClusters = NULL;
694 
695 
696  return kStOK;
697 }
698 
699 //____________________________________________________________________________
700 
702 
703  if (Debug()) gMessMgr->Debug() << "In StSvtClusterAnalysisMaker::Finish() ..."
704  << GetName() << endm;
705  if (Debug()) hfile->Write();
706 
707  return kStOK;
708 }
709 //____________________________________________________________________________
710 
711 void StSvtClusterAnalysisMaker::Clear(Option_t *option)
712 {
713  if(mSvtAnalColl) {
714  int n = mSvtAnalColl->size();
715  mSvtAnalColl->clear();
716  mSvtAnalColl->resize(n);
717  }
718  StMaker::Clear(option);
719 }
720 
721 //_____________________________________________________________________________
723 
724 
725 
726 
727 
728 
729 
730 
731 
TH2F * m_nClust
Sum of ADC on hits.
TH2F * m_SumADCvsTime
Timebucket vs anode for raw sequences.
TH1F ** m_sumADC
No. of seq on a cluster.
TH1F * m_sumADC_all
Sum of ADC on hits.
virtual void Clear(Option_t *option="")
User defined functions.
Definition: StMaker.cxx:634
virtual void Clear(Option_t *option="")
User defined functions.
virtual void SetObject(TObject *obj)
The depricated method (left here for the sake of the backward compatibility)
Definition: TObjectSet.h:59
virtual TObject * GetObject() const
The depricated method (left here for the sake of the backward compatibility)
Definition: TDataSet.cxx:428
TH2F ** m_time_anode_raw
Timebucket vs anode for clusters.
virtual const char * GetName() const
special overload
Definition: StMaker.cxx:237
Definition: Stypes.h:42
Definition: Stypes.h:40
TH2F ** m_time_anode_clu
No. of clusters per event.
TH2F * m_PeakADCvsTime
Timebucket vs SUM ADC of clusters.