]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - ITS/AliITS.cxx
Fast generator for prompt photons (Serguei Kiselev)
[u/mrichter/AliRoot.git] / ITS / AliITS.cxx
index 22067d99a39716e7619b2abae4747bee5b252b35..72636bd63b4d562af0af9ce9c05ecdbfd663ce56 100644 (file)
@@ -91,7 +91,6 @@ the AliITS class.
 #include "AliITSRawStreamSPD.h"
 #include "AliITSRawStreamSSD.h"
 #include "AliITSRawStreamSDD.h"
-#include "AliITSresponseSDD.h" 
 #include "AliRawReader.h"
 #include "AliRun.h"
 #include "AliLog.h"
@@ -107,7 +106,8 @@ fOpt("All"),
 fIdN(0),
 fIdSens(0),
 fIdName(0),
-fITSmodules(0)
+fITSmodules(0),
+fTiming(kFALSE)
 {
   // Default initializer for ITS
   //      The default constructor of the AliITS class. In addition to
@@ -120,6 +120,42 @@ fITSmodules(0)
 //PH    SetMarkerColor(kRed);
 }
 //______________________________________________________________________
+AliITS::AliITS(const Char_t *title):AliDetector("ITS",title),
+fDetTypeSim(0),
+fEuclidOut(0),
+fOpt("All"),
+fIdN(0),
+fIdSens(0),
+fIdName(0),
+fITSmodules(0),
+fTiming(kFALSE)
+{
+    //     The standard Constructor for the ITS class. 
+    // It also zeros the variables
+    // fIshunt (a member of AliDetector class), fEuclidOut, and zeros
+    // the pointers fIdSens and fIdName. To help in displaying hits via the
+    // ROOT macro display.C AliITS also sets the marker color to red. The
+    // variables passes with this constructor, const char *name and *title,
+    // are used by the constructor of AliDetector class. See AliDetector
+    // class for a description of these parameters and its constructor
+    // functions.
+    // Inputs:
+    //   Char_t *title  Simulation title for the ITS
+    // Outputs:
+    //   none.
+    // Return:
+    //   none.
+  
+    fHits = new TClonesArray("AliITShit",1560); // from AliDetector
+    if(gAlice->GetMCApp()) gAlice->GetMCApp()->AddHitList(fHits);
+    //fNhits=0;  //done in AliDetector(name,title)
+    SetDetectors(); // default to fOpt="All". This variable not written out.
+    fDetTypeSim   = new AliITSDetTypeSim();
+    //PH  SetMarkerColor(kRed);
+    if(!fLoader) MakeLoader(AliConfig::GetDefaultEventFolderName());
+    fDetTypeSim->SetLoader((AliITSLoader*)fLoader);
+}
+//______________________________________________________________________
 AliITS::AliITS(const char *name, const char *title):AliDetector(name,title),
 fDetTypeSim(0),
 fEuclidOut(0),
@@ -127,7 +163,8 @@ fOpt("All"),
 fIdN(0),
 fIdSens(0),
 fIdName(0),
-fITSmodules(0)
+fITSmodules(0),
+fTiming(kFALSE)
 {
   //     The standard Constructor for the ITS class. 
   // It also zeros the variables
@@ -213,8 +250,6 @@ void AliITS::Init(){
     // Return:
     //      none.
     Int_t i;
-
-    SetDefaults();
     // Array of TStrings
     if(gMC) for(i=0;i<fIdN;i++) fIdSens[i] = gMC->VolId(fIdName[i]);
  
@@ -231,7 +266,6 @@ void AliITS::SetDefaults(){
     // Return:
     //      none.
     AliInfoClass("AliITS::Setting Defaults");
-
     if(!fDetTypeSim) { 
      Error("SetDefaults()","fDetTypeSim is 0!"); 
      return;
@@ -310,7 +344,6 @@ void AliITS::MakeBranchS(const char* fl){
   sprintf(branchname,"%s",GetName());
 
   if(fLoader->TreeS()){
-    if(fDetTypeSim->GetSDigits()==0x0) fDetTypeSim->SetSDigits(new TClonesArray("AliITSpListItem",1000));
     TClonesArray* sdig = (TClonesArray*)fDetTypeSim->GetSDigits();
     MakeBranchInTree(fLoader->TreeS(),branchname,&sdig,buffersize,fl);
   } 
@@ -337,7 +370,7 @@ void AliITS:: MakeBranchInTreeD(TTree* treeD, const char* file){
   fDetTypeSim->SetLoader((AliITSLoader*)fLoader);
 
   const Char_t *det[3] = {"SPD","SDD","SSD"};
-  Char_t* digclass;
+  const Char_t* digclass;
   Int_t buffersize = 4000;
   Char_t branchname[30];
   
@@ -503,7 +536,7 @@ void AliITS::FillModules(TTree *treeH, Int_t mask) {
 }
 
 //______________________________________________________________________
-void AliITS::InitModules(Int_t size,Int_t &nmodules){
+Bool_t AliITS::InitModules(Int_t size,Int_t &nmodules){
     // Initialize the modules array.
     // Inputs:
     //      Int_t size  Size of array of the number of modules to be
@@ -521,7 +554,7 @@ void AliITS::InitModules(Int_t size,Int_t &nmodules){
 
     if(!fDetTypeSim) {
       Error("InitModules","fDetTypeSim is null!");
-      return;
+      return kFALSE;
     }
 
     Int_t nl,indexMAX,index;
@@ -529,7 +562,7 @@ void AliITS::InitModules(Int_t size,Int_t &nmodules){
     if(size<=0){ // default to using data stored in AliITSgeom
         if(fDetTypeSim->GetITSgeom()==0) {
             Error("InitModules","fITSgeom not defined");
-            return;
+            return kFALSE;
         } // end if fITSgeom==0
         nl = fDetTypeSim->GetITSgeom()->GetNlayers();
         indexMAX = fDetTypeSim->GetITSgeom()->GetIndexMax();
@@ -546,6 +579,7 @@ void AliITS::InitModules(Int_t size,Int_t &nmodules){
 
         nmodules = size;
     } // end i size<=0
+    return kTRUE;
 }
 //______________________________________________________________________
 void AliITS::Hits2SDigits(){
@@ -976,25 +1010,6 @@ void AliITS::AddSumDigit(AliITSpListItem &sdig){
     }
     fDetTypeSim->AddSumDigit(sdig);
     
-}
-//______________________________________________________________________
-void AliITS::AddRealDigit(Int_t branch, Int_t *digits){
-    //   Add a real digit - as coming from data.
-    // Inputs:
-    //      Int_t id        Detector type number.
-    //      Int_t *digits   Integer array containing the digits info. See 
-    //                      AliITSdigit.h
-    // Outputs:
-    //      none.
-    // Return:
-    //      none.
-
-    if(!fDetTypeSim) {
-      Error("AddRealDigit","fDetTypeSim is 0!");
-      return;
-    }
-    fDetTypeSim->AddRealDigit(branch,digits);
-
 }
 //______________________________________________________________________
 void AliITS::AddSimDigit(Int_t branch, AliITSdigit *d){
@@ -1017,7 +1032,7 @@ void AliITS::AddSimDigit(Int_t branch, AliITSdigit *d){
 }
 //______________________________________________________________________
 void AliITS::AddSimDigit(Int_t branch,Float_t phys,Int_t *digits,Int_t *tracks,
-                         Int_t *hits,Float_t *charges){
+                         Int_t *hits,Float_t *charges, Int_t sigexpanded){
   //   Add a simulated digit to the list.
   // Inputs:
   //      Int_t id        Detector type number.
@@ -1041,7 +1056,7 @@ void AliITS::AddSimDigit(Int_t branch,Float_t phys,Int_t *digits,Int_t *tracks,
       Error("AddSimDigit","fDetTypeSim is 0!");
       return;
     }
-    fDetTypeSim->AddSimDigit(branch,phys,digits,tracks,hits,charges);
+    fDetTypeSim->AddSimDigit(branch,phys,digits,tracks,hits,charges,sigexpanded);
 
 }
 //______________________________________________________________________
@@ -1061,8 +1076,11 @@ void AliITS::Digits2Raw(){
       return;
   }
   fDetTypeSim->SetTreeAddressD(digits,(Char_t*)GetName());
-
+  AliITSDDLModuleMapSDD* ddlsdd=fDetTypeSim->GetDDLModuleMapSDD();
+  Bool_t isHLTmodeC=fDetTypeSim->IsHLTmodeC();
   AliITSDDLRawData rawWriter;
+  if(isHLTmodeC) rawWriter.SetUseCompressedSDDFormat(kTRUE);
+  else rawWriter.SetUseCompressedSDDFormat(kFALSE);
   //Verbose level
   // 0: Silent
   // 1: cout messages
@@ -1079,7 +1097,7 @@ void AliITS::Digits2Raw(){
     
   //SILICON DRIFT DETECTOR
   Info("Digits2Raw", "Formatting raw data for SDD");
-  rawWriter.RawDataSDD(digits->GetBranch("ITSDigitsSDD"));
+  rawWriter.RawDataSDD(digits->GetBranch("ITSDigitsSDD"),ddlsdd);
     
   //SILICON STRIP DETECTOR
   Info("Digits2Raw", "Formatting raw data for SSD");
@@ -1110,7 +1128,7 @@ Bool_t AliITS::Raw2SDigits(AliRawReader* rawReader)
     TClonesArray** modA = new TClonesArray*[size];
     for (Int_t mod = 0; mod < size; mod++) modA[mod] = new TClonesArray("AliITSpListItem", 10000);
     
-    AliLoader* loader =  (gAlice->GetRunLoader())->GetLoader("ITSLoader");
+    AliLoader* loader =  (AliRunLoader::Instance())->GetLoader("ITSLoader");
     if (!loader)
     {
        Error("Open","Can not get ITS loader from Run Loader");
@@ -1135,6 +1153,11 @@ Bool_t AliITS::Raw2SDigits(AliRawReader* rawReader)
     // SPD
     //
     AliITSsegmentationSPD* segSPD = (AliITSsegmentationSPD*) fDetTypeSim->GetSegmentationModel(0);
+    if(!segSPD){
+      AliWarning("Set AliITS defaults");
+      SetDefaults();
+      segSPD = (AliITSsegmentationSPD*) fDetTypeSim->GetSegmentationModel(0);
+    }
     npx = segSPD->Npx();
     Double_t thr, sigma; 
     
@@ -1152,7 +1175,7 @@ Bool_t AliITS::Raw2SDigits(AliRawReader* rawReader)
  
        last = (modA[module])->GetEntries();
        TClonesArray& dum = *modA[module];
-       fDetTypeSim->GetCalibrationModel(module)->Thresholds(thr,sigma);
+       fDetTypeSim->GetSimuParam()->SPDThresholds(module,thr,sigma);
        thr += 1.;
        new (dum[last]) AliITSpListItem(-1, -1, module, index, thr);
     }
@@ -1164,6 +1187,8 @@ Bool_t AliITS::Raw2SDigits(AliRawReader* rawReader)
     AliITSsegmentationSDD* segSDD = (AliITSsegmentationSDD*) fDetTypeSim->GetSegmentationModel(1);
     npx = segSDD->Npx();
     AliITSRawStreamSDD inputSDD(rawReader);
+    AliITSDDLModuleMapSDD* ddlmap=fDetTypeSim->GetDDLModuleMapSDD();
+    inputSDD.SetDDLModuleMap(ddlmap);
     while(1){
        Bool_t next  = inputSDD.Next();
        if (!next) break;
@@ -1171,14 +1196,10 @@ Bool_t AliITS::Raw2SDigits(AliRawReader* rawReader)
        Int_t module = inputSDD.GetModuleID();
        Int_t anode  = inputSDD.GetAnode();
        Int_t time   = inputSDD.GetTime();
-       Int_t signal = inputSDD.GetSignal();
+       Int_t signal10 = inputSDD.GetSignal();
        Int_t index  = npx * anode + time;
 
        if (module >= size) continue;
-       // 8bit -> 10 bit
-       AliITSresponseSDD *resSDD = (AliITSresponseSDD*) fDetTypeSim->GetResponse(1);
-       Int_t signal10 = resSDD->Convert8to10(signal);  // signal is a 8 bit value (if the compression is active)
-       
        last = modA[module]->GetEntries();
        TClonesArray& dum = *modA[module];
        new (dum[last]) AliITSpListItem(-1, -1, module, index, Double_t(signal10));
@@ -1239,9 +1260,13 @@ Bool_t AliITS::Raw2SDigits(AliRawReader* rawReader)
 void AliITS::UpdateInternalGeometry(){
 
   //reads new geometry from TGeo 
-  AliDebug(1,"Delete ITSgeom and create a new one reading TGeo");
-  AliITSInitGeometry initgeom("AliITSvPPRasymmFMD",2);
-  AliITSgeom* geom = initgeom.CreateAliITSgeom();
+//   AliDebug(1,"Delete ITSgeom and create a new one reading TGeo");
+
+  AliITSVersion_t version = (AliITSVersion_t)IsVersion();
+  Int_t minor = 0;
+  if(version==kvPPRasymmFMD) minor=2;  // default minor version for this geom.
+  AliITSInitGeometry initgeom;
+  AliITSgeom* geom = initgeom.CreateAliITSgeom(version,minor);
   SetITSgeom(geom);
 }