Changes done to make the Cluser Finder calculate the errors in Pad and Time direction...
authorloizides <loizides@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 7 Jun 2002 16:51:11 +0000 (16:51 +0000)
committerloizides <loizides@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 7 Jun 2002 16:51:11 +0000 (16:51 +0000)
HLT/src/AliL3ClustFinder.cxx
HLT/src/AliL3ClustFinderNew.cxx
HLT/src/AliL3ClustFinderNew.h
HLT/src/AliL3ConfMapTrack.cxx
HLT/src/AliL3MemHandler.cxx
HLT/src/AliL3Merger.cxx
HLT/src/AliL3TrackArray.cxx
HLT/src/AliLevel3.cxx
HLT/src/AliLevel3.h
HLT/src/Makefile

index 07888d2..2f75b14 100644 (file)
@@ -11,7 +11,7 @@
 #include "AliL3SpacePointData.h"
 
 //
-// AliL3ClustFinder
+// AliL3ClusterFinder
 //
 
 
@@ -43,10 +43,10 @@ AliL3ClustFinder::~AliL3ClustFinder()
 }
 
 
-  void AliL3ClustFinder::SetTransformer( AliL3Transform *transform )
-    {
-    fTransform = transform;
-    }
+void AliL3ClustFinder::SetTransformer( AliL3Transform *transform )
+{
+  fTransform = transform;
+}
 
 
 void AliL3ClustFinder::InitSlice(Int_t slice,Int_t patch,Int_t firstrow, Int_t lastrow,Int_t nmaxpoints)
index 32f476b..35c6950 100644 (file)
@@ -29,6 +29,7 @@ AliL3ClustFinderNew::AliL3ClustFinderNew()
   fDeconvPad = kTRUE;
   fDeconvTime = kTRUE;
   fstdout = kFALSE;
+  fcalcerr = kTRUE;
 }
 
 AliL3ClustFinderNew::~AliL3ClustFinderNew()
@@ -43,8 +44,6 @@ void AliL3ClustFinderNew::InitSlice(Int_t slice,Int_t patch,Int_t firstrow, Int_
   fCurrentPatch = patch;
   fFirstRow = firstrow;
   fLastRow = lastrow;
-  //fDeconvTime = kTRUE;
-  //fDeconvPad = kTRUE;
 }
 
 void AliL3ClustFinderNew::InitSlice(Int_t slice,Int_t patch,Int_t nmaxpoints)
@@ -116,7 +115,6 @@ void AliL3ClustFinderNew::ProcessRow(AliL3DigitRowData *tempPt)
            {
              currentPt = pad1;
              previousPt = pad2;
-             
            }
          else 
            {
@@ -134,7 +132,7 @@ void AliL3ClustFinderNew::ProcessRow(AliL3DigitRowData *tempPt)
        }
 
       Bool_t new_cluster = kTRUE;
-      UInt_t seq_charge=0,seq_average=0;
+      UInt_t seq_charge=0,seq_average=0,seq_error=0;
       UInt_t last_charge=0,last_was_falling=0;
       Int_t new_bin=-1;
 
@@ -181,7 +179,8 @@ void AliL3ClustFinderNew::ProcessRow(AliL3DigitRowData *tempPt)
          //Sum the total charge of this sequence
          seq_charge += charge;
          seq_average += data[bin].fTime*charge;
-         
+         seq_error += data[bin].fTime*data[bin].fTime*charge;
+
          //Check where to stop:
          if(data[bin+1].fPad != data[bin].fPad) //new pad
            break; 
@@ -205,6 +204,7 @@ void AliL3ClustFinderNew::ProcessRow(AliL3DigitRowData *tempPt)
       
       //Calculate mean in pad direction:
       Int_t pad_mean = seq_charge*data[bin].fPad;
+      Int_t pad_error = data[bin].fPad*pad_mean;
 
       //Compare with results on previous pad:
       for(UInt_t p=0; p<n_previous; p++)
@@ -213,7 +213,7 @@ void AliL3ClustFinderNew::ProcessRow(AliL3DigitRowData *tempPt)
          if(difference < -fMatch)
            break;
 
-         if(difference <= fMatch)//There is a match here!!
+         if(difference <= fMatch) //There is a match here!!
            {
              
              ClusterData *local = previousPt[p];
@@ -221,9 +221,9 @@ void AliL3ClustFinderNew::ProcessRow(AliL3DigitRowData *tempPt)
                {
                  if(seq_charge > local->fLastCharge)
                    {
-                     if(local->fChargeFalling)//The previous pad was falling
+                     if(local->fChargeFalling) //The previous pad was falling
                        {                       
-                         break;//create a new cluster
+                         break; //create a new cluster
                        }                   
                    }
                  else
@@ -239,7 +239,9 @@ void AliL3ClustFinderNew::ProcessRow(AliL3DigitRowData *tempPt)
              
              local->fTotalCharge += seq_charge;
              local->fPad += pad_mean;
+             local->fPad2 += pad_error;
              local->fTime += seq_average;
+             local->fTime2 += seq_error;
              local->fMean = seq_mean;
              local->fFlags++; //means we have more than one pad 
              
@@ -247,8 +249,8 @@ void AliL3ClustFinderNew::ProcessRow(AliL3DigitRowData *tempPt)
              n_current++;
              
              break;
-           }//Checking for match at previous pad
-       }//Loop over results on previous pad.
+           } //Checking for match at previous pad
+       } //Loop over results on previous pad.
       
       if(new_cluster)
        {
@@ -260,7 +262,9 @@ void AliL3ClustFinderNew::ProcessRow(AliL3DigitRowData *tempPt)
          ClusterData *tmp = &clusterlist[n_total];
          tmp->fTotalCharge = seq_charge;
          tmp->fPad = pad_mean;
+         tmp->fPad2 = pad_error;
          tmp->fTime = seq_average;
+         tmp->fTime2 = seq_error;
          tmp->fMean = seq_mean;
          tmp->fFlags = 0;  //flags for 1 pad clusters
          if(fDeconvPad)
@@ -293,11 +297,20 @@ void AliL3ClustFinderNew::WriteClusters(Int_t n_clusters,ClusterData *list)
       if(list[j].fTotalCharge < fThreshold) continue; //noise cluster
 
       Float_t xyz[3];      
-      Float_t fpad=(Float_t)list[j].fPad/(Float_t)list[j].fTotalCharge;
-      Float_t ftime=(Float_t)list[j].fTime/(Float_t)list[j].fTotalCharge;
+      Float_t fpad =(Float_t)list[j].fPad /(Float_t)list[j].fTotalCharge;
+      Float_t fpad2=fXYErr;
+      Float_t ftime =(Float_t)list[j].fTime /(Float_t)list[j].fTotalCharge;
+      Float_t ftime2=fZErr;
 
+      if(fcalcerr) {
+       fpad2=(Float_t)list[j].fPad2/(Float_t)list[j].fTotalCharge - fpad*fpad;
+       fpad2 = sqrt(fpad2);
+       ftime2=(Float_t)list[j].fTime2/(Float_t)list[j].fTotalCharge - ftime*ftime;
+       ftime2 = sqrt(ftime2); 
+      }
+       
       if(fstdout==kTRUE)
-       cout<<"WriteCluster: padrow "<<fCurrentRow<<" pad "<<fpad<<" time "<<ftime<<" charge "<<list[j].fTotalCharge<<endl;
+       cout<<"WriteCluster: padrow "<<fCurrentRow<<" pad "<<fpad << "+-"<<fpad2<<" time "<<ftime<<"+-"<<ftime2<<" charge "<<list[j].fTotalCharge<<endl;
 
       AliL3Transform::Slice2Sector(fCurrentSlice,fCurrentRow,thissector,thisrow);
       AliL3Transform::Raw2Local(xyz,thissector,thisrow,fpad,ftime);
@@ -314,8 +327,8 @@ void AliL3ClustFinderNew::WriteClusters(Int_t n_clusters,ClusterData *list)
       fSpacePointData[counter].fY = xyz[1];
       fSpacePointData[counter].fZ = xyz[2];
       fSpacePointData[counter].fPadRow = fCurrentRow;
-      fSpacePointData[counter].fXYErr = fXYErr;
-      fSpacePointData[counter].fZErr = fZErr;
+      fSpacePointData[counter].fXYErr = fpad2;
+      fSpacePointData[counter].fZErr  = ftime2;
       fSpacePointData[counter].fID = counter
        +((fCurrentSlice&0x7f)<<25)+((fCurrentPatch&0x7)<<22);//Uli
 #ifdef do_mc
index cfbd68b..ff0ebec 100644 (file)
@@ -9,6 +9,8 @@ struct ClusterData
   UInt_t fTotalCharge;
   UInt_t fPad;
   UInt_t fTime;
+  UInt_t fPad2;  //for error in XY direction
+  UInt_t fTime2; //for error in Z  direction
   UInt_t fMean;
   UInt_t fFlags;
   UInt_t fChargeFalling; //for deconvolution
@@ -27,6 +29,9 @@ class AliL3ClustFinderNew {
   AliL3SpacePointData *fSpacePointData; //!
   Bool_t fDeconvTime;
   Bool_t fDeconvPad;
+  Bool_t fstdout;
+  Bool_t fcalcerr;
+
   UInt_t fNDigitRowData;
   Int_t fFirstRow;
   Int_t fLastRow;
@@ -39,7 +44,6 @@ class AliL3ClustFinderNew {
   Int_t fMaxNClusters;
   Float_t fXYErr;
   Float_t fZErr;
-  Bool_t fstdout;
 
 #ifdef do_mc
   void GetTrackID(Int_t pad,Int_t time,Int_t *trackID);
@@ -63,6 +67,7 @@ class AliL3ClustFinderNew {
   void SetThreshold(UInt_t i) {fThreshold=i;}
   void SetMatchWidth(UInt_t i) {fMatch=i;}
   void SetSTDOutput(Bool_t f=kFALSE) {fstdout=f;}  
+  void SetCalcErr(Bool_t f=kTRUE) {fcalcerr=f;}
 
   Int_t GetNumberOfClusters() {return fNClusters;}
   
@@ -71,4 +76,3 @@ class AliL3ClustFinderNew {
 };
 
 #endif
-
index d9f179a..793cde2 100644 (file)
@@ -26,7 +26,6 @@ AliL3ConfMapTrack::AliL3ConfMapTrack()
 
   fChiSq[0] = 0.;
   fChiSq[1] = 0.;
-
 }
 
 AliL3ConfMapTrack::~AliL3ConfMapTrack()
@@ -102,7 +101,6 @@ void AliL3ConfMapTrack::Reset()
   fChiSq[1] = 0; 
   SetLength(0);
   SetNHits(0);
-  
 }
 
 void AliL3ConfMapTrack::UpdateParam(AliL3ConfMapPoint *thisHit)
@@ -153,7 +151,6 @@ void AliL3ConfMapTrack::UpdateParam(AliL3ConfMapPoint *thisHit)
     a1Sz  = ( g1Sz * s22Sz - g2Sz * s12Sz ) / ddSz ;
     a2Sz  = ( g2Sz * s11Sz - g1Sz * s12Sz ) / ddSz ;
   }
-      
 }
 
 
@@ -185,7 +182,6 @@ void AliL3ConfMapTrack::Fill(AliL3Vertex *vertex,Double_t max_Dca)
       LOG(AliL3Log::kError,"AliL3ConfMapTrack::Fill","Tracks")<<AliL3Log::kDec<<
        "Track with pt<max_Dca :"<<GetPt()<<ENDLOG;
     }
-  
 }
 
 void AliL3ConfMapTrack::UpdateToFirstPoint()
index abec49a..27f69d4 100644 (file)
@@ -1182,6 +1182,7 @@ Bool_t AliL3MemHandler::TrackArray2Binary(AliL3TrackArray *array)
     return kFALSE;
   }
   AliL3TrackSegmentData *data = (AliL3TrackSegmentData *)Allocate(array);
+
   UInt_t ntrack;
   TrackArray2Memory(ntrack,data,array);
   Memory2Binary(ntrack,data);
@@ -1224,6 +1225,7 @@ Bool_t AliL3MemHandler::TrackArray2Memory(UInt_t & ntrack,AliL3TrackSegmentData
     <<"Pointer to AliL3TrackArray = 0x0 "<<ENDLOG;
     return kFALSE;
   }
+
   array->WriteTracks(ntrack,data);
   return kTRUE;
 }
index a015c46..2c5f5e7 100644 (file)
@@ -359,30 +359,30 @@ Double_t AliL3Merger::TrackDiff(AliL3Track *innertrack,AliL3Track *outertrack){
   return diff; 
 }
 
-
-
-void AliL3Merger::PrintDiff(AliL3Track *innertrack,AliL3Track *outertrack){
+void AliL3Merger::PrintDiff(AliL3Track *innertrack,AliL3Track *outertrack)
+{
   if(!innertrack->IsPoint()||!outertrack->IsPoint()){
-    cerr<<"AliL3Merger::PrintDiff: No Points"<<endl;
-    cerr<<"---------------------------"<<endl;
+    LOG(AliL3Log::kInformational,"AliL3Merger::PrintDiff","No Points")<<ENDLOG;
+    //cerr<<"AliL3Merger::PrintDiff: No Points"<<endl;
+    //cerr<<"---------------------------"<<endl;
     return;
   } 
+
   Double_t dx = innertrack->GetPointX()-outertrack->GetPointX();
   Double_t dy = innertrack->GetPointY()-outertrack->GetPointY();
   Double_t dz = innertrack->GetPointZ()-outertrack->GetPointZ();
   Double_t dk = innertrack->GetKappa()-outertrack->GetKappa();
-    Double_t dpsi= innertrack->GetPointPsi() - outertrack->GetPointPsi();
-    if(dpsi>PI) dpsi-=2*PI;
-    if(dpsi<-PI)dpsi+=2*PI;
-//  Double_t dpsi = GetAngle(innertrack->GetPointPsi(),outertrack->GetPointPsi());
+  Double_t dpsi= innertrack->GetPointPsi() - outertrack->GetPointPsi();
+  if(dpsi>PI) dpsi-=2*PI;
+  if(dpsi<-PI)dpsi+=2*PI;
+  //Double_t dpsi = GetAngle(innertrack->GetPointPsi(),outertrack->GetPointPsi());
   Double_t dtgl= innertrack->GetTgl()-outertrack->GetTgl();
   Double_t dq =innertrack->GetCharge()-outertrack->GetCharge();
 
-  fprintf(stderr,"dx: %4f dy: %4f dz: %4f dk: %4f dpsi: %4f dtgl: %4f dq: %4f\n",
-      dx,dy,dz,dk,dpsi,dtgl,dq);
-cerr<<"---------------------------"<<endl;
-//  cerr<<endl; 
-
+  LOG(AliL3Log::kInformational,"AliL3Merger::PrintDiff","Points") <<"dx: "<<dx<<" dy: "<<dy<<" dz: "<<dz<<" dk: "<<dk<<" dpsi: "<<dpsi<<" dtgl: "<<dtgl<<" dq: "<<dq<<ENDLOG;
+  //fprintf(stderr,"dx: %4f dy: %4f dz: %4f dk: %4f dpsi: %4f dtgl: %4f dq: %4f\n",dx,dy,dz,dk,dpsi,dtgl,dq);
+  //cerr<<"---------------------------"<<endl;
+  
 }
 
 void AliL3Merger::Print(){
@@ -403,12 +403,13 @@ void AliL3Merger::Print(){
 //      PrintTrack(track);
 //      track->CalculateReferencePoint(PI/180.);
       track->CalculateReferencePoint(0.001);
-      fprintf(stderr,"npt: %3d dx: %8.5f dy: %8.5f dz: %8.5f\n",
-        track->GetNHits(),(float)track->GetPointX()-track->GetPointX(),
-                          (float)track->GetPointY()-track->GetPointY(),
-                          (float)track->GetPointZ()-track->GetPointZ());
+      Float_t dx=(float)track->GetPointX()-track->GetPointX();
+      Float_t dy=(float)track->GetPointY()-track->GetPointY();
+      Float_t dz=(float)track->GetPointZ()-track->GetPointZ();
+      LOG(AliL3Log::kInformational,"AliL3Merger::Print","RefPoint") <<"npt: "<<track->GetNHits()<<" dx: "<<dx<<" dy: "<<dy<<" dz: "<<dz<<ENDLOG;
 
-      cerr<<"---------------------------"<<endl;
+      //fprintf(stderr,"npt: %3d dx: %8.5f dy: %8.5f dz: %8.5f\n",track->GetNHits(),dx,dy,dz);
+      //cerr<<"---------------------------"<<endl;
       }
     }  
   }
@@ -430,7 +431,3 @@ void AliL3Merger::PrintTrack(AliL3Track *track){
       track->GetPointPsi());
   }
 }
-
-
-
-
index b179dae..a467292 100644 (file)
@@ -66,7 +66,6 @@ AliL3TrackArray::AliL3TrackArray(char* tracktype){
   SetSize();
 }
 
-
 AliL3TrackArray::~AliL3TrackArray(){
   //Destructor
   DeleteArray();
@@ -268,6 +267,7 @@ UInt_t AliL3TrackArray::WriteTracks(AliL3TrackSegmentData* tr){
     tP->fTgl = track->GetTgl();
     tP->fCharge = track->GetCharge();
     tP->fNPoints = track->GetNHits();
+
     pP = (UInt_t*)track->GetHitNumbers();
     for (UInt_t j=0;j<tP->fNPoints;j++){
       tP->fPointIDs[j] = pP[j];
@@ -327,7 +327,6 @@ void AliL3TrackArray::AddLast(AliL3Track *track)
   
 }
 
-
 void AliL3TrackArray::AddTracks(AliL3TrackArray *newtrack,Bool_t remove_old,Int_t slice)
 {
   if(GetTrackType() != newtrack->GetTrackType() && GetTrackType()!='t')
index 5da6397..24c870d 100644 (file)
@@ -367,6 +367,8 @@ void AliLevel3::ProcessSlice(Int_t slice){
       fClusterFinder->SetDeconv(fClusterDeconv);
       fClusterFinder->SetXYError(fXYClusterError);
       fClusterFinder->SetZError(fZClusterError);
+      if((fXYClusterError>0)&&(fZClusterError>0))
+       fClusterFinder->SetCalcErr(kFALSE);
       fClusterFinder->SetOutputArray(points);
       fClusterFinder->Read(ndigits,digits);
       fBenchmark->Start("Cluster Finder");
@@ -374,7 +376,7 @@ void AliLevel3::ProcessSlice(Int_t slice){
       fBenchmark->Stop("Cluster Finder");
       npoints = fClusterFinder->GetNumberOfClusters();
       delete fClusterFinder;
-      fClusterFinder =0;
+      fClusterFinder = 0;
       fFileHandler->Free();
       LOG(AliL3Log::kInformational,"AliLevel3::ProcessSlice","Cluster Finder")
         <<AliL3Log::kDec<<"Found "<<npoints<<" Points"<<ENDLOG;
index bd6ed73..e7adf35 100644 (file)
@@ -64,14 +64,16 @@ class AliLevel3 : public TObject {
   Bool_t fUseBinary;
   Bool_t fWriteOut;
 
+  Bool_t fClusterDeconv;
   Float_t fXYClusterError;
   Float_t fZClusterError;
-  Bool_t fClusterDeconv;
+
 
   void WriteSpacePoints(UInt_t npoints,AliL3SpacePointData *points,
                                           Int_t slice,Int_t patch);
-  void WriteResults();
   Int_t WriteTracks(char *filename,AliL3Merger *merger,char opt='o');  
+  void WriteResults();
+
   void SetPath(char *p){sprintf(fPath,"%s",p);}
 
  public:
@@ -106,3 +108,8 @@ class AliLevel3 : public TObject {
 };
 
 #endif
+
+
+
+
+
index 49d751d..0b373da 100644 (file)
@@ -40,6 +40,7 @@ endif
 
 #Save the particle id's
 #DEFSTR += -Ddo_mc
+DEFSTR += $(EXTRADEF)
 
 #Use logging classes
 ifndef NOLOGGING
@@ -58,8 +59,8 @@ SRCS  = AliL3ConfMapper.cxx AliL3ConfMapPoint.cxx AliLevel3.cxx\
           AliL3Vertex.cxx AliL3VertexFinder.cxx \
           AliL3Merger.cxx AliL3GlobalMerger.cxx AliL3ClustFinderNew.cxx \
           AliL3TrackArray.cxx AliL3InterMerger.cxx AliL3Logger.cxx \
-          AliL3MemHandler.cxx  AliL3Benchmark.cxx AliL3Display.cxx\
-          AliL3Evaluate.cxx
+          AliL3MemHandler.cxx  AliL3Benchmark.cxx AliL3Display.cxx
+
 
 DICT = AliL3Cint.cxx
 DICTH = AliL3Cint.h