]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - ITS/AliITSreconstruction.cxx
technial fix to suppress the warning
[u/mrichter/AliRoot.git] / ITS / AliITSreconstruction.cxx
index 684fc6d3e6a07fdebc3e7429f63dae6fad975d2f..0e099239b85e9991eff1f2a7606237a5694063f7 100644 (file)
  **************************************************************************/
  
 /* $Id$ */
+/////////////////////////////////////////////////////////////////////////
+//                                                                     //
+// Class for ITS RecPoint reconstruction                               //
+//                                                                     //
+////////////////////////////////////////////////////////////////////////
 
-#include <TROOT.h>
-#include <TFile.h>
-#include <TSeqCollection.h>
 #include <TString.h>
-#include <TClonesArray.h>
-
 #include "AliRun.h"
 #include "AliRunLoader.h"
-
-#include "AliITS.h"
-#include "AliITSDetType.h"
+#include "AliITSDetTypeRec.h"
 #include "AliITSLoader.h"
 #include "AliITSreconstruction.h"
-#include "AliITSsegmentationSPD.h"
-#include "AliITSsegmentationSDD.h"
-#include "AliITSsegmentationSSD.h"
-#include "AliITSClusterFinderSPD.h"
-#include "AliITSClusterFinderSDD.h"
-#include "AliITSClusterFinderSSD.h"
-#include "AliITSresponseSDD.h"
 #include "AliITSgeom.h"
 
+using std::endl;
+using std::cout;
 ClassImp(AliITSreconstruction)
 
 //______________________________________________________________________
@@ -44,8 +37,9 @@ AliITSreconstruction::AliITSreconstruction():
  fInit(kFALSE),
  fEnt(0),
  fEnt0(0),
- fITS(0x0),
+ fDetTypeRec(0x0),
  fDfArp(kFALSE),
+ fITSgeom(0x0),
  fLoader(0x0),
  fRunLoader(0x0)
 {
@@ -64,8 +58,9 @@ AliITSreconstruction::AliITSreconstruction(AliRunLoader *rl):
  fInit(kFALSE),
  fEnt(0),
  fEnt0(0),
- fITS(0x0),
+ fDetTypeRec(0x0),
  fDfArp(kFALSE),
+ fITSgeom(0x0),
  fLoader(0x0),
  fRunLoader(rl)
 {
@@ -76,8 +71,9 @@ AliITSreconstruction::AliITSreconstruction(const char* filename):
  fInit(kFALSE),
  fEnt(0),
  fEnt0(0),
- fITS(0x0),
+ fDetTypeRec(0x0),
  fDfArp(kFALSE),
+ fITSgeom(0x0),
  fLoader(0x0),
  fRunLoader(0x0)
 {
@@ -98,24 +94,20 @@ AliITSreconstruction::AliITSreconstruction(const char* filename):
     fRunLoader = AliRunLoader::Open(filename);
     if (fRunLoader == 0x0)
      {
-       Error("AliITSreconstruction","Can not load the session",filename);
+       Error("AliITSreconstruction","Can not load the session %s \n",filename);
        return;
      }
-    fRunLoader->LoadgAlice();
-    gAlice = fRunLoader->GetAliRun();
-
-    if(!gAlice) {
-          Error("AliITSreconstruction","gAlice not found on file. Aborting.");
-          fInit = kFALSE;
-          return;
-      } // end if !gAlice
 
 }
+
+
 //______________________________________________________________________
 AliITSreconstruction::~AliITSreconstruction(){
     //    A destroyed AliITSreconstruction class.
+    
+    //fITS      = 0;
     delete fRunLoader;
-    fITS      = 0;
+    
 }
 //______________________________________________________________________
 Bool_t AliITSreconstruction::Init(){
@@ -126,14 +118,14 @@ Bool_t AliITSreconstruction::Init(){
     //   none.
     // Return:
     //    kTRUE if no errors initilizing this class occurse else kFALSE
-    Info("Init","");
+    Info("Init"," Init ITS reconstruction");
     if (fRunLoader == 0x0)
      {
        Error("Init","Run Loader is NULL");
        return kFALSE;
      }
-    fRunLoader->LoadgAlice();
-    fRunLoader->LoadHeader();  
+    //  fRunLoader->LoadgAlice();
+    //   fRunLoader->LoadHeader();  
 
     fLoader = (AliITSLoader*) fRunLoader->GetLoader("ITSLoader");
     if(!fLoader) {
@@ -141,32 +133,27 @@ Bool_t AliITSreconstruction::Init(){
       fInit = kFALSE;
     }
 
-    //Int_t retcode;
-    fITS = (AliITS*) gAlice->GetDetector("ITS");
-    if(!fITS){
-      cout << "ITS not found aborting. fITS=" << fITS << endl;
-      fInit = kFALSE;
-      return fInit;
-    } // end if !fITS
-    if(!(fITS->GetITSgeom())){
-      cout << "ITSgeom not found aborting."<< endl;
-      fInit = kFALSE;
-      return fInit;
-    } // end if !GetITSgeom()
     // Now ready to init.
+    //fRunLoader->CdGAFile();
+    fITSgeom = fLoader->GetITSgeom();
 
+    fDetTypeRec = new AliITSDetTypeRec();
+    fDetTypeRec->SetITSgeom(fITSgeom);
+    fDetTypeRec->SetDefaults();
     fDet[0] = fDet[1] = fDet[2] = kTRUE;
     fEnt0 = 0;
 
-    fEnt  = gAlice->GetEventsPerRun();
+    fEnt = Int_t(fRunLoader->GetNumberOfEvents());
 
     fLoader->LoadDigits("read");
     fLoader->LoadRecPoints("recreate");
-    fLoader->LoadRawClusters("recreate");
     if (fLoader->TreeR() == 0x0) fLoader->MakeTree("R");
-    fITS->MakeBranch("R");
-    fITS->MakeBranchC();
-    fITS->SetTreeAddress();
+    fDetTypeRec->SetTreeAddressD(fLoader->TreeD());
+    fDetTypeRec->MakeBranchR(fLoader->TreeR());
+    fDetTypeRec->SetTreeAddressR(fLoader->TreeR());
+
     fInit = InitRec();
 
     Info("Init","  Done\n\n\n");
@@ -182,47 +169,11 @@ Bool_t AliITSreconstruction::InitRec(){
     //      none.
     // Return:
     //      none.
-    AliITSDetType *idt;
 
-    // SPD
-    if(fDet[kSPD]){
-      Info("InitRec","SPD");
-      idt = fITS->DetType(kSPD);
-      AliITSsegmentationSPD *segSPD = (AliITSsegmentationSPD*)idt->GetSegmentationModel();
-      TClonesArray *digSPD = fITS->DigitsAddress(kSPD);
-      TClonesArray *recpSPD = fITS->ClustersAddress(kSPD);
-      Info("InitRec","idt = %#x; digSPD = %#x; recpSPD = %#x",idt,digSPD,recpSPD);
-      AliITSClusterFinderSPD *recSPD = new AliITSClusterFinderSPD(segSPD,digSPD,recpSPD);
-      fITS->SetReconstructionModel(kSPD,recSPD);
-    } // end if fDet[kSPD].
-    // SDD
-    if(fDet[kSDD]){
-      Info("InitRec","SDD");
-      idt = fITS->DetType(kSDD);
-      AliITSsegmentationSDD *segSDD = (AliITSsegmentationSDD*)
-                                         idt->GetSegmentationModel();
-      AliITSresponseSDD *resSDD = (AliITSresponseSDD*)
-                                         idt->GetResponseModel();
-      TClonesArray *digSDD = fITS->DigitsAddress(kSDD);
-      TClonesArray *recpSDD = fITS->ClustersAddress(kSDD);
-      AliITSClusterFinderSDD *recSDD =new AliITSClusterFinderSDD(segSDD,
-                                                   resSDD,
-                                                 digSDD,recpSDD);
-      fITS->SetReconstructionModel(kSDD,recSDD);
-    } // end if fDet[kSDD]
-    // SSD
-    if(fDet[kSSD]){
-      Info("InitRec","SSD");
-      idt = fITS->DetType(kSSD);
-      AliITSsegmentationSSD *segSSD = (AliITSsegmentationSSD*)
-                                       idt->GetSegmentationModel();
-      TClonesArray *digSSD = fITS->DigitsAddress(kSSD);
-      AliITSClusterFinderSSD *recSSD =new AliITSClusterFinderSSD(segSSD,
-                                                   digSSD);
-      fITS->SetReconstructionModel(kSSD,recSSD);
-    } // end if fDet[kSSD]
-    Info("InitRec","    Done\n");
-    return kTRUE;
+
+  fDetTypeRec->SetDefaultClusterFindersV2();
+  Info("InitRec","    Done\n");
+  return kTRUE;
 }
 //______________________________________________________________________ 
 void AliITSreconstruction::Exec(const Option_t *opt){
@@ -235,8 +186,14 @@ void AliITSreconstruction::Exec(const Option_t *opt){
     //      none.
     Option_t *lopt;
     Int_t evnt;
-
-    if(strstr(opt,"All")||strstr(opt,"ALL")||strstr(opt,"ITS")||opt==0){
+    Bool_t condition =kFALSE;
+    if(opt){
+      if(strstr(opt,"All")||strstr(opt,"ALL")||strstr(opt,"ITS"))condition =kTRUE;
+    }
+    else{
+      condition = kTRUE;
+    }
+    if(condition){
       fDet[0] = fDet[1] = fDet[2] = kTRUE;
       lopt = "All";
     }else{
@@ -252,26 +209,31 @@ void AliITSreconstruction::Exec(const Option_t *opt){
       cout << "Initilization Failed, Can't run Exec." << endl;
       return;
     } // end if !fInit
-
     for(evnt=0;evnt<fEnt;evnt++)
      {
-      Info("Exec","");
+       //      Info("Exec","");
       Info("Exec","Processing Event %d",evnt);
-      Info("Exec","");
+      //      Info("Exec","");
 
       fRunLoader->GetEvent(evnt);
       if (fLoader->TreeR() == 0x0) fLoader->MakeTree("R");
-      fITS->MakeBranch("R");
-      if (fLoader->TreeC() == 0x0) fITS->MakeTreeC();
-      fITS->SetTreeAddress();
-      fITS->DigitsToRecPoints(evnt,0,lopt);
+      fDetTypeRec->MakeBranchR(0);
+      fDetTypeRec->SetTreeAddressR(fLoader->TreeR());
+      fDetTypeRec->SetTreeAddressD(fLoader->TreeD());
+      fDetTypeRec->DigitsToRecPoints(fLoader->TreeD(),fLoader->TreeR(),0,lopt);
     } // end for evnt
 }
 //______________________________________________________________________ 
 void AliITSreconstruction::SetOutputFile(TString filename){
-  // Set a file name for recpoints. Used only if this file is not the file
-  // containing digits. This obj is deleted by AliRun.
-  Error("SetOutputFile",
-       "Use AliLoader::SetRecPointsFileName(TString&)instead filename=%s",
-       filename.Data());
+  // Set a new file name for recpoints. 
+  // It must be called before Init()
+  if(!fLoader)fLoader = (AliITSLoader*) fRunLoader->GetLoader("ITSLoader");
+  if(fLoader){
+    Info("SetOutputFile","name for rec points is %s",filename.Data());
+    fLoader->SetRecPointsFileName(filename);
+  }
+  else {
+    Error("SetOutputFile",
+    "ITS loader not available. Not possible to set name: %s",filename.Data());
+  }
 }