Introduction of ITS clustrerer for HLT. Improved version of the fast ITS vertexer...
authorcvetan <cvetan@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 29 Nov 2004 09:46:14 +0000 (09:46 +0000)
committercvetan <cvetan@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 29 Nov 2004 09:46:14 +0000 (09:46 +0000)
HLT/ITS/AliL3ITSLinkDef.h
HLT/ITS/AliL3ITSVertexerZ.cxx
HLT/ITS/AliL3ITSVertexerZ.h
HLT/ITS/AliL3ITSclusterer.cxx [new file with mode: 0644]
HLT/ITS/AliL3ITSclusterer.h [new file with mode: 0644]
HLT/ITS/AliL3ITStracker.cxx
HLT/libAliL3ITS.pkg

index 9240100..ed3665e 100644 (file)
@@ -9,6 +9,7 @@
 #pragma link C++ class AliL3ITStrack; 
 #pragma link C++ class AliL3ITStracker; 
 #pragma link C++ class AliL3ITSVertexerZ;
+#pragma link C++ class AliL3ITSclusterer;
 #endif
 
 #endif
index 02b3a42..90abaa7 100644 (file)
@@ -21,6 +21,7 @@
 #include "AliITSLoader.h"
 #include <AliITSgeom.h>
 #include <AliITSRecPoint.h>
+#include <AliITSclusterV2.h>
 
 //-------------------------------------------------------------------------
 //                Implementation of the HLT ITS vertexer class
 
 ClassImp(AliL3ITSVertexerZ)
 
+AliL3ITSVertexerZ::AliL3ITSVertexerZ():AliITSVertexerZ(){
+  // Constructor in case that there is no runloader
+
+  SetDiffPhiMax();
+  fX0 = 0;
+  fY0 = 0;
+  SetFirstLayerModules();
+  SetSecondLayerModules();
+  fZFound = 0;
+  fZsig = 0.;
+  fITS = 0;
+  fZCombc = 0;
+  fZCombf = 0;
+  SetLowLimit();
+  SetHighLimit();
+  SetBinWidthCoarse();
+  SetBinWidthFine();
+  SetTolerance();
+  SetDebug();
+}
+
 AliL3ITSVertexerZ::AliL3ITSVertexerZ(TString filename,Float_t x0, Float_t y0):AliITSVertexerZ(filename,x0,y0)
 {
   // Standard Constructor
@@ -58,46 +80,38 @@ AliESDVertex* AliL3ITSVertexerZ::FindVertexForCurrentEvent(Int_t evnumber){
   AliITSgeom *geom = fITS->GetITSgeom();
 
   TTree *tR = itsLoader->TreeR();
-  TClonesArray *itsRec  = 0;
+
+  return FindVertexForCurrentEvent(geom,tR);
+}
+
+//______________________________________________________________________
+AliESDVertex* AliL3ITSVertexerZ::FindVertexForCurrentEvent(AliITSgeom *geom,TTree *tR){
+  // Defines the AliESDVertex for the current event
+
+  fCurrentVertex = 0;
+
   Float_t lc[3]; for(Int_t ii=0; ii<3; ii++) lc[ii]=0.;
   Float_t gc[3]; for(Int_t ii=0; ii<3; ii++) gc[ii]=0.;
   Float_t lc2[3]; for(Int_t ii=0; ii<3; ii++) lc2[ii]=0.;
   Float_t gc2[3]; for(Int_t ii=0; ii<3; ii++) gc2[ii]=0.;
 
-  itsRec = fITS->RecPoints();
-
-  //cout<<"Address of itsRec = "<<itsRec<<endl;
   TClonesArray dummy("AliITSclusterV2",10000), *clusters=&dummy;
   TBranch *branch;
-  if(fUseV2Clusters){
-    branch = tR->GetBranch("Clusters");
-    branch->SetAddress(&clusters);
-  }
-  else {
-    branch = tR->GetBranch("ITSRecPoints");
-  }
-
+  branch = tR->GetBranch("Clusters");
+  branch->SetAddress(&clusters);
 
   Int_t nrpL1 = 0;
   Int_t nrpL2 = 0;
   for(Int_t module= fFirstL1; module<=fLastL1;module++){
     if(module%4==0 || module%4==3)continue;
     //   cout<<"Procesing module "<<module<<" ";
-    branch->GetEvent(module);
+    tR->GetEvent(module);
     //    cout<<"Number of clusters "<<clusters->GetEntries()<<endl;
-    if(fUseV2Clusters){
-      Clusters2RecPoints(clusters,module,itsRec);
-    }
-    nrpL1+= itsRec->GetEntries();
-    fITS->ResetRecPoints();
+    nrpL1+= clusters->GetEntriesFast();
   }
   for(Int_t module= fFirstL2; module<=fLastL2;module++){
-    branch->GetEvent(module);
-    if(fUseV2Clusters){
-      Clusters2RecPoints(clusters,module,itsRec);
-    }
-    nrpL2+= itsRec->GetEntries();
-    fITS->ResetRecPoints();
+    tR->GetEvent(module);
+    nrpL2+= clusters->GetEntriesFast();
   }
   if(nrpL1 == 0 || nrpL2 == 0){
     ResetHistograms();
@@ -125,19 +139,20 @@ AliESDVertex* AliL3ITSVertexerZ::FindVertexForCurrentEvent(Int_t evnumber){
     phi2[i] = new Float_t [maxind2];
     r2[i] = new Float_t [maxind2];
   }
+  
+  Float_t yshift = 0;
+  Float_t zshift[4] = {-10.708000, -3.536000, 3.536000, 10.708000};
 
+  yshift = 0.248499;
   memset(ind1,0,nPhiBins*sizeof(Int_t));
   for(Int_t module= fFirstL1; module<=fLastL1;module++){
     if(module%4==0 || module%4==3)continue;
-    branch->GetEvent(module);
-    if(fUseV2Clusters){
-      Clusters2RecPoints(clusters,module,itsRec);
-    }
-    Int_t nrecp1 = itsRec->GetEntries();
+    tR->GetEvent(module);
+    Int_t nrecp1 = clusters->GetEntriesFast();
     for(Int_t j=0;j<nrecp1;j++){
-      AliITSRecPoint *recp = (AliITSRecPoint*)itsRec->At(j);
-      lc[0]=recp->GetX();
-      lc[2]=recp->GetZ();
+      AliITSclusterV2 *recp = (AliITSclusterV2*)clusters->UncheckedAt(j);
+      lc[0]=-recp->GetY()+yshift;
+      lc[2]=-recp->GetZ()+zshift[module%4];
       geom->LtoG(module,lc,gc);
       gc[0]-=fX0;
       gc[1]-=fY0;
@@ -147,6 +162,7 @@ AliESDVertex* AliL3ITSVertexerZ::FindVertexForCurrentEvent(Int_t evnumber){
       Float_t phi = TMath::ATan2(gc[1],gc[0]);
       if(phi<0)phi=2*TMath::Pi()+phi;
       Int_t bin = (Int_t)(phi/phiBinSize);
+      if(bin>=nPhiBins || bin<0) bin = 0;
       Int_t ind = ind1[bin];
       if(ind<maxind1) {
        phi1[bin][ind] = phi;
@@ -155,19 +171,17 @@ AliESDVertex* AliL3ITSVertexerZ::FindVertexForCurrentEvent(Int_t evnumber){
        ind1[bin]++;
       }
     }
-    fITS->ResetRecPoints();
+    clusters->Delete();
   }
+  yshift = 3.096207;
   memset(ind2,0,nPhiBins*sizeof(Int_t));
   for(Int_t module= fFirstL2; module<=fLastL2;module++){
-    branch->GetEvent(module);
-    if(fUseV2Clusters){
-      Clusters2RecPoints(clusters,module,itsRec);
-    }
-    Int_t nrecp2 = itsRec->GetEntries();
+    tR->GetEvent(module);
+    Int_t nrecp2 = clusters->GetEntriesFast();
     for(Int_t j=0;j<nrecp2;j++){
-      AliITSRecPoint *recp = (AliITSRecPoint*)itsRec->At(j);
-      lc[0]=recp->GetX();
-      lc[2]=recp->GetZ();
+      AliITSclusterV2 *recp = (AliITSclusterV2*)clusters->UncheckedAt(j);
+      lc[0]=recp->GetY()+yshift;
+      lc[2]=-recp->GetZ()+zshift[module%4];
       geom->LtoG(module,lc,gc);
       gc[0]-=fX0;
       gc[1]-=fY0;
@@ -177,7 +191,7 @@ AliESDVertex* AliL3ITSVertexerZ::FindVertexForCurrentEvent(Int_t evnumber){
       Float_t phi = TMath::ATan2(gc[1],gc[0]);
       if(phi<0)phi=2*TMath::Pi()+phi;
       Int_t bin = (Int_t)(phi/phiBinSize+0.5);
-      if(bin==nPhiBins) bin = 0;
+      if(bin>=nPhiBins || bin<0) bin = 0;
       Int_t ind = ind2[bin];
       if(ind<maxind2) {
        phi2[bin][ind] = phi;
@@ -186,11 +200,10 @@ AliESDVertex* AliL3ITSVertexerZ::FindVertexForCurrentEvent(Int_t evnumber){
        ind2[bin]++;
       }
     }
-    fITS->ResetRecPoints();
+    clusters->Delete();
   }
   Int_t nbinfine = static_cast<Int_t>((fHighLim-fLowLim)/fStepFine);
   Float_t lowz = fLowLim/fStepFine;
-  Float_t highz = fHighLim/fStepFine;
   Int_t *harray = new Int_t[nbinfine];
   memset(harray,0,nbinfine*sizeof(Int_t));
   for(Int_t ibin=0;ibin<nPhiBins;ibin++) {
@@ -209,8 +222,8 @@ AliESDVertex* AliL3ITSVertexerZ::FindVertexForCurrentEvent(Int_t evnumber){
          if(diff>TMath::Pi())diff=2.*TMath::Pi()-diff;
          if(diff<fDiffPhiMax){
            Float_t zr0=(pr2[j]*pzc1[i]-pr1[i]*pzc2[j])/(pr2[j]-pr1[i]);
-           if(zr0>lowz && zr0<highz) {
-             Int_t bin = (Int_t)(zr0-lowz);
+           Int_t bin = (Int_t)(zr0-lowz);
+           if(bin>=0 && bin<nbinfine){
              harray[bin]++;
            }
          }
index 38a63ca..c265a33 100644 (file)
 #include "AliITSVertexerZ.h"
 
 class TString;
+class TTree;
+class AliITSgeom;
 
 //-------------------------------------------------------------------------
 class AliL3ITSVertexerZ : public AliITSVertexerZ {
 public:
-  AliL3ITSVertexerZ():AliITSVertexerZ() {;}
+  AliL3ITSVertexerZ();
   AliL3ITSVertexerZ(TString filename,Float_t x0=0., Float_t y0=0.);
 
   AliESDVertex* FindVertexForCurrentEvent(Int_t evnumb);
+  AliESDVertex* FindVertexForCurrentEvent(AliITSgeom *geom,TTree *tR);
 
   ClassDef(AliL3ITSVertexerZ,1)   //HLT ITS vertexer
 };
diff --git a/HLT/ITS/AliL3ITSclusterer.cxx b/HLT/ITS/AliL3ITSclusterer.cxx
new file mode 100644 (file)
index 0000000..243b233
--- /dev/null
@@ -0,0 +1,83 @@
+/**************************************************************************
+ * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ *                                                                        *
+ * Author: The ALICE Off-line Project.                                    *
+ * Contributors are mentioned in the code where appropriate.              *
+ *                                                                        *
+ * 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.                  *
+ **************************************************************************/
+
+//-------------------------------------------------------------------------
+//               Implementation of the HLT ITS clusterer class
+//    The class derives from AliITSclustererV2.
+//    There is one new method added which allows to read ITS raw data
+//    and store the clusters in a tree without using runloaders.
+//    In this case, the labels filling is skipped.
+//          Origin: Cvetan Cheshkov, CERN, Cvetan.Cheshkov@cern.ch
+//-------------------------------------------------------------------------
+
+#include "AliL3ITSclusterer.h"
+#include "AliRawReader.h"
+#include "AliITSgeom.h"
+#include "../RAW/AliITSRawStreamSPD.h"
+#include "../RAW/AliITSRawStreamSDD.h"
+#include "../RAW/AliITSRawStreamSSD.h"
+#include <TTree.h>
+#include <TClonesArray.h>
+
+ClassImp(AliL3ITSclusterer)
+
+AliL3ITSclusterer::AliL3ITSclusterer(const AliITSgeom *geom):AliITSclustererV2(geom)
+{
+fNModule = geom->GetIndexMax();
+}
+
+void AliL3ITSclusterer::Digits2Clusters(AliRawReader* rawReader,TTree *cTree)
+{
+
+  TClonesArray *array=new TClonesArray("AliITSclusterV2",1000);
+  cTree->Branch("Clusters",&array);
+  delete array;
+
+  TClonesArray** clusters = new TClonesArray*[fNModule]; 
+  for (Int_t iModule = 0; iModule < fNModule; iModule++) {
+    clusters[iModule] = NULL;
+  }
+
+  rawReader->Reset();
+  AliITSRawStreamSPD inputSPD(rawReader);
+  FindClustersSPD(&inputSPD, clusters);
+
+  rawReader->Reset();
+  AliITSRawStreamSDD inputSDD(rawReader);
+  FindClustersSDD(&inputSDD, clusters);
+
+  rawReader->Reset();
+  AliITSRawStreamSSD inputSSD(rawReader);
+  FindClustersSSD(&inputSSD, clusters);
+
+  // write all clusters to the tree
+  Int_t nClusters = 0;
+  for (Int_t iModule = 0; iModule < fNModule; iModule++) {
+    array = clusters[iModule];
+    if (!array) {
+      Error("Digits2Clusters", "data for module %d missing!", iModule);
+      array = new TClonesArray("AliITSclusterV2");
+    }
+    cTree->SetBranchAddress("Clusters", &array);
+    cTree->Fill();
+    nClusters += array->GetEntriesFast();
+    delete array;
+  }
+
+  delete[] clusters;
+
+  Info("Digits2Clusters", "total number of found clusters in ITS: %d\n", 
+       nClusters);
+}
diff --git a/HLT/ITS/AliL3ITSclusterer.h b/HLT/ITS/AliL3ITSclusterer.h
new file mode 100644 (file)
index 0000000..254a4c8
--- /dev/null
@@ -0,0 +1,35 @@
+#ifndef ALIL3ITSCLUSTERER_H
+#define ALIL3ITSCLUSTERER_H
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               */
+
+//-------------------------------------------------------------------------
+//                          High Level Trigger ITS clusterer
+//       This class derives completely from the off-line AliITSclustererV2.
+//       The only difference is in the interface of calling it and stoting
+//       the clusters's tree.
+//      
+//           Origin: Cvetan Cheshkov, CERN, Cvetan.Cheshkov@cern.ch 
+//-------------------------------------------------------------------------
+
+#include "AliITSclustererV2.h"
+
+class TTree;
+class AliITSgeom;
+class AliRawReader;
+
+//-------------------------------------------------------------------------
+class AliL3ITSclusterer : public AliITSclustererV2 {
+public:
+  AliL3ITSclusterer():AliITSclustererV2(){fNModule = 0;}
+  AliL3ITSclusterer(const AliITSgeom *geom);
+
+  void Digits2Clusters(AliRawReader* rawReader,TTree *cTree);
+
+private:
+  Int_t fNModule;             // total number of modules
+  ClassDef(AliL3ITSclusterer,1)   //HLT ITS clusterer
+};
+
+#endif
index f9a6385..0ded844 100644 (file)
@@ -106,10 +106,11 @@ Int_t AliL3ITStracker::Clusters2Tracks(AliESD *event) {
   for (fPass=0; fPass<2; fPass++) {
      Int_t &constraint=fConstraint[fPass]; if (constraint<0) continue;
      for (Int_t i=0; i<nentr; i++) {
+       //       Info("Clusters2Tracks"," %d ",i);
        AliL3ITStrack *t=(AliL3ITStrack*)itsTracks.UncheckedAt(i);
        if (t==0) continue;              //this track has been already tracked
        Int_t tpcLabel=t->GetLabel(); //save the TPC track label
-
+       //       Info("Clusters2Tracks","Pt:%f",1/t->Get1Pt());
        ResetTrackToFollow(*t);
        ResetBestTrack();
 
@@ -123,8 +124,10 @@ Int_t AliL3ITStracker::Clusters2Tracks(AliESD *event) {
         ResetTrackToFollow(*t);
         if (!RefitAt(3.7, &fTrackToFollow, &fBestTrack)) continue;
         ResetBestTrack();
-        }
+       }
        
+       if (!fBestTrack.PropagateTo(3.,0.0028,65.19)) continue;
+       if (!fBestTrack.PropagateToVertex()) continue;
        fBestTrack.SetLabel(tpcLabel);
        fBestTrack.CookdEdx();
        CookLabel(&fBestTrack,0.); //For comparison only
index f0cfe9e..4259abf 100644 (file)
@@ -2,7 +2,7 @@
 
 include HLT/hlt.conf
 
-SRCS:= ITS/AliL3ITStrack.cxx ITS/AliL3ITStracker.cxx ITS/AliL3ITSVertexerZ.cxx
+SRCS:= ITS/AliL3ITStrack.cxx ITS/AliL3ITStracker.cxx ITS/AliL3ITSVertexerZ.cxx ITS/AliL3ITSclusterer.cxx
 
 HDRS:= $(SRCS:.cxx=.h) $(HLTEHDRS)