From: vestbo Date: Fri, 5 Jul 2002 16:08:03 +0000 (+0000) Subject: Added possibility to compile and run with mc information. This was done X-Git-Url: http://git.uio.no/git/?p=u%2Fmrichter%2FAliRoot.git;a=commitdiff_plain;h=8487f697c7fe7de0ce8820cdc4770f03d6a3609a Added possibility to compile and run with mc information. This was done by adding a new data member to AliL3ClusterModel (in AliL3Models.h), and a function AliL3Modeller::GetTrackID. --- diff --git a/HLT/comp/AliL3Compress.cxx b/HLT/comp/AliL3Compress.cxx index dc636f82842..a4b35efbe02 100644 --- a/HLT/comp/AliL3Compress.cxx +++ b/HLT/comp/AliL3Compress.cxx @@ -129,7 +129,7 @@ void AliL3Compress::ReadFile(Char_t which) delete fTracks; fTracks = new AliL3TrackArray("AliL3ModelTrack"); - cout<<"Reading file "<NextTrack(); @@ -146,7 +146,7 @@ void AliL3Compress::ReadFile(Char_t which) } fTracks->RemoveLast(); - cout<<"Read "<GetNTracks()<<" tracks from file"<GetNTracks()<<" tracks from file"< #include +#include #include #include "AliL3ModelTrack.h" @@ -26,6 +27,7 @@ AliL3ModelTrack::AliL3ModelTrack() fTime=0; fClusterCharge=0; fTrackModel=0; + fLabel=0; } @@ -54,14 +56,17 @@ void AliL3ModelTrack::Init(Int_t slice,Int_t patch) fTime = new Float_t[nrows]; fTrackModel = new AliL3TrackModel; fOverlap = new Int_t[nrows]; - + memset(fClusters,0,nrows*sizeof(AliL3ClusterModel)); memset(fPad,0,nrows*sizeof(Float_t)); memset(fTime,0,nrows*sizeof(Float_t)); memset(fTrackModel,0,sizeof(AliL3TrackModel)); for(Int_t i=0; ifTrackID[0] = trackID[0]; + cluster->fTrackID[1] = trackID[1]; + cluster->fTrackID[2] = trackID[2]; + return; +#endif + cerr<<"AliL3ModelTrack::SetTrackID : Compile with do_mc flag"<fTrackID[index]; +#endif + cerr<<"AliL3ModelTrack::GetTrackID : Compile with do_mc flag"< max) + { + max=mx[i]; + lab=lb[i]; + } + } + + for (i=0; i wrong) lab=-lab; + + SetLabel(lab); + + delete[] lb; + delete[] mx; + return; +#endif + cerr<<"AliL3ModelTrack::AssignTrackID : Compile with do_mc flag"<SetBinaryInput(fname)) { cerr<<"AliL3Modeller::Init : Error opening trackfile: "<SetAliInput(fname); + digits = fMemHandler->AliDigits2Memory(ndigits); + } +#else fMemHandler = new AliL3MemHandler(); - sprintf(fname,"%sdigits_%d_%d.raw",fPath,fSlice,fPatch); - if(!fMemHandler->SetBinaryInput(fname)) + if(binary == kFALSE) { - cerr<<"AliL3Modeller::Init : Error opening file "<CompBinary2Memory(ndigits); + else + { + sprintf(fname,"%sdigits_%d_%d.raw",fPath,fSlice,fPatch); + if(!fMemHandler->SetBinaryInput(fname)) + { + cerr<<"AliL3Modeller::Init : Error opening file "<CompBinary2Memory(ndigits); +#endif SetInputData(digits); } @@ -138,6 +161,7 @@ void AliL3Modeller::FindClusters() for(Int_t i=AliL3Transform::GetFirstRow(fPatch); i<=AliL3Transform::GetLastRow(fPatch); i++) { + fCurrentPadRow = i; memset((void*)row,0,ntimes*npads*sizeof(Digit)); digPt = (AliL3DigitData*)rowPt->fDigitData; for(UInt_t j=0; jfNDigit; j++) @@ -324,8 +348,44 @@ void AliL3Modeller::FillCluster(AliL3ModelTrack *track,Cluster *cluster,Int_t ro 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; jfNDigit; 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) { diff --git a/HLT/comp/AliL3Modeller.h b/HLT/comp/AliL3Modeller.h index 59fd30fbf6b..e2210eb27b2 100644 --- a/HLT/comp/AliL3Modeller.h +++ b/HLT/comp/AliL3Modeller.h @@ -32,6 +32,7 @@ class AliL3Modeller { Int_t fNClusters; Int_t fMaxClusters; + Int_t fCurrentPadRow; Float_t fPadOverlap; Float_t fTimeOverlap; @@ -44,13 +45,16 @@ class AliL3Modeller { 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: AliL3Modeller(); virtual ~AliL3Modeller(); - void Init(Int_t slice,Int_t patch,Char_t *trackdata,Char_t *path,Bool_t houghtracks=kFALSE); + void Init(Int_t slice,Int_t patch,Char_t *trackdata,Char_t *path,Bool_t houghtracks,Bool_t binary=kTRUE); void FindClusters(); void CheckForOverlaps(); void CalculateCrossingPoints(); diff --git a/HLT/comp/AliL3Models.h b/HLT/comp/AliL3Models.h index 529b10a8bca..64a0b5ba527 100644 --- a/HLT/comp/AliL3Models.h +++ b/HLT/comp/AliL3Models.h @@ -13,6 +13,9 @@ struct AliL3ClusterModel { Float_t fDSigmaY2; Float_t fDSigmaZ2; UInt_t fNPads; +#ifdef do_mc + Int_t fTrackID[3]; +#endif }; typedef struct AliL3ClusterModel AliL3ClusterModel;