Moved around the functions of the AliHLTTPCClusterFinder so the ones belonging to the ClusterFinderDecoder is at the top of the files, and the ClusterFinderPacked functions on the bottom.
Also changed from fMaxQ to fQMax in the AliHLTSpacePointData.h so that we only have one name convention for max charge of a cluster. This led to changes in KryptonClusterfinder, *Cluster*, Noise map, TrackHistoComponent.
In AliHLTAltroEncoder; added the functionality to revert 40 bit words.
#pragma link C++ class AliHLTTPCEventStatisticsProducerComponent+;
#pragma link C++ class AliHLTTPCRunStatistics+;
#pragma link C++ class AliHLTTPCRunStatisticsProducerComponent+;
+#pragma link C++ class AliHLTTPCHWCFDataReverterComponent+;
+
#endif
}
return fOffset;
}
+
+void AliHLTAltroEncoder::Revert40BitWords(Int_t CDHSize, Int_t trailerSize)
+{
+ // see headerfile for class documentation
+
+ //initialize to last 40 bit word in the payload
+ AliHLTUInt8_t * pointerToHighEnd40BitWord = fpBuffer + fOffset - trailerSize -5;
+
+ //initialize to first 40 bit word in the payload
+ AliHLTUInt8_t * pointerToLowEnd40BitWord = fpBuffer+CDHSize;
+
+ assert(((pointerToHighEnd40BitWord - pointerToLowEnd40BitWord)+5)%5 == 0 );//check that it is a whole number of 40 bit words
+
+ Int_t total40BitWords = ((pointerToHighEnd40BitWord - pointerToLowEnd40BitWord) + 5)/(5);
+
+ AliHLTUInt8_t tmp8BitWords[5] = {0,0,0,0,0};
+
+ for(Int_t numberOf40BitWordMoves = 0 ; numberOf40BitWordMoves < total40BitWords/2 ; numberOf40BitWordMoves++){
+ memcpy(&tmp8BitWords, pointerToLowEnd40BitWord, 5); // copy 40 bit word in to temporary from low side
+ memcpy(pointerToLowEnd40BitWord, pointerToHighEnd40BitWord, 5); // copy the high side 40 bit word to the low side
+ memcpy(pointerToHighEnd40BitWord, &tmp8BitWords, 5); // copy from the temporary to the high side 40 bits
+ pointerToLowEnd40BitWord += 5;
+ pointerToHighEnd40BitWord -= 5;
+ }
+
+}
int GetOffset(){return fOffset;}
+ /**
+ * Revert the 40 bit altro data
+ */
+ void Revert40BitWords(Int_t CDHSize, Int_t trailerSize);
+
enum {
kUnknownOrder = 0,
kAscending,
#include "AliHLTTPCCalibTracksComponent.h"
#include "AliHLTTPCTrackHistoComponent.h"
#include "AliHLTTPCTrackDumpComponent.h"
-
+#include "AliHLTTPCHWCFDataReverterComponent.h"
/** ROOT macro for the implementation of ROOT specific class methods */
ClassImp(AliHLTTPCAgent)
pHandler->AddComponent(new AliHLTTPCCalibTracksComponent);
pHandler->AddComponent(new AliHLTTPCTrackHistoComponent);
pHandler->AddComponent(new AliHLTTPCTrackDumpComponent);
-
+ pHandler->AddComponent(new AliHLTTPCHWCFDataReverterComponent);
+
return 0;
}
AliHLTTPCTransform::LocHLT2Raw(xyz,(Int_t)(clusters[i].fID/10),(Int_t)(clusters[i].fID%10));
dump << "[R,P,T]: [" << xyz[0]<<" , "<<xyz[1]<<" , "<<xyz[2] <<"]"<< endl;
dump << "Total Charge: " << clusters[i].fCharge << endl;
- dump << "Q Max: " << clusters[i].fMaxQ << endl;
+ dump << "Q Max: " << clusters[i].fQMax << endl;
spacePointCounter++;
}
//constructor
}
-AliHLTTPCClusterFinder::~AliHLTTPCClusterFinder()
-{
+AliHLTTPCClusterFinder::~AliHLTTPCClusterFinder(){
+ // see header file for class documentation
+
//destructor
if(fVectorInitialized){
DeInitializePadArray();
fNumberOfPadsInRow=NULL;
}
}
-
-void AliHLTTPCClusterFinder::InitSlice(Int_t slice,Int_t patch,Int_t firstrow, Int_t lastrow,Int_t nmaxpoints)
-{
+
+void AliHLTTPCClusterFinder::InitSlice(Int_t slice,Int_t patch,Int_t nmaxpoints){
+ // see header file for class documentation
+
//init slice
fNClusters = 0;
fMaxNClusters = nmaxpoints;
fCurrentSlice = slice;
fCurrentPatch = patch;
- fFirstRow = firstrow;
- fLastRow = lastrow;
+ fFirstRow=AliHLTTPCTransform::GetFirstRow(patch);
+ fLastRow=AliHLTTPCTransform::GetLastRow(patch);
}
void AliHLTTPCClusterFinder::InitializePadArray(){
fVectorInitialized=kTRUE;
}
-Int_t AliHLTTPCClusterFinder::DeInitializePadArray()
-{
+Int_t AliHLTTPCClusterFinder::DeInitializePadArray(){
// see header file for class documentation
+
for(UInt_t i=0;i<fNumberOfRows;i++){
for(UInt_t j=0;j<=fNumberOfPadsInRow[i];j++){
delete fRowPadVector[i][j];
}
-void AliHLTTPCClusterFinder::InitSlice(Int_t slice,Int_t patch,Int_t nmaxpoints)
-{
- //init slice
- fNClusters = 0;
- fMaxNClusters = nmaxpoints;
- fCurrentSlice = slice;
- fCurrentPatch = patch;
- fFirstRow=AliHLTTPCTransform::GetFirstRow(patch);
- fLastRow=AliHLTTPCTransform::GetLastRow(patch);
-}
-void AliHLTTPCClusterFinder::SetOutputArray(AliHLTTPCSpacePointData *pt)
-{
+void AliHLTTPCClusterFinder::SetOutputArray(AliHLTTPCSpacePointData *pt){
+ // see header file for class documentation
//set pointer to output
fSpacePointData = pt;
}
-void AliHLTTPCClusterFinder::Read(void* ptr,unsigned long size){
+
+void AliHLTTPCClusterFinder::ReadDataUnsorted(void* ptr,unsigned long size){
+ // see header file for class documentation
//set input pointer
fPtr = (UChar_t*)ptr;
fSize = size;
-}
-
-void AliHLTTPCClusterFinder::ProcessDigits()
-{
- int iResult=0;
- bool readValue = true;
- Int_t newRow = 0;
- Int_t rowOffset = 0;
- UShort_t time=0,newTime=0;
- UInt_t pad=0,newPad=0;
- AliHLTTPCSignal_t charge=0;
-
- fNClusters = 0;
-
- // initialize block for reading packed data
- iResult=fDigitReader->InitBlock(fPtr,fSize,fFirstRow,fLastRow,fCurrentPatch,fCurrentSlice);
- if (iResult<0) return;
-
- readValue = fDigitReader->Next();
-
- // Matthias 08.11.2006 the following return would cause termination without writing the
- // ClusterData and thus would block the component. I just want to have the commented line
- // here for information
- //if (!readValue)return;
-
- pad = fDigitReader->GetPad();
- time = fDigitReader->GetTime();
- fCurrentRow = fDigitReader->GetRow();
-
- if ( fCurrentPatch >= 2 ) // Outer sector, patches 2, 3, 4, 5
- rowOffset = AliHLTTPCTransform::GetFirstRow( 2 );
-
- fCurrentRow += rowOffset;
-
- UInt_t lastpad = 123456789;
- const UInt_t kPadArraySize=5000;
- const UInt_t kClusterListSize=10000;
- AliClusterData *pad1[kPadArraySize]; //2 lists for internal memory=2pads
- AliClusterData *pad2[kPadArraySize]; //2 lists for internal memory=2pads
- AliClusterData clusterlist[kClusterListSize]; //Clusterlist
- AliClusterData **currentPt; //List of pointers to the current pad
- AliClusterData **previousPt; //List of pointers to the previous pad
- currentPt = pad2;
- previousPt = pad1;
- UInt_t nprevious=0,ncurrent=0,ntotal=0;
-
- /* quick implementation of baseline calculation and zero suppression
- open a pad object for each pad and delete it after processing.
- later a list of pad objects with base line history can be used
- The whole thing only works if we really get unprocessed raw data, if
- the data is already zero suppressed, there might be gaps in the time
- bins.
- */
- Int_t gatingGridOffset=50;
- if(fFirstTimeBin>0){
- gatingGridOffset=fFirstTimeBin;
+ if(!fVectorInitialized){
+ InitializePadArray();
}
- AliHLTTPCPad baseline(gatingGridOffset, AliHLTTPCTransform::GetNTimeBins());
- // just to make later conversion to a list of objects easier
- AliHLTTPCPad* pCurrentPad=NULL;
- /*
- if (fSignalThreshold>=0) {
- pCurrentPad=&baseline;
- baseline.SetThreshold(fSignalThreshold);
+
+ if (fDigitReader->InitBlock(fPtr,fSize,fFirstRow,fLastRow,fCurrentPatch,fCurrentSlice)<0) {
+ HLTError("failed setting up digit reader (InitBlock)");
+ return;
}
- */
- while ( readValue!=0 && iResult>=0){ // Reads through all digits in block
- iResult=0;
+
+ while(fDigitReader->NextChannel()){
+ UInt_t row=fDigitReader->GetRow();
+ UInt_t pad=fDigitReader->GetPad();
- if(pad != lastpad){
- //This is a new pad
-
- //Switch the lists:
- if(currentPt == pad2){
- currentPt = pad1;
- previousPt = pad2;
- }
- else {
- currentPt = pad2;
- previousPt = pad1;
- }
- nprevious = ncurrent;
- ncurrent = 0;
- if(pad != lastpad+1){
- //this happens if there is a pad with no signal.
- nprevious = ncurrent = 0;
- }
- lastpad = pad;
+ if(row>=fRowPadVector.size()){
+ HLTError("Row number is to large: %d, max is %d",row,fRowPadVector.size()-1);
+ continue;
}
-
- Bool_t newcluster = kTRUE;
- UInt_t seqcharge=0,seqaverage=0,seqerror=0;
- AliHLTTPCSignal_t lastcharge=0;
- UInt_t bLastWasFalling=0;
- Int_t newbin=-1;
-
-
- if(fDeconvTime){
- redo: //This is a goto.
-
- if(newbin > -1){
- //bin = newbin;
- newbin = -1;
- }
-
- lastcharge=0;
- bLastWasFalling = 0;
+ if(pad>=fRowPadVector[row].size()){
+ HLTError("Pad number is to large: %d, max is %d",pad,fRowPadVector[row].size());
+ continue;
}
- while(iResult>=0){ //Loop over time bins of current pad
- // read all the values for one pad at once to calculate the base line
- if (pCurrentPad) {
- if (!pCurrentPad->IsStarted()) {
- //HLTDebug("reading data for pad %d, padrow %d", fDigitReader->GetPad(), fDigitReader->GetRow()+rowOffset);
- pCurrentPad->SetID(fDigitReader->GetRow()+rowOffset,fDigitReader->GetPad());
- if ((pCurrentPad->StartEvent())>=0) {
- do {
- if ((fDigitReader->GetRow()+rowOffset)!=pCurrentPad->GetRowNumber()) break;
- if (fDigitReader->GetPad()!=pCurrentPad->GetPadNumber()) break;
- pCurrentPad->SetRawData(fDigitReader->GetTime(), fDigitReader->GetSignal());
- //HLTDebug("set raw data to pad: bin %d charge %d", fDigitReader->GetTime(), fDigitReader->GetSignal());
- } while ((readValue = fDigitReader->Next())!=0);
+ while(fDigitReader->NextBunch()){
+ if(fDigitReader->GetBunchSize()>1){//to remove single timebin values, this will have to change at some point
+ UInt_t time = fDigitReader->GetTime();
+ if((Int_t)time>=fFirstTimeBin && (Int_t)time+fDigitReader->GetBunchSize()<=fLastTimeBin){
+ const UInt_t *bunchData= fDigitReader->GetSignals();
+ AliHLTTPCClusters candidate;
+ for(Int_t i=0;i<fDigitReader->GetBunchSize();i++){
+ candidate.fTotalCharge+=bunchData[i];
+ candidate.fTime += time*bunchData[i];
+ candidate.fTime2 += time*time*bunchData[i];
+ if(bunchData[i]>candidate.fQMax){
+ candidate.fQMax=bunchData[i];
+ }
+ time++;
}
- pCurrentPad->CalculateBaseLine(AliHLTTPCTransform::GetNTimeBins()/2);
- if (pCurrentPad->Next(kTRUE/*do zero suppression*/)==0) {
- //HLTDebug("no data available after zero suppression");
- pCurrentPad->StopEvent();
- pCurrentPad->ResetHistory();
- break;
+ if(candidate.fTotalCharge>0){
+ candidate.fMean=candidate.fTime/candidate.fTotalCharge;
+ candidate.fPad=candidate.fTotalCharge*pad;
+ candidate.fPad2=candidate.fPad*pad;
+ candidate.fLastMergedPad=pad;
+ candidate.fRowNumber=row+fDigitReader->GetRowOffset();
}
- time=pCurrentPad->GetCurrentPosition();
- if (time>pCurrentPad->GetSize()) {
- HLTError("invalid time bin for pad");
- break;
+ if(fRowPadVector[row][pad] != NULL){
+ fRowPadVector[row][pad]->AddClusterCandidate(candidate);
}
}
}
- if (pCurrentPad) {
- Float_t occupancy=pCurrentPad->GetOccupancy();
- //HLTDebug("pad %d occupancy level: %f", pCurrentPad->GetPadNumber(), occupancy);
- if ( occupancy < fOccupancyLimit ) {
- charge = pCurrentPad->GetCorrectedData();
- } else {
- charge = 0;
- //HLTDebug("ignoring pad %d with occupancy level %f", pCurrentPad->GetPadNumber(), occupancy);
- }
- } else {
- charge = fDigitReader->GetSignal();
- }
- //HLTDebug("get next charge value: position %d charge %d", time, charge);
+ }
+ }
+}
+void AliHLTTPCClusterFinder::ReadDataUnsortedDeconvoluteTime(void* ptr,unsigned long size){
+ // see header file for class documentation
- // CHARGE DEBUG
- if (fDigitReader->GetRow() == 90){
-///// LOG(AliHLTTPCLog::kFatal,"AliHLTTPCClusterFinder::Row","row90") << "PAD=" << fDigitReader->GetPad() << " TIME=" << fDigitReader->GetTime()
- // << " SIGNAL=" << fDigitReader->GetSignal() << ENDLOG;
+ //set input pointer
+ fPtr = (UChar_t*)ptr;
+ fSize = size;
- }
+ if(!fVectorInitialized){
+ InitializePadArray();
+ }
- if(time >= AliHLTTPCTransform::GetNTimeBins()){
- HLTWarning("Pad %d: Timebin (%d) out of range (%d)", pad, time, AliHLTTPCTransform::GetNTimeBins());
- iResult=-ERANGE;
- }
+ if (fDigitReader->InitBlock(fPtr,fSize,fFirstRow,fLastRow,fCurrentPatch,fCurrentSlice)<0) {
+ HLTError("failed setting up digit reader (InitBlock)");
+ return;
+ }
+
+ while(fDigitReader->NextChannel()){
+ UInt_t row=fDigitReader->GetRow();
+ UInt_t pad=fDigitReader->GetPad();
+ while(fDigitReader->NextBunch()){
+ if(fDigitReader->GetBunchSize()>1){//to remove single timebin values, this will have to change at some point
+ UInt_t time = fDigitReader->GetTime();
+ if((Int_t)time>=fFirstTimeBin && (Int_t)time+fDigitReader->GetBunchSize()<=fLastTimeBin){
+ Int_t indexInBunchData=0;
+ Bool_t moreDataInBunch=kFALSE;
+ UInt_t prevSignal=0;
+ Bool_t signalFalling=kFALSE;
+ const UInt_t *bunchData= fDigitReader->GetSignals();
+ do{
+ AliHLTTPCClusters candidate;
+ for(Int_t i=indexInBunchData;i<fDigitReader->GetBunchSize();i++){
+ // Checks if one need to deconvolute the signals
+ if(bunchData[i]>prevSignal && signalFalling==kTRUE){
+ if(i<fDigitReader->GetBunchSize()-1){ // means there are more than one signal left in the bunch
+ moreDataInBunch=kTRUE;
+ prevSignal=0;
+ }
+ break;
+ }
+
+ // Checks if the signal is 0, then quit processing the data.
+ if(bunchData[i]==0 && i<fDigitReader->GetBunchSize()-1){//means we have 0 data fom the rcu, might happen depending on the configuration settings
+ moreDataInBunch=kTRUE;
+ prevSignal=0;
+ break;
+ }
- //Get the current ADC-value
+ if(prevSignal>bunchData[i]){//means the peak of the signal has been reached and deconvolution will happen if the signal rise again.
+ signalFalling=kTRUE;
+ }
+ candidate.fTotalCharge+=bunchData[i];
+ candidate.fTime += time*bunchData[i];
+ candidate.fTime2 += time*time*bunchData[i];
+ if(bunchData[i]>candidate.fQMax){
+ candidate.fQMax=bunchData[i];
+ }
+
+ prevSignal=bunchData[i];
+ time++;
+ indexInBunchData++;
+ }
+ if(candidate.fTotalCharge>0){
+ candidate.fMean=candidate.fTime/candidate.fTotalCharge;
+ candidate.fPad=candidate.fTotalCharge*pad;
+ candidate.fPad2=candidate.fPad*pad;
+ candidate.fLastMergedPad=pad;
+ candidate.fRowNumber=row+fDigitReader->GetRowOffset();
+ }
+ fRowPadVector[row][pad]->AddClusterCandidate(candidate);
+ if(indexInBunchData<fDigitReader->GetBunchSize()-1){
+ moreDataInBunch=kFALSE;
+ }
+ }while(moreDataInBunch);
+ }
+ }
+ }
+ }
+}
+
+Bool_t AliHLTTPCClusterFinder::ComparePads(AliHLTTPCPad *nextPad,AliHLTTPCClusters* cluster,Int_t nextPadToRead){
+ // see header file for class documentation
+
+ //Checking if we have a match on the next pad
+ for(UInt_t candidateNumber=0;candidateNumber<nextPad->fClusterCandidates.size();candidateNumber++){
+ AliHLTTPCClusters *candidate =&nextPad->fClusterCandidates[candidateNumber];
+ if(cluster->fMean-candidate->fMean==1 || candidate->fMean-cluster->fMean==1 || cluster->fMean-candidate->fMean==0){
+ if(fDeconvPad){
+ if(candidate->fTotalCharge<fTotalChargeOfPreviousClusterCandidate){//peak is reached
+ fChargeOfCandidatesFalling=kTRUE;
+ }
+ if(candidate->fTotalCharge>fTotalChargeOfPreviousClusterCandidate && fChargeOfCandidatesFalling==kTRUE){//we have deconvolution
+ return kFALSE;
+ }
+ }
+ cluster->fMean=candidate->fMean;
+ cluster->fTotalCharge+=candidate->fTotalCharge;
+ cluster->fTime += candidate->fTime;
+ cluster->fTime2 += candidate->fTime2;
+ cluster->fPad+=candidate->fPad;
+ cluster->fPad2+=candidate->fPad2;
+ cluster->fLastMergedPad=candidate->fPad;
+ if(candidate->fQMax>cluster->fQMax){
+ cluster->fQMax=candidate->fQMax;
+ }
+
+ if(fDoPadSelection){
+ UInt_t rowNo = nextPad->GetRowNumber();
+ UInt_t padNo = nextPad->GetPadNumber();
+ if(padNo-1>0){
+ fRowPadVector[rowNo][padNo-2]->fSelectedPad=kTRUE;
+ fRowPadVector[rowNo][padNo-2]->fHWAddress=(AliHLTUInt16_t)fDigitReader->GetAltroBlockHWaddr(rowNo,padNo-2);
+ }
+ fRowPadVector[rowNo][padNo-1]->fSelectedPad=kTRUE;// quick solution to set the first pad to selected
+ fRowPadVector[rowNo][padNo-1]->fHWAddress=(AliHLTUInt16_t)fDigitReader->GetAltroBlockHWaddr(rowNo,padNo-1);
+ fRowPadVector[rowNo][padNo]->fSelectedPad=kTRUE;
+ fRowPadVector[rowNo][padNo]->fHWAddress=(AliHLTUInt16_t)fDigitReader->GetAltroBlockHWaddr(rowNo,padNo);
+ }
+
+ //setting the matched pad to used
+ nextPad->fUsedClusterCandidates[candidateNumber]=1;
+ nextPadToRead++;
+ if(nextPadToRead<(Int_t)fNumberOfPadsInRow[fRowOfFirstCandidate]){
+ nextPad=fRowPadVector[fRowOfFirstCandidate][nextPadToRead];
+ ComparePads(nextPad,cluster,nextPadToRead);
+ }
+ else{
+ return kFALSE;
+ }
+ }
+ else{
+ return kFALSE;
+ }
+ }
+ return kFALSE;
+}
+
+Int_t AliHLTTPCClusterFinder::FillHWAddressList(AliHLTUInt16_t *hwaddlist, Int_t maxHWadd){
+ // see header file for class documentation
+
+ Int_t counter=0;
+ for(UInt_t row=0;row<fNumberOfRows;row++){
+ for(UInt_t pad=0;pad<fNumberOfPadsInRow[row]-1;pad++){
+ if(fRowPadVector[row][pad]->fSelectedPad){
+ if(counter<maxHWadd){
+ hwaddlist[counter]=(AliHLTUInt16_t)fRowPadVector[row][pad]->fHWAddress;
+ counter++;
+ }
+ else{
+ HLTWarning("To many hardwareaddresses, skip adding");
+ }
+
+ }
+ }
+ }
+ return counter;
+}
+
+void AliHLTTPCClusterFinder::FindClusters(){
+ // see header file for function documentation
+
+ AliHLTTPCClusters* tmpCandidate=NULL;
+ for(UInt_t row=0;row<fNumberOfRows;row++){
+ fRowOfFirstCandidate=row;
+ for(UInt_t pad=0;pad<fNumberOfPadsInRow[row];pad++){
+ AliHLTTPCPad *tmpPad=fRowPadVector[row][pad];
+ for(size_t candidate=0;candidate<tmpPad->fClusterCandidates.size();candidate++){
+ if(tmpPad->fUsedClusterCandidates[candidate]){
+ continue;
+ }
+ tmpCandidate=&tmpPad->fClusterCandidates[candidate];
+ UInt_t tmpTotalCharge=tmpCandidate->fTotalCharge;
+
+ ComparePads(fRowPadVector[row][pad+1],tmpCandidate,pad+1);
+ if(tmpCandidate->fTotalCharge>tmpTotalCharge){
+ //we have a cluster
+ fClusters.push_back(*tmpCandidate);
+ }
+ }
+ tmpPad->ClearCandidates();
+ }
+ fRowPadVector[row][fNumberOfPadsInRow[row]]->ClearCandidates();
+ }
+
+ HLTInfo("Found %d clusters.",fClusters.size());
+
+ //TODO: Change so it stores AliHLTTPCSpacePointData directly, instead of this copying
+
+ AliClusterData * clusterlist = new AliClusterData[fClusters.size()]; //Clusterlist
+ for(unsigned int i=0;i<fClusters.size();i++){
+ clusterlist[i].fTotalCharge = fClusters[i].fTotalCharge;
+ clusterlist[i].fPad = fClusters[i].fPad;
+ clusterlist[i].fPad2 = fClusters[i].fPad2;
+ clusterlist[i].fTime = fClusters[i].fTime;
+ clusterlist[i].fTime2 = fClusters[i].fTime2;
+ clusterlist[i].fMean = fClusters[i].fMean;
+ clusterlist[i].fFlags = fClusters[i].fFlags;
+ clusterlist[i].fChargeFalling = fClusters[i].fChargeFalling;
+ clusterlist[i].fLastCharge = fClusters[i].fLastCharge;
+ clusterlist[i].fLastMergedPad = fClusters[i].fLastMergedPad;
+ clusterlist[i].fRow = fClusters[i].fRowNumber;
+ clusterlist[i].fQMax = fClusters[i].fQMax;
+ }
+
+ WriteClusters(fClusters.size(),clusterlist);
+ delete [] clusterlist;
+ fClusters.clear();
+}
+
+
+//---------------------------------- Under this line the old sorted clusterfinder functions can be found --------------------------------
+
+
+void AliHLTTPCClusterFinder::PrintClusters(){
+ // see header file for class documentation
+
+ for(size_t i=0;i<fClusters.size();i++){
+ HLTInfo("Cluster number: %d",i);
+ HLTInfo("Row: %d \t Pad: %d",fClusters[i].fRowNumber,fClusters[i].fPad/fClusters[i].fTotalCharge);
+ HLTInfo("Total Charge: %d",fClusters[i].fTotalCharge);
+ HLTInfo("fPad: %d",fClusters[i].fPad);
+ HLTInfo("PadError: %d",fClusters[i].fPad2);
+ HLTInfo("TimeMean: %d",fClusters[i].fTime/fClusters[i].fTotalCharge);
+ HLTInfo("TimeError: %d",fClusters[i].fTime2);
+ HLTInfo("EndOfCluster:");
+ }
+}
+
+void AliHLTTPCClusterFinder::Read(void* ptr,unsigned long size){
+ //set input pointer
+ fPtr = (UChar_t*)ptr;
+ fSize = size;
+}
+
+void AliHLTTPCClusterFinder::ProcessDigits(){
+ // see header file for class documentation
+
+ int iResult=0;
+ bool readValue = true;
+ Int_t newRow = 0;
+ Int_t rowOffset = 0;
+ UShort_t time=0,newTime=0;
+ UInt_t pad=0,newPad=0;
+ AliHLTTPCSignal_t charge=0;
+
+ fNClusters = 0;
+
+ // initialize block for reading packed data
+ iResult=fDigitReader->InitBlock(fPtr,fSize,fFirstRow,fLastRow,fCurrentPatch,fCurrentSlice);
+ if (iResult<0) return;
+
+ readValue = fDigitReader->Next();
+
+ // Matthias 08.11.2006 the following return would cause termination without writing the
+ // ClusterData and thus would block the component. I just want to have the commented line
+ // here for information
+ //if (!readValue)return;
+
+ pad = fDigitReader->GetPad();
+ time = fDigitReader->GetTime();
+ fCurrentRow = fDigitReader->GetRow();
+
+ if ( fCurrentPatch >= 2 ) // Outer sector, patches 2, 3, 4, 5
+ rowOffset = AliHLTTPCTransform::GetFirstRow( 2 );
+
+ fCurrentRow += rowOffset;
+
+ UInt_t lastpad = 123456789;
+ const UInt_t kPadArraySize=5000;
+ const UInt_t kClusterListSize=10000;
+ AliClusterData *pad1[kPadArraySize]; //2 lists for internal memory=2pads
+ AliClusterData *pad2[kPadArraySize]; //2 lists for internal memory=2pads
+ AliClusterData clusterlist[kClusterListSize]; //Clusterlist
+
+ AliClusterData **currentPt; //List of pointers to the current pad
+ AliClusterData **previousPt; //List of pointers to the previous pad
+ currentPt = pad2;
+ previousPt = pad1;
+ UInt_t nprevious=0,ncurrent=0,ntotal=0;
+
+ /* quick implementation of baseline calculation and zero suppression
+ open a pad object for each pad and delete it after processing.
+ later a list of pad objects with base line history can be used
+ The whole thing only works if we really get unprocessed raw data, if
+ the data is already zero suppressed, there might be gaps in the time
+ bins.
+ */
+ Int_t gatingGridOffset=50;
+ if(fFirstTimeBin>0){
+ gatingGridOffset=fFirstTimeBin;
+ }
+ AliHLTTPCPad baseline(gatingGridOffset, AliHLTTPCTransform::GetNTimeBins());
+ // just to make later conversion to a list of objects easier
+ AliHLTTPCPad* pCurrentPad=NULL;
+ /*
+ if (fSignalThreshold>=0) {
+ pCurrentPad=&baseline;
+ baseline.SetThreshold(fSignalThreshold);
+ }
+ */
+ while ( readValue!=0 && iResult>=0){ // Reads through all digits in block
+ iResult=0;
+
+ if(pad != lastpad){
+ //This is a new pad
+
+ //Switch the lists:
+ if(currentPt == pad2){
+ currentPt = pad1;
+ previousPt = pad2;
+ }
+ else {
+ currentPt = pad2;
+ previousPt = pad1;
+ }
+ nprevious = ncurrent;
+ ncurrent = 0;
+ if(pad != lastpad+1){
+ //this happens if there is a pad with no signal.
+ nprevious = ncurrent = 0;
+ }
+ lastpad = pad;
+ }
+
+ Bool_t newcluster = kTRUE;
+ UInt_t seqcharge=0,seqaverage=0,seqerror=0;
+ AliHLTTPCSignal_t lastcharge=0;
+ UInt_t bLastWasFalling=0;
+ Int_t newbin=-1;
+
+
+ if(fDeconvTime){
+ redo: //This is a goto.
+
+ if(newbin > -1){
+ //bin = newbin;
+ newbin = -1;
+ }
+
+ lastcharge=0;
+ bLastWasFalling = 0;
+ }
+
+ while(iResult>=0){ //Loop over time bins of current pad
+ // read all the values for one pad at once to calculate the base line
+ if (pCurrentPad) {
+ if (!pCurrentPad->IsStarted()) {
+ //HLTDebug("reading data for pad %d, padrow %d", fDigitReader->GetPad(), fDigitReader->GetRow()+rowOffset);
+ pCurrentPad->SetID(fDigitReader->GetRow()+rowOffset,fDigitReader->GetPad());
+ if ((pCurrentPad->StartEvent())>=0) {
+ do {
+ if ((fDigitReader->GetRow()+rowOffset)!=pCurrentPad->GetRowNumber()) break;
+ if (fDigitReader->GetPad()!=pCurrentPad->GetPadNumber()) break;
+ pCurrentPad->SetRawData(fDigitReader->GetTime(), fDigitReader->GetSignal());
+ //HLTDebug("set raw data to pad: bin %d charge %d", fDigitReader->GetTime(), fDigitReader->GetSignal());
+ } while ((readValue = fDigitReader->Next())!=0);
+ }
+ pCurrentPad->CalculateBaseLine(AliHLTTPCTransform::GetNTimeBins()/2);
+ if (pCurrentPad->Next(kTRUE/*do zero suppression*/)==0) {
+ //HLTDebug("no data available after zero suppression");
+ pCurrentPad->StopEvent();
+ pCurrentPad->ResetHistory();
+ break;
+ }
+ time=pCurrentPad->GetCurrentPosition();
+ if (time>pCurrentPad->GetSize()) {
+ HLTError("invalid time bin for pad");
+ break;
+ }
+ }
+ }
+ if (pCurrentPad) {
+ Float_t occupancy=pCurrentPad->GetOccupancy();
+ //HLTDebug("pad %d occupancy level: %f", pCurrentPad->GetPadNumber(), occupancy);
+ if ( occupancy < fOccupancyLimit ) {
+ charge = pCurrentPad->GetCorrectedData();
+ } else {
+ charge = 0;
+ //HLTDebug("ignoring pad %d with occupancy level %f", pCurrentPad->GetPadNumber(), occupancy);
+ }
+ } else {
+ charge = fDigitReader->GetSignal();
+ }
+ //HLTDebug("get next charge value: position %d charge %d", time, charge);
+
+
+ // CHARGE DEBUG
+ if (fDigitReader->GetRow() == 90){
+///// LOG(AliHLTTPCLog::kFatal,"AliHLTTPCClusterFinder::Row","row90") << "PAD=" << fDigitReader->GetPad() << " TIME=" << fDigitReader->GetTime()
+ // << " SIGNAL=" << fDigitReader->GetSignal() << ENDLOG;
+
+ }
+
+ if(time >= AliHLTTPCTransform::GetNTimeBins()){
+ HLTWarning("Pad %d: Timebin (%d) out of range (%d)", pad, time, AliHLTTPCTransform::GetNTimeBins());
+ iResult=-ERANGE;
+ }
+
+
+ //Get the current ADC-value
if(fDeconvTime){
//Check if the last pixel in the sequence is smaller than this
} // ENDEND
-void AliHLTTPCClusterFinder::WriteClusters(Int_t nclusters,AliClusterData *list)
-{
+void AliHLTTPCClusterFinder::WriteClusters(Int_t nclusters,AliClusterData *list){
+ // see header file for class documentation
+
//write cluster to output pointer
Int_t thisrow=-1,thissector=-1;
UInt_t counter = fNClusters;
- if(fUnsorted){
- fCurrentRow=list[j].fRow;
- }
-
-
- if(fCalcerr) { //calc the errors, otherwice take the fixed error
- Int_t patch = AliHLTTPCTransform::GetPatch(fCurrentRow);
- UInt_t q2=list[j].fTotalCharge*list[j].fTotalCharge;
- // Float_t sy2=list[j].fPad2 * list[j].fTotalCharge - list[j].fPad * list[j].fPad;
- Float_t sy2=(Float_t)list[j].fPad2 * list[j].fTotalCharge - (Float_t)list[j].fPad * list[j].fPad;
- sy2/=q2;
- if(sy2 < 0) {
- LOG(AliHLTTPCLog::kError,"AliHLTTPCClusterFinder::WriteClusters","Cluster width")
- <<"SigmaY2 negative "<<sy2<<" on row "<<fCurrentRow<<" "<<fpad<<" "<<ftime<<ENDLOG;
- continue;
- } else {
- if(!fRawSP){
- fpad2 = (sy2 + 1./12)*AliHLTTPCTransform::GetPadPitchWidth(patch)*AliHLTTPCTransform::GetPadPitchWidth(patch);
- if(sy2 != 0){
- fpad2*=0.108; //constants are from offline studies
- if(patch<2)
- fpad2*=2.07;
- }
- } else fpad2=sy2; //take the width not the error
- }
- // Float_t sz2=list[j].fTime2*list[j].fTotalCharge - list[j].fTime*list[j].fTime;
- Float_t sz2=(Float_t)list[j].fTime2*list[j].fTotalCharge - (Float_t)list[j].fTime*list[j].fTime;
- sz2/=q2;
- if(sz2 < 0){
- LOG(AliHLTTPCLog::kError,"AliHLTTPCClusterFinder::WriteClusters","Cluster width")
- <<"SigmaZ2 negative "<<sz2<<" on row "<<fCurrentRow<<" "<<fpad<<" "<<ftime<<ENDLOG;
- continue;
- } else {
- if(!fRawSP){
- ftime2 = (sz2 + 1./12)*AliHLTTPCTransform::GetZWidth()*AliHLTTPCTransform::GetZWidth();
- if(sz2 != 0) {
- ftime2 *= 0.169; //constants are from offline studies
- if(patch<2)
- ftime2 *= 1.77;
- }
- } else ftime2=sz2; //take the width, not the error
- }
- }
- if(fStdout==kTRUE)
- HLTInfo("WriteCluster: padrow %d pad %d +- %d time +- %d charge %d",fCurrentRow, fpad, fpad2, ftime, ftime2, list[j].fTotalCharge);
-
- if(!fRawSP){
- AliHLTTPCTransform::Slice2Sector(fCurrentSlice,fCurrentRow,thissector,thisrow);
- AliHLTTPCTransform::Raw2Local(xyz,thissector,thisrow,fpad,ftime);
-
- if(xyz[0]==0) LOG(AliHLTTPCLog::kError,"AliHLTTPCClustFinder","Cluster Finder")
- <<AliHLTTPCLog::kDec<<"Zero cluster"<<ENDLOG;
- if(fNClusters >= fMaxNClusters)
- {
- LOG(AliHLTTPCLog::kError,"AliHLTTPCClustFinder::WriteClusters","Cluster Finder")
- <<AliHLTTPCLog::kDec<<"Too many clusters "<<fNClusters<<ENDLOG;
- return;
- }
-
- fSpacePointData[counter].fX = xyz[0];
- // fSpacePointData[counter].fY = xyz[1];
- if(fCurrentSlice<18){
- fSpacePointData[counter].fY = xyz[1];
- }
- else{
- fSpacePointData[counter].fY = -1*xyz[1];
- }
- fSpacePointData[counter].fZ = xyz[2];
-
- } else {
- fSpacePointData[counter].fX = fCurrentRow;
- fSpacePointData[counter].fY = fpad;
- fSpacePointData[counter].fZ = ftime;
- }
-
- fSpacePointData[counter].fCharge = list[j].fTotalCharge;
- fSpacePointData[counter].fPadRow = fCurrentRow;
- fSpacePointData[counter].fSigmaY2 = fpad2;
- fSpacePointData[counter].fSigmaZ2 = ftime2;
-
- fSpacePointData[counter].fMaxQ = list[j].fQMax;
-
- fSpacePointData[counter].fUsed = kFALSE; // only used / set in AliHLTTPCDisplay
- fSpacePointData[counter].fTrackN = -1; // only used / set in AliHLTTPCDisplay
-
- Int_t patch=fCurrentPatch;
- if(patch==-1) patch=0; //never store negative patch number
- fSpacePointData[counter].fID = counter
- +((fCurrentSlice&0x7f)<<25)+((patch&0x7)<<22);//Uli
-
-#ifdef do_mc
- Int_t trackID[3];
- GetTrackID((Int_t)rint(fpad),(Int_t)rint(ftime),trackID);
-
- fSpacePointData[counter].fTrackID[0] = trackID[0];
- fSpacePointData[counter].fTrackID[1] = trackID[1];
- fSpacePointData[counter].fTrackID[2] = trackID[2];
-
-#endif
-
- fNClusters++;
- counter++;
- }
-}
-
-// STILL TO FIX ----------------------------------------------------------------------------
-
-#ifdef do_mc
-void AliHLTTPCClusterFinder::GetTrackID(Int_t pad,Int_t time,Int_t *trackID)
-{
- //get mc id
- AliHLTTPCDigitRowData *rowPt = (AliHLTTPCDigitRowData*)fDigitRowData;
-
- trackID[0]=trackID[1]=trackID[2]=-2;
- for(Int_t i=fFirstRow; i<=fLastRow; i++){
- if(rowPt->fRow < (UInt_t)fCurrentRow){
- AliHLTTPCMemHandler::UpdateRowPointer(rowPt);
- continue;
- }
- AliHLTTPCDigitData *digPt = (AliHLTTPCDigitData*)rowPt->fDigitData;
- for(UInt_t j=0; j<rowPt->fNDigit; j++){
- Int_t cpad = digPt[j].fPad;
- Int_t ctime = digPt[j].fTime;
- if(cpad != pad) continue;
- if(ctime != time) continue;
-
- trackID[0] = digPt[j].fTrackID[0];
- trackID[1] = digPt[j].fTrackID[1];
- trackID[2] = digPt[j].fTrackID[2];
-
- break;
- }
- break;
- }
-}
-#endif
-
-//----------------------------------Methods for the new unsorted way of reading the data --------------------------------
-
-void AliHLTTPCClusterFinder::ReadDataUnsorted(void* ptr,unsigned long size)
-{
- //set input pointer
- fPtr = (UChar_t*)ptr;
- fSize = size;
-
- if(!fVectorInitialized){
- InitializePadArray();
- }
-
- if (fDigitReader->InitBlock(fPtr,fSize,fFirstRow,fLastRow,fCurrentPatch,fCurrentSlice)<0) {
- HLTError("failed setting up digit reader (InitBlock)");
- return;
- }
-
- while(fDigitReader->NextChannel()){
- UInt_t row=fDigitReader->GetRow();
- UInt_t pad=fDigitReader->GetPad();
-
- if(row>=fRowPadVector.size()){
- HLTError("Row number is to large: %d, max is %d",row,fRowPadVector.size()-1);
- continue;
- }
- if(pad>=fRowPadVector[row].size()){
- HLTError("Pad number is to large: %d, max is %d",pad,fRowPadVector[row].size());
- continue;
- }
-
- while(fDigitReader->NextBunch()){
- if(fDigitReader->GetBunchSize()>1){//to remove single timebin values, this will have to change at some point
- UInt_t time = fDigitReader->GetTime();
- if((Int_t)time>=fFirstTimeBin && (Int_t)time+fDigitReader->GetBunchSize()<=fLastTimeBin){
- const UInt_t *bunchData= fDigitReader->GetSignals();
- AliHLTTPCClusters candidate;
- for(Int_t i=0;i<fDigitReader->GetBunchSize();i++){
- candidate.fTotalCharge+=bunchData[i];
- candidate.fTime += time*bunchData[i];
- candidate.fTime2 += time*time*bunchData[i];
- if(bunchData[i]>candidate.fQMax){
- candidate.fQMax=bunchData[i];
- }
- time++;
- }
- if(candidate.fTotalCharge>0){
- candidate.fMean=candidate.fTime/candidate.fTotalCharge;
- candidate.fPad=candidate.fTotalCharge*pad;
- candidate.fPad2=candidate.fPad*pad;
- candidate.fLastMergedPad=pad;
- candidate.fRowNumber=row+fDigitReader->GetRowOffset();
- }
- if(fRowPadVector[row][pad] != NULL){
- fRowPadVector[row][pad]->AddClusterCandidate(candidate);
- }
- }
- }
- }
- }
-}
-
-void AliHLTTPCClusterFinder::ReadDataUnsortedDeconvoluteTime(void* ptr,unsigned long size)
-{
- //set input pointer
- fPtr = (UChar_t*)ptr;
- fSize = size;
-
- if(!fVectorInitialized){
- InitializePadArray();
- }
-
- if (fDigitReader->InitBlock(fPtr,fSize,fFirstRow,fLastRow,fCurrentPatch,fCurrentSlice)<0) {
- HLTError("failed setting up digit reader (InitBlock)");
- return;
- }
-
- while(fDigitReader->NextChannel()){
- UInt_t row=fDigitReader->GetRow();
- UInt_t pad=fDigitReader->GetPad();
-
- while(fDigitReader->NextBunch()){
- if(fDigitReader->GetBunchSize()>1){//to remove single timebin values, this will have to change at some point
- UInt_t time = fDigitReader->GetTime();
- if((Int_t)time>=fFirstTimeBin && (Int_t)time+fDigitReader->GetBunchSize()<=fLastTimeBin){
- Int_t indexInBunchData=0;
- Bool_t moreDataInBunch=kFALSE;
- UInt_t prevSignal=0;
- Bool_t signalFalling=kFALSE;
- const UInt_t *bunchData= fDigitReader->GetSignals();
- do{
- AliHLTTPCClusters candidate;
- for(Int_t i=indexInBunchData;i<fDigitReader->GetBunchSize();i++){
- // Checks if one need to deconvolute the signals
- if(bunchData[i]>prevSignal && signalFalling==kTRUE){
- if(i<fDigitReader->GetBunchSize()-1){ // means there are more than one signal left in the bunch
- moreDataInBunch=kTRUE;
- prevSignal=0;
- }
- break;
- }
-
- // Checks if the signal is 0, then quit processing the data.
- if(bunchData[i]==0 && i<fDigitReader->GetBunchSize()-1){//means we have 0 data fom the rcu, might happen depending on the configuration settings
- moreDataInBunch=kTRUE;
- prevSignal=0;
- break;
- }
-
- if(prevSignal>bunchData[i]){//means the peak of the signal has been reached and deconvolution will happen if the signal rise again.
- signalFalling=kTRUE;
- }
- candidate.fTotalCharge+=bunchData[i];
- candidate.fTime += time*bunchData[i];
- candidate.fTime2 += time*time*bunchData[i];
- if(bunchData[i]>candidate.fQMax){
- candidate.fQMax=bunchData[i];
- }
-
- prevSignal=bunchData[i];
- time++;
- indexInBunchData++;
- }
- if(candidate.fTotalCharge>0){
- candidate.fMean=candidate.fTime/candidate.fTotalCharge;
- candidate.fPad=candidate.fTotalCharge*pad;
- candidate.fPad2=candidate.fPad*pad;
- candidate.fLastMergedPad=pad;
- candidate.fRowNumber=row+fDigitReader->GetRowOffset();
- }
- fRowPadVector[row][pad]->AddClusterCandidate(candidate);
- if(indexInBunchData<fDigitReader->GetBunchSize()-1){
- moreDataInBunch=kFALSE;
- }
- }while(moreDataInBunch);
- }
+ if(fUnsorted){
+ fCurrentRow=list[j].fRow;
}
- }
- }
-}
-Bool_t AliHLTTPCClusterFinder::ComparePads(AliHLTTPCPad *nextPad,AliHLTTPCClusters* cluster,Int_t nextPadToRead){
- //Checking if we have a match on the next pad
- for(UInt_t candidateNumber=0;candidateNumber<nextPad->fClusterCandidates.size();candidateNumber++){
- AliHLTTPCClusters *candidate =&nextPad->fClusterCandidates[candidateNumber];
- if(cluster->fMean-candidate->fMean==1 || candidate->fMean-cluster->fMean==1 || cluster->fMean-candidate->fMean==0){
- if(fDeconvPad){
- if(candidate->fTotalCharge<fTotalChargeOfPreviousClusterCandidate){//peak is reached
- fChargeOfCandidatesFalling=kTRUE;
+
+ if(fCalcerr) { //calc the errors, otherwice take the fixed error
+ Int_t patch = AliHLTTPCTransform::GetPatch(fCurrentRow);
+ UInt_t q2=list[j].fTotalCharge*list[j].fTotalCharge;
+ // Float_t sy2=list[j].fPad2 * list[j].fTotalCharge - list[j].fPad * list[j].fPad;
+ Float_t sy2=(Float_t)list[j].fPad2 * list[j].fTotalCharge - (Float_t)list[j].fPad * list[j].fPad;
+ sy2/=q2;
+ if(sy2 < 0) {
+ LOG(AliHLTTPCLog::kError,"AliHLTTPCClusterFinder::WriteClusters","Cluster width")
+ <<"SigmaY2 negative "<<sy2<<" on row "<<fCurrentRow<<" "<<fpad<<" "<<ftime<<ENDLOG;
+ continue;
+ } else {
+ if(!fRawSP){
+ fpad2 = (sy2 + 1./12)*AliHLTTPCTransform::GetPadPitchWidth(patch)*AliHLTTPCTransform::GetPadPitchWidth(patch);
+ if(sy2 != 0){
+ fpad2*=0.108; //constants are from offline studies
+ if(patch<2)
+ fpad2*=2.07;
+ }
+ } else fpad2=sy2; //take the width not the error
}
- if(candidate->fTotalCharge>fTotalChargeOfPreviousClusterCandidate && fChargeOfCandidatesFalling==kTRUE){//we have deconvolution
- return kFALSE;
+ // Float_t sz2=list[j].fTime2*list[j].fTotalCharge - list[j].fTime*list[j].fTime;
+ Float_t sz2=(Float_t)list[j].fTime2*list[j].fTotalCharge - (Float_t)list[j].fTime*list[j].fTime;
+ sz2/=q2;
+ if(sz2 < 0){
+ LOG(AliHLTTPCLog::kError,"AliHLTTPCClusterFinder::WriteClusters","Cluster width")
+ <<"SigmaZ2 negative "<<sz2<<" on row "<<fCurrentRow<<" "<<fpad<<" "<<ftime<<ENDLOG;
+ continue;
+ } else {
+ if(!fRawSP){
+ ftime2 = (sz2 + 1./12)*AliHLTTPCTransform::GetZWidth()*AliHLTTPCTransform::GetZWidth();
+ if(sz2 != 0) {
+ ftime2 *= 0.169; //constants are from offline studies
+ if(patch<2)
+ ftime2 *= 1.77;
+ }
+ } else ftime2=sz2; //take the width, not the error
}
}
- cluster->fMean=candidate->fMean;
- cluster->fTotalCharge+=candidate->fTotalCharge;
- cluster->fTime += candidate->fTime;
- cluster->fTime2 += candidate->fTime2;
- cluster->fPad+=candidate->fPad;
- cluster->fPad2+=candidate->fPad2;
- cluster->fLastMergedPad=candidate->fPad;
- if(candidate->fQMax>cluster->fQMax){
- cluster->fQMax=candidate->fQMax;
- }
+ if(fStdout==kTRUE)
+ HLTInfo("WriteCluster: padrow %d pad %d +- %d time +- %d charge %d",fCurrentRow, fpad, fpad2, ftime, ftime2, list[j].fTotalCharge);
- if(fDoPadSelection){
- UInt_t rowNo = nextPad->GetRowNumber();
- UInt_t padNo = nextPad->GetPadNumber();
- if(padNo-1>0){
- fRowPadVector[rowNo][padNo-2]->fSelectedPad=kTRUE;
- fRowPadVector[rowNo][padNo-2]->fHWAddress=(AliHLTUInt16_t)fDigitReader->GetAltroBlockHWaddr(rowNo,padNo-2);
+ if(!fRawSP){
+ AliHLTTPCTransform::Slice2Sector(fCurrentSlice,fCurrentRow,thissector,thisrow);
+ AliHLTTPCTransform::Raw2Local(xyz,thissector,thisrow,fpad,ftime);
+
+ if(xyz[0]==0) LOG(AliHLTTPCLog::kError,"AliHLTTPCClustFinder","Cluster Finder")
+ <<AliHLTTPCLog::kDec<<"Zero cluster"<<ENDLOG;
+ if(fNClusters >= fMaxNClusters)
+ {
+ LOG(AliHLTTPCLog::kError,"AliHLTTPCClustFinder::WriteClusters","Cluster Finder")
+ <<AliHLTTPCLog::kDec<<"Too many clusters "<<fNClusters<<ENDLOG;
+ return;
+ }
+
+ fSpacePointData[counter].fX = xyz[0];
+ // fSpacePointData[counter].fY = xyz[1];
+ if(fCurrentSlice<18){
+ fSpacePointData[counter].fY = xyz[1];
}
- fRowPadVector[rowNo][padNo-1]->fSelectedPad=kTRUE;// quick solution to set the first pad to selected
- fRowPadVector[rowNo][padNo-1]->fHWAddress=(AliHLTUInt16_t)fDigitReader->GetAltroBlockHWaddr(rowNo,padNo-1);
- fRowPadVector[rowNo][padNo]->fSelectedPad=kTRUE;
- fRowPadVector[rowNo][padNo]->fHWAddress=(AliHLTUInt16_t)fDigitReader->GetAltroBlockHWaddr(rowNo,padNo);
- }
+ else{
+ fSpacePointData[counter].fY = -1*xyz[1];
+ }
+ fSpacePointData[counter].fZ = xyz[2];
- //setting the matched pad to used
- nextPad->fUsedClusterCandidates[candidateNumber]=1;
- nextPadToRead++;
- if(nextPadToRead<(Int_t)fNumberOfPadsInRow[fRowOfFirstCandidate]){
- nextPad=fRowPadVector[fRowOfFirstCandidate][nextPadToRead];
- ComparePads(nextPad,cluster,nextPadToRead);
- }
- else{
- return kFALSE;
+ } else {
+ fSpacePointData[counter].fX = fCurrentRow;
+ fSpacePointData[counter].fY = fpad;
+ fSpacePointData[counter].fZ = ftime;
}
- }
- else{
- return kFALSE;
- }
- }
- return kFALSE;
-}
+
+ fSpacePointData[counter].fCharge = list[j].fTotalCharge;
+ fSpacePointData[counter].fPadRow = fCurrentRow;
+ fSpacePointData[counter].fSigmaY2 = fpad2;
+ fSpacePointData[counter].fSigmaZ2 = ftime2;
-Int_t AliHLTTPCClusterFinder::FillHWAddressList(AliHLTUInt16_t *hwaddlist, Int_t maxHWadd){
- Int_t counter=0;
- for(UInt_t row=0;row<fNumberOfRows;row++){
- for(UInt_t pad=0;pad<fNumberOfPadsInRow[row]-1;pad++){
- if(fRowPadVector[row][pad]->fSelectedPad){
- if(counter<maxHWadd){
- hwaddlist[counter]=(AliHLTUInt16_t)fRowPadVector[row][pad]->fHWAddress;
- counter++;
- }
- else{
- HLTWarning("To many hardwareaddresses, skip adding");
- }
-
- }
- }
- }
- return counter;
-}
+ fSpacePointData[counter].fQMax = list[j].fQMax;
-void AliHLTTPCClusterFinder::FindClusters()
-{
- // see header file for function documentation
+ fSpacePointData[counter].fUsed = kFALSE; // only used / set in AliHLTTPCDisplay
+ fSpacePointData[counter].fTrackN = -1; // only used / set in AliHLTTPCDisplay
- AliHLTTPCClusters* tmpCandidate=NULL;
- for(UInt_t row=0;row<fNumberOfRows;row++){
- fRowOfFirstCandidate=row;
- for(UInt_t pad=0;pad<fNumberOfPadsInRow[row];pad++){
- AliHLTTPCPad *tmpPad=fRowPadVector[row][pad];
- for(size_t candidate=0;candidate<tmpPad->fClusterCandidates.size();candidate++){
- if(tmpPad->fUsedClusterCandidates[candidate]){
- continue;
- }
- tmpCandidate=&tmpPad->fClusterCandidates[candidate];
- UInt_t tmpTotalCharge=tmpCandidate->fTotalCharge;
+ Int_t patch=fCurrentPatch;
+ if(patch==-1) patch=0; //never store negative patch number
+ fSpacePointData[counter].fID = counter
+ +((fCurrentSlice&0x7f)<<25)+((patch&0x7)<<22);//Uli
- ComparePads(fRowPadVector[row][pad+1],tmpCandidate,pad+1);
- if(tmpCandidate->fTotalCharge>tmpTotalCharge){
- //we have a cluster
- fClusters.push_back(*tmpCandidate);
- }
- }
- tmpPad->ClearCandidates();
+#ifdef do_mc
+ Int_t trackID[3];
+ GetTrackID((Int_t)rint(fpad),(Int_t)rint(ftime),trackID);
+
+ fSpacePointData[counter].fTrackID[0] = trackID[0];
+ fSpacePointData[counter].fTrackID[1] = trackID[1];
+ fSpacePointData[counter].fTrackID[2] = trackID[2];
+
+#endif
+
+ fNClusters++;
+ counter++;
}
- fRowPadVector[row][fNumberOfPadsInRow[row]]->ClearCandidates();
- }
+}
- HLTInfo("Found %d clusters.",fClusters.size());
+// STILL TO FIX ----------------------------------------------------------------------------
- //TODO: Change so it stores AliHLTTPCSpacePointData directly, instead of this copying
+#ifdef do_mc
+void AliHLTTPCClusterFinder::GetTrackID(Int_t pad,Int_t time,Int_t *trackID){
+ // see header file for class documentation
+
+ //get mc id
+ AliHLTTPCDigitRowData *rowPt = (AliHLTTPCDigitRowData*)fDigitRowData;
- AliClusterData * clusterlist = new AliClusterData[fClusters.size()]; //Clusterlist
- for(unsigned int i=0;i<fClusters.size();i++){
- clusterlist[i].fTotalCharge = fClusters[i].fTotalCharge;
- clusterlist[i].fPad = fClusters[i].fPad;
- clusterlist[i].fPad2 = fClusters[i].fPad2;
- clusterlist[i].fTime = fClusters[i].fTime;
- clusterlist[i].fTime2 = fClusters[i].fTime2;
- clusterlist[i].fMean = fClusters[i].fMean;
- clusterlist[i].fFlags = fClusters[i].fFlags;
- clusterlist[i].fChargeFalling = fClusters[i].fChargeFalling;
- clusterlist[i].fLastCharge = fClusters[i].fLastCharge;
- clusterlist[i].fLastMergedPad = fClusters[i].fLastMergedPad;
- clusterlist[i].fRow = fClusters[i].fRowNumber;
- clusterlist[i].fQMax = fClusters[i].fQMax;
+ trackID[0]=trackID[1]=trackID[2]=-2;
+ for(Int_t i=fFirstRow; i<=fLastRow; i++){
+ if(rowPt->fRow < (UInt_t)fCurrentRow){
+ AliHLTTPCMemHandler::UpdateRowPointer(rowPt);
+ continue;
+ }
+ AliHLTTPCDigitData *digPt = (AliHLTTPCDigitData*)rowPt->fDigitData;
+ for(UInt_t j=0; j<rowPt->fNDigit; j++){
+ Int_t cpad = digPt[j].fPad;
+ Int_t ctime = digPt[j].fTime;
+ if(cpad != pad) continue;
+ if(ctime != time) continue;
+ trackID[0] = digPt[j].fTrackID[0];
+ trackID[1] = digPt[j].fTrackID[1];
+ trackID[2] = digPt[j].fTrackID[2];
+
+ break;
+ }
+ break;
}
- // PrintClusters();
- WriteClusters(fClusters.size(),clusterlist);
- delete [] clusterlist;
- fClusters.clear();
}
+#endif
-void AliHLTTPCClusterFinder::PrintClusters()
-{
+
+
+void AliHLTTPCClusterFinder::WriteClusters(Int_t nclusters,AliHLTTPCClusters *list){//This is used when using the AliHLTTPCClusters class for cluster data
// see header file for class documentation
- for(size_t i=0;i<fClusters.size();i++){
- HLTInfo("Cluster number: %d",i);
- HLTInfo("Row: %d \t Pad: %d",fClusters[i].fRowNumber,fClusters[i].fPad/fClusters[i].fTotalCharge);
- HLTInfo("Total Charge: %d",fClusters[i].fTotalCharge);
- HLTInfo("fPad: %d",fClusters[i].fPad);
- HLTInfo("PadError: %d",fClusters[i].fPad2);
- HLTInfo("TimeMean: %d",fClusters[i].fTime/fClusters[i].fTotalCharge);
- HLTInfo("TimeError: %d",fClusters[i].fTime2);
- HLTInfo("EndOfCluster:");
- }
-}
-void AliHLTTPCClusterFinder::WriteClusters(Int_t nclusters,AliHLTTPCClusters *list)//This is used when using the AliHLTTPCClusters class for cluster data
-{
//write cluster to output pointer
Int_t thisrow,thissector;
UInt_t counter = fNClusters;
fSpacePointData[counter].fSigmaY2 = fpad2;
fSpacePointData[counter].fSigmaZ2 = ftime2;
- fSpacePointData[counter].fMaxQ = list[j].fQMax;
+ fSpacePointData[counter].fQMax = list[j].fQMax;
fSpacePointData[counter].fUsed = kFALSE; // only used / set in AliHLTTPCDisplay
fSpacePointData[counter].fTrackN = -1; // only used / set in AliHLTTPCDisplay
/** standard constructor */
AliHLTTPCClusterFinder();
+
/** destructor */
virtual ~AliHLTTPCClusterFinder();
- void Read(void* ptr,unsigned long size);
-
- void InitSlice(Int_t slice,Int_t patch,Int_t firstrow, Int_t lastrow,Int_t maxpoints);
+ /** Initialize the slice */
void InitSlice(Int_t slice,Int_t patch,Int_t maxpoints);
- void ProcessDigits();
+ /** Initializes the pad array (vector)*/
+ void InitializePadArray();
+
+ /** Deinitialize the pad array (vector)*/
+ Int_t DeInitializePadArray();
+
+ /** Read the data in unsorted format, storing the clustercandidates */
+ void ReadDataUnsorted(void* ptr,unsigned long size);
+
+ /** Read the data in unsorted format, and deconvolute the signals for each pad in time direction */
+ void ReadDataUnsortedDeconvoluteTime(void* ptr,unsigned long size);
+
+ /** Loops over all rows finding the clusters */
+ void FindClusters();
+
+ /** Compare two neighbouring pads for matching clustercandidates */
+ Bool_t ComparePads(AliHLTTPCPad *nextPad,AliHLTTPCClusters* candidate,Int_t nextPadToRead);
+
+ /** Fills the hw address list */
+ Int_t FillHWAddressList(AliHLTUInt16_t *hwaddlist, Int_t maxHWAddress);
+
+ /** Set the pointer to the outputbuffer */
void SetOutputArray(AliHLTTPCSpacePointData *pt);
+
+ /** Returns the number of clusters */
+ Int_t GetNumberOfClusters() const {return fNClusters;}
+
+ // setters
+ void SetDeconv(Bool_t f) {fDeconvPad=f; fDeconvTime=f;}
+ void SetDeconvPad(Bool_t f) {fDeconvPad=f;}
+ void SetDeconvTime(Bool_t f) {fDeconvTime=f;}
+ void SetUnsorted(Int_t unsorted){fUnsorted=unsorted;}
+ void SetPatch(Int_t patch){fCurrentPatch=patch;}
+ void SetDoPadSelection(Bool_t input){fDoPadSelection=input;}
+ void SetLastTimeBin(Int_t ltb){fLastTimeBin=ltb;}
+ void SetFirstTimeBin(Int_t ftb){fFirstTimeBin=ftb;}
+ void UpdateLastTimeBin(){fLastTimeBin=AliHLTTPCTransform::GetNTimeBins();}
+
+//---------------------------------- Under this line the old sorted clusterfinder functions can be found --------------------------------
+ void Read(void* ptr,unsigned long size);
+ void ProcessDigits();
void WriteClusters(Int_t n_clusters,AliClusterData *list);
+ void WriteClusters(Int_t nclusters,AliHLTTPCClusters *list);
void PrintClusters();
void SetXYError(Float_t f) {fXYErr=f;}
void SetZError(Float_t f) {fZErr=f;}
- void SetDeconv(Bool_t f) {fDeconvPad=f; fDeconvTime=f;}
- void SetDeconvPad(Bool_t f) {fDeconvPad=f;}
- void SetDeconvTime(Bool_t f) {fDeconvTime=f;}
void SetThreshold(UInt_t i) {fThreshold=i;}
void SetOccupancyLimit(Float_t f) {fOccupancyLimit=f;}
void SetMatchWidth(UInt_t i) {fMatch=i;}
void SetCalcErr(Bool_t f=kTRUE) {fCalcerr=f;}
void SetRawSP(Bool_t f=kFALSE) {fRawSP=f;}
void SetReader(AliHLTTPCDigitReader* f){fDigitReader = f;}
- Int_t GetNumberOfClusters() const {return fNClusters;}
-
- //----------------------------------Methods for the new unsorted way of reading data ----------
- void ReadDataUnsorted(void* ptr,unsigned long size);
- void ReadDataUnsortedDeconvoluteTime(void* ptr,unsigned long size);
- void FindClusters();
- void WriteClusters(Int_t nclusters,AliHLTTPCClusters *list);
- void SetUnsorted(Int_t unsorted){fUnsorted=unsorted;}
- void SetPatch(Int_t patch){fCurrentPatch=patch;}
- void InitializePadArray();
- Int_t DeInitializePadArray();
- Bool_t ComparePads(AliHLTTPCPad *nextPad,AliHLTTPCClusters* candidate,Int_t nextPadToRead);
-
- void SetDoPadSelection(Bool_t input){fDoPadSelection=input;}
-
- Int_t FillHWAddressList(AliHLTUInt16_t *hwaddlist, Int_t maxHWAddress);
-
- void UpdateLastTimeBin(){fLastTimeBin=AliHLTTPCTransform::GetNTimeBins();}
-
- void SetLastTimeBin(Int_t ltb){fLastTimeBin=ltb;}
-
- void SetFirstTimeBin(Int_t ftb){fFirstTimeBin=ftb;}
vector<AliHLTUInt16_t> fClustersHWAddressVector; //! transient
AliHLTTPCSpacePointData *fSpacePointData; //! array of space points
AliHLTTPCDigitReader *fDigitReader; //! reader instance
- UChar_t* fPtr; //! pointer to packed block
- unsigned long fSize; //packed block size
- Bool_t fDeconvTime; //deconv in time direction
- Bool_t fDeconvPad; //deconv in pad direction
- Bool_t fStdout; //have print out in write clusters
- Bool_t fCalcerr; //calculate centroid sigmas
- Bool_t fRawSP; //store centroids in raw system
-
-
- Int_t fFirstRow; //first row
- Int_t fLastRow; //last row
- Int_t fCurrentRow; //current active row
- Int_t fCurrentSlice; //current slice
- Int_t fCurrentPatch; //current patch
- Int_t fMatch; //size of match
- UInt_t fThreshold; //threshold for clusters
- Int_t fNClusters; //number of found clusters
- Int_t fMaxNClusters; //max. number of clusters
- Float_t fXYErr; //fixed error in XY
- Float_t fZErr; //fixed error in Z
+ UChar_t* fPtr; //! pointer to packed block
+ unsigned long fSize; //! packed block size
+ Bool_t fDeconvTime; //! deconv in time direction
+ Bool_t fDeconvPad; //! deconv in pad direction
+ Bool_t fStdout; //! have print out in write clusters
+ Bool_t fCalcerr; //! calculate centroid sigmas
+ Bool_t fRawSP; //! store centroids in raw system
+
+
+ Int_t fFirstRow; //! first row
+ Int_t fLastRow; //! last row
+ Int_t fCurrentRow; //! current active row
+ Int_t fCurrentSlice; //! current slice
+ Int_t fCurrentPatch; //! current patch
+ Int_t fMatch; //! size of match
+ UInt_t fThreshold; //! threshold for clusters
+ Int_t fNClusters; //! number of found clusters
+ Int_t fMaxNClusters; //! max. number of clusters
+ Float_t fXYErr; //! fixed error in XY
+ Float_t fZErr; //! fixed error in Z
- Float_t fOccupancyLimit; // Occupancy Limit
-
- Int_t fUnsorted; // enable for processing of unsorted digit data
- Bool_t fVectorInitialized;
+ Float_t fOccupancyLimit; //! Occupancy Limit
+ Int_t fUnsorted; //! enable for processing of unsorted digit data
+ Bool_t fVectorInitialized; //! flag to check if pad vector is initialized
+
vector<AliHLTTPCClusters> fClusters; //! transient
UInt_t* fNumberOfPadsInRow; //! transient
case kClusterFinderPacked:
return "TPCClusterFinderPacked";
break;
- case kClusterFinderUnpacked:
- return "TPCClusterFinderUnpacked";
- break;
case kClusterFinderDecoder:
return "TPCClusterFinderDecoder";
break;
case kClusterFinderPacked:
list.push_back( kAliHLTDataTypeDDLRaw | kAliHLTDataOriginTPC );
break;
- case kClusterFinderUnpacked:
- list.push_back( AliHLTTPCDefinitions::fgkUnpackedRawDataType );
- break;
case kClusterFinderDecoder:
list.push_back( kAliHLTDataTypeDDLRaw | kAliHLTDataOriginTPC );
break;
fClusterFinder = new AliHLTTPCClusterFinder();
- // Int_t sigthresh = -1;
- // Double_t sigmathresh= -1;
Float_t occulimit = 1.0;
- // Int_t oldRCUFormat=0;
- // Data Format version numbers:
- // 0: RCU Data format as delivered during TPC commissioning, pads/padrows are sorted, RCU trailer is one 32 bit word.
- // 1: As 0, but pads/padrows are delivered "as is", without sorting
- // 2: As 0, but RCU trailer is 3 32 bit words.
- // 3: As 1, but RCU trailer is 3 32 bit words.
- // -1: use offline raw reader
Int_t i = 0;
Char_t* cpErr;
while ( i < argc ) {
-
-
// -- deconvolute-time option
if ( !strcmp( argv[i], "-deconvolute-time" ) ) {
fDeconvTime = kTRUE;
continue;
}
-
// -- raw reader mode option
if ( !strcmp( argv[i], "rawreadermode" ) ) {
if ( argc <= i+1 ) {
continue;
}
-
// -- pp-run option
if ( !strcmp( argv[i], "pp-run") ) {
HLTWarning("Argument 'pp-run' is obsolete, deconvolution is swiched off in both time and pad directions by default.");
continue;
}
-
// -- checking for rcu format
if ( !strcmp( argv[i], "oldrcuformat" ) ) {
strtoul( argv[i+1], &cpErr ,0);
if (fModeSwitch==kClusterFinderPacked) {
HLTDebug("using AliHLTTPCDigitReaderPacked");
fReader = new AliHLTTPCDigitReaderPacked();
- /*
- if(oldRCUFormat==1){
- fReader->SetOldRCUFormat(kTRUE);
- }
- else if(oldRCUFormat!=0){
- HLTWarning("Wrong oldrcuformat specifier %d; oldrcuformat set to default(kFALSE)",oldRCUFormat);
- }
- */
- if(fUnsorted==1){
- fReader->SetUnsorted(kTRUE);
- }
+ if(fUnsorted==1){ fReader->SetUnsorted(kTRUE); }
fClusterFinder->SetReader(fReader);
}
- else if(fModeSwitch==kClusterFinderUnpacked){
- HLTDebug("using AliHLTTPCDigitReaderUnpacked");
- fReader = new AliHLTTPCDigitReaderUnpacked();
- fClusterFinder->SetReader(fReader);
- }
else if(fModeSwitch==kClusterFinderDecoder){
HLTDebug("using AliHLTTPCDigitReaderDecoder");
fReader = new AliHLTTPCDigitReaderDecoder();
if ( (fXYClusterError>0) && (fZClusterError>0) ){
fClusterFinder->SetCalcErr( false );
}
- // fClusterFinder->SetSignalThreshold(sigthresh);
- // fClusterFinder->SetNSigmaThreshold(sigmathresh);
if(fFirstTimeBin>0){
fClusterFinder->SetFirstTimeBin(fFirstTimeBin);
{
// see header file for class documentation
+ if(fReader == NULL){
+ HLTFatal("Digit reader not initialized, aborting event.");
+ size=0;
+ return 0;
+ }
+
if(GetFirstInputBlock( kAliHLTDataTypeSOR ) || GetFirstInputBlock( kAliHLTDataTypeEOR )){
size=0;
return 0;
outBPtr = outputPtr;
outPtr = (AliHLTTPCClusterData*)outBPtr;
- Int_t slice, patch, row[2];
+ Int_t slice, patch;
unsigned long maxPoints, realPoints = 0;
for ( ndx = 0; ndx < evtData.fBlockCnt; ndx++ )
}
else if(fModeSwitch==1){
+ HLTWarning("Unpacked data type depreciated, block aborted");
HLTDebug("Event 0x%08LX (%Lu) received datatype: %s - required datatype: %s",
evtData.fEventID, evtData.fEventID,
DataType2Text( iter->fDataType).c_str(),
DataType2Text(AliHLTTPCDefinitions::fgkUnpackedRawDataType).c_str());
-
- if ( iter->fDataType != AliHLTTPCDefinitions::fgkUnpackedRawDataType ) continue;
-
+ continue;
}
slice = AliHLTTPCDefinitions::GetMinSliceNr( *iter );
patch = AliHLTTPCDefinitions::GetMinPatchNr( *iter );
- row[0] = AliHLTTPCTransform::GetFirstRow( patch );
- row[1] = AliHLTTPCTransform::GetLastRow( patch );
-
if(fUnsorted){
fClusterFinder->SetUnsorted(fUnsorted);
maxPoints = (size-tSize-sizeof(AliHLTTPCClusterData))/sizeof(AliHLTTPCSpacePointData);
- fClusterFinder->InitSlice( slice, patch, row[0], row[1], maxPoints );
+ fClusterFinder->InitSlice( slice, patch, maxPoints );
fClusterFinder->SetOutputArray( (AliHLTTPCSpacePointData*)outPtr->fSpacePoints );
if(fUnsorted){
if(fGetActivePads){
fClusterFinder->SetDoPadSelection(kTRUE);
- }
-
+ }
if(fDeconvTime){
fClusterFinder->ReadDataUnsortedDeconvoluteTime(iter->fPtr, iter->fSize);
}
fClusterFinder->Read(iter->fPtr, iter->fSize );
fClusterFinder->ProcessDigits();
}
+
realPoints = fClusterFinder->GetNumberOfClusters();
outPtr->fSpacePointCnt = realPoints;
Logging( kHLTLogDebug, "HLT::TPCClusterFinder::DoEvent", "Spacepoints",
"Number of spacepoints: %lu Slice/Patch/RowMin/RowMax: %d/%d/%d/%d.",
- realPoints, slice, patch, row[0], row[1] );
+ realPoints, slice, patch,AliHLTTPCTransform::GetFirstRow( patch ) , AliHLTTPCTransform::GetLastRow( patch ) );
AliHLTComponentBlockData bd;
FillBlockData( bd );
bd.fOffset = offset;
bd.fSize = mysize;
bd.fSpecification = iter->fSpecification;
bd.fDataType = AliHLTTPCDefinitions::fgkClustersDataType;
- //AliHLTSubEventDescriptor::FillBlockAttributes( bd.fAttributes );
outputBlocks.push_back( bd );
tSize += mysize;
}
if(fPlotQmaxPartAll){
- if(clusters[i].fMaxQ>tmpQPart){
- fQMaxPartitionAll->SetBinContent(patch+6*slice,clusters[i].fMaxQ);
- tmpQPart=clusters[i].fMaxQ;
+ if(clusters[i].fQMax>tmpQPart){
+ fQMaxPartitionAll->SetBinContent(patch+6*slice,clusters[i].fQMax);
+ tmpQPart=clusters[i].fQMax;
}
}
if(fPlotQmaxROCAll){
- if(clusters[i].fMaxQ>fQMaxROCAll->GetBinContent(thissector)){
- fQMaxROCAll->SetBinContent(thissector,clusters[i].fMaxQ);
- // tmpQROC=clusters[i].fMaxQ;
+ if(clusters[i].fQMax>fQMaxROCAll->GetBinContent(thissector)){
+ fQMaxROCAll->SetBinContent(thissector,clusters[i].fQMax);
+ // tmpQROC=clusters[i].fQMax;
}
}
}
--- /dev/null
+/**************************************************************************
+ * This file is property of and copyright by the ALICE HLT Project *
+ * ALICE Experiment at CERN, All rights reserved. *
+ * *
+ * Primary Authors: Kenneth Aamodt <Kenneth.Aamodt@student.uib.no> *
+ * for The ALICE HLT Project. *
+ * *
+ * Permission to use, copy, modify and distribute this software and its *
+ * documentation strictly for non-commercial purposes is hereby granted *
+ * without fee, provided that the above copyright notice appears in all *
+ * copies and that both the copyright notice and this permission notice *
+ * appear in the supporting documentation. The authors make no claims *
+ * about the suitability of this software for any purpose. It is *
+ * provided "as is" without express or implied warranty. *
+ **************************************************************************/
+
+/** @file AliHLTTPCHWCFDataReverterComponent.cxx
+ @author Kenneth Aamodt
+ @date
+ @brief Component for reverting data for the HW clusterfinder
+*/
+
+// see header file for class documentation //
+// or //
+// refer to README to build package //
+// or //
+// visit http://web.ift.uib.no/~kjeks/doc/alice-hlt //
+
+#if __GNUC__>= 3
+using namespace std;
+#endif
+#include "AliHLTTPCHWCFDataReverterComponent.h"
+#include "AliHLTTPCDigitReaderDecoder.h"
+#include "AliHLTTPCTransform.h"
+#include "AliHLTTPCDefinitions.h"
+#include "AliHLTTPCDigitData.h"
+#include "AliHLTTPCMapping.h"
+#include <cstdlib>
+#include <cerrno>
+#include <cassert>
+#include "TString.h"
+#include <sys/time.h>
+#include "AliHLTAltroEncoder.h"
+#include "AliRawDataHeader.h"
+
+/** ROOT macro for the implementation of ROOT specific class methods */
+ClassImp(AliHLTTPCHWCFDataReverterComponent)
+
+ AliHLTTPCHWCFDataReverterComponent::AliHLTTPCHWCFDataReverterComponent()
+ :
+ fDigitReader(NULL),
+ fRowPadVector(),
+ fNumberOfPadsInRow(NULL),
+ fFirstPadHigh(NULL),
+ fNumberOfRows(0),
+ fCurrentPatch(0),
+ fFirstRow(0),
+ fLastRow(0),
+ fNTimeBins(0),
+ fVectorInitialized(kFALSE),
+ fMapping(NULL)
+{
+ // see header file for class documentation
+ // or
+ // refer to README to build package
+ // or
+ // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
+}
+
+AliHLTTPCHWCFDataReverterComponent::~AliHLTTPCHWCFDataReverterComponent()
+{
+ // see header file for class documentation
+ if(fVectorInitialized){
+ DeInitializePadArray();
+ }
+ if(fNumberOfPadsInRow){
+ delete [] fNumberOfPadsInRow;
+ fNumberOfPadsInRow=NULL;
+ }
+ if(fFirstPadHigh){
+ delete [] fFirstPadHigh;
+ fFirstPadHigh=NULL;
+ }
+ if(fDigitReader){
+ delete fDigitReader;
+ fDigitReader=NULL;
+ }
+ if(fMapping){
+ delete fMapping;
+ fMapping = NULL;
+ }
+}
+
+// Public functions to implement AliHLTComponent's interface.
+// These functions are required for the registration process
+
+const char* AliHLTTPCHWCFDataReverterComponent::GetComponentID()
+{
+ // see header file for class documentation
+ return "TPCHWCFDataReverter";
+}
+
+void AliHLTTPCHWCFDataReverterComponent::GetInputDataTypes( vector<AliHLTComponentDataType>& list)
+{
+ // see header file for class documentation
+ list.clear();
+ list.push_back( kAliHLTDataTypeDDLRaw | kAliHLTDataOriginTPC );
+}
+
+AliHLTComponentDataType AliHLTTPCHWCFDataReverterComponent::GetOutputDataType()
+{
+ // see header file for class documentation
+ return kAliHLTDataTypeDDLRaw;
+}
+
+int AliHLTTPCHWCFDataReverterComponent::GetOutputDataTypes(AliHLTComponentDataTypeList& tgtList)
+{
+ // see header file for class documentation
+ tgtList.clear();
+ tgtList.push_back(kAliHLTDataTypeDDLRaw);
+ return tgtList.size();
+}
+
+void AliHLTTPCHWCFDataReverterComponent::GetOutputDataSize( unsigned long& constBase, double& inputMultiplier )
+{
+ // see header file for class documentation
+ constBase=0;
+ inputMultiplier=1.0;
+}
+
+AliHLTComponent* AliHLTTPCHWCFDataReverterComponent::Spawn()
+{
+ // see header file for class documentation
+ return new AliHLTTPCHWCFDataReverterComponent();
+}
+
+int AliHLTTPCHWCFDataReverterComponent::DoInit( int argc, const char** argv )
+{
+ // see header file for class documentation
+
+ Int_t i = 0;
+ Char_t* cpErr;
+
+ while ( i < argc ) {
+
+ // -- number of timebins
+ if ( !strcmp( argv[i], "-timebins" )) {
+ fNTimeBins = strtoul( argv[i+1], &cpErr ,0);
+ AliHLTTPCTransform::SetNTimeBins(fNTimeBins);
+ if ( *cpErr ) {
+ HLTError("Cannot convert ntimebins specifier '%s'.", argv[i+1]);
+ return EINVAL;
+ }
+ i+=2;
+ continue;
+ }
+
+ HLTError("HLT::TPCClusterFinder::DoInit", "Unknown Option", "Unknown option '%s'", argv[i] );
+
+ return EINVAL;
+ }
+
+ HLTDebug("using AliHLTTPCDigitReaderDecoder");
+ fDigitReader = new AliHLTTPCDigitReaderDecoder();
+
+ return 0;
+}
+
+int AliHLTTPCHWCFDataReverterComponent::DoDeinit()
+{
+ // see header file for class documentation
+ return 0;
+}
+
+Int_t AliHLTTPCHWCFDataReverterComponent::DeInitializePadArray()
+{
+ // see header file for class documentation
+ if(fVectorInitialized){
+ for(Int_t i=0;i<fNumberOfRows;i++){
+ for(Int_t j=0;j<fNumberOfPadsInRow[i];j++){
+ delete fRowPadVector[i][j];
+ fRowPadVector[i][j]=NULL;
+ }
+ fRowPadVector[i].clear();
+ }
+ fRowPadVector.clear();
+ }
+ return 1;
+}
+
+void AliHLTTPCHWCFDataReverterComponent::InitializePadArray(){
+ // see header file for class documentation
+ if(fCurrentPatch>5){
+ HLTFatal("Patch is not set");
+ return;
+ }
+
+ fFirstRow = AliHLTTPCTransform::GetFirstRow(fCurrentPatch);
+ fLastRow = AliHLTTPCTransform::GetLastRow(fCurrentPatch);
+
+ fNumberOfRows=fLastRow-fFirstRow+1;
+ fNumberOfPadsInRow= new Int_t[fNumberOfRows];
+ fFirstPadHigh= new Int_t[fNumberOfRows];
+
+ memset( fNumberOfPadsInRow, 0, sizeof(Int_t)*(fNumberOfRows));
+ memset( fFirstPadHigh, 0, sizeof(Int_t)*(fNumberOfRows));
+
+ for(Int_t i=0;i<fNumberOfRows;i++){
+ fNumberOfPadsInRow[i]=AliHLTTPCTransform::GetNPads(i+fFirstRow);
+ AliHLTTPCPadVector tmpRow;
+ for(Int_t j=0;j<fNumberOfPadsInRow[i];j++){
+ AliHLTTPCPad *tmpPad = new AliHLTTPCPad();
+ if(fFirstPadHigh[i] != 0){
+ if(fMapping->GetHwAddress(i,j) > 2047){
+ fFirstPadHigh[i]=j;
+ }
+ }
+ tmpPad->SetID(i,j);
+ tmpRow.push_back(tmpPad);
+ }
+ fRowPadVector.push_back(tmpRow);
+ }
+ fVectorInitialized=kTRUE;
+}
+
+
+int AliHLTTPCHWCFDataReverterComponent::DoEvent( const AliHLTComponentEventData& evtData,
+ const AliHLTComponentBlockData* blocks,
+ AliHLTComponentTriggerData& /*trigData*/, AliHLTUInt8_t* outputPtr,
+ AliHLTUInt32_t& size,
+ vector<AliHLTComponentBlockData>& outputBlocks )
+{
+ // see header file for class documentation
+ int iResult=0;
+ if (!fDigitReader) return -ENODEV;
+
+ AliHLTUInt32_t capacity=size;
+ size=0;
+ if (!IsDataEvent()) return 0;
+
+ // == init iter (pointer to datablock)
+ const AliHLTComponentBlockData* iter = NULL;
+ unsigned long ndx;
+
+ //reading the data
+ for ( ndx = 0; ndx < evtData.fBlockCnt; ndx++ ){
+
+ iter = blocks+ndx;
+
+ HLTDebug("Event 0x%08LX (%Lu) received datatype: %s - required datatype: %s",
+ evtData.fEventID, evtData.fEventID,
+ DataType2Text( iter->fDataType).c_str(),
+ DataType2Text(kAliHLTDataTypeDDLRaw | kAliHLTDataOriginTPC).c_str());
+
+ if ( iter->fDataType != (kAliHLTDataTypeDDLRaw | kAliHLTDataOriginTPC)){
+ continue;
+ }
+
+ if (iter->fSize<=sizeof(AliRawDataHeader)) {
+ // forward empty DDLs
+ outputBlocks.push_back(*iter);
+ continue;
+ }
+
+ UInt_t slice = AliHLTTPCDefinitions::GetMinSliceNr( *iter );
+ UInt_t patch = AliHLTTPCDefinitions::GetMinPatchNr( *iter );
+
+ if(fDigitReader->InitBlock(iter->fPtr,iter->fSize,patch,slice)<0){
+ HLTWarning("Decoder failed to initialize, event aborted.");
+ continue;
+ }
+
+ fMapping = new AliHLTTPCMapping(patch);
+
+ if(!fVectorInitialized){
+ fCurrentPatch=patch;
+ InitializePadArray();
+ }
+
+ //Here the reading of the data and the zerosuppression takes place
+ while(fDigitReader->NextChannel()){//Pad
+
+ Int_t row=fDigitReader->GetRow();
+ Int_t pad=fDigitReader->GetPad();
+
+ if(row >= fNumberOfRows || row < 0){
+ continue;
+ }
+ else if(pad >= fNumberOfPadsInRow[row] || pad < 0){
+ continue;
+ }
+
+ AliHLTTPCPad *tmpPad = fRowPadVector[row][pad];
+ if (tmpPad){
+ tmpPad->SetDataToDefault();
+ }
+
+ //reading data to pad
+ while(fDigitReader->NextBunch()){
+ const UInt_t *bunchData= fDigitReader->GetSignals();
+ Int_t time=fDigitReader->GetTime();
+ for(Int_t i=0;i<fDigitReader->GetBunchSize();i++){
+ if(bunchData[i]>0){// disregarding 0 data.
+ if(time+i >= 0 && time+i < AliHLTTPCTransform::GetNTimeBins()){
+ if (tmpPad){
+ tmpPad->SetDataSignal(time+i,bunchData[i]);
+ }
+ }
+ }
+ }
+ }
+ }
+
+ if( iter->fSize > sizeof(AliRawDataHeader )){
+
+ AliHLTAltroEncoder *altroEncoder = new AliHLTAltroEncoder;
+ altroEncoder->SetBuffer(outputPtr,capacity); //tests if one overwrite the buffer is done in the encoder
+
+ // set CDH from the beginning of buffer
+ altroEncoder->SetCDH((AliHLTUInt8_t*)iter->fPtr,sizeof(AliRawDataHeader));
+
+ UChar_t *RCUTrailer=NULL;
+ Int_t RCUTrailerSize=fDigitReader->GetRCUTrailerSize();
+ if (RCUTrailerSize<=0 || !fDigitReader->GetRCUTrailerData( RCUTrailer )) {
+ if(RCUTrailer==NULL){
+ HLTWarning("can not find RCU trailer for data block %s 0x%08x: skipping data block",
+ DataType2Text(iter->fDataType).c_str(), iter->fSpecification);
+ continue;
+ }
+ }
+ altroEncoder->SetRCUTrailer(RCUTrailer, RCUTrailerSize);
+
+ for(Int_t row = 0; row< fNumberOfRows;row++){
+ Int_t padHigh=fFirstPadHigh[row];
+
+ Int_t padLowIndex=0;
+ Int_t padHighIndex= padHigh;
+
+ while(padLowIndex < padHigh || padHighIndex < fNumberOfPadsInRow[row]){
+ Int_t currentTime = 0;
+ Int_t bunchSize = 0;
+ //add the data from low side
+ if(padLowIndex < padHigh){
+ AliHLTTPCPad * lowPad= fRowPadVector[row][padLowIndex];
+ while(lowPad->GetNextGoodSignal(currentTime, bunchSize)){
+ for(Int_t i=0;i<bunchSize;i++){
+ if (altroEncoder->AddSignal((AliHLTUInt16_t)(lowPad->GetDataSignal(currentTime+i)),(AliHLTUInt16_t)(currentTime+i))<0) {
+ HLTWarning("can not add channel: slice %d, partition %d, hw address %d, row %d, pad %d, time %d, bunch size %d",
+ slice, patch, fMapping->GetHwAddress(row,padLowIndex), row, padLowIndex, currentTime+i, bunchSize);
+ break;
+ }
+ }
+ }
+ altroEncoder->SetChannel(fMapping->GetHwAddress(row,padLowIndex));
+ }
+ currentTime = 0;
+ bunchSize = 0;
+ //add the data from the high side
+ if(padHighIndex < fNumberOfPadsInRow[row]){
+ AliHLTTPCPad * highPad= fRowPadVector[row][padHighIndex];
+ while(highPad->GetNextGoodSignal(currentTime, bunchSize)){
+ for(Int_t i=0;i<bunchSize;i++){
+ if (altroEncoder->AddSignal((AliHLTUInt16_t)(highPad->GetDataSignal(currentTime+i)),(AliHLTUInt16_t)(currentTime+i))<0) {
+ HLTWarning("can not add channel: slice %d, partition %d, hw address %d, row %d, pad %d, time %d, bunch size %d",
+ slice, patch, fMapping->GetHwAddress(row,padHighIndex), row, padHighIndex, currentTime+i, bunchSize);
+ break;
+ }
+ }
+ }
+ altroEncoder->SetChannel(fMapping->GetHwAddress(row,padHighIndex));
+ }
+ padLowIndex++;
+ padHighIndex++;
+ }
+ }
+
+ altroEncoder->Revert40BitWords(sizeof(AliRawDataHeader),RCUTrailerSize);
+
+ int sizeOfData=altroEncoder->SetLength();
+
+ if (sizeOfData<0) {
+ HLTError("data encoding failed");
+ iResult=sizeOfData;
+ break;
+ }
+ if(sizeOfData>(int)capacity){
+ HLTWarning("Buffer too small too add the altrodata: %d of %d byte(s) already used", sizeOfData, capacity);
+ iResult=-ENOSPC;
+ break;
+ }
+
+ AliHLTComponentBlockData bd;
+ FillBlockData( bd );
+ bd.fOffset = 0;
+ bd.fSize = sizeOfData;
+ bd.fDataType = kAliHLTDataTypeDDLRaw|kAliHLTDataOriginTPC;
+ bd.fSpecification = iter->fSpecification;
+ outputBlocks.push_back( bd );
+
+ size+=sizeOfData;
+ }
+ fDigitReader->Reset();
+ }
+
+ if(iResult < 0) {
+ fDigitReader->Reset();
+ size=0;
+ }
+ HLTDebug("Total size of output is: %d ",size);
+ return iResult;
+}
--- /dev/null
+// XEmacs -*-C++-*-
+
+#ifndef ALIHLTTPCHWCFDATAREVERTERCOMPONENT_H
+#define ALIHLTTPCHWCFDATAREVERTERCOMPONENT_H
+
+//* This file is property of and copyright by the ALICE HLT Project *
+//* ALICE Experiment at CERN, All rights reserved. *
+//* See cxx source for full Copyright notice *
+
+/** @file AliHLTTPCHWCFDataReverterComponent.h
+ @author Kenneth Aamodt
+ @date
+ @brief Component for reverting data for the HW clusterfinder
+*/
+
+#include "AliHLTProcessor.h"
+#include "AliHLTTPCPad.h"
+#include "AliHLTDataTypes.h"
+
+class AliHLTTPCDigitReader;
+class AliHLTTPCMapping;
+
+/**
+ * @class AliHLTTPCHWCFDataReverterComponent
+ * Implementation of the zero suppression component.
+ * The component implements the interface methods of the @ref AliHLTProcessor.
+ *
+ * The component orders the data in the format the Hardware ClusterFinder
+ * expects, and revert the 40 bit altro words.
+ *
+ * The component has the following component arguments:
+ *
+ * @ingroup alihlt_tpc_components
+ */
+class AliHLTTPCHWCFDataReverterComponent : public AliHLTProcessor
+ {
+ public:
+ /** constructor */
+ AliHLTTPCHWCFDataReverterComponent();
+ /** destructor */
+ virtual ~AliHLTTPCHWCFDataReverterComponent();
+
+ // Public functions to implement AliHLTComponent's interface.
+ // These functions are required for the registration process
+
+ /** interface function, see AliHLTComponent for description */
+ const char* GetComponentID();
+ /** interface function, see AliHLTComponent for description */
+ void GetInputDataTypes( vector<AliHLTComponentDataType>& list);
+ /** interface function, see AliHLTComponent for description */
+ AliHLTComponentDataType GetOutputDataType();
+ /** interface function, see AliHLTComponent for description */
+ int GetOutputDataTypes(AliHLTComponentDataTypeList& tgtList);
+ /** interface function, see AliHLTComponent for description */
+ virtual void GetOutputDataSize( unsigned long& constBase, double& inputMultiplier );
+ /** interface function, see AliHLTComponent for description */
+ AliHLTComponent* Spawn();
+
+ Int_t DeInitializePadArray();
+ void InitializePadArray();
+
+ protected:
+
+ // Protected functions to implement AliHLTComponent's interface.
+ // These functions provide initialization as well as the actual processing
+ // capabilities of the component.
+
+ int DoInit( int argc, const char** argv );
+ int DoDeinit();
+ int DoEvent( const AliHLTComponentEventData& evtData, const AliHLTComponentBlockData* blocks,
+ AliHLTComponentTriggerData& trigData, AliHLTUInt8_t* outputPtr,
+ AliHLTUInt32_t& size, vector<AliHLTComponentBlockData>& outputBlocks );
+ using AliHLTProcessor::DoEvent;
+
+ private:
+
+ /** copy constructor prohibited */
+ AliHLTTPCHWCFDataReverterComponent(const AliHLTTPCHWCFDataReverterComponent&);
+
+ /** assignment operator prohibited */
+ AliHLTTPCHWCFDataReverterComponent& operator=(const AliHLTTPCHWCFDataReverterComponent&);
+
+ /** the reader object for data decoding */
+ AliHLTTPCDigitReader* fDigitReader; //!transient
+
+ /** Vector of pointers to pad objects */
+ typedef vector<AliHLTTPCPad*> AliHLTTPCPadVector;
+
+ /** 2D vector of pointers to pad objects (vector of vectors)*/
+ vector<AliHLTTPCPadVector> fRowPadVector; //! transient
+
+ /** Array containing number of pads in the different rows */
+ Int_t* fNumberOfPadsInRow; //! transient
+
+ /** Array containing the index f forst pad on row with hwaddress > 2048 */
+ Int_t* fFirstPadHigh; //! transient
+
+ /** Number of rows the patch has */
+ Int_t fNumberOfRows; //! transient
+
+ /** Current patch number */
+ UInt_t fCurrentPatch; //! transient
+
+ /** First row in patch */
+ UInt_t fFirstRow; //! transient
+
+ /** Last row in patch */
+ UInt_t fLastRow; //! transient
+
+ /** Number of timebins */
+ Int_t fNTimeBins; //! transient
+
+ /** Flag to check if the 2d vector is initialized */
+ Bool_t fVectorInitialized; //! transient
+
+ /** pointer to mapping object */
+ AliHLTTPCMapping *fMapping;
+
+ ClassDef(AliHLTTPCHWCFDataReverterComponent, 0)
+ };
+#endif
fSpacePointData[fNKryptonClusters].fY = xyz[1];
fSpacePointData[fNKryptonClusters].fZ = xyz[2];
fSpacePointData[fNKryptonClusters].fCharge = tmpCluster->fTotalCharge;
- fSpacePointData[fNKryptonClusters].fMaxQ = tmpCluster->fQMax;
+ fSpacePointData[fNKryptonClusters].fQMax = tmpCluster->fQMax;
fSpacePointData[fNKryptonClusters].fPadRow = tmpCluster->fRowNumber/tmpCluster->fTotalCharge;
HLTDebug("Krypton cluster found");
HLTDebug("xyz=[%f,%f,%f]",fSpacePointData[fNKryptonClusters].fX,fSpacePointData[fNKryptonClusters].fY,fSpacePointData[fNKryptonClusters].fZ);
- HLTDebug("TotalCharge = %d and QMax = %d",fSpacePointData[fNKryptonClusters].fCharge,fSpacePointData[fNKryptonClusters].fMaxQ);
+ HLTDebug("TotalCharge = %d and QMax = %d",fSpacePointData[fNKryptonClusters].fCharge,fSpacePointData[fNKryptonClusters].fQMax);
fNKryptonClusters++;
break;
}
// == init iter (pointer to datablock)
const AliHLTComponentBlockData* iter = NULL;
- Int_t slice, patch, row[2];
+ Int_t slice, patch;
unsigned long maxPoints = 0;
slice = AliHLTTPCDefinitions::GetMinSliceNr( *iter );
patch = AliHLTTPCDefinitions::GetMinPatchNr( *iter );
- row[0] = AliHLTTPCTransform::GetFirstRow( patch );
- row[1] = AliHLTTPCTransform::GetLastRow( patch );
fKryptonClusterFinder->SetPatch(patch);
- fKryptonClusterFinder->InitSlice( slice, patch, row[0], row[1], maxPoints );
+ fKryptonClusterFinder->InitSlice( slice, patch, maxPoints );
fKryptonClusterFinder->SetOutputArray((AliHLTTPCSpacePointData*)outPtr->fSpacePoints);
} // end DoInit()
int AliHLTTPCNoiseMapComponent::DoDeinit() {
-// see header file for class documentation
+ // see header file for class documentation
if(fHistMaxSignal) delete fHistMaxSignal; fHistMaxSignal = NULL;
if(fHistTotSignal) delete fHistTotSignal; fHistTotSignal = NULL;
}
int AliHLTTPCNoiseMapComponent::DoEvent(const AliHLTComponentEventData& evtData, AliHLTComponentTriggerData& /*trigData*/){
-// see header file for class documentation
+ // see header file for class documentation
//HLTInfo("--- Entering DoEvent() in TPCNoiseMap ---");
for(iter = GetFirstInputBlock(kAliHLTDataTypeDDLRaw|kAliHLTDataOriginTPC); iter != NULL; iter = GetNextInputBlock()){
- HLTInfo("Event 0x%08LX (%Lu) received datatype: %s - required datatype: %s",
- evtData.fEventID, evtData.fEventID,
- DataType2Text(iter->fDataType).c_str(),
- DataType2Text(kAliHLTDataTypeDDLRaw | kAliHLTDataOriginTPC).c_str());
-
- if (iter->fDataType == AliHLTTPCDefinitions::fgkDDLPackedRawDataType && GetEventCount()<2){
- HLTWarning("data type %s is depricated, use %s (kAliHLTDataTypeDDLRaw)!",
- DataType2Text(AliHLTTPCDefinitions::fgkDDLPackedRawDataType).c_str(),
- DataType2Text(kAliHLTDataTypeDDLRaw | kAliHLTDataOriginTPC).c_str());
- }
+ HLTInfo("Event 0x%08LX (%Lu) received datatype: %s - required datatype: %s",
+ evtData.fEventID, evtData.fEventID,
+ DataType2Text(iter->fDataType).c_str(),
+ DataType2Text(kAliHLTDataTypeDDLRaw | kAliHLTDataOriginTPC).c_str());
+
+ if (iter->fDataType == AliHLTTPCDefinitions::fgkDDLPackedRawDataType && GetEventCount()<2){
+ HLTWarning("data type %s is depricated, use %s (kAliHLTDataTypeDDLRaw)!",
+ DataType2Text(AliHLTTPCDefinitions::fgkDDLPackedRawDataType).c_str(),
+ DataType2Text(kAliHLTDataTypeDDLRaw | kAliHLTDataOriginTPC).c_str());
+ }
- if (iter->fDataType != (kAliHLTDataTypeDDLRaw | kAliHLTDataOriginTPC)) continue;
+ if (iter->fDataType != (kAliHLTDataTypeDDLRaw | kAliHLTDataOriginTPC)) continue;
- UInt_t slice = AliHLTTPCDefinitions::GetMinSliceNr(*iter);
- UInt_t partition = AliHLTTPCDefinitions::GetMinPatchNr(*iter);
+ UInt_t slice = AliHLTTPCDefinitions::GetMinSliceNr(*iter);
+ UInt_t partition = AliHLTTPCDefinitions::GetMinPatchNr(*iter);
- fSpecification = iter->fSpecification;
+ fSpecification = iter->fSpecification;
- AliHLTTPCDigitReader *pDigitReader = new AliHLTTPCDigitReaderDecoder;
+ AliHLTTPCDigitReader *pDigitReader = new AliHLTTPCDigitReaderDecoder;
- pDigitReader->InitBlock(iter->fPtr,iter->fSize,partition,slice);
- if(!pDigitReader) break;
+ pDigitReader->InitBlock(iter->fPtr,iter->fSize,partition,slice);
+ if(!pDigitReader) break;
- //sprintf(name,"hMaxSignal_slice%d_partition%d", slice, partition);
- //fHistMaxSignal = new TH2F(name,name,250,-250,250,250,-250,250);
+ //sprintf(name,"hMaxSignal_slice%d_partition%d", slice, partition);
+ //fHistMaxSignal = new TH2F(name,name,250,-250,250,250,-250,250);
- while(pDigitReader->Next()){
- //while( pDigitReader->NextChannel()) { // pad loop
+ // while(pDigitReader->Next()){
+
+
+ Float_t maxSignal = 0.;
+ Float_t totalSignal = 0.;
+ Float_t squaredSignal = 0.;
+ Float_t rms = 0.;
+
+ while( pDigitReader->NextChannel()) { // pad loop
fCurrentRow = pDigitReader->GetRow();
fCurrentRow += pDigitReader->GetRowOffset();
// transformation from pad-row coordinates to global ones
// time info is not taken into account
-// AliTPCCalROC *calRoc = noisePad->GetCalROC(thissector);
-// calRoc->GetValue(thisrow,pDigitReader->GetPad());
+ // AliTPCCalROC *calRoc = noisePad->GetCalROC(thissector);
+ // calRoc->GetValue(thisrow,pDigitReader->GetPad());
+
- //while( pDigitReader->NextBunch()) {
+ while( pDigitReader->NextBunch()) {
- const UInt_t *bunchData = pDigitReader->GetSignals();
- Float_t maxSignal = 0.;
- Float_t totalSignal = 0.;
- Float_t squaredSignal = 0.;
- Float_t rms = 0.;
+ const UInt_t *bunchData = pDigitReader->GetSignals();
- //fHistSignal = new TH1F("fHistSignal", "signal distribution per pad",1024,0,1024);
+ //fHistSignal = new TH1F("fHistSignal", "signal distribution per pad",1024,0,1024);
- //fHistSignal->Reset();
- //Int_t time = pDigitReader->GetTime();
+ //fHistSignal->Reset();
+ //Int_t time = pDigitReader->GetTime();
- for(Int_t i=0;i<pDigitReader->GetBunchSize();i++){
+ for(Int_t i=0;i<pDigitReader->GetBunchSize();i++){
if((Float_t)(bunchData[i])>maxSignal){ maxSignal = (Float_t)(bunchData[i]); }
totalSignal += (Float_t)bunchData[i];
squaredSignal += (Float_t)bunchData[i]*(Float_t)bunchData[i];
//fHistSignal->Fill(time+i, bunchData[i]);
- } // end for loop over bunches
- rms = TMath::Sqrt(squaredSignal/pDigitReader->GetBunchSize());
+ } // end for loop over bunches
+ rms = TMath::Sqrt(squaredSignal/pDigitReader->GetBunchSize());
- //} // end of inner while loop
+ } // end of inner while loop
- fHistMaxSignal->Fill(xyz[0],xyz[1],maxSignal);
- fHistTotSignal->Fill(xyz[0],xyz[1],totalSignal);
-
- fHistPadRMS->Fill(xyz[0],xyz[1],rms);
+ } // end of while loop over pads
- //fHistPadRMS->Fill(xyz[0],xyz[1],fHistSignal->GetRMS());
- //delete fHistSignal; fHistSignal = NULL;
-
- if(fPlotSideA || fPlotSideC){
- if(slice<18) fHistSideA->Fill(xyz[0],xyz[1],maxSignal);
- else fHistSideC->Fill(xyz[0],xyz[1],maxSignal);
- } // end if plotting sides
- } // end of while loop over pads
-
- pDigitReader->Reset();
- delete pDigitReader;
+ fHistMaxSignal->Fill(xyz[0],xyz[1],maxSignal);
+ fHistTotSignal->Fill(xyz[0],xyz[1],totalSignal);
+
+ fHistPadRMS->Fill(xyz[0],xyz[1],rms);
+
+ //fHistPadRMS->Fill(xyz[0],xyz[1],fHistSignal->GetRMS());
+ //delete fHistSignal; fHistSignal = NULL;
+
+ if(fPlotSideA || fPlotSideC){
+ if(slice<18) fHistSideA->Fill(xyz[0],xyz[1],maxSignal);
+ else fHistSideC->Fill(xyz[0],xyz[1],maxSignal);
+ } // end if plotting sides
+
+
+ maxSignal = 0.;
+ totalSignal = 0.;
+ squaredSignal = 0.;
+ rms = 0.;
+
+ pDigitReader->Reset();
+ delete pDigitReader;
} // end of for loop over data blocks
if(fResetHistograms) ResetHistograms();
Float_t fSigmaY2; // error (former width) of the clusters
Float_t fSigmaZ2; // error (former width) of the clusters
UInt_t fCharge; // total charge of cluster
- UInt_t fMaxQ; // QMax of cluster
+ UInt_t fQMax; // QMax of cluster
Bool_t fUsed; // only used in AliHLTTPCDisplay
Int_t fTrackN; // only used in AliHLTTPCDisplay
};
Int_t patchCl = (idCluster>>22) & 0x7;
UInt_t pos = idCluster&0x3fffff;
if(fPlotChargeClusters || fPlotAll){fHistoChargeAllClusters->Fill(clusters[i].fCharge);}
- if(fPlotQMaxClusters || fPlotAll){fHistoQMaxAllClusters->Fill(clusters[i].fMaxQ);}
+ if(fPlotQMaxClusters || fPlotAll){fHistoQMaxAllClusters->Fill(clusters[i].fQMax);}
for(UInt_t id=0;id<fTrackClusterID[sliceCl][patchCl].size();id++){
if(fTrackClusterID[sliceCl][patchCl][id]==pos){
clusters[i].fUsed=kTRUE;
nClustersUsed++;
if(fPlotChargeUsedClusters || fPlotAll){fHistoChargeUsedClusters->Fill(clusters[i].fCharge);}
- if(fPlotQMaxUsedClusters || fPlotAll){fHistoQMaxUsedClusters->Fill(clusters[i].fMaxQ);}
+ if(fPlotQMaxUsedClusters || fPlotAll){fHistoQMaxUsedClusters->Fill(clusters[i].fQMax);}
}
}
fClusters.push_back(clusters[i]);
offCluster->SetRow((Int_t)spacePoint.fPadRow); // row
offCluster->SetTimeBin(spacePoint.fZ); // time bin
offCluster->SetQ(spacePoint.fCharge); // charge
- offCluster->SetMax(spacePoint.fMaxQ); // max Q (amplitude)
+ offCluster->SetMax(spacePoint.fQMax); // max Q (amplitude)
//offCluster->SetDetector(0); // detector/slice
//offCluster->SetType(0); // default from constructor
//offCluster->IsUsed(0); // default from constructor
spacePoint.fPadRow = offCluster->GetRow();
spacePoint.fZ = offCluster->GetTimeBin();
spacePoint.fCharge = (UInt_t)offCluster->GetQ();
- spacePoint.fMaxQ = (UInt_t)offCluster->GetMax();
+ spacePoint.fQMax = (UInt_t)offCluster->GetMax();
return spacePoint;
AliHLTTPCTrackHistoComponent.h \
AliHLTTPCTrackDumpComponent.h \
AliHLTTPCClusterDumpComponent.h \
- AliHLTTPCCalibTracksComponent.h
+ AliHLTTPCCalibTracksComponent.h \
+ AliHLTTPCHWCFDataReverterComponent.h