]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - ITS/AliITS.cxx
Implementation of reconstructors (T.Kuhr)
[u/mrichter/AliRoot.git] / ITS / AliITS.cxx
index 368ffa985dae8cd4ef6bd3c7ccac459743a73b57..a009385f76b2efefbe6804ef01b2c7e40a0bd49d 100644 (file)
@@ -110,17 +110,31 @@ the AliITS class.
 #include "AliITSsimulationSSD.h"
 #include "AliMC.h"
 #include "AliITSDigitizer.h"
-#include "AliITSclustererV2.h"
-#include "AliITStrackerV2.h"
-#include "AliITSpidESD.h"
-#include "AliV0vertexer.h"
-#include "AliCascadeVertexer.h"
-#include "AliESD.h"
+#include "AliITSDDLRawData.h"
+#include "AliRun.h"
 
 ClassImp(AliITS)
 
 //______________________________________________________________________
-AliITS::AliITS() : AliDetector() {
+AliITS::AliITS() : AliDetector(),
+    fITSgeom(0),
+    fEuclidOut(0),
+    fITSmodules(0),
+    fOpt("All"),
+    fIdN(0),
+    fIdSens(0),
+    fIdName(0),
+    fNDetTypes(kNTYPES),
+    fDetTypes(0),
+    fSDigits(0),
+    fNSDigits(0),
+    fDtype(0),
+    fNdtype(0),
+    fCtype(0),
+    fNctype(0),
+    fRecPoints(0),
+    fNRecPoints(0),
+    fSelectedVertexer(0){
     // Default initializer for ITS
     //      The default constructor of the AliITS class. In addition to
     // creating the AliITS class it zeros the variables fIshunt (a member
@@ -137,35 +151,30 @@ AliITS::AliITS() : AliDetector() {
     fIshunt     = 0;   // not zeroed in AliDetector.
 
     // AliITS variables.
-    fEuclidOut  = 0;
-    fITSgeom    = 0;
-    fITSmodules = 0;
-    fOpt        = "All";
 //    SetDetectors(); // default to fOpt="All". This variable not written out.
-
-    fIdN        = 0;
-    fIdName     = 0;
-    fIdSens     = 0;
-
-    fNDetTypes  = kNTYPES;
-    fDetTypes   = 0;
-
-    fSDigits    = 0;
-    fNSDigits   = 0;
-
-    fNdtype     = 0;
-    fDtype      = 0;
-
-    fCtype      = 0;
-    fNctype     = 0;
-
-    fRecPoints  = 0;
-    fNRecPoints = 0;
-
     SetMarkerColor(kRed);
+    SelectVertexer(" ");
 }
 //______________________________________________________________________
-AliITS::AliITS(const char *name, const char *title):AliDetector(name,title){
+AliITS::AliITS(const char *name, const char *title):AliDetector(name,title),
+    fITSgeom(0),
+    fEuclidOut(0),
+    fITSmodules(0),
+    fOpt("All"),
+    fIdN(0),
+    fIdSens(0),
+    fIdName(0),
+    fNDetTypes(kNTYPES),
+    fDetTypes(0),
+    fSDigits(0),
+    fNSDigits(0),
+    fDtype(0),
+    fNdtype(0),
+    fCtype(0),
+    fNctype(0),
+    fRecPoints(0),
+    fNRecPoints(0),
+    fSelectedVertexer(0){
     //     The standard Constructor for the ITS class. In addition to 
     // creating the AliITS class, it allocates memory for the TClonesArrays 
     // fHits, fSDigits, fDigits, fITSpoints, and the TObjArray of fCtype 
@@ -187,7 +196,7 @@ AliITS::AliITS(const char *name, const char *title):AliDetector(name,title){
 
     fIshunt     = 0;  // not zeroed in AliDetector
     fHits       = new TClonesArray("AliITShit", 1560);//not done in AliDetector
-    gAlice->GetMCApp()->AddHitList(fHits);  // Not done in AliDetector.
+    if(gAlice->GetMCApp()) gAlice->GetMCApp()->AddHitList(fHits);// Not done in AliDetector.
 
     fEuclidOut  = 0;
     fITSgeom    = 0;
@@ -221,7 +230,7 @@ AliITS::AliITS(const char *name, const char *title):AliDetector(name,title){
     } // end for i
 
     SetMarkerColor(kRed);
-
+    SelectVertexer(" ");
 }
 //______________________________________________________________________
 AliITS::~AliITS(){
@@ -353,7 +362,7 @@ void AliITS::Init(){
 
     SetDefaults();
     // Array of TStrings
-    for(i=0;i<fIdN;i++) fIdSens[i] = gMC->VolId(fIdName[i]);
+    if(gMC) for(i=0;i<fIdN;i++) fIdSens[i] = gMC->VolId(fIdName[i]);
 }
 //______________________________________________________________________
 void AliITS::SetDefaults(){
@@ -1033,8 +1042,9 @@ void AliITS::SDigitsToDigits(Option_t *opt){
         iDetType = DetType(id);
         sim      = (AliITSsimulation*)iDetType->GetSimulationModel();
         if (!sim) {
-            Error("SDigit2Digits",
-                  "The simulation class was not instanciated!");
+            Error("SDigit2Digits","The simulation class was not "
+                  "instanciated for module %d type %s!",module,
+                  geom->GetModuleTypeName(module));
             exit(1);
         } // end if !sim
         sim->InitSimulationModule(module,gAlice->GetEvNumber());
@@ -1155,8 +1165,9 @@ void AliITS::HitsToPreDigits(Int_t evNumber,Int_t bgrev,Int_t size,
         iDetType = DetType(id);
         sim      = (AliITSsimulation*)iDetType->GetSimulationModel();
         if (!sim) {
-            Error("HitsToSDigits",
-                  "The simulation class was not instanciated!");
+            Error("HitsToSDigits","The simulation class was not "
+                  "instanciated for module %d type %s!",module,
+                  geom->GetModuleTypeName(module));
             exit(1);
         } // end if !sim
         mod      = (AliITSmodule *)fITSmodules->At(module);
@@ -1219,8 +1230,9 @@ void AliITS::HitsToDigits(Int_t evNumber,Int_t bgrev,Int_t size,
         iDetType = DetType(id);
         sim      = (AliITSsimulation*)iDetType->GetSimulationModel();
         if (!sim) {
-            Error("HitsToDigits",
-                  "The simulation class was not instanciated!");
+            Error("HitsToDigits","The simulation class was not "
+                  "instanciated for module %d type %s!",module,
+                  geom->GetModuleTypeName(module));
             exit(1);
         } // end if !sim
         mod      = (AliITSmodule *)fITSmodules->At(module);
@@ -1367,6 +1379,46 @@ void AliITS::AddSimDigit(Int_t id,Float_t phys,Int_t *digits,Int_t *tracks,
     break;
   } // end switch id
 }
+
+//______________________________________________________________________
+void AliITS::Digits2Raw()
+{
+// convert digits of the current event to raw data
+
+  fLoader->LoadDigits();
+  TTree* digits = fLoader->TreeD();
+  if (!digits) {
+    Error("Digits2Raw", "no digits tree");
+    return;
+  }
+  SetTreeAddressD(digits);
+
+  AliITSDDLRawData rawWriter;
+  //Verbose level
+  // 0: Silent
+  // 1: cout messages
+  // 2: txt files with digits 
+  //BE CAREFUL, verbose level 2 MUST be used only for debugging and
+  //it is highly suggested to use this mode only for debugging digits files
+  //reasonably small, because otherwise the size of the txt files can reach
+  //quickly several MB wasting time and disk space.
+  rawWriter.SetVerbose(0);
+    
+  //SILICON PIXEL DETECTOR
+  Info("Digits2Raw", "Formatting raw data for SPD");
+  rawWriter.RawDataSPD(digits->GetBranch("ITSDigitsSPD"));
+    
+  //SILICON DRIFT DETECTOR
+  Info("Digits2Raw", "Formatting raw data for SDD");
+  rawWriter.RawDataSDD(digits->GetBranch("ITSDigitsSDD"));
+    
+  //SILICON STRIP DETECTOR
+  Info("Digits2Raw", "Formatting raw data for SSD");
+  rawWriter.RawDataSSD(digits->GetBranch("ITSDigitsSSD"));
+
+  fLoader->UnloadDigits();
+}
+
 //______________________________________________________________________
 void AliITS::MakeTreeC(Option_t *option){
   //   Create a separate tree to store the clusters.
@@ -1645,15 +1697,16 @@ void AliITS::HitsToFastRecPoints(Int_t evNumber,Int_t bgrev,Int_t size,
     
     cout<<"HitsToFastRecPoints: N mod = "<<geom->GetIndexMax()<<endl;
     
-    for(module=0;module<geom->GetIndexMax();module++)
-     {
+    for(module=0;module<geom->GetIndexMax();module++){
         id       = geom->GetModuleType(module);
         if (!all && !det[id]) continue;
         iDetType = DetType(id);
         sim      = (AliITSsimulation*)iDetType->GetSimulationModel();
         if (!sim) 
          {
-           Error("HitsToFastPoints","The simulation class was not instanciated!");
+           Error("HitsToFastPoints","The simulation class was not "
+                 "instanciated for module %d type %x!",module,
+                 geom->GetModuleTypeName(module));
            exit(1);
          } // end if !sim
         mod      = (AliITSmodule *)fITSmodules->At(module);
@@ -1770,86 +1823,3 @@ AliLoader* AliITS::MakeLoader(const char* topfoldername)
   return fLoader;
 }
 
-
-//_____________________________________________________________________________
-void AliITS::Reconstruct() const
-{
-// reconstruct clusters
-
-  AliLoader* loader = GetLoader();
-  loader->LoadRecPoints("recreate");
-  loader->LoadDigits("read");
-
-  AliITSclustererV2 clusterer(GetITSgeom());
-  AliRunLoader* runLoader = loader->GetRunLoader();
-  Int_t nEvents = runLoader->GetNumberOfEvents();
-
-  for (Int_t iEvent = 0; iEvent < nEvents; iEvent++) {
-    runLoader->GetEvent(iEvent);
-
-    TTree* treeClusters = loader->TreeR();
-    if (!treeClusters) {
-      loader->MakeTree("R");
-      treeClusters = loader->TreeR();
-    }
-    TTree* treeDigits = loader->TreeD();
-    if (!treeDigits) {
-      Error("Reconstruct", "Can't get digits tree !");
-      return;
-    }
-
-    clusterer.Digits2Clusters(treeDigits, treeClusters);
-         
-    loader->WriteRecPoints("OVERWRITE");
-  }
-
-  loader->UnloadRecPoints();
-  loader->UnloadDigits();
-}
-
-//_____________________________________________________________________________
-AliTracker* AliITS::CreateTracker() const
-{
-// create an ITS tracker
-
-  return new AliITStrackerV2(GetITSgeom());
-}
-
-//_____________________________________________________________________________
-void AliITS::FillESD(AliESD* esd) const
-{
-// make PID, find V0s and cascades
-
-  Double_t parITS[] = {34., 0.15, 10.};
-  AliITSpidESD itsPID(parITS);
-  itsPID.MakePID(esd);
-
-  // V0 finding
-  Double_t cuts[]={33,  // max. allowed chi2
-                  0.16,// min. allowed negative daughter's impact parameter 
-                  0.05,// min. allowed positive daughter's impact parameter 
-                  0.080,// max. allowed DCA between the daughter tracks
-                  0.998,// max. allowed cosine of V0's pointing angle
-                  0.9,  // min. radius of the fiducial volume
-                  2.9   // max. radius of the fiducial volume
-  };
-  AliV0vertexer vtxer(cuts);
-  Double_t vtx[3], cvtx[6];
-  esd->GetVertex(vtx, cvtx);
-  vtxer.SetVertex(vtx);
-  vtxer.Tracks2V0vertices(esd);
-
-  // cascade finding
-  Double_t cts[]={33.,    // max. allowed chi2
-                 0.05,   // min. allowed V0 impact parameter 
-                 0.008,  // window around the Lambda mass 
-                 0.035,  // min. allowed bachelor's impact parameter 
-                 0.10,   // max. allowed DCA between a V0 and a track
-                 0.9985, //max. allowed cosine of the cascade pointing angle
-                 0.9,    // min. radius of the fiducial volume
-                 2.9     // max. radius of the fiducial volume
-  };
-  AliCascadeVertexer cvtxer=AliCascadeVertexer(cts);
-  cvtxer.V0sTracks2CascadeVertices(esd);
-}
-