]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - ITS/AliITSDetTypeSim.h
One instance of AliITSresponse per sensor - AliITSresponse objects read/stored from...
[u/mrichter/AliRoot.git] / ITS / AliITSDetTypeSim.h
index b4c8762ecfce292ce806703af8ae1014730cc67a..c8800d339fb8aaf4ae9c1b3828ff4c8c3404bb06 100644 (file)
 $Id$ 
 */
 
-/**********************************************************************
- * This class contains all of the "external" information needed to do *
- * detector specific simulations for the ITS.                         *
- **********************************************************************/
+/////////////////////////////////////////////////////////////////////////
+// * This class contains all of the "external" information needed to do//
+// * detector specific simulations for the ITS.                        //
+/////////////////////////////////////////////////////////////////////////
+
 #include <TObject.h>
 #include <TObjArray.h>
 #include <TClonesArray.h>
 
-#include "AliITSgeom.h"
-
+class TTree;
+class AliCDBMetaData;
+class AliITSdigit;
+class AliITSmodule;
+class AliITSpListItem;
 class AliITSsimulation;
 class AliITSsegmentation;
-class AliITSresponce;
+class AliITSresponse;
+class AliLoader;
+class AliITSgeom;
 
 class AliITSDetTypeSim : public TObject {
-  public:
-    AliITSDetTypeSim(); // Default constructor
-    virtual ~AliITSDetTypeSim(); // Proper Destructor
-    virtual AliITSDetTypeSim(const AliITSDetTypeSim &source);
-
-    // AliITSgeom related functions
-    // Return the pointer to the AliITSgeom object for simulation
-    AliITSgeom *GetITSgeom() const{return fGeom;}
-    // Set the pointer to the AliITSgeom object for simulation
+ public:
+  
+    AliITSDetTypeSim();
+    virtual ~AliITSDetTypeSim(); 
+    AliITSDetTypeSim(const AliITSDetTypeSim &source);
+    AliITSDetTypeSim& operator=(const AliITSDetTypeSim &source);
+    AliITSgeom *GetITSgeom() const {return fGeom;}
     void SetITSgeom(AliITSgeom *geom){fGeom=geom;}
+    
+    virtual void SetSimulationModel(Int_t dettype,AliITSsimulation *sim);
+    virtual AliITSsimulation* GetSimulationModel(Int_t dettype);        
+    virtual AliITSsimulation* GetSimulationModelByModule(Int_t module);
+        
+    virtual void SetSegmentationModel(Int_t dettype,AliITSsegmentation *seg);
+    virtual AliITSsegmentation* GetSegmentationModel(Int_t dettype);
+    virtual AliITSsegmentation* GetSegmentationModelByModule(Int_t module);
+
+    virtual void SetResponseModel(Int_t iMod,AliITSresponse *resp);
+    //   virtual void SetResponse(Int_t dettype, Int_t iMod, AliITSresponse *resp);
+    virtual AliITSresponse* GetResponseModel(Int_t iMod);
+
+    TObjArray* GetResponse() const {return fResponse;}
+    TObjArray* GetSegmentation() const {return fSegmentation;}
+    void ResetResponse();
+    void ResetSegmentation();
+
+    virtual void SetLoader(AliLoader* loader) {fLoader=loader;}
+    AliLoader* GetLoader() const {return fLoader;}
+
+    virtual void SetDefaults();
+    virtual void SetDefaultSimulation();
+    virtual void SetRunNumber(Int_t rn=0){fRunNumber = rn;}
+    virtual Int_t GetRunNumber() const {return fRunNumber;}
+    virtual void SetTreeAddressS(TTree* treeS, Char_t* name);
+    virtual void SetTreeAddressD(TTree* treeD, Char_t* name);
+
+    virtual void SetSDigits(TClonesArray* sdigits) {fSDigits=sdigits;}
+    virtual void SetDigits(TObjArray* digits) {fDigits=digits;}
+    TClonesArray* GetSDigits() const {return fSDigits;}
+    TObjArray*    GetDigits() const {return fDigits;}
+    Int_t* GetNDigitArray() const {return fNDigits;}
+    TClonesArray *DigitsAddress(Int_t id) const { return ((TClonesArray*)(*fDigits)[id]);}
 
-    // AliITSmodule related functions
-    // Return Pointer to array of hits by module number
-    TObjArray *GetModules(){return fHitModule;}
-    // Return Pointer to hits for a specific module number
-    AliITSmodule *GetModule(Int_t index){
-        return (AliITSmodule*)(fHitModule->At(index));}
-
-    // AliITSsimulation related functions
-    // Set the simulation model for a give type of detector
-    virtual void SetSimulationModel(Int_t dettype,AliITSsimulation *sim){
-        if(fSimulation==0) fSimulation = new TObjArray();
-        if(fSimulation->At(dettype)!=0) delete fSimulation->At(dettype);
-        fSimulation->AddAt(sim,dettype);}
-    // Return the simulation model for a give detector type
-    virtual AliITSsimulation* GetSimulationModel(Int_t dettype){
-        if(fSimulation==0) return 0; return fSimulation->At(dettype);}
-    // Return the simulation model for a given module (checks AliITSgeom)
-    virtual AliITSsimulation* GetSimulationModelByModule(Int_t module){
-        if(fGeom==0) return 0;
-        return GetSimulationModel(fGeom->GetModuleType(module));}
-
-    // AliITSsegmentation related functions
-    // Set the segmentation model for a give type of detector
-    virtual void SetSegmentationModel(Int_t dettype,AliITSsegmentation *seg){
-        if(fSegmentation==0) fSegmentation = new TObjArray();
-        if(fSegmentation->At(dettype)!=0) delete fSegmentation->At(dettype);
-        fSegmentation->AddAt(seg,dettype);}
-    // Return the segmentation model for a give detector type
-    virtual AliITSsegmentation* GetSegmentationModel(Int_t dettype){
-        if(fSegmentation==0) return 0; return fSegmentation->At(dettype);}
-    // Return the segmentation model for a given module (checks AliITSgeom)
-    virtual AliITSsegmentation* GetSegmentationModelByModule(Int_t module){
-        if(fGeom==0) return 0;
-        return GetSegmentationModel(fGeom->GetModuleType(module));}
-
-    // AliITSresponse related functions
-    // Set the response model for a give module
-    virtual void SetResponseModel(Int_t module,AliITSresponse *resp){
-        if(fResponse==0) fResponse = new TObjArray();
-        if(fResponse->At(module)!=0) delete fResponse->At(module);
-        fResponse->AddAt(resp,module);}
-    // Return the response model for a give detector type
-    virtual AliITSresponse* GetResponseModel(Int_t module){
-        if(fResponse==0) return 0; return fResponse->At(module);}
-
-    // Sorted hit info
-    virtual void InitModules(Int_t size,Int_t &nmodules);  
-    virtual void FillModules(TTree *treeH, Int_t mask = 0);
-    virtual void ClearModules(){if(fHitModule) fHitModule->Delete();};
-
-    // TClonesArray of Hits related functions
-    virtual void ResetHits(){fNhits=0;if(fHits!=0) fHits->Clear();}
-
-    // TClonesArray of SDigits related functions
     virtual void ResetSDigits(){fNSDigits=0;if(fSDigits!=0) fSDigits->Clear();}
-
-    // TClonesArray of SDigits related functions
-    virtual void ResetDigits(){fNDigits=0;if(fDigits!=0) fDigits->Clear();}
-
-  private:
-    AliITSgeom   *fGeom;         //
-    TObjArray    *fSimulation;   // [NDet]
-    TObjArray    *fSegmentation; // [NDet]
-    TObjArray    *fResponse;     // [NMod]
-    TObjArray    *fPreProcess;   // [] e.g. Fill fHitModule with hits
-    TObjArray    *fPostProcess;  // [] e.g. Wright Raw data
-    TObjArray    *fHitModule;    //! [NMod][Nhits]
-    Int_t         fNhits;        //! number of hits
-    TClonesArray *fHits;         //! Local pointer to hits
+    virtual void ResetDigits();
+    virtual void ResetDigits(Int_t branch);
+    virtual void SDigitsToDigits(Option_t *opt,Char_t* name);
+
+    virtual void AddSumDigit(AliITSpListItem &sdig);
+    virtual void AddRealDigit(Int_t branch, Int_t *digits);
+    virtual void AddSimDigit(Int_t branch, AliITSdigit *d);
+    virtual void AddSimDigit(Int_t branch,Float_t phys,Int_t* digits,
+                            Int_t* tracks,Int_t *hits,Float_t* trkcharges);
+
+    virtual void SetDigitClassName(Int_t i, Char_t* name) {fDigClassName[i]=name;}
+    Char_t* GetDigitClassName(Int_t i) const {return fDigClassName[i];}
+
+    void StoreCalibration(Int_t firstRun, Int_t lastRun, AliCDBMetaData &md);
+
+ protected:
+
+    virtual void CreateResponses(); 
+    virtual Bool_t GetCalibration();
+    
+ private:
+
+    static const Int_t fgkNdettypes;          // number of different det. types
+    static const Int_t fgkDefaultNModulesSPD; // Total numbers of SPD modules by default
+    static const Int_t fgkDefaultNModulesSDD; // Total numbers of SDD modules by default
+    static const Int_t fgkDefaultNModulesSSD; // Total numbers of SSD modules by default
+    Int_t fNMod[3];                           // numbers of modules from different types
+
+    AliITSgeom   *fGeom;         // pointer to ITS geom
+    TObjArray    *fSimulation;   //! [NDet]
+    TObjArray    *fSegmentation; //! [NDet]
+    TObjArray    *fResponse;     //! [NMod]
+    TObjArray    *fPreProcess;   //! [] e.g. Fill fHitModule with hits
+    TObjArray    *fPostProcess;  //! [] e.g. Wright Raw data
     Int_t         fNSDigits;     //! number of SDigits
     TClonesArray *fSDigits;      //! [NMod][NSDigits]
-    Int_t         fNDigits;      //! number of Digits
-    TClonesArray *fDigits;       //! [NMod][NDigits]
-    TString       fHitClassName; // String with Hit class name
-    TString       fSDigClassName;// String with SDigit class name.
-    TString       fDigClassName; // String with digit class name.
-
-    ClassDef(AliITSDetTypeSim,1) // ITS Simulation structure
-}
+    Int_t*        fNDigits;      //! [NDet] number of Digits for det.
+    Int_t         fRunNumber;    //! run number (to access DB)
+    TObjArray     *fDigits;       //! [NMod][NDigits]
+    TString       fHitClassName; //! String with Hit class name
+    TString       fSDigClassName;//! String with SDigit class name.
+    Char_t*       fDigClassName[3]; //! String with digit class name.
+    AliLoader* fLoader;        // loader  
+    
+  ClassDef(AliITSDetTypeSim,2) // ITS Simulation structure
+};
+
 #endif