]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - PHOS/AliPHOSClusterizerv2.cxx
Turn off non-linearity by default
[u/mrichter/AliRoot.git] / PHOS / AliPHOSClusterizerv2.cxx
index 5f95bd0d54bd98ab34c0b9df0ccfb60fa8fee923..e774731781f3a4da2106dca52efd29b6dafbca58 100644 (file)
+/**************************************************************************
+ * 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.                  *
+ **************************************************************************/
+
+/* $Id$ */
+
+//////////////////////////////////////////////////////////////////////////////
+//  Clusterization class for IHEP reconstruction.
+// Performs clusterization (collects neighbouring active cells)
+// It differs from AliPHOSClusterizerv1 in neighbour definition only
+//*-- Author: Boris Polichtchouk, IHEP
+
 // --- ROOT system ---
 #include "TBenchmark.h"
-#include "TROOT.h"
 
 // --- Standard library ---
-#include <iostream.h>
-#include <iomanip.h>
 
 // --- AliRoot header files ---
+#include "AliLog.h"
 #include "AliPHOSClusterizerv2.h"
-#include "AliPHOSGetter.h"
-#include "TFolder.h"
 #include "AliPHOSEvalRecPoint.h"
 #include "AliPHOSRecCpvManager.h"
 #include "AliPHOSRecEmcManager.h"
+#include "AliPHOSGeometry.h"
+#include "AliPHOSDigit.h"
 
 ClassImp(AliPHOSClusterizerv2)
 
+//____________________________________________________________________________
 AliPHOSClusterizerv2::AliPHOSClusterizerv2() : AliPHOSClusterizerv1() 
 {}
 
-AliPHOSClusterizerv2::AliPHOSClusterizerv2(const char * headerFile, const char * name, const Bool_t toSplit):
-AliPHOSClusterizerv1(headerFile,name,toSplit)
+//____________________________________________________________________________
+AliPHOSClusterizerv2::AliPHOSClusterizerv2(AliPHOSGeometry *geom):
+AliPHOSClusterizerv1(geom)
 {}
 
+//____________________________________________________________________________
 void AliPHOSClusterizerv2::GetNumberOfClustersFound(int* numb) const
 {
+  // Returns the number of found EMC and CPV rec.points
 
-  AliPHOSGetter * gime = AliPHOSGetter::GetInstance() ;   
-  numb[0] = gime->EmcRecPoints()->GetEntries();  
-  numb[1] = gime->CpvRecPoints()->GetEntries();  
+  numb[0] = fEMCRecPoints->GetEntries();  
+  numb[1] = fCPVRecPoints->GetEntries();  
 }
 
-void AliPHOSClusterizerv2::Exec(Option_t* option)
+//____________________________________________________________________________
+void AliPHOSClusterizerv2::Digits2Clusters(Option_t* option)
 {
+  // Steering method
 
   if(strstr(option,"tim"))
     gBenchmark->Start("PHOSClusterizer"); 
   
   if(strstr(option,"print"))
-    Print("") ; 
-
-  AliPHOSGetter * gime = AliPHOSGetter::GetInstance() ; 
+    Print() ; 
+}
+//   AliPHOSGetter * gime = AliPHOSGetter::Instance() ; 
 
-  TFolder* storage = dynamic_cast<TFolder*>(gROOT->FindObjectAny("Folders/Run/Event/RecData/RecPoints/PHOS")); 
-  TFolder* wPoolF =  storage->AddFolder("SmP","SmartRecPoints for PHOS");
+//   TFolder* wPoolF =  gime->PhosLoader()->GetDetectorDataFolder();
   
-  TObjArray* wPool = new TObjArray(400);
-  wPool->SetName("SmartPoints");
-  wPoolF->Add(wPool);
-  wPoolF->Add(this);
+//   TObjArray* wPool = new TObjArray(400);
+//   wPool->SetName("SmartPoints");
+//   wPoolF->Add(wPool);
+//   wPoolF->Add(this);
 
-  Int_t nevents = (Int_t) gAlice->TreeE()->GetEntries() ;
-  Int_t ievent ;
+//   Int_t nevents = gime->MaxEvent() ;
+//   Int_t ievent ;
 
-  for(ievent = 0; ievent<nevents; ievent++) {
+//   for(ievent = 0; ievent<nevents; ievent++) {
     
-    gAlice->GetEvent(ievent) ;
-    gAlice->SetEvent(ievent) ;
+//     gime->Event(ievent,"D") ;
     
-    gime->Event(ievent,"D") ;
-//      if(!ReadDigits(ievent))  //reads digits for event fEvent
-//        continue;
-    
-    cout<<" MakeClusters invoked..";
-    MakeClusters() ;
-    cout<<" done."<<endl;
+//     AliInfo(Form("MakeClusters invoked..")) ;
+//     MakeClusters() ;
+//     AliInfo(Form("MakeClusters done.")) ;
 
 
-    //SmartRecPoints will communicate with wPool.
+//     //SmartRecPoints will communicate with wPool.
 
-    AliPHOSEvalRecPoint* rp=0;
+//     AliPHOSEvalRecPoint* rp=0;
 
-    // CPV reconstruction
+//     // CPV reconstruction
 
-    AliPHOSRecCpvManager* recCpv = new AliPHOSRecCpvManager();
-    wPoolF->Add(recCpv);
+//     AliPHOSRecCpvManager* recCpv = new AliPHOSRecCpvManager();
+//     wPoolF->Add(recCpv);
 
-    Int_t iPoint; //loop variable
+//     Int_t iPoint; //loop variable
 
-    for(iPoint=0; iPoint<gime->CpvRecPoints()->GetEntriesFast(); iPoint++) {
-      rp = new AliPHOSEvalRecPoint(iPoint,AliPHOSEvalRecPoint::cpv);
-      rp->MakeJob();
-    }
+//     for(iPoint=0; iPoint<gime->CpvRecPoints()->GetEntriesFast(); iPoint++) {
+//       rp = new AliPHOSEvalRecPoint(iPoint, kTRUE);
+//       rp->MakeJob();
+//     }
 
-    AliPHOSEvalRecPoint pt;
-    pt.UpdateWorkingPool();
+//     AliPHOSEvalRecPoint pt;
+//     pt.UpdateWorkingPool();
 
-    TObjArray * cpvRecPoints = gime->CpvRecPoints() ; 
-    Int_t nOldCpv = cpvRecPoints->GetEntries();
-    cpvRecPoints->Delete();
-    cpvRecPoints->Compress();
+//     TObjArray * cpvRecPoints = gime->CpvRecPoints() ; 
+//     Int_t nOldCpv = cpvRecPoints->GetEntries();
+//     cpvRecPoints->Delete();
+//     cpvRecPoints->Compress();
 
-    Int_t i; //loop variable
+//     Int_t i; //loop variable
 
-    for(i=0; i<wPool->GetEntries(); i++)
-      cpvRecPoints->Add(wPool->At(i));
+//     for(i=0; i<wPool->GetEntries(); i++)
+//       cpvRecPoints->Add(wPool->At(i));
 
-    wPool->Clear();
-    wPool->Compress();
+//     wPool->Clear();
+//     wPool->Compress();
 
-    wPoolF->Remove(recCpv);
-    delete recCpv;
+//     wPoolF->Remove(recCpv);
+//     delete recCpv;
 
-    cout<<"       "<<gime->CpvRecPoints()->GetEntries()<<endl;
-    cout<<"       "<<cpvRecPoints->GetEntries()<<" cpvRecPoints."<<endl<<endl;
+//     AliInfo(Form("       %d", gime->CpvRecPoints()->GetEntries() )) ;
+//     AliInfo(Form("       %d cpvRecPoints", cpvRecPoints->GetEntries() )) ;
 
 
-    // Now Emc reconstruction
+//     // Now Emc reconstruction
 
-    AliPHOSRecEmcManager* recEmc = new AliPHOSRecEmcManager();
-    wPoolF->Add(recEmc);
+//     AliPHOSRecEmcManager* recEmc = new AliPHOSRecEmcManager();
+//     wPoolF->Add(recEmc);
 
-    for(iPoint=0; iPoint<gime->EmcRecPoints()->GetEntriesFast(); iPoint++) {
-      rp = new AliPHOSEvalRecPoint(iPoint,(Bool_t)AliPHOSEvalRecPoint::emc);
-      rp->MakeJob();
-    }
+//     for(iPoint=0; iPoint<gime->EmcRecPoints()->GetEntriesFast(); iPoint++) {
+//       rp = new AliPHOSEvalRecPoint(iPoint, kFALSE);
+//       rp->MakeJob();
+//     }
 
-    pt.UpdateWorkingPool();
+//     pt.UpdateWorkingPool();
 
-    TObjArray * emcRecPoints = gime->EmcRecPoints() ; 
-    Int_t nOldEmc = emcRecPoints->GetEntries();
-    emcRecPoints->Delete();
-    emcRecPoints->Compress();
+//     TObjArray * emcRecPoints = gime->EmcRecPoints() ; 
+//     Int_t nOldEmc = emcRecPoints->GetEntries();
+//     emcRecPoints->Delete();
+//     emcRecPoints->Compress();
 
-    for(i=0; i<wPool->GetEntries(); i++)
-      emcRecPoints->Add(wPool->At(i));
+//     for(i=0; i<wPool->GetEntries(); i++)
+//       emcRecPoints->Add(wPool->At(i));
 
-    wPool->Clear();
-    wPool->Compress();
+//     wPool->Clear();
+//     wPool->Compress();
 
-    wPoolF->Remove(recEmc);
-    delete recEmc;
+//     wPoolF->Remove(recEmc);
+//     delete recEmc;
 
-    cout<<"       "<<nOldCpv<<" OLD cpvRecPoints."<<endl;
-    cout<<"       "<<gime->CpvRecPoints()->GetEntries()<<endl;
-    cout<<"       "<<cpvRecPoints->GetEntries()<<" cpvRecPoints."<<endl<<endl;
+//     TString message ; 
+//     message  = "       %d  OLD cpvRecPoints\n" ; 
+//     message += "       %d\n" ; 
+//     message += "       %d cpvRecPoints\n" ; 
 
-    cout<<"       "<<nOldEmc<<" OLD emcRecPoints."<<endl;
-    cout<<"       "<<gime->EmcRecPoints()->GetEntries()<<endl;
-    cout<<"       "<<emcRecPoints->GetEntries()<<" emcRecPoints."<<endl<<endl;
+//     message += "       %d OLD emcRecPoints " ; 
+//     message += "       %d\n" ;
+//     message += "       %d emcRecPoints\n" ;
 
-    WriteRecPoints(ievent);
+//     AliInfo(Form("%s", message.Data(), 
+//      nOldCpv, 
+//      gime->CpvRecPoints()->GetEntries(),cpvRecPoints->GetEntries(), 
+//      nOldEmc, 
+//      gime->EmcRecPoints()->GetEntries(), emcRecPoints->GetEntries() )); 
+    
 
+//     WriteRecPoints();
 
-  } // loop over events
 
-  if(strstr(option,"tim")) {
-    gBenchmark->Stop("PHOSClusterizer");
-    cout << "AliPHOSClusterizer:" << endl ;
-    cout << "  took " << gBenchmark->GetCpuTime("PHOSClusterizer") << " seconds for Clusterizing " << endl;
-    cout << endl ;
+//   } // loop over events
 
-  }
+//   if(strstr(option,"tim")) {
+//     gBenchmark->Stop("PHOSClusterizer");
+//     AliInfo(Form("took %f seconds for Clusterizing", gBenchmark->GetCpuTime("PHOSClusterizer") )) ;
+//   }
+// }
 
-}
-//---------------------------------------------------------------------------------
+//____________________________________________________________________________
 Int_t AliPHOSClusterizerv2::AreNeighbours(AliPHOSDigit* d1, AliPHOSDigit* d2) const
 {
   // Points are neighbours if they have common edge.
@@ -168,15 +193,13 @@ Int_t AliPHOSClusterizerv2::AreNeighbours(AliPHOSDigit* d1, AliPHOSDigit* d2) co
   // The order of d1 and d2 is important: first (d1) should be a digit already in a cluster 
   // which is compared to a digit (d2)  not yet in a cluster  
 
-  const AliPHOSGeometry * geom = AliPHOSGetter::GetInstance()->PHOSGeometry();
-
   Int_t rv = 0 ; 
 
   Int_t relid1[4] ; 
-  geom->AbsToRelNumbering(d1->GetId(), relid1) ; 
+  fGeom->AbsToRelNumbering(d1->GetId(), relid1) ; 
 
   Int_t relid2[4] ; 
-  geom->AbsToRelNumbering(d2->GetId(), relid2) ; 
+  fGeom->AbsToRelNumbering(d2->GetId(), relid2) ; 
  
   if ( (relid1[0] == relid2[0]) && (relid1[1]==relid2[1]) ) { // inside the same PHOS module and the same PPSD Module 
     Int_t rowdiff = TMath::Abs( relid1[2] - relid2[2] ) ;