New TTask based method to do Digits To clusters. Works with files of multiple
authornilsen <nilsen@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 30 Jan 2002 22:20:23 +0000 (22:20 +0000)
committernilsen <nilsen@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 30 Jan 2002 22:20:23 +0000 (22:20 +0000)
events in the file. Macro added to show how to use. Also the changes made
in the nessesary complilation files.

ITS/AliITSDigits2Clusters.C [new file with mode: 0644]
ITS/AliITSreconstruction.cxx [new file with mode: 0644]
ITS/AliITSreconstruction.h [new file with mode: 0644]
ITS/ITSLinkDef.h
ITS/Makefile
ITS/libITS.pkg

diff --git a/ITS/AliITSDigits2Clusters.C b/ITS/AliITSDigits2Clusters.C
new file mode 100644 (file)
index 0000000..8dc5b6d
--- /dev/null
@@ -0,0 +1,5 @@
+void AliITSDigits2Clusters(const char *filename="galice.root"){
+    AliITSreconstruction *itsr = new AliITSreconstruction(filename);
+    itsr->Exec(); 
+    delete itsr;
+}
diff --git a/ITS/AliITSreconstruction.cxx b/ITS/AliITSreconstruction.cxx
new file mode 100644 (file)
index 0000000..ae7efa1
--- /dev/null
@@ -0,0 +1,218 @@
+/**************************************************************************
+ * 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.                  *
+ **************************************************************************/
+/*
+$Log$
+*/
+#include <TROOT.h>
+#include <TFile.h>
+#include <TSeqCollection.h>
+#include <TString.h>
+#include <TClonesArray.h>
+
+#include "AliRun.h"
+
+#include "AliITS.h"
+#include "AliITSDetType.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"
+
+ClassImp(AliITSreconstruction)
+
+//______________________________________________________________________
+AliITSreconstruction::AliITSreconstruction(){
+    // Default constructor.
+    // Inputs:
+    //  none.
+    // Outputs:
+    //   none.
+    // Return:
+    //    A zero-ed constructed AliITSreconstruction class.
+
+    fFilename = "";
+    fFile     = 0;
+    fITS      = 0;
+    fDet[0] = fDet[1] = fDet[2] = kTRUE;
+    fInit     = kFALSE;
+}
+//______________________________________________________________________
+AliITSreconstruction::AliITSreconstruction(const char* filename){
+    // Standard constructor.
+    // Inputs:
+    //  const char* filename    filename containing the digits to be
+    //                          reconstructed
+    // Outputs:
+    //   none.
+    // Return:
+    //    A standardly constructed AliITSreconstruction class.
+
+    fFilename = filename;
+
+    fFile = (TFile*)gROOT->GetListOfFiles()->FindObject(fFilename.Data());
+    if(fFile) fFile->Close();
+    fFile = new TFile(fFilename.Data(),"UPDATE");
+    //
+    if(gAlice) delete gAlice;
+    gAlice = (AliRun*)fFile->Get("gAlice");
+    if(!gAlice) {
+       cout << "gAlice not found on file. Aborting." << endl;
+       fInit = kFALSE;
+       return;
+    } // end if !gAlice
+
+    Init();
+}
+//______________________________________________________________________
+AliITSreconstruction::~AliITSreconstruction(){
+    // Default constructor.
+    // Inputs:
+    //  none.
+    // Outputs:
+    //   none.
+    // Return:
+    //    A destroyed AliITSreconstruction class.
+
+    if(fFile) fFile->Close();
+    fFile     = 0;
+    fITS      = 0;
+    
+}
+//______________________________________________________________________
+Bool_t AliITSreconstruction::Init(){
+    // Class Initilizer.
+    // Inputs:
+    //  none.
+    // Outputs:
+    //   none.
+    // Return:
+    //    kTRUE if no errors initilizing this class occurse else kFALSE
+    Int_t nparticles;
+
+    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.
+
+    fDet[0] = fDet[1] = fDet[2] = kTRUE;
+    fEnt0 = 0;
+    fEnt  = gAlice->GetEventsPerRun();
+    fITS->MakeTreeC();
+    nparticles = gAlice->GetEvent(fEnt0);
+    
+    // finished init.
+    fInit = InitRec();
+    return fInit;
+}
+//______________________________________________________________________
+Bool_t AliITSreconstruction::InitRec(){
+    // Sets up Reconstruction part of AliITSDetType..
+    // Inputs:
+    //      none.
+    // Outputs:
+    //      none.
+    // Return:
+    //      none.
+    AliITSDetType *idt;
+
+    // SPD
+    if(fDet[kSPD]){
+       idt = fITS->DetType(kSPD);
+       AliITSsegmentationSPD *segSPD = (AliITSsegmentationSPD*)
+                                              idt->GetSegmentationModel();
+       TClonesArray *digSPD = fITS->DigitsAddress(kSPD);
+       TClonesArray *recpSPD = fITS->ClustersAddress(kSPD);
+       AliITSClusterFinderSPD *recSPD = new AliITSClusterFinderSPD(segSPD,
+                                                                   digSPD,
+                                                                   recpSPD);
+       fITS->SetReconstructionModel(kSPD,recSPD);
+    } // end if fDet[kSPD].
+    // SDD
+    if(fDet[kSDD]){
+       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]){
+       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]
+
+    return kTRUE;
+}
+//______________________________________________________________________ 
+void AliITSreconstruction::Exec(const Option_t *opt){
+    // Main reconstruction function.
+    // Inputs:
+    //      Option_t * opt   list of subdetector to digitize. =0 all.
+    // Outputs:
+    //      none.
+    // Return:
+    //      none.
+    Option_t *lopt;
+    Int_t nparticles,evnt;
+
+    if(strstr(opt,"All")||strstr(opt,"ALL")||strstr(opt,"ITS")||opt==0){
+       fDet[0] = fDet[1] = fDet[2] = kTRUE;
+       lopt = "All";
+    }else{
+       fDet[0] = fDet[1] = fDet[2] = kFALSE;
+       if(strstr(opt,"SPD")) fDet[kSPD] = kTRUE;
+       if(strstr(opt,"SDD")) fDet[kSDD] = kTRUE;
+       if(strstr(opt,"SSD")) fDet[kSSD] = kTRUE;
+       if(fDet[kSPD] && fDet[kSDD] && fDet[kSSD]) lopt = "All";
+       else lopt = opt;
+    } // end if strstr(opt,...)
+
+    if(!fInit){
+       cout << "Initilization Failed, Can't run Exec." << endl;
+       return;
+    } // end if !fInit
+    for(evnt=0;evnt<fEnt;evnt++){
+       nparticles = gAlice->GetEvent(evnt);
+       gAlice->SetEvent(evnt);
+       if(!gAlice->TreeR()) gAlice->MakeTree("R");
+       fITS->MakeBranch("R");
+       fITS->DigitsToRecPoints(evnt,0,lopt);
+    } // end for evnt
+}
diff --git a/ITS/AliITSreconstruction.h b/ITS/AliITSreconstruction.h
new file mode 100644 (file)
index 0000000..5d8fb10
--- /dev/null
@@ -0,0 +1,37 @@
+#ifndef ALIITSRECONSTRUCTION_H
+#define ALIITSRECONSTRUCTION_H
+/* Copyright (c) 1998-2001, ALICE Experiment at CERN, All rights reserved *
+ * See cxx source for full Copyright notice                               */
+/*
+  $Id$
+ */
+
+#include <TTask.h>
+
+class TString;
+class AliITS;
+
+class AliITSreconstruction : public TTask{
+ public:
+    AliITSreconstruction(); // default constructor
+    AliITSreconstruction(const char *filename); // standard constructor
+    virtual ~AliITSreconstruction();//Destructor
+    virtual Bool_t Init();
+    virtual void Exec(const Option_t *opt="ALL");
+ private:
+    Bool_t InitRec();  // Standard Reconstrution initilization.
+ private:
+    TFile   *fFile;    //! pointer to the file contatining the digits and
+                       // and will contain the RecPoints
+    Bool_t  fDet[3];   //! logical specifing which detectors to reconstruct.
+    Bool_t  fInit;     //! True if Init was sucessfull, else false.
+    TString fFilename; //! input filename for Digits
+    Int_t   fEnt;      //! Number of events to processevent index.
+    Int_t   fEnt0;     //! first event to process, default 0.
+    AliITS  *fITS;     //! Local pointer to ITS class.
+
+    ClassDef(AliITSreconstruction,1) // Task to Reconstruct ITS from Digits.
+
+};
+#endif
index 0868e42226e2809f022992dd76b4733f7f1d4edc..f31664bb752d87d8937a8c55243dad81dcf89329 100644 (file)
 #pragma link C++ class  AliCascadeVertexer+;
 
 #pragma link C++ class  AliITSVertex+;
-
 // Classes for neural tracking
 #pragma link C++ class AliITSglobalRecPoint+;
 #pragma link C++ class AliITSneuron+;
 #pragma link C++ class AliITSneuralTrack+;
 #pragma link C++ class AliITSneuralTracker+;
-
+// Tasks
+#pragma link C++ class AliITSreconstruction+;
+#pragma link C++ class AliITSDigitizer+;
 #endif
index 7402c52306fd62a619498e581d3302ddecf44218..16031a50d8d56d5b7b922e8d60a9566392985a7f 100644 (file)
@@ -43,7 +43,7 @@ SRCS          = AliITS.cxx AliITSv1.cxx AliITSv3.cxx AliITSv5.cxx \
                AliITSvtest.cxx \
                 AliITSclusterV2.cxx AliITStrackV2.cxx AliITStrackerV2.cxx \
                AliITSPid.cxx AliITStrackV2Pid.cxx  \
-               AliITSVertex.cxx \
+                AliITSDigitizer.cxx AliITSreconstruction.cxx \
                AliV0vertex.cxx AliV0vertexer.cxx \
                AliCascadeVertex.cxx AliCascadeVertexer.cxx \
                AliITSglobalRecPoint.cxx AliITSneuralTrack.cxx \
index d9ffec9ef3defd7560bf52a7972be48bdc5b47f8..0049314b91d2517c3648ae8b7d5ed32bcd124d68 100644 (file)
@@ -32,7 +32,8 @@ SRCS          = AliITS.cxx AliITSv1.cxx AliITSv3.cxx AliITSv5.cxx \
                AliITSvtest.cxx \
                 AliITSclusterV2.cxx AliITStrackV2.cxx AliITStrackerV2.cxx \
                AliITSVertex.cxx \
-        AliV0vertex.cxx AliV0vertexer.cxx
+                AliV0vertex.cxx AliV0vertexer.cxx \
+                AliITSDigitizer.cxx AliITSreconstruction.cxx 
 #              AliITSAlignmentTrack.cxx AliITSAlignmentModule.cxx \
 
 HDRS:=  $(SRCS:.cxx=.h)