StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StSstWafer.cc
1 //$Id: StSstWafer.cc,v 1.10 2016/06/10 19:28:31 bouchet Exp $
2 //
3 //$Log: StSstWafer.cc,v $
4 //Revision 1.10 2016/06/10 19:28:31 bouchet
5 //coverity : REVERSE_INULL
6 //
7 //Revision 1.9 2016/06/08 20:53:54 bouchet
8 //coverity : PASS_BY_VALUE, FORWARD_NULL
9 //
10 //Revision 1.8 2016/06/07 21:44:07 bouchet
11 //coverity : multiple RESOURCE_LEAK fixed ; add point to list after having set the flag ; cleanup
12 //
13 //Revision 1.7 2016/05/30 23:52:22 bouchet
14 //forget cleanup at previous commit
15 //
16 //Revision 1.6 2016/05/30 21:39:21 bouchet
17 //coverity : FORWARD_NULL fixed ; cleanup + simplified method
18 //
19 //Revision 1.5 2015/11/16 19:18:47 bouchet
20 //revert back the cut on signal strip : using DB entry, not constant
21 //
22 //Revision 1.4 2015/08/06 17:46:54 smirnovd
23 //Removed unused local variables
24 //
25 //Revision 1.3 2015/07/21 14:54:23 bouchet
26 //removed unused variables ; Int_t doLorentzShiftSide moved to void()
27 //
28 //Revision 1.2 2015/06/24 17:37:21 smirnovd
29 //StSstUtil: Prepend included headers with path to submodule
30 //
31 //Revision 1.1 2015/06/23 16:26:20 jeromel
32 //First version created from the SSD code and reshaped
33 //
34 //Revision 1.2 2015/05/01 12:12:14 bouchet
35 //add fixed threshold for cluster finder decision
36 //
37 //Revision 1.1 2015/04/19 17:30:32 bouchet
38 //initial commit ; SST codes
39 //
40 
41 //fork from the SSD code, move along - see history therein
42 #include "StSstUtil/StSstWafer.hh"
43 #include "St_base/Stiostream.h"
44 #include "TMath.h"
45 #include "StMessMgr.h"
46 //________________________________________________________________________________
47 StSstWafer::StSstWafer(Int_t nid) : TGeoHMatrix(), mDebug(0) {
48  memset(first, 0, last-first);
49  mId = nid;
50 
51  mStripP = new StSstStripList();
52  mStripN = new StSstStripList();
53  mNoiseP = new StSpaListNoise();
54  mNoiseN = new StSpaListNoise();
55  mClusterP = new StSstClusterList();
56  mClusterN = new StSstClusterList();
57  mPackage = new StSstPackageList();
58  mPoint = new StSstPointList();
59 }
60 //________________________________________________________________________________
61 StSstWafer::~StSstWafer() {
62  delete mStripP;
63  delete mStripN;
64  delete mNoiseP;
65  delete mNoiseN;
66  delete mClusterP;
67  delete mClusterN;
68  delete mPackage;
69  delete mPoint;
70 }
71 //________________________________________________________________________________
72 void StSstWafer::Reset() {
73  delete mStripP;
74  delete mStripN;
75  delete mNoiseP;
76  delete mNoiseN;
77  delete mClusterP;
78  delete mClusterN;
79  delete mPackage;
80  delete mPoint;
81  mStripP = new StSstStripList();
82  mStripN = new StSstStripList();
83  mNoiseP = new StSpaListNoise();
84  mNoiseN = new StSpaListNoise();
85  mClusterP = new StSstClusterList();
86  mClusterN = new StSstClusterList();
87  mPackage = new StSstPackageList();
88  mPoint = new StSstPointList();
89 }
90 //________________________________________________________________________________
91 void StSstWafer::init(Int_t rId, Double_t *rD, Double_t *rN, Double_t *rT, Double_t *rX)
92 {
93  if (rId != mId) {LOG_INFO<<" Can not initialize wafer number : "<<mId<<" with "<<rId<<"\n";}
94  else {
95  SetName(Form("R%04i",rId));
96  Double_t rot[9] = {
97  rD[0], rN[0], rT[0],
98  rD[1], rN[1], rT[1],
99  rD[2], rN[2], rT[2]
100  };
101  SetRotation(rot);
102  SetTranslation(rX);
103  }
104 }
105 //________________________________________________________________________________
106 void StSstWafer::debugStrips()
107 {
108  StSstStrip *currentStripP = 0;
109  LOG_INFO<<"List of "<<mStripP->getSize()<<" strips on the P side "<<endm;
110  if (mStripP->getSize()>0) currentStripP = mStripP->first();
111  for (Int_t i=0;i<mStripP->getSize();i++) {
112  LOG_INFO<<" id,sig,noise : "<<currentStripP->getNStrip()
113  <<" "<<currentStripP->getDigitSig()
114  <<" "<<currentStripP->getSigma()<<endm;
115  if (currentStripP!=mStripP->last()) currentStripP = mStripP->next(currentStripP);
116  }
117 
118  StSstStrip *currentStripN = 0;
119  LOG_INFO<<"List of "<<mStripN->getSize()<<" strips on the N side "<<endm;
120  if (mStripN->getSize()>0) currentStripN = mStripN->first();
121  for (Int_t i=0;i<mStripN->getSize();i++) {
122  LOG_INFO<<" id,sig,noise : "<<currentStripN->getNStrip()
123  <<" "<<currentStripN->getDigitSig()
124  <<" "<<currentStripN->getSigma()<<endm;
125  if (currentStripN!=mStripN->last()) currentStripN = mStripN->next(currentStripN);
126  }
127 }
128 //________________________________________________________________________________
129 void StSstWafer::debugClusters()
130 {
131  StSstCluster *currentClusterP = 0;
132  LOG_INFO<<"List of "<<mClusterP->getSize()<<" clusters on the P side "<<endm;
133  if (mClusterP->getSize()>0) currentClusterP = mClusterP->first();
134  for (Int_t i=0;i<mClusterP->getSize();i++) {
135  LOG_INFO<<"N,Size,FirstStrip,StripMean,TotAdc,FirstAdc,LastAdc,TotNoise : "<<currentClusterP->getNCluster()
136  <<" "<<currentClusterP->getClusterSize()
137  <<" "<<currentClusterP->getFirstStrip()
138  <<" "<<currentClusterP->getStripMean()
139  <<" "<<currentClusterP->getTotAdc()
140  <<" "<<currentClusterP->getFirstAdc()
141  <<" "<<currentClusterP->getLastAdc()
142  <<" "<<currentClusterP->getTotNoise()<<endm;
143  if (currentClusterP!=mClusterP->last()) currentClusterP = mClusterP->next(currentClusterP);
144  }
145 
146  StSstCluster *currentClusterN = 0;
147  LOG_INFO<<"List of "<<mClusterN->getSize()<<" clusters on the P side "<<endm;
148  if (mClusterN->getSize()>0) currentClusterN = mClusterN->first();
149  for (Int_t i=0;i<mClusterN->getSize();i++) {
150  LOG_INFO<<"N,Size,FirstStrip,StripMean,TotAdc,FirstAdc,LastAdc,TotNoise : "<<currentClusterN->getNCluster()
151  <<" "<<currentClusterN->getClusterSize()
152  <<" "<<currentClusterN->getFirstStrip()
153  <<" "<<currentClusterN->getStripMean()
154  <<" "<<currentClusterN->getTotAdc()
155  <<" "<<currentClusterN->getFirstAdc()
156  <<" "<<currentClusterN->getLastAdc()
157  <<" "<<currentClusterN->getTotNoise()<<endm;
158  if (currentClusterN!=mClusterN->last()) currentClusterN = mClusterN->next(currentClusterN);
159  }
160 }
161 //________________________________________________________________________________
165 void StSstWafer::addStrip(StSstStrip *ptr, Int_t iSide)
166 {
167  if (iSide)
168  { mStripN->addNewStrip(ptr); }
169  else
170  { mStripP->addNewStrip(ptr); }
171 }
172 //________________________________________________________________________________
176 void StSstWafer::addCluster(StSstCluster *ptr, Int_t iSide)
177 {
178  if (iSide)
179  { mClusterN->addNewCluster(ptr); }
180  else
181  { mClusterP->addNewCluster(ptr); }
182 }
183 //________________________________________________________________________________
188 { mPackage->addNewPackage(ptr); }
189 //________________________________________________________________________________
194 { mPoint->addNewPoint(ptr); }
195 //________________________________________________________________________________
196 void StSstWafer::setPedestalSigmaStrip(Int_t iStrip, Int_t iSide, Int_t iPedestal, Int_t iSigma, StSstDynamicControl *dynamicControl)
197 {
198  if (iSide)
199  { mStripN->setPedestalSigma(iStrip, iPedestal, iSigma, dynamicControl); }
200  else
201  { mStripP->setPedestalSigma(iStrip, iPedestal, iSigma, dynamicControl); }
202 }
203 //________________________________________________________________________________
208 {
209  mStripP->sortStrip();
210  mStripN->sortStrip();
211 }
212 //________________________________________________________________________________
217 {
218  mClusterP->sortCluster();
219  mClusterN->sortCluster();
220 }
221 //________________________________________________________________________________
226 { mPoint->sortPoint(); }
227 //________________________________________________________________________________
232 void StSstWafer::doClusterisation(Int_t *NClusterPerSide, StSstClusterControl *clusterControl)
233 {
234  Int_t iSide = 0;
235  doFindCluster(clusterControl, iSide);
236  NClusterPerSide[0] = doClusterSplitting(clusterControl, iSide);
237  iSide = 1;
238  doFindCluster(clusterControl, iSide);
239  NClusterPerSide[1] = doClusterSplitting(clusterControl, iSide);
240 }
241 //______________________________________________________________
242 void StSstWafer::doCleanListStrip(StSstStripList *myStripList)
243 {
244  Int_t lowCut = 3;
245 
246  StSstStripList *cleanListStrip;
247  // cleanListStrip = new StSstStripList();
248  cleanListStrip = myStripList;
249  StSstStrip *myStrip = 0;
250  StSstStrip *copyStrip = cleanListStrip->first();
251  int size = cleanListStrip->getSize();
252  for(Int_t i=0;i<size;i++){
253  myStrip = copyStrip;
254  copyStrip = myStripList->next(copyStrip);
255  if((myStrip->getSigma()==0)||(myStrip->getDigitSig()<lowCut*myStrip->getSigma())){
256  cleanListStrip->removeStrip(myStrip);
257  }
258  }
259 }
260 //________________________________________________________________________________
281 Int_t StSstWafer::doFindCluster(StSstClusterControl *clusterControl, Int_t iSide)
282 {
283  StSstStripList *CurrentStripList = 0;
284  StSstClusterList *CurrentClusterList = 0;
285 
286  switch (iSide)
287  {
288  case 0:
289  CurrentStripList = mStripP;
290  CurrentClusterList = mClusterP;
291  break;
292  case 1:
293  CurrentStripList = mStripN;
294  CurrentClusterList = mClusterN;
295  break;
296  }
297 
298  if(!CurrentStripList) return 0;
299  if(!CurrentStripList->getSize()) return 0;
300 
301  Int_t nCluster = 0;
302  Int_t atTheEnd = 0;
303 
304  //doCleanListStrip(CurrentStripList);
305 
306  StSstStrip *CurrentStrip = CurrentStripList->first();
307  StSstStrip *ScanStrip = 0;
308  StSstStrip *LastScanStrip = 0;
309  StSstStrip *tmpStrip = CurrentStripList->first();
310  for(Int_t i = 0; i<CurrentStripList->getSize(); i++)
311  { tmpStrip = CurrentStripList->next(tmpStrip); }
312 
313  while(CurrentStrip)
314  {
315  if(CurrentStrip->getDigitSig()> clusterControl->getHighCut())
316  {
317  LastScanStrip = 0;
318  StSstCluster *newCluster = new StSstCluster(CurrentClusterList->getSize());
319  nCluster++;
320  newCluster->update(CurrentStrip,1.);
321  ScanStrip = CurrentStripList->prev(CurrentStrip);
322  while(ScanStrip)
323  {
324  if(((ScanStrip->getNStrip())-((CurrentStripList->next(ScanStrip))->getNStrip()))==-1)
325  {
326  newCluster->update(ScanStrip,1.);
327  ScanStrip = CurrentStripList->prev(ScanStrip);
328  }
329  else
330  { ScanStrip = 0; }
331  }
332  ScanStrip = CurrentStripList->next(CurrentStrip);
333  while(ScanStrip)
334  {
335  if(((ScanStrip->getNStrip())-((CurrentStripList->prev(ScanStrip))->getNStrip()))==1)
336  {
337  newCluster->update(ScanStrip,1.);
338  ScanStrip = CurrentStripList->next(ScanStrip);
339  if (!ScanStrip) atTheEnd = 1;
340  }
341  else
342  {
343  LastScanStrip = ScanStrip;
344  ScanStrip = 0;
345  }
346  }
347  CurrentClusterList->addNewCluster(newCluster);
348  if(LastScanStrip)
349  { CurrentStrip = LastScanStrip; }
350  else
351  {
352  if (atTheEnd)
353  { CurrentStrip = 0; }
354  else
355  { CurrentStrip = CurrentStripList->next(CurrentStrip); }
356  }
357  }
358  else
359  { CurrentStrip = CurrentStripList->next(CurrentStrip); }
360  }
361  return nCluster;
362 }
363 //________________________________________________________________________________
369 Int_t StSstWafer::doClusterSplitting(StSstClusterControl *clusterControl, Int_t iSide)
370 {
371  StSstStripList *CurrentStripList = 0;
372  StSstClusterList *CurrentClusterList = 0;
373 
374  switch (iSide)
375  {
376  case 0:
377  CurrentStripList = mStripP;
378  CurrentClusterList = mClusterP;
379  break;
380  case 1:
381  CurrentStripList = mStripN;
382  CurrentClusterList = mClusterN;
383  break;
384  }
385  if(!CurrentClusterList) return 0;
386  Int_t ClusterListSize = CurrentClusterList->getSize();
387  if(!ClusterListSize) return 0;
388 
389  Int_t iCluster = 0;
390  StSstCluster *CurrentCluster = CurrentClusterList->first();
391 
392  for(iCluster = 0 ; iCluster < ClusterListSize ; iCluster++)
393  {
394 
395  Int_t *ListAdc = CurrentStripList->getListAdc(CurrentCluster->getFirstStrip(),CurrentCluster->getClusterSize());
396  Int_t toBeDeleted = CurrentClusterList->splitCluster(clusterControl,CurrentCluster,ListAdc,CurrentStripList);
397  if(toBeDeleted)
398  {
399  StSstCluster *TempCluster = CurrentCluster;
400  CurrentCluster = CurrentClusterList->next(CurrentCluster);
401  CurrentClusterList->removeCluster(TempCluster);
402  }
403  else
404  {
405  CurrentCluster = CurrentClusterList->next(CurrentCluster);
406  }
407 
408  delete [] ListAdc;
409  }
410  CurrentClusterList->renumCluster();
411  return CurrentClusterList->getSize();
412 }
413 
414 //________________________________________________________________________________
418 void StSstWafer::doLorentzShift(sstDimensions_st *dimensions,Float_t mShift_hole,Float_t mShift_elec)
419 {
420  Float_t pitch = dimensions[0].stripPitch;
421  //side P
422  doLorentzShiftSide(mShift_hole, pitch, mClusterP);
423  //side N
424  doLorentzShiftSide(mShift_elec, pitch, mClusterN);
425 }
426 //___________________________________________________________________________________________
427 void StSstWafer::doLorentzShiftSide(Float_t shift,Float_t pitch, StSstClusterList *currentList){
428  Int_t iCluster = 0;
429  StSstCluster *CurrentCluster = currentList->first();
430  for(iCluster = 0 ; iCluster < currentList->getSize(); iCluster++){
431  Float_t StripMean = CurrentCluster->getStripMean();
432  CurrentCluster->setStripMean(StripMean-(shift/pitch));
433  CurrentCluster = currentList->next(CurrentCluster);
434  }
435  delete CurrentCluster;
436 }
437 //________________________________________________________________________________
441 Int_t StSstWafer::doFindPackage(sstDimensions_st *dimensions, StSstClusterControl *clusterControl)
442 {
443  StSstPackageList *currentPackageList = 0;
444  StSstCluster *currentClusterP = 0;
445  StSstCluster *currentClusterN = 0;
446  StSstCluster *scanClusterP = 0;
447  StSstCluster *scanClusterN = 0;
448  StSstCluster *lastMatchedN = 0;
449  StSstCluster *nextMatchedN = 0;
450 
451  Int_t maxMatchedInPackage = clusterControl->getClusterTreat();
452  Int_t numPackage = 0;
453  Int_t numUnMatched = 0;
454  Int_t numCurrentClusterP = 0;
455  Int_t numCurrentClusterN = 0;
456  Int_t numScanClusterP = 0;
457  Int_t numScanClusterN = 0;
458  Int_t numLastMatchedN = 0;
459  Int_t numNextMatchedN = 0;
460  Int_t matchedOk = 0;
461  Int_t keepPackage = 0;
462 
463  currentPackageList = mPackage;
464  currentClusterP = mClusterP->first();
465  currentClusterN = mClusterN->first();
466 
467  if (!mClusterP->getSize() || !mClusterN->getSize()) return 0;
468  StSstPackage *currentPackage = new StSstPackage(0, clusterControl);
469 
470  while (currentClusterP)
471  {
472  matchedOk = 0;
473  keepPackage = 0;
474  scanClusterP = currentClusterP ;
475  currentPackage->addNewMatched(currentClusterP, maxMatchedInPackage);
476  currentPackage->addKindPackage(numCurrentClusterP+1,0, maxMatchedInPackage);
477  scanClusterN = currentClusterN ;
478  while (scanClusterN)
479  {
480  if (geoMatched(dimensions, scanClusterP, scanClusterN))
481  {
482  matchedOk++;
483  currentPackage->addNewMatched(scanClusterN, maxMatchedInPackage);
484  currentPackage->addKindPackage(numLastMatchedN+1,1, maxMatchedInPackage);
485  lastMatchedN = scanClusterN;
486  numLastMatchedN++;
487  }
488  scanClusterN = mClusterN->next(scanClusterN);
489  }
490  if (!(numScanClusterP == mClusterP->getSize()-1))
491  {
492  scanClusterP = mClusterP->next(scanClusterP);
493  numScanClusterP++;
494  scanClusterN = lastMatchedN;
495  numScanClusterN = numLastMatchedN;
496  while (scanClusterN)
497  {
498  if (geoMatched(dimensions, scanClusterP, scanClusterN))
499  {
500  keepPackage = 1;
501  nextMatchedN = scanClusterN;
502  numScanClusterN--;
503  numNextMatchedN = numScanClusterN;
504  }
505  scanClusterN = mClusterN->prev(scanClusterN);
506  }
507  if (!keepPackage)
508  {
509  numCurrentClusterP = 0;
510  numCurrentClusterN = 0;
511  numScanClusterP = 0;
512  numScanClusterN = 0;
513  numLastMatchedN = 0;
514  if (!matchedOk)
515  {
516  numUnMatched++;
517  currentPackage->purgePackage();
518  }
519  else
520  {
521  currentClusterN = mClusterN->next(lastMatchedN);
522  StSstPackage *newPackage = new StSstPackage(currentPackageList->getSize(), currentPackage->getSize());
523  newPackage->takeMatcheds(currentPackage);
524  currentPackageList->addNewPackage(newPackage);
525  currentPackage->purgePackage();
526  numPackage++;
527  }
528  }
529  else
530  {
531  currentClusterN = nextMatchedN;
532  numCurrentClusterP++;
533  numCurrentClusterN++;
534  numLastMatchedN = numNextMatchedN;
535  }
536  }
537  else
538  {
539  StSstPackage *newPackage = new StSstPackage(currentPackageList->getSize(), currentPackage->getSize());
540  newPackage->takeMatcheds(currentPackage);
541  currentPackageList->addNewPackage(newPackage);
542  currentPackage->purgePackage();
543  numPackage++;
544  }
545  currentClusterP = mClusterP->next(currentClusterP);
546  }
547  delete currentPackage;
548  return numPackage;
549 }
550 //________________________________________________________________________________
551 Int_t StSstWafer::doSolvePerfect(sstDimensions_st *dimensions, StSstClusterControl *clusterControl,Float_t CalibArray)
552 {
553  Int_t nPerfect = 0;
554  StSstPackage *currentPackage = 0;
555  char *currentKind = 0;
556  currentPackage = mPackage->first();
557  while(currentPackage)
558  {
559  currentKind = currentPackage->getKind();
560  Int_t numMatched = strlen(currentKind)/2;
561  Float_t *Adc = new float[numMatched];
562  for(Int_t i=0;i<numMatched;i++)
563  Adc[i]=(currentPackage->getMatched(i))->getTotAdc();
564 // 1 *********************************************************************
565  if(!strcmp(currentKind,"1p1n"))// case (1-1) checked
566  {
567  StSstPoint *newPoint = new StSstPoint(mPoint->getSize(), mId, currentPackage->getNPackage(), 11);
568  newPoint->setFlag(100);
569  setMatcheds(dimensions, newPoint, currentPackage->getMatched(0), currentPackage->getMatched(1));
570  newPoint->setEnergyLossCorrected(Adc[0], Adc[1],CalibArray);
571  mPoint->addNewPoint(newPoint);
572  nPerfect++;
573  }
574 // *********************************************************************
575  delete [] Adc;
576  currentPackage=mPackage->next(currentPackage);
577  }
578  return nPerfect;
579 }
580 //________________________________________________________________________________
581 void StSstWafer::doStatPerfect(Int_t nPerfectPoint, StSstClusterControl *clusterControl)
582 {
583  Float_t store = 0;
584  StSstPoint *currentPerfect = 0;
585  currentPerfect = mPoint->first();
586  while(currentPerfect)
587  {
588  store += currentPerfect->getDe(1);
589  currentPerfect = mPoint->next(currentPerfect);
590  }
591  mPerfectMean = store/nPerfectPoint;
592 
593  store = 0;
594  currentPerfect = mPoint->first();
595  while(currentPerfect)
596  {
597  store += (currentPerfect->getDe(1)-mPerfectMean)*(currentPerfect->getDe(1)-mPerfectMean);
598  currentPerfect=mPoint->next(currentPerfect);
599  }
600  mPerfectSigma = store/nPerfectPoint;
601 }
602 //________________________________________________________________________________
603 Int_t StSstWafer::doSolvePackage(sstDimensions_st *dimensions, StSstClusterControl *clusterControl,Float_t CalibArray)
604 {
605  Int_t nSolved = 0;
606  StSstPackage *currentPackage = 0;
607  char *currentKind = 0;
608  currentPackage = mPackage->first();
609  while(currentPackage)
610  {
611  currentKind = currentPackage->getKind();
612  Int_t numMatched = strlen(currentKind)/2;
613  Float_t *Adc = new float[numMatched];
614  for(Int_t i=0;i<numMatched;i++) Adc[i]=(currentPackage->getMatched(i))->getTotAdc();
615 // 1 ********************************************************************
616  if(!strcmp(currentKind,"1p1n"))// case (1-1) done in doSolvePerfect
617  {
618  }
619 // 2 ********************************************************************
620  else if(!strcmp(currentKind,"1p1n2n"))// case (1-2)A final check Ok
621  {
622  StSstPoint *newPointA = new StSstPoint(mPoint->getSize(), mId, currentPackage->getNPackage(), 12);
623  setMatcheds(dimensions, newPointA, currentPackage->getMatched(0), currentPackage->getMatched(1));
624  newPointA->setEnergyLossCorrected(Adc[0]-Adc[2], Adc[1],CalibArray);
625  newPointA->setFlag(100);
626  mPoint->addNewPoint(newPointA);
627 
628  StSstPoint *newPointB = new StSstPoint(mPoint->getSize(), mId, currentPackage->getNPackage(), 12);
629  setMatcheds(dimensions, newPointB, currentPackage->getMatched(0), currentPackage->getMatched(2));
630  newPointB->setEnergyLossCorrected(Adc[0]-Adc[1], Adc[2],CalibArray);
631  newPointB->setFlag(100);
632  mPoint->addNewPoint(newPointB);
633  nSolved++;
634  }
635 // 3 *********************************************************************
636  else if(!strcmp(currentKind,"1p1n2p1n"))// case (1-2)AS final check Ok
637  {
638  StSstPoint *newPointA = new StSstPoint(mPoint->getSize(), mId, currentPackage->getNPackage(), 21);
639  setMatcheds(dimensions, newPointA, currentPackage->getMatched(0), currentPackage->getMatched(1));
640  newPointA->setEnergyLossCorrected(Adc[0], Adc[1]-Adc[2],CalibArray);
641  newPointA->setFlag(100);
642  mPoint->addNewPoint(newPointA);
643 
644  StSstPoint *newPointB = new StSstPoint(mPoint->getSize(), mId, currentPackage->getNPackage(), 21);
645  setMatcheds(dimensions, newPointB, currentPackage->getMatched(2), currentPackage->getMatched(1));
646  newPointB->setEnergyLossCorrected(Adc[2], Adc[1]-Adc[0],CalibArray);
647  newPointB->setFlag(100);
648  mPoint->addNewPoint(newPointB);
649  nSolved++;
650  }
651 // ********************************************************************
652  else if(!strcmp(currentKind,"1p1n2n3n"))// case (1-3)A checked
653  {
654  StSstPoint *newPointA = new StSstPoint(mPoint->getSize(), mId, currentPackage->getNPackage(), 13);
655  setMatcheds(dimensions, newPointA, currentPackage->getMatched(0), currentPackage->getMatched(1));
656  newPointA->setEnergyLossCorrected(Adc[0]-Adc[2]-Adc[3], Adc[1],CalibArray);
657  newPointA->setFlag(100);
658  mPoint->addNewPoint(newPointA);
659 
660  StSstPoint *newPointB = new StSstPoint(mPoint->getSize(), mId, currentPackage->getNPackage(), 13);
661  setMatcheds(dimensions, newPointB, currentPackage->getMatched(0), currentPackage->getMatched(2));
662  newPointB->setEnergyLossCorrected(Adc[0]-Adc[1]-Adc[3], Adc[2],CalibArray);
663  newPointB->setFlag(100);
664  mPoint->addNewPoint(newPointB);
665 
666  StSstPoint *newPointC = new StSstPoint(mPoint->getSize(), mId, currentPackage->getNPackage(), 13);
667  setMatcheds(dimensions, newPointC, currentPackage->getMatched(0), currentPackage->getMatched(3));
668  newPointC->setEnergyLossCorrected(Adc[0]-Adc[1]-Adc[2], Adc[3],CalibArray);
669  newPointC->setFlag(100);
670  mPoint->addNewPoint(newPointC);
671  nSolved++;
672  }
673 // *********************************************************************
674  else if(!strcmp(currentKind,"1p1n2p1n3p1n"))// case (1-3)AS checked
675  {
676  StSstPoint *newPointA = new StSstPoint(mPoint->getSize(), mId, currentPackage->getNPackage(), 31);
677  setMatcheds(dimensions, newPointA, currentPackage->getMatched(0), currentPackage->getMatched(1));
678  newPointA->setEnergyLossCorrected(Adc[0], Adc[1]-Adc[2]-Adc[4],CalibArray);
679  newPointA->setFlag(100);
680  mPoint->addNewPoint(newPointA);
681 
682  StSstPoint *newPointB = new StSstPoint(mPoint->getSize(), mId, currentPackage->getNPackage(), 31);
683  setMatcheds(dimensions, newPointB, currentPackage->getMatched(2), currentPackage->getMatched(1));
684  newPointB->setEnergyLossCorrected(Adc[2], Adc[1]-Adc[0]-Adc[4],CalibArray);
685  newPointB->setFlag(100);
686  mPoint->addNewPoint(newPointB);
687 
688  StSstPoint *newPointC = new StSstPoint(mPoint->getSize(), mId, currentPackage->getNPackage(), 31);
689  setMatcheds(dimensions, newPointC, currentPackage->getMatched(4), currentPackage->getMatched(1));
690  newPointC->setEnergyLossCorrected(Adc[4], Adc[1]-Adc[0]-Adc[2],CalibArray);
691  newPointC->setFlag(100);
692  mPoint->addNewPoint(newPointC);
693  nSolved++;
694  }
695 // 4 *********************************************************************
696  else if(!strcmp(currentKind,"1p1n2n2p2n"))// case (2-2)A checked
697  {
698  StSstPoint *newPointA = new StSstPoint(mPoint->getSize(), mId, currentPackage->getNPackage(), 221);
699  setMatcheds(dimensions, newPointA, currentPackage->getMatched(0), currentPackage->getMatched(1));
700  newPointA->setEnergyLossCorrected(Adc[0], Adc[1],CalibArray);
701  newPointA->setFlag(100);
702  mPoint->addNewPoint(newPointA);
703 
704  StSstPoint *newPointB = new StSstPoint(mPoint->getSize(), mId, currentPackage->getNPackage(), 221);
705  setMatcheds(dimensions, newPointB, currentPackage->getMatched(3), currentPackage->getMatched(2));
706  newPointB->setEnergyLossCorrected(Adc[3], Adc[2],CalibArray);
707  newPointB->setFlag(100);
708  mPoint->addNewPoint(newPointB);
709  nSolved++;
710  }
711 // 5 *********************************************************************
712  else if(!strcmp(currentKind,"1p1n2p1n2n"))// case (2-2)AP checked
713  {
714  StSstPoint *newPointA = new StSstPoint(mPoint->getSize(), mId, currentPackage->getNPackage(), 222);
715  setMatcheds(dimensions, newPointA, currentPackage->getMatched(0), currentPackage->getMatched(1));
716  newPointA->setEnergyLossCorrected(Adc[0], Adc[1],CalibArray);
717  newPointA->setFlag(100);
718  mPoint->addNewPoint(newPointA);
719 
720  StSstPoint *newPointB = new StSstPoint(mPoint->getSize(), mId, currentPackage->getNPackage(), 222);
721  setMatcheds(dimensions, newPointB, currentPackage->getMatched(2), currentPackage->getMatched(4));
722  newPointB->setEnergyLossCorrected(Adc[2], Adc[4],CalibArray);
723  newPointB->setFlag(100);
724  mPoint->addNewPoint(newPointB);
725  nSolved++;
726  }
727 // 6 *********************************************************************
728  else if(!strcmp(currentKind,"1p1n2n2p1n2n"))// case (2-2)B checked
729  {
730  StSstPoint *newPointA = new StSstPoint(mPoint->getSize(), mId, currentPackage->getNPackage(), 223);
731  setMatcheds(dimensions, newPointA, currentPackage->getMatched(0), currentPackage->getMatched(1));
732  newPointA->setEnergyLossCorrected(Adc[0], Adc[1],CalibArray);
733 
734  StSstPoint *newPointB = new StSstPoint(mPoint->getSize(), mId, currentPackage->getNPackage(), 223);
735  setMatcheds(dimensions, newPointB, currentPackage->getMatched(0), currentPackage->getMatched(2));
736  newPointB->setEnergyLossCorrected(Adc[0], Adc[2],CalibArray);
737 
738  StSstPoint *newPointC = new StSstPoint(mPoint->getSize(), mId, currentPackage->getNPackage(), 223);
739  setMatcheds(dimensions, newPointC, currentPackage->getMatched(3), currentPackage->getMatched(1));
740  newPointC->setEnergyLossCorrected(Adc[3], Adc[1],CalibArray);
741 
742  StSstPoint *newPointD = new StSstPoint(mPoint->getSize(), mId, currentPackage->getNPackage(), 223);
743  setMatcheds(dimensions, newPointD, currentPackage->getMatched(3), currentPackage->getMatched(2));
744  newPointD->setEnergyLossCorrected(Adc[3], Adc[2],CalibArray);
745 
746 // traitement propre aux space points..(probabilite)
747  Double_t setA[2], setB[2], setC[2], setD[2];
748  Double_t probAD, probBC;
749 
750  setA[0] = (Adc[0] - Adc[1])/sqrt(2.0);
751  setA[1] = matchDistr(clusterControl, setA[0]);
752  setB[0] = (Adc[0] - Adc[2])/sqrt(2.0);
753  setB[1] = matchDistr(clusterControl, setB[0]);
754  setC[0] = (Adc[3] - Adc[1])/sqrt(2.0);
755  setC[1] = matchDistr(clusterControl, setC[0]);
756  setD[0] = (Adc[3] - Adc[2])/sqrt(2.0);
757  setD[1] = matchDistr(clusterControl, setD[0]);
758  if ((setA[1]*setD[1])||(setB[1]*setC[1]))
759  {
760  Double_t tmp = 3e-33+(setA[1]*setD[1]+setB[1]*setC[1]);
761  probAD = (setA[1]*setD[1])/tmp;
762  probBC = (setB[1]*setC[1])/tmp;
763  if(probAD>probBC)// we store only pointA and pointD because this configuration has the higher probability
764  {
765  newPointA->setFlag(int(100*probAD));
766  newPointD->setFlag(int(100*probAD));
767  mPoint->addNewPoint(newPointA);
768  mPoint->addNewPoint(newPointD);
769  delete newPointC;
770  delete newPointB;
771  }
772  else
773  {
774  newPointB->setFlag(int(100*probBC));
775  newPointC->setFlag(int(100*probBC));
776  mPoint->addNewPoint(newPointB);
777  mPoint->addNewPoint(newPointC);
778  delete newPointA;
779  delete newPointD;
780  }
781  }
782  else
783  {
784  probAD = 0.5;
785  probBC = 0.5;
786  newPointA->setFlag(int(100*probAD));
787  newPointB->setFlag(int(100*probBC));
788  newPointC->setFlag(int(100*probBC));
789  newPointD->setFlag(int(100*probAD));
790  mPoint->addNewPoint(newPointA);
791  mPoint->addNewPoint(newPointD);
792  mPoint->addNewPoint(newPointB);
793  mPoint->addNewPoint(newPointC);
794  }
795  nSolved++;
796  }
797 // 7 *********************************************************************
798  else if(!strcmp(currentKind,"1p1n2n2p2n3n"))// case (2-3)A checked
799  {
800  StSstPoint *newPointA = new StSstPoint(mPoint->getSize(), mId, currentPackage->getNPackage(), 23);
801  setMatcheds(dimensions, newPointA, currentPackage->getMatched(0), currentPackage->getMatched(1));
802  newPointA->setFlag(100);
803 
804  StSstPoint *newPointB = new StSstPoint(mPoint->getSize(), mId, currentPackage->getNPackage(), 23);
805  setMatcheds(dimensions, newPointB, currentPackage->getMatched(0), currentPackage->getMatched(2));
806  newPointB->setEnergyLossCorrected(Adc[0]-Adc[1], Adc[2],CalibArray);
807 
808  StSstPoint *newPointC = new StSstPoint(mPoint->getSize(), mId, currentPackage->getNPackage(), 23);
809  setMatcheds(dimensions, newPointC, currentPackage->getMatched(3), currentPackage->getMatched(2));
810  newPointC->setEnergyLossCorrected(Adc[3]-Adc[5], Adc[2],CalibArray);
811 
812  StSstPoint *newPointD = new StSstPoint(mPoint->getSize(), mId, currentPackage->getNPackage(), 23);
813  setMatcheds(dimensions, newPointD, currentPackage->getMatched(3), currentPackage->getMatched(5));
814  newPointD->setFlag(100);
815 
816 // traitement propre aux space points..(probabilite)
817  Double_t setA[2], setD[2];
818  Double_t setAB[2], setCD[2];
819  Double_t probABD, probACD;
820 
821  setA[0] = (Adc[0] - Adc[1])/sqrt(2.0);
822  setA[1] = matchDistr(clusterControl, setA[0]);
823  setAB[0] = (Adc[0] - (Adc[1]+Adc[2]))/sqrt(2.0);
824  setAB[1] = matchDistr(clusterControl, setAB[0]);
825  setCD[0] = (Adc[3] - (Adc[2]+Adc[5]))/sqrt(2.0);
826  setCD[1] = matchDistr(clusterControl, setCD[0]);
827  setD[0] = (Adc[3] - Adc[5])/sqrt(2.0);
828  setD[1] = matchDistr(clusterControl, setD[0]);
829  Double_t tmp = 3e-33+(setAB[1]*setD[1]+setA[1]*setCD[1]+1e-10);
830  probABD = (setAB[1]*setD[1])/tmp;
831  probACD = (setA[1]*setCD[1])/tmp;
832  newPointB->setFlag(int(100*probABD));
833  newPointC->setFlag(int(100*probACD));
834  if (probABD > probACD)
835  {
836  newPointA->setEnergyLossCorrected(Adc[0]-Adc[2],Adc[1],CalibArray);
837  newPointD->setEnergyLossCorrected(Adc[3], Adc[5],CalibArray);
838  mPoint->addNewPoint(newPointA);
839  mPoint->addNewPoint(newPointB);
840  mPoint->addNewPoint(newPointD);
841  delete newPointC;
842  }
843  else
844  {
845  newPointA->setEnergyLossCorrected(Adc[0], Adc[1],CalibArray);
846  newPointD->setEnergyLossCorrected(Adc[3]-Adc[2], Adc[5],CalibArray);
847  mPoint->addNewPoint(newPointA);
848  mPoint->addNewPoint(newPointB);
849  mPoint->addNewPoint(newPointC);
850  delete newPointD;
851  }
852  nSolved++;
853  }
854 // 8 *********************************************************************
855  else if(!strcmp(currentKind,"1p1n2p1n2n3p2n"))// case (2-3)AP checked
856  {
857  StSstPoint *newPointA = new StSstPoint(mPoint->getSize(), mId, currentPackage->getNPackage(), 32);
858  setMatcheds(dimensions, newPointA, currentPackage->getMatched(0), currentPackage->getMatched(1));
859  newPointA->setFlag(100);
860 
861  StSstPoint *newPointB = new StSstPoint(mPoint->getSize(), mId, currentPackage->getNPackage(), 32);
862  setMatcheds(dimensions, newPointB, currentPackage->getMatched(2), currentPackage->getMatched(1));
863  newPointB->setEnergyLossCorrected(Adc[2], Adc[1]-Adc[0],CalibArray);
864 
865  StSstPoint *newPointC = new StSstPoint(mPoint->getSize(), mId, currentPackage->getNPackage(), 32);
866  setMatcheds(dimensions, newPointC, currentPackage->getMatched(2), currentPackage->getMatched(4));
867  newPointC->setEnergyLossCorrected(Adc[2], Adc[4]-Adc[5],CalibArray);
868 
869  StSstPoint *newPointD = new StSstPoint(mPoint->getSize(), mId, currentPackage->getNPackage(), 32);
870  setMatcheds(dimensions, newPointD, currentPackage->getMatched(5), currentPackage->getMatched(4));
871  newPointD->setFlag(100);
872 
873 // traitement propre aux space points..(probabilite)
874  Double_t setA[2], setD[2];
875  Double_t setAB[2], setCD[2];
876  Double_t probABD, probACD;
877 
878  setA[0] = (Adc[0] - Adc[1])/sqrt(2.0);
879  setA[1] = matchDistr(clusterControl, setA[0]);
880  setAB[0] = (Adc[0] + Adc[2] - Adc[1])/sqrt(2.0);
881  setAB[1] = matchDistr(clusterControl, setAB[0]);
882  setCD[0] = (Adc[2] + Adc[5] - Adc[4])/sqrt(2.0);
883  setCD[1] = matchDistr(clusterControl, setCD[0]);
884  setD[0] = (Adc[5] - Adc[4])/sqrt(2.0);
885  setD[1] = matchDistr(clusterControl, setD[0]);
886  Double_t tmp = 3e-33+(setAB[1]*setD[1]+setA[1]*setCD[1]);
887  probABD = (setAB[1]*setD[1])/tmp;
888  probACD = (setA[1]*setCD[1])/tmp;
889  newPointB->setFlag(int(100*probABD));
890  newPointC->setFlag(int(100*probACD));
891  if (probABD > probACD)
892  {
893  newPointA->setEnergyLossCorrected(Adc[0], Adc[1]-Adc[2],CalibArray);
894  newPointD->setEnergyLossCorrected(Adc[5], Adc[4],CalibArray);
895  mPoint->addNewPoint(newPointA);
896  mPoint->addNewPoint(newPointB);
897  mPoint->addNewPoint(newPointD);
898  delete newPointC;
899  }
900  else
901  {
902  newPointA->setEnergyLossCorrected(Adc[0], Adc[1],CalibArray);
903  newPointD->setEnergyLossCorrected(Adc[5], Adc[4]-Adc[2],CalibArray);
904  mPoint->addNewPoint(newPointA);
905  mPoint->addNewPoint(newPointB);
906  mPoint->addNewPoint(newPointC);
907  delete newPointD;
908  }
909  nSolved++;
910  }
911 // 9 *********************************************************************
912  else if(!strcmp(currentKind,"1p1n2n3n2p2n3n"))// case (2-3)B
913  {
914  StSstPoint *newPointA = new StSstPoint(mPoint->getSize(), mId, currentPackage->getNPackage(), 23);
915  setMatcheds(dimensions, newPointA, currentPackage->getMatched(0), currentPackage->getMatched(1));
916  newPointA->setFlag(100);
917 
918  StSstPoint *newPointB = new StSstPoint(mPoint->getSize(), mId, currentPackage->getNPackage(), 23);
919  setMatcheds(dimensions, newPointB, currentPackage->getMatched(0), currentPackage->getMatched(2));
920  newPointB->setEnergyLossCorrected(Adc[0]-Adc[1], Adc[2],CalibArray);
921 
922  StSstPoint *newPointC = new StSstPoint(mPoint->getSize(), mId, currentPackage->getNPackage(), 23);
923  setMatcheds(dimensions, newPointC, currentPackage->getMatched(0), currentPackage->getMatched(3));
924  newPointC->setEnergyLossCorrected(Adc[0]-Adc[1], Adc[3],CalibArray);
925 
926  StSstPoint *newPointD = new StSstPoint(mPoint->getSize(), mId, currentPackage->getNPackage(), 23);
927  setMatcheds(dimensions, newPointD, currentPackage->getMatched(4), currentPackage->getMatched(2));
928 
929  StSstPoint *newPointE = new StSstPoint(mPoint->getSize(), mId, currentPackage->getNPackage(), 23);
930  setMatcheds(dimensions, newPointE, currentPackage->getMatched(4), currentPackage->getMatched(3));
931 
932 // traitement propre aux space points..(probabilite)
933  Double_t setA[2], setD[2], setE[2];
934  Double_t setAB[2], setAC[2], setDE[2];
935  Double_t probABE, probACD, probADE;
936 
937  setA[0] = (Adc[0] - Adc[1])/sqrt(2.0);
938  setA[1] = matchDistr(clusterControl, setA[0]);
939  setAB[0] = (Adc[0] - (Adc[1] + Adc[2]))/sqrt(2.0);
940  setAB[1] = matchDistr(clusterControl, setAB[0]);
941  setAC[0] = (Adc[0] - (Adc[1] + Adc[3]))/sqrt(2.0);
942  setAC[1] = matchDistr(clusterControl, setAC[0]);
943  setDE[0] = (Adc[4] - (Adc[2] + Adc[3]))/sqrt(2.0);
944  setDE[1] = matchDistr(clusterControl, setDE[0]);
945  setD[0] = (Adc[4] - Adc[2])/sqrt(2.0);
946  setD[1] = matchDistr(clusterControl, setD[0]);
947  setE[0] = (Adc[4] - Adc[3])/sqrt(2.0);
948  setE[1] = matchDistr(clusterControl, setE[0]);
949  Double_t tmp = 3e-33+(setAB[1]*setE[1]+setAC[1]*setD[1]+setA[1]*setDE[1]);
950  probABE = (setAB[1]*setE[1])/tmp;
951  probACD = (setAC[1]*setD[1])/tmp;
952  probADE = (setA[1]*setDE[1])/tmp;
953  newPointB->setFlag(int(100*probABE));
954  newPointC->setFlag(int(100*probACD));
955  newPointD->setFlag(int(100*(probACD+probADE)));
956  newPointE->setFlag(int(100*(probABE+probADE)));
957  if ((probABE > probACD)&&(probABE > probADE))
958  {
959  newPointA->setEnergyLossCorrected(Adc[0]-Adc[2],Adc[1],CalibArray);
960  newPointE->setEnergyLossCorrected(Adc[4],Adc[3],CalibArray);
961  mPoint->addNewPoint(newPointA);
962  mPoint->addNewPoint(newPointB);
963  mPoint->addNewPoint(newPointE);
964  //delete newPointC;
965  //delete newPointD;
966  }
967  else if ((probACD > probABE)&&(probACD > probADE))
968  {
969  newPointA->setEnergyLossCorrected(Adc[0]-Adc[3],Adc[1],CalibArray);
970  newPointD->setEnergyLossCorrected(Adc[4],Adc[2],CalibArray);
971  mPoint->addNewPoint(newPointA);
972  mPoint->addNewPoint(newPointC);
973  mPoint->addNewPoint(newPointD);
974  //delete newPointB;
975  //delete newPointE;
976  }
977  else if ((probADE > probABE)&&(probADE > probACD))
978  {
979  newPointA->setEnergyLossCorrected(Adc[0],Adc[1],CalibArray);
980  newPointD->setEnergyLossCorrected(Adc[4]-Adc[3],Adc[2],CalibArray);
981  newPointE->setEnergyLossCorrected(Adc[4]-Adc[2],Adc[3],CalibArray);
982  mPoint->addNewPoint(newPointA);
983  mPoint->addNewPoint(newPointB);
984  mPoint->addNewPoint(newPointE);
985  //delete newPointC;
986  //delete newPointD;
987  }
988  nSolved++;
989  }
990 // 10 *********************************************************************
991  else if(!strcmp(currentKind,"1p1n2p1n2n3p1n2n"))// case (3-2)BP
992  {
993  StSstPoint *newPointA = new StSstPoint(mPoint->getSize(), mId, currentPackage->getNPackage(), 32);
994  setMatcheds(dimensions, newPointA, currentPackage->getMatched(0), currentPackage->getMatched(1));
995  newPointA->setFlag(100);
996 
997  StSstPoint *newPointB = new StSstPoint(mPoint->getSize(), mId, currentPackage->getNPackage(), 32);
998  setMatcheds(dimensions, newPointB, currentPackage->getMatched(2), currentPackage->getMatched(1));
999  newPointB->setEnergyLossCorrected(Adc[2], Adc[1]-Adc[0],CalibArray);
1000 
1001  StSstPoint *newPointC = new StSstPoint(mPoint->getSize(), mId, currentPackage->getNPackage(), 32);
1002  setMatcheds(dimensions, newPointC, currentPackage->getMatched(2), currentPackage->getMatched(4));
1003 
1004  StSstPoint *newPointD = new StSstPoint(mPoint->getSize(), mId, currentPackage->getNPackage(), 32);
1005  setMatcheds(dimensions, newPointD, currentPackage->getMatched(5), currentPackage->getMatched(1));
1006  newPointD->setEnergyLossCorrected(Adc[5], Adc[1]-Adc[0],CalibArray);
1007 
1008  StSstPoint *newPointE = new StSstPoint(mPoint->getSize(), mId, currentPackage->getNPackage(), 32);
1009  setMatcheds(dimensions, newPointE, currentPackage->getMatched(5), currentPackage->getMatched(4));
1010 
1011 // traitement propre aux space points..(probabilite)
1012  Double_t setA[2], setC[2], setE[2];
1013  Double_t setAB[2], setAD[2], setCE[2];
1014  Double_t probABE, probACD, probACE;
1015 
1016  setA[0] = (Adc[0] - Adc[1])/sqrt(2.0);
1017  setA[1] = matchDistr(clusterControl, setA[0]);
1018  setAB[0] = (Adc[0] + Adc[2] - Adc[1])/sqrt(2.0);
1019  setAB[1] = matchDistr(clusterControl, setAB[0]);
1020  setAD[0] = (Adc[0] + Adc[5] - Adc[1])/sqrt(2.0);
1021  setAD[1] = matchDistr(clusterControl, setAD[0]);
1022  setCE[0] = (Adc[2] + Adc[5] + Adc[4])/sqrt(2.0);
1023  setCE[1] = matchDistr(clusterControl, setCE[0]);
1024  setC[0] = (Adc[2] - Adc[4])/sqrt(2.0);
1025  setC[1] = matchDistr(clusterControl, setC[0]);
1026  setE[0] = (Adc[5] - Adc[4])/sqrt(2.0);
1027  setE[1] = matchDistr(clusterControl, setE[0]);
1028  Double_t tmp = 3e-33+(setAB[1]*setE[1]+setAD[1]*setC[1]+setA[1]*setCE[1]);
1029  probABE = (setAB[1]*setE[1])/tmp;
1030  probACD = (setAD[1]*setC[1])/tmp;
1031  probACE = (setA[1]*setCE[1])/tmp;
1032  newPointB->setFlag(int(100*probABE));
1033  newPointC->setFlag(int(100*(probACD+probACE)));
1034  newPointD->setFlag(int(100*probACD));
1035  newPointE->setFlag(int(100*(probABE+probACE)));
1036  if ((probABE > probACD)&&(probABE > probACE))
1037  {
1038  newPointA->setEnergyLossCorrected(Adc[0],Adc[1]-Adc[2],CalibArray);
1039  newPointE->setEnergyLossCorrected(Adc[5],Adc[4],CalibArray);
1040  mPoint->addNewPoint(newPointA);
1041  mPoint->addNewPoint(newPointB);
1042  mPoint->addNewPoint(newPointE);
1043  //delete newPointC;
1044  //delete newPointD;
1045  }
1046  else if ((probACD > probABE)&&(probACD > probACE))
1047  {
1048  newPointA->setEnergyLossCorrected(Adc[0],Adc[1]-Adc[5],CalibArray);
1049  newPointC->setEnergyLossCorrected(Adc[2],Adc[4],CalibArray);
1050  mPoint->addNewPoint(newPointA);
1051  mPoint->addNewPoint(newPointC);
1052  mPoint->addNewPoint(newPointD);
1053  //delete newPointB;
1054  //delete newPointE;
1055  }
1056  else if ((probACE > probABE)&&(probACE > probACD))
1057  {
1058  newPointA->setEnergyLossCorrected(Adc[0],Adc[1],CalibArray);
1059  newPointC->setEnergyLossCorrected(Adc[2],Adc[4]-Adc[5],CalibArray);
1060  newPointE->setEnergyLossCorrected(Adc[5],Adc[4]-Adc[2],CalibArray);
1061  mPoint->addNewPoint(newPointA);
1062  mPoint->addNewPoint(newPointB);
1063  mPoint->addNewPoint(newPointE);
1064  //delete newPointC;
1065  //delete newPointD;
1066  }
1067  nSolved++;
1068  }
1069 // 11 ********************************************************************
1070  else if(!strcmp(currentKind,"1p1n2n2p1n2n3n"))// case (2-3)BS
1071  {
1072  StSstPoint *newPointA = new StSstPoint(mPoint->getSize(), mId, currentPackage->getNPackage(), 23);
1073  setMatcheds(dimensions, newPointA, currentPackage->getMatched(0), currentPackage->getMatched(1));
1074 
1075  StSstPoint *newPointB = new StSstPoint(mPoint->getSize(), mId, currentPackage->getNPackage(), 23);
1076  setMatcheds(dimensions, newPointB, currentPackage->getMatched(0), currentPackage->getMatched(2));
1077 
1078  StSstPoint *newPointC = new StSstPoint(mPoint->getSize(), mId, currentPackage->getNPackage(), 23);
1079  setMatcheds(dimensions, newPointC, currentPackage->getMatched(3), currentPackage->getMatched(1));
1080  newPointC->setEnergyLossCorrected(Adc[3]-Adc[6],Adc[1],CalibArray);
1081 
1082  StSstPoint *newPointD = new StSstPoint(mPoint->getSize(), mId, currentPackage->getNPackage(), 23);
1083  setMatcheds(dimensions, newPointD, currentPackage->getMatched(3), currentPackage->getMatched(2));
1084  newPointD->setEnergyLossCorrected(Adc[3]-Adc[6], Adc[2],CalibArray);
1085 
1086  StSstPoint *newPointE = new StSstPoint(mPoint->getSize(), mId, currentPackage->getNPackage(), 23);
1087  setMatcheds(dimensions, newPointE, currentPackage->getMatched(3), currentPackage->getMatched(6));
1088  newPointE->setFlag(100);
1089 
1090 // traitement propre aux space points..(probabilite)
1091  Double_t setA[2], setB[2], setE[2];
1092  Double_t setAB[2], setCE[2], setDE[2];
1093  Double_t probABE, probADE, probBCE;
1094 
1095  setA[0] = (Adc[0] - Adc[1])/sqrt(2.0);
1096  setA[1] = matchDistr(clusterControl, setA[0]);
1097  setB[0] = (Adc[0] - Adc[2])/sqrt(2.0);
1098  setB[1] = matchDistr(clusterControl, setB[0]);
1099  setAB[0] = (Adc[0] - (Adc[1] + Adc[2]))/sqrt(2.0);
1100  setAB[1] = matchDistr(clusterControl, setAB[0]);
1101  setCE[0] = (Adc[3] - (Adc[1] - Adc[6]))/sqrt(2.0);
1102  setCE[1] = matchDistr(clusterControl, setCE[0]);
1103  setDE[0] = (Adc[3] - (Adc[2] + Adc[6]))/sqrt(2.0);
1104  setDE[1] = matchDistr(clusterControl, setDE[0]);
1105  setE[0] = (Adc[3] - Adc[6])/sqrt(2.0);
1106  setE[1] = matchDistr(clusterControl, setE[0]);
1107  Double_t tmp = 3e-33+(setAB[1]*setE[1]+setA[1]*setDE[1]+setB[1]*setCE[1]);
1108  probABE = (setAB[1]*setE[1])/tmp;
1109  probADE = (setA[1]*setDE[1])/tmp;
1110  probBCE = (setB[1]*setCE[1])/tmp;
1111  newPointA->setFlag(int(100*(probABE+probADE)));
1112  newPointB->setFlag(int(100*(probABE+probBCE)));
1113  newPointC->setFlag(int(100*probBCE));
1114  newPointD->setFlag(int(100*probADE));
1115  if ((probABE > probADE)&&(probABE > probBCE))
1116  {
1117  newPointA->setEnergyLossCorrected(Adc[0]-Adc[2],Adc[1],CalibArray);
1118  newPointB->setEnergyLossCorrected(Adc[0]-Adc[1],Adc[2],CalibArray);
1119  newPointE->setEnergyLossCorrected(Adc[3],Adc[6],CalibArray);
1120  mPoint->addNewPoint(newPointA);
1121  mPoint->addNewPoint(newPointB);
1122  mPoint->addNewPoint(newPointE);
1123  //delete newPointC;
1124  //delete newPointD;
1125  }
1126  if ((probADE > probABE)&&(probADE > probBCE))
1127  {
1128  newPointA->setEnergyLossCorrected(Adc[0],Adc[1],CalibArray);
1129  newPointE->setEnergyLossCorrected(Adc[3]-Adc[2],Adc[6],CalibArray);
1130  mPoint->addNewPoint(newPointA);
1131  mPoint->addNewPoint(newPointD);
1132  mPoint->addNewPoint(newPointE);
1133  //delete newPointB;
1134  //delete newPointC;
1135  }
1136  if ((probBCE > probABE)&&(probBCE > probADE))
1137  {
1138  newPointB->setEnergyLossCorrected(Adc[0],Adc[2],CalibArray);
1139  newPointE->setEnergyLossCorrected(Adc[3]-Adc[1],Adc[6],CalibArray);
1140  mPoint->addNewPoint(newPointB);
1141  mPoint->addNewPoint(newPointC);
1142  mPoint->addNewPoint(newPointE);
1143  //delete newPointA;
1144  //delete newPointD;
1145  }
1146  nSolved++;
1147  }
1148  // 12 ********************************************************************
1149  else if(!strcmp(currentKind,"1p1n2n2p1n2n3p2n"))// case (3-2)BSP
1150  {
1151  StSstPoint *newPointA = new StSstPoint(mPoint->getSize(), mId, currentPackage->getNPackage(), 32);
1152  setMatcheds(dimensions, newPointA, currentPackage->getMatched(0), currentPackage->getMatched(1));
1153 
1154  StSstPoint *newPointB = new StSstPoint(mPoint->getSize(), mId, currentPackage->getNPackage(), 32);
1155  setMatcheds(dimensions, newPointB, currentPackage->getMatched(0), currentPackage->getMatched(2));
1156  newPointB->setEnergyLossCorrected(Adc[0]-Adc[6], Adc[2],CalibArray);
1157 
1158  StSstPoint *newPointC = new StSstPoint(mPoint->getSize(), mId, currentPackage->getNPackage(), 32);
1159  setMatcheds(dimensions, newPointC, currentPackage->getMatched(3), currentPackage->getMatched(1));
1160 
1161  StSstPoint *newPointD = new StSstPoint(mPoint->getSize(), mId, currentPackage->getNPackage(), 32);
1162  setMatcheds(dimensions, newPointD, currentPackage->getMatched(3), currentPackage->getMatched(2));
1163  newPointD->setEnergyLossCorrected(Adc[3]-Adc[6], Adc[2],CalibArray);
1164 
1165  StSstPoint *newPointE = new StSstPoint(mPoint->getSize(), mId, currentPackage->getNPackage(), 32);
1166  setMatcheds(dimensions, newPointE, currentPackage->getMatched(6), currentPackage->getMatched(2));
1167  newPointE->setFlag(100);
1168 
1169 // traitement propre aux space points..(probabilite)
1170  Double_t setA[2], setC[2], setE[2];
1171  Double_t setAC[2], setBE[2], setDE[2];
1172  Double_t probACE, probADE, probBCE;
1173 
1174  setA[0] = (Adc[0] - Adc[1])/sqrt(2.0);
1175  setA[1] = matchDistr(clusterControl, setA[0]);
1176  setAC[0] = (Adc[0] + Adc[3] - Adc[1])/sqrt(2.0);
1177  setAC[1] = matchDistr(clusterControl, setAC[0]);
1178  setBE[0] = (Adc[0] + Adc[6] - Adc[2])/sqrt(2.0);
1179  setBE[1] = matchDistr(clusterControl, setBE[0]);
1180  setC[0] = (Adc[3] - Adc[1])/sqrt(2.0);
1181  setC[1] = matchDistr(clusterControl, setC[0]);
1182  setDE[0] = (Adc[3] + Adc[6] - Adc[2])/sqrt(2.0);
1183  setDE[1] = matchDistr(clusterControl, setDE[0]);
1184  setE[0] = (Adc[6] - Adc[2])/sqrt(2.0);
1185  setE[1] = matchDistr(clusterControl, setE[0]);
1186  Double_t tmp = 3e-33+(setAC[1]*setE[1]+setA[1]*setDE[1]+setBE[1]*setC[1]);
1187  probACE = (setAC[1]*setE[1])/tmp;
1188  probADE = (setA[1]*setDE[1])/tmp;
1189  probBCE = (setBE[1]*setC[1])/tmp;
1190  newPointA->setFlag(int(100*(probACE+probADE)));
1191  newPointB->setFlag(int(100*probBCE));
1192  newPointC->setFlag(int(100*(probACE+probBCE)));
1193  newPointD->setFlag(int(100*probADE));
1194  if ((probACE > probADE)&&(probACE > probBCE))
1195  {
1196  newPointA->setEnergyLossCorrected(Adc[0],Adc[1]-Adc[3],CalibArray);
1197  newPointC->setEnergyLossCorrected(Adc[3],Adc[1]-Adc[0],CalibArray);
1198  newPointE->setEnergyLossCorrected(Adc[6],Adc[2],CalibArray);
1199  mPoint->addNewPoint(newPointA);
1200  mPoint->addNewPoint(newPointC);
1201  mPoint->addNewPoint(newPointE);
1202  delete newPointB;
1203  delete newPointD;
1204  }
1205  else if ((probADE > probACE)&&(probADE > probBCE))
1206  {
1207  newPointA->setEnergyLossCorrected(Adc[0],Adc[1],CalibArray);
1208  newPointE->setEnergyLossCorrected(Adc[6],Adc[2]-Adc[3],CalibArray);
1209  mPoint->addNewPoint(newPointA);
1210  mPoint->addNewPoint(newPointD);
1211  mPoint->addNewPoint(newPointE);
1212  delete newPointB;
1213  delete newPointC;
1214  }
1215  else if ((probBCE > probACE)&&(probBCE > probADE))
1216  {
1217  newPointB->setEnergyLossCorrected(Adc[3],Adc[1],CalibArray);
1218  newPointE->setEnergyLossCorrected(Adc[6],Adc[2]-Adc[0],CalibArray);
1219  mPoint->addNewPoint(newPointB);
1220  mPoint->addNewPoint(newPointC);
1221  mPoint->addNewPoint(newPointE);
1222  delete newPointA;
1223  delete newPointD;
1224  }
1225  nSolved++;
1226  }
1227 // 13 ********************************************************************
1228  else if(!strcmp(currentKind,"1p1n2p1n2n3n"))// case (2-3)C checked
1229  {
1230  StSstPoint *newPointA = new StSstPoint(mPoint->getSize(), mId, currentPackage->getNPackage(), 23);
1231  setMatcheds(dimensions, newPointA, currentPackage->getMatched(0), currentPackage->getMatched(1));
1232  newPointA->setEnergyLossCorrected(Adc[0], Adc[1],CalibArray);
1233  newPointA->setFlag(100);
1234  mPoint->addNewPoint(newPointA);
1235 
1236  StSstPoint *newPointC = new StSstPoint(mPoint->getSize(), mId, currentPackage->getNPackage(), 23);
1237  setMatcheds(dimensions, newPointC, currentPackage->getMatched(2), currentPackage->getMatched(4));
1238  newPointC->setEnergyLossCorrected(Adc[2]-Adc[5], Adc[4],CalibArray);
1239  newPointC->setFlag(100);
1240  mPoint->addNewPoint(newPointC);
1241 
1242  StSstPoint *newPointD = new StSstPoint(mPoint->getSize(), mId, currentPackage->getNPackage(), 23);
1243  setMatcheds(dimensions, newPointD, currentPackage->getMatched(2), currentPackage->getMatched(5));
1244  newPointD->setEnergyLossCorrected(Adc[2]-Adc[4], Adc[5],CalibArray);
1245  newPointD->setFlag(100);
1246  mPoint->addNewPoint(newPointD);
1247 
1248  nSolved++;
1249  }
1250 // 14 ********************************************************************
1251  else if(!strcmp(currentKind,"1p1n2n2p2n3p2n"))// case (3-2)CP checked
1252  {
1253  StSstPoint *newPointA = new StSstPoint(mPoint->getSize(), mId, currentPackage->getNPackage(), 32);
1254  setMatcheds(dimensions, newPointA, currentPackage->getMatched(0), currentPackage->getMatched(1));
1255  newPointA->setEnergyLossCorrected(Adc[0], Adc[1],CalibArray);
1256  newPointA->setFlag(100);
1257  mPoint->addNewPoint(newPointA);
1258 
1259  StSstPoint *newPointC = new StSstPoint(mPoint->getSize(), mId, currentPackage->getNPackage(), 32);
1260  setMatcheds(dimensions, newPointC, currentPackage->getMatched(3), currentPackage->getMatched(2));
1261  newPointC->setEnergyLossCorrected(Adc[3], Adc[2]-Adc[5],CalibArray);
1262  newPointC->setFlag(100);
1263  mPoint->addNewPoint(newPointC);
1264 
1265  StSstPoint *newPointD = new StSstPoint(mPoint->getSize(), mId, currentPackage->getNPackage(), 32);
1266  setMatcheds(dimensions, newPointD, currentPackage->getMatched(5), currentPackage->getMatched(2)); // Fixed thanks to Lilian !
1267  newPointD->setEnergyLossCorrected(Adc[5], Adc[2]-Adc[3],CalibArray);
1268  newPointD->setFlag(100);
1269  mPoint->addNewPoint(newPointD);
1270 
1271  nSolved++;
1272  }
1273 // 15 ********************************************************************
1274  else if(!strcmp(currentKind,"1p1n2n3n2p3n"))// case (2-3)CS checked
1275  {
1276  StSstPoint *newPointA = new StSstPoint(mPoint->getSize(), mId, currentPackage->getNPackage(), 23);
1277  setMatcheds(dimensions, newPointA, currentPackage->getMatched(0), currentPackage->getMatched(1));
1278  newPointA->setEnergyLossCorrected(Adc[0]-Adc[2], Adc[1],CalibArray);
1279  newPointA->setFlag(100);
1280  mPoint->addNewPoint(newPointA);
1281 
1282  StSstPoint *newPointB = new StSstPoint(mPoint->getSize(), mId, currentPackage->getNPackage(), 23);
1283  setMatcheds(dimensions, newPointB, currentPackage->getMatched(0), currentPackage->getMatched(2));
1284  newPointB->setEnergyLossCorrected(Adc[0]-Adc[1], Adc[2],CalibArray);
1285  newPointB->setFlag(100);
1286  mPoint->addNewPoint(newPointB);
1287 
1288  StSstPoint *newPointD = new StSstPoint(mPoint->getSize(), mId, currentPackage->getNPackage(), 23);
1289  setMatcheds(dimensions, newPointD, currentPackage->getMatched(4), currentPackage->getMatched(5));
1290  newPointD->setEnergyLossCorrected(Adc[4], Adc[3],CalibArray);
1291  newPointD->setFlag(100);
1292  mPoint->addNewPoint(newPointD);
1293 
1294  nSolved++;
1295  }
1296 // 16 ********************************************************************
1297  else if(!strcmp(currentKind,"1p1n2p1n3p1n2n"))// case (3-2)CPS checked
1298  {
1299  StSstPoint *newPointA = new StSstPoint(mPoint->getSize(), mId, currentPackage->getNPackage(), 32);
1300  setMatcheds(dimensions, newPointA, currentPackage->getMatched(0), currentPackage->getMatched(1));
1301  newPointA->setEnergyLossCorrected(Adc[0], Adc[1]-Adc[2],CalibArray);
1302  newPointA->setFlag(100);
1303  mPoint->addNewPoint(newPointA);
1304 
1305  StSstPoint *newPointB = new StSstPoint(mPoint->getSize(), mId, currentPackage->getNPackage(), 32);
1306  setMatcheds(dimensions, newPointB, currentPackage->getMatched(2), currentPackage->getMatched(1));
1307  newPointB->setEnergyLossCorrected(Adc[2], Adc[1]-Adc[0],CalibArray);
1308  newPointB->setFlag(100);
1309  mPoint->addNewPoint(newPointB);
1310 
1311  StSstPoint *newPointD = new StSstPoint(mPoint->getSize(), mId, currentPackage->getNPackage(), 32);
1312  setMatcheds(dimensions, newPointD, currentPackage->getMatched(4), currentPackage->getMatched(6));
1313  newPointD->setEnergyLossCorrected(Adc[4], Adc[6],CalibArray);
1314  newPointD->setFlag(100);
1315  mPoint->addNewPoint(newPointD);
1316 
1317  nSolved++;
1318  }
1319 // 17 ********************************************************************
1320  else if(!strcmp(currentKind,"1p1n2n3n2p1n2n3n"))// case (2-3)D
1321  {
1322  StSstPoint *newPointA = new StSstPoint(mPoint->getSize(), mId, currentPackage->getNPackage(), 23);
1323  setMatcheds(dimensions, newPointA, currentPackage->getMatched(0), currentPackage->getMatched(1));
1324 
1325  StSstPoint *newPointB = new StSstPoint(mPoint->getSize(), mId, currentPackage->getNPackage(), 23);
1326  setMatcheds(dimensions, newPointB, currentPackage->getMatched(0), currentPackage->getMatched(2));
1327 
1328  StSstPoint *newPointC = new StSstPoint(mPoint->getSize(), mId, currentPackage->getNPackage(), 23);
1329  setMatcheds(dimensions, newPointC, currentPackage->getMatched(0), currentPackage->getMatched(3));
1330 
1331  StSstPoint *newPointD = new StSstPoint(mPoint->getSize(), mId, currentPackage->getNPackage(), 23);
1332  setMatcheds(dimensions, newPointD, currentPackage->getMatched(4), currentPackage->getMatched(1));
1333 
1334  StSstPoint *newPointE = new StSstPoint(mPoint->getSize(), mId, currentPackage->getNPackage(), 23);
1335  setMatcheds(dimensions, newPointE, currentPackage->getMatched(4), currentPackage->getMatched(2));
1336 
1337  StSstPoint *newPointF = new StSstPoint(mPoint->getSize(), mId, currentPackage->getNPackage(), 23);
1338  setMatcheds(dimensions, newPointF, currentPackage->getMatched(4), currentPackage->getMatched(3));
1339 
1340 // traitement propre aux space points..(probabilite)
1341  Double_t setA[2], setB[2], setC[2], setD[2], setE[2], setF[2];
1342  Double_t setAB[2], setAC[2], setBC[2], setDE[2], setDF[2], setEF[2];
1343  Double_t prob[6];
1344 
1345  setA[0] = (Adc[0] - Adc[1])/sqrt(2.0);
1346  setA[1] = matchDistr(clusterControl, setA[0]);
1347  setB[0] = (Adc[0] - Adc[2])/sqrt(2.0);
1348  setB[1] = matchDistr(clusterControl, setB[0]);
1349  setC[0] = (Adc[0] - Adc[3])/sqrt(2.0);
1350  setC[1] = matchDistr(clusterControl, setC[0]);
1351  setD[0] = (Adc[4] - Adc[1])/sqrt(2.0);
1352  setD[1] = matchDistr(clusterControl, setD[0]);
1353  setE[0] = (Adc[4] - Adc[2])/sqrt(2.0);
1354  setE[1] = matchDistr(clusterControl, setE[0]);
1355  setF[0] = (Adc[4] - Adc[3])/sqrt(2.0);
1356  setF[1] = matchDistr(clusterControl, setF[0]);
1357  setAB[0] = (Adc[0] - Adc[1] - Adc[2])/sqrt(2.0);
1358  setAB[1] = matchDistr(clusterControl, setAB[0]);
1359  setAC[0] = (Adc[0] - Adc[1] - Adc[3])/sqrt(2.0);
1360  setAC[1] = matchDistr(clusterControl, setAC[0]);
1361  setBC[0] = (Adc[0] - Adc[2] - Adc[3])/sqrt(2.0);
1362  setBC[1] = matchDistr(clusterControl, setBC[0]);
1363  setDE[0] = (Adc[4] - Adc[1] - Adc[2])/sqrt(2.0);
1364  setDE[1] = matchDistr(clusterControl, setDE[0]);
1365  setDF[0] = (Adc[4] - Adc[1] - Adc[3])/sqrt(2.0);
1366  setDF[1] = matchDistr(clusterControl, setDF[0]);
1367  setEF[0] = (Adc[4] - Adc[2] - Adc[3])/sqrt(2.0);
1368  setEF[1] = matchDistr(clusterControl, setEF[0]);
1369  Double_t tmp = 3e-33+(setAC[1]*setE[1]+setAB[1]*setF[1]+setBC[1]*setD[1]+setDF[1]*setB[1]+setDE[1]*setC[1]+setEF[1]*setA[1]);
1370  prob[0] = (setAC[1]*setE[1]+setAB[1]*setF[1]+setEF[1]*setA[1])/tmp;
1371  prob[1] = (setAB[1]*setF[1]+setBC[1]*setD[1]+setDF[1]*setB[1])/tmp;
1372  prob[2] = (setAC[1]*setE[1]+setBC[1]*setD[1]+setDE[1]*setC[1])/tmp;
1373  prob[3] = (setBC[1]*setD[1]+setDF[1]*setB[1]+setDE[1]*setC[1])/tmp;
1374  prob[4] = (setAC[1]*setE[1]+setDE[1]*setC[1]+setEF[1]*setA[1])/tmp;
1375  prob[5] = (setAB[1]*setF[1]+setDF[1]*setB[1]+setEF[1]*setA[1])/tmp;
1376  newPointA->setFlag(int(100*prob[0]));
1377  newPointB->setFlag(int(100*prob[1]));
1378  newPointC->setFlag(int(100*prob[2]));
1379  newPointD->setFlag(int(100*prob[3]));
1380  newPointE->setFlag(int(100*prob[4]));
1381  newPointF->setFlag(int(100*prob[5]));
1382  mPoint->addNewPoint(newPointA);
1383  mPoint->addNewPoint(newPointB);
1384  mPoint->addNewPoint(newPointC);
1385  mPoint->addNewPoint(newPointD);
1386  mPoint->addNewPoint(newPointE);
1387  mPoint->addNewPoint(newPointF);
1388  nSolved++;
1389  }
1390 // 18 ********************************************************************
1391  else if(!strcmp(currentKind,"1p1n2n2p1n2n3p1n2n"))// case (3-2)DP
1392  {
1393  StSstPoint *newPointA = new StSstPoint(mPoint->getSize(), mId, currentPackage->getNPackage(), 23);
1394  setMatcheds(dimensions, newPointA, currentPackage->getMatched(0), currentPackage->getMatched(1));
1395 
1396  StSstPoint *newPointB = new StSstPoint(mPoint->getSize(), mId, currentPackage->getNPackage(), 23);
1397  setMatcheds(dimensions, newPointB, currentPackage->getMatched(0), currentPackage->getMatched(2));
1398 
1399  StSstPoint *newPointC = new StSstPoint(mPoint->getSize(), mId, currentPackage->getNPackage(), 23);
1400  setMatcheds(dimensions, newPointC, currentPackage->getMatched(3), currentPackage->getMatched(1));
1401 
1402  StSstPoint *newPointD = new StSstPoint(mPoint->getSize(), mId, currentPackage->getNPackage(), 23);
1403  setMatcheds(dimensions, newPointD, currentPackage->getMatched(3), currentPackage->getMatched(2));
1404 
1405  StSstPoint *newPointE = new StSstPoint(mPoint->getSize(), mId, currentPackage->getNPackage(), 23);
1406  setMatcheds(dimensions, newPointE, currentPackage->getMatched(6), currentPackage->getMatched(1));
1407 
1408  StSstPoint *newPointF = new StSstPoint(mPoint->getSize(), mId, currentPackage->getNPackage(), 23);
1409  setMatcheds(dimensions, newPointF, currentPackage->getMatched(6), currentPackage->getMatched(2));
1410 
1411 // traitement propre aux space points..(probabilite)
1412  Double_t setA[2], setB[2], setC[2], setD[2], setE[2], setF[2];
1413  Double_t setAC[2], setBD[2], setAE[2], setBF[2], setCE[2], setDF[2];
1414  Double_t prob[6];
1415 
1416  setA[0] = (Adc[0] - Adc[1])/sqrt(2.0);
1417  setA[1] = matchDistr(clusterControl, setA[0]);
1418  setB[0] = (Adc[0] - Adc[2])/sqrt(2.0);
1419  setB[1] = matchDistr(clusterControl, setB[0]);
1420  setC[0] = (Adc[3] - Adc[1])/sqrt(2.0);
1421  setC[1] = matchDistr(clusterControl, setC[0]);
1422  setD[0] = (Adc[3] - Adc[2])/sqrt(2.0);
1423  setD[1] = matchDistr(clusterControl, setD[0]);
1424  setE[0] = (Adc[6] - Adc[1])/sqrt(2.0);
1425  setE[1] = matchDistr(clusterControl, setE[0]);
1426  setF[0] = (Adc[6] - Adc[2])/sqrt(2.0);
1427  setF[1] = matchDistr(clusterControl, setF[0]);
1428  setAC[0] = (Adc[0] + Adc[3] - Adc[1])/sqrt(2.0);
1429  setAC[1] = matchDistr(clusterControl, setAC[0]);
1430  setBD[0] = (Adc[0] + Adc[3] - Adc[2])/sqrt(2.0);
1431  setBD[1] = matchDistr(clusterControl, setBD[0]);
1432  setAE[0] = (Adc[0] + Adc[6] - Adc[1])/sqrt(2.0);
1433  setAE[1] = matchDistr(clusterControl, setAE[0]);
1434  setBF[0] = (Adc[0] + Adc[6] - Adc[2])/sqrt(2.0);
1435  setBF[1] = matchDistr(clusterControl, setBF[0]);
1436  setCE[0] = (Adc[3] + Adc[6] - Adc[1])/sqrt(2.0);
1437  setCE[1] = matchDistr(clusterControl, setCE[0]);
1438  setDF[0] = (Adc[3] + Adc[6] - Adc[2])/sqrt(2.0);
1439  setDF[1] = matchDistr(clusterControl, setDF[0]);
1440  Double_t tmp = 3e-33+(setAC[1]*setF[1]+setAE[1]*setD[1]+setDF[1]*setA[1]+setCE[1]*setB[1]+setBD[1]*setE[1]+setBF[1]*setC[1]);
1441  prob[0] = (setAC[1]*setF[1]+setAE[1]*setD[1]+setDF[1]*setA[1])/tmp;
1442  prob[1] = (setCE[1]*setB[1]+setBD[1]*setE[1]+setBF[1]*setC[1])/tmp;
1443  prob[2] = (setAC[1]*setF[1]+setCE[1]*setB[1]+setBF[1]*setC[1])/tmp;
1444  prob[3] = (setAE[1]*setD[1]+setCE[1]*setB[1]+setBD[1]*setE[1])/tmp;
1445  prob[4] = (setAE[1]*setD[1]+setDF[1]*setA[1]+setBD[1]*setE[1])/tmp;
1446  prob[5] = (setAC[1]*setF[1]+setDF[1]*setA[1]+setBF[1]*setC[1])/tmp;
1447  newPointA->setFlag(int(100*prob[0]));
1448  newPointB->setFlag(int(100*prob[1]));
1449  newPointC->setFlag(int(100*prob[2]));
1450  newPointD->setFlag(int(100*prob[3]));
1451  newPointE->setFlag(int(100*prob[4]));
1452  newPointF->setFlag(int(100*prob[5]));
1453  mPoint->addNewPoint(newPointA);
1454  mPoint->addNewPoint(newPointB);
1455  mPoint->addNewPoint(newPointC);
1456  mPoint->addNewPoint(newPointD);
1457  mPoint->addNewPoint(newPointE);
1458  mPoint->addNewPoint(newPointF);
1459  nSolved++;
1460  }
1461 // 19 ********************************************************************
1462  else if(!strcmp(currentKind,"1p1n2n2p2n3n3p3n"))// case (3-3)A
1463  {
1464  StSstPoint *newPointA = new StSstPoint(mPoint->getSize(), mId, currentPackage->getNPackage(), 33);
1465  setMatcheds(dimensions, newPointA, currentPackage->getMatched(0), currentPackage->getMatched(1));
1466  newPointA->setEnergyLossCorrected(Adc[0], Adc[1],CalibArray);
1467  newPointA->setFlag(100);
1468  mPoint->addNewPoint(newPointA);
1469 
1470  StSstPoint *newPointC = new StSstPoint(mPoint->getSize(), mId, currentPackage->getNPackage(), 33);
1471  setMatcheds(dimensions, newPointC, currentPackage->getMatched(3), currentPackage->getMatched(2));
1472  newPointC->setEnergyLossCorrected(Adc[3], Adc[2],CalibArray);
1473  newPointC->setFlag(100);
1474  mPoint->addNewPoint(newPointC);
1475 
1476  StSstPoint *newPointE = new StSstPoint(mPoint->getSize(), mId, currentPackage->getNPackage(), 33);
1477  setMatcheds(dimensions, newPointE, currentPackage->getMatched(6), currentPackage->getMatched(5));
1478  newPointE->setEnergyLossCorrected(Adc[6], Adc[5],CalibArray);
1479  newPointE->setFlag(100);
1480  mPoint->addNewPoint(newPointE);
1481 
1482  nSolved++;
1483  }
1484 // 20 ********************************************************************
1485  else if(!strcmp(currentKind,"1p1n2p1n2n3p2n3n"))// case (3-3)AP
1486  {
1487  StSstPoint *newPointA = new StSstPoint(mPoint->getSize(), mId, currentPackage->getNPackage(), 33);
1488  setMatcheds(dimensions, newPointA, currentPackage->getMatched(0), currentPackage->getMatched(1));
1489  newPointA->setEnergyLossCorrected(Adc[0], Adc[1],CalibArray);
1490  newPointA->setFlag(100);
1491  mPoint->addNewPoint(newPointA);
1492 
1493  StSstPoint *newPointC = new StSstPoint(mPoint->getSize(), mId, currentPackage->getNPackage(), 33);
1494  setMatcheds(dimensions, newPointC, currentPackage->getMatched(2), currentPackage->getMatched(4));
1495  newPointC->setEnergyLossCorrected(Adc[2], Adc[4],CalibArray);
1496  newPointC->setFlag(100);
1497  mPoint->addNewPoint(newPointC);
1498 
1499  StSstPoint *newPointE = new StSstPoint(mPoint->getSize(), mId, currentPackage->getNPackage(), 33);
1500  setMatcheds(dimensions, newPointE, currentPackage->getMatched(5), currentPackage->getMatched(7));
1501  newPointE->setEnergyLossCorrected(Adc[5], Adc[7],CalibArray);
1502  newPointE->setFlag(100);
1503  mPoint->addNewPoint(newPointE);
1504 
1505  nSolved++;
1506  }
1507 // 21 *********************************************************************
1508  else if(!strcmp(currentKind,"1p1n2n2p2n3n3p2n3n"))// case (3-3)B
1509  {
1510  StSstPoint *newPointA = new StSstPoint(mPoint->getSize(), mId, currentPackage->getNPackage(), 33);
1511  setMatcheds(dimensions, newPointA, currentPackage->getMatched(0), currentPackage->getMatched(1));
1512  newPointA->setEnergyLossCorrected(Adc[0], Adc[1],CalibArray);
1513  newPointA->setFlag(100);
1514 
1515  StSstPoint *newPointC = new StSstPoint(mPoint->getSize(), mId, currentPackage->getNPackage(), 33);
1516  setMatcheds(dimensions, newPointC, currentPackage->getMatched(3), currentPackage->getMatched(2));
1517  newPointC->setEnergyLossCorrected(Adc[3], Adc[2],CalibArray);
1518 
1519  StSstPoint *newPointD = new StSstPoint(mPoint->getSize(), mId, currentPackage->getNPackage(), 33);
1520  setMatcheds(dimensions, newPointD, currentPackage->getMatched(3), currentPackage->getMatched(5));
1521  newPointD->setEnergyLossCorrected(Adc[3], Adc[5],CalibArray);
1522 
1523  StSstPoint *newPointE = new StSstPoint(mPoint->getSize(), mId, currentPackage->getNPackage(), 33);
1524  setMatcheds(dimensions, newPointE, currentPackage->getMatched(6), currentPackage->getMatched(2));
1525  newPointE->setEnergyLossCorrected(Adc[6], Adc[2],CalibArray);
1526 
1527  StSstPoint *newPointF = new StSstPoint(mPoint->getSize(), mId, currentPackage->getNPackage(), 33);
1528  setMatcheds(dimensions, newPointF, currentPackage->getMatched(6), currentPackage->getMatched(5));
1529  newPointF->setEnergyLossCorrected(Adc[6], Adc[5],CalibArray);
1530 
1531 // traitement propre aux space points..(probabilite)
1532  Double_t setC[2], setD[2], setE[2], setF[2];
1533  Double_t probACF, probADE;
1534 
1535  setC[0] = (Adc[3] - Adc[2])/sqrt(2.0);
1536  setC[1] = matchDistr(clusterControl, setC[0]);
1537  setD[0] = (Adc[3] - Adc[5])/sqrt(2.0);
1538  setD[1] = matchDistr(clusterControl, setD[0]);
1539  setE[0] = (Adc[6] - Adc[2])/sqrt(2.0);
1540  setE[1] = matchDistr(clusterControl, setE[0]);
1541  setF[0] = (Adc[6] - Adc[5])/sqrt(2.0);
1542  setF[1] = matchDistr(clusterControl, setF[0]);
1543  Double_t tmp = 3e-33+ setC[1]*setF[1]+setD[1]*setE[1];
1544  probACF = (setC[1]*setF[1])/tmp;
1545  probADE = (setD[1]*setE[1])/tmp;
1546  newPointC->setFlag(int(100*probACF));
1547  newPointD->setFlag(int(100*probADE));
1548  newPointE->setFlag(int(100*probADE));
1549  newPointF->setFlag(int(100*probACF));
1550 
1551  if(probACF>probADE)
1552  {
1553  mPoint->addNewPoint(newPointA);
1554  mPoint->addNewPoint(newPointC);
1555  mPoint->addNewPoint(newPointF);
1556  delete newPointD;
1557  delete newPointE;
1558  }
1559  else
1560  {
1561  mPoint->addNewPoint(newPointA);
1562  mPoint->addNewPoint(newPointD);
1563  mPoint->addNewPoint(newPointE);
1564  delete newPointC;
1565  delete newPointF;
1566  }
1567  nSolved++;
1568  }
1569 // 22 *********************************************************************
1570  else if(!strcmp(currentKind,"1p1n2p1n2n3n3p2n3n"))// case (3-3)BP
1571  {
1572  StSstPoint *newPointA = new StSstPoint(mPoint->getSize(), mId, currentPackage->getNPackage(), 33);
1573  setMatcheds(dimensions, newPointA, currentPackage->getMatched(0), currentPackage->getMatched(1));
1574  newPointA->setEnergyLossCorrected(Adc[0], Adc[1],CalibArray);
1575  newPointA->setFlag(100);
1576 
1577  StSstPoint *newPointC = new StSstPoint(mPoint->getSize(), mId, currentPackage->getNPackage(), 33);
1578  setMatcheds(dimensions, newPointC, currentPackage->getMatched(2), currentPackage->getMatched(4));
1579  newPointC->setEnergyLossCorrected(Adc[2], Adc[4],CalibArray);
1580 
1581  StSstPoint *newPointD = new StSstPoint(mPoint->getSize(), mId, currentPackage->getNPackage(), 33);
1582  setMatcheds(dimensions, newPointD, currentPackage->getMatched(2), currentPackage->getMatched(5));
1583  newPointD->setEnergyLossCorrected(Adc[2], Adc[5],CalibArray);
1584 
1585  StSstPoint *newPointE = new StSstPoint(mPoint->getSize(), mId, currentPackage->getNPackage(), 33);
1586  setMatcheds(dimensions, newPointE, currentPackage->getMatched(6), currentPackage->getMatched(4));
1587  newPointE->setEnergyLossCorrected(Adc[6], Adc[4],CalibArray);
1588 
1589  StSstPoint *newPointF = new StSstPoint(mPoint->getSize(), mId, currentPackage->getNPackage(), 33);
1590  setMatcheds(dimensions, newPointF, currentPackage->getMatched(6), currentPackage->getMatched(5));
1591  newPointF->setEnergyLossCorrected(Adc[6], Adc[5],CalibArray);
1592 
1593 // traitement propre aux space points..(probabilite)
1594  Double_t setC[2], setD[2], setE[2], setF[2];
1595  Double_t probACF, probADE;
1596 
1597  setC[0] = (Adc[2] - Adc[4])/sqrt(2.0);
1598  setC[1] = matchDistr(clusterControl, setC[0]);
1599  setD[0] = (Adc[2] - Adc[5])/sqrt(2.0);
1600  setD[1] = matchDistr(clusterControl, setD[0]);
1601  setE[0] = (Adc[6] - Adc[4])/sqrt(2.0);
1602  setE[1] = matchDistr(clusterControl, setE[0]);
1603  setF[0] = (Adc[6] - Adc[5])/sqrt(2.0);
1604  setF[1] = matchDistr(clusterControl, setF[0]);
1605  Double_t tmp = 3e-33+ setC[1]*setF[1]+setD[1]*setE[1];
1606  probACF = (setC[1]*setF[1])/tmp;
1607  probADE = (setD[1]*setE[1])/tmp;
1608  newPointC->setFlag(int(100*probACF));
1609  newPointD->setFlag(int(100*probADE));
1610  newPointE->setFlag(int(100*probADE));
1611  newPointF->setFlag(int(100*probACF));
1612  if(probACF>probADE)
1613  {
1614  mPoint->addNewPoint(newPointA);
1615  mPoint->addNewPoint(newPointC);
1616  mPoint->addNewPoint(newPointF);
1617  delete newPointD;
1618  delete newPointE;
1619  }
1620  else
1621  {
1622  mPoint->addNewPoint(newPointA);
1623  mPoint->addNewPoint(newPointD);
1624  mPoint->addNewPoint(newPointE);
1625  delete newPointC;
1626  delete newPointF;
1627  }
1628  nSolved++;
1629  }
1630 // 23 *********************************************************************
1631  else if(!strcmp(currentKind,"1p1n2n2p1n2n3p2n3n"))// case (3-3)BS
1632  {
1633  StSstPoint *newPointA = new StSstPoint(mPoint->getSize(), mId, currentPackage->getNPackage(), 33);
1634  setMatcheds(dimensions, newPointA, currentPackage->getMatched(0), currentPackage->getMatched(1));
1635  newPointA->setEnergyLossCorrected(Adc[0], Adc[1],CalibArray);
1636 
1637  StSstPoint *newPointB = new StSstPoint(mPoint->getSize(), mId, currentPackage->getNPackage(), 33);
1638  setMatcheds(dimensions, newPointB, currentPackage->getMatched(0), currentPackage->getMatched(2));
1639  newPointB->setEnergyLossCorrected(Adc[0], Adc[2],CalibArray);
1640 
1641  StSstPoint *newPointC = new StSstPoint(mPoint->getSize(), mId, currentPackage->getNPackage(), 33);
1642  setMatcheds(dimensions, newPointC, currentPackage->getMatched(3), currentPackage->getMatched(1));
1643  newPointC->setEnergyLossCorrected(Adc[3], Adc[1],CalibArray);
1644 
1645  StSstPoint *newPointD = new StSstPoint(mPoint->getSize(), mId, currentPackage->getNPackage(), 33);
1646  setMatcheds(dimensions, newPointD, currentPackage->getMatched(3), currentPackage->getMatched(2));
1647  newPointD->setEnergyLossCorrected(Adc[3], Adc[2],CalibArray);
1648 
1649  StSstPoint *newPointF = new StSstPoint(mPoint->getSize(), mId, currentPackage->getNPackage(), 33);
1650  setMatcheds(dimensions, newPointF, currentPackage->getMatched(6), currentPackage->getMatched(8));
1651  newPointF->setEnergyLossCorrected(Adc[6], Adc[8],CalibArray);
1652  newPointF->setFlag(100);
1653 
1654 // traitement propre aux space points..(probabilite)
1655  Double_t setA[2], setB[2], setC[2], setD[2];
1656  Double_t probADF, probBCF;
1657 
1658  setA[0] = (Adc[0] - Adc[1])/sqrt(2.0);
1659  setA[1] = matchDistr(clusterControl, setA[0]);
1660  setB[0] = (Adc[0] - Adc[2])/sqrt(2.0);
1661  setB[1] = matchDistr(clusterControl, setB[0]);
1662  setC[0] = (Adc[3] - Adc[1])/sqrt(2.0);
1663  setC[1] = matchDistr(clusterControl, setC[0]);
1664  setD[0] = (Adc[3] - Adc[2])/sqrt(2.0);
1665  setD[1] = matchDistr(clusterControl, setD[0]);
1666  Double_t tmp = 3e-33+(setA[1]*setD[1]+setB[1]*setC[1]);
1667  probADF = (setA[1]*setD[1])/tmp;
1668  probBCF = (setB[1]*setC[1])/tmp;
1669  newPointA->setFlag(int(100*probADF));
1670  newPointB->setFlag(int(100*probBCF));
1671  newPointC->setFlag(int(100*probBCF));
1672  newPointD->setFlag(int(100*probADF));
1673  if(probADF>probBCF)
1674  {
1675  mPoint->addNewPoint(newPointA);
1676  mPoint->addNewPoint(newPointD);
1677  mPoint->addNewPoint(newPointF);
1678  delete newPointB;
1679  delete newPointC;
1680  }
1681  else
1682  {
1683  mPoint->addNewPoint(newPointB);
1684  mPoint->addNewPoint(newPointC);
1685  mPoint->addNewPoint(newPointF);
1686  delete newPointA;
1687  delete newPointD;
1688  }
1689  nSolved++;
1690  }
1691 // 24 *********************************************************************
1692  else if(!strcmp(currentKind,"1p1n2n2p1n2n3n3p3n"))// case (3-3)BSP
1693  {
1694  StSstPoint *newPointA = new StSstPoint(mPoint->getSize(), mId, currentPackage->getNPackage(), 33);
1695  setMatcheds(dimensions, newPointA, currentPackage->getMatched(0), currentPackage->getMatched(1));
1696  newPointA->setEnergyLossCorrected(Adc[0], Adc[1],CalibArray);
1697 
1698  StSstPoint *newPointB = new StSstPoint(mPoint->getSize(), mId, currentPackage->getNPackage(), 33);
1699  setMatcheds(dimensions, newPointB, currentPackage->getMatched(0), currentPackage->getMatched(2));
1700  newPointB->setEnergyLossCorrected(Adc[0], Adc[2],CalibArray);
1701 
1702  StSstPoint *newPointC = new StSstPoint(mPoint->getSize(), mId, currentPackage->getNPackage(), 33);
1703  setMatcheds(dimensions, newPointC, currentPackage->getMatched(3), currentPackage->getMatched(1));
1704  newPointC->setEnergyLossCorrected(Adc[3], Adc[1],CalibArray);
1705 
1706  StSstPoint *newPointD = new StSstPoint(mPoint->getSize(), mId, currentPackage->getNPackage(), 33);
1707  setMatcheds(dimensions, newPointD, currentPackage->getMatched(3), currentPackage->getMatched(2));
1708  newPointD->setEnergyLossCorrected(Adc[3], Adc[2],CalibArray);
1709 
1710  StSstPoint *newPointF = new StSstPoint(mPoint->getSize(), mId, currentPackage->getNPackage(), 33);
1711  setMatcheds(dimensions, newPointF, currentPackage->getMatched(7), currentPackage->getMatched(6));
1712  newPointF->setEnergyLossCorrected(Adc[7], Adc[6],CalibArray);
1713  newPointF->setNMatched(33);
1714  newPointF->setFlag(100);
1715 
1716 // traitement propre aux space points..(probabilite)
1717  Double_t setA[2], setB[2], setC[2], setD[2];
1718  Double_t probADF, probBCF;
1719 
1720  setA[0] = (Adc[0] - Adc[1])/sqrt(2.0);
1721  setA[1] = matchDistr(clusterControl, setA[0]);
1722  setB[0] = (Adc[0] - Adc[2])/sqrt(2.0);
1723  setB[1] = matchDistr(clusterControl, setB[0]);
1724  setC[0] = (Adc[3] - Adc[1])/sqrt(2.0);
1725  setC[1] = matchDistr(clusterControl, setC[0]);
1726  setD[0] = (Adc[3] - Adc[2])/sqrt(2.0);
1727  setD[1] = matchDistr(clusterControl, setD[0]);
1728  Double_t tmp = 3e-33+(setA[1]*setD[1]+setB[1]*setC[1]);
1729  probADF = (setA[1]*setD[1])/tmp;
1730  probBCF = (setB[1]*setC[1])/tmp;
1731  newPointA->setFlag(int(100*probADF));
1732  newPointB->setFlag(int(100*probBCF));
1733  newPointC->setFlag(int(100*probBCF));
1734  newPointD->setFlag(int(100*probADF));
1735  if(probADF>probBCF)
1736  {
1737  mPoint->addNewPoint(newPointA);
1738  mPoint->addNewPoint(newPointD);
1739  mPoint->addNewPoint(newPointF);
1740  delete newPointB;
1741  delete newPointC;
1742  }
1743  else
1744  {
1745  mPoint->addNewPoint(newPointB);
1746  mPoint->addNewPoint(newPointC);
1747  mPoint->addNewPoint(newPointF);
1748  delete newPointA;
1749  delete newPointD;
1750  }
1751  nSolved++;
1752  }
1753 // 25 *********************************************************************
1754  else if(!strcmp(currentKind,"1p1n2n3n2p2n3n3p3n"))// case (3-3)C
1755  {
1756  StSstPoint *newPointA = new StSstPoint(mPoint->getSize(), mId, currentPackage->getNPackage(), 33);
1757  setMatcheds(dimensions, newPointA, currentPackage->getMatched(0), currentPackage->getMatched(1));
1758  newPointA->setEnergyLossCorrected(Adc[0], Adc[1],CalibArray);
1759  newPointA->setFlag(100);
1760  mPoint->addNewPoint(newPointA);
1761 
1762  StSstPoint *newPointD = new StSstPoint(mPoint->getSize(), mId, currentPackage->getNPackage(), 33);
1763  setMatcheds(dimensions, newPointD, currentPackage->getMatched(4), currentPackage->getMatched(2));
1764  newPointD->setEnergyLossCorrected(Adc[4], Adc[2],CalibArray);
1765  newPointD->setFlag(100);
1766  mPoint->addNewPoint(newPointD);
1767 
1768  StSstPoint *newPointF = new StSstPoint(mPoint->getSize(), mId, currentPackage->getNPackage(), 33);
1769  setMatcheds(dimensions, newPointF, currentPackage->getMatched(7), currentPackage->getMatched(3));
1770  newPointF->setEnergyLossCorrected(Adc[7], Adc[3],CalibArray);
1771  newPointF->setFlag(100);
1772  mPoint->addNewPoint(newPointF);
1773 
1774  nSolved++;
1775  }
1776 
1777 // 26 *********************************************************************
1778  else if(!strcmp(currentKind,"1p1n2p1n2n3p1n2n3n"))// case (3-3)CS
1779  {
1780  StSstPoint *newPointA = new StSstPoint(mPoint->getSize(), mId, currentPackage->getNPackage(), 33);
1781  setMatcheds(dimensions, newPointA, currentPackage->getMatched(0), currentPackage->getMatched(1));
1782  newPointA->setEnergyLossCorrected(Adc[0], Adc[1],CalibArray);
1783  newPointA->setFlag(100);
1784  mPoint->addNewPoint(newPointA);
1785 
1786  StSstPoint *newPointD = new StSstPoint(mPoint->getSize(), mId, currentPackage->getNPackage(), 33);
1787  setMatcheds(dimensions, newPointD, currentPackage->getMatched(2), currentPackage->getMatched(4));
1788  newPointD->setEnergyLossCorrected(Adc[2], Adc[4],CalibArray);
1789  newPointD->setFlag(100);
1790  mPoint->addNewPoint(newPointD);
1791 
1792  StSstPoint *newPointF = new StSstPoint(mPoint->getSize(), mId, currentPackage->getNPackage(), 33);
1793  setMatcheds(dimensions, newPointF, currentPackage->getMatched(5), currentPackage->getMatched(8));
1794  newPointF->setEnergyLossCorrected(Adc[5], Adc[8],CalibArray);
1795  newPointF->setFlag(100);
1796  mPoint->addNewPoint(newPointF);
1797 
1798  nSolved++;
1799  }
1800 
1801 // 27 *********************************************************************
1802  else if(!strcmp(currentKind,"1p1n2n3n2p2n3n3p2n3n"))// case (3-3)D
1803  {
1804  StSstPoint *newPointA = new StSstPoint(mPoint->getSize(), mId, currentPackage->getNPackage(), 33);
1805  setMatcheds(dimensions, newPointA, currentPackage->getMatched(0), currentPackage->getMatched(1));
1806  newPointA->setEnergyLossCorrected(Adc[0], Adc[1],CalibArray);
1807  newPointA->setFlag(100);
1808 
1809  StSstPoint *newPointD = new StSstPoint(mPoint->getSize(), mId, currentPackage->getNPackage(), 33);
1810  setMatcheds(dimensions, newPointD, currentPackage->getMatched(4), currentPackage->getMatched(2));
1811  newPointD->setEnergyLossCorrected(Adc[4], Adc[2],CalibArray);
1812 
1813  StSstPoint *newPointE = new StSstPoint(mPoint->getSize(), mId, currentPackage->getNPackage(), 33);
1814  setMatcheds(dimensions, newPointE, currentPackage->getMatched(4), currentPackage->getMatched(3));
1815  newPointE->setEnergyLossCorrected(Adc[4], Adc[3],CalibArray);
1816 
1817  StSstPoint *newPointF = new StSstPoint(mPoint->getSize(), mId, currentPackage->getNPackage(), 33);
1818  setMatcheds(dimensions, newPointF, currentPackage->getMatched(7), currentPackage->getMatched(2));
1819  newPointF->setEnergyLossCorrected(Adc[7], Adc[2],CalibArray);
1820 
1821  StSstPoint *newPointG = new StSstPoint(mPoint->getSize(), mId, currentPackage->getNPackage(), 33);
1822  setMatcheds(dimensions, newPointG, currentPackage->getMatched(7), currentPackage->getMatched(3));
1823  newPointG->setEnergyLossCorrected(Adc[7], Adc[3],CalibArray);
1824 
1825 // traitement propre aux space points..(probabilite)
1826  Double_t setD[2], setE[2], setF[2], setG[2];
1827  Double_t probADG, probAEF;
1828 
1829  setD[0] = (Adc[4] - Adc[2])/sqrt(2.0);
1830  setD[1] = matchDistr(clusterControl, setD[0]);
1831  setE[0] = (Adc[4] - Adc[3])/sqrt(2.0);
1832  setE[1] = matchDistr(clusterControl, setE[0]);
1833  setF[0] = (Adc[7] - Adc[2])/sqrt(2.0);
1834  setF[1] = matchDistr(clusterControl, setF[0]);
1835  setG[0] = (Adc[7] - Adc[3])/sqrt(2.0);
1836  setG[1] = matchDistr(clusterControl, setG[0]);
1837  Double_t tmp = 3e-33+(setD[1]*setG[1]+setE[1]*setF[1]);
1838  probADG = (setD[1]*setG[1])/tmp;
1839  probAEF = (setE[1]*setF[1])/tmp;
1840  newPointD->setFlag(int(100*probADG));
1841  newPointE->setFlag(int(100*probAEF));
1842  newPointF->setFlag(int(100*probAEF));
1843  newPointG->setFlag(int(100*probADG));
1844  if(probADG>probAEF)
1845  {
1846  mPoint->addNewPoint(newPointA);
1847  mPoint->addNewPoint(newPointD);
1848  mPoint->addNewPoint(newPointG);
1849  delete newPointE;
1850  delete newPointF;
1851  }
1852  else
1853  {
1854  mPoint->addNewPoint(newPointA);
1855  mPoint->addNewPoint(newPointE);
1856  mPoint->addNewPoint(newPointF);
1857  delete newPointD;
1858  delete newPointG;
1859  }
1860  nSolved++;
1861  }
1862 // 28 *********************************************************************
1863  else if(!strcmp(currentKind,"1p1n2p1n2n3n3p1n2n3n"))// case (3-3)DP
1864  {
1865  StSstPoint *newPointA = new StSstPoint(mPoint->getSize(), mId, currentPackage->getNPackage(), 33);
1866  setMatcheds(dimensions, newPointA, currentPackage->getMatched(0), currentPackage->getMatched(1));
1867  newPointA->setEnergyLossCorrected(Adc[0], Adc[1],CalibArray);
1868  newPointA->setFlag(100);
1869 
1870  StSstPoint *newPointC = new StSstPoint(mPoint->getSize(), mId, currentPackage->getNPackage(), 33);
1871  setMatcheds(dimensions, newPointC, currentPackage->getMatched(2), currentPackage->getMatched(4));
1872  newPointC->setEnergyLossCorrected(Adc[2], Adc[4],CalibArray);
1873 
1874  StSstPoint *newPointD = new StSstPoint(mPoint->getSize(), mId, currentPackage->getNPackage(), 33);
1875  setMatcheds(dimensions, newPointD, currentPackage->getMatched(2), currentPackage->getMatched(5));
1876  newPointD->setEnergyLossCorrected(Adc[2], Adc[5],CalibArray);
1877 
1878  StSstPoint *newPointF = new StSstPoint(mPoint->getSize(), mId, currentPackage->getNPackage(), 33);
1879  setMatcheds(dimensions, newPointF, currentPackage->getMatched(6), currentPackage->getMatched(4));
1880  newPointF->setEnergyLossCorrected(Adc[6], Adc[4],CalibArray);
1881 
1882  StSstPoint *newPointG = new StSstPoint(mPoint->getSize(), mId, currentPackage->getNPackage(), 33);
1883  setMatcheds(dimensions, newPointG, currentPackage->getMatched(6), currentPackage->getMatched(5));
1884  newPointG->setEnergyLossCorrected(Adc[6], Adc[5],CalibArray);
1885 
1886 // traitement propre aux space points..(probabilite)
1887  Double_t setC[2], setD[2], setF[2], setG[2];
1888  Double_t probACG, probADF;
1889 
1890  setC[0] = (Adc[2] - Adc[4])/sqrt(2.0);
1891  setC[1] = matchDistr(clusterControl, setC[0]);
1892  setD[0] = (Adc[2] - Adc[5])/sqrt(2.0);
1893  setD[1] = matchDistr(clusterControl, setD[0]);
1894  setF[0] = (Adc[6] - Adc[4])/sqrt(2.0);
1895  setF[1] = matchDistr(clusterControl, setF[0]);
1896  setG[0] = (Adc[6] - Adc[5])/sqrt(2.0);
1897  setG[1] = matchDistr(clusterControl, setG[0]);
1898  Double_t tmp = 3e-33+(setC[1]*setG[1]+setD[1]*setF[1]);
1899  probACG = (setC[1]*setG[1])/tmp;
1900  probADF = (setD[1]*setF[1])/tmp;
1901  newPointC->setFlag(int(100*probACG));
1902  newPointD->setFlag(int(100*probADF));
1903  newPointF->setFlag(int(100*probADF));
1904  newPointG->setFlag(int(100*probACG));
1905  if(probACG>probADF)
1906  {
1907  mPoint->addNewPoint(newPointA);
1908  mPoint->addNewPoint(newPointC);
1909  mPoint->addNewPoint(newPointG);
1910  delete newPointD;
1911  delete newPointF;
1912  }
1913  else
1914  {
1915  mPoint->addNewPoint(newPointA);
1916  mPoint->addNewPoint(newPointD);
1917  mPoint->addNewPoint(newPointF);
1918  delete newPointC;
1919  delete newPointG;
1920  }
1921  nSolved++;
1922  }
1923 // 29 *********************************************************************
1924  else if(!strcmp(currentKind,"1p1n2n2p1n2n3p1n2n3n"))// case (3-3)DS
1925  {
1926  StSstPoint *newPointA = new StSstPoint(mPoint->getSize(), mId, currentPackage->getNPackage(), 33);
1927  setMatcheds(dimensions, newPointA, currentPackage->getMatched(0), currentPackage->getMatched(1));
1928  newPointA->setEnergyLossCorrected(Adc[0], Adc[1],CalibArray);
1929 
1930  StSstPoint *newPointB = new StSstPoint(mPoint->getSize(), mId, currentPackage->getNPackage(), 33);
1931  setMatcheds(dimensions, newPointB, currentPackage->getMatched(0), currentPackage->getMatched(2));
1932  newPointB->setEnergyLossCorrected(Adc[0], Adc[2],CalibArray);
1933 
1934  StSstPoint *newPointC = new StSstPoint(mPoint->getSize(), mId, currentPackage->getNPackage(), 33);
1935  setMatcheds(dimensions, newPointC, currentPackage->getMatched(3), currentPackage->getMatched(1));
1936  newPointC->setEnergyLossCorrected(Adc[3], Adc[1],CalibArray);
1937 
1938  StSstPoint *newPointD = new StSstPoint(mPoint->getSize(), mId, currentPackage->getNPackage(), 33);
1939  setMatcheds(dimensions, newPointD, currentPackage->getMatched(3), currentPackage->getMatched(2));
1940  newPointD->setEnergyLossCorrected(Adc[3], Adc[2],CalibArray);
1941 
1942  StSstPoint *newPointG = new StSstPoint(mPoint->getSize(), mId, currentPackage->getNPackage(), 33);
1943  setMatcheds(dimensions, newPointG, currentPackage->getMatched(6), currentPackage->getMatched(9));
1944  newPointG->setEnergyLossCorrected(Adc[6], Adc[9],CalibArray);
1945  newPointG->setFlag(100);
1946 
1947 // traitement propre aux space points..(probabilite)
1948  Double_t setA[2], setB[2], setC[2], setD[2];
1949  Double_t probADG, probBCG;
1950 
1951  setA[0] = (Adc[0] - Adc[1])/sqrt(2.0);
1952  setA[1] = matchDistr(clusterControl, setA[0]);
1953  setB[0] = (Adc[0] - Adc[2])/sqrt(2.0);
1954  setB[1] = matchDistr(clusterControl, setB[0]);
1955  setC[0] = (Adc[3] - Adc[1])/sqrt(2.0);
1956  setC[1] = matchDistr(clusterControl, setC[0]);
1957  setD[0] = (Adc[3] - Adc[2])/sqrt(2.0);
1958  setD[1] = matchDistr(clusterControl, setD[0]);
1959  Double_t tmp = 3e-33+(setA[1]*setD[1]+setB[1]*setC[1]);
1960  probADG = (setA[1]*setD[1])/tmp;
1961  probBCG = (setB[1]*setC[1])/tmp;
1962  newPointA->setFlag(int(100*probADG));
1963  newPointB->setFlag(int(100*probBCG));
1964  newPointC->setFlag(int(100*probBCG));
1965  newPointD->setFlag(int(100*probADG));
1966  if(probADG>probBCG)
1967  {
1968  mPoint->addNewPoint(newPointA);
1969  mPoint->addNewPoint(newPointD);
1970  mPoint->addNewPoint(newPointG);
1971  delete newPointB;
1972  delete newPointC;
1973  }
1974  else
1975  {
1976  mPoint->addNewPoint(newPointB);
1977  mPoint->addNewPoint(newPointC);
1978  mPoint->addNewPoint(newPointG);
1979  delete newPointA;
1980  delete newPointD;
1981  }
1982  nSolved++;
1983  }
1984 // 30 *********************************************************************
1985  else if(!strcmp(currentKind,"1p1n2n3n2p1n2n3n3p3n"))//case (3-3)DSP
1986  {
1987  StSstPoint *newPointA = new StSstPoint(mPoint->getSize(), mId, currentPackage->getNPackage(), 33);
1988  setMatcheds(dimensions, newPointA, currentPackage->getMatched(0), currentPackage->getMatched(1));
1989  newPointA->setEnergyLossCorrected(Adc[0], Adc[1],CalibArray);
1990 
1991  StSstPoint *newPointB = new StSstPoint(mPoint->getSize(), mId, currentPackage->getNPackage(), 33);
1992  setMatcheds(dimensions, newPointB, currentPackage->getMatched(0), currentPackage->getMatched(2));
1993  newPointB->setEnergyLossCorrected(Adc[0], Adc[2],CalibArray);
1994 
1995  StSstPoint *newPointD = new StSstPoint(mPoint->getSize(), mId, currentPackage->getNPackage(), 33);
1996  setMatcheds(dimensions, newPointD, currentPackage->getMatched(4), currentPackage->getMatched(1));
1997  newPointD->setEnergyLossCorrected(Adc[4], Adc[1],CalibArray);
1998 
1999  StSstPoint *newPointE = new StSstPoint(mPoint->getSize(), mId, currentPackage->getNPackage(), 33);
2000  setMatcheds(dimensions, newPointE, currentPackage->getMatched(4), currentPackage->getMatched(2));
2001  newPointE->setEnergyLossCorrected(Adc[4], Adc[2],CalibArray);
2002 
2003  StSstPoint *newPointG = new StSstPoint(mPoint->getSize(), mId, currentPackage->getNPackage(), 33);
2004  setMatcheds(dimensions, newPointG, currentPackage->getMatched(8), currentPackage->getMatched(3));
2005  newPointG->setEnergyLossCorrected(Adc[8], Adc[3],CalibArray);
2006  newPointG->setFlag(100);
2007 
2008 // traitement propre aux space points..(probabilite)
2009  Double_t setA[2], setB[2], setD[2], setE[2];
2010  Double_t probAEG, probBDG;
2011 
2012  setA[0] = (Adc[0] - Adc[1])/sqrt(2.0);
2013  setA[1] = matchDistr(clusterControl, setA[0]);
2014  setB[0] = (Adc[0] - Adc[2])/sqrt(2.0);
2015  setB[1] = matchDistr(clusterControl, setB[0]);
2016  setD[0] = (Adc[4] - Adc[2])/sqrt(2.0);
2017  setD[1] = matchDistr(clusterControl, setD[0]);
2018  setE[0] = (Adc[4] - Adc[1])/sqrt(2.0);
2019  setE[1] = matchDistr(clusterControl, setE[0]);
2020  Double_t tmp = 3e-33+(setA[1]*setE[1]+setB[1]*setD[1]);
2021  probAEG = (setA[1]*setE[1])/tmp;
2022  probBDG = (setB[1]*setD[1])/tmp;
2023  newPointA->setFlag(int(100*probAEG));
2024  newPointB->setFlag(int(100*probBDG));
2025  newPointD->setFlag(int(100*probBDG));
2026  newPointE->setFlag(int(100*probAEG));
2027 
2028  if(probAEG>probBDG)
2029  {
2030  mPoint->addNewPoint(newPointA);
2031  mPoint->addNewPoint(newPointE);
2032  mPoint->addNewPoint(newPointG);
2033  delete newPointB;
2034  delete newPointD;
2035  }
2036  else
2037  {
2038  mPoint->addNewPoint(newPointB);
2039  mPoint->addNewPoint(newPointD);
2040  mPoint->addNewPoint(newPointG);
2041  delete newPointA;
2042  delete newPointE;
2043  }
2044  nSolved++;
2045  }
2046 // 31 *********************************************************************
2047  else if(!strcmp(currentKind,"1p1n2p1n2n3n3p3n"))// case (3-3)E
2048  {
2049  StSstPoint *newPointA = new StSstPoint(mPoint->getSize(), mId, currentPackage->getNPackage(), 33);
2050  setMatcheds(dimensions, newPointA, currentPackage->getMatched(0), currentPackage->getMatched(1));
2051  newPointA->setEnergyLossCorrected(Adc[0], Adc[1],CalibArray);
2052  newPointA->setFlag(100);
2053  mPoint->addNewPoint(newPointA);
2054 
2055  StSstPoint *newPointC = new StSstPoint(mPoint->getSize(), mId, currentPackage->getNPackage(), 33);
2056  setMatcheds(dimensions, newPointC, currentPackage->getMatched(2), currentPackage->getMatched(4));
2057  newPointC->setEnergyLossCorrected(Adc[2], Adc[4],CalibArray);
2058  newPointC->setFlag(100);
2059  mPoint->addNewPoint(newPointC);
2060 
2061  StSstPoint *newPointE = new StSstPoint(mPoint->getSize(), mId, currentPackage->getNPackage(), 33);
2062  setMatcheds(dimensions, newPointE, currentPackage->getMatched(6), currentPackage->getMatched(5));
2063  newPointE->setEnergyLossCorrected(Adc[6], Adc[5],CalibArray);
2064  newPointE->setFlag(100);
2065  mPoint->addNewPoint(newPointE);
2066 
2067  nSolved++;
2068  }
2069 // 32 *********************************************************************
2070  else if(!strcmp(currentKind,"1p1n2n2p2n3p2n3n"))// case (3-3)EP
2071  {
2072  StSstPoint *newPointA = new StSstPoint(mPoint->getSize(), mId, currentPackage->getNPackage(), 33);
2073  setMatcheds(dimensions, newPointA, currentPackage->getMatched(0), currentPackage->getMatched(1));
2074  newPointA->setEnergyLossCorrected(Adc[0], Adc[1],CalibArray);
2075  newPointA->setFlag(100);
2076  mPoint->addNewPoint(newPointA);
2077 
2078  StSstPoint *newPointC = new StSstPoint(mPoint->getSize(), mId, currentPackage->getNPackage(), 33);
2079  setMatcheds(dimensions, newPointC, currentPackage->getMatched(3), currentPackage->getMatched(2));
2080  newPointC->setEnergyLossCorrected(Adc[3], Adc[2],CalibArray);
2081  newPointC->setFlag(100);
2082  mPoint->addNewPoint(newPointC);
2083 
2084  StSstPoint *newPointE = new StSstPoint(mPoint->getSize(), mId, currentPackage->getNPackage(), 33);
2085  setMatcheds(dimensions, newPointE, currentPackage->getMatched(5), currentPackage->getMatched(7));
2086  newPointE->setEnergyLossCorrected(Adc[5], Adc[7],CalibArray);
2087  newPointE->setFlag(100);
2088  mPoint->addNewPoint(newPointE);
2089 
2090  nSolved++;
2091  }
2092 // 33 *********************************************************************
2093  else if(!strcmp(currentKind,"1p1n2n2p1n2n3n3p2n3n"))// case (3-3)F
2094  {
2095  StSstPoint *newPointA = new StSstPoint(mPoint->getSize(), mId, currentPackage->getNPackage(), 33);
2096  setMatcheds(dimensions, newPointA, currentPackage->getMatched(0), currentPackage->getMatched(1));
2097  newPointA->setEnergyLossCorrected(Adc[0], Adc[1],CalibArray);
2098 
2099  StSstPoint *newPointB = new StSstPoint(mPoint->getSize(), mId, currentPackage->getNPackage(), 33);
2100  setMatcheds(dimensions, newPointB, currentPackage->getMatched(0), currentPackage->getMatched(2));
2101  newPointB->setEnergyLossCorrected(Adc[0], Adc[2],CalibArray);
2102 
2103  StSstPoint *newPointC = new StSstPoint(mPoint->getSize(), mId, currentPackage->getNPackage(), 33);
2104  setMatcheds(dimensions, newPointC, currentPackage->getMatched(3), currentPackage->getMatched(1));
2105  newPointC->setEnergyLossCorrected(Adc[3], Adc[1],CalibArray);
2106 
2107  StSstPoint *newPointD = new StSstPoint(mPoint->getSize(), mId, currentPackage->getNPackage(), 33);
2108  setMatcheds(dimensions, newPointD, currentPackage->getMatched(3), currentPackage->getMatched(2));
2109  newPointD->setEnergyLossCorrected(Adc[3], Adc[2],CalibArray);
2110 
2111  StSstPoint *newPointE = new StSstPoint(mPoint->getSize(), mId, currentPackage->getNPackage(), 33);
2112  setMatcheds(dimensions, newPointE, currentPackage->getMatched(3), currentPackage->getMatched(6));
2113  newPointE->setEnergyLossCorrected(Adc[3], Adc[6],CalibArray);
2114 
2115  StSstPoint *newPointF = new StSstPoint(mPoint->getSize(), mId, currentPackage->getNPackage(), 33);
2116  setMatcheds(dimensions, newPointF, currentPackage->getMatched(7), currentPackage->getMatched(2));
2117  newPointF->setEnergyLossCorrected(Adc[7], Adc[2],CalibArray);
2118 
2119  StSstPoint *newPointG = new StSstPoint(mPoint->getSize(), mId, currentPackage->getNPackage(), 33);
2120  setMatcheds(dimensions, newPointG, currentPackage->getMatched(7), currentPackage->getMatched(6));
2121  newPointG->setEnergyLossCorrected(Adc[7], Adc[6],CalibArray);
2122 
2123 // traitement propre aux space points..(probabilite)
2124  Double_t setA[2], setB[2], setC[2], setD[2], setE[2], setF[2], setG[2];
2125  Double_t probADG, probAEF, probBCG;
2126 
2127  setA[0] = (Adc[0] - Adc[1])/sqrt(2.0);
2128  setA[1] = matchDistr(clusterControl, setA[0]);
2129  setB[0] = (Adc[0] - Adc[2])/sqrt(2.0);
2130  setB[1] = matchDistr(clusterControl, setB[0]);
2131  setC[0] = (Adc[3] - Adc[1])/sqrt(2.0);
2132  setC[1] = matchDistr(clusterControl, setC[0]);
2133  setD[0] = (Adc[3] - Adc[2])/sqrt(2.0);
2134  setD[1] = matchDistr(clusterControl, setD[0]);
2135  setE[0] = (Adc[3] - Adc[6])/sqrt(2.0);
2136  setE[1] = matchDistr(clusterControl, setE[0]);
2137  setF[0] = (Adc[7] - Adc[2])/sqrt(2.0);
2138  setF[1] = matchDistr(clusterControl, setF[0]);
2139  setG[0] = (Adc[7] - Adc[6])/sqrt(2.0);
2140  setG[1] = matchDistr(clusterControl, setG[0]);
2141  Double_t tmp = 3e-33+(setA[1]*setD[1]*setG[1]+setA[1]*setE[1]*setF[1]+setB[1]*setC[1]*setG[1]);
2142  probADG = (setA[1]*setD[1]*setG[1])/tmp;
2143  probAEF = (setA[1]*setE[1]*setF[1])/tmp;
2144  probBCG = (setB[1]*setC[1]*setG[1])/tmp;
2145  newPointA->setFlag(int(100*(probADG+probAEF)));
2146  newPointB->setFlag(int(100*probBCG));
2147  newPointC->setFlag(int(100*probBCG));
2148  newPointD->setFlag(int(100*probADG));
2149  newPointE->setFlag(int(100*probAEF));
2150  newPointF->setFlag(int(100*probAEF));
2151  newPointG->setFlag(int(100*(probADG+probBCG)));
2152 
2153  if ((probADG > probAEF)&&(probADG > probBCG))
2154  {
2155 
2156  mPoint->addNewPoint(newPointA);
2157  mPoint->addNewPoint(newPointD);
2158  mPoint->addNewPoint(newPointG);
2159  delete newPointB;
2160  delete newPointC;
2161  delete newPointE;
2162  delete newPointF;
2163  }
2164  else if ((probAEF > probADG)&&(probAEF > probBCG))
2165  {
2166  mPoint->addNewPoint(newPointA);
2167  mPoint->addNewPoint(newPointE);
2168  mPoint->addNewPoint(newPointF);
2169  delete newPointB;
2170  delete newPointC;
2171  delete newPointD;
2172  delete newPointG;
2173  }
2174  else if ((probBCG > probADG)&&(probBCG > probAEF))
2175  {
2176  mPoint->addNewPoint(newPointB);
2177  mPoint->addNewPoint(newPointC);
2178  mPoint->addNewPoint(newPointG);
2179  delete newPointA;
2180  delete newPointD;
2181  delete newPointE;
2182  delete newPointF;
2183  }
2184  nSolved++;
2185  }
2186 // 34 *********************************************************************
2187  else if(!strcmp(currentKind,"1p1n2n3n2p1n2n3n3p2n3n"))// case (3-3)G
2188  {
2189  StSstPoint *newPointA = new StSstPoint(mPoint->getSize(), mId, currentPackage->getNPackage(), 33);
2190  setMatcheds(dimensions, newPointA, currentPackage->getMatched(0), currentPackage->getMatched(1));
2191  newPointA->setEnergyLossCorrected(Adc[0], Adc[1],CalibArray);
2192 
2193  StSstPoint *newPointB = new StSstPoint(mPoint->getSize(), mId, currentPackage->getNPackage(), 33);
2194  setMatcheds(dimensions, newPointB, currentPackage->getMatched(0), currentPackage->getMatched(2));
2195  newPointB->setEnergyLossCorrected(Adc[0], Adc[2],CalibArray);
2196 
2197  StSstPoint *newPointC = new StSstPoint(mPoint->getSize(), mId, currentPackage->getNPackage(), 33);
2198  setMatcheds(dimensions, newPointC, currentPackage->getMatched(0), currentPackage->getMatched(3));
2199  newPointC->setEnergyLossCorrected(Adc[0], Adc[3],CalibArray);
2200 
2201  StSstPoint *newPointD = new StSstPoint(mPoint->getSize(), mId, currentPackage->getNPackage(), 33);
2202  setMatcheds(dimensions, newPointD, currentPackage->getMatched(4), currentPackage->getMatched(1));
2203  newPointD->setEnergyLossCorrected(Adc[4], Adc[1],CalibArray);
2204 
2205  StSstPoint *newPointE = new StSstPoint(mPoint->getSize(), mId, currentPackage->getNPackage(), 33);
2206  setMatcheds(dimensions, newPointE, currentPackage->getMatched(4), currentPackage->getMatched(2));
2207  newPointE->setEnergyLossCorrected(Adc[4], Adc[2],CalibArray);
2208 
2209  StSstPoint *newPointF = new StSstPoint(mPoint->getSize(), mId, currentPackage->getNPackage(), 33);
2210  setMatcheds(dimensions, newPointF, currentPackage->getMatched(4), currentPackage->getMatched(3));
2211  newPointF->setEnergyLossCorrected(Adc[4], Adc[3],CalibArray);
2212 
2213  StSstPoint *newPointG = new StSstPoint(mPoint->getSize(), mId, currentPackage->getNPackage(), 33);
2214  setMatcheds(dimensions, newPointG, currentPackage->getMatched(8), currentPackage->getMatched(2));
2215  newPointG->setEnergyLossCorrected(Adc[8], Adc[2],CalibArray);
2216 
2217  StSstPoint *newPointH = new StSstPoint(mPoint->getSize(), mId, currentPackage->getNPackage(), 33);
2218  setMatcheds(dimensions, newPointH, currentPackage->getMatched(8), currentPackage->getMatched(3));
2219  newPointH->setEnergyLossCorrected(Adc[8], Adc[3],CalibArray);
2220 
2221 // traitement propre aux space points..(probabilite)
2222  Double_t setA[2], setB[2], setC[2], setD[2], setE[2], setF[2], setG[2], setH[2];
2223  Double_t probAEH, probAFG, probBDH, probCDG;
2224 
2225  setA[0] = (Adc[0] - Adc[1])/sqrt(2.0);
2226  setA[1] = matchDistr(clusterControl, setA[0]);
2227  setB[0] = (Adc[0] - Adc[2])/sqrt(2.0);
2228  setB[1] = matchDistr(clusterControl, setB[0]);
2229  setC[0] = (Adc[0] - Adc[3])/sqrt(2.0);
2230  setC[1] = matchDistr(clusterControl, setC[0]);
2231  setD[0] = (Adc[4] - Adc[1])/sqrt(2.0);
2232  setD[1] = matchDistr(clusterControl, setD[0]);
2233  setE[0] = (Adc[4] - Adc[2])/sqrt(2.0);
2234  setE[1] = matchDistr(clusterControl, setE[0]);
2235  setF[0] = (Adc[4] - Adc[3])/sqrt(2.0);
2236  setF[1] = matchDistr(clusterControl, setF[0]);
2237  setG[0] = (Adc[8] - Adc[2])/sqrt(2.0);
2238  setG[1] = matchDistr(clusterControl, setG[0]);
2239  setH[0] = (Adc[8] - Adc[3])/sqrt(2.0);
2240  setH[1] = matchDistr(clusterControl, setH[0]);
2241  Double_t tmp = 3e-33+(setA[1]*setE[1]*setH[1]+setA[1]*setF[1]*setG[1]+setB[1]*setD[1]*setH[1]+setC[1]*setD[1]*setG[1]);
2242  probAEH = (setA[1]*setE[1]*setH[1])/tmp;
2243  probAFG = (setA[1]*setF[1]*setG[1])/tmp;
2244  probBDH = (setB[1]*setD[1]*setH[1])/tmp;
2245  probCDG = (setC[1]*setD[1]*setG[1])/tmp;
2246  newPointA->setFlag(int(100*(probAEH+probAFG)));
2247  newPointB->setFlag(int(100*probBDH));
2248  newPointC->setFlag(int(100*probCDG));
2249  newPointD->setFlag(int(100*(probBDH+probCDG)));
2250  newPointE->setFlag(int(100*probAEH));
2251  newPointF->setFlag(int(100*probAFG));
2252  newPointG->setFlag(int(100*(probAFG+probCDG)));
2253  newPointH->setFlag(int(100*(probAEH+probBDH)));
2254  mPoint->addNewPoint(newPointA);
2255  mPoint->addNewPoint(newPointB);
2256  mPoint->addNewPoint(newPointC);
2257  mPoint->addNewPoint(newPointD);
2258  mPoint->addNewPoint(newPointE);
2259  mPoint->addNewPoint(newPointF);
2260  mPoint->addNewPoint(newPointG);
2261  mPoint->addNewPoint(newPointH);
2262  nSolved++;
2263  }
2264 // 35 *********************************************************************
2265  else if(!strcmp(currentKind,"1p1n2n2p1n2n3n3p1n2n3n"))// case (3-3)GS
2266  {
2267  StSstPoint *newPointA = new StSstPoint(mPoint->getSize(), mId, currentPackage->getNPackage(), 33);
2268  setMatcheds(dimensions, newPointA, currentPackage->getMatched(0), currentPackage->getMatched(1));
2269  newPointA->setEnergyLossCorrected(Adc[0], Adc[1],CalibArray);
2270 
2271  StSstPoint *newPointB = new StSstPoint(mPoint->getSize(), mId, currentPackage->getNPackage(), 33);
2272  setMatcheds(dimensions, newPointB, currentPackage->getMatched(0), currentPackage->getMatched(2));
2273  newPointB->setEnergyLossCorrected(Adc[0], Adc[2],CalibArray);
2274 
2275  StSstPoint *newPointC = new StSstPoint(mPoint->getSize(), mId, currentPackage->getNPackage(), 33);
2276  setMatcheds(dimensions, newPointC, currentPackage->getMatched(3), currentPackage->getMatched(1));
2277  newPointC->setEnergyLossCorrected(Adc[3], Adc[1],CalibArray);
2278 
2279  StSstPoint *newPointD = new StSstPoint(mPoint->getSize(), mId, currentPackage->getNPackage(), 33);
2280  setMatcheds(dimensions, newPointD, currentPackage->getMatched(3), currentPackage->getMatched(2));
2281  newPointD->setEnergyLossCorrected(Adc[3], Adc[2],CalibArray);
2282 
2283  StSstPoint *newPointE = new StSstPoint(mPoint->getSize(), mId, currentPackage->getNPackage(), 33);
2284  setMatcheds(dimensions, newPointE, currentPackage->getMatched(3), currentPackage->getMatched(6));
2285  newPointE->setEnergyLossCorrected(Adc[3], Adc[6],CalibArray);
2286 
2287  StSstPoint *newPointF = new StSstPoint(mPoint->getSize(), mId, currentPackage->getNPackage(), 33);
2288  setMatcheds(dimensions, newPointF, currentPackage->getMatched(7), currentPackage->getMatched(1));
2289  newPointF->setEnergyLossCorrected(Adc[7], Adc[1],CalibArray);
2290 
2291  StSstPoint *newPointG = new StSstPoint(mPoint->getSize(), mId, currentPackage->getNPackage(), 33);
2292  setMatcheds(dimensions, newPointG, currentPackage->getMatched(7), currentPackage->getMatched(2));
2293  newPointG->setEnergyLossCorrected(Adc[7], Adc[2],CalibArray);
2294 
2295  StSstPoint *newPointH = new StSstPoint(mPoint->getSize(), mId, currentPackage->getNPackage(), 33);
2296  setMatcheds(dimensions, newPointH, currentPackage->getMatched(7), currentPackage->getMatched(6));
2297  newPointH->setEnergyLossCorrected(Adc[7], Adc[6],CalibArray);
2298 
2299 // traitement propre aux space points..(probabilite)
2300  Double_t setA[2], setB[2], setC[2], setD[2], setE[2], setF[2], setG[2], setH[2];
2301  Double_t probADH, probAEG, probBCH, probBEF;
2302 
2303  setA[0] = (Adc[0] - Adc[1])/sqrt(2.0);
2304  setA[1] = matchDistr(clusterControl, setA[0]);
2305  setB[0] = (Adc[0] - Adc[2])/sqrt(2.0);
2306  setB[1] = matchDistr(clusterControl, setB[0]);
2307  setC[0] = (Adc[3] - Adc[1])/sqrt(2.0);
2308  setC[1] = matchDistr(clusterControl, setC[0]);
2309  setD[0] = (Adc[3] - Adc[2])/sqrt(2.0);
2310  setD[1] = matchDistr(clusterControl, setD[0]);
2311  setE[0] = (Adc[3] - Adc[6])/sqrt(2.0);
2312  setE[1] = matchDistr(clusterControl, setE[0]);
2313  setF[0] = (Adc[7] - Adc[1])/sqrt(2.0);
2314  setF[1] = matchDistr(clusterControl, setF[0]);
2315  setG[0] = (Adc[7] - Adc[2])/sqrt(2.0);
2316  setG[1] = matchDistr(clusterControl, setG[0]);
2317  setH[0] = (Adc[7] - Adc[6])/sqrt(2.0);
2318  setH[1] = matchDistr(clusterControl, setH[0]);
2319  Double_t tmp = 3e-33+(setA[1]*setD[1]*setH[1]+setA[1]*setE[1]*setG[1]+setB[1]*setC[1]*setH[1]+setB[1]*setE[1]*setF[1]);
2320  probADH = (setA[1]*setD[1]*setH[1])/tmp;
2321  probAEG = (setA[1]*setE[1]*setG[1])/tmp;
2322  probBCH = (setB[1]*setC[1]*setH[1])/tmp;
2323  probBEF = (setB[1]*setE[1]*setF[1])/tmp;
2324  newPointA->setFlag(int(100*(probADH+probAEG)));
2325  newPointB->setFlag(int(100*(probBCH+probBEF)));
2326  newPointC->setFlag(int(100*probBCH));
2327  newPointD->setFlag(int(100*probADH));
2328  newPointE->setFlag(int(100*(probAEG+probBEF)));
2329  newPointF->setFlag(int(100*probBEF));
2330  newPointG->setFlag(int(100*probAEG));
2331  newPointH->setFlag(int(100*(probADH+probBCH)));
2332  mPoint->addNewPoint(newPointA);
2333  mPoint->addNewPoint(newPointB);
2334  mPoint->addNewPoint(newPointC);
2335  mPoint->addNewPoint(newPointD);
2336  mPoint->addNewPoint(newPointE);
2337  mPoint->addNewPoint(newPointF);
2338  mPoint->addNewPoint(newPointG);
2339  mPoint->addNewPoint(newPointH);
2340 
2341  nSolved++;
2342  }
2343 // 36 *********************************************************************
2344  else if(!strcmp(currentKind,"1p1n2n3n2p1n2n3n3p1n2n3n"))// case (3-3)H
2345  {
2346  StSstPoint *newPointA = new StSstPoint(mPoint->getSize(), mId, currentPackage->getNPackage(), 33);
2347  setMatcheds(dimensions, newPointA, currentPackage->getMatched(0), currentPackage->getMatched(1));
2348  newPointA->setEnergyLossCorrected(Adc[0], Adc[1],CalibArray);
2349 
2350  StSstPoint *newPointB = new StSstPoint(mPoint->getSize(), mId, currentPackage->getNPackage(), 33);
2351  setMatcheds(dimensions, newPointB, currentPackage->getMatched(0), currentPackage->getMatched(2));
2352  newPointB->setEnergyLossCorrected(Adc[0], Adc[2],CalibArray);
2353 
2354  StSstPoint *newPointC = new StSstPoint(mPoint->getSize(), mId, currentPackage->getNPackage(), 33);
2355  setMatcheds(dimensions, newPointC, currentPackage->getMatched(0), currentPackage->getMatched(3));
2356  newPointC->setEnergyLossCorrected(Adc[0], Adc[3],CalibArray);
2357 
2358  StSstPoint *newPointD = new StSstPoint(mPoint->getSize(), mId, currentPackage->getNPackage(), 33);
2359  setMatcheds(dimensions, newPointD, currentPackage->getMatched(4), currentPackage->getMatched(1));
2360  newPointD->setEnergyLossCorrected(Adc[4], Adc[1],CalibArray);
2361 
2362  StSstPoint *newPointE = new StSstPoint(mPoint->getSize(), mId, currentPackage->getNPackage(), 33);
2363  setMatcheds(dimensions, newPointE, currentPackage->getMatched(4), currentPackage->getMatched(2));
2364  newPointE->setEnergyLossCorrected(Adc[4], Adc[2],CalibArray);
2365 
2366  StSstPoint *newPointF = new StSstPoint(mPoint->getSize(), mId, currentPackage->getNPackage(), 33);
2367  setMatcheds(dimensions, newPointF, currentPackage->getMatched(4), currentPackage->getMatched(3));
2368  newPointF->setEnergyLossCorrected(Adc[4], Adc[3],CalibArray);
2369 
2370  StSstPoint *newPointG = new StSstPoint(mPoint->getSize(), mId, currentPackage->getNPackage(), 33);
2371  setMatcheds(dimensions, newPointG, currentPackage->getMatched(8), currentPackage->getMatched(1));
2372  newPointG->setEnergyLossCorrected(Adc[8], Adc[1],CalibArray);
2373 
2374  StSstPoint *newPointH = new StSstPoint(mPoint->getSize(), mId, currentPackage->getNPackage(), 33);
2375  setMatcheds(dimensions, newPointH, currentPackage->getMatched(8), currentPackage->getMatched(2));
2376  newPointH->setEnergyLossCorrected(Adc[8], Adc[2],CalibArray);
2377 
2378  StSstPoint *newPointI = new StSstPoint(mPoint->getSize(), mId, currentPackage->getNPackage(), 33);
2379  setMatcheds(dimensions, newPointI, currentPackage->getMatched(8), currentPackage->getMatched(3));
2380  newPointI->setEnergyLossCorrected(Adc[8], Adc[3],CalibArray);
2381 
2382 // traitement propre aux space points..(probabilite)
2383  Double_t setA[2], setB[2], setC[2], setD[2], setE[2], setF[2], setG[2], setH[2], setI[2];
2384  Double_t probAEI, probCEG, probAFH, probBDI, probCDH, probBFG;
2385 
2386  setA[0] = (Adc[0] - Adc[1])/sqrt(2.0);
2387  setA[1] = matchDistr(clusterControl, setA[0]);
2388  setB[0] = (Adc[0] - Adc[2])/sqrt(2.0);
2389  setB[1] = matchDistr(clusterControl, setB[0]);
2390  setC[0] = (Adc[0] - Adc[3])/sqrt(2.0);
2391  setC[1] = matchDistr(clusterControl, setC[0]);
2392  setD[0] = (Adc[4] - Adc[1])/sqrt(2.0);
2393  setD[1] = matchDistr(clusterControl, setD[0]);
2394  setE[0] = (Adc[4] - Adc[2])/sqrt(2.0);
2395  setE[1] = matchDistr(clusterControl, setE[0]);
2396  setF[0] = (Adc[4] - Adc[3])/sqrt(2.0);
2397  setF[1] = matchDistr(clusterControl, setF[0]);
2398  setG[0] = (Adc[8] - Adc[1])/sqrt(2.0);
2399  setG[1] = matchDistr(clusterControl, setG[0]);
2400  setH[0] = (Adc[8] - Adc[2])/sqrt(2.0);
2401  setH[1] = matchDistr(clusterControl, setH[0]);
2402  setI[0] = (Adc[8] - Adc[3])/sqrt(2.0);
2403  setI[1] = matchDistr(clusterControl, setI[0]);
2404  Double_t tmp = (3e-33+setA[1]*setE[1]*setI[1]+setC[1]*setE[1]*setG[1]+setA[1]*setF[1]*setH[1]+setB[1]*setD[1]*setI[1]+setC[1]*setD[1]*setH[1]+setB[1]*setF[1]*setG[1]);
2405  probAEI = (setA[1]*setE[1]*setI[1])/(tmp);
2406  probCEG = (setC[1]*setE[1]*setG[1])/(tmp);
2407  probAFH = (setA[1]*setF[1]*setH[1])/(tmp);
2408  probBDI = (setB[1]*setD[1]*setI[1])/(tmp);
2409  probCDH = (setC[1]*setD[1]*setH[1])/(tmp);
2410  probBFG = (setB[1]*setF[1]*setG[1])/(tmp);
2411  newPointA->setFlag(int(100*(probAEI+probAFH)));
2412  newPointB->setFlag(int(100*(probBDI+probBFG)));
2413  newPointC->setFlag(int(100*(probCEG+probCDH)));
2414  newPointD->setFlag(int(100*(probBDI+probCDH)));
2415  newPointE->setFlag(int(100*(probAEI+probCEG)));
2416  newPointF->setFlag(int(100*(probAFH+probBFG)));
2417  newPointG->setFlag(int(100*(probCEG+probBFG)));
2418  newPointH->setFlag(int(100*(probAFH+probCDH)));
2419  newPointI->setFlag(int(100*(probAEI+probBDI)));
2420  mPoint->addNewPoint(newPointA);
2421  mPoint->addNewPoint(newPointB);
2422  mPoint->addNewPoint(newPointC);
2423  mPoint->addNewPoint(newPointD);
2424  mPoint->addNewPoint(newPointE);
2425  mPoint->addNewPoint(newPointF);
2426  mPoint->addNewPoint(newPointG);
2427  mPoint->addNewPoint(newPointH);
2428  mPoint->addNewPoint(newPointI);
2429  nSolved++;
2430  }
2431  else LOG_INFO<<" Warning unsolved case ("<<currentKind<<")\n";// other cases
2432  delete [] Adc;
2433  currentPackage=mPackage->next(currentPackage);
2434  }
2435  return nSolved;
2436 }
2437 //________________________________________________________________________________
2438 Int_t StSstWafer::convertDigitToAnalog(Double_t pairCreationEnergy)
2439 {
2440  StSstPoint *currentPoint = mPoint->first();
2441  while(currentPoint)
2442  {
2443  currentPoint->setDe(currentPoint->getDe(0)*pairCreationEnergy,0);
2444  currentPoint->setDe(currentPoint->getDe(1)*pairCreationEnergy,1);
2445  currentPoint = mPoint->next(currentPoint);
2446  }
2447  return 1;
2448 }
2449 //________________________________________________________________________________
2450 Int_t StSstWafer::convertUFrameToLocal(sstDimensions_st *dimensions)
2451 {
2452  StSstPoint *currentPoint = mPoint->first();
2453  while(currentPoint)
2454  {
2455  // printf("posU(0)=%f posU(1)=%f\n",currentPoint->getPositionU(0),currentPoint->getPositionU(1));
2456  currentPoint->setXl(currentPoint->getPositionU(0)/2.+currentPoint->getPositionU(1)/2.-dimensions[0].waferHalfActLength+dimensions[0].waferHalfActWidth*tan(dimensions[0].stereoAngle),0);
2457  currentPoint->setXl((currentPoint->getPositionU(1)-currentPoint->getPositionU(0))/(2*tan(dimensions[0].stereoAngle)),2);
2458  currentPoint->setXl(0.0,1); //yL =0
2459  currentPoint = mPoint->next(currentPoint);
2460  }
2461  return 1;
2462 }
2463 //________________________________________________________________________________
2464 Int_t StSstWafer::convertLocalToGlobal() {
2465  StSstPoint *currentPoint = mPoint->first();
2466  Double_t xg[3];
2467  while(currentPoint) {
2468  Double_t xl[3] = {currentPoint->getXl(0), currentPoint->getXl(1), currentPoint->getXl(2)};
2469  LocalToMaster(xl,xg);
2470  currentPoint->setXg(xg[0],0);
2471  currentPoint->setXg(xg[1],1);
2472  currentPoint->setXg(xg[2],2);
2473  currentPoint = mPoint->next(currentPoint);
2474  }
2475  return 1;
2476 }
2477 //________________________________________________________________________________
2478 Int_t StSstWafer::convertGlobalToLocal() {
2479  Int_t localSize = (this->mPoint)->getSize();
2480  if (!localSize) return 0;
2481  StSstPoint *temp = mPoint->first();
2482  for (Int_t i = 0; i < localSize; i++) {
2483  Double_t xg[3] = {temp->getXg(0), temp->getXg(1), temp->getXg(2)};
2484  Double_t xl[3];
2485  MasterToLocal(xg,xl);
2486  temp->setXl( xl[0], 0);
2487  temp->setXl( xl[1], 1);
2488  temp->setXl( xl[2], 2);
2489  temp = mPoint->next(temp);
2490  }
2491  return 1;
2492 }
2493 //________________________________________________________________________________
2494 Int_t StSstWafer::convertLocalToUFrame(Float_t ActiveLargeEdge, Float_t ActiveSmallEdge, Float_t Theta)
2495 {
2496  Int_t localSize = (mPoint)->getSize();
2497  if (!localSize) return 0;
2498 
2499  StSstPoint *temp = (mPoint)->first();
2500  for (Int_t i = 0; i < localSize; i++)
2501 
2502  {
2503  temp->setUpos((temp->getXl(0)+(ActiveLargeEdge/2.))-(temp->getXl(1)+(ActiveSmallEdge/2.))*tan(Theta), 0);
2504  temp->setUpos((temp->getXl(0)+(ActiveLargeEdge/2.))+(temp->getXl(1)-(ActiveSmallEdge/2.))*tan(Theta), 1);
2505  temp = mPoint->next(temp);
2506  }
2507  //return 1;
2508  return localSize;
2509 }
2510 //________________________________________________________________________________
2511 StSstPointList* StSstWafer::getDeadHits(Float_t ActiveLargeEdge, Float_t ActiveSmallEdge,Float_t Test)
2512 {
2513  StSstPointList *listDeadBorder = getNonActivePointBorder(ActiveLargeEdge,ActiveSmallEdge);
2514  StSstPointList *listDeadTriangle = getNonActivePointTriangle(Test);
2515  StSstPointList *listDeadTotal = new StSstPointList();
2516  listDeadTotal = listDeadTotal->addPointList(listDeadBorder);
2517  listDeadTotal = listDeadTotal->addPointList(listDeadTriangle);
2518  listDeadTotal = listDeadTotal->removeMultipleCount();
2519  (mPoint)->substractPointList(listDeadTotal);
2520  delete listDeadBorder;
2521  delete listDeadTriangle;
2522  return listDeadTotal;
2523 }
2524 //________________________________________________________________________________
2525 void StSstWafer::convertToStrip(Float_t Pitch,
2526  Int_t nStripPerSide,
2527  Double_t pairCreationEnergy,
2528  Int_t nstripInACluster,
2529  Double_t parDiffP,
2530  Double_t parDiffN,
2531  Double_t parIndRightP,
2532  Double_t parIndRightN,
2533  Double_t parIndLeftP,
2534  Double_t parIndLeftN,
2535  Float_t mShift_hole,
2536  Float_t mShift_elec)
2537 {
2538  convertHitToStrip(Pitch,
2539  nStripPerSide,
2540  nstripInACluster,
2541  parDiffP,
2542  parDiffN,
2543  parIndRightP,
2544  parIndRightN,
2545  parIndLeftP,
2546  parIndLeftN,
2547  mShift_hole,
2548  mShift_elec);
2549  convertAnalogToDigit(pairCreationEnergy);
2550  mStripP->sortStrip();
2551  mStripN->sortStrip();
2552 }
2553 //________________________________________________________________________________
2554 Int_t StSstWafer::printborder()
2555 {
2556  if (mId==7101){
2557  printf("Wafer = %d \n",mId);
2558  Double_t actives[4][3],templs[4][3];
2559  Double_t activee[4][3],temple[4][3];
2560 
2561  actives[0][0]=-3.65,actives[1][0]= 3.65,actives[2][0]= 3.65,actives[3][0]=-3.65;
2562  actives[0][1]= 2.00,actives[1][1]= 2.00,actives[2][1]=-2.00,actives[3][1]=-2.00;
2563  actives[0][2]= 0.00,actives[1][2]= 0.00,actives[2][2]= 0.00,actives[3][2]= 0.00;
2564 
2565  activee[0][0]= 3.65,activee[1][0]= 3.65,activee[2][0]=-3.65,activee[3][0]=-3.65;
2566  activee[0][1]= 2.00,activee[1][1]=-2.00,activee[2][1]=-2.00,activee[3][1]= 2.00;
2567  activee[0][2]= 0.00,activee[1][2]= 0.00,activee[2][2]= 0.00,activee[3][2]= 0.00;
2568  for (Int_t j = 0; j < 4; j++) {
2569  LocalToMaster(actives[j], templs[j]);
2570  LocalToMaster(activee[j], temple[j]);
2571  }
2572  const Char_t *xyz[3] = {"x","y","z"};
2573  for (Int_t i = 0; i < 3; i++) {
2574  printf("%ssSsdLadder%d set {",xyz[i],mId-7100);
2575  for (Int_t j = 0; j < 4; j++) printf("%.2f ",templs[j][i]);
2576  printf("}\n");
2577  printf("%seSsdLadder%d set {",xyz[i],mId-7100);
2578  for (Int_t j = 0; j < 4; j++) printf("%.2f ",temple[j][i]);
2579  printf("}\n");
2580  }
2581  }
2582  return 1;
2583 }
2584 //________________________________________________________________________________
2585 StSstWafer::StSstWafer(const StSstWafer & originalWafer)
2586 {
2587  memcpy (first, originalWafer.first, last-first);
2588  mStripP = new StSstStripList();
2589  mStripN = new StSstStripList();
2590  mNoiseP = new StSpaListNoise();
2591  mNoiseN = new StSpaListNoise();
2592  mClusterP = new StSstClusterList();
2593  mClusterN = new StSstClusterList();
2594  mPackage = new StSstPackageList();
2595  mPoint = new StSstPointList();
2596 }
2597 
2598 StSstWafer& StSstWafer::operator=(const StSstWafer & originalWafer) {
2599  memset(first, 0, last-first);
2600  mId = originalWafer.mId;
2601  SetName(originalWafer.GetName());
2602  SetRotation(originalWafer.GetRotationMatrix());
2603  SetTranslation(originalWafer.GetTranslation());
2604  return *this;
2605 }
2606 //________________________________________________________________________________
2610 Int_t StSstWafer::geoMatched(sstDimensions_st *dimensions, StSstCluster *ptr1, StSstCluster *ptr2)
2611 {
2612  Int_t geomatched = 0;
2613  Int_t numStrip = int((2*dimensions[0].waferHalfActWidth*tan(dimensions[0].stereoAngle)/dimensions[0].stripPitch)+1);
2614  if ( (!ptr1) || (!ptr2) )
2615  geomatched = 0;
2616  else if((ptr2->getStripMean() > ( ptr1->getStripMean() - numStrip))
2617  && (ptr2->getStripMean() < (ptr1->getStripMean() + numStrip)))
2618  geomatched = 1;
2619  return geomatched;
2620 }
2621 //________________________________________________________________________________
2625 void StSstWafer::setMatcheds(sstDimensions_st *dimensions, StSstPoint *Point, StSstCluster *pMatched, StSstCluster *nMatched)
2626 {// strip(1) -> Upos(0)...
2627  Point->setPositionU((pMatched->getStripMean()-1)*dimensions[0].stripPitch,0);
2628  Point->setPositionU((nMatched->getStripMean()-1)*dimensions[0].stripPitch,1);
2629  Point->setIdClusterP(pMatched->getNCluster());
2630  Point->setIdClusterN(nMatched->getNCluster());
2631 
2632  // for evaluation only !!!
2633  Int_t pHitIndex = 0;
2634  Int_t nHitIndex = 0;
2635  Int_t sptHitIndex = 0;
2636  for (pHitIndex = 0; pHitIndex < SST_MAXIDMCHIT; pHitIndex++)
2637  {
2638  for (nHitIndex = 0; nHitIndex < SST_MAXIDMCHIT; nHitIndex++)
2639  {
2640  if ((pMatched->getIdMcHit(pHitIndex))
2641  &&(nMatched->getIdMcHit(nHitIndex))
2642  &&(pMatched->getIdMcHit(pHitIndex) == nMatched->getIdMcHit(nHitIndex))
2643  &&(sptHitIndex < SST_MAXIDMCHIT))
2644  Point->setNMchit(pMatched->getIdMcHit(pHitIndex),sptHitIndex++);
2645  }
2646  }
2647 }
2648 //________________________________________________________________________________
2649 Double_t StSstWafer::matchDistr(StSstClusterControl *clusterControl, Double_t x)
2650 {
2651  Double_t mean = clusterControl->getMatchMean();
2652  Double_t sigm = clusterControl->getMatchSigma();
2653  return TMath::Gaus(x, mean, sigm, 1);
2654 }
2655 //________________________________________________________________________________
2656 void StSstWafer::addHit(Int_t rNId , Int_t rMcHit, Int_t rMcTrack, Float_t *rXg , Float_t rDe, Float_t *p)
2657 {
2658  Float_t *alpha = new float[2];
2659  alpha[0] = 0.;
2660  alpha[1] = 0.;
2661  StSstPoint *tmpPoint = new StSstPoint(rNId, rMcHit, rMcTrack, rXg, rDe, findAngle(p,alpha));
2662  (mPoint)->addNewPoint(tmpPoint);
2663  delete [] alpha;
2664 }
2665 //________________________________________________________________________________
2666 StSstPointList* StSstWafer::getNonActivePointBorder(Float_t ActiveLargeEdge, Float_t ActiveSmallEdge)
2667 {
2668  Int_t localSize = (mPoint)->getSize();
2669 
2670  StSstPointList *deadPoints = new StSstPointList();
2671  if (!localSize) return deadPoints;
2672 
2673  StSstPoint *temp = (mPoint)->first();
2674  for (Int_t i = 0; i < localSize; i++)
2675  {
2676  if((temp->getXl(0) >(ActiveLargeEdge/2.)) || (temp->getXl(0) < (-ActiveLargeEdge/2.)) ||
2677  (temp->getXl(2) >(ActiveSmallEdge/2.)) || (temp->getXl(2) < (-ActiveSmallEdge/2.)))
2678  {
2679  // tempo : I can remove the hit now, just to keep information.
2680  StSstPoint *badPoint = temp->giveCopy();
2681  deadPoints->addNewPoint(badPoint);
2682  }
2683  temp = (mPoint)->next(temp);
2684  }
2685  return deadPoints;
2686 }
2687 //________________________________________________________________________________
2688  StSstPointList* StSstWafer::getNonActivePointTriangle(Float_t Test)
2689  //typically, test=pitch
2690 {
2691  Int_t localSize = (mPoint)->getSize();
2692  StSstPointList *deadPoints = new StSstPointList();
2693 
2694  if (!localSize) return deadPoints;
2695 
2696  StSstPoint *temp = (mPoint)->first();
2697  for (Int_t i = 0; i < localSize; i++)
2698  {
2699  if (temp->getPositionU(0) < -1.*Test && temp->getPositionU(1) < -1.*Test)
2700  {
2701  // tempo : I can remove the hit now, just to keep information.
2702  StSstPoint *badPoint = temp->giveCopy();
2703  deadPoints->addNewPoint(badPoint);
2704  }
2705  temp = (mPoint)->next(temp);
2706  }
2707  return deadPoints;
2708 }
2709 
2710 //________________________________________________________________________________
2711 Double_t StSstWafer::myErf(Double_t x)
2712 {
2713  const Double_t a1 = -1.26551223, a2 = 1.00002368,
2714  a3 = 0.37409196, a4 = 0.09678418,
2715  a5 = -0.18628806, a6 = 0.27886807,
2716  a7 = -1.13520398, a8 = 1.48851587,
2717  a9 = -0.82215223, a10 = 0.17087277;
2718 
2719  Double_t v = 1.;
2720  Double_t z = ((x) < 0. ? -(x) : (x));
2721 
2722  if (z <= 0) return (1.-v); // erfc(0)=1
2723  Double_t t = 1./(1.+0.5*z);
2724  v = t*exp((-z*z) +a1+t*(a2+t*(a3+t*(a4+t*(a5+t*(a6+t*(a7+t*(a8+t*(a9+t*a10)))))))));
2725 
2726  if (x < 0) v = 2.-v; // erfc(-x)=2-erfc(x)
2727  return (1.-v);
2728 }
2729 //________________________________________________________________________________
2730 void StSstWafer::convertHitToStrip(Float_t Pitch,
2731  Int_t nStripPerSide,
2732  Int_t nstripInACluster,
2733  Double_t parDiffP,
2734  Double_t parDiffN,
2735  Double_t parIndRightP,
2736  Double_t parIndRightN,
2737  Double_t parIndLeftP,
2738  Double_t parIndLeftN,
2739  Float_t mShift_hole,
2740  Float_t mShift_elec)
2741 {
2742  const Double_t parDiff[2]={parDiffP/Pitch,parDiffN/Pitch};
2743  const Double_t parIndRight[2]={parIndRightP,parIndRightN};
2744  const Double_t parIndLeft[2]={parIndLeftP,parIndLeftN};
2745 
2746  Int_t *tabInd = new Int_t[nstripInACluster];
2747  Float_t *tabDe = new Float_t[nstripInACluster];
2748 
2749  StSstPoint *ptr = (mPoint)->first();
2750  Int_t localSize = (mPoint)->getSize();
2751  for (Int_t iPoint = 0; iPoint < localSize; iPoint++)
2752  {
2753  for (Int_t iSide = 0; iSide < 2; iSide++)
2754  {
2755  for (Int_t v = 0 ; v < nstripInACluster; v++)
2756  {
2757  tabInd[v] = 0 ;
2758  tabDe[v] = 0.;
2759  }
2760  if (Debug()) LOG_DEBUG<<Form("Before Lorentz Shift")<<endm;
2761  if (Debug()) LOG_DEBUG<<Form("position of the hit : strip P=%f stripN=%f Pitch=%f",ptr->getPositionU(0),ptr->getPositionU(1),Pitch)<<endm;
2762  UndoLorentzShift(ptr,iSide,mShift_hole,mShift_elec,Pitch);
2763  if (Debug()) LOG_DEBUG<<Form("After Lorentz Shift\n");
2764  if (Debug()) LOG_DEBUG<<Form("position of the hit : strip P=%f stripN=%f Pitch=%f",ptr->getPositionU(0),ptr->getPositionU(1),Pitch)<<endm;
2765  tabInd[0] = (int)(ptr->getPositionU(iSide)/Pitch + 1.);//getPositionU(iSide)->getPositionU(iSide)+shift
2766  tabInd[1] = tabInd[0]+1;
2767  tabInd[2] = tabInd[0]-1;
2768  tabInd[3] = tabInd[0]+2;
2769  if (Debug()) LOG_DEBUG<<Form("Mean strip=%d strip1=%d strip2=%d strip3=%d",tabInd[0],tabInd[1],tabInd[2],tabInd[3])<<endm;
2770  Double_t rest = (double)(ptr->getPositionU(iSide)/Pitch) - (double)(tabInd[0]-1);
2771  Double_t Result=0.5*(1.+myErf((rest-0.5)/sqrt(2.)/parDiff[iSide]) );
2772  Float_t TmpDe0 = 0.;
2773  Float_t TmpDe1 = 0.;
2774  tabDe[0] = (1.-Result)*ptr->getDe();
2775  tabDe[1] = Result*ptr->getDe();
2776  tabDe[2] = tabDe[0]*parIndLeft[iSide];
2777  tabDe[3] = tabDe[1]*parIndRight[iSide];
2778  TmpDe0 = tabDe[1]*parIndLeft[iSide];
2779  TmpDe1 = tabDe[0]*parIndRight[iSide];
2780  tabDe[0] += TmpDe0;
2781  tabDe[1] += TmpDe1;
2782  for (Int_t st = 0; st < nstripInACluster; st++)
2783  {
2784  if ( tabInd[st] > 0 && tabInd[st] < nStripPerSide+1 )
2785  {
2786  if (Debug())printf("st =%d id =%d tabDe(%d)=%f charge=%f NId=%d McHit=%d MvTrack=%d\n",st,tabInd[st],st,tabDe[st],ptr->getDe(),ptr->getNId(),ptr->getMcHit(),ptr->getMcTrack());
2787  StSstStrip *newStrip = new StSstStrip(tabInd[st], ptr->getNId(), ptr->getMcHit(), ptr->getMcTrack(), tabDe[st]);
2788  switch (iSide)
2789  {
2790  case 0:
2791  mStripP->updateStrip(newStrip);
2792  break;
2793  case 1:
2794  mStripN->updateStrip(newStrip);
2795  break;
2796  }
2797  }
2798  }
2799  }
2800  ptr = (mPoint)->next(ptr);
2801  }
2802  delete [] tabInd;
2803  delete [] tabDe;
2804 }
2805 //________________________________________________________________________________
2806 void StSstWafer::convertAnalogToDigit(Double_t pairCreationEnergy)
2807 {
2808  const Double_t ConversionFactor = 1./pairCreationEnergy;//GeV
2809 
2810  Int_t localSize = mStripP->getSize();
2811  StSstStrip *curr = mStripP->first();
2812  Int_t i = 0;
2813  for (i = 0; i < localSize; i++)
2814  {
2815  curr->setDigitSig((int)(curr->getAnalogSig()*ConversionFactor));
2816  curr = mStripP->next(curr);
2817  }
2818  localSize = mStripN->getSize();
2819  curr = mStripN->first();
2820  for (i = 0; i < localSize; i++)
2821  {
2822  curr->setDigitSig((int)(curr->getAnalogSig()*ConversionFactor));
2823  curr = mStripN->next(curr);
2824  }
2825 }
2826 //________________________________________________________________________________
2827 float* StSstWafer::findAngle(Float_t *p, Float_t *alpha)
2828 {
2829  Int_t i = 0;
2830  Float_t pT[3],pN[3],pD[3];
2831 
2832  Float_t spT = 0.;
2833  Float_t spN = 0.;
2834  Float_t spD = 0.;
2835 
2836  Float_t npN = 0.;
2837  Float_t npD = 0.;
2838 
2839  for (i = 0; i < 3; i++)
2840  {
2841  spN += n(i)*p[i] ;
2842  spT += t(i)*p[i] ;
2843  spD += d(i)*p[i] ;
2844  }
2845  for (i = 0; i < 3; i++)
2846  {
2847  pN[i] = n(i)*spN ;
2848  pT[i] = t(i)*spT ;
2849  pD[i] = d(i)*spD ;
2850  }
2851 
2852  npD = sqrt(pD[0]*pD[0]+pD[1]*pD[1]+pD[2]*pD[2]);
2853  npN = sqrt(pN[0]*pN[0]+pN[1]*pN[1]+pN[2]*pN[2]);
2854 
2855 // Float_t np = sqrt(p[0]*p[0]+p[1]*p[1]+p[2]*p[2]);
2856  Float_t npDN = sqrt((pN[0]+pD[0])*(pN[0]+pD[0])+(pN[1]+pD[1])*(pN[1]+pD[1])+(pN[2]+pD[2])*(pN[2]+pD[2]));
2857  Float_t npTD = sqrt((pT[0]+pD[0])*(pT[0]+pD[0])+(pT[1]+pD[1])*(pT[1]+pD[1])+(pT[2]+pD[2])*(pT[2]+pD[2]));
2858 
2859  alpha[0] = acos(npN/npDN);
2860  Float_t sSign = 0.;
2861  sSign = pD[0]*pN[0]+pD[1]*pN[1]+pD[2]*pN[2]+npN*npN;
2862  if (sSign<0.) alpha[0] = -1.*alpha[0];
2863 
2864  alpha[1] = acos(npD/npTD);
2865  sSign = pD[0]*pT[0]+pD[1]*pT[1]+pD[2]*pT[2]+npD*npD;
2866  if (sSign<0.) alpha[1] = -1.*alpha[1];
2867 
2868  return alpha;
2869 }
2870 //________________________________________________________________________________
2871 void StSstWafer::addNoiseToStripSignal(StSpaNoise *ptr, Int_t iSide)
2872 {
2873  if (iSide)
2874  { mNoiseN->addNewNoise(ptr); }
2875  else
2876  { mNoiseP->addNewNoise(ptr); }
2877 }
2878 //________________________________________________________________________________
2879 void StSstWafer::setIsActive(Int_t rIsActive, Int_t iSide, Int_t rNStrip)
2880 {
2881  if (iSide)
2882  { mNoiseN->setIsActive(rIsActive, rNStrip); }
2883  else
2884  { mNoiseP->setIsActive(rIsActive, rNStrip); }
2885 }
2886 //________________________________________________________________________________
2887 void StSstWafer::sortNoise()
2888 {
2889  mNoiseP->sortStrip();
2890  mNoiseN->sortStrip();
2891 }
2892 //________________________________________________________________________________
2893 void StSstWafer::addNoiseToStripSignal(long nElectronInAMip,long adcDynamic)
2894 {
2895  mNoiseP->addSignal(mStripP, nElectronInAMip, adcDynamic);
2896  mNoiseN->addSignal(mStripN, nElectronInAMip, adcDynamic);
2897 }
2898 //________________________________________________________________________________
2899 void StSstWafer::pedestalSubstraction()
2900 {
2901  mNoiseP->substractPedestal();
2902  mNoiseN->substractPedestal();
2903 }
2904 //________________________________________________________________________________
2905 void StSstWafer::zeroSubstraction()
2906 {
2907  mNoiseP->zeroSubstraction();
2908  mNoiseN->zeroSubstraction();
2909 }
2910 //________________________________________________________________________________
2911 void StSstWafer::convertAnalogToDigit(Long_t nElectronInAMip,Long_t adcDynamic,
2912  Long_t nbitEncoding, Float_t daqCutValue)
2913 {
2914  mNoiseP->convertAnalogToDigit(nElectronInAMip, adcDynamic,
2915  nbitEncoding,daqCutValue);
2916  mNoiseN->convertAnalogToDigit(nElectronInAMip, adcDynamic,
2917  nbitEncoding,daqCutValue);
2918 }
2919 //________________________________________________________________________________
2920 void StSstWafer::updateStripList()
2921 {
2922  mStripP->updateStripList(mNoiseP);
2923  mStripN->updateStripList(mNoiseN);
2924 }
2925 //________________________________________________________________________________
2926 void StSstWafer::UndoLorentzShift(StSstPoint *ptr,Int_t iSide,Float_t mShift_hole,Float_t mShift_elec,Float_t pitch)
2927 {
2928  Float_t tempPosition = ptr->getPositionU(iSide);
2929  if(iSide==0){
2930  ptr->setPositionU(tempPosition+mShift_hole,iSide);
2931  }
2932  else
2933  if(iSide==1){
2934  ptr->setPositionU(tempPosition+mShift_elec,iSide);
2935  }
2936 }
2937 
void doLorentzShift(sstDimensions_st *dimensions, Float_t mShift_hole, Float_t mShift_elec)
Definition: StSstWafer.cc:418
void addPoint(StSstPoint *ptr)
Attaches the ptr point on that wafer.
Definition: StSstWafer.cc:193
void sortPoint()
Definition: StSstWafer.cc:225
Int_t doFindPackage(sstDimensions_st *dimensions, StSstClusterControl *clusterControl)
Definition: StSstWafer.cc:441
Int_t geoMatched(sstDimensions_st *dimensions, StSstCluster *ptr1, StSstCluster *ptr2)
Determines if two clusters are geometricaly compatible.
Definition: StSstWafer.cc:2610
void addCluster(StSstCluster *ptr, Int_t iSide)
Attaches the ptr cluster on the iSide of the wafer.
Definition: StSstWafer.cc:176
void addStrip(StSstStrip *ptr, Int_t iSide)
Definition: StSstWafer.cc:165
Int_t doClusterSplitting(StSstClusterControl *clusterControl, Int_t iSide)
Definition: StSstWafer.cc:369
void sortCluster()
Definition: StSstWafer.cc:216
Int_t doFindCluster(StSstClusterControl *clusterControl, Int_t iSide)
Does the cluster finding.
Definition: StSstWafer.cc:281
void addPackage(StSstPackage *ptr)
Attaches the ptr package on that wafer.
Definition: StSstWafer.cc:187
void sortStrip()
Definition: StSstWafer.cc:207
void setMatcheds(sstDimensions_st *dimensions, StSstPoint *Point, StSstCluster *pMatched, StSstCluster *nMatched)
Definition: StSstWafer.cc:2625
void doClusterisation(Int_t *numberOfCluster, StSstClusterControl *clusterControl)
Definition: StSstWafer.cc:232