fPatch=0;
fDigits=0;
fDPt=0;
+ fWriteShape=kFALSE;
}
-AliL3Compress::AliL3Compress(Int_t slice,Int_t patch,Char_t *path)
+AliL3Compress::AliL3Compress(Int_t slice,Int_t patch,Char_t *path,Bool_t writeshape)
{
fSlice=slice;
fPatch=patch;
fDigits=0;
fDPt=0;
sprintf(fPath,"%s",path);
+ fWriteShape=writeshape;
}
AliL3Compress::~AliL3Compress()
void AliL3Compress::WriteFile(AliL3TrackArray *tracks)
{
Char_t fname[100];
- sprintf(fname,"%s/tracks_m_%d_%d.raw",fPath,fSlice,fPatch);
+ sprintf(fname,"%s/comp/tracks_m_%d_%d.raw",fPath,fSlice,fPatch);
FILE *file = fopen(fname,"w");
+ if(!file)
+ {
+ cerr<<"AliL3Compress::WriteFile : Error opening file "<<fname<<endl;
+ return;
+ }
Short_t ntracks = tracks->GetNTracks();
//cout<<"Writing "<<ntracks<<" tracks to file"<<endl;
if(!track) continue;
//Do not save useless tracks or clusters:
- //if(track->CheckClustersQuality(2) == 0)
- //continue;
+ if(track->GetNPresentClusters() == 0)
+ continue;
track->FillModel();
model = track->GetModel();
Char_t fname[100];
if(which == 'm')
- sprintf(fname,"%s/tracks_m_%d_%d.raw",fPath,fSlice,fPatch);
+ sprintf(fname,"%s/comp/tracks_m_%d_%d.raw",fPath,fSlice,fPatch);
else if(which == 'u')
- sprintf(fname,"%s/tracks_u_%d_%d.raw",fPath,fSlice,fPatch);
+ sprintf(fname,"%s/comp/tracks_u_%d_%d.raw",fPath,fSlice,fPatch);
else
{
cerr<<"AliL3Compress::ReadFile() : Wrong option"<<endl;
FILE *file = fopen(fname,"r");
if(!file)
{
- cerr<<"Cannot open file "<<fname<<endl;
+ cerr<<"AliL3Compress::ReadFile : Cannot open file "<<fname<<endl;
return;
}
track->Init(fSlice,fPatch);
AliL3TrackModel *model = track->GetModel();
AliL3ClusterModel *clusters = track->GetClusters();
- //cout<<"Reading model "<<(int)model<<endl;
if(fread(model,sizeof(AliL3TrackModel),1,file)!=1) break;
- //cout<<"Reading clusters "<<(int)clusters<<endl;
if(fread(clusters,(model->fNClusters)*sizeof(AliL3ClusterModel),1,file)!=1) break;
- //cout<<"Filling track"<<endl;
track->FillTrack();
- //track->Print();
}
fTracks->RemoveLast();
}
Char_t fname[100];
- sprintf(fname,"%s/tracks_c_%d_%d.raw",fPath,fSlice,fPatch);
+ sprintf(fname,"%s/comp/tracks_c_%d_%d.raw",fPath,fSlice,fPatch);
BIT_FILE *output = OpenOutputBitFile(fname);
- sprintf(fname,"%s/tracks_m_%d_%d.raw",fPath,fSlice,fPatch);
+ sprintf(fname,"%s/comp/tracks_m_%d_%d.raw",fPath,fSlice,fPatch);
FILE *input = fopen(fname,"r");
if(!input)
{
AliL3TrackModel track;
AliL3ClusterModel cluster;
Int_t temp;
- Short_t power;
+ Int_t power;
Int_t timeo,pado,chargeo,shapeo;
timeo=pado=chargeo=shapeo=0;
//Write charge information:
temp = (Int_t)cluster.fDCharge;
- if(temp<0)
- OutputBit(output,0);
- else
- OutputBit(output,1);
- power = 1<<(fNumChargeBits-1);
+ power = 1<<(fNumChargeBits);
if(abs(temp)>=power)
{
chargeo++;
temp=power - 1;
}
- OutputBits(output,abs(temp),(fNumChargeBits-1));
-
- //Write shape information:
- temp = (Int_t)cluster.fDSigmaY2;
- if(temp<0)
- OutputBit(output,0);
- else
- OutputBit(output,1);
- power = 1<<(fNumShapeBits-1);
- if(abs(temp) >= power)
- {
- shapeo++;
- temp = power - 1;
- }
- OutputBits(output,abs(temp),(fNumShapeBits-1));
+ OutputBits(output,abs(temp),(fNumChargeBits));
- temp = (Int_t)cluster.fDSigmaZ2;
- if(temp<0)
- OutputBit(output,0);
- else
- OutputBit(output,1);
- power = 1<<(fNumShapeBits-1);
- if(abs(temp) >= power)
+ if(fWriteShape)
{
- shapeo++;
- temp=power - 1;
+ //Write shape information:
+ temp = (Int_t)cluster.fDSigmaY2;
+ if(temp<0)
+ OutputBit(output,0);
+ else
+ OutputBit(output,1);
+ power = 1<<(fNumShapeBits-1);
+ if(abs(temp) >= power)
+ {
+ shapeo++;
+ temp = power - 1;
+ }
+ OutputBits(output,abs(temp),(fNumShapeBits-1));
+
+ temp = (Int_t)cluster.fDSigmaZ2;
+ if(temp<0)
+ OutputBit(output,0);
+ else
+ OutputBit(output,1);
+ power = 1<<(fNumShapeBits-1);
+ if(abs(temp) >= power)
+ {
+ shapeo++;
+ temp=power - 1;
+ }
+ OutputBits(output,abs(temp),(fNumShapeBits-1));
}
- OutputBits(output,abs(temp),(fNumShapeBits-1));
}
}
}
Char_t fname[100];
- sprintf(fname,"%s/tracks_c_%d_%d.raw",fPath,fSlice,fPatch);
+ sprintf(fname,"%s/comp/tracks_c_%d_%d.raw",fPath,fSlice,fPatch);
BIT_FILE *input = OpenInputBitFile(fname);
- sprintf(fname,"%s/tracks_u_%d_%d.raw",fPath,fSlice,fPatch);
+ sprintf(fname,"%s/comp/tracks_u_%d_%d.raw",fPath,fSlice,fPatch);
FILE *output = fopen(fname,"w");
if(!output)
{
//Read and write track:
if(fread(&trackmodel,sizeof(AliL3TrackModel),1,input->file)!=1) break;
fwrite(&trackmodel,sizeof(AliL3TrackModel),1,output);
-
+
+ memset(clusters,0,AliL3Transform::GetNRows(fPatch)*sizeof(AliL3ClusterModel));
for(Int_t i=0; i<AliL3Transform::GetNRows(fPatch); i++)
{
Int_t temp,sign;
clusters[i].fDPad = temp;
//Read charge information:
- sign = InputBit(input);
- temp=InputBits(input,(fNumChargeBits-1));
- if(!sign)
- temp*=-1;
+ temp=InputBits(input,(fNumChargeBits));
clusters[i].fDCharge = temp;
- //Read shape information:
- sign = InputBit(input);
- temp = InputBits(input,(fNumShapeBits-1));
- if(!sign)
- temp*=-1;
- clusters[i].fDSigmaY2 = temp;
-
- sign = InputBit(input);
- temp = InputBits(input,(fNumShapeBits-1));
- if(!sign)
- temp*=-1;
- clusters[i].fDSigmaZ2 = temp;
+ if(fWriteShape)
+ {
+ //Read shape information:
+ sign = InputBit(input);
+ temp = InputBits(input,(fNumShapeBits-1));
+ if(!sign)
+ temp*=-1;
+ clusters[i].fDSigmaY2 = temp;
+
+ sign = InputBit(input);
+ temp = InputBits(input,(fNumShapeBits-1));
+ if(!sign)
+ temp*=-1;
+ clusters[i].fDSigmaZ2 = temp;
+ }
}
-
-
count++;
fwrite(clusters,(trackmodel.fNClusters)*sizeof(AliL3ClusterModel),1,output);
//which == u : restore compressed data
//which == m : restore uncompressed data
+ if(!fWriteShape)
+ {
+ cerr<<"AliL3Compress::RestoreData : Not implemented without shape info "<<endl;
+ return;
+ }
ReadFile(which);
void AliL3Compress::WriteRestoredData()
{
- Char_t fname[100];
+ Char_t fname[100];
//Get the remaining raw data array:
AliL3MemHandler *mem = new AliL3MemHandler();
- sprintf(fname,"%s/remains_%d_%d.raw",fPath,fSlice,fPatch);
+ sprintf(fname,"%s/comp/remains_%d_%d.raw",fPath,fSlice,fPatch);
mem->SetBinaryInput(fname);
UInt_t numdigits;
AliL3DigitRowData *origRow = mem->CompBinary2Memory(numdigits);
cerr<<"AliL3Compress::WriteRestoredData() : Written rows: "<<row_counter<<" total rows "<<AliL3Transform::GetNRows(fPatch)<<endl;
mem->Free();
- sprintf(fname,"%s/restored_%d_%d.raw",fPath,fSlice,fPatch);
+ sprintf(fname,"%s/comp/restored_%d_%d.raw",fPath,fSlice,fPatch);
mem->SetBinaryOutput(fname);
mem->Memory2CompBinary((UInt_t)AliL3Transform::GetNRows(fPatch),(AliL3DigitRowData*)data);
mem->CloseBinaryOutput();
void AliL3Compress::PrintCompRatio()
{
Char_t fname[100];
- sprintf(fname,"%s/remains_%d_%d.raw",fPath,fSlice,fPatch);
+ sprintf(fname,"%s/comp/remains_%d_%d.raw",fPath,fSlice,fPatch);
AliL3MemHandler *mem = new AliL3MemHandler();
if(!mem->SetBinaryInput(fname))
{
}
delete mem;
- sprintf(fname,"%s/tracks_c_%d_%d.raw",fPath,fSlice,fPatch);
+ sprintf(fname,"%s/comp/tracks_c_%d_%d.raw",fPath,fSlice,fPatch);
FILE *file1 = fopen(fname,"r");
if(!file1)
{
#ifdef use_aliroot
Char_t fname[100];
AliL3MemHandler *mem = new AliL3MemHandler();
- sprintf(fname,"%s/restored_%d_%d.raw",fPath,fSlice,fPatch);
+ sprintf(fname,"%s/comp/restored_%d_%d.raw",fPath,fSlice,fPatch);
mem->SetBinaryInput(fname);
UInt_t ndigits;
AliL3DigitRowData *rowPt = (AliL3DigitRowData*)mem->CompBinary2Memory(ndigits);
mem->CloseBinaryInput();
- sprintf(fname,"%s/digitfile",fPath);
+ sprintf(fname,"%s/digitfile.root",fPath);
AliL3FileHandler *file = new AliL3FileHandler();
if(!file->SetAliInput(fname))
Int_t fSlice;
Int_t fPatch;
Char_t fPath[100];
-
+ Bool_t fWriteShape;
+
void CreateDigitArray(Int_t maxnumber);
void CreateDigits(Int_t row,Int_t npads,Float_t pad,Float_t time,Int_t charge,Float_t ywidth,Float_t zwidth);
void QSort(AliL3RandomDigitData **a, Int_t first, Int_t last);
public:
AliL3Compress();
- AliL3Compress(Int_t slice,Int_t patch,Char_t *path="./");
+ AliL3Compress(Int_t slice,Int_t patch,Char_t *path="./",Bool_t writeshape=kFALSE);
virtual ~AliL3Compress();
void SetBitNumbers(Int_t pad,Int_t time,Int_t charge,Int_t shape);
memset(fTrackModel,0,sizeof(AliL3TrackModel));
for(Int_t i=0; i<nrows; i++)
fOverlap[i]=-1;
-#ifdef do_mc
- for(Int_t i=0; i<nrows; i++)
- fClusters[i].fTrackID[0]=fClusters[i].fTrackID[1]=fClusters[i].fTrackID[2]=-2;
-#endif
+
fClusterCharge = 100;
// 100 micrometers:
return;
}
AliL3ClusterModel *cl = GetClusterModel(row);
- if(!charge)
+
+ //Do not save the cluster if there were no charge found, or only 1 pad is present.
+ //In the latter case it is most probably noise.
+ if(!charge || npads == 1)
cl->fPresent = kFALSE;
else
{
cl->fPresent = kTRUE;
cl->fDTime = (ftime - GetTimeHit(row))/fXYResidualQ;
cl->fDPad = (fpad - GetPadHit(row))/fZResidualQ;
- cl->fDCharge = charge - fClusterCharge;
+ cl->fDCharge = charge;// - fClusterCharge;
cl->fDSigmaY2 = (sigmaY2 - GetParSigmaY2(row))/fXYWidthQ;
cl->fDSigmaZ2 = (sigmaZ2 - GetParSigmaZ2(row))/fZWidthQ;
cl->fNPads = npads;
fNClusters++;
}
-Int_t AliL3ModelTrack::CheckClustersQuality(UInt_t npads)
+Int_t AliL3ModelTrack::GetNPresentClusters()
{
-
- //Check the quality of clusters,- remove clusters with less than
- //npads.
- //Returns the number of good clusters left.
-
+ //Return the number of assigned clusters to the track.
+ //Differs from fNClusters, which should be equal to the
+ //number of padrows in the present patch.
+
Int_t count=0;
for(Int_t i=AliL3Transform::GetFirstRow(fPatch); i<=AliL3Transform::GetLastRow(fPatch); i++)
{
AliL3ClusterModel *cl = GetClusterModel(i);
- if(cl->fNPads < npads)
- cl->fPresent = kFALSE;
if(cl->fPresent)
count++;
}
-
return count;
}
}
-void AliL3ModelTrack::SetTrackID(Int_t row,Int_t *trackID)
-{
-#ifdef do_mc
- AliL3ClusterModel *cluster = GetClusterModel(row);
- cluster->fTrackID[0] = trackID[0];
- cluster->fTrackID[1] = trackID[1];
- cluster->fTrackID[2] = trackID[2];
- return;
-#endif
- cerr<<"AliL3ModelTrack::SetTrackID : Compile with do_mc flag"<<endl;
-}
-
-
void AliL3ModelTrack::SetPadHit(Int_t row,Float_t pad)
{
Int_t index = row-AliL3Transform::GetFirstRow(fPatch);
}
-Int_t AliL3ModelTrack::GetTrackID(Int_t row,Int_t index)
-{
-
-#ifdef do_mc
- AliL3ClusterModel *cl = GetClusterModel(row);
- return cl->fTrackID[index];
-#endif
- cerr<<"AliL3ModelTrack::GetTrackID : Compile with do_mc flag"<<endl;
-}
-
-
Int_t AliL3ModelTrack::GetNPads(Int_t row)
{
AliL3ClusterModel *cl = GetClusterModel(row);
Bool_t AliL3ModelTrack::GetClusterCharge(Int_t row,Int_t &charge)
{
AliL3ClusterModel *cl = GetClusterModel(row);
- charge = (Int_t)cl->fDCharge + fClusterCharge;
+ charge = (Int_t)cl->fDCharge;// + fClusterCharge;
return (Bool_t)cl->fPresent;
}
{
AliL3ClusterModel *cl = GetClusterModel(row);
width = cl->fDSigmaY2*fXYWidthQ + GetParSigmaY2(row);
-
+
return (Bool_t)cl->fPresent;
}
{
AliL3ClusterModel *cl = GetClusterModel(row);
width = cl->fDSigmaZ2*fZWidthQ + GetParSigmaZ2(row);
-
+
return (Bool_t)cl->fPresent;
}
cout<<i<<" Dpad "<<cl->fDPad<<" Dtime "<<cl->fDTime<<" Dcharge "<<cl->fDCharge;
cout<<" DsigmaY2 "<<cl->fDSigmaY2<<" DsigmaZ2 "<<cl->fDSigmaZ2;
cout<<" Padcrossing "<<GetPadHit(i)<<" Timecrossing "<<GetTimeHit(i)<<" ";
- cout<<"Number of pads "<<GetNPads(i)<<endl;
+ cout<<"Number of pads "<<GetNPads(i)<<" Overlapping index "<<GetOverlap(i);
}
- cout<<"Overlapping index "<<GetOverlap(i)<<endl;
+ cout<<endl;
}
}
Double_t prf = AliL3Transform::GetPRFSigma(fPatch);
Double_t diffT = AliL3Transform::GetDiffT();
- Double_t padlength = AliL3Transform::GetPadLength(fPatch);
+ Double_t padlength = AliL3Transform::GetPadLength(row);
Double_t anode = AliL3Transform::GetAnodeWireSpacing();
Double_t beta = GetCrossingAngle(row);
Double_t sigma0 = AliL3Transform::GetTimeSigma();
Double_t diffL = AliL3Transform::GetDiffL();
- Double_t padlength = AliL3Transform::GetPadLength(fPatch);
+ Double_t padlength = AliL3Transform::GetPadLength(row);
Double_t tanl = GetTgl();
Double_t sigmaZ2 = sigma0*sigma0 + diffL*diffL*drift + padlength*padlength * tanl*tanl/12;
//Convert back to raw coodinates:
sigmaZ2 = sigmaZ2/pow(AliL3Transform::GetZWidth(),2);
+
return sigmaZ2;
}
-void AliL3ModelTrack::AssignTrackID(Float_t wrong)
-{
- //Assign a track ID to the track, corresponding to the MC TParticle ID.
- //Can only be done if you compiled with do_mc flag, of course.
- //The function loops over the assigned clusters, and finds the label (ID)
- //of each clusters, and assigns the ID with the most hits to the track.
- //If there are more than wrong% clusters of a different ID, the track is
- //considered to be fake, and label will be assigned as negative.
-
-#ifdef do_mc
- Int_t *lb = new Int_t[GetNClusters()];
- Int_t *mx = new Int_t[GetNClusters()];
-
- Int_t i,j;
- for(Int_t i=0; i<GetNClusters(); i++)
- lb[i]=mx[i]=0;
-
- Int_t lab=123456789;
-
- for(i=0; i<GetNClusters(); i++)
- {
- lab = abs(GetTrackID(i,0));
- for (j=0; j<GetNClusters(); j++)
- if (lb[j]==lab || mx[j]==0) break;
- lb[j]=lab;
- (mx[j])++;
- }
-
- Int_t max=0;
- for (i=0; i<GetNClusters(); i++)
- {
- if(mx[i] > max)
- {
- max=mx[i];
- lab=lb[i];
- }
- }
-
- for (i=0; i<GetNClusters(); i++)
- {
- if(abs(GetTrackID(i,1)) == lab ||
- abs(GetTrackID(i,2)) == lab)
- max++;
- }
-
- if ((1.- Float_t(max)/GetNClusters()) > wrong) lab=-lab;
-
- SetLabel(lab);
-
- delete[] lb;
- delete[] mx;
- return;
-#endif
- cerr<<"AliL3ModelTrack::AssignTrackID : Compile with do_mc flag"<<endl;
-}
void FillModel();
void FillTrack();
void Print();
- void AssignTrackID(Float_t wrong=0.10);
- void SetTrackID(Int_t row,Int_t *trackID);
void SetPadHit(Int_t row,Float_t f);
void SetTimeHit(Int_t row,Float_t f);
void SetOverlap(Int_t row,Int_t id);
void SetXYResolution(Float_t f) {fXYResolution=f;}
void SetZResolution(Float_t f) {fZResolution=f;}
void SetLabel(Int_t i) {fLabel = i;}
- Int_t CheckClustersQuality(UInt_t npads=3);
-
+ Int_t GetNPresentClusters();
- Int_t GetTrackID(Int_t row,Int_t idindex);
AliL3ClusterModel *GetClusters() {return fClusters;}
AliL3TrackModel *GetModel() {return fTrackModel;}
AliL3ClusterModel *GetClusterModel(Int_t row);
fTracks=0;
fTrackThreshold=0;
fPadOverlap=0;
- fTimeOverlap=0;
- fRowData=0;
+ SetOverlap();
+ SetTrackThreshold();
}
{
fSlice = slice;
fPatch = patch;
- fPadOverlap=6;
- fTimeOverlap=8;
-
+
sprintf(fPath,"%s",path);
- AliL3Transform::Init(fPath);
-
fTracks = new AliL3TrackArray("AliL3ModelTrack");
Char_t fname[100];
CalculateCrossingPoints();
- if(!houghtracks)
- CheckForOverlaps();
-
+ CheckForOverlaps();
+
UInt_t ndigits=0;
AliL3DigitRowData *digits=0;
#ifdef use_aliroot
fMemHandler = new AliL3FileHandler();
+ fMemHandler->Init(slice,patch);
if(binary == kFALSE)
{
- sprintf(fname,"%s/digitfile",fPath);
+ sprintf(fname,"%s/digitfile.root",fPath);
fMemHandler->SetAliInput(fname);
digits = fMemHandler->AliDigits2Memory(ndigits);
}
+ else
+ {
+ sprintf(fname,"%sdigits_%d_%d.raw",fPath,fSlice,fPatch);
+ if(!fMemHandler->SetBinaryInput(fname))
+ {
+ cerr<<"AliL3Modeller::Init : Error opening file "<<fname<<endl;
+ return;
+ }
+ digits=(AliL3DigitRowData*)fMemHandler->CompBinary2Memory(ndigits);
+ }
#else
fMemHandler = new AliL3MemHandler();
+ fMemHandler->Init(slice,patch);
if(binary == kFALSE)
{
cerr<<"AliL3Modeller::Init : Compile with AliROOT if you want rootfile as input"<<endl;
fCurrentPadRow = i;
memset((void*)row,0,ntimes*npads*sizeof(Digit));
digPt = (AliL3DigitData*)rowPt->fDigitData;
+ //cout<<"Loading row "<<i<<" with "<<(Int_t)rowPt->fNDigit<<" digits"<<endl;
for(UInt_t j=0; j<rowPt->fNDigit; j++)
{
pad = digPt[j].fPad;
{
AliL3ModelTrack *track = (AliL3ModelTrack*)fTracks->GetCheckedTrack(k);
if(!track) continue;
- //if(track->GetOverlap(i)>=0) continue;//Track is overlapping
if(track->GetPadHit(i)<0 || track->GetTimeHit(i)<0 || track->GetOverlap(i)>=0)
{
break;
}
- /*
- if(row[index].fUsed == kTRUE)//Only use the digits once....
- charge = 0;
- else
- charge = row[index].fCharge;
- */
-
charge = row[index].fCharge;
- if(charge==0 && timesign==-1)
+ if(charge==0 && timesign==-1) //zero charge on this timebin, perform checks:
{
- if(seq_charge==0 && abs(time-hittime) <= fTimeOverlap/2)
+ if(seq_charge==0 && abs(time-hittime) <= fTimeOverlap) //No charge found on this pad, look further.
{
time--;
continue;
}
- else
+ else //Boundary reached, or we have found one end of the sequence,->start looking in the other time direction
{
time = hittime+1;
timesign=1;
continue;
}
}
- else if(charge==0 && timesign==1)
+ else if(charge==0 && timesign==1)//zero charge on this timebin, perform checks:
{
- if(seq_charge==0 && abs(time-hittime) <= fTimeOverlap/2)
+ if(seq_charge==0 && abs(time-hittime) <= fTimeOverlap)//No charge found on this pad, look further
{
time++;
continue;
}
- else
+ else //Boundary reached, or we have found the other end of the sequence, stop looking on this pad.
{
- //cerr<<"Breaking off at pad "<<pad<<" and time "<<time<<endl;
+ //if(fCurrentPadRow==31)
+ // cerr<<"Breaking off at pad "<<pad<<" and time "<<time<<endl;
break;
}
}
- //cout<<"Doing pad "<<pad<<" time "<<time<<" charge "<<charge<<endl;
+ if(row[ntimes*pad+time].fUsed==kTRUE) //Don't use digits several times. This leads to mult. rec.tracks.
+ {
+ time += timesign;
+ continue;
+ }
seq_charge += charge;
-
+
+ //Update the cluster parameters with this timebin
cluster.fTime += time*charge;
cluster.fPad += pad*charge;
cluster.fCharge += charge;
}
- if(seq_charge)//There was something on this pad.
+ if(seq_charge)//There was something on this pad, so keep looking on the neighbouring pad
{
pad += padsign;
npads++;
{
if(padsign==-1)
{
- if(cluster.fCharge==0 && abs(pad-hitpad) <= fPadOverlap/2 && pad > 0)
+ if(cluster.fCharge==0 && abs(pad-hitpad) <= fPadOverlap && pad > 0)
{
pad--; //In this case, we haven't found anything yet,
} //so we will try to expand our search within the natural boundaries.
else if(padsign==1)
{
- if(cluster.fCharge==0 && abs(pad-hitpad) <= fPadOverlap/2 && pad < AliL3Transform::GetNPads(i)-2)
+ if(cluster.fCharge==0 && abs(pad-hitpad) <= fPadOverlap && pad < AliL3Transform::GetNPads(i)-2)
{
pad++; //In this case, we haven't found anything yet,
continue; //so we will try to expand our search within the natural boundaries.
}
else //We are out of range, or cluster if finished.
{
- //cout<<"Outof range; charge "<<cluster.fCharge<<" paddiff "<<abs(pad-hitpad)<<endl;
+ //if(fCurrentPadRow==31)
+ //cout<<"Out of range; charge "<<cluster.fCharge<<" paddiff "<<abs(pad-hitpad)<<endl;
FillCluster(track,&cluster,i,npads);
break;
}
}
else //Nothing more in this cluster
{
+ //if(fCurrentPadRow==31)
//cout<<"Filling final cluster"<<endl;
FillCluster(track,&cluster,i,npads);
break;
}
//cout<<"done"<<endl;
}
-
FillZeros(rowPt,row);
fMemHandler->UpdateRowPointer(rowPt);
}
Float_t sigmaY2,sigmaZ2;
CalcClusterWidth(cluster,sigmaY2,sigmaZ2);
track->SetCluster(row,fpad,ftime,fcharge,sigmaY2,sigmaZ2,npads);
-#ifdef do_mc
- Int_t trackID[3];
- GetTrackID((Int_t)rint(fpad),(Int_t)rint(ftime),trackID);
- track->SetTrackID(fCurrentPadRow,trackID);
-#endif
-}
-
-#ifdef do_mc
-void AliL3Modeller::GetTrackID(Int_t pad,Int_t time,Int_t *trackID)
-{
-
- AliL3DigitRowData *rowPt = (AliL3DigitRowData*)fRowData;
-
- trackID[0]=trackID[1]=trackID[2]=-2;
-
- for(Int_t i=AliL3Transform::GetFirstRow(fPatch); i<=AliL3Transform::GetLastRow(fPatch); i++)
- {
- if(rowPt->fRow < (UInt_t)fCurrentPadRow)
- {
- AliL3MemHandler::UpdateRowPointer(rowPt);
- continue;
- }
- AliL3DigitData *digPt = (AliL3DigitData*)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
void AliL3Modeller::FillZeros(AliL3DigitRowData *rowPt,Digit *row)
{
Char_t fname[100];
AliL3MemHandler *mem = new AliL3MemHandler();
- sprintf(fname,"%s/remains_%d_%d.raw",fPath,fSlice,fPatch);
+ sprintf(fname,"%s/comp/remains_%d_%d.raw",fPath,fSlice,fPatch);
mem->SetBinaryOutput(fname);
mem->Memory2CompBinary((UInt_t)AliL3Transform::GetNRows(fPatch),(AliL3DigitRowData*)data);
mem->CloseBinaryOutput();
}
Float_t hit[3];
-
- //Remove tracks which are no good:
- for(Int_t i=0; i<fTracks->GetNTracks(); i++)
- {
- AliL3ModelTrack *track = (AliL3ModelTrack*)fTracks->GetCheckedTrack(i);
- if(!track) continue;
- if(track->GetFirstPointX() > AliL3Transform::Row2X(AliL3Transform::GetLastRow(fPatch)) || track->GetPt()<0.1)
- fTracks->Remove(i);
- if(track->GetNHits() < fTrackThreshold)
- {
- fTracks->Remove(i);
- continue;
- }
- }
-
Int_t sector,row;
for(Int_t i=AliL3Transform::GetLastRow(fPatch); i>=AliL3Transform::GetFirstRow(fPatch); i--)
{
fTracks->Remove(j);
continue;
}
- //cout<<" x "<<track->GetPointX()<<" y "<<track->GetPointY()<<" z "<<track->GetPointZ()<<endl;
+ //cout<<"X "<<hit[0]<<" Y "<<hit[1]<<" Z "<<hit[2]<<" tgl "<<track->GetTgl()<<endl;
AliL3Transform::Slice2Sector(fSlice,i,sector,row);
AliL3Transform::Local2Raw(hit,sector,row);
+ //cout<<"Pad "<<hit[1]<<" time "<<hit[2]<<" in sector "<<sector<<" row "<<row<<endl;
if(hit[1]<0 || hit[1]>AliL3Transform::GetNPads(i) ||
hit[2]<0 || hit[2]>AliL3Transform::GetNTimeBins())
{//Track is leaving the patch, so flag the track hits (<0)
//Flag the tracks that overlap
cout<<"Checking for overlaps...";
-
+ Int_t counter=0;
for(Int_t i=0; i<fTracks->GetNTracks(); i++)
{
AliL3ModelTrack *track1 = (AliL3ModelTrack*)fTracks->GetCheckedTrack(i);
if(track1->GetPadHit(k)<0 || track1->GetTimeHit(k)<0 ||
track2->GetPadHit(k)<0 || track2->GetTimeHit(k)<0)
continue;
- if(fabs(track1->GetPadHit(k)-track2->GetPadHit(k)) <= fPadOverlap &&
- fabs(track1->GetTimeHit(k)-track2->GetTimeHit(k)) <= fTimeOverlap)
+
+ if(track1->GetOverlap(k)>=0 || track2->GetOverlap(k)>=0) continue;
+
+ if(abs((Int_t)rint(track1->GetPadHit(k))-(Int_t)rint(track2->GetPadHit(k))) <= fPadOverlap &&
+ abs((Int_t)rint(track1->GetTimeHit(k))-(Int_t)rint(track2->GetTimeHit(k))) <= fTimeOverlap)
{
track2->SetOverlap(k,i);
- track1->SetOverlap(k,j);
+ //track1->SetOverlap(k,j);
+ counter++;
}
}
}
}
- cout<<"done"<<endl;
+ cout<<"found "<<counter<<" done"<<endl;
}
void FillCluster(AliL3ModelTrack *track,Cluster *cluster,Int_t row,Int_t npads);
void CalcClusterWidth(Cluster *cl,Float_t &sigmaY2,Float_t &sigmaZ2);
void FillZeros(AliL3DigitRowData *digPt,Digit *row);
-#ifdef do_mc
- void GetTrackID(Int_t pad,Int_t time,Int_t *trackID);
-#endif
public:
void WriteRemaining();
void SetInputData(AliL3DigitRowData *digits) {fRowData = digits;}
- void SetTrackThreshold(Int_t i) {fTrackThreshold=i;}
-
+ void SetTrackThreshold(Int_t i=0) {fTrackThreshold=i;}
+ void SetOverlap(Int_t p=6,Int_t t=8) {fPadOverlap=p;fTimeOverlap=t;}
+
AliL3TrackArray *GetTracks() {return fTracks;}
ClassDef(AliL3Modeller,1) //Modeller class