1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
16 /* $Id: AliTPCclustererKr.cxx,v 1.7 2008/02/06 17:24:53 matyja Exp $ */
18 //-----------------------------------------------------------------
19 // Implementation of the TPC Kr cluster class
21 // Origin: Adam Matyja, INP PAN, adam.matyja@ifj.edu.pl
22 //-----------------------------------------------------------------
25 Instruction - how to use that:
26 There are two macros prepared. One is for preparing clusters from MC
27 samples: FindKrClusters.C. The output is kept in TPC.RecPoints.root.
28 The other macro is prepared for data analysis: FindKrClustersRaw.C.
29 The output is created for each processed file in root file named adc.root.
30 For each data subsample the same named file is created. So be careful
31 do not overwrite them.
33 Additional selection criteria to select the GOLD cluster
35 // open file with clusters
36 TFile f("Krypton.root");
37 TTree * tree = (TTree*)f.Get("Kr")
38 TCut cutR0("cutR0","fADCcluster/fSize<100"); // adjust it according v seetings -
39 TCut cutR1("cutR1","fADCcluster/fSize>7"); // cosmic tracks and noise removal
40 TCut cutR2("cutR2","fMax.fAdc/fADCcluster<0.2"); // digital noise removal
41 TCut cutR3("cutR3","fMax.fAdc/fADCcluster>0.01"); // noise removal
42 TCut cutS1("cutS1","fSize<200"); // adjust it according v seetings - cosmic tracks
43 TCut cutAll = cutR0+cutR1+cutR2+cutR3+cutS1;
44 This values are typical values to be applied in selectors
51 To run clusterizaton for MC type:
54 If you don't want to use the standard selection criteria then you
57 // load the standard setup
58 AliRunLoader* rl = AliRunLoader::Open("galice.root");
59 AliTPCLoader *tpcl = (AliTPCLoader*)rl->GetLoader("TPCLoader");
62 gAlice=rl->GetAliRun();
63 TDirectory *cwd = gDirectory;
64 AliTPCv4 *tpc = (AliTPCv4*)gAlice->GetDetector("TPC");
65 Int_t ver = tpc->IsVersion();
67 AliTPCParam *param=(AliTPCParamSR *)gDirectory->Get("75x40_100x60_150x60");
68 AliTPCDigitsArray *digarr=new AliTPCDigitsArray;
73 Int_t nevmax=rl->GetNumberOfEvents();
74 for(Int_t nev=0;nev<nevmax ;nev++){
76 TTree* input_tree= tpcl->TreeD();//load tree with digits
77 digarr->ConnectTree(input_tree);
78 TTree *output_tree =tpcl->TreeR();//load output tree
80 AliTPCclustererKr *clusters = new AliTPCclustererKr();
81 clusters->SetParam(param);
82 clusters->SetInput(input_tree);
83 clusters->SetOutput(output_tree);
84 clusters->SetDigArr(digarr);
86 //If you want to change the cluster finder parameters for MC there are
89 //1. signal threshold (everything below the given number is treated as 0)
90 clusters->SetMinAdc(3);
92 //2. number of neighbouring timebins to be considered
93 clusters->SetMinTimeBins(2);
95 //3. distance of the cluster center to the center of a pad in pad-padrow plane
96 //(in cm). Remenber that this is still quantified by pad size.
97 clusters->SetMaxPadRangeCm(2.5);
99 //4. distance of the cluster center to the center of a padrow in pad-padrow
100 //plane (in cm). Remenber that this is still quantified by pad size.
101 clusters->SetMaxRowRangeCm(3.5);
103 //5. distance of the cluster center to the max time bin on a pad (in tackts)
104 //ie. fabs(centerT - time)<7
105 clusters->SetMaxTimeRange(7);
107 //6. cut reduce peak at 0. There are noises which appear mostly as two
108 //timebins on one pad.
109 clusters->SetValueToSize(3.5);
112 clusters->finderIO();
113 tpcl->WriteRecPoints("OVERWRITE");
115 delete rl;//cleans everything
118 ********* DATA *********
121 To run clusterizaton for DATA for file named raw_data.root type:
122 .x FindKrClustersRaw.C("raw_data.root")
124 If you want to change some criteria do the following:
127 // remove Altro warnings
129 AliLog::SetClassDebugLevel("AliTPCRawStream",-5);
130 AliLog::SetClassDebugLevel("AliRawReaderDate",-5);
131 AliLog::SetClassDebugLevel("AliTPCAltroMapping",-5);
132 AliLog::SetModuleDebugLevel("RAW",-5);
135 // Get database with noises
137 // char *ocdbpath = gSystem->Getenv("OCDB_PATH");
138 char *ocdbpath ="local:///afs/cern.ch/alice/tpctest/OCDB";
140 ocdbpath="alien://folder=/alice/data/2007/LHC07w/OCDB/";
142 AliCDBManager * man = AliCDBManager::Instance();
143 man->SetDefaultStorage(ocdbpath);
145 AliTPCCalPad * noiseTPC = AliTPCcalibDB::Instance()->GetPadNoise();
146 AliTPCAltroMapping** mapping =AliTPCcalibDB::Instance()->GetMapping();
149 TFile *hfile=new TFile("adc.root","RECREATE","ADC file");
150 // Create a ROOT Tree
151 TTree *mytree = new TTree("Kr","Krypton cluster tree");
154 const char *fileName="data.root";
155 AliRawReader *reader = new AliRawReaderRoot(fileName);
156 //AliRawReader *reader = new AliRawReaderDate(fileName);
158 AliAltroRawStreamFast* stream = new AliAltroRawStreamFast(reader);
159 stream->SelectRawData("TPC");
162 AliTPCclustererKr *clusters = new AliTPCclustererKr();
163 clusters->SetOutput(mytree);
164 clusters->SetRecoParam(0);//standard reco parameters
165 AliTPCParamSR *param=new AliTPCParamSR();
166 clusters->SetParam(param);//TPC parameters(sectors, timebins, etc.)
168 //set cluster finder parameters (from data):
169 //1. zero suppression parameter
170 clusters->SetZeroSup(param->GetZeroSup());
173 clusters->SetFirstBin(60);
176 clusters->SetLastBin(950);
179 clusters->SetMaxNoiseAbs(2);
181 //5. maximal amount of sigma of noise
182 clusters->SetMaxNoiseSigma(3);
184 //The remaining parameters are the same paramters as for MC (see MC section
186 clusters->SetMinAdc(3);
187 clusters->SetMinTimeBins(2);
188 clusters->SetMaxPadRangeCm(2.5);
189 clusters->SetMaxRowRangeCm(3.5);
190 clusters->SetMaxTimeRange(7);
191 clusters->SetValueToSize(3.5);
193 while (reader->NextEvent()) {
194 clusters->FinderIO(reader);
204 #include "AliTPCclustererKr.h"
205 #include "AliTPCclusterKr.h"
209 #include "AliPadMax.h"
210 #include "AliSimDigits.h"
211 #include "AliTPCv4.h"
212 #include "AliTPCParam.h"
213 #include "AliTPCDigitsArray.h"
214 #include "AliTPCvtpr.h"
215 #include "AliTPCClustersRow.h"
219 #include "TTreeStream.h"
221 #include "AliTPCTransform.h"
223 //used in raw data finder
224 #include "AliTPCROC.h"
225 #include "AliTPCCalPad.h"
226 #include "AliTPCAltroMapping.h"
227 #include "AliTPCcalibDB.h"
228 #include "AliTPCRawStream.h"
229 #include "AliTPCRecoParam.h"
230 #include "AliTPCReconstructor.h"
231 #include "AliRawReader.h"
232 #include "AliTPCCalROC.h"
234 ClassImp(AliTPCclustererKr)
237 AliTPCclustererKr::AliTPCclustererKr()
265 // default constructor
269 AliTPCclustererKr::AliTPCclustererKr(const AliTPCclustererKr ¶m)
299 fParam = param.fParam;
300 fRecoParam = param.fRecoParam;
301 fRawData = param.fRawData;
302 fInput = param.fInput ;
303 fOutput = param.fOutput;
304 fDigarr = param.fDigarr;
305 fZeroSup = param.fZeroSup ;
306 fFirstBin = param.fFirstBin ;
307 fLastBin = param.fLastBin ;
308 fMaxNoiseAbs = param.fMaxNoiseAbs ;
309 fMaxNoiseSigma = param.fMaxNoiseSigma ;
310 fMinAdc = param.fMinAdc;
311 fMinTimeBins = param.fMinTimeBins;
312 // fMaxPadRange = param.fMaxPadRange ;
313 // fMaxRowRange = param.fMaxRowRange ;
314 fMaxTimeRange = param.fMaxTimeRange;
315 fValueToSize = param.fValueToSize;
316 fMaxPadRangeCm = param.fMaxPadRangeCm;
317 fMaxRowRangeCm = param.fMaxRowRangeCm;
318 fDebugLevel = param.fDebugLevel;
319 fHistoRow = param.fHistoRow ;
320 fHistoPad = param.fHistoPad ;
321 fHistoTime = param.fHistoTime;
322 fHistoRowPad = param.fHistoRowPad;
326 AliTPCclustererKr & AliTPCclustererKr::operator = (const AliTPCclustererKr & param)
329 // assignment operator
331 fParam = param.fParam;
332 fRecoParam = param.fRecoParam;
333 fRawData = param.fRawData;
334 fInput = param.fInput ;
335 fOutput = param.fOutput;
336 fDigarr = param.fDigarr;
337 fZeroSup = param.fZeroSup ;
338 fFirstBin = param.fFirstBin ;
339 fLastBin = param.fLastBin ;
340 fMaxNoiseAbs = param.fMaxNoiseAbs ;
341 fMaxNoiseSigma = param.fMaxNoiseSigma ;
342 fMinAdc = param.fMinAdc;
343 fMinTimeBins = param.fMinTimeBins;
344 // fMaxPadRange = param.fMaxPadRange ;
345 // fMaxRowRange = param.fMaxRowRange ;
346 fMaxTimeRange = param.fMaxTimeRange;
347 fValueToSize = param.fValueToSize;
348 fMaxPadRangeCm = param.fMaxPadRangeCm;
349 fMaxRowRangeCm = param.fMaxRowRangeCm;
350 fDebugLevel = param.fDebugLevel;
351 fHistoRow = param.fHistoRow ;
352 fHistoPad = param.fHistoPad ;
353 fHistoTime = param.fHistoTime;
354 fHistoRowPad = param.fHistoRowPad;
358 AliTPCclustererKr::~AliTPCclustererKr()
366 void AliTPCclustererKr::SetRecoParam(AliTPCRecoParam *recoParam)
369 // set reconstruction parameters
372 fRecoParam = recoParam;
374 //set default parameters if not specified
375 fRecoParam = AliTPCReconstructor::GetRecoParam();
376 if (!fRecoParam) fRecoParam = AliTPCRecoParam::GetLowFluxParam();
382 ////____________________________________________________________________________
384 void AliTPCclustererKr::SetInput(TTree * tree)
387 // set input tree with digits
390 if (!fInput->GetBranch("Segment")){
391 cerr<<"AliTPCclusterKr::FindClusterKr(): no proper input tree !\n";
397 void AliTPCclustererKr::SetOutput(TTree * /*tree*/)
402 fOutput = new TTreeSRedirector("Krypton.root");
405 ////____________________________________________________________________________
407 Int_t AliTPCclustererKr::FinderIO()
409 // Krypton cluster finder for simulated events from MC
412 Error("Digits2Clusters", "input tree not initialised");
417 Error("Digits2Clusters", "output tree not initialised");
425 Int_t AliTPCclustererKr::FinderIO(AliRawReader* rawReader)
427 // Krypton cluster finder for the TPC raw data
429 // fParam must be defined before
431 if(rawReader)fRawData=kTRUE; //set flag to data
434 Error("Digits2Clusters", "output tree not initialised");
438 fParam->SetMaxTBin(fRecoParam->GetLastBin());//set number of timebins from reco -> param
439 // used later for memory allocation
441 Bool_t isAltro=kFALSE;
443 AliTPCROC * roc = AliTPCROC::Instance();
444 AliTPCCalPad * noiseTPC = AliTPCcalibDB::Instance()->GetPadNoise();
445 AliTPCAltroMapping** mapping =AliTPCcalibDB::Instance()->GetMapping();
447 AliTPCRawStream input(rawReader,(AliAltroMapping**)mapping);
449 const Int_t kNIS = fParam->GetNInnerSector();//number of inner sectors
450 const Int_t kNOS = fParam->GetNOuterSector();//number of outer sectors
451 const Int_t kNS = kNIS + kNOS;//all sectors
455 AliTPCDigitsArray *digarr=new AliTPCDigitsArray(kFALSE);//data not sim
456 digarr->Setup(fParam);//as usually parameters
461 for(Int_t iSec = 0; iSec < kNS; iSec++) {
462 AliTPCCalROC * noiseROC;
464 noiseROC =new AliTPCCalROC(iSec);//noise=0
467 noiseROC = noiseTPC->GetCalROC(iSec); // noise per given sector
469 Int_t nRows = 0; //number of rows in sector
470 Int_t nDDLs = 0; //number of DDLs
471 Int_t indexDDL = 0; //DDL index
473 nRows = fParam->GetNRowLow();
477 nRows = fParam->GetNRowUp();
479 indexDDL = (iSec-kNIS) * 4 + kNIS * 2;
483 // Load the raw data for corresponding DDLs
486 rawReader->Select("TPC",indexDDL,indexDDL+nDDLs-1);
490 // Allocate memory for rows in sector (pads(depends on row) x timebins)
491 for(Int_t iRow = 0; iRow < nRows; iRow++) {
492 digarr->CreateRow(iSec,iRow);
493 }//end loop over rows
496 rawReader->Select("TPC",indexDDL,indexDDL+nDDLs-1);
499 // Begin loop over altro data
501 while (input.Next()) {
503 //check sector consistency
504 if (input.GetSector() != iSec)
505 AliFatal(Form("Sector index mismatch ! Expected (%d), but got (%d) !",iSec,input.GetSector()));
507 Int_t iRow = input.GetRow();
508 Int_t iPad = input.GetPad();
509 Int_t iTimeBin = input.GetTime();
513 fHistoRow->Fill(iRow);
514 fHistoPad->Fill(iPad);
515 fHistoTime->Fill(iTimeBin);
516 fHistoRowPad->Fill(iPad,iRow);
517 }else if(fDebugLevel>=0&&fDebugLevel<72){
518 if(iSec==fDebugLevel){
519 fHistoRow->Fill(iRow);
520 fHistoPad->Fill(iPad);
521 fHistoTime->Fill(iTimeBin);
522 fHistoRowPad->Fill(iPad,iRow);
524 }else if(fDebugLevel==73){
526 fHistoRow->Fill(iRow);
527 fHistoPad->Fill(iPad);
528 fHistoTime->Fill(iTimeBin);
529 fHistoRowPad->Fill(iPad,iRow);
531 }else if(fDebugLevel==74){
533 fHistoRow->Fill(iRow);
534 fHistoPad->Fill(iPad);
535 fHistoTime->Fill(iTimeBin);
536 fHistoRowPad->Fill(iPad,iRow);
540 //check row consistency
541 if (iRow < 0 ) continue;
542 if (iRow < 0 || iRow >= nRows){
543 AliError(Form("Pad-row index (%d) outside the range (%d -> %d) !",
548 //check pad consistency
549 if (iPad < 0 || iPad >= (Int_t)(roc->GetNPads(iSec,iRow))) {
550 AliError(Form("Pad index (%d) outside the range (%d -> %d) !",
551 iPad, 0, roc->GetNPads(iSec,iRow) ));
555 //check time consistency
556 if ( iTimeBin < fRecoParam->GetFirstBin() || iTimeBin >= fRecoParam->GetLastBin()){
557 //cout<<iTimeBin<<endl;
559 AliFatal(Form("Timebin index (%d) outside the range (%d -> %d) !",
560 iTimeBin, 0, fRecoParam->GetLastBin() -1));
564 Int_t signal = input.GetSignal();
565 if (signal <= fZeroSup ||
566 iTimeBin < fFirstBin ||
569 digarr->GetRow(iSec,iRow)->SetDigitFast(0,iTimeBin,iPad);
572 if (!noiseROC) continue;
573 Double_t noiseOnPad = noiseROC->GetValue(iRow,iPad);//noise on given pad and row in sector
574 if (noiseOnPad > fMaxNoiseAbs){
575 digarr->GetRow(iSec,iRow)->SetDigitFast(0,iTimeBin,iPad);
576 continue; // consider noisy pad as dead
578 if(signal <= fMaxNoiseSigma * noiseOnPad){
579 digarr->GetRow(iSec,iRow)->SetDigitFast(0,iTimeBin,iPad);
582 digarr->GetRow(iSec,iRow)->SetDigitFast(signal,iTimeBin,iPad);
583 }//end of loop over altro data
584 }//end of loop over sectors
587 if(isAltro) FindClusterKrIO();
594 Int_t AliTPCclustererKr::CleanSector(Int_t sector){
596 // clean isolated digits
598 const Int_t kNRows=fParam->GetNRow(sector);//number of rows in sector
599 for(Int_t iRow=0; iRow<kNRows; ++iRow){
600 AliSimDigits *digrow;
602 digrow = (AliSimDigits*)fDigarr->GetRow(sector,iRow);//real data
604 digrow = (AliSimDigits*)fDigarr->LoadRow(sector,iRow);//MC
606 if(!digrow) continue;
607 digrow->ExpandBuffer(); //decrunch
608 const Int_t kNPads = digrow->GetNCols(); // number of pads
609 const Int_t kNTime = digrow->GetNRows(); // number of timebins
610 for(Int_t iPad=1;iPad<kNPads-1;iPad++){
611 Short_t* val = digrow->GetDigitsColumn(iPad);
613 for(Int_t iTimeBin=1;iTimeBin<kNTime-1;iTimeBin++){
614 if (val[iTimeBin]<=0) continue;
615 if (val[iTimeBin-1]+val[iTimeBin+1]<fZeroSup) {val[iTimeBin]=0; continue;}
616 if (val[iTimeBin-kNTime]+val[iTimeBin+kNTime]<fZeroSup) {val[iTimeBin]=0; continue;}
618 if (val[iTimeBin-1-kNTime]+val[iTimeBin+1+kNTime]<fZeroSup) {val[iTimeBin]=0; continue;}
619 if (val[iTimeBin+1-kNTime]+val[iTimeBin-1+kNTime]<fZeroSup) {val[iTimeBin]=0; continue;}
625 ////____________________________________________________________________________
626 Int_t AliTPCclustererKr::FindClusterKrIO()
630 //fParam and fDigarr must be set to run this method
633 Int_t clusterCounter=0;
634 const Int_t nTotalSector=fParam->GetNSector();//number of sectors
635 for(Int_t iSec=0; iSec<nTotalSector; ++iSec){
637 //vector of maxima for each sector
638 //std::vector<AliPadMax*> maximaInSector;
639 TObjArray *maximaInSector=new TObjArray();//to store AliPadMax*
642 // looking for the maxima on the pad
647 const Int_t kNRows=fParam->GetNRow(iSec);//number of rows in sector
648 for(Int_t iRow=0; iRow<kNRows; ++iRow){
649 AliSimDigits *digrow;
651 digrow = (AliSimDigits*)fDigarr->GetRow(iSec,iRow);//real data
653 digrow = (AliSimDigits*)fDigarr->LoadRow(iSec,iRow);//MC
655 if(digrow){//if pointer exist
656 digrow->ExpandBuffer(); //decrunch
657 const Int_t kNPads = digrow->GetNCols(); // number of pads
658 const Int_t kNTime = digrow->GetNRows(); // number of timebins
659 for(Int_t iPad=0;iPad<kNPads;iPad++){
661 Int_t timeBinMax=-1;//timebin of maximum
662 Int_t valueMaximum=-1;//value of maximum in adc
663 Int_t increaseBegin=-1;//timebin when increase starts
664 Int_t sumAdc=0;//sum of adc on the pad in maximum surrounding
665 bool ifIncreaseBegin=true;//flag - check if increasing started
666 bool ifMaximum=false;//flag - check if it could be maximum
667 Short_t* val = digrow->GetDigitsColumn(iPad);
668 for(Int_t iTimeBin=1;iTimeBin<kNTime-1;iTimeBin++){
670 if (val[iTimeBin]==-1) break; // 0 until the end
671 for( ; iTimeBin<kNTime-2&&val[iTimeBin]<fMinAdc ;iTimeBin++){}
674 Short_t adc = val[iTimeBin];
675 if(adc<fMinAdc){//standard was 3
677 if(iTimeBin-increaseBegin<fMinTimeBins){//at least 2 time bins
682 ifIncreaseBegin=true;
686 //insert maximum, default values and set flags
687 //Double_t xCord,yCord;
688 //GetXY(iSec,iRow,iPad,xCord,yCord);
689 Double_t x[]={iRow,iPad,iTimeBin};
691 AliTPCTransform trafo;
692 trafo.Transform(x,i,0,1);
694 AliPadMax *oneMaximum = new AliPadMax(AliTPCvtpr(valueMaximum,
704 maximaInSector->AddLast(oneMaximum);
710 ifIncreaseBegin=true;
717 ifIncreaseBegin=false;
718 increaseBegin=iTimeBin;
721 if(adc>valueMaximum){
727 if(iTimeBin==kNTime-1 && ifMaximum && kNTime-increaseBegin>fMinTimeBins){//on the edge
728 //at least 3 timebins
729 //insert maximum, default values and set flags
730 //Double_t xCord,yCord;
731 //GetXY(iSec,iRow,iPad,xCord,yCord);
732 Double_t x[]={iRow,iPad,iTimeBin};
734 AliTPCTransform trafo;
735 trafo.Transform(x,i,0,1);
736 AliPadMax *oneMaximum = new AliPadMax(AliTPCvtpr(valueMaximum,
746 maximaInSector->AddLast(oneMaximum);
752 ifIncreaseBegin=true;
757 }//end loop over timebins
758 }//end loop over pads
760 // cout<<"Pointer does not exist!!"<<endl;
761 }//end if poiner exists
762 }//end loop over rows
764 MakeClusters(maximaInSector,iSec,clusterCounter);
766 maximaInSector->SetOwner(kTRUE);
767 maximaInSector->Delete();
768 delete maximaInSector;
770 cout<<"Number of clusters in event: "<<clusterCounter<<endl;
774 void AliTPCclustererKr::MakeClusters(TObjArray * maximaInSector, Int_t iSec, Int_t &clusterCounter){
787 Int_t entriesArr = maximaInSector->GetEntriesFast();
788 for(Int_t it1 = 0; it1 < entriesArr; ++it1 ) {
790 AliPadMax *mp1=(AliPadMax *)maximaInSector->UncheckedAt(it1);
792 AliTPCclusterKr clusterKr;
795 Int_t clusterValue=0;
796 clusterValue+=(mp1)->GetSum();
797 list<Int_t> nUsedRows;
798 nUsedRows.push_back((mp1)->GetRow());
800 maxDig =(mp1)->GetAdc() ;
801 maxSumAdc =(mp1)->GetSum() ;
802 maxTimeBin =(mp1)->GetTime();
803 maxPad =(mp1)->GetPad() ;
804 maxRow =(mp1)->GetRow() ;
809 AliSimDigits *digrowTmp;
811 digrowTmp = (AliSimDigits*)fDigarr->GetRow(iSec,(mp1)->GetRow());
813 digrowTmp = (AliSimDigits*)fDigarr->LoadRow(iSec,(mp1)->GetRow());
816 digrowTmp->ExpandBuffer(); //decrunch
818 for(Int_t itb=(mp1)->GetBegin(); itb<((mp1)->GetEnd())+1; itb++){
819 Int_t adcTmp = digrowTmp->GetDigitUnchecked(itb,(mp1)->GetPad());
820 AliTPCvtpr *vtpr=new AliTPCvtpr(adcTmp,itb,(mp1)->GetPad(),(mp1)->GetRow(),(mp1)->GetX(),(mp1)->GetY(),(mp1)->GetT());
821 clusterKr.AddDigitToCluster(vtpr);
823 clusterKr.SetCenter();//set centr of the cluster
825 for(Int_t it2 = it1+1; it2 < entriesArr; ++it2 ) {
826 AliPadMax *mp2=(AliPadMax *)maximaInSector->UncheckedAt(it2);
828 if (TMath::Abs(clusterKr.GetCenterX() - (mp2)->GetX())>fMaxPadRangeCm) continue;
829 if (TMath::Abs(clusterKr.GetCenterY() - (mp2)->GetY()) > fMaxRowRangeCm) continue;
830 if (TMath::Abs(clusterKr.GetCenterT() - (mp2)->GetT()) >fMaxTimeRange) continue;
833 clusterValue+=(mp2)->GetSum();
836 nUsedRows.push_back((mp2)->GetRow());
838 AliSimDigits *digrowTmp1;
840 digrowTmp1 = (AliSimDigits*)fDigarr->GetRow(iSec,(mp2)->GetRow());
842 digrowTmp1 = (AliSimDigits*)fDigarr->LoadRow(iSec,(mp2)->GetRow());
844 digrowTmp1->ExpandBuffer(); //decrunch
846 for(Int_t itb=(mp2)->GetBegin(); itb<(mp2)->GetEnd()+1; itb++){
847 Int_t adcTmp = digrowTmp1->GetDigitUnchecked(itb,(mp2)->GetPad());
848 AliTPCvtpr *vtpr=new AliTPCvtpr(adcTmp,itb,(mp2)->GetPad(),(mp2)->GetRow(),(mp2)->GetX(),(mp2)->GetY(),(mp2)->GetT());
849 clusterKr.AddDigitToCluster(vtpr);
852 clusterKr.SetCenter();//set center of the cluster
854 //which one is bigger
855 if( (mp2)->GetAdc() > maxDig ){
856 maxDig =(mp2)->GetAdc() ;
857 maxSumAdc =(mp2)->GetSum() ;
858 maxTimeBin =(mp2)->GetTime();
859 maxPad =(mp2)->GetPad() ;
860 maxRow =(mp2)->GetRow() ;
861 maxX =(mp2)->GetX() ;
862 maxY =(mp2)->GetY() ;
863 maxT =(mp2)->GetT() ;
864 } else if ( (mp2)->GetAdc() == maxDig ){
865 if( (mp2)->GetSum() > maxSumAdc){
866 maxDig =(mp2)->GetAdc() ;
867 maxSumAdc =(mp2)->GetSum() ;
868 maxTimeBin =(mp2)->GetTime();
869 maxPad =(mp2)->GetPad() ;
870 maxRow =(mp2)->GetRow() ;
871 maxX =(mp2)->GetX() ;
872 maxY =(mp2)->GetY() ;
873 maxT =(mp2)->GetT() ;
876 delete maximaInSector->RemoveAt(it2);
879 delete maximaInSector->RemoveAt(it1);
881 //through out clusters on the edge and noise
882 //if(clusterValue/clusterKr.fCluster.size()<fValueToSize)continue;
883 if(clusterValue/(clusterKr.GetSize())<fValueToSize)continue;
885 clusterKr.SetADCcluster(clusterValue);
886 clusterKr.SetNPads(nUsedPads);
887 clusterKr.SetMax(AliTPCvtpr(maxDig,maxTimeBin,maxPad,maxRow,maxX,maxY,maxT));
888 clusterKr.SetSec(iSec);
893 clusterKr.SetNRows(nUsedRows.size());
894 clusterKr.SetCenter();
899 //save each cluster into file
905 //end of save each cluster into file adc.root
911 ////____________________________________________________________________________
914 void AliTPCclustererKr::GetXY(Int_t sec,Int_t row,Int_t pad,Double_t& xGlob,Double_t& yGlob){
916 //gives global XY coordinate of the pad
919 Double_t yLocal = fParam->GetPadRowRadii(sec,row);//radius of row in sector in cm
921 Int_t padmax = fParam->GetNPads(sec,row);//number of pads in a given row
923 if(sec<fParam->GetNInnerSector())padXSize=0.4;
925 Double_t xLocal=(pad+0.5-padmax/2.)*padXSize;//x-value of the center of pad
928 fParam->AdjustCosSin((Int_t)sec,cos,sin);//return sinus and cosinus of the sector
930 Double_t xGlob1 = xLocal * cos + yLocal * sin;
931 Double_t yGlob1 = -xLocal * sin + yLocal * cos;
937 xGlob = xGlob1 * TMath::Cos(rot) + yGlob1 * TMath::Sin(rot);
938 yGlob = -xGlob1 * TMath::Sin(rot) + yGlob1 * TMath::Cos(rot);
941 if(sec<18||(sec>=36&&sec<54)) xGlob =-1*xGlob;