New TTask method for creating SDigits from Hits.
authornilsen <nilsen@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 28 Mar 2002 16:25:26 +0000 (16:25 +0000)
committernilsen <nilsen@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 28 Mar 2002 16:25:26 +0000 (16:25 +0000)
ITS/AliITSsDigitize.cxx [new file with mode: 0644]
ITS/AliITSsDigitize.h [new file with mode: 0644]
ITS/ITSLinkDef.h
ITS/Makefile
ITS/libITS.pkg

diff --git a/ITS/AliITSsDigitize.cxx b/ITS/AliITSsDigitize.cxx
new file mode 100644 (file)
index 0000000..6a6fdb4
--- /dev/null
@@ -0,0 +1,184 @@
+/**************************************************************************
+ * 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 "AliHeader.h"
+#include "AliRun.h"
+#include "AliITS.h"
+#include "AliITSsDigitize.h"
+#include "AliITSgeom.h"
+ClassImp(AliITSsDigitize)
+//______________________________________________________________________
+AliITSsDigitize::AliITSsDigitize(){
+    // Default constructor.
+    // Inputs:
+    //  none.
+    // Outputs:
+    //   none.
+    // Return:
+    //    A zero-ed constructed AliITSsDigitize class.
+    fFilename = "";
+    fFile     = 0;
+    fITS      = 0;
+    fDet[0] = fDet[1] = fDet[2] = kTRUE;
+    fInit     = kFALSE;
+}
+//______________________________________________________________________
+AliITSsDigitize::AliITSsDigitize(const char* filename){
+    // Standard constructor.
+    // Inputs:
+    //  const char* filename    filename containing the digits to be
+    //                          reconstructed. If filename = 0 (nil)
+    //                          then no file is opened but a file is
+    //                          assumed to already be opened. This
+    //                          already opened file will be used.
+    // Outputs:
+    //   none.
+    // Return:
+    //    A standardly constructed AliITSsDigitize class.
+    fFilename = filename;
+    if(filename){
+        fFile = (TFile*)gROOT->GetListOfFiles()->FindObject(fFilename.Data());
+        if(fFile) fFile->Close();
+        fFile = new TFile(fFilename.Data(),"UPDATE");
+        //
+        if(gAlice) {
+          delete gAlice;
+          gAlice = 0;
+        }
+        gAlice = (AliRun*)fFile->Get("gAlice");
+        if(!gAlice) {
+            cout << "gAlice not found on file. Aborting." << endl;
+            fInit = kFALSE;
+            return;
+        } // end if !gAlice
+    } // end if !filename.
+    Init();
+}
+//______________________________________________________________________
+AliITSsDigitize::~AliITSsDigitize(){
+    // Default constructor.
+    // Inputs:
+    //  none.
+    // Outputs:
+    //   none.
+    // Return:
+    //    A destroyed AliITSsDigitize class.
+    if(fFile) fFile->Close();
+    fFile     = 0;
+    fITS      = 0;
+}
+//______________________________________________________________________
+Bool_t AliITSsDigitize::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(); 
+    if(!gAlice->TreeS()){
+        cout << "Having to create the SDigits Tree." << endl;
+        gAlice->MakeTree("S");
+    } // end if !gAlice->TreeS()
+    //make branch
+    fITS->MakeBranch("S");
+    fITS->SetTreeAddress();
+    nparticles = gAlice->GetEvent(fEnt0);
+    // finished init.
+    fInit = InitSDig();
+    return fInit;
+}
+//______________________________________________________________________
+Bool_t AliITSsDigitize::InitSDig(){
+    // Sets up SDigitization part of AliITSDetType..
+    // Inputs:
+    //      none.
+    // Outputs:
+    //      none.
+    // Return:
+    //      none.
+    return kTRUE;
+}
+//______________________________________________________________________
+void AliITSsDigitize::Exec(const Option_t *opt){
+    // Main SDigitization 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
+
+    fITS->HitsToSDigits(gAlice->GetHeader()->GetEvent(),0,-1," ",lopt," ");
+}
diff --git a/ITS/AliITSsDigitize.h b/ITS/AliITSsDigitize.h
new file mode 100644 (file)
index 0000000..2a1c733
--- /dev/null
@@ -0,0 +1,37 @@
+#ifndef ALIITSSDIGITIZATION_H
+#define ALIITSSDIGITIATION_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 AliITSsDigitize : public TTask{
+ public:
+    AliITSsDigitize(); // default constructor
+    AliITSsDigitize(const char *filename); // standard constructor
+    virtual ~AliITSsDigitize();//Destructor
+    virtual Bool_t Init();
+    virtual void Exec(const Option_t *opt="ALL");
+ private:
+    Bool_t InitSDig();  // Standard SDigitization initilization.
+ private:
+    TFile   *fFile;    //! pointer to the file contatining the hits and
+                       // and will contain the SDigits
+    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 Hits
+    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(AliITSsDigitize,1) // Task to SDigitize ITS from Hits.
+};
+#endif
index 7f4b748..e358bdc 100644 (file)
 #pragma link C++ class AliITSneuralTracker+;
 // Tasks
 #pragma link C++ class AliITSreconstruction+;
+#pragma link C++ class AliITSsDigitize+;
 #pragma link C++ class AliITSDigitizer+;
 #endif
index 45aa9f0..1cd46d8 100644 (file)
@@ -41,7 +41,7 @@ SRCS          = AliITS.cxx AliITSv1.cxx AliITSv3.cxx AliITSv5.cxx \
                AliITSRad.cxx AliITSgeoinfo.cxx AliITSTrackerV1.cxx\
                AliITSvtest.cxx \
                 AliITSclusterV2.cxx AliITStrackV2.cxx AliITStrackerV2.cxx \
-               AliITSPid.cxx AliITStrackV2Pid.cxx  \
+               AliITSPid.cxx AliITStrackV2Pid.cxx AliITSsDigitize.cxx \
                 AliITSDigitizer.cxx AliITSreconstruction.cxx \
                AliV0vertex.cxx AliV0vertexer.cxx \
                AliCascadeVertex.cxx AliCascadeVertexer.cxx \
index 7deb851..1398fdc 100644 (file)
@@ -35,7 +35,7 @@ SRCS          = AliITS.cxx AliITSv1.cxx AliITSv3.cxx AliITSv5.cxx \
                 AliITSPid.cxx AliITStrackV2Pid.cxx AliCascadeVertex.cxx \
                 AliCascadeVertexer.cxx  AliITSneuralTrack.cxx \
                 AliITSneuralTracker.cxx AliITSglobalRecPoint.cxx \
-                AliITSDigitizer.cxx AliITSreconstruction.cxx \
+                AliITSsDigitize.cxx AliITSDigitizer.cxx AliITSreconstruction.cxx \
                AliITSRiemannFit.cxx 
 #              AliITSAlignmentTrack.cxx AliITSAlignmentModule.cxx \