Major Changes to comply with the modifications in Alireconstruction (->still private).
authoramastros <amastros@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 17 Dec 2010 18:50:54 +0000 (18:50 +0000)
committeramastros <amastros@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 17 Dec 2010 18:50:54 +0000 (18:50 +0000)
Most of the modifications are related to the fact that The upgrade Reconstructor now inherits from AliReconstructor.

ITS/UPGRADE/AliITSUpgradeClusterFinder.cxx
ITS/UPGRADE/AliITSUpgradeClusterFinder.h
ITS/UPGRADE/AliITSUpgradeReconstructor.cxx
ITS/UPGRADE/AliITSUpgradeReconstructor.h
ITS/UPGRADE/AliITSlayerUpgrade.cxx
ITS/UPGRADE/AliITSsegmentationUpgrade.cxx
ITS/UPGRADE/AliITStrackerUpgrade.cxx
ITS/UPGRADE/AliITSupgrade.cxx
ITS/UPGRADE/AliITSupgrade.h
ITS/UPGRADE/AliITSupgradeDigitizer.cxx

index 359b97d..418c77b 100644 (file)
 ////////////////////////////////////////////////////////////////////////////
 
 #include "AliITSUpgradeClusterFinder.h"
+#include "AliITSsegmentationUpgrade.h"
+#include "AliITSRecPoint.h"
+#include "AliITSDigitUpgrade.h"
 #include "AliITSRawStreamSPD.h"
 #include "AliLog.h"
 #include <string.h>
 #include <TObjString.h>
-
+#include <TClonesArray.h>
+#include <TTree.h>
+#include <TMath.h>
 
 AliITSUpgradeClusterFinder::AliITSUpgradeClusterFinder() : 
   fNhitsLeft(0),
@@ -42,17 +47,22 @@ AliITSUpgradeClusterFinder::AliITSUpgradeClusterFinder() :
   fClusterWidthMinCol(0),
   fClusterWidthMaxRow(0),
   fClusterWidthMinRow(0),
-  fChargeArray(0x0)
+  fChargeArray(0x0),
+  fRecPoints(0x0)
 { 
   fChargeArray = new TObjArray();
+  fRecPoints = new TClonesArray("AliITSRecPoint",3000);
   fTmpLabel[0]=-5;
   fTmpLabel[1]=-5;
   fTmpLabel[2]=-5;
-   for(int il=0; il<10;il++) fLabels[il]=-5;
+  for(int il=0; il<10;il++) fLabels[il]=-5;
 }
 
 //___________________________________________________________________________________
-AliITSUpgradeClusterFinder::~AliITSUpgradeClusterFinder() {}
+AliITSUpgradeClusterFinder::~AliITSUpgradeClusterFinder() {
+  if(fChargeArray) delete fChargeArray;
+  if(fRecPoints) delete fRecPoints; 
+}
 //___________________________________________________________________________________
 void AliITSUpgradeClusterFinder::StartEvent() {
   NewEvent();
@@ -71,8 +81,8 @@ Int_t AliITSUpgradeClusterFinder::ProcessHitOnline(Int_t layer,  UInt_t col, UIn
 Int_t AliITSUpgradeClusterFinder::ProcessHit(Int_t layer , UInt_t col, UInt_t row, UShort_t charge, Int_t label[3]) {
   
   if (layer>=6) {
-   printf("ERROR: UpgradeClusterFinder::ProcessHit: Out of bounds: layer ,col,row, charge, label(0,1,2)= %d,%d,%d,%d,(%d,%d,%d)\n",layer ,col,row,charge,label[0],label[1],label[2]); 
-   return 1;
+    printf("ERROR: UpgradeClusterFinder::ProcessHit: Out of bounds: layer ,col,row, charge, label(0,1,2)= %d,%d,%d,%d,(%d,%d,%d)\n",layer ,col,row,charge,label[0],label[1],label[2]); 
+    return 1;
   }
 
   // do we need to perform clustering on previous module?
@@ -173,8 +183,8 @@ void AliITSUpgradeClusterFinder::PrintClusters(Int_t layer) {
     return;
   }
   for (UInt_t c=0; c<fClusterList[layer].GetNrEntries(); c++) {
-  printf("layer  %d , z,y=%f,%f , size=%d , type=%d labels=%d %d %d (label printout to be implemented...)\n",layer,fClusterList[layer].GetColIndex(c),fClusterList[layer].GetRowIndex(c),fClusterList[layer].GetSizeIndex(c),fClusterList[layer].GetTypeIndex(c),999,999,999);  
-}  
+    printf("layer  %d , z,y=%f,%f , size=%d , type=%d labels=%d %d %d (label printout to be implemented...)\n",layer,fClusterList[layer].GetColIndex(c),fClusterList[layer].GetRowIndex(c),fClusterList[layer].GetSizeIndex(c),fClusterList[layer].GetTypeIndex(c),999,999,999);  
+  }  
 }
 //___________________________________________________________________________________
 void AliITSUpgradeClusterFinder::NewEvent() {
@@ -213,7 +223,7 @@ Int_t AliITSUpgradeClusterFinder::DoModuleClustering(Int_t Layer, UShort_t charg
       AddLabelIndex(fColSum,fRowSum);
     }
     if (size>0) {
-     if(size==2) printf("DoModuleClustering, size 2, labels :  %i  %i  %i \n",fLabels[0],fLabels[1],fLabels[2]);
+      if(size==2) printf("DoModuleClustering, size 2, labels :  %i  %i  %i \n",fLabels[0],fLabels[1],fLabels[2]);
       fClusterList[Layer].Insert((Float_t)fColSum/size, (Float_t)fRowSum/size, size, GetClusterWidthZ(), GetClusterWidthPhi(), GetClusterType(size), fCharge,fLabels);
       fCharge=0;
       for(Int_t i=0; i<10; i++) fLabels[i]=-5;
@@ -331,16 +341,13 @@ void AliITSUpgradeClusterFinder::ShiftClusterTypeArea(UInt_t direction) {
     memcpy(fClusterTypeArea,tmpClusterTypeArea,kMAXCLUSTERTYPESIDEZ*kMAXCLUSTERTYPESIDEY*sizeof(Bool_t));
   }
 }
-
-
-
 //___________________________________________________________________________________
 UShort_t AliITSUpgradeClusterFinder::GetCharge(Int_t layer,UInt_t index ) {
   return fClusterList[layer].GetCharge(index);
 }
 //___________________________________________________________________________________
 Int_t * AliITSUpgradeClusterFinder::GetLabels(Int_t layer,UInt_t index) {
-       return fClusterList[layer].GetLabels(index);
+  return fClusterList[layer].GetLabels(index);
 }
 
 //___________________________________________________________________________________
@@ -353,7 +360,9 @@ UInt_t AliITSUpgradeClusterFinder::GetClusterWidthPhi() {
 }
 //___________________________________________________________________________________
 UInt_t AliITSUpgradeClusterFinder::GetClusterType(UInt_t size) {
-  // category 'other':
+  //
+  // Cluster shape
+  //
   if (!fFindClusterType || size>4) 
     return 0;
 
@@ -631,8 +640,10 @@ UInt_t AliITSUpgradeClusterFinder::GetClusterType(UInt_t size) {
 }
 
 //___________________________________________________________________________________________________
-
 UInt_t AliITSUpgradeClusterFinder::GetPixelCharge(UInt_t col, UInt_t row){
+  //
+  //...self explaining
+  //
   Int_t q=0;
   for(Int_t entry =0; entry < fChargeArray->GetEntries(); entry++){
     TObjString *s = (TObjString*)fChargeArray->At(entry);
@@ -654,43 +665,159 @@ UInt_t AliITSUpgradeClusterFinder::GetPixelCharge(UInt_t col, UInt_t row){
 //____________________________________________________
 
 void AliITSUpgradeClusterFinder::AddLabelIndex(UInt_t col, UInt_t row){
+  //
+  // Adding cluster labels
+  //
 
- for(Int_t entry =0; entry < fChargeArray->GetEntries(); entry++){
+  for(Int_t entry =0; entry < fChargeArray->GetEntries(); entry++){
     TObjString *s = (TObjString*)fChargeArray->At(entry);
     TString name = s->GetString();
- if(!name.Contains(Form("%i %i",col,row)))
-  continue;
- TObjArray *array = name.Tokenize(" ");
- TString index[3];
- Int_t label[3];
-  for(Int_t i=0; i<3; i++){
-  index[i]=((TObjString*)array->At(3+i))->String();
-  label[i]=index[i].Atoi();
+    if(!name.Contains(Form("%i %i",col,row)))
+      continue;
+    TObjArray *array = name.Tokenize(" ");
+    TString index[3];
+    Int_t label[3];
+    for(Int_t i=0; i<3; i++){
+      index[i]=((TObjString*)array->At(3+i))->String();
+      label[i]=index[i].Atoi();
 
+    }
+    SetLabels(label);
+    delete array;
   }
- SetLabels(label);
- delete array;
- }
 }
 //____________________________________________________
 
 void AliITSUpgradeClusterFinder::SetLabels(Int_t label[3]){
+  //
+  //
+  //
+
+  Bool_t isAssigned[3]={kFALSE,kFALSE,kFALSE};
+
+  for(Int_t i=0; i<10; i++){
+    for(Int_t k=0; k<3; k++){
+      if(fLabels[i]!=label[k] && label[k]>-1 && fLabels[i]<0) {
+       if(!isAssigned[k]) {
+         //  printf("assignign...\n.");
+         //  printf("Assignign  fLabels[%i]=%i  label[%i]=%i \n",i,fLabels[i],k,label[k]);
+         fLabels[i+k]=label[k];
+         isAssigned[k]=kTRUE;
+       }
+      }
+    }
+  }
+}
 
+//____________________________________________________
+void AliITSUpgradeClusterFinder::MakeRecPointBranch(TTree *treeR){
+  //
+  // Creating the branch (see AliITSUpgradeReconstructor::Reconstruct)
+  //
+
+  if(!fRecPoints)fRecPoints = new TClonesArray("AliITSRecPoint",1000);
+  if (treeR) {
+    TBranch *branch = treeR->GetBranch("ITSRecPoints");
+    if (branch) return ;
+    else branch = treeR->Branch("ITSRecPoints",&fRecPoints); 
+  }
+}
+//____________________________________________________
+void AliITSUpgradeClusterFinder::SetRecPointTreeAddress(TTree *treeR){
+  //
+  // Addressing the branch (see AliITSUpgradeReconstructor::Reconstruct)
+  //
+  if(!treeR) return;
+  if(!fRecPoints) fRecPoints = new TClonesArray("AliITSRecPoint",1000);
+
+  TBranch *branch;
+  branch = treeR->GetBranch("ITSRecPoints");
+  if (branch) {
+    branch->SetAddress(&fRecPoints);
+  } else AliError("No RecPoint branch available");
 
- Bool_t isAssigned[3]={kFALSE,kFALSE,kFALSE};
-
- for(Int_t i=0; i<10; i++){
-  for(Int_t k=0; k<3; k++){
-   //printf(" fLabels[%i]=%i  label[%i]=%i \n",i,fLabels[i],k,label[k]);
-    if(fLabels[i]!=label[k] && label[k]>-1 && fLabels[i]<0) {
-      if(!isAssigned[k]) {
-     //  printf("assignign...\n.");
-    printf("Assignign  fLabels[%i]=%i  label[%i]=%i \n",i,fLabels[i],k,label[k]);
-        fLabels[i+k]=label[k];
-        isAssigned[k]=kTRUE;
-      }
-     }
-   }
- }
+}
+//____________________________________________________
+void AliITSUpgradeClusterFinder::DigitsToRecPoints(TObjArray *digList) {
+  //
+  // the clusterization is performed here
+  //
+  AliITSsegmentationUpgrade *segmentation2 = 0x0;
+  AliITSRecPoint  recpnt;
+  if(!segmentation2) segmentation2 = new AliITSsegmentationUpgrade();
+  Int_t nClusters =0;
+  TClonesArray &lrecp = *fRecPoints;
+
+  for(Int_t ilayer=0; ilayer < 6 ;ilayer ++){
+    TClonesArray *pArrDig= (TClonesArray*)digList->At(ilayer);
+    StartEvent();
+    AliInfo(Form("layer %i with digit entries %i",ilayer,pArrDig->GetEntries()));
+    for(Int_t ientr =0; ientr < pArrDig->GetEntries() ; ientr++){
+      AliITSDigitUpgrade *dig = (AliITSDigitUpgrade*)pArrDig->At(ientr);
+      Int_t colz=dig->GetzPixelNumber();
+      Int_t rowx=dig->GetxPixelNumber();
+      Double_t hitcharge= (dig->GetNelectrons());
+      ProcessHitOnline(ilayer,colz, rowx,(Short_t)hitcharge,dig->GetTracks());
+    }//ientr
+    FinishEvent();
+    
+    for(UInt_t nClu = 0; nClu <  GetClusterCount(ilayer); nClu++){
+      UShort_t charge = GetCharge(ilayer, nClu);
+      recpnt.SetQ(charge);
+      recpnt.SetLayer(ilayer);
+      Int_t *lab=GetLabels(ilayer,nClu);
+      for(Int_t l=0; l<3; l++) {recpnt.SetLabel(lab[l],l);}
+
+      Bool_t check2;
+      Double_t xcheck2=0.;
+      Double_t ycheck2=0.;
+      Double_t zcheck2=0.;
+      Double_t xzl2[2]={0.,0.};
+      Double_t XpixC2,ZpixC2=0.;
+
+      XpixC2 = GetClusterMeanRow(ilayer, nClu);
+      ZpixC2 = GetClusterMeanCol(ilayer, nClu);
+      xzl2[0] = XpixC2*(segmentation2->GetCellSizeX(ilayer))+0.5*(segmentation2-> GetCellSizeX(ilayer));
+      xzl2[1] = ZpixC2*(segmentation2->GetCellSizeZ(ilayer))+0.5*(segmentation2->GetCellSizeZ(ilayer))-(segmentation2->GetHalfLength(ilayer));
+      check2 = segmentation2->DetToGlobal(ilayer,xzl2[0], xzl2[1],xcheck2,ycheck2,zcheck2);
+      recpnt.SetType(GetClusterType(ilayer,nClu ));
+      // recpnt.SetLocalCoord(xzl2[0],xzl2[1]); //temporary solution (no LocalToTrack Matrix)
+      //from global to tracking system coordinate
+      // global coordinate -> local coordinate getting alpha angle of the recpoint
+      Float_t xclg = xcheck2;//upgrade clusters global coordinate ( ITS official: GetX tracking coordinate)
+      Float_t yclg = ycheck2;
+      Float_t zclg = zcheck2;
+      Double_t phiclu1rad, phiclu1deg;
+      phiclu1rad=TMath::ATan2(yclg,xclg);//cluster phi angle (rad)
+      if (phiclu1rad<0) phiclu1rad+=TMath::TwoPi();//from 0 to 360
+      else if (phiclu1rad>=TMath::TwoPi()) phiclu1rad-=TMath::TwoPi();//
+
+      phiclu1deg=180.*phiclu1rad/TMath::Pi();// in deg
+      Int_t ladder;// virtual segmentation starting from the cluster phi
+
+      ladder=(Int_t)phiclu1deg/18;// in which ladder the cluster is
+      Double_t alpha= (ladder*18.+9.)*TMath::Pi()/180.;//angle at the center of the ladder (rad)
+
+      //alpha rotation
+      Float_t xclu1_tr = xclg*TMath::Cos(alpha)-yclg*TMath::Sin(alpha);
+      Float_t yclu1 = yclg*TMath::Cos(alpha)+xclg*TMath::Sin(alpha);
+      Float_t xclu1 = TMath::Sqrt(xclu1_tr*xclu1_tr+yclu1*yclu1);
+      Float_t zclu1 = zclg;
+      Double_t phi_trk= (phiclu1rad-alpha);// cluster angle in the rotated system (rad)
+
+      yclu1=xclu1*phi_trk; // tracking system coordinate: r*phi
+      recpnt.SetX(0.);
+      recpnt.SetY(yclu1);
+      recpnt.SetZ(zclu1);
+
+      Double_t xsize, zsize;
+      segmentation2->GetSegmentation(ilayer,xsize, zsize);
+      recpnt.SetSigmaY2(xsize/TMath::Sqrt(12)*xsize/TMath::Sqrt(12));
+      recpnt.SetSigmaZ2(zsize/TMath::Sqrt(12)*zsize/TMath::Sqrt(12));
+      new(lrecp[nClusters++]) AliITSRecPoint(recpnt);
+      //Int_t idx = fRecPoints->GetEntries();
+      AliInfo(Form("recpoint : Nelectrons %f (entry %i)",recpnt.GetQ(),fRecPoints->GetEntries()));
+    }//cluster list entries
+  }//ilayer
 }
 
index ec4961a..fd4394b 100644 (file)
@@ -29,6 +29,8 @@
 #include "AliITSUpgradeClusterList.h"
 #include <TObjArray.h>
 
+class TTree;
+
 class AliITSUpgradeClusterFinder :public TObject{
 
  public:
@@ -45,6 +47,10 @@ class AliITSUpgradeClusterFinder :public TObject{
 
   void AddLabelIndex(UInt_t col, UInt_t row);
   void SetLabels(Int_t label[3]);
+  void MakeRecPointBranch(TTree *treeR);
+  void SetRecPointTreeAddress(TTree *treeR);
+
+  void DigitsToRecPoints(TObjArray *digList);
 
   UInt_t  GetClusterCount(Int_t layer);
   Float_t GetClusterMeanCol(Int_t layer, UInt_t index);
@@ -96,6 +102,8 @@ class AliITSUpgradeClusterFinder :public TObject{
   AliITSUpgradeClusterList fClusterList[8];
   TObjArray *fChargeArray;
 
+  TClonesArray *fRecPoints;
+
   AliITSUpgradeClusterFinder(const AliITSUpgradeClusterFinder &source); // copy constructor
   // assignment operator
   AliITSUpgradeClusterFinder& operator=(const AliITSUpgradeClusterFinder &source);
index 3d269df..e2cfa9f 100644 (file)
@@ -48,19 +48,16 @@ ClassImp(AliITSUpgradeReconstructor)
 
 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
   AliITSUpgradeReconstructor::AliITSUpgradeReconstructor():
-    AliITSReconstructor(), 
-    fRecPoints(0),
-    fNRecPoints(0),
-    fDigits(0)
-
+    AliReconstructor(), 
+    fDigits(0x0)
 {
   //
   //ctor
   //
-  fRecPoints = new TClonesArray("AliITSRecPoint",3000);
-  fNRecPoints = 0;
-  fDigits = new TObjArray(6);
-
+  fDigits = new TObjArray(kNLayers);
+  fDigits->SetOwner(kTRUE);
+  for(Int_t iLay =0; iLay<kNLayers; iLay++) fDigits->AddAt(new TClonesArray("AliITSDigitUpgrade",5000),iLay);
+  AliInfo("    ************* Using the upgrade reconstructor! ****** ");
 
 
 
@@ -73,11 +70,6 @@ AliITSUpgradeReconstructor::~AliITSUpgradeReconstructor(){
     delete fDigits;
     fDigits=0;
   }
-  if(fRecPoints){
-    fRecPoints->Delete();
-    delete fRecPoints;
-    fRecPoints=0;
-  }
 }
 
 //_________________________________________________________________
@@ -117,106 +109,6 @@ void AliITSUpgradeReconstructor::SetTreeAddressD(TTree* const treeD){
     }
   }
 }
-//__________________________________________________________________
-void AliITSUpgradeReconstructor::SetTreeAddressR(TTree* const treeR){
-  // Set branch address for the Reconstructed points Trees.
-  // Inputs:
-  //      TTree *treeR   Tree containing the RecPoints.
-  // Outputs:
-  //      none.
-  // Return:
-  char branchname[30];
-  Char_t namedet[30]="ITS";
-       
-  if(!treeR) return;
-  if(fRecPoints==0x0){
-    fRecPoints = new TClonesArray("AliITSRecPoint",1000);
-  }
-       
-  TBranch *branch;
-  sprintf(branchname,"%sRecPoints",namedet);
-  branch = treeR->GetBranch(branchname);
-       
-  if (branch) {
-    branch->SetAddress(&fRecPoints);
-  }
-  else {
-    sprintf(branchname,"%sRecPointsF",namedet); 
-    branch = treeR->GetBranch(branchname);
-    if (branch) {
-      branch->SetAddress(&fRecPoints);
-    }
-  }
-
-}
-//_________________________________________________________________________
-TBranch* AliITSUpgradeReconstructor::MakeBranchInTree(TTree* const tree,
-                                                     const char* name, const char *classname,
-                                                     void* address,Int_t size,Int_t splitlevel)
-{
-  //
-  // Makes branch in given tree and diverts them to a separate file
-  // 
-  //
-  //
-
-  if (tree == 0x0) {
-    Error("MakeBranchInTree","Making Branch %s Tree is NULL",name);
-    return 0x0;
-  }
-  TBranch *branch = tree->GetBranch(name);
-  if (branch) {
-    return branch;
-  }
-  if (classname){
-    branch = tree->Branch(name,classname,address,size,splitlevel);
-  }
-  else {
-    branch = tree->Bronch(name, "TClonesArray", address, size, splitlevel);
-  }
-
-  return branch;
-}
-//________________________________________________________________________
-
-
-void AliITSUpgradeReconstructor::MakeBranch(TTree* tree, Option_t* option){
-
-  //Creates branches for clusters and recpoints
-  Bool_t cR = (strstr(option,"R")!=0);
-  Bool_t cRF = (strstr(option,"RF")!=0);
-
-  if(cRF)cR = kFALSE;
-
-  if(cR) MakeBranchR(tree);
-  if(cRF) MakeBranchRF(tree);
-
-}
-
-//_________________________________________________________________
-void AliITSUpgradeReconstructor::MakeBranchR(TTree *treeR, Option_t *opt){
-  //Creates tree branches for recpoints
-  // Inputs:
-  //      cont char *file  File name where RecPoints branch is to be written
-  //                       to. If blank it write the SDigits to the same
-  //                       file in which the Hits were found.
-
-  Int_t buffsz = 4000;
-  char branchname[30];
-  Bool_t oFast= (strstr(opt,"Fast")!=0);
-  Char_t detname[30] = "ITS";
-
-  if(oFast){
-    sprintf(branchname,"%sRecPointsF",detname);
-  } else {
-    sprintf(branchname,"%sRecPoints",detname);
-  }
-
-  if(!fRecPoints)fRecPoints = new TClonesArray("AliITSRecPoint",1000);
-  if (treeR)
-    MakeBranchInTree(treeR,branchname,0,&fRecPoints,buffsz,99);
-}
-
 //_____________________________________________________________________
 void AliITSUpgradeReconstructor::ResetDigits(){
   // Reset number of digits and the digits array for the ITS detector.
@@ -233,141 +125,45 @@ void AliITSUpgradeReconstructor::ResetDigits(Int_t branch){
   if(fDigits->At(branch)) ((TClonesArray*)fDigits->At(branch))->Clear();
 
 }
-//________________________________________________________________
-void AliITSUpgradeReconstructor::AddRecPoint(const AliITSRecPoint &r){
-  // Add a reconstructed space point to the list
-  // Inputs:
-  //      const AliITSRecPoint &r RecPoint class to be added to the tree
-  //                              of reconstructed points TreeR.
-  // Outputs:
-  //      none.
-  // Return:
-  //      none.
-
-  TClonesArray &lrecp = *fRecPoints;
-  new(lrecp[fNRecPoints++]) AliITSRecPoint(r);
-}
-
 //___________________________________________________________________
-void AliITSUpgradeReconstructor::DigitsToRecPoints(TTree *treeD,TTree *treeR){
-  AliITSsegmentationUpgrade *segmentation2 = 0x0;
-  AliITSRecPoint  recpnt; 
-  if(!segmentation2)
-  segmentation2 = new AliITSsegmentationUpgrade();
+void AliITSUpgradeReconstructor::Reconstruct(TTree* digitsTree, TTree* clustersTree) const {
+  //
+  // Clustering
+  //
+  for(Int_t iLay=0;iLay<kNLayers;iLay++) {
+    digitsTree->SetBranchAddress(Form("Layer%d",iLay),&(*fDigits)[iLay]);
+  }
+  digitsTree->GetEntry(0);
   AliITSUpgradeClusterFinder *clf = new AliITSUpgradeClusterFinder();
-  TObjArray *digList= new TObjArray(6);
-  for(Int_t il=0; il<6; il ++) digList->AddAt(new TClonesArray("AliITSDigitUpgrade"),il);
-  for(Int_t ilayer=0; ilayer<6; ilayer ++) {
-    treeD->SetBranchAddress(Form("Layer%d",ilayer),&(*digList)[ilayer]);
-    //treeD->GetListOfLeaves()->Print();       
-  }//loop layer per tbranch
-  treeD->GetEntry(0);
-               
-  for(Int_t ilayer=0; ilayer < 6 ;ilayer ++){
-    TClonesArray *pArrDig= (TClonesArray*)digList->At(ilayer);
-    clf->StartEvent();
-    for(Int_t ientr =0; ientr < pArrDig->GetEntries() ; ientr++){
-      AliITSDigitUpgrade *dig = (AliITSDigitUpgrade*)pArrDig->At(ientr);
-      Int_t colz=dig->GetzPixelNumber();
-      Int_t rowx=dig->GetxPixelNumber();
-      Double_t hitcharge= (dig->GetNelectrons());
-      clf->ProcessHitOnline(ilayer,colz, rowx,(Short_t)hitcharge,dig->GetTracks());
-
-
-    }//ientr
-    clf->FinishEvent();
-    for(UInt_t nClu = 0; nClu <  clf -> GetClusterCount(ilayer); nClu++){
-      UShort_t charge = clf->GetCharge(ilayer, nClu);
-      recpnt.SetQ(charge);
-      recpnt.SetLayer(ilayer);
-      Int_t *lab=clf->GetLabels(ilayer,nClu);
-for(Int_t l=0; l<3; l++) {
-                        recpnt.SetLabel(lab[l],l);
-                        }
-if(clf->GetClusterSize(ilayer,nClu)==2){
-                        printf("\n\n CLUSTER LABELS (size %i) \n",clf->GetClusterSize(ilayer,nClu));
-                        for(Int_t i=0; i<10; i++ ){
-                         printf(" %i ",lab[i]);
-                         }
-                        printf("\n\n");
-                       }
-
-
-                       
-      Bool_t check2;
-      Double_t xcheck2=0.;
-      Double_t ycheck2=0.;
-      Double_t zcheck2=0.;
-      Double_t xzl2[2]={0.,0.};
-      Double_t XpixC2,ZpixC2=0.;
-
-      XpixC2 = clf-> GetClusterMeanRow(ilayer, nClu);
-      ZpixC2 = clf-> GetClusterMeanCol(ilayer, nClu);
-      xzl2[0] = XpixC2*(segmentation2->GetCellSizeX(ilayer))+0.5*(segmentation2-> GetCellSizeX(ilayer));
-      xzl2[1] = ZpixC2*(segmentation2->GetCellSizeZ(ilayer))+0.5*(segmentation2->GetCellSizeZ(ilayer))-(segmentation2->GetHalfLength(ilayer));
-      check2 = segmentation2->DetToGlobal(ilayer,xzl2[0], xzl2[1],xcheck2,ycheck2,zcheck2);
-      recpnt.SetType(clf->GetClusterType(ilayer,nClu ));
-    // recpnt.SetLocalCoord(xzl2[0],xzl2[1]); //temporary solution (no LocalToTrack Matrix)
-         //from global to tracking system coordinate
-       // global coordinate -> local coordinate getting alpha angle of the recpoint
-              Float_t xclg = xcheck2;//upgrade clusters global coordinate ( ITS official: GetX tracking coordinate)
-              Float_t yclg = ycheck2;
-              Float_t zclg = zcheck2;
-              Double_t phiclu1rad, phiclu1deg;
-              phiclu1rad=TMath::ATan2(yclg,xclg);//cluster phi angle (rad)
-              if (phiclu1rad<0) phiclu1rad+=TMath::TwoPi();//from 0 to 360
-              else if (phiclu1rad>=TMath::TwoPi()) phiclu1rad-=TMath::TwoPi();//
-
-              phiclu1deg=180.*phiclu1rad/TMath::Pi();// in deg
-              Int_t ladder;// virtual segmentation starting from the cluster phi
-
-              ladder=(Int_t)phiclu1deg/18;// in which ladder the cluster is
-              Double_t alpha= (ladder*18.+9.)*TMath::Pi()/180.;//angle at the center of the ladder (rad)
-
-              //alpha rotation 
-              Float_t xclu1_tr = xclg*TMath::Cos(alpha)-yclg*TMath::Sin(alpha);
-              Float_t yclu1 = yclg*TMath::Cos(alpha)+xclg*TMath::Sin(alpha);
-              Float_t xclu1 = TMath::Sqrt(xclu1_tr*xclu1_tr+yclu1*yclu1);
-              Float_t zclu1 = zclg;
-              Double_t phi_trk= (phiclu1rad-alpha);// cluster angle in the rotated system (rad)
+  clf->MakeRecPointBranch(clustersTree);
+  clf->SetRecPointTreeAddress(clustersTree);
+  clf->DigitsToRecPoints(fDigits);     //cluster finder
+  clustersTree->Fill();                //fill tree for current event
+  delete clf;
+  for(Int_t iLay=0;iLay<kNLayers;iLay++){
+    fDigits->At(iLay)->Clear();
+  }
 
-              yclu1=xclu1*phi_trk; // tracking system coordinate: r*phi
-      recpnt.SetX(0.);
-      recpnt.SetY(yclu1);
-      recpnt.SetZ(zclu1);
-      //  
-      Double_t xsize, zsize;
-      segmentation2->GetSegmentation(ilayer,xsize, zsize);
-      recpnt.SetSigmaY2(xsize/TMath::Sqrt(12)*xsize/TMath::Sqrt(12));
-      recpnt.SetSigmaZ2(zsize/TMath::Sqrt(12)*zsize/TMath::Sqrt(12));
-      TClonesArray &lrecp = *fRecPoints;
-      new(lrecp[fNRecPoints++]) AliITSRecPoint(recpnt);
-    }//cluster list entries
-    treeR->Fill();
-    ResetRecPoints();
-  }//ilayer
 }
 //_______________________________________________________________________________________________________________
 AliTracker* AliITSUpgradeReconstructor::CreateTracker() const
 {
-        // create a ITS tracker
-   //     Int_t trackerOpt = GetRecoParam()->GetTracker();
-    //    AliTracker* tracker;
+  //
+  // create the ITSUpgrade tracker
+  //
 
-      //          tracker = new AliITStrackerUpgrade();
-                AliITStrackerUpgrade *trackUp = new AliITStrackerUpgrade();
-                if(GetRecoParam()->GetTrackerSAOnly()) trackUp->SetSAFlag(kTRUE);
-                if(trackUp->GetSAFlag())AliDebug(1,"Tracking Performed in ITS only\n");
-                if(GetRecoParam()->GetInwardFindingSA()){
-                        trackUp->SetInwardFinding();
-                        trackUp->SetInnerStartLayer(GetRecoParam()->GetInnerStartLayerSA());
-                }else{
-                        trackUp->SetOutwardFinding();
-                        trackUp->SetOuterStartLayer(GetRecoParam()->GetOuterStartLayerSA());
-                }
-                trackUp->SetMinNPoints(GetRecoParam()->GetMinNPointsSA());
-                return trackUp;
+  AliITStrackerUpgrade *trackUp = new AliITStrackerUpgrade();
+  if(GetRecoParam()->GetTrackerSAOnly()) trackUp->SetSAFlag(kTRUE);
+  if(trackUp->GetSAFlag())AliDebug(1,"Tracking Performed in ITS only\n");
+  if(GetRecoParam()->GetInwardFindingSA()){
+    trackUp->SetInwardFinding();
+    trackUp->SetInnerStartLayer(GetRecoParam()->GetInnerStartLayerSA());
+  }else{
+    trackUp->SetOutwardFinding();
+    trackUp->SetOuterStartLayer(GetRecoParam()->GetOuterStartLayerSA());
+  }
+  trackUp->SetMinNPoints(GetRecoParam()->GetMinNPointsSA());
+  return trackUp;
 }
-
-
-
+//_______________________________________________________________________
index f82f8ea..fe56fcd 100644 (file)
@@ -9,7 +9,7 @@
 // ITS upgrade  base class to reconstruct an event
 //.
 #include "AliITSReconstructor.h"        //base class
-#include "AliITSDigitUpgrade.h"           //Dig2Clu(), UseDig()
+#include "AliITSDigitUpgrade.h"           
 #include "AliITSsegmentationUpgrade.h"
 #include "AliRunLoader.h"
 #include "AliRun.h"
@@ -23,7 +23,7 @@
 #include <TObjArray.h>               //SigConv()
 class AliRawReader;                  //Reconstruct() with raw data   
 class AliITSRecPoint;
-class AliITSUpgradeReconstructor: public AliITSReconstructor
+class AliITSUpgradeReconstructor: public AliReconstructor
 { 
  public:
   AliITSUpgradeReconstructor();               
@@ -31,23 +31,20 @@ class AliITSUpgradeReconstructor: public AliITSReconstructor
   virtual void Init();
 
   virtual void SetTreeAddressD(TTree* const treeD); 
-  void SetTreeAddressR(TTree* const treeR);
-  void AddRecPoint(const AliITSRecPoint &p);
-  TBranch*  MakeBranchInTree(TTree* const tree,const char* name, const char *classname,void* address,Int_t size,Int_t splitlevel);
                
   virtual void ResetDigits(); 
   virtual void ResetDigits(Int_t branch);
-  void MakeBranchRF(TTree *treeR){MakeBranchR(treeR,"Fast");} 
-  void DigitsToRecPoints(TTree *treeD,TTree *treeR);
-  void MakeBranchR(TTree *treeR,Option_t *opt=" ");
-  void ResetRecPoints(){if(fRecPoints) fRecPoints->Clear();fNRecPoints = 0;};
-  virtual void MakeBranch(TTree *tree,Option_t *opt);
   virtual AliTracker*  CreateTracker() const;
+
+  virtual void  Reconstruct(TTree* digitsTree, TTree* clustersTree) const; 
+  virtual void  Reconstruct(AliRawReader * /*rawdata*/, TTree* /*clustersTree*/) const {AliInfo("Not implemented");} 
+  enum {kNLayers=6};
+
+  static const AliITSRecoParam* GetRecoParam() { return dynamic_cast<const AliITSRecoParam*>(AliReconstructor::GetRecoParam(0)); }
+
  private:
   AliITSUpgradeReconstructor(const AliITSUpgradeReconstructor&);              //Not implemented
   AliITSUpgradeReconstructor &operator=(const AliITSUpgradeReconstructor&);   //Not implemented
-  TClonesArray *fRecPoints;  //! List of reconstructed points
-  Int_t         fNRecPoints; // Number of rec points
   TObjArray    *fDigits;     
 
 
index 3fd9640..8dbcadb 100644 (file)
@@ -48,8 +48,6 @@ AliITSlayerUpgrade::~AliITSlayerUpgrade() {
   //--------------------------------------------------------------------
   // AliITSlayerUpgrade destructor
   //--------------------------------------------------------------------
-//for (Int_t i=0; i<fN; i++) delete fClusters[i];
-cout<< " AliITSlayerUpgrade destructor " << endl;
 ResetClusters();
 
 }
@@ -57,19 +55,9 @@ void AliITSlayerUpgrade::ResetClusters() {
   //--------------------------------------------------------------------
   // This function removes loaded clusters
   //--------------------------------------------------------------------
-/*
-
-   for (Int_t s=0; s<kNsector; s++) {
-       Int_t &n=fN[s];
-       while (n) {
-          n--;
- */
 
 for (Int_t i=0; i<fN; i++) delete fClusters[i];
   fN=0;
-cout<< " AliITSlayerUpgrade::ResetClusters() : ho chiamato  resetCluster " << endl;
-   //    }
- //  }
 return;
 }
 
index 74da56f..c606721 100644 (file)
@@ -60,10 +60,10 @@ ClassImp(AliITSsegmentationUpgrade)
   f->Close(); 
     
   Int_t i=0;
-  while(gGeoManager->GetVolume(Form("Layer%i",i))){
-    TGeoVolume *vol = gGeoManager->GetVolume(Form("Layer%i",i));
+  while(gGeoManager->GetVolume(Form("LayerSilicon%i",i))){
+    TGeoVolume *vol = gGeoManager->GetVolume(Form("LayerSilicon%i",i));
     if(!vol) {
-      AliInfo(Form("the volume %s has not been found... exiting!",Form("Layer%i",i)));
+      AliInfo(Form("the volume %s has not been found... exiting!",Form("LayerSilicon%i",i)));
       return;
     }
     TGeoTube *shape = (TGeoTube*)vol->GetShape();
index 86aee2d..31b8b91 100644 (file)
@@ -242,7 +242,7 @@ Int_t AliITStrackerUpgrade::LoadClusters(TTree *clusTree){
     TClonesArray *ITSCluster = &statITSCluster;
     TBranch* itsClusterBranch=clusTree->GetBranch("ITSRecPoints");
     if (!itsClusterBranch){
-      printf("can't get the branch with the ITS clusters ! \n");
+      AliError("can't get the branch with the ITS clusters ! \n");
       return 1;
     }
     itsClusterBranch->SetAddress(&ITSCluster);
index b7e24df..f741b16 100644 (file)
@@ -49,7 +49,7 @@ ClassImp(AliITSupgrade)
     fHalfLength(0),
     fSdigits(0),
     fDigits(0),
-    fClusters(0),
+    //fClusters(0),
     fSegmentation(0x0)
 {
   //
@@ -71,7 +71,7 @@ AliITSupgrade::AliITSupgrade(const char *name,const char *title, TArrayD widths,
   fHalfLength(halfLengths),
   fSdigits(0),
   fDigits(0),
-  fClusters(0),
+  //fClusters(0),
   fSegmentation(0x0)
 {
 
@@ -213,9 +213,7 @@ void AliITSupgrade::StepManager()
   TString volname = gMC->CurrentVolName();
   if(volname.Contains("Cu"))return;
   if(volname.Contains("Be"))return; 
-  //AliInfo(Form("volume name %s ",volname.Data()));
   volname.Remove(0,12);          // remove letters to get the layer number
-  //AliInfo(Form("volume name %s ",volname.Data()));
   hit.SetModule(volname.Atoi()); // this will be the layer, not the module
   hit.SetTrack(gAlice->GetMCApp()->GetCurrentTrackNumber());
     
@@ -384,7 +382,6 @@ void AliITSupgrade::Hit2SumDig(TClonesArray *hits,TObjArray *pSDig, Int_t *nSdig
     if(pSdigList[i]->GetEntries()!=0) AliErrorClass("Some of sdigits lists is not empty");         //in principle those lists should be empty 
   }
   
-  AliInfo(Form("Number of hits %i ",hits->GetEntries()));
   for(Int_t iHit=0;iHit<hits->GetEntries();iHit++){         //hits loop
     AliITShit *hit = (AliITShit*)hits->At(iHit);
     Double_t xz[2];
@@ -419,7 +416,7 @@ void AliITSupgrade::MakeBranch(Option_t *option){
   
   const char *cH = strstr(option,"H");
   const char *cD = strstr(option,"D");
-  const char *cR = strstr(option,"R");
+  //const char *cR = strstr(option,"R");
   const char *cS = strstr(option,"S");
 
   if(cH&&fLoader->TreeH()){
@@ -439,12 +436,6 @@ void AliITSupgrade::MakeBranch(Option_t *option){
     DigitsCreate();
     for(Int_t i=0;i<fNlayers;i++) MakeBranchInTree(fLoader->TreeD(),Form("Layer%d",i),&((*fDigits)[i]),kBufSize,0);
   }
-
-  if(cR&&fLoader->TreeR()){
-    ClustersCreate();
-    for(Int_t i=0;i<fNlayers;i++) MakeBranchInTree(fLoader->TreeR(),Form("Layer%d",i),&((*fClusters)[i]),kBufSize,0);
-  }
-
   AliDebug(1,"Stop.");
 }
 //____________________________________________________________________________________________________ 
@@ -457,8 +448,6 @@ void AliITSupgrade::SetTreeAddress()
     fLoader->TreeH()->SetBranchAddress("ITSupgrade",&fHits);
 
   }
-
-
     
   if(fLoader->TreeS() && fLoader->TreeS()->GetBranch("Layer0" )){
     SDigitsCreate();
@@ -466,7 +455,6 @@ void AliITSupgrade::SetTreeAddress()
       fLoader->TreeS()->SetBranchAddress(Form("Layer%d",i),&((*fSdigits)[i]));
     }
   }
-
     
   if(fLoader->TreeD() && fLoader->TreeD()->GetBranch("Layer0")){
     DigitsCreate(); 
@@ -474,16 +462,5 @@ void AliITSupgrade::SetTreeAddress()
       fLoader->TreeD()->SetBranchAddress(Form("Layer%d",i),&((*fDigits)[i]));
     }
   }
-  if(fLoader->TreeR() && fLoader->TreeR()->GetBranch("Layer0")){
-    ClustersCreate(); 
-    for(int i=0;i<fNlayers;i++){
-      fLoader->TreeR()->SetBranchAddress(Form("Layer%d",i),&((*fClusters)[i]));
-    }
-  }
   AliDebug(1,"Stop.");
 }
-
-
-
-
-
index 7f2d453..7523bc8 100644 (file)
@@ -69,13 +69,6 @@ class AliITSupgrade : public AliITS //TObject-TNamed-AliModule-AliDetector-AliIT
     for(Int_t i=0;i<fNlayers;i++)fDigits->AddAt(new TClonesArray("AliITSDigitUpgrade"),i);}//create digits list
   void          DigitsReset ()              {if(fDigits)for(int i=0;i<fNlayers;i++)fDigits->At(i)->Clear();                     }//clean digits list
 
-  TObjArray*    ClusterList()           const{return fClusters;}//get clusters list for all layers
-  TClonesArray* ClusterList(Int_t layer)const{return fClusters ? (TClonesArray *)fClusters->At(layer):0;}//get clusters list for chamber
-  void          ClustersCreate()             {if (fClusters) return; //PH do not recreate existing containers
-    fClusters=new TObjArray(fNlayers); 
-    for(Int_t i=0;i<fNlayers;i++)fClusters->AddAt(new TClonesArray("TObject"),i);}//create clusters list
-  void   ClusterReset ()             {if(fClusters)for(int i=0;i<fNlayers;i++)fClusters->At(i)->Clear();                     }//clean clusters list
-
   AliDigitizer*   CreateDigitizer  (AliRunDigitizer *m) const {return new AliITSupgradeDigitizer(m);}  //from AliModule invoked from AliSimulation::RunDigitization()
            
   void Hit2SumDig(TClonesArray *hits,TObjArray *pSDig, Int_t *nSdigit);
@@ -104,7 +97,6 @@ class AliITSupgrade : public AliITS //TObject-TNamed-AliModule-AliDetector-AliIT
   TArrayD fHalfLength;
   TObjArray            *fSdigits;                 //![fNlayers] list of sdigits
   TObjArray            *fDigits;                     //![fNlayers] list of digits per layer
-  TObjArray            *fClusters;                     //![fNlayers] list of clusters per layer
   AliITSsegmentationUpgrade *fSegmentation;
   
  private:
index 99bf42c..4599812 100644 (file)
@@ -128,14 +128,14 @@ void AliITSupgradeDigitizer::Sdigits2Digits(TClonesArray *pSDigitList,TObjArray
     iCnt[i]=0; if(pLst[i]->GetEntries()!=0) AliErrorClass("Some of digits lists is not empty");  //in principle those lists should be empty 
   }
    
-  AliInfo("starting loop over gli sdigits to create the digits");
+  //AliInfo("starting loop over gli sdigits to create the digits");
   Double_t eloss =0.;
   Double_t nele = 0.;
   ULong_t  pixid = 999;
   Int_t tids[3]={-1,-1,-1};
   
   Float_t elossID[3]={-1.,-1.,-1.};
-  AliInfo("starting layers");
+  //AliInfo("starting layers");
   AliDebug(1,"starting loop over layers");
    
   for(Int_t ilay=0;ilay<fNlayers;ilay++){